From 5abcde36961125cbf436f91b8c17610a6b5f8308 Mon Sep 17 00:00:00 2001
From: sen <sen@qq.com>
Date: 星期三, 15 四月 2026 12:15:08 +0800
Subject: [PATCH] 修改调度单必填校验
---
ui/admin-ui3/src/views/tms/generationCost/index.vue | 203 ++++++++++++++++++++++++++++++++++++--------------
1 files changed, 144 insertions(+), 59 deletions(-)
diff --git a/ui/admin-ui3/src/views/tms/generationCost/index.vue b/ui/admin-ui3/src/views/tms/generationCost/index.vue
index cff296f..6995609 100644
--- a/ui/admin-ui3/src/views/tms/generationCost/index.vue
+++ b/ui/admin-ui3/src/views/tms/generationCost/index.vue
@@ -72,8 +72,9 @@
</el-select>
</el-descriptions-item>
<el-descriptions-item label="鏄惁瀛樺湪搴斾粯鎶ヤ环">
- <span :style="{ color: row.isCZYF == 0 ? 'red' : '' }">{{ row.isCZYF == 0 ? '鍚�' : row.isCZYF == 1 ? '鏄�' :
- ''}}</span>
+ <span :style="{ color: row.isCZYF == 0 ? 'red' : '' }">{{ row.isCZYF == 0 ? '鍚�' : row.isCZYF == 1 ? '鏄�'
+ :
+ '' }}</span>
</el-descriptions-item>
<el-descriptions-item label="璁¤垂閲戦">
@@ -83,7 +84,7 @@
<el-descriptions-item label="甯佸埗">
<el-radio-group v-model="row.yfCurrency">
<el-radio v-for="dict in sys_currency" :key="dict.value" :label="dict.value">{{ dict.label
- }}</el-radio>
+ }}</el-radio>
</el-radio-group>
</el-descriptions-item>
<el-descriptions-item label="璁¤垂鏁伴噺">
@@ -99,15 +100,32 @@
<div v-if="active === 'tab2'">
<h2>瀹炴姤瀹為攢璐圭敤</h2>
<avue-form v-model="boxForm" ref="boxFormRef" :option="boxFormOption">
+ <template #voucherUrl="{ row }">
+ <el-upload class="upload-demo" ref="uploadRef" :limit="1" drag :action="urlApi + '/common/upload2'" multiple
+ :show-file-list="true" :on-success="(res) => handleUploadAfter(res, row)"
+ :on-exceed="(files) => handleExceed(files, row)">
+ <el-icon class="el-icon--upload"><upload-filled /></el-icon>
+ <div class="el-upload__text">
+ 鐐瑰嚮鎴栧皢鍥剧墖鎷栨嫿鍒版鍖哄煙涓婁紶
+ </div>
+ </el-upload>
+ </template>
</avue-form>
- <avue-crud :option="boxTableOption" :data="boxTableData">
+ <avue-crud :option="boxTableOption" :data="boxTableData" @selection-change="boxSelectionChange">
+ <template #menu-left>
+ <el-button type="danger" plain icon="Delete"
+ :disabled="!(boxSelectionList.length === 1 && boxSelectionList[0]?.status === 0)"
+ @click="handleBatchBoxDel">
+ 浣滃簾
+ </el-button>
+ </template>
<template #isYF="{ row }">
- <el-checkbox v-model="row.isYF" :true-value="1" :false-value="0"
+ <el-checkbox v-model="row.isYF" :disabled="row.status == 1" :true-value="1" :false-value="0"
@change="(e: number) => isYFChange(e, row)"></el-checkbox>
</template>
<template #yfServiceProviderId="{ row }">
- <el-select v-model="row.yfServiceProviderIdType" placeholder="璇烽�夋嫨鏈嶅姟鍟�"
+ <el-select :disabled="row.status == 1" v-model="row.yfServiceProviderIdType" placeholder="璇烽�夋嫨鏈嶅姟鍟�"
@change="(e: any) => ysServiceProviderChange(e, row)" :filterable="true">
<el-option v-for="item in serviceProviderList"
:key="item.serviceProviderId + '_' + item.serviceProviderType" :label="item.serviceProviderName"
@@ -115,10 +133,11 @@
</el-select>
</template>
<template #yfPrice="{ row }">
- <el-input v-model="row.yfPrice" :min="1" type="number" placeholder="璇疯緭鍏ラ噾棰�"></el-input>
+ <el-input :disabled="row.status == 1" v-model="row.yfPrice" :min="1" type="number"
+ placeholder="璇疯緭鍏ラ噾棰�"></el-input>
</template>
<template #yfCurrency="{ row }">
- <el-radio-group v-model="row.yfCurrency">
+ <el-radio-group v-model="row.yfCurrency" :disabled="row.status == 1">
<el-radio v-for="dict in sys_currency" :key="dict.value" :label="dict.value">{{ dict.label }}</el-radio>
</el-radio-group>
</template>
@@ -210,7 +229,7 @@
updateTmsDispatchOrder,
generateTmsDispatchOrder, initGenerate, initYSGenerate,
ysGenerateTmsDispatchOrder, initYFGenerate, yfGenerateTmsDispatchOrder,
- getServiceProvider, checkCloseOrder, closeOrder
+ getServiceProvider, checkCloseOrder, closeOrder, tmsFinanceDetail
} from "@/api/tms/tmsDispatchOrder";
import useCurrentInstance from "@/utils/useCurrentInstance";
import { computed, onMounted, reactive, ref, toRefs, watch, getCurrentInstance, nextTick } from "vue";
@@ -227,6 +246,7 @@
import { listTmsLoadingServiceProvider } from "@/api/tms/tmsLoadingServiceProvider";
import { selectPaymentTmsQuotePlan } from "@/api/tms/tmsQuotePlan";
import { addTmsQuoteFee, listTmsQuoteFee, pushTmsQuoteFee } from "@/api/tms/tmsQuoteFee";
+import { status } from "nprogress";
@@ -253,6 +273,8 @@
};
const data = reactive({
form: <TmsDispatchOrderI>{},
+ selectionList2: <any>[],
+ boxSelectionList: <any>[],
queryParams: <TmsDispatchOrderI & PageQueryInterface>{},
page: <PagesInterface>{
pageSize: 10,
@@ -270,7 +292,6 @@
open: false,
open2: false,
goodsTableData: <any>[],
- selectionList2: <any>[],
goodsForm: <any>{},
open3: false,
actualForm: <any>{},
@@ -283,7 +304,7 @@
})
const {
queryParams, form, page, selectionList,
- boxTableData, optionType, open, open5,
+ boxTableData, optionType, open, open5, boxSelectionList,
boxFormOption, boxForm, boxTableOption, boxItemTableOption, selectionList2, isCustoms, isLoad, active, quotationItems, serviceProviderList
} = toRefs(data);
const option = ref({
@@ -808,7 +829,7 @@
display: true,
},
voucherUrl: {
- label: '琛岀▼鍑瘉',
+ label: '琛岀▼鍑瘉3',
display: true,
span: 24, dataType: 'string',
type: 'upload',
@@ -861,8 +882,8 @@
display: true,
accept: 'string', dataType: 'string',
type: 'upload',
- action: '/common/upload2',
-
+ // action: '/common/upload2',
+ slot: true,
},
remark: {
label: '澶囨敞', span: 24,
@@ -881,7 +902,8 @@
const financeTableOption = ref({
menu: false,
addBtn: false,
- header: false, selection: false,
+ header: true,
+ selection: true,
title: '鍘嗗彶鍨粯璐圭敤',
column: {
dataSource: {
@@ -952,9 +974,12 @@
yfCurrency: {
label: '搴斾粯甯佸埗',
display: true,
-
- }
-
+ },
+ status: {
+ label: '鐘舵��',
+ display: true,
+ type: 'select', dicUrl: '/system/dict/data/type/sys_cancel_word', dataType: 'string',
+ },
}
})
@@ -1198,50 +1223,48 @@
console.log(pageF.single)
},
+
getBeginListFunc: (params = {}) => {
- // 1. 鏃ユ湡杞崲
- let newParams = <any>{ ...params };
- if (newParams) {
- // 1. 瀹氫箟鏃ユ湡瀛楁鏄犲皠 (鏁扮粍鍚� : 鎺ュ彛闇�瑕佺殑鍓嶇紑)
- // 杩欐牱鍐欑殑濂藉鏄細濡傛灉浣犳湁澶氫釜鏃ユ湡锛岀洿鎺ュ湪杩欓噷娣诲姞涓�琛屽嵆鍙�
- const dateMap = {
- createTimeRange: 'createTime',
- updateTimeRange: 'updateTime',
- confirmTimeRange: 'confirmTime',
- okTimeRange: 'okTime',
+ // 1. 浣跨敤娴呮嫹璐濓紝涓嶅奖鍝嶅師濮嬫煡璇㈠璞�
+ // 鍏抽敭鐐癸細浠庡師濮� queryParams.value 鍙栧�硷紝纭繚鍒嗛〉鏃朵緷鐒惰兘鎷垮埌鏁扮粍
+ let newParams = { ...queryParams.value, ...params };
- };
+ // 2. 瀹氫箟鏃ユ湡瀛楁鏄犲皠 (鏁扮粍鍚� : 鎺ュ彛闇�瑕佺殑鍓嶇紑)
+ const dateMap = {
+ createTimeRange: 'createTime',
+ updateTimeRange: 'updateTime',
+ confirmTimeRange: 'confirmTime',
+ okTimeRange: 'okTime',
+ };
- // 2. 閬嶅巻澶勭悊鏃ユ湡
- Object.keys(dateMap).forEach(arrayKey => {
- const prefix = dateMap[arrayKey];
- const range = newParams[arrayKey];
+ // 3. 閬嶅巻澶勭悊鏃ユ湡
+ Object.keys(dateMap).forEach(arrayKey => {
+ const prefix = dateMap[arrayKey];
+ const range = newParams[arrayKey];
- if (Array.isArray(range) && range.length > 0) {
- // 璧嬪�� Begin 鍜� End
- newParams[`${prefix}Begin`] = range[0];
- newParams[`${prefix}End`] = range[1];
- }
+ if (Array.isArray(range) && range.length === 2) {
+ // 璧嬪�兼帴鍙i渶瑕佺殑 Begin 鍜� End
+ newParams[`${prefix}Begin`] = range[0];
+ newParams[`${prefix}End`] = range[1];
+ }
- // 銆愭牳蹇冩敼鍔ㄣ�戯細鏃犺鏄惁鏈夊�硷紝澶勭悊瀹屽悗閮芥妸鍘熷鐨� Array 瀛楁鍒犳帀
- // 杩欐牱璇锋眰閲屽氨涓嶄細鍑虹幇 confirmTimeRangeArray: [...]
- delete newParams[arrayKey];
- });
+ // 鍙湪缁欐帴鍙g殑鍙傛暟涓垹闄ゆ暟缁勶紝涓嶅奖鍝嶉〉闈㈡樉绀虹殑 queryParams
+ delete newParams[arrayKey];
+ });
- // 3. 閫氱敤娓呮礂锛氬垹闄ゆ墍鏈夌┖瀛楃涓层�乶ull 鎴� undefined 鐨勫叾浠栧瓧娈�
- Object.keys(newParams).forEach(key => {
- const val = newParams[key];
- if (val === '' || val === null || val === undefined) {
- delete newParams[key];
- }
- });
+ // 4. 娓呮礂鍙傛暟锛氳繃婊ょ┖鍊�
+ const finalParams = {};
+ Object.keys(newParams).forEach(key => {
+ const val = newParams[key];
+ if (val !== '' && val !== null && val !== undefined) {
+ finalParams[key] = val;
+ }
+ });
- } else {
- newParams = {};
- }
+ console.log('鍙戦�佺粰鎺ュ彛鐨勬渶缁堝弬鏁�:', finalParams);
- return newParams;
-
+ // 銆愭牳蹇冧慨鏀广�戯細鐩存帴杩斿洖锛屼笉瑕佽祴鍊肩粰 queryParams.value
+ return finalParams;
},
})
@@ -1261,7 +1284,6 @@
const submitForm = () => {
if (active.value === 'tab1') {
- console.log()
pushTmsQuoteFee({
...form.value,
quoteFeeItems: selectionList2.value
@@ -1278,6 +1300,7 @@
if (Array.isArray(boxForm.value.feeVoucherUrl)) {
boxForm.value.feeVoucherUrl = boxForm.value.feeVoucherUrl.toString();
}
+
boxForm.value.rowItems = boxTableData.value;
saveTmsFinanceDetail(boxForm.value).then(res => {
ElMessage({
@@ -1285,6 +1308,7 @@
type: 'success'
})
boxFormRef.value?.resetFields();
+ uploadRef.value?.clearFiles();
getTab2Data();
})
}
@@ -1329,7 +1353,6 @@
const quotePlanItemRes2 = await listTmsQuoteItem({ quotePlanId: form.value.quotePlanId, pageNum: 1, pageSize: 999 });
let list = quotePlanItemRes2.rows || [];
let quotePlanItemRes = await getDicts("sys_quotation_items");
- console.log(quotePlanItemRes)
let items = quotePlanItemRes.data || [];
let res = await listTmsQuoteFee({ dispatchId: form.value.id, pageNum: 1, pageSize: 999 });
let rowsData = res.rows || [];
@@ -1457,7 +1480,6 @@
if (value == 1) {
let find: any = quotationItems.value.find((item: any) => item.dictLabel === row.feeType);
if (find) {
- console.log(find, "find")
let opt = find.remark;
row.serviceProviderType = opt;
if (opt == 0) {
@@ -1548,7 +1570,6 @@
let receivableAmountHKD = items.filter((cItem: any) => cItem.currency == 'HKD').reduce((pre: any, cur: any) => {
return pre + Number(cur.registerAmount)
}, 0);
- console.log(receivableAmountRMB, receivableAmountHKD)
item.receivableAmountRMB = receivableAmountRMB;
item.receivableAmountHKD = receivableAmountHKD;
@@ -1630,7 +1651,6 @@
}
const submitForm5 = () => {
boxFormRef.value.validate((valid: boolean, done: any) => {
- console.log(valid)
if (valid) {
boxForm.value.id = form.value.id;
closeOrder(boxForm.value).then(res => {
@@ -1644,4 +1664,69 @@
}
})
}
+const uploadRef = ref<any>()
+const urlApi = ref(import.meta.env.VITE_APP_BASE_API)
+// 鍦� script 閮ㄥ垎淇敼 handleUploadAfter 鍑芥暟
+const handleUploadAfter = (res: any, row: any) => {
+ if (res.code === 200) {
+ // 纭繚 res.data.url 瀛樺湪
+ const url = res.data?.url || res.url;
+ if (url) {
+ boxForm.value.feeVoucherUrl = url
+ } else {
+ ElMessage.error('鏈幏鍙栧埌涓婁紶鏂囦欢 URL');
+ }
+ } else {
+ ElMessage.error(res.msg || '涓婁紶澶辫触');
+ }
+};
+
+// 鍚屾椂淇敼 handleExceed 鍑芥暟
+const handleExceed = (files: any, row: any) => {
+ if (!row) {
+ ElMessage.error('琛屾暟鎹负绌�');
+ return;
+ }
+
+ uploadRef.value?.clearFiles();
+ const file = files[0];
+ uploadRef.value?.handleStart(file);
+ uploadRef.value?.submit();
+};
+
+const boxSelectionChange = (selection: any[]) => {
+ boxSelectionList.value = selection;
+}
+/**
+ * 鎵归噺浣滃簾璐圭敤鏄庣粏
+ */
+const handleBatchBoxDel = () => {
+ if (boxSelectionList.value.length === 0) {
+ ElMessage.warning('璇烽�夋嫨瑕佷綔搴熺殑璐圭敤鏄庣粏');
+ return;
+ }
+
+ ElMessageBox.confirm(`纭瑕佷綔搴熼�変腑鐨� ${boxSelectionList.value.length} 鏉¤垂鐢ㄦ槑缁嗗悧锛焋, '璀﹀憡', {
+ confirmButtonText: '纭畾',
+ cancelButtonText: '鍙栨秷',
+ type: 'warning'
+ }).then(() => {
+ // 浠� boxTableData 涓Щ闄ら�変腑鐨勯」
+ // const ids = boxSelectionList.value.map((item: any) => item.id).join(',');
+ let data = {
+ id: boxSelectionList.value[0].id,
+ status: 1
+ }
+ tmsFinanceDetail(data).then(res => {
+ ElMessage.success('浣滃簾鎴愬姛');
+ getTab2Data(); // 鍒锋柊鏁版嵁
+ }).catch(err => {
+ ElMessage.error('浣滃簾澶辫触');
+ });
+ // ElMessage.success('浣滃簾鎴愬姛');
+ // boxSelectionList.value = []; // 娓呯┖閫夋嫨
+ }).catch(() => {
+ // 鍙栨秷鎿嶄綔
+ });
+}
</script>
\ No newline at end of file
--
Gitblit v1.8.0