From df1406d0f571972d033dffd6a93fb4b94febeb56 Mon Sep 17 00:00:00 2001 From: gaoluyang <2820782392@qq.com> Date: 星期二, 24 六月 2025 16:46:44 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/dev' into dev --- src/views/basicInformation/index.vue | 205 ++++++++++++++++++++++++++------------------------ 1 files changed, 107 insertions(+), 98 deletions(-) diff --git a/src/views/basicInformation/index.vue b/src/views/basicInformation/index.vue index fda5d65..21558f7 100644 --- a/src/views/basicInformation/index.vue +++ b/src/views/basicInformation/index.vue @@ -1,7 +1,8 @@ <template> - <div> <el-form :inline="true" :model="queryParams" class="search-form"> - <el-form-item label="鎼滅储" v-if="shouldShowSearch"> - <el-input v-model="queryParams.searchAll" :placeholder="searchPlaceholder" clearable /> + <div> + <el-form :inline="true" :model="queryParams" class="search-form"> + <el-form-item v-if="shouldShowSearch" label="鎼滅储"> + <el-input v-model="queryParams.searchAll" :placeholder="searchPlaceholder" clearable/> </el-form-item> <el-form-item> <el-button type="primary" @click="search">鏌ヨ</el-button> @@ -11,58 +12,62 @@ <el-card> <!-- 鏍囩椤� --> <el-tabs v-model="activeTab" class="info-tabs" @tab-click="handleTabClick"> - <el-tab-pane v-for="tab in tabs" :key="tab.name" :label="tab.label" :name="tab.name" /> + <el-tab-pane v-for="tab in tabs" :key="tab.name" :label="tab.label" :name="tab.name"/> </el-tabs> <!-- 鎿嶄綔鎸夐挳鍖� --> <el-row :gutter="24" class="table-toolbar"> - <el-button type="primary" :icon="Plus" @click="handleAdd">鏂板缓</el-button> - <el-button type="danger" :icon="Delete" @click="handleDelete">鍒犻櫎</el-button> - <el-button type="info" :icon="Download" @click="handleExport" v-show="canExport">瀵煎嚭</el-button> + <el-button :icon="Plus" type="primary" @click="handleAdd">鏂板缓</el-button> + <el-button :icon="Delete" type="danger" @click="handleDelete">鍒犻櫎</el-button> + <el-button @click="jump">admins</el-button> + <el-button v-show="canExport" :icon="Download" type="info" @click="handleExport">瀵煎嚭</el-button> </el-row> <!-- 琛ㄦ牸缁勪欢 --> <div> - <data-table :loading="loading" :table-data="tableData" :columns="columns" - @selection-change="handleSelectionChange" @edit="handleEdit" :show-selection="true" :border="true"> <!-- 瀛楁鍚嶇О鍒楃殑鑷畾涔夋彃妲� - 鏄剧ず涓烘爣绛� --> + <data-table :border="true" :columns="columns" :loading="loading" + :show-selection="true" :table-data="tableData" @edit="handleEdit" @selection-change="handleSelectionChange"> + <!-- 瀛楁鍚嶇О鍒楃殑鑷畾涔夋彃妲� - 鏄剧ず涓烘爣绛� --> <template v-if="tabName === 'coalQualityMaintenance'" #fieldIds="{ row }"> <template v-if="typeof row.fieldIds === 'string' && row.fieldIds.includes(',')"> - <el-tag v-for="(field, index) in row.fieldIds.split(',')" :key="index" type="primary" size="small" - style="margin-right: 4px; margin-bottom: 2px;"> + <el-tag v-for="(field, index) in row.fieldIds.split(',')" :key="index" size="small" style="margin-right: 4px; margin-bottom: 2px;" + type="primary"> {{ getFieldDisplayName(field.trim()) }} </el-tag> </template> <template v-else> - <el-tag type="primary" size="small"> + <el-tag size="small" type="primary"> {{ getFieldDisplayName(row.fieldIds) || '--' }} </el-tag> </template> </template> </data-table> </div> - <pagination v-if="total > 0" :page="pageNum" :limit="pageSizes" :total="total" @pagination="handPagination" - :layout="'total, prev, pager, next, jumper'" /> + <pagination v-if="total > 0" :layout="'total, prev, pager, next, jumper'" :limit="pageSizes" :page="pageNum" :total="total" + @pagination="handPagination"/> <Supplier v-if="tabName === 'supplier'" v-model:copyForm="copyForm" - v-model:supplierDialogFormVisible="dialogFormVisible" :form="form" :title="title" @submit="handleSubmit" - @beforeClose="handleBeforeClose" @update:dialogFormVisible="handleDialogFormVisible" :addOrEdit="addOrEdit" /> + v-model:supplierDialogFormVisible="dialogFormVisible" :addOrEdit="addOrEdit" :form="form" :title="title" + @beforeClose="handleBeforeClose" @submit="handleSubmit" + @update:dialogFormVisible="handleDialogFormVisible"/> <Customer v-if="tabName === 'customer'" v-model:copyForm="copyForm" - v-model:customerDialogFormVisible="dialogFormVisible" :form="form" :title="title" @submit="handleSubmit" - :addOrEdit="addOrEdit" @beforeClose="handleBeforeClose" /> - <Coal v-if="tabName === 'coal'" v-model:copyForm="copyForm" v-model:coalDialogFormVisible="dialogFormVisible" - :form="form" :title="title" :addOrEdit="addOrEdit" @submit="handleSubmit" /> - <coalQualityMaintenance v-if="tabName === 'coalQualityMaintenance'" v-model:copyForm="copyForm" - v-model:coalQualityMaintenanceDialogFormVisible="dialogFormVisible" :form="form" :title="title" - :addOrEdit="addOrEdit" @submit="handleSubmit" /> - <coalMeiZhiZiDuanWeiHu v-if="tabName === 'coalMeiZhiZiDuanWeiHu'" v-model:copyForm="copyForm" - v-model:coalMaintenanceFieldDialogVisible="dialogFormVisible" :form="form" :title="title" :addOrEdit="addOrEdit" - @submit="handleSubmit" /> + v-model:customerDialogFormVisible="dialogFormVisible" :addOrEdit="addOrEdit" :form="form" :title="title" + @beforeClose="handleBeforeClose" @submit="handleSubmit"/> + <Coal v-if="tabName === 'coal'" v-model:coalDialogFormVisible="dialogFormVisible" v-model:copyForm="copyForm" + :addOrEdit="addOrEdit" :form="form" :title="title" @submit="handleSubmit"/> + <coalQualityMaintenance v-if="tabName === 'coalQualityMaintenance'" v-model:coalQualityMaintenanceDialogFormVisible="dialogFormVisible" + v-model:copyForm="copyForm" :addOrEdit="addOrEdit" + :form="form" + :title="title" @submit="handleSubmit"/> + <coalMeiZhiZiDuanWeiHu v-if="tabName === 'coalMeiZhiZiDuanWeiHu'" v-model:coalMaintenanceFieldDialogVisible="dialogFormVisible" + v-model:copyForm="copyForm" :addOrEdit="addOrEdit" :form="form" + :title="title" + @submit="handleSubmit"/> </el-card> </div> </template> <script setup> -// ===== 鏍稿績渚濊禆瀵煎叆 ===== -import { ref, reactive, onMounted, computed, getCurrentInstance } from "vue"; -import { ElMessage, ElMessageBox } from "element-plus"; -import { Plus, Edit, Delete, Download } from "@element-plus/icons-vue"; +import {computed, getCurrentInstance, onMounted, reactive, ref, nextTick} from "vue"; +import {ElMessage, ElMessageBox} from "element-plus"; +import {Delete, Download, Plus} from "@element-plus/icons-vue"; // ===== 缁勪欢瀵煎叆 ===== import DataTable from "@/components/Table/ETable.vue"; @@ -74,18 +79,20 @@ import coalMeiZhiZiDuanWeiHu from "./mould/coalMeiZhiZiDuanWeiHu.vue"; // ===== API 鏈嶅姟瀵煎叆 ===== -import { getSupply, delSupply } from "@/api/basicInformation/supplier.js"; -import { getCoalInfo, delCoalInfo } from "@/api/basicInformation/coal.js"; -import { testUserList } from "@/api/tool/publicInterface.js"; -import { getAreaOptions } from "@/api/system/area.js"; -import { getCustomerList, delCustomer } from "@/api/basicInformation/customer.js"; -import { coalField, deleteCoalField } from "@/api/basicInformation/coalFieldMaintenance.js"; -import { getCoalFieldList, getCoalPlanList } from "@/api/basicInformation/coalQualityMaintenance"; +import {delSupply, getSupply} from "@/api/basicInformation/supplier.js"; +import {delCoalInfo, getCoalInfo} from "@/api/basicInformation/coal.js"; +import {testUserList} from "@/api/tool/publicInterface.js"; +import {getAreaOptions} from "@/api/system/area.js"; +import {delCustomer, getCustomerList} from "@/api/basicInformation/customer.js"; +import {coalField, deleteCoalField} from "@/api/basicInformation/coalFieldMaintenance.js"; +import {getCoalFieldList, getCoalPlanList} from "@/api/basicInformation/coalQualityMaintenance"; -const { proxy } = getCurrentInstance(); +const {proxy} = getCurrentInstance(); +import router from "@/router"; // ===== 鍝嶅簲寮忕姸鎬佺鐞� ===== - +const jump = () => { +}; // 寮圭獥鎺у埗鐘舵�� const dialogFormVisible = ref(false); const form = ref({}); @@ -124,11 +131,11 @@ // 鏍囩椤甸厤缃� const tabs = reactive([ - { name: "supplier", label: "渚涘簲鍟嗕俊鎭�" }, - { name: "customer", label: "瀹㈡埛淇℃伅" }, - { name: "coal", label: "鐓ょ淇℃伅" }, - { name: "coalQualityMaintenance", label: "鐓よ川鏂规" }, - { name: "coalMeiZhiZiDuanWeiHu", label: "鐓よ川瀛楁" } + {name: "supplier", label: "渚涘簲鍟嗕俊鎭�"}, + {name: "customer", label: "瀹㈡埛淇℃伅"}, + {name: "coal", label: "鐓ょ淇℃伅"}, + {name: "coalQualityMaintenance", label: "鐓よ川鏂规"}, + {name: "coalMeiZhiZiDuanWeiHu", label: "鐓よ川瀛楁"} ]); // ===== 宸ュ叿鍑芥暟 ===== @@ -178,18 +185,18 @@ * @description 灏嗗湴鍧�ID鏁扮粍杞崲涓哄彲璇荤殑鍦板潃瀛楃涓� */ const formatAddressArray = (addressIds) => { - if (!addressMap.value || Object.keys(addressMap.value).length === 0 || - !addressIds || !Array.isArray(addressIds) || addressIds.length === 0 || + if (!addressMap.value || Object.keys(addressMap.value).length === 0 || + !addressIds || !Array.isArray(addressIds) || addressIds.length === 0 || addressIds.every(id => !id)) { return '--'; } - + const addressNames = addressIds.map(id => addressMap.value[id]?.name || '--'); - + if (addressNames.every(name => name === '--')) { return '--'; } - + return addressNames.filter(name => name !== '--').join(' / '); }; @@ -217,7 +224,7 @@ */ const coalFieldData = async () => { try { - const { data, code } = await getCoalFieldList(); + const {data, code} = await getCoalFieldList(); if (code === 200) { coalFieldList.value = data; } @@ -234,10 +241,10 @@ */ const getFieldDisplayName = (fieldId) => { if (!fieldId) return '--'; - + const numId = parseInt(fieldId); const matchedField = coalFieldList.value.find(item => item.id === numId); - + return matchedField ? matchedField.fieldName : numId; }; @@ -256,7 +263,7 @@ const searchPlaceholder = computed(() => { const placeholderMap = { supplier: "渚涘簲鍟�/璇嗗埆鐮�/璇︾粏鍦板潃", - customer: "渚涘簲鍟�/璇嗗埆鐮�/璇︾粏鍦板潃", + customer: "渚涘簲鍟�/璇嗗埆鐮�/璇︾粏鍦板潃", coal: "璇疯緭鍏ユ悳绱俊鎭�", coalQualityMaintenance: "璇疯緭鍏ユ悳绱俊鎭�", coalMeiZhiZiDuanWeiHu: "璇疯緭鍏ユ悳绱俊鎭�" @@ -268,7 +275,7 @@ * 鏄惁鏄剧ず鎼滅储妗� */ const shouldShowSearch = computed(() => { - return ['supplier', 'customer', 'coal', 'coalQualityMaintenance','coalMeiZhiZiDuanWeiHu'].includes(tabName.value); + return ['supplier', 'customer', 'coal', 'coalQualityMaintenance', 'coalMeiZhiZiDuanWeiHu'].includes(tabName.value); }); /** @@ -287,8 +294,8 @@ * 渚涘簲鍟嗚〃鏍煎垪閰嶇疆 */ const supplierColumns = ref([ - { prop: "supplierName", label: "渚涘簲鍟嗗悕绉�", minWidth: 100 }, - { prop: "taxpayerId", label: "缁熶竴浜鸿瘑鍒彿", minWidth: 170 }, + {prop: "supplierName", label: "渚涘簲鍟嗗悕绉�", minWidth: 100}, + {prop: "taxpayerId", label: "缁熶竴浜鸿瘑鍒彿", minWidth: 170}, { prop: "bids", label: "缁忚惀鍦板潃", @@ -299,10 +306,10 @@ return formatAddressArray(addressIds); } }, - { prop: "businessAddress", label: "缁忚惀璇︾粏鍦板潃", minWidth: 150 }, - { prop: "bankAccount", label: "寮�鎴疯", minWidth: 120 }, - { prop: "bankName", label: "閾惰璐﹀彿", minWidth: 150 }, - { prop: "contactPerson", label: "鑱旂郴浜�", minWidth: 100 }, + {prop: "businessAddress", label: "缁忚惀璇︾粏鍦板潃", minWidth: 150}, + {prop: "bankAccount", label: "寮�鎴疯", minWidth: 120}, + {prop: "bankName", label: "閾惰璐﹀彿", minWidth: 150}, + {prop: "contactPerson", label: "鑱旂郴浜�", minWidth: 100}, { prop: "cids", label: "鑱旂郴浜哄湴鍧�", @@ -313,16 +320,16 @@ return formatAddressArray(addressIds); } }, - { prop: "contactAddress", label: "鑱旂郴浜鸿缁嗗湴鍧�", minWidth: 120 }, - { prop: "updateTime", label: "缁存姢鏃ユ湡", minWidth: 120 }, + {prop: "contactAddress", label: "鑱旂郴浜鸿缁嗗湴鍧�", minWidth: 120}, + {prop: "updateTime", label: "缁存姢鏃ユ湡", minWidth: 120}, ]); /** * 瀹㈡埛琛ㄦ牸鍒楅厤缃� */ const customerColumns = ref([ - { prop: "customerName", label: "瀹㈡埛鍚嶇О", minWidth: 100 }, - { prop: "taxpayerId", label: "缁熶竴浜鸿瘑鍒彿", minWidth: 120 }, + {prop: "customerName", label: "瀹㈡埛鍚嶇О", minWidth: 100}, + {prop: "taxpayerId", label: "缁熶竴浜鸿瘑鍒彿", minWidth: 120}, { prop: "bids", label: "缁忚惀鍦板潃", @@ -333,11 +340,11 @@ return formatAddressArray(addressIds); } }, - { prop: "businessAddress", label: "璇︾粏鍦板潃", minWidth: 150 }, - { prop: "bankName", label: "寮�鎴疯", minWidth: 120 }, - { prop: "bankAccount", label: "閾惰璐﹀彿", minWidth: 150 }, - { prop: "contactPerson", label: "鑱旂郴浜�", minWidth: 100 }, - { prop: "contactPhone", label: "鑱旂郴浜虹數璇�", minWidth: 100 }, + {prop: "businessAddress", label: "璇︾粏鍦板潃", minWidth: 150}, + {prop: "bankName", label: "寮�鎴疯", minWidth: 120}, + {prop: "bankAccount", label: "閾惰璐﹀彿", minWidth: 150}, + {prop: "contactPerson", label: "鑱旂郴浜�", minWidth: 100}, + {prop: "contactPhone", label: "鑱旂郴浜虹數璇�", minWidth: 100}, { prop: "cids", label: "鑱旂郴浜哄湴鍧�", @@ -348,15 +355,15 @@ return formatAddressArray(addressIds); } }, - { prop: "contactAddress", label: "鑱旂郴浜鸿缁嗗湴鍧�", minWidth: 150 }, - { prop: "updateTime", label: "缁存姢鏃ユ湡", minWidth: 100 }, + {prop: "contactAddress", label: "鑱旂郴浜鸿缁嗗湴鍧�", minWidth: 150}, + {prop: "updateTime", label: "缁存姢鏃ユ湡", minWidth: 100}, ]); /** * 鐓ょ琛ㄦ牸鍒楅厤缃� */ const coalColumns = ref([ - { prop: "coal", label: "鐓ょ鍚嶇О", minWidth: 200 }, + {prop: "coal", label: "鐓ょ鍚嶇О", minWidth: 200}, { prop: "maintainerId", label: "缁存姢浜�", @@ -371,14 +378,14 @@ return userMap.value[cellValue] || '--'; } }, - { prop: "maintenanceDate", label: "缁存姢鏃ユ湡", minWidth: 150 }, + {prop: "maintenanceDate", label: "缁存姢鏃ユ湡", minWidth: 150}, ]); /** * 鐓よ川鏂规琛ㄦ牸鍒楅厤缃� */ const coalQualityMaintenanceColumns = ref([ - { prop: "plan", label: "鏂规鍚嶇О", minWidth: 100 }, + {prop: "plan", label: "鏂规鍚嶇О", minWidth: 100}, { prop: "fieldIds", label: "瀛楁鍚嶇О", @@ -392,15 +399,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}, ]); // ===== 浜嬩欢澶勭悊鍑芥暟 ===== @@ -489,10 +496,10 @@ */ const handleAddEdit = (currentTabName) => { const actionText = addOrEdit.value === "add" ? "鏂板" : "缂栬緫"; - + const tabTitleMap = { supplier: "渚涘簲鍟嗕俊鎭�", - customer: "瀹㈡埛淇℃伅", + customer: "瀹㈡埛淇℃伅", coal: "鐓ょ淇℃伅", coalQualityMaintenance: "鐓よ川鏂规缁存姢", coalMeiZhiZiDuanWeiHu: "鐓よ川瀛楁缁存姢" @@ -561,27 +568,27 @@ */ const handleEdit = (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 = "edit"; handleAddEdit(tabName.value); }; @@ -597,7 +604,7 @@ } const deleteIds = selectedRows.value.map(item => item.id); - + try { await ElMessageBox.confirm("纭畾鍒犻櫎閫変腑鐨勬暟鎹悧锛�", "鎻愮ず", { confirmButtonText: "纭畾", @@ -608,7 +615,9 @@ const deleteApiMap = { supplier: delSupply, coal: delCoalInfo, - coalQualityMaintenance: () => { throw new Error('delCoalQuality API not imported'); }, + coalQualityMaintenance: () => { + throw new Error('delCoalQuality API not imported'); + }, customer: delCustomer, coalMeiZhiZiDuanWeiHu: deleteCoalField }; @@ -620,12 +629,12 @@ } 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) { @@ -653,10 +662,10 @@ */ const handleExport = () => { const exportConfig = { - supplier: { api: "/supply/export", name: "渚涘簲鍟嗕俊鎭�" }, - customer: { api: "/customer/export", name: "瀹㈡埛淇℃伅" }, - coal: { api: "/supply/export", name: "鐓ょ淇℃伅" }, - coalQualityMaintenance: { api: "/supply/export", name: "鐓よ川缁存姢淇℃伅" } + supplier: {api: "/supply/export", name: "渚涘簲鍟嗕俊鎭�"}, + customer: {api: "/customer/export", name: "瀹㈡埛淇℃伅"}, + coal: {api: "/supply/export", name: "鐓ょ淇℃伅"}, + coalQualityMaintenance: {api: "/supply/export", name: "鐓よ川缁存姢淇℃伅"} }; const config = exportConfig[tabName.value]; @@ -671,7 +680,7 @@ * @param {string} name - 瀵煎嚭鏂囦欢鍚嶅墠缂� */ const exportData = (api, name) => { - proxy.download(api, { ...queryParams }, `${name}${new Date().getTime()}.xlsx`); + proxy.download(api, {...queryParams}, `${name}${new Date().getTime()}.xlsx`); ElMessage.success("瀵煎嚭鏁版嵁锛�" + name); }; // ===== 鏁版嵁鑾峰彇鍑芥暟 ===== @@ -707,13 +716,13 @@ const getList = async () => { try { loading.value = true; - const { data, code } = await selectInterface(); - + const {data, code} = await selectInterface(); + if (code !== 200) { ElMessage.error("鑾峰彇鏁版嵁澶辫触锛�" + (data?.msg || '鏈煡閿欒')); return; } - + tableData.value = data.records || []; total.value = data.total || 0; } catch (error) { @@ -733,7 +742,7 @@ try { // 骞惰鎵ц鍒濆鍖栨搷浣� await Promise.all([ - handleTabClick({ props: { name: "supplier" } }), + handleTabClick({props: {name: "supplier"}}), fetchAreaOptions(), getUserList() ]); @@ -778,7 +787,7 @@ /* 琛ㄦ牸宸ュ叿鏍� */ .table-toolbar, -.table-toolbar>* { +.table-toolbar > * { margin: 0 0 0 0 !important; } -- Gitblit v1.9.3