供应商评价

This commit is contained in:
‘huanghaiixia’
2025-12-19 14:37:49 +08:00
parent 5496c041ee
commit 754f44f55d
8 changed files with 539 additions and 49 deletions

View File

@ -67,13 +67,15 @@
const rowId = ref('');
const selectedKeys = ref<string[]>([]);
const selectedValues = ref([]);
const props = defineProps({
selectType: { type: String, default: 'checkbox' },
});
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
setModalProps({ confirmLoading: false });
isUpdate.value = !!data?.isUpdate;
});
const [registerTable, { getDataSource, setTableData, updateTableDataRecord, reload }] = useTable({
@ -94,7 +96,7 @@
return { ...params, valid: 'Y',approCode: 'YSP'};
},
rowSelection: {
type: 'checkBox',
type: props.selectType,
onChange: onSelectChange
},
});

View File

@ -0,0 +1,140 @@
<template>
<div>
<BasicModal v-bind="$attrs" @register="registerModal" width="60%" :title="getTitle" @ok="handleSubmit"
@visible-change="handleVisibleChange" >
<BasicTable @register="registerTable" class="customerListModal"></BasicTable>
</BasicModal>
</div>
</template>
<script lang="ts" setup>
import { ref, computed, unref, nextTick } from 'vue';
import { BasicModal, useModalInner, useModal } from '/@/components/Modal';
import { BasicForm, useForm } from '/@/components/Form/index';
import { BasicTable, useTable, FormSchema, BasicColumn, TableAction } from '/@/components/Table';
import { useMessage } from '/@/hooks/web/useMessage';
import { useI18n } from '/@/hooks/web/useI18n';
import { getLngSupplierPage } from '/@/api/supplier/Supplier';
const { t } = useI18n();
const codeFormSchema: FormSchema[] = [
{
field: 'suName',
label: '供应商名称',
component: 'Input',
},
];
const columns: BasicColumn[] = [
{
dataIndex: 'suCode',
title: '供应商编码',
align: 'left',
sorter: true,
},
{
dataIndex: 'suName',
title: '供应商名称',
align: 'left',
sorter: true,
},
{
dataIndex: 'suSname',
title: '供应商简称',
align: 'left',
sorter: true,
},
{
dataIndex: 'dI',
title: '国内/国际',
align: 'left',
sorter: true,
},
{
dataIndex: 'classCode',
title: '供应商分类',
align: 'left',
sorter: true,
},
];
const emit = defineEmits(['success', 'register']);
const { notification } = useMessage();
const isUpdate = ref(true);
const rowId = ref('');
const selectedKeys = ref<string[]>([]);
const selectedValues = ref([]);
const props = defineProps({
selectType: { type: String, default: 'checkbox' },
});
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
setModalProps({ confirmLoading: false });
isUpdate.value = !!data?.isUpdate;
});
const [registerTable, { getDataSource, setTableData, updateTableDataRecord, reload }] = useTable({
title: t('供应商列表'),
api: getLngSupplierPage,
columns,
bordered: true,
pagination: true,
canResize: false,
formConfig: {
labelCol:{span: 9, offSet:10},
schemas: codeFormSchema,
showResetButton: true,
},
immediate: false, // 设置为不立即调用
beforeFetch: (params) => {
return { ...params, valid: 'Y',approCode: 'YSP'};
},
rowSelection: {
type: props.selectType,
onChange: onSelectChange
},
});
const handleVisibleChange = (visible: boolean) => {
if (visible) {
nextTick(() => {
reload();
});
}
};
function onSelectChange(rowKeys: string[], e) {
selectedKeys.value = rowKeys;
selectedValues.value = e
}
const getTitle = computed(() => (!unref(isUpdate) ? t('供应商列表') : t('')));
async function handleSubmit() {
if (!selectedValues.value.length) {
notification.warning({
message: t('提示'),
description: t('请选择供应商')
});
return
}
closeModal();
emit('success', selectedValues.value);
}
</script>
<style >
.customerListModal .basicCol{
position: inherit !important;
top: 0;
}
</style>

View File

