From e7f86b5ad64b224163c321c46b0f61c294578a2b Mon Sep 17 00:00:00 2001 From: 王震 <10952869+daywangzhen@user.noreply.gitee.com> Date: 星期日, 24 九月 2023 16:53:53 +0800 Subject: [PATCH] 改bug --- src/components/view/Technicalindex.vue | 184 ++++++++++++++++++++++++++------------------- 1 files changed, 105 insertions(+), 79 deletions(-) diff --git a/src/components/view/Technicalindex.vue b/src/components/view/Technicalindex.vue index 03d8f56..623d0eb 100644 --- a/src/components/view/Technicalindex.vue +++ b/src/components/view/Technicalindex.vue @@ -35,7 +35,6 @@ </el-form-item> </el-col> </el-row> - <el-row> <el-col :span="11"> <el-form-item label="椤圭洰缁�"> @@ -48,7 +47,6 @@ </el-form-item> </el-col> </el-row> - <el-form-item label="鍗曚綅"> <el-input v-model="form.name" placeholder="璇疯緭鍏ュ崟浣�" style="width: 220px;"></el-input> </el-form-item> @@ -63,17 +61,8 @@ <span>绫诲瀷锛�</span> <el-select v-model="search.type" size="small" placeholder="璇烽�夋嫨" @change="TYpe" 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;"> - <el-option v-for="(a, ai) in process" key="ai" :label="a.name" :value="a.id"></el-option> - </el-select> - <el-button size="mini"><span>閲� 缃�</span></el-button> - <el-button size="mini" type="primary" style="background: #004EA2;"><span>鏌ヨ</span></el-button> --> </div> <div class="thing"> <!-- 涓讳綋宸� --> @@ -85,17 +74,15 @@ <div class="custom-tree-node" slot-scope="{ node, data }"> <span><i :class="`node_i ${data.code != '[2]'?'el-icon-folder-opened':'el-icon-tickets'}`"></i> {{data.code}} {{ data.name }}</span> - <!-- <el-button type="text" size="mini" @click.stop="remove(node, data)"> - <i class="el-icon-delete"></i> - </el-button> --> </div> </el-tree> </div> <!-- 涓讳綋鍙� --> <div class="right"> - <el-table :data="tableData" style="width: 100%;overflow-y: auto;min-height: 100%" - max-height="100%" row-key="name" border @selection-change="handleSelectionChange" - default-expand-all :tree-props="{children: 'children', hasChildren: 'hasChildren'}"> + <el-table :data="tableData" style="width: 100%;overflow-y: auto;min-height: 100%" max-height="100%" + row-key="name" border @select-all="selectAll" @select="selectTr" ref="multipleTable" + @selection-change="handleSelectionChange" default-expand-all + :tree-props="{children: 'children', hasChildren: 'hasChildren'}"> <el-table-column type="selection" width="55"> </el-table-column> <el-table-column type="index" width="50"> @@ -125,17 +112,13 @@ <div> <el-dialog title="缂栬緫鎶�鏈唴瀹�" :visible.sync="upDia" width="500px"> <div class="body"> - <el-row style="line-height: 46px;"> <el-col :span="4" style="font-size: 14px;text-align: right;">绫诲瀷:</el-col> <el-col :span="16" :offset="1"> <template> <el-select v-model="edit.type" disabled placeholder="璇烽�夋嫨" @change="TYpe" style="width: 306px;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> </template> </el-col> @@ -196,11 +179,8 @@ <el-form-item label="绫诲瀷"> <template> <el-select v-model="form.type" size="small" placeholder="璇烽�夋嫨" @change="edittype" - style="width: 554px;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> + style="width: 98%;margin-right: 30px;"> + <el-option v-for="(a, ai) in bigType" :key="ai" :value="a"></el-option> </el-select> </template> </el-form-item> @@ -208,7 +188,7 @@ <el-col :span="11"> <el-form-item label="宸ュ簭"> <template> - <el-select v-model="form.work" placeholder="璇烽�夋嫨" allow-create filterable @change="workevent"> + <el-select v-model="form.work" placeholder="璇烽�夋嫨" @change="workevent"> <el-option v-for="(item,index) in process" :key="item.name" :label="item.name" :value="item.name"> </el-option> @@ -219,7 +199,7 @@ <el-col :span="11" :offset="2"> <el-form-item label="宸ヨ壓"> <template> - <el-select v-model="form.name" placeholder="璇烽�夋嫨" allow-create filterable> + <el-select v-model="form.name" style="width: 95%;" placeholder="璇烽�夋嫨" @change="craftrow"> <el-option v-for="item in craftapi" :key="item.id" :label="item.name" :value="item.id"> </el-option> </el-select> @@ -227,7 +207,6 @@ </el-form-item> </el-col> </el-row> - <el-row> <el-col :span="11"> <el-form-item label="椤圭洰缁�"> @@ -236,35 +215,17 @@ <el-option v-for="item in higherlevel" :key="item" :label="item" :value="item"> </el-option> </el-select> - <!-- <el-autocomplete - popper-class="my-autocomplete" - v-model="form.father" - :fetch-suggestions="higherlevel" - placeholder="璇疯緭鍏ュ唴瀹�" - @select="electadd"> - <i - class="el-icon-edit el-input__icon" - slot="suffix" - @click="handleIconClick"> - </i> - <template slot-scope="{ item }"> - <div class="name">{{ item }}</div> - <span class="addr">{{ item}}</span> - </template> - </el-autocomplete> --> - </template> </el-form-item> </el-col> <el-col :span="11" :offset="2"> <el-form-item label="椤圭洰"> - <el-input v-model="form.project" style="width: 200px;" placeholder="璇疯緭鍏ラ」鐩�"></el-input> + <el-input v-model="form.project" style="width: 95%;" placeholder="璇疯緭鍏ラ」鐩�"></el-input> </el-form-item> </el-col> </el-row> - <el-form-item label="鍗曚綅"> - <el-input v-model="form.unit" placeholder="璇疯緭鍏ュ崟浣�" style="width: 200px;"></el-input> + <el-input v-model="form.unit" placeholder="璇疯緭鍏ュ崟浣�" style="width: 35.95%;"></el-input> </el-form-item> </el-form> <span slot="footer" class="dialog-footer"> @@ -285,7 +246,6 @@ type: 0, technology: null, }, - // handleClose:[], checkTreeNode: { id: '', }, @@ -306,6 +266,7 @@ modifyevent: false, dialogVisible: false, tableData: [], + crafval: '', typeselect: 0, upData: {}, upDia: false, @@ -316,18 +277,82 @@ father: '', name: '', unit: '', - id: '' - } + id: '', + }, + isAllSelect: false, + bigType: [] } }, mounted() { - this.selectAllleft() - this.selectAllright() + this.chooseType() }, methods: { - handleClose() { - + chooseType() { + this.$axios.get(this.$api.url.chooseType).then(res => { + this.bigType = res.data + this.typeselect = res.data[0] + this.search.type = res.data[0] + this.selectAllleft() + this.selectAllright() + }) }, + handleSelectionChange(val) { + this.selects = val; + this.deleteList = []; + val.forEach((v) => { + if (v.id !== undefined) { + this.deleteList.push(v.id); + } + }); + }, + // 鍏ㄩ��/鍙栨秷閫夋搷浣� + selectAll(val) { + this.isAllSelect = !this.isAllSelect; + let data = this.tableData; + this.toggleSelect(data, this.isAllSelect, "all"); + }, + //閫夋嫨鏌愯 + selectTr(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) { + // console.log('222'); + 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); + }); + } + } + }, + //--------------------------------------------------------------------------------------------------------------------------------------- + handleClose() {}, selectDataList() { this.list.forEach(a => { a.code = '[1]' @@ -372,7 +397,8 @@ "Content-Type": "application/json" } }).then(res => { - this.selectAllright() + /* this.selectAllright() */ + this.$parent.removeAllTab() }) }, submitUpData() { //纭畾 @@ -385,8 +411,9 @@ this.$axios.post(this.$api.url.delTechBy, { id: this.upData.id }).then(res => { - this.selectAllright() + /* this.selectAllright() */ this.$message.success('鍒犻櫎瀹屾垚') + this.$parent.removeAllTab() }) }, deleteRow(index, rows) { @@ -400,22 +427,23 @@ this.$axios.post(this.$api.url.delAllTechskill, { ids: this.delete }).then(res => { - this.selectAllright() + /* this.selectAllright() */ + this.$parent.removeAllTab() }) }, 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) + }) } }) - let cc = this.selects.map(el => { - return el.id - }) - this.delete = cc.join(',') + // cc.splice(0,1) + this.delete = ee.join(',') console.log(this.delete); this.delAllTechskill() this.$message.success('鍒犻櫎瀹屾垚') @@ -474,6 +502,7 @@ })[0] console.log(one); let name = one.children[0].id + this.checkTreeNode.id = name console.log(name); this.selectAllrightStart(name) this.selectDataList(); @@ -505,12 +534,16 @@ console.log(this.tableData); }); }, + craftrow(val) { + this.crafval = val + this.chooseProFath() + }, //涓婄骇 chooseProFath() { console.log(this.checkTreeNode.id); this.$axios.get(this.$api.url.chooseProFath, { params: { - techTemId: this.checkTreeNode.id + techTemId: this.crafval } }).then(res => { this.higherlevel = res.data; @@ -554,13 +587,6 @@ }, modify() { this.modifyevent = true - }, - // deleteRow(index, rows) { - // console.log(); - // rows.splice(index, 1); - // }, - handleSelectionChange(val) { - this.selects = val; }, //缂栬緫 -- Gitblit v1.9.3