From b25e5611ece8d25a6605a1ec66916db0942a5ed5 Mon Sep 17 00:00:00 2001 From: spring <2396852758@qq.com> Date: 星期一, 17 二月 2025 14:45:24 +0800 Subject: [PATCH] 完成标准库联调 --- src/api/standard/standardLibrary.js | 87 +++ src/views/standard/standardLibrary/index.vue | 39 + src/views/standard/standardLibrary/components/BatchCopy.vue | 863 +++++++++++++++++++++++++++++++++++++++ src/views/standard/standardLibrary/components/bindSupplierDensityDialogAsk.vue | 287 +++++++++++++ 4 files changed, 1,260 insertions(+), 16 deletions(-) diff --git a/src/api/standard/standardLibrary.js b/src/api/standard/standardLibrary.js index 914f70b..184ee68 100644 --- a/src/api/standard/standardLibrary.js +++ b/src/api/standard/standardLibrary.js @@ -19,11 +19,11 @@ } // 鍒犻櫎鏍囧噯鏍戠殑灞傜骇 -export function delStandardTree(data) { +export function delStandardTree(query) { return request({ url: "/standardTree/delStandardTree", - method: "post", - data: data, + method: "delete", + params: query, }); } @@ -206,3 +206,84 @@ data: data, }); } + +// 妫�楠岄」澶嶅埗鎺掑簭 +export function copyStandardProductSort(data) { + return request({ + url: "/standardTree/copyStandardProductSort", + method: "post", + data: data, + }); +} + +// 鎻愪氦闇�瑕佸鍒剁殑妫�楠岄」 +export function copyStandardProductOne(data) { + return request({ + url: "/standardTree/copyStandardProductOne", + method: "post", + data: data, + }); +} + +// 澶嶅埗妫�楠岄」 +export function copyStandardProductList(data) { + return request({ + url: "/standardTree/copyStandardProductList", + method: "post", + data: data, + }); +} + +// 鎻愪氦闇�瑕佸鍒剁殑妫�楠岄」 +export function updateStandardProductListBatch(data) { + return request({ + url: "/standardTree/updateStandardProductListBatch", + method: "post", + data: data, + }); +} + +// 鑾峰彇鏍囧噯鏍� +export function selectStandardTreeList2(query) { + return request({ + url: "/standardTree/selectStandardTreeList2", + method: "get", + params: query, + }); +} + +// 鏍囧噯搴撶粦瀹氬巶瀹� +export function selectSupplierAsk(data) { + return request({ + url: "/standardTree/selectSupplierAsk", + method: "post", + data: data, + }); +} + +// 鏂板鏍囧噯搴撶粦瀹氬巶瀹� +export function addProductSupplierAsk(data) { + return request({ + url: "/standardTree/addProductSupplierAsk", + method: "post", + data: data, + }); +} + +// 淇敼鏍囧噯搴撶粦瀹氬巶瀹� +export function updateProductSupplierAsk(data) { + return request({ + url: "/standardTree/updateProductSupplierAsk", + method: "post", + data: data, + }); +} + +// 鍒犻櫎鏍囧噯搴撶粦瀹氬巶瀹� +export function deleteProductSupplierAsk(query) { + return request({ + url: "/standardTree/deleteProductSupplierAsk", + method: "delete", + params: query, + }); +} diff --git a/src/views/standard/standardLibrary/components/BatchCopy.vue b/src/views/standard/standardLibrary/components/BatchCopy.vue new file mode 100644 index 0000000..4b60223 --- /dev/null +++ b/src/views/standard/standardLibrary/components/BatchCopy.vue @@ -0,0 +1,863 @@ +<template> + <div> + <el-dialog + :visible.sync="batchCopyDia" + class="more-edit" + title="鎵归噺缂栬緫" + width="90%" + > + <el-row> + <el-col :span="6" class="search_thing"> + <div class="search_label">鏍峰搧鍚嶇О锛�</div> + <div class="search_input"> + <el-input v-model="sample" disabled size="small"> + <template slot="append" + ><el-button + slot="append" + icon="el-icon-search" + @click="selectStandardTree = true" + ></el-button + ></template> + </el-input> + </div> + </el-col> + <el-col :span="6" class="search_thing"> + <div class="search_label">妫�楠屾爣鍑嗭細</div> + <div class="search_input"> + <el-select + v-model="standardMethodListId" + :loading="methodLoad" + clearable + placeholder="璇疯緭鍏�" + size="small" + @change="changeStandardMethodListId" + @focus="methodFocus" + > + <el-option + v-for="item in methods" + :key="item.id" + :label="item.code" + :value="item.id" + > + </el-option> + </el-select> + </div> + </el-col> + <el-col :span="12" style="text-align: right"> + <el-button size="small" type="primary" @click="sortCopy" + >鎺掑簭澶嶅埗</el-button + > + <el-button size="small" type="primary" @click="compareAlone" + >鍗曠嫭瀵规瘮</el-button + > + <el-button size="small" type="primary" @click="compare" + >澶嶅埗</el-button + > + </el-col> + </el-row> + <div + class="body" + style="display: flex; flex-direction: row; height: 80vh" + > + <div v-loading="productTableLoading1" style="width: 50%"> + <div>闇�瑕佸鍒剁殑妫�楠岄」</div> + <el-table + ref="productTable1" + :data="productList1" + :fit="true" + :row-key="(row) => row.id" + border + header-row-class-name="header-class" + height="90%" + highlight-current-row + stripe + style="width: 98%" + tooltip-effect="dark" + @select="handleSelectionChange1" + @select-all="handleSelectAll1" + > + <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> + <el-table-column + label="妫�楠岄」鍒嗙被" + min-width="140" + prop="inspectionItemClass" + show-overflow-tooltip + ></el-table-column> + <el-table-column + column-key="inspectionItem" + label="妫�楠岄」" + min-width="140" + prop="inspectionItem" + show-overflow-tooltip + ></el-table-column> + <el-table-column + column-key="inspectionItemSubclass" + label="妫�楠岄」瀛愰」" + min-width="140" + prop="inspectionItemSubclass" + show-overflow-tooltip + ></el-table-column> + <el-table-column + label="瑕佹眰鍊�" + min-width="200px" + prop="ask" + ></el-table-column> + <el-table-column + label="瑕佹眰鎻忚堪" + min-width="220px" + prop="tell" + ></el-table-column> + </el-table> + </div> + <div v-loading="productTableLoading0" style="width: 50%"> + <div>褰撳墠妫�楠岄」</div> + <el-table + ref="productTable0" + :data="productList0" + :fit="true" + :row-key="(row) => row.id" + border + header-row-class-name="header-class" + height="90%" + highlight-current-row + stripe + style="width: 98%" + tooltip-effect="dark" + @select="handleSelectionChange0" + @select-all="handleSelectAll0" + > + <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> + <el-table-column + label="妫�楠岄」鍒嗙被" + min-width="140" + prop="inspectionItemClass" + show-overflow-tooltip + ></el-table-column> + <el-table-column + column-key="inspectionItem" + label="妫�楠岄」" + min-width="140" + prop="inspectionItem" + show-overflow-tooltip + ></el-table-column> + <el-table-column + column-key="inspectionItemSubclass" + label="妫�楠岄」瀛愰」" + min-width="140" + prop="inspectionItemSubclass" + show-overflow-tooltip + ></el-table-column> + <el-table-column + label="瑕佹眰鍊�" + min-width="200px" + prop="ask" + ></el-table-column> + <el-table-column + label="瑕佹眰鎻忚堪" + min-width="220px" + prop="tell" + ></el-table-column> + </el-table> + </div> + </div> + </el-dialog> + <el-dialog + :visible.sync="selectStandardTree" + title="閫夋嫨鏍峰搧" + width="500px" + > + <div + v-if="selectStandardTree" + v-loading="selectStandardTreeLoading" + class="body" + style="height: 60vh; overflow-y: auto; user-select: none" + > + <el-row> + <el-col :span="24"> + <el-input + v-model="search" + clearable + placeholder="杈撳叆鍏抽敭瀛楄繘琛屾悳绱�" + size="small" + style="margin-bottom: 5px" + suffix-icon="el-icon-search" + @blur="searchFilter" + @clear="searchFilter" + @keyup.enter.native="searchFilter" + ></el-input> + </el-col> + </el-row> + <el-tree + ref="tree" + :data="list" + :default-expanded-keys="expandedKeys" + :filter-node-method="filterNode" + :props="{ children: 'children', label: 'label' }" + highlight-current + node-key="label" + @node-click="handleNodeClick" + @node-expand="nodeOpen" + @node-collapse="nodeClose" + > + <div slot-scope="{ node, data }" class="custom-tree-node"> + <el-row> + <el-col :span="24"> + <span + ><i + :class="`node_i ${ + data.children != undefined + ? data.code === '[1]' + ? 'el-icon-folder-opened' + : 'el-icon-folder' + : 'el-icon-tickets' + }`" + ></i> + {{ data.code }} {{ data.label }}</span + > + </el-col> + </el-row> + </div> + </el-tree> + </div> + <span slot="footer" class="dialog-footer"> + <el-button @click="selectStandardTree = false">鍙� 娑�</el-button> + <el-button type="primary" @click="activeStandardTree">纭� 瀹�</el-button> + </span> + </el-dialog> + <el-dialog :visible.sync="compareDia" title="纭澶嶅埗淇℃伅" width="80%"> + <div style="width: 100%"> + <el-table + ref="compareList" + :data="compareList" + :fit="true" + :row-key="(row) => row.id" + border + header-row-class-name="header-class" + height="90%" + highlight-current-row + stripe + style="width: 98%" + tooltip-effect="dark" + > + <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> + <el-table-column + label="妫�楠岄」鍒嗙被" + min-width="140" + prop="inspectionItemClass" + show-overflow-tooltip + ></el-table-column> + <el-table-column + column-key="inspectionItem" + label="妫�楠岄」" + min-width="140" + prop="inspectionItem" + show-overflow-tooltip + ></el-table-column> + <el-table-column + column-key="inspectionItemSubclass" + label="妫�楠岄」瀛愰」" + min-width="140" + prop="inspectionItemSubclass" + show-overflow-tooltip + ></el-table-column> + <el-table-column label="瑕佹眰鍊�" min-width="200px" prop="ask"> + <template slot-scope="scope"> + <el-input + v-model="scope.row.ask" + :autosize="{ minRows: 1, maxRows: 3 }" + clearable + placeholder="瑕佹眰鍊�" + size="small" + type="textarea" + ></el-input> + </template> + </el-table-column> + <el-table-column label="瑕佹眰鎻忚堪" min-width="220px" prop="tell"> + <template slot-scope="scope"> + <el-input + v-model="scope.row.tell" + :autosize="{ minRows: 1, maxRows: 3 }" + clearable + placeholder="瑕佹眰鎻忚堪" + size="small" + type="textarea" + ></el-input> + </template> + </el-table-column> + <el-table-column label="鎿嶄綔" prop="section" width="160"> + <template slot-scope="scope"> + <el-button type="text" @click="sectionUp(scope.row)" + >鍖洪棿璁剧疆</el-button + > + </template> + </el-table-column> + </el-table> + <span slot="footer" class="dialog-footer"> + <el-button size="small" @click="compareDia = false">鍙� 娑�</el-button> + <el-button + :loading="handleCompareLoading" + size="small" + type="primary" + @click="handleCompare" + >纭� 瀹�</el-button + > + </span> + </div> + </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-column align="center" label="搴忓彿" type="index" width="70"> + </el-table-column> + <el-table-column align="center" label="鍖洪棿"> + <template slot-scope="scope"> + <el-input + v-model="scope.row.thing" + clearable + placeholder="鍖洪棿" + size="small" + ></el-input> + </template> + </el-table-column> + <el-table-column align="center" label="鑺暟"> + <template slot-scope="scope"> + <el-input + v-model="scope.row.cores" + clearable + placeholder="鑺暟" + size="small" + ></el-input> + </template> + </el-table-column> + <el-table-column align="center" label="瑕佹眰鍊�"> + <template slot-scope="scope"> + <el-input + v-model="scope.row.ask" + clearable + placeholder="瑕佹眰鍊�" + size="small" + ></el-input> + </template> + </el-table-column> + <el-table-column align="center" label="瑕佹眰鎻忚堪"> + <template slot-scope="scope"> + <el-input + v-model="scope.row.tell" + :autosize="{ minRows: 1, maxRows: 2 }" + clearable + placeholder="瑕佹眰鎻忚堪" + size="small" + type="textarea" + ></el-input> + </template> + </el-table-column> + <el-table-column align="center" label="瀵间綋鏉愯川"> + <template slot-scope="scope"> + <el-input + v-model="scope.row.conductorMaterial" + clearable + placeholder="瀵间綋鏉愯川" + size="small" + ></el-input> + </template> + </el-table-column> + <el-table-column align="center" label="瀵间綋绫诲瀷"> + <template slot-scope="scope"> + <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" + @click="sectionList.splice(scope.$index, 1)" + ></el-button> + </template> + </el-table-column> + </el-table> + </div> + <span slot="footer" class="dialog-footer"> + <el-button @click="sectionUpDia = false">鍙� 娑�</el-button> + <el-button type="primary" @click="sectionLoadAdd">淇� 瀛�</el-button> + <el-button + icon="el-icon-plus" + type="primary" + @click="sectionList.push({ thing: '', price: '', manHour: '' })" + ></el-button> + </span> + </el-dialog> + </div> +</template> + +<script> +import { + selectStandardProductListByMethodId, + copyStandardProductSort, + copyStandardProductOne, + copyStandardProductList, + updateStandardProductListBatch, + selectStandardTreeList2, + selectsStandardMethodByFLSSM, +} from "@/api/standard/standardLibrary"; +export default { + name: "BatchCopy", + // import 寮曞叆鐨勭粍浠堕渶瑕佹敞鍏ュ埌瀵硅薄涓墠鑳戒娇鐢� + components: {}, + props: { + selectTree1: { + type: String, + default: () => "", + }, + standardId: { + type: Number, + default: () => null, + }, + }, + data() { + // 杩欓噷瀛樻斁鏁版嵁 + return { + batchCopyDia: false, + productTableLoading0: false, + productList0: [], + productList1: [], + productTableLoading1: false, + moreSelects: [], + templateList: [], + sample: "", // 鏍峰搧鍚嶇О + selectStandardTree: false, + selectStandardTreeLoading: false, + list: [], + search: null, + expandedKeys: [], + selectTree: null, + standardMethodListId: null, + methodLoad: false, + methods: [], + oldStandardProductList: [], + newStandardProductList: [], + compareDia: false, + compareList: [], + sectionUpDia: false, + sectionList: [], + sectionRow: null, + handleCompareLoading: false, + }; + }, + mounted() { + this.selectStandardTreeList(); + }, + // 鏂规硶闆嗗悎 + methods: { + // 鑾峰彇宸﹁竟琛ㄦ牸鏁版嵁 + getList() { + this.batchCopyDia = true; + this.productTableLoading0 = true; + selectStandardProductListByMethodId({ + id: this.standardId, + tree: this.selectTree1, + page: 1, + }).then((res) => { + this.productList0 = res.data.productList; + this.productTableLoading0 = false; + }); + }, + // 鎺掑簭澶嶅埗 + sortCopy() { + const params = { + oldStandardProductList: this.oldStandardProductList, + newStandardProductList: this.newStandardProductList, + }; + // 鎺掑簭澶嶅埗 + copyStandardProductSort(params).then((res) => { + if (res.code === 201) return; + this.$message.success("澶嶅埗鎴愬姛"); + this.compareDia = false; + this.batchCopyDia = false; + this.$emit("refreshList"); + }); + }, + compareAlone() { + const params = { + oldStandardProductList: this.oldStandardProductList, + newStandardProductList: this.newStandardProductList, + }; + // 璋冨彇鍗曠嫭姣旇緝宸﹀彸瑕佹眰鍊肩殑鎺ュ彛 + copyStandardProductOne(params).then((res) => { + if (res.code === 201) return; + this.compareDia = true; + this.compareList = res.data; + }); + }, + compare() { + const params = { + oldStandardProductList: this.oldStandardProductList, + newStandardProductList: this.newStandardProductList, + }; + // 璋冨彇姣旇緝宸﹀彸瑕佹眰鍊肩殑鎺ュ彛 + copyStandardProductList(params).then((res) => { + if (res.code === 201) return; + this.compareDia = true; + this.compareList = res.data; + }); + }, + // 鎻愪氦澶嶅埗淇℃伅 + handleCompare() { + const params = { + standardProductList: this.compareList, + }; + this.handleCompareLoading = true; + // 璋冨彇姣旇緝宸﹀彸瑕佹眰鍊肩殑鎺ュ彛 + updateStandardProductListBatch(params) + .then((res) => { + this.handleCompareLoading = false; + if (res.code === 201) return; + this.$message.success("澶嶅埗鎴愬姛"); + this.compareDia = false; + this.batchCopyDia = false; + this.$emit("refreshList"); + this.compareList = res.data; + }) + .catch((res) => { + this.handleCompareLoading = false; + }); + }, + // 鍖洪棿璁剧疆 + sectionUp(row) { + if (Array.isArray(row)) { + // 鍊兼槸涓�涓暟缁� + if (row.length === 0) { + return this.$message.error("璇烽�夋嫨妫�楠岄」"); + } + this.sectionRow = {}; + this.sectionUpDia = true; + this.sectionList = []; + } else { + // 鍊兼槸涓�涓璞� + this.sectionRow = row; + this.sectionUpDia = true; + this.sectionList = []; + if (this.sectionRow.section != null && this.sectionRow.section != "") { + JSON.parse(this.sectionRow.section).forEach((a, ai) => { + if (this.sectionRow.cores !== null) { + this.sectionList.push({ + thing: a, + ask: JSON.parse(this.sectionRow.ask)[ai], + tell: JSON.parse(this.sectionRow.tell)[ai], + price: JSON.parse(this.sectionRow.price)[ai], + manHour: JSON.parse(this.sectionRow.manHour)[ai], + cores: JSON.parse(this.sectionRow.cores)[ai], + conductorMaterial: + this.sectionRow.conductorMaterial && + JSON.parse(this.sectionRow.conductorMaterial)[ai], + conductorType: + this.sectionRow.conductorType && + JSON.parse(this.sectionRow.conductorType)[ai], + }); + } else { + this.sectionList.push({ + thing: a, + ask: JSON.parse(this.sectionRow.ask)[ai], + tell: JSON.parse(this.sectionRow.tell)[ai], + price: JSON.parse(this.sectionRow.price)[ai], + manHour: JSON.parse(this.sectionRow.manHour)[ai], + conductorMaterial: + this.sectionRow.conductorMaterial && + JSON.parse(this.sectionRow.conductorMaterial)[ai], + conductorType: + this.sectionRow.conductorType && + JSON.parse(this.sectionRow.conductorType)[ai], + }); + } + }); + } + } + }, + // 鍖洪棿淇濆瓨 + sectionLoadAdd() { + let sectionList = []; + let askList = []; + let tellList = []; + let priceList = []; + let manHourList = []; + let coresList = []; + let conductorMaterialList = []; + let conductorTypeList = []; + this.sectionList.forEach((a) => { + if (a.thing !== "") { + sectionList.push(a.thing); + askList.push(a.ask); + tellList.push(a.tell); + priceList.push(a.price); + manHourList.push(a.manHour); + coresList.push(a.cores); + conductorMaterialList.push(a.conductorMaterial); + conductorTypeList.push(a.conductorType); + } + }); + if (sectionList.length === 0) { + this.sectionRow.section = null; + this.sectionRow.ask = null; + this.sectionRow.tell = null; + this.sectionRow.price = null; + this.sectionRow.manHour = null; + this.sectionRow.cores = null; + this.sectionRow.conductorMaterial = null; + this.sectionRow.conductorType = null; + } else { + this.sectionRow.section = JSON.stringify(sectionList); + this.sectionRow.ask = JSON.stringify(askList); + this.sectionRow.tell = JSON.stringify(tellList); + this.sectionRow.price = JSON.stringify(priceList); + this.sectionRow.manHour = JSON.stringify(manHourList); + this.sectionRow.cores = JSON.stringify(coresList); + this.sectionRow.conductorMaterial = JSON.stringify( + conductorMaterialList + ); + this.sectionRow.conductorType = JSON.stringify(conductorTypeList); + } + this.sectionUpDia = false; + }, + // 鑾峰彇鏍峰搧鍚嶇О鏍� + selectStandardTreeList() { + this.selectStandardTreeLoading = true; + selectStandardTreeList2().then((res) => { + this.list = res.data; + this.list.forEach((a) => { + this.expandedKeys.push(a.label); + }); + this.selectStandardTreeLoading = false; + }); + }, + // 閫夋嫨鏍峰搧鍚嶇О鐨勫洖璋� + handleNodeClick(val, node, el) { + this.selectTree = ""; + this.getNodeParent(node); + let flag = false; + if (node.level == 3) { + if (node.data.children.length > 0) { + node.data.children.forEach((a) => { + let key = Object.keys(a); + if (!key.includes("level")) { + flag = true; + } + }); + } + } + this.selectTree = this.selectTree.replace(" - ", ""); + if (flag) { + this.selectTree = " - - " + this.selectTree; + } + let data = this.selectTree.split(" - "); + let data2 = ""; + for (let index = data.length - 1; index >= 0; index--) { + data2 += " - " + data[index]; + } + this.selectTree = data2.replace(" - ", ""); + }, + getNodeParent(val) { + if (val.parent != null) { + if (val.data.children === null) { + this.selectTree += " - " + val.label + " - " + "null"; + } else { + this.selectTree += " - " + val.label; + } + this.getNodeParent(val.parent); + } + }, + changeStandardMethodListId() { + // 鏍规嵁妫�楠屾爣鍑嗘煡鍙宠竟table鏁版嵁 + this.getRightList(); + }, + getRightList() { + this.productTableLoading1 = true; + selectStandardProductListByMethodId({ + id: this.standardMethodListId, + tree: this.selectTree, + page: 1, + }).then((res) => { + this.productList1 = res.data.productList; + this.productTableLoading1 = false; + }); + }, + // 鑱氱劍鏃讹紝鏌ヨ妫�楠屾爣鍑� + methodFocus() { + this.selectsStandardMethodByFLSSM(); + }, + selectsStandardMethodByFLSSM() { + this.methodLoad = true; + selectsStandardMethodByFLSSM({ + tree: this.selectTree, + }).then((res) => { + this.methodLoad = false; + try { + if ( + res.data.standardMethodList.length == 0 && + this.selectTree.split("-").length == 5 + ) { + let arr = this.selectTree.split("-"); + let arr0 = arr.slice(0, arr.length - 1); + let selectTree = arr0 + .join("-") + .substring(0, arr0.join("-").length - 1); + selectsStandardMethodByFLSSM({ + tree: selectTree, + }).then((ress) => { + this.methods = ress.data.standardMethodList; + }); + } else { + this.methods = res.data.standardMethodList; + } + } catch (e) {} + }); + }, + activeStandardTree() { + let trees = this.selectTree.split(" - "); + if (trees.length < 3) { + this.$message.error("鏈�夋嫨瀵硅薄"); + return; + } + if (trees[3] === undefined || trees[3] === "" || trees[3] === "- ") { + this.sample = trees[2]; + } else { + this.sample = trees[3]; + } + this.selectStandardTree = false; + }, + handleSelectionChange0(val) { + this.oldStandardProductList = val; + }, + handleSelectAll0(val) { + this.oldStandardProductList = val; + }, + handleSelectionChange1(val) { + this.newStandardProductList = val; + }, + handleSelectAll1(val) { + this.newStandardProductList = val; + }, + filterNode(value, data) { + if (!value) return true; + return data.label.indexOf(value) !== -1; + }, + searchFilter() { + this.$refs.tree.filter(this.search); + }, + 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"); + }, + }, +}; +</script> + +<style scoped> +.title { + height: 60px; + line-height: 60px; +} + +.search { + width: calc(100% - 40px); + background-color: #fff; + padding: 5px 40px 5px 0; +} + +.search_thing { + display: flex; + align-items: center; + height: 50px; +} + +.search_label { + width: 70px; + font-size: 14px; + text-align: right; +} + +.search_input { + width: calc(100% - 80px); +} +.node_i { + color: orange; + font-size: 18px; +} +.dialog-footer { + display: flex; + justify-content: flex-end; + align-items: center; + margin: 10px; +} +</style> diff --git a/src/views/standard/standardLibrary/components/bindSupplierDensityDialogAsk.vue b/src/views/standard/standardLibrary/components/bindSupplierDensityDialogAsk.vue new file mode 100644 index 0000000..3c44f19 --- /dev/null +++ b/src/views/standard/standardLibrary/components/bindSupplierDensityDialogAsk.vue @@ -0,0 +1,287 @@ +<template> + <div> + <el-dialog + title="鍘傚瑕佹眰鍊肩粦瀹�" + :visible.sync="isShow" + width="800px" + @close="$emit('closeBindPartDialog')" + > + <div + class="body" + v-if="isShow" + style="height: 500px; overflow-y: auto; padding: 5px 0" + > + <el-table + ref="bindPartTable" + :data="bindPartData" + v-loading="bindPartTableLoading" + highlight-current-row + style="width: 100%" + > + <el-table-column + type="index" + width="70" + label="搴忓彿" + ></el-table-column> + <el-table-column + property="supplierName" + label="鍘傚" + width="200" + ></el-table-column> + <el-table-column property="ask" label="瑕佹眰鍊�"></el-table-column> + <el-table-column property="tell" label="瑕佹眰鎻忚堪"></el-table-column> + <el-table-column label="鎿嶄綔" width="100"> + <template slot-scope="scope"> + <el-button + type="text" + size="small" + @click="updateBind(scope.row, 'edit')" + >缂栬緫</el-button + > + <el-button type="text" size="small" @click="deleteBind(scope.row)" + >鍒犻櫎</el-button + > + </template> + </el-table-column> + </el-table> + </div> + <!-- <div class="page" v-if="bindPartData.length > 0">--> + <!-- <el-pagination @size-change="sizeChange" @current-change="currentChange" :current-page="page.current"--> + <!-- :page-size="20" layout="prev, pager, next, jumper"--> + <!-- :total="bindPartData.length">--> + <!-- </el-pagination>--> + <!-- </div>--> + <span slot="footer" class="dialog-footer"> + <el-button @click="$emit('closeBindPartDialog')">鍙� 娑�</el-button> + <el-button + type="primary" + @click="addBindPart('add')" + :loading="addBindLoad" + >鏂� 澧�</el-button + > + </span> + </el-dialog> + <el-dialog + title="鍘傚瑕佹眰鍊肩粦瀹�" + :visible.sync="addBindSupplierDensityDialog" + v-if="addBindSupplierDensityDialog" + width="400px" + @close="closeBindPartDialog" + :close-on-click-modal="false" + > + <div class="body" v-if="addBindSupplierDensityDialog"> + <el-form + label-position="right" + label-width="100px" + ref="bindSupplierDensityData" + :rules="bindPartDataRules" + :model="bindSupplierDensityData" + > + <el-form-item label="鍘傚锛�" prop="supplierName"> + <el-input + v-model="bindSupplierDensityData.supplierName" + size="small" + ></el-input> + </el-form-item> + <el-form-item label="瑕佹眰鍊硷細" prop="ask"> + <el-input + v-model="bindSupplierDensityData.ask" + size="small" + ></el-input> + </el-form-item> + <el-form-item label="瑕佹眰鎻忚堪锛�" prop="tell"> + <el-input + v-model="bindSupplierDensityData.tell" + size="small" + ></el-input> + </el-form-item> + </el-form> + </div> + <span slot="footer" class="dialog-footer"> + <el-button @click="closeBindPartDialog">鍙� 娑�</el-button> + <el-button type="primary" @click="submitBind" :loading="bindLoad" + >纭� 璁�</el-button + > + </span> + </el-dialog> + </div> +</template> + +<script> +import { + selectSupplierAsk, + addProductSupplierAsk, + updateProductSupplierAsk, + deleteProductSupplierAsk, +} from "@/api/standard/standardLibrary"; + +export default { + name: "bindSupplierDensityDialogAsk", + props: { + bindSupplierDensityDialog: { + type: Boolean, + default: () => false, + }, + currentRow: { + // 閫夋嫨鏈潯鏁版嵁鐨勪俊鎭� + type: Object, + default: () => {}, + }, + }, + data() { + // 杩欓噷瀛樻斁鏁版嵁 + return { + isShow: this.bindSupplierDensityDialog, + bindPartData: [], + addBindSupplierDensityDialog: false, + bindSupplierDensityData: { + supplierName: null, // 鍘傚 + ask: null, + tell: null, + supplierAskId: null, + }, + bindPartDataRules: { + supplierName: [ + { required: true, message: "璇峰~鍐欏巶瀹跺悕绉�", trigger: "blur" }, + ], + ask: [{ required: true, message: "璇峰~鍐欒姹傚��", trigger: "blur" }], + tell: [{ required: true, message: "璇峰~鍐欒姹傛弿杩�", trigger: "blur" }], + }, + bindLoad: false, + upIndex: 0, + addBindLoad: false, + entity: { + productListId: "", + }, + page: { + current: 1, + size: 20, + }, + bindPartTableLoading: false, + buttonType: "", + }; + }, + mounted() { + console.log(22222, this.currentRow); + this.entity.productListId = this.currentRow.id; + this.searchTableData(); + }, + // 鏂规硶闆嗗悎 + methods: { + searchTableData() { + this.bindPartTableLoading = true; + selectSupplierAsk(this.entity) + .then((res) => { + if (res.code === 200) { + this.bindPartData = res.data; + } + this.bindPartTableLoading = false; + }) + .catch((err) => { + console.log(err); + this.bindPartTableLoading = false; + }); + }, + updateBind(row, type) { + this.buttonType = type; + this.addBindSupplierDensityDialog = true; + this.bindSupplierDensityData = { ...row }; + }, + deleteBind(row) { + this.$confirm("鏄惁鍒犻櫎褰撳墠鏁版嵁?", "璀﹀憡", { + confirmButtonText: "纭畾", + cancelButtonText: "鍙栨秷", + type: "warning", + }) + .then(() => { + deleteProductSupplierAsk({ supplierAskId: row.supplierAskId }) + .then((res) => { + if (res.code === 201) { + return; + } + this.$message.success("鍒犻櫎鎴愬姛"); + this.searchTableData(); + }) + .catch((e) => { + this.$message.error("鍒犻櫎澶辫触"); + }); + }) + .catch(() => {}); + }, + sizeChange(val) { + this.page.size = val; + }, + currentChange(val) { + this.page.current = val; + }, + addBindPart(type) { + this.buttonType = type; + this.addBindSupplierDensityDialog = true; + }, + // 鎻愪氦闆朵欢缁戝畾 + submitBind() { + this.$refs["bindSupplierDensityData"].validate((valid) => { + if (valid) { + // 鏍规嵁绫诲瀷鍒ゆ柇鏄楠屽璞¢浂浠剁粦瀹氳繕鏄骇鍝佺淮鎶ら浂浠剁粦瀹� + const str = JSON.stringify({ + productListId: this.entity.productListId, + supplierName: this.bindSupplierDensityData.supplierName, + ask: this.bindSupplierDensityData.ask, + tell: this.bindSupplierDensityData.tell, + supplierAskId: this.bindSupplierDensityData.supplierAskId, + }); + this.bindLoad = true; + if (this.buttonType === "add") { + addProductSupplierAsk({ str }) + .then((res) => { + this.bindLoad = false; + if (res.code === 200) { + this.$refs["bindSupplierDensityData"].resetFields(); + this.addBindSupplierDensityDialog = false; + this.$message.success("鎿嶄綔鎴愬姛"); + this.searchTableData(); + } + }) + .catch((err) => { + this.bindLoad = false; + console.log(err); + }); + } else { + updateProductSupplierAsk({ str }) + .then((res) => { + this.bindLoad = false; + if (res.code === 200) { + this.$refs["bindSupplierDensityData"].resetFields(); + this.addBindSupplierDensityDialog = false; + this.$message.success("鎿嶄綔鎴愬姛"); + this.searchTableData(); + } + }) + .catch((err) => { + this.bindLoad = false; + console.log(err); + }); + } + } else { + console.log("error submit!!"); + return false; + } + }); + }, + closeBindPartDialog() { + this.$refs["bindSupplierDensityData"].resetFields(); + this.bindSupplierDensityData = {}; + this.addBindSupplierDensityDialog = false; + }, + }, +}; +</script> + +<style scoped> +.page { + width: 100%; + height: 30px; + text-align: right; + margin-top: 10px; +} +</style> diff --git a/src/views/standard/standardLibrary/index.vue b/src/views/standard/standardLibrary/index.vue index c30d290..60997c2 100644 --- a/src/views/standard/standardLibrary/index.vue +++ b/src/views/standard/standardLibrary/index.vue @@ -575,11 +575,19 @@ ></el-table-column> <el-table-column label="鎿嶄綔" prop="section" width="160"> <template slot-scope="scope"> - <el-button type="text" @click="sectionUp(scope.row)" + <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 > @@ -756,12 +764,19 @@ ></el-button> </span> </el-dialog> - <!-- <bindSupplierDensityDialogAsk v-if="bindSupplierDensityDialog" - :bindSupplierDensityDialog="bindSupplierDensityDialog" - :currentRow="currentSupplierDensityRow" - @closeBindPartDialog="closeBindSupplierDensityDialog"></bindSupplierDensityDialogAsk> --> - <!-- <BatchCopy v-if="batchCopyDia" ref="BatchCopy" :selectTree1="selectTree" - :standardId="standardId" @refreshList="refreshList"></BatchCopy> --> + <bindSupplierDensityDialogAsk + v-if="bindSupplierDensityDialog" + :bindSupplierDensityDialog="bindSupplierDensityDialog" + :currentRow="currentSupplierDensityRow" + @closeBindPartDialog="closeBindSupplierDensityDialog" + ></bindSupplierDensityDialogAsk> + <BatchCopy + v-if="batchCopyDia" + ref="BatchCopy" + :selectTree1="selectTree" + :standardId="standardId" + @refreshList="refreshList" + ></BatchCopy> </div> </template> @@ -790,16 +805,14 @@ getStandardTemplate, selectStandardProductByMethodId, selectStandardProductEnumByMethodId, - resetTreeOfPrice, - resetTreeOfHour, } from "@/api/standard/standardLibrary"; import { checkPermi } from "@/utils/permission"; // 鏉冮檺鍒ゆ柇鍑芥暟 -// import bindSupplierDensityDialogAsk from "../do/a5-capacity-scope/bindSupplierDensityDialogAsk.vue"; -// import BatchCopy from "../do/a5-capacity-scope/BatchCopy.vue"; +import bindSupplierDensityDialogAsk from "./components/bindSupplierDensityDialogAsk.vue"; +import BatchCopy from "./components/BatchCopy.vue"; export default { components: { - // BatchCopy, - // bindSupplierDensityDialogAsk, + BatchCopy, + bindSupplierDensityDialogAsk, draggable, }, dicts: ["sys_factory", "sys_sub_lab", "sys_samp_type"], -- Gitblit v1.9.3