From c0bc2331e9abb2ae003c8dc0ab4524d6101493a1 Mon Sep 17 00:00:00 2001
From: 王震 <10952869+daywangzhen@user.noreply.gitee.com>
Date: 星期一, 25 九月 2023 09:12:51 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
src/components/view/equipmentmaintain.vue | 486 ++++++++++++++++++++++++++++++++++++++++++-----------
1 files changed, 385 insertions(+), 101 deletions(-)
diff --git a/src/components/view/equipmentmaintain.vue b/src/components/view/equipmentmaintain.vue
index 6bec45c..b9fcd0a 100644
--- a/src/components/view/equipmentmaintain.vue
+++ b/src/components/view/equipmentmaintain.vue
@@ -17,16 +17,12 @@
<el-dialog
title="鎶�鏈寚鏍囩紪杈�"
:visible.sync="modifyevent"
- width="40%"
- :before-close="handleClose">
+ width="40%">
<el-form ref="form" :model="form" label-width="80px">
<el-form-item label="绫诲瀷">
<template>
- <el-select v-model="form.type" placeholder="璇烽�夋嫨" >
- <el-option label="姗¤兌杩炴帴鍣�" :value="0"></el-option>
- <el-option label="閲戝睘杩炴帴鍣�" :value="1"></el-option>
- <el-option label="婀挎彃鎷旂數杩炴帴鍣�" :value="2"></el-option>
- <el-option label="鍒嗘敮缁勪欢" :value="3"></el-option>
+ <el-select v-model="edit.type" disabled placeholder="璇烽�夋嫨" style="width: 560px;">
+ <el-option v-for="(a, ai) in bigType" :key="ai" :value="a"></el-option>
</el-select>
</template>
</el-form-item>
@@ -34,7 +30,7 @@
<el-col :span="11">
<el-form-item label="宸ュ簭">
<template>
- <el-select v-model="form.work"
+ <el-select v-model="edit.techFather" disabled
placeholder="璇烽�夋嫨" >
<el-option
v-for="item in process"
@@ -46,46 +42,77 @@
</template>
</el-form-item>
</el-col>
+ <el-col :span="11" :offset="2">
+ <el-form-item label="宸ヨ壓">
+ <el-input v-model="edit.techName" :disabled="true" placeholder="璇烽�夋嫨"></el-input>
+ </el-form-item>
+ </el-col>
</el-row>
<el-row>
<el-col :span="11">
<el-form-item label="璁惧">
- <el-input v-model="form.father" placeholder="璇烽�夋嫨"></el-input>
+ <el-input v-model="edit.dname" disabled placeholder="璇烽�夋嫨"></el-input>
</el-form-item>
</el-col>
<el-col :span="11" :offset="2">
<el-form-item label="椤圭洰">
- <el-input v-model="form.name" placeholder="璇疯緭鍏ラ」鐩�"></el-input>
+ <!-- <el-input v-model="edit.father" :disabled="true" placeholder="璇疯緭鍏ラ」鐩�"></el-input> -->
+ <template>
+ <el-select v-model="edit.father" @change="projectApi" placeholder="璇烽�夋嫨" >
+ <el-option
+ v-for="item in project"
+ :key="item.name"
+ :label="item.name"
+ :value="item.name">
+ </el-option>
+ </el-select>
+ </template>
</el-form-item>
</el-col>
</el-row>
- <el-form-item label="鍗曚綅">
- <el-input v-model="form.unit" placeholder="璇疯緭鍏ュ崟浣�" style="width: 220px;"></el-input>
- </el-form-item>
+ <el-row>
+ <el-col :span="11">
+ <el-form-item label="鎸囨爣">
+ <template>
+ <el-select v-model="edit.name" @change="scale" placeholder="璇烽�夋嫨" >
+ <el-option
+ v-for="item in quota"
+ :key="item.id"
+ :label="item.name"
+ :value="item.id">
+ </el-option>
+ </el-select>
+ </template>
+
+ </el-form-item>
+ </el-col>
+ <el-col :span="11" :offset="2">
+ <el-form-item label="鍗曚綅">
+ <el-input v-model="unitrow" :value="unitrow" :disabled="true" placeholder="璇疯緭鍏ラ」鐩�"></el-input>
+ </el-form-item>
+ </el-col>
+ </el-row>
+
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="modifyevent = false">鍙� 娑�</el-button>
- <el-button type="primary" @click="modifyevent = false">纭� 瀹�</el-button>
+ <el-button type="primary" @click="editApi">纭� 瀹�</el-button>
</span>
</el-dialog>
</div>
<!-- 鏂板寮圭獥 -->
<div>
<el-dialog
- title="鎶�鏈寚鏍囨柊澧�"
+ title="鐢熶骇宸ヨ壓鏂板"
:visible.sync="dialogVisible"
- width="40%"
- :before-close="handleClose">
+ width="40%">
<el-form ref="form" :model="form" label-width="80px">
<el-form-item label="绫诲瀷">
<template>
- <el-select v-model="form.type" placeholder="璇烽�夋嫨" style="width: 480px;">
- <el-option label="姗¤兌杩炴帴鍣�" :value="0"></el-option>
- <el-option label="閲戝睘杩炴帴鍣�" :value="1"></el-option>
- <el-option label="婀挎彃鎷旂數杩炴帴鍣�" :value="2"></el-option>
- <el-option label="鍒嗘敮缁勪欢" :value="3"></el-option>
+ <el-select v-model="form.type" placeholder="璇烽�夋嫨" @change="edittype" style="width: 100%;">
+ <el-option v-for="(a, ai) in bigType" :key="ai" :value="a"></el-option>
</el-select>
</template>
</el-form-item>
@@ -93,13 +120,27 @@
<el-col :span="11">
<el-form-item label="宸ュ簭">
<template>
- <el-select v-model="form.father"
+ <el-select v-model="form.father" @change="workevent"
placeholder="璇烽�夋嫨" >
<el-option
v-for="item in process"
:key="item.name"
:label="item.name"
:value="item.name">
+ </el-option>
+ </el-select>
+ </template>
+ </el-form-item>
+ </el-col>
+ <el-col :span="11" :offset="2">
+ <el-form-item label="宸ヨ壓鍚嶇О">
+ <template>
+ <el-select v-model="form.craft" @change="carftapi" placeholder="璇烽�夋嫨" >
+ <el-option
+ v-for="item in craftapi"
+ :key="item.id"
+ :label="item.name"
+ :value="item.id">
</el-option>
</el-select>
</template>
@@ -113,9 +154,9 @@
<el-select v-model="form.work" placeholder="璇烽�夋嫨" >
<el-option
v-for="item in higherlevel"
- :key="item.name"
+ :key="item.devId"
:label="item.name"
- :value="item.name">
+ :value="item.devId">
</el-option>
</el-select>
</template>
@@ -123,14 +164,47 @@
</el-col>
<el-col :span="11" :offset="2">
<el-form-item label="椤圭洰">
- <el-input v-model="form.name" placeholder="璇疯緭鍏ラ」鐩�"></el-input>
+ <template>
+ <el-select v-model="form.ee" @change="projectApi" placeholder="璇烽�夋嫨" >
+ <el-option
+ v-for="item in project"
+ :key="item.name"
+ :label="item.name"
+ :value="item.name">
+ </el-option>
+ </el-select>
+ </template>
</el-form-item>
</el-col>
</el-row>
- <el-form-item label="鍗曚綅">
+ <el-row>
+ <el-col :span="11">
+ <el-form-item label="鎸囨爣">
+ <template>
+ <el-select v-model="form.aa" @change="scale" placeholder="璇烽�夋嫨" >
+ <el-option
+ v-for="item in quota"
+ :key="item.id"
+ :label="item.name"
+ :value="item.id">
+ </el-option>
+ </el-select>
+ </template>
+ </el-form-item>
+ </el-col>
+ <el-col :span="11" :offset="2">
+ <el-form-item label="鍗曚綅">
+ <template>
+ <el-input v-model="unitrow" :disabled="true" placeholder="璇疯緭鍏ュ崟浣�" style="width: 100%;"></el-input>
+ </template>
+ </el-form-item>
+ </el-col>
+ </el-row>
+
+ <!-- <el-form-item label="鍗曚綅">
<el-input v-model="form.unit" placeholder="璇疯緭鍏ュ崟浣�" style="width: 220px;"></el-input>
- </el-form-item>
+ </el-form-item> -->
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false">鍙� 娑�</el-button>
@@ -144,10 +218,7 @@
<div class="choose">
<span>绫诲瀷锛�</span>
<el-select v-model="search.type" size="small" @change="TYpe" placeholder="璇烽�夋嫨" style="width: 224px;margin-right: 30px;">
- <el-option label="姗¤兌杩炴帴鍣�" :value="0"></el-option>
- <el-option label="閲戝睘杩炴帴鍣�" :value="1"></el-option>
- <el-option label="婀挎彃鎷旂數杩炴帴鍣�" :value="2"></el-option>
- <el-option label="鍒嗘敮缁勪欢" :value="3"></el-option>
+ <el-option v-for="(a, ai) in bigType" :key="ai" :value="a"></el-option>
</el-select>
<!-- <span>宸ュ簭锛�</span>
<el-select v-model="search.name" size="small" placeholder="璇烽�夋嫨" style="width: 224px;margin-right: 30px;">
@@ -160,11 +231,13 @@
<!-- 涓讳綋宸� -->
<div class="left">
<el-input v-model="search.technology"
+ @input="query"
suffix-icon="el-icon-search"
placeholder="璇疯緭鍏ユ悳绱㈠唴瀹�"
size="small" clearable ></el-input>
- <el-tree :data="list" ref="tree" :props="{children: 'children',label: 'name'}" node-key="id" default-expand-all
- highlight-current :filter-node-method="filterNode"
+ <el-tree :data="list" ref="tree"
+ :props="{children: 'children',label: 'name'}" highlight-current node-key="name" default-expand-all
+
@node-click="handleNodeClick"
>
<div class="custom-tree-node" slot-scope="{ node, data }">
@@ -179,12 +252,15 @@
<!-- 涓讳綋鍙� -->
<div class="right">
<el-table
+ height="calc(90vh - 200px)"
:data="tableData"
- style="width: 100%;margin-bottom: 20px;"
- row-key="name"
+ row-key="rowId"
border
+ @select-all="selectAll"
+ @select="selectTr"
@selection-change="handleSelectionChange"
default-expand-all
+ ref="multipleTable"
:tree-props="{children: 'children', hasChildren: 'hasChildren'}">
<el-table-column
type="selection"
@@ -197,30 +273,28 @@
<el-table-column
label="璁惧鍚嶇О"
sortable
+ prop="dname"
width="300px">
<template slot-scope="scope">
- <el-tag>
+ <!-- <el-tag>
<div class="firstDiv" :style="`color: ${scope.row.children ? '#16a7ff' : '#58c173'}`">
{{ scope.row.children ? "01" : "02" }}
</div>
</el-tag>
- <span style="children: black">{{ scope.row.name }}</span>
-
+ <span style="children: black">{{ scope.row.name }}</span> -->
+ <el-tag v-if="scope.row.children" type="primary">01</el-tag>
+ <span style="color: black" v-if="scope.row.children">
+ {{ scope.row.dname }}
+ </span>
</template>
</el-table-column>
-
<el-table-column
label="椤圭洰"
sortable
width="300px">
<template slot-scope="scope">
- <el-tag>
- <div class="firstDiv" :style="`color: ${scope.row.children ? '#16a7ff' : '#58c173'}`">
- {{ scope.row.children ? "01" : "02" }}
- </div>
- </el-tag>
- <span style="color: black">{{ scope.row.name }}</span>
-
+ <el-tag type="success" v-if="!scope.row.children">02</el-tag>
+ <span style="color: black" v-if="!scope.row.children">{{ scope.row.father }}</span>
</template>
</el-table-column>
<el-table-column
@@ -228,7 +302,7 @@
label="鍗曚綅">
</el-table-column>
<el-table-column
- prop="address"
+ prop="name"
label="鎸囨爣">
</el-table-column>
<el-table-column
@@ -236,9 +310,11 @@
label="鎿嶄綔"
width="200px">
<template slot-scope="scope" style="text-align: center;">
- <el-button type="text" size="mini" @click="childrenClick(scope)">缂栬緫</el-button>
- <el-button type="text" size="mini" @click="deleteRow(scope.$index, tableData)">鍒犻櫎</el-button>
- </template>
+ <div v-if="!scope.row.children">
+ <!-- <el-button type="text" size="mini" @click="childrenClick(scope.row)">缂栬緫</el-button> -->
+ <el-button type="text" size="mini" @click="deleteRow(scope.$index, scope.row)">鍒犻櫎</el-button>
+ </div>
+ </template>
</el-table-column>
</el-table>
</div>
@@ -249,6 +325,7 @@
export default {
data() {
return {
+ bigType: [],
search: {
type: 0,
technology: null
@@ -258,12 +335,18 @@
options:[],
process:[],
list: [],
- TYpe:'',
selects:'',
process:{},
options:{},
+ craftapi:{},
+ project:{},
+ edit:{},
+ upData:{
+
+ },
+
checkTreeNode:{
- id:2,
+ id:1,
},
form:{
type:'',
@@ -271,21 +354,34 @@
work:'',
name:'',
unit:'',
-
+
},
+
modifyevent:false,
dialogVisible:false,
tableData: [],
higherlevel:{},
+ quota:{},
+ carftrow:"",
+ unitrow:'',
}
},
mounted() {
+ this.chooseType()
this.selectAllleft()
this.selectAllTeque()
},
methods:{
+ chooseType() {
+ this.$axios.get(this.$api.url.chooseType).then(res => {
+ this.bigType = res.data
+ this.typeselect = res.data[0]
+ console.log(this.typeselect);
+ this.search.type = res.data[0]
+ })
+ },
selectDataList() {
this.list.forEach(a => {
a.code = '[1]'
@@ -303,10 +399,56 @@
this.upIndex++
},
elForm() {},
- //鏂板
- choosePro() {//宸ュ簭
+ // //鏂板
+ choosePro() {//椤圭洰
this.$axios.get(this.$api.url.choosePro,{
- params:{techTemId:this.checkTreeNode.id}
+ params:{techTemId:this.carftrow}
+ }).then(res => {
+ this.project = res.data;
+ console.log(this.process);
+ })
+ },
+ carftapi(val) {
+ console.log(val);
+ this.carftrow = val
+ this.chooseDeiv()
+ this.choosePro()
+ },
+ chooseDeiv() {//璁惧
+ this.$axios.get(this.$api.url.chooseDeiv,{
+ params:{techTemId:this.carftrow}
+ }).then(res => {
+ this.higherlevel = res.data;
+ console.log(this.process);
+ })
+ },
+ //鏂板
+ edittype(val) {
+ this.typeselect = val
+ this.chooseTechFath()
+ },
+ projectApi(val) {
+ console.log(val);
+ let idx = this.project.findIndex(el => el.name === val)
+ this.quota = this.project[idx].children
+ console.log( this.quota);
+ },
+ scale(val) {
+ console.log(val);
+ let cc = this.quota.findIndex(el => el.id === val)
+ console.log(cc);
+ this.unitrow = this.quota[cc].unit
+ console.log(this.unitrow);
+ },
+ workevent(val){
+ console.log(val);
+ let idx = this.process.findIndex(el => el.name === val)
+ this.craftapi = this.process[idx].children
+ console.log( this.craftapi);
+ },
+ chooseTechFath() {
+ this.$axios.get(this.$api.url.chooseTechFath,{
+ params:{type:this.typeselect}
}).then(res => {
this.process = res.data;
console.log(this.process);
@@ -314,20 +456,10 @@
headers: {
"Content-Type": "application/json"
}
- })
- },
- chooseDeiv() {//璁惧
- this.$axios.get(this.$api.url.chooseDeiv,{
- params:{techTemId:this.checkTreeNode.id}
- }).then(res => {
- this.higherlevel = res.data;
- console.log(this.process);
- }, {
- headers: {
- "Content-Type": "application/json"
- }
- })
- },
+ }).then(res =>{
+
+ })
+ },
//鏂板
event(){
this.dialogVisible = true
@@ -337,21 +469,54 @@
//纭
add() {
this.dialogVisible = false
+ this.addQeMode()
},
addQeMode(){
- this.$axios.get(this.$api.url.addQeMode,{
- devId:this.form.xxx,
- techTemId:this.form.xxx,
- technicalModelId:this.form.xxx,
+ this.$axios.post(this.$api.url.addQeMode,{
+ devId:this.form.work,
+ techTemId:this.form.craft,
+ technicalModelId:this.form.aa,
+ }, {headers: {"Content-Type": "application/json"}
+ }).then(res =>{
+ this.selectAllTeque()
+ this.form = {}
+ this.unitrow = ""
})
},
//缂栬緫
- childrenClick() {
+ childrenClick(ob) {
this.modifyevent=true
- this.chooseTechFath()
+ this.upData = ob
+ this.selecQueById()
+ this.choosePro()
},
- TYpe() {
+ //缂栬緫 selecQueById
+ selecQueById() {
+ this.$axios.get(this.$api.url.selecQueById,{
+ params:{id:this.upData.id}
+ }).then(res => {
+ console.log(res);
+ this.edit = res.data[0]
+ console.log(this.edit);
+ this.unitrow = this.edit.unit
+ })
+ },
+ editApi() {
+ this.modifyevent = false
+ this.writeQueById()
+ },
+ writeQueById() {
+ this.$axios.post(this.$api.url.writeQueById,{
+ devId:this.edit.did,
+ techTemId:this.edit.tid,
+ technicalModelId:this.edit.name,
+ }, {headers: {"Content-Type": "application/json"}
+ }).then(res =>{
+ })
+ },
+ //========================
+ TYpe(val) {
this.typeselect = val
this.selectAllleft()
},
@@ -361,15 +526,39 @@
this.selectAllTeque()
},
-
+ //鏌ヨ
+ query(val) {
+ this.selectAllleft()
+ },
//涓讳綋宸�
selectAllleft() {
this.$axios.get(this.$api.url.selectAllleft,{
- params:{type:this.typeselect}
+ params:{type:this.typeselect,message:this.search.technology}
}).then(res => {
this.list = res.data;
console.log(this.list);
this.selectDataList()
+ this.$nextTick(() => {
+ this.$refs.tree.setCurrentKey(this.list[0].children[0].name) // 榛樿閫変腑鑺傜偣绗竴涓�
+ })
+ let one=this.list.filter(item=>{
+ return item.children.length>0
+ })[0]
+ console.log(one);
+ let name=one.children[0].id
+ console.log(name);
+ this.checkTreeNode.id = name
+ this.selectAllTequeStart(name)
+ this.selectDataList();
+ })
+ },
+ selectAllTequeStart(name) {
+ this.$axios.get(this.$api.url.selectAllTeque,{
+ params:{id:this.checkTreeNode.id}
+ }).then(res => {
+ this.tableData = res.data;
+ console.log(this.tableData);
+ this.formatData(res.data)
})
},
//涓讳綋鍙�
@@ -379,40 +568,132 @@
}).then(res => {
this.tableData = res.data;
console.log(this.tableData);
-
+ this.formatData(res.data)
})
},
modify(){
this.modifyevent = true
},
- deleteRow(index, rows) {
- rows.splice(index, 1);
+ formatData(data){
+ let arr = data;
+ for(var i=0;i<arr.length;i++){
+ arr[i].rowId = Math.random();
+ if(arr[i].children != undefined){
+ this.formatData(arr[i].children);
+ }
+ }
+ },
+ //delQueById
+ delQueById() {
+ this.$axios.post(this.$api.url.delQueById,{
+ id:this.upData.id
+ }).then(res =>{
+ this.selectAllTeque()
+ this.$message.success('鍒犻櫎瀹屾垚')
+ })
},
- handleSelectionChange(val) {
- this.selects = val
+ deleteRow(index, row) {
+ this.tableData.splice(index,1)
+ this.upData.id = row.id
+ console.log(this.upData.id);
+ this.delQueById()
},
+ //鎵归噺鍒犻櫎
+ delAllQue() {
+ this.$axios.post(this.$api.url.delAllQue,{
+ ids:this.delete
+ }).then(res =>{
+ this.selectAllTeque()
+ this.$message.success('鍒犻櫎瀹屾垚')
+ })
+ },
+
dels() {
- this.selects.forEach(a => {
- for (var b = 0; b < this.tableData.length; b++) {
- if (this.tableData[b].id == a.id) {
- this.tableData.splice(b, 1)
- b--
- }
- }
- })
+ let ee = []
+ console.log(this.selects);
+ this.selects.forEach(el =>{
+ if(el.children){
+ el.children.forEach(ele =>{
+ ee.push(ele.id)
+ })
+ }
+ })
+ console.log(ee);
+ this.delete = ee.join(',')
+ console.log(this.delete);
+ this.delAllQue()
this.$message.success('鍒犻櫎瀹屾垚')
},
- handleClose(){
- this.$confirm('纭鍏抽棴锛�')
- .then(_ => {
- done();
+ // handleClose(){
+ // // this.$confirm('纭鍏抽棴锛�')
+ // // .then(_ => {
+ // // done();
+ // // })
+ // // .catch(_ => {})
+ // // },
+ // // filterNode(){
+
+ // },
+ handleSelectionChange(val) {
+ this.selects = val
+ // console.log(this.selects);
+ this.deleteList = [];
+ val.forEach((v) => {
+ if (v.id !== undefined) {
+ this.deleteList.push(v.id);
+ }
+ });
+ },
+ // 鍏ㄩ��/鍙栨秷閫夋搷浣�
+ selectAll(val) {
+ // console.log(val);
+ this.isAllSelect = !this.isAllSelect;
+ let data = this.tableData;
+ this.$nextTick(() =>{
+ this.toggleSelect(data, this.isAllSelect, "all");
})
- .catch(_ => {})
},
- filterNode(){
+ //閫夋嫨鏌愯
+ selectTr(selection, row) {
+ console.log(selection,row);
+ this.$set(row, "isChecked", !row.isChecked);
+ this.$nextTick(() => {
+ this.isAllSelect = row.isChecked;
+ this.toggleSelect(row, row.isChecked, "tr");
+ });
},
-
+ toggleSelection(row, flag) {
+ this.$set(row, "isChecked", flag);
+ this.$nextTick(() => {
+ if (flag) {
+ this.$refs.multipleTable.toggleRowSelection(row, flag);
+ } else {
+ this.$refs.multipleTable.clearSelection();
+ }
+ });
+ },
+ //閫掑綊瀛愮骇
+ toggleSelect(data, flag, type) {
+ if (type === "all") {
+ if (data.length > 0) {
+ data.forEach((item) => {
+ this.toggleSelection(item, flag);
+ if (item.children && item.children.length > 0) {
+ this.toggleSelect(item.children, flag, type);
+ }
+ });
+ }
+ } else {
+ if (data.children && data.children.length > 0) {
+ data.children.forEach((item) => {
+ item.isChecked = !item.isChecked;
+ this.$refs.multipleTable.toggleRowSelection(item, flag);
+ this.toggleSelect(item, flag, type);
+ });
+ }
+ }
+ },
}
}
</script>
@@ -465,6 +746,7 @@
height: calc(100% - 20px);
border-right: 3px solid rgb(245, 247, 251);
padding: 16px;
+ overflow-y: auto;
}
.thing .left .custom-tree-node span {
@@ -496,7 +778,9 @@
.thing .right {
width: calc(100% - 305px);
height: calc(100% - 25px);
- overflow: hidden;
+ /* overflow: hidden; */
+ overflow-y: scroll;
+ overflow-x: scroll;
padding: 10px;
}
--
Gitblit v1.9.3