From 3032fc5c1b188a820c7546da5b92a6b8d415f23a Mon Sep 17 00:00:00 2001
From: loulijun2021 <1694218219@qq.com>
Date: 星期一, 01 八月 2022 17:08:49 +0800
Subject: [PATCH] 1.综合看板 对接接口实现部分数据渲染
---
src/views/zlgl/gxjy.vue | 120 ++++++++++++++++++++++++++++++++++++++++++++---------------
1 files changed, 89 insertions(+), 31 deletions(-)
diff --git a/src/views/zlgl/gxjy.vue b/src/views/zlgl/gxjy.vue
index 2249042..a62f8b9 100644
--- a/src/views/zlgl/gxjy.vue
+++ b/src/views/zlgl/gxjy.vue
@@ -6,7 +6,7 @@
<i class="el-icon-s-operation" style="color:#42b983; margin-right: 5px" />鎵爜淇℃伅
</div>
<div style="display: flex;align-items: center">
- <div style="width: 90px">鎵弿鏉$爜锛�</div>
+ <div style="width: 90px;display: flex"><div style="color: red;width:10px">*</div>鎵弿鏉$爜锛�</div>
<el-input
v-model="form.orderstepqrcode"
name="GXproduceCode"
@@ -51,7 +51,7 @@
<i class="el-icon-s-operation" style="color:#42b983; margin-right: 5px" />妫�楠屾爣鍑嗕俊鎭�
</div>
<div style="display: flex;align-items: center">
- <div style="width: 90px">妫�楠屾爣鍑嗭細</div>
+ <div style="width: 90px;display: flex"><div style="color: red;width:10px">*</div>妫�楠屾爣鍑嗭細</div>
<el-select
v-model="checkStandard"
style="width: 200px;"
@@ -66,7 +66,7 @@
:value="item.code"
/>
</el-select>
- <div style="width: 90px;margin-left: 50px;">妫�楠屼汉鍛橈細</div>
+ <div style="width: 90px;margin-left: 50px;display: flex"><div style="color: red;width:10px">*</div>妫�楠屼汉鍛橈細</div>
<el-select
v-model="checkUser"
style="width: 200px;"
@@ -98,7 +98,9 @@
highlight-current-row
:header-cell-style="this.$headerCellStyle"
:cell-style="this.$cellStyle"
+ :row-class-name="tableRowClassName"
@selection-change="handleSelectionChange"
+ @cell-dblclick="cellDblclick"
>
<el-table-column
type="index"
@@ -141,9 +143,17 @@
prop="stepcheckitem_desc"
label="妫�楠屾爣鍑嗘弿杩�"
>
- <template slot-scope="{row}">
- <el-input v-if="row.isVisible===1" v-model="row.stepcheckitem_desc" placeholder="璇疯緭鍏�" />
- <div v-else> {{ row.stepcheckitem_desc }}</div>
+ <template slot-scope="scope">
+ <el-input
+ v-if="scope.row.isVisible===1||scope.row.index === tabClickIndex && tabClickLabel === '妫�楠屾爣鍑嗘弿杩�'"
+ v-model="scope.row.stepcheckitem_desc"
+ placeholder="璇疯緭鍏�"
+ @keyup.enter.native="val=>keyUpEnterNative(val,scope.row)"
+ />
+ <div
+ v-else
+ > {{ scope.row.stepcheckitem_desc }}</div>
+
</template>
</el-table-column>
@@ -202,7 +212,7 @@
<div style="display: flex;margin-top: 20px;align-items: center">
<div style="display: flex;margin-right: 50px;align-items: center">
- <div style="width: 90px">妫�楠岀粨鏋滐細</div>
+ <div style="width: 90px;display: flex"><div style="color: red;width:10px">*</div>妫�楠岀粨鏋滐細</div>
<el-select
v-model="checkResult"
style="width: 200px;"
@@ -242,7 +252,6 @@
// const SER_HZ = /^[\u4e00-\u9fa5]+$/
import $ from 'jquery'
import {
- DeleteStepCheckStaned,
MesOrderStepCheckItemList,
MesOrderStepCheckSearch,
MesOrderStepCheckSelect, SaveMesOrderStepCheckItem,
@@ -283,7 +292,10 @@
JYTableData: [], // 妫�楠岄」淇℃伅琛ㄦ牸
JYSelectArr: [], // 妫�楠屼笅鎷夋暟缁�
JYSelectedArr: [], // 宸查�夋楠岄」鐩暟缁�
- multipleSelection: []// 琛ㄦ牸澶氶�夋
+ multipleSelection: [], // 琛ㄦ牸澶氶�夋
+ tabClickIndex: null, // 鐐瑰嚮鐨勫崟鍏冩牸
+ tabClickLabel: '', // 褰撳墠鐐瑰嚮鐨勫垪鍚�
+ isCancel: false// 鏄惁鐐瑰嚮鍙栨秷鎸夐挳
}
},
created() {
@@ -321,6 +333,7 @@
},
// 妫�楠屾爣鍑嗕笅鎷夊�兼敼鍙�
async changeCheckStandard(val) {
+ this.isCancel = false
this.JYSelectedArr = []
const { data: res } = await MesOrderStepCheckItemList({ checkstandcode: val })
this.JYTableData = res
@@ -330,12 +343,13 @@
number = number === 0 ? (10 + Math.random()) : number
// item.result = 0 // 0鍚堟牸 1涓嶈壇
- item.result = 'NG'
+ item.result = 'OK'
item.isVisible = 0
item.number = number
this.JYSelectedArr.push(item.code)
})
+ this.$refs.multipleTable.toggleAllSelection()
},
// changeRadioValue(val, row) {
// console.log(val, row.result, 20000)
@@ -354,13 +368,13 @@
it.result = 'NG'
}
})
- if (this.multipleSelection.length > 0) {
- if (this.multipleSelection.length === this.JYTableData.length) {
- this.checkResult = 'OK'
- } else {
- this.checkResult = 'NG'
- }
+
+ if (this.multipleSelection.length > 0 && this.multipleSelection.length === this.JYTableData.length) {
+ this.checkResult = 'OK'
} else {
+ this.checkResult = 'NG'
+ }
+ if (this.isCancel) {
this.checkResult = ''
}
},
@@ -390,8 +404,9 @@
let number = Math.random() * Math.random()// 浣滀负鍒犻櫎鏃剁殑鏍囪瘑绗�
number = number === 0 ? (10 + Math.random()) : number
- const data = { result: 'NG', code: '', name: '', stepcheckitem_desc: '', isVisible: 1, number }
+ const data = { result: 'OK', code: '', name: '', stepcheckitem_desc: '', isVisible: 1, number }
this.JYTableData.push(data)
+ this.$refs.multipleTable.toggleRowSelection(data, true)
},
// 纭
@@ -415,14 +430,10 @@
}
})
- if (this.multipleSelection.length > 0) {
- if (this.multipleSelection.length === this.JYTableData.length) {
- this.checkResult = 'OK'
- } else {
- this.checkResult = 'NG'
- }
+ if (this.multipleSelection.length > 0 && this.multipleSelection.length === this.JYTableData.length) {
+ this.checkResult = 'OK'
} else {
- this.checkResult = ''
+ this.checkResult = 'NG'
}
},
// 鍙栨秷
@@ -439,6 +450,7 @@
}
})
},
+
// 鍒犻櫎
del(row) {
this.JYTableData.forEach((item, index) => {
@@ -455,8 +467,23 @@
},
// 鎻愪氦
submitButton(val) {
- console.log(val)
if (val !== 'Cancel') {
+ if (this.form.orderstepqrcode.length < 1) {
+ return this.$message.info('鎵弿鏉$爜涓嶈兘涓虹┖锛�')
+ }
+ if (this.checkStandard.length < 1) {
+ return this.$message.info('妫�楠屾爣鍑嗕笉鑳戒负绌猴紒')
+ }
+ if (this.checkUser.length < 1) {
+ return this.$message.info('妫�楠屼汉鍛樹笉鑳戒负绌猴紒')
+ }
+ if (this.JYTableData.length < 1) {
+ return this.$message.info('妫�楠岄」淇℃伅涓嶈兘涓虹┖锛�')
+ }
+ if (this.checkResult.length < 1) {
+ return this.$message.info('妫�楠岀粨鏋滀笉鑳戒负绌猴紒')
+ }
+
const text = val === 'FirstCheck' ? '棣栨淇濆瓨' : (val === 'PatroCheck' ? '宸℃淇濆瓨' : '瀹屽伐妫�淇濆瓨')
this.$confirm('鏄惁纭' + text + '?', '鎻愮ず', {
confirmButtonText: '纭畾',
@@ -484,12 +511,13 @@
'checkdescr': this.checkdescr, // 妫�楠屾弿杩�
'data': arr
}
- const res = SaveMesOrderStepCheckItem(data)
- if (res.code === '200') {
- this.$message.success(text + '鎴愬姛锛�')
- this.clearContent()
- this.getFocus()
- }
+ SaveMesOrderStepCheckItem(data).then(res => {
+ if (res.code === '200') {
+ this.$message.success(text + '鎴愬姛锛�')
+ this.clearContent()
+ this.getFocus()
+ }
+ })
}).catch(() => {
this.$message.info('宸插彇娑堜繚瀛�')
})
@@ -502,6 +530,7 @@
clearContent() {
this.JYTableData = []
this.multipleSelection = []
+ this.JYSelectedArr = []
this.checkdescr = ''
this.checkUser = ''
this.checkResult = ''
@@ -513,6 +542,35 @@
this.form.partspec = ''
this.form.stepcode = ''
this.form.stepname = ''
+
+ this.isCancel = true
+ },
+
+ // 鍗曞厓鏍艰鐐瑰嚮鏃�
+ cellDblclick(row, column, cell, event) {
+ console.log(row, column, cell, event)
+ console.log(column.label)
+ console.log(row.index)
+ switch (column.label) {
+ case '妫�楠屾爣鍑嗘弿杩�':
+ this.tabClickIndex = row.index
+ this.tabClickLabel = column.label
+ break
+ // case '鍒よ矗閲戦(鍏�)':
+ // this.tabClickIndex = row.index
+ // this.tabClickLabel = column.label
+ // break
+ default: return
+ }
+ },
+ // 鍥炶溅浜嬩欢
+ keyUpEnterNative(val, row) {
+ this.tabClickLabel = ''
+ },
+
+ tableRowClassName({ row, rowIndex }) {
+ // 鎶婃瘡涓�琛岀殑绱㈠紩鏀捐繘row
+ row.index = rowIndex
},
// 鑾峰彇椤甸潰楂樺害
getHeight() {
--
Gitblit v1.9.3