dev
张同海 2 years ago
parent 323b35aee0
commit ba3e733e3f

@ -0,0 +1,66 @@
import { axios } from '@/utils/request'
/**
* 分页查询订舱打印模板
*
* @author Myshipping
*/
export function BookingPrintTemplatePage(parameter) {
return axios({
url: '/BookingPrintTemplate/page',
method: 'get',
params: parameter
})
}
/**
* 增加订舱打印模板
*
* @author Myshipping
*/
export function BookingPrintTemplateAdd(parameter) {
let params = new FormData()
params.append('file', parameter.file)
console.log(parameter)
return axios({
url: '/BookingPrintTemplate/add',
method: 'post',
data: params,
headers: { 'Content-type': 'multipart/form-data;charset=utf-8' }
})
// return axios({
// url: '/sysFileInfo/upload',
// method: 'post',
// data: parameter,
// onUploadProgress: function(progressEvent) {
// let percent = ((progressEvent.loaded / progressEvent.total) * 100) | 0
// uploadProcess && uploadProcess(percent)
// }
// })
}
/**
* 更新订舱打印模板
*
* @author Myshipping
*/
export function BookingPrintTemplateEdit(parameter) {
return axios({
url: '/BookingPrintTemplate/edit',
method: 'post',
data: parameter
})
}
/**
* 删除订舱模板
*
* @author Myshipping
*/
export function BookingPrintTemplateDelete(parameter) {
return axios({
url: '/BookingPrintTemplate/delete',
method: 'post',
data: parameter
})
}

@ -290,7 +290,7 @@ export default {
this.ColumnsQuery.push({ ...item, checked: true })
})
DjyCustomerGet({ type: 'customer_column_config' }).then(res => {
if (JSON.parse(res.data.configJson).length) {
if (res.data && JSON.parse(res.data.configJson).length) {
columns.forEach(item => {
item.checked = false
})
@ -315,6 +315,8 @@ export default {
}
})
this.TableColumns = Arr
} else {
this.TableColumns = columns
}
this.FnGetData()
this.$forceUpdate()

@ -0,0 +1,130 @@
<template>
<a-modal
title="新增客户信息"
:width="1100"
:visible="visible"
:confirmLoading="confirmLoading"
@ok="handleSubmit"
@cancel="handleCancel"
>
<a-spin :spinning="confirmLoading">
<a-form :form="form">
<a-row>
<a-col :span="8">
<a-form-item label="类型名称" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
<a-input
placeholder="请输入类型名称"
v-decorator="['typeName', { rules: [{ required: true, message: '请输入类型名称!' }] }]"
/>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="租户名称" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
<a-input
placeholder="请输入租户名称"
v-decorator="['tenantName', { rules: [{ required: true, message: '请输入租户名称!' }] }]"
/>
</a-form-item>
</a-col>
<a-col :span="8">
<a-upload name="file" @change="handleChange" :customRequest="customRequest" :multiple="false">
<a-button> <a-icon type="upload" /> 文件上传 </a-button>
</a-upload>
</a-col>
</a-row>
</a-form>
</a-spin>
</a-modal>
</template>
<script>
import { BookingPrintTemplateAdd } from '@/api/modular/main/bookingprinttemplate'
export default {
data() {
return {
file: {},
labelCol: {
xs: { span: 24 },
sm: { span: 7 }
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 15 }
},
typeData: [],
visible: false,
confirmLoading: false,
form: this.$form.createForm(this)
}
},
methods: {
customRequest(data) {
this.file = data.file
},
handleChange(info) {
console.log(this.file)
},
//
add(record) {
this.visible = true
this.typeData = [
{
code: 10,
name: '收货人'
},
{
code: 20,
name: '发货人'
},
{
code: 30,
name: '通知人'
},
{
code: 40,
name: '第二通知人'
}
]
},
/**
* 提交表单
*/
handleSubmit() {
const {
form: { validateFields }
} = this
this.confirmLoading = true
validateFields((errors, values) => {
if (!errors) {
for (const key in values) {
if (typeof values[key] === 'object' && !(values[key] === null)) {
values[key] = JSON.stringify(values[key])
}
}
BookingPrintTemplateAdd({ file: this.file, data: values })
.then(res => {
if (res.success) {
this.$message.success('新增成功')
this.confirmLoading = false
this.$emit('ok', values)
this.handleCancel()
} else {
this.$message.error('新增失败') // + res.message
}
})
.finally(res => {
this.confirmLoading = false
})
} else {
this.confirmLoading = false
}
})
},
handleCancel() {
this.form.resetFields()
this.visible = false
}
}
}
</script>

