lng计划业务逻辑处理

This commit is contained in:
‘huanghaiixia’
2026-03-16 17:52:36 +08:00
parent f822654100
commit ee57286c05
21 changed files with 3505 additions and 318 deletions

View File

@ -6,30 +6,15 @@ export const formConfig = {
};
export const searchFormSchema: FormSchema[] = [
{
field: 'id',
label: 'Id',
component: 'Input',
},
{
field: 'verNo',
label: '版本号',
component: 'Input',
},
{
field: 'datePlan',
label: '计划日期',
component: 'Input',
},
{
field: 'cuCode',
label: '客户简称',
component: 'Input',
},
{
field: 'staCode',
label: '气源地',
component: 'Input',
component: 'RangePicker',
componentProps: {
format: 'YYYY-MM-DD',
style: { width: '100%' },
getPopupContainer: () => document.body,
},
},
{
field: 'noTractor',
@ -42,71 +27,37 @@ export const searchFormSchema: FormSchema[] = [
component: 'Input',
},
{
field: 'idNoDriver',
label: '驾驶员身份证号',
field: 'kName',
label: '销售合同名称/编码',
component: 'Input',
},
{
field: 'nameDriver',
label: '驾驶员姓名',
component: 'Input',
},
{
field: 'phoneDriver',
label: '驾驶员手机号',
component: 'Input',
},
{
field: 'idNoEscort',
label: '押运员身份证号',
component: 'Input',
},
{
field: 'nameEscort',
label: '押运员姓名',
component: 'Input',
},
{
field: 'phoneEscort',
label: '押运员手机号',
component: 'Input',
},
{
field: 'carrCode',
label: '承运商',
component: 'Input',
},
{
field: 'ksId',
label: '销售合同',
component: 'Input',
},
{
field: 'unloadingName',
label: '卸货站点',
component: 'Input',
},
{
field: 'alterSign',
label: '变更',
{
field: 'staName',
label: '气源地名称',
component: 'Input',
},
{
field: 'approCode',
label: '审批状态',
component: 'Input',
component: 'Select',
componentProps: {
showSearch: true,
optionFilterProp: 'label',
filterOption: (input: string, option: any) => {
return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0;
},
options: [
// { label: '全部', value: '' },
],
placeholder: '请选择',
allowClear: true,
getPopupContainer: () => document.body,
},
},
];
export const columns: BasicColumn[] = [
{
dataIndex: 'id',
title: 'Id',
componentType: 'input',
align: 'left',
sorter: true,
},
{
dataIndex: 'verNo',
@ -127,7 +78,7 @@ export const columns: BasicColumn[] = [
},
{
dataIndex: 'cuCode',
dataIndex: 'cuSname',
title: '客户简称',
componentType: 'input',
align: 'left',
@ -136,7 +87,7 @@ export const columns: BasicColumn[] = [
},
{
dataIndex: 'staCode',
dataIndex: 'staName',
title: '气源地',
componentType: 'input',
align: 'left',
@ -217,7 +168,7 @@ export const columns: BasicColumn[] = [
},
{
dataIndex: 'carrCode',
dataIndex: 'carrName',
title: '承运商',
componentType: 'input',
align: 'left',
@ -226,7 +177,7 @@ export const columns: BasicColumn[] = [
},
{
dataIndex: 'ksId',
dataIndex: 'ksName',
title: '销售合同',
componentType: 'input',
align: 'left',
@ -244,7 +195,7 @@ export const columns: BasicColumn[] = [
},
{
dataIndex: 'alterSign',
dataIndex: 'alterName',
title: '变更',
componentType: 'input',
align: 'left',
@ -253,7 +204,7 @@ export const columns: BasicColumn[] = [
},
{
dataIndex: 'approCode',
dataIndex: 'approName',
title: '审批状态',
componentType: 'input',
align: 'left',

View File

@ -29,9 +29,7 @@
const logId = ref('')
const logPath = ref('/dayPlan/lngAppro/datalog');
import { DataLog } from '/@/components/pcitc';
import { ref, computed, onMounted, onUnmounted,
} from 'vue';
import { ref, computed, onMounted, onUnmounted, } from 'vue';
import { BasicTable, useTable, TableAction, ActionItem } from '/@/components/Table';
import { getLngLngApproPage, deleteLngLngAppro} from '/@/api/dayPlan/LngAppro';
@ -66,13 +64,15 @@
//所有按钮
const buttons = ref([{"isUse":true,"name":"刷新","code":"refresh","icon":"ant-design:reload-outlined","isDefault":true},{"isUse":true,"name":"查看","code":"view","icon":"ant-design:eye-outlined","isDefault":true},{"isUse":true,"name":"数据日志","code":"datalog","icon":"ant-design:profile-outlined","isDefault":true},{"isUse":true,"name":"审批","code":"approve","icon":"ant-design:check-outlined","isDefault":true},{"isUse":true,"name":"对比","code":"compare","icon":"ant-design:file-done-outlined","isDefault":false}]);
//展示在列表内的按钮
const actionButtons = ref<string[]>(['view', 'edit','datalog', 'copyData', 'delete', 'startwork','flowRecord']);
const actionButtons = ref<string[]>(['view', 'edit','datalog', 'copyData', 'delete', 'startwork','flowRecord','compare','approve']);
const buttonConfigs = computed(()=>{
return filterButtonAuth(buttons.value);
})
const tableButtonConfig = computed(() => {
return buttonConfigs.value?.filter((x) => !actionButtons.value.includes(x.code));
let arr =[{"isUse":true,"name":"审批","code":"approve","icon":"ant-design:check-outlined","isDefault":true},{"name":"刷新","code":"refresh","icon":"ant-design:reload-outlined","isDefault":true,"isUse":true},]
return arr
// return buttonConfigs.value?.filter((x) => !actionButtons.value.includes(x.code));
});
const actionButtonConfig = computed(() => {
@ -82,13 +82,14 @@
const btnEvent = {refresh : handleRefresh,view : handleView,datalog : handleDatalog,approve : handleApprove,}
const { currentRoute } = useRouter();
const selectedKeys = ref([])
const router = useRouter();
const formIdComputedRef = ref();
formIdComputedRef.value = currentRoute.value.meta.formId
const schemaIdComputedRef = ref();
schemaIdComputedRef.value = currentRoute.value.meta.schemaId
const [registerModal, { openModal }] = useModal();
const formName=' LNG调度审批';
const formName=currentRoute.value.meta?.title;
const [registerTable, { reload, }] = useTable({
title: '' || (formName + '列表'),
api: getLngLngApproPage,
@ -119,13 +120,19 @@
dataIndex: 'action',
slots: { customRender: 'action' },
},
rowSelection: {
type: 'checkbox',
onChange: onSelectChange
},
tableSetting: {
size: false,
setting: false,
},
});
function onSelectChange(rowKeys: string[]) {
selectedKeys.value = rowKeys;
}
function dbClickRow(record) {
if (!actionButtonConfig?.value.some(element => element.code == 'view')) {
return;
@ -255,4 +262,24 @@
.hide{
display: none !important;
}
:deep( .ant-col-8:nth-child(1)) {
width: 320px !important;
max-width: 320px !important;
}
:deep(.ant-col-8:nth-child(1) .ant-form-item-label) {
width: 80px !important;
}
:deep( .ant-col-8:nth-child(4)) {
width: 320px !important;
max-width: 320px !important;
}
:deep(.ant-col-8:nth-child(4) .ant-form-item-label) {
width: 130px !important;
max-width: 130px !important;
}
:deep(.ant-col-8:nth-child(4) .ant-form-item-label label) {
width: 130px !important;
max-width: 130px !important;
}
</style>

View File

@ -0,0 +1,332 @@
<template>
<a-form ref="formRef" :model="formState" :rules="rules" v-bind="layout">
<a-row>
<a-col :span="8">
<a-form-item label="计划日期" name="datePlan">
<div v-if="pageType=='compare'" :class="diffResultList.includes('datePlan')?'changeStyle':''">
{{ formState.datePlan ? dayjs(formState.datePlan).format('YYYY-MM-DD'): null }}
</div>
<a-date-picker :inputReadOnly="true" v-else v-model:value="formState.datePlan" :disabled-date="disabledDateStart" style="width: 100%" :disabled="disable||pageType=='edit'" placeholder="请选择计划日期" @change="datePlanChange" />
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="合同" name="kName">
<div v-if="pageType=='compare'" :class="diffResultList.includes('kName')?'changeStyle':''">{{ formState.kName }}</div>
<a-input-search v-else v-model:value="formState.kName" :disabled="disable||pageType=='edit'" placeholder="请选择合同" readonly @search="onSearch"/>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="气源地" name="staName">
<div v-if="pageType=='compare'" :class="diffResultList.includes('staName')?'changeStyle':''">{{ formState.staName }}</div>
<a-input-search v-else v-model:value="formState.staName" :disabled="disable||pageType=='edit'" placeholder="请选择气源地" readonly @search="onSearchUpLoad"/>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="车头号" name="noTractor" :class="diffResultList.includes('noTractor')?'changeStyle':''">
<a-input v-model:value="formState.noTractor" :disabled="disable" placeholder="请输入车头号" />
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="挂车号" name="noTrailer" :class="diffResultList.includes('noTrailer')?'changeStyle':''">
<a-input v-model:value="formState.noTrailer" :disabled="disable" placeholder="请输入挂车号" />
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="承运商" name="carrName" :class="diffResultList.includes('carrName')?'changeStyle':''">
<a-input v-model:value="formState.carrName" :disabled="disable" placeholder="请输入承运商" />
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="驾驶员身份证号" name="idNoDriver" :class="diffResultList.includes('idNoDriver')?'changeStyle':''">
<a-input v-model:value="formState.idNoDriver" :disabled="disable" placeholder="请输入驾驶员身份证号" />
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="驾驶员姓名" name="nameDriver" :class="diffResultList.includes('nameDriver')?'changeStyle':''">
<a-input v-model:value="formState.nameDriver" :disabled="disable" placeholder="请输入驾驶员姓名" />
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="驾驶员手机号" name="phoneDriver" :class="diffResultList.includes('phoneDriver')?'changeStyle':''">
<a-input v-model:value="formState.phoneDriver" :disabled="disable" placeholder="驾驶员手机号" />
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="押运员身份证号" name="idNoEscort" :class="diffResultList.includes('idNoEscort')?'changeStyle':''">
<a-input v-model:value="formState.idNoEscort" :disabled="disable" placeholder="请输入押运员身份证号" />
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="押运员姓名" name="nameEscort" :class="diffResultList.includes('nameEscort')?'changeStyle':''">
<a-input v-model:value="formState.nameEscort" :disabled="disable" placeholder="请输入押运员姓名" />
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="押运员手机号" name="phoneEscort" :class="diffResultList.includes('phoneEscort')?'changeStyle':''">
<a-input v-model:value="formState.phoneEscort" :disabled="disable" placeholder="请输入押运员手机号" />
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="卸货站点" name="unloadingName" :class="diffResultList.includes('unloadingName')?'changeStyle':''">
<a-input-search v-model:value="formState.unloadingName" :disabled="disable" placeholder="请选择卸货站点" />
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="预约时间段" name="timePeriod" :class="diffResultList.includes('timePeriod')?'changeStyle':''">
<a-select v-model:value="formState.timePeriod" :disabled="disable" placeholder="请选择预约时间段" style="width: 100%" allow-clear>
<a-select-option v-for="item in optionSelect.timePeriodList" :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="timeUnloading">
<div v-if="pageType=='compare'" :class="diffResultList.includes('timeUnloading')?'changeStyle':''">
{{ formState.timeUnloading ? dayjs(formState.timeUnloading).format('YYYY-MM-DD'): null }}
</div>
<a-date-picker :inputReadOnly="true" showTime v-else v-model:value="formState.timeUnloading" style="width: 100%" :disabled="disable" placeholder="请选择预计卸货时间" />
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="车辆类型" name="supplyCode" :class="diffResultList.includes('supplyCode')?'changeStyle':''">
<a-select v-model:value="formState.supplyCode" :disabled="disable" placeholder="请选择车辆类型" style="width: 100%" allow-clear>
<a-select-option v-for="item in optionSelect.supplyCodeList" :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="noTank" :class="diffResultList.includes('noTank')?'changeStyle':''">
<a-input v-model:value="formState.noTank" :disabled="disable" placeholder="请输入压力容器登记证号" />
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="充装量(吨)" name="qtyTon" :class="diffResultList.includes('qtyTon')?'changeStyle':''">{{ formState.qtyTon }}</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="供应商" name="comName" :class="diffResultList.includes('comName')?'changeStyle':''">{{ formState.comName }}</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="版本号" name="verNo" :class="diffResultList.includes('verNo')?'changeStyle':''">{{ formState.verNo }}</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="审批状态" name="approName" :class="diffResultList.includes('approName')?'changeStyle':''">{{ formState.approName }}</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="备注" name="note" :label-col="{ span: 3 }" :wrapper-col="{ span: 24 }">
<div v-if="pageType=='compare'" :class="diffResultList.includes('note')?'changeStyle':''">{{ formState.note }}</div>
<a-textarea v-else v-model:value="formState.note" :disabled="disable" placeholder="请输入备注" :auto-size="{ minRows: 2, maxRows: 5 }"/>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="批复意见" name="reply" :label-col="{ span: 3 }" :wrapper-col="{ span: 24 }">
<div v-if="pageType=='compare'" :class="diffResultList.includes('reply')?'changeStyle':''">{{ formState.reply }}</div>
<a-textarea v-else v-model:value="formState.reply" disabled :auto-size="{ minRows: 1, maxRows: 5 }"/>
</a-form-item>
</a-col>
</a-row>
</a-form>
<contractDemandListModal @register="registerContract" @success="handleSuccessContract" />
<pointDelyDemandListModal @register="registerUpLoad" @success="handleSuccessUpLoad" />
</template>
<script lang="ts" setup>
import { useI18n } from '/@/hooks/web/useI18n';
import { useRouter } from 'vue-router';
import { ref, computed, onMounted, onBeforeMount, nextTick, defineAsyncComponent, reactive, defineComponent, watch} from 'vue';
import contractDemandListModal from '/@/components/common/contractDemandListModal.vue';
import pointDelyDemandListModal from '/@/components/common/pointDelyDemandListModal.vue';
import { useModal } from '/@/components/Modal';
import { message } from 'ant-design-vue';
import dayjs from 'dayjs';
import { getCompDept } from '/@/api/approve/Appro';
import { useUserStore } from '/@/store/modules/user';
import { getDictionary } from '/@/api/sales/Customer';
import { getLngPngDemandContractList, getLngPngDemandPointDely, getLngPngDemandContractQty, getLngPngDemandPurList, getLngPngDemandRate } from '/@/api/dayPlan/Demand';
const userStore = useUserStore();
const userInfo = userStore.getUserInfo;
const router = useRouter();
const { currentRoute } = router;
const pageId = ref(currentRoute.value.query?.id)
const pageType = ref(currentRoute.value.query?.type)
const formRef = ref()
const rules= reactive({
pointDelyName: [{ required: true, message: "该项为必填项", trigger: 'change' }],
datePlan: [{ required: true, message: "该项为必填项", trigger: 'change' }],
kName: [{ required: true, message: "该项为必填项", trigger: 'change' }],
});
const layout = {
labelCol: { span: 9 },
wrapperCol: { span: 18 },
}
const { t } = useI18n();
const [registerContract, { openModal:openModalContractSales}] = useModal();
const [registerUpLoad, { openModal:openModalUpLoad}] = useModal();
const props = defineProps({
formObj: {},
disable: false,
changeList: []
});
const optionSelect= reactive({
timePeriodList: [],
supplyCodeList: []
})
const diffResultList = ref([])
const formState = ref({})
const contractList = ref([])
const pointDelyList = ref([])
onMounted(async () =>{
getOption()
if (!pageType.value) {
formState.value.lastVerSign = 'Y'
formState.value.validSign = 'N'
formState.value.alterSign = 'I'
formState.value.approCode = 'WTJ'
const res = await getCompDept(userInfo.id)
formState.value.cuCode = res?.comp?.cuCode
formState.value.comId = res?.comp?.id
const res1 = await getLngPngDemandRate({}) || []
formState.value.rateM3Gj = res1[0]?.rateM3Gj
}
})
async function getOption() {
optionSelect.timePeriodList = await getDictionary('LNG_TIME_P')
optionSelect.supplyCodeList = await getDictionary('LNG_SUPPLY')
}
const datePlanChange = async (val) => {
let obj = {
cuCode:formState.value.cuCode,
datePlan: dayjs(formState.value.datePlan).format('YYYY-MM-DD')
}
let res = await getLngPngDemandContractList(obj)
contractList.value = res || []
if (contractList.value.length == 1) {
formState.value.kName = contractList.value[0].kName
formState.value.ksId = contractList.value[0].id
getPointDely()
getContractQty()
}
}
const onSearch = ()=> {
if (!formState.value.datePlan) {
message.warn('请选择计划日期')
return
}
openModalContractSales(true,{isUpdate: false, list: contractList.value})
}
const handleSuccessContract = (val) => {
formState.value.kName = val[0].kName
formState.value.ksId = val[0].id
getPointDely()
getContractQty()
}
const onSearchUpLoad = (val)=> {
if (!formState.value.kName) {
message.warn('请选择合同')
return
}
openModalUpLoad(true,{isUpdate: false, list: pointDelyList.value})
}
const handleSuccessUpLoad = (val) => {
formState.value.pointDelyName = val[0].pointDelyName
formState.value.pointDelyCode = val[0].pointDelyCode
formState.value.ksppId = val[0].id
getPurList()
}
const getPointDely = async () => {
let res = await getLngPngDemandPointDely({kId: formState.value.ksId})
pointDelyList.value = res || []
if (pointDelyList.value.length == 1) {
formState.value.pointDelyName = pointDelyList.value[0].pointDelyName
formState.value.pointDelyCode = pointDelyList.value[0].pointDelyCode
formState.value.ksppId = pointDelyList.value[0].id
}
}
const getContractQty = async () => {
let obj = {
kId: formState.value.ksId,
datePlan: dayjs(formState.value.datePlan).format('YYYY-MM-DD')
}
let res = await getLngPngDemandContractQty(obj) || []
formState.value.qtyContractGj = res[0]?.qtyContractGj
formState.value.qtyContractM3 = res[0]?.qtyContractM3
formState.value.qtyContractM3 =NP.divide(Number(formState.value.qtyContractM3), 10000)
}
const disabledDateStart = (current) => {
const today = new Date();
today.setHours(0, 0, 0, 0); // 清除时分秒,确保比较时不考虑时间部分
// 获取明天的日期
const tomorrow = new Date();
tomorrow.setDate(tomorrow.getDate() + (pageType.value?1: 2));
tomorrow.setHours(0, 0, 0, 0); // 清除时分秒
// 当前日期小于今天或大于明天,则禁用
return current < today || current > tomorrow;
}
async function getFormValue () {
await formRef.value.validateFields();
let obj = {
formInfo: formState.value,
}
return obj
}
watch(
() => props.formObj,
(val) => {
if (val) {
formState.value = val
}
},
{
immediate: true,
deep: true,
}
);
watch(
() => props.changeList,
(val) => {
diffResultList.value = val || []
},
{
immediate: true,
deep: true,
}
);
defineExpose({
getFormValue
});
</script>
<style lang="less" scoped>
.dot {
margin-right: 10px;
display: flex;
align-items: center;
.ant-input-number{
margin:0 5px;
font-style: normal;
}
span{
width: 10px !important;
height: 10px !important;
border-radius: 50%;
background: red;
display: block;
}
}
.changeStyle {
color: red !important;
}
:deep(.changeStyle .ant-input) {
color: red !important;
}
</style>

View File

@ -6,25 +6,15 @@ export const formConfig = {
};
export const searchFormSchema: FormSchema[] = [
{
field: 'id',
label: 'id',
component: 'Input',
},
{
field: 'verNo',
label: '版本号',
component: 'Input',
},
{
field: 'datePlan',
label: '计划日期',
component: 'Input',
},
{
field: 'staCode',
label: '气源地',
component: 'Input',
component: 'RangePicker',
componentProps: {
format: 'YYYY-MM-DD',
style: { width: '100%' },
getPopupContainer: () => document.body,
},
},
{
field: 'noTractor',
@ -37,66 +27,32 @@ export const searchFormSchema: FormSchema[] = [
component: 'Input',
},
{
field: 'idNoDriver',
label: '驾驶员身份证号',
field: 'kName',
label: '销售合同名称/编码',
component: 'Input',
},
{
field: 'nameDriver',
label: '驾驶员姓名',
component: 'Input',
},
{
field: 'phoneDriver',
label: '驾驶员手机号',
component: 'Input',
},
{
field: 'idNoEscort',
label: '押运员身份证号',
component: 'Input',
},
{
field: 'nameEscort',
label: '押运员姓名',
component: 'Input',
},
{
field: 'phoneEscort',
label: '押运员手机号',
component: 'Input',
},
{
field: 'carrCode',
label: '承运商',
component: 'Input',
},
{
field: 'ksId',
label: '合同',
component: 'Input',
},
{
field: 'alterSign',
label: '变更',
{
field: 'staName',
label: '气源地名称',
component: 'Input',
},
{
field: 'approCode',
label: '审批状态',
component: 'Input',
component: 'XjrSelect',
componentProps: {
datasourceType: 'dic',
params: { itemId: '1990669393069129729' },
labelField: 'name',
valueField: 'value',
getPopupContainer: () => document.body,
},
},
];
export const columns: BasicColumn[] = [
{
dataIndex: 'id',
title: 'id',
componentType: 'input',
align: 'left',
sorter: true,
},
{
dataIndex: 'verNo',
@ -117,7 +73,7 @@ export const columns: BasicColumn[] = [
},
{
dataIndex: 'staCode',
dataIndex: 'staName',
title: '气源地',
componentType: 'input',
align: 'left',
@ -198,7 +154,7 @@ export const columns: BasicColumn[] = [
},
{
dataIndex: 'carrCode',
dataIndex: 'carrName',
title: '承运商',
componentType: 'input',
align: 'left',
@ -207,7 +163,7 @@ export const columns: BasicColumn[] = [
},
{
dataIndex: 'ksId',
dataIndex: 'ksName',
title: '合同',
componentType: 'input',
align: 'left',
@ -216,7 +172,7 @@ export const columns: BasicColumn[] = [
},
{
dataIndex: 'alterSign',
dataIndex: 'alterName',
title: '变更',
componentType: 'input',
align: 'left',
@ -225,7 +181,7 @@ export const columns: BasicColumn[] = [
},
{
dataIndex: 'approCode',
dataIndex: 'approName',
title: '审批状态',
componentType: 'input',
align: 'left',

View File

@ -0,0 +1,203 @@
<template>
<a-spin :spinning="spinning" tip="加载中...">
<div class="page-bg-wrap formViewStyle pdcss">
<div class="top-toolbar" >
<a-button style="margin-right: 10px" @click="close">
<slot name="icon"><close-outlined /></slot>关闭
</a-button>
<template v-if="pageType=='edit'||pageType=='update' || !pageType ">
<a-button style="margin-right: 10px" type="primary" @click="checkBtn('save')">
<slot name="icon"><save-outlined /></slot>保存
</a-button>
<a-button style="margin-right: 10px" @click="checkBtn('submit')">
<slot name="icon"><send-outlined /></slot>保存并提交
</a-button>
</template>
</div>
<Card :title="titleNew" :bordered="false" v-if="pageType=='compare'&&titleNew">
<basicForm :formObj="formStateNew" :changeList="diffResultList" :disable="true"></basicForm>
</Card>
<Card :title="title" :bordered="false" v-if="title">
<basicForm ref="formRef" :formObj="formState" :disable="pageType=='view' || pageType=='compare'"></basicForm>
</Card>
</div>
</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 { SendOutlined, SaveOutlined, CloseOutlined, } from '@ant-design/icons-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 { addLngPngDemand, submitLngPngDemand,getLngPngDemand,getLngPngDemandUpdate,getLngPngDemandCompare,updateLngPngDemand } from '/@/api/dayPlan/Demand';
import dayjs from 'dayjs';
import { getAppEnvConfig } from '/@/utils/env';
import { message } from 'ant-design-vue';
import { useUserStore } from '/@/store/modules/user';
import basicForm from './basicForm.vue'
import NP from 'number-precision';
const userStore = useUserStore();
const userInfo = userStore.getUserInfo;
const formRef = ref();
const { bus, FORM_LIST_MODIFIED } = useEventBus();
const router = useRouter();
const { currentRoute } = router
const tabStore = useMultipleTabStore();
const formProps = ref(null);
const pageId = ref(currentRoute.value.query?.id)
const pageType = ref(currentRoute.value.query?.type)
const spinning = ref(false);
const { notification } = useMessage();
const { t } = useI18n();
const formState = reactive({
datePlan: null
});
const formStateNew = reactive({})
const [register, { openModal:openModal}] = useModal();
const title = ref('管道气需求')
const titleNew = ref('')
const basicFormRef = ref()
const diffResultList = ref([])
onMounted(() => {
if (pageId.value) {
if (pageType.value=='compare') {
getCompareInfo(pageId.value)
return
}
getInfo(pageId.value)
}
});
async function getCompareInfo(id) {
spinning.value = true
try {
let data = await getLngPngDemandCompare(id) || {}
spinning.value = false
diffResultList.value = data.diffResultList || []
let obj = changeData(data.oldBean || {})
Object.assign(formState, {...obj.params})
title.value = formState.verNo? ('版本V'+ formState.verNo) : ''
let obj1 = changeData(data.newBean || {})
Object.assign(formStateNew, {...obj1.params})
titleNew.value = formStateNew.verNo ? ('版本V'+ formStateNew.verNo) : ''
} catch (error) {
console.log(error,'error555555')
spinning.value = false
}
}
async function getInfo(id) {
spinning.value = true
try {
let data = {}
if (pageType.value == 'update') {
data = await getLngPngDemandUpdate(id)
} else {
data = await getLngPngDemand(id)
}
spinning.value = false
let obj = changeData(data)
Object.assign(formState, {...obj.params})
} catch (error) {
console.log(error, 'error')
spinning.value = false
}
}
const changeData = (obj) => {
if (Object.keys(obj).length === 0) return {
params: {}
}
obj.datePlan = obj.datePlan ? dayjs(obj.datePlan) : null
return {
params: obj
}
}
function close() {
tabStore.closeTab(currentRoute.value, router);
}
async function checkBtn(type) {
try {
const data = await formRef.value.getFormValue();
let obj = {
...data.formInfo,
datePlan: dayjs(data.formInfo.datePlan).format('YYYY-MM-DD HH:mm:ss'),
}
spinning.value = true;
let request = submitLngPngDemand
if (type == 'save') {
request = !pageId.value ? addLngPngDemand : updateLngPngDemand
}
await request(obj)
spinning.value = false;
notification.success({
message: 'Tip',
description: type == 'save' ? '保存成功':'已提交'
}); //提示消息
setTimeout(() => {
bus.emit(FORM_LIST_MODIFIED, {});
close();
}, 500);
} catch (errorInfo) {
spinning.value = false;
errorInfo?.errorFields?.length && notification.warning({
message: 'Tip',
description: '请完善信息'
});
}
}
</script>
<style lang="less" scoped>
.page-bg-wrap {
background-color: #fff;
}
.top-toolbar {
min-height: 44px;
margin-bottom: 12px;
border-bottom: 1px solid #eee;
}
.pdcss {
padding:0px 12px 6px 12px !important;
}
.dot {
margin-right: 10px;
display: flex;
align-items: center;
i{
padding: 5px;
font-style: normal;
}
span{
width: 10px !important;
height: 10px !important;
border-radius: 50%;
background: red;
display: block;
}
}
</style>

View File

@ -1,5 +1,5 @@
<template>
<PageWrapper dense fixedHeight contentFullHeight contentClass="flex">
<PageWrapper dense fixedHeight contentFullHeight contentClass="flex" class="LngDemandStyle">
<BasicTable @register="registerTable" ref="tableRef" @row-dbClick="dbClickRow">
<template #toolbar>
@ -78,15 +78,37 @@
const tableRef = ref();
//所有按钮
const buttons = ref([{"isUse":true,"name":"新增","code":"add","icon":"ant-design:plus-outlined","isDefault":true,"type":"primary"},{"isUse":true,"name":"编辑","code":"edit","icon":"ant-design:form-outlined","isDefault":true},{"isUse":true,"name":"刷新","code":"refresh","icon":"ant-design:reload-outlined","isDefault":true},{"isUse":true,"name":"查看","code":"view","icon":"ant-design:eye-outlined","isDefault":true},{"isUse":true,"name":"数据日志","code":"datalog","icon":"ant-design:profile-outlined","isDefault":true},{"isUse":true,"name":"快速导入","code":"import","icon":"ant-design:import-outlined","isDefault":true},{"isUse":true,"name":"快速导出","code":"export","icon":"ant-design:export-outlined","isDefault":true},{"isUse":true,"name":"发起审批","code":"startwork","icon":"ant-design:form-outlined","isDefault":true},{"isUse":true,"name":"查看流转记录","code":"flowRecord","icon":"ant-design:form-outlined","isDefault":true},{"isUse":true,"name":"提交","code":"submit","icon":"ant-design:send-outlined","isDefault":true},{"isUse":true,"name":"变更","code":"update","icon":"ant-design:edit-filled","isDefault":true},{"isUse":true,"name":"对比","code":"compare","icon":"ant-design:file-done-outlined","isDefault":false},{"isUse":true,"name":"撤回","code":"back","icon":"ant-design:rollback-outlined","isDefault":false},{"isUse":true,"name":"删除","code":"delete","icon":"ant-design:delete-outlined","isDefault":true}]);
const buttons = ref([{"isUse":true,"name":"新增","code":"add","icon":"ant-design:plus-outlined","isDefault":true,"type":"primary"},
{"isUse":true,"name":"编辑","code":"edit","icon":"ant-design:form-outlined","isDefault":true},
{"isUse":true,"name":"刷新","code":"refresh","icon":"ant-design:reload-outlined","isDefault":true},
{"isUse":true,"name":"查看","code":"view","icon":"ant-design:eye-outlined","isDefault":true},
{"isUse":true,"name":"数据日志","code":"datalog","icon":"ant-design:profile-outlined","isDefault":true},
{"isUse":true,"name":"快速导入","code":"import","icon":"ant-design:import-outlined","isDefault":true},
{"isUse":true,"name":"快速导出","code":"export","icon":"ant-design:export-outlined","isDefault":true},
{"isUse":true,"name":"发起审批","code":"startwork","icon":"ant-design:form-outlined","isDefault":true},
{"isUse":true,"name":"查看流转记录","code":"flowRecord","icon":"ant-design:form-outlined","isDefault":true},
{"isUse":true,"name":"提交","code":"submit","icon":"ant-design:send-outlined","isDefault":true},
{"isUse":true,"name":"变更","code":"update","icon":"ant-design:edit-filled","isDefault":true},
{"isUse":true,"name":"取消","code":"cancel","icon":"ant-design:close-outlined","isDefault":true},
{"isUse":true,"name":"对比","code":"compare","icon":"ant-design:file-done-outlined","isDefault":false},
{"isUse":true,"name":"撤回","code":"back","icon":"ant-design:rollback-outlined","isDefault":false},
{"isUse":true,"name":"删除","code":"delete","icon":"ant-design:delete-outlined","isDefault":true}]);
//展示在列表内的按钮
const actionButtons = ref<string[]>(['view', 'edit','datalog', 'copyData', 'delete', 'startwork','flowRecord']);
const actionButtons = ref<string[]>(['view', 'edit','datalog', 'copyData', 'delete', 'startwork','flowRecord','compare','update','back','cancel']);
const buttonConfigs = computed(()=>{
return filterButtonAuth(buttons.value);
})
const tableButtonConfig = computed(() => {
return buttonConfigs.value?.filter((x) => !actionButtons.value.includes(x.code));
let arr =[{"isUse":true,"name":"新增","code":"add","icon":"ant-design:plus-outlined","isDefault":true,"type":"primary"},
{"isUse":true,"name":"提交","code":"submit","icon":"ant-design:send-outlined","isDefault":true},
{"isUse":true,"name":"撤回","code":"back","icon":"ant-design:rollback-outlined","isDefault":false},
{"isUse":true,"name":"导入","code":"import","icon":"ant-design:import-outlined","isDefault":true},
{"isUse":true,"name":"导出模板","code":"export","icon":"ant-design:export-outlined","isDefault":true},
{"name":"刷新","code":"refresh","icon":"ant-design:reload-outlined","isDefault":true,"isUse":true},]
return arr
// return buttonConfigs.value?.filter((x) => !actionButtons.value.includes(x.code));
});
const actionButtonConfig = computed(() => {
@ -108,6 +130,7 @@
const schemaIdRef = ref('');
const formDataRef = ref();
const rowKeyData = ref();
const selectedKeys = ref([])
const draftsId = ref();
const visibleApproveProcessRef = ref(false);
@ -116,7 +139,7 @@
const [registerModal, { openModal }] = useModal();
const [registerImportModal, { openModal: openImportModal }] = useModal();
const formName='LNG客户需求';
const formName=currentRoute.value.meta?.title;
const [registerTable, { reload, }] = useTable({
title: '' || (formName + '列表'),
api: getLngLngDemandPage,
@ -127,11 +150,11 @@
gutter: 16,
},
schemas: customSearchFormSchema,
fieldMapToTime: [],
showResetButton: false,
fieldMapToTime: [['datePlan', ['startDate', 'endDate'], 'YYYY-MM-DD']],
showResetButton: true,
},
beforeFetch: (params) => {
return { ...params, FormId: formIdComputedRef.value, PK: 'id' };
return { ...params, FormId: formIdComputedRef.value, PK: 'id',page:params.limit };
},
afterFetch: (res) => {
tableRef.value.setToolBarWidth();
@ -147,13 +170,19 @@
dataIndex: 'action',
slots: { customRender: 'action' },
},
rowSelection: {
type: 'checkbox',
onChange: onSelectChange
},
tableSetting: {
size: false,
setting: false,
},
});
function onSelectChange(rowKeys: string[]) {
selectedKeys.value = rowKeys;
}
function dbClickRow(record) {
if (!actionButtonConfig?.value.some(element => element.code == 'view')) {
return;
@ -206,10 +235,10 @@
});
} else {
router.push({
path: '/form/LngDemand/0/createForm',
path: '/dayPlan/LngDemand/createForm',
query: {
formPath: 'dayPlan/LngDemand',
formName: formName,
formName: '新建'+formName,
formId:currentRoute.value.meta.formId
}
});
@ -227,6 +256,14 @@
}
});
}
async function handleCancel(record: Recordable) {
await cancelLngPng(record.id)
handleSuccess();
notification.success({
message: '提示',
description: t('已取消!'),
});
}
function handleSubmit () {
}
@ -247,7 +284,7 @@
deleteLngLngDemand(ids).then((_) => {
handleSuccess();
notification.success({
message: 'Tip',
message: '提示',
description: t('删除成功!'),
});
});
@ -423,6 +460,14 @@
}
};
</script>
<style lang="less">
.LngDemandStyle .cusSearchForm .advanceRow> div:nth-of-type(3){
display: none;
}
.LngDemandStyle .cusSearchForm .advanceRow> div:nth-of-type(2){
display: none;
}
</style>
<style lang="less" scoped>
:deep(.ant-table-selection-col) {
width: 50px;
@ -433,4 +478,24 @@
.hide{
display: none !important;
}
:deep( .ant-col-8:nth-child(1)) {
width: 320px !important;
max-width: 320px !important;
}
:deep(.ant-col-8:nth-child(1) .ant-form-item-label) {
width: 80px !important;
}
:deep( .ant-col-8:nth-child(4)) {
width: 320px !important;
max-width: 320px !important;
}
:deep(.ant-col-8:nth-child(4) .ant-form-item-label) {
width: 130px !important;
max-width: 130px !important;
}
:deep(.ant-col-8:nth-child(4) .ant-form-item-label label) {
width: 130px !important;
max-width: 130px !important;
}
</style>

View File

@ -16,6 +16,16 @@ export const searchFormSchema: FormSchema[] = [
getPopupContainer: () => document.body,
},
},
{
field: 'cuName',
label: '客户名称/简称/编码',
component: 'Input',
},
{
field: 'suName',
label: '供应商名称/简称/编码',
component: 'Input',
},
{
field: 'noTractor',
label: '车头号',
@ -26,6 +36,25 @@ export const searchFormSchema: FormSchema[] = [
label: '挂车号',
component: 'Input',
},
{
field: 'statusCode',
label: '状态',
component: 'Select',
componentProps: {
showSearch: true,
optionFilterProp: 'label',
filterOption: (input: string, option: any) => {
return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0;
},
options: [
// { label: '全部', value: '' },
],
placeholder: '请选择',
allowClear: true,
getPopupContainer: () => document.body,
},
},
];
export const columns: BasicColumn[] = [
@ -48,7 +77,7 @@ export const columns: BasicColumn[] = [
},
{
dataIndex: 'staCode',
dataIndex: 'staName',
title: '气源地',
componentType: 'input',
align: 'left',
@ -75,7 +104,7 @@ export const columns: BasicColumn[] = [
},
{
dataIndex: 'qtyTonLoading',
dataIndex: 'qtyMeaTonSales',
title: '装车量(吨)',
componentType: 'input',
align: 'left',
@ -84,7 +113,7 @@ export const columns: BasicColumn[] = [
},
{
dataIndex: 'tenantId',
dataIndex: 'qtyMeaGjSales',
title: '装车量(吉焦)',
componentType: 'input',
align: 'left',
@ -93,7 +122,7 @@ export const columns: BasicColumn[] = [
},
{
dataIndex: 'modifyDate',
dataIndex: 'qtyMeaM3Sales',
title: '装车量(方)',
componentType: 'input',
align: 'left',

View File

@ -1,5 +1,5 @@
<template>
<PageWrapper dense fixedHeight contentFullHeight contentClass="flex">
<PageWrapper dense fixedHeight contentFullHeight contentClass="flex" class="LngMeasurePurStyle">
<BasicTable @register="registerTable" ref="tableRef" @row-dbClick="dbClickRow">
<template #toolbar>
@ -15,13 +15,19 @@
</template>
</template>
<template #bodyCell="{ column, record }">
<template v-if="column.dataIndex === 'lngFileUploadList'">
<div v-for="(item, idx) in record.lngFileUploadList">
<a @click="handleDownload(item)">{{item.fileOrg}}</a>
</div>
</template>
<template v-if="column.dataIndex === 'action'">
<TableAction :actions="getActions(record)" />
</template>
</template>
</BasicTable>
<LngMeasurePurModal @register="registerModal" @success="handleSuccess" />
<DataLog :logId="logId" :logPath="logPath" v-model:visible="modalVisible"/>
<LngMeasurePurModal @register="registerModal" @success="handleSuccess" />
<DataLog :logId="logId" :logPath="logPath" v-model:visible="modalVisible"/>
<rejectReplyModal :visible="isOpen" @success="handleRejectReply" />
</PageWrapper>
</template>
<script lang="ts" setup>
@ -29,9 +35,7 @@
const logId = ref('')
const logPath = ref('/dayPlan/lngMeasurePur/datalog');
import { DataLog } from '/@/components/pcitc';
import { ref, computed, onMounted, onUnmounted,
} from 'vue';
import { ref, computed, onMounted, onUnmounted, watch} from 'vue';
import { BasicTable, useTable, TableAction, ActionItem } from '/@/components/Table';
import { getLngLngMeasurePage, deleteLngLngMeasure} from '/@/api/dayPlan/LngMeasurePur';
@ -49,6 +53,10 @@
import Icon from '/@/components/Icon/index';
import useEventBus from '/@/hooks/event/useEventBus';
import { cloneDeep } from 'lodash-es';
import { parseDownloadUrl} from '/@/api/system/file';
import { downloadByUrl } from '/@/utils/file/download';
import { DataFormat, FormatOption, DATE_FORMAT, FormatType } from '/@/utils/dataFormat';
import rejectReplyModal from '/@/components/common/rejectReplyModal.vue'
const { bus, CREATE_FLOW, FLOW_PROCESSED, FORM_LIST_MODIFIED } = useEventBus();
@ -61,25 +69,29 @@
const filterColumns = cloneDeep(filterColumnAuth(columns));
const customConfigColums =ref(filterColumns);
const customSearchFormSchema =ref(searchFormSchema);
const isOpen = ref(false)
const tableRef = ref();
const tableData = ref([])
const selectedKeys = ref<string[]>([]);
//所有按钮
const buttons = ref([{"isUse":true,"name":"刷新","code":"refresh","icon":"ant-design:reload-outlined","isDefault":true},{"isUse":true,"name":"数据日志","code":"datalog","icon":"ant-design:profile-outlined","isDefault":true},{"isUse":true,"name":"确认","code":"submit","icon":"ant-design:check-outlined","isDefault":false},{"isUse":true,"name":"取消确认","code":"cancel","icon":"ant-design:rollback-outlined","isDefault":false},{"isUse":true,"name":"驳回","code":"reject","icon":"ant-design:stop-outlined","isDefault":false}]);
//展示在列表内的按钮
const actionButtons = ref<string[]>(['view', 'edit','datalog', 'copyData', 'delete', 'startwork','flowRecord']);
const actionButtons = ref<string[]>(['view', 'edit','datalog', 'copyData', 'delete', 'startwork','flowRecord','submit','cancel','reject']);
const buttonConfigs = computed(()=>{
return filterButtonAuth(buttons.value);
})
const tableButtonConfig = computed(() => {
return buttonConfigs.value?.filter((x) => !actionButtons.value.includes(x.code));
let arr =[{"name":"确认","code":"submit","icon":"ant-design:check-outlined","isDefault":true,"isUse":true},{"name":"取消确认","code":"cancel","icon":"ant-design:rollback-outlined","isDefault":true,"isUse":true},{"name":"驳回","code":"reject","icon":"ant-design:stop-outlined","isDefault":true,"isUse":true},{"name":"刷新","code":"refresh","icon":"ant-design:reload-outlined","isDefault":true,"isUse":true},]
return arr
// return buttonConfigs.value?.filter((x) => !actionButtons.value.includes(x.code));
});
const actionButtonConfig = computed(() => {
return buttonConfigs.value?.filter((x) => actionButtons.value.includes(x.code));
});
const btnEvent = {refresh : handleRefresh,datalog : handleDatalog,}
const btnEvent = {refresh : handleRefresh,datalog : handleDatalog,submit: handleSubmit, cancel: handleCancel, reject: handleReject}
const { currentRoute } = useRouter();
const router = useRouter();
@ -88,8 +100,8 @@
const schemaIdComputedRef = ref();
schemaIdComputedRef.value = currentRoute.value.meta.schemaId
const [registerModal, { openModal }] = useModal();
const formName='LNG计量(业务)';
const [registerTable, { reload, }] = useTable({
const formName=currentRoute.value.meta?.title;
const [registerTable, { reload, setTableData,clearSelectedRowKeys }] = useTable({
title: '' || (formName + '列表'),
api: getLngLngMeasurePage,
rowKey: 'id',
@ -99,13 +111,14 @@
gutter: 16,
},
schemas: customSearchFormSchema,
fieldMapToTime: [],
fieldMapToTime: [['datePlan', ['startDate', 'endDate'], 'YYYY-MM-DD']],
showResetButton: false,
},
beforeFetch: (params) => {
return { ...params, FormId: formIdComputedRef.value, PK: 'id' };
return { ...params, FormId: formIdComputedRef.value, PK: 'id',page:params.limit };
},
afterFetch: (res) => {
tableData.value = res || []
tableRef.value.setToolBarWidth();
},
@ -119,52 +132,117 @@
dataIndex: 'action',
slots: { customRender: 'action' },
},
rowSelection: {
type: 'checkbox',
onChange: onSelectChange
},
tableSetting: {
size: false,
setting: false,
},
});
watch(
() => tableData.value,
(val) => {
if (val) {
let arr = DataFormat.format(val, [
FormatOption.createQty('qtyMeaTonSales'),
FormatOption.createQty('qtyMeaGjSales'),
FormatOption.createQty('qtyMeaM3Sales'),
]);
if (arr.length) {
setTableData(arr)
}
}
},
{
immediate: true,
deep: true,
}
);
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});
};
function onSelectChange(selectedRowKeys: [], selectedRows) {
selectedKeys.value = selectedRowKeys;
}
function dbClickRow(record) {
if (!actionButtonConfig?.value.some(element => element.code == 'view')) {
return;
}
const { processId, taskIds, schemaId } = record.workflowData || {};
if (taskIds && taskIds.length) {
router.push({
path: '/flow/' + schemaId + '/' + (processId || '') + '/approveFlow',
query: {
taskId: taskIds[0],
formName: formName,
formId:currentRoute.value.meta.formId
}
});
} else if (schemaId && !taskIds && processId) {
router.push({
path: '/flow/' + schemaId + '/' + processId + '/approveFlow',
query: {
readonly: 1,
taskId: '',
formName: formName,
formId:currentRoute.value.meta.formId
}
});
} else {
router.push({
path: '/form/LngMeasurePur/' + record.id + '/viewForm',
query: {
formPath: 'dayPlan/LngMeasurePur',
formName: formName,
formId:currentRoute.value.meta.formId
}
});
}
}
function buttonClick(code) {
btnEvent[code]();
btnEvent[code]('batch');
}
async function handleSubmit (val) {
if (val=='batch') {
if (!selectedKeys.value.length) {
notification.warning({
message: '提示',
description: t('请选择需要确认的数据'),
});
return;
}
} else {
selectedKeys.value= [val?.id]
}
await submitLngPngMeasurePur(selectedKeys.value)
handleSuccess();
notification.success({
message: '提示',
description: t('确认成功!'),
});
clearSelectedRowKeys()
}
async function handleCancel (val) {
if (val=='batch') {
if (!selectedKeys.value.length) {
notification.warning({
message: '提示',
description: t('请选择需要取消的数据'),
});
return;
}
} else {
selectedKeys.value= [val?.id]
}
await cancelLngPngMeasurePur(selectedKeys.value)
handleSuccess();
notification.success({
message: '提示',
description: t('取消成功!'),
});
clearSelectedRowKeys()
}
function handleReject (val) {
if (val=='batch') {
if (!selectedKeys.value.length) {
notification.warning({
message: '提示',
description: t('请选择需要驳回的数据'),
});
return;
}
} else {
selectedKeys.value= [val?.id]
}
isOpen.value = true
}
const handleRejectReply = async (val) => {
let obj = {
"ids": selectedKeys.value,
"rejNote": val.reply,
}
await rejectLngPngMeasurePur(obj)
isOpen.value = false
handleSuccess();
notification.success({
message: '提示',
description: t('已驳回!'),
});
}
function handleDatalog (record: Recordable) {
modalVisible.value = true
@ -179,6 +257,17 @@
}
onMounted(() => {
const statusList = [
{label: '计量中', value: 'JLZ'},
{label: '结算中', value: 'JSZ'},
{label: '已结算', value: 'YJS'},
{label: '计量完成', value: 'JLWC'},
]
customSearchFormSchema.value.forEach(v => {
if (v.field == 'statusCode') {
v.componentProps.options = statusList
}
});
if (schemaIdComputedRef.value) {
bus.on(FLOW_PROCESSED, handleRefresh);
bus.on(CREATE_FLOW, handleRefresh);
@ -198,27 +287,52 @@
}
});
function getActions(record: Recordable):ActionItem[] {
const actionsList: ActionItem[] = actionButtonConfig.value?.map((button) => {
if (!record.workflowData?.processId) {
return {
let submitBtn: ActionItem[] = [];
let cancelBtn: ActionItem[] = [];
let rejectBtn: ActionItem[] = [];
let datalogBtn: ActionItem[] = [];
let actionsList: ActionItem[] = []
actionButtonConfig.value?.map((button) => {
if (['submit'].includes(button.code)) {
submitBtn.push({
icon: button?.icon,
tooltip: button?.name,
onClick: btnEvent[button.code].bind(null, record),
});
}
if (['cancel'].includes(button.code)) {
cancelBtn.push({
icon: button?.icon,
tooltip: button?.name,
onClick: btnEvent[button.code].bind(null, record),
});
}
if (['reject'].includes(button.code)) {
rejectBtn.push({
icon: button?.icon,
tooltip: button?.name,
color: button.code === 'delete' ? 'error' : undefined,
onClick: btnEvent[button.code].bind(null, record),
};
} else {
if (button.code === 'view') {
return {
icon: button?.icon,
tooltip: button?.name,
onClick: btnEvent[button.code].bind(null, record),
};
} else {
return {};
}
});
}
if (['datalog'].includes(button.code)) {
datalogBtn.push({
icon: button?.icon,
tooltip: button?.name,
onClick: btnEvent[button.code].bind(null, record),
});
}
});
if (record.statusCode=='JLZ') {
actionsList = actionsList.concat(submitBtn);
}
if (record.statusCode=='JLWC') {
actionsList = actionsList.concat(cancelBtn);
}
if (record.statusCode=='JLZ'&&record.cfmCuUserId) {
actionsList = actionsList.concat(rejectBtn);
}
actionsList = actionsList.concat(datalogBtn);
return actionsList;
}
async function mergeCustomListRenderConfig(){
@ -236,6 +350,11 @@
}
};
</script>
<style lang="less">
.LngMeasurePurStyle .cusSearchForm .advanceRow> div:nth-of-type(3){
display: none;
}
</style>
<style lang="less" scoped>
:deep(.ant-table-selection-col) {
width: 50px;
@ -246,4 +365,67 @@
.hide{
display: none !important;
}
:deep( .ant-col-8:nth-child(1)) {
width: 320px !important;
max-width: 320px !important;
}
:deep(.ant-col-8:nth-child(1) .ant-form-item-label) {
width: 80px !important;
}
:deep( .ant-col-8:nth-child(4)) {
width: 320px !important;
max-width: 320px !important;
}
:deep(.ant-col-8:nth-child(4) .ant-form-item-label) {
width: 80px !important;
}
:deep( .ant-col-8:nth-child(2)) {
width: 330px !important;
max-width: 330px !important;
}
:deep(.ant-col-8:nth-child(2) .ant-form-item-label) {
width: 150px !important;
max-width: 150px !important;
}
:deep(.ant-col-8:nth-child(2) .ant-form-item-label label) {
width: 150px !important;
max-width: 150px !important;
}
:deep( .ant-col-8:nth-child(6)) {
width: 330px !important;
max-width: 330px !important;
}
:deep(.ant-col-8:nth-child(6) .ant-form-item-label) {
width: 150px !important;
max-width: 150px !important;
}
:deep(.ant-col-8:nth-child(6) .ant-form-item-label label) {
width: 150px !important;
max-width: 150px !important;
}
:deep( .ant-col-8:nth-child(3)) {
width: 330px !important;
max-width: 330px !important;
}
:deep(.ant-col-8:nth-child(3) .ant-form-item-label) {
width: 150px !important;
max-width: 150px !important;
}
:deep(.ant-col-8:nth-child(3) .ant-form-item-label label) {
width: 150px !important;
max-width: 150px !important;
}
:deep( .ant-col-8:nth-child(5)) {
width: 330px !important;
max-width: 330px !important;
}
:deep(.ant-col-8:nth-child(5) .ant-form-item-label) {
width: 150px !important;
max-width: 150px !important;
}
:deep(.ant-col-8:nth-child(5) .ant-form-item-label label) {
width: 150px !important;
max-width: 150px !important;
}
</style>

View File

@ -26,6 +26,11 @@ export const searchFormSchema: FormSchema[] = [
label: '挂车号',
component: 'Input',
},
{
field: 'noTrailer',
label: '挂车号',
component: 'Input',
},
];
export const columns: BasicColumn[] = [
@ -66,7 +71,7 @@ export const columns: BasicColumn[] = [
},
{
dataIndex: 'qtyTonLoading',
dataIndex: 'qtyMeaTonSales',
title: '装车量(吨)',
componentType: 'input',
align: 'left',
@ -75,7 +80,7 @@ export const columns: BasicColumn[] = [
},
{
dataIndex: 'xCode',
dataIndex: 'qtyMeaGjSales',
title: '装车量(吉焦)',
componentType: 'input',
align: 'left',
@ -84,7 +89,7 @@ export const columns: BasicColumn[] = [
},
{
dataIndex: 'tenantId',
dataIndex: 'qtyMeaM3Sales',
title: '装车量(方)',
componentType: 'input',
align: 'left',

View File

@ -0,0 +1,251 @@
<template>
<BasicModal v-bind="$attrs" @register="registerModal" width="85%" :title="getTitle" @ok="handleSubmit" @visible-change="handleVisibleChange">
<a-spin :spinning="spinning" tip="加载中...">
<BasicTable @register="registerTable" v-if="showTable" class="LngMeasureSalesForm">
</BasicTable>
</a-spin>
</BasicModal>
</template>
<script lang="ts" setup>
import { useRouter } from 'vue-router';
import { ref, computed, unref, nextTick } from 'vue';
import { SaveOutlined, } from '@ant-design/icons-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 { BasicModal, useModalInner, useModal } from '/@/components/Modal';
import dayjs from 'dayjs';
import { message } from 'ant-design-vue';
import { useUserStore } from '/@/store/modules/user';
import { BasicTable, useTable, FormSchema, BasicColumn, TableAction } from '/@/components/Table';
import { getLngPngMeasureSalesPurPageAdd, addLngPngMeasureSalesPur } from '/@/api/dayPlan/PngMeasureSalesPur';
import NP from 'number-precision';
const userStore = useUserStore();
const { bus, FORM_LIST_MODIFIED } = useEventBus();
const router = useRouter();
const { currentRoute } = router;
const tabStore = useMultipleTabStore();
const codeFormSchema: FormSchema[] = [
{
field: 'datePlan',
label: '计划日期',
component: 'RangePicker',
componentProps: {
format: 'YYYY-MM-DD',
style: { width: '100%' },
getPopupContainer: () => document.body,
},
},
{
field: 'noTractor',
label: '车头号',
component: 'Input',
},
{
field: 'noTrailer',
label: '挂车号',
component: 'Input',
},
];
const columns: BasicColumn[] = [
{
dataIndex: 'datePlan',
title: '计划日期',
componentType: 'input',
align: 'left',
width: 120,
ellipsis: true,
},
{
dataIndex: 'staName',
title: '气源地',
componentType: 'input',
align: 'left',
ellipsis: true,
width: 120,
},
{
dataIndex: 'noTractor',
title: '车头号',
componentType: 'input',
align: 'left',
ellipsis: true,
width: 150,
},
{
dataIndex: 'noTrailer',
title: '挂车号',
componentType: 'input',
align: 'left',
ellipsis: true,
width: 120,
},
{
dataIndex: 'idNoDriver',
title: '驾驶员身份证号',
componentType: 'input',
align: 'left',
width: 120,
},
{
dataIndex: 'nameDriver',
title: '驾驶员姓名',
componentType: 'input',
align: 'left',
width: 120,
},
{
dataIndex: 'phoneDriver',
title: '驾驶员手机号',
componentType: 'input',
align: 'left',
ellipsis: true,
width: 150,
},
{
dataIndex: 'idNoEscort',
title: '押运员身份证号',
componentType: 'input',
align: 'left',
width: 120,
},
{
dataIndex: 'nameEscort',
title: '押运员姓名',
componentType: 'input',
align: 'left',
width: 120,
},
{
dataIndex: 'phoneEscort',
title: '押运员手机号',
componentType: 'input',
align: 'left',
width: 120,
},
{
dataIndex: 'carrName',
title: '承运商',
componentType: 'input',
align: 'left',
width: 120,
},
{
dataIndex: 'ksName',
title: '销售合同',
componentType: 'input',
align: 'left',
width: 120,
},
{
dataIndex: 'suName',
title: '供应商',
componentType: 'input',
align: 'left',
width: 120,
},
];
const spinning = ref(false);
const { t } = useI18n();
const formState = ref({});
const isUpdate = ref(true);
const showTable = ref(false)
const curCuCode = ref('')
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
showTable.value = true
curCuCode.value = data?.cuCode
setModalProps({ confirmLoading: false });
setPagination({'limit': 1,'size': 10,'page': 1});
isUpdate.value = !!data?.isUpdate;
});
const emit = defineEmits(['success', 'register']);
const { notification } = useMessage();
const selectedKeys = ref<string[]>([]);
const selectedValues = ref([]);
const [registerTable, { reload,setPagination }] = useTable({
title: t('LNG计量(客户)新增列表'),
api: getLngPngMeasureSalesPurPageAdd,
columns: columns,
pagination: true,
canResize: false,
formConfig: {
labelCol:{span: 9},
schemas: codeFormSchema,
fieldMapToTime: [['datePlan', ['startDate', 'endDate'], 'YYYY-MM-DD']],
showResetButton: true,
},
immediate: false,
beforeFetch: (params) => {
return { ...params,...formState.value,page:params.limit,cuCode: curCuCode.value};
},
rowSelection: {
type: 'checkbox',
onChange: onSelectChange
},
});
const getTitle = computed(() => (!unref(isUpdate) ? t('LNG计量(客户)新增列表') : t('')));
const handleVisibleChange = async (visible: boolean) => {
if (visible) {
showTable.value = false
await nextTick();
await nextTick();
await nextTick();
nextTick(() => {
reload({searchInfo:{'limit':1,'size':10,'page':1,cuCode: curCuCode.value}});
});
}
};
function onSelectChange(rowKeys: string[], e) {
selectedKeys.value = rowKeys;
selectedValues.value = e
}
function close() {
tabStore.closeTab(currentRoute.value, router);
}
async function handleSubmit() {
if (!selectedValues.value.length) {
message.warn('请选择数据')
return
}
spinning.value = true;
try {
await addLngPngMeasureSalesPur(selectedValues.value);
spinning.value = false;
notification.success({
message: '提示',
description: '保存成功'
});
closeModal();
emit('success', selectedValues.value);
}catch (errorInfo) {
spinning.value = false;
}
}
</script>
<style >
.LngMeasureSalesForm .basicCol{
position: inherit !important;
top: 0;
}
</style>
<style lang="less" scoped>
:deep( .ant-col-8:nth-child(1)) {
width: 360px !important;
max-width: 360px !important;;
}
:deep(.ant-col-8:nth-child(1) .ant-form-item-label) {
width: 80px !important;
}
</style>

View File

@ -1,5 +1,5 @@
<template>
<PageWrapper dense fixedHeight contentFullHeight contentClass="flex">
<PageWrapper dense fixedHeight contentFullHeight contentClass="flex" class="LngMeasureSalesStyle">
<BasicTable @register="registerTable" ref="tableRef" @row-dbClick="dbClickRow">
<template #toolbar>
@ -15,6 +15,33 @@
</template>
</template>
<template #bodyCell="{ column, record }">
<template v-if="column.dataIndex === 'qtyMeaTonSales'">
<input-number v-model:value="record.qtyMeaTonSales" :disabled="record.statusCode!=='JLZ'"
@change="numChange(record)" :min="0" :digits="3" style="width: 100%" />
</template>
<template v-if="column.dataIndex === 'qtyMeaGjSales'">
<input-number v-model:value="record.qtyMeaGjSales" :disabled="record.statusCode!=='JLZ'"
@change="numChange(record)" :min="0" :digits="3" style="width: 100%" />
</template>
<template v-if="column.dataIndex === 'qtyMeaM3Sales'">
<input-number v-model:value="record.qtyMeaM3Sales" :disabled="record.statusCode!=='JLZ'" :min="0" :digits="3" style="width: 100%" />
</template>
<template v-if="column.dataIndex === 'timeIn'">
<a-date-picker :inputReadOnly="true" v-model:value="record.timeIn" show-time />
</template>
<template v-if="column.dataIndex === 'timeOut'">
<a-date-picker :inputReadOnly="true" v-model:value="record.timeOut" show-time />
</template>
<template v-if="column.dataIndex === 'lngFileUploadList'">
<div>
<Upload :file-list="record.lngFileUploadList" :showUploadList="false" v-model:value="tableId" v-model:tableName="tableName" v-model:columnName="columnName"
:multiple="true" :dataDelete="true" :isShowTip="false" :isShowBtnIcon="false" @click="onUpload(index)" @change="uploadChange" :showDownloadIcon="false"/>
<div v-for="(item, idx) in record.lngFileUploadList">
<a @click="handleDownload(item)">{{item.fileOrg}}</a>
<span @click="deleteFile(record, idx)" class="delIcon"><DeleteOutlined /></span>
</div>
</div>
</template>
<template v-if="column.dataIndex === 'action'">
<TableAction :actions="getActions(record)" />
</template>
@ -22,6 +49,7 @@
</BasicTable>
<LngMeasureSalesModal @register="registerModal" @success="handleSuccess" />
<DataLog :logId="logId" :logPath="logPath" v-model:visible="modalVisible"/>
<createFormModal @register="registerModalForm" @success="handleSuccessForm"/>
</PageWrapper>
</template>
<script lang="ts" setup>
@ -29,9 +57,7 @@
const logId = ref('')
const logPath = ref('/dayPlan/lngMeasureSales/datalog');
import { DataLog } from '/@/components/pcitc';
import { ref, computed, onMounted, onUnmounted, createVNode,
} from 'vue';
import { ref, computed, onMounted, onUnmounted, createVNode, } from 'vue';
import { Modal } from 'ant-design-vue';
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
@ -51,6 +77,10 @@
import Icon from '/@/components/Icon/index';
import useEventBus from '/@/hooks/event/useEventBus';
import { cloneDeep } from 'lodash-es';
import createFormModal from './components/createFormModal.vue';
import { parseDownloadUrl} from '/@/api/system/file';
import { downloadByUrl } from '/@/utils/file/download';
import { DeleteOutlined } from '@ant-design/icons-vue';
const { bus, CREATE_FLOW, FLOW_PROCESSED, FORM_LIST_MODIFIED } = useEventBus();
@ -63,25 +93,36 @@
const filterColumns = cloneDeep(filterColumnAuth(columns));
const customConfigColums =ref(filterColumns);
const customSearchFormSchema =ref(searchFormSchema);
const selectedKeys = ref<string[]>([]);
const selectedRowsData = ref<any[]>([]);
const curCuCode = ref('')
const tableRef = ref();
const curIdx = ref('')
//所有按钮
const buttons = ref([{"isUse":true,"name":"新增","code":"add","icon":"ant-design:plus-outlined","isDefault":true,"type":"primary"},{"isUse":true,"name":"刷新","code":"refresh","icon":"ant-design:reload-outlined","isDefault":true},{"isUse":true,"name":"数据日志","code":"datalog","icon":"ant-design:profile-outlined","isDefault":true},{"isUse":true,"name":"保存","code":"save","icon":"ant-design:save-outlined","isDefault":false},{"isUse":true,"name":"保存并确认","code":"submit","icon":"ant-design:check-outlined","isDefault":false},{"isUse":true,"name":"取消确认","code":"cancel","icon":"ant-design:rollback-outlined","isDefault":false},{"isUse":true,"name":"删除","code":"delete","icon":"ant-design:delete-outlined","isDefault":true}]);
const buttons = ref([{"isUse":true,"name":"数据日志","code":"datalog","icon":"ant-design:profile-outlined","isDefault":true},{"isUse":true,"name":"保存","code":"save","icon":"ant-design:save-outlined","isDefault":false},{"isUse":true,"name":"保存并确认","code":"submit","icon":"ant-design:check-outlined","isDefault":false},{"isUse":true,"name":"取消确认","code":"cancel","icon":"ant-design:rollback-outlined","isDefault":false},{"isUse":true,"name":"删除","code":"delete","icon":"ant-design:delete-outlined","isDefault":true}]);
//展示在列表内的按钮
const actionButtons = ref<string[]>(['view', 'edit','datalog', 'copyData', 'delete', 'startwork','flowRecord']);
const actionButtons = ref<string[]>(['view', 'edit','datalog', 'copyData', 'delete','save','submit','cancel', 'startwork','flowRecord']);
const buttonConfigs = computed(()=>{
return filterButtonAuth(buttons.value);
})
const tableButtonConfig = computed(() => {
return buttonConfigs.value?.filter((x) => !actionButtons.value.includes(x.code));
let arr =[
{"isUse":true,"name":"新增","code":"add","icon":"ant-design:plus-outlined","isDefault":true,"type":"primary"},
{"isUse":true,"name":"保存","code":"save","icon":"ant-design:save-outlined","isDefault":true},
{"isUse":true,"name":"保存并确认","code":"submit","icon":"ant-design:check-outlined","isDefault":true},
{"isUse":true,"name":"取消确认","code":"cancel","icon":"ant-design:rollback-outlined","isDefault":true},
{"isUse":true,"name":"删除","code":"delete","icon":"ant-design:delete-outlined","isDefault":true},
{"isUse":true,"name":"刷新","code":"refresh","icon":"ant-design:reload-outlined","isDefault":true}]
return arr
// return buttonConfigs.value?.filter((x) => !actionButtons.value.includes(x.code));
});
const actionButtonConfig = computed(() => {
return buttonConfigs.value?.filter((x) => actionButtons.value.includes(x.code));
});
const btnEvent = {add : handleAdd,refresh : handleRefresh,datalog : handleDatalog,delete : handleDelete,}
const btnEvent = {add : handleAdd,refresh : handleRefresh,datalog : handleDatalog,delete : handleDelete,save: handleSave, submit: handleSubmit, cancel: handleCancel}
const { currentRoute } = useRouter();
const router = useRouter();
@ -90,8 +131,12 @@
const schemaIdComputedRef = ref();
schemaIdComputedRef.value = currentRoute.value.meta.schemaId
const [registerModal, { openModal }] = useModal();
const formName='LNG计量(客户)';
const [registerTable, { reload, }] = useTable({
const [registerModalForm, { openModal: openModalForm }] = useModal();
const tableId = '';
const tableName = 'LngMeasureSales';
const columnName = 'LngMeasureSales';
const formName=currentRoute.value.meta?.title;
const [registerTable, { reload, clearSelectedRowKeys, getDataSource, updateTableDataRecord,setTableData }] = useTable({
title: '' || (formName + '列表'),
api: getLngLngMeasurePage,
rowKey: 'id',
@ -101,11 +146,11 @@
gutter: 16,
},
schemas: customSearchFormSchema,
fieldMapToTime: [],
fieldMapToTime: [['datePlan', ['startDate', 'endDate'], 'YYYY-MM-DD']],
showResetButton: false,
},
beforeFetch: (params) => {
return { ...params, FormId: formIdComputedRef.value, PK: 'id' };
return { ...params, FormId: formIdComputedRef.value, PK: 'id',page:params.limit };
},
afterFetch: (res) => {
tableRef.value.setToolBarWidth();
@ -121,73 +166,122 @@
dataIndex: 'action',
slots: { customRender: 'action' },
},
rowSelection: {
type: 'checkbox',
onChange: onSelectChange
},
tableSetting: {
size: false,
setting: false,
},
});
function onSelectChange(selectedRowKeys: [], selectedRows) {
selectedKeys.value = selectedRowKeys;
selectedRowsData.value = selectedRows;
}
function dbClickRow(record) {
if (!actionButtonConfig?.value.some(element => element.code == 'view')) {
return;
}
const { processId, taskIds, schemaId } = record.workflowData || {};
if (taskIds && taskIds.length) {
router.push({
path: '/flow/' + schemaId + '/' + (processId || '') + '/approveFlow',
query: {
taskId: taskIds[0],
formName: formName,
formId:currentRoute.value.meta.formId
}
});
} else if (schemaId && !taskIds && processId) {
router.push({
path: '/flow/' + schemaId + '/' + processId + '/approveFlow',
query: {
readonly: 1,
taskId: '',
formName: formName,
formId:currentRoute.value.meta.formId
}
});
} else {
router.push({
path: '/form/LngMeasureSales/' + record.id + '/viewForm',
query: {
formPath: 'dayPlan/LngMeasureSales',
formName: formName,
formId:currentRoute.value.meta.formId
}
});
}
}
function buttonClick(code) {
btnEvent[code]();
btnEvent[code]('batch');
}
function handleDatalog (record: Recordable) {
modalVisible.value = true
logId.value = record.id
}
const onUpload = (index) => {
curIdx.value = index
}
const uploadChange = (val) => {
let data = getDataSource()
let record = data[curIdx.value]
record.lngFileUploadList = val
updateTableDataRecord(record.id, record)
}
const deleteFile = (record, idx) => {
record.lngFileUploadList.splice(idx, 1)
updateTableDataRecord(record.id, record)
}
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 numChange = (record) => {
record.rateTonGj = Number(record.qtyMeaGjSales) ? (Number(record.qtyMeaTonSales) || 0 ) / Number(record.qtyMeaGjSales) : '0'
record.rateTonGj = record.rateTonGj ? Number(record.rateTonGj).toFixed(6) : 0
updateTableDataRecord(record.id, record)
}
function handleAdd() {
if (schemaIdComputedRef.value) {
router.push({
path: '/flow/' + schemaIdComputedRef.value + '/0/createFlow'
});
openModalForm(true,{isUpdate: false, cuCode: curCuCode.value});
}
const handleSuccessForm = (val) => {
handleSuccess()
}
async function handleCancel(val) {
if (val=='batch') {
if (!selectedRowsData.value.length) {
notification.warning({
message: '提示',
description: t('请选择需要取消的数据'),
});
return;
}
} else {
router.push({
path: '/form/LngMeasureSales/0/createForm',
query: {
formPath: 'dayPlan/LngMeasureSales',
formName: formName,
formId:currentRoute.value.meta.formId
}
});
selectedRowsData.value= [{...val}]
}
await cancelLngPngMeasureSalesPur(selectedRowsData.value)
handleSuccess();
notification.success({
message: '提示',
description: t('取消成功!'),
});
clearSelectedRowKeys()
}
async function handleSubmit(val) {
if (val=='batch') {
if (!selectedRowsData.value.length) {
notification.warning({
message: '提示',
description: t('请选择需要确认的数据'),
});
return;
}
} else {
selectedRowsData.value= [{...val}]
}
await updateLngPngMeasureSalesPur(selectedRowsData.value)
handleSuccess();
notification.success({
message: '提示',
description: t('确认成功!'),
});
clearSelectedRowKeys()
}
async function handleSave(val) {
if (val=='batch') {
if (!selectedRowsData.value.length) {
notification.warning({
message: '提示',
description: t('请选择需要保存的数据'),
});
return;
}
} else {
selectedRowsData.value= [{...val}]
}
await addLngPngMeasureSalesPur(selectedRowsData.value)
handleSuccess();
notification.success({
message: '提示',
description: t('保存成功!'),
});
clearSelectedRowKeys()
}
function handleDelete(record: Recordable) {
deleteList([record.id]);
@ -239,27 +333,63 @@
}
});
function getActions(record: Recordable):ActionItem[] {
const actionsList: ActionItem[] = actionButtonConfig.value?.map((button) => {
if (!record.workflowData?.processId) {
return {
let saveBtn: ActionItem[] = [];
let submitBtn: ActionItem[] = [];
let cancelBtn: ActionItem[] = [];
let deleteBtn: ActionItem[] = [];
let datalogBtn: ActionItem[] = [];
let actionsList: ActionItem[] = []
actionButtonConfig.value?.map((button) => {
if (['save'].includes(button.code)) {
saveBtn.push({
icon: button?.icon,
tooltip: button?.name,
onClick: btnEvent[button.code].bind(null, record),
});
}
if (['submit'].includes(button.code)) {
submitBtn.push({
icon: button?.icon,
tooltip: button?.name,
onClick: btnEvent[button.code].bind(null, record),
});
}
if (['cancel'].includes(button.code)) {
cancelBtn.push({
icon: button?.icon,
tooltip: button?.name,
onClick: btnEvent[button.code].bind(null, record),
});
}
if (['delete'].includes(button.code)) {
deleteBtn.push({
icon: button?.icon,
tooltip: button?.name,
color: button.code === 'delete' ? 'error' : undefined,
onClick: btnEvent[button.code].bind(null, record),
};
} else {
if (button.code === 'view') {
return {
icon: button?.icon,
tooltip: button?.name,
onClick: btnEvent[button.code].bind(null, record),
};
} else {
return {};
}
});
}
if (['datalog'].includes(button.code)) {
datalogBtn.push({
icon: button?.icon,
tooltip: button?.name,
onClick: btnEvent[button.code].bind(null, record),
});
}
});
if (record.statusCode=='JLZ'&&!record.cfmCuUserId&&!record.dataSource) {
actionsList = actionsList.concat(saveBtn);
}
if (record.statusCode=='JLZ'&&!record.cfmCuUserId) {
actionsList = actionsList.concat(submitBtn);
}
if (record.statusCode=='JLZ'&&record.cfmCuUserId) {
actionsList = actionsList.concat(cancelBtn);
}
if (record.statusCode=='JLZ'&&!record.dataSource) {
actionsList = actionsList.concat(deleteBtn);
}
actionsList = actionsList.concat(datalogBtn);
return actionsList;
}
async function mergeCustomListRenderConfig(){
@ -277,6 +407,18 @@
}
};
</script>
<style lang="less">
.LngMeasureSalesStyle .cusSearchForm .advanceRow> div:nth-of-type(3){
display: none;
}
.LngMeasureSalesStyle .cusSearchForm .advanceRow> div:nth-of-type(2){
display: none;
}
.LngMeasureSalesStyle .w-full .advanceRow> div:nth-of-type(4){
display: none;
}
</style>
<style lang="less" scoped>
:deep(.ant-table-selection-col) {
width: 50px;
@ -287,4 +429,12 @@
.hide{
display: none !important;
}
:deep( .ant-col-8:nth-child(1)) {
width: 320px !important;
max-width: 320px !important;
}
:deep(.ant-col-8:nth-child(1) .ant-form-item-label) {
width: 80px !important;
}
</style>

View File

@ -0,0 +1,224 @@
<template>
<SimpleForm
ref="systemFormRef"
:formProps="data.formDataProps"
:formModel="{}"
:isWorkFlow="props.fromPage!=FromPageType.MENU"
/>
</template>
<script lang="ts" setup>
import { reactive, ref,onBeforeMount,onMounted } from 'vue';
import { formProps, formEventConfigs ,formConfig} from './config';
import SimpleForm from '/@/components/SimpleForm/src/SimpleForm.vue';
import { addLngLngSettleHdr, getLngLngSettleHdr, updateLngLngSettleHdr, deleteLngLngSettleHdr } from '/@/api/dayPlan/LngSettleHdr';
import { cloneDeep } from 'lodash-es';
import { FormDataProps } from '/@/components/Designer/src/types';
import { usePermission } from '/@/hooks/web/usePermission';
import { useFormConfig } from '/@/hooks/web/useFormConfig';
import { FromPageType } from '/@/enums/workflowEnum';
import { createFormEvent, getFormDataEvent, loadFormEvent, submitFormEvent,} from '/@/hooks/web/useFormEvent';
import { changeWorkFlowForm, changeSchemaDisabled } from '/@/hooks/web/useWorkFlowForm';
import { WorkFlowFormParams } from '/@/model/workflow/bpmnConfig';
import { useRouter } from 'vue-router';
const { filterFormSchemaAuth } = usePermission();
const { mergeFormSchemas,mergeFormEventConfigs } = useFormConfig();
const { currentRoute } = useRouter();
const RowKey = 'id';
const emits = defineEmits(['changeUploadComponentIds','loadingCompleted', 'form-mounted']);
const props = defineProps({
fromPage: {
type: Number,
default: FromPageType.MENU,
},
});
const systemFormRef = ref();
const data: { formDataProps: FormDataProps } = reactive({
formDataProps: {schemas:[]} as FormDataProps,
});
const state = reactive({
formModel: {},
});
let customFormEventConfigs=[];
onMounted(async () => {
try {
// 合并渲染覆盖配置中的字段配置、表单事件配置
await mergeCustomFormRenderConfig();
if (props.fromPage == FromPageType.MENU) {
setMenuPermission();
await createFormEvent(customFormEventConfigs, state.formModel,
systemFormRef.value,
formProps.schemas); //表单事件:初始化表单
await loadFormEvent(customFormEventConfigs, state.formModel,
systemFormRef.value,
formProps.schemas); //表单事件:加载表单
} else if (props.fromPage == FromPageType.FLOW) {
emits('loadingCompleted'); //告诉系统表单已经加载完毕
// loadingCompleted后 工作流页面直接利用Ref调用setWorkFlowForm方法
} else if (props.fromPage == FromPageType.PREVIEW) {
// 预览 无需权限,表单事件也无需执行
} else if (props.fromPage == FromPageType.DESKTOP) {
// 桌面设计 表单事件需要执行
emits('loadingCompleted'); //告诉系统表单已经加载完毕
await createFormEvent(customFormEventConfigs, state.formModel,
systemFormRef.value,
formProps.schemas); //表单事件:初始化表单
await loadFormEvent(customFormEventConfigs, state.formModel,
systemFormRef.value,
formProps.schemas); //表单事件:加载表单
}
emits('form-mounted', formProps);
} catch (error) {
}
});
async function mergeCustomFormRenderConfig() {
let cloneProps=cloneDeep(formProps);
let fEventConfigs=cloneDeep(formEventConfigs);
if (formConfig.useCustomConfig) {
if(props.fromPage !== FromPageType.FLOW){
let formPath=currentRoute.value.query.formPath;
//1.合并字段配置
cloneProps.schemas=await mergeFormSchemas({formSchema:cloneProps.schemas!,formPath:formPath});
//2.合并表单事件配置
fEventConfigs=await mergeFormEventConfigs({formEventConfigs:fEventConfigs,formPath:formPath});
}
}
data.formDataProps=cloneProps;
customFormEventConfigs=fEventConfigs;
}
// 根据菜单页面权限,设置表单属性(必填,禁用,显示)
function setMenuPermission() {
data.formDataProps.schemas = filterFormSchemaAuth(data.formDataProps.schemas!);
}
// 校验form 通过返回表单数据
async function validate() {
let values = [];
try {
values = await systemFormRef.value?.validate();
//添加隐藏组件
if (data.formDataProps.hiddenComponent?.length) {
data.formDataProps.hiddenComponent.forEach((component) => {
values[component.bindField] = component.value;
});
}
} finally {
}
return values;
}
// 根据行唯一ID查询行数据并设置表单数据 【编辑】
async function setFormDataFromId(rowId, skipUpdate) {
try {
const record = await getLngLngSettleHdr(rowId);
if (skipUpdate) {
return record;
}
setFieldsValue(record);
state.formModel = record;
await getFormDataEvent(customFormEventConfigs, state.formModel, systemFormRef.value, formProps.schemas); //表单事件:获取表单数据
return record;
} catch (error) {
}
}
// 辅助设置表单数据
function setFieldsValue(record) {
systemFormRef.value.setFieldsValue(record);
}
// 重置表单数据
async function resetFields() {
await systemFormRef.value.resetFields();
}
// 设置表单数据全部为Disabled 【查看】
async function setDisabledForm(isDisabled) {
data.formDataProps.schemas = changeSchemaDisabled(cloneDeep(data.formDataProps.schemas),isDisabled);
}
// 获取行键值
function getRowKey() {
return RowKey;
}
// 更新api表单数据
async function update({ values, rowId }) {
try {
values[RowKey] = rowId;
state.formModel = values;
let saveVal = await updateLngLngSettleHdr(values);
await submitFormEvent(customFormEventConfigs, state.formModel,
systemFormRef.value,
formProps.schemas); //表单事件:提交表单
return saveVal;
} catch (error) {}
}
// 新增api表单数据
async function add(values) {
try {
state.formModel = values;
let saveVal = await addLngLngSettleHdr(values);
await submitFormEvent(customFormEventConfigs, state.formModel,
systemFormRef.value,
formProps.schemas); //表单事件:提交表单
return saveVal;
} catch (error) {}
}
// 根据工作流页面权限,设置表单属性(必填,禁用,显示)
async function setWorkFlowForm(obj: WorkFlowFormParams) {
try {
const cloneProps=cloneDeep(formProps);
customFormEventConfigs=cloneDeep(formEventConfigs);
if (formConfig.useCustomConfig) {
const parts = obj.formConfigKey.split('_');
const formId=parts[1];
cloneProps.schemas=await mergeFormSchemas({formSchema:cloneProps.schemas!,formId:formId});
customFormEventConfigs=await mergeFormEventConfigs({formEventConfigs:customFormEventConfigs,formId:formId});
}
let flowData = changeWorkFlowForm(cloneProps, obj);
let { buildOptionJson, uploadComponentIds, formModels, isViewProcess } = flowData;
data.formDataProps = buildOptionJson;
emits('changeUploadComponentIds', uploadComponentIds); //工作流中必须保存上传组件id【附件汇总需要】
if (isViewProcess) {
setDisabledForm(); //查看
}
state.formModel = formModels;
if(formModels[RowKey]) {
setFormDataFromId(formModels[RowKey], false)
} else {
setFieldsValue(formModels)
}
} catch (error) {}
await createFormEvent(customFormEventConfigs, state.formModel,
systemFormRef.value,
formProps.schemas); //表单事件:初始化表单
await loadFormEvent(customFormEventConfigs, state.formModel,
systemFormRef.value,
formProps.schemas); //表单事件:加载表单
}
function getFormModel() {
return systemFormRef.value.formModel
}
async function handleDelete(id) {
return await deleteLngLngSettleHdr([id]);
}
defineExpose({
setFieldsValue,
resetFields,
validate,
add,
update,
setFormDataFromId,
setDisabledForm,
setMenuPermission,
setWorkFlowForm,
getRowKey,
getFormModel,
handleDelete
});
</script>

View File

@ -0,0 +1,110 @@
<template>
<BasicModal v-bind="$attrs" @register="registerModal" :title="getTitle" @ok="handleSubmit" @cancel="handleClose" :paddingRight="15" :bodyStyle="{ minHeight: '400px !important' }">
<ModalForm ref="formRef" :fromPage="FromPageType.MENU" />
</BasicModal>
</template>
<script lang="ts" setup>
import { ref, computed, reactive } from 'vue';
import { BasicModal, useModalInner } from '/@/components/Modal';
import { useMessage } from '/@/hooks/web/useMessage';
import { useI18n } from '/@/hooks/web/useI18n';
import { formProps } from './config';
import ModalForm from './Form.vue';
import { FromPageType } from '/@/enums/workflowEnum';
const emit = defineEmits(['success', 'register']);
const { notification } = useMessage();
const formRef = ref();
const state = reactive({
formModel: {},
isUpdate: true,
isView: false,
isCopy: false,
rowId: '',
});
const { t } = useI18n();
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
state.isUpdate = !!data?.isUpdate;
state.isView = !!data?.isView;
state.isCopy = !!data?.isCopy;
setModalProps({
destroyOnClose: true,
maskClosable: false,
showCancelBtn: !state.isView,
showOkBtn: !state.isView,
canFullscreen: true,
width: 900,
});
if (state.isUpdate || state.isView || state.isCopy) {
state.rowId = data.id;
if (state.isView) {
await formRef.value.setDisabledForm();
}
await formRef.value.setFormDataFromId(state.rowId);
} else {
formRef.value.resetFields();
}
});
const getTitle = computed(() => (state.isView ? '查看' : !state.isUpdate ? '新增' : '编辑'));
async function saveModal() {
let saveSuccess = false;
try {
const values = await formRef.value?.validate();
//添加隐藏组件
if (formProps.hiddenComponent?.length) {
formProps.hiddenComponent.forEach((component) => {
values[component.bindField] = component.value;
});
}
if (values !== false) {
try {
if (!state.isUpdate || state.isCopy) {
saveSuccess = await formRef.value.add(values);
} else {
saveSuccess = await formRef.value.update({ values, rowId: state.rowId });
}
return saveSuccess;
} catch (error) {}
}
} catch (error) {
return saveSuccess;
}
}
async function handleSubmit() {
try {
const saveSuccess = await saveModal();
setModalProps({ confirmLoading: true });
if (saveSuccess) {
if (!state.isUpdate || state.isCopy) {
//false 新增
notification.success({
message: 'Tip',
description: t('新增成功!'),
}); //提示消息
} else {
notification.success({
message: 'Tip',
description: t('修改成功!'),
}); //提示消息
}
closeModal();
formRef.value.resetFields();
emit('success');
}
} finally {
setModalProps({ confirmLoading: false });
}
}
function handleClose() {
formRef.value.resetFields();
}
</script>

View File

@ -0,0 +1,568 @@
import { FormProps, FormSchema } from '/@/components/Form';
import { BasicColumn } from '/@/components/Table';
export const formConfig = {
useCustomConfig: false,
};
export const searchFormSchema: FormSchema[] = [
{
field: 'datePlan',
label: '结算月',
component: 'RangePicker',
componentProps: {
format: 'YYYY-MM',
picker: 'month',
style: { width: '100%' },
getPopupContainer: () => document.body,
},
},
{
field: 'cuName',
label: '客户',
component: 'Input',
},
];
export const columns: BasicColumn[] = [
{
dataIndex: 'settleMonth',
title: '结算月',
componentType: 'input',
align: 'left',
sorter: true,
},
{
dataIndex: 'dateFrom',
title: '结算月开始日期',
componentType: 'input',
align: 'left',
sorter: true,
},
{
dataIndex: 'dateTo',
title: '结算月结束日期',
componentType: 'input',
align: 'left',
sorter: true,
},
{
dataIndex: 'cuSname',
title: '客户简称',
componentType: 'input',
align: 'left',
sorter: true,
},
{
dataIndex: 'qtySettleTon',
title: '结算总数量(吨)',
componentType: 'input',
align: 'left',
sorter: true,
},
{
dataIndex: 'amount',
title: '结算总金额(元)',
componentType: 'input',
align: 'left',
sorter: true,
},
{
dataIndex: 'comName',
title: '交易主体',
componentType: 'input',
align: 'left',
sorter: true,
},
{
dataIndex: 'settleDesc',
title: '结算说明',
componentType: 'input',
align: 'left',
sorter: true,
},
{
dataIndex: 'lngFileUploadList',
title: '附件',
componentType: 'input',
align: 'left',
sorter: true,
},
{
dataIndex: 'approName',
title: '审批状态',
componentType: 'input',
align: 'left',
sorter: true,
},
];
//表单事件
export const formEventConfigs = {
0: [
{
type: 'circle',
color: '#2774ff',
text: '开始节点',
icon: '#icon-kaishi',
bgcColor: '#D8E5FF',
isUserDefined: false,
},
{
color: '#F6AB01',
icon: '#icon-chushihua',
text: '初始化表单',
bgcColor: '#f9f5ea',
isUserDefined: false,
nodeInfo: { processEvent: [] },
},
],
1: [
{
color: '#B36EDB',
icon: '#icon-shujufenxi',
text: '获取表单数据',
detail: '(新增无此操作)',
bgcColor: '#F8F2FC',
isUserDefined: false,
nodeInfo: { processEvent: [] },
},
],
2: [
{
color: '#F8625C',
icon: '#icon-jiazai',
text: '加载表单',
bgcColor: '#FFF1F1',
isUserDefined: false,
nodeInfo: { processEvent: [] },
},
],
3: [
{
color: '#6C6AE0',
icon: '#icon-jsontijiao',
text: '提交表单',
bgcColor: '#F5F4FF',
isUserDefined: false,
nodeInfo: { processEvent: [] },
},
],
4: [
{
type: 'circle',
color: '#F8625C',
text: '结束节点',
icon: '#icon-jieshuzhiliao',
bgcColor: '#FFD6D6',
isLast: true,
isUserDefined: false,
},
],
};
export const formProps: FormProps = {
labelCol: { span: 3, offset: 0 },
labelAlign: 'right',
layout: 'horizontal',
size: 'default',
schemas: [
{
key: '8980f8e631064649a474fa6ccc34b54c',
field: 'id',
label: 'id',
type: 'input',
component: 'Input',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请输入id',
maxlength: null,
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: { width: '100%' },
},
},
{
key: 'b25793d1aa864d79bb371e945493059b',
field: 'settleMonth',
label: '结算月',
type: 'input',
component: 'Input',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请输入结算月',
maxlength: null,
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: { width: '100%' },
},
},
{
key: '9b047eb834d24e5991c9f632878b55b9',
field: 'dateFrom',
label: '结算月开始日期',
type: 'input',
component: 'Input',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请输入结算月开始日期',
maxlength: null,
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: { width: '100%' },
},
},
{
key: '2be493e953b548e8a045393f69fb4454',
field: 'dateTo',
label: '结算月结束日期',
type: 'input',
component: 'Input',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请输入结算月结束日期',
maxlength: null,
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: { width: '100%' },
},
},
{
key: '976485aaab7546138a97314f741a2b52',
field: 'cpCode',
label: '客户简称',
type: 'input',
component: 'Input',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请输入客户简称',
maxlength: null,
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: { width: '100%' },
},
},
{
key: '008b3fb361b349f48ee76765108a2025',
field: 'qtySettleTon',
label: '结算总数量(吨)',
type: 'input',
component: 'Input',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请输入结算总数量(吨)',
maxlength: null,
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: { width: '100%' },
},
},
{
key: '8cf29e5393e74344b680ed27470b9f3a',
field: 'amount',
label: '结算总金额(元)',
type: 'input',
component: 'Input',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请输入结算总金额(元)',
maxlength: null,
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: { width: '100%' },
},
},
{
key: 'ce9db8635ace44c7bdb497f777228d2b',
field: 'comId',
label: '交易主体',
type: 'input',
component: 'Input',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请输入交易主体',
maxlength: null,
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: { width: '100%' },
},
},
{
key: 'c56220cb3f98441c841300747a60b30a',
field: 'settleDesc',
label: '结算说明',
type: 'input',
component: 'Input',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请输入结算说明',
maxlength: null,
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: { width: '100%' },
},
},
{
key: 'b8420edd57ef488f8656eba40add2a36',
field: 'deptId',
label: '附件',
type: 'input',
component: 'Input',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请输入附件',
maxlength: null,
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: { width: '100%' },
},
},
{
key: 'e4570e884b5b45f6adc9cf9056ab04e8',
field: 'approCode',
label: '审批状态',
type: 'input',
component: 'Input',
colProps: { span: 24 },
defaultValue: '',
componentProps: {
width: '100%',
span: '',
defaultValue: '',
labelWidthMode: 'fix',
labelFixWidth: 120,
responsive: false,
respNewRow: false,
placeholder: '请输入审批状态',
maxlength: null,
prefix: '',
suffix: '',
addonBefore: '',
addonAfter: '',
disabled: false,
allowClear: false,
showLabel: true,
required: false,
rules: [],
events: {},
isSave: false,
isShow: true,
scan: false,
style: { width: '100%' },
},
},
],
showActionButtonGroup: false,
buttonLocation: 'center',
actionColOptions: { span: 24 },
showResetButton: false,
showSubmitButton: false,
hiddenComponent: [],
};

View File

@ -0,0 +1,399 @@
<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="settleMonth">
<a-date-picker :inputReadOnly="true" v-model:value="formState.settleMonth" style="width: 100%" picker="month" :disabled="isDisable" placeholder="请选择结算月" />
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="结算月开始日期" name="dateFrom">
<a-date-picker :inputReadOnly="true" 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 :inputReadOnly="true" 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="cpName">
<a-input-search v-model:value="formState.cpName" :disabled="isDisable || dataList.length" placeholder="请选择客户" readonly @search="onSearchCustomer"/>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="交易主体" name="comId">
<a-select v-model:value="formState.comId" :disabled="isDisable || dataList.length" @change="comIdChange" placeholder="请选择" style="width: 100%" allow-clear>
<a-select-option v-for="item in optionSelect.comIdList" :key="item.id" :value="item.id">
{{ item.shortName }}
</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="账期内含预收付款" name="rpSign">
<a-select v-model:value="formState.rpSign" style="width: 100%" allow-clear :disabled="isDisable">
<a-select-option v-for="item in optionSelect.signList" :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="qtySettleGj">
<a-input v-model:value="formState.qtySettleGj" disabled/>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="结算总数量(方)" name="qtySettleM3">
<a-input v-model:value="formState.qtySettleM3" disabled/>
</a-form-item>
</a-col>
<a-col :span="8">
<a-form-item label="结算总金额(元)" name="amount">
<a-input v-model:value="formState.amount" 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-col :span="24">
<a-form-item label="结算说明" name="settleDesc" :label-col="{ span: 3 }" :wrapper-col="{ span: 24 }">
<a-textarea v-model:value="formState.settleDesc" :disabled="isDisable" :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" :auto-size="{ minRows: 2, maxRows: 5 }"/>
</a-form-item>
</a-col>
</a-row>
</Card>
<Card>
<settleSalesPurList :list="dataList" :disabled="isDisable" pageType="customer" :formState="formState" @change="settleChange"></settleSalesPurList>
</Card>
<Card title="对账单" :bordered="false" >
<UploadList :disabled="isDisable" btnTip="上传对账单" :list="dataFileAccount" :value="formState.filePath" :tableName="tableName" :columnName="columnName" @change="uploadChange"/>
</Card>
<Card title="附件信息" :bordered="false" >
<UploadList :disabled="isDisable" :list="dataFile" :value="formState.filePath" :tableName="tableName" :columnName="columnName" @change="uploadListChange"/>
</Card>
</a-form>
</div>
<customerListModal @register="registerCustomer" @success="handleSuccessCustomer" selectType="radio" />
</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 { addLngPngSettleHdr,updateLngPngSettleHdr, getLngPngSettleHdr, getLngPngSettleHdrDate} from '/@/api/dayPlan/PngSettleHdr';
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 customerListModal from '/@/components/common/customerListModal.vue';
import settleSalesPurList from '/@/components/common/settleSalesPurList.vue';
import { getAllCom} from '/@/api/contract/ContractPurInt';
import { DataFormat, FormatOption, DATE_FORMAT, FormatType } from '/@/utils/dataFormat';
const tableName = 'PngSettleHdr';
const columnName = 'PngSettleHdr'
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 { notification } = useMessage();
const { t } = useI18n();
const formState = reactive({
approCode: 'WTJ',
settleMonth: dayjs(new Date()),
settleTypeCode: 'I',
rpSign: 'Y'
});
const [registerCustomer, { openModal:openModalCustomer}] = useModal();
const rules= reactive({
settleMonth: [{ required: true, message: "该项为必填项", trigger: 'change' }],
dateFrom: [{ required: true, message: "该项为必填项", trigger: 'change' }],
dateTo: [{ required: true, message: "该项为必填项", trigger: 'change' }],
cpName: [{ required: true, message: "该项为必填项", trigger: 'change' }],
rpSign: [{ required: true, message: "该项为必填项", trigger: 'change' }],
comId: [{ required: true, message: "该项为必填项", trigger: 'change' }],
});
const layout = {
labelCol: { span: 8 },
wrapperCol: { span: 16 },
}
const dataFile = ref([]);
const dataFileAccount = ref([])
const dataList = ref([])
let optionSelect= reactive({
approCodeList: [],
comIdList: [],
signList: []
});
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 uploadChange = (val) => {
dataFileAccount.value = val
}
const uploadListChange = (val) => {
dataFile.value = val
}
async function getInfo(id) {
spinning.value = true
try {
let data = await getLngPngSettleHdr(id)
spinning.value = false
Object.assign(formState, {...data})
Object.assign(dataFile.value, formState.lngFileUploadList || [])
Object.assign(dataFileAccount.value, formState.billList || [])
Object.assign(dataList.value, formState.lngPngSettleSalesList || [])
formState.settleMonth = formState.settleMonth ? dayjs(formState.settleMonth) : null
formState.dateFrom = formState.dateFrom ? dayjs(formState.dateFrom) : null
formState.dateTo = formState.dateTo ? dayjs(formState.dateTo) : null
numFormat()
} catch (error) {
console.log(error, 'error')
spinning.value = false
}
}
const numFormat = () => {
dataList.value = DataFormat.format(dataList.value, [
FormatOption.createQty('qtySettleGj'),
FormatOption.createQty('qtySettleM3'),
FormatOption.createQty('qtyMeaGj'),
FormatOption.createQty('qtyMeaM3'),
FormatOption.createAmt('amount'),
FormatOption.createQty('priceGj',4),
FormatOption.createQty('priceM3',4),
]);
let obj = {
qtySettleGj: formState.qtySettleGj,
qtySettleM3: formState.qtySettleM3,
amount: formState.amount
}
let a = DataFormat.format({...obj}, [
FormatOption.createQty('qtySettleGj'),
FormatOption.createQty('qtySettleM3'),
FormatOption.createAmt('amount'),
]);
formState.qtySettleGj = a.qtySettleGj
formState.qtySettleM3 = a.qtySettleM3
formState.amount = a.amount
}
const settleChange = (val) => {
dataList.value = val
numClear()
tableCount()
}
const numClear = () => {
if (!dataList.value.length) {
formState.qtySettleGj = ''
formState.qtySettleM3 = ''
formState.amount = ''
}
}
const tableCount = () => {
let qtySettleGj = 0
let qtySettleM3 = 0
let amount = 0
dataList.value.forEach(v => {
if (Number(v.settleTimes) == 1){
qtySettleGj+=Number(v.qtySettleGj) || 0
qtySettleM3+=Number(v.qtySettleM3) || 0
}
amount+=Number(v.amount) || 0
})
formState.qtySettleGj = qtySettleGj.toFixed(3)
formState.qtySettleM3 = qtySettleM3.toFixed(3)
formState.amount = amount.toFixed(2)
numFormat()
}
const comIdChange = (val) => {
if (!val)return
getDate()
}
const getDate=(async () => {
let obj = {
cpCode: formState.cpCode,
comId: formState.comId
}
if (!pageId.value && formState.cpCode && formState.comId && !formState.dateFrom) {
let data = await getLngPngSettleHdrDate(obj) || []
if (data.length) {
formState.dateFrom = data[0]?.dateTo ? dayjs(data[0]?.dateTo) : null
formState.dateTo = null
}
}
})
async function getOption() {
optionSelect.approCodeList = await getDictionary('LNG_APPRO')
optionSelect.comIdList = await getAllCom() || []
optionSelect.signList = await getDictionary('LNG_YN')
}
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 onSearchCustomer = () => {
openModalCustomer(true,{isUpdate: false})
}
const handleSuccessCustomer = (val) => {
formState.cpCode = val[0].cuCode
formState.cpName = val[0].cuSname
getDate()
}
function close() {
tabStore.closeTab(currentRoute.value, router);
}
async function getFormValue() {
return formState
}
async function handleSubmit(type) {
try {
await formRef.value.validateFields();
dataList.value.forEach(v => {
v.settleTypeCode = 'I'
})
let obj = {
...formState,
lngFileUploadList: dataFile.value,
billList: dataFileAccount.value,
lngPngSettleSalesList: dataList.value,
}
spinning.value = true;
let request = !formState.id ? addLngPngSettleHdr :updateLngPngSettleHdr
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) {
console.log(errorInfo, 'errorInfo')
spinning.value = false;
errorInfo?.errorFields?.length && notification.warning({
message: '提示',
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>

View File

@ -0,0 +1,167 @@
export const permissionList = [
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: 'id',
fieldId: 'id',
isSubTable: false,
showChildren: true,
type: 'input',
key: '8980f8e631064649a474fa6ccc34b54c',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '结算月',
fieldId: 'settleMonth',
isSubTable: false,
showChildren: true,
type: 'input',
key: 'b25793d1aa864d79bb371e945493059b',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '结算月开始日期',
fieldId: 'dateFrom',
isSubTable: false,
showChildren: true,
type: 'input',
key: '9b047eb834d24e5991c9f632878b55b9',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '结算月结束日期',
fieldId: 'dateTo',
isSubTable: false,
showChildren: true,
type: 'input',
key: '2be493e953b548e8a045393f69fb4454',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '客户简称',
fieldId: 'cpCode',
isSubTable: false,
showChildren: true,
type: 'input',
key: '976485aaab7546138a97314f741a2b52',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '结算总数量(吨)',
fieldId: 'qtySettleTon',
isSubTable: false,
showChildren: true,
type: 'input',
key: '008b3fb361b349f48ee76765108a2025',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '结算总金额(元)',
fieldId: 'amount',
isSubTable: false,
showChildren: true,
type: 'input',
key: '8cf29e5393e74344b680ed27470b9f3a',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '交易主体',
fieldId: 'comId',
isSubTable: false,
showChildren: true,
type: 'input',
key: 'ce9db8635ace44c7bdb497f777228d2b',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '结算说明',
fieldId: 'settleDesc',
isSubTable: false,
showChildren: true,
type: 'input',
key: 'c56220cb3f98441c841300747a60b30a',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '附件',
fieldId: 'deptId',
isSubTable: false,
showChildren: true,
type: 'input',
key: 'b8420edd57ef488f8656eba40add2a36',
children: [],
},
{
required: true,
view: true,
edit: true,
disabled: false,
isSaveTable: false,
tableName: '',
fieldName: '审批状态',
fieldId: 'approCode',
isSubTable: false,
showChildren: true,
type: 'input',
key: 'e4570e884b5b45f6adc9cf9056ab04e8',
children: [],
},
];

View File

@ -0,0 +1,408 @@
<template>
<PageWrapper dense fixedHeight contentFullHeight contentClass="flex">
<BasicTable @register="registerTable" ref="tableRef" @row-dbClick="dbClickRow">
<template #toolbar>
<template v-for="button in tableButtonConfig" :key="button.code">
<a-button v-if="button.isDefault" :type="button.type" @click="buttonClick(button.code)">
<template #icon><Icon :icon="button.icon" /></template>
{{ button.name }}
</a-button>
<a-button v-else :type="button.type">
<template #icon><Icon :icon="button.icon" /></template>
{{ button.name }}
</a-button>
</template>
</template>
<template #bodyCell="{ column, record }">
<template v-if="column.dataIndex === 'action'">
<TableAction :actions="getActions(record)" />
</template>
</template>
</BasicTable>
<LngSettleHdrModal @register="registerModal" @success="handleSuccess" />
<DataLog :logId="logId" :logPath="logPath" v-model:visible="modalVisible"/>
</PageWrapper>
</template>
<script lang="ts" setup>
const modalVisible = ref(false);
const logId = ref('')
const logPath = ref('/dayPlan/lngSettleHdr/datalog');
import { DataLog } from '/@/components/pcitc';
import { ref, computed, onMounted, onUnmounted, createVNode,
} from 'vue';
import { Modal } from 'ant-design-vue';
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
import { BasicTable, useTable, TableAction, ActionItem } from '/@/components/Table';
import { getLngLngSettleHdrPage, deleteLngLngSettleHdr} from '/@/api/dayPlan/LngSettleHdr';
import { PageWrapper } from '/@/components/Page';
import { useMessage } from '/@/hooks/web/useMessage';
import { useI18n } from '/@/hooks/web/useI18n';
import { usePermission } from '/@/hooks/web/usePermission';
import { useFormConfig } from '/@/hooks/web/useFormConfig';
import { useRouter } from 'vue-router';
import { setIndexFlowStatus } from '/@/utils/flow/index'
import { getLngLngSettleHdr } from '/@/api/dayPlan/LngSettleHdr';
import { useModal,BasicModal } from '/@/components/Modal';
import LookProcess from '/@/views/workflow/task/components/LookProcess.vue';
import LaunchProcess from '/@/views/workflow/task/components/LaunchProcess.vue';
import ApprovalProcess from '/@/views/workflow/task/components/ApprovalProcess.vue';
import { getDraftInfo } from '/@/api/workflow/process';
import { isValidJSON } from '/@/utils/event/design';
import LngSettleHdrModal from './components/LngSettleHdrModal.vue';
import {formConfig, searchFormSchema, columns } from './components/config';
import Icon from '/@/components/Icon/index';
import FlowRecord from '/@/views/workflow/task/components/flow/FlowRecord.vue';
import useEventBus from '/@/hooks/event/useEventBus';
import { cloneDeep } from 'lodash-es';
const { bus, CREATE_FLOW, FLOW_PROCESSED, FORM_LIST_MODIFIED } = useEventBus();
const { notification } = useMessage();
const { t } = useI18n();
defineEmits(['register']);
const { filterColumnAuth, filterButtonAuth } = usePermission();
const { mergeColumns,mergeSearchFormSchema,mergeButtons } = useFormConfig();
const filterColumns = cloneDeep(filterColumnAuth(columns));
const customConfigColums =ref(filterColumns);
const customSearchFormSchema =ref(searchFormSchema);
const tableRef = ref();
//所有按钮
const buttons = ref([{"isUse":true,"name":"新增","code":"add","icon":"ant-design:plus-outlined","isDefault":true,"type":"primary"},{"isUse":true,"name":"编辑","code":"edit","icon":"ant-design:form-outlined","isDefault":true},{"isUse":true,"name":"查看","code":"view","icon":"ant-design:eye-outlined","isDefault":true},{"isUse":true,"name":"发起审批","code":"startwork","icon":"ant-design:form-outlined","isDefault":true},{"isUse":true,"name":"查看流转记录","code":"flowRecord","icon":"ant-design:form-outlined","isDefault":true},{"isUse":true,"name":"审批","code":"approve","icon":"ant-design:check-outlined","isDefault":true},{"isUse":true,"name":"生成对账单","code":"check","icon":"ant-design:check-outlined","isDefault":false},{"isUse":true,"name":"数据日志","code":"datalog","icon":"ant-design:profile-outlined","isDefault":true},{"isUse":true,"name":"取消对账单","code":"cancel","icon":"ant-design:rollback-outlined","isDefault":false},{"isUse":true,"name":"删除","code":"delete","icon":"ant-design:delete-outlined","isDefault":true},{"isUse":true,"name":"刷新","code":"refresh","icon":"ant-design:reload-outlined","isDefault":true}]);
//展示在列表内的按钮
const actionButtons = ref<string[]>(['view', 'edit','datalog', 'copyData', 'delete', 'startwork','flowRecord','approve']);
const buttonConfigs = computed(()=>{
return filterButtonAuth(buttons.value);
})
const tableButtonConfig = computed(() => {
return buttonConfigs.value?.filter((x) => !actionButtons.value.includes(x.code));
});
const actionButtonConfig = computed(() => {
return buttonConfigs.value?.filter((x) => actionButtons.value.includes(x.code));
});
const btnEvent = {add : handleAdd,edit : handleEdit,refresh : handleRefresh,view : handleView,startwork : handleStartwork,flowRecord : handleFlowRecord,approve : handleApprove,delete : handleDelete,}
const { currentRoute } = useRouter();
const router = useRouter();
const formIdComputedRef = ref();
formIdComputedRef.value = currentRoute.value.meta.formId
const schemaIdComputedRef = ref();
schemaIdComputedRef.value = currentRoute.value.meta.schemaId
const visibleLookProcessRef = ref(false);
const processIdRef = ref('');
const visibleLaunchProcessRef = ref(false);
const schemaIdRef = ref('');
const formDataRef = ref();
const rowKeyData = ref();
const draftsId = ref();
const visibleApproveProcessRef = ref(false);
const taskIdRef = ref('');
const visibleFlowRecordModal = ref(false);
const [registerModal, { openModal }] = useModal();
const formName='LNG销售结算';
const [registerTable, { reload, }] = useTable({
title: '' || (formName + '列表'),
api: getLngLngSettleHdrPage,
rowKey: 'id',
columns: customConfigColums,
formConfig: {
rowProps: {
gutter: 16,
},
schemas: customSearchFormSchema,
fieldMapToTime: [['datePlan', ['startDate', 'endDate'], 'YYYY-MM']],
showResetButton: true,
},
beforeFetch: (params) => {
return { ...params, FormId: formIdComputedRef.value, PK: 'id',page:params.limit };
},
afterFetch: (res) => {
tableRef.value.setToolBarWidth();
},
useSearchForm: true,
showTableSetting: true,
striped: false,
actionColumn: {
width: 160,
title: '操作',
dataIndex: 'action',
slots: { customRender: 'action' },
},
tableSetting: {
size: false,
setting: false,
},
});
function dbClickRow(record) {
if (!actionButtonConfig?.value.some(element => element.code == 'view')) {
return;
}
const { processId, taskIds, schemaId } = record.workflowData || {};
if (taskIds && taskIds.length) {
router.push({
path: '/flow/' + schemaId + '/' + (processId || '') + '/approveFlow',
query: {
taskId: taskIds[0],
formName: formName,
formId:currentRoute.value.meta.formId
}
});
} else if (schemaId && !taskIds && processId) {
router.push({
path: '/flow/' + schemaId + '/' + processId + '/approveFlow',
query: {
readonly: 1,
taskId: '',
formName: formName,
formId:currentRoute.value.meta.formId
}
});
} else {
router.push({
path: '/form/LngSettleHdr/' + record.id + '/viewForm',
query: {
formPath: 'dayPlan/LngSettleHdr',
formName: formName,
formId:currentRoute.value.meta.formId
}
});
}
}
function buttonClick(code) {
btnEvent[code]();
}
function handleDatalog (record: Recordable) {
modalVisible.value = true
logId.value = record.id
}
function handleAdd() {
if (schemaIdComputedRef.value) {
router.push({
path: '/flow/' + schemaIdComputedRef.value + '/0/createFlow'
});
} else {
router.push({
path: '/form/LngSettleHdr/0/createForm',
query: {
formPath: 'dayPlan/LngSettleHdr',
formName: formName,
formId:currentRoute.value.meta.formId
}
});
}
}
function handleEdit(record: Recordable) {
router.push({
path: '/form/LngSettleHdr/' + record.id + '/updateForm',
query: {
formPath: 'dayPlan/LngSettleHdr',
formName: formName,
formId:currentRoute.value.meta.formId
}
});
}
function handleApprove () {
}
function handleDelete(record: Recordable) {
deleteList([record.id]);
}
function deleteList(ids) {
Modal.confirm({
title: '提示信息',
icon: createVNode(ExclamationCircleOutlined),
content: '是否确认删除?',
okText: '确认',
cancelText: '取消',
onOk() {
deleteLngLngSettleHdr(ids).then((_) => {
handleSuccess();
notification.success({
message: 'Tip',
description: t('删除成功!'),
});
});
},
onCancel() {},
});
}
function handleRefresh() {
reload();
}
function handleSuccess() {
reload();
}
function handleView(record: Recordable) {
dbClickRow(record);
}
onMounted(() => {
if (schemaIdComputedRef.value) {
bus.on(FLOW_PROCESSED, handleRefresh);
bus.on(CREATE_FLOW, handleRefresh);
} else {
bus.on(FORM_LIST_MODIFIED, handleRefresh);
}
// 合并渲染覆盖配置中的列表配置,包括展示字段配置、搜索字段配置、按钮配置
mergeCustomListRenderConfig();
});
onUnmounted(() => {
if (schemaIdComputedRef.value) {
bus.off(FLOW_PROCESSED, handleRefresh);
bus.off(CREATE_FLOW, handleRefresh);
} else {
bus.off(FORM_LIST_MODIFIED, handleRefresh);
}
});
function getActions(record: Recordable):ActionItem[] {
let actionsList: ActionItem[] = [];
let editAndDelBtn: ActionItem[] = [];
let hasFlowRecord = false;
actionButtonConfig.value?.map((button) => {
if (['view', 'copyData'].includes(button.code)) {
actionsList.push({
icon: button?.icon,
tooltip: button?.name,
onClick: btnEvent[button.code].bind(null, record),
});
}
if (['edit', 'delete'].includes(button.code)) {
editAndDelBtn.push({
icon: button?.icon,
tooltip: button?.name,
color: button.code === 'delete' ? 'error' : undefined,
onClick: btnEvent[button.code].bind(null, record),
});
}
if (button.code === 'flowRecord') hasFlowRecord = true;
});
if (record.workflowData?.enabled) {
//与工作流有关联的表单
if (record.workflowData.status) {
actionsList.unshift(setIndexFlowStatus(record.workflowData))
} else {
actionsList = actionsList.concat(editAndDelBtn);
}
} else {
if (!record.workflowData?.processId) {
//与工作流没有关联的表单并且在当前页面新增的数据 如选择编辑、删除按钮则加上
actionsList = actionsList.concat(editAndDelBtn);
}
}
return actionsList;
}
function handleStartwork(record: Recordable) {
const { processId, schemaId } = record.workflowData;
router.push({
path: '/flow/' + schemaId + '/' + (processId || '') + '/approveFlow',
query: {
readonly: 1,
taskId: '',
formName: formName
}
});
}
function handleFlowRecord(record: Recordable) {
if (record.workflowData) {
visibleFlowRecordModal.value = true;
processIdRef.value = record.workflowData?.processId;
}
}
async function handleLaunchProcess(record: Recordable) {
const schemaId=record.workflowData?.schemaId||schemaIdComputedRef.value;
if(schemaId){
if(record.workflowData?.draftId){
let res = await getDraftInfo(record.workflowData.draftId);
if (isValidJSON(res.formData)) {
localStorage.setItem('draftsJsonStr', res.formData);
router.push({
path: '/flow/' + schemaId + '/'+record.workflowData.draftId+'/createFlow'
});
return;
}
}
const result = await getLngLngSettleHdr(record['id']);
const form={};
const key="form_"+schemaId+"_"+record['id'];
form[key]=result;
localStorage.setItem('formJsonStr', JSON.stringify(form));
router.push({
path: '/flow/' + schemaId + '/0/createFlow',
query: {
fromKey: key
}
});
}
}
function handleApproveProcess(record: Recordable) {
const { processId, taskIds, schemaId } = record.workflowData;
router.push({
path: '/flow/' + schemaId + '/' + processId + '/approveFlow',
query: {
taskId: taskIds[0],
formName: formName
}
});
}
function handleCloseLaunch() {
visibleLaunchProcessRef.value = false;
reload();
}
function handleCloseApproval() {
visibleApproveProcessRef.value = false;
reload();
}
async function mergeCustomListRenderConfig(){
if (formConfig.useCustomConfig) {
let formId=currentRoute.value.meta.formId;
//1.合并展示字段配置
let cols= await mergeColumns(customConfigColums.value,formId);
customConfigColums.value=cols;
//2.合并搜索字段配置
let sFormSchema= await mergeSearchFormSchema(customSearchFormSchema.value,formId);
customSearchFormSchema.value=sFormSchema;
//3.合并按钮配置
let btns= await mergeButtons(buttons.value,formId);
buttons.value=btns;
}
};
</script>
<style lang="less" scoped>
:deep(.ant-table-selection-col) {
width: 50px;
}
.show{
display: flex;
}
.hide{
display: none !important;
}
</style>