更新新增市场经营--合同信息

This commit is contained in:
mkm 2024-04-19 11:51:14 +08:00
parent 2506f3e189
commit 9045ce63a4
2 changed files with 524 additions and 479 deletions

View File

@ -1,6 +1,7 @@
<template>
<div class="edit-popup">
<popup ref="popupRef" :title="popupTitle" :async="true" width="80vw" @confirm="handleSubmit" @close="handleClose">
<popup ref="popupRef" :title="popupTitle" :async="true" width="80vw" @confirm="handleSubmit"
@close="handleClose">
<el-form ref="formRef" :model="formData" label-width="120px" :rules="formRules">
<el-row>
<el-col :span="8">
@ -25,7 +26,8 @@
</el-col>
<el-col :span="8">
<el-form-item label="合同编号" prop="contract_code">
<el-input v-model="formData.contract_code" clearable placeholder="请输入合同编号" v-type="'code'" />
<el-input v-model="formData.contract_code" clearable placeholder="请输入合同编号"
v-type="'code'" />
</el-form-item>
</el-col>
<el-col :span="8">
@ -57,32 +59,36 @@
</el-col>
<el-col :span="8">
<el-form-item label="业务性质" prop="business_nature">
<el-select class='flex-1' v-model="formData.business_nature">
<el-option v-for="(item, index) in dictData.cost_consultation_business_nature "
:key="index" :label="item.name" :value="parseInt(item.value)"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="行业性质" prop="industry_nature">
<el-select class=' flex-1' v-model="formData.industry_nature">
<el-option v-for="(item, index) in dictData.cost_consultation_industry_nature "
:key="index" :label="item.name" :value="parseInt(item.value)"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="资金来源" prop="fund_sources">
<el-select class=' flex-1' v-model="formData.fund_sources">
<el-option v-for="(item, index) in dictData.money_source " :key="index" :label="item.name"
<el-select class="flex-1" v-model="formData.business_nature">
<el-option v-for="(
item, index
) in dictData.cost_consultation_business_nature" :key="index" :label="item.name"
:value="parseInt(item.value)"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="行业性质" prop="industry_nature">
<el-select class="flex-1" v-model="formData.industry_nature">
<el-option v-for="(
item, index
) in dictData.cost_consultation_industry_nature" :key="index" :label="item.name"
:value="parseInt(item.value)"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="资金来源" prop="fund_sources">
<el-select class="flex-1" v-model="formData.fund_sources">
<el-option v-for="(item, index) in dictData.money_source" :key="index"
:label="item.name" :value="parseInt(item.value)"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="建设区域" prop="const_area">
<el-select class=' flex-1' v-model="formData.const_area">
<el-option v-for="(item, index) in dictData.const_area " :key="index" :label="item.name"
<el-select class="flex-1" v-model="formData.const_area">
<el-option v-for="(item, index) in dictData.const_area" :key="index" :label="item.name"
:value="parseInt(item.value)"></el-option>
</el-select>
</el-form-item>
@ -133,7 +139,8 @@
</el-col>
<el-col :span="8">
<el-form-item label="履约金">
<el-input v-model="formData.performance_money" clearable placeholder="请输入履约金" type="number" />
<el-input v-model="formData.performance_money" clearable placeholder="请输入履约金"
type="number" />
</el-form-item>
</el-col>
<el-col :span="8">
@ -184,16 +191,16 @@
</el-col>
<el-col :span="8">
<el-form-item label="实施方式">
<el-select class=' flex-1' v-model="formData.implement_method">
<el-option v-for="(item, index) in dictData.cost_consultation_way " :key="index"
<el-select class="flex-1" v-model="formData.implement_method">
<el-option v-for="(item, index) in dictData.cost_consultation_way" :key="index"
:label="item.name" :value="parseInt(item.value)"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="盖章名称">
<el-select class=' flex-1' v-model="formData.seal_name">
<el-option v-for="(item, index) in dictData.cost_consultation_seal_name " :key="index"
<el-select class="flex-1" v-model="formData.seal_name">
<el-option v-for="(item, index) in dictData.cost_consultation_seal_name" :key="index"
:label="item.name" :value="parseInt(item.value)"></el-option>
</el-select>
</el-form-item>
@ -213,8 +220,8 @@
</el-col>
<el-col :span="8">
<el-form-item label="文件类型">
<el-select class='flex-1' v-model="formData.file_type">
<el-option v-for="( item, index ) in dictData.cost_consultation_file_type " :key="index"
<el-select class="flex-1" v-model="formData.file_type">
<el-option v-for="(item, index) in dictData.cost_consultation_file_type" :key="index"
:label="item.name" :value="parseInt(item.value)"></el-option>
</el-select>
</el-form-item>
@ -232,8 +239,8 @@
</el-col>
<el-col :span="8">
<el-form-item label="骑缝盖章">
<el-select class='flex-1' v-model="formData.plance_seal">
<el-option v-for="( item, index ) in dictData.isqfgz " :key="index" :label="item.name"
<el-select class="flex-1" v-model="formData.plance_seal">
<el-option v-for="(item, index) in dictData.isqfgz" :key="index" :label="item.name"
:value="parseInt(item.value)"></el-option>
</el-select>
</el-form-item>
@ -267,7 +274,7 @@
</el-select>
</el-form-item>
</el-col> -->
<createUserLable :form-data='formData' name='录入' flag></createUserLable>
<createUserLable :form-data="formData" name="录入" flag></createUserLable>
<el-col :span="8">
<el-form-item label="附件">
<upload-annex :form-data="formData" />
@ -284,110 +291,113 @@
</dialogTable>
</el-dialog>
<el-dialog v-model="showDialog2" title="选择甲方签订单位" width="70%">
<dialogTable :config="marketing_custom" @customEvent="customEvent1">
</dialogTable>
<dialogTable :config="marketing_custom" @customEvent="customEvent1"> </dialogTable>
</el-dialog>
</popup>
</div>
</template>
<script lang="ts" setup name="marketingContractEdit">
import type { FormInstance } from "element-plus";
import Popup from "@/components/popup/index.vue";
import type { FormInstance } from 'element-plus'
import Popup from '@/components/popup/index.vue'
import {
apiMarketingContractAdd,
apiMarketingContractEdit,
apiMarketingContractDetail,
} from "@/api/marketing_contract";
import { timeFormat } from "@/utils/util";
import type { PropType } from "vue";
import { marketing_framework_agreement, marketing_custom } from "@/components/dialogTable/dialogTableConfig";
apiMarketingContractDetail
} from '@/api/marketing_contract'
import { timeFormat } from '@/utils/util'
import type { PropType } from 'vue'
import {
marketing_framework_agreement,
marketing_custom
} from '@/components/dialogTable/dialogTableConfig'
defineProps({
dictData: {
type: Object as PropType<Record<string, any[]>>,
default: () => ({}),
default: () => ({})
},
deptList: Array
});
const emit = defineEmits(["success", "close"]);
const formRef = shallowRef<FormInstance>();
const popupRef = shallowRef<InstanceType<typeof Popup>>();
const mode = ref("add");
})
const emit = defineEmits(['success', 'close'])
const formRef = shallowRef<FormInstance>()
const popupRef = shallowRef<InstanceType<typeof Popup>>()
const mode = ref('add')
const showDialog = ref(false)
const showDialog1 = ref(false)
const showDialog2 = ref(false)
const personnel = ref(null)
//
const popupTitle = computed(() => {
return mode.value == "edit"
? "编辑市场经营--合同信息"
: "新增市场经营--合同信息";
});
return mode.value == 'edit' ? '编辑市场经营--合同信息' : '新增市场经营--合同信息'
})
//
const formData = reactive({
id: "",
related_contract_id: "",
framework_agreement_name: "",
contract_type: "",
contract_name: "",
contract_code: "",
part_a: "",
part_a_name: "",
part_a_contact: "",
part_a_address: "",
part_b: "",
part_b_signatory: "",
part_b_signatory_name: "",
business_nature: "",
industry_nature: "",
fund_sources: "",
const_area: "",
agreement_nature: "",
project_money: "",
project_scale: "",
signed_amount: "",
signed_rate: "",
service_duration: "",
start_date: "",
end_date: "",
performance_money: "",
performance_money_expiration_time: "",
payment_method: "",
content: "",
annex: "",
signed_dept: "",
signed_head: "",
signed_head_name: "",
supervise_dept: "",
project_manager: "",
project_manager_name: "",
implement_method: "",
seal_name: "",
is_limit: "",
limit_num: "",
file_type: "",
seal_num: "",
seal_user: "",
seal_user_name: "",
plance_seal: "",
send_date: "",
mailing_number: "",
review_status: "",
status: "",
create_user: "",
});
id: '',
related_contract_id: '',
framework_agreement_name: '',
contract_type: '',
contract_name: '',
contract_code: '',
part_a: '',
part_a_name: '',
part_a_contact: '',
part_a_address: '',
part_b: '',
part_b_signatory: '',
part_b_signatory_name: '',
business_nature: '',
industry_nature: '',
fund_sources: '',
const_area: '',
agreement_nature: '',
project_money: '',
project_scale: '',
signed_amount: '',
signed_rate: '',
service_duration: '',
start_date: '',
end_date: '',
performance_money: '',
performance_money_expiration_time: '',
payment_method: '',
content: '',
annex: '',
signed_dept: '',
signed_head: '',
signed_head_name: '',
supervise_dept: '',
project_manager: '',
project_manager_name: '',
implement_method: '',
seal_name: '',
is_limit: '',
limit_num: '',
file_type: '',
seal_num: '',
seal_user: '',
seal_user_name: '',
plance_seal: '',
send_date: '',
mailing_number: '',
review_status: '',
status: '',
create_user: ''
})
const customEvent = (e) => {
formData.related_contract_id = e.id
formData.framework_agreement_name = e.contract_name
formData.part_a_name = e.part_a_name
formData.part_a = e.part_a
formData.part_a_address = e.part_a_address
formData.part_a_contact = e.part_a_contact
formData.part_b = e.part_b
formData.part_b_signatory = e.part_b_signatory
formData.part_b_signatory_name = e.part_b_signatory_name
formData.business_nature = e.business_nature
showDialog1.value = false
}
@ -397,15 +407,12 @@ const customEvent1 = (e) => {
showDialog2.value = false
}
let value;
let value
const userclick = async (val) => {
showDialog.value = true
value = val
await nextTick()
personnel.value.open()
}
//
@ -428,148 +435,155 @@ const formRules = reactive<any>({
related_contract_id: [
{
required: true,
message: "请输入关联主合同id",
trigger: ["blur"],
},
message: '请输入关联主合同id',
trigger: ['blur']
}
],
signed_head_name: [
{
required: true,
message: '请选择签订负责人',
trigger: ['blur']
}
],
contract_type: [
{
required: true,
message: "请输入合同类型",
trigger: ["blur"],
},
message: '请输入合同类型',
trigger: ['blur']
}
],
contract_name: [
{
required: true,
message: "请输入合同名称",
trigger: ["blur"],
},
message: '请输入合同名称',
trigger: ['blur']
}
],
contract_code: [
{
required: true,
message: "请输入合同编号",
trigger: ["blur"],
},
message: '请输入合同编号',
trigger: ['blur']
}
],
part_a: [
{
required: true,
message: "请输入甲方签约单位",
trigger: ["blur"],
},
message: '请输入甲方签约单位',
trigger: ['blur']
}
],
part_a_contact: [
{
required: true,
message: "请输入联系人",
trigger: ["blur"],
},
message: '请输入联系人',
trigger: ['blur']
}
],
part_a_address: [
{
required: true,
message: "请输入业主地址",
trigger: ["blur"],
},
message: '请输入业主地址',
trigger: ['blur']
}
],
part_b: [
{
required: true,
message: "请输入乙方签约单位",
trigger: ["blur"],
},
message: '请输入乙方签约单位',
trigger: ['blur']
}
],
part_b_signatory: [
{
required: true,
message: "请输入乙方签约人",
trigger: ["blur"],
},
message: '请输入乙方签约人',
trigger: ['blur']
}
],
business_nature: [
{
required: true,
message: "请输入业务性质",
trigger: ["blur"],
},
message: '请输入业务性质',
trigger: ['blur']
}
],
industry_nature: [
{
required: true,
message: "请输入行业性质",
trigger: ["blur"],
},
message: '请输入行业性质',
trigger: ['blur']
}
],
fund_sources: [
{
required: true,
message: "请输入资金来源",
trigger: ["blur"],
},
message: '请输入资金来源',
trigger: ['blur']
}
],
const_area: [
{
required: true,
message: "请输入建设区域",
trigger: ["blur"],
},
message: '请输入建设区域',
trigger: ['blur']
}
],
agreement_nature: [
{
required: true,
message: "请输入协议性质",
trigger: ["blur"],
},
message: '请输入协议性质',
trigger: ['blur']
}
],
project_money: [
{
required: true,
message: "请输入工程总投资",
trigger: ["blur"],
},
message: '请输入工程总投资',
trigger: ['blur']
}
],
project_scale: [
{
required: true,
message: "请输入工程规模及概况",
trigger: ["blur"],
},
message: '请输入工程规模及概况',
trigger: ['blur']
}
],
signed_amount: [
{
required: true,
message: "请输入签订金额",
trigger: ["blur"],
},
message: '请输入签订金额',
trigger: ['blur']
}
],
signed_rate: [
{
required: true,
message: "请输入合同签订费率",
trigger: ["blur"],
},
message: '请输入合同签订费率',
trigger: ['blur']
}
],
service_duration: [
{
required: true,
message: "请输入合同服务工期",
trigger: ["blur"],
},
message: '请输入合同服务工期',
trigger: ['blur']
}
],
start_date: [
{
required: true,
message: "请输入计划开始日期",
trigger: ["blur"],
},
message: '请输入计划开始日期',
trigger: ['blur']
}
],
end_date: [
{
required: true,
message: "请输入计划结束日期",
trigger: ["blur"],
message: '请输入计划结束日期',
trigger: ['blur']
},
{
validator: chekcDate,
@ -579,194 +593,194 @@ const formRules = reactive<any>({
performance_money: [
{
required: true,
message: "请输入履约金",
trigger: ["blur"],
},
message: '请输入履约金',
trigger: ['blur']
}
],
performance_money_expiration_time: [
{
required: true,
message: "请输入履约金到期时间",
trigger: ["blur"],
},
message: '请输入履约金到期时间',
trigger: ['blur']
}
],
payment_method: [
{
required: true,
message: "请输入合同付款方式",
trigger: ["blur"],
},
message: '请输入合同付款方式',
trigger: ['blur']
}
],
content: [
{
required: true,
message: "请输入合同主要内容",
trigger: ["blur"],
},
message: '请输入合同主要内容',
trigger: ['blur']
}
],
signed_dept: [
{
required: true,
message: "请输入签订部门",
trigger: ["blur"],
},
message: '请输入签订部门',
trigger: ['blur']
}
],
signed_head: [
{
required: true,
message: "请输入签订负责人",
trigger: ["blur"],
},
message: '请输入签订负责人',
trigger: ['blur']
}
],
supervise_dept: [
{
required: true,
message: "请输入监管部门",
trigger: ["blur"],
},
message: '请输入监管部门',
trigger: ['blur']
}
],
project_manager: [
{
required: true,
message: "请输入项目总监/经理",
trigger: ["blur"],
},
message: '请输入项目总监/经理',
trigger: ['blur']
}
],
implement_method: [
{
required: true,
message: "请输入实施方式",
trigger: ["blur"],
},
message: '请输入实施方式',
trigger: ['blur']
}
],
seal_name: [
{
required: true,
message: "请输入盖章名称",
trigger: ["blur"],
},
message: '请输入盖章名称',
trigger: ['blur']
}
],
is_limit: [
{
required: true,
message: "请输入是否限制",
trigger: ["blur"],
},
message: '请输入是否限制',
trigger: ['blur']
}
],
limit_num: [
{
required: true,
message: "请输入限制次数",
trigger: ["blur"],
},
message: '请输入限制次数',
trigger: ['blur']
}
],
file_type: [
{
required: true,
message: "请输入文件类型",
trigger: ["blur"],
},
message: '请输入文件类型',
trigger: ['blur']
}
],
seal_num: [
{
required: true,
message: "请输入盖章份数",
trigger: ["blur"],
},
message: '请输入盖章份数',
trigger: ['blur']
}
],
seal_user: [
{
required: true,
message: "请输入盖章人",
trigger: ["blur"],
},
message: '请输入盖章人',
trigger: ['blur']
}
],
plance_seal: [
{
required: true,
message: "请输入骑缝盖章",
trigger: ["blur"],
},
message: '请输入骑缝盖章',
trigger: ['blur']
}
],
send_date: [
{
required: true,
message: "请输入发出日期",
trigger: ["blur"],
},
message: '请输入发出日期',
trigger: ['blur']
}
],
mailing_number: [
{
required: true,
message: "请输入邮寄编号",
trigger: ["blur"],
},
message: '请输入邮寄编号',
trigger: ['blur']
}
],
review_status: [
{
required: true,
message: "请输入评审状态",
trigger: ["blur"],
},
message: '请输入评审状态',
trigger: ['blur']
}
],
status: [
{
required: true,
message: "请输入立项状态",
trigger: ["blur"],
},
message: '请输入立项状态',
trigger: ['blur']
}
],
create_user: [
{
required: true,
message: "请输入录入人",
trigger: ["blur"],
},
],
});
message: '请输入录入人',
trigger: ['blur']
}
]
})
//
const setFormData = async (data: Record<any, any>) => {
for (const key in formData) {
if (data[key] != null && data[key] != undefined) {
//@ts-ignore
formData[key] = data[key];
formData[key] = data[key]
}
}
};
}
const getDetail = async (row: Record<string, any>) => {
const data = await apiMarketingContractDetail({
id: row.id,
});
setFormData(data);
};
id: row.id
})
setFormData(data)
}
//
const handleSubmit = async () => {
await formRef.value?.validate();
const data = { ...formData };
mode.value == "edit"
await formRef.value?.validate()
const data = { ...formData }
mode.value == 'edit'
? await apiMarketingContractEdit(data)
: await apiMarketingContractAdd(data);
popupRef.value?.close();
emit("success");
};
: await apiMarketingContractAdd(data)
popupRef.value?.close()
emit('success')
}
//
const open = (type = "add") => {
mode.value = type;
popupRef.value?.open();
};
const open = (type = 'add') => {
mode.value = type
popupRef.value?.open()
}
//
const handleClose = () => {
emit("close");
};
emit('close')
}
defineExpose({
open,
setFormData,
getDetail,
});
getDetail
})
</script>

