pull/781/head
zy 2025-05-31 00:27:48 +08:00
parent 1dd341393a
commit 3fc90c00b7
13 changed files with 138 additions and 66 deletions

View File

@ -9,3 +9,13 @@ export const getAreaTree = async () => {
export const getAreaByIp = async (ip: string) => { export const getAreaByIp = async (ip: string) => {
return await request.get({ url: '/system/area/get-by-ip?ip=' + ip }) return await request.get({ url: '/system/area/get-by-ip?ip=' + ip })
} }
// 获得选择的地区
export const getChooseAreaTree = async () => {
return await request.get({ url: '/crm/area/getChooseAreaTree' })
}
// 获得选择的地区
export const setChooseAreaTree = async (data: any) => {
return await request.put({ url: 'crm/area/update', data })
}

View File

@ -336,7 +336,6 @@ const submitForm = async () => {
const changeCustomerId = (val) => { const changeCustomerId = (val) => {
let arr = customerList.value.filter(v => v.id === val) let arr = customerList.value.filter(v => v.id === val)
console.log('%csrc/views/crm/contact/ContactForm.vue:341 arr', 'color: #007acc;', arr,customerList.value);
if(arr.length) formData.value.registeredAddress = arr[0]['registeredAddress'] if(arr.length) formData.value.registeredAddress = arr[0]['registeredAddress']
} }

View File

@ -176,7 +176,7 @@
v-hasPermi="['crm:contact:update']" v-hasPermi="['crm:contact:update']"
link link
type="primary" type="primary"
@click="openForm('update', scope.row.id)" @click="openForm('update', scope.row.id, scope.row.customerId)"
> >
编辑 编辑
</el-button> </el-button>
@ -269,8 +269,8 @@ const handleTabClick = (tab: TabsPaneContext) => {
/** 添加/修改操作 */ /** 添加/修改操作 */
const formRef = ref() const formRef = ref()
const openForm = (type: string, id?: number) => { const openForm = (type: string, id?: number, customerId?: number) => {
formRef.value.open(type, id) formRef.value.open(type, id, customerId)
} }
/** 删除按钮操作 */ /** 删除按钮操作 */

View File

@ -106,14 +106,14 @@
<ContentWrap> <ContentWrap>
<ContractAuthPersonInfo <ContractAuthPersonInfo
ref="personDataRef" ref="personDataRef"
:products="formData.contractAAuthorizedPersons" :products="JSON.parse(JSON.stringify(formData.contractAAuthorizedPersons))"
/> />
</ContentWrap> </ContentWrap>
<ContentWrap style="border: none"> <ContentWrap style="border: none">
甲方授权人 甲方授权人
</ContentWrap> </ContentWrap>
<ContentWrap> <ContentWrap>
<ContractBAuthorizedPersonForm ref="ContractBAuthorizedPersonFormRef" :formFields="formFields" :customerId="formData.customerId" :contract-id="formData.id" /> <ContractBAuthorizedPersonForm ref="ContractBAuthorizedPersonFormRef" :data="formData.contractAAuthorizedCompanysHis" :formFields="formFields" :customerId="formData.customerId" :contract-id="formData.id" />
</ContentWrap> </ContentWrap>
</div> </div>
<ContracExtension ref="contractExtensionFormRef" :formFields="formFields" v-if="formData.changeItem == 3" :data="formData" /> <ContracExtension ref="contractExtensionFormRef" :formFields="formFields" v-if="formData.changeItem == 3" :data="formData" />
@ -245,7 +245,8 @@ const formData = ref({
deptId: undefined, deptId: undefined,
quotationTimes: undefined, quotationTimes: undefined,
changeItem: 1, changeItem: 1,
products: [] products: [],
contractAAuthorizedCompanysHis: []
}) })
const formRules = reactive({ const formRules = reactive({
name: [{ required: true, message: '合同名称不能为空', trigger: 'blur' }], name: [{ required: true, message: '合同名称不能为空', trigger: 'blur' }],
@ -290,6 +291,7 @@ const open = async (type: string) => {
try { try {
let data = await ContractApi.getContract(type) let data = await ContractApi.getContract(type)
data.agreementDeadline = moment(data.endTime).format('YYYY-MM-DD') data.agreementDeadline = moment(data.endTime).format('YYYY-MM-DD')
formData.value.contractAAuthorizedCompanysHis = JSON.parse(JSON.stringify(data.contractAAuthorizedPersons))
if(!route.query.id) delete data.customerId if(!route.query.id) delete data.customerId
@ -390,11 +392,11 @@ if(contractFormRef.value) {
data.changeAmount = dataFormList.changeAmount data.changeAmount = dataFormList.changeAmount
data.changeAmountDeadline = dataFormList.changeAmountDeadline data.changeAmountDeadline = dataFormList.changeAmountDeadline
} else if(formData.value.changeItem == 2) { } else if(formData.value.changeItem == 2) {
let ids = [] // let ids = []
dataFormList.map(item => { // dataFormList.map(item => {
ids.push(item.customerContactId) // ids.push(item.customerContactId)
}) // })
data.afterAuthorizerId = ids.join(',') data.afterAuthorizerId = JSON.stringify(dataFormList)
} else if(formData.value.changeItem == 3) { } else if(formData.value.changeItem == 3) {
data.agreementDeadline = dataFormList.agreementDeadline data.agreementDeadline = dataFormList.agreementDeadline
data.extensionYears = dataFormList.extensionYears data.extensionYears = dataFormList.extensionYears
@ -407,7 +409,7 @@ if(contractFormRef.value) {
} else if(formData.value.changeItem == 5) { } else if(formData.value.changeItem == 5) {
let ids = [] let ids = []
dataFormList.map(item => { dataFormList.map(item => {
ids.push(item.id) ids.push(item.customerCompanyId)
}) })
data.afterAffiliateCompanyId = ids.join(',') data.afterAffiliateCompanyId = ids.join(',')
} else if(formData.value.changeItem == 6) { } else if(formData.value.changeItem == 6) {

View File

@ -901,7 +901,8 @@ const handleQuotationChange = async (quotationId: number) => {
if (!quotationId) return if (!quotationId) return
try { try {
const quotation = await QuotationApi.getQuotation(quotationId) const quotation = await QuotationApi.getQuotation(quotationId)
formData.value.products = quotation.products;
if(!formType.value) formData.value.products = quotation.products;
// formData.value.customerId = quotation.customerId; // formData.value.customerId = quotation.customerId;
formData.value.invoiceTemplateId = quotation.invoiceTemplateId; formData.value.invoiceTemplateId = quotation.invoiceTemplateId;

View File

@ -80,7 +80,8 @@ const getList = async (val) => {
companyBank: v.companyBank, companyBank: v.companyBank,
companyAccount: v.companyAccount, companyAccount: v.companyAccount,
companyAddress: v.companyAddress, companyAddress: v.companyAddress,
id: v.id // id: v.id,
customerCompanyId: v.id
}) })
}) })
formData.value = newList formData.value = newList

View File

@ -1,18 +1,22 @@
<template> <template>
<el-table :data="formData" class="-mt-10px"> <el-table :data="formData" class="-mt-10px">
<el-table-column label="序号" type="index" width="100" /> <el-table-column label="序号" type="index" width="100" />
<el-table-column label="是否授权人" prop="authPersonType" min-width="150" /> <!-- <el-table-column label="是否授权人" prop="authPersonType" align="center" min-width="150" /> -->
<el-table-column label="姓名" prop="customerName" min-width="150" /> <el-table-column label="姓名" prop="customerName" align="center" min-width="150" />
<el-table-column label="手机号" prop="phoneNumber" min-width="150" /> <el-table-column label="手机号" prop="phoneNumber" align="center" min-width="150" />
<el-table-column label="微信号" prop="wechat" min-width="150" /> <el-table-column label="微信号" prop="wechat" align="center" min-width="150" />
<el-table-column label="单位名称" prop="customerName" min-width="150" /> <!-- <el-table-column label="单位名称" prop="customerName" min-width="150" /> -->
<el-table-column label="职务" prop="name" min-width="150" /> <el-table-column label="职务" prop="post" align="center" min-width="150" />
<el-table-column label="联系地址" prop="name" min-width="150" /> <el-table-column label="家庭地址" prop="detailAddress" align="center" min-width="150" />
<el-table-column label="类别" prop="name" min-width="150" /> <el-table-column label="类别" prop="name" align="center" min-width="150" />
<el-table-column label="邮箱" prop="email" min-width="150" /> <el-table-column label="邮箱" prop="email" align="center" min-width="150" />
<el-table-column label="身份证号" prop="name" min-width="150" /> <el-table-column label="身份证号" prop="idNumber" align="center" min-width="180" />
<el-table-column label="生日" prop="name" min-width="150" /> <el-table-column label="生日" prop="birthday" align="center" min-width="150" />
<el-table-column label="性别" prop="name" min-width="150" /> <el-table-column label="性别" prop="sex" align="center" min-width="100">
<template #default="scope">
<dict-tag :type="DICT_TYPE.SYSTEM_USER_SEX" :value="scope.row.sex" />
</template>
</el-table-column>
</el-table> </el-table>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">

View File

@ -101,7 +101,7 @@
<ContentWrap style="border: none"> <ContentWrap style="border: none">
甲方授权人 甲方授权人
</ContentWrap> </ContentWrap>
<ContractBAuthorizedPersonForm :formFields="formFields" :type="1" ref="ContractBAuthorizedPersonFormRef" :customerId="formData.customerId" :contract-id="formData.id" /> <ContractBAuthorizedPersonForm :formFields="formFields" :type="1" :data="formData.contractAAuthorizedCompanysHis" ref="ContractBAuthorizedPersonFormRef" :customerId="formData.customerId" :contract-id="formData.id" />
</div> </div>
<ContracExtension ref="contractExtensionFormRef" :isTrue="isTrue" :formFields="formFields" v-if="formData.changeItem == 3" :data="formData" /> <ContracExtension ref="contractExtensionFormRef" :isTrue="isTrue" :formFields="formFields" v-if="formData.changeItem == 3" :data="formData" />
<el-col :span="24"> <el-col :span="24">
@ -257,7 +257,8 @@ const formData = ref({
deptId: undefined, deptId: undefined,
quotationTimes: undefined, quotationTimes: undefined,
changeItem: 1, changeItem: 1,
products: [] products: [],
contractAAuthorizedCompanysHis: []
}) })
const formRules = reactive({ const formRules = reactive({
name: [{ required: true, message: '合同名称不能为空', trigger: 'blur' }], name: [{ required: true, message: '合同名称不能为空', trigger: 'blur' }],
@ -302,6 +303,7 @@ const open = async (type: string) => {
// formData.value = Object.assign(formData.value, data) // formData.value = Object.assign(formData.value, data)
let data = await ContractApi.getChangeContract(type) let data = await ContractApi.getChangeContract(type)
formData.value = data.contractDetail formData.value = data.contractDetail
formData.value.contractAAuthorizedCompanysHis = JSON.parse(JSON.stringify(data.contractAAuthorizedPersons))
formData.value.contractAAuthorizedCompanys = data.contractAAuthorizedCompanys formData.value.contractAAuthorizedCompanys = data.contractAAuthorizedCompanys
//contractDetail //contractDetail
@ -415,11 +417,11 @@ if(contractFormRef.value) {
data.changeAmount = dataFormList.changeAmount data.changeAmount = dataFormList.changeAmount
data.changeAmountDeadline = dataFormList.changeAmountDeadline data.changeAmountDeadline = dataFormList.changeAmountDeadline
} else if(formData.value.changeItem == 2) { } else if(formData.value.changeItem == 2) {
let ids = [] // let ids = []
dataFormList.map(item => { // dataFormList.map(item => {
ids.push(item.id) // ids.push(item.id)
}) // })
data.afterAuthorizerId = ids.join(',') data.afterAuthorizerId = JSON.stringify(dataFormList)
} else if(formData.value.changeItem == 3) { } else if(formData.value.changeItem == 3) {
data.agreementDeadline = dataFormList.agreementDeadline data.agreementDeadline = dataFormList.agreementDeadline
data.extensionYears = dataFormList.extensionYears data.extensionYears = dataFormList.extensionYears
@ -432,7 +434,7 @@ if(contractFormRef.value) {
} else if(formData.value.changeItem == 5) { } else if(formData.value.changeItem == 5) {
let ids = [] let ids = []
dataFormList.map(item => { dataFormList.map(item => {
ids.push(item.id) ids.push(item.customerCompanyId)
}) })
data.afterAffiliateCompanyId = ids.join(',') data.afterAffiliateCompanyId = ids.join(',')
} else if(formData.value.changeItem == 6) { } else if(formData.value.changeItem == 6) {

View File

@ -1032,7 +1032,7 @@ const handleQuotationChange = async (quotationId: number) => {
if (!quotationId) return if (!quotationId) return
try { try {
const quotation = await QuotationApi.getQuotation(quotationId) const quotation = await QuotationApi.getQuotation(quotationId)
formData.value.products = quotation.products; // formData.value.products = quotation.products;
formData.value.customerId = quotation.customerId; formData.value.customerId = quotation.customerId;
formData.value.invoiceTemplateId = quotation.invoiceTemplateId; formData.value.invoiceTemplateId = quotation.invoiceTemplateId;

View File

@ -11,30 +11,59 @@
<!-- 操作 --> <!-- 操作 -->
<template #header> <template #header>
<div class="flex items-center justify-between"> <div class="flex items-center justify-between">
<CardTitle title="行业设置" /> <CardTitle title="额度设置" />
<el-button type="primary" @click="onSubmit" v-hasPermi="['crm:contract-config:update']"> <el-button type="primary" @click="onSubmit" v-hasPermi="['crm:contract-industry:update']">
保存 保存
</el-button> </el-button>
</div> </div>
</template> </template>
<!-- 表单 --> <!-- 表单 -->
<el-form-item label="提前提醒设置" prop="notifyEnabled"> <el-row>
<el-tree <el-col :span="12">
ref="treeRef" <el-form-item label="禁授行业" prop="notifyEnabled">
v-model="formData.deptId" <el-tree
:data="list" ref="treeRef"
v-model="formData.deptId"
:props="props" :data="list"
filterable
@check="nodeClick" :props="props"
:cache-data="cacheData" filterable
node-key="id" @check="nodeClick"
multiple :cache-data="cacheData"
:render-after-expand="false" node-key="id"
show-checkbox multiple
placeholder="请选择归属部门" :render-after-expand="false"
/> show-checkbox
</el-form-item> placeholder="请选择归属部门"
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="禁授地区" prop="notifyEnabled">
<div style="width: 100%; height: 700px">
<el-auto-resizer>
<template #default="{ height, width }">
<el-tree-v2
ref="treeAreaRef"
:width="width"
:height="height"
v-model="formData.areaId"
:data="areaList"
:props="props"
filterable
@check="nodeClickArea"
node-key="id"
multiple
:render-after-expand="false"
show-checkbox
placeholder="请选择归属部门"
/>
</template>
</el-auto-resizer>
</div>
</el-form-item>
</el-col>
</el-row>
</el-card> </el-card>
</el-form> </el-form>
</ContentWrap> </ContentWrap>
@ -45,6 +74,7 @@ import download from '@/utils/download'
import { IndustryApi, IndustryVO } from '@/api/crm/industry' import { IndustryApi, IndustryVO } from '@/api/crm/industry'
import IndustryForm from './IndustryForm.vue' import IndustryForm from './IndustryForm.vue'
import { defaultProps, handleTree } from '@/utils/tree' import { defaultProps, handleTree } from '@/utils/tree'
import * as AreaApi from '@/api/system/area'
/** 行业 列表 */ /** 行业 列表 */
defineOptions({ name: 'Industry' }) defineOptions({ name: 'Industry' })
@ -53,10 +83,12 @@ const message = useMessage() // 消息弹窗
const { t } = useI18n() // const { t } = useI18n() //
const formData = reactive({ const formData = reactive({
deptId: undefined deptId: undefined,
areaId: undefined
}) })
const loading = ref(true) // const loading = ref(true) //
const list = ref<IndustryVO[]>([]) // const list = ref<IndustryVO[]>([]) //
const areaList = ref([])
const total = ref(0) // const total = ref(0) //
const props = ref({ const props = ref({
label: 'name', label: 'name',
@ -74,7 +106,9 @@ const queryParams = reactive({
const queryFormRef = ref() // const queryFormRef = ref() //
const exportLoading = ref(false) // const exportLoading = ref(false) //
const treeRef = ref('') const treeRef = ref('')
const treeAreaRef = ref('')
const cacheDataList = ref([]) const cacheDataList = ref([])
const cacheDataAreaList = ref([])
const formLoading = ref(false) const formLoading = ref(false)
@ -92,16 +126,22 @@ const load = (node, resolve) => {
}, 400) }, 400)
} }
//
const nodeClick = (checkedNodes,checkedKeys,halfCheckedNodes,halfCheckedKeys) => { const nodeClick = (checkedNodes,checkedKeys,halfCheckedNodes,halfCheckedKeys) => {
// console.log('%csrc/views/crm/industry/index.vue:96 node', 'color: #007acc;', checkedKeys);
cacheDataList.value = [...checkedKeys.checkedKeys, ...checkedKeys.halfCheckedKeys] cacheDataList.value = [...checkedKeys.checkedKeys, ...checkedKeys.halfCheckedKeys]
} }
//
const nodeClickArea = (checkedNodes,checkedKeys,halfCheckedNodes,halfCheckedKeys) => {
cacheDataAreaList.value = [...checkedKeys.checkedKeys, ...checkedKeys.halfCheckedKeys]
}
/** 查询列表 */ /** 查询列表 */
const getList = async () => { const getList = async () => {
formLoading.value = true formLoading.value = true
try { try {
list.value = await IndustryApi.getIndustryPage() list.value = await IndustryApi.getIndustryPage()
areaList.value = await AreaApi.getAreaTree()
// getIds(list.value) // getIds(list.value)
} finally { } finally {
formLoading.value = false formLoading.value = false
@ -110,14 +150,24 @@ const getList = async () => {
// //
const getCheckNodes = async () => { const getCheckNodes = async () => {
let data = await IndustryApi.getIndustry() let data = await IndustryApi.getIndustry()
cacheDataList.value =
setCheckedKeys(data.chooseIds) setCheckedKeys(data.chooseIds)
let dataArea = await AreaApi.getChooseAreaTree()
setCheckedAreaKeys(dataArea.chooseIds)
} }
const onSubmit = async () => { const onSubmit = async () => {
try { try {
const checkedNodes = treeRef.value.getCheckedNodes();
const checkedIds = checkedNodes.map(node => node.id);
await IndustryApi.updateIndustry({ await IndustryApi.updateIndustry({
ids: cacheDataList.value ids: checkedIds
})
const checkedAreaNodes = treeAreaRef.value.getCheckedNodes();
const checkedAreaIds = checkedAreaNodes.map(node => node.id);
await AreaApi.setChooseAreaTree({
ids: checkedAreaIds
}) })
message.success(t('common.updateSuccess')) message.success(t('common.updateSuccess'))
} finally { } finally {
@ -132,11 +182,16 @@ const onSubmit = async () => {
// } // }
// } // }
// } // }
//
const setCheckedKeys = (data) => { const setCheckedKeys = (data) => {
treeRef.value!.setCheckedKeys(data, false) treeRef.value!.setCheckedKeys(data, false)
} }
//
const setCheckedAreaKeys = (data) => {
treeAreaRef.value!.setCheckedKeys(data, false)
}
/** 重置按钮操作 */ /** 重置按钮操作 */
const resetQuery = () => { const resetQuery = () => {
queryFormRef.value.resetFields() queryFormRef.value.resetFields()

View File

@ -74,7 +74,7 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
</template> </template>
<template #cooperationType> <!-- <template #cooperationType>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="合作类型" prop="cooperationType"> <el-form-item label="合作类型" prop="cooperationType">
<el-select v-model="formData.cooperationType" disabled placeholder="" filterable clearable class="w-1/1"> <el-select v-model="formData.cooperationType" disabled placeholder="" filterable clearable class="w-1/1">
@ -87,7 +87,7 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
</template> </template> -->
<template #regType> <template #regType>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="公司类型" prop="regType"> <el-form-item label="公司类型" prop="regType">

View File

@ -71,7 +71,7 @@
</el-select> --> </el-select> -->
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <!-- <el-col :span="8">
<el-form-item label="公司类型" prop="cooperationType"> <el-form-item label="公司类型" prop="cooperationType">
<el-select v-model="formData.cooperationType" disabled filterable clearable placeholder="" class="w-1/1"> <el-select v-model="formData.cooperationType" disabled filterable clearable placeholder="" class="w-1/1">
<el-option <el-option
@ -82,7 +82,7 @@
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col> -->
<el-col :span="8"> <el-col :span="8">
<el-form-item label="公司类型" prop="regType"> <el-form-item label="公司类型" prop="regType">
<el-input v-model="formData.regType" disabled placeholder="" clearable /> <el-input v-model="formData.regType" disabled placeholder="" clearable />
@ -114,8 +114,6 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row>
<el-row>
<!-- <el-col :span="8"> <!-- <el-col :span="8">
<el-form-item label="企业类型" prop="enterpriseType"> <el-form-item label="企业类型" prop="enterpriseType">
<el-input v-model="formData.enterpriseType" clearable /> <el-input v-model="formData.enterpriseType" clearable />

View File

@ -10,7 +10,7 @@
<!-- 列表 --> <!-- 列表 -->
<ContentWrap> <ContentWrap>
<div style="width: 100%; height: 700px"> <div style="width: 100%; height: 500px">
<!-- AutoResizer 自动调节大小 --> <!-- AutoResizer 自动调节大小 -->
<el-auto-resizer> <el-auto-resizer>
<template #default="{ height, width }"> <template #default="{ height, width }">