|
|
|
@ -14,42 +14,42 @@
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
|
|
|
|
|
<el-form ref="ruleFormRef" :model="ruleForm" :rules="rules" label-width="160px" class="demo-ruleForm" :size="formSize" status-icon>
|
|
|
|
|
<el-form ref="ruleFormRef" :model="formData" label-width="160px" class="demo-ruleForm" :size="formSize" :rules="formRules" status-icon>
|
|
|
|
|
<el-row style="width:95%">
|
|
|
|
|
<el-col :span="8">
|
|
|
|
|
<el-form-item label="业务线编号" prop="name">
|
|
|
|
|
<el-input v-model="ruleForm.name" />
|
|
|
|
|
<el-form-item label="业务线编号" prop="businessCode">
|
|
|
|
|
<el-input v-model="formData.businessCode" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="8">
|
|
|
|
|
<el-form-item label="业务线名称" prop="name">
|
|
|
|
|
<el-input v-model="ruleForm.name" />
|
|
|
|
|
<el-input v-model="formData.name" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="8">
|
|
|
|
|
<el-form-item label="业务线 简称/英文名">
|
|
|
|
|
<el-input v-model="ruleForm.name" />
|
|
|
|
|
<el-input v-model="formData.businessSimple" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
|
|
|
|
|
<el-row style="width:95%">
|
|
|
|
|
<el-col :span="8">
|
|
|
|
|
<el-form-item label="类型" prop="region">
|
|
|
|
|
<el-select v-model="ruleForm.region" clearable placeholder="选择类型">
|
|
|
|
|
<el-option label="业务线" value="shanghai" />
|
|
|
|
|
<el-option label="业务线" value="beijing" />
|
|
|
|
|
<el-form-item label="类型" prop="diffFlag">
|
|
|
|
|
<el-select v-model="formData.diffFlag" clearable placeholder="选择类型">
|
|
|
|
|
<el-option label="业务线" value="0" />
|
|
|
|
|
<el-option label="仓库" value="1" />
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="8">
|
|
|
|
|
<el-form-item label="所属分类" clearable prop="count">
|
|
|
|
|
<el-select-v2 v-model="ruleForm.count" placeholder="所属行业" :options="options" />
|
|
|
|
|
<el-form-item label="所属分类" clearable prop="industry">
|
|
|
|
|
<el-select-v2 v-model="formData.industry" placeholder="所属行业" :options="industryOptions" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="8">
|
|
|
|
|
<el-form-item label="所在城市" prop="count">
|
|
|
|
|
<el-select-v2 v-model="ruleForm.count" placeholder="选择城市" :options="options" />
|
|
|
|
|
<el-form-item label="所在城市" prop="city">
|
|
|
|
|
<el-select-v2 v-model="formData.city" placeholder="选择城市" :options="options" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
@ -57,7 +57,7 @@
|
|
|
|
|
<el-row style="width:95%">
|
|
|
|
|
<el-col :span="8">
|
|
|
|
|
<el-form-item label="成立时间" prop="date1">
|
|
|
|
|
<el-date-picker v-model="ruleForm.date1" type="date" label="选择日期" placeholder="请选择成立时间" style="width: 100%" />
|
|
|
|
|
<el-date-picker v-model="formData.establishDate" type="date" label="选择日期" placeholder="请选择成立时间" style="width: 100%" />
|
|
|
|
|
</el-form-item></el-col>
|
|
|
|
|
<el-col :span="22">
|
|
|
|
|
<el-form-item label="描述" prop="desc">
|
|
|
|
@ -76,7 +76,7 @@
|
|
|
|
|
<el-row>
|
|
|
|
|
<el-col :span="22" style="margin:0 auto;">
|
|
|
|
|
<el-card class="box-card">
|
|
|
|
|
<el-table :data="tableData" border stripe style="width: 100%">
|
|
|
|
|
<el-table :data="ContacttableData" border stripe style="width: 100%">
|
|
|
|
|
<el-table-column prop="date" label="类型" width="180" />
|
|
|
|
|
<el-table-column prop="name" label="姓名" width="180" />
|
|
|
|
|
<el-table-column prop="name" label="手机号" width="180" />
|
|
|
|
@ -127,36 +127,36 @@
|
|
|
|
|
|
|
|
|
|
<!--新建/ 编辑对话框 -->
|
|
|
|
|
<el-dialog v-model="dialogFormVisible" :title="dialogTitle" width="30%" @closed="closed(ruleFormRef)">
|
|
|
|
|
<el-form ref="ruleFormRef" :model="ruleForm" :rules="rules" label-width="120px" class="demo-ruleForm" :size="formSize" status-icon>
|
|
|
|
|
<el-form ref="ruleFormRef" :model="ContactruleForm.data" :rules="rules" label-width="120px" class="demo-ruleForm" :size="formSize" status-icon>
|
|
|
|
|
<el-form-item label="联系人类型:" prop="region">
|
|
|
|
|
<el-select v-model="ruleForm.region" placeholder="类型">
|
|
|
|
|
<el-select v-model="ContactruleForm.data" placeholder="类型">
|
|
|
|
|
<el-option label="Zone one" value="shanghai" />
|
|
|
|
|
<el-option label="Zone two" value="beijing" />
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="联系人姓名:" prop="name">
|
|
|
|
|
<el-input v-model="ruleForm.name" placeholder="输入内容" />
|
|
|
|
|
<el-input v-model="ContactruleForm.name" placeholder="输入内容" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="联系人手机号:" prop="name">
|
|
|
|
|
<el-input v-model="ruleForm.name" placeholder="输入内容" />
|
|
|
|
|
<el-input v-model="ContactruleForm.phone" placeholder="输入内容" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="联系人邮箱:" prop="name">
|
|
|
|
|
<el-input v-model="ruleForm.name" placeholder="输入内容" />
|
|
|
|
|
<el-input v-model="ContactruleForm.email" placeholder="输入内容" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="联系人座机:">
|
|
|
|
|
<el-input v-model="ruleForm.name" placeholder="输入内容" />
|
|
|
|
|
<el-input v-model="ContactruleForm.landline" placeholder="输入内容" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="联系人传真:">
|
|
|
|
|
<el-input v-model="ruleForm.name" placeholder="输入内容" />
|
|
|
|
|
<el-input v-model="ContactruleForm.fax" placeholder="输入内容" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="备注:" prop="desc">
|
|
|
|
|
<el-input v-model="ruleForm.desc" maxlength="100" placeholder="输入内容" show-word-limit :autosize="{ minRows: 6, maxRows: 8 }" type="textarea" />
|
|
|
|
|
<el-input v-model="ContactruleForm.desc" maxlength="100" placeholder="输入内容" show-word-limit :autosize="{ minRows: 6, maxRows: 8 }" type="textarea" />
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-form>
|
|
|
|
|
<template #footer>
|
|
|
|
|
<span class="dialog-footer">
|
|
|
|
|
<el-button @click="dialogFormVisible = false">取消</el-button>
|
|
|
|
|
<el-button type="primary" @click="dialogFormVisible = false">
|
|
|
|
|
<el-button type="primary" @click="ContactsaveData()">
|
|
|
|
|
保存
|
|
|
|
|
</el-button>
|
|
|
|
|
</span>
|
|
|
|
@ -177,8 +177,36 @@ const { t } = useI18n() // 国际化
|
|
|
|
|
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
|
|
|
|
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
|
|
|
|
|
|
|
|
|
const formData = ref({
|
|
|
|
|
id: undefined,
|
|
|
|
|
businessCode: undefined,
|
|
|
|
|
name: undefined,
|
|
|
|
|
businessSimple: undefined,
|
|
|
|
|
businessLogo: undefined,
|
|
|
|
|
parentId: undefined,
|
|
|
|
|
type: undefined,
|
|
|
|
|
status: undefined,
|
|
|
|
|
institutionNum: undefined,
|
|
|
|
|
employeeNum: undefined,
|
|
|
|
|
industry: undefined,
|
|
|
|
|
city: undefined,
|
|
|
|
|
establishDate: undefined,
|
|
|
|
|
belongUserId: undefined,
|
|
|
|
|
brandName: undefined,
|
|
|
|
|
phone: undefined,
|
|
|
|
|
diffFlag: undefined,
|
|
|
|
|
fax: undefined,
|
|
|
|
|
url: undefined,
|
|
|
|
|
description: undefined,
|
|
|
|
|
relationList: []
|
|
|
|
|
})
|
|
|
|
|
interface RuleForm {
|
|
|
|
|
businessCode: string
|
|
|
|
|
name: string
|
|
|
|
|
businessSimple: string
|
|
|
|
|
diffFlag: string
|
|
|
|
|
industry: string
|
|
|
|
|
city: string
|
|
|
|
|
region: string
|
|
|
|
|
count: string
|
|
|
|
|
date1: string
|
|
|
|
@ -188,69 +216,83 @@ interface RuleForm {
|
|
|
|
|
const formSize = ref('default')
|
|
|
|
|
const ruleFormRef = ref<FormInstance>()
|
|
|
|
|
const ruleForm = reactive<RuleForm>({
|
|
|
|
|
businessCode: '',
|
|
|
|
|
name: 'Hello',
|
|
|
|
|
businessSimple: '',
|
|
|
|
|
diffFlag: '',
|
|
|
|
|
industry: '',
|
|
|
|
|
city: '',
|
|
|
|
|
region: '',
|
|
|
|
|
count: '',
|
|
|
|
|
date1: '',
|
|
|
|
|
desc: ''
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
const rules = reactive<FormRules<RuleForm>>({
|
|
|
|
|
name: [
|
|
|
|
|
{ required: true, message: '请输入内容', trigger: 'blur' },
|
|
|
|
|
{ min: 1, max: 11, message: '输入1-11个字', trigger: 'blur' }
|
|
|
|
|
],
|
|
|
|
|
region: [
|
|
|
|
|
{
|
|
|
|
|
required: true,
|
|
|
|
|
message: '请选择',
|
|
|
|
|
trigger: 'change'
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
count: [
|
|
|
|
|
{
|
|
|
|
|
required: true,
|
|
|
|
|
message: '请选择',
|
|
|
|
|
trigger: 'change'
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
date1: [
|
|
|
|
|
{
|
|
|
|
|
type: 'date',
|
|
|
|
|
required: true,
|
|
|
|
|
message: 'Please pick a date',
|
|
|
|
|
trigger: 'change'
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
const formRules = reactive({
|
|
|
|
|
businessCode: [{ required: true, message: '业务线编号不能为空', trigger: 'blur' }],
|
|
|
|
|
name: [{ required: true, message: '业务线名称不能为空', trigger: 'blur' }],
|
|
|
|
|
diffFlag: [{ required: true, message: '业务线仓库区分(0:业务线,1:仓库)不能为空', trigger: 'change' }]
|
|
|
|
|
})
|
|
|
|
|
// const rules = reactive<FormRules<RuleForm>>({
|
|
|
|
|
// name: [
|
|
|
|
|
// { required: true, message: '请输入内容', trigger: 'blur' },
|
|
|
|
|
// { min: 1, max: 11, message: '输入1-11个字', trigger: 'blur' }
|
|
|
|
|
// ],
|
|
|
|
|
// region: [
|
|
|
|
|
// {
|
|
|
|
|
// required: true,
|
|
|
|
|
// message: '请选择',
|
|
|
|
|
// trigger: 'change'
|
|
|
|
|
// }
|
|
|
|
|
// ],
|
|
|
|
|
// count: [
|
|
|
|
|
// {
|
|
|
|
|
// required: true,
|
|
|
|
|
// message: '请选择',
|
|
|
|
|
// trigger: 'change'
|
|
|
|
|
// }
|
|
|
|
|
// ],
|
|
|
|
|
// date1: [
|
|
|
|
|
// {
|
|
|
|
|
// type: 'date',
|
|
|
|
|
// required: true,
|
|
|
|
|
// message: 'Please pick a date',
|
|
|
|
|
// trigger: 'change'
|
|
|
|
|
// }
|
|
|
|
|
// ]
|
|
|
|
|
// })
|
|
|
|
|
|
|
|
|
|
const submitForm = async () => {
|
|
|
|
|
debugger
|
|
|
|
|
|
|
|
|
|
const submitForm = async (formEl: FormInstance | undefined) => {
|
|
|
|
|
if (!formEl) return
|
|
|
|
|
formLoading.value = true
|
|
|
|
|
await formEl.validate((valid, fields) => {
|
|
|
|
|
if (valid) {
|
|
|
|
|
// const data = formData.value as unknown as BusinessWarehouseApi.BusinessWarehouseVO
|
|
|
|
|
// if (formType.value === 'create') {
|
|
|
|
|
// await BusinessWarehouseApi.createBusinessWarehouse(data)
|
|
|
|
|
// message.success(t('common.createSuccess'))
|
|
|
|
|
// } else {
|
|
|
|
|
// await BusinessWarehouseApi.updateBusinessWarehouse(data)
|
|
|
|
|
// message.success(t('common.updateSuccess'))
|
|
|
|
|
// }
|
|
|
|
|
try {
|
|
|
|
|
const data = formData.value as unknown as BusinessWarehouseApi.BusinessWarehouseVO
|
|
|
|
|
if (formType.value === 'create') {
|
|
|
|
|
debugger
|
|
|
|
|
await BusinessWarehouseApi.createBusinessWarehouse(data)
|
|
|
|
|
message.success(t('common.createSuccess'))
|
|
|
|
|
} else {
|
|
|
|
|
await BusinessWarehouseApi.updateBusinessWarehouse(data)
|
|
|
|
|
message.success(t('common.updateSuccess'))
|
|
|
|
|
}
|
|
|
|
|
console.log('新建submit校验成功 返回上一页!')
|
|
|
|
|
router.push('./index.vue')//需配置路由
|
|
|
|
|
emit('success')
|
|
|
|
|
} else {
|
|
|
|
|
console.log('error submit!', fields)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
formLoading.value = false
|
|
|
|
|
} finally {
|
|
|
|
|
formLoading.value = false
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
const backtrack = () => {
|
|
|
|
|
router.push('./index.vue')//需配置路由
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const industryOptions = Array.from({ length: 10000 }).map((_, idx) => ({
|
|
|
|
|
value: `${idx + 1}`,
|
|
|
|
|
label: `${idx + 1}`
|
|
|
|
|
}))
|
|
|
|
|
|
|
|
|
|
const options = Array.from({ length: 10000 }).map((_, idx) => ({
|
|
|
|
|
value: `${idx + 1}`,
|
|
|
|
|
label: `${idx + 1}`
|
|
|
|
@ -280,6 +322,67 @@ const tableData = [
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
const ContacttableData = ref([
|
|
|
|
|
{
|
|
|
|
|
id:1,
|
|
|
|
|
date: '类型一',
|
|
|
|
|
name: 'Tom',
|
|
|
|
|
phone:'11012011912306',
|
|
|
|
|
landline:'0371-12315',
|
|
|
|
|
email:'ww1234@163.com',
|
|
|
|
|
fax:'传真',
|
|
|
|
|
newdata:'2023-10-18 08:36'
|
|
|
|
|
}, {
|
|
|
|
|
id:2,
|
|
|
|
|
date: '类型二',
|
|
|
|
|
name: 'Tom',
|
|
|
|
|
phone:'11012011912306',
|
|
|
|
|
landline:'0371-12315',
|
|
|
|
|
email:'ww1234@163.com',
|
|
|
|
|
fax:'传真',
|
|
|
|
|
newdata:'2023-10-18 08:36'
|
|
|
|
|
}, {
|
|
|
|
|
id:3,
|
|
|
|
|
date: '类型三',
|
|
|
|
|
name: 'Tom',
|
|
|
|
|
phone:'11012011912306',
|
|
|
|
|
landline:'0371-12315',
|
|
|
|
|
email:'ww1234@163.com',
|
|
|
|
|
fax:'传真',
|
|
|
|
|
newdata:'2023-10-18 08:36'
|
|
|
|
|
}, {
|
|
|
|
|
id:4,
|
|
|
|
|
date: '类型四',
|
|
|
|
|
name: 'Tom',
|
|
|
|
|
phone:'11012011912306',
|
|
|
|
|
landline:'0371-12315',
|
|
|
|
|
email:'ww1234@163.com',
|
|
|
|
|
fax:'传真',
|
|
|
|
|
newdata:'2023-10-18 08:36'
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
])
|
|
|
|
|
|
|
|
|
|
interface ContactRuleForm {
|
|
|
|
|
date: any
|
|
|
|
|
name: any
|
|
|
|
|
phone:any
|
|
|
|
|
landline:any
|
|
|
|
|
email:any
|
|
|
|
|
fax:any
|
|
|
|
|
newdata:any
|
|
|
|
|
}
|
|
|
|
|
const ContactruleForm:any = reactive<ContactRuleForm>(
|
|
|
|
|
{
|
|
|
|
|
date: '',
|
|
|
|
|
name: '',
|
|
|
|
|
phone:'',
|
|
|
|
|
landline:'',
|
|
|
|
|
email:'',
|
|
|
|
|
fax:'',
|
|
|
|
|
newdata:''
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
const handleClose = (done: () => void) => {
|
|
|
|
|
ElMessageBox.confirm('Are you sure to close this dialog?')
|
|
|
|
|
.then(() => {
|
|
|
|
@ -302,9 +405,46 @@ const addexpert = () => {
|
|
|
|
|
dialogFormVisible.value = true
|
|
|
|
|
dialogTitle.value = '新建联系人'
|
|
|
|
|
|
|
|
|
|
Object.keys(experupdatetList).forEach((key) => {
|
|
|
|
|
experupdatetList[key] = ''
|
|
|
|
|
})
|
|
|
|
|
// Object.keys(experupdatetList).forEach((key) => {
|
|
|
|
|
// experupdatetList[key] = ''
|
|
|
|
|
// })
|
|
|
|
|
}
|
|
|
|
|
const ContactsaveData = () => {
|
|
|
|
|
if (dialogTitle.value == '新建联系人') {
|
|
|
|
|
newContactsaveData()
|
|
|
|
|
} else if (dialogTitle.value == '编辑联系人') {
|
|
|
|
|
redactContactsaveData()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
//新建
|
|
|
|
|
const newContactsaveData =()=>{
|
|
|
|
|
if (Array.isArray(ContacttableData.value)) {
|
|
|
|
|
ContacttableData.value.push(ContactruleForm);
|
|
|
|
|
} else {
|
|
|
|
|
// 如果不是数组,你可以尝试将其转换成数组
|
|
|
|
|
ContacttableData.value = [ContactruleForm];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
dialogFormVisible.value = false
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 保存编辑后的数据
|
|
|
|
|
const redactContactsaveData = () => {
|
|
|
|
|
if (Array.isArray(ContacttableData.value)) {
|
|
|
|
|
// 如果是编辑状态,找到对应的索引
|
|
|
|
|
const index = ContacttableData.value.findIndex((item) => item.name === ContactruleForm.name);
|
|
|
|
|
|
|
|
|
|
if (index !== -1) {
|
|
|
|
|
// 修改对应索引的数据
|
|
|
|
|
ContacttableData.value.splice(index, 1, { ...ContactruleForm }); // Use spread to create a new object
|
|
|
|
|
} else {
|
|
|
|
|
// 新建状态
|
|
|
|
|
ContacttableData.value.push({ ...ContactruleForm });
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
ContacttableData.value = [{ ...ContactruleForm }];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//编辑
|
|
|
|
@ -378,17 +518,40 @@ const handleEdit = (val: any) => {
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
/** 删除按钮操作 */
|
|
|
|
|
const handleDelete = async (id: number) => {
|
|
|
|
|
try {
|
|
|
|
|
// const handleDelete = async (id: number) => {
|
|
|
|
|
// try {
|
|
|
|
|
// // 删除的二次确认
|
|
|
|
|
// await message.delConfirm()
|
|
|
|
|
// // 发起删除
|
|
|
|
|
// // await EnterpriseApi.deleteEnterprise(id)
|
|
|
|
|
// message.success(t('common.delSuccess'))
|
|
|
|
|
// // 刷新列表
|
|
|
|
|
// // await getList()
|
|
|
|
|
// } catch {}
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
const handleDelete = (id: number) => {
|
|
|
|
|
try {
|
|
|
|
|
// 删除的二次确认
|
|
|
|
|
await message.delConfirm()
|
|
|
|
|
// 发起删除
|
|
|
|
|
// await EnterpriseApi.deleteEnterprise(id)
|
|
|
|
|
message.success(t('common.delSuccess'))
|
|
|
|
|
// 刷新列表
|
|
|
|
|
// await getList()
|
|
|
|
|
// message.delConfirm();
|
|
|
|
|
|
|
|
|
|
// 删除对应索引的数据
|
|
|
|
|
ContacttableData.value.splice(id, 1);
|
|
|
|
|
|
|
|
|
|
// message.success(t('common.delSuccess'));
|
|
|
|
|
// 刷新列表(如果有的话)
|
|
|
|
|
// await getList();
|
|
|
|
|
} catch {}
|
|
|
|
|
}
|
|
|
|
|
const route = useRoute() // 路由
|
|
|
|
|
onMounted(() => {
|
|
|
|
|
const id:any = route.query.id
|
|
|
|
|
const type:any = route.query.type
|
|
|
|
|
if(!id){
|
|
|
|
|
formType.value = 'create'
|
|
|
|
|
}else{
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
</script>
|
|
|
|
|
<style scoped lang="scss">
|
|
|
|
|
.box-card {
|
|
|
|
|