lng客户需求

This commit is contained in:
‘huanghaiixia’
2026-03-18 18:25:41 +08:00
parent d2627b856f
commit ad4452a09c
7 changed files with 534 additions and 196 deletions

View File

@ -11,10 +11,117 @@ enum Api {
ContractList ='/magic-api/dayPlan/queryContractList',
StationList ='/magic-api/dayPlan/queryStationList',
Export = '/dayPlan/lngDemand/export',
check ='/magic-api/dayPlan/check',
AllPlaceLngUnload = '/magic-api/mdm/queryAllPlaceLngUnload',
queryCategory = '/magic-api/mdm/queryCategory',
saveAndSubmit = '/dayPlan/lngDemand/saveAndSubmit',
toChange = '/dayPlan/lngDemand/toChange',
compare = '/dayPlan/lngDemand/compare',
withdraw = '/dayPlan/lngDemand/withdraw',
submit = '/dayPlan/lngDemand/submit',
cancel = '/dayPlan/lngDemand/cancel',
DataLog = '/dayPlan/lngDemand/datalog',
}
export async function cancelLngDemand(id: String, mode: ErrorMessageMode = 'modal') {
return defHttp.get<LngLngDemandPageModel>(
{
url: Api.cancel,
params: { id },
},
{
errorMessageMode: mode,
},
);
}
export async function submitLngDemand(ids: string[], mode: ErrorMessageMode = 'modal') {
return defHttp.post<boolean>(
{
url: Api.submit,
data: ids,
},
{
errorMessageMode: mode,
},
);
}
export async function withdrawLngDemand(ids: string[], mode: ErrorMessageMode = 'modal') {
return defHttp.post<boolean>(
{
url: Api.withdraw,
data: ids,
},
{
errorMessageMode: mode,
},
);
}
export async function getLngDemandCompare(orgId: String, mode: ErrorMessageMode = 'modal') {
return defHttp.get<LngLngDemandPageModel>(
{
url: Api.compare,
params: { orgId },
},
{
errorMessageMode: mode,
},
);
}
export async function getLngDemanddUpdate(id: String, mode: ErrorMessageMode = 'modal') {
return defHttp.get<LngLngDemandPageModel>(
{
url: Api.toChange,
params: { id },
},
{
errorMessageMode: mode,
},
);
}
export async function submitSaveLngDemand(lngLngDemand: Recordable, mode: ErrorMessageMode = 'modal') {
return defHttp.post<boolean>(
{
url: Api.saveAndSubmit,
params: lngLngDemand,
},
{
errorMessageMode: mode,
},
);
}
export async function getCategory(params, mode: ErrorMessageMode = 'modal') {
return defHttp.get<LngLngDemandPageResult>(
{
url: Api.queryCategory,
params: params,
},
{
errorMessageMode: mode,
},
);
}
export async function getAllPlaceLngUnload(params, mode: ErrorMessageMode = 'modal') {
return defHttp.get<LngLngDemandPageResult>(
{
url: Api.AllPlaceLngUnload,
params: params,
},
{
errorMessageMode: mode,
},
);
}
export async function carCheck(params, mode: ErrorMessageMode = 'modal') {
return defHttp.get<LngLngDemandPageResult>(
{
url: Api.check,
params: params,
},
{
errorMessageMode: mode,
},
);
}
export async function getLngLngDemandStationList(params, mode: ErrorMessageMode = 'modal') {
return defHttp.get<LngLngDemandPageResult>(
{

View File

@ -0,0 +1,100 @@
<template>
<BasicModal v-bind="$attrs" @register="registerModal" width="60%" :title="getTitle" @ok="handleSubmit" @cancel="handleCancel"
@visible-change="handleVisibleChange" >
<BasicTable @register="registerTable" class="placeLngUnloadModal"></BasicTable>
</BasicModal>
</template>
<script lang="ts" setup>
import { ref, computed, unref, nextTick } from 'vue';
import { BasicModal, useModalInner, useModal } from '/@/components/Modal';
import { BasicForm, useForm } from '/@/components/Form/index';
import { BasicTable, useTable, FormSchema, BasicColumn, TableAction } from '/@/components/Table';
import { addCodeRule, getCodeRuleInfo, editCodeRule } from '/@/api/system/code';
import { useMessage } from '/@/hooks/web/useMessage';
import { Form, message } from 'ant-design-vue';
import { useI18n } from '/@/hooks/web/useI18n';
import { getAllPlaceLngUnload} from '/@/api/dayPlan/LngDemand';
const { t } = useI18n();
const codeFormSchema: FormSchema[] = [
{ field: 'fullName', label: '名称', component: 'Input'},
];
const columns: BasicColumn[] = [
{ dataIndex: 'code', title: '编码', componentType: 'input', width: 120,align: 'left', },
{ dataIndex: 'fullName', title: '名称', componentType: 'input', align: 'left', },
];
const emit = defineEmits(['success', 'register', 'cancel']);
const showTable = ref(false)
const { notification } = useMessage();
const isUpdate = ref(true);
const rowId = ref('');
const selectedKeys = ref<string[]>([]);
const selectedValues = ref([]);
const props = defineProps({
selectType: { type: String, default: 'radio' },
});
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
setModalProps({ confirmLoading: false });
isUpdate.value = !!data?.isUpdate;
});
const [registerTable, { getDataSource, setTableData, updateTableDataRecord, reload,setPagination }] = useTable({
title: t('列表'),
api: getAllPlaceLngUnload,
columns,
bordered: true,
pagination: false,
canResize: false,
formConfig: {
labelCol:{span: 9},
schemas: codeFormSchema,
showResetButton: true,
},
immediate: false, // 设置为不立即调用
beforeFetch: (params) => {
return { ...params, eid: ''};
},
rowSelection: {
type: props.selectType,
onChange: onSelectChange
},
});
const handleVisibleChange = async (visible: boolean) => {
if (visible) {
nextTick(() => {
reload();
});
}
};
function onSelectChange(rowKeys: string[], e) {
selectedKeys.value = rowKeys;
selectedValues.value = e
}
const getTitle = computed(() => (!unref(isUpdate) ? t('卸货地列表') : t('')));
function handleCancel () {
emit('cancel',);
}
async function handleSubmit() {
if (!selectedValues.value.length) {
notification.warning({
message: t('提示'),
description: t('请选择数据')
});
return
}
closeModal();
emit('success', selectedValues.value);
}
</script>
<style >
.placeLngUnloadModal .basicCol{
position: inherit !important;
top: 0;
}
</style>

View File

@ -23,12 +23,12 @@
</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-input v-model:value="formState.noTractor" :disabled="disable" placeholder="请输入车头号" @change="handleCheck('noTractor')"/>
</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-input v-model:value="formState.noTrailer" :disabled="disable" placeholder="请输入挂车号" @change="handleCheck('noTrailer')" />
</a-form-item>
</a-col>
<a-col :span="8">
@ -38,37 +38,37 @@
</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-input v-model:value="formState.idNoDriver" :disabled="disable" placeholder="请输入驾驶员身份证号" @change="handleCheck('idNoDriver')"/>
</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-input v-model:value="formState.nameDriver" :disabled="disable||formState.onlineSign == 'Y'" 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-input v-model:value="formState.phoneDriver" :disabled="disable||formState.onlineSign == 'Y'" 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-input v-model:value="formState.idNoEscort" :disabled="disable" placeholder="请输入押运员身份证号" @change="handleCheck('idNoEscort')"/>
</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-input v-model:value="formState.nameEscort" :disabled="disable||formState.onlineSign == 'Y'" 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-input v-model:value="formState.phoneEscort" :disabled="disable||formState.onlineSign == 'Y'" 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-input-search v-model:value="formState.unloadingName" :disabled="disable" placeholder="请选择卸货站点" readonly @search="onSearchPlace"/>
</a-form-item>
</a-col>
<a-col :span="8">
@ -112,7 +112,13 @@
<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-form-item label="审批状态" name="approName" :class="diffResultList.includes('approName')?'changeStyle':''">
<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="note" :label-col="{ span: 3 }" :wrapper-col="{ span: 24 }">
@ -129,7 +135,8 @@
</a-row>
</a-form>
<contractDemandListModal @register="registerContract" @success="handleSuccessContract" />
<pointDelyDemandListModal @register="registerUpLoad" @success="handleSuccessUpLoad" />
<pointDelyDemandListModal @register="registerStation" @success="handleSuccessStation" />
<placeLngUnloadModal @register="registerPlace" @success="handleSuccessPlace"/>
</template>
<script lang="ts" setup>
@ -138,14 +145,14 @@
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 placeLngUnloadModal from '/@/components/common/placeLngUnloadModal.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 { getLngLngDemandContractList, getLngLngDemandStationList } from '/@/api/dayPlan/LngDemand';
import { getLngLngDemandContractList, getLngLngDemandStationList,carCheck,getCategory } from '/@/api/dayPlan/LngDemand';
const userStore = useUserStore();
const userInfo = userStore.getUserInfo;
const router = useRouter();
@ -154,9 +161,20 @@
const pageType = ref(currentRoute.value.query?.type)
const formRef = ref()
const rules= reactive({
pointDelyName: [{ required: true, message: "该项为必填项", trigger: 'change' }],
staName: [{ required: true, message: "该项为必填项", trigger: 'change' }],
datePlan: [{ required: true, message: "该项为必填项", trigger: 'change' }],
kName: [{ required: true, message: "该项为必填项", trigger: 'change' }],
noTractor: [{ required: true, message: "该项为必填项", trigger: 'change' }],
noTrailer: [{ required: true, message: "该项为必填项", trigger: 'change' }],
carrName: [{ required: true, message: "该项为必填项", trigger: 'change' }],
idNoDriver: [{ required: true, message: "该项为必填项", trigger: 'change' }],
nameDriver: [{ required: true, message: "该项为必填项", trigger: 'change' }],
phoneDriver: [{ required: true, message: "该项为必填项", trigger: 'change' }],
idNoEscort: [{ required: true, message: "该项为必填项", trigger: 'change' }],
nameEscort: [{ required: true, message: "该项为必填项", trigger: 'change' }],
phoneEscort: [{ required: true, message: "该项为必填项", trigger: 'change' }],
unloadingName: [{ required: true, message: "该项为必填项", trigger: 'change' }],
timePeriod: [{ required: true, message: "该项为必填项", trigger: 'change' }],
});
const layout = {
labelCol: { span: 9 },
@ -164,7 +182,8 @@
}
const { t } = useI18n();
const [registerContract, { openModal:openModalContractSales}] = useModal();
const [registerUpLoad, { openModal:openModalUpLoad}] = useModal();
const [registerStation, { openModal:openModalUpLoad}] = useModal();
const [registerPlace, { openModal:openModalPlace}] = useModal();
const props = defineProps({
formObj: {},
disable: false,
@ -177,19 +196,20 @@
const diffResultList = ref([])
const formState = ref({})
const contractList = ref([])
const pointDelyList = ref([])
const stationList = ref([])
onMounted(async () =>{
getOption()
if (!pageType.value) {
formState.value.lastVerSign = 'Y'
formState.value.validSign = 'N'
formState.value.carrCode = '123'
// 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
let a = await getCategory({code: 'LNG'})||[]
formState.value.qtyTon = a[0]?.coefficient
}
@ -197,8 +217,14 @@
async function getOption() {
optionSelect.timePeriodList = await getDictionary('LNG_TIME_P')
optionSelect.supplyCodeList = await getDictionary('LNG_SUPPLY')
optionSelect.approCodeList = await getDictionary('LNG_APPRO')
}
const datePlanChange = async (val) => {
if (!val) {
contractList.value = []
return
}
let obj = {
cuCode:formState.value.cuCode,
datePlan: dayjs(formState.value.datePlan).format('YYYY-MM-DD')
@ -208,8 +234,9 @@
if (contractList.value.length == 1) {
formState.value.kName = contractList.value[0].kName
formState.value.ksId = contractList.value[0].id
getPointDely()
getContractQty()
formState.value.comId = contractList.value[0].comId
formState.value.comName = contractList.value[0].comName
getStation()
}
}
const onSearch = ()=> {
@ -222,8 +249,9 @@
const handleSuccessContract = (val) => {
formState.value.kName = val[0].kName
formState.value.ksId = val[0].id
getPointDely()
getContractQty()
formState.value.comId = contractList.value[0].comId
formState.value.comName = contractList.value[0].comName
getStation()
}
const onSearchUpLoad = (val)=> {
@ -231,33 +259,54 @@
message.warn('请选择合同')
return
}
openModalUpLoad(true,{isUpdate: false, list: pointDelyList.value})
openModalUpLoad(true,{isUpdate: false, list: stationList.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 getLngLngDemandStationList({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 handleSuccessStation = (val) => {
formState.value.staName = val[0].pointDelyName
formState.value.staCode = val[0].pointDelyCode
formState.value.onlineSign = val[0].onlineSign
changeRules()
}
const changeRules = () => {
if (formState.value.onlineSign == 'Y') {
rules.nameDriver = [{ required: false, message: "该项为必填项", trigger: 'change' }]
rules.phoneDriver = [{ required: false, message: "该项为必填项", trigger: 'change' }]
rules.nameEscort = [{ required: false, message: "该项为必填项", trigger: 'change' }]
rules.phoneEscort = [{ required: false, message: "该项为必填项", trigger: 'change' }]
} else {
rules.nameDriver = [{ required: true, message: "该项为必填项", trigger: 'change' }]
rules.phoneDriver = [{ required: true, message: "该项为必填项", trigger: 'change' }]
rules.nameEscort = [{ required: true, message: "该项为必填项", trigger: 'change' }]
rules.phoneEscort = [{ required: true, message: "该项为必填项", trigger: 'change' }]
}
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 onSearchPlace = ()=> {
openModalPlace(true,{isUpdate: false})
}
const handleSuccessPlace= (val) => {
formState.value.unloadingName = val[0].fullName
formState.value.unloadingCode = val[0].code
}
const getStation = async () => {
let res = await getLngLngDemandStationList({ksId: formState.value.ksId})
stationList.value = res || []
stationList.value.forEach(v => {
v.pointDelyName = v.fullName
v.pointDelyCode = v.code
})
if (stationList.value.length == 1) {
formState.value.staName = stationList.value[0].fullName
formState.value.staCode = stationList.value[0].code
formState.value.onlineSign = stationList.value[0].onlineSign
changeRules()
}
}
const handleCheck = async (type) => {
if (formState.value.onlineSign == 'Y' && ((type == 'noTractor'&& !formState.value.noTrailer) || (type == 'noTrailer'&& !formState.value.noTractor)) ) {
// formState.value.carrCode = ''
// formState.value.carrName = ''
}
}
const disabledDateStart = (current) => {
@ -307,22 +356,6 @@
<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;
}

View File

@ -163,7 +163,7 @@ export const columns: BasicColumn[] = [
},
{
dataIndex: 'ksName',
dataIndex: 'kName',
title: '合同',
componentType: 'input',
align: 'left',

View File

@ -39,13 +39,13 @@
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 { Modal } from 'ant-design-vue';
import { addLngLngDemand, submitSaveLngDemand,getLngLngDemand,getLngDemanddUpdate,getLngDemandCompare,updateLngLngDemand,carCheck } from '/@/api/dayPlan/LngDemand';
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;
@ -86,7 +86,7 @@
async function getCompareInfo(id) {
spinning.value = true
try {
let data = await getLngPngDemandCompare(id) || {}
let data = await getLngDemandCompare(id) || {}
spinning.value = false
diffResultList.value = data.diffResultList || []
let obj = changeData(data.oldBean || {})
@ -108,9 +108,9 @@
try {
let data = {}
if (pageType.value == 'update') {
data = await getLngPngDemandUpdate(id)
data = await getLngDemanddUpdate(id)
} else {
data = await getLngPngDemand(id)
data = await getLngLngDemand(id)
}
spinning.value = false
let obj = changeData(data)
@ -126,6 +126,7 @@
params: {}
}
obj.datePlan = obj.datePlan ? dayjs(obj.datePlan): null
obj.timeUnloading = obj.timeUnloading ? dayjs(obj.timeUnloading) : null
return {
params: obj
}
@ -140,31 +141,64 @@
...data.formInfo,
datePlan: dayjs(data.formInfo.datePlan).format('YYYY-MM-DD HH:mm:ss'),
}
if (type == 'submit') {
let params = {
orgId: obj.orgId,
datePlan: dayjs(obj.datePlan).format('YYYY-MM-DD'),
noTractor: obj.noTractor,
noTrailer: obj.noTrailer,
idNoDriver: obj.idNoDriver,
idNoEscort: obj.idNoEscort,
}
let res = await carCheck(params)
if (res) {
Modal.confirm({
title: '提示信息',
content: res,
okText: '确认',
cancelText: '取消',
onOk() {
saveSubmit(type, obj)
},
onCancel() {}
});
} else {
saveSubmit(type, obj)
}
} else {
saveSubmit(type, obj)
}
} catch (errorInfo) {
spinning.value = false;
errorInfo?.errorFields?.length && notification.warning({
message: '提示',
description: '请完善信息'
});
}
}
const saveSubmit = async (type, obj) => {
try {
spinning.value = true;
let request = submitLngPngDemand
let request = submitSaveLngDemand
if (type == 'save') {
request = !pageId.value ? addLngPngDemand : updateLngPngDemand
request = !pageId.value ? addLngLngDemand : updateLngLngDemand
}
await request(obj)
spinning.value = false;
notification.success({
message: 'Tip',
message: '提示',
description: type == 'save' ? '保存成功':'已提交'
}); //提示消息
setTimeout(() => {
bus.emit(FORM_LIST_MODIFIED, {});
close();
}, 500);
}catch (errorInfo) {
spinning.value = false;
errorInfo?.errorFields?.length && notification.warning({
message: 'Tip',
description: '请完善信息'
});
}
}
@ -183,21 +217,5 @@
.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

@ -31,14 +31,12 @@
const logId = ref('')
const logPath = ref('/dayPlan/lngDemand/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';
import { BasicTable, useTable, TableAction, ActionItem } from '/@/components/Table';
import { getLngLngDemandPage, deleteLngLngDemand, exportLngLngDemand} from '/@/api/dayPlan/LngDemand';
import { getLngLngDemandPage, deleteLngLngDemand, exportLngLngDemand,cancelLngDemand,withdrawLngDemand,submitLngDemand} from '/@/api/dayPlan/LngDemand';
import { PageWrapper } from '/@/components/Page';
import { useMessage } from '/@/hooks/web/useMessage';
import { useI18n } from '/@/hooks/web/useI18n';
@ -88,13 +86,13 @@
{"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":"toChange","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":"withdraw","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','compare','update','back','cancel']);
const actionButtons = ref<string[]>(['view', 'edit','datalog', 'copyData', 'delete', 'startwork','flowRecord','compare','toChange','withdraw','cancel', 'submit']);
const buttonConfigs = computed(()=>{
return filterButtonAuth(buttons.value);
})
@ -103,7 +101,7 @@
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":"withdraw","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},]
@ -115,7 +113,7 @@
return buttonConfigs.value?.filter((x) => actionButtons.value.includes(x.code));
});
const btnEvent = {add : handleAdd,edit : handleEdit,refresh : handleRefresh,view : handleView,datalog : handleDatalog,import : handleImport,export : handleExport,startwork : handleStartwork,flowRecord : handleFlowRecord,submit : handleSubmit,update : handleUpdate,delete : handleDelete,}
const btnEvent = {add : handleAdd,edit : handleEdit,refresh : handleRefresh,view : handleView,datalog : handleDatalog,import : handleImport,compare:handleCompare,export : handleExport,startwork : handleStartwork,flowRecord : handleFlowRecord,submit : handleSubmit,toChange : handleUpdate,delete : handleDelete,cancel:handleCancel,withdraw:handleBack}
const { currentRoute } = useRouter();
const router = useRouter();
@ -140,7 +138,7 @@
const [registerImportModal, { openModal: openImportModal }] = useModal();
const formName=currentRoute.value.meta?.title;
const [registerTable, { reload, }] = useTable({
const [registerTable, { reload, clearSelectedRowKeys }] = useTable({
title: '' || (formName + '列表'),
api: getLngLngDemandPage,
rowKey: 'id',
@ -165,7 +163,7 @@
striped: false,
actionColumn: {
width: 160,
width: 190,
title: '操作',
dataIndex: 'action',
slots: { customRender: 'action' },
@ -184,44 +182,21 @@
selectedKeys.value = rowKeys;
}
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/LngDemand/' + record.id + '/viewForm',
path: '/dayPlan/LngDemand/createForm',
query: {
formPath: 'dayPlan/LngDemand',
formName: formName,
formId:currentRoute.value.meta.formId
formName: '查看'+formName,
formId:currentRoute.value.meta.formId,
id: record.id,
type: 'view'
}
});
}
}
function buttonClick(code) {
btnEvent[code]();
btnEvent[code]('batch');
}
function handleDatalog (record: Recordable) {
modalVisible.value = true
@ -248,27 +223,79 @@
function handleEdit(record: Recordable) {
router.push({
path: '/form/LngDemand/' + record.id + '/updateForm',
path: '/dayPlan/LngDemand/createForm',
query: {
formPath: 'dayPlan/LngDemand',
formName: formName,
formId:currentRoute.value.meta.formId
formName: '编辑'+formName,
formId:currentRoute.value.meta.formId,
id: record.id,
type: 'edit'
}
});
}
function handleCompare(record: Recordable) {
router.push({
path: '/dayPlan/LngDemand/createForm',
query: {
formPath: 'dayPlan/LngDemand',
formName: "对比"+formName,
formId:currentRoute.value.meta.formId,
id: record.orgId,
type: 'compare'
}
});
}
async function handleCancel(record: Recordable) {
await cancelLngPng(record.id)
await cancelLngDemand(record.id)
handleSuccess();
notification.success({
message: '提示',
description: t('已取消!'),
});
}
function handleSubmit () {
async function handleBack(record: Recordable) {
if (record == 'batch'&&!selectedKeys.value.length) {
notification.warning({
message: '提示',
description: t('请选择需要撤回的数据'),
});
return;
}
function handleUpdate () {
let arr = record == 'batch' ? selectedKeys.value : [record.id]
await withdrawLngDemand(arr)
handleSuccess();
notification.success({
message: '提示',
description: t('已撤回!'),
});
}
async function handleSubmit (record: Recordable) {
if (record == 'batch'&&!selectedKeys.value.length) {
notification.warning({
message: '提示',
description: t('请选择需要提交的数据'),
});
return;
}
let arr = record == 'batch' ? selectedKeys.value : [record.id]
await submitLngDemand(arr)
handleSuccess();
notification.success({
message: '提示',
description: t('已提交!'),
});
}
function handleUpdate (record: Recordable) {
router.push({
path: '/dayPlan/LngDemand/createForm',
query: {
formPath: 'dayPlan/LngDemand',
formName: formName,
formId:currentRoute.value.meta.formId,
id: record.id,
type: 'update'
}
});
}
function handleDelete(record: Recordable) {
deleteList([record.id]);
@ -296,7 +323,7 @@
reload();
}
function handleSuccess() {
clearSelectedRowKeys()
reload();
}
@ -347,39 +374,80 @@
function getActions(record: Recordable):ActionItem[] {
let actionsList: ActionItem[] = [];
let editAndDelBtn: ActionItem[] = [];
let editBtn: ActionItem[] = [];
let delBtn: ActionItem[] = [];
let updateBtn: ActionItem[] = [];
let backBtn: ActionItem[] = [];
let hasFlowRecord = false;
let viewBtn: ActionItem[]=[]
actionButtonConfig.value?.map((button) => {
if (['view', 'copyData'].includes(button.code)) {
actionsList.push({
if (['view', 'copyData','compare', 'datalog'].includes(button.code)) {
viewBtn.push({
icon: button?.icon,
tooltip: button?.name,
onClick: btnEvent[button.code].bind(null, record),
});
}
if (['edit', 'delete'].includes(button.code)) {
editAndDelBtn.push({
if (['edit'].includes(button.code)) {
editBtn.push({
icon: button?.icon,
tooltip: button?.name,
color: button.code === 'delete' ? 'error' : undefined,
onClick: btnEvent[button.code].bind(null, record),
});
}
if (['delete','submit'].includes(button.code)) {
delBtn.push({
icon: button?.icon,
tooltip: button?.name,
color: button.code === 'delete' ? 'error' : undefined,
onClick: btnEvent[button.code].bind(null, record),
});
}
if (['toChange', 'cancel'].includes(button.code)) {
updateBtn.push({
icon: button?.icon,
tooltip: button?.name,
onClick: btnEvent[button.code].bind(null, record),
});
}
if (['withdraw'].includes(button.code)) {
backBtn.push({
icon: button?.icon,
tooltip: button?.name,
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);
if (record.approCode == 'YSP' && record.alterSign!='D') {
actionsList = actionsList.concat(updateBtn);
}
} else {
if (!record.workflowData?.processId) {
//与工作流没有关联的表单并且在当前页面新增的数据 如选择编辑、删除按钮则加上
actionsList = actionsList.concat(editAndDelBtn);
// || record.approCode == 'YBH'
if ((record.approCode == 'WTJ'|| record.approCode == 'YBH') && record.alterSign!='D' ) {
actionsList = actionsList.concat(editBtn);
}
if (record.approCode == 'WTJ'|| record.approCode == 'YBH') {
actionsList = actionsList.concat(delBtn);
}
if (record.approCode == 'SPZ') {
actionsList = actionsList.concat(backBtn);
}
actionsList = actionsList.concat(viewBtn)
// 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) {

View File

@ -259,13 +259,7 @@
} else {
selectedRowsData.value= [{...val}]
}
await cancelLngLngMeasure(selectedRowsData.value)
handleSuccess();
notification.success({
message: '提示',
description: t('取消成功!'),
});
clearSelectedRowKeys()
fieldCheck('cancel')
}
async function handleSubmit(val) {
if (val=='batch') {
@ -279,14 +273,7 @@
} else {
selectedRowsData.value= [{...val}]
}
await updateLngLngMeasure(selectedRowsData.value)
handleSuccess();
notification.success({
message: '提示',
description: t('确认成功!'),
});
clearSelectedRowKeys()
fieldCheck('submit')
}
async function handleSave(val) {
if (val=='batch') {
@ -300,18 +287,43 @@
} else {
selectedRowsData.value= [{...val}]
}
selectedRowsData.value.forEach(v=> {
v.timeOut = v.timeOut ? dayjs(v.timeOut).format('YYYY-MM-DD HH:mm:ss') : null
v.timeIn = v.timeIn ? dayjs(v.timeIn).format('YYYY-MM-DD HH:mm:ss') : null
})
await addLngLngMeasure(selectedRowsData.value)
handleSuccess();
notification.success({
fieldCheck('save')
}
const fieldCheck = async (type) => {
for(let i = 0; i<selectedRowsData.value.length;i++) {
if (!selectedRowsData.value[i].timeOut || !selectedRowsData.value[i].timeIn) {
notification.warning({
message: '提示',
description: t('保存成功!'),
description: t('时间不能为空'),
});
return
}
if (selectedRowsData.value[i].statusCode=='JLZ' && (!selectedRowsData.value[i].qtyMeaTonSales || !selectedRowsData.value[i].qtyMeaGjSales || !selectedRowsData.value[i].qtyMeaM3Sales)) {
notification.warning({
message: '提示',
description: t('装车量不能为空'),
})
return
}
selectedRowsData.value[i].timeOut = selectedRowsData.value[i].timeOut ? dayjs(selectedRowsData.value[i].timeOut).format('YYYY-MM-DD HH:mm:ss') : null
selectedRowsData.value[i].timeIn = selectedRowsData.value[i].timeIn ? dayjs(selectedRowsData.value[i].timeIn).format('YYYY-MM-DD HH:mm:ss') : null
}
let request = type == 'save' ? addLngLngMeasure : updateLngLngMeasure
if (type =='cancel') {
request = cancelLngLngMeasure
}
await request(selectedRowsData.value)
let tip = type == 'save' ? '保存成功' : '确认成功'
if (type =='cancel') {
tip = '取消成功'
}
handleSuccess();
notification.warn({
message: '提示',
description: tip,
});
clearSelectedRowKeys()
}
function handleDelete(record: Recordable) {
deleteList([record.id]);