From 50e637f1ab3c6eb6ec29b4968de70a0b6d4f4224 Mon Sep 17 00:00:00 2001
From: huminmin <mac@MacBook-Pro.local>
Date: 星期四, 04 六月 2026 17:06:52 +0800
Subject: [PATCH] Merge branch 'dev_天津_阳光印刷' of http://114.132.189.42:9002/r/product-inventory-management into dev_天津_阳光印刷
---
src/views/collaborativeApproval/notificationManagement/summary/index.vue | 624 ++--
src/views/collaborativeApproval/notificationManagement/meetExamine/index.vue | 632 ++--
src/views/qualityManagement/metricMaintenance/StandardFormDialog.vue | 215
src/views/collaborativeApproval/notificationManagement/meetPublish/index.vue | 622 ++--
src/views/productionManagement/workOrder/index.vue | 59
src/views/qualityManagement/finalInspection/components/formDia.vue | 872 +++--
src/views/qualityManagement/metricMaintenance/index.vue | 1680 ++++++------
src/views/collaborativeApproval/notificationManagement/meetApplication/index.vue | 844 +++---
src/views/qualityManagement/finalInspection/index.vue | 1293 +++++----
src/views/qualityManagement/metricBinding/index.vue | 1133 ++++---
10 files changed, 4,351 insertions(+), 3,623 deletions(-)
diff --git a/src/views/collaborativeApproval/notificationManagement/meetApplication/index.vue b/src/views/collaborativeApproval/notificationManagement/meetApplication/index.vue
index b2fb88d..f083574 100644
--- a/src/views/collaborativeApproval/notificationManagement/meetApplication/index.vue
+++ b/src/views/collaborativeApproval/notificationManagement/meetApplication/index.vue
@@ -1,18 +1,17 @@
<template>
<div>
-
<!-- 鐢宠绫诲瀷閫夋嫨 -->
<el-card class="type-card">
<div class="type-selector">
- <div
- v-for="type in applicationTypes"
- :key="type.value"
- class="type-item"
- :class="{ active: currentType === type.value }"
- @click="changeType(type.value)"
- >
+ <div v-for="type in applicationTypes"
+ :key="type.value"
+ class="type-item"
+ :class="{ active: currentType === type.value }"
+ @click="changeType(type.value)">
<div class="type-icon">
- <el-icon :size="24"><component :is="type.icon"/></el-icon>
+ <el-icon :size="24">
+ <component :is="type.icon" />
+ </el-icon>
</div>
<div class="type-info">
<div class="type-name">{{ type.name }}</div>
@@ -21,491 +20,512 @@
</div>
</div>
</el-card>
-
<!-- 浼氳鐢宠琛ㄥ崟 -->
<el-card>
<div class="form-header">
<h3>{{ getCurrentTypeName() }}鐢宠</h3>
</div>
-
- <el-form
- ref="meetingFormRef"
- :model="meetingForm"
- :rules="rules"
- label-width="100px"
- >
+ <el-form ref="meetingFormRef"
+ :model="meetingForm"
+ :rules="rules"
+ label-width="100px">
<el-row :gutter="20">
<el-col :span="12">
- <el-form-item label="浼氳涓婚" prop="title">
- <el-input v-model="meetingForm.title" placeholder="璇疯緭鍏ヤ細璁富棰�"/>
+ <el-form-item label="浼氳涓婚"
+ prop="title">
+ <el-input v-model="meetingForm.title"
+ placeholder="璇疯緭鍏ヤ細璁富棰�" />
</el-form-item>
</el-col>
</el-row>
-
<el-row :gutter="20">
<el-col :span="12">
- <el-form-item label="浼氳瀹�" prop="roomId">
- <el-select v-model="meetingForm.roomId" placeholder="璇烽�夋嫨浼氳瀹�" style="width: 100%">
- <el-option
- v-for="room in meetingRooms"
- :key="room.id"
- :label="`${room.name} (${room.location})`"
- :value="room.id"
- />
+ <el-form-item label="浼氳瀹�"
+ prop="roomId">
+ <el-select v-model="meetingForm.roomId"
+ placeholder="璇烽�夋嫨浼氳瀹�"
+ style="width: 100%">
+ <el-option v-for="room in meetingRooms"
+ :key="room.id"
+ :label="`${room.name} (${room.location})`"
+ :value="room.id" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
- <el-form-item label="涓绘寔浜�" prop="host">
- <el-input v-model="meetingForm.host" placeholder="璇疯緭鍏ヤ富鎸佷汉濮撳悕"/>
+ <el-form-item label="涓绘寔浜�"
+ prop="host">
+ <el-input v-model="meetingForm.host"
+ placeholder="璇疯緭鍏ヤ富鎸佷汉濮撳悕" />
</el-form-item>
</el-col>
</el-row>
-
<el-row :gutter="20">
<el-col :span="12">
- <el-form-item label="浼氳鏃ユ湡" prop="meetingDate">
- <el-date-picker
- v-model="meetingForm.meetingDate"
- type="date"
- placeholder="璇烽�夋嫨浼氳鏃ユ湡"
- value-format="YYYY-MM-DD"
- format="YYYY-MM-DD"
- :disabled-date="disabledDate"
- style="width: 100%"
- />
+ <el-form-item label="浼氳鏃ユ湡"
+ prop="meetingDate">
+ <el-date-picker v-model="meetingForm.meetingDate"
+ type="date"
+ placeholder="璇烽�夋嫨浼氳鏃ユ湡"
+ value-format="YYYY-MM-DD"
+ format="YYYY-MM-DD"
+ :disabled-date="disabledDate"
+ style="width: 100%" />
</el-form-item>
</el-col>
<el-col :span="12">
<!-- 绌哄垪锛屼繚鎸佸竷灞� -->
</el-col>
</el-row>
-
<el-row :gutter="20">
<el-col :span="12">
- <el-form-item label="寮�濮嬫椂闂�" prop="startTime">
- <el-select
- v-model="meetingForm.startTime"
- placeholder="璇烽�夋嫨寮�濮嬫椂闂�"
- style="width: 100%"
- >
- <el-option
- v-for="time in startTimeOptions"
- :key="time.value"
- :label="time.label"
- :value="time.value"
- />
+ <el-form-item label="寮�濮嬫椂闂�"
+ prop="startTime">
+ <el-select v-model="meetingForm.startTime"
+ placeholder="璇烽�夋嫨寮�濮嬫椂闂�"
+ style="width: 100%">
+ <el-option v-for="time in startTimeOptions"
+ :key="time.value"
+ :label="time.label"
+ :value="time.value" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
- <el-form-item label="缁撴潫鏃堕棿" prop="endTime">
- <el-select
- v-model="meetingForm.endTime"
- placeholder="璇烽�夋嫨缁撴潫鏃堕棿"
- style="width: 100%"
- >
- <el-option
- v-for="time in endTimeOptions"
- :key="time.value"
- :label="time.label"
- :value="time.value"
- />
+ <el-form-item label="缁撴潫鏃堕棿"
+ prop="endTime">
+ <el-select v-model="meetingForm.endTime"
+ placeholder="璇烽�夋嫨缁撴潫鏃堕棿"
+ style="width: 100%">
+ <el-option v-for="time in endTimeOptions"
+ :key="time.value"
+ :label="time.label"
+ :value="time.value" />
</el-select>
</el-form-item>
</el-col>
</el-row>
-
- <el-form-item label="鍙備細浜哄憳" prop="participants">
- <el-select
- v-model="meetingForm.participants"
- multiple
- filterable
- placeholder="璇烽�夋嫨鍙備細浜哄憳"
- style="width: 100%"
- >
- <el-option
- v-for="person in employees"
- :key="person.id"
- :label="`${person.staffName}${person.postName ? ` (${person.postName})` : ''}`"
- :value="person.id"
- />
+ <el-form-item label="鍙備細浜哄憳"
+ prop="participants">
+ <el-select v-model="meetingForm.participants"
+ multiple
+ filterable
+ placeholder="璇烽�夋嫨鍙備細浜哄憳"
+ style="width: 100%">
+ <el-option v-for="user in users"
+ :key="user.userId"
+ :label="user.deptNames ? `${user.nickName} (${user.deptNames})` : user.nickName"
+ :value="user.userId" />
</el-select>
</el-form-item>
-
- <el-form-item label="浼氳璇存槑" prop="description">
- <el-input
- v-model="meetingForm.description"
- type="textarea"
- :rows="4"
- placeholder="璇疯緭鍏ヤ細璁鏄�"
- />
+ <el-form-item label="浼氳璇存槑"
+ prop="description">
+ <el-input v-model="meetingForm.description"
+ type="textarea"
+ :rows="4"
+ placeholder="璇疯緭鍏ヤ細璁鏄�" />
</el-form-item>
</el-form>
-
<div class="form-footer">
<el-button @click="resetForm">閲嶇疆</el-button>
- <el-button type="primary" @click="submitForm">鎻愪氦</el-button>
+ <el-button type="primary"
+ @click="submitForm">鎻愪氦</el-button>
</div>
</el-card>
</div>
</template>
<script setup>
-import {ref, reactive, onMounted, computed, watch} from 'vue'
-import {ElMessage} from 'element-plus'
-import {Plus, Document, Promotion, Bell} from '@element-plus/icons-vue'
-import {getRoomEnum, saveMeetingApplication} from '@/api/collaborativeApproval/meeting.js'
-import {staffOnJobListPage} from "@/api/personnelManagement/staffOnJob.js";
+ import { ref, reactive, onMounted, computed, watch } from "vue";
+ import { ElMessage } from "element-plus";
+ import { Plus, Document, Promotion, Bell } from "@element-plus/icons-vue";
+ import {
+ getRoomEnum,
+ saveMeetingApplication,
+ } from "@/api/collaborativeApproval/meeting.js";
+ import { userListNoPageByTenantId } from "@/api/system/user.js";
-// 褰撳墠鐢宠绫诲瀷
-const currentType = ref('department') // approval: 瀹℃壒娴佺▼, department: 閮ㄩ棬绾�, notification: 閫氱煡鍙戝竷
+ // 褰撳墠鐢宠绫诲瀷
+ const currentType = ref("department"); // approval: 瀹℃壒娴佺▼, department: 閮ㄩ棬绾�, notification: 閫氱煡鍙戝竷
-// 鐢宠绫诲瀷閫夐」
-const applicationTypes = ref([
- {
- value: 'approval',
- name: '瀹℃壒娴佺▼浼氳',
- desc: '闇�瑕佺粡杩囧绾у鎵圭殑浼氳鐢宠',
- icon: Document
- },
- {
- value: 'department',
- name: '閮ㄩ棬绾т細璁�',
- desc: '閮ㄩ棬鍐呴儴浼氳鐢宠娴佺▼',
- icon: Promotion
- },
- {
- value: 'notification',
- name: '浼氳閫氱煡',
- desc: '鏃犻渶瀹℃壒鐩存帴鍙戝竷鐨勪細璁�氱煡',
- icon: Bell
- }
-])
+ // 鐢宠绫诲瀷閫夐」
+ const applicationTypes = ref([
+ {
+ value: "approval",
+ name: "瀹℃壒娴佺▼浼氳",
+ desc: "闇�瑕佺粡杩囧绾у鎵圭殑浼氳鐢宠",
+ icon: Document,
+ },
+ {
+ value: "department",
+ name: "閮ㄩ棬绾т細璁�",
+ desc: "閮ㄩ棬鍐呴儴浼氳鐢宠娴佺▼",
+ icon: Promotion,
+ },
+ {
+ value: "notification",
+ name: "浼氳閫氱煡",
+ desc: "鏃犻渶瀹℃壒鐩存帴鍙戝竷鐨勪細璁�氱煡",
+ icon: Bell,
+ },
+ ]);
-// 琛ㄥ崟鏁版嵁
-const meetingForm = reactive({
- title: '',
- type: '',
- roomId: '',
- host: '',
- meetingDate: '',
- startTime: '',
- endTime: '',
- participants: [],
- description: ''
-})
+ // 琛ㄥ崟鏁版嵁
+ const meetingForm = reactive({
+ title: "",
+ type: "",
+ roomId: "",
+ host: "",
+ meetingDate: "",
+ startTime: "",
+ endTime: "",
+ participants: [],
+ description: "",
+ });
-// 琛ㄥ崟寮曠敤
-const meetingFormRef = ref(null)
+ // 琛ㄥ崟寮曠敤
+ const meetingFormRef = ref(null);
-// 浼氳瀹ゅ垪琛�
-const meetingRooms = ref([])
+ // 浼氳瀹ゅ垪琛�
+ const meetingRooms = ref([]);
-// 鍛樺伐鍒楄〃
-const employees = ref([])
+ // 鐢ㄦ埛鍒楄〃锛堢郴缁熺鐞�-鐢ㄦ埛绠$悊锛�
+ const users = ref([]);
-// 鏃堕棿閫夐」锛堜互鍗婂皬鏃朵负闂撮殧锛�
-const timeOptions = ref([])
+ // 鏃堕棿閫夐」锛堜互鍗婂皬鏃朵负闂撮殧锛�
+ const timeOptions = ref([]);
-const getTimeInMinutes = (time) => {
- if (!time) return -1
- const [hour, minute] = time.split(':').map(Number)
- return hour * 60 + minute
-}
+ const getTimeInMinutes = time => {
+ if (!time) return -1;
+ const [hour, minute] = time.split(":").map(Number);
+ return hour * 60 + minute;
+ };
-const isToday = (dateText) => {
- if (!dateText) return false
- const [year, month, day] = dateText.split('-').map(Number)
- const now = new Date()
- return year === now.getFullYear() && month === now.getMonth() + 1 && day === now.getDate()
-}
+ const isToday = dateText => {
+ if (!dateText) return false;
+ const [year, month, day] = dateText.split("-").map(Number);
+ const now = new Date();
+ return (
+ year === now.getFullYear() &&
+ month === now.getMonth() + 1 &&
+ day === now.getDate()
+ );
+ };
-const validateStartTime = (_rule, value, callback) => {
- if (!value) {
- callback()
- return
- }
-
- if (isToday(meetingForm.meetingDate)) {
- const now = new Date()
- const currentMinutes = now.getHours() * 60 + now.getMinutes()
- if (getTimeInMinutes(value) > currentMinutes) {
- callback(new Error('褰撳ぉ寮�濮嬫椂闂翠笉鑳芥櫄浜庡綋鍓嶆椂闂�'))
- return
+ const validateStartTime = (_rule, value, callback) => {
+ if (!value) {
+ callback();
+ return;
}
- }
- callback()
-}
-
-const validateEndTime = (_rule, value, callback) => {
- if (!value || !meetingForm.startTime) {
- callback()
- return
- }
-
- if (getTimeInMinutes(value) <= getTimeInMinutes(meetingForm.startTime)) {
- callback(new Error('缁撴潫鏃堕棿蹇呴』澶т簬寮�濮嬫椂闂�'))
- return
- }
-
- callback()
-}
-
-// 琛ㄥ崟鏍¢獙瑙勫垯
-const rules = {
- title: [{required: true, message: '璇疯緭鍏ヤ細璁富棰�', trigger: 'blur'}],
- roomId: [{required: true, message: '璇烽�夋嫨浼氳瀹�', trigger: 'change'}],
- host: [{required: true, message: '璇疯緭鍏ヤ富鎸佷汉', trigger: 'blur'}],
- meetingDate: [{required: true, message: '璇烽�夋嫨浼氳鏃ユ湡', trigger: 'change'}],
- startTime: [
- {required: true, message: '璇烽�夋嫨寮�濮嬫椂闂�', trigger: 'change'},
- {validator: validateStartTime, trigger: 'change'}
- ],
- endTime: [
- {required: true, message: '璇烽�夋嫨缁撴潫鏃堕棿', trigger: 'change'},
- {validator: validateEndTime, trigger: 'change'}
- ],
- participants: [{required: true, message: '璇烽�夋嫨鍙備細浜哄憳', trigger: 'change'}]
-}
-
-const startTimeOptions = computed(() => {
- if (!isToday(meetingForm.meetingDate)) {
- return timeOptions.value
- }
- const now = new Date()
- const currentMinutes = now.getHours() * 60 + now.getMinutes()
- return timeOptions.value.filter(item => getTimeInMinutes(item.value) <= currentMinutes)
-})
-
-const endTimeOptions = computed(() => {
- if (!meetingForm.startTime) {
- return timeOptions.value
- }
- const startMinutes = getTimeInMinutes(meetingForm.startTime)
- return timeOptions.value.filter(item => getTimeInMinutes(item.value) > startMinutes)
-})
-
-// 鍒濆鍖栨椂闂撮�夐」
-const initTimeOptions = () => {
- const options = []
- const now = new Date()
- const currentHour = now.getHours()
- const currentMinute = now.getMinutes()
- // meetingDate 鏄� "yyyy-MM-dd"
- const meetingDate = new Date(meetingForm.meetingDate)
-
- const isSameDay =
- now.getFullYear() === meetingDate.getFullYear() &&
- now.getMonth() === meetingDate.getMonth() &&
- now.getDate() === meetingDate.getDate()
-
- console.log('鏄惁鍚屼竴澶�:', isSameDay)
- for (let hour = 8; hour <= 18; hour++) {
- // 寮�濮嬫椂闂村繀椤绘櫄浜庡綋鍓嶆椂闂�
- if (hour < currentHour && isSameDay) {
- continue
+ if (isToday(meetingForm.meetingDate)) {
+ const now = new Date();
+ const currentMinutes = now.getHours() * 60 + now.getMinutes();
+ if (getTimeInMinutes(value) > currentMinutes) {
+ callback(new Error("褰撳ぉ寮�濮嬫椂闂翠笉鑳芥櫄浜庡綋鍓嶆椂闂�"));
+ return;
+ }
}
- if (hour === currentHour && currentMinute > 30 && isSameDay) {
- continue
- }
- // 姣忎釜灏忔椂娣诲姞涓や釜閫夐」锛氭暣鐐瑰拰鍗婄偣
- options.push({
- value: `${hour.toString().padStart(2, '0')}:00`,
- label: `${hour.toString().padStart(2, '0')}:00`
- })
- if (hour < 18) { // 18:00涔嬪悗娌℃湁鍗婄偣閫夐」
+ callback();
+ };
+
+ const validateEndTime = (_rule, value, callback) => {
+ if (!value || !meetingForm.startTime) {
+ callback();
+ return;
+ }
+
+ if (getTimeInMinutes(value) <= getTimeInMinutes(meetingForm.startTime)) {
+ callback(new Error("缁撴潫鏃堕棿蹇呴』澶т簬寮�濮嬫椂闂�"));
+ return;
+ }
+
+ callback();
+ };
+
+ // 琛ㄥ崟鏍¢獙瑙勫垯
+ const rules = {
+ title: [{ required: true, message: "璇疯緭鍏ヤ細璁富棰�", trigger: "blur" }],
+ roomId: [{ required: true, message: "璇烽�夋嫨浼氳瀹�", trigger: "change" }],
+ host: [{ required: true, message: "璇疯緭鍏ヤ富鎸佷汉", trigger: "blur" }],
+ meetingDate: [
+ { required: true, message: "璇烽�夋嫨浼氳鏃ユ湡", trigger: "change" },
+ ],
+ startTime: [
+ { required: true, message: "璇烽�夋嫨寮�濮嬫椂闂�", trigger: "change" },
+ { validator: validateStartTime, trigger: "change" },
+ ],
+ endTime: [
+ { required: true, message: "璇烽�夋嫨缁撴潫鏃堕棿", trigger: "change" },
+ { validator: validateEndTime, trigger: "change" },
+ ],
+ participants: [
+ { required: true, message: "璇烽�夋嫨鍙備細浜哄憳", trigger: "change" },
+ ],
+ };
+
+ const startTimeOptions = computed(() => {
+ if (!isToday(meetingForm.meetingDate)) {
+ return timeOptions.value;
+ }
+ const now = new Date();
+ const currentMinutes = now.getHours() * 60 + now.getMinutes();
+ return timeOptions.value.filter(
+ item => getTimeInMinutes(item.value) <= currentMinutes
+ );
+ });
+
+ const endTimeOptions = computed(() => {
+ if (!meetingForm.startTime) {
+ return timeOptions.value;
+ }
+ const startMinutes = getTimeInMinutes(meetingForm.startTime);
+ return timeOptions.value.filter(
+ item => getTimeInMinutes(item.value) > startMinutes
+ );
+ });
+
+ // 鍒濆鍖栨椂闂撮�夐」
+ const initTimeOptions = () => {
+ const options = [];
+ const now = new Date();
+ const currentHour = now.getHours();
+ const currentMinute = now.getMinutes();
+ // meetingDate 鏄� "yyyy-MM-dd"
+ const meetingDate = new Date(meetingForm.meetingDate);
+
+ const isSameDay =
+ now.getFullYear() === meetingDate.getFullYear() &&
+ now.getMonth() === meetingDate.getMonth() &&
+ now.getDate() === meetingDate.getDate();
+
+ console.log("鏄惁鍚屼竴澶�:", isSameDay);
+ for (let hour = 8; hour <= 18; hour++) {
+ // 寮�濮嬫椂闂村繀椤绘櫄浜庡綋鍓嶆椂闂�
+ if (hour < currentHour && isSameDay) {
+ continue;
+ }
+ if (hour === currentHour && currentMinute > 30 && isSameDay) {
+ continue;
+ }
+ // 姣忎釜灏忔椂娣诲姞涓や釜閫夐」锛氭暣鐐瑰拰鍗婄偣
options.push({
- value: `${hour.toString().padStart(2, '0')}:30`,
- label: `${hour.toString().padStart(2, '0')}:30`
- })
+ value: `${hour.toString().padStart(2, "0")}:00`,
+ label: `${hour.toString().padStart(2, "0")}:00`,
+ });
+
+ if (hour < 18) {
+ // 18:00涔嬪悗娌℃湁鍗婄偣閫夐」
+ options.push({
+ value: `${hour.toString().padStart(2, "0")}:30`,
+ label: `${hour.toString().padStart(2, "0")}:30`,
+ });
+ }
}
- }
- timeOptions.value = options
-}
+ timeOptions.value = options;
+ };
-watch(() => meetingForm.meetingDate, () => {
- if (meetingForm.startTime && !startTimeOptions.value.some(item => item.value === meetingForm.startTime)) {
- meetingForm.startTime = ''
- }
- if (meetingForm.endTime && !endTimeOptions.value.some(item => item.value === meetingForm.endTime)) {
- meetingForm.endTime = ''
- }
- if (meetingForm.startTime) {
- meetingFormRef.value?.validateField('startTime')
- }
- if (meetingForm.endTime) {
- meetingFormRef.value?.validateField('endTime')
- }
- initTimeOptions()
-})
-
-watch(() => meetingForm.startTime, () => {
- if (meetingForm.endTime && getTimeInMinutes(meetingForm.endTime) <= getTimeInMinutes(meetingForm.startTime)) {
- meetingForm.endTime = ''
- }
- if (meetingForm.endTime) {
- meetingFormRef.value?.validateField('endTime')
- }
-
-})
-
-// 绂佺敤鏃ユ湡锛堢鐢ㄤ粖澶╀箣鍓嶇殑鏃ユ湡锛�
-const disabledDate = (time) => {
- // 绂佺敤浠婂ぉ涔嬪墠鐨勬棩鏈�
- return time.getTime() < Date.now() - 86400000
-}
-
-// 鍒囨崲鐢宠绫诲瀷
-const changeType = (type) => {
- currentType.value = type
-}
-
-// 鑾峰彇褰撳墠绫诲瀷鍚嶇О
-const getCurrentTypeName = () => {
- const type = applicationTypes.value.find(t => t.value === currentType.value)
- return type ? type.name : ''
-}
-
-// 閲嶇疆琛ㄥ崟
-const resetForm = () => {
- meetingFormRef.value?.resetFields()
-}
-
-// 鎻愪氦琛ㄥ崟
-const submitForm = () => {
- meetingFormRef.value?.validate((valid) => {
- if (valid) {
-
- let formData = {...meetingForm}
- formData.applicationType = currentType.value
- formData.startTime = `${meetingForm.meetingDate} ${meetingForm.startTime}:00`
- formData.endTime = `${meetingForm.meetingDate} ${meetingForm.endTime}:00`
- formData.participants = JSON.stringify(formData.participants)
- console.log(formData)
- saveMeetingApplication(formData).then(() => {
-
- // 妯℃嫙鎻愪氦鎿嶄綔
- ElMessage.success(`${getCurrentTypeName()}鎻愪氦鎴愬姛`)
-
- // 鏍规嵁涓嶅悓绫诲瀷鎵ц涓嶅悓鎿嶄綔
- switch (currentType.value) {
- case 'approval':
- ElMessage.info('浼氳宸叉彁浜ゅ鎵规祦绋�')
- break
- case 'department':
- ElMessage.info('閮ㄩ棬绾т細璁敵璇峰凡鎻愪氦')
- break
- case 'notification':
- ElMessage.info('浼氳閫氱煡宸插彂甯�')
- break
- }
- resetForm()
- })
-
+ watch(
+ () => meetingForm.meetingDate,
+ () => {
+ if (
+ meetingForm.startTime &&
+ !startTimeOptions.value.some(item => item.value === meetingForm.startTime)
+ ) {
+ meetingForm.startTime = "";
+ }
+ if (
+ meetingForm.endTime &&
+ !endTimeOptions.value.some(item => item.value === meetingForm.endTime)
+ ) {
+ meetingForm.endTime = "";
+ }
+ if (meetingForm.startTime) {
+ meetingFormRef.value?.validateField("startTime");
+ }
+ if (meetingForm.endTime) {
+ meetingFormRef.value?.validateField("endTime");
+ }
+ initTimeOptions();
}
- })
-}
+ );
-// 椤甸潰鍔犺浇鏃跺垵濮嬪寲
-onMounted(() => {
- initTimeOptions()
- getRoomEnum().then(res => {
- meetingRooms.value = res.data
- })
- staffOnJobListPage({
- current: -1,
- size: -1,
- staffState: 1
- }).then(res => {
- employees.value = res.data.records.sort((a, b) => (a.postName || '').localeCompare(b.postName || ''))
- })
-})
+ watch(
+ () => meetingForm.startTime,
+ () => {
+ if (
+ meetingForm.endTime &&
+ getTimeInMinutes(meetingForm.endTime) <=
+ getTimeInMinutes(meetingForm.startTime)
+ ) {
+ meetingForm.endTime = "";
+ }
+ if (meetingForm.endTime) {
+ meetingFormRef.value?.validateField("endTime");
+ }
+ }
+ );
+
+ // 绂佺敤鏃ユ湡锛堢鐢ㄤ粖澶╀箣鍓嶇殑鏃ユ湡锛�
+ const disabledDate = time => {
+ // 绂佺敤浠婂ぉ涔嬪墠鐨勬棩鏈�
+ return time.getTime() < Date.now() - 86400000;
+ };
+
+ // 鍒囨崲鐢宠绫诲瀷
+ const changeType = type => {
+ currentType.value = type;
+ };
+
+ // 鑾峰彇褰撳墠绫诲瀷鍚嶇О
+ const getCurrentTypeName = () => {
+ const type = applicationTypes.value.find(t => t.value === currentType.value);
+ return type ? type.name : "";
+ };
+
+ // 閲嶇疆琛ㄥ崟
+ const resetForm = () => {
+ meetingFormRef.value?.resetFields();
+ };
+
+ // 鎻愪氦琛ㄥ崟
+ const submitForm = () => {
+ meetingFormRef.value?.validate(valid => {
+ if (valid) {
+ let formData = { ...meetingForm };
+ formData.applicationType = currentType.value;
+ formData.startTime = `${meetingForm.meetingDate} ${meetingForm.startTime}:00`;
+ formData.endTime = `${meetingForm.meetingDate} ${meetingForm.endTime}:00`;
+ formData.participants = JSON.stringify(formData.participants);
+ console.log(formData);
+ saveMeetingApplication(formData).then(() => {
+ // 妯℃嫙鎻愪氦鎿嶄綔
+ ElMessage.success(`${getCurrentTypeName()}鎻愪氦鎴愬姛`);
+
+ // 鏍规嵁涓嶅悓绫诲瀷鎵ц涓嶅悓鎿嶄綔
+ switch (currentType.value) {
+ case "approval":
+ ElMessage.info("浼氳宸叉彁浜ゅ鎵规祦绋�");
+ break;
+ case "department":
+ ElMessage.info("閮ㄩ棬绾т細璁敵璇峰凡鎻愪氦");
+ break;
+ case "notification":
+ ElMessage.info("浼氳閫氱煡宸插彂甯�");
+ break;
+ }
+ resetForm();
+ });
+ }
+ });
+ };
+
+ // 椤甸潰鍔犺浇鏃跺垵濮嬪寲
+ onMounted(() => {
+ initTimeOptions();
+ getRoomEnum().then(res => {
+ meetingRooms.value = res.data;
+ });
+ userListNoPageByTenantId().then(res => {
+ const list = Array.isArray(res?.data) ? res.data : [];
+ users.value = list
+ .map(item => ({
+ userId: item?.userId,
+ nickName:
+ item?.nickName || item?.userName || String(item?.userId ?? ""),
+ deptNames: item?.deptNames || "",
+ }))
+ .filter(
+ item =>
+ item.userId !== null && item.userId !== undefined && item.nickName
+ )
+ .sort((a, b) => String(a.nickName).localeCompare(String(b.nickName)));
+ });
+ });
</script>
<style scoped>
-.app-container {
- padding: 20px;
-}
+ .app-container {
+ padding: 20px;
+ }
-.page-header {
- display: flex;
- justify-content: space-between;
- align-items: center;
- margin-bottom: 20px;
-}
+ .page-header {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ margin-bottom: 20px;
+ }
-.page-header h2 {
- margin: 0;
- color: #303133;
-}
+ .page-header h2 {
+ margin: 0;
+ color: #303133;
+ }
-.type-card {
- margin-bottom: 20px;
-}
+ .type-card {
+ margin-bottom: 20px;
+ }
-.type-selector {
- display: flex;
- gap: 20px;
-}
+ .type-selector {
+ display: flex;
+ gap: 20px;
+ }
-.type-item {
- flex: 1;
- display: flex;
- align-items: center;
- padding: 20px;
- border: 1px solid #ebeef5;
- border-radius: 8px;
- cursor: pointer;
- transition: all 0.3s;
-}
+ .type-item {
+ flex: 1;
+ display: flex;
+ align-items: center;
+ padding: 20px;
+ border: 1px solid #ebeef5;
+ border-radius: 8px;
+ cursor: pointer;
+ transition: all 0.3s;
+ }
-.type-item:hover {
- border-color: #409eff;
- box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
-}
+ .type-item:hover {
+ border-color: #409eff;
+ box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
+ }
-.type-item.active {
- border-color: #409eff;
- background-color: #ecf5ff;
-}
+ .type-item.active {
+ border-color: #409eff;
+ background-color: #ecf5ff;
+ }
-.type-icon {
- margin-right: 15px;
- color: #409eff;
-}
+ .type-icon {
+ margin-right: 15px;
+ color: #409eff;
+ }
-.type-name {
- font-size: 16px;
- font-weight: 500;
- color: #303133;
- margin-bottom: 5px;
-}
+ .type-name {
+ font-size: 16px;
+ font-weight: 500;
+ color: #303133;
+ margin-bottom: 5px;
+ }
-.type-desc {
- font-size: 14px;
- color: #909399;
-}
+ .type-desc {
+ font-size: 14px;
+ color: #909399;
+ }
-.form-header {
- margin-bottom: 20px;
- padding-bottom: 15px;
- border-bottom: 1px solid #ebeef5;
-}
+ .form-header {
+ margin-bottom: 20px;
+ padding-bottom: 15px;
+ border-bottom: 1px solid #ebeef5;
+ }
-.form-header h3 {
- margin: 0;
- color: #303133;
-}
+ .form-header h3 {
+ margin: 0;
+ color: #303133;
+ }
-.form-footer {
- display: flex;
- justify-content: flex-end;
- gap: 10px;
- margin-top: 30px;
- padding-top: 20px;
- border-top: 1px solid #ebeef5;
-}
+ .form-footer {
+ display: flex;
+ justify-content: flex-end;
+ gap: 10px;
+ margin-top: 30px;
+ padding-top: 20px;
+ border-top: 1px solid #ebeef5;
+ }
</style>
diff --git a/src/views/collaborativeApproval/notificationManagement/meetExamine/index.vue b/src/views/collaborativeApproval/notificationManagement/meetExamine/index.vue
index 26e2c24..57f5eaa 100644
--- a/src/views/collaborativeApproval/notificationManagement/meetExamine/index.vue
+++ b/src/views/collaborativeApproval/notificationManagement/meetExamine/index.vue
@@ -1,182 +1,219 @@
<template>
<div>
-
- <el-form :model="searchForm" inline>
- <el-form-item label="浼氳涓婚">
- <el-input v-model="searchForm.title" placeholder="璇疯緭鍏ヤ細璁富棰�" clearable/>
- </el-form-item>
- <el-form-item label="鐢宠浜�">
- <el-input v-model="searchForm.applicant" placeholder="璇疯緭鍏ョ敵璇蜂汉" clearable/>
- </el-form-item>
- <el-form-item label="瀹℃壒鐘舵��">
- <el-select style="width: 100px" v-model="searchForm.status" placeholder="璇烽�夋嫨瀹℃壒鐘舵��" clearable>
- <el-option label="寰呭鎵�" value="0"/>
- <el-option label="宸查�氳繃" value="1"/>
- <el-option label="鏈鎵�" value="2"/>
- <el-option label="宸插彇娑�" value="3"/>
- </el-select>
- </el-form-item>
- <el-form-item>
- <el-button type="primary" @click="handleSearch">鎼滅储</el-button>
- <el-button @click="resetSearch">閲嶇疆</el-button>
- </el-form-item>
- </el-form>
-
+ <el-form :model="searchForm"
+ inline>
+ <el-form-item label="浼氳涓婚">
+ <el-input v-model="searchForm.title"
+ placeholder="璇疯緭鍏ヤ細璁富棰�"
+ clearable />
+ </el-form-item>
+ <el-form-item label="鐢宠浜�">
+ <el-input v-model="searchForm.applicant"
+ placeholder="璇疯緭鍏ョ敵璇蜂汉"
+ clearable />
+ </el-form-item>
+ <el-form-item label="瀹℃壒鐘舵��">
+ <el-select style="width: 100px"
+ v-model="searchForm.status"
+ placeholder="璇烽�夋嫨瀹℃壒鐘舵��"
+ clearable>
+ <el-option label="寰呭鎵�"
+ value="0" />
+ <el-option label="宸查�氳繃"
+ value="1" />
+ <el-option label="鏈鎵�"
+ value="2" />
+ <el-option label="宸插彇娑�"
+ value="3" />
+ </el-select>
+ </el-form-item>
+ <el-form-item>
+ <el-button type="primary"
+ @click="handleSearch">鎼滅储</el-button>
+ <el-button @click="resetSearch">閲嶇疆</el-button>
+ </el-form-item>
+ </el-form>
<!-- 浼氳瀹℃壒鍒楄〃 -->
<el-card>
- <el-table v-loading="loading" :data="approvalList" border :height="tableHeight">
- <el-table-column prop="title" label="浼氳涓婚" align="center" min-width="200" show-overflow-tooltip/>
- <el-table-column prop="applicant" label="鐢宠浜�" align="center" width="120"/>
- <el-table-column prop="host" label="涓荤悊浜�" align="center" width="120"/>
- <el-table-column prop="meetingTime" label="浼氳鏃堕棿" align="center" width="180">
+ <el-table v-loading="loading"
+ :data="approvalList"
+ border
+ :height="tableHeight">
+ <el-table-column prop="title"
+ label="浼氳涓婚"
+ align="center"
+ min-width="200"
+ show-overflow-tooltip />
+ <el-table-column prop="applicant"
+ label="鐢宠浜�"
+ align="center"
+ width="120" />
+ <el-table-column prop="host"
+ label="涓荤悊浜�"
+ align="center"
+ width="120" />
+ <el-table-column prop="meetingTime"
+ label="浼氳鏃堕棿"
+ align="center"
+ width="180">
<template #default="scope">
{{ formatDateTime(scope.row.meetingTime) }}
</template>
</el-table-column>
- <el-table-column prop="location" label="浼氳鍦扮偣" align="center" width="150"/>
- <el-table-column prop="participants" label="鍙備細浜烘暟" align="center" width="100">
+ <el-table-column prop="location"
+ label="浼氳鍦扮偣"
+ align="center"
+ width="150" />
+ <el-table-column prop="participants"
+ label="鍙備細浜烘暟"
+ align="center"
+ width="100">
<template #default="scope">
{{ scope.row.participants.length }}浜�
</template>
</el-table-column>
- <el-table-column prop="status" label="瀹℃壒鐘舵��" align="center" width="120">
+ <el-table-column prop="status"
+ label="瀹℃壒鐘舵��"
+ align="center"
+ width="120">
<template #default="scope">
<el-tag :type="getStatusType(scope.row.status)">
{{ getStatusText(scope.row.status) }}
</el-tag>
</template>
</el-table-column>
- <el-table-column label="鎿嶄綔" align="center" width="200" fixed="right">
+ <el-table-column label="鎿嶄綔"
+ align="center"
+ width="200"
+ fixed="right">
<template #default="scope">
- <el-button type="primary" link @click="viewDetail(scope.row)">鏌ョ湅</el-button>
- <el-button
- v-if="scope.row.status == '0'"
- type="primary"
- link
- @click="handleApproval(scope.row)"
- >
+ <el-button type="primary"
+ link
+ @click="viewDetail(scope.row)">鏌ョ湅</el-button>
+ <el-button v-if="scope.row.status == '0'"
+ type="primary"
+ link
+ @click="handleApproval(scope.row)">
瀹℃壒
</el-button>
</template>
</el-table-column>
</el-table>
-
<!-- 鍒嗛〉 -->
- <pagination
- v-show="total > 0"
- :total="total"
- v-model:page="queryParams.current"
- v-model:limit="queryParams.size"
- @pagination="getList"
- />
+ <pagination v-show="total > 0"
+ :total="total"
+ v-model:page="queryParams.current"
+ v-model:limit="queryParams.size"
+ @pagination="getList" />
</el-card>
-
<!-- 浼氳璇︽儏瀵硅瘽妗� -->
- <el-dialog
- title="浼氳璇︽儏"
- v-model="detailDialogVisible"
- width="800px"
- >
+ <el-dialog title="浼氳璇︽儏"
+ v-model="detailDialogVisible"
+ width="800px">
<div v-if="currentMeeting">
- <el-descriptions label-width="100px" class="meeting-desc" :column="2" border>
- <el-descriptions-item label="浼氳涓婚" label-class-name="nowrap-label">{{
+ <el-descriptions label-width="100px"
+ class="meeting-desc"
+ :column="2"
+ border>
+ <el-descriptions-item label="浼氳涓婚"
+ label-class-name="nowrap-label">{{
currentMeeting.title
}}</el-descriptions-item>
- <el-descriptions-item label="鐢宠浜�" label-class-name="nowrap-label">{{
+ <el-descriptions-item label="鐢宠浜�"
+ label-class-name="nowrap-label">{{
currentMeeting.applicant
}}</el-descriptions-item>
- <el-descriptions-item label="涓荤悊浜�" label-class-name="nowrap-label">{{
+ <el-descriptions-item label="涓荤悊浜�"
+ label-class-name="nowrap-label">{{
currentMeeting.host
}}</el-descriptions-item>
- <el-descriptions-item label="浼氳鏃堕棿" :span="2" label-class-name="nowrap-label">
+ <el-descriptions-item label="浼氳鏃堕棿"
+ :span="2"
+ label-class-name="nowrap-label">
{{ formatDateTime(currentMeeting.meetingTime) }}
</el-descriptions-item>
- <el-descriptions-item label="浼氳鍦扮偣" label-class-name="nowrap-label">{{
+ <el-descriptions-item label="浼氳鍦扮偣"
+ label-class-name="nowrap-label">{{
currentMeeting.location
}}</el-descriptions-item>
- <el-descriptions-item label="鍙備細浜烘暟" label-class-name="nowrap-label">{{
+ <el-descriptions-item label="鍙備細浜烘暟"
+ label-class-name="nowrap-label">{{
currentMeeting.participants.length
}}浜�</el-descriptions-item>
- <el-descriptions-item label="瀹℃壒鐘舵��" label-class-name="nowrap-label">
+ <el-descriptions-item label="瀹℃壒鐘舵��"
+ label-class-name="nowrap-label">
<el-tag :type="getStatusType(currentMeeting.status)">
{{ getStatusText(currentMeeting.status) }}
</el-tag>
</el-descriptions-item>
- <el-descriptions-item label="鐢宠鏃堕棿" label-class-name="nowrap-label">{{
+ <el-descriptions-item label="鐢宠鏃堕棿"
+ label-class-name="nowrap-label">{{
currentMeeting.createTime
}}</el-descriptions-item>
- <el-descriptions-item style="max-height: 400px" label="浼氳璇存槑" :span="2"
+ <el-descriptions-item style="max-height: 400px"
+ label="浼氳璇存槑"
+ :span="2"
label-class-name="nowrap-label">{{ currentMeeting.description }}</el-descriptions-item>
</el-descriptions>
-
-
<div class="content-section mt-20">
<h4>鍙備細浜哄憳</h4>
<div class="participants-list">
- <el-tag
- v-for="participant in currentMeeting.participants"
- :key="participant.id"
- style="margin-right: 10px; margin-bottom: 10px;"
- >
+ <el-tag v-for="participant in currentMeeting.participants"
+ :key="participant.id"
+ style="margin-right: 10px; margin-bottom: 10px;">
{{ participant.name }}
</el-tag>
</div>
</div>
</div>
-
<template #footer>
<div class="dialog-footer">
<el-button @click="detailDialogVisible = false">鍏� 闂�</el-button>
</div>
</template>
</el-dialog>
-
<!-- 浼氳瀹℃壒瀵硅瘽妗� -->
- <el-dialog
- title="浼氳瀹℃壒"
- v-model="approvalDialogVisible"
- >
+ <el-dialog title="浼氳瀹℃壒"
+ v-model="approvalDialogVisible">
<div v-if="currentMeeting">
- <el-descriptions :column="2" border>
+ <el-descriptions :column="2"
+ border>
<el-descriptions-item label="浼氳涓婚">{{ currentMeeting.title }}</el-descriptions-item>
<el-descriptions-item label="鐢宠浜�">{{ currentMeeting.applicant }}</el-descriptions-item>
<el-descriptions-item label="涓荤悊浜�">{{ currentMeeting.host }}</el-descriptions-item>
- <el-descriptions-item label="浼氳鏃堕棿" :span="2">
+ <el-descriptions-item label="浼氳鏃堕棿"
+ :span="2">
{{ formatDateTime(currentMeeting.meetingTime) }}
</el-descriptions-item>
<el-descriptions-item label="浼氳鍦扮偣">{{ currentMeeting.location }}</el-descriptions-item>
<el-descriptions-item label="鍙備細浜烘暟">{{ currentMeeting.participants.length }}浜�</el-descriptions-item>
</el-descriptions>
-
<div class="content-section mt-20">
<h4>鍙備細浜哄憳</h4>
<div class="participants-list">
- <el-tag
- v-for="participant in currentMeeting.participants"
- :key="participant.id"
- style="margin-right: 10px; margin-bottom: 10px;"
- >
+ <el-tag v-for="participant in currentMeeting.participants"
+ :key="participant.id"
+ style="margin-right: 10px; margin-bottom: 10px;">
{{ participant.name }}
</el-tag>
</div>
</div>
-
- <div v-show="false" class="approval-opinion mt-20">
+ <div v-show="false"
+ class="approval-opinion mt-20">
<h4>瀹℃壒鎰忚</h4>
- <el-input
- v-model="approvalOpinion"
- type="textarea"
- placeholder="璇疯緭鍏ュ鎵规剰瑙�"
- :rows="4"
- />
+ <el-input v-model="approvalOpinion"
+ type="textarea"
+ placeholder="璇疯緭鍏ュ鎵规剰瑙�"
+ :rows="4" />
</div>
</div>
-
<template #footer>
<div class="dialog-footer">
<el-button @click="approvalDialogVisible = false">鍙� 娑�</el-button>
- <el-button type="danger" @click="submitApproval('2')">涓嶉�氳繃</el-button>
- <el-button type="primary" @click="submitApproval('1')">閫� 杩�</el-button>
+ <el-button type="danger"
+ @click="submitApproval('2')">涓嶉�氳繃</el-button>
+ <el-button type="primary"
+ @click="submitApproval('1')">閫� 杩�</el-button>
</div>
</template>
</el-dialog>
@@ -184,231 +221,260 @@
</template>
<script setup>
-import {ref, reactive, onMounted} from 'vue'
-import {ElMessage, ElMessageBox} from 'element-plus'
-import Pagination from '@/components/Pagination/index.vue'
-import {getRoomEnum, getExamineList,saveMeetingApplication} from '@/api/collaborativeApproval/meeting.js'
-import dayjs from "dayjs";
-import {staffOnJobListPage} from "@/api/personnelManagement/staffOnJob.js";
+ import { ref, reactive, onMounted } from "vue";
+ import { ElMessage, ElMessageBox } from "element-plus";
+ import Pagination from "@/components/Pagination/index.vue";
+ import {
+ getRoomEnum,
+ getExamineList,
+ saveMeetingApplication,
+ } from "@/api/collaborativeApproval/meeting.js";
+ import dayjs from "dayjs";
+ import { userListNoPageByTenantId } from "@/api/system/user.js";
-// 鏁版嵁鍒楄〃鍔犺浇鐘舵��
-const loading = ref(false)
+ // 鏁版嵁鍒楄〃鍔犺浇鐘舵��
+ const loading = ref(false);
-// 鎬绘潯鏁�
-const total = ref(0)
+ // 鎬绘潯鏁�
+ const total = ref(0);
-// 琛ㄦ牸楂樺害锛堟牴鎹獥鍙i珮搴﹁嚜閫傚簲锛�
-const tableHeight = ref(window.innerHeight - 380)
-const roomEnum = ref([])
-const staffList = ref([])
-// 瀹℃壒鍒楄〃鏁版嵁
-const approvalList = ref([])
+ // 琛ㄦ牸楂樺害锛堟牴鎹獥鍙i珮搴﹁嚜閫傚簲锛�
+ const tableHeight = ref(window.innerHeight - 380);
+ const roomEnum = ref([]);
+ const userList = ref([]);
+ // 瀹℃壒鍒楄〃鏁版嵁
+ const approvalList = ref([]);
-// 鏌ヨ鍙傛暟
-const queryParams = reactive({
- current: 1,
- size: 10
-})
+ // 鏌ヨ鍙傛暟
+ const queryParams = reactive({
+ current: 1,
+ size: 10,
+ });
-// 鎼滅储琛ㄥ崟
-const searchForm = reactive({
- title: '',
- applicant: '',
- status: ''
-})
+ // 鎼滅储琛ㄥ崟
+ const searchForm = reactive({
+ title: "",
+ applicant: "",
+ status: "",
+ });
-// 鏄惁鏄剧ず瀵硅瘽妗�
-const detailDialogVisible = ref(false)
-const approvalDialogVisible = ref(false)
+ // 鏄惁鏄剧ず瀵硅瘽妗�
+ const detailDialogVisible = ref(false);
+ const approvalDialogVisible = ref(false);
-// 褰撳墠鏌ョ湅鐨勪細璁�
-const currentMeeting = ref(null)
+ // 褰撳墠鏌ョ湅鐨勪細璁�
+ const currentMeeting = ref(null);
-// 瀹℃壒鎰忚
-const approvalOpinion = ref('')
+ // 瀹℃壒鎰忚
+ const approvalOpinion = ref("");
-// 鏌ヨ鏁版嵁
-const getList = async () => {
- loading.value = true
- let resp = await getExamineList({...searchForm, ...queryParams})
- approvalList.value = resp.data.records.map(it => {
- let room = roomEnum.value.find(room => it.roomId === room.id)
- it.location = `${room.name}(${room.location})`
- let staffs = JSON.parse(it.participants)
- it.staffCount = staffs.size
- it.meetingTime = `${it.meetingDate} ${dayjs(it.startTime).format('HH:mm:ss')} ~ ${dayjs(it.endTime).format('HH:mm:ss')}`
- it.participants = staffList.value.filter(staff => staffs.some(id=>id === staff.id)).map(staff => {
- return {
- id: staff.id,
- name: `${staff.staffName}${staff.postName ? ` (${staff.postName})` : ''}`
+ // 鏌ヨ鏁版嵁
+ const getList = async () => {
+ loading.value = true;
+ let resp = await getExamineList({ ...searchForm, ...queryParams });
+ const userMap = new Map(userList.value.map(u => [String(u.userId), u]));
+ approvalList.value = resp.data.records.map(it => {
+ let room = roomEnum.value.find(room => it.roomId === room.id);
+ it.location = `${room.name}(${room.location})`;
+ let participantIds = [];
+ try {
+ participantIds = Array.isArray(it.participants)
+ ? it.participants
+ : JSON.parse(it.participants);
+ } catch (_e) {
+ participantIds = [];
}
- })
+ if (!Array.isArray(participantIds)) participantIds = [];
+ it.staffCount = participantIds.length;
+ it.meetingTime = `${it.meetingDate} ${dayjs(it.startTime).format(
+ "HH:mm:ss"
+ )} ~ ${dayjs(it.endTime).format("HH:mm:ss")}`;
+ it.participants = participantIds.map(id => {
+ const user = userMap.get(String(id));
+ const nickName = user?.nickName || user?.userName || String(id ?? "");
+ const deptNames = user?.deptNames || "";
+ return {
+ id,
+ name: deptNames ? `${nickName} (${deptNames})` : nickName,
+ };
+ });
+ return it;
+ });
+ total.value = resp.data.total;
+ loading.value = false;
+ };
- return it
- })
- total.value = resp.data.total
- loading.value = false
-}
+ // 鎼滅储鎸夐挳鎿嶄綔
+ const handleSearch = () => {
+ queryParams.pageNum = 1;
+ getList();
+ };
-// 鎼滅储鎸夐挳鎿嶄綔
-const handleSearch = () => {
- queryParams.pageNum = 1
- getList()
-}
+ // 閲嶇疆鎼滅储琛ㄥ崟
+ const resetSearch = () => {
+ Object.assign(searchForm, {
+ title: "",
+ applicant: "",
+ status: "",
+ });
+ handleSearch();
+ };
-// 閲嶇疆鎼滅储琛ㄥ崟
-const resetSearch = () => {
- Object.assign(searchForm, {
- title: '',
- applicant: '',
- status: ''
- })
- handleSearch()
-}
+ // 鏌ョ湅璇︽儏
+ const viewDetail = row => {
+ currentMeeting.value = row;
+ detailDialogVisible.value = true;
+ };
-// 鏌ョ湅璇︽儏
-const viewDetail = (row) => {
- currentMeeting.value = row
- detailDialogVisible.value = true
-}
+ // 澶勭悊瀹℃壒
+ const handleApproval = row => {
+ currentMeeting.value = row;
+ approvalOpinion.value = "";
+ approvalDialogVisible.value = true;
+ };
-// 澶勭悊瀹℃壒
-const handleApproval = (row) => {
- currentMeeting.value = row
- approvalOpinion.value = ''
- approvalDialogVisible.value = true
-}
+ // 鑾峰彇鐘舵�佺被鍨�
+ const getStatusType = status => {
+ const statusMap = {
+ 0: "info", // 寰呭鎵�
+ 1: "success", // 宸查�氳繃
+ 2: "warning", // 鏈�氳繃
+ 3: "danger", // 鍙栨秷
+ };
+ return statusMap[status] || "info";
+ };
-// 鑾峰彇鐘舵�佺被鍨�
-const getStatusType = (status) => {
- const statusMap = {
- '0': 'info', // 寰呭鎵�
- '1': 'success', // 宸查�氳繃
- '2': 'warning', // 鏈�氳繃
- '3': 'danger' // 鍙栨秷
- }
- return statusMap[status] || 'info'
-}
+ // 鑾峰彇鐘舵�佹枃鏈�
+ const getStatusText = status => {
+ const statusMap = {
+ 0: "寰呭鎵�",
+ 1: "宸查�氳繃",
+ 2: "鏈�氳繃",
+ 3: "宸插彇娑�",
+ };
+ return statusMap[status] || "鏈煡";
+ };
-// 鑾峰彇鐘舵�佹枃鏈�
-const getStatusText = (status) => {
- const statusMap = {
- '0': '寰呭鎵�',
- '1': '宸查�氳繃',
- '2': '鏈�氳繃',
- '3': '宸插彇娑�'
- }
- return statusMap[status] || '鏈煡'
-}
+ // 鏍煎紡鍖栨棩鏈熸椂闂�
+ const formatDateTime = dateTime => {
+ if (!dateTime) return "";
+ return dateTime.replace(" ", "\n");
+ };
-// 鏍煎紡鍖栨棩鏈熸椂闂�
-const formatDateTime = (dateTime) => {
- if (!dateTime) return ''
- return dateTime.replace(' ', '\n')
-}
+ // 鎻愪氦瀹℃壒
+ const submitApproval = status => {
+ // if (status === 'approved' && !approvalOpinion.value.trim()) {
+ // ElMessage.warning('璇峰~鍐欏鎵规剰瑙�')
+ // return
+ // }
-// 鎻愪氦瀹℃壒
-const submitApproval = (status) => {
- // if (status === 'approved' && !approvalOpinion.value.trim()) {
- // ElMessage.warning('璇峰~鍐欏鎵规剰瑙�')
- // return
- // }
-
- ElMessageBox.confirm(
- `纭${status === '1' ? '閫氳繃' : '涓嶉�氳繃'}璇ヤ細璁敵璇凤紵`,
- '瀹℃壒纭',
+ ElMessageBox.confirm(
+ `纭${status === "1" ? "閫氳繃" : "涓嶉�氳繃"}璇ヤ細璁敵璇凤紵`,
+ "瀹℃壒纭",
{
- confirmButtonText: '纭畾',
- cancelButtonText: '鍙栨秷',
- type: 'warning'
+ confirmButtonText: "纭畾",
+ cancelButtonText: "鍙栨秷",
+ type: "warning",
}
- ).then(() => {
- saveMeetingApplication({
- id: currentMeeting.value.id,
- status: status
- }).then(resp=>{
- // 鏇存柊浼氳鐘舵��
- currentMeeting.value.status = status
+ )
+ .then(() => {
+ saveMeetingApplication({
+ id: currentMeeting.value.id,
+ status: status,
+ }).then(resp => {
+ // 鏇存柊浼氳鐘舵��
+ currentMeeting.value.status = status;
- ElMessage.success('瀹℃壒鎻愪氦鎴愬姛')
- approvalDialogVisible.value = false
- getList()
- })
+ ElMessage.success("瀹℃壒鎻愪氦鎴愬姛");
+ approvalDialogVisible.value = false;
+ getList();
+ });
+ })
+ .catch(() => {});
+ };
- }).catch(() => {
- })
-}
+ // 椤甸潰鍔犺浇鏃惰幏鍙栨暟鎹�
+ onMounted(async () => {
+ const [resp1, resp2] = await Promise.all([
+ getRoomEnum(),
+ userListNoPageByTenantId(),
+ ]);
+ roomEnum.value = resp1.data;
+ const list = Array.isArray(resp2?.data) ? resp2.data : [];
+ userList.value = list
+ .map(item => ({
+ userId: item?.userId,
+ nickName: item?.nickName,
+ userName: item?.userName,
+ deptNames:
+ item?.deptNames || (item?.dept?.deptName ? item.dept.deptName : ""),
+ }))
+ .filter(item => item.userId !== null && item.userId !== undefined);
-// 椤甸潰鍔犺浇鏃惰幏鍙栨暟鎹�
-onMounted(async () => {
- const [resp1, resp2]= await Promise.all([getRoomEnum(), staffOnJobListPage({current: -1, size: -1, staffState: 1})])
- roomEnum.value = resp1.data
- staffList.value = resp2.data.records
-
- await getList()
-})
+ await getList();
+ });
</script>
<style scoped>
-.app-container {
- padding: 20px;
-}
+ .app-container {
+ padding: 20px;
+ }
-.page-header {
- display: flex;
- justify-content: space-between;
- align-items: center;
- margin-bottom: 20px;
-}
+ .page-header {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ margin-bottom: 20px;
+ }
-.page-header h2 {
- margin: 0;
- color: #303133;
-}
+ .page-header h2 {
+ margin: 0;
+ color: #303133;
+ }
-.search-card {
- margin-bottom: 20px;
-}
+ .search-card {
+ margin-bottom: 20px;
+ }
-.dialog-footer {
- display: flex;
- justify-content: flex-end;
- gap: 10px;
-}
+ .dialog-footer {
+ display: flex;
+ justify-content: flex-end;
+ gap: 10px;
+ }
-.content-section h4 {
- margin: 0 0 15px 0;
- color: #303133;
-}
+ .content-section h4 {
+ margin: 0 0 15px 0;
+ color: #303133;
+ }
-.mt-20 {
- margin-top: 20px;
-}
+ .mt-20 {
+ margin-top: 20px;
+ }
-.participants-list {
- min-height: 40px;
- padding: 15px;
- border-radius: 4px;
- line-height: 1.6;
-}
+ .participants-list {
+ min-height: 40px;
+ padding: 15px;
+ border-radius: 4px;
+ line-height: 1.6;
+ }
-.approval-opinion h4 {
- margin: 0 0 15px 0;
- color: #303133;
-}
+ .approval-opinion h4 {
+ margin: 0 0 15px 0;
+ color: #303133;
+ }
-.nowrap-label {
- white-space: nowrap !important;
-}
+ .nowrap-label {
+ white-space: nowrap !important;
+ }
-.description-content {
- white-space: pre-wrap;
- word-wrap: break-word;
- line-height: 1.6;
- padding: 10px;
- background-color: #f5f7fa;
- border-radius: 4px;
- min-height: 60px;
-}
+ .description-content {
+ white-space: pre-wrap;
+ word-wrap: break-word;
+ line-height: 1.6;
+ padding: 10px;
+ background-color: #f5f7fa;
+ border-radius: 4px;
+ min-height: 60px;
+ }
</style>
diff --git a/src/views/collaborativeApproval/notificationManagement/meetPublish/index.vue b/src/views/collaborativeApproval/notificationManagement/meetPublish/index.vue
index dace531..3b9650a 100644
--- a/src/views/collaborativeApproval/notificationManagement/meetPublish/index.vue
+++ b/src/views/collaborativeApproval/notificationManagement/meetPublish/index.vue
@@ -1,180 +1,213 @@
<template>
<div>
-
- <el-form :model="searchForm" inline>
- <el-form-item label="浼氳涓婚">
- <el-input v-model="searchForm.title" placeholder="璇疯緭鍏ヤ細璁富棰�" clearable/>
- </el-form-item>
- <el-form-item label="鐢宠浜�">
- <el-input v-model="searchForm.applicant" placeholder="璇疯緭鍏ョ敵璇蜂汉" clearable/>
- </el-form-item>
- <el-form-item label="鍙戝竷鐘舵��">
- <el-select style="width: 100px" v-model="searchForm.status" placeholder="璇烽�夋嫨鍙戝竷鐘舵��" clearable>
- <el-option label="寰呭彂甯�" value="0"/>
- <el-option label="宸插彂甯�" value="1"/>
- </el-select>
- </el-form-item>
- <el-form-item>
- <el-button type="primary" @click="handleSearch">鎼滅储</el-button>
- <el-button @click="resetSearch">閲嶇疆</el-button>
- </el-form-item>
- </el-form>
-
+ <el-form :model="searchForm"
+ inline>
+ <el-form-item label="浼氳涓婚">
+ <el-input v-model="searchForm.title"
+ placeholder="璇疯緭鍏ヤ細璁富棰�"
+ clearable />
+ </el-form-item>
+ <el-form-item label="鐢宠浜�">
+ <el-input v-model="searchForm.applicant"
+ placeholder="璇疯緭鍏ョ敵璇蜂汉"
+ clearable />
+ </el-form-item>
+ <el-form-item label="鍙戝竷鐘舵��">
+ <el-select style="width: 100px"
+ v-model="searchForm.status"
+ placeholder="璇烽�夋嫨鍙戝竷鐘舵��"
+ clearable>
+ <el-option label="寰呭彂甯�"
+ value="0" />
+ <el-option label="宸插彂甯�"
+ value="1" />
+ </el-select>
+ </el-form-item>
+ <el-form-item>
+ <el-button type="primary"
+ @click="handleSearch">鎼滅储</el-button>
+ <el-button @click="resetSearch">閲嶇疆</el-button>
+ </el-form-item>
+ </el-form>
<!-- 浼氳鍙戝竷鍒楄〃 -->
<el-card>
- <el-table v-loading="loading" :data="approvalList" border :height="tableHeight">
- <el-table-column prop="title" label="浼氳涓婚" align="center" min-width="200" show-overflow-tooltip/>
- <el-table-column prop="applicant" label="鐢宠浜�" align="center" width="120"/>
- <el-table-column prop="host" label="涓荤悊浜�" align="center" width="120"/>
- <el-table-column prop="meetingTime" label="浼氳鏃堕棿" align="center" width="180">
+ <el-table v-loading="loading"
+ :data="approvalList"
+ border
+ :height="tableHeight">
+ <el-table-column prop="title"
+ label="浼氳涓婚"
+ align="center"
+ min-width="200"
+ show-overflow-tooltip />
+ <el-table-column prop="applicant"
+ label="鐢宠浜�"
+ align="center"
+ width="120" />
+ <el-table-column prop="host"
+ label="涓荤悊浜�"
+ align="center"
+ width="120" />
+ <el-table-column prop="meetingTime"
+ label="浼氳鏃堕棿"
+ align="center"
+ width="180">
<template #default="scope">
{{ formatDateTime(scope.row.meetingTime) }}
</template>
</el-table-column>
- <el-table-column prop="location" label="浼氳鍦扮偣" align="center" width="150"/>
- <el-table-column prop="participants" label="鍙備細浜烘暟" align="center" width="100">
+ <el-table-column prop="location"
+ label="浼氳鍦扮偣"
+ align="center"
+ width="150" />
+ <el-table-column prop="participants"
+ label="鍙備細浜烘暟"
+ align="center"
+ width="100">
<template #default="scope">
{{ scope.row.participants.length }}浜�
</template>
</el-table-column>
- <el-table-column prop="status" label="鍙戝竷鐘舵��" align="center" width="120">
+ <el-table-column prop="status"
+ label="鍙戝竷鐘舵��"
+ align="center"
+ width="120">
<template #default="scope">
<el-tag :type="getStatusType(scope.row.status)">
{{ getStatusText(scope.row.status) }}
</el-tag>
</template>
</el-table-column>
- <el-table-column label="鎿嶄綔" align="center" width="200" fixed="right">
+ <el-table-column label="鎿嶄綔"
+ align="center"
+ width="200"
+ fixed="right">
<template #default="scope">
- <el-button type="primary" link @click="viewDetail(scope.row)">鏌ョ湅</el-button>
- <el-button
- v-if="scope.row.status == '0'"
- type="primary"
- link
- @click="handleApproval(scope.row)"
- >
+ <el-button type="primary"
+ link
+ @click="viewDetail(scope.row)">鏌ョ湅</el-button>
+ <el-button v-if="scope.row.status == '0'"
+ type="primary"
+ link
+ @click="handleApproval(scope.row)">
鍙戝竷
</el-button>
</template>
</el-table-column>
</el-table>
-
<!-- 鍒嗛〉 -->
- <pagination
- v-show="total > 0"
- :total="total"
- v-model:page="queryParams.current"
- v-model:limit="queryParams.size"
- @pagination="getList"
- />
+ <pagination v-show="total > 0"
+ :total="total"
+ v-model:page="queryParams.current"
+ v-model:limit="queryParams.size"
+ @pagination="getList" />
</el-card>
-
<!-- 浼氳璇︽儏瀵硅瘽妗� -->
- <el-dialog
- title="浼氳璇︽儏"
- v-model="detailDialogVisible"
- width="800px"
- >
+ <el-dialog title="浼氳璇︽儏"
+ v-model="detailDialogVisible"
+ width="800px">
<div v-if="currentMeeting">
- <el-descriptions label-width="100px" class="meeting-desc" :column="2" border>
- <el-descriptions-item label="浼氳涓婚" label-class-name="nowrap-label">{{
+ <el-descriptions label-width="100px"
+ class="meeting-desc"
+ :column="2"
+ border>
+ <el-descriptions-item label="浼氳涓婚"
+ label-class-name="nowrap-label">{{
currentMeeting.title
}}</el-descriptions-item>
- <el-descriptions-item label="鐢宠浜�" label-class-name="nowrap-label">{{
+ <el-descriptions-item label="鐢宠浜�"
+ label-class-name="nowrap-label">{{
currentMeeting.applicant
}}</el-descriptions-item>
- <el-descriptions-item label="涓荤悊浜�" label-class-name="nowrap-label">{{
+ <el-descriptions-item label="涓荤悊浜�"
+ label-class-name="nowrap-label">{{
currentMeeting.host
}}</el-descriptions-item>
- <el-descriptions-item label="浼氳鏃堕棿" :span="2" label-class-name="nowrap-label">
+ <el-descriptions-item label="浼氳鏃堕棿"
+ :span="2"
+ label-class-name="nowrap-label">
{{ formatDateTime(currentMeeting.meetingTime) }}
</el-descriptions-item>
- <el-descriptions-item label="浼氳鍦扮偣" label-class-name="nowrap-label">{{
+ <el-descriptions-item label="浼氳鍦扮偣"
+ label-class-name="nowrap-label">{{
currentMeeting.location
}}</el-descriptions-item>
- <el-descriptions-item label="鍙備細浜烘暟" label-class-name="nowrap-label">{{
+ <el-descriptions-item label="鍙備細浜烘暟"
+ label-class-name="nowrap-label">{{
currentMeeting.participants.length
}}浜�</el-descriptions-item>
- <el-descriptions-item label="鍙戝竷鐘舵��" label-class-name="nowrap-label">
+ <el-descriptions-item label="鍙戝竷鐘舵��"
+ label-class-name="nowrap-label">
<el-tag :type="getStatusType(currentMeeting.status)">
{{ getStatusText(currentMeeting.status) }}
</el-tag>
</el-descriptions-item>
- <el-descriptions-item label="鐢宠鏃堕棿" label-class-name="nowrap-label">{{
+ <el-descriptions-item label="鐢宠鏃堕棿"
+ label-class-name="nowrap-label">{{
currentMeeting.createTime
}}</el-descriptions-item>
- <el-descriptions-item style="max-height: 400px" label="浼氳璇存槑" :span="2"
+ <el-descriptions-item style="max-height: 400px"
+ label="浼氳璇存槑"
+ :span="2"
label-class-name="nowrap-label">{{ currentMeeting.description }}</el-descriptions-item>
</el-descriptions>
-
-
<div class="content-section mt-20">
<h4>鍙備細浜哄憳</h4>
<div class="participants-list">
- <el-tag
- v-for="participant in currentMeeting.participants"
- :key="participant.id"
- style="margin-right: 10px; margin-bottom: 10px;"
- >
+ <el-tag v-for="participant in currentMeeting.participants"
+ :key="participant.id"
+ style="margin-right: 10px; margin-bottom: 10px;">
{{ participant.name }}
</el-tag>
</div>
</div>
</div>
-
<template #footer>
<div class="dialog-footer">
<el-button @click="detailDialogVisible = false">鍏� 闂�</el-button>
</div>
</template>
</el-dialog>
-
<!-- 浼氳鍙戝竷瀵硅瘽妗� -->
- <el-dialog
- title="浼氳鍙戝竷"
- v-model="approvalDialogVisible"
- >
+ <el-dialog title="浼氳鍙戝竷"
+ v-model="approvalDialogVisible">
<div v-if="currentMeeting">
- <el-descriptions :column="2" border>
+ <el-descriptions :column="2"
+ border>
<el-descriptions-item label="浼氳涓婚">{{ currentMeeting.title }}</el-descriptions-item>
<el-descriptions-item label="鐢宠浜�">{{ currentMeeting.applicant }}</el-descriptions-item>
<el-descriptions-item label="涓荤悊浜�">{{ currentMeeting.host }}</el-descriptions-item>
- <el-descriptions-item label="浼氳鏃堕棿" :span="2">
+ <el-descriptions-item label="浼氳鏃堕棿"
+ :span="2">
{{ formatDateTime(currentMeeting.meetingTime) }}
</el-descriptions-item>
<el-descriptions-item label="浼氳鍦扮偣">{{ currentMeeting.location }}</el-descriptions-item>
<el-descriptions-item label="鍙備細浜烘暟">{{ currentMeeting.participants.length }}浜�</el-descriptions-item>
</el-descriptions>
-
<div class="content-section mt-20">
<h4>鍙備細浜哄憳</h4>
<div class="participants-list">
- <el-tag
- v-for="participant in currentMeeting.participants"
- :key="participant.id"
- style="margin-right: 10px; margin-bottom: 10px;"
- >
+ <el-tag v-for="participant in currentMeeting.participants"
+ :key="participant.id"
+ style="margin-right: 10px; margin-bottom: 10px;">
{{ participant.name }}
</el-tag>
</div>
</div>
-
<div class="approval-opinion mt-20">
<h4>鍙戝竷鎰忚</h4>
- <el-input
- v-model="publishComment"
- type="textarea"
- placeholder="璇疯緭鍏ュ彂甯冩剰瑙�"
- :rows="4"
- />
+ <el-input v-model="publishComment"
+ type="textarea"
+ placeholder="璇疯緭鍏ュ彂甯冩剰瑙�"
+ :rows="4" />
</div>
</div>
-
<template #footer>
<div class="dialog-footer">
<el-button @click="approvalDialogVisible = false">鍙� 娑�</el-button>
-<!-- <el-button type="danger" @click="submitApproval('2')">涓嶉�氳繃</el-button>-->
- <el-button type="primary" @click="submitApproval('1')">鍙� 甯�</el-button>
+ <!-- <el-button type="danger" @click="submitApproval('2')">涓嶉�氳繃</el-button>-->
+ <el-button type="primary"
+ @click="submitApproval('1')">鍙� 甯�</el-button>
</div>
</template>
</el-dialog>
@@ -182,231 +215,260 @@
</template>
<script setup>
-import {ref, reactive, onMounted} from 'vue'
-import {ElMessage, ElMessageBox} from 'element-plus'
-import Pagination from '@/components/Pagination/index.vue'
-import {getRoomEnum, getMeetingPublish,saveMeetingApplication} from '@/api/collaborativeApproval/meeting.js'
-import dayjs from "dayjs";
-import {staffOnJobListPage} from "@/api/personnelManagement/staffOnJob.js";
+ import { ref, reactive, onMounted } from "vue";
+ import { ElMessage, ElMessageBox } from "element-plus";
+ import Pagination from "@/components/Pagination/index.vue";
+ import {
+ getRoomEnum,
+ getMeetingPublish,
+ saveMeetingApplication,
+ } from "@/api/collaborativeApproval/meeting.js";
+ import dayjs from "dayjs";
+ import { userListNoPageByTenantId } from "@/api/system/user.js";
-// 鏁版嵁鍒楄〃鍔犺浇鐘舵��
-const loading = ref(false)
+ // 鏁版嵁鍒楄〃鍔犺浇鐘舵��
+ const loading = ref(false);
-// 鎬绘潯鏁�
-const total = ref(0)
+ // 鎬绘潯鏁�
+ const total = ref(0);
-// 琛ㄦ牸楂樺害锛堟牴鎹獥鍙i珮搴﹁嚜閫傚簲锛�
-const tableHeight = ref(window.innerHeight - 380)
-const roomEnum = ref([])
-const staffList = ref([])
-// 鍙戝竷鍒楄〃鏁版嵁
-const approvalList = ref([])
+ // 琛ㄦ牸楂樺害锛堟牴鎹獥鍙i珮搴﹁嚜閫傚簲锛�
+ const tableHeight = ref(window.innerHeight - 380);
+ const roomEnum = ref([]);
+ const userList = ref([]);
+ // 鍙戝竷鍒楄〃鏁版嵁
+ const approvalList = ref([]);
-// 鏌ヨ鍙傛暟
-const queryParams = reactive({
- current: 1,
- size: 10
-})
+ // 鏌ヨ鍙傛暟
+ const queryParams = reactive({
+ current: 1,
+ size: 10,
+ });
-// 鎼滅储琛ㄥ崟
-const searchForm = reactive({
- title: '',
- applicant: '',
- status: ''
-})
+ // 鎼滅储琛ㄥ崟
+ const searchForm = reactive({
+ title: "",
+ applicant: "",
+ status: "",
+ });
-// 鏄惁鏄剧ず瀵硅瘽妗�
-const detailDialogVisible = ref(false)
-const approvalDialogVisible = ref(false)
+ // 鏄惁鏄剧ず瀵硅瘽妗�
+ const detailDialogVisible = ref(false);
+ const approvalDialogVisible = ref(false);
-// 褰撳墠鏌ョ湅鐨勪細璁�
-const currentMeeting = ref(null)
+ // 褰撳墠鏌ョ湅鐨勪細璁�
+ const currentMeeting = ref(null);
-// 鍙戝竷鎰忚
-const publishComment = ref('')
+ // 鍙戝竷鎰忚
+ const publishComment = ref("");
-// 鏌ヨ鏁版嵁
-const getList = async () => {
- loading.value = true
- let resp = await getMeetingPublish({...searchForm, ...queryParams})
- approvalList.value = resp.data.records.map(it => {
- let room = roomEnum.value.find(room => it.roomId === room.id)
- it.location = `${room.name}(${room.location})`
- let staffs = JSON.parse(it.participants)
- it.staffCount = staffs.size
- it.status = it.publishStatus
- it.meetingTime = `${it.meetingDate} ${dayjs(it.startTime).format('HH:mm:ss')} ~ ${dayjs(it.endTime).format('HH:mm:ss')}`
- it.participants = staffList.value.filter(staff => staffs.some(id=>id === staff.id)).map(staff => {
- return {
- id: staff.id,
- name: `${staff.staffName}${staff.postName ? ` (${staff.postName})` : ''}`
+ // 鏌ヨ鏁版嵁
+ const getList = async () => {
+ loading.value = true;
+ let resp = await getMeetingPublish({ ...searchForm, ...queryParams });
+ const userMap = new Map(userList.value.map(u => [String(u.userId), u]));
+ approvalList.value = resp.data.records.map(it => {
+ let room = roomEnum.value.find(room => it.roomId === room.id);
+ it.location = `${room.name}(${room.location})`;
+ let participantIds = [];
+ try {
+ participantIds = Array.isArray(it.participants)
+ ? it.participants
+ : JSON.parse(it.participants);
+ } catch (_e) {
+ participantIds = [];
}
- })
+ if (!Array.isArray(participantIds)) participantIds = [];
+ it.staffCount = participantIds.length;
+ it.status = it.publishStatus;
+ it.meetingTime = `${it.meetingDate} ${dayjs(it.startTime).format(
+ "HH:mm:ss"
+ )} ~ ${dayjs(it.endTime).format("HH:mm:ss")}`;
+ it.participants = participantIds.map(id => {
+ const user = userMap.get(String(id));
+ const nickName = user?.nickName || user?.userName || String(id ?? "");
+ const deptNames = user?.deptNames || "";
+ return {
+ id,
+ name: deptNames ? `${nickName} (${deptNames})` : nickName,
+ };
+ });
+ return it;
+ });
+ total.value = resp.data.total;
+ loading.value = false;
+ };
- return it
- })
- total.value = resp.data.total
- loading.value = false
-}
+ // 鎼滅储鎸夐挳鎿嶄綔
+ const handleSearch = () => {
+ queryParams.pageNum = 1;
+ getList();
+ };
-// 鎼滅储鎸夐挳鎿嶄綔
-const handleSearch = () => {
- queryParams.pageNum = 1
- getList()
-}
+ // 閲嶇疆鎼滅储琛ㄥ崟
+ const resetSearch = () => {
+ Object.assign(searchForm, {
+ title: "",
+ applicant: "",
+ status: "",
+ });
+ handleSearch();
+ };
-// 閲嶇疆鎼滅储琛ㄥ崟
-const resetSearch = () => {
- Object.assign(searchForm, {
- title: '',
- applicant: '',
- status: ''
- })
- handleSearch()
-}
+ // 鏌ョ湅璇︽儏
+ const viewDetail = row => {
+ currentMeeting.value = row;
+ detailDialogVisible.value = true;
+ };
-// 鏌ョ湅璇︽儏
-const viewDetail = (row) => {
- currentMeeting.value = row
- detailDialogVisible.value = true
-}
+ // 澶勭悊鍙戝竷
+ const handleApproval = row => {
+ currentMeeting.value = row;
+ publishComment.value = "";
+ approvalDialogVisible.value = true;
+ };
-// 澶勭悊鍙戝竷
-const handleApproval = (row) => {
- currentMeeting.value = row
- publishComment.value = ''
- approvalDialogVisible.value = true
-}
+ // 鑾峰彇鐘舵�佺被鍨�
+ const getStatusType = status => {
+ const statusMap = {
+ 0: "info", // 寰呭彂甯�
+ 1: "success", // 宸查�氳繃
+ 2: "danger", // 鏈�氳繃
+ };
+ return statusMap[status] || "info";
+ };
-// 鑾峰彇鐘舵�佺被鍨�
-const getStatusType = (status) => {
- const statusMap = {
- '0': 'info', // 寰呭彂甯�
- '1': 'success', // 宸查�氳繃
- '2': 'danger', // 鏈�氳繃
- }
- return statusMap[status] || 'info'
-}
+ // 鑾峰彇鐘舵�佹枃鏈�
+ const getStatusText = status => {
+ const statusMap = {
+ 0: "寰呭彂甯�",
+ 1: "宸插彂甯�",
+ 2: "宸插彇娑�",
+ };
+ return statusMap[status] || "鏈煡";
+ };
-// 鑾峰彇鐘舵�佹枃鏈�
-const getStatusText = (status) => {
- const statusMap = {
- '0': '寰呭彂甯�',
- '1': '宸插彂甯�',
- '2': '宸插彇娑�',
- }
- return statusMap[status] || '鏈煡'
-}
+ // 鏍煎紡鍖栨棩鏈熸椂闂�
+ const formatDateTime = dateTime => {
+ if (!dateTime) return "";
+ return dateTime.replace(" ", "\n");
+ };
-// 鏍煎紡鍖栨棩鏈熸椂闂�
-const formatDateTime = (dateTime) => {
- if (!dateTime) return ''
- return dateTime.replace(' ', '\n')
-}
+ // 鎻愪氦鍙戝竷
+ const submitApproval = status => {
+ // if (status === 'approved' && !publishComment.value.trim()) {
+ // ElMessage.warning('璇峰~鍐欏彂甯冩剰瑙�')
+ // return
+ // }
-// 鎻愪氦鍙戝竷
-const submitApproval = (status) => {
- // if (status === 'approved' && !publishComment.value.trim()) {
- // ElMessage.warning('璇峰~鍐欏彂甯冩剰瑙�')
- // return
- // }
-
- ElMessageBox.confirm(
- `纭${status === '1' ? '鍙戝竷' : '鍙栨秷'}璇ヤ細璁紵`,
- '鍙戝竷纭',
+ ElMessageBox.confirm(
+ `纭${status === "1" ? "鍙戝竷" : "鍙栨秷"}璇ヤ細璁紵`,
+ "鍙戝竷纭",
{
- confirmButtonText: '纭畾',
- cancelButtonText: '鍙栨秷',
- type: 'warning'
+ confirmButtonText: "纭畾",
+ cancelButtonText: "鍙栨秷",
+ type: "warning",
}
- ).then(() => {
- saveMeetingApplication({
- id: currentMeeting.value.id,
- publishStatus: status,
- publishComment: publishComment.value
- }).then(resp=>{
- // 鏇存柊浼氳鐘舵��
- currentMeeting.value.status = status
+ )
+ .then(() => {
+ saveMeetingApplication({
+ id: currentMeeting.value.id,
+ publishStatus: status,
+ publishComment: publishComment.value,
+ }).then(resp => {
+ // 鏇存柊浼氳鐘舵��
+ currentMeeting.value.status = status;
- ElMessage.success('鍙戝竷鎻愪氦鎴愬姛')
- approvalDialogVisible.value = false
- getList()
- })
+ ElMessage.success("鍙戝竷鎻愪氦鎴愬姛");
+ approvalDialogVisible.value = false;
+ getList();
+ });
+ })
+ .catch(() => {});
+ };
- }).catch(() => {
- })
-}
+ // 椤甸潰鍔犺浇鏃惰幏鍙栨暟鎹�
+ onMounted(async () => {
+ const [resp1, resp2] = await Promise.all([
+ getRoomEnum(),
+ userListNoPageByTenantId(),
+ ]);
+ roomEnum.value = resp1.data;
+ const list = Array.isArray(resp2?.data) ? resp2.data : [];
+ userList.value = list
+ .map(item => ({
+ userId: item?.userId,
+ nickName: item?.nickName,
+ userName: item?.userName,
+ deptNames:
+ item?.deptNames || (item?.dept?.deptName ? item.dept.deptName : ""),
+ }))
+ .filter(item => item.userId !== null && item.userId !== undefined);
-// 椤甸潰鍔犺浇鏃惰幏鍙栨暟鎹�
-onMounted(async () => {
- const [resp1, resp2]= await Promise.all([getRoomEnum(), staffOnJobListPage({current: -1, size: -1, staffState: 1})])
- roomEnum.value = resp1.data
- staffList.value = resp2.data.records
-
- await getList()
-})
+ await getList();
+ });
</script>
<style scoped>
-.app-container {
- padding: 20px;
-}
+ .app-container {
+ padding: 20px;
+ }
-.page-header {
- display: flex;
- justify-content: space-between;
- align-items: center;
- margin-bottom: 20px;
-}
+ .page-header {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ margin-bottom: 20px;
+ }
-.page-header h2 {
- margin: 0;
- color: #303133;
-}
+ .page-header h2 {
+ margin: 0;
+ color: #303133;
+ }
-.search-card {
- margin-bottom: 20px;
-}
+ .search-card {
+ margin-bottom: 20px;
+ }
-.dialog-footer {
- display: flex;
- justify-content: flex-end;
- gap: 10px;
-}
+ .dialog-footer {
+ display: flex;
+ justify-content: flex-end;
+ gap: 10px;
+ }
-.content-section h4 {
- margin: 0 0 15px 0;
- color: #303133;
-}
+ .content-section h4 {
+ margin: 0 0 15px 0;
+ color: #303133;
+ }
-.mt-20 {
- margin-top: 20px;
-}
+ .mt-20 {
+ margin-top: 20px;
+ }
-.participants-list {
- min-height: 40px;
- padding: 15px;
- border-radius: 4px;
- line-height: 1.6;
-}
+ .participants-list {
+ min-height: 40px;
+ padding: 15px;
+ border-radius: 4px;
+ line-height: 1.6;
+ }
-.approval-opinion h4 {
- margin: 0 0 15px 0;
- color: #303133;
-}
+ .approval-opinion h4 {
+ margin: 0 0 15px 0;
+ color: #303133;
+ }
-.nowrap-label {
- white-space: nowrap !important;
-}
+ .nowrap-label {
+ white-space: nowrap !important;
+ }
-.description-content {
- white-space: pre-wrap;
- word-wrap: break-word;
- line-height: 1.6;
- padding: 10px;
- background-color: #f5f7fa;
- border-radius: 4px;
- min-height: 60px;
-}
+ .description-content {
+ white-space: pre-wrap;
+ word-wrap: break-word;
+ line-height: 1.6;
+ padding: 10px;
+ background-color: #f5f7fa;
+ border-radius: 4px;
+ min-height: 60px;
+ }
</style>
diff --git a/src/views/collaborativeApproval/notificationManagement/summary/index.vue b/src/views/collaborativeApproval/notificationManagement/summary/index.vue
index 2b26723..295d64e 100644
--- a/src/views/collaborativeApproval/notificationManagement/summary/index.vue
+++ b/src/views/collaborativeApproval/notificationManagement/summary/index.vue
@@ -1,153 +1,182 @@
<template>
<div>
-
- <el-form :model="searchForm" inline>
- <el-form-item label="浼氳涓婚">
- <el-input v-model="searchForm.title" placeholder="璇疯緭鍏ヤ細璁富棰�" clearable />
- </el-form-item>
- <el-form-item label="鐢宠浜�">
- <el-input v-model="searchForm.applicant" placeholder="璇疯緭鍏ョ敵璇蜂汉" clearable />
- </el-form-item>
- <el-form-item>
- <el-button type="primary" @click="handleSearch">鎼滅储</el-button>
- <el-button @click="resetSearch">閲嶇疆</el-button>
- </el-form-item>
- </el-form>
-
+ <el-form :model="searchForm"
+ inline>
+ <el-form-item label="浼氳涓婚">
+ <el-input v-model="searchForm.title"
+ placeholder="璇疯緭鍏ヤ細璁富棰�"
+ clearable />
+ </el-form-item>
+ <el-form-item label="鐢宠浜�">
+ <el-input v-model="searchForm.applicant"
+ placeholder="璇疯緭鍏ョ敵璇蜂汉"
+ clearable />
+ </el-form-item>
+ <el-form-item>
+ <el-button type="primary"
+ @click="handleSearch">鎼滅储</el-button>
+ <el-button @click="resetSearch">閲嶇疆</el-button>
+ </el-form-item>
+ </el-form>
<!-- 浼氳鍒楄〃 -->
<el-card>
- <el-table v-loading="loading" :data="meetingList" border :height="tableHeight">
- <el-table-column prop="title" label="浼氳涓婚" align="center" min-width="200" show-overflow-tooltip />
- <el-table-column prop="applicant" label="鐢宠浜�" align="center" width="120" />
- <el-table-column prop="host" label="涓绘寔浜�" align="center" width="120" />
- <el-table-column prop="meetingTime" label="浼氳鏃堕棿" align="center" width="180">
+ <el-table v-loading="loading"
+ :data="meetingList"
+ border
+ :height="tableHeight">
+ <el-table-column prop="title"
+ label="浼氳涓婚"
+ align="center"
+ min-width="200"
+ show-overflow-tooltip />
+ <el-table-column prop="applicant"
+ label="鐢宠浜�"
+ align="center"
+ width="120" />
+ <el-table-column prop="host"
+ label="涓绘寔浜�"
+ align="center"
+ width="120" />
+ <el-table-column prop="meetingTime"
+ label="浼氳鏃堕棿"
+ align="center"
+ width="180">
<template #default="scope">
{{ formatDateTime(scope.row.meetingTime) }}
</template>
</el-table-column>
- <el-table-column prop="location" label="浼氳鍦扮偣" align="center" width="150" />
- <el-table-column prop="participants" label="鍙備細浜烘暟" align="center" width="100">
+ <el-table-column prop="location"
+ label="浼氳鍦扮偣"
+ align="center"
+ width="150" />
+ <el-table-column prop="participants"
+ label="鍙備細浜烘暟"
+ align="center"
+ width="100">
<template #default="scope">
{{ scope.row.participants.length }}浜�
</template>
</el-table-column>
- <el-table-column label="鎿嶄綔" align="center" width="200" fixed="right">
+ <el-table-column label="鎿嶄綔"
+ align="center"
+ width="200"
+ fixed="right">
<template #default="scope">
- <el-button type="primary" link @click="viewDetail(scope.row)">鏌ョ湅</el-button>
- <el-button
- type="primary"
- link
- @click="addMinutes(scope.row)"
- >
+ <el-button type="primary"
+ link
+ @click="viewDetail(scope.row)">鏌ョ湅</el-button>
+ <el-button type="primary"
+ link
+ @click="addMinutes(scope.row)">
娣诲姞绾
</el-button>
</template>
</el-table-column>
</el-table>
-
<!-- 鍒嗛〉 -->
- <pagination
- v-show="total > 0"
- :total="total"
- v-model:page="queryParams.current"
- v-model:limit="queryParams.size"
- @pagination="getList"
- />
+ <pagination v-show="total > 0"
+ :total="total"
+ v-model:page="queryParams.current"
+ v-model:limit="queryParams.size"
+ @pagination="getList" />
</el-card>
-
<!-- 浼氳璇︽儏瀵硅瘽妗� -->
- <el-dialog
- title="浼氳璇︽儏"
- v-model="detailDialogVisible"
- width="800px"
- >
+ <el-dialog title="浼氳璇︽儏"
+ v-model="detailDialogVisible"
+ width="800px">
<div v-if="currentMeeting">
- <el-descriptions label-width="100px" class="meeting-desc" :column="2" border>
- <el-descriptions-item label="浼氳涓婚" label-class-name="nowrap-label">{{
+ <el-descriptions label-width="100px"
+ class="meeting-desc"
+ :column="2"
+ border>
+ <el-descriptions-item label="浼氳涓婚"
+ label-class-name="nowrap-label">{{
currentMeeting.title
}}</el-descriptions-item>
- <el-descriptions-item label="鐢宠浜�" label-class-name="nowrap-label">{{
+ <el-descriptions-item label="鐢宠浜�"
+ label-class-name="nowrap-label">{{
currentMeeting.applicant
}}</el-descriptions-item>
- <el-descriptions-item label="涓绘寔浜�" label-class-name="nowrap-label">{{
+ <el-descriptions-item label="涓绘寔浜�"
+ label-class-name="nowrap-label">{{
currentMeeting.host
}}</el-descriptions-item>
- <el-descriptions-item label="浼氳鏃堕棿" :span="2" label-class-name="nowrap-label">
+ <el-descriptions-item label="浼氳鏃堕棿"
+ :span="2"
+ label-class-name="nowrap-label">
{{ formatDateTime(currentMeeting.meetingTime) }}
</el-descriptions-item>
- <el-descriptions-item label="浼氳鍦扮偣" label-class-name="nowrap-label">{{
+ <el-descriptions-item label="浼氳鍦扮偣"
+ label-class-name="nowrap-label">{{
currentMeeting.location
}}</el-descriptions-item>
- <el-descriptions-item label="鍙備細浜烘暟" label-class-name="nowrap-label">{{
+ <el-descriptions-item label="鍙備細浜烘暟"
+ label-class-name="nowrap-label">{{
currentMeeting.participants.length
}}浜�</el-descriptions-item>
- <el-descriptions-item label="瀹℃壒鐘舵��" label-class-name="nowrap-label">
+ <el-descriptions-item label="瀹℃壒鐘舵��"
+ label-class-name="nowrap-label">
<el-tag :type="getStatusType(currentMeeting.status)">
{{ getStatusText(currentMeeting.status) }}
</el-tag>
</el-descriptions-item>
- <el-descriptions-item label="鐢宠鏃堕棿" label-class-name="nowrap-label">{{
+ <el-descriptions-item label="鐢宠鏃堕棿"
+ label-class-name="nowrap-label">{{
currentMeeting.createTime
}}</el-descriptions-item>
- <el-descriptions-item style="max-height: 400px" label="浼氳璇存槑" :span="2"
- label-class-name="nowrap-label">{{ currentMeeting.description }}</el-descriptions-item>
+ <el-descriptions-item style="max-height: 400px"
+ label="浼氳璇存槑"
+ :span="2"
+ label-class-name="nowrap-label">{{ currentMeeting.description }}</el-descriptions-item>
</el-descriptions>
-
<div class="content-section mt-20">
<h4>鍙備細浜哄憳</h4>
<div class="participants-list">
- <el-tag
- v-for="participant in currentMeeting.participants"
- :key="participant.id"
- style="margin-right: 10px; margin-bottom: 10px;"
- >
+ <el-tag v-for="participant in currentMeeting.participants"
+ :key="participant.id"
+ style="margin-right: 10px; margin-bottom: 10px;">
{{ participant.name }}
</el-tag>
</div>
</div>
</div>
-
<template #footer>
<div class="dialog-footer">
<el-button @click="detailDialogVisible = false">鍏� 闂�</el-button>
</div>
</template>
</el-dialog>
-
<!-- 娣诲姞浼氳绾瀵硅瘽妗� -->
- <el-dialog
- title="娣诲姞浼氳绾"
- v-model="minutesDialogVisible"
- width="80%"
- @close="handleCloseMinutesDialog"
- >
+ <el-dialog title="娣诲姞浼氳绾"
+ v-model="minutesDialogVisible"
+ width="80%"
+ @close="handleCloseMinutesDialog">
<div v-if="currentMeeting">
- <el-descriptions :column="2" border>
+ <el-descriptions :column="2"
+ border>
<el-descriptions-item label="浼氳涓婚">{{ currentMeeting.title }}</el-descriptions-item>
<el-descriptions-item label="鐢宠浜�">{{ currentMeeting.applicant }}</el-descriptions-item>
<el-descriptions-item label="涓绘寔浜�">{{ currentMeeting.host }}</el-descriptions-item>
- <el-descriptions-item label="浼氳鏃堕棿" :span="2">
+ <el-descriptions-item label="浼氳鏃堕棿"
+ :span="2">
{{ formatDateTime(currentMeeting.meetingTime) }}
</el-descriptions-item>
<el-descriptions-item label="浼氳鍦扮偣">{{ currentMeeting.location }}</el-descriptions-item>
<el-descriptions-item label="鍙備細浜烘暟">{{ currentMeeting.participants.length }}浜�</el-descriptions-item>
</el-descriptions>
-
<div class="content-section mt-20">
<h4>浼氳绾鍐呭</h4>
<div class="editor-container">
- <Editor
- v-model="minutesContent"
- :min-height="400"
- />
+ <Editor v-model="minutesContent"
+ :min-height="400" />
</div>
</div>
</div>
-
<template #footer>
<div class="dialog-footer">
<el-button @click="minutesDialogVisible = false">鍙� 娑�</el-button>
- <el-button type="primary" @click="submitMinutes">淇� 瀛�</el-button>
+ <el-button type="primary"
+ @click="submitMinutes">淇� 瀛�</el-button>
</div>
</template>
</el-dialog>
@@ -155,245 +184,278 @@
</template>
<script setup>
-import { ref, reactive, onMounted } from 'vue'
-import { ElMessage } from 'element-plus'
-import Pagination from '@/components/Pagination/index.vue'
-import Editor from '@/components/Editor/index.vue'
-import { getRoomEnum, getMeetingPublish ,getMeetingMinutesByMeetingId,saveMeetingMinutes} from '@/api/collaborativeApproval/meeting.js'
-import dayjs from "dayjs"
-import {staffOnJobListPage} from "@/api/personnelManagement/staffOnJob.js";
+ import { ref, reactive, onMounted } from "vue";
+ import { ElMessage } from "element-plus";
+ import Pagination from "@/components/Pagination/index.vue";
+ import Editor from "@/components/Editor/index.vue";
+ import {
+ getRoomEnum,
+ getMeetingPublish,
+ getMeetingMinutesByMeetingId,
+ saveMeetingMinutes,
+ } from "@/api/collaborativeApproval/meeting.js";
+ import dayjs from "dayjs";
+ import { userListNoPageByTenantId } from "@/api/system/user.js";
-// 鏁版嵁鍒楄〃鍔犺浇鐘舵��
-const loading = ref(false)
+ // 鏁版嵁鍒楄〃鍔犺浇鐘舵��
+ const loading = ref(false);
-// 鎬绘潯鏁�
-const total = ref(0)
+ // 鎬绘潯鏁�
+ const total = ref(0);
-// 琛ㄦ牸楂樺害锛堟牴鎹獥鍙i珮搴﹁嚜閫傚簲锛�
-const tableHeight = ref(window.innerHeight - 380)
-const roomEnum = ref([])
-const staffList = ref([])
+ // 琛ㄦ牸楂樺害锛堟牴鎹獥鍙i珮搴﹁嚜閫傚簲锛�
+ const tableHeight = ref(window.innerHeight - 380);
+ const roomEnum = ref([]);
+ const userList = ref([]);
-// 浼氳鍒楄〃鏁版嵁
-const meetingList = ref([])
+ // 浼氳鍒楄〃鏁版嵁
+ const meetingList = ref([]);
-// 鏌ヨ鍙傛暟
-const queryParams = reactive({
- current: 1,
- size: 10
-})
+ // 鏌ヨ鍙傛暟
+ const queryParams = reactive({
+ current: 1,
+ size: 10,
+ });
-// 鎼滅储琛ㄥ崟
-const searchForm = reactive({
- title: '',
- applicant: '',
- // status: '1' // 榛樿鍙樉绀哄凡閫氳繃瀹℃壒鐨勪細璁�
-})
+ // 鎼滅储琛ㄥ崟
+ const searchForm = reactive({
+ title: "",
+ applicant: "",
+ // status: '1' // 榛樿鍙樉绀哄凡閫氳繃瀹℃壒鐨勪細璁�
+ });
-// 鏄惁鏄剧ず瀵硅瘽妗�
-const detailDialogVisible = ref(false)
-const minutesDialogVisible = ref(false)
+ // 鏄惁鏄剧ず瀵硅瘽妗�
+ const detailDialogVisible = ref(false);
+ const minutesDialogVisible = ref(false);
-// 褰撳墠鏌ョ湅鐨勪細璁�
-const currentMeeting = ref(null)
+ // 褰撳墠鏌ョ湅鐨勪細璁�
+ const currentMeeting = ref(null);
-// 浼氳绾鍐呭
-const minutesContent = ref('')
-const minutesContentId = ref('')
+ // 浼氳绾鍐呭
+ const minutesContent = ref("");
+ const minutesContentId = ref("");
-// 鏌ヨ鏁版嵁
-const getList = async () => {
- loading.value = true
- let resp = await getMeetingPublish({ ...searchForm, ...queryParams })
- meetingList.value = resp.data.records.map(it => {
- let room = roomEnum.value.find(room => it.roomId === room.id)
- it.location = `${room.name}(${room.location})`
- let staffs = JSON.parse(it.participants)
- it.staffCount = staffs.size
- it.meetingTime = `${it.meetingDate} ${dayjs(it.startTime).format('HH:mm:ss')} ~ ${dayjs(it.endTime).format('HH:mm:ss')}`
- it.participants = staffList.value.filter(staff => staffs.some(id => id === staff.id)).map(staff => {
- return {
- id: staff.id,
- name: `${staff.staffName}${staff.postName ? ` (${staff.postName})` : ''}`
- }
- })
+ const parseParticipants = raw => {
+ if (!raw) return [];
+ if (Array.isArray(raw)) return raw;
+ try {
+ const parsed = JSON.parse(raw);
+ return Array.isArray(parsed) ? parsed : [];
+ } catch (_e) {
+ return [];
+ }
+ };
- return it
- })
- total.value = resp.data.total
- loading.value = false
-}
+ // 鏌ヨ鏁版嵁
+ const getList = async () => {
+ loading.value = true;
+ let resp = await getMeetingPublish({ ...searchForm, ...queryParams });
+ const userMap = new Map(userList.value.map(u => [String(u.userId), u]));
+ meetingList.value = resp.data.records.map(it => {
+ let room = roomEnum.value.find(room => it.roomId === room.id);
+ it.location = `${room.name}(${room.location})`;
+ const participantIds = parseParticipants(it.participants);
+ it.staffCount = participantIds.length;
+ it.meetingTime = `${it.meetingDate} ${dayjs(it.startTime).format(
+ "HH:mm:ss"
+ )} ~ ${dayjs(it.endTime).format("HH:mm:ss")}`;
+ it.participants = participantIds.map(id => {
+ const user = userMap.get(String(id));
+ const nickName = user?.nickName || user?.userName || String(id ?? "");
+ const deptNames = user?.deptNames || "";
+ return {
+ id,
+ name: deptNames ? `${nickName} (${deptNames})` : nickName,
+ };
+ });
-// 鎼滅储鎸夐挳鎿嶄綔
-const handleSearch = () => {
- queryParams.current = 1
- getList()
-}
+ return it;
+ });
+ total.value = resp.data.total;
+ loading.value = false;
+ };
-// 閲嶇疆鎼滅储琛ㄥ崟
-const resetSearch = () => {
- Object.assign(searchForm, {
- title: '',
- applicant: '',
- // status: '1'
- })
- handleSearch()
-}
+ // 鎼滅储鎸夐挳鎿嶄綔
+ const handleSearch = () => {
+ queryParams.current = 1;
+ getList();
+ };
-// 鏌ョ湅璇︽儏
-const viewDetail = (row) => {
- currentMeeting.value = row
- detailDialogVisible.value = true
-}
+ // 閲嶇疆鎼滅储琛ㄥ崟
+ const resetSearch = () => {
+ Object.assign(searchForm, {
+ title: "",
+ applicant: "",
+ // status: '1'
+ });
+ handleSearch();
+ };
-// 娣诲姞浼氳绾
-const addMinutes = async (row) => {
- let resp = await getMeetingMinutesByMeetingId(row.id)
- currentMeeting.value = row
- if (resp.data){
- minutesContent.value = resp.data.content
- minutesContentId.value = resp.data.id
- }else {
- minutesContent.value = `<h2>${row.title}浼氳绾</h2>
-<p><strong>浼氳鏃堕棿锛�</strong>${row.meetingTime}</p>
-<p><strong>浼氳鍦扮偣锛�</strong>${row.location}</p>
-<p><strong>涓绘寔浜猴細</strong>${row.host}</p>
-<p><strong>鍙備細浜哄憳锛�</strong></p>
-<ol>
- ${row.participants.map(p => `<li>${p.name}</li>`).join('')}
-</ol>
-<p><strong>浼氳鍐呭锛�</strong></p>
-<ol>
- <li>璁涓�锛�
- <ul>
- <li>璁ㄨ鍐呭锛�</li>
- <li>鍐宠浜嬮」锛�</li>
- </ul>
- </li>
- <li>璁浜岋細
- <ul>
- <li>璁ㄨ鍐呭锛�</li>
- <li>鍐宠浜嬮」锛�</li>
- </ul>
- </li>
-</ol>
-<p><strong>澶囨敞锛�</strong></p>`
- }
+ // 鏌ョ湅璇︽儏
+ const viewDetail = row => {
+ currentMeeting.value = row;
+ detailDialogVisible.value = true;
+ };
- minutesDialogVisible.value = true
-}
+ // 娣诲姞浼氳绾
+ const addMinutes = async row => {
+ let resp = await getMeetingMinutesByMeetingId(row.id);
+ currentMeeting.value = row;
+ if (resp.data) {
+ minutesContent.value = resp.data.content;
+ minutesContentId.value = resp.data.id;
+ } else {
+ minutesContent.value = `<h2>${row.title}浼氳绾</h2>
+ <p><strong>浼氳鏃堕棿锛�</strong>${row.meetingTime}</p>
+ <p><strong>浼氳鍦扮偣锛�</strong>${row.location}</p>
+ <p><strong>涓绘寔浜猴細</strong>${row.host}</p>
+ <p><strong>鍙備細浜哄憳锛�</strong></p>
+ <ol>
+ ${row.participants.map(p => `<li>${p.name}</li>`).join("")}
+ </ol>
+ <p><strong>浼氳鍐呭锛�</strong></p>
+ <ol>
+ <li>璁涓�锛�
+ <ul>
+ <li>璁ㄨ鍐呭锛�</li>
+ <li>鍐宠浜嬮」锛�</li>
+ </ul>
+ </li>
+ <li>璁浜岋細
+ <ul>
+ <li>璁ㄨ鍐呭锛�</li>
+ <li>鍐宠浜嬮」锛�</li>
+ </ul>
+ </li>
+ </ol>
+ <p><strong>澶囨敞锛�</strong></p>`;
+ }
-// 鎻愪氦浼氳绾
-const submitMinutes = () => {
- if (!minutesContent.value) {
- ElMessage.warning('璇疯緭鍏ヤ細璁邯瑕佸唴瀹�')
- return
- }
- saveMeetingMinutes({
- id: minutesContentId.value,
- content: minutesContent.value,
- meetingId: currentMeeting.value.id,
- title: currentMeeting.value.title
- }).then(resp=>{
- console.log('浼氳绾鍐呭:', minutesContent.value)
- ElMessage.success('浼氳绾淇濆瓨鎴愬姛')
- minutesDialogVisible.value = false
- })
+ minutesDialogVisible.value = true;
+ };
-}
+ // 鎻愪氦浼氳绾
+ const submitMinutes = () => {
+ if (!minutesContent.value) {
+ ElMessage.warning("璇疯緭鍏ヤ細璁邯瑕佸唴瀹�");
+ return;
+ }
+ saveMeetingMinutes({
+ id: minutesContentId.value,
+ content: minutesContent.value,
+ meetingId: currentMeeting.value.id,
+ title: currentMeeting.value.title,
+ }).then(resp => {
+ console.log("浼氳绾鍐呭:", minutesContent.value);
+ ElMessage.success("浼氳绾淇濆瓨鎴愬姛");
+ minutesDialogVisible.value = false;
+ });
+ };
-// 鍏抽棴浼氳绾瀵硅瘽妗�
-const handleCloseMinutesDialog = () => {
- minutesContent.value = ''
-}
+ // 鍏抽棴浼氳绾瀵硅瘽妗�
+ const handleCloseMinutesDialog = () => {
+ minutesContent.value = "";
+ };
-// 鑾峰彇鐘舵�佺被鍨�
-const getStatusType = (status) => {
- const statusMap = {
- '0': 'info', // 寰呭鎵�
- '1': 'success', // 宸查�氳繃
- '2': 'warning', // 鏈�氳繃
- '3': 'danger' // 鍙栨秷
- }
- return statusMap[status] || 'info'
-}
+ // 鑾峰彇鐘舵�佺被鍨�
+ const getStatusType = status => {
+ const statusMap = {
+ 0: "info", // 寰呭鎵�
+ 1: "success", // 宸查�氳繃
+ 2: "warning", // 鏈�氳繃
+ 3: "danger", // 鍙栨秷
+ };
+ return statusMap[status] || "info";
+ };
-// 鑾峰彇鐘舵�佹枃鏈�
-const getStatusText = (status) => {
- const statusMap = {
- '0': '寰呭鎵�',
- '1': '宸查�氳繃',
- '2': '鏈�氳繃',
- '3': '宸插彇娑�'
- }
- return statusMap[status] || '鏈煡'
-}
+ // 鑾峰彇鐘舵�佹枃鏈�
+ const getStatusText = status => {
+ const statusMap = {
+ 0: "寰呭鎵�",
+ 1: "宸查�氳繃",
+ 2: "鏈�氳繃",
+ 3: "宸插彇娑�",
+ };
+ return statusMap[status] || "鏈煡";
+ };
-// 鏍煎紡鍖栨棩鏈熸椂闂�
-const formatDateTime = (dateTime) => {
- if (!dateTime) return ''
- return dateTime.replace(' ', '\n')
-}
+ // 鏍煎紡鍖栨棩鏈熸椂闂�
+ const formatDateTime = dateTime => {
+ if (!dateTime) return "";
+ return dateTime.replace(" ", "\n");
+ };
-// 椤甸潰鍔犺浇鏃惰幏鍙栨暟鎹�
-onMounted(async () => {
- const [resp1, resp2] = await Promise.all([getRoomEnum(), staffOnJobListPage({current: -1, size: -1, staffState: 1})])
- roomEnum.value = resp1.data
- staffList.value = resp2.data.records
+ // 椤甸潰鍔犺浇鏃惰幏鍙栨暟鎹�
+ onMounted(async () => {
+ const [resp1, resp2] = await Promise.all([
+ getRoomEnum(),
+ userListNoPageByTenantId(),
+ ]);
+ roomEnum.value = resp1.data;
+ const list = Array.isArray(resp2?.data) ? resp2.data : [];
+ userList.value = list
+ .map(item => ({
+ userId: item?.userId,
+ nickName: item?.nickName,
+ userName: item?.userName,
+ deptNames:
+ item?.deptNames || (item?.dept?.deptName ? item.dept.deptName : ""),
+ }))
+ .filter(item => item.userId !== null && item.userId !== undefined);
- await getList()
-})
+ await getList();
+ });
</script>
<style scoped>
-.app-container {
- padding: 20px;
-}
+ .app-container {
+ padding: 20px;
+ }
-.page-header {
- display: flex;
- justify-content: space-between;
- align-items: center;
- margin-bottom: 20px;
-}
+ .page-header {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ margin-bottom: 20px;
+ }
-.page-header h2 {
- margin: 0;
- color: #303133;
-}
+ .page-header h2 {
+ margin: 0;
+ color: #303133;
+ }
-.search-card {
- margin-bottom: 20px;
-}
+ .search-card {
+ margin-bottom: 20px;
+ }
-.dialog-footer {
- display: flex;
- justify-content: flex-end;
- gap: 10px;
-}
+ .dialog-footer {
+ display: flex;
+ justify-content: flex-end;
+ gap: 10px;
+ }
-.content-section h4 {
- margin: 0 0 15px 0;
- color: #303133;
-}
+ .content-section h4 {
+ margin: 0 0 15px 0;
+ color: #303133;
+ }
-.mt-20 {
- margin-top: 20px;
-}
+ .mt-20 {
+ margin-top: 20px;
+ }
-.participants-list {
- min-height: 40px;
- padding: 15px;
- border-radius: 4px;
- line-height: 1.6;
-}
+ .participants-list {
+ min-height: 40px;
+ padding: 15px;
+ border-radius: 4px;
+ line-height: 1.6;
+ }
-.nowrap-label {
- white-space: nowrap !important;
-}
+ .nowrap-label {
+ white-space: nowrap !important;
+ }
-.editor-container {
- border: 1px solid #dcdfe6;
- border-radius: 4px;
-}
+ .editor-container {
+ border: 1px solid #dcdfe6;
+ border-radius: 4px;
+ }
</style>
diff --git a/src/views/productionManagement/workOrder/index.vue b/src/views/productionManagement/workOrder/index.vue
index 18ece60..9c62a41 100644
--- a/src/views/productionManagement/workOrder/index.vue
+++ b/src/views/productionManagement/workOrder/index.vue
@@ -233,6 +233,7 @@
<el-form-item label="鐝粍淇℃伅"
prop="teamList">
<el-select v-model="reportForm.teamList"
+ ref="teamSelectRef"
multiple
filterable
allow-create
@@ -242,8 +243,8 @@
value-key="userName"
placeholder="璇烽�夋嫨鎴栬緭鍏ョ彮缁勬垚鍛�"
@change="handleTeamListChange">
- <el-option v-for="user in reportForm.userIdsList"
- :key="user.userId"
+ <el-option v-for="user in teamSelectOptions"
+ :key="user.userId || `custom-${user.nickName}`"
:label="user.nickName"
:value="{ userId: user.userId, userName: user.nickName }" />
</el-select>
@@ -505,6 +506,7 @@
const currentUserId = ref("");
const deviceOptions = ref([]);
const currentUserName = ref("");
+ const teamSelectRef = ref(null);
const ensureCurrentUser = async () => {
if (currentUserId.value) return;
@@ -1216,6 +1218,29 @@
teamList: [],
deviceId: null,
});
+ const teamSelectOptions = computed(() => {
+ const base =
+ Array.isArray(reportForm.userIdsList) && reportForm.userIdsList.length > 0
+ ? reportForm.userIdsList.map(u => ({
+ userId: String(u.userId ?? ""),
+ nickName: String(u.nickName ?? "").trim(),
+ }))
+ : [];
+ const baseNameSet = new Set(base.map(u => u.nickName));
+ const selected = Array.isArray(reportForm.teamList)
+ ? reportForm.teamList
+ : [];
+ const extraNames = selected
+ .map(item => {
+ if (typeof item === "string") return String(item).trim();
+ const name = item?.userName ?? item?.nickName ?? "";
+ return String(name).trim();
+ })
+ .filter(Boolean)
+ .filter(name => !baseNameSet.has(name));
+ const extras = extraNames.map(name => ({ userId: "", nickName: name }));
+ return [...base, ...extras];
+ });
function removeLastFour(str) {
if (!str) return ""; // 绌哄�间繚鎶�
return str.toString().slice(0, -4); // 鏍稿績锛氭埅鍙� 0 鍒� 鍊掓暟绗�4浣�
@@ -1675,13 +1700,39 @@
const handleTeamListChange = val => {
if (!Array.isArray(val)) return;
- if (!val.some(item => typeof item === "string")) return;
- reportForm.teamList = val.map(item => {
+ let hasString = false;
+ const newList = val.map(item => {
if (typeof item === "string") {
+ hasString = true;
return { userName: item };
}
return item;
});
+
+ if (hasString) {
+ reportForm.teamList = newList;
+ }
+
+ // 瑙e喅 allow-create 鍦� multiple 妯″紡涓嬭緭鍏ユ鍐呭涓嶈嚜鍔ㄦ竻绌虹殑闂
+ setTimeout(() => {
+ if (teamSelectRef.value) {
+ // 1. 娓呴櫎鍐呴儴 query 鐘舵��
+ teamSelectRef.value.query = "";
+ if (teamSelectRef.value.states) {
+ teamSelectRef.value.states.query = "";
+ teamSelectRef.value.states.inputValue = "";
+ }
+ // 2. 寮哄埗娓呴櫎 DOM 杈撳叆妗嗙殑鍊�
+ const input = teamSelectRef.value.$el?.querySelector("input");
+ if (input) {
+ input.value = "";
+ }
+ // 3. 閽堝鏌愪簺鐗堟湰锛岄噸缃�変腑鏍囩鐨勫唴閮ㄥ亸绉伙紙闃叉杈撳叆妗嗚鎸ゅ崰锛�
+ if (typeof teamSelectRef.value.resetInputState === "function") {
+ teamSelectRef.value.resetInputState();
+ }
+ }
+ }, 50);
};
// 瀹℃牳浜�
const handleReviewerIdChange = userId => {
diff --git a/src/views/qualityManagement/finalInspection/components/formDia.vue b/src/views/qualityManagement/finalInspection/components/formDia.vue
index 2866cca..84c0eba 100644
--- a/src/views/qualityManagement/finalInspection/components/formDia.vue
+++ b/src/views/qualityManagement/finalInspection/components/formDia.vue
@@ -1,120 +1,167 @@
<template>
<div>
- <el-dialog
- v-model="dialogFormVisible"
- :title="operationType === 'add' ? '鏂板鍑哄巶妫�楠�' : '缂栬緫鍑哄巶妫�楠�'"
- width="70%"
- @close="closeDia"
- >
- <el-form :model="form" label-width="140px" label-position="top" :rules="rules" ref="formRef">
+ <el-dialog v-model="dialogFormVisible"
+ :title="operationType === 'add' ? '鏂板鍑哄巶妫�楠�' : '缂栬緫鍑哄巶妫�楠�'"
+ width="70%"
+ @close="closeDia">
+ <el-form :model="form"
+ label-width="140px"
+ label-position="top"
+ :rules="rules"
+ ref="formRef">
<el-row :gutter="30">
<el-col :span="12">
- <el-form-item label="浜у搧鍚嶇О锛�" prop="productId">
- <el-tree-select
- v-model="form.productId"
- placeholder="璇烽�夋嫨"
- clearable
- check-strictly
- @change="getModels"
- :data="productOptions"
- :render-after-expand="false"
- :disabled="operationType === 'edit'"
- style="width: 100%"
- />
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="瑙勬牸鍨嬪彿锛�" prop="productModelId">
- <el-select v-model="form.productModelId" 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-form-item label="宸ュ簭锛�"
+ prop="process">
+ <el-select v-model="form.process"
+ placeholder="璇烽�夋嫨宸ュ簭"
+ clearable
+ :disabled="processQuantityDisabled"
+ @change="handleProcessChange"
+ style="width: 100%">
+ <el-option v-for="item in processList"
+ :key="item.name"
+ :label="item.name"
+ :value="item.name" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
- <el-form-item label="鎸囨爣閫夋嫨锛�" prop="testStandardId">
- <el-select
- v-model="form.testStandardId"
- placeholder="璇烽�夋嫨鎸囨爣"
- clearable
- @change="handleTestStandardChange"
- style="width: 100%"
- >
- <el-option
- v-for="item in testStandardOptions"
- :key="item.id"
- :label="item.standardName || item.standardNo"
- :value="item.id"
- />
+ <el-form-item label="浜у搧鍚嶇О锛�"
+ prop="productId">
+ <el-tree-select v-model="form.productId"
+ placeholder="璇烽�夋嫨"
+ clearable
+ check-strictly
+ @change="getModels"
+ :data="productOptions"
+ :render-after-expand="false"
+ :disabled="operationType === 'edit'"
+ style="width: 100%" />
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-row :gutter="30">
+ <el-col :span="12">
+ <el-form-item label="瑙勬牸鍨嬪彿锛�"
+ prop="productModelId">
+ <el-select v-model="form.productModelId"
+ 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-col :span="12">
+ <el-form-item label="鎸囨爣閫夋嫨锛�"
+ prop="testStandardId">
+ <el-select v-model="form.testStandardId"
+ placeholder="璇烽�夋嫨鎸囨爣"
+ clearable
+ @change="handleTestStandardChange"
+ style="width: 100%">
+ <el-option v-for="item in testStandardOptions"
+ :key="item.id"
+ :label="item.standardName || item.standardNo"
+ :value="item.id" />
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="30">
<el-col :span="12">
- <el-form-item label="鍗曚綅锛�" prop="unit">
- <el-input v-model="form.unit" placeholder="璇疯緭鍏�" disabled/>
+ <el-form-item label="鍗曚綅锛�"
+ prop="unit">
+ <el-input v-model="form.unit"
+ placeholder="璇疯緭鍏�"
+ disabled />
</el-form-item>
</el-col>
<el-col :span="12">
- <el-form-item label="鏁伴噺锛�" prop="quantity">
- <el-input-number :step="0.01" :min="0" style="width: 100%" v-model="form.quantity" placeholder="璇疯緭鍏�" clearable :precision="2" :disabled="quantityDisabled"/>
+ <el-form-item label="鏁伴噺锛�"
+ prop="quantity">
+ <el-input-number :step="0.01"
+ :min="0"
+ style="width: 100%"
+ v-model="form.quantity"
+ placeholder="璇疯緭鍏�"
+ clearable
+ :precision="2"
+ :disabled="quantityDisabled" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="30">
<el-col :span="12">
- <el-form-item label="妫�娴嬪崟浣嶏細" prop="checkCompany">
- <el-input v-model="form.checkCompany" placeholder="璇疯緭鍏�" clearable/>
+ <el-form-item label="妫�娴嬪崟浣嶏細"
+ prop="checkCompany">
+ <el-input v-model="form.checkCompany"
+ placeholder="璇疯緭鍏�"
+ clearable />
</el-form-item>
</el-col>
<el-col :span="12">
- <el-form-item label="妫�娴嬬粨鏋滐細" prop="checkResult">
+ <el-form-item label="妫�娴嬬粨鏋滐細"
+ prop="checkResult">
<el-select v-model="form.checkResult">
- <el-option label="鍚堟牸" value="鍚堟牸" />
- <el-option label="涓嶅悎鏍�" value="涓嶅悎鏍�" />
+ <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="checkName">
- <el-select v-model="form.checkName" placeholder="璇烽�夋嫨" clearable filterable>
- <el-option v-for="item in userList" :key="item.nickName" :label="item.nickName"
- :value="item.nickName"/>
- </el-select>
+ <el-form-item label="妫�楠屽憳锛�"
+ prop="checkName">
+ <el-select v-model="form.checkName"
+ placeholder="璇烽�夋嫨"
+ clearable
+ filterable>
+ <el-option v-for="item in userList"
+ :key="item.nickName"
+ :label="item.nickName"
+ :value="item.nickName" />
+ </el-select>
</el-form-item>
</el-col>
<el-col :span="12">
- <el-form-item label="妫�娴嬫棩鏈燂細" prop="checkTime">
- <el-date-picker
- v-model="form.checkTime"
- type="date"
- placeholder="璇烽�夋嫨鏃ユ湡"
- value-format="YYYY-MM-DD"
- format="YYYY-MM-DD"
- clearable
- style="width: 100%"
- />
+ <el-form-item label="妫�娴嬫棩鏈燂細"
+ prop="checkTime">
+ <el-date-picker v-model="form.checkTime"
+ type="date"
+ placeholder="璇烽�夋嫨鏃ユ湡"
+ value-format="YYYY-MM-DD"
+ format="YYYY-MM-DD"
+ clearable
+ style="width: 100%" />
</el-form-item>
</el-col>
</el-row>
</el-form>
- <PIMTable
- rowKey="id"
- :column="tableColumn"
- :tableData="tableData"
- :tableLoading="tableLoading"
- height="400"
- >
- <template #slot="{ row }">
- <el-input v-model="row.testValue" clearable/>
- </template>
- </PIMTable>
+ <PIMTable rowKey="id"
+ :column="tableColumn"
+ :tableData="tableData"
+ :tableLoading="tableLoading"
+ height="400">
+ <template #slot="{ row }">
+ <el-input v-model="row.testValue"
+ clearable />
+ </template>
+ </PIMTable>
<template #footer>
<div class="dialog-footer">
- <el-button type="primary" @click="submitForm">纭</el-button>
+ <el-button type="primary"
+ @click="submitForm">纭</el-button>
<el-button @click="closeDia">鍙栨秷</el-button>
</div>
</template>
@@ -123,315 +170,396 @@
</template>
<script setup>
-import {ref, reactive, toRefs, computed, getCurrentInstance, nextTick} from "vue";
-import {getOptions} from "@/api/procurementManagement/procurementLedger.js";
-import {modelList, productTreeList} from "@/api/basicData/product.js";
-import {qualityInspectAdd, qualityInspectUpdate} from "@/api/qualityManagement/rawMaterialInspection.js";
-import {userListNoPage} from "@/api/system/user.js";
-import {qualityInspectDetailByProductId, getQualityTestStandardParamByTestStandardId} from "@/api/qualityManagement/metricMaintenance.js";
-import {qualityInspectParamInfo} from "@/api/qualityManagement/qualityInspectParam.js";
-const { proxy } = getCurrentInstance()
-const emit = defineEmits(['close'])
+ import {
+ ref,
+ reactive,
+ toRefs,
+ computed,
+ getCurrentInstance,
+ nextTick,
+ } from "vue";
+ import { getOptions } from "@/api/procurementManagement/procurementLedger.js";
+ import { modelList, productTreeList } from "@/api/basicData/product.js";
+ import {
+ qualityInspectAdd,
+ qualityInspectUpdate,
+ } from "@/api/qualityManagement/rawMaterialInspection.js";
+ import { userListNoPage } from "@/api/system/user.js";
+ import {
+ qualityInspectDetailByProductId,
+ getQualityTestStandardParamByTestStandardId,
+ } from "@/api/qualityManagement/metricMaintenance.js";
+ import { qualityInspectParamInfo } from "@/api/qualityManagement/qualityInspectParam.js";
+ import { list } from "@/api/productionManagement/productionProcess";
+ const { proxy } = getCurrentInstance();
+ const emit = defineEmits(["close"]);
-const dialogFormVisible = ref(false);
-const operationType = ref('')
-const data = reactive({
- form: {
- checkTime: "",
- process: "",
- checkName: "",
- productName: "",
- productId: "",
- productModelId: "",
- model: "",
- testStandardId: "",
- unit: "",
- quantity: "",
- checkCompany: "",
- checkResult: "",
- },
- rules: {
- checkTime: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" },],
- process: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
- checkName: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }],
- productId: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
- productModelId: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
- testStandardId: [{required: false, message: "璇烽�夋嫨鎸囨爣", trigger: "change"}],
- unit: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }],
- quantity: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
- checkCompany: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }],
- checkResult: [{ required: true, message: "璇疯緭鍏�", trigger: "change" }],
- },
-});
-const { form, rules } = toRefs(data);
-// 缂栬緫鏃讹細productMainId 鎴� purchaseLedgerId 浠讳竴鏈夊�煎垯鏁伴噺缃伆
-const quantityDisabled = computed(() => {
- const v = form.value || {};
- return !!(v.productMainId != null || v.purchaseLedgerId != null);
-});
-const supplierList = ref([]);
-const productOptions = ref([]);
-const tableColumn = ref([
- {
- label: "鎸囨爣",
- prop: "parameterItem",
- },
- {
- label: "鍗曚綅",
- prop: "unit",
- },
- {
- label: "鏍囧噯鍊�",
- prop: "standardValue",
- },
- {
- label: "鍐呮帶鍊�",
- prop: "controlValue",
- },
- {
- label: "妫�楠屽��",
- prop: "testValue",
- dataType: 'slot',
- slot: 'slot',
- },
-]);
-const tableData = ref([]);
-const tableLoading = ref(false);
-const userList = ref([]);
-const currentProductId = ref(0);
-const testStandardOptions = ref([]); // 鎸囨爣閫夋嫨涓嬫媺妗嗘暟鎹�
-const modelOptions = ref([]);
-
-// 鎵撳紑寮规
-const openDialog = async (type, row, defaultCheckResult = "", defaultCheckName = "") => {
- operationType.value = type;
- dialogFormVisible.value = true;
- // 鍏堟竻绌鸿〃鍗曢獙璇佺姸鎬侊紝閬垮厤闂儊
- await nextTick();
- proxy.$refs.formRef?.clearValidate();
-
- // 骞惰鍔犺浇鍩虹鏁版嵁
- const [userListsRes] = await Promise.all([
- userListNoPage(),
- getProductOptions(),
- getOptions().then((res) => {
- supplierList.value = res.data;
- })
+ const dialogFormVisible = ref(false);
+ const operationType = ref("");
+ const data = reactive({
+ form: {
+ checkTime: "",
+ process: "",
+ checkName: "",
+ productName: "",
+ productId: "",
+ productModelId: "",
+ model: "",
+ testStandardId: "",
+ unit: "",
+ quantity: "",
+ checkCompany: "",
+ checkResult: "",
+ },
+ rules: {
+ checkTime: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
+ process: [{ required: true, message: "璇烽�夋嫨宸ュ簭", trigger: "change" }],
+ checkName: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }],
+ productId: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
+ productModelId: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
+ testStandardId: [
+ { required: false, message: "璇烽�夋嫨鎸囨爣", trigger: "change" },
+ ],
+ unit: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }],
+ quantity: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
+ checkCompany: [{ required: false, message: "璇疯緭鍏�", trigger: "blur" }],
+ checkResult: [{ required: true, message: "璇疯緭鍏�", trigger: "change" }],
+ },
+ });
+ const { form, rules } = toRefs(data);
+ // 缂栬緫鏃讹細productMainId 鎴� purchaseLedgerId 浠讳竴鏈夊�煎垯鏁伴噺缃伆
+ const quantityDisabled = computed(() => {
+ const v = form.value || {};
+ return !!(v.productMainId != null || v.purchaseLedgerId != null);
+ });
+ const processQuantityDisabled = computed(() => {
+ const v = form.value || {};
+ return !!(v.productMainId != null || v.purchaseLedgerId != null);
+ });
+ const processList = ref([]); // 宸ュ簭涓嬫媺鍒楄〃锛堝伐搴忓悕绉� name锛�
+ const supplierList = ref([]);
+ const productOptions = ref([]);
+ const tableColumn = ref([
+ {
+ label: "鎸囨爣",
+ prop: "parameterItem",
+ },
+ {
+ label: "鍗曚綅",
+ prop: "unit",
+ },
+ {
+ label: "鏍囧噯鍊�",
+ prop: "standardValue",
+ },
+ {
+ label: "鍐呮帶鍊�",
+ prop: "controlValue",
+ },
+ {
+ label: "妫�楠屽��",
+ prop: "testValue",
+ dataType: "slot",
+ slot: "slot",
+ },
]);
- // 绛涢�� roleIds 鍖呭惈 106 鐨勭敤鎴�
- userList.value = (userListsRes.data || []).filter(user => {
- const roleIds = user.roleIds || [];
- return roleIds.includes(106) || roleIds.includes('106');
- });
+ const tableData = ref([]);
+ const tableLoading = ref(false);
+ const userList = ref([]);
+ const currentProductId = ref(0);
+ const testStandardOptions = ref([]); // 鎸囨爣閫夋嫨涓嬫媺妗嗘暟鎹�
+ const modelOptions = ref([]);
- form.value = {}
- testStandardOptions.value = [];
- tableData.value = [];
+ // 鎵撳紑寮规
+ const openDialog = async (
+ type,
+ row,
+ defaultCheckResult = "",
+ defaultCheckName = ""
+ ) => {
+ operationType.value = type;
+ dialogFormVisible.value = true;
+ await nextTick();
+ proxy.$refs.formRef?.clearValidate?.();
- if (operationType.value === 'edit') {
- // 鍏堜繚瀛� testStandardId锛岄伩鍏嶈娓呯┖
- const savedTestStandardId = row.testStandardId;
- // 鍏堣缃〃鍗曟暟鎹紝浣嗘殏鏃舵竻绌� testStandardId锛岀瓑閫夐」鍔犺浇瀹屾垚鍚庡啀璁剧疆
- form.value = {...row, testStandardId: ''}
- // 濡傛灉浼犲叆浜嗛粯璁ゆ娴嬬粨鏋滐紝瑕嗙洊row涓殑鍊�
- if (defaultCheckResult) {
- form.value.checkResult = defaultCheckResult;
- }
- // 濡傛灉浼犲叆浜嗛粯璁ゆ楠屽憳锛岃鐩杛ow涓殑鍊硷紙浼樺厛浣跨敤浼犲叆鐨勬楠屽憳锛�
- console.log('formDia checkName debug:', { defaultCheckName, rowCheckName: row.checkName });
- form.value.checkName = defaultCheckName || row.checkName || "";
- currentProductId.value = row.productId || 0
- // 娓呯┖楠岃瘉鐘舵�侊紝閬垮厤鏁版嵁鍔犺浇杩囩▼涓殑鏍¢獙闂儊
- nextTick(() => {
- proxy.$refs.formRef?.clearValidate();
+ const [userListsRes] = await Promise.all([
+ userListNoPage(),
+ getProductOptions(),
+ getOptions().then(res => {
+ supplierList.value = res.data;
+ }),
+ list()
+ .then(res => {
+ processList.value = res.data || [];
+ })
+ .catch(() => {
+ processList.value = [];
+ }),
+ ]);
+ // 绛涢�� roleIds 鍖呭惈 106 鐨勭敤鎴�
+ userList.value = (userListsRes.data || []).filter(user => {
+ const roleIds = user.roleIds || [];
+ return roleIds.includes(106) || roleIds.includes("106");
});
-
- // 缂栬緫妯″紡涓嬶紝骞惰鍔犺浇瑙勬牸鍨嬪彿鍜屾寚鏍囬�夐」
- if (currentProductId.value) {
- // 璁剧疆浜у搧鍚嶇О
- form.value.productName = findNodeById(productOptions.value, currentProductId.value);
-
- // 骞惰鍔犺浇瑙勬牸鍨嬪彿鍜屾寚鏍囬�夐」
- const params = {
- productId: currentProductId.value,
- inspectType: 2
- };
-
- Promise.all([
- modelList({ id: currentProductId.value }),
- qualityInspectDetailByProductId(params)
- ]).then(([modelRes, testStandardRes]) => {
- // 璁剧疆瑙勬牸鍨嬪彿閫夐」
- modelOptions.value = modelRes || [];
- // 濡傛灉琛ㄥ崟涓凡鏈� productModelId锛岃缃搴旂殑 model 鍜� unit
- if (form.value.productModelId && modelOptions.value.length > 0) {
- const selectedModel = modelOptions.value.find(item => item.id == form.value.productModelId);
- if (selectedModel) {
- form.value.model = selectedModel.model || '';
- form.value.unit = selectedModel.unit || '';
- }
- }
-
- // 璁剧疆鎸囨爣閫夐」
- testStandardOptions.value = testStandardRes.data || [];
-
- // 璁剧疆 testStandardId 骞跺姞杞藉弬鏁板垪琛�
- nextTick(() => {
- if (savedTestStandardId) {
- // 纭繚绫诲瀷鍖归厤锛坕tem.id 鍙兘鏄暟瀛楁垨瀛楃涓诧級
- const matchedOption = testStandardOptions.value.find(item =>
- item.id == savedTestStandardId || String(item.id) === String(savedTestStandardId)
- );
- if (matchedOption) {
- // 纭繚浣跨敤鍖归厤椤圭殑 id锛堜繚鎸佺被鍨嬩竴鑷达級
- form.value.testStandardId = matchedOption.id;
- } else {
- // 濡傛灉鎵句笉鍒板尮閰嶉」锛屽皾璇曠洿鎺ヤ娇鐢ㄥ師鍊�
- console.warn('鏈壘鍒板尮閰嶇殑鎸囨爣閫夐」锛宼estStandardId:', savedTestStandardId, '鍙敤閫夐」:', testStandardOptions.value);
- form.value.testStandardId = savedTestStandardId;
- }
- }
- // 缂栬緫鍦烘櫙淇濈暀宸叉湁妫�楠屽�硷紝鐩存帴鎷夊彇鍘熷弬鏁版暟鎹�
- getQualityInspectParamList(row.id);
- });
- });
- } else {
- getQualityInspectParamList(row.id);
- }
- }
-}
-const getProductOptions = () => {
- return productTreeList().then((res) => {
- productOptions.value = convertIdToValue(res);
- });
-};
-const getModels = (value) => {
- form.value.productModelId = undefined;
- form.value.unit = undefined;
- modelOptions.value = [];
- currentProductId.value = value
- form.value.productName = findNodeById(productOptions.value, value);
- modelList({ id: value }).then((res) => {
- modelOptions.value = res;
- })
- if (currentProductId.value) {
- getList();
- }
-};
-const handleChangeModel = (value) => {
- form.value.model = modelOptions.value.find(item => item.id == value)?.model || '';
- form.value.unit = modelOptions.value.find(item => item.id == value)?.unit || '';
-}
-
-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
-};
-function convertIdToValue(data) {
- return data.map((item) => {
- const { id, children, ...rest } = item;
- const newItem = {
- ...rest,
- value: id, // 灏� id 鏀逛负 value
+ currentProductId.value = 0;
+ modelOptions.value = [];
+ form.value = {
+ checkTime: "",
+ process: "",
+ checkName: defaultCheckName || "",
+ productName: "",
+ productId: "",
+ productModelId: "",
+ model: "",
+ testStandardId: "",
+ unit: "",
+ quantity: "",
+ checkCompany: "",
+ checkResult: defaultCheckResult || "",
};
- if (children && children.length > 0) {
- newItem.children = convertIdToValue(children);
- }
-
- return newItem;
- });
-}
-// 鎻愪氦浜у搧琛ㄥ崟
-const submitForm = () => {
- proxy.$refs.formRef.validate(valid => {
- if (valid) {
- form.value.inspectType = 2
- if (operationType.value === "add") {
- tableData.value.forEach((item) => {
- delete item.id
- })
- }
- const data = {...form.value, qualityInspectParams: tableData.value}
- if (operationType.value === "add") {
- qualityInspectAdd(data).then(res => {
- proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
- closeDia();
- })
- } else {
- qualityInspectUpdate(data).then(res => {
- proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
- closeDia();
- })
- }
- }
- })
-}
-const getList = () => {
- if (!currentProductId.value) {
testStandardOptions.value = [];
tableData.value = [];
- return;
- }
- let params = {
- productId: currentProductId.value,
- inspectType: 2
- }
- qualityInspectDetailByProductId(params).then(res => {
- // 淇濆瓨涓嬫媺妗嗛�夐」鏁版嵁
- testStandardOptions.value = res.data || [];
- // 娓呯┖琛ㄦ牸鏁版嵁锛岀瓑寰呯敤鎴烽�夋嫨鎸囨爣
- tableData.value = [];
- // 娓呯┖鎸囨爣閫夋嫨
- form.value.testStandardId = '';
- })
-}
-// 鎸囨爣閫夋嫨鍙樺寲澶勭悊
-const handleTestStandardChange = (testStandardId) => {
- if (!testStandardId) {
+ if (operationType.value === "edit") {
+ // 鍏堜繚瀛� testStandardId锛岄伩鍏嶈娓呯┖
+ const savedTestStandardId = row.testStandardId;
+ // 鍏堣缃〃鍗曟暟鎹紝浣嗘殏鏃舵竻绌� testStandardId锛岀瓑閫夐」鍔犺浇瀹屾垚鍚庡啀璁剧疆
+ form.value = { ...row, testStandardId: "" };
+ // 濡傛灉浼犲叆浜嗛粯璁ゆ娴嬬粨鏋滐紝瑕嗙洊row涓殑鍊�
+ if (defaultCheckResult) {
+ form.value.checkResult = defaultCheckResult;
+ }
+ // 濡傛灉浼犲叆浜嗛粯璁ゆ楠屽憳锛岃鐩杛ow涓殑鍊硷紙浼樺厛浣跨敤浼犲叆鐨勬楠屽憳锛�
+ console.log("formDia checkName debug:", {
+ defaultCheckName,
+ rowCheckName: row.checkName,
+ });
+ form.value.checkName = defaultCheckName || row.checkName || "";
+ currentProductId.value = row.productId || 0;
+ // 娓呯┖楠岃瘉鐘舵�侊紝閬垮厤鏁版嵁鍔犺浇杩囩▼涓殑鏍¢獙闂儊
+ nextTick(() => {
+ proxy.$refs.formRef?.clearValidate();
+ });
+
+ // 缂栬緫妯″紡涓嬶紝骞惰鍔犺浇瑙勬牸鍨嬪彿鍜屾寚鏍囬�夐」
+ if (currentProductId.value) {
+ // 璁剧疆浜у搧鍚嶇О
+ form.value.productName = findNodeById(
+ productOptions.value,
+ currentProductId.value
+ );
+
+ // 骞惰鍔犺浇瑙勬牸鍨嬪彿鍜屾寚鏍囬�夐」
+ const params = {
+ productId: currentProductId.value,
+ inspectType: 2,
+ process: form.value.process || "",
+ };
+
+ Promise.all([
+ modelList({ id: currentProductId.value }),
+ qualityInspectDetailByProductId(params),
+ ]).then(([modelRes, testStandardRes]) => {
+ // 璁剧疆瑙勬牸鍨嬪彿閫夐」
+ modelOptions.value = modelRes || [];
+ // 濡傛灉琛ㄥ崟涓凡鏈� productModelId锛岃缃搴旂殑 model 鍜� unit
+ if (form.value.productModelId && modelOptions.value.length > 0) {
+ const selectedModel = modelOptions.value.find(
+ item => item.id == form.value.productModelId
+ );
+ if (selectedModel) {
+ form.value.model = selectedModel.model || "";
+ form.value.unit = selectedModel.unit || "";
+ }
+ }
+
+ // 璁剧疆鎸囨爣閫夐」
+ testStandardOptions.value = testStandardRes.data || [];
+
+ // 璁剧疆 testStandardId 骞跺姞杞藉弬鏁板垪琛�
+ nextTick(() => {
+ if (savedTestStandardId) {
+ // 纭繚绫诲瀷鍖归厤锛坕tem.id 鍙兘鏄暟瀛楁垨瀛楃涓诧級
+ const matchedOption = testStandardOptions.value.find(
+ item =>
+ item.id == savedTestStandardId ||
+ String(item.id) === String(savedTestStandardId)
+ );
+ if (matchedOption) {
+ // 纭繚浣跨敤鍖归厤椤圭殑 id锛堜繚鎸佺被鍨嬩竴鑷达級
+ form.value.testStandardId = matchedOption.id;
+ } else {
+ // 濡傛灉鎵句笉鍒板尮閰嶉」锛屽皾璇曠洿鎺ヤ娇鐢ㄥ師鍊�
+ console.warn(
+ "鏈壘鍒板尮閰嶇殑鎸囨爣閫夐」锛宼estStandardId:",
+ savedTestStandardId,
+ "鍙敤閫夐」:",
+ testStandardOptions.value
+ );
+ form.value.testStandardId = savedTestStandardId;
+ }
+ }
+ // 缂栬緫鍦烘櫙淇濈暀宸叉湁妫�楠屽�硷紝鐩存帴鎷夊彇鍘熷弬鏁版暟鎹�
+ getQualityInspectParamList(row.id);
+ });
+ });
+ } else {
+ getQualityInspectParamList(row.id);
+ }
+ }
+ };
+ const getProductOptions = () => {
+ return productTreeList().then(res => {
+ productOptions.value = convertIdToValue(res);
+ });
+ };
+ const getModels = value => {
+ form.value.productModelId = undefined;
+ form.value.unit = undefined;
+ modelOptions.value = [];
+ currentProductId.value = value;
+ form.value.productName = findNodeById(productOptions.value, value);
+ modelList({ id: value }).then(res => {
+ modelOptions.value = res;
+ });
+ if (currentProductId.value) {
+ getList();
+ }
+ };
+
+ const handleProcessChange = () => {
+ testStandardOptions.value = [];
tableData.value = [];
- return;
+ form.value.testStandardId = "";
+ if (currentProductId.value) {
+ getList();
+ }
+ };
+
+ const handleChangeModel = value => {
+ form.value.model =
+ modelOptions.value.find(item => item.id == value)?.model || "";
+ form.value.unit =
+ modelOptions.value.find(item => item.id == value)?.unit || "";
+ };
+
+ 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
+ };
+ 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;
+ });
}
- tableLoading.value = true;
- getQualityTestStandardParamByTestStandardId(testStandardId).then(res => {
- tableData.value = res.data || [];
- }).catch(error => {
- console.error('鑾峰彇鏍囧噯鍙傛暟澶辫触:', error);
+ // 鎻愪氦浜у搧琛ㄥ崟
+ const submitForm = () => {
+ proxy.$refs.formRef.validate(valid => {
+ if (valid) {
+ form.value.inspectType = 2;
+ if (operationType.value === "add") {
+ tableData.value.forEach(item => {
+ delete item.id;
+ });
+ }
+ const processName = form.value.process || "";
+ const data = {
+ ...form.value,
+ process: processName,
+ qualityInspectParams: tableData.value,
+ };
+ if (operationType.value === "add") {
+ qualityInspectAdd(data).then(res => {
+ proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
+ closeDia();
+ });
+ } else {
+ qualityInspectUpdate(data).then(res => {
+ proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
+ closeDia();
+ });
+ }
+ }
+ });
+ };
+ const getList = () => {
+ if (!currentProductId.value) {
+ testStandardOptions.value = [];
+ tableData.value = [];
+ return;
+ }
+ let params = {
+ productId: currentProductId.value,
+ inspectType: 2,
+ process: form.value.process || "",
+ };
+ qualityInspectDetailByProductId(params).then(res => {
+ // 淇濆瓨涓嬫媺妗嗛�夐」鏁版嵁
+ testStandardOptions.value = res.data || [];
+ // 娓呯┖琛ㄦ牸鏁版嵁锛岀瓑寰呯敤鎴烽�夋嫨鎸囨爣
+ tableData.value = [];
+ // 娓呯┖鎸囨爣閫夋嫨
+ form.value.testStandardId = "";
+ });
+ };
+
+ // 鎸囨爣閫夋嫨鍙樺寲澶勭悊
+ const handleTestStandardChange = testStandardId => {
+ if (!testStandardId) {
+ tableData.value = [];
+ return;
+ }
+ tableLoading.value = true;
+ getQualityTestStandardParamByTestStandardId(testStandardId)
+ .then(res => {
+ tableData.value = res.data || [];
+ })
+ .catch(error => {
+ console.error("鑾峰彇鏍囧噯鍙傛暟澶辫触:", error);
+ tableData.value = [];
+ })
+ .finally(() => {
+ tableLoading.value = false;
+ });
+ };
+ const getQualityInspectParamList = id => {
+ qualityInspectParamInfo(id).then(res => {
+ tableData.value = res.data;
+ });
+ };
+ // 鍏抽棴寮规
+ const closeDia = () => {
+ proxy.resetForm("formRef");
tableData.value = [];
- }).finally(() => {
- tableLoading.value = false;
- })
-}
-const getQualityInspectParamList = (id) => {
- qualityInspectParamInfo(id).then(res => {
- tableData.value = res.data;
- })
-}
-// 鍏抽棴寮规
-const closeDia = () => {
- proxy.resetForm("formRef");
- tableData.value = [];
- testStandardOptions.value = [];
- form.value.testStandardId = '';
- dialogFormVisible.value = false;
- emit('close')
-};
-defineExpose({
- openDialog,
-});
+ testStandardOptions.value = [];
+ form.value.testStandardId = "";
+ dialogFormVisible.value = false;
+ emit("close");
+ };
+ defineExpose({
+ openDialog,
+ });
</script>
<style scoped>
-
-</style>
\ No newline at end of file
+</style>
diff --git a/src/views/qualityManagement/finalInspection/index.vue b/src/views/qualityManagement/finalInspection/index.vue
index 899ff7d..ea8e698 100644
--- a/src/views/qualityManagement/finalInspection/index.vue
+++ b/src/views/qualityManagement/finalInspection/index.vue
@@ -2,50 +2,73 @@
<div class="app-container">
<div class="search_form">
<div>
- <span class="search_title">浜у搧鍚嶇О锛�</span>
- <el-input
- v-model="searchForm.productName"
- style="width: 240px"
- placeholder="璇疯緭鍏ヤ骇鍝佸悕绉版悳绱�"
- @change="handleQuery"
- clearable
- :prefix-icon="Search"
- />
- <span style="margin-left: 10px" class="search_title">妫�娴嬫棩鏈燂細</span>
- <el-date-picker v-model="searchForm.entryDate" value-format="YYYY-MM-DD" format="YYYY-MM-DD" type="daterange"
- placeholder="璇烽�夋嫨" clearable @change="changeDaterange" />
- <el-button type="primary" @click="handleQuery" style="margin-left: 10px"
- >鎼滅储</el-button
- >
+ <span class="search_title">宸ュ簭锛�</span>
+ <el-input v-model="searchForm.process"
+ style="width: 240px"
+ placeholder="璇疯緭鍏ュ伐搴忔悳绱�"
+ @change="handleQuery"
+ clearable
+ :prefix-icon="Search" />
+ <span style="margin-left: 10px"
+ class="search_title">浜у搧鍚嶇О锛�</span>
+ <el-input v-model="searchForm.productName"
+ style="width: 240px"
+ placeholder="璇疯緭鍏ヤ骇鍝佸悕绉版悳绱�"
+ @change="handleQuery"
+ clearable
+ :prefix-icon="Search" />
+ <span style="margin-left: 10px"
+ class="search_title">妫�娴嬫棩鏈燂細</span>
+ <el-date-picker v-model="searchForm.entryDate"
+ value-format="YYYY-MM-DD"
+ format="YYYY-MM-DD"
+ type="daterange"
+ placeholder="璇烽�夋嫨"
+ clearable
+ @change="changeDaterange" />
+ <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="primary"
+ @click="openForm('add')">鏂板</el-button>
<el-button @click="handleOut">瀵煎嚭</el-button>
- <el-button type="danger" plain @click="handleDelete">鍒犻櫎</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"
- ></PIMTable>
+ <PIMTable rowKey="id"
+ :column="tableColumn"
+ :tableData="tableData"
+ :page="page"
+ :isSelection="true"
+ @selection-change="handleSelectionChange"
+ :tableLoading="tableLoading"
+ @pagination="pagination"
+ :total="page.total"></PIMTable>
</div>
- <InspectionFormDia ref="inspectionFormDia" @close="handleQuery"></InspectionFormDia>
- <FormDia ref="formDia" @close="handleQuery"></FormDia>
- <files-dia ref="filesDia" @close="handleQuery"></files-dia>
+ <InspectionFormDia ref="inspectionFormDia"
+ @close="handleQuery"></InspectionFormDia>
+ <FormDia ref="formDia"
+ @close="handleQuery"></FormDia>
+ <files-dia ref="filesDia"
+ @close="handleQuery"></files-dia>
<!-- 妫�楠岀粨鏋滈�夋嫨瀵硅瘽妗� -->
- <el-dialog v-model="quickCheckVisible" title="妫�楠�" width="40%" @close="closeQuickCheck">
- <el-form :model="quickCheckForm" label-width="140px" label-position="top" ref="quickCheckRef">
+ <el-dialog v-model="quickCheckVisible"
+ title="妫�楠�"
+ width="40%"
+ @close="closeQuickCheck">
+ <el-form :model="quickCheckForm"
+ label-width="140px"
+ label-position="top"
+ ref="quickCheckRef">
<el-row :gutter="20">
<el-col :span="12">
- <el-form-item label="妫�娴嬬粨鏋滐細" required>
+ <el-form-item label="妫�娴嬬粨鏋滐細"
+ required>
<el-radio-group v-model="quickCheckForm.checkResult">
<el-radio value="鍚堟牸">鍚堟牸</el-radio>
<el-radio value="涓嶅悎鏍�">涓嶅悎鏍�</el-radio>
@@ -53,42 +76,44 @@
</el-form-item>
</el-col>
<el-col :span="12">
- <el-form-item label="妫�楠屽憳锛�" required>
- <el-select v-model="quickCheckForm.checkName" placeholder="璇烽�夋嫨" clearable style="width: 100%">
- <el-option v-for="item in userList" :key="item.nickName" :label="item.nickName" :value="item.nickName"/>
+ <el-form-item label="妫�楠屽憳锛�"
+ required>
+ <el-select v-model="quickCheckForm.checkName"
+ placeholder="璇烽�夋嫨"
+ clearable
+ style="width: 100%">
+ <el-option v-for="item in userList"
+ :key="item.nickName"
+ :label="item.nickName"
+ :value="item.nickName" />
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
- <el-form-item label="妫�娴嬫棩鏈燂細" required>
- <el-date-picker
- v-model="quickCheckForm.checkTime"
- type="date"
- placeholder="璇烽�夋嫨鏃ユ湡"
- value-format="YYYY-MM-DD"
- format="YYYY-MM-DD"
- clearable
- style="width: 100%"
- />
+ <el-form-item label="妫�娴嬫棩鏈燂細"
+ required>
+ <el-date-picker v-model="quickCheckForm.checkTime"
+ 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="鎸囨爣閫夋嫨锛�">
- <el-select
- v-model="quickCheckForm.testStandardId"
- placeholder="璇烽�夋嫨鎸囨爣"
- clearable
- @change="handleTestStandardChange"
- style="width: 100%"
- >
- <el-option
- v-for="item in testStandardOptions"
- :key="item.id"
- :label="item.standardName || item.standardNo"
- :value="item.id"
- />
+ <el-select v-model="quickCheckForm.testStandardId"
+ placeholder="璇烽�夋嫨鎸囨爣"
+ clearable
+ @change="handleTestStandardChange"
+ style="width: 100%">
+ <el-option v-for="item in testStandardOptions"
+ :key="item.id"
+ :label="item.standardName || item.standardNo"
+ :value="item.id" />
</el-select>
</el-form-item>
</el-col>
@@ -96,344 +121,380 @@
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="妫�娴嬪崟浣嶏細">
- <el-input v-model="quickCheckForm.checkCompany" placeholder="璇疯緭鍏�" clearable style="width: 100%"/>
+ <el-input v-model="quickCheckForm.checkCompany"
+ placeholder="璇疯緭鍏�"
+ clearable
+ style="width: 100%" />
</el-form-item>
</el-col>
</el-row>
<!-- 妫�楠屽�艰〃鏍� -->
- <el-form-item label="妫�楠屽�硷細" v-if="quickCheckTableData.length > 0">
- <PIMTable
- rowKey="id"
- :column="quickCheckTableColumn"
- :tableData="quickCheckTableData"
- :tableLoading="quickCheckTableLoading"
- height="200"
- >
+ <el-form-item label="妫�楠屽�硷細"
+ v-if="quickCheckTableData.length > 0">
+ <PIMTable rowKey="id"
+ :column="quickCheckTableColumn"
+ :tableData="quickCheckTableData"
+ :tableLoading="quickCheckTableLoading"
+ height="200">
<template #slot="{ row }">
- <el-input v-model="row.testValue" clearable placeholder="璇疯緭鍏ユ楠屽��"/>
+ <el-input v-model="row.testValue"
+ clearable
+ placeholder="璇疯緭鍏ユ楠屽��" />
</template>
</PIMTable>
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
- <el-button type="primary" @click="handleQuickCheckConfirm">纭</el-button>
+ <el-button type="primary"
+ @click="handleQuickCheckConfirm">纭</el-button>
<el-button @click="closeQuickCheck">鍙栨秷</el-button>
</div>
</template>
</el-dialog>
- <el-dialog v-model="dialogFormVisible" title="缂栬緫妫�楠屽憳" width="30%"
- @close="closeDia">
- <el-form :model="form" label-width="140px" label-position="top" :rules="rules" ref="formRef">
- <el-form-item label="妫�楠屽憳锛�" prop="checkName">
- <el-select v-model="form.checkName" placeholder="璇烽�夋嫨" clearable>
- <el-option v-for="item in userList" :key="item.nickName" :label="item.nickName"
- :value="item.nickName"/>
- </el-select>
- </el-form-item>
- </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>
+ <el-dialog v-model="dialogFormVisible"
+ title="缂栬緫妫�楠屽憳"
+ width="30%"
+ @close="closeDia">
+ <el-form :model="form"
+ label-width="140px"
+ label-position="top"
+ :rules="rules"
+ ref="formRef">
+ <el-form-item label="妫�楠屽憳锛�"
+ prop="checkName">
+ <el-select v-model="form.checkName"
+ placeholder="璇烽�夋嫨"
+ clearable>
+ <el-option v-for="item in userList"
+ :key="item.nickName"
+ :label="item.nickName"
+ :value="item.nickName" />
+ </el-select>
+ </el-form-item>
+ </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 { Search } from "@element-plus/icons-vue";
-import {onMounted, ref, reactive, toRefs, getCurrentInstance, nextTick} from "vue";
-import InspectionFormDia from "@/views/qualityManagement/finalInspection/components/inspectionFormDia.vue";
-import FormDia from "@/views/qualityManagement/finalInspection/components/formDia.vue";
-import {ElMessageBox} from "element-plus";
-import {
- downloadQualityInspect,
- qualityInspectDel,
- qualityInspectDetail,
- qualityInspectListPage, qualityInspectUpdate,
- submitQualityInspect,
- qualityInspectExportNew
-} from "@/api/qualityManagement/rawMaterialInspection.js";
-import {qualityInspectDetailByProductId, getQualityTestStandardParamByTestStandardId} from "@/api/qualityManagement/metricMaintenance.js";
-import FilesDia from "@/views/qualityManagement/finalInspection/components/filesDia.vue";
-import dayjs from "dayjs";
-import {userListNoPage} from "@/api/system/user.js";
-import useUserStore from "@/store/modules/user";
+ import { Search } from "@element-plus/icons-vue";
+ import {
+ onMounted,
+ ref,
+ reactive,
+ toRefs,
+ getCurrentInstance,
+ nextTick,
+ } from "vue";
+ import InspectionFormDia from "@/views/qualityManagement/finalInspection/components/inspectionFormDia.vue";
+ import FormDia from "@/views/qualityManagement/finalInspection/components/formDia.vue";
+ import { ElMessageBox } from "element-plus";
+ import {
+ downloadQualityInspect,
+ qualityInspectDel,
+ qualityInspectDetail,
+ qualityInspectListPage,
+ qualityInspectUpdate,
+ submitQualityInspect,
+ qualityInspectExportNew,
+ } from "@/api/qualityManagement/rawMaterialInspection.js";
+ import {
+ qualityInspectDetailByProductId,
+ getQualityTestStandardParamByTestStandardId,
+ } from "@/api/qualityManagement/metricMaintenance.js";
+ import FilesDia from "@/views/qualityManagement/finalInspection/components/filesDia.vue";
+ import dayjs from "dayjs";
+ import { userListNoPage } from "@/api/system/user.js";
+ import useUserStore from "@/store/modules/user";
-const data = reactive({
- searchForm: {
- productName: "",
- entryDate: undefined, // 褰曞叆鏃ユ湡
- entryDateStart: undefined,
- entryDateEnd: undefined,
- },
- rules: {
- checkName: [{required: true, message: "璇烽�夋嫨", trigger: "change"}],
- },
-});
-const { searchForm } = toRefs(data);
-const tableColumn = ref([
- {
- label: "妫�娴嬫棩鏈�",
- prop: "checkTime",
- width: 120
- },
- {
- label: "鐢熶骇宸ュ崟鍙�",
- prop: "workOrderNo",
- width: 120
- },
- {
- label: "妫�楠屽憳",
- prop: "checkName",
- },
- {
- label: "浜у搧鍚嶇О",
- prop: "productName",
- },
- {
- label: "瑙勬牸鍨嬪彿",
- prop: "model",
- },
- {
- label: "鍗曚綅",
- prop: "unit",
- },
- {
- label: "鏁伴噺",
- prop: "quantity",
- width: 100
- },
- {
- label: "妫�娴嬪崟浣�",
- prop: "checkCompany",
- width: 120
- },
- {
- label: "妫�娴嬬粨鏋�",
- prop: "checkResult",
- dataType: "tag",
- formatType: (params) => {
- if (params == '涓嶅悎鏍�') {
- return "danger";
- } else if (params == '鍚堟牸') {
- return "success";
- } else {
- return null;
- }
+ const data = reactive({
+ searchForm: {
+ process: "",
+ productName: "",
+ entryDate: undefined, // 褰曞叆鏃ユ湡
+ entryDateStart: undefined,
+ entryDateEnd: undefined,
},
- },
- {
- label: "鎻愪氦鐘舵��",
- prop: "inspectState",
- formatData: (params) => {
- if (params) {
- return "宸叉彁浜�";
- } else {
- return "鏈彁浜�";
- }
- },
- },
- {
- dataType: "action",
- label: "鎿嶄綔",
- align: "center",
- fixed: "right",
- width: 280,
- operation: [
- {
- name: "妫�楠�",
- type: "text",
- clickFun: (row) => {
- openQuickCheck(row);
- },
- disabled: (row) => {
- // 宸叉彁浜ゅ垯绂佺敤
- if (row.inspectState == 1) return true;
- // 濡傛灉妫�楠屽憳鏈夊�硷紝鍙湁褰撳墠鐧诲綍鐢ㄦ埛鑳界紪杈�
- if (row.checkName) {
- return row.checkName !== userStore.nickName;
- }
- return false;
- }
+ rules: {
+ checkName: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
+ },
+ });
+ const { searchForm } = toRefs(data);
+ const tableColumn = ref([
+ {
+ label: "妫�娴嬫棩鏈�",
+ prop: "checkTime",
+ width: 120,
+ },
+ {
+ label: "鐢熶骇宸ュ崟鍙�",
+ prop: "workOrderNo",
+ width: 120,
+ },
+ {
+ label: "宸ュ簭",
+ prop: "process",
+ width: 230,
+ },
+ {
+ label: "妫�楠屽憳",
+ prop: "checkName",
+ },
+ {
+ label: "浜у搧鍚嶇О",
+ prop: "productName",
+ },
+ {
+ label: "瑙勬牸鍨嬪彿",
+ prop: "model",
+ },
+ {
+ label: "鍗曚綅",
+ prop: "unit",
+ },
+ {
+ label: "鏁伴噺",
+ prop: "quantity",
+ width: 100,
+ },
+ {
+ label: "妫�娴嬪崟浣�",
+ prop: "checkCompany",
+ width: 120,
+ },
+ {
+ label: "妫�娴嬬粨鏋�",
+ prop: "checkResult",
+ dataType: "tag",
+ formatType: params => {
+ if (params == "涓嶅悎鏍�") {
+ return "danger";
+ } else if (params == "鍚堟牸") {
+ return "success";
+ } else {
+ return null;
+ }
},
- {
- name: "闄勪欢",
- type: "text",
- clickFun: (row) => {
- openFilesFormDia(row);
- },
+ },
+ {
+ label: "鎻愪氦鐘舵��",
+ prop: "inspectState",
+ formatData: params => {
+ if (params) {
+ return "宸叉彁浜�";
+ } else {
+ return "鏈彁浜�";
+ }
},
- {
- name: "鎻愪氦",
- type: "text",
- clickFun: (row) => {
- submit(row.id);
- },
- disabled: (row) => {
- // 宸叉彁浜ゅ垯绂佺敤
- if (row.inspectState == 1) return true;
- // 濡傛灉妫�楠屽憳鏈夊�硷紝鍙湁褰撳墠鐧诲綍鐢ㄦ埛鑳芥彁浜�
- if (row.checkName) {
- return row.checkName !== userStore.nickName;
- }
- return false;
- }
- },
- {
- name: "鍒嗛厤妫�楠屽憳",
- type: "text",
- clickFun: (row) => {
- if (!row.checkName) {
- open(row)
- } else {
- proxy.$modal.msgError("妫�楠屽憳宸插瓨鍦�");
- }
- },
- disabled: (row) => {
- return row.inspectState == 1 || row.checkName;
- }
- },
- {
- name: "涓嬭浇",
- type: "text",
- clickFun: (row) => {
- downLoadFile(row);
- },
- },
- ],
- },
-]);
-const tableData = ref([]);
-const selectedRows = ref([]);
-const tableLoading = ref(false);
-const currentRow = ref(null)
-const page = reactive({
- current: 1,
- size: 100,
- total: 0
-});
-const formDia = ref()
-const filesDia = ref()
-const inspectionFormDia = ref()
-const { proxy } = getCurrentInstance()
-const userStore = useUserStore()
-const userList = ref([]);
-const form = ref({
- checkName: ""
-});
-const dialogFormVisible = ref(false);
-const quickCheckVisible = ref(false);
-const quickCheckForm = ref({
- checkResult: "鍚堟牸",
- checkName: "",
- checkTime: "",
- testStandardId: "",
- checkCompany: "澶╂触闃冲厜褰╁嵃鑲′唤鏈夐檺鍏徃"
-});
-const quickCheckRef = ref(null);
-const testStandardOptions = ref([]); // 鎸囨爣閫夋嫨涓嬫媺妗嗘暟鎹�
-const quickCheckTableColumn = ref([
- {
- label: "鎸囨爣",
- prop: "parameterItem",
- },
- {
- label: "鍗曚綅",
- prop: "unit",
- },
- {
- label: "鏍囧噯鍊�",
- prop: "standardValue",
- },
- {
- label: "鍐呮帶鍊�",
- prop: "controlValue",
- },
- {
- label: "妫�楠屽��",
- prop: "testValue",
- dataType: 'slot',
- slot: 'slot',
- },
-]);
-const quickCheckTableData = ref([]);
-const quickCheckTableLoading = ref(false);
+ },
+ {
+ dataType: "action",
+ label: "鎿嶄綔",
+ align: "center",
+ fixed: "right",
+ width: 280,
+ operation: [
+ {
+ name: "妫�楠�",
+ type: "text",
+ clickFun: row => {
+ openQuickCheck(row);
+ },
+ disabled: row => {
+ // 宸叉彁浜ゅ垯绂佺敤
+ if (row.inspectState == 1) return true;
+ // 濡傛灉妫�楠屽憳鏈夊�硷紝鍙湁褰撳墠鐧诲綍鐢ㄦ埛鑳界紪杈�
+ if (row.checkName) {
+ return row.checkName !== userStore.nickName;
+ }
+ return false;
+ },
+ },
+ {
+ name: "闄勪欢",
+ type: "text",
+ clickFun: row => {
+ openFilesFormDia(row);
+ },
+ },
+ {
+ name: "鎻愪氦",
+ type: "text",
+ clickFun: row => {
+ submit(row.id);
+ },
+ disabled: row => {
+ // 宸叉彁浜ゅ垯绂佺敤
+ if (row.inspectState == 1) return true;
+ // 濡傛灉妫�楠屽憳鏈夊�硷紝鍙湁褰撳墠鐧诲綍鐢ㄦ埛鑳芥彁浜�
+ if (row.checkName) {
+ return row.checkName !== userStore.nickName;
+ }
+ return false;
+ },
+ },
+ {
+ name: "鍒嗛厤妫�楠屽憳",
+ type: "text",
+ clickFun: row => {
+ if (!row.checkName) {
+ open(row);
+ } else {
+ proxy.$modal.msgError("妫�楠屽憳宸插瓨鍦�");
+ }
+ },
+ disabled: row => {
+ return row.inspectState == 1 || row.checkName;
+ },
+ },
+ {
+ name: "涓嬭浇",
+ type: "text",
+ clickFun: row => {
+ downLoadFile(row);
+ },
+ },
+ ],
+ },
+ ]);
+ const tableData = ref([]);
+ const selectedRows = ref([]);
+ const tableLoading = ref(false);
+ const currentRow = ref(null);
+ const page = reactive({
+ current: 1,
+ size: 100,
+ total: 0,
+ });
+ const formDia = ref();
+ const filesDia = ref();
+ const inspectionFormDia = ref();
+ const { proxy } = getCurrentInstance();
+ const userStore = useUserStore();
+ const userList = ref([]);
+ const form = ref({
+ checkName: "",
+ });
+ const dialogFormVisible = ref(false);
+ const quickCheckVisible = ref(false);
+ const quickCheckForm = ref({
+ checkResult: "鍚堟牸",
+ checkName: "",
+ checkTime: "",
+ testStandardId: "",
+ checkCompany: "",
+ });
+ const quickCheckRef = ref(null);
+ const testStandardOptions = ref([]); // 鎸囨爣閫夋嫨涓嬫媺妗嗘暟鎹�
+ const quickCheckTableColumn = ref([
+ {
+ label: "鎸囨爣",
+ prop: "parameterItem",
+ },
+ {
+ label: "鍗曚綅",
+ prop: "unit",
+ },
+ {
+ label: "鏍囧噯鍊�",
+ prop: "standardValue",
+ },
+ {
+ label: "鍐呮帶鍊�",
+ prop: "controlValue",
+ },
+ {
+ label: "妫�楠屽��",
+ prop: "testValue",
+ dataType: "slot",
+ slot: "slot",
+ },
+ ]);
+ const quickCheckTableData = ref([]);
+ const quickCheckTableLoading = ref(false);
-const changeDaterange = (value) => {
- searchForm.value.entryDateStart = undefined;
- searchForm.value.entryDateEnd = undefined;
- if (value) {
- searchForm.value.entryDateStart = dayjs(value[0]).format("YYYY-MM-DD");
- searchForm.value.entryDateEnd = dayjs(value[1]).format("YYYY-MM-DD");
- }
- getList();
-};
-// 鏌ヨ鍒楄〃
-/** 鎼滅储鎸夐挳鎿嶄綔 */
-const handleQuery = () => {
- page.current = 1;
- getList();
-};
-const pagination = (obj) => {
- page.current = obj.page;
- page.size = obj.limit;
- getList();
-};
-const getList = () => {
- tableLoading.value = true;
- const params = { ...searchForm.value, ...page };
- params.entryDate = undefined
- qualityInspectListPage({...params, inspectType: 2}).then(res => {
- tableLoading.value = false;
- tableData.value = res.data.records
- page.total = res.data.total;
- }).catch(err => {
- tableLoading.value = false;
- })
-};
-// 琛ㄦ牸閫夋嫨鏁版嵁
-const handleSelectionChange = (selection) => {
- selectedRows.value = selection;
-};
+ const changeDaterange = value => {
+ searchForm.value.entryDateStart = undefined;
+ searchForm.value.entryDateEnd = undefined;
+ if (value) {
+ searchForm.value.entryDateStart = dayjs(value[0]).format("YYYY-MM-DD");
+ searchForm.value.entryDateEnd = dayjs(value[1]).format("YYYY-MM-DD");
+ }
+ getList();
+ };
+ // 鏌ヨ鍒楄〃
+ /** 鎼滅储鎸夐挳鎿嶄綔 */
+ const handleQuery = () => {
+ page.current = 1;
+ getList();
+ };
+ const pagination = obj => {
+ page.current = obj.page;
+ page.size = obj.limit;
+ getList();
+ };
+ const getList = () => {
+ tableLoading.value = true;
+ const params = { ...searchForm.value, ...page };
+ params.entryDate = undefined;
+ qualityInspectListPage({ ...params, inspectType: 2 })
+ .then(res => {
+ tableLoading.value = false;
+ tableData.value = res.data.records;
+ page.total = res.data.total;
+ })
+ .catch(err => {
+ tableLoading.value = false;
+ });
+ };
+ // 琛ㄦ牸閫夋嫨鏁版嵁
+ const handleSelectionChange = selection => {
+ selectedRows.value = selection;
+ };
-// 鎵撳紑寮规
-const openForm = (type, row) => {
- nextTick(() => {
- formDia.value?.openDialog(type, row)
- })
-};
-// 鎵撳紑鏂板妫�楠屽脊妗�
-const openInspectionForm = (type, row) => {
- nextTick(() => {
- inspectionFormDia.value?.openDialog(type, row)
- })
-};
-// 鎵撳紑闄勪欢寮规
-const openFilesFormDia = (type, row) => {
- nextTick(() => {
- filesDia.value?.openDialog(type, row)
- })
-};
+ // 鎵撳紑寮规
+ const openForm = (type, row) => {
+ nextTick(() => {
+ formDia.value?.openDialog(type, row);
+ });
+ };
+ // 鎵撳紑鏂板妫�楠屽脊妗�
+ const openInspectionForm = (type, row) => {
+ nextTick(() => {
+ inspectionFormDia.value?.openDialog(type, row);
+ });
+ };
+ // 鎵撳紑闄勪欢寮规
+ const openFilesFormDia = (type, row) => {
+ nextTick(() => {
+ filesDia.value?.openDialog(type, row);
+ });
+ };
-// 鍒犻櫎
-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",
- })
+ // 鍒犻櫎
+ 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(() => {
- qualityInspectDel(ids).then((res) => {
+ qualityInspectDel(ids).then(res => {
proxy.$modal.msgSuccess("鍒犻櫎鎴愬姛");
getList();
});
@@ -441,258 +502,276 @@
.catch(() => {
proxy.$modal.msg("宸插彇娑�");
});
-};
-// 瀵煎嚭
-const handleOut = () => {
- // 鍒ゆ柇鏄惁鏈夐�変腑鏁版嵁
- const hasSelected = selectedRows.value.length > 0;
+ };
+ // 瀵煎嚭
+ const handleOut = () => {
+ // 鍒ゆ柇鏄惁鏈夐�変腑鏁版嵁
+ const hasSelected = selectedRows.value.length > 0;
- const confirmMsg = hasSelected
- ? "閫変腑鐨勫唴瀹瑰皢琚鍑猴紝鏄惁纭瀵煎嚭锛�"
- : "灏嗗鍑哄叏閮ㄦ暟鎹紝鏄惁纭瀵煎嚭锛�";
+ const confirmMsg = hasSelected
+ ? "閫変腑鐨勫唴瀹瑰皢琚鍑猴紝鏄惁纭瀵煎嚭锛�"
+ : "灏嗗鍑哄叏閮ㄦ暟鎹紝鏄惁纭瀵煎嚭锛�";
- ElMessageBox.confirm(confirmMsg, "瀵煎嚭", {
- confirmButtonText: "纭",
- cancelButtonText: "鍙栨秷",
- type: "warning",
- })
- .then(() => {
- // 鏋勫缓瀵煎嚭鍙傛暟
- const exportData = {
- inspectType: 2,
- productName: searchForm.value.productName || "",
- entryDateStart: searchForm.value.entryDateStart || "",
- entryDateEnd: searchForm.value.entryDateEnd || "",
- };
+ ElMessageBox.confirm(confirmMsg, "瀵煎嚭", {
+ confirmButtonText: "纭",
+ cancelButtonText: "鍙栨秷",
+ type: "warning",
+ })
+ .then(() => {
+ // 鏋勫缓瀵煎嚭鍙傛暟
+ const exportData = {
+ inspectType: 2,
+ process: searchForm.value.process || "",
+ productName: searchForm.value.productName || "",
+ entryDateStart: searchForm.value.entryDateStart || "",
+ entryDateEnd: searchForm.value.entryDateEnd || "",
+ };
- // 濡傛灉鏈夐�変腑鏁版嵁锛屾坊鍔爄ds
- if (hasSelected) {
- exportData.ids = selectedRows.value.map(item => item.id);
- }
+ // 濡傛灉鏈夐�変腑鏁版嵁锛屾坊鍔爄ds
+ if (hasSelected) {
+ exportData.ids = selectedRows.value.map(item => item.id);
+ }
- // 璋冪敤鏂板鍑烘帴鍙�
- qualityInspectExportNew(exportData).then((blobData) => {
- const blob = new Blob([blobData], {
- type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
- });
- const downloadUrl = window.URL.createObjectURL(blob);
- const link = document.createElement('a');
- link.href = downloadUrl;
- link.download = '鍑哄巶妫�楠�.xlsx';
- document.body.appendChild(link);
- link.click();
- document.body.removeChild(link);
- window.URL.revokeObjectURL(downloadUrl);
- }).catch((error) => {
- proxy.$modal.msgError("瀵煎嚭澶辫触");
- });
- })
- .catch(() => {
- proxy.$modal.msg("宸插彇娑�");
- });
-};
+ // 璋冪敤鏂板鍑烘帴鍙�
+ qualityInspectExportNew(exportData)
+ .then(blobData => {
+ const blob = new Blob([blobData], {
+ type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
+ });
+ const downloadUrl = window.URL.createObjectURL(blob);
+ const link = document.createElement("a");
+ link.href = downloadUrl;
+ link.download = "鍑哄巶妫�楠�.xlsx";
+ document.body.appendChild(link);
+ link.click();
+ document.body.removeChild(link);
+ window.URL.revokeObjectURL(downloadUrl);
+ })
+ .catch(error => {
+ proxy.$modal.msgError("瀵煎嚭澶辫触");
+ });
+ })
+ .catch(() => {
+ proxy.$modal.msg("宸插彇娑�");
+ });
+ };
-// 鎻愪环
-const submit = async (id) => {
- const res = await submitQualityInspect({id: id})
- if (res.code === 200) {
- proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
- getList();
- }
-}
+ // 鎻愪环
+ const submit = async id => {
+ const res = await submitQualityInspect({ id: id });
+ if (res.code === 200) {
+ proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
+ getList();
+ }
+ };
-// 鍏抽棴寮规
-const closeDia = () => {
- proxy.resetForm("formRef");
- dialogFormVisible.value = false;
-};
+ // 鍏抽棴寮规
+ const closeDia = () => {
+ proxy.resetForm("formRef");
+ dialogFormVisible.value = false;
+ };
-const submitForm = () => {
- if (currentRow.value) {
- const data = {
- ...form.value,
- id: currentRow.value.id
- }
- qualityInspectUpdate(data).then(res => {
- proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
- closeDia();
- getList();
- })
- }
-};
+ const submitForm = () => {
+ if (currentRow.value) {
+ const data = {
+ ...form.value,
+ id: currentRow.value.id,
+ };
+ qualityInspectUpdate(data).then(res => {
+ proxy.$modal.msgSuccess("鎻愪氦鎴愬姛");
+ closeDia();
+ getList();
+ });
+ }
+ };
-const open = async (row) => {
- let userLists = await userListNoPage();
- // 绛涢�� roleIds 鍖呭惈 106 鐨勭敤鎴�
- userList.value = (userLists.data || []).filter(user => {
- const roleIds = user.roleIds || [];
- return roleIds.includes(106) || roleIds.includes('106');
- });
- currentRow.value = row
- dialogFormVisible.value = true
-}
+ const open = async row => {
+ let userLists = await userListNoPage();
+ // 绛涢�� roleIds 鍖呭惈 106 鐨勭敤鎴�
+ userList.value = (userLists.data || []).filter(user => {
+ const roleIds = user.roleIds || [];
+ return roleIds.includes(106) || roleIds.includes("106");
+ });
+ currentRow.value = row;
+ dialogFormVisible.value = true;
+ };
-const downLoadFile = (row) => {
- downloadQualityInspect({ id: row.id }).then((blobData) => {
- const blob = new Blob([blobData], {
- type: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
- })
- const downloadUrl = window.URL.createObjectURL(blob)
+ const downLoadFile = row => {
+ downloadQualityInspect({ id: row.id }).then(blobData => {
+ const blob = new Blob([blobData], {
+ type: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
+ });
+ const downloadUrl = window.URL.createObjectURL(blob);
- const link = document.createElement('a')
- link.href = downloadUrl
- link.download = '鍑哄巶妫�楠屾姤鍛�.docx'
- document.body.appendChild(link)
- link.click()
+ const link = document.createElement("a");
+ link.href = downloadUrl;
+ link.download = "鍑哄巶妫�楠屾姤鍛�.docx";
+ document.body.appendChild(link);
+ link.click();
- document.body.removeChild(link)
- window.URL.revokeObjectURL(downloadUrl)
- })
-};
+ document.body.removeChild(link);
+ window.URL.revokeObjectURL(downloadUrl);
+ });
+ };
-// 鎵撳紑妫�楠岀粨鏋滈�夋嫨瀵硅瘽妗�
-const openQuickCheck = async (row) => {
- // 鍏堣皟鐢ㄨ鎯呮帴鍙h幏鍙栧畬鏁存暟鎹紙鍖呭惈鎸囨爣鍜屾楠屽�硷級
- let detailData = row;
- try {
- const detailRes = await qualityInspectDetail(row.id);
- if (detailRes.code === 200 && detailRes.data) {
- detailData = detailRes.data;
- }
- } catch (e) {
- console.error("鑾峰彇妫�楠岃鎯呭け璐�", e);
- }
- currentRow.value = detailData;
+ // 鎵撳紑妫�楠岀粨鏋滈�夋嫨瀵硅瘽妗�
+ const openQuickCheck = async row => {
+ // 鍏堣皟鐢ㄨ鎯呮帴鍙h幏鍙栧畬鏁存暟鎹紙鍖呭惈鎸囨爣鍜屾楠屽�硷級
+ let detailData = row;
+ try {
+ const detailRes = await qualityInspectDetail(row.id);
+ if (detailRes.code === 200 && detailRes.data) {
+ detailData = detailRes.data;
+ }
+ } catch (e) {
+ console.error("鑾峰彇妫�楠岃鎯呭け璐�", e);
+ }
+ currentRow.value = detailData;
- // 鍔犺浇鐢ㄦ埛鍒楄〃锛岀瓫閫� roleIds 鍖呭惈 106 鐨勭敤鎴�
- try {
- const userLists = await userListNoPage();
- userList.value = (userLists.data || []).filter(user => {
- const roleIds = user.roleIds || [];
- return roleIds.includes(106) || roleIds.includes('106');
- });
- } catch (e) {
- console.error("鍔犺浇妫�楠屽憳鍒楄〃澶辫触", e);
- userList.value = [];
- }
- // 鍔犺浇鎸囨爣閫夐」锛堟牴鎹骇鍝両D锛�
- if (detailData.productId) {
- try {
- const params = {
- productId: detailData.productId,
- inspectType: 2
- };
- const res = await qualityInspectDetailByProductId(params);
- testStandardOptions.value = res.data || [];
- } catch (e) {
- console.error("鍔犺浇鎸囨爣閫夐」澶辫触", e);
- testStandardOptions.value = [];
- }
- } else {
- testStandardOptions.value = [];
- }
- // 璁剧疆榛樿鍊硷紙浼樺厛浣跨敤璇︽儏鏁版嵁锛屾楠屽憳榛樿涓哄綋鍓嶇櫥褰曠敤鎴凤級
- quickCheckForm.value = {
- checkResult: detailData.checkResult || "鍚堟牸",
- checkName: detailData.checkName || userStore.nickName || "",
- checkTime: detailData.checkTime || dayjs().format("YYYY-MM-DD"),
- testStandardId: detailData.testStandardId || "",
- checkCompany: detailData.checkCompany || "澶╂触闃冲厜褰╁嵃鑲′唤鏈夐檺鍏徃"
- };
- // 濡傛灉鏈夋楠屽弬鏁版暟鎹紝鍥炴樉鍒拌〃鏍�
- if (detailData.qualityInspectParams && detailData.qualityInspectParams.length > 0) {
- quickCheckTableData.value = detailData.qualityInspectParams;
- } else {
- quickCheckTableData.value = [];
- }
- quickCheckVisible.value = true;
-};
+ // 鍔犺浇鐢ㄦ埛鍒楄〃锛岀瓫閫� roleIds 鍖呭惈 106 鐨勭敤鎴�
+ try {
+ const userLists = await userListNoPage();
+ userList.value = (userLists.data || []).filter(user => {
+ const roleIds = user.roleIds || [];
+ return roleIds.includes(106) || roleIds.includes("106");
+ });
+ } catch (e) {
+ console.error("鍔犺浇妫�楠屽憳鍒楄〃澶辫触", e);
+ userList.value = [];
+ }
+ // 鍔犺浇鎸囨爣閫夐」锛堟牴鎹骇鍝両D锛�
+ if (detailData.productId) {
+ try {
+ const params = {
+ productId: detailData.productId,
+ inspectType: 2,
+ process: detailData.process || "",
+ };
+ const res = await qualityInspectDetailByProductId(params);
+ testStandardOptions.value = res.data || [];
+ } catch (e) {
+ console.error("鍔犺浇鎸囨爣閫夐」澶辫触", e);
+ testStandardOptions.value = [];
+ }
+ } else {
+ testStandardOptions.value = [];
+ }
+ // 璁剧疆榛樿鍊硷紙浼樺厛浣跨敤璇︽儏鏁版嵁锛屾楠屽憳榛樿涓哄綋鍓嶇櫥褰曠敤鎴凤級
+ quickCheckForm.value = {
+ checkResult: detailData.checkResult || "鍚堟牸",
+ checkName: detailData.checkName || userStore.nickName || "",
+ checkTime: detailData.checkTime || dayjs().format("YYYY-MM-DD"),
+ testStandardId: detailData.testStandardId || "",
+ checkCompany: detailData.checkCompany || "",
+ };
+ // 濡傛灉鏈夋楠屽弬鏁版暟鎹紝鍥炴樉鍒拌〃鏍�
+ if (
+ detailData.qualityInspectParams &&
+ detailData.qualityInspectParams.length > 0
+ ) {
+ quickCheckTableData.value = detailData.qualityInspectParams;
+ } else {
+ quickCheckTableData.value = [];
+ }
+ quickCheckVisible.value = true;
+ };
-// 鎸囨爣閫夋嫨鍙樺寲澶勭悊
-const handleTestStandardChange = (testStandardId) => {
- if (!testStandardId) {
+ // 鎸囨爣閫夋嫨鍙樺寲澶勭悊
+ const handleTestStandardChange = testStandardId => {
+ if (!testStandardId) {
+ quickCheckTableData.value = [];
+ return;
+ }
+ quickCheckTableLoading.value = true;
+ getQualityTestStandardParamByTestStandardId(testStandardId)
+ .then(res => {
+ quickCheckTableData.value = res.data || [];
+ })
+ .catch(error => {
+ console.error("鑾峰彇鏍囧噯鍙傛暟澶辫触:", error);
+ quickCheckTableData.value = [];
+ })
+ .finally(() => {
+ quickCheckTableLoading.value = false;
+ });
+ };
+
+ // 鍏抽棴妫�楠岀粨鏋滈�夋嫨瀵硅瘽妗�
+ const closeQuickCheck = () => {
+ quickCheckVisible.value = false;
+ quickCheckForm.value = {
+ checkResult: "鍚堟牸",
+ checkName: "",
+ checkTime: "",
+ testStandardId: "",
+ checkCompany: "",
+ };
quickCheckTableData.value = [];
- return;
- }
- quickCheckTableLoading.value = true;
- getQualityTestStandardParamByTestStandardId(testStandardId).then(res => {
- quickCheckTableData.value = res.data || [];
- }).catch(error => {
- console.error('鑾峰彇鏍囧噯鍙傛暟澶辫触:', error);
- quickCheckTableData.value = [];
- }).finally(() => {
- quickCheckTableLoading.value = false;
+ testStandardOptions.value = [];
+ };
+
+ // 纭妫�楠岀粨鏋�
+ const handleQuickCheckConfirm = () => {
+ if (!quickCheckForm.value.checkResult) {
+ proxy.$modal.msgWarning("璇烽�夋嫨妫�娴嬬粨鏋�");
+ return;
+ }
+ if (!quickCheckForm.value.checkName) {
+ proxy.$modal.msgWarning("璇烽�夋嫨妫�楠屽憳");
+ return;
+ }
+ if (!quickCheckForm.value.checkTime) {
+ proxy.$modal.msgWarning("璇烽�夋嫨妫�娴嬫棩鏈�");
+ return;
+ }
+
+ const checkNameToPass = quickCheckForm.value.checkName;
+ const checkResultToPass = quickCheckForm.value.checkResult;
+ const checkTimeToPass = quickCheckForm.value.checkTime;
+ const testStandardIdToPass = quickCheckForm.value.testStandardId;
+ const checkCompanyToPass = quickCheckForm.value.checkCompany;
+ const qualityInspectParamsToPass = [...quickCheckTableData.value];
+
+ if (quickCheckForm.value.checkResult === "鍚堟牸") {
+ // 鍚堟牸锛氱洿鎺ユ彁浜�
+ const data = {
+ id: currentRow.value.id,
+ checkResult: "鍚堟牸",
+ checkName: checkNameToPass,
+ checkTime: checkTimeToPass,
+ testStandardId: testStandardIdToPass,
+ checkCompany: checkCompanyToPass,
+ inspectType: 2,
+ qualityInspectParams: qualityInspectParamsToPass,
+ };
+ qualityInspectUpdate(data).then(res => {
+ proxy.$modal.msgSuccess("妫�楠屾垚鍔�");
+ closeQuickCheck();
+ getList();
+ });
+ } else {
+ // 涓嶅悎鏍硷細鎵撳紑璇︾粏濉啓椤甸潰
+ closeQuickCheck();
+ nextTick(() => {
+ currentRow.value.checkTime = checkTimeToPass;
+ currentRow.value.checkCompany = checkCompanyToPass;
+ currentRow.value.testStandardId = testStandardIdToPass;
+ formDia.value?.openDialog(
+ "edit",
+ currentRow.value,
+ checkResultToPass,
+ checkNameToPass,
+ testStandardIdToPass,
+ checkCompanyToPass,
+ qualityInspectParamsToPass
+ );
+ });
+ }
+ };
+
+ onMounted(() => {
+ getList();
});
-};
-
-// 鍏抽棴妫�楠岀粨鏋滈�夋嫨瀵硅瘽妗�
-const closeQuickCheck = () => {
- quickCheckVisible.value = false;
- quickCheckForm.value = {
- checkResult: "鍚堟牸",
- checkName: "",
- checkTime: "",
- testStandardId: "",
- checkCompany: "澶╂触闃冲厜褰╁嵃鑲′唤鏈夐檺鍏徃"
- };
- quickCheckTableData.value = [];
- testStandardOptions.value = [];
-};
-
-// 纭妫�楠岀粨鏋�
-const handleQuickCheckConfirm = () => {
- if (!quickCheckForm.value.checkResult) {
- proxy.$modal.msgWarning("璇烽�夋嫨妫�娴嬬粨鏋�");
- return;
- }
- if (!quickCheckForm.value.checkName) {
- proxy.$modal.msgWarning("璇烽�夋嫨妫�楠屽憳");
- return;
- }
- if (!quickCheckForm.value.checkTime) {
- proxy.$modal.msgWarning("璇烽�夋嫨妫�娴嬫棩鏈�");
- return;
- }
-
- const checkNameToPass = quickCheckForm.value.checkName;
- const checkResultToPass = quickCheckForm.value.checkResult;
- const checkTimeToPass = quickCheckForm.value.checkTime;
- const testStandardIdToPass = quickCheckForm.value.testStandardId;
- const checkCompanyToPass = quickCheckForm.value.checkCompany;
- const qualityInspectParamsToPass = [...quickCheckTableData.value];
-
- if (quickCheckForm.value.checkResult === "鍚堟牸") {
- // 鍚堟牸锛氱洿鎺ユ彁浜�
- const data = {
- id: currentRow.value.id,
- checkResult: "鍚堟牸",
- checkName: checkNameToPass,
- checkTime: checkTimeToPass,
- testStandardId: testStandardIdToPass,
- checkCompany: checkCompanyToPass,
- inspectType: 2,
- qualityInspectParams: qualityInspectParamsToPass
- };
- qualityInspectUpdate(data).then(res => {
- proxy.$modal.msgSuccess("妫�楠屾垚鍔�");
- closeQuickCheck();
- getList();
- });
- } else {
- // 涓嶅悎鏍硷細鎵撳紑璇︾粏濉啓椤甸潰
- closeQuickCheck();
- nextTick(() => {
- currentRow.value.checkTime = checkTimeToPass;
- currentRow.value.checkCompany = checkCompanyToPass;
- currentRow.value.testStandardId = testStandardIdToPass;
- formDia.value?.openDialog("edit", currentRow.value, checkResultToPass, checkNameToPass, testStandardIdToPass, checkCompanyToPass, qualityInspectParamsToPass);
- });
- }
-};
-
-onMounted(() => {
- getList();
-});
</script>
<style scoped></style>
diff --git a/src/views/qualityManagement/metricBinding/index.vue b/src/views/qualityManagement/metricBinding/index.vue
index 0509961..c207349 100644
--- a/src/views/qualityManagement/metricBinding/index.vue
+++ b/src/views/qualityManagement/metricBinding/index.vue
@@ -1,138 +1,205 @@
<template>
<div class="app-container metric-binding">
- <el-tabs v-model="activeTab" @tab-change="handleTabChange" class="metric-tabs">
- <el-tab-pane label="鍘熸潗鏂欐楠�" name="0" />
- <el-tab-pane label="杩囩▼妫�楠�" name="1" />
- <el-tab-pane label="鍑哄巶妫�楠�" name="2" />
+ <el-tabs v-model="activeTab"
+ @tab-change="handleTabChange"
+ class="metric-tabs">
+ <el-tab-pane label="鍘熸潗鏂欐楠�"
+ name="0" />
+ <el-tab-pane label="杩囩▼妫�楠�"
+ name="1" />
+ <el-tab-pane label="鍑哄巶妫�楠�"
+ name="2" />
</el-tabs>
- <el-row :gutter="16" class="metric-binding-row">
+ <el-row :gutter="16"
+ class="metric-binding-row">
<!-- 宸︿晶锛氭娴嬫爣鍑嗗垪琛� -->
- <el-col :xs="24" :sm="24" :md="12" :lg="14" :xl="14" class="left-col">
+ <el-col :xs="24"
+ :sm="24"
+ :md="12"
+ :lg="14"
+ :xl="14"
+ class="left-col">
<div class="panel left-panel">
- <PIMTable
- rowKey="id"
- :column="standardColumns"
- :tableData="standardTableData"
- :page="page"
- :isSelection="false"
- :rowClassName="rowClassNameCenter"
- :tableLoading="tableLoading"
- :rowClick="handleTableRowClick"
- @pagination="handlePagination"
- :total="page.total"
- >
- <template #standardNoCell="{ row }">
- <span class="clickable-link" @click="handleStandardRowClick(row)">
- {{ row.standardNo }}
- </span>
- </template>
-
- <!-- 琛ㄥご鎼滅储 -->
- <template #standardNoHeader>
- <el-input
- v-model="searchForm.standardNo"
- placeholder="鏍囧噯缂栧彿"
- clearable
- size="small"
- @change="handleQuery"
- @clear="handleQuery"
- />
- </template>
- <template #standardNameHeader>
- <el-input
- v-model="searchForm.standardName"
- placeholder="鏍囧噯鍚嶇О"
- clearable
- size="small"
- @change="handleQuery"
- @clear="handleQuery"
- />
- </template>
- <template #stateHeader>
- <el-select
- v-model="searchForm.state"
- placeholder="鐘舵��"
- clearable
- size="small"
- style="width: 110px"
- @change="handleQuery"
- @clear="handleQuery"
- >
- <el-option label="鑽夌" value="0" />
- <el-option label="閫氳繃" value="1" />
- <el-option label="鎾ら攢" value="2" />
- </el-select>
- </template>
- </PIMTable>
+ <PIMTable rowKey="id"
+ :column="standardColumns"
+ :tableData="standardTableData"
+ :page="page"
+ :isSelection="false"
+ :rowClassName="rowClassNameCenter"
+ :tableLoading="tableLoading"
+ :rowClick="handleTableRowClick"
+ @pagination="handlePagination"
+ :total="page.total">
+ <template #standardNoCell="{ row }">
+ <span class="clickable-link"
+ @click="handleStandardRowClick(row)">
+ {{ row.standardNo }}
+ </span>
+ </template>
+ <!-- 琛ㄥご鎼滅储 -->
+ <template #standardNoHeader>
+ <el-input v-model="searchForm.standardNo"
+ placeholder="鏍囧噯缂栧彿"
+ clearable
+ size="small"
+ @change="handleQuery"
+ @clear="handleQuery" />
+ </template>
+ <template #standardNameHeader>
+ <el-input v-model="searchForm.standardName"
+ placeholder="鏍囧噯鍚嶇О"
+ clearable
+ size="small"
+ @change="handleQuery"
+ @clear="handleQuery" />
+ </template>
+ <template #stateHeader>
+ <el-select v-model="searchForm.state"
+ placeholder="鐘舵��"
+ clearable
+ size="small"
+ style="width: 110px"
+ @change="handleQuery"
+ @clear="handleQuery">
+ <el-option label="鑽夌"
+ value="0" />
+ <el-option label="閫氳繃"
+ value="1" />
+ <el-option label="鎾ら攢"
+ value="2" />
+ </el-select>
+ </template>
+ </PIMTable>
</div>
</el-col>
-
<!-- 鍙充晶锛氱粦瀹氬垪琛� -->
- <el-col :xs="24" :sm="24" :md="12" :lg="10" :xl="10" class="right-col">
+ <el-col :xs="24"
+ :sm="24"
+ :md="12"
+ :lg="10"
+ :xl="10"
+ class="right-col">
<div class="panel right-panel">
- <div class="right-header">
- <div class="title">缁戝畾鍏崇郴</div>
- <div class="desc" v-if="currentStandard">
- 褰撳墠妫�娴嬫爣鍑嗙紪鍙凤細<span class="link-text">{{ currentStandard.standardNo }}</span>
- </div>
- <div class="desc" v-else>璇烽�夋嫨宸︿晶妫�娴嬫爣鍑�</div>
- </div>
-
- <div class="right-toolbar">
- <el-button type="primary" :disabled="!currentStandard" @click="openBindingDialog">娣诲姞缁戝畾</el-button>
- <el-button type="danger" plain :disabled="!currentStandard" @click="handleBatchUnbind">鍒犻櫎</el-button>
- </div>
-
- <el-table
- v-loading="bindingLoading"
- :data="bindingTableData"
- border
- :row-class-name="() => 'row-center'"
- class="center-table"
- style="width: 100%"
- height="calc(100vh - 220px)"
- @selection-change="handleBindingSelectionChange"
- >
- <el-table-column type="selection" width="48" align="center" />
- <el-table-column type="index" label="搴忓彿" width="60" align="center" />
- <el-table-column prop="productName" label="浜у搧鍚嶇О" min-width="140" />
- <el-table-column label="鎿嶄綔" width="120" fixed="right" align="center">
- <template #default="{ row }">
- <el-button link type="danger" size="small" @click="handleUnbind(row)">鍒犻櫎</el-button>
- </template>
- </el-table-column>
- </el-table>
+ <div class="right-header">
+ <div class="title">缁戝畾鍏崇郴</div>
+ <div class="desc"
+ v-if="currentStandard">
+ 褰撳墠妫�娴嬫爣鍑嗙紪鍙凤細<span class="link-text">{{ currentStandard.standardNo }}</span>
+ </div>
+ <div class="desc"
+ v-else>璇烽�夋嫨宸︿晶妫�娴嬫爣鍑�</div>
+ </div>
+ <div class="right-toolbar">
+ <el-button type="primary"
+ :disabled="!currentStandard"
+ @click="openBindingDialog">娣诲姞缁戝畾</el-button>
+ <el-button v-if="activeTab === '1' || activeTab === '2'"
+ type="primary"
+ :disabled="!leftProcessOptions.length"
+ @click="openProcessBindingDialog">鎸夊伐搴忔壒閲忕粦瀹�</el-button>
+ <el-button type="danger"
+ plain
+ :disabled="!currentStandard"
+ @click="handleBatchUnbind">鍒犻櫎</el-button>
+ </div>
+ <el-table v-loading="bindingLoading"
+ :data="bindingTableData"
+ border
+ :row-class-name="() => 'row-center'"
+ class="center-table"
+ style="width: 100%"
+ height="calc(100vh - 220px)"
+ @selection-change="handleBindingSelectionChange">
+ <el-table-column type="selection"
+ width="48"
+ align="center" />
+ <el-table-column type="index"
+ label="搴忓彿"
+ width="60"
+ align="center" />
+ <el-table-column prop="productName"
+ label="浜у搧鍚嶇О"
+ min-width="140" />
+ <el-table-column label="鎿嶄綔"
+ width="120"
+ fixed="right"
+ align="center">
+ <template #default="{ row }">
+ <el-button link
+ type="danger"
+ size="small"
+ @click="handleUnbind(row)">鍒犻櫎</el-button>
+ </template>
+ </el-table-column>
+ </el-table>
</div>
</el-col>
</el-row>
-
<!-- 娣诲姞缁戝畾寮规 -->
- <el-dialog
- v-model="bindingDialogVisible"
- title="娣诲姞缁戝畾"
- width="520px"
- @close="closeBindingDialog"
- >
+ <el-dialog v-model="bindingDialogVisible"
+ title="娣诲姞缁戝畾"
+ width="520px"
+ @close="closeBindingDialog">
<el-form label-width="100px">
<el-form-item label="浜у搧">
- <el-tree-select
- v-model="selectedProductIds"
- multiple
- collapse-tags
- collapse-tags-tooltip
- placeholder="璇烽�夋嫨浜у搧锛堝彲澶氶�夛級"
- clearable
- check-strictly
- :data="productOptions"
- :render-after-expand="false"
- style="width: 100%"
- />
+ <el-tree-select v-model="selectedProductIds"
+ multiple
+ collapse-tags
+ collapse-tags-tooltip
+ placeholder="璇烽�夋嫨浜у搧锛堝彲澶氶�夛級"
+ clearable
+ check-strictly
+ :data="productOptions"
+ :render-after-expand="false"
+ style="width: 100%" />
</el-form-item>
</el-form>
<template #footer>
<span class="dialog-footer">
<el-button @click="closeBindingDialog">鍙栨秷</el-button>
- <el-button type="primary" @click="submitBinding">纭畾</el-button>
+ <el-button type="primary"
+ @click="submitBinding">纭畾</el-button>
+ </span>
+ </template>
+ </el-dialog>
+ <el-dialog v-model="processBindingDialogVisible"
+ title="鎸夊伐搴忔壒閲忕粦瀹�"
+ width="520px"
+ @close="closeProcessBindingDialog">
+ <el-form label-width="100px">
+ <el-form-item label="浜у搧">
+ <el-tree-select v-model="processBindingProductIds"
+ multiple
+ collapse-tags
+ collapse-tags-tooltip
+ placeholder="璇烽�夋嫨浜у搧锛堝彲澶氶�夛級"
+ clearable
+ check-strictly
+ :data="productOptions"
+ :render-after-expand="false"
+ style="width: 100%" />
+ </el-form-item>
+ <el-form-item label="宸ュ簭">
+ <el-select v-model="processBindingProcessIds"
+ multiple
+ filterable
+ clearable
+ collapse-tags
+ collapse-tags-tooltip
+ placeholder="璇烽�夋嫨宸ュ簭锛堝繀閫夛紝鍙閫夛級"
+ style="width: 100%">
+ <el-option v-for="item in leftProcessOptions"
+ :key="item.value"
+ :label="item.label"
+ :value="item.value" />
+ </el-select>
+ </el-form-item>
+ </el-form>
+ <template #footer>
+ <span class="dialog-footer">
+ <el-button @click="closeProcessBindingDialog">鍙栨秷</el-button>
+ <el-button type="primary"
+ @click="submitProcessBinding">纭畾</el-button>
</span>
</template>
</el-dialog>
@@ -140,410 +207,516 @@
</template>
<script setup>
-import { Search } from '@element-plus/icons-vue'
-import { ref, reactive, toRefs, onMounted, getCurrentInstance } from 'vue'
-import { ElMessageBox } from 'element-plus'
-import PIMTable from '@/components/PIMTable/PIMTable.vue'
-import { productTreeList } from '@/api/basicData/product.js'
-import {
- qualityTestStandardListPage
-} from '@/api/qualityManagement/metricMaintenance.js'
-import { productProcessListPage } from '@/api/basicData/productProcess.js'
-import {
- qualityTestStandardBindingList,
- qualityTestStandardBindingAdd,
- qualityTestStandardBindingDel
-} from '@/api/qualityManagement/qualityTestStandardBinding.js'
+ import { Search } from "@element-plus/icons-vue";
+ import {
+ ref,
+ reactive,
+ toRefs,
+ onMounted,
+ getCurrentInstance,
+ computed,
+ } from "vue";
+ import { ElMessageBox } from "element-plus";
+ import PIMTable from "@/components/PIMTable/PIMTable.vue";
+ import { productTreeList } from "@/api/basicData/product.js";
+ import { qualityTestStandardListPage } from "@/api/qualityManagement/metricMaintenance.js";
+ import { productProcessListPage } from "@/api/basicData/productProcess.js";
+ import {
+ qualityTestStandardBindingList,
+ qualityTestStandardBindingAdd,
+ qualityTestStandardBindingDel,
+ } from "@/api/qualityManagement/qualityTestStandardBinding.js";
-const { proxy } = getCurrentInstance()
+ const { proxy } = getCurrentInstance();
-// 绫诲埆 Tab锛�0=鍘熸潗鏂欙紝1=杩囩▼锛�2=鍑哄巶锛�
-const activeTab = ref('0')
+ // 绫诲埆 Tab锛�0=鍘熸潗鏂欙紝1=杩囩▼锛�2=鍑哄巶锛�
+ const activeTab = ref("0");
-// 宸︿晶鏍囧噯鍒楄〃锛氭暣琛屽唴瀹瑰眳涓紙閰嶅悎鏍峰紡锛�
-const rowClassNameCenter = () => 'row-center'
+ // 宸︿晶鏍囧噯鍒楄〃锛氭暣琛屽唴瀹瑰眳涓紙閰嶅悎鏍峰紡锛�
+ const rowClassNameCenter = () => "row-center";
-const data = reactive({
- searchForm: {
- standardNo: '',
- standardName: '',
- state: '',
- inspectType: ''
+ const data = reactive({
+ searchForm: {
+ standardNo: "",
+ standardName: "",
+ state: "",
+ inspectType: "",
+ },
+ });
+ const { searchForm } = toRefs(data);
+
+ // 宸︿晶
+ const standardTableData = ref([]);
+ const tableLoading = ref(false);
+ const page = reactive({ current: 1, size: 10, total: 0 });
+
+ // 宸ュ簭涓嬫媺锛堢敤浜庡垪琛ㄥ洖鏄撅級
+ const processOptions = ref([]);
+
+ const getProcessList = async () => {
+ try {
+ const res = await productProcessListPage({ current: 1, size: 1000 });
+ if (res?.code === 200) {
+ const records = res?.data?.records || [];
+ processOptions.value = records.map(item => ({
+ label: item.processName || item.name || item.label,
+ value: item.id || item.processId || item.value,
+ }));
+ }
+ } catch (error) {
+ console.error("鑾峰彇宸ュ簭鍒楄〃澶辫触:", error);
+ }
+ };
+
+ const standardColumns = ref([
+ {
+ label: "鏍囧噯缂栧彿",
+ prop: "standardNo",
+ dataType: "slot",
+ slot: "standardNoCell",
+ minWidth: 160,
+ align: "center",
+ headerSlot: "standardNoHeader",
+ },
+ {
+ label: "鏍囧噯鍚嶇О",
+ prop: "standardName",
+ minWidth: 180,
+ align: "center",
+ headerSlot: "standardNameHeader",
+ },
+ {
+ label: "绫诲埆",
+ prop: "inspectType",
+ align: "center",
+ dataType: "tag",
+ formatData: val => {
+ const map = { 0: "鍘熸潗鏂欐楠�", 1: "杩囩▼妫�楠�", 2: "鍑哄巶妫�楠�" };
+ return map[val] || val;
+ },
+ },
+ {
+ label: "宸ュ簭",
+ prop: "processId",
+ align: "center",
+ dataType: "tag",
+ formatData: val => {
+ const target = processOptions.value.find(
+ item => String(item.value) === String(val)
+ );
+ return target?.label || val;
+ },
+ },
+ {
+ label: "澶囨敞",
+ prop: "remark",
+ minWidth: 160,
+ align: "center",
+ },
+ // {
+ // label: '鐘舵��',
+ // prop: 'state',
+ // headerSlot: 'stateHeader',
+ // dataType: 'tag',
+ // formatData: (val) => {
+ // const map = { 0: '鑽夌', 1: '閫氳繃', 2: '鎾ら攢' }
+ // return map[val] || val
+ // },
+ // formatType: (val) => {
+ // if (val == 1) return 'success'
+ // if (val == 2) return 'warning'
+ // return 'info'
+ // }
+ // }
+ ]);
+
+ const handleTabChange = () => {
+ searchForm.value.standardNo = "";
+ searchForm.value.standardName = "";
+ searchForm.value.state = "";
+ searchForm.value.inspectType = activeTab.value;
+ page.current = 1;
+ currentStandard.value = null;
+ bindingTableData.value = [];
+ bindingSelectedRows.value = [];
+ bindingDialogVisible.value = false;
+ processBindingDialogVisible.value = false;
+ getStandardList();
+ };
+
+ const currentStandard = ref(null);
+
+ // 鍙充晶缁戝畾
+ const bindingTableData = ref([]);
+ const bindingLoading = ref(false);
+ const bindingSelectedRows = ref([]);
+ const bindingDialogVisible = ref(false);
+ const processBindingDialogVisible = ref(false);
+
+ // 浜у搧鏍戯紙鐢ㄤ簬缁戝畾閫夋嫨锛�
+ const productOptions = ref([]);
+ const selectedProductIds = ref([]);
+ const processBindingProductIds = ref([]);
+ const processBindingProcessIds = ref([]);
+ const leftProcessOptions = computed(() => {
+ const ids = new Set(
+ (standardTableData.value || [])
+ .map(i => i?.processId)
+ .filter(v => v !== null && v !== undefined && String(v) !== "")
+ .map(v => String(v))
+ );
+ if (!ids.size) return [];
+ return (processOptions.value || [])
+ .filter(p => ids.has(String(p.value)))
+ .sort((a, b) => String(a.label).localeCompare(String(b.label), "zh-CN"));
+ });
+
+ const getProductOptions = async () => {
+ // 閬垮厤閲嶅璇锋眰
+ if (productOptions.value?.length) return;
+ const res = await productTreeList();
+ productOptions.value = convertIdToValue(Array.isArray(res) ? res : []);
+ };
+
+ function convertIdToValue(data) {
+ return (data || []).map(item => {
+ const { id, children, ...rest } = item;
+ const newItem = {
+ ...rest,
+ value: id,
+ };
+ if (children && children.length > 0) {
+ newItem.children = convertIdToValue(children);
+ }
+ return newItem;
+ });
}
-})
-const { searchForm } = toRefs(data)
-// 宸︿晶
-const standardTableData = ref([])
-const tableLoading = ref(false)
-const page = reactive({ current: 1, size: 10, total: 0 })
+ const handleQuery = () => {
+ page.current = 1;
+ getStandardList();
+ };
-// 宸ュ簭涓嬫媺锛堢敤浜庡垪琛ㄥ洖鏄撅級
-const processOptions = ref([])
+ const handlePagination = obj => {
+ page.current = obj.page;
+ page.size = obj.limit;
+ getStandardList();
+ };
-const getProcessList = async () => {
- try {
- const res = await productProcessListPage({ current: 1, size: 1000 })
- if (res?.code === 200) {
- const records = res?.data?.records || []
- processOptions.value = records.map((item) => ({
- label: item.processName || item.name || item.label,
- value: item.id || item.processId || item.value
- }))
- }
- } catch (error) {
- console.error('鑾峰彇宸ュ簭鍒楄〃澶辫触:', error)
- }
-}
-
-const standardColumns = ref([
- { label: '鏍囧噯缂栧彿', prop: 'standardNo', dataType: 'slot', slot: 'standardNoCell', minWidth: 160, align: 'center', headerSlot: 'standardNoHeader' },
- { label: '鏍囧噯鍚嶇О', prop: 'standardName', minWidth: 180, align: 'center', headerSlot: 'standardNameHeader' },
- {
- label: '绫诲埆',
- prop: 'inspectType',
- align: 'center',
- dataType: 'tag',
- formatData: (val) => {
- const map = { 0: '鍘熸潗鏂欐楠�', 1: '杩囩▼妫�楠�', 2: '鍑哄巶妫�楠�' }
- return map[val] || val
- }
- },
- {
- label: '宸ュ簭',
- prop: 'processId',
- align: 'center',
- dataType: 'tag',
- formatData: (val) => {
- const target = processOptions.value.find(
- (item) => String(item.value) === String(val)
- )
- return target?.label || val
- }
- },
- {
- label: '澶囨敞',
- prop: 'remark',
- minWidth: 160,
- align: 'center'
- }
- // {
- // label: '鐘舵��',
- // prop: 'state',
- // headerSlot: 'stateHeader',
- // dataType: 'tag',
- // formatData: (val) => {
- // const map = { 0: '鑽夌', 1: '閫氳繃', 2: '鎾ら攢' }
- // return map[val] || val
- // },
- // formatType: (val) => {
- // if (val == 1) return 'success'
- // if (val == 2) return 'warning'
- // return 'info'
- // }
- // }
-])
-
-const handleTabChange = () => {
- searchForm.value.standardNo = ''
- searchForm.value.standardName = ''
- searchForm.value.state = ''
- searchForm.value.inspectType = activeTab.value
- page.current = 1
- currentStandard.value = null
- bindingTableData.value = []
- bindingSelectedRows.value = []
- getStandardList()
-}
-
-const currentStandard = ref(null)
-
-// 鍙充晶缁戝畾
-const bindingTableData = ref([])
-const bindingLoading = ref(false)
-const bindingSelectedRows = ref([])
-const bindingDialogVisible = ref(false)
-
-// 浜у搧鏍戯紙鐢ㄤ簬缁戝畾閫夋嫨锛�
-const productOptions = ref([])
-const selectedProductIds = ref([])
-
-const getProductOptions = async () => {
- // 閬垮厤閲嶅璇锋眰
- if (productOptions.value?.length) return
- const res = await productTreeList()
- productOptions.value = convertIdToValue(Array.isArray(res) ? res : [])
-}
-
-function convertIdToValue(data) {
- return (data || []).map((item) => {
- const { id, children, ...rest } = item
- const newItem = {
- ...rest,
- value: id
- }
- if (children && children.length > 0) {
- newItem.children = convertIdToValue(children)
- }
- return newItem
- })
-}
-
-const handleQuery = () => {
- page.current = 1
- getStandardList()
-}
-
-const handlePagination = (obj) => {
- page.current = obj.page
- page.size = obj.limit
- getStandardList()
-}
-
-const getStandardList = () => {
- tableLoading.value = true
- qualityTestStandardListPage({
- ...searchForm.value,
- current: page.current,
- size: page.size,
- state: 1
- })
- .then((res) => {
- const records = res?.data?.records || []
- standardTableData.value = records
- page.total = res?.data?.total || records.length
+ const getStandardList = () => {
+ tableLoading.value = true;
+ qualityTestStandardListPage({
+ ...searchForm.value,
+ current: page.current,
+ size: page.size,
+ state: 1,
})
- .finally(() => {
- tableLoading.value = false
- })
-}
+ .then(res => {
+ const records = res?.data?.records || [];
+ standardTableData.value = records;
+ page.total = res?.data?.total || records.length;
+ })
+ .finally(() => {
+ tableLoading.value = false;
+ });
+ };
-// 琛ㄦ牸琛岀偣鍑伙紝鍔犺浇鍙充晶缁戝畾鍒楄〃
-const handleTableRowClick = (row) => {
- currentStandard.value = row
- loadBindingList()
-}
+ // 琛ㄦ牸琛岀偣鍑伙紝鍔犺浇鍙充晶缁戝畾鍒楄〃
+ const handleTableRowClick = row => {
+ currentStandard.value = row;
+ loadBindingList();
+ };
-// 宸︿晶琛岀偣鍑伙紝鍔犺浇鍙充晶缁戝畾鍒楄〃锛堜繚鐣欑敤浜庢爣鍑嗙紪鍙峰垪鐨勭偣鍑伙級
-const handleStandardRowClick = (row) => {
- currentStandard.value = row
- loadBindingList()
-}
+ // 宸︿晶琛岀偣鍑伙紝鍔犺浇鍙充晶缁戝畾鍒楄〃锛堜繚鐣欑敤浜庢爣鍑嗙紪鍙峰垪鐨勭偣鍑伙級
+ const handleStandardRowClick = row => {
+ currentStandard.value = row;
+ loadBindingList();
+ };
-const loadBindingList = () => {
- if (!currentStandard.value?.id) {
- bindingTableData.value = []
- return
- }
- bindingLoading.value = true
- qualityTestStandardBindingList({ testStandardId: currentStandard.value.id })
- .then((res) => {
- const base = res?.data || []
- // 灏嗗綋鍓嶆爣鍑嗙殑宸ュ簭鍜屽娉ㄥ甫鍒扮粦瀹氬垪琛ㄤ腑灞曠ず
- bindingTableData.value = base.map((item) => ({
- ...item,
- processId: currentStandard.value?.processId,
- remark: currentStandard.value?.remark
- }))
- })
- .finally(() => {
- bindingLoading.value = false
- })
-}
+ const loadBindingList = () => {
+ if (!currentStandard.value?.id) {
+ bindingTableData.value = [];
+ return;
+ }
+ bindingLoading.value = true;
+ qualityTestStandardBindingList({ testStandardId: currentStandard.value.id })
+ .then(res => {
+ const base = res?.data || [];
+ // 灏嗗綋鍓嶆爣鍑嗙殑宸ュ簭鍜屽娉ㄥ甫鍒扮粦瀹氬垪琛ㄤ腑灞曠ず
+ bindingTableData.value = base.map(item => ({
+ ...item,
+ processId: currentStandard.value?.processId,
+ remark: currentStandard.value?.remark,
+ }));
+ })
+ .finally(() => {
+ bindingLoading.value = false;
+ });
+ };
-const handleBindingSelectionChange = (selection) => {
- bindingSelectedRows.value = selection
-}
+ const handleBindingSelectionChange = selection => {
+ bindingSelectedRows.value = selection;
+ };
-const openBindingDialog = () => {
- if (!currentStandard.value?.id) return
- selectedProductIds.value = []
- getProductOptions()
- bindingDialogVisible.value = true
-}
+ const openBindingDialog = () => {
+ if (!currentStandard.value?.id) return;
+ selectedProductIds.value = [];
+ getProductOptions();
+ bindingDialogVisible.value = true;
+ };
-const closeBindingDialog = () => {
- bindingDialogVisible.value = false
-}
+ const closeBindingDialog = () => {
+ bindingDialogVisible.value = false;
+ };
-const submitBinding = async () => {
- const testStandardId = currentStandard.value?.id
- if (!testStandardId) return
- const ids = (selectedProductIds.value || []).filter(Boolean)
- if (!ids.length) {
- proxy.$message.warning('璇烽�夋嫨浜у搧')
- return
- }
- const payload = ids.map((pid) => ({
- productId: pid,
- testStandardId
- }))
- await qualityTestStandardBindingAdd(payload)
- proxy.$message.success('娣诲姞鎴愬姛')
- bindingDialogVisible.value = false
- loadBindingList()
-}
+ const openProcessBindingDialog = () => {
+ if (activeTab.value !== "1" && activeTab.value !== "2") return;
+ processBindingProductIds.value = [];
+ processBindingProcessIds.value = [];
+ getProductOptions();
+ processBindingDialogVisible.value = true;
+ };
-const handleUnbind = async (row) => {
- const id = row?.id ?? row?.qualityTestStandardBindingId
- if (id == null || id === '') return
- try {
- await ElMessageBox.confirm('纭鍒犻櫎璇ョ粦瀹氾紵', '鎻愮ず', { type: 'warning' })
- } catch {
- return
- }
- try {
- await qualityTestStandardBindingDel([id])
- proxy.$message.success('鍒犻櫎鎴愬姛')
- loadBindingList()
- } catch (err) {
- console.error('鍒犻櫎缁戝畾澶辫触:', err)
- proxy.$message?.error(err?.message || '鍒犻櫎澶辫触')
- }
-}
+ const closeProcessBindingDialog = () => {
+ processBindingDialogVisible.value = false;
+ };
-const handleBatchUnbind = async () => {
- if (!bindingSelectedRows.value.length) {
- proxy.$message.warning('璇烽�夋嫨鏁版嵁')
- return
- }
- const ids = bindingSelectedRows.value
- .map((i) => i?.id ?? i?.qualityTestStandardBindingId)
- .filter((id) => id != null && id !== '')
- if (!ids.length) {
- proxy.$message.warning('閫変腑鏁版嵁缂哄皯鏈夋晥 id')
- return
- }
- try {
- await ElMessageBox.confirm('閫変腑鐨勫唴瀹瑰皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�', '鍒犻櫎鎻愮ず', { type: 'warning' })
- } catch {
- return
- }
- try {
- await qualityTestStandardBindingDel(ids)
- proxy.$message.success('鍒犻櫎鎴愬姛')
- loadBindingList()
- } catch (err) {
- console.error('鎵归噺鍒犻櫎缁戝畾澶辫触:', err)
- proxy.$message?.error(err?.message || '鍒犻櫎澶辫触')
- }
-}
+ const submitBinding = async () => {
+ const ids = (selectedProductIds.value || []).filter(Boolean);
+ if (!ids.length) {
+ proxy.$message.warning("璇烽�夋嫨浜у搧");
+ return;
+ }
+ const testStandardId = currentStandard.value?.id;
+ if (!testStandardId) return;
+ const payload = ids.map(pid => ({
+ productId: pid,
+ testStandardId,
+ }));
+ await qualityTestStandardBindingAdd(payload);
+ proxy.$message.success("娣诲姞鎴愬姛");
+ bindingDialogVisible.value = false;
+ loadBindingList();
+ };
-onMounted(() => {
- searchForm.value.inspectType = activeTab.value
- getStandardList()
- getProcessList()
-})
+ const submitProcessBinding = async () => {
+ const ids = (processBindingProductIds.value || []).filter(Boolean);
+ if (!ids.length) {
+ proxy.$message.warning("璇烽�夋嫨浜у搧");
+ return;
+ }
+ const processIds = (processBindingProcessIds.value || []).filter(Boolean);
+ if (!processIds.length) {
+ proxy.$message.warning("璇烽�夋嫨宸ュ簭");
+ return;
+ }
+ const allow = new Set(leftProcessOptions.value.map(i => String(i.value)));
+ const processIdSet = new Set(processIds.map(i => String(i)));
+ for (const pid of processIdSet) {
+ if (!allow.has(pid)) {
+ proxy.$message.warning("鎵�閫夊伐搴忓繀椤诲湪宸︿晶鍒楄〃涓嚭鐜拌繃");
+ return;
+ }
+ }
+ const standards = (standardTableData.value || []).filter(s =>
+ processIdSet.has(String(s?.processId))
+ );
+ if (!standards.length) {
+ proxy.$message.warning("宸︿晶鍒楄〃鏈壘鍒板尮閰嶅伐搴忕殑妫�娴嬫爣鍑�");
+ return;
+ }
+
+ const uniq = new Set();
+ const payload = [];
+ for (const std of standards) {
+ const testStandardId = std?.id;
+ if (!testStandardId) continue;
+ for (const pid of ids) {
+ const key = `${String(testStandardId)}__${String(pid)}`;
+ if (uniq.has(key)) continue;
+ uniq.add(key);
+ payload.push({
+ productId: pid,
+ testStandardId,
+ });
+ }
+ }
+ if (!payload.length) {
+ proxy.$message.warning("鏈敓鎴愭湁鏁堢粦瀹氭暟鎹�");
+ return;
+ }
+ await qualityTestStandardBindingAdd(payload);
+ proxy.$message.success(`宸叉坊鍔� ${payload.length} 鏉$粦瀹歚);
+ processBindingDialogVisible.value = false;
+ if (currentStandard.value?.id) {
+ loadBindingList();
+ }
+ };
+
+ const handleUnbind = async row => {
+ const id = row?.id ?? row?.qualityTestStandardBindingId;
+ if (id == null || id === "") return;
+ try {
+ await ElMessageBox.confirm("纭鍒犻櫎璇ョ粦瀹氾紵", "鎻愮ず", { type: "warning" });
+ } catch {
+ return;
+ }
+ try {
+ await qualityTestStandardBindingDel([id]);
+ proxy.$message.success("鍒犻櫎鎴愬姛");
+ loadBindingList();
+ } catch (err) {
+ console.error("鍒犻櫎缁戝畾澶辫触:", err);
+ proxy.$message?.error(err?.message || "鍒犻櫎澶辫触");
+ }
+ };
+
+ const handleBatchUnbind = async () => {
+ if (!bindingSelectedRows.value.length) {
+ proxy.$message.warning("璇烽�夋嫨鏁版嵁");
+ return;
+ }
+ const ids = bindingSelectedRows.value
+ .map(i => i?.id ?? i?.qualityTestStandardBindingId)
+ .filter(id => id != null && id !== "");
+ if (!ids.length) {
+ proxy.$message.warning("閫変腑鏁版嵁缂哄皯鏈夋晥 id");
+ return;
+ }
+ try {
+ await ElMessageBox.confirm(
+ "閫変腑鐨勫唴瀹瑰皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�",
+ "鍒犻櫎鎻愮ず",
+ { type: "warning" }
+ );
+ } catch {
+ return;
+ }
+ try {
+ await qualityTestStandardBindingDel(ids);
+ proxy.$message.success("鍒犻櫎鎴愬姛");
+ loadBindingList();
+ } catch (err) {
+ console.error("鎵归噺鍒犻櫎缁戝畾澶辫触:", err);
+ proxy.$message?.error(err?.message || "鍒犻櫎澶辫触");
+ }
+ };
+
+ onMounted(() => {
+ searchForm.value.inspectType = activeTab.value;
+ getStandardList();
+ getProcessList();
+ });
</script>
<style scoped>
-.metric-binding {
- padding: 0;
-}
+ .metric-binding {
+ padding: 0;
+ }
-.metric-tabs {
- margin: 10px;
-}
+ .metric-tabs {
+ margin: 10px;
+ }
-.metric-binding-row {
- width: 100%;
-}
+ .metric-binding-row {
+ width: 100%;
+ }
-.metric-binding-row .left-col,
-.metric-binding-row .right-col {
- margin-bottom: 16px;
-}
+ .metric-binding-row .left-col,
+ .metric-binding-row .right-col {
+ margin-bottom: 16px;
+ }
-.metric-binding-row .panel {
- background: #ffffff;
- padding: 16px;
- box-sizing: border-box;
- height: 100%;
- min-height: 400px;
-}
+ .metric-binding-row .panel {
+ background: #ffffff;
+ padding: 16px;
+ box-sizing: border-box;
+ height: 100%;
+ min-height: 400px;
+ }
-.left-panel,
-.right-panel {
- height: 100%;
-}
+ .left-panel,
+ .right-panel {
+ height: 100%;
+ }
-.toolbar {
- display: flex;
- justify-content: space-between;
- align-items: center;
- margin-bottom: 12px;
-}
+ .toolbar {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ margin-bottom: 12px;
+ }
-.toolbar-right {
- flex-shrink: 0;
-}
+ .toolbar-right {
+ flex-shrink: 0;
+ }
-.right-header {
- display: flex;
- align-items: baseline;
- justify-content: space-between;
- margin-bottom: 10px;
-}
+ .right-header {
+ display: flex;
+ align-items: baseline;
+ justify-content: space-between;
+ margin-bottom: 10px;
+ }
-.right-header .title {
- font-size: 16px;
- font-weight: 600;
-}
+ .right-header .title {
+ font-size: 16px;
+ font-weight: 600;
+ }
-.right-header .desc {
- font-size: 13px;
- color: #666;
-}
+ .right-header .desc {
+ font-size: 13px;
+ color: #666;
+ }
-.right-toolbar {
- display: flex;
- justify-content: flex-end;
- gap: 10px;
- margin-bottom: 10px;
-}
+ .right-toolbar {
+ display: flex;
+ justify-content: flex-end;
+ gap: 10px;
+ margin-bottom: 10px;
+ }
-.link-text {
- color: #409eff;
- cursor: default;
-}
+ .link-text {
+ color: #409eff;
+ cursor: default;
+ }
-.clickable-link {
- color: #409eff;
- cursor: pointer;
-}
+ .clickable-link {
+ color: #409eff;
+ cursor: pointer;
+ }
-.clickable-link:hover {
- text-decoration: underline;
-}
+ .clickable-link:hover {
+ text-decoration: underline;
+ }
-:deep(.row-center td) {
- text-align: center !important;
-}
+ :deep(.row-center td) {
+ text-align: center !important;
+ }
-/* el-table 琛ㄥご/鍐呭缁熶竴灞呬腑锛坮ow-class-name 涓嶄綔鐢ㄤ簬琛ㄥご锛� */
-:deep(.center-table .el-table__header-wrapper th .cell) {
- text-align: center !important;
-}
-:deep(.center-table .el-table__body-wrapper td .cell) {
- text-align: center !important;
-}
+ /* el-table 琛ㄥご/鍐呭缁熶竴灞呬腑锛坮ow-class-name 涓嶄綔鐢ㄤ簬琛ㄥご锛� */
+ :deep(.center-table .el-table__header-wrapper th .cell) {
+ text-align: center !important;
+ }
+ :deep(.center-table .el-table__body-wrapper td .cell) {
+ text-align: center !important;
+ }
-/* PIMTable 琛ㄥご灞呬腑 */
-:deep(.lims-table .pim-table-header-cell) {
- text-align: center;
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
-}
+ /* PIMTable 琛ㄥご灞呬腑 */
+ :deep(.lims-table .pim-table-header-cell) {
+ text-align: center;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+ }
-:deep(.lims-table .pim-table-header-title) {
- text-align: center;
- width: 100%;
-}
+ :deep(.lims-table .pim-table-header-title) {
+ text-align: center;
+ width: 100%;
+ }
-:deep(.lims-table .pim-table-header-extra) {
- width: 100%;
- margin-top: 4px;
-}
+ :deep(.lims-table .pim-table-header-extra) {
+ width: 100%;
+ margin-top: 4px;
+ }
</style>
diff --git a/src/views/qualityManagement/metricMaintenance/StandardFormDialog.vue b/src/views/qualityManagement/metricMaintenance/StandardFormDialog.vue
index 0827a93..5872fd3 100644
--- a/src/views/qualityManagement/metricMaintenance/StandardFormDialog.vue
+++ b/src/views/qualityManagement/metricMaintenance/StandardFormDialog.vue
@@ -1,128 +1,137 @@
<template>
- <FormDialog
- v-model="dialogVisible"
- :title="computedTitle"
- :operation-type="operationType"
- :width="width"
- @close="emit('close')"
- @cancel="handleCancel"
- @confirm="handleConfirm"
- >
- <el-form
- ref="formRef"
- :model="form"
- :rules="rules"
- label-width="100px"
- >
- <el-form-item label="鏍囧噯缂栧彿" prop="standardNo">
- <el-input v-model="form.standardNo" placeholder="璇疯緭鍏ユ爣鍑嗙紪鍙�" />
+ <FormDialog v-model="dialogVisible"
+ :title="computedTitle"
+ :operation-type="operationType"
+ :width="width"
+ @close="emit('close')"
+ @cancel="handleCancel"
+ @confirm="handleConfirm">
+ <el-form ref="formRef"
+ :model="form"
+ :rules="rules"
+ label-width="100px">
+ <el-form-item label="鏍囧噯缂栧彿"
+ prop="standardNo">
+ <el-input v-model="form.standardNo"
+ placeholder="璇疯緭鍏ユ爣鍑嗙紪鍙�" />
</el-form-item>
- <el-form-item label="鏍囧噯鍚嶇О" prop="standardName">
- <el-input v-model="form.standardName" placeholder="璇疯緭鍏ユ爣鍑嗗悕绉�" />
+ <el-form-item label="鏍囧噯鍚嶇О"
+ prop="standardName">
+ <el-input v-model="form.standardName"
+ placeholder="璇疯緭鍏ユ爣鍑嗗悕绉�" />
</el-form-item>
- <el-form-item v-if="needProcess" label="宸ュ簭" prop="processId">
- <el-select v-model="form.processId" placeholder="璇烽�夋嫨宸ュ簭" style="width: 100%">
- <el-option
- v-for="item in processOptions"
- :key="item.value"
- :label="item.label"
- :value="item.value"
- />
+ <el-form-item v-if="needProcess"
+ label="宸ュ簭"
+ prop="processId">
+ <el-select v-model="form.processId"
+ placeholder="璇烽�夋嫨宸ュ簭"
+ style="width: 100%">
+ <el-option v-for="item in processOptions"
+ :key="item.value"
+ :label="item.label"
+ :value="item.value" />
</el-select>
</el-form-item>
- <el-form-item label="鐘舵��" prop="state">
- <el-select v-model="form.state" placeholder="璇烽�夋嫨鐘舵��" style="width: 100%">
- <el-option label="鑽夌" value="0" />
- <el-option label="閫氳繃" value="1" />
- <el-option label="鎾ら攢" value="2" />
+ <el-form-item label="鐘舵��"
+ prop="state">
+ <el-select v-model="form.state"
+ placeholder="璇烽�夋嫨鐘舵��"
+ style="width: 100%">
+ <el-option label="鑽夌"
+ value="0" />
+ <el-option label="閫氳繃"
+ value="1" />
+ <el-option label="鎾ら攢"
+ value="2" />
</el-select>
</el-form-item>
- <el-form-item label="澶囨敞" prop="remark">
- <el-input
- v-model="form.remark"
- type="textarea"
- :rows="3"
- placeholder="璇疯緭鍏ュ娉�"
- />
+ <el-form-item label="澶囨敞"
+ prop="remark">
+ <el-input v-model="form.remark"
+ type="textarea"
+ :rows="3"
+ placeholder="璇疯緭鍏ュ娉�" />
</el-form-item>
</el-form>
</FormDialog>
</template>
<script setup>
-import { computed, ref } from 'vue'
-import FormDialog from '@/components/Dialog/FormDialog.vue'
+ import { computed, ref } from "vue";
+ import FormDialog from "@/components/Dialog/FormDialog.vue";
-const props = defineProps({
- modelValue: {
- type: Boolean,
- default: false
- },
- operationType: {
- type: String,
- default: 'add'
- },
- form: {
- type: Object,
- required: true
- },
- rules: {
- type: Object,
- default: () => ({})
- },
- processOptions: {
- type: Array,
- default: () => []
- },
- width: {
- type: String,
- default: '500px'
- },
- inspectType:{
- type: String,
- default: null
- }
-})
+ const props = defineProps({
+ modelValue: {
+ type: Boolean,
+ default: false,
+ },
+ operationType: {
+ type: String,
+ default: "add",
+ },
+ form: {
+ type: Object,
+ required: true,
+ },
+ rules: {
+ type: Object,
+ default: () => ({}),
+ },
+ processOptions: {
+ type: Array,
+ default: () => [],
+ },
+ width: {
+ type: String,
+ default: "500px",
+ },
+ inspectType: {
+ type: String,
+ default: null,
+ },
+ });
-const emit = defineEmits(['update:modelValue', 'close', 'cancel', 'confirm'])
+ const emit = defineEmits(["update:modelValue", "close", "cancel", "confirm"]);
-const dialogVisible = computed({
- get: () => props.modelValue,
- set: (val) => emit('update:modelValue', val)
-})
+ const dialogVisible = computed({
+ get: () => props.modelValue,
+ set: val => emit("update:modelValue", val),
+ });
-const formRef = ref(null)
+ const formRef = ref(null);
-const needProcess = computed(() => String(props.inspectType ?? '') === '1')
+ const needProcess = computed(() =>
+ ["1", "2"].includes(String(props.inspectType ?? ""))
+ );
-const computedTitle = computed(() => {
- if (props.operationType === 'edit') return '缂栬緫妫�娴嬫爣鍑�'
- if (props.operationType === 'copy') return '澶嶅埗妫�娴嬫爣鍑�'
- return '鏂板妫�娴嬫爣鍑�'
-})
+ const computedTitle = computed(() => {
+ if (props.operationType === "edit") return "缂栬緫妫�娴嬫爣鍑�";
+ if (props.operationType === "copy") return "澶嶅埗妫�娴嬫爣鍑�";
+ return "鏂板妫�娴嬫爣鍑�";
+ });
-const handleConfirm = () => {
- if (!formRef.value) {
- emit('confirm')
- return
- }
- formRef.value.validate((valid) => {
- if (valid) {
- emit('confirm')
+ const handleConfirm = () => {
+ if (!formRef.value) {
+ emit("confirm");
+ return;
}
- })
-}
+ formRef.value.validate(valid => {
+ if (valid) {
+ emit("confirm");
+ }
+ });
+ };
-const handleCancel = () => {
- emit('cancel')
- dialogVisible.value = false
-}
+ const handleCancel = () => {
+ emit("cancel");
+ dialogVisible.value = false;
+ };
-const resetFields = () => {
- formRef.value?.resetFields?.()
-}
+ const resetFields = () => {
+ formRef.value?.resetFields?.();
+ };
-defineExpose({
- resetFields
-})
+ defineExpose({
+ resetFields,
+ });
</script>
diff --git a/src/views/qualityManagement/metricMaintenance/index.vue b/src/views/qualityManagement/metricMaintenance/index.vue
index 89cc08f..6282edd 100644
--- a/src/views/qualityManagement/metricMaintenance/index.vue
+++ b/src/views/qualityManagement/metricMaintenance/index.vue
@@ -1,860 +1,938 @@
<template>
<div class="app-container metric-maintenance">
- <el-tabs v-model="activeTab" @tab-change="handleTabChange" class="metric-tabs">
- <el-tab-pane label="鍘熸潗鏂欐楠�" name="0" />
- <el-tab-pane label="杩囩▼妫�楠�" name="1" />
- <el-tab-pane label="鍑哄巶妫�楠�" name="2" />
+ <el-tabs v-model="activeTab"
+ @tab-change="handleTabChange"
+ class="metric-tabs">
+ <el-tab-pane label="鍘熸潗鏂欐楠�"
+ name="0" />
+ <el-tab-pane label="杩囩▼妫�楠�"
+ name="1" />
+ <el-tab-pane label="鍑哄巶妫�楠�"
+ name="2" />
</el-tabs>
- <el-row :gutter="16" class="metric-maintenance-row">
+ <el-row :gutter="16"
+ class="metric-maintenance-row">
<!-- 宸︿晶锛氭娴嬫爣鍑嗗垪琛� -->
- <el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12" class="left-col">
+ <el-col :xs="24"
+ :sm="24"
+ :md="12"
+ :lg="12"
+ :xl="12"
+ class="left-col">
<div class="left-panel">
- <div class="toolbar">
- <div class="toolbar-left"></div>
- <div class="toolbar-right">
- <el-button type="primary" @click="openStandardDialog('add')">鏂板</el-button>
- <el-button type="success" plain @click="handleBatchAudit(1)">鎵瑰噯</el-button>
- <el-button type="warning" plain @click="handleBatchAudit(2)">鎾ら攢</el-button>
- <el-button type="danger" plain @click="handleBatchDelete">鍒犻櫎</el-button>
- </div>
- </div>
- <PIMTable
- rowKey="id"
- :column="standardColumns"
- :tableData="standardTableData"
- :page="page"
- :isSelection="true"
- :tableLoading="tableLoading"
- :rowClassName="rowClassNameCenter"
- :rowClick="handleTableRowClick"
- @selection-change="handleSelectionChange"
- @pagination="handlePagination"
- :total="page.total"
- >
- <template #standardNoCell="{ row }">
- <span class="clickable-link" @click="handleStandardRowClick(row)">
- {{ row.standardNo }}
- </span>
- </template>
-
- <!-- 琛ㄥご鎼滅储鎻掓Ы -->
- <template #standardNoHeader>
- <el-input
- v-model="searchForm.standardNo"
- placeholder="鏍囧噯缂栧彿"
- clearable
- size="small"
- @change="handleQuery"
- @clear="handleQuery"
- />
- </template>
- <template #standardNameHeader>
- <el-input
- v-model="searchForm.standardName"
- placeholder="鏍囧噯鍚嶇О"
- clearable
- size="small"
- @change="handleQuery"
- @clear="handleQuery"
- />
- </template>
- <template #stateHeader>
- <el-select
- v-model="searchForm.state"
- placeholder="鐘舵��"
- clearable
- size="small"
- style="width: 110px"
- @change="handleQuery"
- @clear="handleQuery"
- >
- <el-option label="鑽夌" value="0" />
- <el-option label="閫氳繃" value="1" />
- <el-option label="鎾ら攢" value="2" />
- </el-select>
- </template>
- </PIMTable>
+ <div class="toolbar">
+ <div class="toolbar-left"></div>
+ <div class="toolbar-right">
+ <el-button type="primary"
+ @click="openStandardDialog('add')">鏂板</el-button>
+ <el-button type="success"
+ plain
+ @click="handleBatchAudit(1)">鎵瑰噯</el-button>
+ <el-button type="warning"
+ plain
+ @click="handleBatchAudit(2)">鎾ら攢</el-button>
+ <el-button type="danger"
+ plain
+ @click="handleBatchDelete">鍒犻櫎</el-button>
+ </div>
+ </div>
+ <PIMTable rowKey="id"
+ :column="standardColumns"
+ :tableData="standardTableData"
+ :page="page"
+ :isSelection="true"
+ :tableLoading="tableLoading"
+ :rowClassName="rowClassNameCenter"
+ :rowClick="handleTableRowClick"
+ @selection-change="handleSelectionChange"
+ @pagination="handlePagination"
+ :total="page.total">
+ <template #standardNoCell="{ row }">
+ <span class="clickable-link"
+ @click="handleStandardRowClick(row)">
+ {{ row.standardNo }}
+ </span>
+ </template>
+ <!-- 琛ㄥご鎼滅储鎻掓Ы -->
+ <template #standardNoHeader>
+ <el-input v-model="searchForm.standardNo"
+ placeholder="鏍囧噯缂栧彿"
+ clearable
+ size="small"
+ @change="handleQuery"
+ @clear="handleQuery" />
+ </template>
+ <template #standardNameHeader>
+ <el-input v-model="searchForm.standardName"
+ placeholder="鏍囧噯鍚嶇О"
+ clearable
+ size="small"
+ @change="handleQuery"
+ @clear="handleQuery" />
+ </template>
+ <template #stateHeader>
+ <el-select v-model="searchForm.state"
+ placeholder="鐘舵��"
+ clearable
+ size="small"
+ style="width: 110px"
+ @change="handleQuery"
+ @clear="handleQuery">
+ <el-option label="鑽夌"
+ value="0" />
+ <el-option label="閫氳繃"
+ value="1" />
+ <el-option label="鎾ら攢"
+ value="2" />
+ </el-select>
+ </template>
+ </PIMTable>
</div>
</el-col>
-
<!-- 鍙充晶锛氭爣鍑嗗弬鏁板垪琛� -->
- <el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12" class="right-col">
+ <el-col :xs="24"
+ :sm="24"
+ :md="12"
+ :lg="12"
+ :xl="12"
+ class="right-col">
<div class="right-panel">
- <div class="right-header">
- <div class="title">鏍囧噯鍙傛暟</div>
- <div class="desc" v-if="currentStandard">
- 鎮ㄥ綋鍓嶉�夋嫨鐨勬娴嬫爣鍑嗙紪鍙锋槸锛�
- <span class="link-text">{{ currentStandard.standardNo }}</span>
- </div>
- <div class="desc" v-else>璇峰厛鍦ㄥ乏渚ч�夋嫨涓�涓娴嬫爣鍑�</div>
- </div>
-
- <div class="right-toolbar">
- <el-button type="primary" :disabled="!currentStandard || isStandardReadonly" @click="openParamDialog('add')">
- 鏂板
- </el-button>
- <el-button type="danger" plain :disabled="!currentStandard || isStandardReadonly" @click="handleParamBatchDelete">
- 鍒犻櫎
- </el-button>
- </div>
-
- <el-table
- v-loading="detailLoading"
- :data="detailTableData"
- border
- :row-class-name="() => 'row-center'"
- class="center-table"
- style="width: 100%"
- height="calc(100vh - 220px)"
- @selection-change="handleParamSelectionChange"
- >
- <el-table-column type="selection" width="48" align="center" />
- <el-table-column type="index" label="搴忓彿" width="60" align="center" />
- <el-table-column prop="parameterItem" label="鍙傛暟椤�" min-width="120" />
- <el-table-column prop="unit" label="鍗曚綅" width="80" />
- <el-table-column prop="standardValue" label="鏍囧噯鍊�" min-width="120" />
- <el-table-column prop="controlValue" label="鍐呮帶鍊�" min-width="120" />
- <el-table-column prop="defaultValue" label="榛樿鍊�" min-width="120" />
- <el-table-column label="鎿嶄綔" width="140" fixed="right" align="center">
- <template #default="{ row }">
- <el-button link type="primary" size="small" :disabled="isStandardReadonly" @click="openParamDialog('edit', row)">
- 缂栬緫
+ <div class="right-header">
+ <div class="title">鏍囧噯鍙傛暟</div>
+ <div class="desc"
+ v-if="currentStandard">
+ 鎮ㄥ綋鍓嶉�夋嫨鐨勬娴嬫爣鍑嗙紪鍙锋槸锛�
+ <span class="link-text">{{ currentStandard.standardNo }}</span>
+ </div>
+ <div class="desc"
+ v-else>璇峰厛鍦ㄥ乏渚ч�夋嫨涓�涓娴嬫爣鍑�</div>
+ </div>
+ <div class="right-toolbar">
+ <el-button type="primary"
+ :disabled="!currentStandard || isStandardReadonly"
+ @click="openParamDialog('add')">
+ 鏂板
</el-button>
- <el-button link type="danger" size="small" :disabled="isStandardReadonly" @click="handleParamDelete(row)">
+ <el-button type="danger"
+ plain
+ :disabled="!currentStandard || isStandardReadonly"
+ @click="handleParamBatchDelete">
鍒犻櫎
</el-button>
- </template>
- </el-table-column>
- </el-table>
+ </div>
+ <el-table v-loading="detailLoading"
+ :data="detailTableData"
+ border
+ :row-class-name="() => 'row-center'"
+ class="center-table"
+ style="width: 100%"
+ height="calc(100vh - 220px)"
+ @selection-change="handleParamSelectionChange">
+ <el-table-column type="selection"
+ width="48"
+ align="center" />
+ <el-table-column type="index"
+ label="搴忓彿"
+ width="60"
+ align="center" />
+ <el-table-column prop="parameterItem"
+ label="鍙傛暟椤�"
+ min-width="120" />
+ <el-table-column prop="unit"
+ label="鍗曚綅"
+ width="80" />
+ <el-table-column prop="standardValue"
+ label="鏍囧噯鍊�"
+ min-width="120" />
+ <el-table-column prop="controlValue"
+ label="鍐呮帶鍊�"
+ min-width="120" />
+ <el-table-column prop="defaultValue"
+ label="榛樿鍊�"
+ min-width="120" />
+ <el-table-column label="鎿嶄綔"
+ width="140"
+ fixed="right"
+ align="center">
+ <template #default="{ row }">
+ <el-button link
+ type="primary"
+ size="small"
+ :disabled="isStandardReadonly"
+ @click="openParamDialog('edit', row)">
+ 缂栬緫
+ </el-button>
+ <el-button link
+ type="danger"
+ size="small"
+ :disabled="isStandardReadonly"
+ @click="handleParamDelete(row)">
+ 鍒犻櫎
+ </el-button>
+ </template>
+ </el-table-column>
+ </el-table>
</div>
</el-col>
</el-row>
-
<!-- 鏂板 / 缂栬緫妫�娴嬫爣鍑� -->
- <StandardFormDialog
- ref="standardFormDialogRef"
- v-model="standardDialogVisible"
- :operation-type="standardOperationType"
- :form="standardForm"
- :rules="standardRules"
- :inspect-type="activeTab"
- :process-options="processOptions"
- @confirm="submitStandardForm"
- @close="closeStandardDialog"
- @cancel="closeStandardDialog"
- />
-
- <ParamFormDialog
- ref="paramFormDialogRef"
- v-model="paramDialogVisible"
- :operation-type="paramOperationType"
- :inspectType="activeTab.value"
- :form="paramForm"
- @confirm="submitParamForm"
- @close="closeParamDialog"
- @cancel="closeParamDialog"
- />
+ <StandardFormDialog ref="standardFormDialogRef"
+ v-model="standardDialogVisible"
+ :operation-type="standardOperationType"
+ :form="standardForm"
+ :rules="standardRules"
+ :inspect-type="activeTab"
+ :process-options="processOptions"
+ @confirm="submitStandardForm"
+ @close="closeStandardDialog"
+ @cancel="closeStandardDialog" />
+ <ParamFormDialog ref="paramFormDialogRef"
+ v-model="paramDialogVisible"
+ :operation-type="paramOperationType"
+ :inspectType="activeTab.value"
+ :form="paramForm"
+ @confirm="submitParamForm"
+ @close="closeParamDialog"
+ @cancel="closeParamDialog" />
</div>
</template>
<script setup>
-import { Search } from '@element-plus/icons-vue'
-import { ref, reactive, toRefs, onMounted, getCurrentInstance, computed } from 'vue'
-import { ElMessageBox } from 'element-plus'
-import {
- qualityTestStandardListPage,
- qualityTestStandardAdd,
- qualityTestStandardUpdate,
- qualityTestStandardDel,
- qualityTestStandardCopyParam,
- qualityTestStandardAudit,
- qualityTestStandardParamList,
- qualityTestStandardParamAdd,
- qualityTestStandardParamUpdate,
- qualityTestStandardParamDel
-} from '@/api/qualityManagement/metricMaintenance.js'
-import { productProcessListPage } from '@/api/basicData/productProcess.js'
-import StandardFormDialog from './StandardFormDialog.vue'
-import ParamFormDialog from './ParamFormDialog.vue'
+ import { Search } from "@element-plus/icons-vue";
+ import {
+ ref,
+ reactive,
+ toRefs,
+ onMounted,
+ getCurrentInstance,
+ computed,
+ } from "vue";
+ import { ElMessageBox } from "element-plus";
+ import {
+ qualityTestStandardListPage,
+ qualityTestStandardAdd,
+ qualityTestStandardUpdate,
+ qualityTestStandardDel,
+ qualityTestStandardCopyParam,
+ qualityTestStandardAudit,
+ qualityTestStandardParamList,
+ qualityTestStandardParamAdd,
+ qualityTestStandardParamUpdate,
+ qualityTestStandardParamDel,
+ } from "@/api/qualityManagement/metricMaintenance.js";
+ import { productProcessListPage } from "@/api/basicData/productProcess.js";
+ import StandardFormDialog from "./StandardFormDialog.vue";
+ import ParamFormDialog from "./ParamFormDialog.vue";
-const { proxy } = getCurrentInstance()
+ const { proxy } = getCurrentInstance();
-// 绫诲埆 Tab锛�0=鍘熸潗鏂欙紝1=杩囩▼锛�2=鍑哄巶锛�
-const activeTab = ref('0')
+ // 绫诲埆 Tab锛�0=鍘熸潗鏂欙紝1=杩囩▼锛�2=鍑哄巶锛�
+ const activeTab = ref("0");
-// 宸︿晶鏍囧噯鍒楄〃锛氭暣琛屽唴瀹瑰眳涓紙閰嶅悎鏍峰紡锛�
-const rowClassNameCenter = () => 'row-center'
+ // 宸︿晶鏍囧噯鍒楄〃锛氭暣琛屽唴瀹瑰眳涓紙閰嶅悎鏍峰紡锛�
+ const rowClassNameCenter = () => "row-center";
-// 鏍囧噯鐘舵�佷负鈥滈�氳繃(1)鈥濇椂锛屽彸渚у弬鏁扮姝㈠鍒犳敼
-const isStandardReadonly = computed(() => {
- const state = currentStandard.value?.state
- return state === 1 || state === '1'
-})
+ // 鏍囧噯鐘舵�佷负鈥滈�氳繃(1)鈥濇椂锛屽彸渚у弬鏁扮姝㈠鍒犳敼
+ const isStandardReadonly = computed(() => {
+ const state = currentStandard.value?.state;
+ return state === 1 || state === "1";
+ });
-// 鎼滅储鏉′欢
-const data = reactive({
- searchForm: {
- standardNo: '',
- standardName: '',
- remark: '',
- state: '',
- inspectType: '',
- processId: ''
- },
- standardForm: {
- id: undefined,
- standardNo: '',
- standardName: '',
- remark: '',
- state: '0',
- inspectType: '',
- processId: ''
- },
- standardRules: {
- standardNo: [{ required: true, message: '璇疯緭鍏ユ爣鍑嗙紪鍙�', trigger: 'blur' }],
- standardName: [{ required: true, message: '璇疯緭鍏ユ爣鍑嗗悕绉�', trigger: 'blur' }],
- processId: [{
- validator: (_rule, value, callback) => {
- const inspectType = String(standardForm.value.inspectType ?? activeTab.value ?? '')
- if (inspectType === '1' && (value === '' || value === null || value === undefined)) {
- callback(new Error('璇烽�夋嫨宸ュ簭'))
- return
- }
- callback()
- },
- trigger: 'change'
- }]
- }
-})
-
-const { searchForm, standardForm, standardRules } = toRefs(data)
-
-// 宸︿晶琛ㄦ牸
-const standardTableData = ref([])
-const selectedRows = ref([])
-const tableLoading = ref(false)
-const page = reactive({
- current: 1,
- size: 10,
- total: 0
-})
-
-// 宸ュ簭涓嬫媺
-const processOptions = ref([])
-
-// 鑾峰彇宸ュ簭鍒楄〃
-const getProcessList = async () => {
- try {
- const res = await productProcessListPage({ current: 1, size: 1000 })
- if (res?.code === 200) {
- const records = res?.data?.records || []
- processOptions.value = records.map(item => ({
- label: item.processName || item.name || item.label,
- value: item.id || item.processId || item.value
- }))
- }
- } catch (error) {
- console.error('鑾峰彇宸ュ簭鍒楄〃澶辫触:', error)
- }
-}
-
-// 褰撳墠閫変腑鐨勬爣鍑� & 鍙充晶璇︽儏
-const currentStandard = ref(null)
-const detailTableData = ref([])
-const detailLoading = ref(false)
-const paramSelectedRows = ref([])
-const paramDialogVisible = ref(false)
-const paramOperationType = ref('add') // add | edit
-const paramFormDialogRef = ref(null)
-const paramForm = reactive({
- id: undefined,
- parameterItem: '',
- unit: '',
- standardValue: '',
- controlValue: '',
- defaultValue: ''
-})
-
-// 寮圭獥
-const standardDialogVisible = ref(false)
-const standardOperationType = ref('add') // add | edit | copy
-const standardFormDialogRef = ref(null)
-
-// 鍒楀畾涔�
-const standardColumns = ref([
- {
- label: '鏍囧噯缂栧彿',
- prop: 'standardNo',
- dataType: 'slot',
- slot: 'standardNoCell',
- minWidth: 160,
- align: 'center',
- headerSlot: 'standardNoHeader'
- },
- {
- label: '鏍囧噯鍚嶇О',
- prop: 'standardName',
- minWidth: 180,
- align: 'center',
- headerSlot: 'standardNameHeader'
- },
- {
- label: '绫诲埆',
- prop: 'inspectType',
- align: 'center',
- dataType: 'tag',
- minWidth: 120,
- formatData: (val) => {
- const map = {
- 0: '鍘熸潗鏂欐楠�',
- 1: '杩囩▼妫�楠�',
- 2: '鍑哄巶妫�楠�'
- }
- return map[val] || val
- }
- },
- {
- label: '宸ュ簭',
- prop: 'processId',
- align: 'center',
- dataType: 'tag',
- visible: visible => activeTab.value === '1',
- formatData: (val) => {
- const target = processOptions.value.find(
- (item) => String(item.value) === String(val)
- )
- return target?.label || val
- }
- },
- {
- label: '鐘舵��',
- prop: 'state',
- headerSlot: 'stateHeader',
- align: 'center',
- dataType: 'tag',
- formatData: (val) => {
- const map = {
- 0: '鑽夌',
- 1: '閫氳繃',
- 2: '鎾ら攢'
- }
- return map[val] || val
+ // 鎼滅储鏉′欢
+ const data = reactive({
+ searchForm: {
+ standardNo: "",
+ standardName: "",
+ remark: "",
+ state: "",
+ inspectType: "",
+ processId: "",
},
- formatType: (val) => {
- if (val === '1' || val === 1) return 'success'
- if (val === '2' || val === 2) return 'warning'
- return 'info'
- }
- },
- {
- label: '澶囨敞',
- prop: 'remark',
- minWidth: 160,
- align: 'center'
- },
- {
- dataType: 'action',
- label: '鎿嶄綔',
- align: 'center',
- fixed: 'right',
- width: 220,
- operation: [
- {
- name: '缂栬緫',
- type: 'text',
- clickFun: (row) => {
- openStandardDialog('edit', row)
- }
- },
- {
- name: '澶嶅埗',
- type: 'text',
- clickFun: async (row) => {
- if (!row?.id) return
- try {
- await ElMessageBox.confirm('纭澶嶅埗璇ユ爣鍑嗗弬鏁帮紵', '鎻愮ず', { type: 'warning' })
- } catch {
- return
- }
- await qualityTestStandardCopyParam(row.id)
- proxy.$message.success('澶嶅埗鎴愬姛')
- getStandardList()
- if (currentStandard.value?.id === row.id) {
- loadDetail(row.id)
- }
- }
- },
- {
- name: '鍒犻櫎',
- type: 'text',
- clickFun: (row) => {
- handleDelete(row)
- }
+ standardForm: {
+ id: undefined,
+ standardNo: "",
+ standardName: "",
+ remark: "",
+ state: "0",
+ inspectType: "",
+ processId: "",
+ },
+ standardRules: {
+ standardNo: [
+ { required: true, message: "璇疯緭鍏ユ爣鍑嗙紪鍙�", trigger: "blur" },
+ ],
+ standardName: [
+ { required: true, message: "璇疯緭鍏ユ爣鍑嗗悕绉�", trigger: "blur" },
+ ],
+ processId: [
+ {
+ validator: (_rule, value, callback) => {
+ const inspectType = String(
+ standardForm.value.inspectType ?? activeTab.value ?? ""
+ );
+ if (
+ (inspectType === "1" || inspectType === "2") &&
+ (value === "" || value === null || value === undefined)
+ ) {
+ callback(new Error("璇烽�夋嫨宸ュ簭"));
+ return;
+ }
+ callback();
+ },
+ trigger: "change",
+ },
+ ],
+ },
+ });
+
+ const { searchForm, standardForm, standardRules } = toRefs(data);
+
+ // 宸︿晶琛ㄦ牸
+ const standardTableData = ref([]);
+ const selectedRows = ref([]);
+ const tableLoading = ref(false);
+ const page = reactive({
+ current: 1,
+ size: 10,
+ total: 0,
+ });
+
+ // 宸ュ簭涓嬫媺
+ const processOptions = ref([]);
+
+ // 鑾峰彇宸ュ簭鍒楄〃
+ const getProcessList = async () => {
+ try {
+ const res = await productProcessListPage({ current: 1, size: 1000 });
+ if (res?.code === 200) {
+ const records = res?.data?.records || [];
+ processOptions.value = records.map(item => ({
+ label: item.processName || item.name || item.label,
+ value: item.id || item.processId || item.value,
+ }));
}
- ]
- }
-])
-const handleTabChange = () => {
- searchForm.value.standardNo = ''
- searchForm.value.standardName = ''
- searchForm.value.remark = ''
- searchForm.value.state = ''
- searchForm.value.processId = ''
- searchForm.value.inspectType = activeTab.value
- page.current = 1
- currentStandard.value = null
- detailTableData.value = []
- paramSelectedRows.value = []
- getStandardList()
-}
+ } catch (error) {
+ console.error("鑾峰彇宸ュ簭鍒楄〃澶辫触:", error);
+ }
+ };
-// 鏌ヨ鍒楄〃
-const getStandardList = () => {
- tableLoading.value = true
- const params = {
- ...searchForm.value,
- current: page.current,
- size: page.size
- }
- qualityTestStandardListPage(params)
- .then((res) => {
- const records = res?.data?.records || []
- standardTableData.value = records
- page.total = res?.data?.total || records.length
+ // 褰撳墠閫変腑鐨勬爣鍑� & 鍙充晶璇︽儏
+ const currentStandard = ref(null);
+ const detailTableData = ref([]);
+ const detailLoading = ref(false);
+ const paramSelectedRows = ref([]);
+ const paramDialogVisible = ref(false);
+ const paramOperationType = ref("add"); // add | edit
+ const paramFormDialogRef = ref(null);
+ const paramForm = reactive({
+ id: undefined,
+ parameterItem: "",
+ unit: "",
+ standardValue: "",
+ controlValue: "",
+ defaultValue: "",
+ });
+
+ // 寮圭獥
+ const standardDialogVisible = ref(false);
+ const standardOperationType = ref("add"); // add | edit | copy
+ const standardFormDialogRef = ref(null);
+
+ // 鍒楀畾涔�
+ const standardColumns = ref([
+ {
+ label: "鏍囧噯缂栧彿",
+ prop: "standardNo",
+ dataType: "slot",
+ slot: "standardNoCell",
+ minWidth: 160,
+ align: "center",
+ headerSlot: "standardNoHeader",
+ },
+ {
+ label: "鏍囧噯鍚嶇О",
+ prop: "standardName",
+ minWidth: 180,
+ align: "center",
+ headerSlot: "standardNameHeader",
+ },
+ {
+ label: "绫诲埆",
+ prop: "inspectType",
+ align: "center",
+ dataType: "tag",
+ minWidth: 120,
+ formatData: val => {
+ const map = {
+ 0: "鍘熸潗鏂欐楠�",
+ 1: "杩囩▼妫�楠�",
+ 2: "鍑哄巶妫�楠�",
+ };
+ return map[val] || val;
+ },
+ },
+ {
+ label: "宸ュ簭",
+ prop: "processId",
+ align: "center",
+ dataType: "tag",
+ visible: visible => ["1", "2"].includes(String(activeTab.value)),
+ formatData: val => {
+ const target = processOptions.value.find(
+ item => String(item.value) === String(val)
+ );
+ return target?.label || val;
+ },
+ },
+ {
+ label: "鐘舵��",
+ prop: "state",
+ headerSlot: "stateHeader",
+ align: "center",
+ dataType: "tag",
+ formatData: val => {
+ const map = {
+ 0: "鑽夌",
+ 1: "閫氳繃",
+ 2: "鎾ら攢",
+ };
+ return map[val] || val;
+ },
+ formatType: val => {
+ if (val === "1" || val === 1) return "success";
+ if (val === "2" || val === 2) return "warning";
+ return "info";
+ },
+ },
+ {
+ label: "澶囨敞",
+ prop: "remark",
+ minWidth: 160,
+ align: "center",
+ },
+ {
+ dataType: "action",
+ label: "鎿嶄綔",
+ align: "center",
+ fixed: "right",
+ width: 220,
+ operation: [
+ {
+ name: "缂栬緫",
+ type: "text",
+ clickFun: row => {
+ openStandardDialog("edit", row);
+ },
+ },
+ {
+ name: "澶嶅埗",
+ type: "text",
+ clickFun: async row => {
+ if (!row?.id) return;
+ try {
+ await ElMessageBox.confirm("纭澶嶅埗璇ユ爣鍑嗗弬鏁帮紵", "鎻愮ず", {
+ type: "warning",
+ });
+ } catch {
+ return;
+ }
+ await qualityTestStandardCopyParam(row.id);
+ proxy.$message.success("澶嶅埗鎴愬姛");
+ getStandardList();
+ if (currentStandard.value?.id === row.id) {
+ loadDetail(row.id);
+ }
+ },
+ },
+ {
+ name: "鍒犻櫎",
+ type: "text",
+ clickFun: row => {
+ handleDelete(row);
+ },
+ },
+ ],
+ },
+ ]);
+ const handleTabChange = () => {
+ searchForm.value.standardNo = "";
+ searchForm.value.standardName = "";
+ searchForm.value.remark = "";
+ searchForm.value.state = "";
+ searchForm.value.processId = "";
+ searchForm.value.inspectType = activeTab.value;
+ page.current = 1;
+ currentStandard.value = null;
+ detailTableData.value = [];
+ paramSelectedRows.value = [];
+ getStandardList();
+ };
+
+ // 鏌ヨ鍒楄〃
+ const getStandardList = () => {
+ tableLoading.value = true;
+ const params = {
+ ...searchForm.value,
+ current: page.current,
+ size: page.size,
+ };
+ qualityTestStandardListPage(params)
+ .then(res => {
+ const records = res?.data?.records || [];
+ standardTableData.value = records;
+ page.total = res?.data?.total || records.length;
+ })
+ .finally(() => {
+ tableLoading.value = false;
+ });
+ };
+
+ const handleQuery = () => {
+ page.current = 1;
+ getStandardList();
+ };
+
+ const resetQuery = () => {
+ searchForm.value.standardNo = "";
+ searchForm.value.standardName = "";
+ searchForm.value.remark = "";
+ searchForm.value.state = "";
+ searchForm.value.inspectType = "";
+ searchForm.value.processId = "";
+ handleQuery();
+ };
+
+ const handlePagination = obj => {
+ page.current = obj.page;
+ page.size = obj.limit;
+ getStandardList();
+ };
+
+ const handleSelectionChange = selection => {
+ selectedRows.value = selection;
+ };
+
+ // 鎵归噺瀹℃牳锛氱姸鎬� 1=鎵瑰噯锛�2=鎾ら攢
+ const handleBatchAudit = async state => {
+ if (!selectedRows.value.length) {
+ proxy.$message.warning("璇烽�夋嫨鏁版嵁");
+ return;
+ }
+ const text = state === 1 ? "鎵瑰噯" : "鎾ら攢";
+ const payload = selectedRows.value
+ .filter(i => i?.id)
+ .map(item => ({ id: item.id, state }));
+
+ if (!payload.length) {
+ proxy.$message.warning("璇烽�夋嫨鏈夋晥鏁版嵁");
+ return;
+ }
+
+ try {
+ await ElMessageBox.confirm(`纭${text}閫変腑鐨勬爣鍑嗭紵`, "鎻愮ず", {
+ type: "warning",
+ });
+ } catch {
+ return;
+ }
+ await qualityTestStandardAudit(payload);
+ proxy.$message.success(`${text}鎴愬姛`);
+ getStandardList();
+ };
+
+ // 琛ㄦ牸琛岀偣鍑伙紝鍔犺浇鍙充晶鍙傛暟
+ const handleTableRowClick = row => {
+ currentStandard.value = row;
+ loadDetail(row.id);
+ };
+
+ // 宸︿晶琛岀偣鍑伙紝鍔犺浇鍙充晶鍙傛暟锛堜繚鐣欑敤浜庢爣鍑嗙紪鍙峰垪鐨勭偣鍑伙級
+ const handleStandardRowClick = row => {
+ currentStandard.value = row;
+ loadDetail(row.id);
+ };
+
+ const loadDetail = standardId => {
+ if (!standardId) {
+ detailTableData.value = [];
+ return;
+ }
+ detailLoading.value = true;
+ qualityTestStandardParamList({ testStandardId: standardId })
+ .then(res => {
+ detailTableData.value = res?.data || [];
+ })
+ .finally(() => {
+ detailLoading.value = false;
+ });
+ };
+
+ const handleParamSelectionChange = selection => {
+ paramSelectedRows.value = selection;
+ };
+
+ const openParamDialog = (type, row) => {
+ if (!currentStandard.value?.id) return;
+ if (isStandardReadonly.value) {
+ proxy.$message.warning("璇ユ爣鍑嗗凡閫氳繃锛屽弬鏁颁笉鍙紪杈�");
+ return;
+ }
+ paramOperationType.value = type;
+ if (type === "add") {
+ Object.assign(paramForm, {
+ id: undefined,
+ parameterItem: "",
+ unit: "",
+ standardValue: "",
+ controlValue: "",
+ defaultValue: "",
+ });
+ } else if (type === "edit" && row) {
+ Object.assign(paramForm, row);
+ }
+ paramDialogVisible.value = true;
+ };
+
+ const closeParamDialog = () => {
+ paramDialogVisible.value = false;
+ paramFormDialogRef.value?.resetFields?.();
+ };
+
+ const submitParamForm = async () => {
+ const testStandardId = currentStandard.value?.id;
+ if (!testStandardId) return;
+ if (isStandardReadonly.value) {
+ proxy.$message.warning("璇ユ爣鍑嗗凡閫氳繃锛屽弬鏁颁笉鍙紪杈�");
+ return;
+ }
+ const payload = { ...paramForm, testStandardId };
+ if (paramOperationType.value === "edit") {
+ await qualityTestStandardParamUpdate(payload);
+ proxy.$message.success("鎻愪氦鎴愬姛");
+ } else {
+ await qualityTestStandardParamAdd(payload);
+ proxy.$message.success("鎻愪氦鎴愬姛");
+ }
+ closeParamDialog();
+ loadDetail(testStandardId);
+ };
+
+ const handleParamDelete = async row => {
+ if (!row?.id) return;
+ if (isStandardReadonly.value) {
+ proxy.$message.warning("璇ユ爣鍑嗗凡閫氳繃锛屽弬鏁颁笉鍙紪杈�");
+ return;
+ }
+ try {
+ await ElMessageBox.confirm("纭鍒犻櫎璇ュ弬鏁帮紵", "鎻愮ず", { type: "warning" });
+ } catch {
+ return;
+ }
+ await qualityTestStandardParamDel([row.id]);
+ proxy.$message.success("鍒犻櫎鎴愬姛");
+ loadDetail(currentStandard.value?.id);
+ };
+
+ const handleParamBatchDelete = async () => {
+ if (isStandardReadonly.value) {
+ proxy.$message.warning("璇ユ爣鍑嗗凡閫氳繃锛屽弬鏁颁笉鍙紪杈�");
+ return;
+ }
+ if (!paramSelectedRows.value.length) {
+ proxy.$message.warning("璇烽�夋嫨鏁版嵁");
+ return;
+ }
+ const ids = paramSelectedRows.value.map(i => i.id);
+ try {
+ await ElMessageBox.confirm(
+ "閫変腑鐨勫唴瀹瑰皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�",
+ "鍒犻櫎鎻愮ず",
+ { type: "warning" }
+ );
+ } catch {
+ return;
+ }
+ await qualityTestStandardParamDel(ids);
+ proxy.$message.success("鍒犻櫎鎴愬姛");
+ loadDetail(currentStandard.value?.id);
+ };
+
+ // 鏂板 / 缂栬緫 / 澶嶅埗
+ const openStandardDialog = (type, row) => {
+ standardOperationType.value = type;
+ if (type === "add") {
+ Object.assign(standardForm.value, {
+ id: undefined,
+ standardNo: "",
+ standardName: "",
+ remark: "",
+ state: "0",
+ inspectType: activeTab.value,
+ processId: ["1", "2"].includes(String(activeTab.value)) ? "" : null,
+ });
+ } else if (type === "edit" && row) {
+ Object.assign(standardForm.value, {
+ ...row,
+ // 纭繚 inspectType 鍜� state 杞崲涓哄瓧绗︿覆锛屼互鍖归厤 el-select 鐨� value 绫诲瀷
+ inspectType:
+ row.inspectType !== null && row.inspectType !== undefined
+ ? String(row.inspectType)
+ : "",
+ state:
+ row.state !== null && row.state !== undefined ? String(row.state) : "0",
+ // 纭繚 processId 杞崲涓哄瓧绗︿覆鎴栨暟瀛楋紙鏍规嵁瀹為檯闇�瑕侊級
+ processId:
+ ["1", "2"].includes(String(row.inspectType)) &&
+ row.processId !== null &&
+ row.processId !== undefined
+ ? row.processId
+ : null,
+ });
+ } else if (type === "copy" && row) {
+ const { id, ...rest } = row;
+ Object.assign(standardForm.value, {
+ ...rest,
+ id: undefined,
+ standardNo: "",
+ state: "0",
+ // 纭繚 inspectType 杞崲涓哄瓧绗︿覆
+ inspectType: activeTab.value,
+ processId: ["1", "2"].includes(String(activeTab.value))
+ ? rest.processId ?? ""
+ : null,
+ });
+ }
+ standardDialogVisible.value = true;
+ };
+
+ const closeStandardDialog = () => {
+ standardDialogVisible.value = false;
+ standardFormDialogRef.value?.resetFields?.();
+ };
+
+ const submitStandardForm = () => {
+ const payload = { ...standardForm.value };
+ payload.inspectType = activeTab.value;
+ if (!["1", "2"].includes(String(payload.inspectType))) {
+ payload.processId = null;
+ }
+ const isEdit = standardOperationType.value === "edit";
+ if (isEdit) {
+ qualityTestStandardUpdate(payload).then(() => {
+ proxy.$message.success("鎻愪氦鎴愬姛");
+ standardDialogVisible.value = false;
+ getStandardList();
+ });
+ } else {
+ qualityTestStandardAdd(payload).then(() => {
+ proxy.$message.success("鎻愪氦鎴愬姛");
+ standardDialogVisible.value = false;
+ getStandardList();
+ });
+ }
+ };
+
+ // 鍒犻櫎锛堝崟鏉★級
+ const handleDelete = row => {
+ const ids = [row.id];
+ ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�", "鍒犻櫎鎻愮ず", {
+ confirmButtonText: "纭",
+ cancelButtonText: "鍙栨秷",
+ type: "warning",
})
- .finally(() => {
- tableLoading.value = false
+ .then(() => {
+ tableLoading.value = true;
+ qualityTestStandardDel(ids)
+ .then(() => {
+ proxy.$message.success("鍒犻櫎鎴愬姛");
+ getStandardList();
+ if (currentStandard.value && currentStandard.value.id === row.id) {
+ currentStandard.value = null;
+ detailTableData.value = [];
+ }
+ })
+ .finally(() => {
+ tableLoading.value = false;
+ });
+ })
+ .catch(() => {
+ proxy.$modal?.msg("宸插彇娑�");
+ });
+ };
+
+ // 鎵归噺鍒犻櫎
+ const handleBatchDelete = () => {
+ if (!selectedRows.value.length) {
+ proxy.$message.warning("璇烽�夋嫨鏁版嵁");
+ return;
+ }
+ const ids = selectedRows.value.map(item => item.id);
+ ElMessageBox.confirm("閫変腑鐨勫唴瀹瑰皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�", "鍒犻櫎鎻愮ず", {
+ confirmButtonText: "纭",
+ cancelButtonText: "鍙栨秷",
+ type: "warning",
})
-}
+ .then(() => {
+ tableLoading.value = true;
+ qualityTestStandardDel(ids)
+ .then(() => {
+ proxy.$message.success("鍒犻櫎鎴愬姛");
+ getStandardList();
+ if (currentStandard.value && ids.includes(currentStandard.value.id)) {
+ currentStandard.value = null;
+ detailTableData.value = [];
+ }
+ })
+ .finally(() => {
+ tableLoading.value = false;
+ });
+ })
+ .catch(() => {
+ proxy.$modal?.msg("宸插彇娑�");
+ });
+ };
-const handleQuery = () => {
- page.current = 1
- getStandardList()
-}
-
-const resetQuery = () => {
- searchForm.value.standardNo = ''
- searchForm.value.standardName = ''
- searchForm.value.remark = ''
- searchForm.value.state = ''
- searchForm.value.inspectType = ''
- searchForm.value.processId = ''
- handleQuery()
-}
-
-const handlePagination = (obj) => {
- page.current = obj.page
- page.size = obj.limit
- getStandardList()
-}
-
-const handleSelectionChange = (selection) => {
- selectedRows.value = selection
-}
-
-// 鎵归噺瀹℃牳锛氱姸鎬� 1=鎵瑰噯锛�2=鎾ら攢
-const handleBatchAudit = async (state) => {
- if (!selectedRows.value.length) {
- proxy.$message.warning('璇烽�夋嫨鏁版嵁')
- return
- }
- const text = state === 1 ? '鎵瑰噯' : '鎾ら攢'
- const payload = selectedRows.value
- .filter(i => i?.id)
- .map((item) => ({ id: item.id, state }))
-
- if (!payload.length) {
- proxy.$message.warning('璇烽�夋嫨鏈夋晥鏁版嵁')
- return
- }
-
- try {
- await ElMessageBox.confirm(`纭${text}閫変腑鐨勬爣鍑嗭紵`, '鎻愮ず', { type: 'warning' })
- } catch {
- return
- }
- await qualityTestStandardAudit(payload)
- proxy.$message.success(`${text}鎴愬姛`)
- getStandardList()
-}
-
-// 琛ㄦ牸琛岀偣鍑伙紝鍔犺浇鍙充晶鍙傛暟
-const handleTableRowClick = (row) => {
- currentStandard.value = row
- loadDetail(row.id)
-}
-
-// 宸︿晶琛岀偣鍑伙紝鍔犺浇鍙充晶鍙傛暟锛堜繚鐣欑敤浜庢爣鍑嗙紪鍙峰垪鐨勭偣鍑伙級
-const handleStandardRowClick = (row) => {
- currentStandard.value = row
- loadDetail(row.id)
-}
-
-const loadDetail = (standardId) => {
- if (!standardId) {
- detailTableData.value = []
- return
- }
- detailLoading.value = true
- qualityTestStandardParamList({ testStandardId: standardId }).then((res) => {
- detailTableData.value = res?.data || []
- })
- .finally(() => {
- detailLoading.value = false
- })
-}
-
-const handleParamSelectionChange = (selection) => {
- paramSelectedRows.value = selection
-}
-
-const openParamDialog = (type, row) => {
- if (!currentStandard.value?.id) return
- if (isStandardReadonly.value) {
- proxy.$message.warning('璇ユ爣鍑嗗凡閫氳繃锛屽弬鏁颁笉鍙紪杈�')
- return
- }
- paramOperationType.value = type
- if (type === 'add') {
- Object.assign(paramForm, {
- id: undefined,
- parameterItem: '',
- unit: '',
- standardValue: '',
- controlValue: '',
- defaultValue: ''
- })
- } else if (type === 'edit' && row) {
- Object.assign(paramForm, row)
- }
- paramDialogVisible.value = true
-}
-
-const closeParamDialog = () => {
- paramDialogVisible.value = false
- paramFormDialogRef.value?.resetFields?.()
-}
-
-const submitParamForm = async () => {
- const testStandardId = currentStandard.value?.id
- if (!testStandardId) return
- if (isStandardReadonly.value) {
- proxy.$message.warning('璇ユ爣鍑嗗凡閫氳繃锛屽弬鏁颁笉鍙紪杈�')
- return
- }
- const payload = { ...paramForm, testStandardId }
- if (paramOperationType.value === 'edit') {
- await qualityTestStandardParamUpdate(payload)
- proxy.$message.success('鎻愪氦鎴愬姛')
- } else {
- await qualityTestStandardParamAdd(payload)
- proxy.$message.success('鎻愪氦鎴愬姛')
- }
- closeParamDialog()
- loadDetail(testStandardId)
-}
-
-const handleParamDelete = async (row) => {
- if (!row?.id) return
- if (isStandardReadonly.value) {
- proxy.$message.warning('璇ユ爣鍑嗗凡閫氳繃锛屽弬鏁颁笉鍙紪杈�')
- return
- }
- try {
- await ElMessageBox.confirm('纭鍒犻櫎璇ュ弬鏁帮紵', '鎻愮ず', { type: 'warning' })
- } catch {
- return
- }
- await qualityTestStandardParamDel([row.id])
- proxy.$message.success('鍒犻櫎鎴愬姛')
- loadDetail(currentStandard.value?.id)
-}
-
-const handleParamBatchDelete = async () => {
- if (isStandardReadonly.value) {
- proxy.$message.warning('璇ユ爣鍑嗗凡閫氳繃锛屽弬鏁颁笉鍙紪杈�')
- return
- }
- if (!paramSelectedRows.value.length) {
- proxy.$message.warning('璇烽�夋嫨鏁版嵁')
- return
- }
- const ids = paramSelectedRows.value.map((i) => i.id)
- try {
- await ElMessageBox.confirm('閫変腑鐨勫唴瀹瑰皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�', '鍒犻櫎鎻愮ず', { type: 'warning' })
- } catch {
- return
- }
- await qualityTestStandardParamDel(ids)
- proxy.$message.success('鍒犻櫎鎴愬姛')
- loadDetail(currentStandard.value?.id)
-}
-
-// 鏂板 / 缂栬緫 / 澶嶅埗
-const openStandardDialog = (type, row) => {
- standardOperationType.value = type
- if (type === 'add') {
- Object.assign(standardForm.value, {
- id: undefined,
- standardNo: '',
- standardName: '',
- remark: '',
- state: '0',
- inspectType: activeTab.value,
- processId: activeTab.value === '1' ? '' : null
- })
- } else if (type === 'edit' && row) {
- Object.assign(standardForm.value, {
- ...row,
- // 纭繚 inspectType 鍜� state 杞崲涓哄瓧绗︿覆锛屼互鍖归厤 el-select 鐨� value 绫诲瀷
- inspectType: row.inspectType !== null && row.inspectType !== undefined ? String(row.inspectType) : '',
- state: row.state !== null && row.state !== undefined ? String(row.state) : '0',
- // 纭繚 processId 杞崲涓哄瓧绗︿覆鎴栨暟瀛楋紙鏍规嵁瀹為檯闇�瑕侊級
- processId: String(row.inspectType) === '1' && row.processId !== null && row.processId !== undefined ? row.processId : null
- })
- } else if (type === 'copy' && row) {
- const { id, ...rest } = row
- Object.assign(standardForm.value, {
- ...rest,
- id: undefined,
- standardNo: '',
- state: '0',
- // 纭繚 inspectType 杞崲涓哄瓧绗︿覆
- inspectType: activeTab.value,
- processId: activeTab.value === '1' ? (rest.processId ?? '') : null
- })
- }
- standardDialogVisible.value = true
-}
-
-const closeStandardDialog = () => {
- standardDialogVisible.value = false
- standardFormDialogRef.value?.resetFields?.()
-}
-
-const submitStandardForm = () => {
- const payload = { ...standardForm.value }
- payload.inspectType = activeTab.value
- if (String(payload.inspectType) !== '1') {
- payload.processId = null
- }
- const isEdit = standardOperationType.value === 'edit'
- if (isEdit) {
- qualityTestStandardUpdate(payload).then(() => {
- proxy.$message.success('鎻愪氦鎴愬姛')
- standardDialogVisible.value = false
- getStandardList()
- })
- } else {
- qualityTestStandardAdd(payload).then(() => {
- proxy.$message.success('鎻愪氦鎴愬姛')
- standardDialogVisible.value = false
- getStandardList()
- })
- }
-}
-
-// 鍒犻櫎锛堝崟鏉★級
-const handleDelete = (row) => {
- const ids = [row.id]
- ElMessageBox.confirm('閫変腑鐨勫唴瀹瑰皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�', '鍒犻櫎鎻愮ず', {
- confirmButtonText: '纭',
- cancelButtonText: '鍙栨秷',
- type: 'warning'
- })
- .then(() => {
- tableLoading.value = true
- qualityTestStandardDel(ids)
- .then(() => {
- proxy.$message.success('鍒犻櫎鎴愬姛')
- getStandardList()
- if (currentStandard.value && currentStandard.value.id === row.id) {
- currentStandard.value = null
- detailTableData.value = []
- }
- })
- .finally(() => {
- tableLoading.value = false
- })
- })
- .catch(() => {
- proxy.$modal?.msg('宸插彇娑�')
- })
-}
-
-// 鎵归噺鍒犻櫎
-const handleBatchDelete = () => {
- if (!selectedRows.value.length) {
- proxy.$message.warning('璇烽�夋嫨鏁版嵁')
- return
- }
- const ids = selectedRows.value.map((item) => item.id)
- ElMessageBox.confirm('閫変腑鐨勫唴瀹瑰皢琚垹闄わ紝鏄惁纭鍒犻櫎锛�', '鍒犻櫎鎻愮ず', {
- confirmButtonText: '纭',
- cancelButtonText: '鍙栨秷',
- type: 'warning'
- })
- .then(() => {
- tableLoading.value = true
- qualityTestStandardDel(ids)
- .then(() => {
- proxy.$message.success('鍒犻櫎鎴愬姛')
- getStandardList()
- if (currentStandard.value && ids.includes(currentStandard.value.id)) {
- currentStandard.value = null
- detailTableData.value = []
- }
- })
- .finally(() => {
- tableLoading.value = false
- })
- })
- .catch(() => {
- proxy.$modal?.msg('宸插彇娑�')
- })
-}
-
-onMounted(() => {
- searchForm.value.inspectType = activeTab.value
- getProcessList()
- getStandardList()
-})
+ onMounted(() => {
+ searchForm.value.inspectType = activeTab.value;
+ getProcessList();
+ getStandardList();
+ });
</script>
<style scoped>
-.metric-maintenance {
- padding: 0;
- min-width: 0;
-}
+ .metric-maintenance {
+ padding: 0;
+ min-width: 0;
+ }
-.metric-tabs {
- margin: 10px;
-}
+ .metric-tabs {
+ margin: 10px;
+ }
-.metric-maintenance-row {
- width: 100%;
-}
+ .metric-maintenance-row {
+ width: 100%;
+ }
-.metric-maintenance-row .left-col,
-.metric-maintenance-row .right-col {
- margin-bottom: 16px;
-}
+ .metric-maintenance-row .left-col,
+ .metric-maintenance-row .right-col {
+ margin-bottom: 16px;
+ }
-.left-panel,
-.right-panel {
- min-width: 0;
- background: #ffffff;
- padding: 16px;
- box-sizing: border-box;
- overflow: hidden;
- height: 100%;
- min-height: 400px;
-}
-
-@media (max-width: 768px) {
.left-panel,
.right-panel {
- padding: 12px;
+ min-width: 0;
+ background: #ffffff;
+ padding: 16px;
+ box-sizing: border-box;
+ overflow: hidden;
+ height: 100%;
+ min-height: 400px;
}
-}
-.toolbar {
- display: flex;
- justify-content: space-between;
- align-items: center;
- margin-bottom: 12px;
- flex-wrap: wrap;
- gap: 8px;
-}
+ @media (max-width: 768px) {
+ .left-panel,
+ .right-panel {
+ padding: 12px;
+ }
+ }
-.toolbar-left {
- display: flex;
- align-items: center;
- flex-wrap: wrap;
- gap: 4px;
-}
+ .toolbar {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ margin-bottom: 12px;
+ flex-wrap: wrap;
+ gap: 8px;
+ }
-.toolbar-right {
- flex-shrink: 0;
- display: flex;
- flex-wrap: wrap;
- gap: 8px;
-}
+ .toolbar-left {
+ display: flex;
+ align-items: center;
+ flex-wrap: wrap;
+ gap: 4px;
+ }
-.search-label {
- margin: 0 4px 0 12px;
-}
+ .toolbar-right {
+ flex-shrink: 0;
+ display: flex;
+ flex-wrap: wrap;
+ gap: 8px;
+ }
-.search-label:first-of-type {
- margin-left: 0;
-}
+ .search-label {
+ margin: 0 4px 0 12px;
+ }
-.right-header {
- display: flex;
- align-items: baseline;
- justify-content: space-between;
- margin-bottom: 10px;
-}
+ .search-label:first-of-type {
+ margin-left: 0;
+ }
-.right-header .title {
- font-size: 16px;
- font-weight: 600;
-}
+ .right-header {
+ display: flex;
+ align-items: baseline;
+ justify-content: space-between;
+ margin-bottom: 10px;
+ }
-.right-header .desc {
- font-size: 13px;
- color: #666;
-}
+ .right-header .title {
+ font-size: 16px;
+ font-weight: 600;
+ }
-.right-toolbar {
- display: flex;
- justify-content: flex-end;
- gap: 10px;
- margin-bottom: 10px;
-}
+ .right-header .desc {
+ font-size: 13px;
+ color: #666;
+ }
-.link-text {
- color: #409eff;
- cursor: default;
-}
+ .right-toolbar {
+ display: flex;
+ justify-content: flex-end;
+ gap: 10px;
+ margin-bottom: 10px;
+ }
-.clickable-link {
- color: #409eff;
- cursor: pointer;
-}
+ .link-text {
+ color: #409eff;
+ cursor: default;
+ }
-.clickable-link:hover {
- text-decoration: underline;
-}
+ .clickable-link {
+ color: #409eff;
+ cursor: pointer;
+ }
-:deep(.row-center td) {
- text-align: center !important;
-}
+ .clickable-link:hover {
+ text-decoration: underline;
+ }
-/* el-table 琛ㄥご/鍐呭缁熶竴灞呬腑锛坮ow-class-name 涓嶄綔鐢ㄤ簬琛ㄥご锛� */
-:deep(.center-table .el-table__header-wrapper th .cell) {
- text-align: center !important;
-}
-:deep(.center-table .el-table__body-wrapper td .cell) {
- text-align: center !important;
-}
+ :deep(.row-center td) {
+ text-align: center !important;
+ }
-/* PIMTable 琛ㄥご灞呬腑 */
-:deep(.lims-table .pim-table-header-cell) {
- text-align: center;
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
-}
+ /* el-table 琛ㄥご/鍐呭缁熶竴灞呬腑锛坮ow-class-name 涓嶄綔鐢ㄤ簬琛ㄥご锛� */
+ :deep(.center-table .el-table__header-wrapper th .cell) {
+ text-align: center !important;
+ }
+ :deep(.center-table .el-table__body-wrapper td .cell) {
+ text-align: center !important;
+ }
-:deep(.lims-table .pim-table-header-title) {
- text-align: center;
- width: 100%;
-}
+ /* PIMTable 琛ㄥご灞呬腑 */
+ :deep(.lims-table .pim-table-header-cell) {
+ text-align: center;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+ }
-:deep(.lims-table .pim-table-header-extra) {
- width: 100%;
- margin-top: 4px;
-}
+ :deep(.lims-table .pim-table-header-title) {
+ text-align: center;
+ width: 100%;
+ }
+
+ :deep(.lims-table .pim-table-header-extra) {
+ width: 100%;
+ margin-top: 4px;
+ }
</style>
--
Gitblit v1.9.3