From d9493eb7905545e5509689eae73a450c576418e0 Mon Sep 17 00:00:00 2001
From: loulijun2021 <1694218219@qq.com>
Date: 星期五, 26 八月 2022 17:16:02 +0800
Subject: [PATCH] 1.修改bug2.新增工序检验记录
---
src/views/zlgl/gxjy.vue | 206 +++++++++++++++++++++++++++++++++++----------------
1 files changed, 141 insertions(+), 65 deletions(-)
diff --git a/src/views/zlgl/gxjy.vue b/src/views/zlgl/gxjy.vue
index 153339e..e5ef964 100644
--- a/src/views/zlgl/gxjy.vue
+++ b/src/views/zlgl/gxjy.vue
@@ -124,7 +124,42 @@
:value="item.usercode"
/>
</el-select>
+ <div style="width: 90px;margin-left: 50px;display: flex">
+ <div style="color: red;width:10px">*</div>
+ 妫�楠屾暟閲忥細
+ </div>
+ <el-input v-model="checkCount" oninput="value=value.replace(/[^0-9]/g,'')" style="width: 200px" />
</div>
+
+ <!-- 妫�楠岀粨鏋� 鍜� 妫�楠屽娉� -->
+ <div style="display: flex;margin-top: 20px;align-items: center">
+
+ <div style="display: flex;margin-right: 50px;align-items: center">
+ <div style="width: 90px;display: flex">
+ <div style="color: red;width:10px">*</div>
+ 妫�楠岀粨鏋滐細
+ </div>
+ <el-select
+ v-model="checkResult"
+ style="width: 200px;"
+ placeholder="璇烽�夋嫨"
+ filterable
+ >
+ <el-option
+ v-for="item in checkResultSelect"
+ :key="item.code"
+ :label="item.name"
+ :value="item.code"
+ />
+ </el-select>
+ </div>
+ <div style="display: flex;align-items: center">
+ <div style="width: 90px">妫�楠屽娉細</div>
+ <el-input v-model="checkdescr" style="width: 540px" placeholder="璇疯緭鍏�" />
+ </div>
+
+ </div>
+
<div style="margin: 15px 0;font-size: 14px">
<i class="el-icon-s-operation" style="color:#42b983; margin-right: 5px" />妫�楠岄」淇℃伅
</div>
@@ -151,38 +186,80 @@
width="100"
fixed
/>
+
<!-- <el-table-column-->
<!-- prop="code"-->
- <!-- label="妫�楠岄」鐩紪鐮�"-->
- <!-- sortable="custom"-->
- <!-- />-->
+ <!-- label="妫�楠岄」鐩紪鐮�(鍚嶇О)"-->
+ <!-- >-->
+ <!-- <template slot-scope="{row}">-->
+ <!-- <div v-if="row.isVisible===0" style="display: flex;">-->
+ <!-- <div>{{ row.code }}</div>-->
+ <!-- <div style="margin-left: 10px">{{ row.name }}</div>-->
+ <!-- </div>-->
+
+ <!-- <el-select-->
+ <!-- v-if="row.isVisible===1"-->
+ <!-- v-model="row.code"-->
+ <!-- filterable-->
+ <!-- style="width: 400px;"-->
+ <!-- placeholder="璇烽�夋嫨"-->
+ <!-- @change="val=>changeCode(val,row)"-->
+ <!-- >-->
+ <!-- <el-option-->
+ <!-- v-for="item in JYSelectArr"-->
+ <!-- :key="item.code"-->
+ <!-- :label="item.code+''+item.name"-->
+ <!-- :value="item.code"-->
+ <!-- />-->
+ <!-- </el-select>-->
+ <!-- </template>-->
+ <!-- </el-table-column>-->
+
<el-table-column
prop="code"
- label="妫�楠岄」鐩紪鐮�(鍚嶇О)"
+ label="妫�楠屾爣鍑嗙紪鐮�"
>
<template slot-scope="{row}">
- <div v-if="row.isVisible===0" style="display: flex;">
- <div>{{ row.code }}</div>
- <div style="margin-left: 10px">{{ row.name }}</div>
- </div>
-
+ <div v-if="row.isVisible===0">{{ row.code }}</div>
<el-select
v-if="row.isVisible===1"
v-model="row.code"
- filterable
- style="width: 400px;"
+ style="width: 200px;"
placeholder="璇烽�夋嫨"
- @change="val=>changeCode(val,row)"
+ @change="val=>changeName(val,row)"
+ >
+ <el-option
+ v-for="item in JYSelectArr"
+ :key="item.name"
+ :label="item.code"
+ :value="item.name"
+ />
+ </el-select>
+ </template>
+ </el-table-column>
+ <el-table-column
+ prop="name"
+ label="妫�楠屾爣鍑嗗悕绉�"
+ >
+ <template slot-scope="{row}">
+ <div v-if="row.isVisible===0">{{ row.name }}</div>
+ <el-select
+ v-if="row.isVisible===1"
+ v-model="row.name"
+ style="width: 200px;"
+ placeholder="璇烽�夋嫨"
+ @change="val=>changeName(val,row)"
>
<el-option
v-for="item in JYSelectArr"
:key="item.code"
- :label="item.code+''+item.name"
+ :label="item.name"
:value="item.code"
/>
</el-select>
</template>
</el-table-column>
+
<el-table-column
prop="stepcheckitem_desc"
label="妫�楠屾爣鍑嗘弿杩�"
@@ -242,6 +319,7 @@
<el-table-column
label="鎿嶄綔"
+ fixed="right"
>
<template slot-scope="{row}">
<div class="operationClass">
@@ -252,34 +330,6 @@
</template>
</el-table-column>
</el-table>
- </div>
- <!-- 妫�楠岀粨鏋� 鍜� 妫�楠屽娉� -->
- <div style="display: flex;margin-top: 20px;align-items: center">
-
- <div style="display: flex;margin-right: 50px;align-items: center">
- <div style="width: 90px;display: flex">
- <div style="color: red;width:10px">*</div>
- 妫�楠岀粨鏋滐細
- </div>
- <el-select
- v-model="checkResult"
- style="width: 200px;"
- placeholder="璇烽�夋嫨"
- filterable
- >
- <el-option
- v-for="item in checkResultSelect"
- :key="item.code"
- :label="item.name"
- :value="item.code"
- />
- </el-select>
- </div>
- <div style="display: flex;align-items: center">
- <div style="width: 90px">妫�楠屽娉細</div>
- <el-input v-model="checkdescr" style="width: 300px" placeholder="璇疯緭鍏�" />
- </div>
-
</div>
<div style="display: flex;margin: 30px 0;align-items: center">
@@ -330,6 +380,7 @@
checkStandard: '', // 妫�楠屾爣鍑�
checkStandardSelect: [], // 妫�楠屾爣鍑嗕笅鎷夋暟缁�
checkUser: '', // 妫�楠屼汉鍛�
+ checkCount: 0, // 妫�楠屾暟閲�
checkUserSelect: [], // 妫�楠屼汉鍛樹笅鎷夋暟缁�
checkResult: '', // 妫�楠岀粨鏋�
checkResultSelect: [
@@ -340,7 +391,8 @@
JYTableData: [], // 妫�楠岄」淇℃伅琛ㄦ牸
JYSelectArr: [], // 妫�楠屼笅鎷夋暟缁�
- JYSelectedArr: [], // 宸查�夋楠岄」鐩暟缁�
+ // JYSelectedArr: [], // 宸查�夋楠岄」鐩暟缁�
+ JYIsCancel: true,
multipleSelection: [], // 琛ㄦ牸澶氶�夋
tabClickIndex: null, // 鐐瑰嚮鐨勫崟鍏冩牸
tabClickLabel: '', // 褰撳墠鐐瑰嚮鐨勫垪鍚�
@@ -390,10 +442,14 @@
},
// 妫�楠屾爣鍑嗕笅鎷夊�兼敼鍙�
async changeCheckStandard(val) {
+ await this.getJYSelectArr()
this.isCancel = false
- this.JYSelectedArr = []
+
const { data: res } = await MesOrderStepCheckItemList({ checkstandcode: val })
this.JYTableData = res
+
+ // let arr = [鈥].filter(x => [鈥].every(y => y.id !== x.id));
+ this.JYSelectArr = [...this.JYSelectArr].filter(x => [...this.JYTableData].every(y => y.code !== x.code))
this.JYTableData.forEach(item => {
let number = Math.random() * Math.random()// 浣滀负鍒犻櫎鏃剁殑鏍囪瘑绗�
@@ -404,7 +460,6 @@
item.isVisible = 0
item.number = number
- this.JYSelectedArr.push(item.code)
})
this.$refs.multipleTable.toggleAllSelection()
},
@@ -436,9 +491,13 @@
}
},
// 妫�楠岄」鐩紪鐮侊紙鍚嶇О锛�
- changeCode(val, row) {
- row.stepcheckitem_desc = this.JYSelectArr.find(it => it.code === val).descr
- row.name = this.JYSelectArr.find(it => it.code === val).name
+ changeName(val, row) {
+ const res = this.JYSelectArr.find(item => {
+ return item.code === val || item.name === val
+ })
+ row.code = res.code
+ row.name = res.name
+ row.stepcheckitem_desc = res.descr
},
// 鎵爜閿洏鍥炶溅浜嬩欢
async enterNative(val, belong) {
@@ -455,6 +514,9 @@
// 鏂板
add() {
+ if (this.JYTableData.length === 0) {
+ return this.$message.info('璇峰厛閫夋嫨妫�楠屾爣鍑嗭紒')
+ }
if (this.JYTableData.length > 0 && this.JYTableData[this.JYTableData.length - 1].isVisible === 1) {
return this.$message.info('璇峰厛纭畾鎴栧彇娑堟湰鏉¤褰曪紒')
}
@@ -464,19 +526,25 @@
const data = { result: 'OK', code: '', name: '', stepcheckitem_desc: '', isVisible: 1, number }
this.JYTableData.push(data)
this.$refs.multipleTable.toggleRowSelection(data, true)
+
+ this.JYIsCancel = false
},
// 纭
confirm(row) {
if (row.code === '') {
- return this.$message.info('妫�楠岄」鐩紪鐮�(鍚嶇О)涓嶈兘涓虹┖锛�')
+ return this.$message.info('妫�楠岄」鐩紪鐮佷笉鑳戒负绌猴紒')
+ }
+ if (row.name === '') {
+ return this.$message.info('妫�楠岄」鐩悕绉颁笉鑳戒负绌猴紒')
}
- if (this.JYSelectedArr.find(item => item === row.code) !== undefined) {
- return this.$message.info('妫�楠岄」鐩紪鐮�(鍚嶇О)涓嶈兘閲嶅锛�')
- } else {
- this.JYSelectedArr.push(row.code)
- }
+ this.JYSelectArr.forEach((item, index) => {
+ if (item.code === row.code) {
+ this.JYSelectArr.splice(index, 1)
+ }
+ })
+
this.JYTableData.forEach((item, index) => {
if (item.number === row.number) {
item.isVisible = 0
@@ -501,24 +569,27 @@
}
})
- this.JYSelectedArr.forEach((item, index) => {
- if (item === row.code) {
- this.JYSelectedArr.splice(index, 1)
- }
- })
+ if (this.JYIsCancel && row.code.toString().length > 0) {
+ this.JYSelectArr.splice(0, 0, {
+ code: row.code,
+ name: row.name,
+ descr: row.stepcheckitem_desc
+ })
+ }
+ this.JYIsCancel = true
},
// 鍒犻櫎
del(row) {
+ this.JYSelectArr.splice(0, 0, {
+ code: row.code,
+ name: row.name,
+ descr: row.stepcheckitem_desc
+ })
+
this.JYTableData.forEach((item, index) => {
if (item.number === row.number) {
this.JYTableData.splice(index, 1)
- }
- })
-
- this.JYSelectedArr.forEach((item, index) => {
- if (item === row.code) {
- this.JYSelectedArr.splice(index, 1)
}
})
},
@@ -533,6 +604,9 @@
}
if (this.checkUser.length < 1) {
return this.$message.info('妫�楠屼汉鍛樹笉鑳戒负绌猴紒')
+ }
+ if (parseFloat(this.checkCount) > 0) {
+ return this.$message.info('妫�楠屾暟閲忓繀椤昏澶т簬闆讹紒')
}
if (this.JYTableData.length < 1) {
return this.$message.info('妫�楠岄」淇℃伅涓嶈兘涓虹┖锛�')
@@ -573,6 +647,7 @@
this.$message.success(text + '鎴愬姛锛�')
this.clearContent()
this.getFocus()
+ this.getJYSelectArr()
}
})
}).catch(() => {
@@ -581,15 +656,16 @@
} else {
this.clearContent()
this.getFocus()
+ this.getJYSelectArr()
}
},
// 娓呯┖椤甸潰鍐呭
clearContent() {
this.JYTableData = []
this.multipleSelection = []
- this.JYSelectedArr = []
this.checkdescr = ''
this.checkUser = ''
+ this.checkCount = 0
this.checkResult = ''
this.checkStandard = ''
this.form.orderstepqrcode = ''
--
Gitblit v1.9.3