From 92f2177d06cc67b2055bac0331a85780a086df0b Mon Sep 17 00:00:00 2001
From: liding <756868258@qq.com>
Date: 星期日, 20 九月 2026 19:51:47 +0800
Subject: [PATCH] feat(order): 优化订单管理功能并增加设备绑定支持 - 修改生产日期字段支持清除和显示默认值 - 在标准库中增加设备绑定功能,支持模板与设备关联 - 新增价格字段用于检验项目定价管理 - 增强模板绑定界面,支持多选和设备分配操作
---
src/views/standard/standardLibrary/index.vue | 59 ++++++++++++++++++++++++++++++++++++++++++++++-------------
1 files changed, 46 insertions(+), 13 deletions(-)
diff --git a/src/views/standard/standardLibrary/index.vue b/src/views/standard/standardLibrary/index.vue
index a800e11..464bb37 100644
--- a/src/views/standard/standardLibrary/index.vue
+++ b/src/views/standard/standardLibrary/index.vue
@@ -48,9 +48,21 @@
<p v-if="!templateBindings.length" class="binding-tip">璇蜂负褰撳墠鏍囧噯缁戝畾鍘熷璁板綍妯℃澘銆�</p>
<el-table :data="templateBindings" border size="small">
<el-table-column type="index" label="椤哄簭" width="70" /><el-table-column label="妯℃澘缂栧彿" prop="number" width="180" /><el-table-column label="妯℃澘鍚嶇О" prop="name" /><el-table-column label="妫�娴嬩緷鎹紙妯℃澘澶囨敞锛�" prop="remark" />
+ <el-table-column label="璁惧缁戝畾" min-width="360">
+ <template slot-scope="scope">
+ <el-select v-model="scope.row.deviceIds"
+ :disabled="!checkPermi(['standard:standardLibrary:upStandardProduct'])"
+ multiple filterable clearable size="small"
+ placeholder="璇烽�夋嫨璇ユā鏉跨殑榛樿璁惧" style="width:100%">
+ <el-option v-for="device in deviceOptions" :key="device.id"
+ :label="device.label" :value="device.id" />
+ </el-select>
+ </template>
+ </el-table-column>
<el-table-column v-if="checkPermi(['standard:standardLibrary:upStandardProduct'])" label="鎿嶄綔" width="150"><template slot-scope="scope"><el-button type="text" :disabled="scope.$index === 0" @click="moveBinding(scope.$index, -1)">涓婄Щ</el-button><el-button type="text" :disabled="scope.$index === templateBindings.length - 1" @click="moveBinding(scope.$index, 1)">涓嬬Щ</el-button><el-button type="text" @click="removeBinding(scope.$index)">绉婚櫎</el-button></template></el-table-column>
</el-table>
- <el-select v-if="checkPermi(['standard:standardLibrary:upStandardProduct'])" v-model="templateToBind" filterable placeholder="閫夋嫨鍘熷璁板綍妯℃澘" size="small" style="width:320px;margin-top:16px" @change="addBinding"><el-option v-for="template in templateList.filter(item => !templateBindings.some(binding => binding.templateId === item.id))" :key="template.id" :label="template.number ? template.number + ' - ' + template.name : template.name" :value="template.id" /></el-select>
+ <el-select v-if="checkPermi(['standard:standardLibrary:upStandardProduct'])" v-model="templateToBind" multiple filterable placeholder="閫夋嫨鍘熷璁板綍妯℃澘" size="small" style="width:320px;margin-top:16px"><el-option v-for="template in templateList.filter(item => !templateBindings.some(binding => binding.templateId === item.id))" :key="template.id" :label="template.number ? template.number + ' - ' + template.name : template.name" :value="template.id" /></el-select>
+ <el-button v-if="checkPermi(['standard:standardLibrary:upStandardProduct'])" type="primary" size="small" style="margin-top:16px;margin-left:8px" @click="confirmAddBindings">纭</el-button>
</el-card>
<el-empty v-else description="璇烽�夋嫨浜岀骇鏍囧噯锛岀淮鎶ゅ叾鍘熷璁板綍妯℃澘" />
<div v-if="false">
@@ -322,6 +334,7 @@
getStandardTemplate,
selectTemplateBindings,
saveTemplateBindings,
+ searchDevices,
} from "@/api/standard/standardLibrary";
import bindSupplierDensityDialogAsk from "./components/bindSupplierDensityDialogAsk.vue";
import BatchCopy from "./components/BatchCopy.vue";
@@ -393,7 +406,8 @@
sectionList: [],
templateList: [],
templateBindings: [],
- templateToBind: null,
+ templateToBind: [],
+ deviceOptions: [],
total: 0,
currentPage: 1,
standardId: 0,
@@ -419,6 +433,7 @@
this.selectEnumByCategoryForSonLaboratory();
this.selectEnumByCategoryForsampleType();
this.getStandardTemplate();
+ this.loadDeviceOptions();
this.selectStandardMethodsSec();
this.token = {
token: sessionStorage.getItem("token"),
@@ -977,18 +992,32 @@
this.templateList = res.data;
});
},
- loadTemplateBindings(standardTreeId) {
- selectTemplateBindings({ standardTreeId }).then((res) => {
- this.templateBindings = res.data || [];
- this.templateToBind = null;
+ loadDeviceOptions() {
+ searchDevices({ status: 0 }).then((res) => {
+ this.deviceOptions = (res.data || []).map((device) => ({
+ id: device.id,
+ label: `${device.deviceName}--${device.managementNumber}`,
+ }));
});
},
- addBinding(templateId) {
- const template = this.templateList.find((item) => item.id === templateId);
- if (template && !this.templateBindings.some((item) => item.templateId === templateId)) {
- this.templateBindings.push({ ...template, templateId, sort: this.templateBindings.length });
- }
- this.templateToBind = null;
+ loadTemplateBindings(standardTreeId) {
+ selectTemplateBindings({ standardTreeId }).then((res) => {
+ this.templateBindings = (res.data || []).map((item) => ({
+ ...item,
+ deviceIds: Array.isArray(item.deviceIds) ? [...item.deviceIds] : [],
+ }));
+ this.templateToBind = [];
+ });
+ },
+ confirmAddBindings() {
+ const selectedIds = Array.isArray(this.templateToBind) ? this.templateToBind : [];
+ selectedIds.forEach((templateId) => {
+ const template = this.templateList.find((item) => item.id === templateId);
+ if (template && !this.templateBindings.some((item) => item.templateId === templateId)) {
+ this.templateBindings.push({ ...template, templateId, sort: this.templateBindings.length, deviceIds: [] });
+ }
+ });
+ this.templateToBind = [];
},
removeBinding(index) {
this.templateBindings.splice(index, 1);
@@ -1000,7 +1029,11 @@
},
saveBindings() {
saveTemplateBindings({ standardTreeId: this.selected.id,
- templates: this.templateBindings.map((item, index) => ({ templateId: item.templateId, sort: index }))
+ templates: this.templateBindings.map((item, index) => ({
+ templateId: item.templateId,
+ sort: index,
+ deviceIds: Array.isArray(item.deviceIds) ? [...item.deviceIds] : [],
+ }))
}).then(() => {
this.$message.success("妯℃澘缁戝畾宸蹭繚瀛�");
this.loadTemplateBindings(this.selected.id);
--
Gitblit v1.9.3