This commit is contained in:
‘huanghaiixia’
2025-12-19 17:50:27 +08:00
parent 694d3cc2ee
commit 2b2c8df0f7
6 changed files with 104 additions and 145 deletions

View File

@ -2,35 +2,63 @@
<a-spin :spinning="spinning" tip="加载中...">
<div class="page-bg-wrap formViewStyle">
<a-form ref="formRef" :model="formState" :rules="rules" v-bind="layout">
<a-card title="评价基础信息" :bordered="false" >
<a-card title="" :bordered="false" >
<a-row>
<a-col :span="8">
<a-form-item label="客户名称" name="cpCodeName">
<a-input-search v-model:value="formState.cpCodeName" placeholder="请选择客户" readonly @search="onSearch"/>
<a-form-item label="编号" name="code">
<a-input v-model:value="formState.code" disabled />
</a-form-item>
</a-col>
<a-col :span="16">
<a-form-item label="标题" name="title" :label-col="{ span: 5, offset }" :wrapper-col="{ span: 24 }">
<a-input v-model:value="formState.title" placeholder="请输入标题"/>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="客户分类" name="classCode">
<a-input v-model:value="formState.classCode" disabled />
<a-form-item label="签报类型" name="typeCode">
<a-select v-model:value="formState.typeCode" :disabled="isDisable" placeholder="请选择签报类型" style="width: 100%" allow-clear>
<a-select-option v-for="item in optionSelect.typeCodeList" :key="item.code" :value="item.code">
{{ item.name }}
</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="评价体系" name="gsId">
<a-select v-model:value="formState.gsId" :disabled="isDisable" placeholder="请选择评价体系" @mouseenter="gsIdFocus(formState.gsId)" @change="gsIdChange" style="width: 100%" allow-clear>
<a-select-option v-for="item in optionSelect.gsIdList" :key="item.id" :value="item.id">
{{ item.gsName }}
<a-col :span="8">
<a-form-item label="密级" name="securityCode">
<a-select v-model:value="formState.securityCode" :disabled="isDisable" placeholder="请选择密级" style="width: 100%" allow-clear>
<a-select-option v-for="item in optionSelect.securityCodeList" :key="item.code" :value="item.code">
{{ item.name }}
</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="缓急" name="urgencyCode">
<a-select v-model:value="formState.urgencyCode" :disabled="isDisable" placeholder="请选择缓急" style="width: 100%" allow-clear>
<a-select-option v-for="item in optionSelect.urgencyCodeList" :key="item.code" :value="item.code">
{{ item.name }}
</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="评价日期" name="dateGrade">
<a-date-picker v-model:value="formState.dateGrade" disabled style="width: 100%" placeholder="请选择评价日期" />
<a-form-item label="拟稿人" name="empIdName">
<a-input-search v-model:value="formState.empIdName" placeholder="请选择拟稿人" readonly @search="onSearch"/>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="分类合计" name="score">
<a-input v-model:value="formState.score" disabled/>
<a-form-item label="拟稿人所属部门" name="bDeptIdName">
<a-input-search v-model:value="formState.bDeptIdName" placeholder="请选择拟稿人" readonly @search="onSearch"/>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="拟稿人所属公司" name="comIdName">
<a-input-search v-model:value="formState.comIdName" placeholder="请选择拟稿人" readonly @search="onSearch"/>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="拟稿日期" name="dateAppro">
<a-date-picker v-model:value="formState.dateAppro" style="width: 100%" placeholder="请选择评价日期" />
</a-form-item>
</a-col>
<a-col :span="8">
@ -42,20 +70,18 @@
</a-select>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="内容摘要" name="content" :label-col="{ span: 3 }" :wrapper-col="{ span: 24 }">
<a-textarea v-model:value="formState.content" :disabled="isDisable" placeholder="请输入备注最多1000字" :maxlength="1000" :auto-size="{ minRows: 4, }"/>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="备注" name="note" :label-col="{ span: 3 }" :wrapper-col="{ span: 24 }">
<a-textarea v-model:value="formState.note" :disabled="isDisable" placeholder="请输入备注最多200字" :maxlength="200" :auto-size="{ minRows: 2, maxRows: 5 }"/>
</a-form-item>
</a-col>
</a-row>
</a-card>
<a-card title="填写评分表信息" :bordered="false" >
<a-table :columns="columns" :data-source="dataList" >
<template #bodyCell="{ column, record, index }">
<template v-if="column.dataIndex === 'score'">
<a-input-number v-model:value="record.score" @change="numChagne('score', record, index)"/>
</template>
<template v-if="column.dataIndex === 'scoreDesc'">
<a-input v-model:value="record.scoreDesc" @change="numChagne('scoreDesc', record, index)"/>
</template>
</template>
</a-table>
</a-card>
<a-card title="附件信息" :bordered="false" >
<UploadList :disabled="isDisable" :list="dataFile" :value="formState.filePath" :tableName="tableName" :columnName="columnName" @change="uploadListChange"/>
</a-card>
@ -75,7 +101,6 @@
import useEventBus from '/@/hooks/event/useEventBus';
import type { Rule } from 'ant-design-vue/es/form';
import { getDictionary } from '/@/api/sales/Customer';
import { getLngGradeSystemPageList, getLngGradeSystem} from '/@/api/sales/GradeSystem';
import { useModal } from '/@/components/Modal';
import { addLngScore,updateLngScore,getLngScore } from '/@/api/sales/ScoreCustomer';
import dayjs from 'dayjs';
@ -83,7 +108,6 @@
import { message } from 'ant-design-vue';
import UploadList from '/@/components/Form/src/components/UploadList.vue';
import customerListModal from '/@/components/common/customerListModal.vue';
import { getUserInfo } from '/@/api/system/login';
import { Modal } from 'ant-design-vue';
const tableName = 'ScoreCustomer';
@ -116,9 +140,8 @@
const { t } = useI18n();
const formState = reactive({
approCode: 'WTJ',
dateGrade: dayjs(new Date()),
dateAppro: dayjs(new Date()),
});
const userInfo = reactive({})
const [register, { openModal:openModal}] = useModal();
const rules: Record<string, Rule[]> = {
cpCodeName: [{ required: true, message: "该项为必填项", trigger: 'change' }],
@ -128,23 +151,13 @@
labelCol: { span: 9 },
wrapperCol: { span: 15 },
}
const gsIdOld = ref()
const columns = ref([
{ title: t('序号'), dataIndex: 'index', key: 'index', sorter: true, customRender: (column) => `${column.index + 1}` ,width: 80},
{ title: t('评价事项'), dataIndex: 'itemName', sorter: true},
{ title: t('评价标准'), dataIndex: 'itemDesc', sorter: true},
{ title: t('评价部门'), dataIndex: 'eDeptCode', sorter: true},
{ title: t('评分'), dataIndex: 'score', sorter: true},
{ title: t('分数说明'), dataIndex: 'scoreDesc', sorter: true},
{ title: t('评价人'), dataIndex: 'aEmpCode', sorter: true},
{ title: t('评价时间'), dataIndex: 'aTime', sorter: true},
{ title: t('实际评价部门'), dataIndex: 'aDeptCode', sorter: true},
]);
const dataList= ref([]);
const dataFile = ref([]);
let optionSelect= reactive({
gsIdList: [],
approCodeList: [],
typeCodeList: [],
securityCodeList: [],
urgencyCodeList: []
});
watch(
() => props.id,
@ -182,18 +195,17 @@
let data = await getLngScore(id)
spinning.value = false
Object.assign(formState, {...data})
Object.assign(dataList.value, formState.lngScoreDtlList || [])
Object.assign(dataFile.value, formState.lngFileUploadList || [])
formState.dateGrade = formState.dateGrade ? dayjs(formState.dateGrade) : null
formState.dateAppro = formState.dateAppro ? dayjs(formState.dateAppro) : null
} catch (error) {
spinning.value = false
}
}
async function getOption() {
optionSelect.gsIdList = await getLngGradeSystemPageList({'valid': 'Y', 'typeCode': 'CU'})
optionSelect.typeCodeList = await getDictionary('LNG_QB')
optionSelect.securityCodeList = await getDictionary('LNG_SECRET')
optionSelect.urgencyCodeList = await getDictionary('LNG_URGEN')
optionSelect.approCodeList = await getDictionary('LNG_APPRO')
let res = await getUserInfo()
Object.assign(userInfo, {...res})
}
const onSearch = (val)=> {
openModal(true,{isUpdate: false})
@ -203,64 +215,7 @@
formState.classCode = val[0].classCode
formState.cpCodeName = val[0].cuName
}
const gsIdFocus = (val) => {
gsIdOld.value = val
}
async function gsIdChange (val) {
if (!val) {
dataList.value = []
return
}
const res = await getLngGradeSystem(val)
let arr = res.lngGradeSystemItemList || []
if (!gsIdOld.value) {
dataList.value = res.lngGradeSystemItemList || []
dataList.value.forEach(v => {
v.aTime = dayjs(new Date()).format('YYYY-MM-DD HH:mm:ss')
v.aEmpCode = userInfo.name
v.gsiId = v.id
})
return
}
if (arr.length && gsIdOld.value) {
Modal.confirm({
title: t('提示'),
content: t('变更将重新设置评分表,是否继续'),
okText: t('确定'),
cancelText: t('取消'),
onOk() {
dataList.value = res.lngGradeSystemItemList || []
dataList.value.forEach(v => {
v.aTime = dayjs(new Date()).format('YYYY-MM-DD HH:mm:ss')
v.aEmpCode = userInfo.name
v.gsiId = v.id
})
},
onCancel() {
formState.gsId = gsIdOld.value
}
});
} else {
if (!arr.length) {
dataList.value = res.lngGradeSystemItemList || []
dataList.value.forEach(v => {
v.aTime = dayjs(new Date()).format('YYYY-MM-DD HH:mm:ss')
v.aEmpCode = userInfo.name
v.gsiId = v.id
})
}
}
}
const numChagne = (type, record, index) => {
record.aTime = dayjs(new Date()).format('YYYY-MM-DD HH:mm:ss')
if (type == 'score') {
let num = 0
dataList.value.forEach(v => {
num+=Number(v.score || 0)
})
formState.score = num
}
}
function close() {
tabStore.closeTab(currentRoute.value, router);
}