角色下拉

dev
张同海 2 years ago
parent 745c35bedd
commit 4a235560bd

@ -146,9 +146,14 @@
> >
<vxe-column type="checkbox" width="60"></vxe-column> <vxe-column type="checkbox" width="60"></vxe-column>
<vxe-column type="seq" width="60"></vxe-column> <vxe-column type="seq" width="60"></vxe-column>
<vxe-column field="roleName" title="角色" :edit-render="{}"> <vxe-column field="roleCode" title="角色" :edit-render="{}">
<template #default="{ row }">
<span>{{ formatRole(row.roleCode) }}</span>
</template>
<template #edit="{ row }"> <template #edit="{ row }">
<vxe-input v-model="row.roleName" type="text" placeholder="请输入角色"></vxe-input> <vxe-select v-model="row.roleCode" transfer>
<vxe-option v-for="item in TypeData" :key="item.code" :value="item.code" :label="item.value"></vxe-option>
</vxe-select>
</template> </template>
</vxe-column> </vxe-column>
<vxe-column field="name" title="姓名" :edit-render="{}"> <vxe-column field="name" title="姓名" :edit-render="{}">
@ -247,7 +252,7 @@
<script> <script>
import { DjyCustomerAdd } from '@/api/modular/main/CustomerInformationManagement' import { DjyCustomerAdd } from '@/api/modular/main/CustomerInformationManagement'
import { sysDictDataPage } from '@/api/modular/system/dictDataManage'
export default { export default {
data() { data() {
return { return {
@ -284,9 +289,15 @@ export default {
visible: false, visible: false,
confirmLoading: false, confirmLoading: false,
form: this.$form.createForm(this), form: this.$form.createForm(this),
ContactsData: [] ContactsData: [],
TypeData: []
} }
}, },
mounted() {
sysDictDataPage({ pageNo: 1, pageSize: 999, typeId: '346103538081861' }).then(res => {
this.TypeData = res.data.rows
})
},
methods: { methods: {
removeCheckboxRow() { removeCheckboxRow() {
console.log(this.$refs.xTable.selection) console.log(this.$refs.xTable.selection)
@ -310,6 +321,15 @@ export default {
}) })
console.log(this.ContactsData) console.log(this.ContactsData)
}, },
formatRole(value) {
let RData = ''
this.TypeData.forEach(item => {
if (item.code == value) {
RData = item.value
}
})
return RData
},
formatSex(value) { formatSex(value) {
if (value === '1') { if (value === '1') {
return '男' return '男'

@ -1,289 +0,0 @@
<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="['codeName', { 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="['shortName', { 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="['fullName', { rules: [{ required: true, message: '请输入全称!' }] }]"
/>
</a-form-item>
</a-col>
</a-row>
<a-row>
<a-col :span="8">
<a-form-item label="负责人" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
<a-input
placeholder="请输入负责人"
v-decorator="['chief', { 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="['tel', { 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="['email', { rules: [{ required: true, message: '请输入邮箱!' }] }]"
/>
</a-form-item>
</a-col>
</a-row>
<a-row>
<a-col :span="8">
<a-form-item label="QQ" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
<a-input
placeholder="请输入QQ"
v-decorator="['qq', { rules: [{ required: true, message: '请输入QQ' }] }]"
/>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="网址" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
<a-input
placeholder="请输入网址"
v-decorator="['webUrl', { 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="['province', { rules: [{ required: true, message: '请输入省份!' }] }]"
/>
</a-form-item>
</a-col>
</a-row>
<a-row>
<a-col :span="8">
<a-form-item label="城市" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
<a-input
placeholder="请输入城市"
v-decorator="['city', { 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="['addr', { 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="['fullNameEN', { rules: [{ required: true, message: '请输入英文全名!' }] }]"
/>
</a-form-item>
</a-col>
</a-row>
<a-row>
<a-col :span="8">
<a-form-item label="英文地址" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
<a-input
placeholder="请输入英文地址"
v-decorator="['addrEN', { 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="['invTitle', { 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="['taxNO', { rules: [{ required: true, message: '请输入纳税人识别号!' }] }]"
/>
</a-form-item>
</a-col>
</a-row>
<a-row>
<a-col :span="8">
<a-form-item label="发票地址电话" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
<a-input
placeholder="请输入发票地址电话"
v-decorator="['invAddrTel', { 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="['rmbBank', { 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="['rmbAccount', { rules: [{ required: true, message: '请输入人民币账号!' }] }]"
/>
</a-form-item>
</a-col>
</a-row>
<a-row>
<a-col :span="8">
<a-form-item label="美元开户行" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
<a-input
placeholder="请输入美元开户行"
v-decorator="['usdBank', { 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="['usdAccount', { rules: [{ required: true, message: '请输入美元账号!' }] }]"
/>
</a-form-item>
</a-col>
</a-row>
</a-form>
</a-spin>
</a-modal>
</template>
<script>
import { DjyCustomerEdit } from '@/api/modular/main/CustomerInformationManagement'
export default {
data() {
return {
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: {
//
edit(record) {
console.log(record)
this.visible = true
const typeOption = this.$options
this.typeData = typeOption.filters['dictData']('edi_type')
setTimeout(() => {
this.form.setFieldsValue({
codeName: record.codeName,
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)
DjyCustomerEdit(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>

@ -146,9 +146,14 @@
> >
<vxe-column type="checkbox" width="60"></vxe-column> <vxe-column type="checkbox" width="60"></vxe-column>
<vxe-column type="seq" width="60"></vxe-column> <vxe-column type="seq" width="60"></vxe-column>
<vxe-column field="roleName" title="角色" :edit-render="{}"> <vxe-column field="roleCode" title="角色" :edit-render="{}">
<template #default="{ row }">
<span>{{ formatRole(row.roleCode) }}</span>
</template>
<template #edit="{ row }"> <template #edit="{ row }">
<vxe-input v-model="row.roleName" type="text" placeholder="请输入角色"></vxe-input> <vxe-select v-model="row.roleCode" transfer>
<vxe-option v-for="item in TypeData" :key="item.code" :value="item.code" :label="item.value"></vxe-option>
</vxe-select>
</template> </template>
</vxe-column> </vxe-column>
<vxe-column field="name" title="姓名" :edit-render="{}"> <vxe-column field="name" title="姓名" :edit-render="{}">
@ -247,7 +252,7 @@
<script> <script>
import { DjyCustomerEdit, DjyCustomerDetail } from '@/api/modular/main/CustomerInformationManagement' import { DjyCustomerEdit, DjyCustomerDetail } from '@/api/modular/main/CustomerInformationManagement'
import { sysDictDataPage } from '@/api/modular/system/dictDataManage'
export default { export default {
props: ['RowData'], props: ['RowData'],
data() { data() {
@ -281,12 +286,12 @@ export default {
xs: { span: 25 }, xs: { span: 25 },
sm: { span: 22 } sm: { span: 22 }
}, },
typeData: [],
visible: false, visible: false,
confirmLoading: false, confirmLoading: false,
form: this.$form.createForm(this), form: this.$form.createForm(this),
ContactsData: [], ContactsData: [],
Data: {} Data: {},
TypeData: []
} }
}, },
mounted() { mounted() {
@ -296,15 +301,17 @@ export default {
...res.data ...res.data
}) })
res.data.contacts.forEach((item, index) => { res.data.contacts.forEach((item, index) => {
console.log(index)
item.WebKey = index item.WebKey = index
this.ContactsData.push(item) this.ContactsData.push(item)
}) })
}) })
sysDictDataPage({ pageNo: 1, pageSize: 999, typeId: '346103538081861' }).then(res => {
this.TypeData = res.data.rows
console.log(this.TypeData)
})
}, },
methods: { methods: {
removeCheckboxRow() { removeCheckboxRow() {
console.log(this.$refs.xTable.selection)
this.$refs.xTable.selection.forEach(item => { this.$refs.xTable.selection.forEach(item => {
this.ContactsData.forEach((item2, index2) => { this.ContactsData.forEach((item2, index2) => {
if (item.WebKey == item2.WebKey) { if (item.WebKey == item2.WebKey) {
@ -323,7 +330,16 @@ export default {
qq: '', qq: '',
remark: '' remark: ''
}) })
console.log(this.ContactsData) },
formatRole(value) {
let RData = ''
this.TypeData.forEach(item => {
console.log(item.code, value)
if (item.code == value) {
RData = item.value
}
})
return RData
}, },
formatSex(value) { formatSex(value) {
if (value === '1') { if (value === '1') {
@ -343,24 +359,6 @@ export default {
// //
add(record) { add(record) {
this.visible = true this.visible = true
this.typeData = [
{
code: 10,
name: '收货人'
},
{
code: 20,
name: '发货人'
},
{
code: 30,
name: '通知人'
},
{
code: 40,
name: '第二通知人'
}
]
}, },
/** /**
* 提交表单 * 提交表单

Loading…
Cancel
Save