@ -0,0 +1,147 @@
<template>
<a-modal
title="编辑客户信息"
:width="1100"
:visible="visible"
:confirmLoading="confirmLoading"
@ok="handleSubmit"
@cancel="handleCancel"
>
<a-spin :spinning="confirmLoading">
<a-form :form="form">
<a-row>
<a-col :span="8">
<a-form-item label="类型名称" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
<a-input
placeholder="请输入类型名称"
v-decorator="['typeName', { rules: [{ required: true, message: '请输入类型名称!' }] }]"
/>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="租户名称" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
<a-input
placeholder="请输入租户名称"
v-decorator="['tenantName', { rules: [{ required: true, message: '请输入租户名称!' }] }]"
/>
</a-form-item>
</a-col>
<a-col :span="8">
<a-upload :file-list="fileList" :before-upload="beforeUpload" @remove="handleRemove">
<a-button>
<upload-outlined></upload-outlined>
Select File
</a-button>
</a-upload>
</a-col>
</a-row>
</a-form>
</a-spin>
</a-modal>
</template>
<script>
import { BookingPrintTemplateEdit } from '@/api/modular/main/bookingprinttemplate'
export default {
data() {
return {
fileList: '',
labelCol: {
xs: { span: 24 },
sm: { span: 7 }
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 15 }
},
typeData: [],
visible: false,
confirmLoading: false,
form: this.$form.createForm(this)
}
},
methods: {
beforeUpload(file) {
console.log('beforeUpload', file)
},
handleRemove(file) {
console.log('handleRemove', file)
},
//
edit(record) {
console.log(record)
this.visible = true
const typeOption = this.$options
this.typeData = typeOption.filters['dictData']('edi_type')
setTimeout(() => {
this.form.setFieldsValue({
addr: record.addr,
addrEN: record.addrEN,
chief: record.chief,
city: record.city,
createdTime: record.createdTime,
createdUserId: record.createdUserId,
createdUserName: record.createdUserName,
email: record.email,
fullName: record.fullName,
fullNameEN: record.fullNameEN,
id: record.id,
invAddrTel: record.invAddrTel,
invTitle: record.invTitle,
isDeleted: record.isDeleted,
province: record.province,
qq: record.qq,
rmbAccount: record.rmbAccount,
rmbBank: record.rmbBank,
shortName: record.shortName,
taxNO: record.taxNO,
tel: record.tel,
tenantId: record.tenantId,
usdAccount: record.usdAccount,
usdBank: record.usdBank,
webUrl: record.webUrl
})
console.log(this.form.getFieldsValue())
}, 100)
},
handleSubmit() {
const {
form: { validateFields }
} = this
this.confirmLoading = true
validateFields((errors, values) => {
console.log(errors, values)
if (!errors) {
for (const key in values) {
console.log(key, 1)
if (typeof values[key] === 'object' && !(values[key] === null)) {
values[key] = JSON.stringify(values[key])
}
}
console.log(this.form, values.id)
BookingPrintTemplateEdit(values)
.then(res => {
if (res.success) {
this.$message.success('编辑成功')
this.confirmLoading = false
this.$emit('ok', values)
this.handleCancel()
} else {
this.$message.error('编辑失败') // + res.message
}
})
.finally(res => {
this.confirmLoading = false
})
} else {
this.confirmLoading = false
}
})
},
handleCancel() {
this.form.resetFields()
this.visible = false
}
}
}
</script>

@ -0,0 +1,301 @@
<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="8" :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-row>
</a-col>
<a-col :md="6" :sm="24">
<span class="table-page-search-submitButtons">
<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-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-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"
:width="item.width"
:title="item.title"
:align="item.align"
v-if="item.checked"
></vxe-column>
<vxe-column title="操作" fixed="right" width="200" align="center">
<template #default="{ row }">
<vxe-button type="text" @click="$refs.editForm.edit(row)"></vxe-button>
<vxe-button type="text" @click="BookingPrintTemplateDelete(row)"></vxe-button>
</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>
</div>
</template>
<script>
import { BookingPrintTemplatePage, BookingPrintTemplateDelete } from '@/api/modular/main/bookingprinttemplate'
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',
width: '60',
dataIndex: 'typeName'
},
{
title: '租户名称',
align: 'center',
width: '60',
dataIndex: 'tenantName'
}
]
export default {
components: {
addForm,
editForm,
columnSetting
},
data() {
return {
// /
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: {}
}
},
created() {},
mounted() {
this.init()
},
methods: {
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
BookingPrintTemplatePage(this.queryParam).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
},
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 {
height: 45px;
overflow: hidden;
}
</style>
Loading…
Cancel
Save