|
|
|
@ -0,0 +1,467 @@
|
|
|
|
|
<template>
|
|
|
|
|
<div>
|
|
|
|
|
<a-card :bordered="false" :bodyStyle="tstyle">
|
|
|
|
|
<div
|
|
|
|
|
class="table-page-search-wrapper"
|
|
|
|
|
v-if="hasPerm('BookingTemplate:page')"
|
|
|
|
|
:class="advanced ? 'Open' : 'Close'"
|
|
|
|
|
>
|
|
|
|
|
<a-form layout="inline">
|
|
|
|
|
<a-row :gutter="48">
|
|
|
|
|
<a-col :md="18">
|
|
|
|
|
<a-row :gutter="48">
|
|
|
|
|
<a-col :md="6" :sm="24" v-for="item in ColumnsQuery" :key="`${item.dataIndex}1`" v-show="item.checked">
|
|
|
|
|
<a-form-item :label="item.title">
|
|
|
|
|
<a-input v-model="queryParam[item.dataIndex]" allow-clear :placeholder="`请输入${item.title}`" />
|
|
|
|
|
</a-form-item>
|
|
|
|
|
</a-col>
|
|
|
|
|
<a-col :md="6" :sm="24">
|
|
|
|
|
<a-form-item label="分类">
|
|
|
|
|
<a-select
|
|
|
|
|
v-model="queryParam.cateCode"
|
|
|
|
|
style="width: 100%"
|
|
|
|
|
placeholder="请选择分类"
|
|
|
|
|
mode="multiple"
|
|
|
|
|
allow-clear
|
|
|
|
|
>
|
|
|
|
|
<a-select-option v-for="item in CateData" :key="item.id" :value="item.code">
|
|
|
|
|
{{ item.name }}
|
|
|
|
|
</a-select-option>
|
|
|
|
|
</a-select>
|
|
|
|
|
</a-form-item>
|
|
|
|
|
</a-col>
|
|
|
|
|
<a-col :md="6" :sm="24">
|
|
|
|
|
<a-form-item label="模板类型">
|
|
|
|
|
<a-select v-model="queryParam.type" style="width: 100%" placeholder="请选择模板类型" allow-clear>
|
|
|
|
|
<a-select-option value="FastReport">
|
|
|
|
|
FastReport
|
|
|
|
|
</a-select-option>
|
|
|
|
|
<a-select-option value="ExcelTemplate">
|
|
|
|
|
Excel模板
|
|
|
|
|
</a-select-option>
|
|
|
|
|
</a-select>
|
|
|
|
|
</a-form-item>
|
|
|
|
|
</a-col>
|
|
|
|
|
</a-row>
|
|
|
|
|
</a-col>
|
|
|
|
|
<a-col :md="4" :sm="24">
|
|
|
|
|
<span class="table-page-search-submitButtons">
|
|
|
|
|
<a-button type="primary" @click="FnGetData">查询</a-button>
|
|
|
|
|
<a-button style="margin-left: 8px" @click="init">重置</a-button>
|
|
|
|
|
<!-- <a @click="toggleAdvanced" style="margin-left: 8px">
|
|
|
|
|
{{ advanced ? '收起' : '展开' }}
|
|
|
|
|
<a-icon :type="advanced ? 'up' : 'down'" />
|
|
|
|
|
</a> -->
|
|
|
|
|
</span>
|
|
|
|
|
</a-col>
|
|
|
|
|
<a-col :md="2" :sm="24" class="SetFlex">
|
|
|
|
|
<a-popover placement="bottom" v-model="setVisible" trigger="click">
|
|
|
|
|
<template #content>
|
|
|
|
|
<columnSetting :columns="ColumnsQuery" @columnChange="columnChange"></columnSetting>
|
|
|
|
|
</template>
|
|
|
|
|
<span class="tab-btn"> <a-icon type="setting" :style="{ fontSize: '16px' }" /> 设置 </span>
|
|
|
|
|
</a-popover>
|
|
|
|
|
</a-col>
|
|
|
|
|
</a-row>
|
|
|
|
|
</a-form>
|
|
|
|
|
</div>
|
|
|
|
|
</a-card>
|
|
|
|
|
<a-card :bordered="false">
|
|
|
|
|
<vxe-toolbar>
|
|
|
|
|
<template #buttons>
|
|
|
|
|
<a-button type="primary" icon="plus" @click="$refs.addForm.add()">
|
|
|
|
|
新增订舱打印模板
|
|
|
|
|
</a-button>
|
|
|
|
|
</template>
|
|
|
|
|
<template #tools>
|
|
|
|
|
<div class="right">
|
|
|
|
|
<a-popover placement="bottom" v-model="setVisible1" trigger="click">
|
|
|
|
|
<template #content>
|
|
|
|
|
<columnSetting :columns="TableColumns" @columnChange="columnChange1"></columnSetting>
|
|
|
|
|
</template>
|
|
|
|
|
<span class="tab-btn"> <a-icon type="setting" :style="{ fontSize: '16px' }" /> 设置 </span>
|
|
|
|
|
</a-popover>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
</vxe-toolbar>
|
|
|
|
|
<vxe-table :data="loadData" border :loading="loading" empty-text="没有更多数据了!" v-if="!TableType">
|
|
|
|
|
<vxe-column type="seq" width="40" fixed="left"></vxe-column>
|
|
|
|
|
<vxe-column
|
|
|
|
|
v-for="item in TableColumns"
|
|
|
|
|
:key="`${item.dataIndex}3`"
|
|
|
|
|
:field="item.dataIndex"
|
|
|
|
|
:min-width="item.width"
|
|
|
|
|
:title="item.title"
|
|
|
|
|
:align="item.align"
|
|
|
|
|
v-if="item.checked"
|
|
|
|
|
>
|
|
|
|
|
<template #default="{ row }" v-if="item.title == '文件名称'">
|
|
|
|
|
<a @click="FnDFile(row)">{{ row.fileName }}</a>
|
|
|
|
|
</template>
|
|
|
|
|
</vxe-column>
|
|
|
|
|
<vxe-column title="类型" width="200" align="center">
|
|
|
|
|
<template #default="{ row }">
|
|
|
|
|
{{ row.cateName }}
|
|
|
|
|
</template>
|
|
|
|
|
</vxe-column>
|
|
|
|
|
<vxe-column title="模板类型" width="200" align="center">
|
|
|
|
|
<template #default="{ row }">
|
|
|
|
|
{{ RMain(row) }}
|
|
|
|
|
</template>
|
|
|
|
|
</vxe-column>
|
|
|
|
|
<vxe-column title="操作" fixed="right" width="250" align="center">
|
|
|
|
|
<template #default="{ row }">
|
|
|
|
|
<vxe-button type="text" v-if="row.type == 'ExcelTemplate'" @click="FnExcel(row)">详细设置</vxe-button>
|
|
|
|
|
<vxe-button type="text" @click="$refs.editForm.edit(row)">编辑</vxe-button>
|
|
|
|
|
<a-popconfirm
|
|
|
|
|
title="请确认删除?"
|
|
|
|
|
ok-text="是"
|
|
|
|
|
cancel-text="否"
|
|
|
|
|
@confirm="
|
|
|
|
|
e => {
|
|
|
|
|
confirm(e, row)
|
|
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
>
|
|
|
|
|
<vxe-button type="text">删除</vxe-button>
|
|
|
|
|
</a-popconfirm>
|
|
|
|
|
</template>
|
|
|
|
|
</vxe-column>
|
|
|
|
|
</vxe-table>
|
|
|
|
|
<vxe-pager
|
|
|
|
|
:loading="loading"
|
|
|
|
|
:current-page="queryParam.currentPage"
|
|
|
|
|
:page-size="queryParam.pageSize"
|
|
|
|
|
:total="queryParam.totalResult"
|
|
|
|
|
:layouts="['PrevPage', 'JumpNumber', 'NextPage', 'FullJump', 'Sizes', 'Total']"
|
|
|
|
|
@page-change="handlePageChange"
|
|
|
|
|
>
|
|
|
|
|
</vxe-pager>
|
|
|
|
|
<add-form ref="addForm" @ok="handleOk" />
|
|
|
|
|
<edit-form ref="editForm" @ok="handleOk" />
|
|
|
|
|
</a-card>
|
|
|
|
|
<a-modal v-model="ExcelVisible" width="800px" title="详细设置">
|
|
|
|
|
<vxe-toolbar>
|
|
|
|
|
<template #buttons>
|
|
|
|
|
<vxe-button @click="insertEvent(-1)">添加一行</vxe-button>
|
|
|
|
|
<vxe-button @click="$refs.xTable.removeCheckboxRow()">删除选中</vxe-button>
|
|
|
|
|
<vxe-button icon="vxe-icon-save" @click="saveEvent">保存</vxe-button>
|
|
|
|
|
</template>
|
|
|
|
|
</vxe-toolbar>
|
|
|
|
|
|
|
|
|
|
<vxe-table
|
|
|
|
|
border
|
|
|
|
|
show-overflow
|
|
|
|
|
keep-source
|
|
|
|
|
ref="xTable"
|
|
|
|
|
max-height="600"
|
|
|
|
|
:data="tableData"
|
|
|
|
|
:edit-config="{ trigger: 'click', mode: 'row', icon: 'vxe-icon-edit', showStatus: true }"
|
|
|
|
|
>
|
|
|
|
|
<vxe-column type="checkbox" width="60"></vxe-column>
|
|
|
|
|
<vxe-column field="field" title="字段名称" :edit-render="{}">
|
|
|
|
|
<template #edit="{ row }">
|
|
|
|
|
<vxe-input v-model="row.field" type="text"></vxe-input>
|
|
|
|
|
</template>
|
|
|
|
|
</vxe-column>
|
|
|
|
|
<vxe-column field="row" title="行" :edit-render="{}">
|
|
|
|
|
<template #edit="{ row }">
|
|
|
|
|
<vxe-input v-model="row.row" type="number"></vxe-input>
|
|
|
|
|
</template>
|
|
|
|
|
</vxe-column>
|
|
|
|
|
<vxe-column field="column" title="列" :edit-render="{}">
|
|
|
|
|
<template #edit="{ row }">
|
|
|
|
|
<vxe-input v-model="row.column" type="number"></vxe-input>
|
|
|
|
|
</template>
|
|
|
|
|
</vxe-column>
|
|
|
|
|
<vxe-column field="describe" title="固定内容" width="300" :edit-render="{}">
|
|
|
|
|
<template #edit="{ row }">
|
|
|
|
|
<vxe-input v-model="row.describe" type="text"></vxe-input>
|
|
|
|
|
</template>
|
|
|
|
|
</vxe-column>
|
|
|
|
|
</vxe-table>
|
|
|
|
|
<template slot="footer"> <span></span> </template>
|
|
|
|
|
</a-modal>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
<script>
|
|
|
|
|
import {
|
|
|
|
|
BookingPrintTemplatePage,
|
|
|
|
|
BookingPrintTemplateDelete,
|
|
|
|
|
BookingPrintTemplateDownload,
|
|
|
|
|
BookingTemplateAddOrUpdateExcelTemplate,
|
|
|
|
|
BookingTemplateBookingExcelTemplateList
|
|
|
|
|
} from '@/api/modular/main/bookingprinttemplateNew'
|
|
|
|
|
import { DjyCustomerGet, DjyUserConfigAdd } from '@/api/modular/main/CustomerInformationManagement'
|
|
|
|
|
import addForm from './addForm.vue'
|
|
|
|
|
import editForm from './editForm.vue'
|
|
|
|
|
import columnSetting from '@/components/tableColumnSetting'
|
|
|
|
|
const columns = [
|
|
|
|
|
// {
|
|
|
|
|
// title: '类型',
|
|
|
|
|
// align: 'center',
|
|
|
|
|
// dataIndex: 'CateName'
|
|
|
|
|
// },
|
|
|
|
|
{
|
|
|
|
|
title: '租户名称',
|
|
|
|
|
align: 'center',
|
|
|
|
|
dataIndex: 'tenantName'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '文件名称',
|
|
|
|
|
align: 'center',
|
|
|
|
|
dataIndex: 'fileName'
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
export default {
|
|
|
|
|
components: {
|
|
|
|
|
addForm,
|
|
|
|
|
editForm,
|
|
|
|
|
columnSetting
|
|
|
|
|
},
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
tableData: [],
|
|
|
|
|
ExcelVisible: false,
|
|
|
|
|
// 高级搜索 展开/关闭
|
|
|
|
|
TableType: false,
|
|
|
|
|
advanced: false,
|
|
|
|
|
loading: false,
|
|
|
|
|
setVisible: false,
|
|
|
|
|
setVisible1: false,
|
|
|
|
|
queryParam: {
|
|
|
|
|
currentPage: 1,
|
|
|
|
|
pageSize: 10,
|
|
|
|
|
totalResult: 1
|
|
|
|
|
},
|
|
|
|
|
ColumnsQuery: [],
|
|
|
|
|
TableColumns: [],
|
|
|
|
|
tstyle: { 'padding-bottom': '0px', 'margin-bottom': '10px' },
|
|
|
|
|
// 加载数据方法 必须为 Promise 对象
|
|
|
|
|
loadData: [],
|
|
|
|
|
ExcelPid: ''
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
created() {
|
|
|
|
|
this.CateData = this.$options.filters['dictData']('booking_template_category')
|
|
|
|
|
console.log(this.CateData, 111111111111)
|
|
|
|
|
},
|
|
|
|
|
mounted() {
|
|
|
|
|
this.init()
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
saveEvent() {
|
|
|
|
|
const $table = this.$refs.xTable
|
|
|
|
|
const { insertRecords } = $table.getRecordset()
|
|
|
|
|
BookingTemplateAddOrUpdateExcelTemplate({
|
|
|
|
|
pid: this.ExcelPid,
|
|
|
|
|
children: insertRecords
|
|
|
|
|
}).then(res => {
|
|
|
|
|
console.log(res)
|
|
|
|
|
})
|
|
|
|
|
console.log(insertRecords)
|
|
|
|
|
},
|
|
|
|
|
async insertEvent(row) {
|
|
|
|
|
const $table = this.$refs.xTable
|
|
|
|
|
const { row: newRow } = await $table.insertAt({}, row)
|
|
|
|
|
await $table.setActiveCell(newRow, 'name')
|
|
|
|
|
},
|
|
|
|
|
FnExcel(data) {
|
|
|
|
|
this.ExcelPid = data.id
|
|
|
|
|
BookingTemplateBookingExcelTemplateList({ id: this.ExcelPid }).then(res => {
|
|
|
|
|
this.tableData = res.data
|
|
|
|
|
})
|
|
|
|
|
this.ExcelVisible = true
|
|
|
|
|
},
|
|
|
|
|
RMain(data) {
|
|
|
|
|
let Text = ''
|
|
|
|
|
if (data.type == 'FastReport') {
|
|
|
|
|
Text = 'FastReport'
|
|
|
|
|
} else if (data.type == 'ExcelTemplate') {
|
|
|
|
|
Text = 'Excel模板'
|
|
|
|
|
} else {
|
|
|
|
|
Text = '-'
|
|
|
|
|
}
|
|
|
|
|
return Text
|
|
|
|
|
},
|
|
|
|
|
FnDFile(Data) {
|
|
|
|
|
BookingPrintTemplateDownload({ id: Data.id }).then(res => {
|
|
|
|
|
const blob = res
|
|
|
|
|
let link = document.createElement('a')
|
|
|
|
|
link.href = URL.createObjectURL(new Blob([blob], { type: 'application/vnd.ms-excel' }))
|
|
|
|
|
link.download = Data.fileName
|
|
|
|
|
document.body.appendChild(link)
|
|
|
|
|
link.click()
|
|
|
|
|
URL.revokeObjectURL(link.href)
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
columnChange(data) {
|
|
|
|
|
this.ColumnsQuery = [...data]
|
|
|
|
|
let Data = []
|
|
|
|
|
data.forEach(item => {
|
|
|
|
|
if (item.checked) {
|
|
|
|
|
Data.push(item.dataIndex)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
DjyUserConfigAdd({
|
|
|
|
|
type: 'printing_cond_cfg',
|
|
|
|
|
configJson: JSON.stringify(Data)
|
|
|
|
|
}).then(res => {
|
|
|
|
|
console.log(res)
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
columnChange1(data) {
|
|
|
|
|
this.TableType = true
|
|
|
|
|
this.TableColumns = data
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
this.TableType = false
|
|
|
|
|
})
|
|
|
|
|
let Data = []
|
|
|
|
|
data.forEach(item => {
|
|
|
|
|
if (item.checked) {
|
|
|
|
|
Data.push(item.dataIndex)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
DjyUserConfigAdd({
|
|
|
|
|
type: 'printing_list_col',
|
|
|
|
|
configJson: JSON.stringify(Data)
|
|
|
|
|
}).then(res => {
|
|
|
|
|
console.log(res)
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
toggleAdvanced() {
|
|
|
|
|
this.advanced = !this.advanced
|
|
|
|
|
},
|
|
|
|
|
init() {
|
|
|
|
|
Object.assign(this.$data, this.$options.data())
|
|
|
|
|
columns.forEach(item => {
|
|
|
|
|
item.checked = true
|
|
|
|
|
})
|
|
|
|
|
columns.forEach(item => {
|
|
|
|
|
this.ColumnsQuery.push({ ...item, checked: true })
|
|
|
|
|
})
|
|
|
|
|
DjyCustomerGet({ type: 'printing_list_col' }).then(res => {
|
|
|
|
|
if (res.data && JSON.parse(res.data.configJson).length) {
|
|
|
|
|
columns.forEach(item => {
|
|
|
|
|
item.checked = false
|
|
|
|
|
})
|
|
|
|
|
let Arr = []
|
|
|
|
|
JSON.parse(res.data.configJson).forEach(item => {
|
|
|
|
|
columns.forEach(item2 => {
|
|
|
|
|
if (item2.dataIndex == item) {
|
|
|
|
|
item2.checked = true
|
|
|
|
|
Arr.push(item2)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
columns.forEach(item => {
|
|
|
|
|
let type = true
|
|
|
|
|
Arr.forEach(item2 => {
|
|
|
|
|
if (item.dataIndex == item2.dataIndex) {
|
|
|
|
|
type = false
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
if (type) {
|
|
|
|
|
Arr.push(item)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
this.TableColumns = Arr
|
|
|
|
|
} else {
|
|
|
|
|
this.TableColumns = columns
|
|
|
|
|
}
|
|
|
|
|
this.FnGetData()
|
|
|
|
|
this.$forceUpdate()
|
|
|
|
|
})
|
|
|
|
|
DjyCustomerGet({ type: 'printing_cond_cfg' }).then(res => {
|
|
|
|
|
if (JSON.parse(res.data.configJson).length) {
|
|
|
|
|
this.ColumnsQuery = []
|
|
|
|
|
columns.forEach(item => {
|
|
|
|
|
this.ColumnsQuery.push({ ...item, checked: false })
|
|
|
|
|
})
|
|
|
|
|
let Arr = []
|
|
|
|
|
JSON.parse(res.data.configJson).forEach(item => {
|
|
|
|
|
this.ColumnsQuery.forEach(item2 => {
|
|
|
|
|
if (item == item2.dataIndex) {
|
|
|
|
|
item2.checked = true
|
|
|
|
|
Arr.push(item2)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
this.ColumnsQuery.forEach(item => {
|
|
|
|
|
let type = true
|
|
|
|
|
Arr.forEach(item2 => {
|
|
|
|
|
if (item.dataIndex == item2.dataIndex) {
|
|
|
|
|
type = false
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
if (type) {
|
|
|
|
|
Arr.push(item)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
this.ColumnsQuery = Arr
|
|
|
|
|
}
|
|
|
|
|
this.$forceUpdate()
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
handlePageChange({ currentPage, pageSize }) {
|
|
|
|
|
this.queryParam.pageNo = currentPage
|
|
|
|
|
this.queryParam.pageSize = pageSize
|
|
|
|
|
this.FnGetData()
|
|
|
|
|
},
|
|
|
|
|
FnGetData() {
|
|
|
|
|
this.loading = true
|
|
|
|
|
let Data = {}
|
|
|
|
|
BookingPrintTemplatePage({ ...this.queryParam, ...Data }).then(res => {
|
|
|
|
|
this.loadData = res.data.rows
|
|
|
|
|
this.loading = false
|
|
|
|
|
this.queryParam.currentPage = res.data.pageNo
|
|
|
|
|
this.queryParam.pageSize = res.data.pageSize
|
|
|
|
|
this.queryParam.totalResult = res.data.totalRows
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
/**
|
|
|
|
|
* 查询参数组装
|
|
|
|
|
*/
|
|
|
|
|
switchingDate() {
|
|
|
|
|
const obj = JSON.parse(JSON.stringify(this.queryParam))
|
|
|
|
|
return obj
|
|
|
|
|
},
|
|
|
|
|
confirm(e, data) {
|
|
|
|
|
this.BookingPrintTemplateDelete(data)
|
|
|
|
|
},
|
|
|
|
|
BookingPrintTemplateDelete(record) {
|
|
|
|
|
BookingPrintTemplateDelete(record).then(res => {
|
|
|
|
|
if (res.success) {
|
|
|
|
|
this.$message.success('删除成功')
|
|
|
|
|
this.FnGetData()
|
|
|
|
|
} else {
|
|
|
|
|
this.$message.error(`删除失败,${res.message}`)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
handleOk() {
|
|
|
|
|
this.FnGetData()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
<style lang="less">
|
|
|
|
|
.table-operator {
|
|
|
|
|
margin-bottom: 18px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
button {
|
|
|
|
|
margin-right: 8px;
|
|
|
|
|
}
|
|
|
|
|
.Open {
|
|
|
|
|
}
|
|
|
|
|
.Close {
|
|
|
|
|
min-height: 45px;
|
|
|
|
|
padding-bottom: 8px;
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
}
|
|
|
|
|
.SetFlex {
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: flex-end;
|
|
|
|
|
}
|
|
|
|
|
</style>
|