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/self-inspection.vue | 335 ++++++++++++++++++++++++++++++++++++------------------- 1 files changed, 219 insertions(+), 116 deletions(-) diff --git a/src/components/view/self-inspection.vue b/src/components/view/self-inspection.vue index 44c9b99..8f23b85 100644 --- a/src/components/view/self-inspection.vue +++ b/src/components/view/self-inspection.vue @@ -113,43 +113,26 @@ <el-col :span="12" style="line-height: 32px;">鑷椤圭洰缁存姢</el-col> <el-col :span="12" style="text-align: right;"> <el-button type="primary" icon="el-icon-plus" style="background: #004EA2;" @click="addend">鏂板</el-button> - <el-button icon="el-icon-edit-outline" @click="modify">淇敼</el-button> <el-button icon="el-icon-delete" @click="dels">鍒犻櫎</el-button> </el-col> </el-row> </div> <div class="choose"> <span>绫诲瀷锛�</span> - <el-select v-model="search.type" size="small" 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-select v-model="search.type" size="small" @change="TYpe" placeholder="璇烽�夋嫨" style="width: 224px;margin-right: 30px;"> + <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> - <span>椤圭洰锛�</span> - <el-select v-model="search.name" size="small" placeholder="璇烽�夋嫨" style="width: 224px;margin-right: 30px;"> - <el-option v-for="(a, ai) in product" key="ai" :label="a.name" :value="a.id"></el-option> - </el-select> - <el-button size="mini" @click="clean()"><span>閲� 缃�</span></el-button> - <el-button size="mini" type="primary" style="background: #004EA2;"><span>鏌� - 璇�</span></el-button> </div> <div class="thing"> <div class="left"> <el-input v-model="search.technology" suffix-icon="el-icon-search" placeholder="璇疯緭鍏ユ悳绱㈠唴瀹�" size="small" clearable @input="(val)=>$refs.tree.filter(val)"></el-input> - <el-tree :data="list" ref="tree" :props="{children: 'children',label: 'name'}" node-key="id" default-expand-all + <el-tree :data="list" ref="tree" :props="{children: 'children',label: 'name'}" node-key="name" default-expand-all @node-click="handleNodeClick" highlight-current @node-expand="nodeOpen" @node-collapse="nodeClose" :filter-node-method="filterNode" :key="upIndex"> <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> @@ -164,20 +147,21 @@ </el-table-column> <el-table-column prop="unit" label="鍗曚綅"> </el-table-column> - <el-table-column prop="stand" label="鏍囧噯鍊�"> + <el-table-column prop="required" label="鏍囧噯鍊�"> </el-table-column> - <el-table-column prop="ask" label="鍐呮帶鍊�"> + <el-table-column prop="internal" label="鍐呮帶鍊�"> </el-table-column> <el-table-column label="鎿嶄綔" width="130"> <template slot-scope="scope"> - <span class="table_do" @click="upContent(scope.row)">缂栬緫 </span> - <span class="table_do" @click="deleteRow(scope.$index, tableData)">鍒犻櫎</span> + <!-- <span class="table_do" @click="upContent(scope.row)">缂栬緫 --> + <!-- </span> --> + <span class="table_do" @click="deleteRow(scope.$index, scope.row)">鍒犻櫎</span> </template> </el-table-column> </el-table> </div> </div> - <el-dialog title="缂栬緫璁板綍鍐呭" :visible.sync="upDia" width="500px"> + <!-- <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> @@ -194,13 +178,13 @@ <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"> - <el-input v-model="upData.stand" size="small" clearable></el-input> + <el-input v-model="upData.required" size="small" clearable></el-input> </el-col> </el-row> <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"> - <el-input v-model="upData.ask" size="small" clearable></el-input> + <el-input v-model="upData.internal" size="small" clearable></el-input> </el-col> </el-row> </div> @@ -208,31 +192,31 @@ <el-button type="primary" @click="submitUpData">纭� 瀹�</el-button> <el-button @click="upDia = false">鍙� 娑�</el-button> </span> - </el-dialog> + </el-dialog> --> <!-- 鏂板寮圭獥 --> <el-dialog title="鑷缓鏂板" :visible.sync="dialogVisible" width="35%"> <div> <el-form ref="form" :model="form" label-width="80px"> <el-form-item label="绫诲瀷"> <template> - <el-select v-model="value" placeholder="璇烽�夋嫨绫诲瀷" style="width: 480px;"> - <el-option - v-for="item in options" - :key="item.value" - :label="item.label" - :value="item.value"> - </el-option> + <el-select v-model="form.value" placeholder="璇烽�夋嫨" @change="edittype" style="width: 100%;"> + <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> </template> </el-form-item> <el-form-item label="宸ュ簭"> <template> - <el-select v-model="value" placeholder="璇烽�夋嫨绫诲瀷" style="width: 480px;"> + <el-select v-model="form.procedure" + @change="workevent" + placeholder="璇烽�夋嫨" style="width: 100%;"> <el-option - v-for="item in options" - :key="item.value" - :label="item.label" - :value="item.value"> + v-for="item in process" + :key="item.name" + :label="item.name" + :value="item.name"> </el-option> </el-select> </template> @@ -241,48 +225,48 @@ <el-col :span="10"> <el-form-item label="宸ヨ壓鍚嶇О"> <template> - <el-select v-model="value" placeholder="璇烽�夋嫨绫诲瀷" style="width: 180px;"> + <el-select v-model="form.name" placeholder="璇烽�夋嫨" style="width: 180px;"> <el-option - v-for="item in options" - :key="item.value" - :label="item.label" - :value="item.value"> + v-for="item in craftapi" + :key="item.id" + :label="item.name" + :value="item.id"> </el-option> </el-select> </template> </el-form-item> </el-col> - <el-col :span="10" :offset="3"> - <el-form-item label="鑷缓椤圭洰"> - <el-input v-model="form.name" style="width: 180px;"></el-input> + <el-col :span="10" :offset="4"> + <el-form-item label="鑷椤圭洰"> + <el-input v-model="form.project" style="width: 100%;"></el-input> </el-form-item> </el-col> </el-row> <el-row> <el-col :span="10"> <el-form-item label="鍗曚綅"> - <el-input v-model="form.vvvv" style="width: 180px;"></el-input> + <el-input v-model="form.unit" style="width: 180px;"></el-input> </el-form-item> </el-col> - <el-col :span="10" :offset="3"> + <el-col :span="10" :offset="4"> <el-form-item label="鏍囧噯鍊�"> - <el-input v-model="form.aaaa" style="width: 180px;"></el-input> + <el-input v-model="form.standard" style="width: 100%;"></el-input> </el-form-item> </el-col> </el-row> <el-form-item label="鍐呮帶鍊�" > - <el-input v-model="form.aaaa" style="width: 180px;"></el-input> + <el-input v-model="form.control" style="width: 180px;"></el-input> </el-form-item> </el-form> </div> <span slot="footer" class="dialog-footer"> - <el-button type="primary" @click="dialogVisible = false">纭� 瀹�</el-button> + <el-button type="primary" @click="add">纭� 瀹�</el-button> <el-button @click="dialogVisible = false">鍙� 娑�</el-button> </span> </el-dialog> <!-- 淇敼寮圭獥 --> - <el-dialog title="宸ヨ壓璺嚎淇敼" :visible.sync="modifyVisible" width="35%"> + <!-- <el-dialog title="宸ヨ壓璺嚎淇敼" :visible.sync="modifyVisible" width="35%"> <div> <el-form ref="form" :model="form" label-width="80px"> <el-form-item label="绫诲瀷"> @@ -351,7 +335,7 @@ <el-button type="primary" @click="modifyVisible = false">纭� 瀹�</el-button> <el-button @click="modifyVisible = false">鍙� 娑�</el-button> </span> - </el-dialog> + </el-dialog> --> </div> </template> @@ -366,68 +350,32 @@ }, options:[], value:{}, - form:{}, + form:{ + value:'', + procedure:'', + name:'', + project:'', + unit:'', + standard:'', + control:'', + }, modifyVisible:false, dialogVisible:false, process: [], product: [], - list: [{ - id: 0, - name: "鍘熸潗鏂�", - children: [{ - id: 3, - name: "宸ヨ壓" - }] - }, { - id: 1, - name: "鎴愬搧", - children: [{ - id: 4, - name: "宸ヨ壓" - }] - }, { - id: 2, - name: "鍗婃垚鍝�", - children: [{ - id: 5, - name: "宸ヨ壓" - }] - }], - checkTreeNode: {}, - tableData: [{ - id: 1, - name: "鐢电紗瑙勬牸", - unit: "dajskda", - stand: "12348", - ask: "564165" - }, { - id: 2, - name: "浣滀笟浜哄憳", - unit: "dajskda", - stand: "12348", - ask: "564165" - }, { - id: 3, - name: "瑙勬牸", - unit: "dajskda", - stand: "12348", - ask: "564165" - }, { - id: 4, - name: "瑙勬牸", - unit: "dajskda", - stand: "12348", - ask: "564165" - }, { - id: 5, - name: "瑙勬牸", - unit: "dajskda", - stand: "12348", - ask: "564165" - }], + list: [], + checkTreeNode: { + id:'', + }, + bigType: [], + tableData: [], upIndex: 0, selects: [], - upDia: false, + upDia: [], + typeselect:0, + process:[], + craftapi:[], + delete:{}, upData: { id: 0, name: null, @@ -438,14 +386,165 @@ } }, mounted() { - this.selectDataList() + this.chooseType() + this.selectAllleft() + this.selectAllSelf() }, methods: { + 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.selectAllTechTem(); + this.selectAllTechNam(); + }) + }, + selectDataList() { + this.list.forEach(a => { + a.code = '[1]' + if (a.children != undefined) { + a.children.forEach(b => { + b.code = '[2]' + if (b.children != undefined) { + b.children.forEach(c => { + c.code = '[3]' + }) + } + }) + } + }) + this.upIndex++ + }, + //鍒犻櫎 + delSelfcheck() { + console.log(this.upData.id); + this.$axios.post(this.$api.url.delSelfcheck,{ + id:this.upData.id + } + + ) + }, + deleteRow(index, row) { + this.tableData.splice(index,1) + this.upData.id = row.id + this.delSelfcheck() + }, + //鎵归噺鍒犻櫎 + delAll() { + this.$axios.post(this.$api.url.delAll,{ + ids:this.delete + }) + }, + //缂栬緫 + writeRecordById() { + + }, + //鏂板 + add() { + if (this.form.standard[0] !== "<" && this.form.standard[0] !== "<=" && this.form.standard[0] !== ">"){ + this.$message({ + message: '杈撳叆鐨勭涓�涓瓧绗﹀繀椤绘槸 '<' 鎴� '<='锛�', + type: 'warning' + }); + return; + } + this.addSelfcheck() + this.dialogVisible = false + }, + addSelfcheck() { + this.$axios.post(this.$api.url.addSelfcheck,{ + internal:this.form.control, + name:this.form.project, + required:this.form.standard, + techTemId:this.form.name, + unit:this.form.unit, + }, { + headers: { + "Content-Type": "application/json" + } + }).then(res=>{ + this.selectAllSelf() + this.form = {} + }) + }, + //宸ュ簭宸ヨ壓 + chooseTechFath() { + this.$axios.get(this.$api.url.chooseTechFath,{ + params:{type:this.typeselect} + }).then(res => { + this.process = res.data; + console.log(this.process); + }, { + headers: { + "Content-Type": "application/json" + } + }) + }, + workevent(val){ + console.log(val); + let idx = this.process.findIndex(el => el.name === val) + this.craftapi = this.process[idx].children + }, + TYpe(val) { + this.typeselect = val + console.log(this.typeselect); + this.selectAllleft() + }, + edittype(val) { + // this.typeselect = '' + this.typeselect = val + this.chooseTechFath() + }, + //涓讳綋宸� + selectAllleft() { + this.$axios.get(this.$api.url.selectAllleft,{ + params:{type:this.typeselect} + }).then(res => { + this.list = res.data; + console.log(this.list); + this.selectDataList() + this.$nextTick(() => { + this.$refs.tree.setCurrentKey(this.list[0].children[0].name) // 榛樿閫変腑鑺傜偣绗竴涓� + }) + console.log("==========="); + console.log(this.list); + let one=this.list.filter(item=>{ + return item.children.length>0 + })[0] + console.log(one); + let id =one.children[0].id + this.checkTreeNode.id = id + console.log(id); + this.selectAllSelfStart(id) + this.selectDataList(); + console.log("==========="); + }) + }, + //榛樿 + selectAllSelfStart(id) { + this.$axios.get(this.$api.url.selectAllSelf,{ + params:{id:id} + }).then(res => { + this.tableData = res.data; + console.log(this.tableData); + }) + }, + //鍙� + selectAllSelf() { + this.$axios.get(this.$api.url.selectAllSelf,{ + params:{id:this.checkTreeNode.id} + }).then(res => { + this.tableData = res.data; + console.log(this.tableData); + }) + }, modify(){ this.modifyVisible = true }, addend(){ this.dialogVisible = true + this.chooseTechFath() }, filterNode(value, data) { if (!value) return true; @@ -474,6 +573,7 @@ }, handleNodeClick(data) { this.checkTreeNode = data + this.selectAllSelf() if(data.code=='[2]'){ console.log(data); } @@ -496,10 +596,13 @@ } } }) + let cc = this.selects.map(el => { + return el.id + }) + this.delete = cc.join(',') + console.log(this.delete); + this.delAll() this.$message.success('鍒犻櫎瀹屾垚') - }, - deleteRow(index, rows) { - rows.splice(index, 1); }, upContent(ob) { this.upData = this.HaveJson(ob) -- Gitblit v1.9.3