From 0bd64cdb66957d78202e96517d52cb100369b5af Mon Sep 17 00:00:00 2001 From: XiaoRuby <3114200645@qq.com> Date: 星期六, 09 九月 2023 14:51:22 +0800 Subject: [PATCH] Crunchy-09/09 --- src/view/enter.vue | 349 +++-- src/components/view/raw-ins.vue | 4 src/components/view/record-content.vue | 1263 +++++++++++++---------- src/main.js | 1 src/components/view/Processingproducts.vue | 20 src/components/view/rawInsDetail.vue | 293 ++++- src/components/view/rawUnqualified/raw.vue | 2 src/components/view/unqualifiedManagement.vue | 2 src/view/index.vue | 1122 +++++++++++---------- src/assets/api/controller.js | 5 10 files changed, 1,728 insertions(+), 1,333 deletions(-) diff --git a/src/assets/api/controller.js b/src/assets/api/controller.js index 583298d..ef8a46e 100644 --- a/src/assets/api/controller.js +++ b/src/assets/api/controller.js @@ -20,9 +20,8 @@ selectRawInspectsListById: "/rawInspect/selectRawInspectsListById/", //鏍规嵁妫�楠屽崟id鑾峰彇妫�楠屽崟璇︽儏 updaterawInsProduct: '/rawInsProduct/updaterawInsProduct', //淇敼椤圭洰鐨勬楠屽�� updateRawInspectsById: "/rawInspect/updateRawInspectsById/", //涓婃姤, - selectDevice: "/rawInsProduct/selectDevice", //鏌ヨ璁惧淇℃伅 - selectSpBySt: "/rawInspect/selectSpBySt", //鏍规嵁鏉愭枡id鏌ヨ鎵�鏈夊瀷鍙�, - addRawInspects: "/rawInspect/addRawInspects" + rawSelectDevice: "/rawInsProduct/selectDevice", //鏌ヨ璁惧淇℃伅 + addRawInspects: "/rawInspect/addRawInspects", // 娣诲姞 } //涓嶅悎鏍煎師鏉愭枡 const unqualifiedaa ={ diff --git a/src/components/view/Processingproducts.vue b/src/components/view/Processingproducts.vue index df007fc..d4ed2a1 100644 --- a/src/components/view/Processingproducts.vue +++ b/src/components/view/Processingproducts.vue @@ -74,12 +74,12 @@ > <el-table-column type="selection" min-width="50"> </el-table-column> <el-table-column type="index" label="搴忓彿" width="60"> - <template scope="scope"> + <template slot-scope="scope"> {{ (search.pageSize - 1) * search.countSize + scope.$index + 1 }} </template> </el-table-column> <el-table-column prop="dateArrival" label="浜у搧澶х被"> - <template scope="scope"> + <template slot-scope="scope"> <span v-if="scope.row.type == 0">鍘熸潗鏂�</span> <span v-if="scope.row.type == 1">鎴愬搧</span> <span v-if="scope.row.type == 2">鍗婃垚鍝�</span> @@ -97,7 +97,7 @@ <el-table-column prop="number" label="涓嶅悎鏍煎搧鏁伴噺"> </el-table-column> <el-table-column label="鐜板儚鎻忚堪" min-width="150"> - <template scope="scope"> + <template slot-scope="scope"> <el-input size="small" v-model="scope.row.description" @@ -106,7 +106,7 @@ </template> </el-table-column> <el-table-column label="澶勭疆鎰忚"> - <template scope="scope"> + <template slot-scope="scope"> <el-button type="text" @click="showDisposalOpinions(scope)" >鏌ョ湅澶勭疆鎰忚</el-button > @@ -125,7 +125,7 @@ </template> </el-table-column> <el-table-column label="鎿嶄綔" width="130"> - <template scope="scope"> + <template slot-scope="scope"> <div style="display: flex;"> <el-button type="text" siae="small" size="mini">闄勪欢</el-button> <el-button @@ -312,9 +312,13 @@ // 鐐瑰嚮纭畾鎸夐挳 updateEditDevided() { this.$axios - .post(this.$api.url.addOpinion, this.updateEditList, { - headers: { "Content-Type": "application/json" } - }) + .post( + this.$api.url.addOpinion, + { opinion: this.updateEditList }, + { + headers: { "Content-Type": "application/json" } + } + ) .then(res => { console.log(`output->res`, res); this.dialogVisible = false; diff --git a/src/components/view/raw-ins.vue b/src/components/view/raw-ins.vue index e2229b3..d359349 100644 --- a/src/components/view/raw-ins.vue +++ b/src/components/view/raw-ins.vue @@ -244,8 +244,8 @@ this.selectRawInspectsList(); }, selectRawInspectsList() { - this.axios - .post(this.$api.url.selectRawInspectsList, this.search) + this.$axios + .get(this.$api.url.selectRawInspectsList, { params: this.search }) .then(res => { this.tableData = res.data.row; this.total = res.data.total; diff --git a/src/components/view/rawInsDetail.vue b/src/components/view/rawInsDetail.vue index cd05798..93ad190 100644 --- a/src/components/view/rawInsDetail.vue +++ b/src/components/view/rawInsDetail.vue @@ -51,19 +51,25 @@ <el-input v-if="detailId !== null" :disabled="detailId !== null" - v-model="detailInfo.name" + v-model="detailInfo.rname" ></el-input> <el-input v-else v-model="detailInfo.name" - placeholder="璇疯緭鍏�" + placeholder="璇疯緭鍏ュ師鏉愭枡鍚嶇О" ></el-input> </el-form-item ></el-col> <el-col :span="7"> <el-form-item label="鍘熸潗鏂欑紪鐮�:"> <el-input + v-if="detailId !== null" :disabled="detailId !== null" + v-model="detailInfo.rcode" + ></el-input> + <el-input + v-else v-model="detailInfo.code" + placeholder="璇疯緭鍏ュ師鏉愭枡缂栫爜" ></el-input> </el-form-item> </el-col> @@ -78,7 +84,7 @@ ></el-input> <el-input v-else - v-model="detailInfo.specificationsArr" + v-model="detailInfo.specifications" placeholder="璇疯緭鍏ヨ鏍煎瀷鍙�" ></el-input> </el-form-item> @@ -86,6 +92,12 @@ <el-col :span="7"> <el-form-item label="鍗曚綅:"> <el-input + v-if="detailId !== null" + :disabled="detailId !== null" + v-model="detailInfo.runit" + ></el-input> + <el-input + v-else placeholder="璇疯緭鍏ユ楠屽崟浣�" :disabled="detailId !== null" v-model="detailInfo.unit" @@ -95,7 +107,7 @@ <el-col :span="7"> <el-form-item label="鏁伴噺:"> <el-input - placeholder="璇疯緭鍏ユ楠屾暟閲�" + :placeholder="detailId !== null ? '' : '璇疯緭鍏ユ楠屾暟閲�'" :disabled="detailId !== null" v-model="detailInfo.number" ></el-input> @@ -106,9 +118,9 @@ <el-col :span="7"> <el-form-item label="渚涘簲鍟嗗悕绉�:"> <el-input - placeholder="璇疯緭鍏ユ楠屾暟閲�" + :placeholder="detailId !== null ? '' : '璇疯緭鍏ユ楠屾暟閲�'" :disabled="detailId !== null" - v-model="detailInfo.number" + v-model="detailInfo.supplier" ></el-input> </el-form-item> </el-col> @@ -116,7 +128,7 @@ <el-form-item v-show="detailId !== null" label="鎶ユ鏃ユ湡:"> <el-input :disabled="detailId !== null" - v-model="detailInfo.createTime" + v-model="detailInfo.creatTime" ></el-input> </el-form-item> </el-col> @@ -135,7 +147,14 @@ <el-row> <el-col :span="12" style="line-height: 32px;">妫�楠岄」鐩�</el-col> <el-col :span="12" style="line-height: 32px; padding-top: 6px;"> - <el-button v-if="detailId == null" style="float: right;" + <el-button + style="float: right;" + @click="clickDeleteInspectionColumn()" + >鍒犻櫎妫�楠屽�煎垪</el-button + > + <el-button + style="float: right;margin-right: 30px;" + @click="clickAddInspectionColumn()" >娣诲姞妫�楠屽�煎垪</el-button > <el-button @@ -149,53 +168,81 @@ </div> <div class="raw-project-table"> <el-table :data="projectTable" style="width: 100%" height="320"> - <el-table-column type="index" label="搴忓彿" width="100"> + <el-table-column type="index" label="搴忓彿" width="60"> </el-table-column> - <el-table-column prop="name" label="椤圭洰" width="212"> - <template scope="scope"> + <el-table-column prop="rpName" label="椤圭洰" width="212"> + <template slot-scope="scope"> <el-input + v-if="detailId == null" v-model="scope.row.name" placeholder="璇疯緭鍏ラ」鐩悕绉�" ></el-input> + <el-input v-else v-model="scope.row.rpName" disabled></el-input> </template> </el-table-column> <el-table-column prop="unit" label="鍗曚綅" width="148"> - <template scope="scope"> + <template slot-scope="scope"> <el-input + v-if="detailId == null" v-model="scope.row.unit" placeholder="璇疯緭鍏ュ崟浣�" ></el-input> + <el-input v-else v-model="scope.row.rpUnit" disabled></el-input> </template> </el-table-column> - <el-table-column prop="required" label="鏍囧噯" width="254"> - <template scope="scope"> + <el-table-column prop="required" label="鏍囧噯" min-width="150"> + <template slot-scope="scope"> <el-input v-model="scope.row.required" placeholder="璇疯緭鍏ユ爣鍑嗗��" ></el-input> </template> </el-table-column> - <el-table-column prop="internal" label="鍐呮帶鍊�" width="254"> - <template scope="scope"> + <el-table-column prop="internal" label="鍐呮帶鍊�" min-width="150"> + <template slot-scope="scope"> <el-input v-model="scope.row.internal" placeholder="璇疯緭鍏ュ唴鎺у��" ></el-input> </template> </el-table-column> - <el-table-column prop="testValue" label="妫�鏌ュ��" width="254"> + <el-table-column + prop="testValue" + label="妫�娴嬪��" + min-width="150" + v-for="(item, index) in empiricalValueAdd" + :key="index" + > <template slot-scope="scope"> - <el-input - v-model="scope.row.testValue" - @blur="changeState(scope.row)" - placeholder="璇疯緭鍏ユ娴嬪��" - ></el-input> + <el-tooltip + :disabled="scope.row.deviceId != null" + class="item" + effect="dark" + content="璇峰厛閫夋嫨璁惧锛�" + placement="top-start" + > + <el-input + :disabled="scope.row.deviceId == null" + v-model="scope.row.testValueList[index]" + @blur="changeState(scope.row, index)" + placeholder="璇疯緭鍏ユ娴嬪��" + ></el-input> + </el-tooltip> </template> </el-table-column> - <el-table-column prop="deviceName" label="璇曢獙璁惧"> - <el-button type="text">閫夋嫨</el-button> + <el-table-column prop="deviceName" label="璇曢獙璁惧" min-width="100"> + <template slot-scope="scope"> + <el-button type="text" @click="clickTableSelect(scope)">{{ + scope.row.deviceId == null ? "璇烽�夋嫨" : scope.row.deviceName + }}</el-button> + </template> </el-table-column> - <el-table-column prop="testState" label="缁撹"> + <el-table-column + v-if="detailId !== null" + prop="testState" + label="缁撹" + min-width="100" + > <template slot-scope="scope"> <span v-show="scope.row.testState != null" @@ -207,8 +254,8 @@ <span v-show="scope.row.testState == null">鏆傛湭缁撹</span> </template> </el-table-column> - <el-table-column v-if="detailId == null" label="鎿嶄綔" fixed="right"> - <template scope="scope"> + <el-table-column v-if="detailId == null" label="鎿嶄綔" width="100"> + <template slot-scope="scope"> <el-button type="text" @click="clickDeleteline(scope)" >鍒犻櫎</el-button > @@ -256,6 +303,47 @@ </el-table-column> </el-table> </div> + <el-dialog + title="璇烽�夋嫨璁惧" + :visible.sync="centerDialogVisible" + width="20%" + > + <div class="div_device_dialog"> + <el-input + placeholder="杈撳叆鍏抽敭瀛楄繘琛岃繃婊�" + v-model="filterText" + style="margin-bottom: 6px;" + > + </el-input> + <el-tree + class="filter-tree" + :data="materialOptions" + :props="defaultProps" + default-expand-all + highlight-current + @node-click="nodeClick" + :filter-node-method="filterNode" + ref="tree" + > + <div class="custom-tree-node" slot-scope="{ data }"> + <span + ><i + :class=" + `node_i ${ + data.children ? 'el-icon-folder-opened' : 'el-icon-tickets' + }` + " + ></i> + {{ data.name }}</span + > + </div> + </el-tree> + </div> + <span slot="footer" class="dialog-footer"> + <el-button @click="centerDialogVisible = false">鍙� 娑�</el-button> + <el-button type="primary" @click="clickNodeSure()">纭� 瀹�</el-button> + </span> + </el-dialog> </div> </template> @@ -299,33 +387,69 @@ }, data() { return { + // 娣诲姞鍒� + empiricalValueAdd: 1, + // 缂栬緫鏃跺瓨鍌ㄦ渶闀跨殑鍒楁暟瀛楋紝鍋氬垹闄ゅ垽鏂� + empiricalValueAddMaxNumber: 0, + // 璁惧閫夋嫨鏍戞樉绀� + centerDialogVisible: false, // 璇︽儏椤靛氨鏄鎯呬俊鎭� detailInfo: {}, + // 琛ㄦ牸 projectTable: [], // 鏂板缓妫�楠屽崟鍙傛暟瀵硅薄 rawInsParams: {}, // 椤圭洰鍚嶇Оoptions - materialOptions: [], - specificationOptions: [] + specificationOptions: [], + filterText: "", + materialOptions: [], // 鏍戞暟鎹� + defaultProps: { + // 璁惧鏍戞暟鎹缃� + children: "children", + label: "name" + }, + nodeData: "", // node鐐瑰嚮淇濆瓨褰撳墠鐐瑰嚮鏁版嵁 + clickSelectSaveIndex: "" // 鐐瑰嚮閫夋嫨瀛樺偍鍒楄〃绱㈠紩 }; }, + watch: { + filterText(val) { + this.$refs.tree.filter(val); + } + }, methods: { + // 璁惧鏍戣繃婊ゆ悳绱� + filterNode(value, data) { + if (!value) return true; + return data.name.indexOf(value) !== -1; + }, + // 鑾峰彇鎶ユ鍗曡鎯呬俊鎭� async getDetailInfo() { - const { data } = await this.$axios.get( - this.$api.url.selectRawInspectsListById + `${this.detailId}`, - { params: { id: this.detailId } } - ); - this.detailInfo = data; - this.projectTable = data.rawInsProducts; + await this.$axios + .get(this.$api.url.selectRawInspectsListById + `${this.detailId}`, { + params: { id: this.detailId } + }) + .then(res => { + this.detailInfo = res.data; + this.projectTable = res.data.children; + this.projectTable.forEach(i => { + i.testValueList = i.testValue.split(","); + // 鍙栨渶闀跨殑鍒楄〃鏁� + if (i.testValueList.length > this.empiricalValueAdd) { + this.empiricalValueAdd = i.testValueList.length; + this.empiricalValueAddMaxNumber = i.testValueList.length - 1; + } + }); + }); }, // 鏂板妫�楠屽崟 async addNewRawInspect() { - this.detailInfo.specifications = this.detailInfo.specificationsArr.join( - "-" - ); - // const time = this.detailInfo.formTime - // this.detailInfo.formTime = `${time.getFullYear()}-${time.getMonth() + 1 < 10 ? '0' + (time.getMonth() + 1) : time.getMonth() + 1}-${time.getDate() < 10 ? '0' + time.getDate() : time.getDate()}` + this.projectTable.forEach(i => { + // 灏嗗垪琛ㄨ浆鎹负瀛楃涓� + i.testValue = i.testValueList.join(","); + }); + this.detailInfo.rawInsProducts = this.projectTable; const res = await this.$axios.post( this.$api.url.addRawInspects, { ...this.detailInfo }, @@ -333,18 +457,20 @@ ); this.detailId = res.data; this.getDetailInfo(); - - this.$message.success("鎻愪氦鎴愬姛"); + this.$message.success(res.message); }, + // 淇敼椤圭洰鐨勬娴嬪�兼敼鍙樼粨璁� - async changeState(row) { - const res = await this.$axios.post( - this.$api.url.updaterawInsProduct, - { ...row }, - { headers: { "Content-Type": "application/json" } } - ); - this.$message.success("鎻愪氦鎴愬姛"); - this.getDetailInfo(); //閲嶆柊鍒锋柊淇℃伅鏁版嵁 + async changeState(row, index) { + if (this.detailId !== null) { + const res = await this.$axios.post(this.$api.url.updaterawInsProduct, { + DevId: row.deviceId, + rpId: this.detailId, + testValue: row.testValueList[index] + }); + this.$message.success("鎻愪氦鎴愬姛"); + this.getDetailInfo(); //閲嶆柊鍒锋柊淇℃伅鏁版嵁 + } }, async submitSave() { const res = await this.$axios.post( @@ -353,30 +479,22 @@ this.$message.success("鎻愪氦鎴愬姛"); this.getDetailInfo(); }, - async getOptions() { - const { data } = await this.$axios.get(this.$api.url.selectDevice); - this.materialOptions = data; - }, - checkRawName(data) { - this.materialOptions.forEach(item => { - if (item.name === data) { - this.detailInfo.code = item.code; - this.$axios - .get(this.$api.url.selectSpBySt, { params: { id: item.id } }) - .then(res => { - this.specificationOptions = res.data; - }); - } + // 鑾峰彇璁惧鏍戝唴瀹� + getOptions() { + this.$axios.get(this.$api.url.rawSelectDevice).then(res => { + this.materialOptions = res.data; }); }, // 娣诲姞琛� clickAddLine() { let obj = { - deviceId: 0, + deviceId: null, + deviceName: "", internal: "", name: "", required: "", - testValue: "", + textValue: "", + testValueList: [], unit: "" }; this.projectTable.push(obj); @@ -384,12 +502,52 @@ // 鍒犻櫎琛� clickDeleteline(scope) { this.projectTable.splice(scope.$index, 1); + }, + // 鐐瑰嚮璁惧鏍戜繚瀛樼偣鍑昏褰� + nodeClick(data) { + if (data.id != undefined) this.nodeData = data; + }, + // 鐐瑰嚮琛ㄦ牸閫夋嫨瑙﹀彂 + clickTableSelect(scope) { + this.centerDialogVisible = true; + this.clickSelectSaveIndex = scope.$index; + }, + // 鐐瑰嚮鏍戦噷闈㈢殑纭畾 + clickNodeSure() { + this.projectTable[this.clickSelectSaveIndex].deviceId = this.nodeData.id; + this.projectTable[ + this.clickSelectSaveIndex + ].deviceName = this.nodeData.name; + this.centerDialogVisible = false; + }, + // 鍒犻櫎妫�楠屽�煎垪 + clickDeleteInspectionColumn() { + if (this.empiricalValueAdd - 1 === 0) { + } else { + if (this.empiricalValueAddMaxNumber != this.empiricalValueAdd - 1) { + this.empiricalValueAdd = this.empiricalValueAdd - 1; + this.projectTable.forEach(i => { + i.testValueList.splice(this.empiricalValueAdd, 1); + }); + } + } + }, + // 娣诲姞妫�楠屽�煎垪 + clickAddInspectionColumn() { + this.empiricalValueAdd = this.empiricalValueAdd + 1; } } }; </script> <style scoped> +.node_i { + color: orange; +} +.div_device_dialog { + min-height: 400px; + overflow: auto; +} .rawInsBox { height: 100%; width: 100%; @@ -397,6 +555,9 @@ display: flex; flex-direction: column; } +.el-table__fixed-body-wrapper { + top: 48px; +} .rawInsBox .title .el-button { height: 32px; border: 1px solid rgba(190, 190, 190, 0.44); diff --git a/src/components/view/rawUnqualified/raw.vue b/src/components/view/rawUnqualified/raw.vue index ac0b8c4..a92a38f 100644 --- a/src/components/view/rawUnqualified/raw.vue +++ b/src/components/view/rawUnqualified/raw.vue @@ -71,7 +71,7 @@ > <el-table-column type="selection" width="50"> </el-table-column> <el-table-column type="index" label="搴忓彿" width="60"> - <template scope="scope"> + <template slot-scope="scope"> {{ (search.pageSize - 1) * search.countSize + scope.$index + 1 }} </template> </el-table-column> diff --git a/src/components/view/record-content.vue b/src/components/view/record-content.vue index 12b98b3..8c5976a 100644 --- a/src/components/view/record-content.vue +++ b/src/components/view/record-content.vue @@ -1,606 +1,729 @@ <style scoped> - .title .el-button { - height: 32px; - border: 1px solid rgba(190, 190, 190, 0.44); - box-shadow: 0px 2px 4px rgba(220, 220, 220, 0.41); - padding: 0 12px; - } +.title .el-button { + height: 32px; + border: 1px solid rgba(190, 190, 190, 0.44); + box-shadow: 0px 2px 4px rgba(220, 220, 220, 0.41); + padding: 0 12px; +} - .title { - margin-bottom: 10px; - padding: 0 20px; - } +.title { + margin-bottom: 10px; + padding: 0 20px; +} - .title * { - font-size: 16px; - } +.title * { + font-size: 16px; +} - .choose { - padding: 21px 24px; - display: flex; - align-items: center; - background-color: #fff; - border-bottom: 3px solid rgb(245, 247, 251); - } +.choose { + padding: 21px 24px; + display: flex; + align-items: center; + background-color: #fff; + border-bottom: 3px solid rgb(245, 247, 251); +} - .choose * { - font-size: 14px; - } +.choose * { + font-size: 14px; +} - .choose .el-button { - height: 32px; - border: 1px solid rgba(190, 190, 190, 0.44); - box-shadow: 0px 2px 4px rgba(220, 220, 220, 0.41); - padding: 0 12px; - } +.choose .el-button { + height: 32px; + border: 1px solid rgba(190, 190, 190, 0.44); + box-shadow: 0px 2px 4px rgba(220, 220, 220, 0.41); + padding: 0 12px; +} - .thing { - width: 100%; - height: calc(100% - 120px); - background-color: #fff; - display: flex; - } +.thing { + width: 100%; + height: calc(100% - 120px); + background-color: #fff; + display: flex; +} - .thing .left { - width: 295px; - height: calc(100% - 20px); - border-right: 3px solid rgb(245, 247, 251); - padding: 16px; - } +.thing .left { + width: 295px; + height: calc(100% - 20px); + border-right: 3px solid rgb(245, 247, 251); + padding: 16px; +} - .thing .left .custom-tree-node span { - font-size: 14px; - } +.thing .left .custom-tree-node span { + font-size: 14px; +} - .thing .left .custom-tree-node { - flex: 1; - display: flex; - align-items: center; - justify-content: space-between; - font-size: 14px; - padding-right: 8px; - } +.thing .left .custom-tree-node { + flex: 1; + display: flex; + align-items: center; + justify-content: space-between; + font-size: 14px; + padding-right: 8px; +} - .node_i { - color: orange; - } +.node_i { + color: orange; +} - .el-icon-delete { - display: none; - color: #004EA2; - } +.el-icon-delete { + display: none; + color: #004ea2; +} - .custom-tree-node:hover .el-icon-delete { - display: inline; - } +.custom-tree-node:hover .el-icon-delete { + display: inline; +} - .thing .right { - width: calc(100% - 305px); - height: calc(100% - 25px); - overflow: hidden; - padding: 10px; - } +.thing .right { + width: calc(100% - 305px); + height: calc(100% - 25px); + overflow: hidden; + padding: 10px; +} - .table_do { - color: #004ea0; - cursor: pointer; - } +.table_do { + color: #004ea0; + cursor: pointer; +} </style> <style> - .record_content .title .el-button * { - font-size: 14px; - } +.record_content .title .el-button * { + font-size: 14px; +} - .record_content .title .el-button--default { - color: #004EA2; - } +.record_content .title .el-button--default { + color: #004ea2; +} - .record_content .thing .left .el-tree--highlight-current .el-tree-node.is-current>.el-tree-node__content { - background: rgba(58, 124, 253, 0.2); - color: #004EA2; - } +.record_content + .thing + .left + .el-tree--highlight-current + .el-tree-node.is-current + > .el-tree-node__content { + background: rgba(58, 124, 253, 0.2); + color: #004ea2; +} - .record_content .el-tree-node__content { - height: 30px; - border-radius: 2px; - } +.record_content .el-tree-node__content { + height: 30px; + border-radius: 2px; +} </style> - <template> - <div class="record_content"> - <div class="title"> - <el-row> - <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" @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-select> - <!-- <span>宸ュ簭锛�</span> + <div class="record_content"> + <div class="title"> + <el-row> + <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" + @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-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" @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 - @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> - <div class="right"> - <el-table :data="tableData" border style="width: 100%;overflow-y: auto;min-height: 100%" max-height="100%" - @selection-change="handleSelectionChange" default-expand-all> - <el-table-column type="selection" width="50"> - </el-table-column> - <el-table-column type="index" label="搴忓彿" width="70"> - </el-table-column> - <el-table-column prop="name" label="鍚嶇О"> - </el-table-column> - <el-table-column prop="unit" label="鍗曚綅"> - </el-table-column> - <el-table-column prop="note" 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, scope.row)">鍒犻櫎</span> - </template> - </el-table-column> - </el-table> - </div> - </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" placeholder="璇烽�夋嫨绫诲瀷" style="width: 310px;"> - <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-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"> - <template> - <el-select v-model="edit.techFather" - placeholder="璇烽�夋嫨绫诲瀷" - @change="workevent" - style="width: 310px;"> - <el-option - v-for="item in process" - :key="item.name" - :label="item.name" - :value="item.name"> - </el-option> - </el-select> - </template> - </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"> - <template> - <el-select v-model="edit.techName" placeholder="璇烽�夋嫨绫诲瀷" style="width: 310px;"> - <el-option - v-for="item in craftapi" - :key="item.id" - :label="item.name" - :value="item.id"> - </el-option> - </el-select> - </template> - </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.name" 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.unit" 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.note" size="small" clearable></el-input> - </el-col> - </el-row> - </div> - <span slot="footer" class="dialog-footer"> - <el-button type="primary" @click="submitUpData">纭� 瀹�</el-button> - <el-button @click="upDia = false">鍙� 娑�</el-button> - </span> - </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="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> - </template> - </el-form-item> - <el-form-item label="宸ュ簭"> - <template> - <el-select v-model="form.work" - @change="workevent" - placeholder="璇烽�夋嫨绫诲瀷" style="width: 480px;"> - <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-form-item label="宸ヨ壓鍚嶇О"> - <template> - <el-select v-model="form.craft" placeholder="璇烽�夋嫨绫诲瀷" style="width: 480px;"> - <el-option - v-for="item in craftapi" - :key="item.id" - :label="item.name" - :value="item.id"> - </el-option> - </el-select> - </template> - </el-form-item> - <el-form-item label="璁板綍"> - <el-input v-model="form.record"></el-input> - </el-form-item> - <el-form-item label="澶囨敞"> - <el-input v-model="form.remarks"></el-input> - </el-form-item> - <el-form-item label="鍗曚綅"> - <el-input v-model="form.unit"></el-input> - </el-form-item> - </el-form> - </div> - <span slot="footer" class="dialog-footer"> - <el-button type="primary" @click="add">纭� 瀹�</el-button> - <el-button @click="dialogVisible = false">鍙� 娑�</el-button> - </span> - </el-dialog> + </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 + @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> + <div class="right"> + <el-table + :data="tableData" + border + style="width: 100%;overflow-y: auto;min-height: 100%" + max-height="100%" + @selection-change="handleSelectionChange" + default-expand-all + > + <el-table-column type="selection" width="50"> </el-table-column> + <el-table-column type="index" label="搴忓彿" width="70"> + </el-table-column> + <el-table-column prop="name" label="鍚嶇О"> </el-table-column> + <el-table-column prop="unit" label="鍗曚綅"> </el-table-column> + <el-table-column prop="note" 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, scope.row)" + >鍒犻櫎</span + > + </template> + </el-table-column> + </el-table> + </div> + </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" + placeholder="璇烽�夋嫨绫诲瀷" + style="width: 310px;" + > + <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-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"> + <template> + <el-select + v-model="edit.techFather" + placeholder="璇烽�夋嫨绫诲瀷" + @change="workevent" + style="width: 310px;" + > + <el-option + v-for="item in process" + :key="item.name" + :label="item.name" + :value="item.name" + > + </el-option> + </el-select> + </template> + </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"> + <template> + <el-select + v-model="edit.techName" + placeholder="璇烽�夋嫨绫诲瀷" + style="width: 310px;" + > + <el-option + v-for="item in craftapi" + :key="item.id" + :label="item.name" + :value="item.id" + > + </el-option> + </el-select> + </template> + </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.name" 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.unit" 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.note" size="small" clearable></el-input> + </el-col> + </el-row> + </div> + <span slot="footer" class="dialog-footer"> + <el-button type="primary" @click="submitUpData">纭� 瀹�</el-button> + <el-button @click="upDia = false">鍙� 娑�</el-button> + </span> + </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="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> + </template> + </el-form-item> + <el-form-item label="宸ュ簭"> + <template> + <el-select + v-model="form.work" + @change="workevent" + placeholder="璇烽�夋嫨绫诲瀷" + style="width: 480px;" + > + <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-form-item label="宸ヨ壓鍚嶇О"> + <template> + <el-select + v-model="form.craft" + placeholder="璇烽�夋嫨绫诲瀷" + style="width: 480px;" + > + <el-option + v-for="item in craftapi" + :key="item.id" + :label="item.name" + :value="item.id" + > + </el-option> + </el-select> + </template> + </el-form-item> + <el-form-item label="璁板綍"> + <el-input v-model="form.record"></el-input> + </el-form-item> + <el-form-item label="澶囨敞"> + <el-input v-model="form.remarks"></el-input> + </el-form-item> + <el-form-item label="鍗曚綅"> + <el-input v-model="form.unit"></el-input> + </el-form-item> + </el-form> + </div> + <span slot="footer" class="dialog-footer"> + <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%"> - <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> - </template> - </el-form-item> - <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> - </template> - </el-form-item> - <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> - </template> - </el-form-item> - <el-form-item label="璁板綍"> - <el-input v-model="form.record"></el-input> - </el-form-item> - <el-form-item label="澶囨敞"> - <el-input v-model="form.remarks"></el-input> - </el-form-item> - <el-form-item label="鍗曚綅"> - <el-input v-model="form.unit"></el-input> - </el-form-item> - </el-form> - </div> - <span slot="footer" class="dialog-footer"> - <el-button type="primary" @click="modifyVisible = false">纭� 瀹�</el-button> - <el-button @click="modifyVisible = false">鍙� 娑�</el-button> - </span> - </el-dialog> - </div> + <!-- 淇敼寮圭獥 --> + <el-dialog title="宸ュ簭缂栬緫" :visible.sync="modifyVisible" 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> + </template> + </el-form-item> + <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> + </template> + </el-form-item> + <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> + </template> + </el-form-item> + <el-form-item label="璁板綍"> + <el-input v-model="form.record"></el-input> + </el-form-item> + <el-form-item label="澶囨敞"> + <el-input v-model="form.remarks"></el-input> + </el-form-item> + <el-form-item label="鍗曚綅"> + <el-input v-model="form.unit"></el-input> + </el-form-item> + </el-form> + </div> + <span slot="footer" class="dialog-footer"> + <el-button type="primary" @click="modifyVisible = false" + >纭� 瀹�</el-button + > + <el-button @click="modifyVisible = false">鍙� 娑�</el-button> + </span> + </el-dialog> + </div> </template> <script> - export default { - data() { - return { - search: { - type: 0, - name: 2, - technology: 2 - }, - options:[], - value:{}, - craftapi:[], - form:{ - type:'', - work:'', - craft:'', - name:'', - record:'', - remarks:'', - unit:'', - }, - modifyVisible:false, - dialogVisible:false, - process: {}, - list: [], - checkTreeNode: {}, - tableData: [], - upIndex: 0, - selects: [], - delete:[], - typeselect:0, - upDia: false, - checkTreeNode:{ - id:2, - }, - upData:{}, - edit:{ - name:'', - note:'', - techFather:'', - techName:'', - type:'', - unit:'', - }, - upData: { - id: 0, - name: null, - unit: null, - thing: null - } - } - }, - mounted() { - this.selectAllleft() - this.selectjilu() - }, - methods: { - delQueById() { - this.$axios.get(this.$api.url.delQueById,) - }, - childrenClick() {}, - //鏂板 - workevent(val){ - console.log(val); - let idx = this.process.findIndex(el => el.name === val) - this.craftapi = this.process[idx].children - }, - 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" - } - }) - }, - addRecord() { - this.$axios.post(this.$api.url.addRecord,{ - name:this.form.record, - note:this.form.remarks, - techTemId:this.form.craft, - unit:this.form.unit, - } - , { - headers: { - "Content-Type": "application/json" - } - } - ) - }, - add() { - this.dialogVisible = false - this.addRecord() - this.selectjilu() - this.form = {}; - }, - //缂栬緫 this.upData - selecRecord() { - this.$axios.get(this.$api.url.selecRecord,{ - params:{ - id:this.upData.id - } - }).then(res => { - this.edit = res.data[0] - // console.log(this.edit); - }) - }, - TYpe(val) { - this.typeselect = val - console.log(this.typeselect); - this.selectAllleft() - }, - //涓讳綋宸� - selectAllleft() { - this.$axios.get(this.$api.url.selectAllleft,{ - params:{type:this.typeselect} - }).then(res => { - this.list = res.data; - console.log(this.list); - this.selectDataList() - }) - }, - //selectjilu checkTreeNode - selectjilu() { - this.$axios.get(this.$api.url.selectjilu,{ - 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; - return data.name.indexOf(value) !== -1; - }, - remove(node, data) { - this.$confirm("鏄惁鍒犻櫎", "璀﹀憡", { - type: "warning" - }).then(res => { - const parent = node.parent; - const children = parent.data.children || parent.data; - const index = children.findIndex(d => d.id === data.id); - children.splice(index, 1); - }).catch(e => {}) - }, - 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++ - }, - handleNodeClick(data) { - this.checkTreeNode = data - this.selectjilu() - if(data.code=='[3]'){ - console.log(data); - } - }, - nodeOpen(data, node, el) { - $($(el.$el).find('.node_i')[0]).attr('class', 'node_i el-icon-folder-opened') - }, - nodeClose(data, node, el) { - $($(el.$el).find('.node_i')[0]).attr('class', 'node_i el-icon-folder') - }, - handleSelectionChange(val) { - this.selects = val; - }, - 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(',') - console.log(this.delete); - this.delAllRecord() - this.$message.success('鍒犻櫎瀹屾垚') - }, - //鎵归噺鍒犻櫎 - delAllRecord() { - this.$axios.post(this.$api.url.delAllRecord,{ - ids:this.delete - }) - }, +export default { + data() { + return { + search: { + type: 0, + name: 2, + technology: 2 + }, + options: [], + value: {}, + craftapi: [], + form: { + type: "", + work: "", + craft: "", + name: "", + record: "", + remarks: "", + unit: "" + }, + modifyVisible: false, + dialogVisible: false, + process: {}, + list: [], + checkTreeNode: {}, + tableData: [], + upIndex: 0, + selects: [], + delete: [], + typeselect: 0, + upDia: false, + checkTreeNode: { + id: 2 + }, + upData: {}, + edit: { + name: "", + note: "", + techFather: "", + techName: "", + type: "", + unit: "" + }, + upData: { + id: 0, + name: null, + unit: null, + thing: null + } + }; + }, + mounted() { + this.selectAllleft(); + this.selectjilu(); + }, + methods: { + delQueById() { + this.$axios.get(this.$api.url.delQueById); + }, + childrenClick() {}, + //鏂板 + workevent(val) { + console.log(val); + let idx = this.process.findIndex(el => el.name === val); + this.craftapi = this.process[idx].children; + }, + 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" + } + } + ); + }, + addRecord() { + this.$axios.post( + this.$api.url.addRecord, + { + name: this.form.record, + note: this.form.remarks, + techTemId: this.form.craft, + unit: this.form.unit + }, + { + headers: { + "Content-Type": "application/json" + } + } + ); + }, + add() { + this.dialogVisible = false; + this.addRecord(); + this.selectjilu(); + this.form = {}; + }, + //缂栬緫 this.upData + selecRecord() { + this.$axios + .get(this.$api.url.selecRecord, { + params: { + id: this.upData.id + } + }) + .then(res => { + this.edit = res.data[0]; + // console.log(this.edit); + }); + }, + TYpe(val) { + this.typeselect = val; + console.log(this.typeselect); + this.selectAllleft(); + }, + //涓讳綋宸� + selectAllleft() { + this.$axios + .get(this.$api.url.selectAllleft, { + params: { type: this.typeselect } + }) + .then(res => { + this.list = res.data; + console.log(this.list); + this.selectDataList(); + }); + }, + //selectjilu checkTreeNode + selectjilu() { + this.$axios + .get(this.$api.url.selectjilu, { + 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; + return data.name.indexOf(value) !== -1; + }, + remove(node, data) { + this.$confirm("鏄惁鍒犻櫎", "璀﹀憡", { + type: "warning" + }) + .then(res => { + const parent = node.parent; + const children = parent.data.children || parent.data; + const index = children.findIndex(d => d.id === data.id); + children.splice(index, 1); + }) + .catch(e => {}); + }, + 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++; + }, + handleNodeClick(data) { + this.checkTreeNode = data; + this.selectjilu(); + if (data.code == "[3]") { + console.log(data); + } + }, + nodeOpen(data, node, el) { + $($(el.$el).find(".node_i")[0]).attr( + "class", + "node_i el-icon-folder-opened" + ); + }, + nodeClose(data, node, el) { + $($(el.$el).find(".node_i")[0]).attr("class", "node_i el-icon-folder"); + }, + handleSelectionChange(val) { + this.selects = val; + }, + 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(","); + console.log(this.delete); + this.delAllRecord(); + this.$message.success("鍒犻櫎瀹屾垚"); + }, + //鎵归噺鍒犻櫎 + delAllRecord() { + this.$axios.post(this.$api.url.delAllRecord, { + ids: this.delete + }); + }, - //鍒犻櫎 - delQueById() { - this.$axios.post(this.$api.url.delQueById,{ - id:this.upData.id - }) - }, - deleteRow(index, rows) { - this.tableData.splice(index,1) - this.upData.id = rows.id - this.delQueById() - }, + //鍒犻櫎 + delQueById() { + this.$axios.post(this.$api.url.delQueById, { + id: this.upData.id + }); + }, + deleteRow(index, rows) { + this.tableData.splice(index, 1); + this.upData.id = rows.id; + this.delQueById(); + }, - upContent(ob) { - this.upData = ob - console.log(this.upData); - this.selecRecord() - this.chooseTechFath() - this.upDia = true - }, - submitUpData() { - this.tableData.forEach(a => { - if (a.id == this.upData.id) { - a.name = this.upData.name - a.unit = this.upData.unit - a.thing = this.upData.thing - } - }) - this.$message.success('淇敼鎴愬姛') - this.upDia = false - } - } - } + upContent(ob) { + this.upData = ob; + console.log(this.upData); + this.selecRecord(); + this.chooseTechFath(); + this.upDia = true; + }, + submitUpData() { + this.tableData.forEach(a => { + if (a.id == this.upData.id) { + a.name = this.upData.name; + a.unit = this.upData.unit; + a.thing = this.upData.thing; + } + }); + this.$message.success("淇敼鎴愬姛"); + this.upDia = false; + } + } +}; </script> diff --git a/src/components/view/unqualifiedManagement.vue b/src/components/view/unqualifiedManagement.vue index e1f6686..17e01c2 100644 --- a/src/components/view/unqualifiedManagement.vue +++ b/src/components/view/unqualifiedManagement.vue @@ -56,7 +56,7 @@ > <el-table-column type="selection" width="50"> </el-table-column> <el-table-column type="index" label="搴忓彿" width="60"> - <template scope="scope"> + <template slot-scope="scope"> {{ (search.pageSize - 1) * search.countSize + scope.$index + 1 }} </template> </el-table-column> diff --git a/src/main.js b/src/main.js index f3d0d1e..599b7e9 100644 --- a/src/main.js +++ b/src/main.js @@ -59,6 +59,7 @@ // console.log(config.data) } + return config }, function(error) { return Promise.reject(error) diff --git a/src/view/enter.vue b/src/view/enter.vue index 523fdb0..56d4eb0 100644 --- a/src/view/enter.vue +++ b/src/view/enter.vue @@ -1,122 +1,149 @@ <style scoped> - .enter { - width: 100vw; - height: 100vh; - display: flex; - background-image: url("../../static/img/鐧诲綍.png"); - background-size: 100% 100%; - } +.enter { + width: 100vw; + height: 100vh; + display: flex; + background-image: url("../../static/img/鐧诲綍.png"); + background-size: 100% 100%; +} - .left { - width: calc(100% - 500px); - height: 100%; - overflow: hidden; - } +.left { + width: calc(100% - 500px); + height: 100%; + overflow: hidden; +} - .left img { - width: 100%; - min-height: 100%; - } +.left img { + width: 100%; + min-height: 100%; +} - .right { - width: 600px; - overflow-y: auto; - display: flex; - align-items: center; - justify-content: center; - } +.right { + width: 600px; + overflow-y: auto; + display: flex; + align-items: center; + justify-content: center; +} - .title_big { - color: #004EA2; - font-size: 40px; - margin-bottom: 8px; - } +.title_big { + color: #004ea2; + font-size: 40px; + margin-bottom: 8px; +} - .title_small { - color: #004EA2; - font-size: 24px; - } +.title_small { + color: #004ea2; + font-size: 24px; +} - .elform { - margin-top: 50px; - } +.elform { + margin-top: 50px; +} - .sao { - font-size: 14px; - color: #004EA2; - width: 100%; - text-align: right; - } +.sao { + font-size: 14px; + color: #004ea2; + width: 100%; + text-align: right; +} </style> <style> - .enter .el-form-item__label { - font-size: 20px; - color: #333; - line-height: 48px; - } +.enter .el-form-item__label { + font-size: 20px; + color: #333; + line-height: 48px; +} - .enter .el-form-item { - margin-bottom: 30px; - } +.enter .el-form-item { + margin-bottom: 30px; +} - .enter .el-input__inner { - height: 48px; - } +.enter .el-input__inner { + height: 48px; +} - .enter .el-button { - background-color: #1763EB; - color: #fff; - border: 0; - border-radius: 16px; - width: 100%; - height: 48px; - } +.enter .el-button { + background-color: #1763eb; + color: #fff; + border: 0; + border-radius: 16px; + width: 100%; + height: 48px; +} - .enter input::-webkit-input-placeholder, - .enter textarea::-webkit-input-placeholder { - font-size: 14px; - } +.enter input::-webkit-input-placeholder, +.enter textarea::-webkit-input-placeholder { + font-size: 14px; +} - .enter input::-moz-placeholder, - .enter textarea::-moz-placeholder { - font-size: 10px; - } +.enter input::-moz-placeholder, +.enter textarea::-moz-placeholder { + font-size: 10px; +} - .enter input:-ms-input-placeholder, - .enter textarea:-ms-input-placeholder { - font-size: 10px; - } +.enter input:-ms-input-placeholder, +.enter textarea:-ms-input-placeholder { + font-size: 10px; +} - .enter input:-moz-placeholder, - .enter textarea:-moz-placeholder { - font-size: 10px; - } +.enter input:-moz-placeholder, +.enter textarea:-moz-placeholder { + font-size: 10px; +} </style> <template> <div class="enter"> <div class="left"> - <img src="../../static/img/鐧诲綍鑳屾櫙.png"> + <img src="../../static/img/鐧诲綍鑳屾櫙.png" /> </div> <div class="right"> <div style="width: calc(100% - 100px * 2);"> <div class="title_big">娆㈣繋鎮ㄧ櫥褰曪紒</div> <div class="title_small">鐢电紗闄勪欢鏂颁竴浠om绯荤粺</div> - <el-form :model="ruleForm" :rules="rules" ref="ruleForm" class="elform" :hide-required-asterisk="true"> + <el-form + :model="ruleForm" + :rules="rules" + ref="ruleForm" + class="elform" + :hide-required-asterisk="true" + > <el-form-item label="鐢ㄦ埛鍚�" prop="account"> - <el-input v-model="ruleForm.account" placeholder="璇疯緭鍏ヨ处鍙�" clearable></el-input> + <el-input + v-model="ruleForm.account" + placeholder="璇疯緭鍏ヨ处鍙�" + clearable + ></el-input> </el-form-item> <el-form-item label="瀵嗙爜" prop="pwd"> - <el-input v-model="ruleForm.pwd" placeholder="璇疯緭鍏ュ瘑鐮�" clearable show-password></el-input> + <el-input + v-model="ruleForm.pwd" + placeholder="璇疯緭鍏ュ瘑鐮�" + clearable + show-password + ></el-input> </el-form-item> <el-form-item style="margin-bottom: 8px;"> - <el-col :span="12"><el-checkbox v-model="ruleForm.remumberme">璁颁綇瀵嗙爜</el-checkbox></el-col> - <el-col :span="12" style="text-align: right;"><el-checkbox - v-model="ruleForm.autoenter">鑷姩鐧诲綍</el-checkbox></el-col> + <el-col :span="12" + ><el-checkbox v-model="ruleForm.remumberme" + >璁颁綇瀵嗙爜</el-checkbox + ></el-col + > + <el-col :span="12" style="text-align: right;" + ><el-checkbox v-model="ruleForm.autoenter" + >鑷姩鐧诲綍</el-checkbox + ></el-col + > </el-form-item> <el-form-item style="margin-bottom: 15px;"> - <el-button type="primary" @click="submitForm('ruleForm')" :loading="btnload">绔嬪嵆鐧诲綍</el-button> + <el-button + type="primary" + @click="submitForm('ruleForm')" + :loading="btnload" + >绔嬪嵆鐧诲綍</el-button + > </el-form-item> </el-form> <div class="sao">寰俊鎵爜鐧诲綍</div> @@ -126,80 +153,100 @@ </template> <script> - export default { - data() { - return { - ruleForm: { - account: null, - pwd: null, - remumberme: false, - autoenter: false - }, - rules: { - account: [{ +export default { + data() { + return { + ruleForm: { + account: null, + pwd: null, + remumberme: false, + autoenter: false + }, + rules: { + account: [ + { required: true, - message: '璇疯緭鍏ヨ处鍙�', - trigger: ['blur', 'change'] - }], - pwd: [{ + message: "璇疯緭鍏ヨ处鍙�", + trigger: ["blur", "change"] + } + ], + pwd: [ + { required: true, - message: '璇疯緭鍏ュ瘑鐮�', - trigger: ['blur', 'change'] - }] - }, - btnload: false + message: "璇疯緭鍏ュ瘑鐮�", + trigger: ["blur", "change"] + } + ] + }, + btnload: false + }; + }, + mounted() { + this.ruleForm.remumberme = + JSON.parse(localStorage.getItem("rememberme")) == null + ? false + : JSON.parse(localStorage.getItem("rememberme")); + this.ruleForm.autoenter = + JSON.parse(localStorage.getItem("autoenter")) == null + ? false + : JSON.parse(localStorage.getItem("autoenter")); + var user = JSON.parse(localStorage.getItem("user")); + if (user != null && user != undefined) { + if (this.ruleForm.remumberme == true) { + this.ruleForm.account = user.account; + this.ruleForm.pwd = user.password; } - }, - mounted() { - this.ruleForm.remumberme = JSON.parse(localStorage.getItem('rememberme'))==null?false:JSON.parse(localStorage.getItem('rememberme')) - this.ruleForm.autoenter = JSON.parse(localStorage.getItem('autoenter'))==null?false:JSON.parse(localStorage.getItem('autoenter')) - var user = JSON.parse(localStorage.getItem('user')) - if (user != null && user != undefined) { - if (this.ruleForm.remumberme==true) { - this.ruleForm.account = user.account - this.ruleForm.pwd = user.password - } - if (this.ruleForm.autoenter==true) { - this.submitForm('ruleForm') - } + if (this.ruleForm.autoenter == true) { + this.submitForm("ruleForm"); } - }, - methods: { - submitForm(formName) { - this.btnload = true - this.$refs[formName].validate((valid) => { - if (valid) { - this.axios.post(this.$api.url.enter, { + } + }, + methods: { + submitForm(formName) { + this.btnload = true; + this.$refs[formName].validate(valid => { + if (valid) { + this.axios + .post(this.$api.url.enter, { account: this.ruleForm.account, password: this.ruleForm.pwd - }).then(res => { - this.btnload = false - if (res.data == null) { - this.$message.error("璐﹀彿鎴栧瘑鐮侀敊璇�") - return - } - localStorage.setItem('rememberme', this.ruleForm.remumberme) - localStorage.setItem('autoenter', this.ruleForm.autoenter) - if (this.ruleForm.remumberme==true||this.ruleForm.autoenter==true) localStorage.setItem('user', JSON.stringify({ - account: this.ruleForm.account, - password: this.ruleForm.pwd, - name: res.data.name - })) - sessionStorage.setItem('token', res.data.token) - sessionStorage.setItem('reToken', res.data.reToken) - this.$message.success("鐧诲綍鎴愬姛") - this.$router.push('/') - }).catch(e => { - this.btnload = false - this.$message.error('鐧诲綍澶辫触, 璇疯仈绯荤鐞嗗憳') }) - } else { - this.btnload = false - this.$message.error('璐﹀彿鎴栧瘑鐮佹湭杈撳叆锛�') - return false; - } - }) - }, + .then(res => { + this.btnload = false; + if (res.data == null) { + this.$message.error("璐﹀彿鎴栧瘑鐮侀敊璇�"); + return; + } + localStorage.setItem("rememberme", this.ruleForm.remumberme); + localStorage.setItem("autoenter", this.ruleForm.autoenter); + if ( + this.ruleForm.remumberme == true || + this.ruleForm.autoenter == true + ) + localStorage.setItem( + "user", + JSON.stringify({ + account: this.ruleForm.account, + password: this.ruleForm.pwd, + name: res.data.name + }) + ); + sessionStorage.setItem("token", res.data.token); + sessionStorage.setItem("reToken", res.data.reToken); + this.$message.success("鐧诲綍鎴愬姛"); + this.$router.push("/"); + }) + .catch(e => { + this.btnload = false; + this.$message.error("鐧诲綍澶辫触, 璇疯仈绯荤鐞嗗憳"); + }); + } else { + this.btnload = false; + this.$message.error("璐﹀彿鎴栧瘑鐮佹湭杈撳叆锛�"); + return false; + } + }); } } +}; </script> diff --git a/src/view/index.vue b/src/view/index.vue index 942bfac..09cfbd5 100644 --- a/src/view/index.vue +++ b/src/view/index.vue @@ -1,569 +1,629 @@ <style scoped> - .all { - width: 100vw; - height: 100vh; - background-size: 100% 100%; - display: flex; - flex-wrap: wrap; - } +.all { + width: 100vw; + height: 100vh; + background-size: 100% 100%; + display: flex; + flex-wrap: wrap; +} - .title { - width: 100%; - height: 58px; - display: flex; - align-items: center; - padding: 0 30px; - } +.title { + width: 100%; + height: 58px; + display: flex; + align-items: center; + padding: 0 30px; +} - .logo { - width: 130px; - } +.logo { + width: 130px; +} - .logo img { - width: 100%; - height: 100%; - } +.logo img { + width: 100%; + height: 100%; +} - .title .label { - font-size: 18px; - text-align: center; - width: calc(100% - 130px - 200px); - } +.title .label { + font-size: 18px; + text-align: center; + width: calc(100% - 130px - 200px); +} - .user { - width: 200px; - height: 100%; - display: flex; - align-items: center; - justify-content: right; - color: #000; - } +.user { + width: 200px; + height: 100%; + display: flex; + align-items: center; + justify-content: right; + color: #000; +} - .user * { - margin: 0 5px; - } +.user * { + margin: 0 5px; +} - .user img { - margin-left: 20px; - cursor: pointer; - width: 14px; - } +.user img { + margin-left: 20px; + cursor: pointer; + width: 14px; +} - .user span { - font-size: 14px; - } +.user span { + font-size: 14px; +} - .left { - height: calc(100vh - 58px - 40px); - background-color: #004ea2; - display: flex; - align-items: center; - flex-direction: column; - padding: 20px 0; - transition: .3s; - } +.left { + height: calc(100vh - 58px - 40px); + background-color: #004ea2; + display: flex; + align-items: center; + flex-direction: column; + padding: 20px 0; + transition: 0.3s; + overflow-y: auto; +} - .left .box { - color: #fff; - width: 68px; - height: 68px; - margin: 8px 0; - cursor: pointer; - display: flex; - align-items: center; - justify-content: center; - flex-direction: column; - border-radius: 8px; - } +.left::-webkit-scrollbar { + width: 0; +} - .left .box:active { - opacity: 0.8; - } +.left .box { + color: #fff; + width: 68px; + height: 68px; + margin: 8px 0; + cursor: pointer; + display: flex; + align-items: center; + justify-content: center; + flex-direction: column; + border-radius: 8px; +} - .left .active_box { - background-color: #fff; - color: #004ea2; - } +.left .box:active { + opacity: 0.8; +} - .left .box i { - font-size: 32px; - margin-bottom: 8px; - } +.left .active_box { + background-color: #fff; + color: #004ea2; +} - .left .box div { - font-size: 14px; - } +.left .box i { + font-size: 32px; + margin-bottom: 8px; +} - .small_menu { - color: #666; - } +.left .box div { + font-size: 14px; +} - .small_menu .active_p { - color: #004ea2; - } +.small_menu { + color: #666; +} - .small_menu p { - padding: 12px 15px; - cursor: pointer; - } +.small_menu .active_p { + color: #004ea2; +} - .small_menu p:hover { - background-color: rgba(0, 0, 0, 0.05); - } +.small_menu p { + padding: 12px 15px; + cursor: pointer; +} - .small_menu i { - font-size: 16px; - } +.small_menu p:hover { + background-color: rgba(0, 0, 0, 0.05); +} - .small_menu span { - font-size: 14px; - } +.small_menu i { + font-size: 16px; +} - .right { - height: calc(100vh - 58px); - transition: .3s; - } +.small_menu span { + font-size: 14px; +} - .tag { - width: 100%; - height: 36px; - background: rgb(255, 255, 255); - opacity: 0.8; - box-shadow: 0px 4px 16px rgba(0, 0, 0, 0.1); - display: flex; - align-items: center; - color: #999; - font-size: 14px; - } +.right { + height: calc(100vh - 58px); + transition: 0.3s; +} - .tag > .el-icon-s-unfold,.el-icon-s-fold { - font-size: 18px; - cursor: pointer; - margin: 0 8px; - } +.tag { + width: 100%; + height: 36px; + background: rgb(255, 255, 255); + opacity: 0.8; + box-shadow: 0px 4px 16px rgba(0, 0, 0, 0.1); + display: flex; + align-items: center; + color: #999; + font-size: 14px; +} - .tabs { - min-width: calc(100% - 34px); - height: 100%; - align-items: center; - display: flex; - overflow-x: auto; - } +.tag > .el-icon-s-unfold, +.el-icon-s-fold { + font-size: 18px; + cursor: pointer; + margin: 0 8px; +} - .tab { - cursor: pointer; - font-size: 14px; - margin: 0 8px; - line-height: 32px; - transition: 0.3s; - border-top: 2px solid transparent; - border-bottom: 2px solid transparent; - user-select: none; - flex-shrink: 0; - } +.tabs { + min-width: calc(100% - 34px); + height: 100%; + align-items: center; + display: flex; + overflow-x: auto; +} - .tab i { - font-size: 12px; - display: none; - } +.tab { + cursor: pointer; + font-size: 14px; + margin: 0 8px; + line-height: 32px; + transition: 0.3s; + border-top: 2px solid transparent; + border-bottom: 2px solid transparent; + user-select: none; + flex-shrink: 0; +} - .active_tab { - border-bottom: 2px solid #004ea2; - color: #004ea2; - } +.tab i { + font-size: 12px; + display: none; +} - .active_tab i { - display: inline; - color: #004ea2; - } +.active_tab { + border-bottom: 2px solid #004ea2; + color: #004ea2; +} - .component_view { - height: calc(100vh - 94px - 22px); - width: calc(100% - 48px); - padding: 11px 24px; - background: rgb(245, 247, 251); - } +.active_tab i { + display: inline; + color: #004ea2; +} - .com_index { - width: 100%; - height: 100%; - } +.component_view { + height: calc(100vh - 94px - 22px); + width: calc(100% - 48px); + padding: 11px 24px; + background: rgb(245, 247, 251); + overflow-y: auto; +} + +.com_index { + width: 100%; + height: 100%; +} </style> <style></style> <template> - <div class="all"> - <div class="title"> - <div class="logo"> - <img src="../../static/img/logo 1.png" /> - </div> - <div class="label">涓ぉ娴锋磱鏂颁竴浠om绯荤粺</div> - <div class="user"> - <el-avatar :size="24">{{ userName.substring(0, 1) }}</el-avatar> - <span>{{ userName }}</span> - <img src="../../static/img/閫�鍑�.png" @click="out" /> - </div> - </div> - <div class="left" :style="`width: ${leftOpen?'92':'0'}px;`"> - <div :class="`box ${activeBox == 0 ? 'active_box' : ''}`" @click="addTab(menu[0].c[0])"> - <i class="font icon-shouye"></i> - <div>棣栭〉</div> - </div> - <div :class="`box ${activeBox == 3 ? 'active_box' : ''}`" @click="addTab(menu[1].c[0])"> - <i class="font icon-jine"></i> - <div>閿�鍞鐞�</div> - </div> - <el-popover placement="right-start" width="90" trigger="click" v-for="(a, ai) in menu" :key="ai" - v-if="a.k != '0' && a.k != '3'"> - <div :class="`box ${activeBox == a.k ? 'active_box' : ''}`" @click="activeBox = a.k" slot="reference"> - <i :class="a.i"></i> - <div>{{ a.v }}</div> - </div> - <div class="small_menu"> - <p v-for="(b, bi) in a.c" :key="bi" :class="activeP == b.k ? 'active_p' : ''" @click="addTab(b)"> - <i :class="b.i"></i> - <span>{{ b.v }}</span> - </p> - </div> - </el-popover> - </div> - <div class="right" :style="`width: calc(100% - ${leftOpen?'92':'0'}px);`"> - <div class="tag"> - <i :class="`${leftOpen?'el-icon-s-unfold':'el-icon-s-fold'}`" @click="leftOpen = !leftOpen"></i> - <div class="tabs"> - <div :class="`tab ${tabActive == a.k ? 'active_tab' : ''}`" v-for="(a, ai) in tabs" :key="ai" - @click="upTabActive(a.k)"> - {{ a.v }} - <i class="el-icon-close" @click="removeTab(ai)" v-if="tabActive!=0"></i> - </div> - </div> - </div> - <div class="component_view"> - <component class="com_index" v-for="(com, index) in tabs" :is="com.u" :key="upIndex + '|' + index" - v-show="com.k == tabActive"> - </component> - </div> - </div> - </div> + <div class="all"> + <div class="title"> + <div class="logo"> + <img src="../../static/img/logo 1.png" /> + </div> + <div class="label">涓ぉ娴锋磱鏂颁竴浠om绯荤粺</div> + <div class="user"> + <el-avatar :size="24">{{ userName.substring(0, 1) }}</el-avatar> + <span>{{ userName }}</span> + <img src="../../static/img/閫�鍑�.png" @click="out" /> + </div> + </div> + <div class="left" :style="`width: ${leftOpen ? '92' : '0'}px;`"> + <div + :class="`box ${activeBox == 0 ? 'active_box' : ''}`" + @click="addTab(menu[0].c[0])" + > + <i class="font icon-shouye"></i> + <div>棣栭〉</div> + </div> + <div + :class="`box ${activeBox == 3 ? 'active_box' : ''}`" + @click="addTab(menu[1].c[0])" + > + <i class="font icon-jine"></i> + <div>閿�鍞鐞�</div> + </div> + <el-popover + placement="right-start" + width="90" + trigger="click" + v-for="(a, ai) in menu" + :key="ai" + v-if="a.k != '0' && a.k != '3'" + > + <div + :class="`box ${activeBox == a.k ? 'active_box' : ''}`" + @click="activeBox = a.k" + slot="reference" + > + <i :class="a.i"></i> + <div>{{ a.v }}</div> + </div> + <div class="small_menu"> + <p + v-for="(b, bi) in a.c" + :key="bi" + :class="activeP == b.k ? 'active_p' : ''" + @click="addTab(b)" + > + <i :class="b.i"></i> + <span>{{ b.v }}</span> + </p> + </div> + </el-popover> + </div> + <div + class="right" + :style="`width: calc(100% - ${leftOpen ? '92' : '0'}px);`" + > + <div class="tag"> + <i + :class="`${leftOpen ? 'el-icon-s-unfold' : 'el-icon-s-fold'}`" + @click="leftOpen = !leftOpen" + ></i> + <div class="tabs"> + <div + :class="`tab ${tabActive == a.k ? 'active_tab' : ''}`" + v-for="(a, ai) in tabs" + :key="ai" + @click="upTabActive(a.k)" + > + {{ a.v }} + <i + class="el-icon-close" + @click="removeTab(ai)" + v-if="tabActive != 0" + ></i> + </div> + </div> + </div> + <div class="component_view"> + <component + class="com_index" + v-for="(com, index) in tabs" + :is="com.u" + :key="upIndex + '|' + index" + v-show="com.k == tabActive" + > + </component> + </div> + </div> + </div> </template> <script> - const requireComponent = require.context("../components/view", false, /\.vue/); - var comObj = {}; - requireComponent.keys().forEach(fileName => { - var names = fileName - .split("/") - .pop() - .replace(".vue", ""); - const componentConfig = requireComponent(fileName); - comObj[names] = componentConfig.default || componentConfig; - }); - export default { - components: comObj, - data() { - return { - userName: "value", - leftOpen: true, - menu: [{ - k: 0, - v: "棣栭〉", - i: "font icon-shouye", - c: [{ - k: 0, - v: "棣栭〉", - i: "font icon-shouye", - u: "index-index" - }] - }, - { - k: 3, - v: "閿�鍞鐞�", - i: "font icon-jine", - c: [{ - k: 11, - v: "閿�鍞鐞�", - i: "font icon-jine", - u: "sale" - }] - }, - { - k: 1, - v: "鎶�鏈鐞�", - i: "font icon-ic_form_set24px", - c: [{ - k: 1, - v: "鏍囧噯BOM", - i: "font icon-shouye", - u: "standard" - }, - { - k: 2, - v: "璁㈠崟BOM", - i: "font icon-shouye", - u: "technical" - } - ] - }, - { - k: 4, - v: "鐢熶骇绠$悊", - i: "font icon-shengchanguanli", - c: [{ - k: 12, - v: "鐢熶骇璁㈠崟", - i: "font icon-shouye", - u: "" - }, - { - k: 13, - v: "鐢熶骇璁″垝", - i: "font icon-shouye", - u: "" - }, - { - k: 14, - v: "鐢熶骇鎶ュ伐", - i: "font icon-shouye", - u: "" - } - ] - }, - { - k: 5, - v: "WMS绠$悊", - i: "font icon-a-Inventorydumprequest", - c: [{ - k: 15, - v: "鍘熸潗鏂欏簱瀛�", - i: "font icon-shouye", - u: "" - }, - { - k: 16, - v: "鍥炲崟绠$悊", - i: "font icon-shouye", - u: "" - }, - { - k: 17, - v: "鍗婃垚鍝佸簱瀛�", - i: "font icon-shouye", - u: "" - }, - { - k: 18, - v: "鎴愬搧搴撳瓨", - i: "font icon-shouye", - u: "" - }, - { - k: 19, - v: "鎴愬搧鍙戣揣", - i: "font icon-shouye", - u: "" - }, - { - k: 20, - v: "鎴愬搧鍏ュ簱", - i: "font icon-shouye", - u: "" - } - ] - }, - { - k: 2, - v: "QMS绠$悊", - i: "font icon-xunhuan", - c: [{ - k: 3, - v: "鍘熸潗鏂欐楠�", - i: "font icon-shouye", - u: "rawInsBox" - }, - { - k: 4, - v: "鍘熸潗鏂欎笉鍚堟牸鍝�", - i: "font icon-shouye", - u: "rawUnqualifiedBox" - }, - { - k: 5, - v: "杩囩▼妫�楠�", - i: "font icon-shouye", - u: "processInspection" - }, - { - k: 6, - v: "鎴愬搧妫�楠�", - i: "font icon-shouye", - u: "finishedProductInspection" - }, - { - k: 7, - v: "涓嶅悎鏍煎搧绠$悊", - i: "font icon-shouye", - u: "unqualifiedManagement" - }, - { - k: 9, - v: "璐ㄩ噺缁熻", - i: "font icon-shouye", - u: "" - }, - { - k: 10, - v: "璁¢噺绠$悊", - i: "font icon-shouye", - u: "measurementManagement" - }, - { - k: 10.1, - v: "涓嶅悎鏍煎搧澶勭疆", - i: "font icon-shouye", - u: "Processingproducts" - } - ] - }, - { - k: 6, - v: "鏍哥畻绠$悊", - i: "font icon-caiwuhesuanxitong", - c: [{ - k: 21, - v: "浜ч噺宸ヨ祫", - i: "font icon-shouye", - u: "" - }, - { - k: 22, - v: "鍛樺伐鍑哄嫟", - i: "font icon-shouye", - u: "" - } - ] - }, - { - k: 7, - v: "鍩虹鏁版嵁", - i: "font icon-a-ziyuan20", - c: [{ - k: 23, - v: "鐢熶骇璁板綍缁存姢", - i: "font icon-shouye", - u: "record-content" - }, - { - k: 24, - v: "鑷椤圭洰缁存姢", - i: "font icon-shouye", - u: "self-inspection" - }, - { - k: 25, - v: "鎶�鏈寚鏍囩淮鎶�", - i: "font icon-shouye", - u: "Technicalindex" - }, - { - k: 26, - v: "宸ヨ壓璺嚎缁存姢", - i: "font icon-shouye", - u: "technology" - }, - { - k: 27, - v: "璁惧缁存姢", - i: "font icon-shouye", - u: "laboratoryManagement" - }, - { - k: 28, - v: "鐗╂枡娓呭崟缁存姢", - i: "font icon-shouye", - u: "mbom" - }, - // { - // k: 29, - // v: "宸℃椤圭洰缁存姢", - // i: "font icon-shouye", - // u: "routinginspection" - // }, - { - k: 30, - v: "鐢熶骇宸ヨ壓缁存姢", - i: "font icon-shouye", - u: "equipmentmaintain" - } - ] - } - ], - activeBox: 0, - activeP: 0, - tabActive: 0, - tabs: [{ - k: 0, - v: "棣栭〉", - i: "font icon-shouye", - u: "index-index" - }], - upIndex: 0 - }; - }, - created() {}, - mounted() { - this.userName = JSON.parse(localStorage.getItem("user")).name; - }, - methods: { - addTab(ob) { - if (ob.k == 0) this.activeBox = 0; - if (ob.k == 11) this.activeBox = 3; - this.activeP = ob.k; //0 - this.tabActive = ob.k; //0 - let num = -1; - this.tabs.forEach((a, ai) => { - if (ob.k == a.k) { - num = a.k; - } - }); - // 濡傛灉娌℃湁閬嶅巻鍒皌abs閲屾病鏈夎ob瀵瑰簲鐨則able锛屽線tabs閲岄潰鍔犲叆璇b - if (num == -1) { - this.tabs.push(ob); - } - }, - removeTab(index) { - if (this.tabs.length > 1) { - this.tabs.splice(index, 1); - this.activeP = this.tabs[this.tabs.length - 1].k; - this.tabActive = this.tabs[this.tabs.length - 1].k; - } else { - this.$message.warning("涓嶈兘鍏抽棴鏈�鍚庣殑鏍囩"); - } - }, - upTabActive(num) { - this.tabActive = num; - this.activeP = num; - if (num == 0) { - this.activeBox = 0; - } else if (num > 0 && num <= 2) { - this.activeBox = 1; - } else if (num > 2 && num < 11) { - this.activeBox = 2; - } else if (num == 11) { - this.activeBox = 3; - } else if (num > 11 && num <= 14) { - this.activeBox = 4; - } else if (num > 14 && num <= 20) { - this.activeBox = 5 - } else if (num > 20 && num <= 22) { - this.activeBox = 6 - } else if (num > 22 && num <= 30) { - this.activeBox = 7 - } - }, - out() { - sessionStorage.clear(); - localStorage.removeItem("autoenter"); - this.$router.push("/enter"); - } - } - }; +const requireComponent = require.context("../components/view", false, /\.vue/); +var comObj = {}; +requireComponent.keys().forEach(fileName => { + var names = fileName + .split("/") + .pop() + .replace(".vue", ""); + const componentConfig = requireComponent(fileName); + comObj[names] = componentConfig.default || componentConfig; +}); +export default { + components: comObj, + data() { + return { + userName: "value", + leftOpen: true, + menu: [ + { + k: 0, + v: "棣栭〉", + i: "font icon-shouye", + c: [ + { + k: 0, + v: "棣栭〉", + i: "font icon-shouye", + u: "index-index" + } + ] + }, + { + k: 3, + v: "閿�鍞鐞�", + i: "font icon-jine", + c: [ + { + k: 11, + v: "閿�鍞鐞�", + i: "font icon-jine", + u: "sale" + } + ] + }, + { + k: 1, + v: "鎶�鏈鐞�", + i: "font icon-ic_form_set24px", + c: [ + { + k: 1, + v: "鏍囧噯BOM", + i: "font icon-shouye", + u: "standard" + }, + { + k: 2, + v: "璁㈠崟BOM", + i: "font icon-shouye", + u: "technical" + } + ] + }, + { + k: 4, + v: "鐢熶骇绠$悊", + i: "font icon-shengchanguanli", + c: [ + { + k: 12, + v: "鐢熶骇璁㈠崟", + i: "font icon-shouye", + u: "" + }, + { + k: 13, + v: "鐢熶骇璁″垝", + i: "font icon-shouye", + u: "" + }, + { + k: 14, + v: "鐢熶骇鎶ュ伐", + i: "font icon-shouye", + u: "" + } + ] + }, + { + k: 5, + v: "WMS绠$悊", + i: "font icon-a-Inventorydumprequest", + c: [ + { + k: 15, + v: "鍘熸潗鏂欏簱瀛�", + i: "font icon-shouye", + u: "" + }, + { + k: 16, + v: "鍥炲崟绠$悊", + i: "font icon-shouye", + u: "" + }, + { + k: 17, + v: "鍗婃垚鍝佸簱瀛�", + i: "font icon-shouye", + u: "" + }, + { + k: 18, + v: "鎴愬搧搴撳瓨", + i: "font icon-shouye", + u: "" + }, + { + k: 19, + v: "鎴愬搧鍙戣揣", + i: "font icon-shouye", + u: "" + }, + { + k: 20, + v: "鎴愬搧鍏ュ簱", + i: "font icon-shouye", + u: "" + } + ] + }, + { + k: 2, + v: "QMS绠$悊", + i: "font icon-xunhuan", + c: [ + { + k: 3, + v: "鍘熸潗鏂欐楠�", + i: "font icon-shouye", + u: "rawInsBox" + }, + { + k: 4, + v: "鍘熸潗鏂欎笉鍚堟牸鍝�", + i: "font icon-shouye", + u: "rawUnqualifiedBox" + }, + { + k: 5, + v: "杩囩▼妫�楠�", + i: "font icon-shouye", + u: "processInspection" + }, + { + k: 6, + v: "鎴愬搧妫�楠�", + i: "font icon-shouye", + u: "finishedProductInspection" + }, + { + k: 7, + v: "涓嶅悎鏍煎搧绠$悊", + i: "font icon-shouye", + u: "unqualifiedManagement" + }, + { + k: 9, + v: "璐ㄩ噺缁熻", + i: "font icon-shouye", + u: "" + }, + { + k: 10, + v: "璁¢噺绠$悊", + i: "font icon-shouye", + u: "measurementManagement" + }, + { + k: 10.1, + v: "涓嶅悎鏍煎搧澶勭疆", + i: "font icon-shouye", + u: "Processingproducts" + } + ] + }, + { + k: 6, + v: "鏍哥畻绠$悊", + i: "font icon-caiwuhesuanxitong", + c: [ + { + k: 21, + v: "浜ч噺宸ヨ祫", + i: "font icon-shouye", + u: "" + }, + { + k: 22, + v: "鍛樺伐鍑哄嫟", + i: "font icon-shouye", + u: "" + } + ] + }, + { + k: 7, + v: "鍩虹鏁版嵁", + i: "font icon-a-ziyuan20", + c: [ + { + k: 23, + v: "鐢熶骇璁板綍缁存姢", + i: "font icon-shouye", + u: "record-content" + }, + { + k: 24, + v: "鑷椤圭洰缁存姢", + i: "font icon-shouye", + u: "self-inspection" + }, + { + k: 25, + v: "鎶�鏈寚鏍囩淮鎶�", + i: "font icon-shouye", + u: "Technicalindex" + }, + { + k: 26, + v: "宸ヨ壓璺嚎缁存姢", + i: "font icon-shouye", + u: "technology" + }, + { + k: 27, + v: "璁惧缁存姢", + i: "font icon-shouye", + u: "laboratoryManagement" + }, + { + k: 28, + v: "鐗╂枡娓呭崟缁存姢", + i: "font icon-shouye", + u: "mbom" + }, + // { + // k: 29, + // v: "宸℃椤圭洰缁存姢", + // i: "font icon-shouye", + // u: "routinginspection" + // }, + { + k: 30, + v: "鐢熶骇宸ヨ壓缁存姢", + i: "font icon-shouye", + u: "equipmentmaintain" + } + ] + } + ], + activeBox: 0, + activeP: 0, + tabActive: 0, + tabs: [ + { + k: 0, + v: "棣栭〉", + i: "font icon-shouye", + u: "index-index" + } + ], + upIndex: 0 + }; + }, + created() {}, + mounted() { + this.userName = JSON.parse(localStorage.getItem("user")).name; + }, + methods: { + addTab(ob) { + if (ob.k == 0) this.activeBox = 0; + if (ob.k == 11) this.activeBox = 3; + this.activeP = ob.k; //0 + this.tabActive = ob.k; //0 + let num = -1; + this.tabs.forEach((a, ai) => { + if (ob.k == a.k) { + num = a.k; + } + }); + // 濡傛灉娌℃湁閬嶅巻鍒皌abs閲屾病鏈夎ob瀵瑰簲鐨則able锛屽線tabs閲岄潰鍔犲叆璇b + if (num == -1) { + this.tabs.push(ob); + } + }, + removeTab(index) { + if (this.tabs.length > 1) { + this.tabs.splice(index, 1); + this.activeP = this.tabs[this.tabs.length - 1].k; + this.tabActive = this.tabs[this.tabs.length - 1].k; + } else { + this.$message.warning("涓嶈兘鍏抽棴鏈�鍚庣殑鏍囩"); + } + }, + upTabActive(num) { + this.tabActive = num; + this.activeP = num; + if (num == 0) { + this.activeBox = 0; + } else if (num > 0 && num <= 2) { + this.activeBox = 1; + } else if (num > 2 && num < 11) { + this.activeBox = 2; + } else if (num == 11) { + this.activeBox = 3; + } else if (num > 11 && num <= 14) { + this.activeBox = 4; + } else if (num > 14 && num <= 20) { + this.activeBox = 5; + } else if (num > 20 && num <= 22) { + this.activeBox = 6; + } else if (num > 22 && num <= 30) { + this.activeBox = 7; + } + }, + out() { + sessionStorage.clear(); + localStorage.removeItem("autoenter"); + this.$router.push("/enter"); + } + } +}; </script> -- Gitblit v1.9.3