管道气采购
This commit is contained in:
123
src/components/common/contractFactListModal.vue
Normal file
123
src/components/common/contractFactListModal.vue
Normal file
@ -0,0 +1,123 @@
|
||||
<template>
|
||||
<div>
|
||||
<BasicModal v-bind="$attrs" @register="registerModal" width="60%" :title="getTitle" @ok="handleSubmit"
|
||||
@visible-change="handleVisibleChange" >
|
||||
<BasicTable @register="registerTable" class="contractFactListModal"></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 { getLngContractFactPage,} from '/@/api/contract/ContractFact';
|
||||
|
||||
const { t } = useI18n();
|
||||
const codeFormSchema: FormSchema[] = [
|
||||
{ field: 'kName', label: '合同号/名称', component: 'Input'},
|
||||
{
|
||||
field: 'relTypeCode',
|
||||
label: '关联类别',
|
||||
component: 'XjrSelect',
|
||||
componentProps: {
|
||||
datasourceType: 'dic',
|
||||
params: { itemId: '2003815292742479874' },
|
||||
labelField: 'name',
|
||||
valueField: 'value',
|
||||
|
||||
getPopupContainer: () => document.body,
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
const columns: BasicColumn[] = [
|
||||
{ title: t('合同号'), dataIndex: 'kNo', sorter: true},
|
||||
{ title: t('合同名称'), dataIndex: 'kName', sorter: true},
|
||||
{ title: t('关联类别'), dataIndex: 'relTypeName', sorter: true},
|
||||
{ title: t('合同类别'), dataIndex: 'kTypeName1', sorter: true},
|
||||
{ title: t('承办人'), dataIndex: 'empName', sorter: true,},
|
||||
{ title: t('承办部门'), dataIndex: 'bDeptName', 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: getLngContractFactPage,
|
||||
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 >
|
||||
.contractFactListModal .basicCol{
|
||||
position: inherit !important;
|
||||
top: 0;
|
||||
}
|
||||
</style>
|
||||
150
src/components/common/correlationApproList.vue
Normal file
150
src/components/common/correlationApproList.vue
Normal file
@ -0,0 +1,150 @@
|
||||
<template>
|
||||
<div>
|
||||
<Card title="签报列表" :bordered="false" >
|
||||
<a-button type="primary" style="margin-bottom: 10px" v-if="!disabled" @click="onAppro">关联签报</a-button>
|
||||
<a-table :columns="columns" :data-source="dataList" :pagination="false">
|
||||
<template #bodyCell="{ column, record, index }">
|
||||
<template v-if="column.dataIndex === 'file'">
|
||||
<div v-for="item in (record.lngFileUploadList )">
|
||||
<a @click="handleDownload(item)">{{item.fileOrg}}</a>
|
||||
</div>
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'operation'">
|
||||
<a style="margin-right: 10px" @click="btnCheck('view', record, index)">查看</a>
|
||||
<a v-if="!disabled" style="margin-right: 10px" @click="btnCheck('delete', record, index)">删除</a>
|
||||
</template>
|
||||
</template>
|
||||
</a-table>
|
||||
</Card>
|
||||
<approListModal @register="register" @success="handleSuccess" />
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { Card } from 'ant-design-vue';
|
||||
import { ref, watch} from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { useI18n } from '/@/hooks/web/useI18n';
|
||||
import { parseDownloadUrl} from '/@/api/system/file';
|
||||
import { downloadByUrl } from '/@/utils/file/download';
|
||||
import { Modal } from 'ant-design-vue';
|
||||
import approListModal from '/@/components/common/approListModal.vue';
|
||||
import { useModal } from '/@/components/Modal';
|
||||
import { message } from 'ant-design-vue';
|
||||
|
||||
const router = useRouter();
|
||||
const { t } = useI18n();
|
||||
const dataList = ref([])
|
||||
const columns= ref([
|
||||
{ title: t('序号'), dataIndex: 'index', key: 'index', sorter: true, customRender: (column) => `${column.index + 1}` ,width: 100},
|
||||
{ title: t('标题'), dataIndex: 'title', sorter: true, width:100},
|
||||
{ title: t('编号'), dataIndex: 'code', sorter: true},
|
||||
{ title: t('签报类型'), dataIndex: 'typeName', sorter: true, width: 140},
|
||||
{ title: t('拟稿人'), dataIndex: 'empName', sorter: true, width: 140},
|
||||
{ title: t('拟稿人所属部门'), dataIndex: 'bDeptName', sorter: true, width: 140},
|
||||
{ title: t('拟稿时间'), dataIndex: 'dateAppro', sorter: true, width: 140},
|
||||
{ title: t('附件'), dataIndex: 'file', sorter: true, width: 140},
|
||||
{ title: t('操作'), dataIndex: 'operation', width: 120, fixed: 'right',align: 'center'},
|
||||
]);
|
||||
const [register, { openModal:openModal}] = useModal();
|
||||
const props = defineProps({
|
||||
disabled: Boolean,
|
||||
list: Array,
|
||||
});
|
||||
const emit = defineEmits(['change']);
|
||||
const handleDownload = (info) => {
|
||||
const url = parseDownloadUrl(info.response ? info.response.data.fileUrl : info.fileUrl);
|
||||
const fileName = info.response ? info.response.data.fileOrg : info.fileOrg;
|
||||
downloadByUrl({ url, fileName: fileName});
|
||||
};
|
||||
const onAppro = (val)=> {
|
||||
openModal(true,{isUpdate: false})
|
||||
}
|
||||
const handleSuccess = (val) =>{
|
||||
val.forEach(v => {
|
||||
v.approId = v.id
|
||||
v.id = null
|
||||
})
|
||||
if (!dataList.value.length) {
|
||||
dataList.value = val
|
||||
emit('change', dataList.value);
|
||||
return
|
||||
}
|
||||
let arr = []
|
||||
val.forEach(v => {
|
||||
dataList.value.forEach(i => {
|
||||
if (v.code == i.code){
|
||||
message.warning(v.code + '已重复, 签报不需要重复选择')
|
||||
} else {
|
||||
arr.push(v)
|
||||
}
|
||||
})
|
||||
})
|
||||
dataList.value = unique([...dataList.value, ...arr], 'code')
|
||||
emit('change', dataList.value);
|
||||
}
|
||||
function unique(arr, u_key) {
|
||||
const map = new Map()
|
||||
arr.forEach((item, index) => {
|
||||
if (!map.has(item[u_key])) {
|
||||
map.set(item[u_key], item)
|
||||
}
|
||||
})
|
||||
return [...map.values()]
|
||||
}
|
||||
const btnCheck = (btn, record, index) => {
|
||||
if (btn == 'delete') {
|
||||
Modal.confirm({
|
||||
title: '提示信息',
|
||||
content: '是否取消关联?',
|
||||
okText: '确认',
|
||||
cancelText: '取消',
|
||||
onOk() {
|
||||
dataList.value.splice(index, 1);
|
||||
emit('change', dataList.value);
|
||||
},
|
||||
onCancel() {}
|
||||
});
|
||||
|
||||
}
|
||||
if (btn == 'view') {
|
||||
router.push({
|
||||
path: '/approve/Appro/form',
|
||||
query: {
|
||||
id: record.id || record.approId,
|
||||
disabled: true
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
watch(
|
||||
() => props.disabled,
|
||||
(val) => {
|
||||
if (val) {
|
||||
let idx2 = columns.value.findIndex(v =>v.dataIndex == 'operation')
|
||||
idx2>-1 && columns.value.splice(idx2, 1)
|
||||
}
|
||||
},
|
||||
{
|
||||
immediate: true,
|
||||
deep: true,
|
||||
}
|
||||
);
|
||||
watch(
|
||||
() => props.list,
|
||||
async (val) => {
|
||||
dataList.value = val || []
|
||||
},
|
||||
{
|
||||
immediate: true,
|
||||
deep: true,
|
||||
}
|
||||
);
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
.btn {
|
||||
color: #5e95ff;
|
||||
font-size: 20px;
|
||||
font-weight: bold;
|
||||
}
|
||||
</style>
|
||||
152
src/components/common/correlationContractFactList.vue
Normal file
152
src/components/common/correlationContractFactList.vue
Normal file
@ -0,0 +1,152 @@
|
||||
<template>
|
||||
<div>
|
||||
<Card title="关联合同信息" :bordered="false" >
|
||||
<a-button type="primary" style="margin-bottom: 10px" v-if="!disabled" @click="onAppro">关联合同</a-button>
|
||||
<a-table :columns="columns" :data-source="dataList" :pagination="false" :scroll="{x: 1000}">
|
||||
<template #bodyCell="{ column, record, index }">
|
||||
<template v-if="column.dataIndex === 'file'">
|
||||
<div v-for="item in (record.lngFileUploadList )">
|
||||
<a @click="handleDownload(item)">{{item.fileOrg}}</a>
|
||||
</div>
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'operation'">
|
||||
<a style="margin-right: 10px" @click="btnCheck('view', record, index)">查看</a>
|
||||
<a v-if="!disabled" style="margin-right: 10px" @click="btnCheck('delete', record, index)">删除</a>
|
||||
</template>
|
||||
</template>
|
||||
</a-table>
|
||||
</Card>
|
||||
<contractFactListModal @register="register" @success="handleSuccess" />
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { Card } from 'ant-design-vue';
|
||||
import { ref, watch} from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { useI18n } from '/@/hooks/web/useI18n';
|
||||
import { parseDownloadUrl} from '/@/api/system/file';
|
||||
import { downloadByUrl } from '/@/utils/file/download';
|
||||
import { Modal } from 'ant-design-vue';
|
||||
import contractFactListModal from '/@/components/common/contractFactListModal.vue';
|
||||
import { useModal } from '/@/components/Modal';
|
||||
import { message } from 'ant-design-vue';
|
||||
|
||||
const router = useRouter();
|
||||
const { t } = useI18n();
|
||||
const dataList = ref([])
|
||||
const columns= ref([
|
||||
{ title: t('序号'), dataIndex: 'index', key: 'index', sorter: true, customRender: (column) => `${column.index + 1}` ,width: 80},
|
||||
{ title: t('合同号'), dataIndex: 'kNo', sorter: true, width:180},
|
||||
{ title: t('合同名称'), dataIndex: 'kName', sorter: true, width: 300},
|
||||
{ title: t('关联类别'), dataIndex: 'relTypeName', sorter: true, width: 100},
|
||||
{ title: t('合同类别'), dataIndex: 'kTypeName1', sorter: true, width: 100},
|
||||
{ title: t('合同主体'), dataIndex: 'comName', sorter: true, width: 250},
|
||||
{ title: t('我方联系人'), dataIndex: 'empName', sorter: true, width: 140},
|
||||
{ title: t('联系电话'), dataIndex: 'tel', sorter: true, width: 140},
|
||||
{ title: t('业务部门'), dataIndex: 'bDeptName', sorter: true, width: 140},
|
||||
{ title: t('附件'), dataIndex: 'file', sorter: true, width: 140},
|
||||
{ title: t('操作'), dataIndex: 'operation', width: 120, fixed: 'right',align: 'center'},
|
||||
]);
|
||||
const [register, { openModal:openModal}] = useModal();
|
||||
const props = defineProps({
|
||||
disabled: Boolean,
|
||||
list: Array,
|
||||
});
|
||||
const emit = defineEmits(['change']);
|
||||
const handleDownload = (info) => {
|
||||
const url = parseDownloadUrl(info.response ? info.response.data.fileUrl : info.fileUrl);
|
||||
const fileName = info.response ? info.response.data.fileOrg : info.fileOrg;
|
||||
downloadByUrl({ url, fileName: fileName});
|
||||
};
|
||||
const onAppro = (val)=> {
|
||||
openModal(true,{isUpdate: false})
|
||||
}
|
||||
const handleSuccess = (val) =>{
|
||||
val.forEach(v => {
|
||||
v.approId = v.id
|
||||
v.id = null
|
||||
})
|
||||
if (!dataList.value.length) {
|
||||
dataList.value = val
|
||||
emit('change', dataList.value);
|
||||
return
|
||||
}
|
||||
let arr = []
|
||||
val.forEach(v => {
|
||||
dataList.value.forEach(i => {
|
||||
if (v.kNo == i.kNo){
|
||||
message.warning(v.kNo + '已重复, 合同不需要重复选择')
|
||||
} else {
|
||||
arr.push(v)
|
||||
}
|
||||
})
|
||||
})
|
||||
dataList.value = unique([...dataList.value, ...arr], 'kNo')
|
||||
emit('change', dataList.value);
|
||||
}
|
||||
function unique(arr, u_key) {
|
||||
const map = new Map()
|
||||
arr.forEach((item, index) => {
|
||||
if (!map.has(item[u_key])) {
|
||||
map.set(item[u_key], item)
|
||||
}
|
||||
})
|
||||
return [...map.values()]
|
||||
}
|
||||
const btnCheck = (btn, record, index) => {
|
||||
if (btn == 'delete') {
|
||||
Modal.confirm({
|
||||
title: '提示信息',
|
||||
content: '是否取消关联?',
|
||||
okText: '确认',
|
||||
cancelText: '取消',
|
||||
onOk() {
|
||||
dataList.value.splice(index, 1);
|
||||
emit('change', dataList.value);
|
||||
},
|
||||
onCancel() {}
|
||||
});
|
||||
|
||||
}
|
||||
if (btn == 'view') {
|
||||
router.push({
|
||||
path: '/approve/Appro/form',
|
||||
query: {
|
||||
id: record.id || record.approId,
|
||||
disabled: true
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
watch(
|
||||
() => props.disabled,
|
||||
(val) => {
|
||||
if (val) {
|
||||
let idx2 = columns.value.findIndex(v =>v.dataIndex == 'operation')
|
||||
idx2>-1 && columns.value.splice(idx2, 1)
|
||||
}
|
||||
},
|
||||
{
|
||||
immediate: true,
|
||||
deep: true,
|
||||
}
|
||||
);
|
||||
watch(
|
||||
() => props.list,
|
||||
async (val) => {
|
||||
dataList.value = val || []
|
||||
},
|
||||
{
|
||||
immediate: true,
|
||||
deep: true,
|
||||
}
|
||||
);
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
.btn {
|
||||
color: #5e95ff;
|
||||
font-size: 20px;
|
||||
font-weight: bold;
|
||||
}
|
||||
</style>
|
||||
@ -8,7 +8,7 @@ export const formConfig = {
|
||||
export const searchFormSchema: FormSchema[] = [
|
||||
{
|
||||
field: 'kName',
|
||||
label: '合同号',
|
||||
label: '合同号/名称',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
|
||||
@ -214,22 +214,7 @@
|
||||
<Card title="附件信息" :bordered="false" >
|
||||
<UploadList :disabled="isDisable" :list="dataFile" :value="formState.filePath" :tableName="tableName" :columnName="columnName" @change="uploadListChange"/>
|
||||
</Card>
|
||||
<Card title="签报列表" :bordered="false" >
|
||||
<a-button type="primary" style="margin-bottom: 10px" v-if="!isDisable" @click="onAppro">关联签报</a-button>
|
||||
<a-table :columns="columnsAppro" :data-source="dataListAppro" :pagination="false">
|
||||
<template #bodyCell="{ column, record, index }">
|
||||
<template v-if="column.dataIndex === 'file'">
|
||||
<div v-for="item in (record.lngFileUploadList )">
|
||||
<a @click="handleDownload(item)">{{item.fileOrg}}</a>
|
||||
</div>
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'operation'">
|
||||
<a style="margin-right: 10px" @click="btnCheck('appro', 'view', record, index)">查看</a>
|
||||
<a v-if="!isDisable" style="margin-right: 10px" @click="btnCheck('appro', 'delete', record, index)">删除</a>
|
||||
</template>
|
||||
</template>
|
||||
</a-table>
|
||||
</Card>
|
||||
<correlationApproList :list="dataListAppro" :disabled="isDisable" @change="getApproList"></correlationApproList>
|
||||
</a-form>
|
||||
</div>
|
||||
<deptUserModal @register="register" @success="handleSuccess"/>
|
||||
@ -261,11 +246,11 @@
|
||||
import deptListModal from '/@/components/common/deptListModal.vue';
|
||||
import approListModal from '/@/components/common/approListModal.vue';
|
||||
import contractFactUserModal from '/@/components/common/contractFactUserModal.vue';
|
||||
import correlationApproList from '/@/components/common/correlationApproList.vue';
|
||||
import { amountToChinese } from '/@/utils/amountToChinese';
|
||||
import { parseDownloadUrl} from '/@/api/system/file';
|
||||
import { downloadByUrl } from '/@/utils/file/download';
|
||||
|
||||
import { Modal } from 'ant-design-vue';
|
||||
|
||||
|
||||
import { useUserStore } from '/@/store/modules/user';
|
||||
const userStore = useUserStore();
|
||||
const userInfo = userStore.getUserInfo;
|
||||
@ -445,11 +430,6 @@
|
||||
}
|
||||
|
||||
}
|
||||
const handleDownload = (info) => {
|
||||
const url = parseDownloadUrl(info.response ? info.response.data.fileUrl : info.fileUrl);
|
||||
const fileName = info.response ? info.response.data.fileOrg : info.fileOrg;
|
||||
downloadByUrl({ url, fileName: fileName});
|
||||
};
|
||||
const periodTypeCodeChange = (val) => {
|
||||
if (val === 'Y') {
|
||||
rules.dateTo = [{ required: true, message: "该项为必填项", trigger: 'change' }]
|
||||
@ -486,6 +466,9 @@
|
||||
}
|
||||
return endValue.valueOf() <= startValue.valueOf();
|
||||
}
|
||||
const getApproList = (val) => {
|
||||
dataListAppro.value = val
|
||||
}
|
||||
const onSearch = (val)=> {
|
||||
openModalDept(true,{isUpdate: false})
|
||||
}
|
||||
@ -550,31 +533,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
// 签报
|
||||
if (type == 'appro') {
|
||||
if (btn == 'delete') {
|
||||
Modal.confirm({
|
||||
title: '提示信息',
|
||||
content: '是否取消关联?',
|
||||
okText: '确认',
|
||||
cancelText: '取消',
|
||||
onOk() {
|
||||
dataListAppro.value.splice(index, 1);
|
||||
},
|
||||
onCancel() {}
|
||||
});
|
||||
|
||||
}
|
||||
if (btn == 'view') {
|
||||
router.push({
|
||||
path: '/approve/Appro/form',
|
||||
query: {
|
||||
id: record.id || record.approId,
|
||||
disabled: true
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
function unique(arr, u_key) {
|
||||
|
||||
@ -6,19 +6,10 @@ export const formConfig = {
|
||||
};
|
||||
|
||||
export const searchFormSchema: FormSchema[] = [
|
||||
{
|
||||
field: 'id',
|
||||
label: 'id',
|
||||
component: 'Input',
|
||||
},
|
||||
|
||||
{
|
||||
field: 'kNo',
|
||||
label: '合同号',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
field: 'kName',
|
||||
label: '合同名称',
|
||||
label: '合同号/合同名称',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
@ -26,53 +17,9 @@ export const searchFormSchema: FormSchema[] = [
|
||||
label: '供应商',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
field: 'dateFrom',
|
||||
label: '有效期开始',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
field: 'dateTo',
|
||||
label: '有效期结束',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
field: 'approCode',
|
||||
label: '状态',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
field: 'cpTableName',
|
||||
label: '上载点',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
field: 'onlineSign',
|
||||
label: '是否托运',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
field: 'comId',
|
||||
label: '合同主体',
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
field: 'note',
|
||||
label: '备注',
|
||||
component: 'Input',
|
||||
},
|
||||
];
|
||||
|
||||
export const columns: BasicColumn[] = [
|
||||
{
|
||||
dataIndex: 'id',
|
||||
title: 'id',
|
||||
componentType: 'input',
|
||||
align: 'left',
|
||||
|
||||
sorter: true,
|
||||
},
|
||||
|
||||
{
|
||||
dataIndex: 'kNo',
|
||||
title: '合同号',
|
||||
|
||||
576
src/views/contract/ContractPurPng/components/createForm.vue
Normal file
576
src/views/contract/ContractPurPng/components/createForm.vue
Normal file
@ -0,0 +1,576 @@
|
||||
<template>
|
||||
<a-spin :spinning="spinning" tip="加载中...">
|
||||
<div class="page-bg-wrap formViewStyle">
|
||||
<a-form ref="formRef" :model="formState" :rules="rules" v-bind="layout">
|
||||
<Card title="合同档案" :bordered="false" >
|
||||
<a-row>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="合同号" name="kNo">
|
||||
<a-input v-model:value="formState.kNo" :disabled="isDisable" style="width: 65%" /><a-button v-if="!isDisable" type="primary" @click="onContract">关联合同</a-button>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="16">
|
||||
<a-form-item label="合同名称" name="kName" :label-col="{ span: 4 }" :wrapper-col="{ span: 24 }">
|
||||
<a-input v-model:value="formState.kName" placeholder="请输入合同名称" :disabled="isDisable"/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="合同期限" name="kPriod">
|
||||
<a-select v-model:value="formState.kPriod" :disabled="isDisable" placeholder="请选择合同期限" style="width: 100%" allow-clear>
|
||||
<a-select-option v-for="item in optionSelect.kPriodList" :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="dateFrom">
|
||||
<a-date-picker v-model:value="formState.dateFrom" style="width: 100%" :disabled="isDisable" :disabled-date="disabledDateStart" placeholder="请选择开始日期" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="有效期结束" name="dateTo">
|
||||
<a-date-picker v-model:value="formState.dateTo" style="width: 100%" :disabled="isDisable" :disabled-date="disabledDateEnd" placeholder="请选择结束日期" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="合同签订日期" name="dateSign">
|
||||
<a-date-picker v-model:value="formState.dateSign" style="width: 100%" :disabled="isDisable" placeholder="请选择合同签订日期" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="确认函开始日" name="dateCfmFrom">
|
||||
<a-date-picker v-model:value="formState.dateCfmFrom" style="width: 100%" :disabled="isDisable" placeholder="请选择确认函开始日" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="确认函结束日" name="dateCfmTo">
|
||||
<a-date-picker v-model:value="formState.dateCfmTo" style="width: 100%" :disabled="isDisable" placeholder="请选择确认函结束日" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="供应商" name="cpName">
|
||||
<a-input-search v-model:value="formState.cpName" :disabled="isDisable" placeholder="请选择供应商" readonly @search="onSearchUser"/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="业务人员" name="empName">
|
||||
<a-input-search v-model:value="formState.empName" :disabled="isDisable" placeholder="请选择业务联系人" readonly @search="onSearchUser"/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="业务部门" name="bDeptName">
|
||||
<a-input-search v-model:value="formState.bDeptName" :disabled="isDisable" placeholder="请选择业务部门" readonly @search="onSearch"/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="合同主体" name="comName">
|
||||
<a-input v-model:value="formState.comName" disabled />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="定价机制" name="prcTypeCode">
|
||||
<a-select v-model:value="formState.prcTypeCode" style="width: 100%" allow-clear>
|
||||
<a-select-option v-for="item in optionSelect.prcTypeCodeList" :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="periodTypeCode">
|
||||
<a-select v-model:value="formState.periodTypeCode" style="width: 100%" allow-clear>
|
||||
<a-select-option v-for="item in optionSelect.periodTypeCodeList" :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="uomCode">
|
||||
<a-select v-model:value="formState.uomCode" style="width: 100%" allow-clear>
|
||||
<a-select-option v-for="item in optionSelect.uomCodeList" :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="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>
|
||||
</Card>
|
||||
<Card title="业务信息" :bordered="false" >
|
||||
<h4>上载点</h4>
|
||||
<a-button type="primary" style="margin-bottom: 10px;margin-right: 10px;" @click="addUpLoad" v-if="!isDisable">新增</a-button>
|
||||
<a-button type="primary" @click="deleteUpLoad" v-if="!isDisable">删除</a-button>
|
||||
<div v-for="item in dataListUpLoad">
|
||||
<a-row>
|
||||
<a-col :span="8">
|
||||
<a-form-item label="上载点" name="pointUpCode">
|
||||
<a-select v-model:value="formState.pointUpCode" 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-col :span="8">
|
||||
<a-form-item label="是否托运" name="transSign">
|
||||
<a-select v-model:value="formState.transSign" style="width: 100%" allow-clear>
|
||||
<a-select-option v-for="item in optionSelect.transSignList" :key="item.code" :value="item.code">
|
||||
{{ item.name }}
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
</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="请输入备注" :auto-size="{ minRows: 2, maxRows: 5 }"/>
|
||||
</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="请输入交割点" :auto-size="{ minRows: 2, maxRows: 5 }"/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</div>
|
||||
</Card>
|
||||
<Card title="合同约定" :bordered="false" >
|
||||
<div style="width: 100%">
|
||||
<a-button type="primary" style="margin-bottom: 10px" @click="addContractAgree" v-if="!isDisable">新增行</a-button>
|
||||
<a-table style="width: 100%" :columns="columns" :data-source="dataListContractAgree" :pagination="false" :scroll="{x: 500}">
|
||||
<template #bodyCell="{ column, record, index }">
|
||||
<template v-if="column.dataIndex === 'dateFrom'">
|
||||
<a-date-picker v-model:value="record.dateFrom" style="width: 100%" />
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'dateTo'">
|
||||
<a-date-picker v-model:value="record.dateTo" style="width: 100%" />
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'sort'">
|
||||
<a-input-number v-model:value="record.sort" :min="0" style="width: 100%" />
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'baseInc'">
|
||||
<a-select v-model:value="record.baseInc" style="width: 100%" allow-clear>
|
||||
<a-select-option v-for="item in optionSelect.baseIncList" :key="item.code" :value="item.code">
|
||||
{{ item.name }}
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'rateM3Gj'">
|
||||
<a-input-number v-model:value="record.rateM3Gj" :min="0" style="width: 100%" />
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'qtyGjMonth'">
|
||||
<a-input-number v-model:value="record.qtyGjMonth" :min="0" style="width: 100%" />
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'qtyM3Month'">
|
||||
<a-input-number v-model:value="record.qtyM3Month" :min="0" style="width: 100%" />
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'zfbyTypeCode'">
|
||||
<a-select v-model:value="record.zfbyTypeCode" style="width: 100%" allow-clear>
|
||||
<a-select-option v-for="item in optionSelect.zfbyTypeCodeList" :key="item.code" :value="item.code">
|
||||
{{ item.name }}
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'zfbyValue'">
|
||||
<a-input-number v-model:value="record.zfbyValue" :min="0" style="width: 100%" />
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'note'">
|
||||
<a-input v-model:value="record.note" style="width: 100%" />
|
||||
</template>
|
||||
<template v-if="column.dataIndex === 'operation'">
|
||||
<a v-if="!isDisable" style="margin-right: 10px" @click="btnCheck('cp', 'delete', record, index)">删除</a>
|
||||
</template>
|
||||
</template>
|
||||
</a-table>
|
||||
</div>
|
||||
</Card>
|
||||
<Card title="附件信息" :bordered="false" >
|
||||
<UploadList :disabled="isDisable" :list="dataFile" :value="formState.filePath" :tableName="tableName" :columnName="columnName" @change="uploadListChange"/>
|
||||
</Card>
|
||||
<correlationContractFactList :list="dataListContractFact" :disabled="isDisable" @change="getApproContractFactList"></correlationContractFactList>
|
||||
<correlationApproList :list="dataListAppro" :disabled="isDisable" @change="getApproList"></correlationApproList>
|
||||
</a-form>
|
||||
</div>
|
||||
<deptUserModal @register="register" @success="handleSuccess"/>
|
||||
<deptListModal @register="registerDept" @success="handleSuccessDept" />
|
||||
<contractFactListModal @register="registerContractFact" @success="handleSuccessContractFact" />
|
||||
</a-spin>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { Card } from 'ant-design-vue';
|
||||
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 { useModal } from '/@/components/Modal';
|
||||
import { addLngContractFact,updateLngContractFact,getAllCurrency,getAllUser, getLngContractFact } from '/@/api/contract/ContractFact';
|
||||
import { getLngAppro,getCompDept } from '/@/api/approve/Appro';
|
||||
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 deptUserModal from '/@/components/common/deptUserModal.vue';
|
||||
import deptListModal from '/@/components/common/deptListModal.vue';
|
||||
import correlationApproList from '/@/components/common/correlationApproList.vue';
|
||||
import correlationContractFactList from '/@/components/common/correlationContractFactList.vue';
|
||||
import contractFactListModal from '/@/components/common/contractFactListModal.vue';
|
||||
|
||||
import { Modal } from 'ant-design-vue';
|
||||
import { useUserStore } from '/@/store/modules/user';
|
||||
const userStore = useUserStore();
|
||||
const userInfo = userStore.getUserInfo;
|
||||
|
||||
const tableName = 'ContractPurPng';
|
||||
const columnName = 'ContractPurPng'
|
||||
|
||||
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',
|
||||
dateDraft: dayjs(new Date()),
|
||||
});
|
||||
const [register, { openModal:openModal}] = useModal();
|
||||
const [registerDept, { openModal:openModalDept}] = useModal();
|
||||
const [registerContractFact, { openModal:openModalContractFact}] = useModal();
|
||||
const rules= reactive({
|
||||
kNo: [{ required: true, message: "该项为必填项", trigger: 'change' }],
|
||||
kName: [{ required: true, message: "该项为必填项", trigger: 'change' }],
|
||||
relTypeCode: [{ required: true, message: "该项为必填项", trigger: 'change' }],
|
||||
kTypeCode1: [{ required: true, message: "该项为必填项", trigger: 'change' }],
|
||||
periodTypeCode: [{ required: true, message: "该项为必填项", trigger: 'change' }],
|
||||
cpCount: [{ required: true, message: "该项为必填项", trigger: 'change' }],
|
||||
amountTypeCode: [{ required: true, message: "该项为必填项", trigger: 'change' }],
|
||||
settleTypeCode: [{ required: true, message: "该项为必填项", trigger: 'change' }],
|
||||
bidSign: [{ required: true, message: "该项为必填项", trigger: 'change' }],
|
||||
preApproSign: [{ required: true, message: "该项为必填项", trigger: 'change' }],
|
||||
aheadSign: [{ required: true, message: "该项为必填项", trigger: 'change' }],
|
||||
tempSign: [{ required: true, message: "该项为必填项", trigger: 'change' }],
|
||||
impSign: [{ required: true, message: "该项为必填项", trigger: 'change' }],
|
||||
empName: [{ required: true, message: "该项为必填项", trigger: 'change' }],
|
||||
tel: [{ required: true, message: "该项为必填项", trigger: 'change' }],
|
||||
bDeptName: [{ required: true, message: "该项为必填项", trigger: 'change' }],
|
||||
|
||||
});
|
||||
const layout = {
|
||||
labelCol: { span: 8 },
|
||||
wrapperCol: { span: 16 },
|
||||
}
|
||||
const columns= ref([
|
||||
{ title: t('序号'), dataIndex: 'index', key: 'index', sorter: true, customRender: (column) => `${column.index + 1}` ,width: 80},
|
||||
{ title: t('开始日期'), dataIndex: 'dateFrom', sorter: true, width:150},
|
||||
{ title: t('结束日期'), dataIndex: 'dateTo', sorter: true, width: 150},
|
||||
{ title: t('基础量/增量'), dataIndex: 'baseInc', sorter: true, width: 180},
|
||||
{ title: t('优先级'), dataIndex: 'sort', sorter: true, width: 100},
|
||||
{ title: t('比值(方/吉焦)'), dataIndex: 'rateM3Gj', sorter: true, width: 180},
|
||||
{ title: t('月气量(吉焦)'), dataIndex: 'qtyGjMonth', sorter: true, width: 120},
|
||||
{ title: t('月气量(万方)'), dataIndex: 'qtyM3Month', sorter: true, width: 120},
|
||||
{ title: t('日气量(吉焦)'), dataIndex: 'qtyGjDay', sorter: true, width: 120},
|
||||
{ title: t('日气量(万方)'), dataIndex: 'qtyM3Day', sorter: true, width: 120},
|
||||
{ title: t('照付不议类型'), dataIndex: 'zfbyTypeCode', sorter: true, width: 120},
|
||||
{ title: t('照付不议比例%/量数值'), dataIndex: 'zfbyValue', sorter: true, width: 120},
|
||||
{ title: t('备注'), dataIndex: 'note', sorter: true, width: 200},
|
||||
{ title: t('操作'), dataIndex: 'operation', width: 80, fixed: 'right',align: 'center'},
|
||||
]);
|
||||
const dataListContractAgree = ref([])
|
||||
const dataFile = ref([]);
|
||||
const dataListAppro = ref([])
|
||||
const dataListContractFact = ref([])
|
||||
const dataListUpLoad = ref([{}])
|
||||
let optionSelect= reactive({
|
||||
approCodeList: [],
|
||||
kPriodList: [],
|
||||
prcTypeCodeList: [],
|
||||
uomCodeList: [],
|
||||
periodTypeCodeList: [],
|
||||
transSignList: [],
|
||||
baseIncList: [],
|
||||
zfbyTypeCodeList: []
|
||||
});
|
||||
watch(
|
||||
() => props.id,
|
||||
(val) => {
|
||||
if (val) {
|
||||
getInfo(val)
|
||||
}
|
||||
},
|
||||
{
|
||||
immediate: true
|
||||
}
|
||||
);
|
||||
watch(
|
||||
() => props.disabled,
|
||||
(val) => {
|
||||
isDisable.value = val
|
||||
if (val) {
|
||||
let idx = columns.value.findIndex(v =>v.dataIndex == 'operation')
|
||||
idx>-1 && columns.value.splice(idx, 1)
|
||||
}
|
||||
},
|
||||
{
|
||||
immediate: true
|
||||
}
|
||||
);
|
||||
onMounted(() => {
|
||||
getOption()
|
||||
if (pageId.value) {
|
||||
getInfo(pageId.value)
|
||||
} else {
|
||||
formState.empName = userInfo.name
|
||||
formState.empId = userInfo.id
|
||||
formState.tel = userInfo.mobile
|
||||
}
|
||||
|
||||
});
|
||||
const uploadListChange = (val) => {
|
||||
dataFile.value = val
|
||||
}
|
||||
async function getInfo(id) {
|
||||
spinning.value = true
|
||||
try {
|
||||
let data = await getLngContractFact(id)
|
||||
spinning.value = false
|
||||
Object.assign(formState, {...data})
|
||||
Object.assign(dataFile.value, formState.lngFileUploadList || [])
|
||||
Object.assign(dataList.value, formState.lngContractFactCpList || [])
|
||||
Object.assign(dataListAppro.value, formState.lngApproVoList || [])
|
||||
formState.dateDraft = formState.dateDraft ? dayjs(formState.dateDraft) : null
|
||||
formState.dateFrom = formState.dateFrom ? dayjs(formState.dateFrom) : null
|
||||
formState.dateTo = formState.dateTo ? dayjs(formState.dateTo) : null
|
||||
|
||||
} catch (error) {
|
||||
spinning.value = false
|
||||
}
|
||||
}
|
||||
async function getOption() {
|
||||
optionSelect.kPriodList = await getDictionary('LNG_K_PER')
|
||||
optionSelect.prcTypeCodeList = await getDictionary('LNG_PRC')
|
||||
optionSelect.periodTypeCodeList = await getDictionary('LNG_PRC_P')
|
||||
optionSelect.uomCodeList = await getDictionary('LNG_UOM')
|
||||
optionSelect.approCodeList = await getDictionary('LNG_APPRO')
|
||||
optionSelect.transSignList = await getDictionary('LNG_YN')
|
||||
optionSelect.baseIncList = await getDictionary('LNG_BASE')
|
||||
optionSelect.zfbyTypeCodeList = await getDictionary('LNG_ZFBY')
|
||||
|
||||
|
||||
if (!pageId.value) {
|
||||
const res = await getCompDept(userInfo.id)
|
||||
formState.bDeptName = res?.dept?.name
|
||||
formState.bDeptId = res?.dept?.id
|
||||
|
||||
formState.comName = res?.comp?.name
|
||||
formState.comId = res?.comp?.id
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
const getApproList = (val) => {
|
||||
dataListAppro.value = val
|
||||
}
|
||||
const getApproContractFactList = (val) => {
|
||||
dataListContractFact.value = val
|
||||
}
|
||||
const disabledDateStart = (startValue) => {
|
||||
const endValue = formState?.dateTo;
|
||||
if (!startValue || !endValue) {
|
||||
return false
|
||||
}
|
||||
return startValue.valueOf() >= endValue.valueOf();
|
||||
}
|
||||
const disabledDateEnd = (endValue) => {
|
||||
const startValue = formState?.dateFrom;
|
||||
if (!endValue || !startValue) {
|
||||
return false
|
||||
}
|
||||
return endValue.valueOf() <= startValue.valueOf();
|
||||
}
|
||||
const onSearch = (val)=> {
|
||||
openModalDept(true,{isUpdate: false})
|
||||
}
|
||||
const onSearchUser = (val)=> {
|
||||
openModal(true,{isUpdate: false})
|
||||
}
|
||||
const onContract = (val)=> {
|
||||
openModalContractFact(true,{isUpdate: false})
|
||||
|
||||
}
|
||||
const addContractAgree = () => {
|
||||
dataListContractAgree.value.push({})
|
||||
}
|
||||
const addUpLoad = ()=> {
|
||||
dataListUpLoad.value.push({})
|
||||
}
|
||||
const deleteUpLoad = () => {
|
||||
if (dataListUpLoad.value.length == 1) return
|
||||
dataListUpLoad.value.pop()
|
||||
}
|
||||
|
||||
const handleSuccess = (val) => {
|
||||
formState.empName = val[0].name
|
||||
formState.empId = val[0].id
|
||||
formState.tel = val[0].mobile
|
||||
}
|
||||
const handleSuccessDept = (val, info) => {
|
||||
formState.bDeptName = val[0].name
|
||||
formState.bDeptId = val[0].id
|
||||
|
||||
formState.comName = info.name
|
||||
formState.comId = info.id
|
||||
}
|
||||
const handleSuccessContractFact = (val) => {
|
||||
val.forEach(v => {
|
||||
v.approId = v.id
|
||||
v.id = null
|
||||
})
|
||||
if (!dataListContractFact.value.length) {
|
||||
dataListContractFact.value = val
|
||||
return
|
||||
}
|
||||
let arr = []
|
||||
val.forEach(v => {
|
||||
dataListContractFact.value.forEach(i => {
|
||||
if (v.kNo == i.kNo){
|
||||
message.warning(v.kNo + '已重复, 合同不需要重复选择')
|
||||
} else {
|
||||
arr.push(v)
|
||||
}
|
||||
})
|
||||
})
|
||||
dataListContractFact.value = unique([...dataListContractFact.value, ...arr], 'kNo')
|
||||
}
|
||||
const btnCheck = (type, btn, record, index) => {
|
||||
curIdx.value = null
|
||||
if (type == 'cp') {
|
||||
if (btn == 'delete') {
|
||||
dataList.value.splice(index, 1)
|
||||
}
|
||||
if (btn == 'edit') {
|
||||
openModalContract(true, {record: record,isUpdate: true});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
function unique(arr, u_key) {
|
||||
const map = new Map()
|
||||
arr.forEach((item, index) => {
|
||||
if (!map.has(item[u_key])) {
|
||||
map.set(item[u_key], item)
|
||||
}
|
||||
})
|
||||
return [...map.values()]
|
||||
}
|
||||
function close() {
|
||||
tabStore.closeTab(currentRoute.value, router);
|
||||
}
|
||||
async function getFormValue() {
|
||||
return formState
|
||||
}
|
||||
async function handleSubmit(type) {
|
||||
try {
|
||||
await formRef.value.validateFields();
|
||||
|
||||
if (Number(formState.cpCount) !== dataList.value.length) {
|
||||
notification.warning({
|
||||
message: 'Tip',
|
||||
description: '相对数量需与相对方信息个数一致'
|
||||
});
|
||||
return
|
||||
}
|
||||
let obj = {
|
||||
...formState,
|
||||
lngFileUploadList: dataFile.value,
|
||||
lngContractFactCpList: dataList.value,
|
||||
lngContractApproRelList: dataListAppro.value
|
||||
|
||||
}
|
||||
spinning.value = true;
|
||||
let request = !formState.id ? addLngContractFact :updateLngContractFact
|
||||
|
||||
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>
|
||||
:deep(.ant-form-item .ant-form-item-label) {
|
||||
width: 135px !important;
|
||||
max-width: 135px !important;
|
||||
}
|
||||
.page-bg-wrap {
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.top-toolbar {
|
||||
min-height: 44px;
|
||||
margin-bottom: 12px;
|
||||
border-bottom: 1px solid #eee;
|
||||
}
|
||||
|
||||
</style>
|
||||
@ -122,7 +122,7 @@
|
||||
},
|
||||
schemas: customSearchFormSchema,
|
||||
fieldMapToTime: [],
|
||||
showResetButton: false,
|
||||
showResetButton: true,
|
||||
},
|
||||
beforeFetch: (params) => {
|
||||
return { ...params, FormId: formIdComputedRef.value, PK: 'id' };
|
||||
@ -396,6 +396,13 @@
|
||||
:deep(.ant-table-selection-col) {
|
||||
width: 50px;
|
||||
}
|
||||
:deep(.ant-col-8:nth-child(1) .ant-form-item-label) {
|
||||
width: 118px !important;
|
||||
}
|
||||
:deep(.ant-col-8:nth-child(1)) {
|
||||
max-width: 330px !important;
|
||||
width: 330px !important;
|
||||
}
|
||||
.show{
|
||||
display: flex;
|
||||
}
|
||||
|
||||
@ -1,6 +1,3 @@
|
||||
export const customFormConfig = {
|
||||
codeList: ['addCustomer','addSupplier', 'addCustomerScore', 'addSupplierScore', 'addAppro', 'contractFactApprove'],
|
||||
router: [
|
||||
{code: 'addCustomer', src: ''}
|
||||
]
|
||||
codeList: ['addCustomer','addSupplier', 'addCustomerScore', 'addSupplierScore', 'addAppro', 'contractFactApprove', 'addContractPurPng'],
|
||||
};
|
||||
Reference in New Issue
Block a user