lng计划业务逻辑处理
This commit is contained in:
332
src/views/dayPlan/LngDemand/components/basicForm.vue
Normal file
332
src/views/dayPlan/LngDemand/components/basicForm.vue
Normal 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>
|
||||
@ -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',
|
||||
|
||||
203
src/views/dayPlan/LngDemand/components/createForm.vue
Normal file
203
src/views/dayPlan/LngDemand/components/createForm.vue
Normal 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>
|
||||
@ -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>
|
||||
Reference in New Issue
Block a user