From 709fa95bc62e339ec74d8d8084b7380a62a8474f Mon Sep 17 00:00:00 2001
From: 小小儁爺 <1694218219@qq.com>
Date: 星期二, 28 四月 2026 17:06:35 +0800
Subject: [PATCH] 1.sop工艺 变成批量绑定
---
src/views/sopManager/sopRoute.vue | 191 +++++++++++++++++++++++++++++++++++++++--------
1 files changed, 158 insertions(+), 33 deletions(-)
diff --git a/src/views/sopManager/sopRoute.vue b/src/views/sopManager/sopRoute.vue
index 8d863cc..a75ea20 100644
--- a/src/views/sopManager/sopRoute.vue
+++ b/src/views/sopManager/sopRoute.vue
@@ -184,14 +184,14 @@
v-el-drag-dialog
title="鏂囦欢涓婁紶"
:visible.sync="dialogVisible"
- width="800px"
+ width="1000px"
:close-on-click-modal="false"
- top="15vh"
+ top="5vh"
@closed="handleClose"
@close="handleClose"
>
<el-form ref="dialogForm" inline :rules="dialogFormRules" :model="dialogForm" label-width="80px">
- <el-form-item label="浜у搧淇℃伅" prop="partcode">
+ <el-form-item label="浜у搧淇℃伅">
<el-button
v-waves
type="primary"
@@ -200,9 +200,12 @@
@click="selectSuitpart"
>閫夋嫨鐗╂枡
</el-button>
- <div v-if="dialogForm.partcode.toString().trim().length>0">
- 宸查�夋嫨{{ dialogForm.partcode }} {{ dialogForm.partname }}
+ <div v-if="multipleSelection.length>0">
+ 宸查�夋嫨{{ multipleSelection.length }}涓墿鏂�
</div>
+ <!-- <div v-if="dialogForm.partcode.toString().trim().length>0">-->
+ <!-- 宸查�夋嫨{{ dialogForm.partcode }} {{ dialogForm.partname }}-->
+ <!-- </div>-->
<!-- <el-select-->
<!-- v-model="dialogForm.partcode"-->
<!-- style="width: 200px"-->
@@ -247,6 +250,7 @@
style="width: 200px"
placeholder="璇烽�夋嫨"
filterable
+ multiple
collapse-tags
:popper-append-to-body="false"
@change="stepcodeChange"
@@ -276,9 +280,6 @@
/>
</el-select>
</el-form-item>
- <el-form-item label="鐗堟湰鍙�">
- <el-input v-model="dialogForm.fileversion" disabled style="width: 200px" />
- </el-form-item>
<el-form-item label="鏂囦欢涓婁紶" prop="Files">
<div style="width: 200px;">
<el-upload
@@ -301,6 +302,60 @@
</el-button>
</el-upload>
</div>
+ </el-form-item>
+ <el-form-item label-width="120" label="瀵瑰簲鐗堟湰鍙�">
+ <el-table
+ :data="versionList"
+ border
+ style="width: 800px"
+ :header-cell-style="this.$headerCellStyle"
+ :cell-style="this.$cellStyle"
+ height="300"
+ >
+ <el-table-column
+ type="index"
+ label="搴忓彿"
+ width="60"
+ align="center"
+ />
+ <el-table-column
+ prop="materielcode"
+ label="鐗╂枡缂栫爜"
+
+ show-tooltip-when-overflow
+ />
+ <el-table-column
+ prop="materielname"
+ label="鐗╂枡鍚嶇О"
+
+ show-tooltip-when-overflow
+ />
+ <el-table-column
+ prop="materielspec"
+ label="瑙勬牸鍨嬪彿"
+
+ show-tooltip-when-overflow
+ />
+ <el-table-column
+ prop="stepcode"
+ label="宸ュ簭缂栫爜"
+ width="100"
+ align="center"
+ />
+ <el-table-column
+ prop="stepname"
+ label="宸ュ簭鍚嶇О"
+ width="100"
+ align="center"
+ />
+ <el-table-column
+ prop="file_version"
+ label="鐗堟湰鍙�"
+ width="100"
+ align="center"
+ />
+ </el-table>
+
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
@@ -419,21 +474,24 @@
highlight-current-row
:header-cell-style="this.$headerCellStyle"
:cell-style="this.$cellStyle"
- row-key="partcode"
- @row-click="rowClick2"
+ :row-key="getRowKey"
+ @select-all="handleSelectionAllChange"
+ @select="handleSelectionChange"
>
-
+ <!-- @row-click="rowClick2"-->
<el-table-column
width="50"
+ type="selection"
+ :reserve-selection="true"
fixed
>
- <template slot-scope="{row}">
- <el-radio
- v-model="dialogForm.partcode"
- :label="row.partcode"
- style="color: transparent;padding-left: 10px;"
- />
- </template>
+ <!-- <template slot-scope="{row}">-->
+ <!-- <el-radio-->
+ <!-- v-model="dialogForm.partcode"-->
+ <!-- :label="row.partcode"-->
+ <!-- style="color: transparent;padding-left: 10px;"-->
+ <!-- />-->
+ <!-- </template>-->
</el-table-column>
<el-table-column
prop="rowNum"
@@ -457,6 +515,15 @@
>
<template slot-scope="{row}">
{{ row.partspec ? row.partspec : '/' }}
+ </template>
+ </el-table-column>
+ <el-table-column
+ prop="is_retdproc"
+ label="鏄惁缁戝畾宸ヨ壓"
+ >
+ <template slot-scope="{row}">
+ <el-tag v-if="row.is_retdproc==='Y'" size="small" type="success">宸茬粦瀹�</el-tag>
+ <el-tag v-else size="small" type="danger">鏈粦瀹�</el-tag>
</template>
</el-table-column>
<el-table-column
@@ -499,7 +566,13 @@
<script>
import Pagination from '@/components/Pagination'
-import { ProcessSopAddSeave, ProcessSopDeleteSeave, ProcessSopSearch, ProcessSopMaxVersion } from '@/api/SopManager'
+import {
+ ProcessSopAddSeave,
+ ProcessSopDeleteSeave,
+ ProcessSopSearch,
+ ProcessSopMaxVersion,
+ ProcessSopPartSelectRpute
+} from '@/api/SopManager'
import waves from '@/directive/waves'
import elDragDialog from '@/directive/el-drag-dialog'
import { PartSelect, TMaterielClassTree, TMaterielData } from '@/api/ProductModel'
@@ -521,8 +594,8 @@
form: {
check: 'N', // 鏄惁閫変腑鏈�楂樼増鏈�
search: '', // 鎼滅储鍏抽敭瀛�
- prop: 'lm_date', // 鎺掑簭瀛楁
- order: 'desc', // 鎺掑簭瀛楁
+ prop: 'materielcode,routecode,stepcode', // 鎺掑簭瀛楁
+ order: 'asc', // 鎺掑簭瀛楁
page: 1, // 绗嚑椤�
rows: 20 // 姣忛〉澶氬皯鏉�
},
@@ -536,7 +609,7 @@
partname: '', //
route: '', // 鐗╂枡缂栫爜
- stepcode: '',
+ stepcode: [],
defilename: '',
filetypecode: '', // 鏂囦欢绫诲瀷缂栫爜
Files: '', // 鏂囦欢
@@ -594,7 +667,9 @@
prop: 'lm_date', // 鎺掑簭瀛楁
order: 'desc' // 鎺掑簭瀛楁
},
- suitobjectTotal: 0
+ suitobjectTotal: 0,
+ multipleSelection: [],
+ versionList: []
}
},
@@ -616,6 +691,20 @@
this.getHeight()
},
methods: {
+ getRowKey(row) {
+ return row.partcode
+ },
+ handleSelectionAllChange(val) {
+ this.multipleSelection = JSON.parse(JSON.stringify(val))
+ },
+ handleSelectionChange(val, row) {
+ const arrAll = JSON.parse(JSON.stringify(val))
+ if (this.multipleSelection.filter((item) => item.partcode === row.partcode).length === 0) {
+ this.multipleSelection = arrAll
+ } else {
+ this.multipleSelection = arrAll.filter((item) => item.partcode !== row.partcode)
+ }
+ },
selectSuitpart() {
this.dialogVisibleSuitobject = true
this.$nextTick(() => {
@@ -640,8 +729,19 @@
},
async dialogVisibleConfirmSuitobject() {
- await this.partcodeChange(this.dialogForm.partcode)
+ const { data: res } = await ProcessSopPartSelectRpute(this.multipleSelection.map(i => i.partcode))
+ // await this.partcodeChange(this.dialogForm.partcode)
+ if (this.mesSetting.route) {
+ this.routeArr = res
+ } else {
+ this.stepcodeArr = res
+ }
+ this.dialogForm.route = ''
+ this.dialogForm.stepcode = []
this.dialogVisibleSuitobject = false
+
+ this.versionList = []
+ // await this.stepcodeChange()
},
rowClick2(row, event, column) {
@@ -743,7 +843,7 @@
this.stepcodeArr = res
}
this.dialogForm.route = ''
- this.dialogForm.stepcode = ''
+ this.dialogForm.stepcode = []
await this.stepcodeChange()
},
async routeChange() {
@@ -753,19 +853,20 @@
}
const { data: res } = await RouteSelectStep(data)
this.stepcodeArr = res
- this.dialogForm.stepcode = ''
+ this.dialogForm.stepcode = []
await this.stepcodeChange()
},
async stepcodeChange() {
- if (this.dialogForm.partcode && this.dialogForm.stepcode && this.dialogForm.filetypecode) {
+ if (this.multipleSelection && this.dialogForm.filetypecode) {
const data = {
- partcode: this.dialogForm.partcode,
+ // partcode: this.dialogForm.partcode,
+ partcode: this.multipleSelection.map(i => i.partcode),
routecode: this.dialogForm.route,
stepcode: this.dialogForm.stepcode,
filetypecode: this.dialogForm.filetypecode
}
const { data: res } = await ProcessSopMaxVersion(data)
- this.dialogForm.fileversion = res
+ this.versionList = res
}
},
@@ -818,8 +919,11 @@
this.dialogForm.fileversion = ''
this.dialogForm.stepcode = ''
this.dialogForm.Files = ''
+ this.multipleSelection = []
+ this.versionList = []
this.$refs.uploadFileRef.clearFiles()
this.$refs.dialogForm.clearValidate()
+ this.$refs.tableDataRef3.clearSelection()
},
// 瀵硅瘽妗嗗彇娑�
dialogVisibleCancel() {
@@ -840,13 +944,34 @@
this.$refs.dialogForm.validate(valid => {
if (valid) {
+ if (this.multipleSelection.length === 0) {
+ return this.$message.info('璇峰厛閫夋嫨浜у搧锛�')
+ }
+
+ // const sopPartVersionList = []
+ // this.versionList.forEach(i => {
+ // sopPartVersionList.push({
+ // PartCode: i.materielcode,
+ // Routecode: this.dialogForm.route,
+ // StepCode: i.stepcode,
+ // Version: i.file_version
+ // })
+ // })
+
const formData = new FormData()
- formData.append('partcode', this.dialogForm.partcode)
- formData.append('routecode', this.dialogForm.route)
- formData.append('stepcode', this.dialogForm.stepcode)
+ this.versionList.forEach((i, index) => {
+ formData.append(`sopPartVersionList[${index}].PartCode`, i.materielcode)
+ formData.append(`sopPartVersionList[${index}].Routecode`, this.dialogForm.route)
+ formData.append(`sopPartVersionList[${index}].StepCode`, i.stepcode)
+ formData.append(`sopPartVersionList[${index}].Version`, i.file_version)
+ })
+ // formData.append('sopPartVersionList', JSON.stringify(sopPartVersionList).toString())
+ // formData.append('partcode', this.dialogForm.partcode)
+ // formData.append('routecode', this.dialogForm.route)
+ // formData.append('stepcode', this.dialogForm.stepcode)
formData.append('filename', this.$refs.uploadFileRef.uploadFiles[0].name)
formData.append('filetypecode', this.dialogForm.filetypecode)
- formData.append('version', this.dialogForm.fileversion)
+ // formData.append('version', this.dialogForm.fileversion)
formData.append('file', this.$refs.uploadFileRef.uploadFiles[0].raw)
// for (var [key, value] of formData) {
// console.log(key, value)
--
Gitblit v1.9.3