From ac6d1295be85d51f77f8da4d77a3abe717a6dcb7 Mon Sep 17 00:00:00 2001 From: gaoluyang <2820782392@qq.com> Date: 星期四, 13 三月 2025 16:46:06 +0800 Subject: [PATCH] 隐藏工时管理部分功能 --- src/views/standard/standardLibrary/index.vue | 108 +++++++++++++++++++++-------------------------------- 1 files changed, 43 insertions(+), 65 deletions(-) diff --git a/src/views/standard/standardLibrary/index.vue b/src/views/standard/standardLibrary/index.vue index 180ad2c..d6c8435 100644 --- a/src/views/standard/standardLibrary/index.vue +++ b/src/views/standard/standardLibrary/index.vue @@ -206,7 +206,8 @@ height: calc(100% - 30px); overflow-y: scroll; scrollbar-width: none; - " @node-click="handleNodeClick" @node-expand="nodeOpen" @node-collapse="nodeClose" @node-drop="handleDrop"> + " @node-click="handleNodeClick" + @node-drop="handleDrop"> <div slot-scope="{ node, data }" class="custom-tree-node"> <el-row style="width: 100%"> <el-col :class="{ sort: node.level > 3 }" :span="19" :title="data.label" style="text-align: left"> @@ -254,6 +255,7 @@ </el-row> <el-row v-loading="tableLoad" class="standard_table"> <el-table ref="standard" :data="standardList" class="el-table" header-row-class-name="header-class" height="220" + :header-cell-style="{ background: '#f8f8f9', color: '#515a6e' }" border highlight-current-row style="width: 100%; height: 220px !important" tooltip-effect="dark" @row-click="rowClick"> <el-table-column label="鏍囧噯缂栧彿" prop="code" show-overflow-tooltip width="200"> @@ -269,7 +271,8 @@ </el-row> <el-row v-loading="tableLoad2" class="product_table"> <el-table id="templateParamTable" ref="productTable" v-loading="productTableLoading" :data="productList" - :fit="true" :row-class-name="tableRowClassName" border class="productTable" + :header-cell-style="{ background: '#f8f8f9', color: '#515a6e' }" border + :fit="true" :row-class-name="tableRowClassName" class="productTable" header-row-class-name="header-class" height="100%" row-key="id" stripe style="width: 100%" tooltip-effect="dark" @select="upProductSelect" @selection-change="handleSelectionChange" @select-all="handleAll"> @@ -410,7 +413,8 @@ </el-dialog> <el-dialog :close-on-click-modal="false" :visible.sync="sectionUpDia" title="鍖洪棿璁剧疆" width="80%"> <div class="body" style="padding: 5px 0"> - <el-table :data="sectionList" border height="350px" style="width: 100%"> + <el-table :data="sectionList" border height="350px" style="width: 100%" + :header-cell-style="{ background: '#f8f8f9', color: '#515a6e' }"> <el-table-column align="center" label="搴忓彿" type="index" width="70"> </el-table-column> <el-table-column align="center" label="鍖洪棿"> @@ -682,10 +686,42 @@ } } }, - filterNode(value, data) { - if (!value) return true; - return data.label.indexOf(value) !== -1; + // 璋冪敤tree杩囨护鏂规硶 涓枃鑻辫繃婊� + filterNode (value, data, node) { + if (!value) {銆�銆�銆�銆�//濡傛灉鏁版嵁涓虹┖锛屽垯杩斿洖true,鏄剧ず鎵�鏈夌殑鏁版嵁椤� + return true + } + // 鏌ヨ鍒楄〃鏄惁鏈夊尮閰嶆暟鎹紝灏嗗�煎皬鍐欙紝鍖归厤鑻辨枃鏁版嵁 + let val = value.toLowerCase() + return this.chooseNode(val, data, node) // 璋冪敤杩囨护浜屽眰鏂规硶 }, + // 杩囨护鐖惰妭鐐� / 瀛愯妭鐐� (濡傛灉杈撳叆鐨勫弬鏁版槸鐖惰妭鐐逛笖鑳藉尮閰嶏紝鍒欒繑鍥炶鑺傜偣浠ュ強鍏朵笅鐨勬墍鏈夊瓙鑺傜偣锛涘鏋滃弬鏁版槸瀛愯妭鐐癸紝鍒欒繑鍥炶鑺傜偣鐨勭埗鑺傜偣銆俷ame鏄腑鏂囧瓧绗︼紝enName鏄嫳鏂囧瓧绗�. + chooseNode (value, data, node) { + if (data.label.indexOf(value) !== -1) { + return true + } + const level = node.level + // 濡傛灉浼犲叆鐨勮妭鐐规湰韬氨鏄竴绾ц妭鐐瑰氨涓嶇敤鏍¢獙浜� + if (level === 1) { + return false + } + // 鍏堝彇褰撳墠鑺傜偣鐨勭埗鑺傜偣 + let parentData = node.parent + // 閬嶅巻褰撳墠鑺傜偣鐨勭埗鑺傜偣 + let index = 0 + while (index < level - 1) { + // 濡傛灉鍖归厤鍒扮洿鎺ヨ繑鍥烇紝姝ゅname鍊兼槸涓枃瀛楃锛宔nName鏄嫳鏂囧瓧绗︺�傚垽鏂尮閰嶄腑鑻辨枃杩囨护 + if (parentData.data.label.indexOf(value) !== -1) { + return true + } + // 鍚﹀垯鐨勮瘽鍐嶅線涓婁竴灞傚仛鍖归厤 + parentData = parentData.parent + index++ + } + // 娌″尮閰嶅埌杩斿洖false + return false + }, + searchFilter() { this.$refs.tree.filter(this.search); }, @@ -745,7 +781,6 @@ } this.selectTree = data2.replace(" - ", ""); delStandardTree({ tree: this.selectTree }).then((res) => { - if (res.code == 201) return; this.$message.success("宸插垹闄�"); let arr = this.selectTree.split(" - "); this.deleteStandard(this.list, arr[arr.length - 1]); @@ -764,15 +799,6 @@ item.children && this.deleteStandard(item.children, label); } }); - }, - 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"); }, selectEnumByCategoryForFactory() { this.getConfigKey("sys_factory").then((response) => { @@ -855,10 +881,6 @@ this.addLoad = true; addStandardTree(this.addOb) .then((res) => { - if (res.code === 201) { - this.addLoad = false; - return; - } this.$message.success("娣诲姞鎴愬姛"); this.addDia = false; this.list @@ -892,10 +914,6 @@ this.updateLoad = true; updateStandardTree(this.addOb) .then((res) => { - if (res.code === 201) { - this.updateLoad = false; - return; - } this.$message.success("娣诲姞鎴愬姛"); this.$tab.refreshPage(); // this.selectStandardTreeList(); @@ -929,10 +947,6 @@ ask: value, }), }).then((res) => { - if (res.code == 201) { - this.$message.error("鏈繚瀛�"); - return; - } this.$message.success("宸蹭繚瀛�"); }); }, @@ -943,10 +957,6 @@ tell: value, }), }).then((res) => { - if (res.code == 201) { - this.$message.error("鏈繚瀛�"); - return; - } this.$message.success("宸蹭繚瀛�"); }); }, @@ -958,10 +968,6 @@ methodS: value, }), }).then((res) => { - if (res.code == 201) { - this.$message.error("鏈繚瀛�"); - return; - } this.$message.success("宸蹭繚瀛�"); }); }, @@ -973,10 +979,6 @@ radius: value, }), }).then((res) => { - if (res.code == 201) { - this.$message.error("鏈繚瀛�"); - return; - } this.$message.success("宸蹭繚瀛�"); }); }, @@ -987,10 +989,6 @@ price: value, }), }).then((res) => { - if (res.code == 201) { - this.$message.error("鏈繚瀛�"); - return; - } this.$message.success("宸蹭繚瀛�"); }); }, @@ -1001,10 +999,6 @@ manHour: value, }), }).then((res) => { - if (res.code == 201) { - this.$message.error("鏈繚瀛�"); - return; - } this.$message.success("宸蹭繚瀛�"); }); }, @@ -1015,10 +1009,6 @@ templateId: value, }), }).then((res) => { - if (res.code == 201) { - this.$message.error("鏈繚瀛�"); - return; - } this.$message.success("宸蹭繚瀛�"); }); }, @@ -1099,11 +1089,7 @@ state: row.state, }), }).then((res) => { - if (res.code == 201) { - this.$message.error("鏈繚瀛�"); - return; - } - // this.$message.success('宸蹭繚瀛�') + this.$message.success('宸蹭繚瀛�') }); }, filterHandler(value) { @@ -1253,10 +1239,6 @@ }), }).then((res) => { this.sectionLoad = false; - if (res.code == 201) { - this.$message.error("鏈繚瀛�"); - return; - } this.$message.success("宸蹭繚瀛�"); this.sectionUpDia = false; }); @@ -1275,10 +1257,6 @@ }, }).then((res) => { this.sectionLoad = false; - if (res.code == 201) { - this.$message.error("鏈繚瀛�"); - return; - } this.$message.success("宸蹭繚瀛�"); this.sectionUpDia = false; this.currentPage0 = 1; -- Gitblit v1.9.3