dev
张同海 2 years ago
parent 0bcc51678a
commit f54eca2346

@ -0,0 +1,27 @@
import { axios } from '@/utils/request'
/**
* 查询国家
*
* @author Myshipping
*/
export function CommondbCodeCountryList(parameter) {
return axios({
url: '/commondb/code-country-list',
method: 'post',
params: parameter
})
}
/**
* 保存国家
*
* @author Myshipping
*/
export function CommondbSavecodecountry(parameter) {
return axios({
url: '/commondb/savecodecountry',
method: 'post',
data: parameter
})
}

@ -0,0 +1,141 @@
<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="12">
<a-form-item label="代码" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
<a-input
placeholder="请输入中文名"
v-decorator="['code', { rules: [{ required: true, message: '请输入代码!' }] }]"
/>
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="英文名" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
<a-input
placeholder="请输入英文名"
v-decorator="['enName', { rules: [{ required: true, message: '请输入英文名!' }] }]"
/>
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="中文名" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
<a-input
placeholder="请输入中文名"
v-decorator="['cnName', { rules: [{ required: true, message: '请输入中文名!' }] }]"
/>
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="首都" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
<a-input
placeholder="请输入首都"
v-decorator="['capital', { rules: [{ required: true, message: '请输入首都!' }] }]"
/>
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="大洲" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
<a-input
placeholder="请输入大洲"
v-decorator="['continent', { rules: [{ required: true, message: '请输入大洲!' }] }]"
/>
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="描述" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
<a-input
placeholder="请输入描述"
v-decorator="['description', { rules: [{ required: true, message: '请输入描述!' }] }]"
/>
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="备注" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
<a-input placeholder="请输入备注" v-decorator="['remark']" />
</a-form-item>
</a-col>
</a-row>
</a-form>
</a-spin>
</a-modal>
</template>
<script>
import { CommondbSavecodecountry } from '@/api/modular/main/CommondbCodeCountry'
export default {
data() {
return {
TypeData: [],
labelCol: {
xs: { span: 24 },
sm: { span: 7 }
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 15 }
},
labelCol2: {
xs: { span: 24 },
sm: { span: 4 }
},
wrapperCol2: {
xs: { span: 24 },
sm: { span: 20 }
},
visible: false,
confirmLoading: false,
form: this.$form.createForm(this)
}
},
mounted() {},
methods: {
/**
* 提交表单
*/
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])
}
}
CommondbSavecodecountry(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,144 @@
<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="12">
<a-form-item label="代码" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
<a-input
placeholder="请输入中文名"
v-decorator="['code', { rules: [{ required: true, message: '请输入代码!' }] }]"
/>
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="英文名" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
<a-input
placeholder="请输入英文名"
v-decorator="['enName', { rules: [{ required: true, message: '请输入英文名!' }] }]"
/>
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="中文名" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
<a-input
placeholder="请输入中文名"
v-decorator="['cnName', { rules: [{ required: true, message: '请输入中文名!' }] }]"
/>
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="首都" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
<a-input
placeholder="请输入首都"
v-decorator="['capital', { rules: [{ required: true, message: '请输入首都!' }] }]"
/>
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="大洲" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
<a-input
placeholder="请输入大洲"
v-decorator="['continent', { rules: [{ required: true, message: '请输入大洲!' }] }]"
/>
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="描述" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
<a-input
placeholder="请输入描述"
v-decorator="['description', { rules: [{ required: true, message: '请输入描述!' }] }]"
/>
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="备注" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
<a-input placeholder="请输入备注" v-decorator="['remark']" />
</a-form-item>
</a-col>
</a-row>
</a-form>
</a-spin>
</a-modal>
</template>
<script>
import { CommondbSavecodecountry } from '@/api/modular/main/CommondbCodeCountry'
export default {
data() {
return {
TypeData: [],
labelCol: {
xs: { span: 24 },
sm: { span: 7 }
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 15 }
},
labelCol2: {
xs: { span: 24 },
sm: { span: 4 }
},
wrapperCol2: {
xs: { span: 24 },
sm: { span: 20 }
},
visible: false,
confirmLoading: false,
form: this.$form.createForm(this),
data: {}
}
},
mounted() {},
methods: {
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.gid)
values.gid = this.data.gid
console.log(values)
CommondbSavecodecountry(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,199 @@
<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`">
<a-form-item
:label="item.title"
v-if="
item.title != '备注' && item.title != '船公司' && item.title != '包装' && 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-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>
</vxe-toolbar>
<vxe-table :data="loadData" border :loading="loading" height="600px" empty-text="">
<vxe-column type="seq" width="40" fixed="left"></vxe-column>
<vxe-column
v-for="item in columns"
:key="`${item.dataIndex}3`"
:field="item.dataIndex"
:min-width="item.width"
:title="item.title"
:align="item.align"
>
</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>
</template>
</vxe-column>
</vxe-table>
<add-form ref="addForm" @ok="handleOk" />
<edit-form ref="editForm" @ok="handleOk" />
</a-card>
</div>
</template>
<script>
import { CommondbCodeCountryList } from '@/api/modular/main/CommondbCodeCountry'
import { commondbModules, commondbCarrierlist } from '@/api/modular/main/ShippingCompanyMapping'
import addForm from './addForm.vue'
import editForm from './editForm.vue'
export default {
components: {
addForm,
editForm
},
data() {
return {
TypeData: [],
// /
advanced: false,
loading: false,
setVisible: false,
setVisible1: false,
queryParam: {
// currentPage: 1,
// pageSize: 10,
// totalResult: 1
},
ColumnsQuery: [],
columns: [
{
title: '代码',
align: 'center',
width: '100',
dataIndex: 'code'
},
{
title: '英文名',
align: 'center',
width: '80',
dataIndex: 'enName'
},
{
title: '中文名',
align: 'center',
width: '80',
dataIndex: 'cnName'
},
{
title: '首都',
align: 'center',
width: '80',
dataIndex: 'capital'
},
{
title: '大洲',
align: 'center',
width: '80',
dataIndex: 'continent'
},
{
title: '描述',
align: 'center',
width: '80',
dataIndex: 'description'
},
{
title: '备注',
align: 'center',
width: '80',
dataIndex: 'remark'
}
],
tstyle: { 'padding-bottom': '0px', 'margin-bottom': '10px' },
// Promise
loadData: [],
CodeData: [],
WCodeData: [],
ModulesData: [],
carrierCodeData: []
}
},
created() {},
mounted() {
this.init()
},
methods: {
toggleAdvanced() {
this.advanced = !this.advanced
},
init() {
Object.assign(this.$data, this.$options.data())
this.ColumnsQuery = this.columns
this.FnGetData()
commondbPackage().then(res => {
this.CodeData = res.data
this.WCodeData = res.data
})
},
FnGetData() {
if (this.queryParam.module) {
this.loading = true
CommondbCodeCountryList(this.queryParam).then(res => {
if (res.code == 200) {
this.loadData = res.data
} else {
this.loadData = []
this.$message.warning(res.message)
}
this.loading = false
})
} else {
this.$message.warning('请选择模块!')
}
},
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