From c3445703d247f39c21be7aae1b1fab5096be4380 Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期四, 29 一月 2026 10:57:49 +0800
Subject: [PATCH] Merge branch 'dev_New' of http://114.132.189.42:9002/r/product-inventory-management into dev_New
---
src/views/safeProduction/safeQualifications/index.vue | 6
src/views/safeProduction/safeWorkApproval/components/infoFormDia.vue | 486 +++++++
src/views/salesManagement/receiptPayment/index.vue | 8
src/views/productionManagement/productionDispatching/components/formDia.vue | 2
src/views/safeProduction/safeWorkApproval/components/approvalDia.vue | 530 ++++++++
src/views/salesManagement/salesLedger/index.vue | 16
src/api/safeProduction/dangerInvestigation.js | 61
src/views/personnelManagement/employeeRecord/components/NewOrEditFormDia.vue | 8
src/views/safeProduction/safeWorkApproval/index.vue | 371 +++++
src/api/safeProduction/hazardousMaterialsControl.js | 33
src/views/safeProduction/safeWorkApproval/fileList.vue | 67 +
src/views/procurementManagement/invoiceEntry/components/Modal.vue | 42
src/views/safeProduction/hazardousMaterialsControl/index.vue | 889 +++++++++++++
src/views/safeProduction/dangerInvestigation/index.vue | 1293 ++++++++++++++++++++
14 files changed, 3,788 insertions(+), 24 deletions(-)
diff --git a/src/api/safeProduction/dangerInvestigation.js b/src/api/safeProduction/dangerInvestigation.js
new file mode 100644
index 0000000..e6ec3d0
--- /dev/null
+++ b/src/api/safeProduction/dangerInvestigation.js
@@ -0,0 +1,61 @@
+// 鍙戣揣鍙拌处椤甸潰鎺ュ彛
+import request from "@/utils/request";
+
+// 鍒嗛〉鏌ヨ
+export function dangerInvestigationListPage(query) {
+ return request({
+ url: "/safeHidden/page",
+ method: "get",
+ params: query,
+ });
+}
+
+// 鏂板瀹夊叏瑙勭▼涓庤祫璐ㄧ鐞�
+export function safeHiddenAdd(query) {
+ return request({
+ url: '/safeHidden',
+ method: 'post',
+ data: query
+ })
+}
+// 淇敼瀹夊叏瑙勭▼涓庤祫璐ㄧ鐞�
+export function safeHiddenUpdate(query) {
+ return request({
+ url: '/safeHidden',
+ method: 'put',
+ data: query
+ })
+}
+// 鍒犻櫎瀹夊叏瑙勭▼涓庤祫璐ㄧ鐞�
+export function safeHiddenDel(ids) {
+ return request({
+ url: '/safeHidden/' + ids,
+ method: 'delete',
+ data: ids
+ })
+}
+
+// 鏌ヨ闄勪欢鍒楄〃
+export function fileListPage(query) {
+ return request({
+ url: "/safeHiddenFile/listPage",
+ method: "get",
+ params: query,
+ });
+}
+// 娣诲姞闄勪欢
+export function safeHiddenFileAdd(query) {
+ return request({
+ url: '/safeHiddenFile/add',
+ method: 'post',
+ data: query
+ })
+}
+// 鍒犻櫎闄勪欢
+export function safeHiddenFileDel(ids) {
+ return request({
+ url: '/safeHiddenFile/del',
+ method: 'delete',
+ data: ids
+ })
+}
\ No newline at end of file
diff --git a/src/api/safeProduction/hazardousMaterialsControl.js b/src/api/safeProduction/hazardousMaterialsControl.js
new file mode 100644
index 0000000..0f5557f
--- /dev/null
+++ b/src/api/safeProduction/hazardousMaterialsControl.js
@@ -0,0 +1,33 @@
+import request from "@/utils/request";
+
+export function safeHazardRecordListPage(query) {
+ return request({
+ url: "/safeHazardRecord/page",
+ method: "get",
+ params: query,
+ });
+}
+
+export function safeHazardRecordDel(ids) {
+ return request({
+ url: '/safeHazardRecord/' + ids,
+ method: 'delete',
+ data: ids
+ })
+}
+// 鏂板鍗遍櫓婧愬彴璐�
+export function safeHazardRecordAdd(query) {
+ return request({
+ url: '/safeHazardRecord/borrow',
+ method: 'post',
+ data: query
+ })
+}
+
+export function safeHazardRecordUpdate(query) {
+ return request({
+ url: '/safeHazardRecord/return',
+ method: 'put',
+ data: query
+ })
+}
\ No newline at end of file
diff --git a/src/views/personnelManagement/employeeRecord/components/NewOrEditFormDia.vue b/src/views/personnelManagement/employeeRecord/components/NewOrEditFormDia.vue
index 06eee04..f65509a 100644
--- a/src/views/personnelManagement/employeeRecord/components/NewOrEditFormDia.vue
+++ b/src/views/personnelManagement/employeeRecord/components/NewOrEditFormDia.vue
@@ -179,7 +179,6 @@
contractTerm: 0,
contractStartTime: "",
contractEndTime: "",
- staffState: "",
sysPostId: undefined,
sysDeptId: undefined,
},
@@ -215,6 +214,9 @@
form.value = {...res.data}
if (form.value.sysPostId === 0) {
form.value.sysPostId = undefined
+ }
+ if (form.value.sysDeptId === 0) {
+ form.value.sysDeptId = undefined
}
// 缂栬緫鏃朵篃璁$畻涓�娆″悎鍚屽勾闄�
calculateContractTerm();
@@ -260,9 +262,11 @@
if (!form.value.sysPostId) {
form.value.sysPostId = 0;
}
+ if (!form.value.sysDeptId) {
+ form.value.sysDeptId = 0;
+ }
proxy.$refs.formRef.validate(valid => {
if (valid) {
- form.value.staffState = 1
if (operationType.value === "add") {
createStaffOnJob(form.value).then(res => {
proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
diff --git a/src/views/procurementManagement/invoiceEntry/components/Modal.vue b/src/views/procurementManagement/invoiceEntry/components/Modal.vue
index efd4a4e..b723175 100644
--- a/src/views/procurementManagement/invoiceEntry/components/Modal.vue
+++ b/src/views/procurementManagement/invoiceEntry/components/Modal.vue
@@ -411,13 +411,15 @@
item.futureTicketsAmount !== undefined ? item.futureTicketsAmount : (item.taxInclusiveTotalPrice || 0)
);
- // 鏂板鏃讹細鏈寮�绁ㄩ粯璁や笉濉紙0锛夛紝閬垮厤涓�鎵撳紑灏辨妸鈥滄湭鏉ョエ鏁扳�濇墸鎴� 0
- item.ticketsNum = 0;
- item.ticketsAmount = 0;
-
- // 椤甸潰灞曠ず鐨勨�滄湭鏉ョエ鏁�/鏈潵绁ㄩ噾棰濃�濋粯璁ゅ睍绀哄師濮嬫湭鏉ュ��
- item.futureTickets = item.tempFutureTickets;
- item.futureTicketsAmount = item.tempFutureTicketsAmount;
+ // 鏂板鏃讹細鏈寮�绁ㄦ暟榛樿 = 鏈潵绁ㄦ暟锛堜笖涓嶈兘澶т簬鏈潵绁ㄦ暟锛�
+ item.ticketsNum = Number(item.tempFutureTickets || 0);
+ // 鑱斿姩璁$畻鏈寮�绁ㄩ噾棰濄�佹湭鏉ョエ鏁般�佹湭鏉ョエ閲戦
+ const unitPrice = Number(item.taxInclusiveUnitPrice || 0);
+ item.ticketsAmount = Number((item.ticketsNum * unitPrice).toFixed(2));
+ item.futureTickets = Number((item.tempFutureTickets - item.ticketsNum).toFixed(2));
+ item.futureTicketsAmount = Number(
+ (item.tempFutureTicketsAmount - item.ticketsAmount).toFixed(2)
+ );
});
form.productData = allProductData;
@@ -426,7 +428,7 @@
const totalAmount = allProductData.reduce((sum, item) => {
return sum + (Number(item.ticketsAmount) || 0);
}, 0);
- form.invoiceAmount = totalAmount.toFixed(2);
+ form.invoiceAmount = Number(totalAmount.toFixed(2));
// 瀛樺偍閫変腑鐨勫悎鍚屾暟鎹�
selectedContracts.value = selectedRows;
@@ -467,11 +469,11 @@
row.ticketsNum = Number(row.tempFutureTickets || 0);
}
// 璁$畻鏈鏉ョエ閲戦
- row.ticketsAmount = (row.ticketsNum * row.taxInclusiveUnitPrice).toFixed(2)
+ row.ticketsAmount = Number((Number(row.ticketsNum) * Number(row.taxInclusiveUnitPrice || 0)).toFixed(2));
// 璁$畻鏈潵绁ㄦ暟
- row.futureTickets = (row.tempFutureTickets - row.ticketsNum).toFixed(2)
+ row.futureTickets = Number((Number(row.tempFutureTickets || 0) - Number(row.ticketsNum || 0)).toFixed(2));
// 璁$畻鏈潵绁ㄩ噾棰�
- row.futureTicketsAmount = (row.tempFutureTicketsAmount - row.ticketsAmount).toFixed(2)
+ row.futureTicketsAmount = Number((Number(row.tempFutureTicketsAmount || 0) - Number(row.ticketsAmount || 0)).toFixed(2));
calculateinvoiceAmount();
};
@@ -494,12 +496,12 @@
proxy.$modal.msgWarning("鏈寮�绁ㄦ暟涓嶈兘澶т簬鏈潵绁ㄦ暟");
row.ticketsNum = Number(row.tempFutureTickets || 0);
// 閲嶆柊璁$畻鏈鏉ョエ閲戦
- row.ticketsAmount = (row.ticketsNum * row.taxInclusiveUnitPrice).toFixed(2);
+ row.ticketsAmount = Number((Number(row.ticketsNum) * Number(row.taxInclusiveUnitPrice || 0)).toFixed(2));
}
// 璁$畻鏈潵绁ㄦ暟
- row.futureTickets = (row.tempFutureTickets - row.ticketsNum).toFixed(2)
+ row.futureTickets = Number((Number(row.tempFutureTickets || 0) - Number(row.ticketsNum || 0)).toFixed(2));
// 璁$畻鏈潵绁ㄩ噾棰�
- row.futureTicketsAmount = (row.tempFutureTicketsAmount - row.ticketsAmount).toFixed(2)
+ row.futureTicketsAmount = Number((Number(row.tempFutureTicketsAmount || 0) - Number(row.ticketsAmount || 0)).toFixed(2));
calculateinvoiceAmount();
};
@@ -510,7 +512,7 @@
invoiceAmountTotal += Number(item.ticketsAmount);
}
});
- form.invoiceAmount = invoiceAmountTotal.toFixed(2);
+ form.invoiceAmount = Number(invoiceAmountTotal.toFixed(2));
};
const open = async (type, selectedRows) => {
@@ -518,9 +520,15 @@
// 濡傛灉鏄壒閲忔搷浣滐紝璁剧疆鏍囬
if (Array.isArray(selectedRows) && selectedRows.length > 1) {
- modalOptions.title = `鎵归噺鏂板 (${selectedRows.length}鏉�)`;
+ modalOptions.value = {
+ ...(modalOptions.value || {}),
+ title: `鎵归噺鏂板 (${selectedRows.length}鏉�)`,
+ };
} else {
- modalOptions.title = type === "add" ? "鏂板" : "缂栬緫";
+ modalOptions.value = {
+ ...(modalOptions.value || {}),
+ title: type === "add" ? "鏂板" : "缂栬緫",
+ };
}
// 濡傛灉鏄崟涓搷浣滐紝鑾峰彇id
diff --git a/src/views/productionManagement/productionDispatching/components/formDia.vue b/src/views/productionManagement/productionDispatching/components/formDia.vue
index 971bc6e..a514d9a 100644
--- a/src/views/productionManagement/productionDispatching/components/formDia.vue
+++ b/src/views/productionManagement/productionDispatching/components/formDia.vue
@@ -111,7 +111,7 @@
<script setup>
import {ref} from "vue";
-import {getStaffJoinInfo, staffJoinAdd, staffJoinUpdate} from "@/api/personnelManagement/onboarding.js";
+// import {getStaffJoinInfo, staffJoinAdd, staffJoinUpdate} from "@/api/personnelManagement/onboarding.js";
import {userListNoPageByTenantId} from "@/api/system/user.js";
import {productionDispatch} from "@/api/productionManagement/productionOrder.js";
import useUserStore from "@/store/modules/user.js";
diff --git a/src/views/safeProduction/dangerInvestigation/index.vue b/src/views/safeProduction/dangerInvestigation/index.vue
new file mode 100644
index 0000000..1878370
--- /dev/null
+++ b/src/views/safeProduction/dangerInvestigation/index.vue
@@ -0,0 +1,1293 @@
+<template>
+ <div class="app-container">
+ <!-- <div class="search_form">
+ <el-form :model="searchForm"
+ :inline="true">
+ <el-form-item label="闅愭偅缂栧彿锛�">
+ <el-input v-model="searchForm.hiddenCode"
+ placeholder="璇疯緭鍏�"
+ clearable
+ prefix-icon="Search"
+ @change="handleQuery" />
+ </el-form-item>
+ <el-form-item>
+ <el-button type="primary"
+ @click="handleQuery"> 鎼滅储 </el-button>
+ </el-form-item>
+ </el-form>
+ </div> -->
+ <div class="table_list">
+ <div class="actions">
+ <div></div>
+ <div>
+ <el-button type="primary"
+ @click="openForm('add')">
+ 鏂板闅愭偅
+ </el-button>
+ <!-- <el-button type="primary"
+ plain
+ @click="handleImport">瀵煎叆</el-button>
+ <el-button @click="handleOut">瀵煎嚭</el-button> -->
+ <el-button type="danger"
+ plain
+ @click="handleDelete">鍒犻櫎</el-button>
+ <!-- <el-button type="primary"
+ plain
+ @click="handlePrint">鎵撳嵃</el-button> -->
+ </div>
+ </div>
+ <el-table :data="tableData"
+ border
+ v-loading="tableLoading"
+ @selection-change="handleSelectionChange"
+ :expand-row-keys="expandedRowKeys"
+ :row-key="(row) => row.id"
+ :row-class-name="getRowClass"
+ style="width: 100%"
+ height="calc(100vh - 18.5em)">
+ <el-table-column align="center"
+ type="selection"
+ width="55"
+ fixed="left" />
+ <el-table-column align="center"
+ label="搴忓彿"
+ type="index"
+ width="60" />
+ <el-table-column label="闅愭偅缂栧彿"
+ prop="hiddenCode"
+ width="180"
+ show-overflow-tooltip />
+ <el-table-column label="闅愭偅鎻忚堪"
+ prop="hiddenDesc"
+ show-overflow-tooltip />
+ <el-table-column label="闅愭偅鍏蜂綋浣嶇疆"
+ prop="location"
+ show-overflow-tooltip />
+ <el-table-column label="涓婃姤浜�"
+ prop="createUserName"
+ width="180"
+ show-overflow-tooltip />
+ <el-table-column label="涓婃姤鏃堕棿"
+ prop="createTime"
+ show-overflow-tooltip />
+ <el-table-column label="鏁存敼瀹屾垚鏈熼檺"
+ prop="rectifyTime"
+ width="120"
+ show-overflow-tooltip />
+ <el-table-column label="鏁存敼璐d换浜�"
+ prop="rectifyUserName"
+ width="120"
+ show-overflow-tooltip />
+ <el-table-column label="鏁存敼璐d换浜鸿仈绯绘柟寮�"
+ prop="rectifyUserMobile"
+ width="120"
+ show-overflow-tooltip />
+ <el-table-column label="鏁存敼鍏蜂綋鎺柦"
+ prop="rectifyMeasures"
+ width="120"
+ show-overflow-tooltip />
+ <el-table-column label="瀹為檯鏁存敼瀹屾垚鏃堕棿"
+ prop="rectifyActualTime"
+ width="120"
+ show-overflow-tooltip />
+ <el-table-column label="楠屾敹鎰忚"
+ prop="verifyRemark"
+ width="120"
+ show-overflow-tooltip />
+ <el-table-column label="楠屾敹鏃堕棿"
+ prop="verifyTime"
+ width="120"
+ show-overflow-tooltip />
+ <el-table-column label="楠屾敹缁撴灉"
+ prop="verifyResult"
+ width="120"
+ show-overflow-tooltip>
+ <template #default="scope">
+ <el-tag v-if="scope.row.verifyResult"
+ :type="scope.row.verifyResult === '閫氳繃' ? 'success' : 'danger'">
+ {{ scope.row.verifyResult }}
+ </el-tag>
+ </template>
+ </el-table-column>
+ <el-table-column fixed="right"
+ label="鎿嶄綔"
+ min-width="250"
+ align="center">
+ <template #default="scope">
+ <el-button link
+ type="primary"
+ size="small"
+ @click="openForm('edit', scope.row)">缂栬緫</el-button>
+ <el-button link
+ type="primary"
+ size="small"
+ @click="downLoadFile(scope.row)">闄勪欢</el-button>
+ <el-button link
+ type="primary"
+ size="small"
+ @click="openForm('edit2', scope.row)">鏁存敼</el-button>
+ <el-button link
+ type="primary"
+ size="small"
+ :disabled="!scope.row.rectifyActualTime"
+ @click="openForm('edit3', scope.row)">楠屾敹</el-button>
+ </template>
+ </el-table-column>
+ </el-table>
+ <pagination v-show="total > 0"
+ :total="total"
+ layout="total, sizes, prev, pager, next, jumper"
+ :page="page.current"
+ :limit="page.size"
+ @pagination="paginationChange" />
+ </div>
+ <FormDialog v-model="dialogFormVisible"
+ :title="getTitle(operationType)"
+ :width="'70%'"
+ :operation-type="operationType"
+ @close="closeDia"
+ @confirm="submitForm"
+ @cancel="closeDia">
+ <el-form :model="form"
+ v-if="operationType === 'add' || operationType === 'edit'"
+ label-width="140px"
+ label-position="top"
+ :rules="rules"
+ ref="formRef">
+ <el-row :gutter="30">
+ <el-col :span="12">
+ <el-form-item label="闅愭偅缂栧彿锛�"
+ prop="hiddenCode">
+ <el-input v-model="form.hiddenCode"
+ placeholder="鑷姩鐢熸垚"
+ disabled
+ clearable />
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="闅愭偅鍏蜂綋浣嶇疆锛�"
+ prop="location">
+ <el-input v-model="form.location"
+ placeholder="璇疯緭鍏�"
+ clearable />
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-form-item label="闅愭偅鎻忚堪锛�"
+ prop="hiddenDesc">
+ <el-input v-model="form.hiddenDesc"
+ type="textarea"
+ :rows="2"
+ placeholder="璇疯緭鍏�"
+ clearable />
+ </el-form-item>
+ <el-row :gutter="30">
+ <el-col :span="12">
+ <el-form-item label="闅愭偅绫诲瀷锛�"
+ prop="type">
+ <el-select v-model="form.type"
+ placeholder="璇烽�夋嫨"
+ clearable>
+ <el-option v-for="item in typeList"
+ :key="item.value"
+ :label="item.label"
+ :value="item.value" />
+ </el-select>
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="闅愭偅椋庨櫓绛夌骇锛�"
+ prop="riskLevel">
+ <el-select v-model="form.riskLevel"
+ placeholder="璇烽�夋嫨"
+ clearable>
+ <el-option v-for="item in riskLevelList"
+ :key="item.value"
+ :label="item.label"
+ :value="item.value" />
+ </el-select>
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row :gutter="30">
+ <el-col :span="12">
+ <el-form-item label="涓婃姤浜猴細"
+ prop="createUser">
+ <el-select v-model="form.createUser"
+ placeholder="璇烽�夋嫨"
+ disabled
+ clearable>
+ <el-option v-for="item in userList"
+ :key="item.userId"
+ :label="item.nickName"
+ :value="item.userId" />
+ </el-select>
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="涓婃姤鏃堕棿锛�"
+ prop="createTime">
+ <el-date-picker style="width: 100%"
+ disabled
+ v-model="form.createTime"
+ value-format="YYYY-MM-DD"
+ format="YYYY-MM-DD"
+ type="date"
+ placeholder="璇烽�夋嫨"
+ clearable />
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row :gutter="30">
+ <el-col :span="12">
+ <el-form-item label="鏁存敼璐d换浜猴細"
+ prop="rectifyUserId">
+ <el-select v-model="form.rectifyUserId"
+ placeholder="璇烽�夋嫨"
+ @change="handleChange2"
+ clearable>
+ <el-option v-for="item in userList"
+ :key="item.userId"
+ :label="item.nickName"
+ :value="item.userId" />
+ </el-select>
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="鏁存敼瀹屾垚鏈熼檺"
+ prop="rectifyTime">
+ <el-date-picker style="width: 100%"
+ v-model="form.rectifyTime"
+ value-format="YYYY-MM-DD"
+ format="YYYY-MM-DD"
+ type="date"
+ placeholder="璇烽�夋嫨"
+ clearable />
+ </el-form-item>
+ </el-col>
+ </el-row>
+ </el-form>
+ <el-descriptions :column="2"
+ style="margin-bottom: 20px;"
+ v-if="operationType === 'edit2' || operationType === 'edit3'"
+ title="闅愭偅璇︽儏"
+ border>
+ <el-descriptions-item label="闅愭偅缂栧彿">
+ <span class="detail-title">{{ form.hiddenCode }}</span>
+ </el-descriptions-item>
+ <el-descriptions-item label="闅愭偅鍏蜂綋浣嶇疆">
+ <span class="detail-title">{{ form.location }}</span>
+ </el-descriptions-item>
+ <el-descriptions-item :span="2"
+ label="闅愭偅鎻忚堪">
+ <span class="detail-title">{{ form.hiddenDesc }}</span>
+ </el-descriptions-item>
+ <el-descriptions-item label="闅愭偅绫诲瀷">
+ <span class="detail-title">{{ form.type }}</span>
+ </el-descriptions-item>
+ <el-descriptions-item label="闅愭偅椋庨櫓绛夌骇">
+ <el-tag :type="getTypeTagType(form.riskLevel)">
+ {{ form.riskLevel }}
+ </el-tag>
+ </el-descriptions-item>
+ <el-descriptions-item label="涓婃姤浜�">
+ <span class="detail-title">{{ form.createUserName }}</span>
+ </el-descriptions-item>
+ <el-descriptions-item label="涓婃姤鏃堕棿">
+ <span class="detail-title">{{ form.createTime }}</span>
+ </el-descriptions-item>
+ <el-descriptions-item label="鏁存敼璐d换浜�">
+ <span class="detail-title">{{ form.rectifyUserName }}</span>
+ </el-descriptions-item>
+ <el-descriptions-item label="鏁存敼璐d换浜鸿仈绯绘柟寮�">
+ <span class="detail-title">{{ form.rectifyUserMobile }}</span>
+ </el-descriptions-item>
+ <el-descriptions-item label="鏁存敼瀹屾垚鏈熼檺">
+ <span class="detail-title">{{ form.rectifyTime }}</span>
+ </el-descriptions-item>
+ </el-descriptions>
+ <el-descriptions :column="2"
+ style="margin-bottom: 20px;"
+ v-if="operationType === 'edit3'"
+ title="鏁存敼璇︽儏"
+ border>
+ <el-descriptions-item label="鏁存敼鍏蜂綋鎺柦"
+ :span="2">
+ <span class="detail-title">{{ form2.rectifyMeasures }}</span>
+ </el-descriptions-item>
+ <el-descriptions-item label="瀹為檯鏁存敼瀹屾垚鏃堕棿">
+ <span class="detail-title">{{ form2.rectifyActualTime }}</span>
+ </el-descriptions-item>
+ </el-descriptions>
+ <el-form :model="form2"
+ v-if="operationType === 'edit2'"
+ label-width="140px"
+ label-position="top"
+ :rules="rules2"
+ ref="formRef2">
+ <el-form-item label="鏁存敼鍏蜂綋鎺柦锛�"
+ prop="rectifyMeasures">
+ <el-input v-model="form2.rectifyMeasures"
+ type="textarea"
+ :rows="2"
+ placeholder="璇疯緭鍏ユ暣鏀瑰叿浣撴帾鏂�"
+ clearable />
+ </el-form-item>
+ <el-row :gutter="30">
+ <el-col :span="12">
+ <el-form-item label="瀹為檯鏁存敼瀹屾垚鏃堕棿锛�"
+ prop="rectifyActualTime">
+ <el-date-picker style="width: 100%"
+ v-model="form2.rectifyActualTime"
+ value-format="YYYY-MM-DD"
+ format="YYYY-MM-DD"
+ type="date"
+ placeholder="璇烽�夋嫨"
+ clearable />
+ </el-form-item>
+ </el-col>
+ </el-row>
+ </el-form>
+ <el-form :model="form3"
+ v-if="operationType === 'edit3'"
+ label-width="140px"
+ label-position="top"
+ :rules="rules3"
+ ref="formRef3">
+ <el-form-item label="楠屾敹鎰忚锛�"
+ prop="verifyRemark">
+ <el-input v-model="form3.verifyRemark"
+ type="textarea"
+ :rows="2"
+ placeholder="璇疯緭鍏ラ獙鏀舵剰瑙�"
+ clearable />
+ </el-form-item>
+ <el-row :gutter="30">
+ <el-col :span="12">
+ <el-form-item label="楠屾敹鏃堕棿锛�"
+ prop="verifyTime">
+ <el-date-picker style="width: 100%"
+ disabled
+ v-model="form3.verifyTime"
+ value-format="YYYY-MM-DD"
+ format="YYYY-MM-DD"
+ type="date"
+ placeholder="璇烽�夋嫨"
+ clearable />
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="楠屾敹缁撴灉锛�"
+ prop="verifyResult">
+ <el-select v-model="form3.verifyResult"
+ placeholder="璇烽�夋嫨"
+ clearable>
+ <el-option label="閫氳繃"
+ value="閫氳繃" />
+ <el-option label="涓嶉�氳繃"
+ value="涓嶉�氳繃" />
+ </el-select>
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row :gutter="30">
+ <el-col :span="12">
+ <el-form-item label="楠屾敹浜猴細"
+ prop="verifyUserId">
+ <el-select v-model="form3.verifyUserId"
+ disabled
+ placeholder="璇烽�夋嫨"
+ clearable>
+ <el-option v-for="item in userList"
+ :key="item.userId"
+ :label="item.nickName"
+ :value="item.userId" />
+ </el-select>
+ </el-form-item>
+ </el-col>
+ </el-row>
+ </el-form>
+ </FormDialog>
+ <!-- 闄勪欢鍒楄〃寮圭獥 -->
+ <FileListDialog ref="fileListRef"
+ v-model="fileListDialogVisible"
+ :show-upload-button="true"
+ :show-delete-button="true"
+ :upload-method="handleUpload"
+ :delete-method="handleFileDelete"
+ title="闄勪欢鍒楄〃" />
+ </div>
+</template>
+
+<script setup>
+ import { getToken } from "@/utils/auth";
+ import pagination from "@/components/PIMTable/Pagination.vue";
+ import { onMounted, ref, getCurrentInstance } from "vue";
+ import { ElMessageBox, ElMessage } from "element-plus";
+ import useUserStore from "@/store/modules/user";
+ import { userListNoPage } from "@/api/system/user.js";
+ import FileListDialog from "@/components/Dialog/FileListDialog.vue";
+ import FormDialog from "@/components/Dialog/FormDialog.vue";
+ import { getQuotationList } from "@/api/salesManagement/salesQuotation.js";
+ import {
+ dangerInvestigationListPage,
+ safeHiddenAdd,
+ safeHiddenUpdate,
+ safeHiddenDel,
+ fileListPage,
+ safeHiddenFileAdd,
+ safeHiddenFileDel,
+ } from "@/api/safeProduction/dangerInvestigation.js";
+ import useFormData from "@/hooks/useFormData.js";
+ import request from "@/utils/request";
+ import dayjs from "dayjs";
+ import { get } from "@vueuse/core";
+
+ const userStore = useUserStore();
+ const { proxy } = getCurrentInstance();
+ const tableData = ref([]);
+ const selectedRows = ref([]);
+ const userList = ref([]);
+ const tableLoading = ref(false);
+ const page = reactive({
+ current: 1,
+ size: 100,
+ });
+ const total = ref(0);
+ const getTitle = type => {
+ if (type === "add") {
+ return "鏂板闅愭偅";
+ } else if (type === "edit") {
+ return "淇敼闅愭偅";
+ } else if (type === "edit2") {
+ return "鏁存敼椤甸潰";
+ } else if (type === "edit3") {
+ return "楠屾敹椤甸潰";
+ }
+ };
+ // 鑾峰彇绫诲瀷鏍囩绫诲瀷
+ const getTypeTagType = type => {
+ const typeMap = {
+ 杈冨ぇ椋庨櫓: "warning",
+ 浣庨闄�: "info",
+ 涓�鑸闄�: "info",
+ 閲嶅ぇ椋庨櫓: "danger",
+ };
+ return typeMap[type] || "info";
+ };
+ // 鐢ㄦ埛淇℃伅琛ㄥ崟寮规鏁版嵁
+ const operationType = ref("");
+ const dialogFormVisible = ref(false);
+ const data = reactive({
+ searchForm: {
+ hiddenCode: "", // 闅愭偅缂栧彿
+ },
+ form: {
+ hiddenCode: "", // 闅愭偅缂栧彿
+ location: "", // 闅愭偅浣嶇疆
+ hiddenDesc: "", // 闅愭偅鎻忚堪
+ createUser: "", // 涓婃姤浜�
+ createUserName: "",
+ createTime: dayjs().format("YYYY-MM-DD HH:mm:ss"), // 涓婃姤鏃堕棿
+ rectifyUserId: "", // 鏁存敼璐d换浜�
+ rectifyUserName: "",
+ rectifyTime: "", // 鏁存敼瀹屾垚鏈熼檺
+ rectifyUserMobile: "", // 鏁存敼璐d换浜烘墜鏈哄彿
+ riskLevel: "", // 闅愭偅椋庨櫓绛夌骇
+ type: "", // 闅愭偅绫诲瀷
+ },
+
+ rules: {
+ location: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
+ hiddenDesc: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
+ riskLevel: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
+ type: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
+ createUser: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
+ rectifyUserId: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
+ rectifyTime: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
+ },
+ });
+ const rules2 = {
+ rectifyActualTime: [{ required: true, message: "璇烽�夋嫨", trigger: "blur" }],
+ rectifyMeasures: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
+ };
+ const rules3 = {
+ verifyTime: [{ required: true, message: "璇烽�夋嫨", trigger: "blur" }],
+ verifyRemark: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
+ verifyResult: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
+ acceptDesc: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
+ };
+ const typeList = ref([
+ {
+ value: "璁惧瀹夊叏",
+ label: "璁惧瀹夊叏",
+ },
+ {
+ value: "浜哄憳鎿嶄綔",
+ label: "浜哄憳鎿嶄綔",
+ },
+ {
+ value: "鐜椋庨櫓",
+ label: "鐜椋庨櫓",
+ },
+ {
+ value: "鐗╂枡绠℃帶",
+ label: "鐗╂枡绠℃帶",
+ },
+ {
+ value: "鍏朵粬",
+ label: "鍏朵粬",
+ },
+ ]);
+ const form2 = ref({
+ rectifyActualTime: "", // 瀹為檯鏁存敼瀹屾垚鏃堕棿
+ rectifyMeasures: "", // 鏁存敼鍏蜂綋鎺柦
+ });
+ const form3 = ref({
+ verifyTime: "", // 楠屾敹鏃堕棿
+ verifyRemark: "", // 楠屾敹澶囨敞
+ acceptDesc: "", // 楠屾敹鎻忚堪
+ verifyUserId: "", // 楠屾敹浜�
+ verifyUserName: "",
+ verifyResult: "", // 楠屾敹缁撴灉
+ });
+ const riskLevelList = ref([
+ {
+ value: "閲嶅ぇ椋庨櫓",
+ label: "閲嶅ぇ椋庨櫓",
+ },
+ {
+ value: "杈冨ぇ椋庨櫓",
+ label: "杈冨ぇ椋庨櫓",
+ },
+ {
+ value: "涓�鑸闄�",
+ label: "涓�鑸闄�",
+ },
+ {
+ value: "浣庨闄�",
+ label: "浣庨闄�",
+ },
+ ]);
+ // 闅愭偅绫诲瀷閫夐」
+ const { type_qualification } = proxy.useDict("type_qualification");
+ const { form, rules } = toRefs(data);
+ const { form: searchForm } = useFormData(data.searchForm);
+ // 浜у搧琛ㄥ崟寮规鏁版嵁
+ const productFormVisible = ref(false);
+
+ const quotationLoading = ref(false);
+ const quotationList = ref([]);
+ const quotationSearchForm = reactive({
+ quotationNo: "",
+ customer: "",
+ });
+
+ const handleChange2 = userId => {
+ const selectedUser = userList.value.find(user => user.userId === userId);
+ if (selectedUser) {
+ form.value.rectifyUserName = selectedUser.nickName;
+ form.value.rectifyUserMobile = selectedUser.phonenumber;
+ }
+ };
+
+ // 瀵煎叆鐩稿叧
+ const importUploadRef = ref(null);
+ const importUpload = reactive({
+ title: "瀵煎叆閿�鍞彴璐�",
+ open: false,
+ url: import.meta.env.VITE_APP_BASE_API + "/sales/ledger/import",
+ headers: { Authorization: "Bearer " + getToken() },
+ isUploading: false,
+ beforeUpload: file => {
+ const isExcel = file.name.endsWith(".xlsx") || file.name.endsWith(".xls");
+ const isLt10M = file.size / 1024 / 1024 < 10;
+ if (!isExcel) {
+ proxy.$modal.msgError("涓婁紶鏂囦欢鍙兘鏄� xlsx/xls 鏍煎紡!");
+ return false;
+ }
+ if (!isLt10M) {
+ proxy.$modal.msgError("涓婁紶鏂囦欢澶у皬涓嶈兘瓒呰繃 10MB!");
+ return false;
+ }
+ return true;
+ },
+ onChange: (file, fileList) => {
+ console.log("鏂囦欢鐘舵�佹敼鍙�", file, fileList);
+ },
+ onProgress: (event, file, fileList) => {
+ console.log("涓婁紶涓�...", event.percent);
+ },
+ onSuccess: (response, file, fileList) => {
+ console.log("涓婁紶鎴愬姛", response, file, fileList);
+ importUpload.isUploading = false;
+ if (response.code === 200) {
+ proxy.$modal.msgSuccess("瀵煎叆鎴愬姛");
+ importUpload.open = false;
+ if (importUploadRef.value) {
+ importUploadRef.value.clearFiles();
+ }
+ getList();
+ } else {
+ proxy.$modal.msgError(response.msg || "瀵煎叆澶辫触");
+ }
+ },
+ onError: (error, file, fileList) => {
+ console.error("涓婁紶澶辫触", error, file, fileList);
+ importUpload.isUploading = false;
+ proxy.$modal.msgError("瀵煎叆澶辫触锛岃閲嶈瘯");
+ },
+ });
+
+ // 鏌ヨ鍒楄〃
+ /** 鎼滅储鎸夐挳鎿嶄綔 */
+ const handleQuery = () => {
+ // 鍙湁鍦ㄧ偣鍑绘悳绱㈡寜閽椂鎵嶉噸缃〉鐮佸埌绗竴椤�
+ // 閬垮厤琛ㄥ崟瀛楁change浜嬩欢骞叉壈鍒嗛〉
+ if (arguments.length === 0) {
+ page.current = 1;
+ }
+ expandedRowKeys.value = [];
+ getList();
+ };
+ const paginationChange = obj => {
+ page.current = obj.page;
+ page.size = obj.limit;
+ getList();
+ };
+ const getList = () => {
+ tableLoading.value = true;
+ const { entryDate, ...rest } = searchForm;
+ // 灏嗚寖鍥存棩鏈熷瓧娈典紶閫掔粰鍚庣
+ const params = { ...rest, ...page };
+ // 绉婚櫎褰曞叆鏃ユ湡鐨勯粯璁ゅ�艰缃紝鍙繚鐣欒寖鍥存棩鏈熷瓧娈�
+ delete params.entryDate;
+ return dangerInvestigationListPage(params)
+ .then(res => {
+ tableLoading.value = false;
+ tableData.value = res.data.records;
+ total.value = res.data.total;
+ return res;
+ })
+ .catch(() => {
+ tableLoading.value = false;
+ });
+ };
+
+ const findNodeById = (nodes, productId) => {
+ for (let i = 0; i < nodes.length; i++) {
+ if (nodes[i].value === productId) {
+ return nodes[i].label; // 鎵惧埌鑺傜偣锛岃繑鍥炶鑺傜偣
+ }
+ if (nodes[i].children && nodes[i].children.length > 0) {
+ const foundNode = findNodeById(nodes[i].children, productId);
+ if (foundNode) {
+ return foundNode; // 鍦ㄥ瓙鑺傜偣涓壘鍒帮紝杩斿洖璇ヨ妭鐐�
+ }
+ }
+ }
+ return null; // 娌℃湁鎵惧埌鑺傜偣锛岃繑鍥瀗ull
+ };
+ // 琛ㄦ牸閫夋嫨鏁版嵁
+ const handleSelectionChange = selection => {
+ selectedRows.value = selection;
+ console.log("selection", selectedRows.value);
+ };
+ const expandedRowKeys = ref([]);
+ // 鎵撳紑寮规
+ const openForm = async (type, row) => {
+ console.log("row", row);
+ operationType.value = type;
+ form3.value = {
+ verifyTime: "", // 楠屾敹鏃堕棿
+ verifyRemark: "", // 楠屾敹澶囨敞
+ verifyResult: "", // 楠屾敹鎻忚堪
+ verifyUserId: "", // 楠屾敹浜�
+ };
+ form2.value = {
+ rectifyActualTime: "", // 瀹為檯鏁存敼瀹屾垚鏃堕棿
+ rectifyMeasures: "", // 鏁存敼鍏蜂綋鎺柦
+ };
+ if (type === "add") {
+ form.value = {
+ hiddenCode: "", // 闅愭偅缂栧彿
+ location: "", // 闅愭偅浣嶇疆
+ hiddenDesc: "", // 闅愭偅鎻忚堪
+ createUser: Number(currentUserId.value), // 涓婃姤浜�
+ createUserName: currentUserName.value,
+ createTime: dayjs().format("YYYY-MM-DD HH:mm:ss"), // 涓婃姤鏃堕棿
+ rectifyUserId: "", // 鏁存敼璐d换浜�
+ rectifyUserName: "",
+ rectifyTime: "", // 鏁存敼瀹屾垚鏈熼檺
+ rectifyUserMobile: "", // 鏁存敼璐d换浜烘墜鏈哄彿
+ riskLevel: "", // 闅愭偅椋庨櫓绛夌骇
+ type: "", // 闅愭偅绫诲瀷
+ };
+ } else if (type === "edit") {
+ form.value = {
+ id: row.id,
+ hiddenCode: row.hiddenCode, // 闅愭偅缂栧彿
+ location: row.location, // 闅愭偅浣嶇疆
+ hiddenDesc: row.hiddenDesc, // 闅愭偅鎻忚堪
+ createUser: row.createUser, // 涓婃姤浜�
+ createUserName: row.createUserName,
+ createTime: row.createTime, // 涓婃姤鏃堕棿
+ rectifyUserId: row.rectifyUserId, // 鏁存敼璐d换浜�
+ rectifyUserName: row.rectifyUserName,
+ rectifyTime: row.rectifyTime, // 鏁存敼瀹屾垚鏈熼檺
+ rectifyUserMobile: row.rectifyUserMobile, // 鏁存敼璐d换浜烘墜鏈哄彿
+ riskLevel: row.riskLevel, // 闅愭偅椋庨櫓绛夌骇
+ type: row.type, // 闅愭偅绫诲瀷
+ };
+ } else if (type === "edit2") {
+ form.value = {
+ id: row.id,
+ hiddenCode: row.hiddenCode, // 闅愭偅缂栧彿
+ location: row.location, // 闅愭偅浣嶇疆
+ hiddenDesc: row.hiddenDesc, // 闅愭偅鎻忚堪
+ createUser: row.createUser, // 涓婃姤浜�
+ createUserName: row.createUserName,
+ createTime: row.createTime, // 涓婃姤鏃堕棿
+ rectifyUserId: row.rectifyUserId, // 鏁存敼璐d换浜�
+ rectifyUserName: row.rectifyUserName,
+ rectifyTime: row.rectifyTime, // 鏁存敼瀹屾垚鏈熼檺
+ rectifyUserMobile: row.rectifyUserMobile, // 鏁存敼璐d换浜烘墜鏈哄彿
+ riskLevel: row.riskLevel, // 闅愭偅椋庨櫓绛夌骇
+ type: row.type, // 闅愭偅绫诲瀷
+ };
+ form2.value = {
+ rectifyActualTime: row.rectifyActualTime, // 瀹為檯鏁存敼瀹屾垚鏃堕棿
+ rectifyMeasures: row.rectifyMeasures, // 鏁存敼鍏蜂綋鎺柦
+ };
+ } else if (type === "edit3") {
+ form.value = {
+ id: row.id,
+ hiddenCode: row.hiddenCode, // 闅愭偅缂栧彿
+ location: row.location, // 闅愭偅浣嶇疆
+ hiddenDesc: row.hiddenDesc, // 闅愭偅鎻忚堪
+ createUser: row.createUser, // 涓婃姤浜�
+ createUserName: row.createUserName,
+ createTime: row.createTime, // 涓婃姤鏃堕棿
+ rectifyUserId: row.rectifyUserId, // 鏁存敼璐d换浜�
+ rectifyUserName: row.rectifyUserName,
+ rectifyTime: row.rectifyTime, // 鏁存敼瀹屾垚鏈熼檺
+ rectifyUserMobile: row.rectifyUserMobile, // 鏁存敼璐d换浜烘墜鏈哄彿
+ riskLevel: row.riskLevel, // 闅愭偅椋庨櫓绛夌骇
+ type: row.type, // 闅愭偅绫诲瀷
+ };
+ form2.value = {
+ rectifyActualTime: row.rectifyActualTime, // 瀹為檯鏁存敼瀹屾垚鏃堕棿
+ rectifyMeasures: row.rectifyMeasures, // 鏁存敼鍏蜂綋鎺柦
+ };
+ form3.value = {
+ verifyTime: row.verifyTime, // 楠屾敹鏃堕棿
+ verifyRemark: row.verifyRemark, // 楠屾敹澶囨敞
+ verifyResult: row.verifyResult, // 楠屾敹鎻忚堪
+ verifyUserId: row.verifyUserId, // 楠屾敹浜�
+ };
+ console.log("form3.value", form3.value);
+ if (!form3.value.verifyUserId || form3.value.verifyUserId === "null") {
+ form3.value.verifyUserId = Number(currentUserId.value); // 楠屾敹浜�
+ }
+ if (!form3.value.verifyTime || form3.value.verifyTime === "null") {
+ form3.value.verifyTime = dayjs().format("YYYY-MM-DD"); // 楠屾敹鎻忚堪
+ }
+ }
+ dialogFormVisible.value = true;
+ };
+ const getCurrentUserInfo = () => {
+ getInfo;
+ };
+ const fetchQuotationList = async () => {
+ quotationLoading.value = true;
+ try {
+ const params = {
+ // 鍏煎鍚庣鍒嗛〉瀛楁锛氳繖閲屾部鐢ㄦ姤浠烽〉闈㈠凡鏈夊彲鐢ㄧ殑瀛楁鍛藉悕
+ currentPage: 1,
+ pageSize: 100,
+ ...quotationSearchForm,
+ status: "閫氳繃",
+ };
+ const res = await getQuotationList(params);
+ quotationList.value = res?.data?.records || [];
+ } finally {
+ quotationLoading.value = false;
+ }
+ };
+
+ // 鎻愪氦琛ㄥ崟
+ const submitForm = () => {
+ console.log("operationType.value", operationType.value);
+
+ if (operationType.value == "add") {
+ proxy.$refs["formRef"].validate(valid => {
+ if (valid) {
+ safeHiddenAdd(form.value).then(res => {
+ proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
+ closeDia();
+ getList();
+ });
+ }
+ });
+ } else if (operationType.value == "edit") {
+ proxy.$refs["formRef"].validate(valid => {
+ if (valid) {
+ safeHiddenUpdate(form.value).then(res => {
+ proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
+ closeDia();
+ getList();
+ });
+ }
+ });
+ } else if (operationType.value == "edit2") {
+ console.log("form2.value", form2.value);
+ proxy.$refs["formRef2"].validate(valid => {
+ if (valid) {
+ safeHiddenUpdate({ ...form2.value, ...form.value }).then(res => {
+ proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
+ closeDia();
+ getList();
+ });
+ }
+ });
+ } else if (operationType.value == "edit3") {
+ proxy.$refs["formRef3"].validate(valid => {
+ if (valid) {
+ safeHiddenUpdate({
+ ...form3.value,
+ ...form2.value,
+ ...form.value,
+ }).then(res => {
+ proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
+ closeDia();
+ getList();
+ });
+ }
+ });
+ }
+ };
+ // 鍏抽棴寮规
+ const closeDia = () => {
+ proxy.resetForm("formRef");
+ proxy.resetForm("formRef2");
+ dialogFormVisible.value = false;
+ };
+ // 鍏抽棴浜у搧寮规
+ const closeProductDia = () => {
+ proxy.resetForm("productFormRef");
+ productFormVisible.value = false;
+ };
+ // 鍒犻櫎
+ const handleDelete = () => {
+ let ids = [];
+ if (selectedRows.value.length > 0) {
+ ids = selectedRows.value.map(item => item.id);
+ } else {
+ proxy.$modal.msgWarning("璇烽�夋嫨鏁版嵁");
+ return;
+ }
+ ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�", "瀵煎嚭", {
+ confirmButtonText: "纭",
+ cancelButtonText: "鍙栨秷",
+ type: "warning",
+ })
+ .then(() => {
+ safeHiddenDel(ids).then(res => {
+ proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
+ getList();
+ });
+ })
+ .catch(() => {
+ proxy.$modal.msg("宸插彇娑�");
+ });
+ };
+
+ /**
+ * 鍒ゆ柇鏄惁鍙互鍙戣揣
+ * 鍙湁鍦ㄤ骇鍝佺姸鎬佹槸鍏呰冻锛屽彂璐х姸鎬佹槸寰呭彂璐у拰瀹℃牳鎷掔粷鐨勬椂鍊欐墠鍙互鍙戣揣
+ * @param row 琛屾暟鎹�
+ */
+ const canShip = row => {
+ // 浜у搧鐘舵�佸繀椤绘槸鍏呰冻锛坅pproveStatus === 1锛�
+ if (row.approveStatus !== 1) {
+ return false;
+ }
+
+ // 鑾峰彇鍙戣揣鐘舵��
+ const shippingStatus = row.shippingStatus;
+
+ // 濡傛灉宸插彂璐э紙鏈夊彂璐ф棩鏈熸垨杞︾墝鍙凤級锛屼笉鑳藉啀娆″彂璐�
+ if (row.shippingDate || row.shippingCarNumber) {
+ return false;
+ }
+
+ // 鍙戣揣鐘舵�佸繀椤绘槸"寰呭彂璐�"鎴�"瀹℃牳鎷掔粷"
+ const statusStr = shippingStatus ? String(shippingStatus).trim() : "";
+ return statusStr === "寰呭彂璐�" || statusStr === "瀹℃牳鎷掔粷";
+ };
+
+ /**
+ * 涓嬭浇鏂囦欢
+ *
+ * @param row 涓嬭浇鏂囦欢鐨勭浉鍏充俊鎭璞�
+ */
+ const fileListRef = ref(null);
+ const fileListDialogVisible = ref(false);
+ const currentFileRow = ref(null);
+ const downLoadFile = row => {
+ currentFileRow.value = row;
+ fileListPage({ safeHiddenId: row.id }).then(res => {
+ if (fileListRef.value) {
+ fileListRef.value.open(res.data.records);
+ }
+ });
+ };
+ const currentUserId = ref("");
+ const currentUserName = ref("");
+ const getCurrentFactoryName = async () => {
+ let res = await userStore.getInfo();
+ currentUserId.value = res.user.userId;
+ currentUserName.value = res.user.nickName;
+ };
+
+ /**
+ * 鑾峰彇琛岀被鍚嶏紝鐢ㄤ簬鍒ゆ柇鏄惁杩囨湡鏈暣鏀�
+ * @param row 琛屾暟鎹�
+ * @returns 绫诲悕
+ */
+ const getRowClass = ({ row }) => {
+ const now = new Date();
+
+ // 妫�鏌ユ槸鍚﹁秴杩囨暣鏀规湡闄愪笖鏈疄闄呮暣鏀�
+ if (row.rectifyTime && !row.rectifyActualTime) {
+ const rectifyTime = new Date(row.rectifyTime);
+ if (now > rectifyTime) {
+ return "overdue-row";
+ }
+ }
+
+ return "";
+ };
+
+ onMounted(() => {
+ getList();
+ userListNoPage().then(res => {
+ userList.value = res.data;
+ });
+ getCurrentFactoryName();
+ });
+ // 涓婁紶闄勪欢
+ const handleUpload = async () => {
+ if (!currentFileRow.value) {
+ proxy.$modal.msgWarning("璇峰厛閫夋嫨鏁版嵁");
+ return null;
+ }
+
+ return new Promise(resolve => {
+ // 鍒涘缓涓�涓殣钘忕殑鏂囦欢杈撳叆鍏冪礌
+ const input = document.createElement("input");
+ input.type = "file";
+ input.style.display = "none";
+ input.onchange = async e => {
+ const file = e.target.files[0];
+ if (!file) {
+ resolve(null);
+ return;
+ }
+
+ try {
+ // 浣跨敤 FormData 涓婁紶鏂囦欢
+ const formData = new FormData();
+ formData.append("file", file);
+
+ const uploadRes = await request({
+ url: "/file/upload",
+ method: "post",
+ data: formData,
+ headers: {
+ "Content-Type": "multipart/form-data",
+ Authorization: `Bearer ${getToken()}`,
+ },
+ });
+
+ if (uploadRes.code === 200) {
+ // 淇濆瓨闄勪欢淇℃伅
+ const fileData = {
+ safeHiddenId: currentFileRow.value.id,
+ name: uploadRes.data.originalName || file.name,
+ url: uploadRes.data.tempPath || uploadRes.data.url,
+ };
+
+ const saveRes = await safeHiddenFileAdd(fileData);
+ if (saveRes.code === 200) {
+ proxy.$modal.msgSuccess("鏂囦欢涓婁紶鎴愬姛");
+ // 閲嶆柊鍔犺浇鏂囦欢鍒楄〃
+ const listRes = await fileListPage({
+ safeHiddenId: currentFileRow.value.id,
+ });
+ if (listRes.code === 200 && fileListRef.value) {
+ const fileList = (listRes.data?.records || []).map(item => ({
+ name: item.name,
+ url: item.url,
+ id: item.id,
+ ...item,
+ }));
+ fileListRef.value.setList(fileList);
+ }
+ // 杩斿洖鏂版枃浠朵俊鎭�
+ resolve({
+ name: fileData.name,
+ url: fileData.url,
+ id: saveRes.data?.id,
+ });
+ } else {
+ proxy.$modal.msgError(saveRes.msg || "鏂囦欢淇濆瓨澶辫触");
+ resolve(null);
+ }
+ } else {
+ proxy.$modal.msgError(uploadRes.msg || "鏂囦欢涓婁紶澶辫触");
+ resolve(null);
+ }
+ } catch (error) {
+ proxy.$modal.msgError("鏂囦欢涓婁紶澶辫触");
+ resolve(null);
+ } finally {
+ document.body.removeChild(input);
+ }
+ };
+
+ document.body.appendChild(input);
+ input.click();
+ });
+ };
+ // 鍒犻櫎闄勪欢
+ const handleFileDelete = async row => {
+ try {
+ const res = await safeHiddenFileDel([row.id]);
+ if (res.code === 200) {
+ proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
+ // 閲嶆柊鍔犺浇鏂囦欢鍒楄〃
+ if (currentFileRow.value && fileListRef.value) {
+ const listRes = await fileListPage({
+ safeHiddenId: currentFileRow.value.id,
+ });
+ if (listRes.code === 200) {
+ const fileList = (listRes.data?.records || []).map(item => ({
+ name: item.name,
+ url: item.url,
+ id: item.id,
+ ...item,
+ }));
+ fileListRef.value.setList(fileList);
+ }
+ }
+ return true; // 杩斿洖 true 琛ㄧず鍒犻櫎鎴愬姛锛岀粍浠朵細鏇存柊鍒楄〃
+ } else {
+ proxy.$modal.msgError(res.msg || "鍒犻櫎澶辫触");
+ return false;
+ }
+ } catch (error) {
+ proxy.$modal.msgError("鍒犻櫎澶辫触");
+ return false;
+ }
+ };
+</script>
+
+<style scoped lang="scss">
+ .ml-10 {
+ margin-left: 10px;
+ }
+
+ .table_list {
+ margin-top: unset;
+ }
+
+ :deep(.warning-row) {
+ background-color: #fef0f0 !important;
+ }
+
+ :deep(.warning-row td) {
+ // color: #cf1322 !important;
+ }
+
+ :deep(.overdue-row) {
+ background-color: #ffffff !important;
+ }
+
+ :deep(.overdue-row td) {
+ color: #e1707a !important;
+ }
+
+ .actions {
+ display: flex;
+ justify-content: space-between;
+ margin-bottom: 10px;
+ }
+ .print-preview-dialog {
+ .el-dialog__body {
+ padding: 0;
+ max-height: 80vh;
+ overflow-y: auto;
+ }
+ }
+
+ .print-preview-container {
+ .print-preview-header {
+ padding: 15px;
+ border-bottom: 1px solid #e4e7ed;
+ text-align: center;
+
+ .el-button {
+ margin: 0 10px;
+ }
+ }
+
+ .print-preview-content {
+ padding: 20px;
+ background-color: #f5f5f5;
+ min-height: 400px;
+ }
+ }
+
+ .print-page {
+ width: 220mm;
+ height: 90mm;
+ padding: 10mm;
+ margin: 0 auto;
+ background: white;
+ box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
+ margin-bottom: 10px;
+ box-sizing: border-box;
+ }
+
+ .delivery-note {
+ width: 100%;
+ height: 100%;
+ font-family: "SimSun", serif;
+ font-size: 10px;
+ line-height: 1.2;
+ display: flex;
+ flex-direction: column;
+ }
+
+ .header {
+ text-align: center;
+ margin-bottom: 8px;
+
+ .company-name {
+ font-size: 18px;
+ font-weight: bold;
+ margin-bottom: 4px;
+ }
+
+ .document-title {
+ font-size: 16px;
+ font-weight: bold;
+ }
+ }
+
+ .info-section {
+ margin-bottom: 8px;
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+
+ .info-row {
+ line-height: 20px;
+
+ .label {
+ font-weight: bold;
+ width: 60px;
+ font-size: 14px;
+ }
+
+ .value {
+ margin-right: 20px;
+ min-width: 80px;
+ font-size: 14px;
+ }
+ }
+ }
+
+ .table-section {
+ margin-bottom: 4px;
+ flex: 1;
+
+ .product-table {
+ width: 100%;
+ border-collapse: collapse;
+ border: 1px solid #000;
+
+ th,
+ td {
+ border: 1px solid #000;
+ padding: 6px;
+ text-align: center;
+ font-size: 14px;
+ line-height: 1.4;
+ }
+
+ th {
+ font-weight: bold;
+ }
+
+ .total-label {
+ text-align: right;
+ font-weight: bold;
+ }
+
+ .total-value {
+ font-weight: bold;
+ }
+ }
+ }
+
+ .footer-section {
+ .footer-row {
+ display: flex;
+ margin-bottom: 3px;
+ line-height: 20px;
+ justify-content: space-between;
+
+ .footer-item {
+ display: flex;
+ margin-right: 20px;
+
+ .label {
+ font-weight: bold;
+ width: 80px;
+ font-size: 14px;
+ }
+
+ .value {
+ min-width: 80px;
+ font-size: 14px;
+ }
+
+ &.address-item {
+ .address-value {
+ min-width: 200px;
+ }
+ }
+ }
+ }
+ }
+
+ @media print {
+ .app-container {
+ display: none;
+ }
+
+ .print-page {
+ box-shadow: none;
+ margin: 0;
+ padding: 10mm;
+ padding-left: 20mm;
+ page-break-inside: avoid;
+ page-break-after: always;
+ }
+ .print-page:last-child {
+ page-break-after: avoid;
+ }
+ }
+</style>
diff --git a/src/views/safeProduction/hazardousMaterialsControl/index.vue b/src/views/safeProduction/hazardousMaterialsControl/index.vue
new file mode 100644
index 0000000..63d9a5b
--- /dev/null
+++ b/src/views/safeProduction/hazardousMaterialsControl/index.vue
@@ -0,0 +1,889 @@
+<template>
+ <div class="app-container">
+ <div class="search_form">
+ <div>
+ <span class="search_title">鍗遍櫓婧愬悕绉帮細</span>
+ <el-input v-model="searchForm.name"
+ style="width: 240px"
+ placeholder="璇疯緭鍏ュ嵄闄╂簮鍚嶇О鎼滅储"
+ @change="handleQuery"
+ clearable
+ :prefix-icon="Search" />
+ <span class="search_title ml10">鍗遍櫓婧愮被鍨嬶細</span>
+ <el-select v-model="searchForm.type"
+ clearable
+ @change="handleQuery"
+ style="width: 240px">
+ <el-option v-for="item in knowledgeTypeOptions"
+ :key="item.value"
+ :label="item.label"
+ :value="item.value" />
+ </el-select>
+ <el-button type="primary"
+ @click="handleQuery"
+ style="margin-left: 10px">
+ 鎼滅储
+ </el-button>
+ </div>
+ <div>
+ <el-button type="primary"
+ @click="openForm('add')">鍘婚鐢�</el-button>
+ <el-button type="danger"
+ plain
+ @click="handleDelete">鍒犻櫎</el-button>
+ </div>
+ </div>
+ <div class="table_list">
+ <PIMTable rowKey="id"
+ :column="tableColumn"
+ :tableData="tableData"
+ :page="page"
+ :isSelection="true"
+ @selection-change="handleSelectionChange"
+ :tableLoading="tableLoading"
+ @pagination="pagination1"
+ :total="page.total"></PIMTable>
+ </div>
+ <!-- 鏂板/缂栬緫鐭ヨ瘑寮圭獥 -->
+ <el-dialog v-model="dialogVisible"
+ :title="dialogTitle"
+ width="800px"
+ :close-on-click-modal="false">
+ <el-form ref="formRef"
+ v-if="dialogType === 'add'"
+ :model="form"
+ :rules="rules"
+ label-width="120px">
+ <el-row :gutter="20">
+ <el-col :span="12">
+ <el-form-item label="鍗遍櫓婧�"
+ prop="safeHazardId">
+ <el-input v-model="valueItem.name"
+ readonly
+ @click="openSafeHazardSelect"
+ placeholder="璇烽�夋嫨鍗遍櫓婧�" />
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="鎵�鍦ㄤ綅缃�"
+ prop="location">
+ <el-input v-model="valueItem.location"
+ disabled
+ placeholder="鑷姩甯﹀嚭" />
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row :gutter="20">
+ <el-col :span="12">
+ <el-form-item label="鍗遍櫓婧愮被鍨�"
+ prop="type">
+ <el-input v-model="valueItem.type"
+ disabled
+ placeholder="鑷姩甯﹀嚭" />
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="椋庨櫓绛夌骇"
+ prop="riskLevel">
+ <el-input v-model="valueItem.riskLevel"
+ disabled
+ placeholder="鑷姩甯﹀嚭" />
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row :gutter="20">
+ <el-col :span="12">
+ <el-form-item label="搴撳瓨鏁伴噺"
+ prop="stockQty">
+ <el-input v-model="valueItem.stockQty"
+ disabled
+ placeholder="鑷姩甯﹀嚭" />
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row :gutter="20">
+ <el-col :span="12">
+ <el-form-item label="棰嗙敤鐢ㄩ��"
+ prop="applyPurpose">
+ <el-input v-model="form.applyPurpose"
+ placeholder="璇疯緭鍏ラ鐢ㄧ敤閫�" />
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="棰嗙敤鏁伴噺"
+ prop="applyQty">
+ <el-input v-model="form.applyQty"
+ type="number"
+ min="0"
+ @input="handleApplyQtyChange"
+ placeholder="璇疯緭鍏ラ鐢ㄦ暟閲�" />
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row :gutter="20">
+ <el-col :span="12">
+ <el-form-item label="棰嗙敤浜�"
+ prop="applyUserId">
+ <el-select v-model="form.applyUserId"
+ disabled
+ placeholder="璇烽�夋嫨"
+ clearable>
+ <el-option v-for="item in userList"
+ :key="item.userId"
+ :label="item.nickName"
+ :value="item.userId" />
+ </el-select>
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="棰嗙敤鏃堕棿"
+ prop="applyTime">
+ <el-date-picker style="width: 100%"
+ disabled
+ v-model="form.applyTime"
+ value-format="YYYY-MM-DD"
+ format="YYYY-MM-DD"
+ type="date"
+ placeholder="璇烽�夋嫨"
+ clearable />
+ </el-form-item>
+ </el-col>
+ </el-row>
+ </el-form>
+ <el-descriptions :column="2"
+ style="margin-bottom: 20px"
+ v-if="dialogType === 'edit' || dialogType === 'view'"
+ border>
+ <el-descriptions-item label="鍗遍櫓婧愮紪鐮�">
+ <span>{{ form.code }}</span>
+ </el-descriptions-item>
+ <el-descriptions-item label="鍗遍櫓婧愬悕绉�">
+ <span>{{ form.name }}</span>
+ </el-descriptions-item>
+ <el-descriptions-item label="鍗遍櫓婧愮被鍨�">
+ <span>{{ getTypeLabel(form.type) }}</span>
+ </el-descriptions-item>
+ <el-descriptions-item label="鎵�鍦ㄤ綅缃�">
+ <span>{{ form.location }}</span>
+ </el-descriptions-item>
+ <el-descriptions-item label="椋庨櫓绛夌骇">
+ <el-tag :type="getTypeTagType(form.riskLevel)">
+ {{ form.riskLevel }}
+ </el-tag>
+ </el-descriptions-item>
+ <el-descriptions-item label="棰嗙敤鐢ㄩ��">
+ <span>{{ form.applyPurpose }}</span>
+ </el-descriptions-item>
+ <el-descriptions-item label="棰嗙敤鏃堕棿">
+ <span>{{ form.applyTime }}</span>
+ </el-descriptions-item>
+ <el-descriptions-item label="棰嗙敤鏁伴噺">
+ <span>{{ form.applyQty }}</span>
+ </el-descriptions-item>
+ <el-descriptions-item label="棰嗙敤浜�">
+ <span>{{ form.applyUserName }}</span>
+ </el-descriptions-item>
+ <el-descriptions-item v-if="dialogType === 'view' && form.returnUserId"
+ label="褰掕繕浜�">
+ <span>{{ form.returnUserName }}</span>
+ </el-descriptions-item>
+ <el-descriptions-item v-if="dialogType === 'view' && form.returnTime"
+ label="褰掕繕鏃堕棿">
+ <span>{{ form.returnTime }}</span>
+ </el-descriptions-item>
+ <el-descriptions-item v-if="dialogType === 'view' && form.returnUserId"
+ label="褰掕繕鎯呭喌璇存槑">
+ <span>{{ form.returnRemark }}</span>
+ </el-descriptions-item>
+ </el-descriptions>
+ <el-form ref="formRef1"
+ v-if="dialogType === 'edit'"
+ :model="form"
+ :rules="rules1"
+ label-width="120px">
+ <el-row :gutter="20">
+ <el-col :span="12">
+ <el-form-item label="褰掕繕浜�"
+ prop="returnUserId">
+ <el-select v-model="form.returnUserId"
+ disabled
+ placeholder="璇烽�夋嫨"
+ clearable>
+ <el-option v-for="item in userList"
+ :key="item.userId"
+ :label="item.nickName"
+ :value="item.userId" />
+ </el-select>
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="褰掕繕鏃堕棿"
+ prop="returnTime">
+ <el-date-picker style="width: 100%"
+ disabled
+ v-model="form.returnTime"
+ value-format="YYYY-MM-DD"
+ format="YYYY-MM-DD"
+ type="date"
+ placeholder="璇烽�夋嫨"
+ clearable />
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-form-item label="褰掕繕鎯呭喌璇存槑"
+ prop="applyPurpose">
+ <el-input v-model="form.returnRemark"
+ type="textarea"
+ :rows="4"
+ placeholder="璇疯緭鍏ュ綊杩樻儏鍐佃鏄�" />
+ </el-form-item>
+ </el-form>
+ <template #footer>
+ <span class="dialog-footer">
+ <el-button @click="dialogVisible = false">鍙栨秷</el-button>
+ <el-button type="primary"
+ @click="submitForm">纭畾</el-button>
+ </span>
+ </template>
+ </el-dialog>
+ <!-- 鍗遍櫓婧愰�夋嫨寮圭獥 -->
+ <el-dialog v-model="safeHazardSelectVisible"
+ title="閫夋嫨鍗遍櫓婧�"
+ width="800px"
+ :close-on-click-modal="false">
+ <div>
+ <el-table :data="safeHazardList"
+ border
+ v-loading="safeHazardLoading"
+ style="width: 100%"
+ @row-click="handleSafeHazardSelect">
+ <el-table-column prop="code"
+ label="鍗遍櫓婧愮紪鐮�"
+ width="180"
+ show-overflow-tooltip />
+ <el-table-column prop="name"
+ label="鍗遍櫓婧愬悕绉�"
+ show-overflow-tooltip />
+ <el-table-column prop="type"
+ label="鍗遍櫓婧愮被鍨�"
+ width="120"
+ show-overflow-tooltip>
+ <template #default="scope">
+ {{ getTypeLabel(scope.row.type) }}
+ </template>
+ </el-table-column>
+ <el-table-column prop="location"
+ label="鎵�鍦ㄤ綅缃�"
+ width="180"
+ show-overflow-tooltip />
+ <el-table-column prop="riskLevel"
+ label="椋庨櫓绛夌骇"
+ width="100">
+ <template #default="scope">
+ <el-tag :type="getTypeTagType(scope.row.riskLevel)">
+ {{ scope.row.riskLevel }}
+ </el-tag>
+ </template>
+ </el-table-column>
+ <el-table-column prop="stockQty"
+ label="搴撳瓨鏁伴噺"
+ width="100" />
+ </el-table>
+ <pagination :total="safeHazardPage.total"
+ style="margin-top: 20px"
+ layout="total, sizes, prev, pager, next, jumper"
+ :page="safeHazardPage.current"
+ :limit="safeHazardPage.size"
+ @pagination="safeHazardPagination" />
+ </div>
+ <template #footer>
+ <span class="dialog-footer">
+ <el-button @click="safeHazardSelectVisible = false">鍙栨秷</el-button>
+ </span>
+ </template>
+ </el-dialog>
+ </div>
+</template>
+
+<script setup>
+ import { Search } from "@element-plus/icons-vue";
+ import {
+ onMounted,
+ ref,
+ reactive,
+ toRefs,
+ getCurrentInstance,
+ computed,
+ } from "vue";
+ import { ElMessage, ElMessageBox } from "element-plus";
+ import PIMTable from "@/components/PIMTable/PIMTable.vue";
+ import pagination from "@/components/PIMTable/Pagination.vue";
+ import { userListNoPage } from "@/api/system/user.js";
+ import { safeHazardListPage } from "@/api/safeProduction/hazardSourceLedger.js";
+ import {
+ safeHazardRecordListPage,
+ safeHazardRecordDel,
+ safeHazardRecordAdd,
+ safeHazardRecordUpdate,
+ } from "@/api/safeProduction/hazardousMaterialsControl.js";
+ import dayjs from "dayjs";
+ import useUserStore from "@/store/modules/user";
+ const userStore = useUserStore();
+ // 琛ㄥ崟楠岃瘉瑙勫垯
+ const rules = {
+ applyPurpose: [
+ { required: true, message: "璇疯緭鍏ラ鐢ㄧ敤閫�", trigger: "blur" },
+ ],
+ applyQty: [{ required: true, message: "璇疯緭鍏ラ鐢ㄦ暟閲�", trigger: "blur" }],
+ safeHazardId: [
+ { required: true, message: "璇烽�夋嫨鍗遍櫓婧�", trigger: "change" },
+ ],
+ };
+ const rules1 = {
+ returnRemark: [
+ { required: true, message: "璇疯緭鍏ュ綊杩樻儏鍐佃鏄�", trigger: "blur" },
+ ],
+ };
+ // 鍝嶅簲寮忔暟鎹�
+ const data = reactive({
+ searchForm: {
+ name: "",
+ type: "",
+ },
+ tableLoading: false,
+ page: {
+ current: 1,
+ size: 20,
+ total: 0,
+ },
+ tableData: [],
+ selectedIds: [],
+ form: {
+ applyPurpose: "", // 棰嗙敤鐢ㄩ��
+ applyTime: "", // 棰嗙敤鏃堕棿
+ applyQty: "", // 棰嗙敤鏁伴噺
+ applyUserId: "", // 棰嗙敤浜篒D
+ safeHazardId: "", // 鍗遍櫓婧怚D
+ },
+ dialogVisible: false,
+ dialogTitle: "",
+ dialogType: "add",
+ viewDialogVisible: false,
+ currentKnowledge: {},
+ safeHazardSelectVisible: false,
+ safeHazardList: [],
+ safeHazardLoading: false,
+ safeHazardPage: {
+ current: 1,
+ size: 10,
+ total: 0,
+ },
+ });
+
+ const {
+ searchForm,
+ tableLoading,
+ page,
+ tableData,
+ selectedIds,
+ form,
+ dialogVisible,
+ dialogTitle,
+ dialogType,
+ viewDialogVisible,
+ currentKnowledge,
+ safeHazardSelectVisible,
+ safeHazardList,
+ safeHazardLoading,
+ safeHazardPage,
+ } = toRefs(data);
+ const valueItem = ref({});
+
+ // 琛ㄥ崟寮曠敤
+ const formRef = ref();
+ const formRef1 = ref();
+ const riskLevelOptions = ref([
+ { value: "浣庨闄�", label: "浣庨闄�" },
+ { value: "涓�鑸闄�", label: "涓�鑸闄�" },
+ { value: "杈冨ぇ椋庨櫓", label: "杈冨ぇ椋庨櫓" },
+ { value: "閲嶅ぇ椋庨櫓", label: "閲嶅ぇ椋庨櫓" },
+ ]);
+
+ // 琛ㄦ牸鍒楅厤缃�
+ const tableColumn = ref([
+ {
+ label: "鍗遍櫓婧愮紪鐮�",
+ prop: "code",
+ showOverflowTooltip: true,
+ },
+ {
+ label: "鍗遍櫓婧愬悕绉�",
+ prop: "name",
+ showOverflowTooltip: true,
+ },
+ {
+ label: "鍗遍櫓婧愮被鍨�",
+ prop: "type",
+ showOverflowTooltip: true,
+ formatData: params => {
+ return getTypeLabel(params);
+ },
+ },
+ {
+ label: "椋庨櫓绛夌骇",
+ prop: "riskLevel",
+ showOverflowTooltip: true,
+ dataType: "tag",
+ formatType: params => {
+ const typeMap = {
+ 浣庨闄�: "info",
+ 涓�鑸闄�: "info",
+ 杈冨ぇ椋庨櫓: "warning",
+ 閲嶅ぇ椋庨櫓: "danger",
+ };
+ return typeMap[params] || "info";
+ },
+ },
+ {
+ label: "棰嗙敤鐢ㄩ��",
+ prop: "applyPurpose",
+ showOverflowTooltip: true,
+ },
+ {
+ label: "棰嗙敤鏃堕棿",
+ prop: "applyTime",
+ showOverflowTooltip: true,
+ },
+ {
+ label: "棰嗙敤鏁伴噺",
+ prop: "applyQty",
+ showOverflowTooltip: true,
+ },
+ {
+ label: "褰掕繕鏃堕棿",
+ prop: "returnTime",
+ showOverflowTooltip: true,
+ },
+ {
+ label: "褰掕繕浜�",
+ prop: "returnUserName",
+ showOverflowTooltip: true,
+ },
+ {
+ label: "褰掕繕鎯呭喌璇存槑",
+ prop: "returnRemark",
+ showOverflowTooltip: true,
+ },
+ {
+ label: "鎵�鍦ㄤ綅缃�",
+ prop: "location",
+ showOverflowTooltip: true,
+ },
+ {
+ label: "鍗曞彿",
+ prop: "materialRecordCode",
+ showOverflowTooltip: true,
+ },
+ {
+ dataType: "action",
+ label: "鎿嶄綔",
+ align: "center",
+ fixed: "right",
+ width: 200,
+ operation: [
+ {
+ name: "褰掕繕",
+ type: "text",
+ clickFun: row => {
+ openForm("edit", row);
+ },
+ disabled: row => row.returnUserId,
+ },
+ {
+ name: "鏌ョ湅",
+ type: "text",
+ clickFun: row => {
+ openForm("view", row);
+ },
+ },
+ ],
+ },
+ ]);
+ const userList = ref([]);
+ // 鐢熷懡鍛ㄦ湡
+ onMounted(() => {
+ getCurrentFactoryName();
+ getList();
+ startAutoRefresh();
+ userListNoPage().then(res => {
+ userList.value = res.data;
+ });
+ });
+ const currentUserId = ref("");
+ const currentUserName = ref("");
+ const getCurrentFactoryName = async () => {
+ let res = await userStore.getInfo();
+ currentUserId.value = res.user.userId;
+ currentUserName.value = res.user.nickName;
+ };
+
+ // 澶勭悊鐢ㄦ埛閫夋嫨鍙樺寲
+ const handleUserChange = userId => {
+ const selectedUser = userList.value.find(user => user.userId === userId);
+ if (selectedUser) {
+ form.value.principalUser = selectedUser.nickName;
+ form.value.principalMobile = selectedUser.phonenumber;
+ }
+ };
+ const handleApplyQtyChange = () => {
+ if (form.value.applyQty > valueItem.value.stockQty) {
+ ElMessage.error("棰嗙敤鏁伴噺涓嶈兘澶т簬搴撳瓨鏁伴噺");
+ form.value.applyQty = "";
+ }
+ };
+
+ // 寮�濮嬭嚜鍔ㄥ埛鏂�
+ const startAutoRefresh = () => {
+ setInterval(() => {
+ getList();
+ }, 600000); // 10鍒嗛挓鍒锋柊涓�娆� (10 * 60 * 1000 = 600000ms)
+ };
+
+ // 鏌ヨ鏁版嵁
+ const handleQuery = () => {
+ page.value.current = 1;
+ getList();
+ };
+
+ const getList = () => {
+ tableLoading.value = true;
+ safeHazardRecordListPage({ ...page.value, ...searchForm.value })
+ .then(res => {
+ tableLoading.value = false;
+ tableData.value = res.data.records;
+ page.value.total = res.data.total;
+ })
+ .catch(err => {
+ tableLoading.value = false;
+ });
+ };
+ const openSafeHazardSelect = async () => {
+ await fetchSafeHazardList();
+ safeHazardSelectVisible.value = true;
+ };
+
+ const fetchSafeHazardList = () => {
+ safeHazardLoading.value = true;
+ return safeHazardListPage({
+ page: safeHazardPage.value.current,
+ size: safeHazardPage.value.size,
+ })
+ .then(res => {
+ safeHazardList.value = res.data.records;
+ safeHazardPage.value.total = res.data.total;
+ })
+ .finally(() => {
+ safeHazardLoading.value = false;
+ });
+ };
+
+ const handleSafeHazardSelect = item => {
+ valueItem.value = {
+ ...item,
+ };
+ valueItem.value.type = getTypeLabel(valueItem.value.type);
+ form.value.safeHazardId = item.id;
+ safeHazardSelectVisible.value = false;
+ };
+
+ const safeHazardPagination = obj => {
+ safeHazardPage.value.current = obj.page;
+ safeHazardPage.value.size = obj.limit;
+ fetchSafeHazardList();
+ };
+
+ // 鍒嗛〉澶勭悊
+ const pagination1 = obj => {
+ page.value.current = obj.page;
+ page.value.size = obj.limit;
+ handleQuery();
+ };
+
+ // 閫夋嫨鍙樺寲澶勭悊
+ const handleSelectionChange = selection => {
+ selectedIds.value = selection.map(item => item.id);
+ };
+
+ // 鎵撳紑琛ㄥ崟
+ const openForm = (type, row = null) => {
+ dialogType.value = type;
+ if (type === "add") {
+ dialogTitle.value = "棰嗙敤鍗遍櫓婧�";
+ // 閲嶇疆琛ㄥ崟
+ form.value = {};
+ Object.assign(form.value, {
+ applyPurpose: "", // 棰嗙敤鐢ㄩ��
+ applyTime: dayjs().format("YYYY-MM-DD"), // 棰嗙敤鏃堕棿
+ applyQty: "", // 棰嗙敤鏁伴噺
+ applyUserId: currentUserId.value, // 棰嗙敤浜篒D
+ safeHazardId: "", // 鍗遍櫓婧怚D
+ });
+ valueItem.value = {};
+ } else if (type === "edit" && row) {
+ dialogTitle.value = "褰掕繕";
+ Object.assign(form.value, {
+ id: row.id, // 涓婚敭ID
+ materialRecordCode: row.materialRecordCode, // 鍗曞彿
+ applyPurpose: row.applyPurpose, // 棰嗙敤鐢ㄩ��
+ applyTime: row.applyTime, // 棰嗙敤鏃堕棿
+ applyQty: row.applyQty, // 棰嗙敤鏁伴噺
+ applyUserId: row.applyUserId, // 棰嗙敤浜篒D
+ safeHazardId: row.safeHazardId, // 鍗遍櫓婧怚D
+ applyUserName: row.applyUserName, // 棰嗙敤浜哄鍚�
+ code: row.code, // 鍗遍櫓婧愮紪鐮�
+ name: row.name, // 鍗遍櫓婧愬悕绉�
+ type: row.type, // 鍗遍櫓婧愮被鍨�
+ location: row.location, // 鎵�鍦ㄤ綅缃�
+ riskLevel: row.riskLevel, // 椋庨櫓绛夌骇
+ type: row.type, // 鍗遍櫓婧愮被鍨�
+ returnTime: dayjs().format("YYYY-MM-DD"), // 褰掕繕鏃堕棿
+ returnUserName: "", // 褰掕繕浜哄鍚�
+ returnUserId: currentUserId.value, // 褰掕繕浜篒D
+ returnRemark: "", // 褰掕繕鎯呭喌璇存槑
+ });
+ } else if (type === "view") {
+ dialogTitle.value = "鏌ョ湅";
+ form.value = { ...row };
+ }
+ dialogVisible.value = true;
+ };
+
+ // 鏌ョ湅鍗遍櫓婧愯鎯�
+ const viewKnowledge = row => {
+ currentKnowledge.value = { ...row };
+ viewDialogVisible.value = true;
+ };
+
+ // 鑾峰彇绫诲瀷鏍囩绫诲瀷
+ const getTypeTagType = type => {
+ const typeMap = {
+ 杈冨ぇ椋庨櫓: "warning",
+ 浣庨闄�: "info",
+ 涓�鑸闄�: "info",
+ 閲嶅ぇ椋庨櫓: "danger",
+ };
+ return typeMap[type] || "info";
+ };
+
+ // 鑾峰彇绫诲瀷鏍囩鏂囨湰
+ const getTypeLabel = type => {
+ return getKnowledgeTypeLabel(type);
+ };
+
+ // 鑾峰彇鏁堢巼鏍囩绫诲瀷
+ const getEfficiencyTagType = efficiency => {
+ const typeMap = {
+ high: "success",
+ medium: "warning",
+ low: "info",
+ };
+ return typeMap[efficiency] || "info";
+ };
+
+ // 鑾峰彇鏁堢巼鏍囩鏂囨湰
+ const getEfficiencyLabel = efficiency => {
+ const efficiencyMap = {
+ high: "鏄捐憲鎻愬崌",
+ medium: "涓�鑸彁鍗�",
+ low: "杞诲井鎻愬崌",
+ };
+ return efficiencyMap[efficiency] || efficiency;
+ };
+
+ // 鑾峰彇鏁堢巼鎻愬崌鐧惧垎姣�
+ const getEfficiencyScore = efficiency => {
+ const scoreMap = {
+ high: 40,
+ medium: 25,
+ low: 15,
+ };
+ return scoreMap[efficiency] || 0;
+ };
+
+ // 鑾峰彇骞冲潎鑺傜渷鏃堕棿
+ const getTimeSaved = efficiency => {
+ const timeMap = {
+ high: "2-3澶�",
+ medium: "1-2澶�",
+ low: "0.5-1澶�",
+ };
+ return timeMap[efficiency] || "鏈煡";
+ };
+
+ // 鎻愪氦鍗遍櫓婧愯〃鍗�
+ const submitForm = async () => {
+ try {
+ if (dialogType.value === "add") {
+ await formRef.value.validate();
+ safeHazardRecordAdd({ ...form.value })
+ .then(res => {
+ if (res.code == 200) {
+ ElMessage.success("娣诲姞鎴愬姛");
+ dialogVisible.value = false;
+ getList();
+ }
+ })
+ .catch(err => {
+ ElMessage.error(err.msg);
+ });
+ } else {
+ await formRef1.value.validate();
+ safeHazardRecordUpdate({ ...form.value })
+ .then(res => {
+ if (res.code == 200) {
+ ElMessage.success("鏇存柊鎴愬姛");
+ dialogVisible.value = false;
+ getList();
+ }
+ })
+ .catch(err => {
+ ElMessage.error(err.msg);
+ });
+ }
+ } catch (error) {
+ console.error("琛ㄥ崟楠岃瘉澶辫触:", error);
+ }
+ };
+
+ // 鍒犻櫎鍗遍櫓婧愯褰�
+ const handleDelete = () => {
+ if (selectedIds.value.length === 0) {
+ ElMessage.warning("璇烽�夋嫨瑕佸垹闄ょ殑璁板綍");
+ return;
+ }
+
+ ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�", "鍒犻櫎", {
+ confirmButtonText: "纭",
+ cancelButtonText: "鍙栨秷",
+ type: "warning",
+ })
+ .then(() => {
+ // console.log(selectedIds.value);
+ safeHazardRecordDel(selectedIds.value).then(res => {
+ if (res.code == 200) {
+ ElMessage.success("鍒犻櫎鎴愬姛");
+ selectedIds.value = [];
+ getList();
+ }
+ });
+ })
+ .catch(() => {
+ // 鐢ㄦ埛鍙栨秷
+ });
+ };
+
+ // 瀵煎嚭
+ const { proxy } = getCurrentInstance();
+ const { hazard_source_type } = proxy.useDict("hazard_source_type");
+
+ // 瀛楀吀宸ュ叿
+ const knowledgeTypeOptions = computed(() => hazard_source_type?.value || []);
+ const getKnowledgeTypeLabel = val => {
+ const item = knowledgeTypeOptions.value.find(
+ i => String(i.value) === String(val)
+ );
+ return item ? item.label : val;
+ };
+ const getKnowledgeTypeTagType = val => {
+ const item = knowledgeTypeOptions.value.find(
+ i => String(i.value) === String(val)
+ );
+ return item?.elTagType || "info";
+ };
+ const handleExport = () => {
+ proxy.download(
+ "/knowledgeBase/export",
+ { ...searchForm.value },
+ "鐭ヨ瘑搴�.xlsx"
+ );
+ };
+</script>
+
+<style scoped>
+ .auto-refresh-info {
+ margin-bottom: 15px;
+ }
+
+ .auto-refresh-info .el-alert {
+ border-radius: 8px;
+ }
+
+ .dialog-footer {
+ text-align: right;
+ }
+
+ .knowledge-detail {
+ padding: 20px 0;
+ }
+
+ .detail-title {
+ font-size: 18px;
+ font-weight: bold;
+ color: #303133;
+ }
+
+ .detail-section {
+ margin-top: 24px;
+ }
+
+ .detail-section h4 {
+ margin: 0 0 12px 0;
+ font-size: 16px;
+ font-weight: 600;
+ color: #303133;
+ border-left: 4px solid #409eff;
+ padding-left: 12px;
+ }
+
+ .detail-content {
+ background: #f8f9fa;
+ padding: 16px;
+ border-radius: 6px;
+ line-height: 1.6;
+ color: #606266;
+ white-space: pre-wrap;
+ }
+
+ .key-points {
+ display: flex;
+ flex-wrap: wrap;
+ gap: 8px;
+ }
+
+ .usage-stats {
+ margin-top: 16px;
+ }
+
+ .stat-item {
+ text-align: center;
+ padding: 20px;
+ background: #f8f9fa;
+ border-radius: 8px;
+ }
+
+ .stat-number {
+ font-size: 24px;
+ font-weight: bold;
+ color: #409eff;
+ margin-bottom: 8px;
+ }
+
+ .stat-label {
+ font-size: 14px;
+ color: #909399;
+ }
+
+ :deep(.danger-row td) {
+ color: #e95a66 !important;
+ }
+</style>
diff --git a/src/views/safeProduction/safeQualifications/index.vue b/src/views/safeProduction/safeQualifications/index.vue
index 8bf320b..d7c41f9 100644
--- a/src/views/safeProduction/safeQualifications/index.vue
+++ b/src/views/safeProduction/safeQualifications/index.vue
@@ -82,7 +82,11 @@
show-overflow-tooltip />
<el-table-column label="瑙勭▼璧勮川绫诲瀷"
prop="type"
- show-overflow-tooltip />
+ show-overflow-tooltip>
+ <template #default="scope">
+ {{ type_qualification.find(item => item.value === scope.row.type)?.label || '-' }}
+ </template>
+ </el-table-column>
<el-table-column label="鐗堟湰鍙�"
prop="version"
width="180"
diff --git a/src/views/safeProduction/safeWorkApproval/components/approvalDia.vue b/src/views/safeProduction/safeWorkApproval/components/approvalDia.vue
new file mode 100644
index 0000000..8d40a2e
--- /dev/null
+++ b/src/views/safeProduction/safeWorkApproval/components/approvalDia.vue
@@ -0,0 +1,530 @@
+<template>
+ <div>
+ <el-dialog v-model="dialogFormVisible"
+ :title="operationType === 'approval' ? '瀹℃壒' : '璇︽儏'"
+ width="700px"
+ @close="closeDia">
+ <el-form :model="form"
+ label-width="140px"
+ label-position="top"
+ ref="formRef">
+ <el-row>
+ <el-col :span="24">
+ <el-form-item label="娴佺▼缂栧彿锛�"
+ prop="approveId">
+ <el-input v-model="form.approveId"
+ placeholder="鑷姩缂栧彿"
+ clearable
+ disabled />
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row>
+ <el-col :span="24">
+ <el-form-item label="鐢宠閮ㄩ棬锛�">
+ <el-select disabled
+ v-model="form.approveDeptId"
+ placeholder="閫夋嫨閮ㄩ棬">
+ <el-option v-for="user in productOptions"
+ :key="user.deptId"
+ :label="user.deptName"
+ :value="user.deptId" />
+ </el-select>
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row v-if="!isQuotationApproval && !isPurchaseApproval">
+ <el-col :span="24">
+ <el-form-item :label="props.approveType == 5 ? '閲囪喘鍚堝悓鍙凤細' : '瀹℃壒浜嬬敱锛�'"
+ prop="approveReason">
+ <el-input v-model="form.approveReason"
+ placeholder="璇疯緭鍏�"
+ clearable
+ type="textarea"
+ disabled />
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <!-- 瀹℃壒浜洪�夋嫨锛堝姩鎬佽妭鐐癸級 -->
+ <el-row :gutter="30">
+ <el-col :span="12">
+ <el-form-item label="鐢宠浜猴細"
+ prop="approveUser">
+ <el-select v-model="form.approveUser"
+ placeholder="閫夋嫨浜哄憳"
+ disabled>
+ <el-option v-for="user in userList"
+ :key="user.userId"
+ :label="user.nickName"
+ :value="user.userId" />
+ </el-select>
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="鐢宠鏃ユ湡锛�"
+ prop="approveTime">
+ <el-date-picker v-model="form.approveTime"
+ type="date"
+ placeholder="璇烽�夋嫨鏃ユ湡"
+ value-format="YYYY-MM-DD"
+ format="YYYY-MM-DD"
+ clearable
+ style="width: 100%"
+ disabled />
+ </el-form-item>
+ </el-col>
+ </el-row>
+ </el-form>
+ <!-- 鎶ヤ环瀹℃壒锛氬睍绀烘姤浠疯鎯咃紙澶嶇敤閿�鍞姤浠�"鏌ョ湅璇︽儏瀵硅瘽妗�"鍐呭缁撴瀯锛� -->
+ <div v-if="isQuotationApproval"
+ style="margin: 10px 0 18px;">
+ <el-divider content-position="left">鎶ヤ环璇︽儏</el-divider>
+ <el-skeleton :loading="quotationLoading"
+ animated>
+ <template #template>
+ <el-skeleton-item variant="h3"
+ style="width: 30%" />
+ <el-skeleton-item variant="text"
+ style="width: 100%" />
+ <el-skeleton-item variant="text"
+ style="width: 100%" />
+ </template>
+ <template #default>
+ <el-empty v-if="!currentQuotation || !currentQuotation.quotationNo"
+ description="鏈煡璇㈠埌瀵瑰簲鎶ヤ环璇︽儏" />
+ <template v-else>
+ <el-descriptions :column="2"
+ border>
+ <el-descriptions-item label="鎶ヤ环鍗曞彿">{{ currentQuotation.quotationNo }}</el-descriptions-item>
+ <el-descriptions-item label="瀹㈡埛鍚嶇О">{{ currentQuotation.customer }}</el-descriptions-item>
+ <el-descriptions-item label="涓氬姟鍛�">{{ currentQuotation.salesperson }}</el-descriptions-item>
+ <el-descriptions-item label="鎶ヤ环鏃ユ湡">{{ currentQuotation.quotationDate }}</el-descriptions-item>
+ <el-descriptions-item label="鏈夋晥鏈熻嚦">{{ currentQuotation.validDate }}</el-descriptions-item>
+ <el-descriptions-item label="浠樻鏂瑰紡">{{ currentQuotation.paymentMethod }}</el-descriptions-item>
+ <el-descriptions-item label="鎶ヤ环鎬婚"
+ :span="2">
+ <span style="font-size: 18px; color: #e6a23c; font-weight: bold;">
+ 楼{{ Number(currentQuotation.totalAmount ?? 0).toFixed(2) }}
+ </span>
+ </el-descriptions-item>
+ </el-descriptions>
+ <div style="margin-top: 20px;">
+ <h4>浜у搧鏄庣粏</h4>
+ <el-table :data="currentQuotation.products || []"
+ border
+ style="width: 100%">
+ <el-table-column prop="product"
+ label="浜у搧鍚嶇О" />
+ <el-table-column prop="specification"
+ label="瑙勬牸鍨嬪彿" />
+ <el-table-column prop="unit"
+ label="鍗曚綅" />
+ <el-table-column prop="unitPrice"
+ label="鍗曚环">
+ <template #default="scope">楼{{ Number(scope.row.unitPrice ?? 0).toFixed(2) }}</template>
+ </el-table-column>
+ </el-table>
+ </div>
+ <div v-if="currentQuotation.remark"
+ style="margin-top: 20px;">
+ <h4>澶囨敞</h4>
+ <p>{{ currentQuotation.remark }}</p>
+ </div>
+ </template>
+ </template>
+ </el-skeleton>
+ </div>
+ <!-- 閲囪喘瀹℃壒锛氬睍绀洪噰璐鎯� -->
+ <div v-if="isPurchaseApproval"
+ style="margin: 10px 0 18px;">
+ <el-divider content-position="left">閲囪喘璇︽儏</el-divider>
+ <el-skeleton :loading="purchaseLoading"
+ animated>
+ <template #template>
+ <el-skeleton-item variant="h3"
+ style="width: 30%" />
+ <el-skeleton-item variant="text"
+ style="width: 100%" />
+ <el-skeleton-item variant="text"
+ style="width: 100%" />
+ </template>
+ <template #default>
+ <el-empty v-if="!currentPurchase || !currentPurchase.purchaseContractNumber"
+ description="鏈煡璇㈠埌瀵瑰簲閲囪喘璇︽儏" />
+ <template v-else>
+ <el-descriptions :column="2"
+ border>
+ <el-descriptions-item label="閲囪喘鍚堝悓鍙�">{{ currentPurchase.purchaseContractNumber }}</el-descriptions-item>
+ <el-descriptions-item label="渚涘簲鍟嗗悕绉�">{{ currentPurchase.supplierName }}</el-descriptions-item>
+ <el-descriptions-item label="椤圭洰鍚嶇О">{{ currentPurchase.projectName }}</el-descriptions-item>
+ <el-descriptions-item label="閿�鍞悎鍚屽彿">{{ currentPurchase.salesContractNo }}</el-descriptions-item>
+ <el-descriptions-item label="绛捐鏃ユ湡">{{ currentPurchase.executionDate }}</el-descriptions-item>
+ <el-descriptions-item label="褰曞叆鏃ユ湡">{{ currentPurchase.entryDate }}</el-descriptions-item>
+ <el-descriptions-item label="浠樻鏂瑰紡">{{ currentPurchase.paymentMethod }}</el-descriptions-item>
+ <el-descriptions-item label="鍚堝悓閲戦"
+ :span="2">
+ <span style="font-size: 18px; color: #e6a23c; font-weight: bold;">
+ 楼{{ Number(currentPurchase.contractAmount ?? 0).toFixed(2) }}
+ </span>
+ </el-descriptions-item>
+ </el-descriptions>
+ <div style="margin-top: 20px;">
+ <h4>浜у搧鏄庣粏</h4>
+ <el-table :data="currentPurchase.productData || []"
+ border
+ style="width: 100%">
+ <el-table-column prop="productCategory"
+ label="浜у搧鍚嶇О" />
+ <el-table-column prop="specificationModel"
+ label="瑙勬牸鍨嬪彿" />
+ <el-table-column prop="unit"
+ label="鍗曚綅" />
+ <el-table-column prop="quantity"
+ label="鏁伴噺" />
+ <el-table-column prop="taxInclusiveUnitPrice"
+ label="鍚◣鍗曚环">
+ <template #default="scope">楼{{ Number(scope.row.taxInclusiveUnitPrice ?? 0).toFixed(2) }}</template>
+ </el-table-column>
+ <el-table-column prop="taxInclusiveTotalPrice"
+ label="鍚◣鎬讳环">
+ <template #default="scope">楼{{ Number(scope.row.taxInclusiveTotalPrice ?? 0).toFixed(2) }}</template>
+ </el-table-column>
+ </el-table>
+ </div>
+ </template>
+ </template>
+ </el-skeleton>
+ </div>
+ <el-form :model="{ activities }"
+ ref="formRef"
+ label-position="top">
+ <el-steps :active="getActiveStep()"
+ finish-status="success"
+ process-status="process"
+ align-center
+ direction="vertical">
+ <el-step v-for="(activity, index) in activities"
+ :key="index"
+ finish-status="success"
+ :title="getNodeTitle(index, activities.length)"
+ :description="activity.approveNodeUser"
+ :icon="getNodeIcon(activity, index)">
+ <template #icon>
+ <el-icon v-if="activity.approveNodeStatus === 2"
+ color="red"
+ :size="22">
+ <WarningFilled />
+ </el-icon>
+ <el-icon v-else-if="activity.isShen"
+ color="#1890ff"
+ :size="22">
+ <Edit />
+ </el-icon>
+ <el-icon v-else-if="activity.approveNodeStatus === 1"
+ color="#67C23A"
+ :size="26">
+ <Check />
+ </el-icon>
+ <el-icon v-else
+ color="#C0C4CC"
+ :size="22">
+ <MoreFilled />
+ </el-icon>
+ </template>
+ <template #title>
+ <span style="color: #000000">{{ getNodeTitle(index, activities.length) }}</span>
+ </template>
+ <template #description>
+ <div class="node-user">
+ <div class="avatar-wrapper">
+ <img :src="userStore.avatar"
+ class="user-avatar"
+ alt="" />
+ </div>
+ <span style="color: #000000">{{ activity.approveNodeUser }}-{{activity.isApproval}}</span>
+ </div>
+ <div v-if="!activity.isShen"
+ class="node-reason">
+ <span>瀹℃壒鎰忚锛�</span>{{ activity.approveNodeReason }}
+ </div>
+ <div v-if="!activity.isShen"
+ class="node-reason">
+ <span>绛惧悕锛�</span>
+ <img :src="activity.urlTem"
+ class="signImg"
+ alt=""
+ v-if="activity.urlTem" />
+ </div>
+ <div v-else-if="activity.isShen">
+ <el-form-item :prop="'activities.' + index + '.approveNodeReason'"
+ :rules="[{ required: true, message: '瀹℃壒鎰忚涓嶈兘涓虹┖', trigger: 'blur' }]">
+ <el-input v-model="activity.approveNodeReason"
+ clearable
+ type="textarea"
+ :disabled="operationType === 'view'"></el-input>
+ </el-form-item>
+ </div>
+ </template>
+ </el-step>
+ </el-steps>
+ </el-form>
+ <template #footer
+ v-if="operationType === 'approval'">
+ <div class="dialog-footer">
+ <el-button type="primary"
+ @click="submitForm(2)">涓嶉�氳繃</el-button>
+ <el-button type="primary"
+ @click="submitForm(1)">閫氳繃</el-button>
+ <el-button @click="closeDia">鍙栨秷</el-button>
+ </div>
+ </template>
+ </el-dialog>
+ </div>
+</template>
+
+<script setup>
+ import {
+ computed,
+ getCurrentInstance,
+ nextTick,
+ reactive,
+ ref,
+ toRefs,
+ } from "vue";
+ import {
+ approveProcessDetails,
+ getDept,
+ updateApproveNode,
+ } from "@/api/collaborativeApproval/approvalProcess.js";
+ import useUserStore from "@/store/modules/user.js";
+ import { userListNoPageByTenantId } from "@/api/system/user.js";
+ import {
+ WarningFilled,
+ Edit,
+ Check,
+ MoreFilled,
+ } from "@element-plus/icons-vue";
+ import { getQuotationList } from "@/api/salesManagement/salesQuotation.js";
+ import { getPurchaseByCode } from "@/api/procurementManagement/procurementLedger.js";
+ const emit = defineEmits(["close"]);
+ const { proxy } = getCurrentInstance();
+
+ const props = defineProps({
+ approveType: {
+ type: [Number, String],
+ default: 0,
+ },
+ });
+
+ const dialogFormVisible = ref(false);
+ const operationType = ref("");
+ const activities = ref([]);
+ const formRef = ref(null);
+ const userStore = useUserStore();
+ const productOptions = ref([]);
+ const userList = ref([]);
+ const quotationLoading = ref(false);
+ const currentQuotation = ref({});
+ const purchaseLoading = ref(false);
+ const currentPurchase = ref({});
+ const isQuotationApproval = computed(() => Number(props.approveType) === 6);
+ const isPurchaseApproval = computed(() => Number(props.approveType) === 5);
+
+ const data = reactive({
+ form: {
+ approveTime: "",
+ approveId: "",
+ approveUser: "",
+ approveDeptId: "",
+ approveReason: "",
+ checkResult: "",
+ },
+ });
+ const { form } = toRefs(data);
+
+ // 鑺傜偣鏍囬
+ const getNodeTitle = (index, len) => {
+ if (index === len - 1) return "缁撴潫";
+ return "瀹℃壒";
+ };
+
+ // 鑾峰彇褰撳墠婵�娲绘楠�
+ const getActiveStep = () => {
+ // 濡傛灉鎵�鏈� isShen 閮戒负 false锛岃繑鍥炴渶鍚庝竴涓楠わ紙鍏ㄩ儴瀹屾垚锛�
+ const hasActive = activities.value.some(a => a.isShen === true);
+ if (!hasActive) return activities.value.length;
+ // 褰撳墠鑺傜偣绱㈠紩
+ return activities.value.findIndex(a => a.isShen == true);
+ };
+ // 姝ラicon
+ const getNodeIcon = (activity, index) => {
+ if (activity.approveNodeStatus === 2) return "el-icon-warning"; // 涓嶉�氳繃
+ if (activity.isShen) return "Edit";
+ return "";
+ };
+
+ // 鎵撳紑寮规
+ const openDialog = (type, row) => {
+ operationType.value = type;
+ dialogFormVisible.value = true;
+ currentQuotation.value = {};
+ currentPurchase.value = {};
+ userListNoPageByTenantId().then(res => {
+ userList.value = res.data;
+ });
+ form.value = { ...row };
+ // 绔嬪嵆娓呴櫎琛ㄥ崟楠岃瘉鐘舵�侊紙鍥犱负瀛楁鏄痙isabled鐨勶紝涓嶉渶瑕侀獙璇侊級
+ nextTick(() => {
+ if (formRef.value) {
+ formRef.value.clearValidate();
+ }
+ });
+ // 纭繚閫夐」鍔犺浇瀹屾垚鍚庡啀鍖归厤鍊肩被鍨�
+ getProductOptions().then(() => {
+ // 纭繚鍊肩被鍨嬪尮閰嶏紙濡傛灉閫夐」宸插姞杞斤級
+ if (productOptions.value.length > 0 && form.value.approveDeptId) {
+ const matchedOption = productOptions.value.find(
+ opt =>
+ opt.deptId == form.value.approveDeptId ||
+ String(opt.deptId) === String(form.value.approveDeptId)
+ );
+ if (matchedOption) {
+ form.value.approveDeptId = matchedOption.deptId;
+ }
+ }
+ // 鍐嶆娓呴櫎楠岃瘉锛岀‘淇濋�夐」鍔犺浇鍚庡�煎尮閰嶆纭�
+ nextTick(() => {
+ if (formRef.value) {
+ formRef.value.clearValidate();
+ }
+ });
+ });
+
+ // 鎶ヤ环瀹℃壒锛氱敤瀹℃壒浜嬬敱瀛楁鎵胯浇鐨�"鎶ヤ环鍗曞彿"鍘绘煡鎶ヤ环鍒楄〃
+ if (isQuotationApproval.value) {
+ const quotationNo = row?.approveReason;
+ if (quotationNo) {
+ quotationLoading.value = true;
+ getQuotationList({ quotationNo })
+ .then(res => {
+ const records = res?.data?.records || [];
+ currentQuotation.value = records[0] || {};
+ })
+ .finally(() => {
+ quotationLoading.value = false;
+ });
+ }
+ }
+
+ // 閲囪喘瀹℃壒锛氱敤瀹℃壒浜嬬敱瀛楁鎵胯浇鐨�"閲囪喘鍚堝悓鍙�"鍘绘煡閲囪喘璇︽儏
+ if (isPurchaseApproval.value) {
+ const purchaseContractNumber = row?.approveReason;
+ if (purchaseContractNumber) {
+ purchaseLoading.value = true;
+ getPurchaseByCode({ purchaseContractNumber })
+ .then(res => {
+ currentPurchase.value = res;
+ })
+ .catch(err => {
+ console.error("鏌ヨ閲囪喘璇︽儏澶辫触:", err);
+ proxy.$modal.msgError("鏌ヨ閲囪喘璇︽儏澶辫触");
+ })
+ .finally(() => {
+ purchaseLoading.value = false;
+ });
+ }
+ }
+
+ approveProcessDetails(row.approveId).then(res => {
+ activities.value = res.data;
+ // 澧炲姞isApproval瀛楁
+ activities.value.forEach(item => {
+ if (item.url && item.url.includes("word")) {
+ item.urlTem = item.url.replaceAll("word", "img");
+ } else {
+ item.urlTem = item.url;
+ }
+ if (item.approveNodeStatus === 2) {
+ item.isApproval = "宸查┏鍥�";
+ } else if (item.approveNodeStatus === 1) {
+ item.isApproval = "宸插悓鎰�";
+ } else {
+ item.isApproval = "鏈鎵�";
+ }
+ });
+ });
+ };
+ const getProductOptions = () => {
+ return getDept().then(res => {
+ productOptions.value = res.data;
+ });
+ };
+ // 鎻愪氦瀹℃壒
+ const submitForm = status => {
+ const filteredActivities = activities.value.filter(
+ activity => activity.isShen
+ );
+ if (!filteredActivities || filteredActivities.length === 0) {
+ proxy.$modal.msgError("鏈壘鍒板緟瀹℃壒鐨勮妭鐐�");
+ return;
+ }
+ const currentActivity = filteredActivities[0];
+ if (!currentActivity) {
+ proxy.$modal.msgError("鏈壘鍒板緟瀹℃壒鐨勮妭鐐�");
+ return;
+ }
+ currentActivity.approveNodeStatus = status;
+ // 鍒ゆ柇鏄惁涓烘渶鍚庝竴姝�
+ const isLast =
+ activities.value.findIndex(a => a.isShen) === activities.value.length - 1;
+ updateApproveNode({ ...currentActivity, isLast }).then(() => {
+ proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
+ closeDia();
+ });
+ };
+ // 鍏抽棴寮规
+ const closeDia = () => {
+ proxy.resetForm("formRef");
+ dialogFormVisible.value = false;
+ quotationLoading.value = false;
+ currentQuotation.value = {};
+ purchaseLoading.value = false;
+ currentPurchase.value = {};
+ emit("close");
+ };
+ defineExpose({
+ openDialog,
+ });
+</script>
+
+<style scoped>
+ .node-user {
+ margin: 10px 0;
+ font-size: 16px;
+ font-weight: 600;
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ }
+ .node-status {
+ color: #1890ff;
+ margin-left: 8px;
+ font-size: 14px;
+ }
+ .node-reason {
+ font-size: 15px;
+ color: #333;
+ margin: 10px 0;
+ }
+ .user-avatar {
+ cursor: pointer;
+ width: 30px;
+ height: 30px;
+ border-radius: 50px;
+ }
+ .signImg {
+ cursor: pointer;
+ width: 200px;
+ height: 60px;
+ }
+</style>
\ No newline at end of file
diff --git a/src/views/safeProduction/safeWorkApproval/components/infoFormDia.vue b/src/views/safeProduction/safeWorkApproval/components/infoFormDia.vue
new file mode 100644
index 0000000..02b728e
--- /dev/null
+++ b/src/views/safeProduction/safeWorkApproval/components/infoFormDia.vue
@@ -0,0 +1,486 @@
+<template>
+ <div>
+ <el-dialog v-model="dialogFormVisible"
+ :title="operationType === 'add' ? '鏂板瀹℃壒娴佺▼' : '缂栬緫瀹℃壒娴佺▼'"
+ width="50%"
+ @close="closeDia">
+ <el-form :model="form"
+ label-width="140px"
+ label-position="top"
+ :rules="rules"
+ ref="formRef">
+ <el-row>
+ <el-col :span="24">
+ <el-form-item label="娴佺▼缂栧彿锛�"
+ prop="approveId">
+ <el-input v-model="form.approveId"
+ placeholder="鑷姩缂栧彿"
+ clearable
+ disabled />
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row>
+ <el-col :span="24">
+ <el-form-item label="鐢宠閮ㄩ棬锛�"
+ prop="approveDeptName">
+ <!-- <el-input v-model="form.approveDeptName" placeholder="璇疯緭鍏�" clearable/>-->
+ <el-select v-model="form.approveDeptId"
+ placeholder="閫夋嫨閮ㄩ棬"
+ @change="handleDeptChange">
+ <el-option v-for="user in productOptions"
+ :key="user.deptId"
+ :label="user.deptName"
+ :value="user.deptId" />
+ </el-select>
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row>
+ <el-col :span="24">
+ <el-form-item :label="props.approveType == 5 ? '閲囪喘鍚堝悓鍙凤細' : '瀹℃壒浜嬬敱锛�'"
+ prop="approveReason">
+ <el-input v-model="form.approveReason"
+ placeholder="璇疯緭鍏�"
+ clearable
+ type="textarea" />
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <!-- 璇峰亣鏃堕棿锛堜粎褰� approveType 涓� 2 鏃舵樉绀猴級 -->
+ <el-row :gutter="30"
+ v-if="props.approveType == 2">
+ <el-col :span="12">
+ <el-form-item label="璇峰亣寮�濮嬫椂闂达細"
+ prop="startDate">
+ <el-date-picker v-model="form.startDate"
+ type="date"
+ placeholder="璇烽�夋嫨寮�濮嬫棩鏈�"
+ value-format="YYYY-MM-DD"
+ format="YYYY-MM-DD"
+ clearable
+ style="width: 100%" />
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="璇峰亣缁撴潫鏃堕棿锛�"
+ prop="endDate">
+ <el-date-picker v-model="form.endDate"
+ type="date"
+ placeholder="璇烽�夋嫨缁撴潫鏃ユ湡"
+ value-format="YYYY-MM-DD"
+ format="YYYY-MM-DD"
+ clearable
+ style="width: 100%" />
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <!-- 鎶ラ攢閲戦锛堜粎褰� approveType 涓� 4 鏃舵樉绀猴級 -->
+ <el-row v-if="props.approveType == 4">
+ <el-col :span="24">
+ <el-form-item label="鎶ラ攢閲戦锛�"
+ prop="price">
+ <el-input-number v-model="form.price"
+ placeholder="璇疯緭鍏ユ姤閿�閲戦"
+ :min="0"
+ :precision="2"
+ :step="0.01"
+ style="width: 100%"
+ clearable />
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <!-- 鍑哄樊鍦扮偣锛堜粎褰� approveType 涓� 3 鏃舵樉绀猴級 -->
+ <el-row v-if="props.approveType == 3">
+ <el-col :span="24">
+ <el-form-item label="鍑哄樊鍦扮偣锛�"
+ prop="location">
+ <el-input v-model="form.location"
+ placeholder="璇疯緭鍏ュ嚭宸湴鐐�"
+ clearable />
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <!-- 瀹℃壒浜洪�夋嫨锛堝姩鎬佽妭鐐癸級 -->
+ <el-row>
+ <el-col :span="24">
+ <el-form-item>
+ <template #label>
+ <span>瀹℃壒浜洪�夋嫨锛�</span>
+ <el-button type="primary"
+ @click="addApproverNode"
+ style="margin-left: 8px;">鏂板鑺傜偣</el-button>
+ </template>
+ <div style="display: flex; align-items: flex-end; flex-wrap: wrap;">
+ <div v-for="(node, index) in approverNodes"
+ :key="node.id"
+ style="margin-right: 30px; text-align: center; margin-bottom: 10px;">
+ <div>
+ <span>瀹℃壒浜�</span>
+ 鈫�
+ </div>
+ <el-select v-model="node.userId"
+ placeholder="閫夋嫨浜哄憳"
+ style="width: 120px; margin-bottom: 8px;">
+ <el-option v-for="user in userList"
+ :key="user.userId"
+ :label="user.nickName"
+ :value="user.userId" />
+ </el-select>
+ <div>
+ <el-button type="danger"
+ size="small"
+ @click="removeApproverNode(index)"
+ v-if="approverNodes.length > 1">鍒犻櫎</el-button>
+ </div>
+ </div>
+ </div>
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row :gutter="30">
+ <el-col :span="12">
+ <el-form-item label="鐢宠浜猴細"
+ prop="approveUser">
+ <el-select v-model="form.approveUser"
+ placeholder="閫夋嫨浜哄憳"
+ filterable
+ default-first-option
+ :reserve-keyword="false">
+ <el-option v-for="user in userList"
+ :key="user.userId"
+ :label="user.nickName"
+ :value="user.userId" />
+ </el-select>
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="鐢宠鏃ユ湡锛�"
+ prop="approveTime">
+ <el-date-picker v-model="form.approveTime"
+ type="date"
+ placeholder="璇烽�夋嫨鏃ユ湡"
+ value-format="YYYY-MM-DD"
+ format="YYYY-MM-DD"
+ clearable
+ style="width: 100%" />
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row :gutter="30">
+ <el-col :span="24">
+ <el-form-item label="闄勪欢鏉愭枡锛�"
+ prop="remark">
+ <el-upload v-model:file-list="fileList"
+ :action="upload.url"
+ multiple
+ ref="fileUpload"
+ auto-upload
+ :headers="upload.headers"
+ :before-upload="handleBeforeUpload"
+ :on-error="handleUploadError"
+ :on-success="handleUploadSuccess"
+ :on-remove="handleRemove">
+ <el-button type="primary"
+ v-if="operationType !== 'view'">涓婁紶</el-button>
+ <template #tip
+ v-if="operationType !== 'view'">
+ <div class="el-upload__tip">
+ 鏂囦欢鏍煎紡鏀寔
+ doc锛宒ocx锛寈ls锛寈lsx锛宲pt锛宲ptx锛宲df锛宼xt锛寈ml锛宩pg锛宩peg锛宲ng锛実if锛宐mp锛宺ar锛寊ip锛�7z
+ </div>
+ </template>
+ </el-upload>
+ </el-form-item>
+ </el-col>
+ </el-row>
+ </el-form>
+ <template #footer>
+ <div class="dialog-footer">
+ <el-button type="primary"
+ @click="submitForm">纭</el-button>
+ <el-button @click="closeDia">鍙栨秷</el-button>
+ </div>
+ </template>
+ </el-dialog>
+ </div>
+</template>
+
+<script setup>
+ import { ref, reactive, toRefs, getCurrentInstance } from "vue";
+ import {
+ approveProcessAdd,
+ approveProcessGetInfo,
+ approveProcessUpdate,
+ getDept,
+ } from "@/api/collaborativeApproval/approvalProcess.js";
+ import { delLedgerFile } from "@/api/salesManagement/salesLedger.js";
+ import { userListNoPageByTenantId } from "@/api/system/user.js";
+ import { getToken } from "@/utils/auth";
+ const { proxy } = getCurrentInstance();
+ const emit = defineEmits(["close"]);
+ import useUserStore from "@/store/modules/user";
+ import { getCurrentDate } from "@/utils/index.js";
+ import log from "@/views/monitor/job/log.vue";
+ const userStore = useUserStore();
+
+ const dialogFormVisible = ref(false);
+ const operationType = ref("");
+ const fileList = ref([]);
+ const upload = reactive({
+ // 涓婁紶鐨勫湴鍧�
+ url: import.meta.env.VITE_APP_BASE_API + "/file/upload",
+ // 璁剧疆涓婁紶鐨勮姹傚ご閮�
+ headers: { Authorization: "Bearer " + getToken() },
+ });
+ const data = reactive({
+ form: {
+ approveTime: "",
+ approveId: "",
+ approveUser: "",
+ approveDeptId: "",
+ approveDeptName: "",
+ approveReason: "",
+ checkResult: "",
+ tempFileIds: [],
+ approverList: [], // 鏂板瀛楁锛屽瓨鍌ㄦ墍鏈夎妭鐐圭殑瀹℃壒浜篿d
+ startDate: "", // 璇峰亣寮�濮嬫椂闂�
+ endDate: "", // 璇峰亣缁撴潫鏃堕棿
+ price: null, // 鎶ラ攢閲戦
+ location: "", // 鍑哄樊鍦扮偣
+ },
+ rules: {
+ approveTime: [{ required: false, message: "璇疯緭鍏�", trigger: "change" }],
+ approveId: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }],
+ approveUser: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }],
+ approveDeptName: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
+ approveReason: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
+ checkResult: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }],
+ startDate: [
+ { required: true, message: "璇烽�夋嫨璇峰亣寮�濮嬫椂闂�", trigger: "change" },
+ ],
+ endDate: [
+ { required: true, message: "璇烽�夋嫨璇峰亣缁撴潫鏃堕棿", trigger: "change" },
+ ],
+ price: [{ required: true, message: "璇疯緭鍏ユ姤閿�閲戦", trigger: "blur" }],
+ location: [{ required: true, message: "璇疯緭鍏ュ嚭宸湴鐐�", trigger: "blur" }],
+ },
+ });
+ const { form, rules } = toRefs(data);
+ const productOptions = ref([]);
+ const currentApproveStatus = ref(0);
+ const props = defineProps({
+ approveType: {
+ type: [Number, String],
+ default: 0,
+ },
+ });
+
+ // 瀹℃壒浜鸿妭鐐圭浉鍏�
+ const approverNodes = ref([{ id: 1, userId: null }]);
+ let nextApproverId = 2;
+ const userList = ref([]);
+ function addApproverNode() {
+ approverNodes.value.push({ id: nextApproverId++, userId: null });
+ }
+ function removeApproverNode(index) {
+ approverNodes.value.splice(index, 1);
+ }
+ // 澶勭悊閮ㄩ棬閫夋嫨鍙樺寲
+ const handleDeptChange = deptId => {
+ if (deptId) {
+ const selectedDept = productOptions.value.find(
+ dept => dept.deptId === deptId
+ );
+ if (selectedDept) {
+ form.value.approveDeptName = selectedDept.deptName;
+ }
+ } else {
+ form.value.approveDeptName = "";
+ }
+ };
+ // 鎵撳紑寮规
+ const openDialog = (type, row) => {
+ operationType.value = type;
+ dialogFormVisible.value = true;
+ userListNoPageByTenantId().then(res => {
+ userList.value = res.data;
+ });
+ form.value = {};
+ approverNodes.value = [{ id: 1, userId: null }];
+ form.value.approveUser = userStore.id;
+ form.value.approveTime = getCurrentDate();
+
+ // 鑾峰彇褰撳墠鐢ㄦ埛淇℃伅骞惰缃儴闂↖D
+ form.value.approveDeptId = userStore.currentDeptId;
+
+ // 鍔犺浇閮ㄩ棬閫夐」锛屽苟鍦ㄥ姞杞藉畬鎴愬悗璁剧疆閮ㄩ棬鍚嶇О
+ getProductOptions();
+ if (operationType.value === "edit") {
+ fileList.value = row.commonFileList;
+ form.value.tempFileIds = fileList.value.map(file => file.id);
+ currentApproveStatus.value = row.approveStatus;
+ approveProcessGetInfo({ id: row.approveId, approveReason: "1" }).then(
+ res => {
+ form.value = { ...res.data };
+ // 鍙嶆樉瀹℃壒浜�
+ if (res.data && res.data.approveUserIds) {
+ const userIds = res.data.approveUserIds.split(",");
+ approverNodes.value = userIds.map((userId, idx) => ({
+ id: idx + 1,
+ userId: parseInt(userId.trim()),
+ }));
+ nextApproverId = userIds.length + 1;
+ } else {
+ approverNodes.value = [{ id: 1, userId: null }];
+ nextApproverId = 2;
+ }
+ }
+ );
+ }
+ };
+ const getProductOptions = () => {
+ return getDept().then(res => {
+ productOptions.value = res.data;
+ // 濡傛灉宸叉湁閮ㄩ棬ID锛岃嚜鍔ㄨ缃儴闂ㄥ悕绉帮紙鐢ㄤ簬楠岃瘉锛�
+ if (form.value.approveDeptId && productOptions.value.length > 0) {
+ const matchedDept = productOptions.value.find(
+ dept =>
+ dept.deptId == form.value.approveDeptId ||
+ String(dept.deptId) === String(form.value.approveDeptId)
+ );
+ if (matchedDept) {
+ form.value.approveDeptName = matchedDept.deptName;
+ }
+ }
+ });
+ };
+ function convertIdToValue(data) {
+ return data.map(item => {
+ const { id, children, ...rest } = item;
+ const newItem = {
+ ...rest,
+ value: id, // 灏� id 鏀逛负 value
+ };
+ if (children && children.length > 0) {
+ newItem.children = convertIdToValue(children);
+ }
+
+ return newItem;
+ });
+ }
+ // 鎻愪氦浜у搧琛ㄥ崟
+ const submitForm = () => {
+ // 鏀堕泦鎵�鏈夎妭鐐圭殑瀹℃壒浜篿d
+ form.value.approveUserIds = approverNodes.value
+ .map(node => node.userId)
+ .join(",");
+ form.value.approveType = props.approveType;
+ // 瀹℃壒浜哄繀濉牎楠�
+ const hasEmptyApprover = approverNodes.value.some(node => !node.userId);
+ if (hasEmptyApprover) {
+ proxy.$modal.msgError("璇蜂负鎵�鏈夊鎵硅妭鐐归�夋嫨瀹℃壒浜猴紒");
+ return;
+ }
+ // 褰� approveType 涓� 2 鏃讹紝鏍¢獙璇峰亣鏃堕棿
+ if (props.approveType == 2) {
+ if (!form.value.startDate) {
+ proxy.$modal.msgError("璇烽�夋嫨璇峰亣寮�濮嬫椂闂达紒");
+ return;
+ }
+ if (!form.value.endDate) {
+ proxy.$modal.msgError("璇烽�夋嫨璇峰亣缁撴潫鏃堕棿锛�");
+ return;
+ }
+ // 鏍¢獙缁撴潫鏃堕棿涓嶈兘鏃╀簬寮�濮嬫椂闂�
+ if (new Date(form.value.endDate) < new Date(form.value.startDate)) {
+ proxy.$modal.msgError("璇峰亣缁撴潫鏃堕棿涓嶈兘鏃╀簬寮�濮嬫椂闂达紒");
+ return;
+ }
+ }
+ // 褰� approveType 涓� 3 鏃讹紝鏍¢獙鍑哄樊鍦扮偣
+ if (props.approveType == 3) {
+ if (!form.value.location || form.value.location.trim() === "") {
+ proxy.$modal.msgError("璇疯緭鍏ュ嚭宸湴鐐癸紒");
+ return;
+ }
+ }
+ // 褰� approveType 涓� 4 鏃讹紝鏍¢獙鎶ラ攢閲戦
+ if (props.approveType == 4) {
+ if (!form.value.price || form.value.price <= 0) {
+ proxy.$modal.msgError("璇疯緭鍏ユ湁鏁堢殑鎶ラ攢閲戦锛�");
+ return;
+ }
+ }
+ proxy.$refs.formRef.validate(valid => {
+ if (valid) {
+ if (operationType.value === "add" || currentApproveStatus.value == 3) {
+ approveProcessAdd(form.value).then(res => {
+ proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
+ closeDia();
+ });
+ } else {
+ approveProcessUpdate(form.value).then(res => {
+ proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
+ closeDia();
+ });
+ }
+ }
+ });
+ };
+ // 鍏抽棴寮规
+ const closeDia = () => {
+ fileList.value = [];
+ proxy.resetForm("formRef");
+ dialogFormVisible.value = false;
+ emit("close");
+ };
+
+ // 涓婁紶鍓嶆牎妫�
+ function handleBeforeUpload(file) {
+ // 鏍℃鏂囦欢澶у皬
+ // if (file.size > 1024 * 1024 * 10) {
+ // proxy.$modal.msgError("涓婁紶鏂囦欢澶у皬涓嶈兘瓒呰繃10MB!");
+ // return false;
+ // }
+ proxy.$modal.loading("姝e湪涓婁紶鏂囦欢锛岃绋嶅��...");
+ return true;
+ }
+ // 涓婁紶澶辫触
+ function handleUploadError(err) {
+ proxy.$modal.msgError("涓婁紶鏂囦欢澶辫触");
+ proxy.$modal.closeLoading();
+ }
+ // 涓婁紶鎴愬姛鍥炶皟
+ function handleUploadSuccess(res, file, uploadFiles) {
+ proxy.$modal.closeLoading();
+ if (res.code === 200) {
+ // 纭繚 tempFileIds 瀛樺湪涓斾负鏁扮粍
+ if (!form.value.tempFileIds) {
+ form.value.tempFileIds = [];
+ }
+ form.value.tempFileIds.push(res.data.tempId);
+ proxy.$modal.msgSuccess("涓婁紶鎴愬姛");
+ } else {
+ proxy.$modal.msgError(res.msg);
+ proxy.$refs.fileUpload.handleRemove(file);
+ }
+ }
+ // 绉婚櫎鏂囦欢
+ function handleRemove(file) {
+ if (operationType.value === "edit") {
+ let ids = [];
+ ids.push(file.id);
+ delLedgerFile(ids).then(res => {
+ proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
+ });
+ }
+ }
+
+ defineExpose({
+ openDialog,
+ });
+</script>
+
+<style scoped>
+</style>
\ No newline at end of file
diff --git a/src/views/safeProduction/safeWorkApproval/fileList.vue b/src/views/safeProduction/safeWorkApproval/fileList.vue
new file mode 100644
index 0000000..5cc65f1
--- /dev/null
+++ b/src/views/safeProduction/safeWorkApproval/fileList.vue
@@ -0,0 +1,67 @@
+<template>
+ <el-dialog v-model="dialogVisible" title="闄勪欢" width="40%" :before-close="handleClose" draggable>
+ <el-table :data="tableData" border height="40vh">
+ <el-table-column label="闄勪欢鍚嶇О" prop="name" min-width="400" show-overflow-tooltip />
+ <el-table-column fixed="right" label="鎿嶄綔" width="150" align="center">
+ <template #default="scope">
+ <el-button link type="primary" size="small" @click="downLoadFile(scope.row)">涓嬭浇</el-button>
+ <el-button link type="primary" size="small" @click="lookFile(scope.row)">棰勮</el-button>
+ <el-button link type="danger" size="small" @click="handleDelete(scope.row)">鍒犻櫎</el-button>
+ </template>
+ </el-table-column>
+ </el-table>
+ </el-dialog>
+ <filePreview ref="filePreviewRef" />
+</template>
+
+<script setup>
+import { ref } from 'vue'
+import filePreview from '@/components/filePreview/index.vue'
+import { ElMessageBox, ElMessage } from 'element-plus'
+import { delCommonFile } from '@/api/publicApi/commonFile.js'
+
+const dialogVisible = ref(false)
+const tableData = ref([])
+const { proxy } = getCurrentInstance();
+const filePreviewRef = ref()
+const handleClose = () => {
+ dialogVisible.value = false
+}
+const open = (list) => {
+ dialogVisible.value = true
+ tableData.value = list
+}
+const downLoadFile = (row) => {
+ proxy.$download.name(row.url);
+
+}
+const lookFile = (row) => {
+ filePreviewRef.value.open(row.url)
+}
+// 鍒犻櫎闄勪欢
+const handleDelete = (row) => {
+ ElMessageBox.confirm(`纭鍒犻櫎闄勪欢"${row.name}"鍚楋紵`, '鎻愮ず', {
+ confirmButtonText: '纭畾',
+ cancelButtonText: '鍙栨秷',
+ type: 'warning'
+ }).then(() => {
+ delCommonFile([row.id]).then(() => {
+ ElMessage.success('鍒犻櫎鎴愬姛')
+ // 浠庡垪琛ㄤ腑绉婚櫎宸插垹闄ょ殑闄勪欢
+ const index = tableData.value.findIndex(item => item.id === row.id)
+ if (index !== -1) {
+ tableData.value.splice(index, 1)
+ }
+ }).catch(() => {
+ ElMessage.error('鍒犻櫎澶辫触')
+ })
+ }).catch(() => {
+ ElMessage.info('宸插彇娑堝垹闄�')
+ })
+}
+defineExpose({
+ open
+})
+</script>
+
+<style></style>
\ No newline at end of file
diff --git a/src/views/safeProduction/safeWorkApproval/index.vue b/src/views/safeProduction/safeWorkApproval/index.vue
new file mode 100644
index 0000000..2d8362e
--- /dev/null
+++ b/src/views/safeProduction/safeWorkApproval/index.vue
@@ -0,0 +1,371 @@
+<template>
+ <div class="app-container">
+ <!-- 鏍囩椤靛垏鎹笉鍚岀殑瀹℃壒绫诲瀷 -->
+ <div class="search_form">
+ <div>
+ <span class="search_title">娴佺▼缂栧彿锛�</span>
+ <el-input v-model="searchForm.approveId"
+ style="width: 240px"
+ placeholder="璇疯緭鍏ユ祦绋嬬紪鍙锋悳绱�"
+ @change="handleQuery"
+ clearable
+ :prefix-icon="Search" />
+ <span class="search_title ml10">瀹℃壒鐘舵�侊細</span>
+ <el-select v-model="searchForm.approveStatus"
+ clearable
+ @change="handleQuery"
+ style="width: 240px">
+ <el-option label="寰呭鏍�"
+ :value="0" />
+ <el-option label="瀹℃牳涓�"
+ :value="1" />
+ <el-option label="瀹℃牳瀹屾垚"
+ :value="2" />
+ <el-option label="瀹℃牳鏈�氳繃"
+ :value="3" />
+ <el-option label="宸查噸鏂版彁浜�"
+ :value="4" />
+ </el-select>
+ <el-button type="primary"
+ @click="handleQuery"
+ style="margin-left: 10px">鎼滅储</el-button>
+ </div>
+ <div>
+ <el-button type="primary"
+ @click="openForm('add')">鏂板</el-button>
+ <el-button @click="handleOut">瀵煎嚭</el-button>
+ <el-button type="danger"
+ plain
+ @click="handleDelete">鍒犻櫎</el-button>
+ </div>
+ </div>
+ <div class="table_list">
+ <PIMTable rowKey="id"
+ :column="tableColumnCopy"
+ :tableData="tableData"
+ :page="page"
+ :isSelection="true"
+ @selection-change="handleSelectionChange"
+ :tableLoading="tableLoading"
+ @pagination="pagination"
+ :total="page.total"></PIMTable>
+ </div>
+ <info-form-dia ref="infoFormDia"
+ @close="handleQuery"
+ :approveType="currentApproveType"></info-form-dia>
+ <approval-dia ref="approvalDia"
+ @close="handleQuery"
+ :approveType="currentApproveType"></approval-dia>
+ <FileList ref="fileListRef" />
+ </div>
+</template>
+
+<script setup>
+ import FileList from "./fileList.vue";
+ import { Search } from "@element-plus/icons-vue";
+ import {
+ onMounted,
+ ref,
+ computed,
+ reactive,
+ toRefs,
+ nextTick,
+ getCurrentInstance,
+ } from "vue";
+ import { ElMessageBox } from "element-plus";
+ import { useRoute } from "vue-router";
+ import InfoFormDia from "@/views/collaborativeApproval/approvalProcess/components/infoFormDia.vue";
+ import ApprovalDia from "@/views/collaborativeApproval/approvalProcess/components/approvalDia.vue";
+ import {
+ approveProcessDelete,
+ approveProcessListPage,
+ } from "@/api/collaborativeApproval/approvalProcess.js";
+ import useUserStore from "@/store/modules/user";
+
+ const userStore = useUserStore();
+ const route = useRoute();
+
+ // 褰撳墠瀹℃壒绫诲瀷锛屾牴鎹�変腑鐨勬爣绛鹃〉璁$畻
+ const currentApproveType = computed(() => {
+ return Number(8);
+ });
+
+ // 鏍囩椤靛垏鎹㈠鐞�
+ const handleTabChange = tabName => {
+ // 鍒囨崲鏍囩椤垫椂閲嶇疆鎼滅储鏉′欢鍜屽垎椤碉紝骞堕噸鏂板姞杞芥暟鎹�
+ searchForm.value.approveId = "";
+ searchForm.value.approveStatus = "";
+ page.current = 1;
+ getList();
+ };
+
+ const data = reactive({
+ searchForm: {
+ approveId: "",
+ approveStatus: "",
+ },
+ });
+ const { searchForm } = toRefs(data);
+
+ // 鍔ㄦ�佽〃鏍煎垪閰嶇疆锛屾牴鎹鎵圭被鍨嬬敓鎴愬垪
+ const tableColumnCopy = computed(() => {
+ // 鍩虹鍒楅厤缃�
+ const baseColumns = [
+ {
+ label: "瀹℃壒鐘舵��",
+ prop: "approveStatus",
+ dataType: "tag",
+ width: 100,
+ formatData: params => {
+ if (params == 0) {
+ return "寰呭鏍�";
+ } else if (params == 1) {
+ return "瀹℃牳涓�";
+ } else if (params == 2) {
+ return "瀹℃牳瀹屾垚";
+ } else if (params == 4) {
+ return "宸查噸鏂版彁浜�";
+ } else {
+ return "涓嶉�氳繃";
+ }
+ },
+ formatType: params => {
+ if (params == 0) {
+ return "warning";
+ } else if (params == 1) {
+ return "primary";
+ } else if (params == 2) {
+ return "success";
+ } else if (params == 4) {
+ return "info";
+ } else {
+ return "danger";
+ }
+ },
+ },
+ {
+ label: "娴佺▼缂栧彿",
+ prop: "approveId",
+ width: 170,
+ },
+ {
+ label: "鐢宠閮ㄩ棬",
+ prop: "approveDeptName",
+ width: 220,
+ },
+ {
+ label: "瀹℃壒浜嬬敱",
+ prop: "approveReason",
+ width: 200,
+ },
+ {
+ label: "鐢宠浜�",
+ prop: "approveUserName",
+ width: 120,
+ },
+ ];
+
+ // 鏃ユ湡鍒楋紙鏍规嵁绫诲瀷鍔ㄦ�侀厤缃級
+ baseColumns.push(
+ {
+ label: "鐢宠鏃ユ湡",
+ prop: "approveTime",
+ width: 200,
+ },
+ {
+ label: "缁撴潫鏃ユ湡",
+ prop: "approveOverTime",
+ width: 120,
+ }
+ );
+
+ // 褰撳墠瀹℃壒浜哄垪
+ baseColumns.push({
+ label: "褰撳墠瀹℃壒浜�",
+ prop: "approveUserCurrentName",
+ width: 120,
+ });
+
+ // 鎿嶄綔鍒�
+ baseColumns.push({
+ dataType: "action",
+ label: "鎿嶄綔",
+ align: "center",
+ fixed: "right",
+ width: 230,
+ operation: [
+ {
+ name: "缂栬緫",
+ type: "text",
+ clickFun: row => {
+ openForm("edit", row);
+ },
+ disabled: row =>
+ row.approveStatus == 2 ||
+ row.approveStatus == 1 ||
+ row.approveStatus == 4,
+ },
+ {
+ name: "瀹℃牳",
+ type: "text",
+ clickFun: row => {
+ openApprovalDia("approval", row);
+ },
+ disabled: row =>
+ row.approveUserCurrentId == null ||
+ row.approveStatus == 2 ||
+ row.approveStatus == 3 ||
+ row.approveStatus == 4 ||
+ row.approveUserCurrentId !== userStore.id,
+ },
+ {
+ name: "璇︽儏",
+ type: "text",
+ clickFun: row => {
+ openApprovalDia("view", row);
+ },
+ },
+ {
+ name: "闄勪欢",
+ type: "text",
+ clickFun: row => {
+ downLoadFile(row);
+ },
+ },
+ ],
+ });
+
+ return baseColumns;
+ });
+ const tableData = ref([]);
+ const selectedRows = ref([]);
+ const tableLoading = ref(false);
+ const page = reactive({
+ current: 1,
+ size: 100,
+ total: 0,
+ });
+ const infoFormDia = ref();
+ const approvalDia = ref();
+ const { proxy } = getCurrentInstance();
+
+ // 鏌ヨ鍒楄〃
+ /** 鎼滅储鎸夐挳鎿嶄綔 */
+ const handleQuery = () => {
+ page.current = 1;
+ getList();
+ };
+ const fileListRef = ref(null);
+ const downLoadFile = row => {
+ fileListRef.value.open(row.commonFileList);
+ };
+ const pagination = obj => {
+ page.current = obj.page;
+ page.size = obj.limit;
+ getList();
+ };
+ const getList = () => {
+ tableLoading.value = true;
+ approveProcessListPage({
+ ...page,
+ ...searchForm.value,
+ approveType: currentApproveType.value,
+ })
+ .then(res => {
+ tableLoading.value = false;
+ tableData.value = res.data.records;
+ page.total = res.data.total;
+ })
+ .catch(err => {
+ tableLoading.value = false;
+ });
+ };
+ // 瀵煎嚭
+ const handleOut = () => {
+ const type = currentApproveType.value;
+ const urlMap = {
+ 0: "/approveProcess/exportZero",
+ 1: "/approveProcess/exportOne",
+ 2: "/approveProcess/exportTwo",
+ 3: "/approveProcess/exportThree",
+ 4: "/approveProcess/exportFour",
+ 5: "/approveProcess/exportFive",
+ 6: "/approveProcess/exportSix",
+ 7: "/approveProcess/exportSeven",
+ 8: "/approveProcess/exportEight",
+ };
+ const url = urlMap[type] || urlMap[0];
+ const nameMap = {
+ 0: "鍗忓悓瀹℃壒绠$悊琛�",
+ 1: "鍏嚭绠$悊瀹℃壒琛�",
+ 2: "璇峰亣绠$悊瀹℃壒琛�",
+ 3: "鍑哄樊绠$悊瀹℃壒琛�",
+ 4: "鎶ラ攢绠$悊瀹℃壒琛�",
+ 5: "閲囪喘鐢宠瀹℃壒琛�",
+ 6: "鎶ヤ环瀹℃壒琛�",
+ 7: "鍙戣揣瀹℃壒琛�",
+ 8: "鍗遍櫓浣滀笟瀹℃壒琛�",
+ };
+ const fileName = nameMap[type] || nameMap[0];
+ proxy.download(url, {}, `${fileName}.xlsx`);
+ };
+ // 琛ㄦ牸閫夋嫨鏁版嵁
+ const handleSelectionChange = selection => {
+ selectedRows.value = selection;
+ };
+
+ // 鎵撳紑鏂板銆佺紪杈戝脊妗�
+ const openForm = (type, row) => {
+ nextTick(() => {
+ infoFormDia.value?.openDialog(type, row);
+ });
+ };
+ // 鎵撳紑鏂板妫�楠屽脊妗�
+ const openApprovalDia = (type, row) => {
+ nextTick(() => {
+ approvalDia.value?.openDialog(type, row);
+ });
+ };
+
+ // 鍒犻櫎
+ const handleDelete = () => {
+ let ids = [];
+ if (selectedRows.value.length > 0) {
+ ids = selectedRows.value.map(item => item.approveId);
+ } else {
+ proxy.$modal.msgWarning("璇烽�夋嫨鏁版嵁");
+ return;
+ }
+ ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�", "瀵煎嚭", {
+ confirmButtonText: "纭",
+ cancelButtonText: "鍙栨秷",
+ type: "warning",
+ })
+ .then(() => {
+ approveProcessDelete(ids).then(res => {
+ proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
+ getList();
+ });
+ })
+ .catch(() => {
+ proxy.$modal.msg("宸插彇娑�");
+ });
+ };
+ onMounted(() => {
+ const approveId = route.query.approveId;
+
+ if (approveId) {
+ // 璁剧疆娴佺▼缂栧彿鏌ヨ鏉′欢
+ searchForm.value.approveId = String(approveId);
+ }
+
+ // 鏌ヨ鍒楄〃
+ getList();
+ });
+</script>
+
+<style scoped>
+ .approval-tabs {
+ margin-bottom: 10px;
+ }
+</style>
diff --git a/src/views/salesManagement/receiptPayment/index.vue b/src/views/salesManagement/receiptPayment/index.vue
index a2a0b2f..7b03d7d 100644
--- a/src/views/salesManagement/receiptPayment/index.vue
+++ b/src/views/salesManagement/receiptPayment/index.vue
@@ -421,7 +421,11 @@
proxy.$modal.msgError("璇烽�夋嫨鑷冲皯涓�鏉℃暟鎹�");
return;
}
- const validRows = selectedRows.value.filter((item) => item.noReceiptAmount !== 0);
+ // 浠呭厑璁糕�滃緟鍥炴閲戦 > 0鈥濈殑璁板綍杩涘叆鏂板鍥炴寮圭獥锛屽苟杩囨护鎺夊彲鑳芥贩鍏ョ殑绌哄璞�
+ const validRows = selectedRows.value.filter((item) => {
+ if (!item || !item.id) return false;
+ return Number(item.pendingInvoiceTotal ?? 0) > 0;
+ });
if (validRows.length === 0) {
proxy.$modal.msgWarning("鎵�閫夎褰曞潎鏃犻渶鍥炴");
return;
@@ -485,6 +489,8 @@
const closeDia = () => {
forms.value = [];
dialogFormVisible.value = false;
+ // 閬垮厤浜屾鎵撳紑寮圭獥鏃朵粛鎼哄甫涓婁竴娆$殑閫夋嫨瀵艰嚧鈥滃鍑轰竴琛�/鑴忔暟鎹��
+ selectedRows.value = [];
};
// 鍒犻櫎鍥炴璁板綍
diff --git a/src/views/salesManagement/salesLedger/index.vue b/src/views/salesManagement/salesLedger/index.vue
index d9a180f..da26ba7 100644
--- a/src/views/salesManagement/salesLedger/index.vue
+++ b/src/views/salesManagement/salesLedger/index.vue
@@ -132,6 +132,14 @@
<FormDialog v-model="dialogFormVisible" :title="operationType === 'add' ? '鏂板閿�鍞彴璐﹂〉闈�' : '缂栬緫閿�鍞彴璐﹂〉闈�'" :width="'70%'"
:operation-type="operationType" @close="closeDia" @confirm="submitForm" @cancel="closeDia">
<el-form :model="form" label-width="140px" label-position="top" :rules="rules" ref="formRef">
+ <!-- 鎶ヤ环鍗曞鍏ュ叆鍙o細鏀惧湪琛ㄥ崟椤堕儴锛岄�夋嫨鍚庡弽鏄惧鎴�/涓氬姟鍛樼瓑 -->
+ <el-row v-if="operationType === 'add'" style="margin-bottom: 10px;">
+ <el-col :span="24" style="text-align: right;">
+ <el-button type="primary" plain @click="openQuotationDialog">
+ 浠庨攢鍞姤浠峰鍏�
+ </el-button>
+ </el-col>
+ </el-row>
<el-row :gutter="30">
<el-col :span="12">
<el-form-item label="閿�鍞悎鍚屽彿锛�" prop="salesContractNo">
@@ -1076,10 +1084,14 @@
selectedQuotation.value = row;
// 涓氬姟鍛�
- form.value.salesman = row.salesperson || "";
+ form.value.salesman = (row.salesperson || "").trim();
// 瀹㈡埛鍚嶇О -> customerId
- const customer = (customerOption.value || []).find((c) => c.customerName === row.customer);
+ const qCustomerName = String(row.customer || "").trim();
+ const customer = (customerOption.value || []).find((c) => {
+ const name = String(c.customerName || "").trim();
+ return name === qCustomerName || name.includes(qCustomerName) || qCustomerName.includes(name);
+ });
if (customer?.id) {
form.value.customerId = customer.id;
} else {
--
Gitblit v1.9.3