From a43becd99dec4696ed629b9f549819b7d788a022 Mon Sep 17 00:00:00 2001
From: maven <2163098428@qq.com>
Date: 星期六, 11 十月 2025 13:38:27 +0800
Subject: [PATCH] yys 修改是否为耗材字段名称
---
src/views/basicInformation/index.vue | 253 ++++++++++++-------------------------------------
1 files changed, 64 insertions(+), 189 deletions(-)
diff --git a/src/views/basicInformation/index.vue b/src/views/basicInformation/index.vue
index caf93be..040ef69 100644
--- a/src/views/basicInformation/index.vue
+++ b/src/views/basicInformation/index.vue
@@ -31,7 +31,7 @@
<!-- 鎿嶄綔鎸夐挳鍖� -->
<el-row :gutter="24" class="table-toolbar">
<el-button :icon="Plus" type="primary" @click="handleAdd"
- >鏂板缓</el-button
+ >{{activeTab == 'supplier' ? '娉ㄥ唽' : '鏂板缓'}}</el-button
>
<el-button :icon="Delete" type="danger" @click="handleDelete"
>鍒犻櫎</el-button
@@ -56,9 +56,6 @@
@edit="handleEdit"
@viewRow="handleView"
@selection-change="handleSelectionChange"
- :showOperations="true"
- :showIndex="true"
- :showPagination="false"
:operations="['edit', 'viewRow']"
:operationsWidth="200"
>
@@ -146,21 +143,6 @@
:title="title"
@submit="handleSubmit"
/>
- <Descriptions
- v-model:descriptionsVisible="showDialog"
- title="渚涘簲鍟嗚鎯�"
- :formData="supplierData"
- :fieldLabels="supplierFieldLabels"
- :column="2"
- :isViewOnly="false"
- :border="true"
- :showOperations="true"
- descriptionsTitle="鍩烘湰淇℃伅"
- :fieldConfig="fieldConfig"
- :excludeFields="excludeFields"
- @edit="descriptionsHandleEdit"
- @close="handleClose"
- />
</el-card>
</div>
</template>
@@ -185,7 +167,6 @@
import Coal from "./mould/coal.vue";
import coalQualityMaintenance from "./mould/coalQualityMaintenance.vue";
import coalMeiZhiZiDuanWeiHu from "./mould/coalMeiZhiZiDuanWeiHu.vue";
-import Descriptions from "@/components/dialog/Descriptions.vue";
// ===== API 鏈嶅姟瀵煎叆 =====
import { delSupply, getSupply } from "@/api/basicInformation/supplier.js";
@@ -203,77 +184,17 @@
import {
getCoalFieldList,
getCoalPlanList,
+ delCoalPlan,
} from "@/api/basicInformation/coalQualityMaintenance";
-
+import { useDelete } from "@/hooks/useDelete.js";
const { proxy } = getCurrentInstance();
-import router from "@/router";
// ===== 鍝嶅簲寮忕姸鎬佺鐞� =====
-// 寮圭獥鎺у埗鐘舵��
-const showDialog = ref(false)
-const supplierFieldLabels = {
- supplierName: '渚涘簲鍟嗗悕绉�',
- taxpayerId: '缁熶竴绀句細淇$敤浠g爜',
-}
-// 鏁版嵁瀵硅薄
-const supplierData = ref({
- supplierName: "娴嬭瘯渚涘簲鍟�",
- taxpayerId: "91320000MA1N2P3Q4R",
- contactPerson: "寮犱笁",
- contactPhone: "13800138000",
- bankAccount: "6222024200019999999",
- bankName: "涓浗宸ュ晢閾惰",
- businessAddress: "姹熻嫃鐪佽嫃宸炲競宸ヤ笟鍥尯鏄熸箹琛�328鍙�",
- contactAddress: "姹熻嫃鐪佽嫃宸炲競濮戣嫃鍖鸿鍓嶈100鍙�",
- createTime: "2024-01-15T10:30:00",
- updateTime: "2024-06-25T14:20:00",
- id: 123,
-})
-// 瀛楁閰嶇疆
-const fieldConfig = ref({
- supplierName: {
- label: '渚涘簲鍟嗗悕绉�',
- span: 2 // 璺�2鍒楁樉绀�
- },
- taxpayerId: {
- label: '缁熶竴绀句細淇$敤浠g爜'
- },
- contactPhone: {
- label: '鑱旂郴鐢佃瘽',
- formatter: (value) => value || '鏆傛棤鑱旂郴鏂瑰紡'
- },
- createTime: {
- label: '鍒涘缓鏃堕棿',
- formatter: (value) => new Date(value).toLocaleDateString('zh-CN')
- },
- businessAddress: {
- label: '璇︾粏缁忚惀鍦板潃',
- span: 2
- },
- contactAddress: {
- label: '璇︾粏鑱旂郴鍦板潃',
- span: 2
- }
-})
-// 鎺掗櫎涓嶆樉绀虹殑瀛楁
-const excludeFields = ref(["id", "updateTime", "deleted"]);
-
-// 浜嬩欢澶勭悊
-const descriptionsHandleEdit = (data) => {
- console.log("缂栬緫鏁版嵁:", data);
- // 璺宠浆鍒扮紪杈戦〉闈㈡垨鎵撳紑缂栬緫寮圭獥
-};
-
-const handleClose = () => {
- console.log("寮圭獥鍏抽棴");
-};
-
const dialogFormVisible = ref(false);
const form = ref({});
const title = ref("");
const copyForm = ref({});
const addOrEdit = ref("add");
-const descriptionsVisible = ref(false);
// 鏁版嵁缂撳瓨鏄犲皠
const userList = ref([]);
@@ -389,10 +310,12 @@
const getUserList = async () => {
try {
const res = await testUserList();
+ console.log("鑾峰彇鐢ㄦ埛鍒楄〃鏁版嵁:", res);
+ console.log("userMap:", userMap.value);
if (res && res.data) {
userList.value = res.data;
userList.value.forEach((user) => {
- userMap.value[user.userId] = user.username;
+ userMap.value[user.userId] = user.nickName;
});
}
} catch (error) {
@@ -430,8 +353,6 @@
return matchedField ? matchedField.fieldName : numId;
};
-// ===== 璁$畻灞炴�� =====
-
/**
* 褰撳墠鏍囩椤垫槸鍚︽敮鎸佸鍑哄姛鑳�
*/
@@ -444,11 +365,11 @@
*/
const searchPlaceholder = computed(() => {
const placeholderMap = {
- supplier: "渚涘簲鍟�/璇嗗埆鐮�/璇︾粏鍦板潃",
- customer: "渚涘簲鍟�/璇嗗埆鐮�/璇︾粏鍦板潃",
- coal: "璇疯緭鍏ユ悳绱俊鎭�",
- coalQualityMaintenance: "璇疯緭鍏ユ悳绱俊鎭�",
- coalMeiZhiZiDuanWeiHu: "璇疯緭鍏ユ悳绱俊鎭�",
+ supplier: "渚涘簲鍟�/缁熶竴璇嗗埆鐮�/璇︾粏鍦板潃",
+ customer: "渚涘簲鍟�/缁熶竴璇嗗埆鐮�/璇︾粏鍦板潃",
+ coal: "璇疯緭鍏ョ叅绉嶄俊鎭�",
+ coalQualityMaintenance: "璇疯緭鍏ョ叅璐ㄦ柟妗堜俊鎭�",
+ coalMeiZhiZiDuanWeiHu: "璇疯緭鍏ョ叅璐ㄥ瓧娈典俊鎭�",
};
return placeholderMap[tabName.value] || "璇疯緭鍏ユ悳绱俊鎭�";
});
@@ -470,11 +391,6 @@
* 褰撳墠閫変腑琛屾暟閲�
*/
const selectedCount = computed(() => selectedRows.value.length);
-
-/**
- * 鏄惁鏈夐�変腑鐨勮
- */
-const hasSelectedRows = computed(() => selectedCount.value > 0);
// ===== 琛ㄦ牸鍒楅厤缃� =====
@@ -575,10 +491,10 @@
* 鐓よ川鏂规琛ㄦ牸鍒楅厤缃�
*/
const coalQualityMaintenanceColumns = ref([
- { prop: "plan", label: "鏂规鍚嶇О", minWidth: 100 },
+ { prop: "plan", label: "鐓よ川鏂规", minWidth: 100 },
{
prop: "fieldIds",
- label: "瀛楁鍚嶇О",
+ label: "鐓よ川瀛楁",
minWidth: 200,
showOverflowTooltip: true,
slot: true,
@@ -589,15 +505,15 @@
return cellValue || "--";
},
},
- { prop: "schemeDesc", label: "瀛楁鎻忚堪", minWidth: 100 },
+ { prop: "schemeDesc", label: "鐓よ川鎻忚堪", minWidth: 100 },
]);
/**
* 鐓よ川瀛楁琛ㄦ牸鍒楅厤缃�
*/
const coalMeiZhiZiDuanWeiHuColumns = ref([
- { prop: "fieldName", label: "瀛楁鍚嶇О", minWidth: 200 },
- { prop: "fieldDescription", label: "瀛楁鎻忚堪", minWidth: 200 },
+ { prop: "fieldName", label: "鐓よ川瀛楁", minWidth: 200 },
+ { prop: "fieldDescription", label: "鐓よ川鎻忚堪", minWidth: 200 },
]);
// ===== 浜嬩欢澶勭悊鍑芥暟 =====
@@ -796,104 +712,27 @@
handleAddEdit(tabName.value);
};
-/**
- * 鏌ョ湅鎸夐挳鐐瑰嚮澶勭悊
- * @param {Object} row - 琛屾暟鎹�
- * @description 澶勭悊鏌ョ湅鎿嶄綔锛屾瀯寤哄湴鍧�鏁扮粍骞舵墦寮�鏌ョ湅寮圭獥
- */
-const handleView = (row) => {
- console.log("鏌ョ湅琛屾暟鎹�:", row);
- // 鎷垮埌鎵�鏈夌殑keys
- const keys = Object.keys(row);
- console.log("鎵�鏈塳eys:", keys);
- showDialog.value = true;
- // form.value = JSON.parse(JSON.stringify(row));
- // console.log("鏌ョ湅琛屾暟鎹�:", form.value);
- // // 鏋勫缓渚涘簲鍟嗕笟鍔″湴鍧�鏁扮粍
- // if (form.value.bprovinceId && form.value.bdistrictId && form.value.bcityId) {
- // form.value.bids = [row.bprovinceId, row.bcityId, row.bdistrictId];
- // }
- // // 鏋勫缓渚涘簲鍟嗚仈绯诲湴鍧�鏁扮粍
- // if (form.value.cprovinceId && form.value.cdistrictId && form.value.ccityId) {
- // form.value.cids = [row.cprovinceId, row.ccityId, row.cdistrictId];
- // }
- // // 鏋勫缓瀹㈡埛涓氬姟鍦板潃鏁扮粍
- // if (
- // form.value.businessCityId &&
- // form.value.businessDistrictId &&
- // form.value.businessProvinceId
- // ) {
- // form.value.bids = [
- // row.businessProvinceId,
- // row.businessCityId,
- // row.businessDistrictId,
- // ];
- // }
-
- // // 鏋勫缓瀹㈡埛鑱旂郴鍦板潃鏁扮粍
- // if (form.value.cityId && form.value.districtId && form.value.provinceId) {
- // form.value.cids = [row.provinceId, row.cityId, row.districtId];
- // }
-
- // addOrEdit.value = "viewRow";
- // handleAddEdit(tabName.value);
-};
/**
* 鎵归噺鍒犻櫎澶勭悊
* @description 鎵归噺鍒犻櫎閫変腑鐨勮褰�
*/
-const handleDelete = async () => {
- if (selectedRows.value.length === 0) {
- ElMessage.warning("璇烽�夋嫨瑕佸垹闄ょ殑鏁版嵁");
- return;
- }
-
- const deleteIds = selectedRows.value.map((item) => item.id);
-
- try {
- await ElMessageBox.confirm("纭畾鍒犻櫎閫変腑鐨勬暟鎹悧锛�", "鎻愮ず", {
- confirmButtonText: "纭畾",
- cancelButtonText: "鍙栨秷",
- type: "warning",
- });
-
- const deleteApiMap = {
+ const deleteApiMap = {
supplier: delSupply,
coal: delCoalInfo,
- coalQualityMaintenance: () => {
- throw new Error("delCoalQuality API not imported");
- },
+ coalQualityMaintenance: delCoalPlan,
customer: delCustomer,
coalMeiZhiZiDuanWeiHu: deleteCoalField,
};
-
- const deleteApi = deleteApiMap[tabName.value];
- if (!deleteApi) {
- ElMessage.error("鍒犻櫎鎺ュ彛鏈厤缃�");
- return;
- }
- console.log(deleteIds);
- const res = await deleteApi(deleteIds);
-
- if (res.code !== 200 && res.msg !== "鎿嶄綔鎴愬姛") {
- ElMessage.error("鍒犻櫎澶辫触锛�" + res.msg);
- return;
- }
-
- ElMessage.success("鍒犻櫎鎴愬姛");
- await getList();
- } catch (error) {
- if (error.message !== "cancel") {
- console.error("鍒犻櫎鎿嶄綔澶辫触:", error);
- ElMessage.error("鍒犻櫎澶辫触锛岃绋嶅悗鍐嶈瘯");
- } else {
- ElMessage.info("宸插彇娑堝垹闄ゆ搷浣�");
- }
- } finally {
- selectedRows.value = [];
- }
-};
+const {handleDeleteBatch :handleDelete} = useDelete({
+ deleteApi: () => deleteApiMap[tabName.value],
+ selectedRows: selectedRows,
+ getList: () => getList,
+ tableData: tableData,
+ total: total,
+ confirmText: "纭鍒犻櫎閫変腑鐨勬暟鎹悧锛�",
+ successText: "鍒犻櫎鎴愬姛",
+})
/**
* 鍏抽棴寮圭獥澶勭悊
@@ -985,6 +824,40 @@
}
};
+const handleView = (row) => {
+ form.value = JSON.parse(JSON.stringify(row));
+ // 鏋勫缓渚涘簲鍟嗕笟鍔″湴鍧�鏁扮粍
+ if (form.value.bprovinceId && form.value.bdistrictId && form.value.bcityId) {
+ form.value.bids = [row.bprovinceId, row.bcityId, row.bdistrictId];
+ }
+
+ // 鏋勫缓渚涘簲鍟嗚仈绯诲湴鍧�鏁扮粍
+ if (form.value.cprovinceId && form.value.cdistrictId && form.value.ccityId) {
+ form.value.cids = [row.cprovinceId, row.ccityId, row.cdistrictId];
+ }
+
+ // 鏋勫缓瀹㈡埛涓氬姟鍦板潃鏁扮粍
+ if (
+ form.value.businessCityId &&
+ form.value.businessDistrictId &&
+ form.value.businessProvinceId
+ ) {
+ form.value.bids = [
+ row.businessProvinceId,
+ row.businessCityId,
+ row.businessDistrictId,
+ ];
+ }
+
+ // 鏋勫缓瀹㈡埛鑱旂郴鍦板潃鏁扮粍
+ if (form.value.cityId && form.value.districtId && form.value.provinceId) {
+ form.value.cids = [row.provinceId, row.cityId, row.districtId];
+ }
+ addOrEdit.value = "viewRow";
+ handleAddEdit(tabName.value);
+};
+
+
// ===== 鐢熷懡鍛ㄦ湡閽╁瓙 =====
/**
@@ -1018,7 +891,9 @@
width: 16%;
}
}
-
+.app-container{
+ padding: 18px !important;
+}
.table-toolbar {
margin-bottom: 20px;
display: flex;
--
Gitblit v1.9.3