From 39724c7cb4801b3863bb0135057e5d300f6670be Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期五, 30 一月 2026 15:37:31 +0800
Subject: [PATCH] Merge branch 'dev_New' of http://114.132.189.42:9002/r/product-inventory-management into dev_New
---
src/views/productionManagement/productStructure/Detail/index.vue | 23
src/api/safeProduction/safetyTrainingAssessment.js | 44 ++
src/views/safeProduction/safetyTrainingAssessment/detail.vue | 325 ++++++++++++++++++++
src/views/equipmentManagement/measurementEquipment/components/formDia.vue | 51 +++
src/views/safeProduction/safetyTrainingAssessment/index.vue | 415 ++++++++++++++++++++++---
src/views/equipmentManagement/measurementEquipment/components/calibrationDia.vue | 55 +++
6 files changed, 841 insertions(+), 72 deletions(-)
diff --git a/src/api/safeProduction/safetyTrainingAssessment.js b/src/api/safeProduction/safetyTrainingAssessment.js
index a02ff2e..336e17a 100644
--- a/src/api/safeProduction/safetyTrainingAssessment.js
+++ b/src/api/safeProduction/safetyTrainingAssessment.js
@@ -67,4 +67,46 @@
method: 'delete',
data: ids
})
-}
\ No newline at end of file
+}
+// 绛惧埌
+export function safeTrainingSign(query) {
+ return request({
+ url: '/safeTraining/sign',
+ method: 'post',
+ data: query
+ })
+}
+// 鏌ヨ璇︽儏
+export function safeTrainingGet(query) {
+ return request({
+ url: '/safeTraining/getSafeTraining',
+ method: 'get',
+ params: query
+ })
+}
+
+// 鎻愪氦
+export function safeTrainingSave(query) {
+ return request({
+ url: '/safeTraining/saveSafeTraining',
+ method: 'post',
+ data: query
+ })
+}
+
+export function safeTrainingDetailListPage(query) {
+ return request({
+ url: "/safeTrainingDetails/page",
+ method: "get",
+ params: query,
+ });
+}
+// 瀵煎嚭
+export function safeTrainingDetailExport(query) {
+ return request({
+ url: '/safeTrainingDetails/export',
+ method: 'post',
+ data: query,
+ responseType: 'blob'
+ })
+}
diff --git a/src/views/equipmentManagement/measurementEquipment/components/calibrationDia.vue b/src/views/equipmentManagement/measurementEquipment/components/calibrationDia.vue
index b5c1ea1..b7fa07e 100644
--- a/src/views/equipmentManagement/measurementEquipment/components/calibrationDia.vue
+++ b/src/views/equipmentManagement/measurementEquipment/components/calibrationDia.vue
@@ -51,11 +51,14 @@
</el-form-item>
</el-col>
<el-col :span="12">
- <el-form-item label="鏈夋晥鏈燂細" prop="valid">
+ <el-form-item label="鏈夋晥鏃ユ湡(澶�)锛�" prop="valid">
<el-input
v-model="form.valid"
- placeholder="璇疯緭鍏�"
+ type="number"
+ placeholder="璇疯緭鍏ユ湁鏁堟湡澶╂暟"
clearable
+ :min="1"
+ @input="handleValidInput"
>
<template #append>鏃�</template>
</el-input>
@@ -152,7 +155,32 @@
rules: {
code: [{required: true, message: "璇疯緭鍏�", trigger: "blur"}],
name: [{required: true, message: "璇疯緭鍏�", trigger: "blur"}],
- valid: [{required: true, message: "璇疯緭鍏�", trigger: "blur"}],
+ valid: [
+ {required: true, message: "璇疯緭鍏�", trigger: "blur"},
+ {
+ validator: (rule, value, callback) => {
+ if (value === '' || value === null || value === undefined) {
+ callback();
+ return;
+ }
+ const numValue = Number(value);
+ if (isNaN(numValue)) {
+ callback(new Error('璇疯緭鍏ユ湁鏁堢殑鏁板瓧'));
+ return;
+ }
+ if (numValue <= 0) {
+ callback(new Error('鍙兘杈撳叆姝f暟'));
+ return;
+ }
+ if (!Number.isInteger(numValue)) {
+ callback(new Error('璇疯緭鍏ユ暣鏁�'));
+ return;
+ }
+ callback();
+ },
+ trigger: 'blur'
+ }
+ ],
recordDate: [{required: true, message: "璇烽�夋嫨", trigger: "change"}],
userId: [{required: true, message: "璇烽�夋嫨", trigger: "change"}],
entryDate: [{required: true, message: "璇烽�夋嫨", trigger: "change"}],
@@ -233,6 +261,27 @@
}
}
+// 澶勭悊鏈夋晥鏃ユ湡杈撳叆锛屽彧鍏佽姝f暣鏁�
+const handleValidInput = (value) => {
+ if (value === '' || value === null || value === undefined) {
+ form.value.valid = '';
+ return;
+ }
+ // 杞崲涓哄瓧绗︿覆骞剁Щ闄ゆ墍鏈夐潪鏁板瓧瀛楃锛堝寘鎷礋鍙枫�佸皬鏁扮偣绛夛級
+ const numStr = String(value).replace(/[^0-9]/g, '');
+ if (numStr === '') {
+ form.value.valid = '';
+ return;
+ }
+ const numValue = parseInt(numStr, 10);
+ // 纭繚鏄鏁存暟锛堝ぇ浜�0锛�
+ if (numValue > 0 && !isNaN(numValue)) {
+ form.value.valid = numValue;
+ } else {
+ form.value.valid = '';
+ }
+}
+
const submitForm = () => {
proxy.$refs["formRef"].validate(valid => {
if (valid) {
diff --git a/src/views/equipmentManagement/measurementEquipment/components/formDia.vue b/src/views/equipmentManagement/measurementEquipment/components/formDia.vue
index d2a1969..8a1e302 100644
--- a/src/views/equipmentManagement/measurementEquipment/components/formDia.vue
+++ b/src/views/equipmentManagement/measurementEquipment/components/formDia.vue
@@ -74,8 +74,11 @@
<el-form-item label="鏈夋晥鏃ユ湡(澶�)锛�" prop="valid">
<el-input
v-model="form.valid"
+ type="number"
placeholder="璇疯緭鍏ユ湁鏁堟湡澶╂暟"
clearable
+ :min="1"
+ @input="handleValidInput"
>
<template #append>鏃�</template>
</el-input>
@@ -192,7 +195,32 @@
instationLocation: [{required: true, message: "璇疯緭鍏�", trigger: "blur"}],
mostDate: [{required: true, message: "璇烽�夋嫨", trigger: "change"}],
cycle: [{required: true, message: "璇烽�夋嫨", trigger: "blur"}],
- valid: [{required: true, message: "璇疯緭鍏�", trigger: "blur"}],
+ valid: [
+ {required: true, message: "璇疯緭鍏�", trigger: "blur"},
+ {
+ validator: (rule, value, callback) => {
+ if (value === '' || value === null || value === undefined) {
+ callback();
+ return;
+ }
+ const numValue = Number(value);
+ if (isNaN(numValue)) {
+ callback(new Error('璇疯緭鍏ユ湁鏁堢殑鏁板瓧'));
+ return;
+ }
+ if (numValue <= 0) {
+ callback(new Error('鍙兘杈撳叆姝f暟'));
+ return;
+ }
+ if (!Number.isInteger(numValue)) {
+ callback(new Error('璇疯緭鍏ユ暣鏁�'));
+ return;
+ }
+ callback();
+ },
+ trigger: 'blur'
+ }
+ ],
unit: [{required: true, message: "璇疯緭鍏�", trigger: "blur"}],
}
})
@@ -254,6 +282,27 @@
}
}
+// 澶勭悊鏈夋晥鏃ユ湡杈撳叆锛屽彧鍏佽姝f暣鏁�
+const handleValidInput = (value) => {
+ if (value === '' || value === null || value === undefined) {
+ form.value.valid = '';
+ return;
+ }
+ // 杞崲涓哄瓧绗︿覆骞剁Щ闄ゆ墍鏈夐潪鏁板瓧瀛楃锛堝寘鎷礋鍙枫�佸皬鏁扮偣绛夛級
+ const numStr = String(value).replace(/[^0-9]/g, '');
+ if (numStr === '') {
+ form.value.valid = '';
+ return;
+ }
+ const numValue = parseInt(numStr, 10);
+ // 纭繚鏄鏁存暟锛堝ぇ浜�0锛�
+ if (numValue > 0 && !isNaN(numValue)) {
+ form.value.valid = numValue;
+ } else {
+ form.value.valid = '';
+ }
+}
+
const submitForm = () => {
proxy.$refs["formRef"].validate(valid => {
if (valid) {
diff --git a/src/views/productionManagement/productStructure/Detail/index.vue b/src/views/productionManagement/productStructure/Detail/index.vue
index 3a76e48..6734830 100644
--- a/src/views/productionManagement/productStructure/Detail/index.vue
+++ b/src/views/productionManagement/productStructure/Detail/index.vue
@@ -115,7 +115,7 @@
<el-input v-model="row.unit"
placeholder="璇疯緭鍏ュ崟浣�"
clearable
- :disabled="!dataValue.isEdit || dataValue.dataList.some(item => (item as any).tempId === row.tempId)" />
+ :disabled="!dataValue.isEdit || dataValue.dataList.some(item => (item as any).tempId === row.tempId)" />
</el-form-item>
</template>
</el-table-column>
@@ -264,15 +264,20 @@
const productData = row[0];
// 鏈�澶栧眰缁勪欢涓紝涓庡綋鍓嶄骇鍝佺浉鍚岀殑浜у搧鍙兘鏈変竴涓�
- const isTopLevel = dataValue.dataList.some(item => (item as any).tempId === dataValue.currentRowName);
+ const isTopLevel = dataValue.dataList.some(
+ item => (item as any).tempId === dataValue.currentRowName
+ );
if (isTopLevel) {
- if (productData.productName === tableData[0].productName &&
- productData.model === tableData[0].model) {
+ if (
+ productData.productName === tableData[0].productName &&
+ productData.model === tableData[0].model
+ ) {
// 鏌ユ壘鏄惁宸茬粡鏈夊叾浠栭《灞傝宸茬粡鏄繖涓骇鍝�
- const hasOther = dataValue.dataList.some(item =>
- (item as any).tempId !== dataValue.currentRowName &&
- (item as any).productName === tableData[0].productName &&
- (item as any).model === tableData[0].model
+ const hasOther = dataValue.dataList.some(
+ item =>
+ (item as any).tempId !== dataValue.currentRowName &&
+ (item as any).productName === tableData[0].productName &&
+ (item as any).model === tableData[0].model
);
if (hasOther) {
ElMessage.warning("鏈�澶栧眰鍜屽綋鍓嶄骇鍝佷竴鏍风殑涓�绾у彧鑳芥湁涓�涓�");
@@ -390,7 +395,7 @@
}
};
- const removeItem = (tempId:string) => {
+ const removeItem = (tempId: string) => {
// 鍏堝皾璇曚粠椤跺眰鍒犻櫎
const topIndex = dataValue.dataList.findIndex(item => item.tempId === tempId);
if (topIndex !== -1) {
diff --git a/src/views/safeProduction/safetyTrainingAssessment/detail.vue b/src/views/safeProduction/safetyTrainingAssessment/detail.vue
new file mode 100644
index 0000000..9796980
--- /dev/null
+++ b/src/views/safeProduction/safetyTrainingAssessment/detail.vue
@@ -0,0 +1,325 @@
+<template>
+ <div class="app-container">
+ <PageHeader content="鍩硅璁板綍">
+ </PageHeader>
+ <div class="search_form">
+ <div class="search_item">
+ <span class="search_title">浜哄憳鍚嶇О锛�</span>
+ <el-input v-model="searchForm.searchText"
+ style="width: 240px"
+ placeholder="杈撳叆瀹㈡埛鍚嶇О鎼滅储"
+ @change="searchName"
+ clearable
+ prefix-icon="Search" />
+ <el-button type="primary"
+ @click="searchName"
+ style="margin-left: 10px">鎼滅储</el-button>
+ </div>
+ <div class="search_item">
+ <span class="search_title">骞翠唤锛�</span>
+ <el-date-picker v-model="searchForm.invoiceDate"
+ type="year"
+ @change="searchDate"
+ placeholder="閫夋嫨骞�">
+ </el-date-picker>
+ <el-button type="primary"
+ @click="searchDate"
+ style="margin-left: 10px">鎼滅储</el-button>
+ <el-button type="primary"
+ @click="exportData"
+ style="margin-left: 20px;margin-right: 20px">瀵煎嚭</el-button>
+ </div>
+ </div>
+ <div style="display: flex">
+ <div class="table_list">
+ <el-table :data="tableData"
+ border
+ v-loading="tableLoading"
+ :row-key="(row) => row.id"
+ @row-click="rowClickMethod"
+ height="calc(100vh - 18.5em)">
+ <el-table-column align="center"
+ label="搴忓彿"
+ type="index"
+ width="60" />
+ <el-table-column label="鍚嶇О"
+ prop="nickName"
+ show-overflow-tooltip
+ width="200" />
+ <el-table-column label="鎵�灞為儴闂�"
+ prop="deptNames"
+ show-overflow-tooltip
+ width="200" />
+ <el-table-column label="鑱旂郴鏂瑰紡"
+ prop="phonenumber"
+ show-overflow-tooltip
+ width="200" />
+ <!-- <el-table-column label="email"
+ prop="email"
+ show-overflow-tooltip
+ width="200" /> -->
+ <!-- <el-table-column label="搴旀敹閲戦(鍏�)"
+ prop="unReceiptPaymentAmount"
+ show-overflow-tooltip
+ width="200">
+ <template #default="{ row, column }">
+ <el-text type="danger">
+ {{ formattedNumber(row, column, row.unReceiptPaymentAmount) }}
+ </el-text>
+ </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>
+ <div class="table_list">
+ <el-table :data="receiptRecord"
+ border
+ :row-key="(row) => row.id"
+ height="calc(100vh - 18.5em)">
+ <el-table-column align="center"
+ label="搴忓彿"
+ type="index"
+ width="60" />
+ <el-table-column label="鍩硅鏃ユ湡"
+ prop="trainingDate"
+ show-overflow-tooltip />
+ <el-table-column label="鍩硅鍐呭"
+ prop="trainingContent"
+ show-overflow-tooltip />
+ <el-table-column label="鍩硅璇炬椂"
+ prop="classHour"
+ show-overflow-tooltip />
+ <el-table-column label="鑰冩牳缁撴灉"
+ prop="examinationResults"
+ show-overflow-tooltip>
+ <template #default="{ row }">
+ <el-tag :type="row.examinationResults === '鍚堟牸' ? 'success' : 'danger'">
+ {{ row.examinationResults }}
+ </el-tag>
+ </template>
+ </el-table-column>
+ </el-table>
+ </div>
+ </div>
+ </div>
+</template>
+
+<script setup>
+ import { onMounted, ref } from "vue";
+ import { invoiceLedgerSalesAccount } from "@/api/salesManagement/invoiceLedger.js";
+ import { customerInteractions } from "@/api/salesManagement/receiptPayment.js";
+ import Pagination from "@/components/PIMTable/Pagination.vue";
+ import {
+ safeTrainingDetailListPage,
+ safeTrainingDetailExport,
+ } from "@/api/safeProduction/safetyTrainingAssessment.js";
+ import { userListNoPage } from "@/api/system/user.js";
+ const { proxy } = getCurrentInstance();
+ const tableData = ref([]);
+ const receiptRecord = ref([]);
+ const tableLoading = ref(false);
+ const page = reactive({
+ current: 1,
+ size: 100,
+ });
+ const recordPage = reactive({
+ current: 1,
+ size: 100,
+ });
+ const total = ref(0);
+ const recordTotal = ref(0);
+ const data = reactive({
+ searchForm: {
+ searchText: "",
+ invoiceDate: "",
+ },
+ });
+ const customerId = ref("");
+ const { searchForm } = toRefs(data);
+ const originReceiptRecord = ref([]);
+ // 鏌ヨ鍒楄〃
+ /** 鎼滅储鎸夐挳鎿嶄綔 */
+ const handleQuery = () => {
+ page.current = 1;
+ getList();
+ };
+ const paginationChange = obj => {
+ page.current = obj.page;
+ page.size = obj.limit;
+ getList();
+ };
+ const tableDataCopy = ref([]);
+ const getList = () => {
+ tableLoading.value = true;
+ userListNoPage({}).then(res => {
+ console.log("res", res.data);
+ tableData.value = res.data;
+ tableDataCopy.value = res.data;
+ if (tableData.value.length > 0) {
+ customerId.value = tableData.value[0].userId;
+ receiptPaymentList(customerId.value);
+ tableLoading.value = false;
+ }
+ });
+ };
+ const exportData = () => {
+ safeTrainingDetailExport({
+ userId: customerId.value,
+ })
+ .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 = `璁板綍璇︽儏_${tableData.value[0].nickName}.docx`;
+
+ // 妯℃嫙鐐瑰嚮涓嬭浇
+ 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 formattedNumber = (row, column, cellValue) => {
+ return parseFloat(cellValue).toFixed(2);
+ };
+ // 涓昏〃鍚堣鏂规硶
+ const summarizeMainTable = param => {
+ return proxy.summarizeTable(
+ param,
+ ["invoiceTotal", "receiptPaymentAmount", "unReceiptPaymentAmount"],
+ {
+ ticketsNum: { noDecimal: true }, // 涓嶄繚鐣欏皬鏁�
+ futureTickets: { noDecimal: true }, // 涓嶄繚鐣欏皬鏁�
+ }
+ );
+ };
+ // 瀛愯〃鍚堣鏂规硶
+ const summarizeMainTable1 = param => {
+ var summarizeTable = proxy.summarizeTable(
+ param,
+ ["invoiceAmount", "receiptAmount", "unReceiptAmount"],
+ {
+ ticketsNum: { noDecimal: true }, // 涓嶄繚鐣欏皬鏁�
+ futureTickets: { noDecimal: true }, // 涓嶄繚鐣欏皬鏁�
+ }
+ );
+ // 鍙栨渶鍚庝竴琛屾暟鎹�;
+ if (receiptRecord.value?.length > 0) {
+ const index = tableData.value.findIndex(
+ item => item.id == customerId.value
+ );
+ summarizeTable[summarizeTable.length - 1] =
+ tableData.value[index].unReceiptPaymentAmount.toFixed(2);
+ } else {
+ summarizeTable[summarizeTable.length - 1] = 0.0;
+ }
+ return summarizeTable;
+ };
+ const goBack = () => {
+ proxy.$router.push({
+ path: "/safeProduction/safetyTrainingAssessment",
+ });
+ };
+ const searchName = () => {
+ tableData.value = tableDataCopy.value;
+ if (searchForm.value.searchText) {
+ tableData.value = tableData.value.filter(item =>
+ item.nickName.includes(searchForm.value.searchText)
+ );
+ customerId.value = tableData.value[0].userId;
+ }
+
+ receiptPaymentList(customerId.value);
+ };
+ const dateFormat = (date, format = "yyyy-MM-dd") => {
+ const year = date.getFullYear();
+ const month = String(date.getMonth() + 1).padStart(2, "0");
+ const day = String(date.getDate()).padStart(2, "0");
+ return format.replace("yyyy", year).replace("MM", month).replace("dd", day);
+ };
+ const searchDate = () => {
+ receiptRecord.value = originReceiptRecordCopy.value;
+ console.log("searchForm.value.invoiceDate", searchForm.value.invoiceDate);
+ if (searchForm.value.invoiceDate) {
+ const year = dateFormat(searchForm.value.invoiceDate, "yyyy");
+ receiptRecord.value = receiptRecord.value.filter(item => {
+ console.log("item.trainingDate", item.trainingDate);
+ return item.trainingDate.includes(year);
+ });
+ }
+ };
+ const originReceiptRecordCopy = ref([]);
+ const receiptPaymentList = id => {
+ const param = {
+ userId: id,
+ };
+ console.log("param", param);
+ safeTrainingDetailListPage(param).then(res => {
+ originReceiptRecord.value = res.data.records;
+ handlePagination({ page: 1, limit: recordPage.size });
+ recordTotal.value = res.data.length;
+ });
+ };
+
+ // 姹囨璁板綍鍒楄〃鍒嗛〉
+ const recordPaginationChange = pagination => {
+ handlePagination(pagination);
+ };
+
+ const rowClickMethod = row => {
+ customerId.value = row.userId;
+ receiptPaymentList(customerId.value);
+ };
+
+ const handlePagination = ({ page, limit }) => {
+ recordPage.current = page;
+ recordPage.size = limit;
+
+ const start = (page - 1) * limit;
+ const end = start + limit;
+
+ receiptRecord.value = originReceiptRecord.value.slice(start, end);
+ originReceiptRecordCopy.value = originReceiptRecord.value.slice(start, end);
+ };
+
+ onMounted(() => {
+ getList();
+ });
+</script>
+
+<style scoped lang="scss">
+ .table_list {
+ width: 50%;
+ }
+ .search_back {
+ cursor: pointer;
+ color: #0f497e;
+ }
+ .search_item {
+ width: 50%;
+ display: flex;
+ align-items: center;
+ justify-content: flex-start;
+ margin-right: 20px;
+ }
+</style>
diff --git a/src/views/safeProduction/safetyTrainingAssessment/index.vue b/src/views/safeProduction/safetyTrainingAssessment/index.vue
index 8fbfe9b..1ab310f 100644
--- a/src/views/safeProduction/safetyTrainingAssessment/index.vue
+++ b/src/views/safeProduction/safetyTrainingAssessment/index.vue
@@ -2,23 +2,14 @@
<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>
+ <span class="search_title">鍩硅鏃ユ湡锛�</span>
+ <el-date-picker v-model="searchForm.trainingDate"
+ value-format="YYYY-MM-DD"
+ format="YYYY-MM-DD"
+ @change="handleQuery"
+ type="date"
+ placeholder="璇烽�夋嫨"
+ clearable />
<el-button type="primary"
@click="handleQuery"
style="margin-left: 10px">
@@ -28,12 +19,24 @@
<div>
<el-button type="primary"
@click="openForm('add')">鏂板鍩硅</el-button>
+ <el-button type="primary"
+ @click="opendetail">鍩硅璁板綍</el-button>
<el-button type="danger"
plain
@click="handleDelete">鍒犻櫎</el-button>
</div>
</div>
<div class="table_list">
+ <el-tabs v-model="searchForm.state"
+ @tab-click="tabhandleQuery">
+ <el-tab-pane label="鏈紑濮�"
+ :name="0"></el-tab-pane>
+ <el-tab-pane label="杩涜涓�"
+ :name="1"></el-tab-pane>
+ <el-tab-pane label="宸茬粨鏉�"
+ :name="2"></el-tab-pane>
+ </el-tabs>
+ <!-- state 鐘舵��(0锛氭湭寮�濮�1锛氳繘琛屼腑锛�2锛氬凡缁撴潫) -->
<PIMTable rowKey="id"
:column="tableColumn"
:tableData="tableData"
@@ -135,6 +138,8 @@
<el-form-item label="璇剧▼瀛﹀垎"
prop="projectCredits">
<el-input v-model="form.projectCredits"
+ type="number"
+ min="0"
placeholder="璇疯緭鍏ヨ绋嬪鍒�" />
</el-form-item>
</el-col>
@@ -181,51 +186,164 @@
</el-dialog>
<!-- 鏌ョ湅鐭ヨ瘑璇︽儏寮圭獥 -->
<el-dialog v-model="viewDialogVisible"
- title="鍩硅璇︽儏"
+ 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-descriptions size="mini"
+ style="margin-left: 60px;"
+ :column="3">
+ <el-descriptions-item label="璇剧▼缂栧彿:">{{ currentKnowledge.courseCode }}</el-descriptions-item>
+ <el-descriptions-item label="鍩硅鍐呭:">{{ currentKnowledge.trainingContent }}</el-descriptions-item>
+ <el-descriptions-item label="鐘舵��:">
+ <el-tag :type="currentKnowledge.status === 0 ? 'success' : (currentKnowledge.status === 1 ? 'success' : 'info')">
+ {{ currentKnowledge.status === 0 ? '鏈紑濮�' : (currentKnowledge.status === 1 ? '杩涜涓�' : '宸茬粨鏉�') }}
</el-tag>
</el-descriptions-item>
- <el-descriptions-item label="鎵�鍦ㄤ綅缃�">
- {{ currentKnowledge.location }}
+ <el-descriptions-item label="鍩硅璁插笀:">
+ {{ currentKnowledge.trainingLecturer }}
</el-descriptions-item>
- <el-descriptions-item label="绠℃帶鎺柦">
- {{ currentKnowledge.controlMeasures }}
+ <el-descriptions-item label="鍩硅寮�濮嬫椂闂�:">
+ {{ currentKnowledge.trainingDate + ' ' + currentKnowledge.openingTime }}
</el-descriptions-item>
- <el-descriptions-item label="搴撳瓨鏁伴噺">
- {{ currentKnowledge.stockQty }}
+ <el-descriptions-item label="鍩硅缁撴潫鏃堕棿:">
+ {{ currentKnowledge.trainingDate + ' ' + currentKnowledge.endTime }}
</el-descriptions-item>
- <el-descriptions-item label="绠℃帶璐d换浜�">
- {{ currentKnowledge.principalUserId }}
+ <el-descriptions-item label="鍩硅鐩爣:">
+ {{ currentKnowledge.trainingObjectives }}
</el-descriptions-item>
- <el-descriptions-item label="璐d换浜鸿仈绯荤數璇�">
- {{ currentKnowledge.principalMobile }}
+ <el-descriptions-item label="鍙傚姞瀵硅薄:">
+ {{ currentKnowledge.participants }}
</el-descriptions-item>
- <el-descriptions-item label="椋庨櫓绛夌骇">
- <el-tag :type="getTypeTagType(currentKnowledge.riskLevel)">
- {{ currentKnowledge.riskLevel }}
+ <el-descriptions-item label="鍩硅鏂瑰紡:">
+ <el-tag type="primary">
+ {{ getTrainingModeLabel(currentKnowledge.trainingMode) }}
</el-tag>
</el-descriptions-item>
- <el-descriptions-item label="瑙勬牸 / 椋庨櫓鎻忚堪">
- {{ currentKnowledge.specInfo }}
+ <el-descriptions-item label="鍩硅鍦扮偣:">
+ {{ currentKnowledge.placeTraining }}
+ </el-descriptions-item>
+ <el-descriptions-item label="璇炬椂:">
+ {{ currentKnowledge.classHour }}
+ </el-descriptions-item>
+ <el-descriptions-item label="璇剧▼瀛﹀垎:">
+ {{ currentKnowledge.projectCredits }}
+ </el-descriptions-item>
+ <el-descriptions-item label="鎶ュ悕浜烘暟:">
+ {{ currentKnowledge.nums }}
+ </el-descriptions-item>
+ <el-descriptions-item label="闄勪欢鍒楄〃:">
+ <el-button type="primary"
+ size="small"
+ @click="downLoadFile(endform)">闄勪欢鍒楄〃</el-button>
</el-descriptions-item>
</el-descriptions>
+ <el-divider style="margin: 20px 0;" />
+ <el-form ref="formRef"
+ :model="form"
+ :rules="rules"
+ label-width="130px">
+ <el-row :gutter="20">
+ <el-col :span="12">
+ <el-form-item label="璇勪环浜�:"
+ prop="courseCode">
+ <el-input v-model="endform.assessmentUserName"
+ disabled
+ placeholder="璇烽�夋嫨璇勪环浜�" />
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="璇勪环鏃堕棿:"
+ prop="trainingDate">
+ <el-date-picker style="width: 100%"
+ disabled
+ v-model="endform.assessmentDate"
+ value-format="YYYY-MM-DD"
+ format="YYYY-MM-DD"
+ type="date"
+ placeholder="璇烽�夋嫨"
+ clearable />
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row :gutter="20">
+ <el-col :span="12">
+ <el-form-item label="鑰冩牳鏂瑰紡:"
+ prop="assessmentMethod">
+ <el-input v-model="endform.assessmentMethod"
+ placeholder="璇烽�夋嫨鑰冩牳鏂瑰紡" />
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="鏈璇剧▼缁煎悎璇勪环:"
+ prop="comprehensiveAssessment">
+ <el-input v-model="endform.comprehensiveAssessment"
+ placeholder="璇疯緭鍏ユ湰娆¤绋嬬患鍚堣瘎浠�" />
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-form-item label="鍩硅鎽樿:"
+ prop="trainingAbstract">
+ <el-input v-model="endform.trainingAbstract"
+ type="textarea"
+ :rows="2"
+ placeholder="璇疯緭鍏ュ煿璁憳瑕�" />
+ </el-form-item>
+ <!-- <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>
+ <el-table style="margin-top: 20px;"
+ :data="endform.safeTrainingDetailsDtoList"
+ border
+ fit
+ highlight-current-row>
+ <el-table-column prop="nickName"
+ label="濮撳悕" />
+ <el-table-column prop="phonenumber"
+ label="鐢佃瘽鍙风爜" />
+ <el-table-column prop="examinationResults"
+ label="鑰冩牳缁撴灉">
+ <template #default="scope">
+ <el-select v-model="scope.row.examinationResults"
+ placeholder="璇烽�夋嫨鑰冩牳缁撴灉">
+ <el-option label="鍚堟牸"
+ value="鍚堟牸" />
+ <el-option label="涓嶅悎鏍�"
+ value="涓嶅悎鏍�" />
+ </el-select>
+ </template>
+ </el-table-column>
+ </el-table>
</div>
<template #footer>
<span class="dialog-footer">
+ <el-button type="primary"
+ @click="submitForm2">鎻愪氦</el-button>
<el-button @click="viewDialogVisible = false">鍏抽棴</el-button>
</span>
</template>
@@ -265,7 +383,13 @@
safeTrainingFileListPage,
safeTrainingFileAdd,
safeTrainingFileDel,
+ safeTrainingSign,
+ safeTrainingGet,
+ safeTrainingSave,
} from "@/api/safeProduction/safetyTrainingAssessment.js";
+ import useUserStore from "@/store/modules/user";
+ import dayjs from "dayjs";
+ const userStore = useUserStore();
// 琛ㄥ崟楠岃瘉瑙勫垯
const rules = {
@@ -284,12 +408,17 @@
],
classHour: [{ required: true, message: "璇疯緭鍏ヨ鏃�", trigger: "blur" }],
};
-
+ const upload = reactive({
+ // 涓婁紶鐨勫湴鍧�
+ url: import.meta.env.VITE_APP_BASE_API + "/file/upload",
+ // 璁剧疆涓婁紶鐨勮姹傚ご閮�
+ headers: { Authorization: "Bearer " + getToken() },
+ });
// 鍝嶅簲寮忔暟鎹�
const data = reactive({
searchForm: {
- name: "",
- type: "",
+ trainingDate: "",
+ state: 0,
},
tableLoading: false,
page: {
@@ -342,6 +471,13 @@
);
return item ? item.label : val;
};
+ // 鍒囨崲tab鏌ヨ
+ const tabhandleQuery = val => {
+ searchForm.value.state = val.paneName;
+ console.log(searchForm.value.state, "searchForm.value.state");
+
+ handleQuery();
+ };
// 琛ㄥ崟寮曠敤
const formRef = ref();
const riskLevelOptions = ref([
@@ -351,56 +487,69 @@
{ value: "閲嶅ぇ椋庨櫓", label: "閲嶅ぇ椋庨櫓" },
]);
+ const fileList = ref([]);
+
// 琛ㄦ牸鍒楅厤缃�
const tableColumn = ref([
{
label: "璇剧▼缂栧彿",
prop: "courseCode",
+ width: 150,
showOverflowTooltip: true,
},
{
label: "鍩硅鏃ユ湡",
prop: "trainingDate",
+ width: 120,
+
showOverflowTooltip: true,
},
{
label: "寮�濮嬫椂闂�",
prop: "openingTime",
+ width: 120,
showOverflowTooltip: true,
},
{
label: "缁撴潫鏃堕棿",
prop: "endTime",
+ width: 120,
showOverflowTooltip: true,
},
{
label: "鍩硅鐩爣",
prop: "trainingObjectives",
+ width: 200,
showOverflowTooltip: true,
},
{
label: "鍙傚姞瀵硅薄",
prop: "participants",
+ width: 200,
showOverflowTooltip: true,
},
{
label: "鍩硅鍐呭",
prop: "trainingContent",
+ width: 200,
showOverflowTooltip: true,
},
{
label: "鍩硅璁插笀",
prop: "trainingLecturer",
+ width: 200,
showOverflowTooltip: true,
},
{
label: "椤圭洰瀛﹀垎",
prop: "projectCredits",
+ width: 120,
showOverflowTooltip: true,
},
{
label: "鍩硅鏂瑰紡",
prop: "trainingMode",
+ width: 120,
showOverflowTooltip: true,
formatData: params => {
return getTrainingModeLabel(params);
@@ -409,11 +558,19 @@
{
label: "鍩硅鍦扮偣",
prop: "placeTraining",
+ width: 200,
showOverflowTooltip: true,
},
{
label: "璇炬椂",
prop: "classHour",
+ width: 120,
+ showOverflowTooltip: true,
+ },
+ {
+ label: "鎶ュ悕浜烘暟",
+ prop: "nums",
+ width: 120,
showOverflowTooltip: true,
},
{
@@ -421,27 +578,47 @@
label: "鎿嶄綔",
align: "center",
fixed: "right",
- width: 200,
+ width: 300,
operation: [
+ {
+ name: "绛惧埌",
+ type: "text",
+ disabled: row => row.state !== 1,
+ clickFun: row => {
+ signIn(row);
+ },
+ },
{
name: "缂栬緫",
type: "text",
+ disabled: row => row.state !== 0,
clickFun: row => {
openForm("edit", row);
},
},
{
name: "瀵煎嚭",
- type: "danger",
+ type: "text",
clickFun: row => {
exportKnowledge(row);
},
+ color: "#C49000",
},
{
name: "闄勪欢",
- type: "danger",
+ type: "text",
clickFun: row => {
downLoadFile(row);
+ },
+ color: "#007AFF",
+ },
+
+ {
+ name: "缁撴灉鏄庣粏",
+ type: "text",
+ // disabled: row => row.state !== 2,
+ clickFun: row => {
+ viewResultDetail(row);
},
},
// {
@@ -457,12 +634,133 @@
const userList = ref([]);
// 鐢熷懡鍛ㄦ湡
onMounted(() => {
+ getCurrentFactoryName();
getList();
startAutoRefresh();
userListNoPage().then(res => {
userList.value = res.data;
});
});
+ const endform = ref({
+ assessmentUserId: "", //璇勪环浜�
+ assessmentUserName: "", //璇勪环浜哄鍚�
+ assessmentMethod: "", //鑰冩牳鏂瑰紡
+ assessmentDate: "", //璇勪环鏃堕棿
+ comprehensiveAssessment: "", //缁煎悎璇勪环
+ trainingAbstract: "", //鍩硅鎽樿
+ safeTrainingFileList: [], //鍩硅闄勪欢
+ safeTrainingDetailsDtoList: [], //鑰冩牳缁撴灉璇︽儏
+ });
+ const operationType = ref("edit");
+ const viewResultDetail = row => {
+ // fileList.value = [];
+ operationType.value = "edit";
+ safeTrainingGet({ id: row.id }).then(res => {
+ if (res.code === 200) {
+ console.log(res.data, "res.data");
+ currentKnowledge.value = JSON.parse(JSON.stringify(res.data));
+ currentKnowledge.value.nums = row.nums;
+ viewDialogVisible.value = true;
+ endform.value = { ...res.data };
+ endform.value.assessmentUserName = endform.value.assessmentUserName
+ ? endform.value.assessmentUserName
+ : currentUserName.value;
+ endform.value.assessmentUserId = endform.value.assessmentUserId
+ ? endform.value.assessmentUserId
+ : currentUserId.value;
+ endform.value.assessmentDate = dayjs().format("YYYY-MM-DD");
+ } else {
+ proxy.$modal.msgError(res.msg || "鏌ヨ璇︽儏澶辫触");
+ }
+ });
+ };
+
+ // 涓婁紶鍓嶆牎妫�
+ function handleBeforeUpload(file) {
+ 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 (!endform.value.safeTrainingFileList) {
+ endform.value.safeTrainingFileList = [];
+ }
+ endform.value.safeTrainingFileList.push({
+ id: res.data.tempId,
+ fileName: res.data.originalName,
+ url: res.data.tempPath,
+ safeTrainingId: currentKnowledge.value.id,
+ });
+ proxy.$modal.msgSuccess("涓婁紶鎴愬姛");
+ } else {
+ proxy.$modal.msgError(res.msg);
+ proxy.$refs.fileUpload.handleRemove(file);
+ }
+ }
+ // 绉婚櫎鏂囦欢
+ function handleRemove(file) {
+ if (operationType.value === "edit") {
+ let index = endform.value.safeTrainingFileList.findIndex(
+ item => item.fileName === file.name
+ );
+ if (index !== -1) {
+ endform.value.safeTrainingFileList.splice(index, 1);
+ }
+ }
+ }
+ const submitForm2 = () => {
+ endform.value.safeTrainingDetailsDtoList.forEach((item, index) => {
+ if (!item.examinationResults) {
+ proxy.$modal.msgError(`璇烽�夋嫨${item.nickName}鐨勮�冩牳缁撴灉`);
+ return;
+ }
+ });
+ console.log(endform.value, "endform.value");
+ proxy.$modal.loading("姝e湪鎻愪氦锛岃绋嶅��...");
+ safeTrainingSave(endform.value).then(res => {
+ proxy.$modal.closeLoading();
+ if (res.code === 200) {
+ proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
+ getList();
+ viewDialogVisible.value = false;
+ } else {
+ proxy.$modal.msgError(res.msg || "鎻愪氦澶辫触");
+ }
+ });
+ };
+ const opendetail = row => {
+ proxy.$router.push({
+ path: "/safeProduction/safetyTrainingAssessmentDetail",
+ });
+ };
+
+ const signIn = row => {
+ ElMessageBox.confirm("纭绛惧埌鍚楋紵", "鎻愮ず", {
+ confirmButtonText: "纭畾",
+ cancelButtonText: "鍙栨秷",
+ type: "warning",
+ }).then(() => {
+ safeTrainingSign({
+ safeTrainingId: row.id,
+ userId: currentUserId.value,
+ }).then(res => {
+ if (res.code === 200) {
+ proxy.$modal.msgSuccess("绛惧埌鎴愬姛");
+ getList();
+ } else {
+ proxy.$modal.msgError(res.msg || "绛惧埌澶辫触");
+ }
+ });
+ });
+ };
// 澶勭悊鐢ㄦ埛閫夋嫨鍙樺寲
const handleUserChange = userId => {
@@ -627,7 +925,7 @@
const url = window.URL.createObjectURL(blob);
const link = document.createElement("a");
link.href = url;
- link.download = `鍩硅璁板綍_${row.courseCode}.xlsx`;
+ link.download = `鍩硅璁板綍_${row.courseCode}.docx`;
// 妯℃嫙鐐瑰嚮涓嬭浇
document.body.appendChild(link);
@@ -670,6 +968,13 @@
const handleSelectionChange = selection => {
selectedIds.value = selection.map(item => item.id);
};
+ 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 openForm = (type, row = null) => {
@@ -710,12 +1015,6 @@
});
}
dialogVisible.value = true;
- };
-
- // 鏌ョ湅鍩硅璇︽儏
- const viewKnowledge = row => {
- currentKnowledge.value = { ...row };
- viewDialogVisible.value = true;
};
// 鑾峰彇绫诲瀷鏍囩绫诲瀷
--
Gitblit v1.9.3