From cf9cde2c639572108a926ec8136cd7941198304f Mon Sep 17 00:00:00 2001
From: loulijun2021 <1694218219@qq.com>
Date: 星期一, 29 八月 2022 17:24:48 +0800
Subject: [PATCH] 1.完成点检标准增删查改,关联设备的开发
---
src/views/sbgl/djbw.vue | 2
src/views/scgl/gd.vue | 4
src/views/sbgl/djbz.vue | 243 ++++++++++++++++++++++++++++++++++++++++++++----
src/views/sbgl/bybw.vue | 41 +-------
4 files changed, 231 insertions(+), 59 deletions(-)
diff --git a/src/views/sbgl/bybw.vue b/src/views/sbgl/bybw.vue
index 682e563..ddff0d5 100644
--- a/src/views/sbgl/bybw.vue
+++ b/src/views/sbgl/bybw.vue
@@ -34,16 +34,7 @@
/>
</el-select>
</el-form-item>
- <el-form-item label="鐐规鍛ㄦ湡" style=" display: flex;">
- <el-select v-model="form.cycle" style="width: 200px" placeholder="璇烽�夋嫨">
- <el-option
- v-for="item in cycleArr"
- :key="item.code"
- :label="item.name"
- :value="item.code"
- />
- </el-select>
- </el-form-item>
+
</div>
<div style="display: flex;align-items: start;margin-top: 5px;z-index: 2">
<el-button type="primary" icon="el-icon-search" @click="search">鏌ヨ</el-button>
@@ -94,11 +85,6 @@
sortable="custom"
/>
<el-table-column
- prop="parentorg_name"
- label="鐐规鍛ㄦ湡"
- sortable="custom"
- />
- <el-table-column
prop="lm_user"
label="鍒涘缓浜哄憳"
sortable="custom"
@@ -111,6 +97,8 @@
/>
<el-table-column
label="鎿嶄綔"
+ width="120"
+ fixed="right"
>
<template slot-scope="{row}">
<div class="operationClass">
@@ -153,21 +141,7 @@
<el-form-item label="閮ㄤ綅鍚嶇О" prop="OrgName">
<el-input v-model="dialogForm.OrgName" style="width: 200px" />
</el-form-item>
- <el-form-item prop="SupUnit" label="淇濆吇鍛ㄦ湡">
- <el-select
- v-model="dialogForm.SupUnit"
- style="width: 200px"
- placeholder="璇烽�夋嫨"
- :popper-append-to-body="false"
- >
- <el-option
- v-for="item in SupUnitArr"
- :key="item.code"
- :label="item.name"
- :value="item.code"
- />
- </el-select>
- </el-form-item>
+
<el-form-item prop="SupUnit" label="閫夋嫨鎵爜">
<el-select
v-model="dialogForm.SupUnit"
@@ -241,17 +215,14 @@
checkitemname: '', // 閮ㄤ綅鍚嶇О
maidescr: '', // 淇濆吇瑕佹眰
isqrcode: '', // 閫変腑鎵爜
- cycle: '', // 鐐规鍛ㄦ湡
prop: 'lm_date', // 鎺掑簭瀛楁
order: 'desc', // 鎺掑簭瀛楁
page: 1, // 绗嚑椤�
rows: 20 // 姣忛〉澶氬皯鏉�
},
isqrcodeArr: [
-
- ],
- cycleArr: [
-
+ { code: 'Y', name: '鏄�' },
+ { code: 'N', name: '鍚�' }
],
total: 10,
diff --git a/src/views/sbgl/djbw.vue b/src/views/sbgl/djbw.vue
index d67d3e7..77b6130 100644
--- a/src/views/sbgl/djbw.vue
+++ b/src/views/sbgl/djbw.vue
@@ -334,7 +334,7 @@
reset() {
this.form.checkitemcode = ''
this.form.checkitemname = ''
- this.form.checkitemdescr = ''
+ this.form.checkdescr = ''
this.form.isqrcode = ''
this.form.cycle = ''
this.getDeviceCheckItemSearch()
diff --git a/src/views/sbgl/djbz.vue b/src/views/sbgl/djbz.vue
index 4ab6079..2dc802b 100644
--- a/src/views/sbgl/djbz.vue
+++ b/src/views/sbgl/djbz.vue
@@ -75,7 +75,13 @@
prop="description"
label="鏍囧噯鎻忚堪"
sortable="custom"
- />
+ show-tooltip-when-overflow
+ >
+ <template slot-scope="{row}">
+ <div v-if="row.description">{{ row.description }}</div>
+ <div v-else>/</div>
+ </template>
+ </el-table-column>
<el-table-column
prop="iscontr"
label="鐐规绠℃帶"
@@ -168,7 +174,7 @@
<el-form-item label="鏍囧噯鍚嶇О" prop="name">
<el-input v-model="dialogForm.name" style="width: 200px" />
</el-form-item>
- <el-form-item prop="SupUnit" label="鐐规绠℃帶">
+ <el-form-item required label="鐐规绠℃帶">
<el-select
v-model="dialogForm.enable"
style="width: 200px"
@@ -350,6 +356,7 @@
<i class="el-icon-s-operation" style="color:#42b983;" /> 璁惧鎵�灞炶溅闂撮泦鍚堬細
</div>
<div class="myCheckboxGroup">
+
<div
v-for="item in dialogFormEqp.eqpArr"
:key="item.code"
@@ -373,10 +380,10 @@
<el-divider />
<div>
<div style="margin-bottom:20px">
- <i class="el-icon-s-operation" style="color:#42b983;" /> 瑙掕壊锛�
+ <i class="el-icon-s-operation" style="color:#42b983;" /> 璁惧淇℃伅锛�
</div>
<el-tree
- ref="roleTree"
+ ref="epqTree"
:data="dialogFormEqp.eqpTree"
show-checkbox
node-key="code"
@@ -417,9 +424,10 @@
import {
AddUpdateDeviceCheckStandArd, DeleteDeviceCheckStaned,
DeviceCheckItemSelect,
- DeviceCheckStandArdSearch,
+ DeviceCheckStandArdSearch, DeviceCheckStanedAssociationEqp, SaveDeviceCheckStanedAssociationEqp,
ViewDeviceCheckStanedSearch
} from '@/api/sbgl'
+import $ from 'jquery'
const SER_HZ = /^[\u4e00-\u9fa5]+$/
export default {
@@ -495,8 +503,11 @@
dialogFormEqp: {
name: '',
- eqpArr: [],
- eqpTree: []
+ code: '',
+ eqpAll: [], // 杞﹂棿鍙婅澶囨墍鏈�
+ eqpArr: [], // 杞﹂棿闆嗗悎鎵�鏈�
+ eqpTree: [], // 璁惧鏍戝舰鎵�鏈�
+ eqpCodeSelectedArr: []// 璁惧鏍戝舰閫変腑
},
defaultPropsOfEqpTree: {
value: 'code',
@@ -528,7 +539,6 @@
},
methods: {
async getDeviceCheckStandArdSearch() {
- console.log(this.form, 11)
const res = await DeviceCheckStandArdSearch(this.form)
this.tableData = res.data
this.total = res.count
@@ -668,7 +678,7 @@
Data.forEach((item, index) => {
item.checkitem_seq = index + 1
})
- console.log(Data, 999)
+
const data = {
'code': this.dialogForm.code,
'name': this.dialogForm.name,
@@ -676,7 +686,7 @@
'description': this.dialogForm.description,
'Data': Data
}
- console.log(data, 111)
+
AddUpdateDeviceCheckStandArd(data, this.operation === 'add' ? 'Add' : 'Update').then(res => {
if (res.code === '200') {
this.$message.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�')
@@ -753,7 +763,6 @@
})
},
delRow(row) {
- console.log(row)
this.checkItemSelectArr.splice(0, 0, {
code: row.checkitem_code,
name: row.checkitem_name,
@@ -808,28 +817,220 @@
return 'custom-row'
},
// 鍏宠仈璁惧
- checkeqpClick(row) {
- this.dialogVisibleEqp = true
- },
- handleCloseEqp() {
+ async checkeqpClick(row) {
+ this.dialogFormEqp.name = row.name
+ this.dialogFormEqp.code = row.code
+ const { data: res } = await DeviceCheckStanedAssociationEqp({ checkstand_code: row.code })
+ this.dialogFormEqp.eqpAll = res
+
+ if (this.dialogFormEqp.eqpAll.length > 0) {
+ this.dialogFormEqp.eqpAll.forEach((item, index) => {
+ this.dialogFormEqp.eqpArr.push({
+ code: item.code,
+ name: item.name,
+ type: item.type,
+ isSelected1: index === 0,
+ isSelected2: item.flag === 'Y'
+ })
+ if (item.flag === 'Y') {
+ this.$nextTick(() => {
+ $('input:checkbox').eq(index).prop('checked', true)// 鑷畾涔夊崟閫夋鍥炴樉
+ })
+ }
+ if (item.children && item.children.length > 0) {
+ item.children.forEach(it => {
+ if (it.flag === 'Y') {
+ this.dialogFormEqp.eqpCodeSelectedArr.push(it.code)
+ }
+ })
+ }
+ })
+ this.dialogFormEqp.eqpAll[0].name = '鍏ㄩ儴'
+ this.dialogFormEqp.eqpTree = [this.dialogFormEqp.eqpAll[0]]
+ }
+
+ this.dialogVisibleEqp = true
+
+ this.$nextTick(() => { // 鏍戝舰鍥炴樉
+ this.$refs.epqTree.setCheckedKeys(this.dialogFormEqp.eqpCodeSelectedArr)
+ })
+ },
+ // 鍏宠仈璁惧瀵硅瘽妗嗗叧闂�
+ handleCloseEqp() {
+ this.$refs.epqTree.setCheckedKeys([])
+ this.dialogFormEqp.code = ''
+ this.dialogFormEqp.name = ''
+ this.dialogFormEqp.eqpAll = []
+ this.dialogFormEqp.eqpArr = []
+ this.dialogFormEqp.eqpTree = []
+ this.dialogFormEqp.eqpCodeSelectedArr = []
},
// 澶х洅瀛愮偣鍑�
- myCheckboxClick() {
-
+ myCheckboxClick(val) {
+ this.dialogFormEqp.eqpArr.forEach((item, index) => {
+ item.isSelected1 = item.code === val.code
+ if (item.code === val.code) {
+ this.dialogFormEqp.eqpAll[index].name = '鍏ㄩ儴'
+ this.dialogFormEqp.eqpTree = [this.dialogFormEqp.eqpAll[index]]
+ }
+ })
},
// 灏忕洅瀛愮偣鍑�
- myCheckboxInputClick() {
-
+ myCheckboxInputClick(val) {
+ console.log(val)
+ val.isSelected2 = !val.isSelected2
+ if (val.isSelected2) { // 浠庢病閫変腑鍒伴�変腑
+ console.log('浠庢病閫変腑鍒伴�変腑')
+ this.dialogFormEqp.eqpAll.forEach((item, index) => {
+ if (item.code === val.code) {
+ if (item.children && item.children.length > 0) {
+ item.children.forEach(it => {
+ this.dialogFormEqp.eqpCodeSelectedArr.push(it.code)
+ })
+ }
+ }
+ })
+ console.log(this.dialogFormEqp.eqpCodeSelectedArr, 1)
+ this.$nextTick(() => { // 鏍戝舰鍥炴樉
+ this.$refs.epqTree.setCheckedKeys(this.dialogFormEqp.eqpCodeSelectedArr)
+ })
+ } else { // 浠庨�変腑鍒版病閫変腑
+ console.log('浠庨�変腑鍒版病閫変腑')
+ const temp = []
+ this.dialogFormEqp.eqpAll.forEach((item, index) => {
+ if (item.code === val.code) {
+ if (item.children && item.children.length > 0) {
+ item.children.forEach(it => {
+ temp.push(it.code)
+ })
+ }
+ }
+ })
+ this.dialogFormEqp.eqpCodeSelectedArr = [...this.dialogFormEqp.eqpCodeSelectedArr].filter(x => [...temp].every(y => y !== x))
+ this.$nextTick(() => { // 鏍戝舰鍥炴樉
+ this.$refs.epqTree.setCheckedKeys(this.dialogFormEqp.eqpCodeSelectedArr)
+ })
+ }
+ console.log(this.dialogFormEqp.eqpCodeSelectedArr, 999)
},
- checkBoxClick() {
+ // 鏍戝舰澶嶉�夋鐐瑰嚮浜嬩欢
+ checkBoxClick(obj, { checkedNodes, checkedKeys, halfCheckedNodes, halfCheckedKeys }) {
+ let checkedFatherCode = '' // 鎵惧埌 checkedFatherCode 鐖禼ode鍊�
+ console.log(obj, { checkedNodes, checkedKeys, halfCheckedNodes, halfCheckedKeys })
+ this.dialogFormEqp.eqpAll.forEach((item, index) => {
+ if (item.code === obj.code) {
+ checkedFatherCode = item.code
+ }
+ if (item.children && item.children.length > 0) {
+ item.children.forEach((it, ind) => {
+ if (it.code === obj.code) {
+ checkedFatherCode = item.code
+ }
+ })
+ }
+ })
+ console.log(checkedFatherCode, 1)
+ // 1.绗竴绉嶆儏鍐靛綋鏍戝舰 鍗婂彾 涓嶄负闆� 鍏ㄥ彾 涓嶄负闆�
+ if (halfCheckedKeys.length !== 0 && checkedKeys.length !== 0) {
+ console.log('// 1.绗竴绉嶆儏鍐靛綋鏍戝舰 鍗婂彾 涓嶄负闆� 鍏ㄥ彾 涓嶄负闆�')
+ this.dialogFormEqp.eqpArr.forEach((item, index) => {
+ if (item.code === checkedFatherCode) {
+ console.log(item.code, 777)
+ this.dialogFormEqp.eqpArr[index].isSelected2 = true
+ this.$nextTick(() => {
+ $('input:checkbox').eq(index).prop('checked', true)// 鑷畾涔夊崟閫夋鍥炴樉
+ })
+ }
+ })
+ this.dialogFormEqp.eqpCodeSelectedArr.forEach((item, index) => {
+ if (item === obj.code) {
+ this.dialogFormEqp.eqpCodeSelectedArr.splice(index, 1)
+ }
+ })
+ checkedKeys.forEach(item => {
+ this.dialogFormEqp.eqpCodeSelectedArr.push(item)
+ })
+ this.dialogFormEqp.eqpCodeSelectedArr = [...new Set(this.dialogFormEqp.eqpCodeSelectedArr)]
+ }
+
+ // 2.绗簩绉嶆儏鍐靛綋鏍戝舰 鍗婂彾 涓洪浂 鍏ㄥ彾 涓洪浂
+ if (halfCheckedKeys.length === 0 && checkedKeys.length === 0) {
+ console.log('// 2.绗簩绉嶆儏鍐靛綋鏍戝舰 鍗婂彾 涓洪浂 鍏ㄥ彾 涓洪浂')
+ const temp = []
+ this.dialogFormEqp.eqpArr.forEach((item, index) => {
+ if (item.code === checkedFatherCode) {
+ this.dialogFormEqp.eqpArr[index].isSelected2 = false
+ this.$nextTick(() => {
+ $('input:checkbox').eq(index).prop('checked', false)// 鑷畾涔夊崟閫夋鍥炴樉
+ })
+ }
+ })
+ this.dialogFormEqp.eqpAll.forEach((item, index) => {
+ if (item.code === checkedFatherCode) {
+ if (item.children && item.children.length > 0) {
+ item.children.forEach(it => {
+ temp.push(it.code)
+ })
+ }
+ }
+ })
+ this.dialogFormEqp.eqpCodeSelectedArr = [...this.dialogFormEqp.eqpCodeSelectedArr].filter(x => [...temp].every(y => y !== x))
+ }
+
+ // 3.绗笁绉嶇鎯呭喌褰撴爲褰� 鍗婂彾 涓洪浂 鍏ㄥ彾 涓嶄负闆�
+ if (halfCheckedKeys.length === 0 && checkedKeys.length !== 0) {
+ console.log('// 3.绗笁绉嶇鎯呭喌褰撴爲褰� 鍗婂彾 涓洪浂 鍏ㄥ彾 涓嶄负闆�')
+ this.dialogFormEqp.eqpArr.forEach((item, index) => {
+ if (item.code === checkedFatherCode) {
+ this.dialogFormEqp.eqpArr[index].isSelected2 = true
+ this.$nextTick(() => {
+ $('input:checkbox').eq(index).prop('checked', true)// 鑷畾涔夊崟閫夋鍥炴樉
+ })
+ }
+ })
+
+ this.dialogFormEqp.eqpAll.forEach((item, index) => {
+ if (item.code === checkedFatherCode) {
+ if (item.children && item.children.length > 0) {
+ item.children.forEach(it => {
+ this.dialogFormEqp.eqpCodeSelectedArr.push(it.code)
+ })
+ }
+ }
+ })
+ }
},
+ // 鍙栨秷浜嬩欢
eqpDialogVisibleCancel() {
this.dialogVisibleEqp = false
},
+ // 纭浜嬩欢
eqpDialogVisibleConfirm() {
- this.dialogVisibleEqp = false
+ // console.log(this.dialogFormEqp.eqpCodeSelectedArr, 888)
+ // this.dialogVisibleEqp = false
+ const data = []
+ this.dialogFormEqp.eqpAll.forEach((item, index) => {
+ if (item.children && item.children.length > 0) {
+ item.children.forEach(it => {
+ if (this.dialogFormEqp.eqpCodeSelectedArr.includes(it.code)) {
+ data.push({
+ name: it.name,
+ code: it.code
+ })
+ }
+ })
+ }
+ })
+
+ SaveDeviceCheckStanedAssociationEqp(data, this.dialogFormEqp.code).then(res => {
+ if (res.code === '200') {
+ this.$message.success('鍏宠仈鎴愬姛锛�')
+ this.getDeviceCheckStandArdSearch()
+ this.dialogVisibleEqp = false
+ }
+ })
}
}
}
diff --git a/src/views/scgl/gd.vue b/src/views/scgl/gd.vue
index 60d2c5b..e8a1a8a 100644
--- a/src/views/scgl/gd.vue
+++ b/src/views/scgl/gd.vue
@@ -1597,8 +1597,8 @@
this.dialogForm.partname = row.partname
this.dialogForm.mesqty = row.plan_qty
this.dialogForm.partspec = row.partspec
- this.dialogForm.sourceorder = row.sourceorder
- this.dialogForm.ordertype = row.ordertype
+ this.dialogForm.sourceorder = row.m_po
+ this.dialogForm.ordertype = row.wotype
// this.routecodeChange(this.dialogForm.routecode)
--
Gitblit v1.9.3