View File

@ -1,6 +1,7 @@
<template>
<div class="edit-popup">
<popup ref="popupRef" :title="popupTitle" :async="true" width="80vw" @confirm="handleSubmit" @close="handleClose">
<popup ref="popupRef" :title="popupTitle" :async="true" width="80vw" @confirm="handleSubmit"
@close="handleClose">
<el-form ref="formRef" :model="formData" label-width="160px" :rules="formRules">
<el-row>
<el-col :span="8">
@ -20,12 +21,11 @@
</el-col>
<el-col :span="8">
<el-form-item label="重要等级" prop="important_level">
<el-select v-model="formData.important_level" placeholder="请选择重要等级" class=" flex-1">
<el-select v-model="formData.important_level" placeholder="请选择重要等级" class="flex-1">
<el-option :label="item.name" :value="parseInt(item.value)"
v-for="item in dictData.custom_important_level">
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
@ -38,8 +38,8 @@
</el-col>
<el-col :span="8">
<el-form-item label="客户分类" prop="category">
<el-select v-model="formData.category" placeholder="请选择客户分类" class=" flex-1">
<el-option :label="item.name" :value="(item.value)"
<el-select v-model="formData.category" placeholder="请选择客户分类" class="flex-1">
<el-option :label="item.name" :value="item.value"
v-for="item in dictData.custom_category">
</el-option>
</el-select>
@ -95,18 +95,18 @@
</el-col>
<el-col :span="8">
<el-form-item label="所在省份" prop="province">
<el-select v-model="formData.province" clearable placeholder="请选择省" @change="province_change"
class="flex-1">
<el-select v-model="formData.province" clearable placeholder="请选择省"
@change="province_change" class="flex-1">
<el-option v-for="(item, index) in datas.provinceOptions" :key="index"
:label="item.province_name" :value="(item.province_code)" />
:label="item.province_name" :value="item.province_code" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="所在市区" prop="city">
<el-select v-model="formData.city" clearable placeholder="请选择市" class="flex-1">
<el-option v-for="(item, index) in datas.cityOptions" :key="index" :label="item.city_name"
:value="(item.city_code)" />
<el-option v-for="(item, index) in datas.cityOptions" :key="index"
:label="item.city_name" :value="item.city_code" />
</el-select>
</el-form-item>
</el-col>
@ -144,7 +144,6 @@
</el-col>
</el-row>
<formTable :formData="formData.detail" :config="tableConfig" :dictData="dictData">
</formTable>
</el-form>
@ -155,11 +154,16 @@
<script lang="ts" setup name="marketingCustomEdit">
import type { FormInstance } from 'element-plus'
import Popup from '@/components/popup/index.vue'
import { apiMarketingCustomAdd, apiMarketingCustomEdit, apiMarketingCustomDetail, apiMarketingCustomContactsLists, apiMarketingCustomContactsDelete } from '@/api/marketing_custom'
import { checkPhone, checkEmail } from "@/utils/validate"
import {
apiMarketingCustomAdd,
apiMarketingCustomEdit,
apiMarketingCustomDetail,
apiMarketingCustomContactsLists,
apiMarketingCustomContactsDelete
} from '@/api/marketing_custom'
import { checkPhone, checkEmail } from '@/utils/validate'
import type { PropType } from 'vue'
import { apiCityList, apiProvinceList } from "@/api/common";
import { apiCityList, apiProvinceList } from '@/api/common'
defineProps({
dictData: {
@ -173,7 +177,6 @@ const formRef = shallowRef<FormInstance>()
const popupRef = shallowRef<InstanceType<typeof Popup>>()
const mode = ref('add')
//
const popupTitle = computed(() => {
return mode.value == 'edit' ? '编辑市场经营--客户信息' : '新增市场经营--客户信息'
@ -181,8 +184,8 @@ const popupTitle = computed(() => {
const datas = reactive({
provinceOptions: [],
cityOptions: [],
});
cityOptions: []
})
//
const formData = reactive({
@ -214,211 +217,244 @@ const formData = reactive({
create_time: '',
detail: [
{
"name": "",
"dept": "",
"gender": 0,
"job": "",
"mobile": "",
"telephone": "",
"email": "",
"qq": "",
"remark": ""
name: '',
dept: '',
gender: 0,
job: '',
mobile: '',
telephone: '',
email: '',
qq: '',
remark: ''
}
]
})
const tableConfig = reactive(
{
title: "联系人",
tableConfig: [
{
label: "姓名",
value: 'name',
},
{
label: "部门",
value: 'dept',
},
{
label: "性别",
value: 'gender',
select: [{
const tableConfig = reactive({
title: '联系人',
tableConfig: [
{
label: '姓名',
value: 'name'
},
{
label: '部门',
value: 'dept'
},
{
label: '性别',
value: 'gender',
select: [
{
name: '男',
value: 0
},
{
name: '女',
value: 1
},
]
},
{
label: "职务",
value: 'job',
},
{
label: "手机",
value: 'mobile',
check: ['detail', checkPhone]
},
{
label: "电话",
value: 'telephone',
},
{
label: "邮箱",
value: 'email',
check: ['detail', checkEmail]
},
{
label: "qq",
value: 'qq',
},
{
label: "备注",
value: 'remark',
},
],
deleteApi: apiMarketingCustomContactsDelete,
}
)
}
]
},
{
label: '职务',
value: 'job'
},
{
label: '手机',
value: 'mobile',
check: ['detail', checkPhone]
},
{
label: '电话',
value: 'telephone'
},
{
label: '邮箱',
value: 'email',
check: ['detail', checkEmail]
},
{
label: 'qq',
value: 'qq'
},
{
label: '备注',
value: 'remark'
}
],
deleteApi: apiMarketingCustomContactsDelete
})
//
const formRules = reactive<any>({
name: [{
required: true,
message: '请输入客户名称',
trigger: ['blur']
}],
sub_name: [{
required: true,
message: '请输入客户简称',
trigger: ['blur']
}],
code: [{
required: true,
message: '请输入客户编号',
trigger: ['blur']
}],
important_level: [{
required: true,
message: '请输入重要等级',
trigger: ['blur']
}],
dept_id: [{
required: true,
message: '请输入负责部门',
trigger: ['blur']
}],
category: [{
required: true,
message: '请输入客户分类',
trigger: ['blur']
}],
name: [
{
required: true,
message: '请输入客户名称',
trigger: ['blur']
}
],
sub_name: [
{
required: true,
message: '请输入客户简称',
trigger: ['blur']
}
],
code: [
{
required: true,
message: '请输入客户编号',
trigger: ['blur']
}
],
important_level: [
{
required: true,
message: '请输入重要等级',
trigger: ['blur']
}
],
dept_id: [
{
required: true,
message: '请输入负责部门',
trigger: ['blur']
}
],
category: [
{
required: true,
message: '请输入客户分类',
trigger: ['blur']
}
],
invoice_company: [{
required: true,
message: '请输入开票单位',
trigger: ['blur']
}],
taxpayer_identification_number: [{
required: true,
message: '请输入纳税人识别号',
trigger: ['blur']
}],
opening_bank: [{
required: true,
message: '请输入开户银行',
trigger: ['blur']
}],
invoice_contact: [{
required: true,
message: '请输入开票联系人',
trigger: ['blur']
}],
invoice_company_address: [{
required: true,
message: '请输入开票单位注册地址',
trigger: ['blur']
}],
invoice_company_telephone: [{
required: true,
message: '请输入开票单位电话',
trigger: ['blur']
}],
opening_bank_account: [{
required: true,
message: '请输入开户账号',
trigger: ['blur']
}],
email: [{
required: true,
message: '请输入电子邮箱',
trigger: ['blur']
},
{
validator: checkEmail,
trigger: ['blur']
}],
province: [{
required: true,
message: '请输入省份',
trigger: ['blur']
}],
city: [{
required: true,
message: '请输入城市',
trigger: ['blur']
}],
post_code: [{
required: true,
message: '请输入邮编',
trigger: ['blur']
}],
telephone: [{
required: true,
message: '请输入电话',
trigger: ['blur']
}],
invoice_company: [
{
required: true,
message: '请输入开票单位',
trigger: ['blur']
}
],
taxpayer_identification_number: [
{
required: true,
message: '请输入纳税人识别号',
trigger: ['blur']
}
],
opening_bank: [
{
required: true,
message: '请输入开户银行',
trigger: ['blur']
}
],
invoice_contact: [
{
required: true,
message: '请输入开票联系人',
trigger: ['blur']
}
],
invoice_company_address: [
{
required: true,
message: '请输入开票单位注册地址',
trigger: ['blur']
}
],
invoice_company_telephone: [
{
required: true,
message: '请输入开票单位电话',
trigger: ['blur']
}
],
opening_bank_account: [
{
required: true,
message: '请输入开户账号',
trigger: ['blur']
}
],
// email: [{
// required: true,
// message: '',
// trigger: ['blur']
// },
// {
// validator: checkEmail,
// trigger: ['blur']
// }],
province: [
{
required: true,
message: '请输入省份',
trigger: ['blur']
}
],
city: [
{
required: true,
message: '请输入城市',
trigger: ['blur']
}
],
post_code: [
{
required: true,
message: '请输入邮编',
trigger: ['blur']
}
],
// telephone: [{
// required: true,
// message: '',
// trigger: ['blur']
// }],
// {
// validator: checkPhone,
// trigger: ['blur']
// }],
fax: [{
required: true,
message: '请输入传真',
trigger: ['blur']
}],
website: [{
required: true,
message: '请输入网址',
trigger: ['blur']
}],
address: [{
required: true,
message: '请输入地址',
trigger: ['blur']
}],
create_user: [{
required: true,
message: '请输入录入人',
trigger: ['blur']
}],
create_time: [{
required: true,
message: '请输入录入日期',
trigger: ['blur']
}]
fax: [
{
required: true,
message: '请输入传真',
trigger: ['blur']
}
],
website: [
{
required: true,
message: '请输入网址',
trigger: ['blur']
}
],
address: [
{
required: true,
message: '请输入地址',
trigger: ['blur']
}
],
create_user: [
{
required: true,
message: '请输入录入人',
trigger: ['blur']
}
],
create_time: [
{
required: true,
message: '请输入录入日期',
trigger: ['blur']
}
]
})
//
const setFormData = async (data: Record<any, any>) => {
for (const key in formData) {
@ -427,11 +463,9 @@ const setFormData = async (data: Record<any, any>) => {
formData[key] = data[key]
}
}
let res = await apiMarketingCustomContactsLists({ custom_id: data.id })
const res = await apiMarketingCustomContactsLists({ custom_id: data.id })
formData.detail = res.lists
getCityList();
getCityList()
}
const getDetail = async (row: Record<string, any>) => {
@ -441,14 +475,11 @@ const getDetail = async (row: Record<string, any>) => {
setFormData(data)
}
//
const handleSubmit = async () => {
await formRef.value?.validate()
const data = { ...formData, }
mode.value == 'edit'
? await apiMarketingCustomEdit(data)
: await apiMarketingCustomAdd(data)
const data = { ...formData }
mode.value == 'edit' ? await apiMarketingCustomEdit(data) : await apiMarketingCustomAdd(data)
popupRef.value?.close()
emit('success')
}
@ -465,18 +496,18 @@ const handleClose = () => {
}
const getProvinceList = async () => {
const data = await apiProvinceList({});
datas["provinceOptions"] = data;
};
const data = await apiProvinceList({})
datas['provinceOptions'] = data
}
const getCityList = async () => {
const data = await apiCityList({ province_code: formData.province });
datas["cityOptions"] = data;
};
const data = await apiCityList({ province_code: formData.province })
datas['cityOptions'] = data
}
//
function province_change(value: string) {
function province_change (value: string) {
formData.city = ''
getCityList();
getCityList()
}
getProvinceList()