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 | 187 ++++++++++++++++++++++++++++++++++------------
1 files changed, 137 insertions(+), 50 deletions(-)
diff --git a/src/components/view/equipmentmaintain.vue b/src/components/view/equipmentmaintain.vue
index 0defcf5..b9fcd0a 100644
--- a/src/components/view/equipmentmaintain.vue
+++ b/src/components/view/equipmentmaintain.vue
@@ -22,10 +22,7 @@
<el-form-item label="绫诲瀷">
<template>
<el-select v-model="edit.type" disabled placeholder="璇烽�夋嫨" style="width: 560px;">
- <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>
</template>
</el-form-item>
@@ -108,17 +105,14 @@
<!-- 鏂板寮圭獥 -->
<div>
<el-dialog
- title="鎶�鏈寚鏍囨柊澧�"
+ title="鐢熶骇宸ヨ壓鏂板"
:visible.sync="dialogVisible"
width="40%">
<el-form ref="form" :model="form" label-width="80px">
<el-form-item label="绫诲瀷">
<template>
- <el-select v-model="form.type" placeholder="璇烽�夋嫨" @change="edittype" 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>
@@ -141,7 +135,7 @@
<el-col :span="11" :offset="2">
<el-form-item label="宸ヨ壓鍚嶇О">
<template>
- <el-select v-model="form.craft" placeholder="璇烽�夋嫨" >
+ <el-select v-model="form.craft" @change="carftapi" placeholder="璇烽�夋嫨" >
<el-option
v-for="item in craftapi"
:key="item.id"
@@ -202,7 +196,7 @@
<el-col :span="11" :offset="2">
<el-form-item label="鍗曚綅">
<template>
- <el-input v-model="unitrow" :disabled="true" placeholder="璇疯緭鍏ュ崟浣�" style="width: 200px;"></el-input>
+ <el-input v-model="unitrow" :disabled="true" placeholder="璇疯緭鍏ュ崟浣�" style="width: 100%;"></el-input>
</template>
</el-form-item>
</el-col>
@@ -224,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;">
@@ -261,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"
@@ -317,7 +311,7 @@
width="200px">
<template slot-scope="scope" style="text-align: center;">
<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="childrenClick(scope.row)">缂栬緫</el-button> -->
<el-button type="text" size="mini" @click="deleteRow(scope.$index, scope.row)">鍒犻櫎</el-button>
</div>
</template>
@@ -331,6 +325,7 @@
export default {
data() {
return {
+ bigType: [],
search: {
type: 0,
technology: null
@@ -349,6 +344,7 @@
upData:{
},
+
checkTreeNode:{
id:1,
},
@@ -367,15 +363,25 @@
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]'
@@ -396,27 +402,25 @@
// //鏂板
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);
- }, {
- headers: {
- "Content-Type": "application/json"
- }
- })
+ })
+ },
+ carftapi(val) {
+ console.log(val);
+ this.carftrow = val
+ this.chooseDeiv()
+ this.choosePro()
},
chooseDeiv() {//璁惧
this.$axios.get(this.$api.url.chooseDeiv,{
- params:{techTemId:this.checkTreeNode.id}
+ params:{techTemId:this.carftrow}
}).then(res => {
this.higherlevel = res.data;
console.log(this.process);
- }, {
- headers: {
- "Content-Type": "application/json"
- }
- })
+ })
},
//鏂板
edittype(val) {
@@ -537,9 +541,26 @@
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)
+ })
+ },
//涓讳綋鍙�
selectAllTeque() {
this.$axios.get(this.$api.url.selectAllTeque,{
@@ -547,12 +568,21 @@
}).then(res => {
this.tableData = res.data;
console.log(this.tableData);
-
+ this.formatData(res.data)
})
},
modify(){
this.modifyevent = true
},
+ 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,{
@@ -568,9 +598,6 @@
console.log(this.upData.id);
this.delQueById()
},
- handleSelectionChange(val) {
- this.selects = val
- },
//鎵归噺鍒犻櫎
delAllQue() {
this.$axios.post(this.$api.url.delAllQue,{
@@ -582,18 +609,17 @@
},
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 cc = this.selects.map(el => {
- return el.id
- })
- this.delete = cc.join(',')
+ 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('鍒犻櫎瀹屾垚')
@@ -608,7 +634,66 @@
// // 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");
+ })
+ },
+ //閫夋嫨鏌愯
+ 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>
@@ -693,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