| | |
| | | </el-col> |
| | | <el-col v-if="checkPermi(['standard:standardLibrary:add'])" :span="4" |
| | | style="text-align: center; line-height: 30px"> |
| | | <el-button circle icon="el-icon-plus" size="mini" type="primary" @click="addDia = true"></el-button> |
| | | <el-button circle icon="el-icon-plus" size="mini" type="primary" @click="openAddDia"></el-button> |
| | | </el-col> |
| | | </el-row> |
| | | <el-tree ref="tree" v-loading="treeLoad" :allow-drop="allowDrop" :data="list" |
| | |
| | | height: calc(100% - 30px); |
| | | overflow-y: scroll; |
| | | scrollbar-width: none; |
| | | " @node-click="handleNodeClick" @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"> |
| | |
| | | </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"> |
| | | :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"> |
| | | <template slot-scope="scope"> |
| | | <span style="color: red; font-size: 14px">{{ |
| | |
| | | </el-row> |
| | | <el-row v-loading="tableLoad2" class="product_table"> |
| | | <el-table id="templateParamTable" ref="productTable" v-loading="productTableLoading" :data="productList" |
| | | :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"> |
| | | :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"> |
| | | <el-table-column type="selection" width="50"> </el-table-column> |
| | | <el-table-column label="产品" min-width="100" prop="sample" show-overflow-tooltip></el-table-column> |
| | | <el-table-column label="型号" min-width="100" prop="model" show-overflow-tooltip></el-table-column> |
| | |
| | | <template slot-scope="scope"> |
| | | <el-button type="text" @click="sectionUp(scope.row)" :disabled="!checkPermi(['standard:standardLibrary:upStandardProduct']) |
| | | ">区间设置</el-button> |
| | | <!-- <el-button type="text" :disabled="!checkPermi(['standard:standardLibrary:upStandardProduct']) |
| | | " @click="bindSupplierDensitySecond(scope.row)">绑定厂家</el-button> --> |
| | | <el-button type="text" :disabled="!checkPermi(['standard:standardLibrary:upStandardProduct']) |
| | | " @click="bindSupplierDensitySecond(scope.row)">绑定厂家</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <!-- <el-pagination :current-page="currentPage" :page-size="300" :total="total" layout="total" |
| | | style="position: absolute; right: 16px; bottom: 1px" @current-change="handleCurrentChange"> |
| | | </el-pagination> --> |
| | | <p style="text-align: right;margin-right: 20px;color: #333;">共{{ total }}条</p> |
| | | </el-row> |
| | | </div> |
| | |
| | | <span class="required-span">* </span>型号: |
| | | </el-col> |
| | | <el-col :offset="1" :span="16"> |
| | | <el-input v-model="addOb.model" clearable placeholder="请输入型号" size="small" |
| | | @keyup.enter.native="addStandardTree"></el-input> |
| | | <el-input v-model="addOb.modelName" clearable placeholder="请输入型号" size="small"></el-input> |
| | | </el-col> |
| | | </el-row> |
| | | </div> |
| | |
| | | <span class="required-span">* </span>型号: |
| | | </el-col> |
| | | <el-col :offset="1" :span="16"> |
| | | <el-input v-model="addOb.model" clearable placeholder="请输入型号" size="small" |
| | | @keyup.enter.native="updateStandardTree"></el-input> |
| | | <el-input v-model="addOb.modelName" clearable placeholder="请输入型号" size="small"></el-input> |
| | | </el-col> |
| | | </el-row> |
| | | </div> |
| | |
| | | <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%" |
| | | :header-cell-style="{ background: '#f8f8f9', color: '#515a6e' }"> |
| | | :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="区间"> |
| | |
| | | <el-input v-model="scope.row.conductorType" clearable placeholder="导体类型" size="small"></el-input> |
| | | </template> |
| | | </el-table-column> |
| | | <!-- <el-table-column align="center" label="单价" width="120">--> |
| | | <!-- <template slot-scope="scope">--> |
| | | <!-- <el-input v-model="scope.row.price" clearable placeholder="单价" size="small"></el-input>--> |
| | | <!-- </template>--> |
| | | <!-- </el-table-column>--> |
| | | <!-- <el-table-column align="center" label="工时系数" width="120">--> |
| | | <!-- <template slot-scope="scope">--> |
| | | <!-- <el-input v-model="scope.row.manHour" clearable placeholder="工时系数" size="small"></el-input>--> |
| | | <!-- </template>--> |
| | | <!-- </el-table-column>--> |
| | | <el-table-column align="center" label="操作" width="70"> |
| | | <template slot-scope="scope"> |
| | | <el-button circle icon="el-icon-minus" size="mini" type="danger" |
| | |
| | | factory: [], |
| | | addDia: false, |
| | | updateDia: false, // 修改树名字弹框 |
| | | oldModel: "", |
| | | addOb: { |
| | | factory: null, |
| | | laboratory: null, |
| | | sampleType: null, |
| | | sample: null, |
| | | model: null, |
| | | id: '', |
| | | modelName: null, |
| | | parentLevel: '', |
| | | parentId: '', |
| | | }, |
| | | laboratory: [], |
| | | addLoad: false, |
| | |
| | | }; |
| | | }, |
| | | methods: { |
| | | // 修改最子级名字 |
| | | editTreeName(info) { |
| | | this.updateDia = true; |
| | | this.oldModel = info.label; |
| | | }, |
| | | // 拖拽时判定目标节点能否被放置 |
| | | // 'prev'、'inner' 和 'next',前、插入、后 |
| | | allowDrop(draggingNode, dropNode, type) { |
| | |
| | | } |
| | | }, |
| | | // 调用tree过滤方法 中文英过滤 |
| | | filterNode(value, data, node) { |
| | | filterNode (value, data, node) { |
| | | if (!value) { //如果数据为空,则返回true,显示所有的数据项 |
| | | return true |
| | | } |
| | |
| | | return this.chooseNode(val, data, node) // 调用过滤二层方法 |
| | | }, |
| | | // 过滤父节点 / 子节点 (如果输入的参数是父节点且能匹配,则返回该节点以及其下的所有子节点;如果参数是子节点,则返回该节点的父节点。name是中文字符,enName是英文字符. |
| | | chooseNode(value, data, node) { |
| | | chooseNode (value, data, node) { |
| | | if (data.label.indexOf(value) !== -1) { |
| | | return true |
| | | } |
| | |
| | | this.upIndex++; |
| | | }, |
| | | handleNodeClick(val, node, el) { |
| | | //树的值 |
| | | if (node.childNodes.length === 0) { |
| | | this.isShowCopy = true; |
| | | } else { |
| | | this.isShowCopy = false; |
| | | } |
| | | // 判断是否为叶子节点 |
| | | this.isShowCopy = node.childNodes.length === 0; |
| | | |
| | | // 更新父节点信息 |
| | | this.addOb.parentLevel = node.data.level; |
| | | this.addOb.parentId = node.data.value; |
| | | this.addOb.id = node.data.value; |
| | | |
| | | // 初始化分页相关变量 |
| | | this.total = 0; |
| | | this.currentPage = 1; |
| | | this.selectTree = ""; |
| | | this.getNodeParent(node); |
| | | this.selectTree = this.selectTree.replace(" - ", ""); |
| | | let data = this.selectTree.split(" - "); |
| | | let data2 = ""; |
| | | for (let index = data.length - 1; index >= 0; index--) { |
| | | data2 += " - " + data[index]; |
| | | } |
| | | this.selectTree = data2.replace(" - ", ""); |
| | | if (node.childNodes.length === 0) { |
| | | |
| | | // 拼接树路径 |
| | | this.selectTree = this.getReversedTreePath(node); |
| | | |
| | | // 如果是叶子节点,调用特定方法 |
| | | if (this.isShowCopy) { |
| | | this.selectsStandardMethodByFLSSM(); |
| | | } |
| | | let trees = this.selectTree.split(" - "); |
| | | this.addOb.factory = trees[0]; |
| | | this.addOb.laboratory = trees[1]; |
| | | this.addOb.sampleType = trees[2]; |
| | | this.addOb.sample = trees[3]; |
| | | }, |
| | | getNodeParent(val) { |
| | | if (val.parent != null) { |
| | | if (val.data.children === null) { |
| | | this.selectTree += " - " + val.label + " - " + "null"; |
| | | } else { |
| | | this.selectTree += " - " + val.label; |
| | | |
| | | /** |
| | | * 获取反向拼接的树路径字符串 |
| | | * @param {Object} node - 当前节点 |
| | | * @returns {string} - 反向拼接的树路径 |
| | | */ |
| | | getReversedTreePath(node) { |
| | | const pathParts = []; |
| | | |
| | | // 递归获取父节点路径 |
| | | const collectParentLabels = (currentNode) => { |
| | | if (currentNode && currentNode.label) { |
| | | pathParts.unshift(currentNode.label); // 将当前节点标签插入到数组开头 |
| | | } |
| | | this.getNodeParent(val.parent); |
| | | } |
| | | if (currentNode.parent) { |
| | | collectParentLabels(currentNode.parent); // 递归处理父节点 |
| | | } |
| | | }; |
| | | |
| | | collectParentLabels(node); |
| | | |
| | | // 拼接路径并返回 |
| | | return pathParts.join(" - "); |
| | | }, |
| | | remove(node, data) { |
| | | this.$confirm("是否删除该层级", "提示", { |
| | | type: "error", |
| | | }) |
| | | .then(() => { |
| | | // this.treeLoad = true |
| | | }).then(() => { |
| | | this.selectTree = ""; |
| | | // 拼接树路径 |
| | | this.selectTree = this.getReversedTreePath(node); |
| | | delStandardTree({ tree: this.selectTree }).then((res) => { |
| | | this.$message.success("已删除"); |
| | | let arr = this.selectTree.split(" - "); |
| | | this.deleteStandard(this.list, arr[arr.length - 1]); |
| | | this.selectTree = ""; |
| | | this.getNodeParent(node); |
| | | this.selectTree = this.selectTree.replace(" - ", ""); |
| | | let data = this.selectTree.split(" - "); |
| | | let data2 = ""; |
| | | for (let index = data.length - 1; index >= 0; index--) { |
| | | data2 += " - " + data[index]; |
| | | } |
| | | this.selectTree = data2.replace(" - ", ""); |
| | | delStandardTree({ tree: this.selectTree }).then((res) => { |
| | | this.$message.success("已删除"); |
| | | let arr = this.selectTree.split(" - "); |
| | | this.deleteStandard(this.list, arr[arr.length - 1]); |
| | | this.selectTree = ""; |
| | | this.standardList = []; |
| | | this.productList = []; |
| | | }); |
| | | this.standardList = []; |
| | | this.productList = []; |
| | | }) |
| | | .catch((e) => { }); |
| | | }).catch((e) => { }); |
| | | }, |
| | | deleteStandard(arr, label) { |
| | | arr.forEach((item, index) => { |
| | |
| | | this.standardEnum = data; |
| | | }); |
| | | }, |
| | | // 打开新增弹框 |
| | | openAddDia () { |
| | | this.addDia = true |
| | | this.addOb.modelName = '' |
| | | }, |
| | | // 提交分类添加 |
| | | addStandardTree() { |
| | | if (this.addOb.sampleType == null || this.addOb.sampleType == "") { |
| | | this.$message.error("对象不存在"); |
| | | return; |
| | | } |
| | | if (this.addOb.model == null || this.addOb.model == "") { |
| | | if (this.addOb.modelName == null || this.addOb.modelName == "") { |
| | | this.$message.error("请填写型号"); |
| | | return; |
| | | } |
| | | this.addLoad = true; |
| | | addStandardTree(this.addOb) |
| | | .then((res) => { |
| | | this.$message.success("添加成功"); |
| | | this.addDia = false; |
| | | this.list |
| | | .find((a) => a.label == this.addOb.factory) |
| | | .children.find((a) => a.label == this.addOb.laboratory) |
| | | .children.find((a) => a.label == this.addOb.sampleType) |
| | | .children.find((a) => a.label == this.addOb.sample) |
| | | .children.push({ |
| | | code: "[5]", |
| | | label: this.addOb.model, |
| | | value: this.addOb.model, |
| | | }); |
| | | this.addLoad = false; |
| | | }) |
| | | .catch((e) => { |
| | | this.addDia = false; |
| | | this.addLoad = false; |
| | | }); |
| | | delete this.addOb.id; |
| | | addStandardTree(this.addOb).then((res) => { |
| | | this.$message.success("添加成功"); |
| | | this.addOb.modelName = ""; |
| | | this.addDia = false; |
| | | this.selectStandardTreeList(); |
| | | this.addLoad = false; |
| | | }).catch((e) => { |
| | | this.addLoad = false; |
| | | }); |
| | | }, |
| | | // 修改型号 |
| | | // 打开修改名字弹框 |
| | | editTreeName(info) { |
| | | this.updateDia = true; |
| | | this.addOb.modelName = info.label; |
| | | }, |
| | | // 提交修改型号 |
| | | updateStandardTree() { |
| | | if (this.addOb.sampleType == null || this.addOb.sampleType == "") { |
| | | this.$message.error("对象不存在"); |
| | | return; |
| | | } |
| | | if (this.addOb.model == null || this.addOb.model == "") { |
| | | if (this.addOb.modelName == null || this.addOb.modelName == "") { |
| | | this.$message.error("请填写型号"); |
| | | return; |
| | | } |
| | | this.addOb.oldModel = this.oldModel; |
| | | this.updateLoad = true; |
| | | updateStandardTree(this.addOb) |
| | | .then((res) => { |
| | | this.$message.success("添加成功"); |
| | | this.$tab.refreshPage(); |
| | | // this.selectStandardTreeList(); |
| | | this.updateDia = false; |
| | | this.updateLoad = false; |
| | | }) |
| | | .catch((e) => { |
| | | this.updateDia = false; |
| | | this.updateLoad = false; |
| | | }); |
| | | delete this.addOb.parentLevel; |
| | | delete this.addOb.parentId; |
| | | updateStandardTree(this.addOb).then((res) => { |
| | | this.$message.success("添加成功"); |
| | | this.selectStandardTreeList(); |
| | | this.addOb.modelName = ""; |
| | | this.updateDia = false; |
| | | this.updateLoad = false; |
| | | }).catch((e) => { |
| | | this.updateLoad = false; |
| | | }); |
| | | }, |
| | | selectsStandardMethodByFLSSM() { |
| | | this.tableLoad = true; |
| | |
| | | |
| | | >>>.is-disabled .el-textarea__inner { |
| | | background: rgba(0, 0, 0, 0.05) !important; |
| | | } |
| | | |
| | | >>>.el-table__body-wrapper::-webkit-scrollbar { |
| | | height: 14px; |
| | | /* 设置滚动条宽度 */ |
| | | } |
| | | </style> |
| | | <style scoped> |