@ -5,8 +5,8 @@
<a-card title="评价基础信息" :bordered="false" >
<a-row>
<a-col :span="8">
<a-form-item label="客户名称" name="cpCode">
<a-input-search v-model:value="formState.cpCode" placeholder="请选择客户" readonly @search="onSearch"/>
<a-form-item label="客户名称" name="cpCodeName">
<a-input-search v-model:value="formState.cpCodeName" placeholder="请选择客户" readonly @search="onSearch"/>
</a-form-item>
</a-col>
<a-col :span="8">
@ -61,7 +61,7 @@
</a-card>
</a-form>
</div>
<customerListModal @register="register" @success="handleSuccess"/>
<customerListModal @register="register" selectType="radio" @success="handleSuccess"/>
</a-spin>
</template>
@ -84,7 +84,6 @@
import UploadList from '/@/components/Form/src/components/UploadList.vue';
import customerListModal from '/@/components/common/customerListModal.vue';
import { getUserInfo } from '/@/api/system/login';
import { Rect } from '@grapecity/activereports/reportviewer';
const tableName = 'ScoreCustomer';
const columnName = 'ScoreCustomer'
@ -121,7 +120,7 @@ import { Rect } from '@grapecity/activereports/reportviewer';
const userInfo = reactive({})
const [register, { openModal:openModal}] = useModal();
const rules: Record<string, Rule[]> = {
cpCode: [{ required: true, message: "该项为必填项", trigger: 'change' }],
cpCodeName: [{ required: true, message: "该项为必填项", trigger: 'change' }],
gsId: [{ required: true, message: "该项为必填项", trigger: 'change' }],
};
const layout = {
@ -201,6 +200,7 @@ import { Rect } from '@grapecity/activereports/reportviewer';
const handleSuccess = (val) => {
formState.cpCode = val[0].cuCode
formState.classCode = val[0].classCode
formState.cpCodeName = val[0].cuName
}
async function gsIdChange (val) {
const res = await getLngGradeSystem(val)
@ -208,6 +208,7 @@ import { Rect } from '@grapecity/activereports/reportviewer';
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) => {

View File

@ -111,7 +111,7 @@
const visibleFlowRecordModal = ref(false);
const [registerModal, { openModal }] = useModal();
const formName='客户评价';
const [registerTable, { reload, }] = useTable({
const [registerTable, { reload, clearSelectedRowKeys }] = useTable({
title: '' || (formName + '列表'),
api: getLngScorePage,
rowKey: 'id',
@ -128,6 +128,7 @@
return { ...params, FormId: formIdComputedRef.value, PK: 'id' };
},
afterFetch: (res) => {
clearSelectedRowKeys()
tableRef.value.setToolBarWidth();
},
@ -152,14 +153,15 @@
if (!actionButtonConfig?.value.some(element => element.code == 'view')) {
return;
}
const { processId, taskIds, schemaId } = record.workflowData || {};
const { processId, taskIds, schemaId, status } = record.workflowData || {};
if (taskIds && taskIds.length) {
router.push({
path: '/flow/' + schemaId + '/' + (processId || '') + '/approveFlow',
query: {
taskId: taskIds[0],
formName: formName,
formId:currentRoute.value.meta.formId
formId:currentRoute.value.meta.formId,
id: record.id
}
});
} else if (schemaId && !taskIds && processId) {
@ -169,18 +171,33 @@
readonly: 1,
taskId: '',
formName: formName,
formId:currentRoute.value.meta.formId
formId:currentRoute.value.meta.formId,
id: record.id,
status
}
});
} else {
router.push({
path: '/form/ScoreCustomer/' + record.id + '/viewForm',
query: {
formPath: 'sales/ScoreCustomer',
formName: formName,
formId:currentRoute.value.meta.formId
}
});
if (schemaIdComputedRef.value) {
router.push({
path: '/flow/' + schemaIdComputedRef.value + '/0/createFlow',
query: {
formPath: 'sales/ScoreCustomer',
formName: formName,
formId:currentRoute.value.meta.formId,
type:'edit',
id: record.id,
disabled: 1,
}
});
}
// router.push({
// path: '/form/ScoreCustomer/' + record.id + '/viewForm',
// query: {
// formPath: 'sales/ScoreCustomer',
// formName: formName,
// formId:currentRoute.value.meta.formId
// }
// });
}
}
@ -211,15 +228,27 @@
}
function handleEdit(record: Recordable) {
router.push({
path: '/form/ScoreCustomer/' + record.id + '/updateForm',
query: {
if (schemaIdComputedRef.value) {
router.push({
path: '/flow/' + schemaIdComputedRef.value + '/0/createFlow',
query: {
formPath: 'sales/ScoreCustomer',
formName: formName,
formId:currentRoute.value.meta.formId
}
});
formId:currentRoute.value.meta.formId,
type:'edit',
id: record.id
}
});
} else {
router.push({
path: '/form/ScoreCustomer/' + record.id + '/updateForm',
query: {
formPath: 'sales/ScoreCustomer',
formName: formName,
formId:currentRoute.value.meta.formId
}
});
}
}
function handleDelete(record: Recordable) {
deleteList([record.id]);

View File

@ -1,5 +1,5 @@
export const customFormConfig = {
codeList: ['addCustomer','addSupplier', 'addCustomerScore'],
codeList: ['addCustomer','addSupplier', 'addCustomerScore', 'addSupplierScore'],
router: [
{code: 'addCustomer', src: ''}
]

View File

@ -0,0 +1,288 @@
<template>
<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-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>
</a-col>
<a-col :span="8">
<a-form-item label="供应商分类" name="classCode">
<a-input v-model:value="formState.classCode" disabled />
</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="请选择评价体系" @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-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>
</a-col>
<a-col :span="8">
<a-form-item label="分类合计" name="score">
<a-input v-model:value="formState.score" disabled/>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="审批状态" name="approCode">
<a-select v-model:value="formState.approCode" disabled style="width: 100%" allow-clear>
<a-select-option v-for="item in optionSelect.approCodeList" :key="item.code" :value="item.code">
{{ item.name }}
</a-select-option>
</a-select>
</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>
</a-form>
</div>
<supplierListModal @register="register" selectType="radio" @success="handleSuccess"/>
</a-spin>
</template>
<script lang="ts" setup>
import { useRouter } from 'vue-router';
import { FromPageType, RecordType } from '/@/enums/workflowEnum';
import { ref, computed, onMounted, onBeforeMount, nextTick, defineAsyncComponent, reactive, defineComponent, watch} from 'vue';
import { useMessage } from '/@/hooks/web/useMessage';
import { useI18n } from '/@/hooks/web/useI18n';
import { useMultipleTabStore } from '/@/store/modules/multipleTab';
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/supplier/ScoreSupplier';
import dayjs from 'dayjs';
import { getAppEnvConfig } from '/@/utils/env';
import { message } from 'ant-design-vue';
import UploadList from '/@/components/Form/src/components/UploadList.vue';
import supplierListModal from '/@/components/common/supplierListModal.vue';
import { getUserInfo } from '/@/api/system/login';
const tableName = 'ScoreSupplier';
const columnName = 'ScoreSupplier'
const formType = ref('2'); // 0 新建 1 修改 2 查看
const formRef = ref();
const props = defineProps({
disabled: false,
id: ''
});
const { bus, FORM_LIST_MODIFIED } = useEventBus();
const router = useRouter();
const { currentRoute } = router;
const isDisable = ref(false);
const { formPath } = currentRoute.value.query;
const pathArr = [];
const tabStore = useMultipleTabStore();
const formProps = ref(null);
const formId = ref(currentRoute.value?.params?.id);
const pageType = ref(currentRoute.value.query?.type);
const pageId = ref(currentRoute.value.query?.id)
const spinning = ref(false);
const curIdx = ref(null)
const { notification } = useMessage();
const { t } = useI18n();
const formState = reactive({
approCode: 'WTJ',
dateGrade: dayjs(new Date()),
});
const userInfo = reactive({})
const [register, { openModal:openModal}] = useModal();
const rules: Record<string, Rule[]> = {
cpCodeName: [{ required: true, message: "该项为必填项", trigger: 'change' }],
gsId: [{ required: true, message: "该项为必填项", trigger: 'change' }],
};
const layout = {
labelCol: { span: 9 },
wrapperCol: { span: 15 },
}
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: [],
});
watch(
() => props.id,
(val) => {
if (val) {
getInfo(val)
}
},
{
immediate: true
}
);
watch(
() => props.disabled,
(val) => {
isDisable.value = val
},
{
immediate: true
}
);
onMounted(() => {
getOption()
if (pageId.value) {
getInfo(pageId.value)
}
});
const uploadListChange = (val) => {
dataFile.value = val
}
async function getInfo(id) {
spinning.value = true
try {
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
} catch (error) {
spinning.value = false
}
}
async function getOption() {
optionSelect.gsIdList = await getLngGradeSystemPageList({'valid': 'Y', 'typeCode': 'SU'})
optionSelect.approCodeList = await getDictionary('LNG_APPRO')
let res = await getUserInfo()
Object.assign(userInfo, {...res})
}
const onSearch = (val)=> {
openModal(true,{isUpdate: false})
}
const handleSuccess = (val) => {
formState.cpCode = val[0].suCode
formState.classCode = val[0].classCode
formState.cpCodeName = val[0].suName
}
async function gsIdChange (val) {
const res = await getLngGradeSystem(val)
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);
}
async function getFormValue() {
return formState
}
async function handleSubmit(type) {
try {
await formRef.value.validateFields();
let obj = {
...formState,
lngScoreDtlList: dataList.value,
lngFileUploadList: dataFile.value
}
spinning.value = true;
let request = !formState.id ? addLngScore :updateLngScore
try {
const data = await request(obj);
// 新增保存
if (data?.id) {
getInfo(data?.id)
}
// 同意保存不提示
if (!type) {
notification.success({
message: 'Tip',
description: data?.id ? t('新增成功!') : t('修改成功!')
}); //提示消息
}
return data?.id ? data : obj
} finally {
spinning.value = false;
}
} catch (errorInfo) {
spinning.value = false;
errorInfo?.errorFields?.length && notification.warning({
message: 'Tip',
description: '请完善信息'
});
return false
}
}
defineExpose({
handleSubmit,
getFormValue
});
</script>
<style lang="less" scoped>
.page-bg-wrap {
background-color: #fff;
}
.top-toolbar {
min-height: 44px;
margin-bottom: 12px;
border-bottom: 1px solid #eee;
}
</style>

