From a3c508233dd94b50c8005ec3a5d40b91341d6434 Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期四, 29 一月 2026 17:58:30 +0800
Subject: [PATCH] Merge branch 'dev_New' of http://114.132.189.42:9002/r/product-inventory-management into dev_New
---
src/views/productionManagement/productionProcess/index.vue | 48 +
src/views/qualityManagement/processInspection/components/formDia.vue | 2
src/views/salesManagement/deliveryLedger/index.vue | 146 ++++-
src/views/qualityManagement/finalInspection/components/formDia.vue | 2
src/views/safeProduction/emergencyPlanReview/index.vue | 32
src/views/salesManagement/salesLedger/index.vue | 24
src/views/safeProduction/hazardSourceLedger/index.vue | 4
src/views/safeProduction/accidentReportingRecord/index.vue | 53 +-
src/api/safeProduction/safetyTrainingAssessment.js | 70 ++
src/views/qualityManagement/nonconformingManagement/components/formDia.vue | 13
src/views/salesManagement/indicatorStats/index.vue | 46 -
src/views/qualityManagement/rawMaterialInspection/components/formDia.vue | 2
src/views/productionManagement/productionOrder/index.vue | 23
src/views/safeProduction/safetyTrainingAssessment/index.vue | 939 +++++++++++++++++++++++++++++++++++++
src/views/safeProduction/hazardousMaterialsControl/index.vue | 17
src/views/safeProduction/dangerInvestigation/index.vue | 34 -
16 files changed, 1,254 insertions(+), 201 deletions(-)
diff --git a/src/api/safeProduction/safetyTrainingAssessment.js b/src/api/safeProduction/safetyTrainingAssessment.js
new file mode 100644
index 0000000..a02ff2e
--- /dev/null
+++ b/src/api/safeProduction/safetyTrainingAssessment.js
@@ -0,0 +1,70 @@
+
+import request from "@/utils/request";
+
+// 鍒嗛〉鏌ヨ
+export function safeTrainingListPage(query) {
+ return request({
+ url: "/safeTraining/page",
+ method: "get",
+ params: query,
+ });
+}
+
+
+export function safeTrainingAdd(query) {
+ return request({
+ url: '/safeTraining',
+ method: 'post',
+ data: query
+ })
+}
+
+export function safeTrainingUpdate(query) {
+ return request({
+ url: '/safeTraining',
+ method: 'put',
+ data: query
+ })
+}
+
+export function safeTrainingDel(ids) {
+ return request({
+ url: '/safeTraining/' + ids,
+ method: 'delete',
+ data: ids
+ })
+}
+// 瀵煎嚭
+export function safeTrainingExport(query) {
+ return request({
+ url: '/safeTraining/export',
+ method: 'post',
+ data: query,
+ responseType: 'blob'
+ })
+}
+
+// 鏌ヨ闄勪欢鍒楄〃
+export function safeTrainingFileListPage(query) {
+ return request({
+ url: "/safeTrainingFile/listPage",
+ method: "get",
+ params: query,
+ });
+}
+// 娣诲姞闄勪欢
+export function safeTrainingFileAdd(query) {
+ return request({
+ url: '/safeTrainingFile/add',
+ method: 'post',
+ data: query
+ })
+}
+// 鍒犻櫎闄勪欢
+export function safeTrainingFileDel(ids) {
+ return request({
+ url: '/safeTrainingFile/del',
+ method: 'delete',
+ data: ids
+ })
+}
\ No newline at end of file
diff --git a/src/views/productionManagement/productionOrder/index.vue b/src/views/productionManagement/productionOrder/index.vue
index 4c09ac7..ece5ca6 100644
--- a/src/views/productionManagement/productionOrder/index.vue
+++ b/src/views/productionManagement/productionOrder/index.vue
@@ -239,13 +239,16 @@
// 娣诲姞琛ㄨ绫诲悕鏂规硶
const tableRowClassName = ({ row }) => {
- switch (row.deliveryDaysDiff) {
- case 15:
- return 'yellow'
- case 10:
- return 'red'
- case 2:
- return 'purple'
+ const diff = row.deliveryDaysDiff;
+
+ if (diff === 15) {
+ return 'yellow';
+ } else if (diff === 10) {
+ return 'pink';
+ } else if (diff === 2) {
+ return 'purple';
+ } else if (diff < 2) {
+ return 'red';
}
};
@@ -413,10 +416,14 @@
background-color: #FAF0DE;
}
-::v-deep .red {
+::v-deep .pink {
background-color: #FAE1DE;
}
+::v-deep .red {
+ background-color: #f80202;
+}
+
::v-deep .purple{
background-color: #F4DEFA;
}
diff --git a/src/views/productionManagement/productionProcess/index.vue b/src/views/productionManagement/productionProcess/index.vue
index 7ab8c9a..67430cb 100644
--- a/src/views/productionManagement/productionProcess/index.vue
+++ b/src/views/productionManagement/productionProcess/index.vue
@@ -30,7 +30,9 @@
class="mb10">
<el-button type="primary"
@click="showNewModal">鏂板宸ュ簭</el-button>
- <el-button type="info" plain @click="handleImport">瀵煎叆</el-button>
+ <el-button type="info"
+ plain
+ @click="handleImport">瀵煎叆</el-button>
<el-button type="danger"
@click="handleDelete"
:disabled="selectedRows.length === 0"
@@ -53,19 +55,17 @@
v-model:visible="isShowEditModal"
:record="record"
@completed="getList" />
- <ImportDialog
- ref="importDialogRef"
- v-model="importDialogVisible"
- title="瀵煎叆宸ュ簭"
- :action="importAction"
- :headers="importHeaders"
- :auto-upload="false"
- :on-success="handleImportSuccess"
- :on-error="handleImportError"
- @confirm="handleImportConfirm"
- @download-template="handleDownloadTemplate"
- @close="handleImportClose"
- />
+ <ImportDialog ref="importDialogRef"
+ v-model="importDialogVisible"
+ title="瀵煎叆宸ュ簭"
+ :action="importAction"
+ :headers="importHeaders"
+ :auto-upload="false"
+ :on-success="handleImportSuccess"
+ :on-error="handleImportError"
+ @confirm="handleImportConfirm"
+ @download-template="handleDownloadTemplate"
+ @close="handleImportClose" />
</div>
</template>
@@ -74,7 +74,12 @@
import NewProcess from "@/views/productionManagement/productionProcess/New.vue";
import EditProcess from "@/views/productionManagement/productionProcess/Edit.vue";
import ImportDialog from "@/components/Dialog/ImportDialog.vue";
- import { listPage, del, importData, downloadTemplate } from "@/api/productionManagement/productionProcess.js";
+ import {
+ listPage,
+ del,
+ importData,
+ downloadTemplate,
+ } from "@/api/productionManagement/productionProcess.js";
import { getToken } from "@/utils/auth";
const data = reactive({
@@ -93,7 +98,7 @@
label: "宸ュ簭鍚嶇О",
prop: "name",
},
-
+
{
label: "宸ヨ祫瀹氶",
prop: "salaryQuota",
@@ -102,7 +107,7 @@
label: "澶囨敞",
prop: "remark",
},
- {
+ {
label: "鏇存柊鏃堕棿",
prop: "updateTime",
},
@@ -137,9 +142,10 @@
total: 0,
});
const { proxy } = getCurrentInstance();
-
+
// 瀵煎叆鐩稿叧閰嶇疆
- const importAction = import.meta.env.VITE_APP_BASE_API + "/productProcess/importData";
+ const importAction =
+ import.meta.env.VITE_APP_BASE_API + "/productProcess/importData";
const importHeaders = { Authorization: "Bearer " + getToken() };
// 鏌ヨ鍒楄〃
@@ -235,7 +241,7 @@
};
// 瀵煎叆鎴愬姛
- const handleImportSuccess = (response) => {
+ const handleImportSuccess = response => {
if (response.code === 200) {
proxy.$modal.msgSuccess("瀵煎叆鎴愬姛");
importDialogVisible.value = false;
@@ -249,7 +255,7 @@
};
// 瀵煎叆澶辫触
- const handleImportError = (error) => {
+ const handleImportError = error => {
proxy.$modal.msgError("瀵煎叆澶辫触锛�" + (error.message || "鏈煡閿欒"));
};
diff --git a/src/views/qualityManagement/finalInspection/components/formDia.vue b/src/views/qualityManagement/finalInspection/components/formDia.vue
index 741712e..8dfd3ba 100644
--- a/src/views/qualityManagement/finalInspection/components/formDia.vue
+++ b/src/views/qualityManagement/finalInspection/components/formDia.vue
@@ -155,7 +155,7 @@
process: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
checkName: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }],
productId: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
- productModelId: [{ required: false, message: "璇烽�夋嫨", trigger: "change" }],
+ productModelId: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
testStandardId: [{required: false, message: "璇烽�夋嫨鎸囨爣", trigger: "change"}],
unit: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }],
quantity: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
diff --git a/src/views/qualityManagement/nonconformingManagement/components/formDia.vue b/src/views/qualityManagement/nonconformingManagement/components/formDia.vue
index 6a33ee6..d33ddad 100644
--- a/src/views/qualityManagement/nonconformingManagement/components/formDia.vue
+++ b/src/views/qualityManagement/nonconformingManagement/components/formDia.vue
@@ -35,7 +35,10 @@
</el-col>
<el-col :span="12">
<el-form-item label="瑙勬牸鍨嬪彿锛�" prop="model">
- <el-input v-model="form.model" placeholder="璇疯緭鍏�" clearable/>
+ <el-select v-model="form.model" placeholder="璇烽�夋嫨" clearable :disabled="operationType === 'edit'"
+ filterable readonly @change="handleChangeModel">
+ <el-option v-for="item in modelOptions" :key="item.id" :label="item.model" :value="item.id" />
+ </el-select>
</el-form-item>
</el-col>
</el-row>
@@ -118,7 +121,7 @@
<script setup>
import {ref} from "vue";
-import {productTreeList} from "@/api/basicData/product.js";
+import {modelList, productTreeList} from "@/api/basicData/product.js";
import {
getQualityUnqualifiedInfo,
qualityUnqualifiedAdd,
@@ -151,7 +154,7 @@
process: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
checkName: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }],
productId: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
- model: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }],
+ model: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
unit: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }],
quantity: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
checkCompany: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }],
@@ -160,6 +163,7 @@
});
const { form, rules } = toRefs(data);
const productOptions = ref([]);
+const modelOptions = ref([])
// 鎵撳紑寮规
const openDialog = (type, row) => {
@@ -181,6 +185,9 @@
};
const getModels = (value) => {
form.value.productName = findNodeById(productOptions.value, value);
+ modelList({ id: value }).then((res) => {
+ modelOptions.value = res;
+ })
};
const findNodeById = (nodes, productId) => {
for (let i = 0; i < nodes.length; i++) {
diff --git a/src/views/qualityManagement/processInspection/components/formDia.vue b/src/views/qualityManagement/processInspection/components/formDia.vue
index 852df9e..e0aea52 100644
--- a/src/views/qualityManagement/processInspection/components/formDia.vue
+++ b/src/views/qualityManagement/processInspection/components/formDia.vue
@@ -162,7 +162,7 @@
process: [{ required: true, message: "璇疯緭鍏ュ伐搴�", trigger: "blur" }],
checkName: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }],
productId: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
- productModelId: [{ required: false, message: "璇烽�夋嫨", trigger: "change" }],
+ productModelId: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
testStandardId: [{required: false, message: "璇烽�夋嫨鎸囨爣", trigger: "change"}],
unit: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }],
quantity: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
diff --git a/src/views/qualityManagement/rawMaterialInspection/components/formDia.vue b/src/views/qualityManagement/rawMaterialInspection/components/formDia.vue
index 2b8d77f..3323986 100644
--- a/src/views/qualityManagement/rawMaterialInspection/components/formDia.vue
+++ b/src/views/qualityManagement/rawMaterialInspection/components/formDia.vue
@@ -175,7 +175,7 @@
supplier: [{required: true, message: "璇疯緭鍏�", trigger: "blur"}],
checkName: [{required: false, message: "璇疯緭鍏�", trigger: "blur"}],
productId: [{required: true, message: "璇疯緭鍏�", trigger: "blur"}],
- productModelId: [{required: false, message: "璇烽�夋嫨浜у搧鍨嬪彿", trigger: "change"}],
+ productModelId: [{required: true, message: "璇烽�夋嫨浜у搧鍨嬪彿", trigger: "change"}],
testStandardId: [{required: false, message: "璇烽�夋嫨鎸囨爣", trigger: "change"}],
unit: [{required: false, message: "璇疯緭鍏�", trigger: "blur"}],
quantity: [{required: true, message: "璇疯緭鍏�", trigger: "blur"}],
diff --git a/src/views/safeProduction/accidentReportingRecord/index.vue b/src/views/safeProduction/accidentReportingRecord/index.vue
index bf064cd..b38f04a 100644
--- a/src/views/safeProduction/accidentReportingRecord/index.vue
+++ b/src/views/safeProduction/accidentReportingRecord/index.vue
@@ -229,10 +229,10 @@
{{ currentKnowledge.happenLocation }}
</el-descriptions-item>
<el-descriptions-item label="浜嬫晠绛夌骇">
- {{ currentKnowledge.accidentGrade }}
+ <el-tag :type="accidentGradeType(currentKnowledge.accidentGrade)">{{ currentKnowledge.accidentGrade }}</el-tag>
</el-descriptions-item>
<el-descriptions-item label="浜嬫晠绫诲瀷">
- {{ currentKnowledge.accidentType }}
+ <el-tag type="info">{{ accidentTypeLabel(currentKnowledge.accidentType) }}</el-tag>
</el-descriptions-item>
<el-descriptions-item label="浜哄憳浼や骸鎯呭喌">
{{ currentKnowledge.personLoss }}
@@ -409,6 +409,9 @@
label: "浜嬫晠绫诲瀷",
prop: "accidentType",
showOverflowTooltip: true,
+ formatData: params => {
+ return accidentTypeLabel(params);
+ },
},
{
dataType: "action",
@@ -462,6 +465,20 @@
page.value.current = 1;
getList();
};
+ const accidentGradeType = val => {
+ switch (val) {
+ case "杞诲井浜嬫晠":
+ return "info";
+ case "涓�鑸簨鏁�":
+ return "info";
+ case "杈冨ぇ浜嬫晠":
+ return "warning";
+ case "閲嶅ぇ浜嬫晠":
+ return "danger";
+ default:
+ return "info";
+ }
+ };
const accidentGradeOptions = [
{
label: "杞诲井浜嬫晠",
@@ -480,25 +497,15 @@
value: "閲嶅ぇ浜嬫晠",
},
];
- const accidentTypeOptions = [
- {
- label: "璐d换浜嬫晠",
- value: "璐d换浜嬫晠",
- },
- {
- label: "闈炶矗浠讳簨鏁�",
- value: "闈炶矗浠讳簨鏁�",
- },
- {
- label: "鐮村潖鎬т簨鏁�",
- value: "鐮村潖鎬т簨鏁�",
- },
- {
- label: "閲嶅ぇ浜嬫晠",
- value: "閲嶅ぇ浜嬫晠",
- },
- ];
-
+ const { proxy } = getCurrentInstance();
+ const { accident_type } = proxy.useDict("accident_type");
+ const accidentTypeOptions = computed(() => accident_type?.value || []);
+ const accidentTypeLabel = val => {
+ const item = accidentTypeOptions.value.find(
+ i => String(i.value) === String(val)
+ );
+ return item ? item.label : val;
+ };
const getList = () => {
tableLoading.value = true;
safeAccidentListPage({ ...page.value, ...searchForm.value })
@@ -711,10 +718,6 @@
// 鐢ㄦ埛鍙栨秷
});
};
-
- // 瀵煎嚭
- const { proxy } = getCurrentInstance();
- const { knowledge_type } = proxy.useDict("knowledge_type");
// 瀛楀吀宸ュ叿
const knowledgeTypeOptions = computed(() => knowledge_type?.value || []);
diff --git a/src/views/safeProduction/dangerInvestigation/index.vue b/src/views/safeProduction/dangerInvestigation/index.vue
index 1878370..0fa284b 100644
--- a/src/views/safeProduction/dangerInvestigation/index.vue
+++ b/src/views/safeProduction/dangerInvestigation/index.vue
@@ -283,7 +283,7 @@
<span class="detail-title">{{ form.hiddenDesc }}</span>
</el-descriptions-item>
<el-descriptions-item label="闅愭偅绫诲瀷">
- <span class="detail-title">{{ form.type }}</span>
+ <span class="detail-title">{{ TypeLabel(form.type) }}</span>
</el-descriptions-item>
<el-descriptions-item label="闅愭偅椋庨櫓绛夌骇">
<el-tag :type="getTypeTagType(form.riskLevel)">
@@ -422,7 +422,7 @@
<script setup>
import { getToken } from "@/utils/auth";
import pagination from "@/components/PIMTable/Pagination.vue";
- import { onMounted, ref, getCurrentInstance } from "vue";
+ import { onMounted, ref, getCurrentInstance, computed } from "vue";
import { ElMessageBox, ElMessage } from "element-plus";
import useUserStore from "@/store/modules/user";
import { userListNoPage } from "@/api/system/user.js";
@@ -517,28 +517,12 @@
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 { hidden_danger_type } = proxy.useDict("hidden_danger_type");
+ const typeList = computed(() => hidden_danger_type?.value || []);
+ const TypeLabel = val => {
+ const item = typeList.value.find(i => String(i.value) === String(val));
+ return item ? item.label : val;
+ };
const form2 = ref({
rectifyActualTime: "", // 瀹為檯鏁存敼瀹屾垚鏃堕棿
rectifyMeasures: "", // 鏁存敼鍏蜂綋鎺柦
@@ -569,8 +553,6 @@
label: "浣庨闄�",
},
]);
- // 闅愭偅绫诲瀷閫夐」
- const { type_qualification } = proxy.useDict("type_qualification");
const { form, rules } = toRefs(data);
const { form: searchForm } = useFormData(data.searchForm);
// 浜у搧琛ㄥ崟寮规鏁版嵁
diff --git a/src/views/safeProduction/emergencyPlanReview/index.vue b/src/views/safeProduction/emergencyPlanReview/index.vue
index 07bf56e..26a3cfe 100644
--- a/src/views/safeProduction/emergencyPlanReview/index.vue
+++ b/src/views/safeProduction/emergencyPlanReview/index.vue
@@ -192,7 +192,7 @@
{{ currentKnowledge.coreResponsorUserName }}
</el-descriptions-item>
<el-descriptions-item label="棰勬绫诲瀷">
- <el-tag type="warning"> {{ currentKnowledge.planType }}</el-tag>
+ <el-tag type="warning"> {{ emergencyPlanTypeLabel(currentKnowledge.planType) }}</el-tag>
</el-descriptions-item>
<el-descriptions-item label="澶囨敞">
{{ currentKnowledge.remark }}
@@ -352,6 +352,9 @@
label: "棰勬绫诲瀷",
prop: "planType",
showOverflowTooltip: true,
+ formatData: params => {
+ return emergencyPlanTypeLabel(params);
+ },
},
{
label: "澶囨敞",
@@ -569,20 +572,17 @@
};
return timeMap[efficiency] || "鏈煡";
};
- const emergencyPlanTypeOptions = computed(() => [
- {
- value: "棰勯槻鎬у簲鎬ラ妗�",
- label: "棰勯槻鎬у簲鎬ラ妗�",
- },
- {
- value: "搴旀�ュ鐞嗛妗�",
- label: "搴旀�ュ鐞嗛妗�",
- },
- {
- value: "鎭㈠鎬у簲鎬ラ妗�",
- label: "鎭㈠鎬у簲鎬ラ妗�",
- },
- ]);
+ const { proxy } = getCurrentInstance();
+ const { emergency_plan_type } = proxy.useDict("emergency_plan_type");
+ const emergencyPlanTypeOptions = computed(
+ () => emergency_plan_type?.value || []
+ );
+ const emergencyPlanTypeLabel = val => {
+ const item = emergencyPlanTypeOptions.value.find(
+ i => String(i.value) === String(val)
+ );
+ return item ? item.label : val;
+ };
// 鎻愪氦搴旀�ラ妗堣〃鍗�
const submitForm = async () => {
try {
@@ -664,8 +664,6 @@
};
// 瀵煎嚭
- const { proxy } = getCurrentInstance();
- const { knowledge_type } = proxy.useDict("knowledge_type");
// 瀛楀吀宸ュ叿
const knowledgeTypeOptions = computed(() => knowledge_type?.value || []);
diff --git a/src/views/safeProduction/hazardSourceLedger/index.vue b/src/views/safeProduction/hazardSourceLedger/index.vue
index dfa4650..2a78c48 100644
--- a/src/views/safeProduction/hazardSourceLedger/index.vue
+++ b/src/views/safeProduction/hazardSourceLedger/index.vue
@@ -181,7 +181,9 @@
{{ currentKnowledge.code }}
</el-descriptions-item>
<el-descriptions-item label="鍗遍櫓婧愮被鍨�">
- {{ getTypeLabel(currentKnowledge.type) }}
+ <el-tag type="info">
+ {{ getTypeLabel(currentKnowledge.type) }}
+ </el-tag>
</el-descriptions-item>
<el-descriptions-item label="鎵�鍦ㄤ綅缃�">
{{ currentKnowledge.location }}
diff --git a/src/views/safeProduction/hazardousMaterialsControl/index.vue b/src/views/safeProduction/hazardousMaterialsControl/index.vue
index 5be4bdc..0a2bd6d 100644
--- a/src/views/safeProduction/hazardousMaterialsControl/index.vue
+++ b/src/views/safeProduction/hazardousMaterialsControl/index.vue
@@ -162,7 +162,9 @@
<span>{{ form.name }}</span>
</el-descriptions-item>
<el-descriptions-item label="鍗遍櫓婧愮被鍨�">
- <span>{{ getTypeLabel(form.type) }}</span>
+ <el-tag type="info">
+ {{ getTypeLabel(form.type) }}
+ </el-tag>
</el-descriptions-item>
<el-descriptions-item label="鎵�鍦ㄤ綅缃�">
<span>{{ form.location }}</span>
@@ -414,6 +416,12 @@
// 琛ㄦ牸鍒楅厤缃�
const tableColumn = ref([
{
+ label: "棰嗙敤鍗曞彿",
+ prop: "materialRecordCode",
+ width: 130,
+ showOverflowTooltip: true,
+ },
+ {
label: "鍗遍櫓婧愮紪鐮�",
prop: "code",
showOverflowTooltip: true,
@@ -482,16 +490,11 @@
showOverflowTooltip: true,
},
{
- label: "鍗曞彿",
- prop: "materialRecordCode",
- showOverflowTooltip: true,
- },
- {
dataType: "action",
label: "鎿嶄綔",
align: "center",
fixed: "right",
- width: 200,
+ width: 130,
operation: [
{
name: "褰掕繕",
diff --git a/src/views/safeProduction/safetyTrainingAssessment/index.vue b/src/views/safeProduction/safetyTrainingAssessment/index.vue
new file mode 100644
index 0000000..8fbfe9b
--- /dev/null
+++ b/src/views/safeProduction/safetyTrainingAssessment/index.vue
@@ -0,0 +1,939 @@
+<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="pagination"
+ :total="page.total"
+ :rowClassName="getRowClass"></PIMTable>
+ </div>
+ <!-- 鏂板/缂栬緫鐭ヨ瘑寮圭獥 -->
+ <el-dialog v-model="dialogVisible"
+ :title="dialogTitle"
+ width="800px"
+ :close-on-click-modal="false">
+ <el-form ref="formRef"
+ :model="form"
+ :rules="rules"
+ label-width="120px">
+ <el-row :gutter="20">
+ <el-col :span="12">
+ <el-form-item label="鍩硅鏃ユ湡"
+ prop="trainingDate">
+ <el-date-picker style="width: 100%"
+ v-model="form.trainingDate"
+ 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="courseCode">
+ <el-input v-model="form.courseCode"
+ disabled
+ placeholder="鑷姩鐢熸垚" />
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row :gutter="20">
+ <el-col :span="12">
+ <el-form-item label="寮�濮嬫椂闂�"
+ prop="openingTime">
+ <el-time-picker v-model="form.openingTime"
+ placeholder="璇烽�夋嫨"
+ value-format="HH:mm:ss"
+ format="HH:mm:ss"
+ clearable />
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="缁撴潫鏃堕棿"
+ prop="endTime">
+ <el-time-picker v-model="form.endTime"
+ placeholder="璇烽�夋嫨"
+ value-format="HH:mm:ss"
+ format="HH:mm:ss"
+ clearable />
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row :gutter="20">
+ <el-col :span="12">
+ <el-form-item label="鍩硅鐩爣"
+ prop="trainingObjectives">
+ <el-input v-model="form.trainingObjectives"
+ placeholder="璇疯緭鍏ュ煿璁洰鏍�" />
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="鍙傚姞瀵硅薄"
+ prop="participants">
+ <el-input v-model="form.participants"
+ placeholder="璇疯緭鍏ュ弬鍔犲璞�" />
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row :gutter="20">
+ <el-col :span="12">
+ <el-form-item label="鍩硅鍐呭"
+ prop="trainingContent">
+ <el-input v-model="form.trainingContent"
+ placeholder="璇疯緭鍏ュ煿璁唴瀹�" />
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="鍩硅璁插笀"
+ prop="trainingLecturer">
+ <el-input v-model="form.trainingLecturer"
+ placeholder="璇疯緭鍏ュ煿璁甯�" />
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row :gutter="20">
+ <el-col :span="12">
+ <el-form-item label="璇剧▼瀛﹀垎"
+ prop="projectCredits">
+ <el-input v-model="form.projectCredits"
+ placeholder="璇疯緭鍏ヨ绋嬪鍒�" />
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="鍩硅鏂瑰紡"
+ prop="trainingMode">
+ <el-select v-model="form.trainingMode"
+ placeholder="璇烽�夋嫨鍩硅鏂瑰紡"
+ clearable>
+ <el-option v-for="item in trainingModeOptions"
+ :key="item.value"
+ :label="item.label"
+ :value="item.value" />
+ </el-select>
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row :gutter="20">
+ <el-col :span="12">
+ <el-form-item label="鍩硅鍦扮偣"
+ prop="placeTraining">
+ <el-input v-model="form.placeTraining"
+ placeholder="璇疯緭鍏ュ煿璁湴鐐�" />
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="璇炬椂"
+ prop="classHour">
+ <el-input v-model="form.classHour"
+ type="number"
+ min="0"
+ placeholder="璇疯緭鍏ヨ鏃�" />
+ </el-form-item>
+ </el-col>
+ </el-row>
+ </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="viewDialogVisible"
+ title="鍩硅璇︽儏"
+ width="900px"
+ :close-on-click-modal="false">
+ <div class="knowledge-detail">
+ <el-descriptions :column="2"
+ border>
+ <el-descriptions-item label="鍩硅鍚嶇О"
+ :span="2">
+ <span class="detail-title">{{ currentKnowledge.name }}</span>
+ </el-descriptions-item>
+ <el-descriptions-item label="鍩硅缂栫爜">
+ {{ currentKnowledge.code }}
+ </el-descriptions-item>
+ <el-descriptions-item label="鍩硅绫诲瀷">
+ <el-tag type="info">
+ <!-- {{ getTypeLabel(currentKnowledge.type) }} -->
+ </el-tag>
+ </el-descriptions-item>
+ <el-descriptions-item label="鎵�鍦ㄤ綅缃�">
+ {{ currentKnowledge.location }}
+ </el-descriptions-item>
+ <el-descriptions-item label="绠℃帶鎺柦">
+ {{ currentKnowledge.controlMeasures }}
+ </el-descriptions-item>
+ <el-descriptions-item label="搴撳瓨鏁伴噺">
+ {{ currentKnowledge.stockQty }}
+ </el-descriptions-item>
+ <el-descriptions-item label="绠℃帶璐d换浜�">
+ {{ currentKnowledge.principalUserId }}
+ </el-descriptions-item>
+ <el-descriptions-item label="璐d换浜鸿仈绯荤數璇�">
+ {{ currentKnowledge.principalMobile }}
+ </el-descriptions-item>
+ <el-descriptions-item label="椋庨櫓绛夌骇">
+ <el-tag :type="getTypeTagType(currentKnowledge.riskLevel)">
+ {{ currentKnowledge.riskLevel }}
+ </el-tag>
+ </el-descriptions-item>
+ <el-descriptions-item label="瑙勬牸 / 椋庨櫓鎻忚堪">
+ {{ currentKnowledge.specInfo }}
+ </el-descriptions-item>
+ </el-descriptions>
+ </div>
+ <template #footer>
+ <span class="dialog-footer">
+ <el-button @click="viewDialogVisible = false">鍏抽棴</el-button>
+ </span>
+ </template>
+ </el-dialog>
+ <!-- 闄勪欢鍒楄〃寮圭獥 -->
+ <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 { Search } from "@element-plus/icons-vue";
+ import FileListDialog from "@/components/Dialog/FileListDialog.vue";
+ import {
+ onMounted,
+ ref,
+ reactive,
+ toRefs,
+ getCurrentInstance,
+ computed,
+ } from "vue";
+ import request from "@/utils/request";
+ import { getToken } from "@/utils/auth";
+ import { ElMessage, ElMessageBox } from "element-plus";
+ import PIMTable from "@/components/PIMTable/PIMTable.vue";
+ import { userListNoPage } from "@/api/system/user.js";
+ import {
+ safeTrainingListPage,
+ safeTrainingAdd,
+ safeTrainingExport,
+ safeTrainingDel,
+ safeTrainingFileListPage,
+ safeTrainingFileAdd,
+ safeTrainingFileDel,
+ } from "@/api/safeProduction/safetyTrainingAssessment.js";
+
+ // 琛ㄥ崟楠岃瘉瑙勫垯
+ const rules = {
+ trainingDate: [
+ { required: true, message: "璇烽�夋嫨鍩硅鏃ユ湡", trigger: "change" },
+ ],
+ openingTime: [
+ { required: true, message: "璇烽�夋嫨寮�濮嬫椂闂�", trigger: "change" },
+ ],
+ endTime: [{ required: true, message: "璇烽�夋嫨缁撴潫鏃堕棿", trigger: "change" }],
+ trainingContent: [
+ { required: true, message: "璇疯緭鍏ュ煿璁唴瀹�", trigger: "blur" },
+ ],
+ trainingLecturer: [
+ { required: true, message: "璇疯緭鍏ュ煿璁甯�", trigger: "blur" },
+ ],
+ classHour: [{ required: true, message: "璇疯緭鍏ヨ鏃�", trigger: "blur" }],
+ };
+
+ // 鍝嶅簲寮忔暟鎹�
+ const data = reactive({
+ searchForm: {
+ name: "",
+ type: "",
+ },
+ tableLoading: false,
+ page: {
+ current: 1,
+ size: 20,
+ total: 0,
+ },
+ tableData: [],
+ selectedIds: [],
+ form: {
+ courseCode: "", // 璇剧▼缂栧彿
+ trainingDate: "", // 鍩硅鏃ユ湡
+ openingTime: "", // 寮�濮嬫椂闂�
+ endTime: "", // 缁撴潫鏃堕棿
+ trainingObjectives: "", // 鍩硅鐩爣
+ participants: "", // 鍙傚姞瀵硅薄
+ trainingContent: "", // 鍩硅鍐呭
+ trainingLecturer: "", // 鍩硅璁插笀
+ projectCredits: "", // 椤圭洰瀛﹀垎
+ trainingMode: "", // 鍩硅鏂瑰紡
+ placeTraining: "", // 鍩硅鍦扮偣
+ classHour: "", // 璇炬椂
+ },
+ dialogVisible: false,
+ dialogTitle: "",
+ dialogType: "add",
+ viewDialogVisible: false,
+ currentKnowledge: {},
+ });
+
+ const {
+ searchForm,
+ tableLoading,
+ page,
+ tableData,
+ selectedIds,
+ form,
+ dialogVisible,
+ dialogTitle,
+ dialogType,
+ viewDialogVisible,
+ currentKnowledge,
+ } = toRefs(data);
+ const { proxy } = getCurrentInstance();
+ const { safe_training_methods } = proxy.useDict("safe_training_methods");
+ const trainingModeOptions = computed(() => safe_training_methods?.value || []);
+ const getTrainingModeLabel = val => {
+ const item = trainingModeOptions.value.find(
+ i => String(i.value) === String(val)
+ );
+ return item ? item.label : val;
+ };
+ // 琛ㄥ崟寮曠敤
+ const formRef = ref();
+ const riskLevelOptions = ref([
+ { value: "浣庨闄�", label: "浣庨闄�" },
+ { value: "涓�鑸闄�", label: "涓�鑸闄�" },
+ { value: "杈冨ぇ椋庨櫓", label: "杈冨ぇ椋庨櫓" },
+ { value: "閲嶅ぇ椋庨櫓", label: "閲嶅ぇ椋庨櫓" },
+ ]);
+
+ // 琛ㄦ牸鍒楅厤缃�
+ const tableColumn = ref([
+ {
+ label: "璇剧▼缂栧彿",
+ prop: "courseCode",
+ showOverflowTooltip: true,
+ },
+ {
+ label: "鍩硅鏃ユ湡",
+ prop: "trainingDate",
+ showOverflowTooltip: true,
+ },
+ {
+ label: "寮�濮嬫椂闂�",
+ prop: "openingTime",
+ showOverflowTooltip: true,
+ },
+ {
+ label: "缁撴潫鏃堕棿",
+ prop: "endTime",
+ showOverflowTooltip: true,
+ },
+ {
+ label: "鍩硅鐩爣",
+ prop: "trainingObjectives",
+ showOverflowTooltip: true,
+ },
+ {
+ label: "鍙傚姞瀵硅薄",
+ prop: "participants",
+ showOverflowTooltip: true,
+ },
+ {
+ label: "鍩硅鍐呭",
+ prop: "trainingContent",
+ showOverflowTooltip: true,
+ },
+ {
+ label: "鍩硅璁插笀",
+ prop: "trainingLecturer",
+ showOverflowTooltip: true,
+ },
+ {
+ label: "椤圭洰瀛﹀垎",
+ prop: "projectCredits",
+ showOverflowTooltip: true,
+ },
+ {
+ label: "鍩硅鏂瑰紡",
+ prop: "trainingMode",
+ showOverflowTooltip: true,
+ formatData: params => {
+ return getTrainingModeLabel(params);
+ },
+ },
+ {
+ label: "鍩硅鍦扮偣",
+ prop: "placeTraining",
+ showOverflowTooltip: true,
+ },
+ {
+ label: "璇炬椂",
+ prop: "classHour",
+ showOverflowTooltip: true,
+ },
+ {
+ dataType: "action",
+ label: "鎿嶄綔",
+ align: "center",
+ fixed: "right",
+ width: 200,
+ operation: [
+ {
+ name: "缂栬緫",
+ type: "text",
+ clickFun: row => {
+ openForm("edit", row);
+ },
+ },
+ {
+ name: "瀵煎嚭",
+ type: "danger",
+ clickFun: row => {
+ exportKnowledge(row);
+ },
+ },
+ {
+ name: "闄勪欢",
+ type: "danger",
+ clickFun: row => {
+ downLoadFile(row);
+ },
+ },
+ // {
+ // name: "鏌ョ湅",
+ // type: "text",
+ // clickFun: row => {
+ // viewKnowledge(row);
+ // },
+ // },
+ ],
+ },
+ ]);
+ const userList = ref([]);
+ // 鐢熷懡鍛ㄦ湡
+ onMounted(() => {
+ getList();
+ startAutoRefresh();
+ userListNoPage().then(res => {
+ userList.value = res.data;
+ });
+ });
+
+ // 澶勭悊鐢ㄦ埛閫夋嫨鍙樺寲
+ const handleUserChange = userId => {
+ const selectedUser = userList.value.find(user => user.userId === userId);
+ if (selectedUser) {
+ form.value.principalUser = selectedUser.nickName;
+ form.value.principalMobile = selectedUser.phonenumber;
+ }
+ };
+ /**
+ * 涓嬭浇鏂囦欢
+ *
+ * @param row 涓嬭浇鏂囦欢鐨勭浉鍏充俊鎭璞�
+ */
+ const fileListRef = ref(null);
+ const fileListDialogVisible = ref(false);
+ const currentFileRow = ref(null);
+ const downLoadFile = row => {
+ currentFileRow.value = row;
+ safeTrainingFileListPage({ safeTrainingId: row.id }).then(res => {
+ if (fileListRef.value) {
+ fileListRef.value.open(res.data.records);
+ }
+ });
+ };
+ // 涓婁紶闄勪欢
+ 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 = {
+ safeTrainingId: currentFileRow.value.id,
+ name: uploadRes.data.originalName || file.name,
+ url: uploadRes.data.tempPath || uploadRes.data.url,
+ };
+
+ const saveRes = await safeTrainingFileAdd(fileData);
+ if (saveRes.code === 200) {
+ proxy.$modal.msgSuccess("鏂囦欢涓婁紶鎴愬姛");
+ // 閲嶆柊鍔犺浇鏂囦欢鍒楄〃
+ const listRes = await safeTrainingFileListPage({
+ safeTrainingId: 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 safeTrainingFileDel([row.id]);
+ if (res.code === 200) {
+ proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
+ // 閲嶆柊鍔犺浇鏂囦欢鍒楄〃
+ if (currentFileRow.value && fileListRef.value) {
+ const listRes = await safeTrainingFileListPage({
+ safeTrainingId: 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;
+ }
+ };
+
+ // 寮�濮嬭嚜鍔ㄥ埛鏂�
+ const startAutoRefresh = () => {
+ setInterval(() => {
+ getList();
+ }, 600000); // 10鍒嗛挓鍒锋柊涓�娆� (10 * 60 * 1000 = 600000ms)
+ };
+
+ // 鏌ヨ鏁版嵁
+ const handleQuery = () => {
+ page.value.current = 1;
+ getList();
+ };
+ const exportKnowledge = row => {
+ safeTrainingExport(row)
+ .then(res => {
+ // 鍒涘缓Blob瀵硅薄
+ const blob = new Blob([res], {
+ type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
+ });
+ // 鍒涘缓涓嬭浇閾炬帴
+ const url = window.URL.createObjectURL(blob);
+ const link = document.createElement("a");
+ link.href = url;
+ link.download = `鍩硅璁板綍_${row.courseCode}.xlsx`;
+
+ // 妯℃嫙鐐瑰嚮涓嬭浇
+ document.body.appendChild(link);
+ link.click();
+
+ // 娓呯悊涓存椂瀵硅薄
+ setTimeout(() => {
+ document.body.removeChild(link);
+ window.URL.revokeObjectURL(url);
+ }, 100);
+
+ ElMessage.success("瀵煎嚭鎴愬姛");
+ })
+ .catch(err => {
+ console.error("瀵煎嚭澶辫触:", err);
+ ElMessage.error("瀵煎嚭澶辫触锛岃閲嶈瘯");
+ });
+ };
+ const getList = () => {
+ tableLoading.value = true;
+ safeTrainingListPage({ ...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 pagination = 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 = "鏂板鍩硅";
+ // 閲嶇疆琛ㄥ崟
+ Object.assign(form.value, {
+ courseCode: "", // 璇剧▼缂栧彿
+ trainingDate: "", // 鍩硅鏃ユ湡
+ openingTime: "", // 寮�濮嬫椂闂�
+ endTime: "", // 缁撴潫鏃堕棿
+ trainingObjectives: "", // 鍩硅鐩爣
+ participants: "", // 鍙傚姞瀵硅薄
+ trainingContent: "", // 鍩硅鍐呭
+ trainingLecturer: "", // 鍩硅璁插笀
+ projectCredits: "", // 椤圭洰瀛﹀垎
+ trainingMode: "", // 鍩硅鏂瑰紡
+ placeTraining: "", // 鍩硅鍦扮偣
+ classHour: "", // 璇炬椂
+ });
+ } else if (type === "edit" && row) {
+ dialogTitle.value = "缂栬緫鍩硅";
+ Object.assign(form.value, {
+ id: row.id,
+ courseCode: row.courseCode, // 璇剧▼缂栧彿
+ trainingDate: row.trainingDate, // 鍩硅鏃ユ湡
+ openingTime: row.openingTime, // 寮�濮嬫椂闂�
+ endTime: row.endTime, // 缁撴潫鏃堕棿
+ trainingObjectives: row.trainingObjectives, // 鍩硅鐩爣
+ participants: row.participants, // 鍙傚姞瀵硅薄
+ trainingContent: row.trainingContent, // 鍩硅鍐呭
+ trainingLecturer: row.trainingLecturer, // 鍩硅璁插笀
+ projectCredits: row.projectCredits, // 椤圭洰瀛﹀垎
+ trainingMode: row.trainingMode, // 鍩硅鏂瑰紡
+ placeTraining: row.placeTraining, // 鍩硅鍦扮偣
+ classHour: row.classHour, // 璇炬椂
+ });
+ }
+ 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 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] || "鏈煡";
+ };
+
+ /**
+ * 鑾峰彇琛岀被鍚嶏紝鐢ㄤ簬鍒ゆ柇椋庨櫓绛夌骇鏄惁涓洪噸澶ч闄�
+ * @param row 琛屾暟鎹�
+ * @returns 绫诲悕
+ */
+ const getRowClass = ({ row }) => {
+ if (row.riskLevel === "閲嶅ぇ椋庨櫓") {
+ return "danger-row";
+ }
+ return "";
+ };
+
+ // 鎻愪氦鍩硅琛ㄥ崟
+ const submitForm = async () => {
+ try {
+ await formRef.value.validate();
+ if (dialogType.value === "add") {
+ // 鏂板鍩硅鍙拌处
+ safeTrainingAdd({ ...form.value })
+ .then(res => {
+ if (res.code == 200) {
+ ElMessage.success("娣诲姞鎴愬姛");
+ dialogVisible.value = false;
+ getList();
+ }
+ })
+ .catch(err => {
+ ElMessage.error(err.msg);
+ });
+ } else {
+ // 鏇存柊鍩硅鍙拌处
+ safeTrainingAdd({ ...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);
+ safeTrainingDel(selectedIds.value).then(res => {
+ if (res.code == 200) {
+ ElMessage.success("鍒犻櫎鎴愬姛");
+ selectedIds.value = [];
+ getList();
+ }
+ });
+ })
+ .catch(() => {
+ // 鐢ㄦ埛鍙栨秷
+ });
+ };
+
+ 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/salesManagement/deliveryLedger/index.vue b/src/views/salesManagement/deliveryLedger/index.vue
index 52e14cb..de52c68 100644
--- a/src/views/salesManagement/deliveryLedger/index.vue
+++ b/src/views/salesManagement/deliveryLedger/index.vue
@@ -45,14 +45,20 @@
</el-tag>
</template>
</el-table-column>
- <el-table-column fixed="right" label="鎿嶄綔" width="150" align="center">
+ <el-table-column fixed="right" label="鎿嶄綔" width="200" align="center">
<template #default="scope">
<el-button
link
type="primary"
size="small"
- :disabled="isApproving(scope.row.status)"
+ :disabled="!isApproved(scope.row.status)"
@click="openForm('edit', scope.row)">琛ュ厖鍙戣揣淇℃伅</el-button>
+ <el-button
+ link
+ type="primary"
+ size="small"
+ @click="openDetail(scope.row)"
+ >璇︽儏</el-button>
<el-button
link
type="danger"
@@ -166,6 +172,41 @@
</div>
</template>
</el-dialog>
+
+ <!-- 璇︽儏寮规 -->
+ <el-dialog v-model="detailDialogVisible" title="鍙戣揣鍙拌处璇︽儏" width="55%" @close="closeDetail">
+ <div v-if="detailRow" class="detail-wrapper">
+ <el-descriptions :column="2" border>
+ <el-descriptions-item label="閿�鍞鍗�">{{ detailRow.salesContractNo || '--' }}</el-descriptions-item>
+ <el-descriptions-item label="鍙戣揣璁㈠崟鍙�">{{ detailRow.shippingNo || '--' }}</el-descriptions-item>
+ <el-descriptions-item label="瀹㈡埛鍚嶇О">{{ detailRow.customerName || '--' }}</el-descriptions-item>
+ <el-descriptions-item label="鍙戣揣绫诲瀷">{{ detailRow.type || '--' }}</el-descriptions-item>
+ <el-descriptions-item label="鍙戣揣鏃ユ湡">{{ detailRow.shippingDate || '--' }}</el-descriptions-item>
+ <el-descriptions-item label="瀹℃牳鐘舵��">{{ getApprovalStatusText(detailRow.status) }}</el-descriptions-item>
+ <el-descriptions-item label="鍙戣揣杞︾墝鍙�">{{ detailRow.shippingCarNumber || '--' }}</el-descriptions-item>
+ <el-descriptions-item label="蹇�掑叕鍙�">{{ detailRow.expressCompany || '--' }}</el-descriptions-item>
+ <el-descriptions-item label="蹇�掑崟鍙�" :span="2">{{ detailRow.expressNumber || '--' }}</el-descriptions-item>
+ </el-descriptions>
+
+ <div class="detail-images" v-if="detailImages.length">
+ <div class="detail-images-title">鍙戣揣鍥剧墖</div>
+ <el-image
+ v-for="img in detailImages"
+ :key="img.url"
+ :src="img.url"
+ :preview-src-list="detailImages.map(i => i.url)"
+ fit="cover"
+ class="detail-image"
+ />
+ </div>
+ <div v-else class="detail-images-empty">鏆傛棤鍙戣揣鍥剧墖</div>
+ </div>
+ <template #footer>
+ <div class="dialog-footer">
+ <el-button @click="closeDetail">鍏抽棴</el-button>
+ </div>
+ </template>
+ </el-dialog>
</div>
</template>
@@ -196,6 +237,31 @@
const total = ref(0);
const deliveryFileList = ref([]);
const javaApi = proxy.javaApi;
+// 璇︽儏寮规
+const detailDialogVisible = ref(false);
+const detailRow = ref(null);
+const detailImages = ref([]);
+
+const normalizeFileUrl = (rawUrl = '') => {
+ let fileUrl = rawUrl || '';
+ // Windows 璺緞杞� URL
+ if (fileUrl && fileUrl.indexOf('\\') > -1) {
+ const uploadsIndex = fileUrl.toLowerCase().indexOf('uploads');
+ if (uploadsIndex > -1) {
+ const relativePath = fileUrl.substring(uploadsIndex).replace(/\\/g, '/');
+ fileUrl = '/' + relativePath;
+ } else {
+ const parts = fileUrl.split('\\');
+ const fileName = parts[parts.length - 1];
+ fileUrl = '/uploads/' + fileName;
+ }
+ }
+ if (fileUrl && !fileUrl.startsWith('http')) {
+ if (!fileUrl.startsWith('/')) fileUrl = '/' + fileUrl;
+ fileUrl = javaApi + fileUrl;
+ }
+ return fileUrl;
+};
// 涓婁紶閰嶇疆
const upload = reactive({
@@ -284,9 +350,9 @@
// 鎵撳紑寮规
const openForm = async (type, row) => {
- // 缂栬緫鏃舵鏌ュ鏍哥姸鎬侊紝鍙湁瀹℃牳涓笉鑳界紪杈�
- if (type === 'edit' && row && isApproving(row.status)) {
- proxy.$modal.msgWarning("瀹℃牳涓殑鏁版嵁涓嶈兘缂栬緫");
+ // 琛ュ厖鍙戣揣淇℃伅锛氫粎鈥滃鏍搁�氳繃鈥濆厑璁哥紪杈�
+ if (type === 'edit' && row && !isApproved(row.status)) {
+ proxy.$modal.msgWarning("鍙湁瀹℃牳閫氳繃鐨勬暟鎹墠鍙互琛ュ厖鍙戣揣淇℃伅");
return;
}
@@ -307,38 +373,7 @@
// 濡傛灉鏈夊浘鐗囷紝灏� commonFileList 杞崲涓烘枃浠跺垪琛ㄦ牸寮�
if (row.commonFileList && Array.isArray(row.commonFileList) && row.commonFileList.length > 0) {
deliveryFileList.value = row.commonFileList.map((file, index) => {
- // 澶勭悊 URL锛氬皢 Windows 璺緞杞崲涓哄彲璁块棶鐨� URL
- let fileUrl = file.url || '';
- console.log('鍘熷 URL:', fileUrl);
-
- // 濡傛灉 URL 鏄� Windows 璺緞鏍煎紡锛堝寘鍚弽鏂滄潬锛夛紝闇�瑕佽浆鎹�
- if (fileUrl && fileUrl.indexOf('\\') > -1) {
- // 鏌ユ壘 uploads 鍏抽敭瀛楃殑浣嶇疆锛屼粠閭i噷寮�濮嬫彁鍙栫浉瀵硅矾寰�
- const uploadsIndex = fileUrl.toLowerCase().indexOf('uploads');
- if (uploadsIndex > -1) {
- // 浠� uploads 寮�濮嬫彁鍙栬矾寰勶紝骞跺皢鍙嶆枩鏉犳浛鎹负姝f枩鏉�
- const relativePath = fileUrl.substring(uploadsIndex).replace(/\\/g, '/');
- fileUrl = '/' + relativePath;
- console.log('杞崲鍚庣殑鐩稿璺緞:', fileUrl);
- } else {
- // 濡傛灉娌℃湁鎵惧埌 uploads锛屾彁鍙栨渶鍚庝竴涓洰褰曞拰鏂囦欢鍚�
- const parts = fileUrl.split('\\');
- const fileName = parts[parts.length - 1];
- fileUrl = '/uploads/' + fileName;
- console.log('鏈壘鍒� uploads锛屼娇鐢ㄦ枃浠跺悕:', fileUrl);
- }
- }
-
- // 纭繚鎵�鏈夐潪 http 寮�澶寸殑 URL 閮芥嫾鎺� baseUrl
- if (fileUrl && !fileUrl.startsWith('http')) {
- // 纭繚璺緞浠� / 寮�澶�
- if (!fileUrl.startsWith('/')) {
- fileUrl = '/' + fileUrl;
- }
- // 鎷兼帴 baseUrl
- fileUrl = javaApi + fileUrl;
- console.log('鏈�缁堟嫾鎺ョ殑 URL:', fileUrl);
- }
+ const fileUrl = normalizeFileUrl(file.url || '');
return {
uid: file.id || Date.now() + index,
@@ -373,6 +408,21 @@
}
dialogFormVisible.value = true;
+};
+
+// 鎵撳紑璇︽儏寮规
+const openDetail = (row) => {
+ detailRow.value = row || null;
+ const list = Array.isArray(row?.commonFileList) ? row.commonFileList : [];
+ detailImages.value = list
+ .map((f) => ({ url: normalizeFileUrl(f?.url || '') }))
+ .filter((i) => !!i.url);
+ detailDialogVisible.value = true;
+};
+const closeDetail = () => {
+ detailDialogVisible.value = false;
+ detailRow.value = null;
+ detailImages.value = [];
};
// 鎻愪氦琛ㄥ崟
@@ -671,5 +721,27 @@
display: none;
}
}
+.detail-wrapper {
+ padding: 8px 0;
+}
+.detail-images {
+ margin-top: 16px;
+}
+.detail-images-title {
+ font-weight: 600;
+ margin-bottom: 10px;
+ color: #303133;
+}
+.detail-image {
+ width: 120px;
+ height: 120px;
+ margin-right: 10px;
+ margin-bottom: 10px;
+ border-radius: 6px;
+}
+.detail-images-empty {
+ margin-top: 16px;
+ color: #909399;
+}
</style>
diff --git a/src/views/salesManagement/indicatorStats/index.vue b/src/views/salesManagement/indicatorStats/index.vue
index 8cbeb24..0d2017d 100644
--- a/src/views/salesManagement/indicatorStats/index.vue
+++ b/src/views/salesManagement/indicatorStats/index.vue
@@ -38,7 +38,7 @@
</div>
</div>
<div class="stat-content">
- <div class="stat-value">{{ indicatorKpis.shipRate }}%</div>
+ <div class="stat-value">{{ indicatorKpis.shipRate }}</div>
<div class="stat-label">鍙戣揣鐜�</div>
</div>
<div class="stat-bg-decoration"></div>
@@ -127,41 +127,6 @@
<div ref="indicatorChartRef" class="chart-wrapper"></div>
</div>
</el-card>
-
- <!-- 涓氱哗缁熻锛堝洟闃熺淮搴︼紝鏃犱釜浜哄鍚嶏級 -->
- <el-card v-if="showTeamPerformance" class="table-card" shadow="hover">
- <template #header>
- <div class="card-header">
- <span class="card-title">鍥㈤槦涓氱哗缁熻</span>
- </div>
- </template>
- <el-table
- :data="teamPerformanceList"
- border
- stripe
- style="width: 100%"
- :header-cell-style="{ background: '#f5f7fa', color: '#606266', fontWeight: 'bold' }"
- >
- <el-table-column prop="team" label="閿�鍞洟闃�" min-width="120"/>
- <el-table-column prop="orderCount" label="璁㈠崟鏁�" align="right" min-width="100"/>
- <el-table-column prop="salesAmount" label="閿�鍞" align="right" min-width="140">
- <template #default="scope">楼{{ scope.row.salesAmount.toLocaleString() }}</template>
- </el-table-column>
- <el-table-column prop="shipRate" label="鍙戣揣鐜�" align="right" min-width="100">
- <template #default="scope">{{ scope.row.shipRate }}%</template>
- </el-table-column>
- <el-table-column prop="attainment" label="鐩爣杈炬垚鐜�" align="center" min-width="120">
- <template #default="scope">
- <el-tag
- :type="scope.row.attainment >= 100 ? 'success' : scope.row.attainment >= 80 ? 'warning' : 'danger'"
- effect="dark"
- >
- {{ scope.row.attainment }}%
- </el-tag>
- </template>
- </el-table-column>
- </el-table>
- </el-card>
</div>
</template>
@@ -195,13 +160,6 @@
const productOptions = ref([])
const customerOption = ref([])
-
-const teamPerformanceList = ref([
- { team: '鍗庝笢澶у尯', orderCount: 320, salesAmount: 2850000, shipRate: 90, attainment: 105 },
- { team: '鍗庡寳澶у尯', orderCount: 280, salesAmount: 2150000, shipRate: 86, attainment: 92 },
- { team: '鍗庡崡澶у尯', orderCount: 210, salesAmount: 1850000, shipRate: 88, attainment: 78 },
- { team: '瑗垮崡澶у尯', orderCount: 180, salesAmount: 1500000, shipRate: 83, attainment: 74 }
-])
// 杞崲浜у搧鏍戞暟鎹紝灏� id 鏀逛负 value
function convertIdToValue(data) {
@@ -277,7 +235,7 @@
indicatorKpis.orderCount = res.data.total || 0
indicatorKpis.salesAmount = res.data.contractAmountTotal || 0
// 鍙戣揣鐜囧鏋滄帴鍙f病鏈夎繑鍥烇紝淇濇寔鍘熷�兼垨璁句负0
- // indicatorKpis.shipRate = res.data.shipRate || 0
+ indicatorKpis.shipRate = res.data.shipRate || 0
}
} catch (error) {
console.error('鑾峰彇澶撮儴缁熻澶辫触:', error)
diff --git a/src/views/salesManagement/salesLedger/index.vue b/src/views/salesManagement/salesLedger/index.vue
index 457f0f1..170f8ed 100644
--- a/src/views/salesManagement/salesLedger/index.vue
+++ b/src/views/salesManagement/salesLedger/index.vue
@@ -1001,13 +1001,16 @@
// 娣诲姞琛ㄨ绫诲悕鏂规硶
const tableRowClassName = ({ row }) => {
- switch (row.deliveryDaysDiff) {
- case 15:
- return 'yellow'
- case 10:
- return 'red'
- case 2:
- return 'purple'
+ const diff = row.deliveryDaysDiff;
+
+ if (diff === 15) {
+ return 'yellow';
+ } else if (diff === 10) {
+ return 'pink';
+ } else if (diff === 2) {
+ return 'purple';
+ } else if (diff < 2) {
+ return 'red';
}
};
// 涓昏〃鍚堣鏂规硶
@@ -2111,14 +2114,17 @@
background-color: #FAF0DE;
}
-::v-deep .red {
+::v-deep .pink {
background-color: #FAE1DE;
+}
+
+::v-deep .red {
+ background-color: #f80202;
}
::v-deep .purple{
background-color: #F4DEFA;
}
-
.table_list {
margin-top: unset;
--
Gitblit v1.9.3