View File

@ -111,7 +111,7 @@
const visibleFlowRecordModal = ref(false);
const [registerModal, { openModal }] = useModal();
const formName='供应商评价';
const [registerTable, { reload, }] = useTable({
const [registerTable, { reload, clearSelectedRowKeys }] = useTable({
title: '' || (formName + '列表'),
api: getLngScorePage,
rowKey: 'id',
@ -128,6 +128,7 @@
return { ...params, FormId: formIdComputedRef.value, PK: 'id' };
},
afterFetch: (res) => {
clearSelectedRowKeys()
tableRef.value.setToolBarWidth();
},
@ -152,14 +153,15 @@
if (!actionButtonConfig?.value.some(element => element.code == 'view')) {
return;
}
const { processId, taskIds, schemaId } = record.workflowData || {};
const { processId, taskIds, schemaId,status } = record.workflowData || {};
if (taskIds && taskIds.length) {
router.push({
path: '/flow/' + schemaId + '/' + (processId || '') + '/approveFlow',
query: {
taskId: taskIds[0],
formName: formName,
formId:currentRoute.value.meta.formId
formId:currentRoute.value.meta.formId,
id: record.id
}
});
} else if (schemaId && !taskIds && processId) {
@ -169,18 +171,33 @@
readonly: 1,
taskId: '',
formName: formName,
formId:currentRoute.value.meta.formId
formId:currentRoute.value.meta.formId,
id: record.id,
status
}
});
} else {
router.push({
path: '/form/ScoreSupplier/' + record.id + '/viewForm',
query: {
formPath: 'supplier/ScoreSupplier',
formName: formName,
formId:currentRoute.value.meta.formId
}
});
if (schemaIdComputedRef.value) {
router.push({
path: '/flow/' + schemaIdComputedRef.value + '/0/createFlow',
query: {
formPath: 'supplier/ScoreSupplier',
formName: formName,
formId:currentRoute.value.meta.formId,
type:'edit',
id: record.id,
disabled: 1,
}
});
}
// router.push({
// path: '/form/ScoreSupplier/' + record.id + '/viewForm',
// query: {
// formPath: 'supplier/ScoreSupplier',
// formName: formName,
// formId:currentRoute.value.meta.formId
// }
// });
}
}
@ -211,15 +228,27 @@
}
function handleEdit(record: Recordable) {
router.push({
path: '/form/ScoreSupplier/' + record.id + '/updateForm',
query: {
if (schemaIdComputedRef.value) {
router.push({
path: '/flow/' + schemaIdComputedRef.value + '/0/createFlow',
query: {
formPath: 'supplier/ScoreSupplier',
formName: formName,
formId:currentRoute.value.meta.formId
}
});
formId:currentRoute.value.meta.formId,
type:'edit',
id: record.id
}
});
} else {
router.push({
path: '/form/ScoreSupplier/' + record.id + '/updateForm',
query: {
formPath: 'supplier/ScoreSupplier',
formName: formName,
formId:currentRoute.value.meta.formId
}
});
}
}
function handleDelete(record: Recordable) {
deleteList([record.id]);

View File

@ -111,7 +111,7 @@
const visibleFlowRecordModal = ref(false);
const [registerModal, { openModal }] = useModal();
const formName='供应商';
const [registerTable, { reload, }] = useTable({
const [registerTable, { reload, clearSelectedRowKeys }] = useTable({
title: '' || (formName + '列表'),
api: getLngSupplierPage,
rowKey: 'id',
@ -128,6 +128,7 @@
return { ...params, FormId: formIdComputedRef.value, PK: 'id' };
},
afterFetch: (res) => {
clearSelectedRowKeys()
tableRef.value.setToolBarWidth();
},
@ -152,7 +153,7 @@
if (!actionButtonConfig?.value.some(element => element.code == 'view')) {
return;
}
const { processId, taskIds, schemaId } = record.workflowData || {};
const { processId, taskIds, schemaId, status } = record.workflowData || {};
if (taskIds && taskIds.length) {
router.push({
path: '/flow/' + schemaId + '/' + (processId || '') + '/approveFlow',