From 6f07da9344da3c3a2c099c33c3e98fb9e247fdeb Mon Sep 17 00:00:00 2001 From: Surpriseplus <845948745@qq.com> Date: 星期三, 09 八月 2023 15:48:43 +0800 Subject: [PATCH] 项目管理修改批量上传功能 --- src/views/datamanage/catalogueManage.vue | 726 +++++++++++++++++++++++++++++++++++++++++++++---------- 1 files changed, 596 insertions(+), 130 deletions(-) diff --git a/src/views/datamanage/catalogueManage.vue b/src/views/datamanage/catalogueManage.vue index 1c6b226..a6a4fe1 100644 --- a/src/views/datamanage/catalogueManage.vue +++ b/src/views/datamanage/catalogueManage.vue @@ -2,7 +2,7 @@ <div class="subpage_Box"> <My-bread :list="[ `${$t('dataManage.dataManage')}`, - `${$t('dataManage.catalogueManage')}`, + `${$t('dataManage.projectManagement')}`, ]"></My-bread> <el-divider /> <div class="mainBox"> @@ -21,8 +21,19 @@ :expand-on-click-node="false" :default-expanded-keys="expandData" @node-click="handleNodeClick" + @node-contextmenu="openTreeMenu" > </el-tree> + <div + class="right_menu box_divm" + id="menu" + v-show="showRightMenu" + > + <ul> + <li @click="setMenuDataCopy">澶嶅埗</li> + <li @click="setMenuDataPaste">绮樿创</li> + </ul> + </div> </div> </div> <div class="cataLog_rightContent right subpage_Div"> @@ -46,6 +57,25 @@ class="demo-form-inline" > <el-form-item> + + <el-button + v-show="directoryFlag" + icon="el-icon-download" + type="info" + size="small" + @click="setDirectoryDownload" + >{{ $t("shuJuGuanLi.butten.folderDownload") }}</el-button> + </el-form-item> + <el-form-item> + + <el-button + icon="el-icon-download" + type="info" + size="small" + @click="setTemplateDownload" + >{{ $t("shuJuGuanLi.butten.templateDownload") }}</el-button> + </el-form-item> + <el-form-item> <el-upload action accept=".xlsx, .xls" @@ -58,7 +88,7 @@ type="success" icon="el-icon-plus" size="small" - >{{ $t("shuJuGuanLi.butten.uploadFile") }}</el-button> + >{{ $t("shuJuGuanLi.butten.uploads") }}</el-button> </el-upload> </el-form-item> <el-form-item> @@ -126,29 +156,57 @@ > <el-form-item prop="name" - :label="$t('dataManage.dataUpObj.directoryName')" + :label="$t('dataManage.dataUpObj.name')" :label-width="formLabelWidth" > <el-input v-model="itemdetail.name" size="small" style=" max-width: 420px" - :placeholder="$t('shuJuGuanLi.shuJuJianSuo.valueone')" + :placeholder="$t('shuJuGuanLi.shuJuJianSuo.valueName')" clearable /> <!-- style="max-width: 400px"--> </el-form-item> <el-form-item - :label="$t('dataManage.dataUpObj.catalogDescription')" + :label="$t('dataManage.dataUpObj.explain')" :label-width="formLabelWidth" > <el-input v-model="itemdetail.descr" type="textarea" style=" max-width: 420px" - :placeholder="$t('shuJuGuanLi.shuJuJianSuo.valueone')" + :placeholder="$t('shuJuGuanLi.shuJuJianSuo.valueexplain')" clearable /> + </el-form-item> + <el-form-item + :label="$t('dataManage.dataUpObj.inspectionItems')" + :label-width="formLabelWidth" + > + <el-select + style="width: 420px" + v-model="itemdetail.checks" + :placeholder="$t('shuJuGuanLi.shuJuJianSuo.valueexamine')" + multiple + > + <el-option + v-for="item in options" + :key="item.value" + :label="item.label" + :value="item.value" + > + </el-option> + </el-select> + <!-- <el-input + + type="textarea" + style=" max-width: 420px" + :placeholder="$t('shuJuGuanLi.shuJuJianSuo.valueone')" + clearable + /> --> + <!-- resize="none"--> + <!-- style="height: 100%; overflow: auto; max-width: 400px"--> </el-form-item> <el-form-item :label="$t('dataManage.dataUpObj.fileExtension')" @@ -158,11 +216,9 @@ v-model="itemdetail.exts" type="textarea" style=" max-width: 420px" - :placeholder="$t('shuJuGuanLi.shuJuJianSuo.valueone')" + :placeholder="$t('shuJuGuanLi.shuJuJianSuo.valuesuffix')" clearable /> - <!-- resize="none"--> - <!-- style="height: 100%; overflow: auto; max-width: 400px"--> </el-form-item> <!-- <el-form-item :label="$t('dataManage.dataUpObj.inspectionItems')" @@ -184,7 +240,6 @@ disabled type="textarea" style=" max-width: 420px" - :placeholder="$t('shuJuGuanLi.shuJuJianSuo.valueone')" autosize /> </el-form-item> @@ -260,22 +315,24 @@ :rules="rules" > <el-form-item - :label="$t('dataManage.dataUpObj.directoryName')" + :label="$t('dataManage.dataUpObj.name')" prop="name" :label-width="formLabelWidth" > <el-input v-model="ruleForm.name" autocomplete="off" + :placeholder="$t('shuJuGuanLi.shuJuJianSuo.valueName')" ></el-input> </el-form-item> <el-form-item - :label="$t('dataManage.dataUpObj.catalogDescription')" + :label="$t('dataManage.dataUpObj.explain')" :label-width="formLabelWidth" > <el-input v-model="ruleForm.descr" autocomplete="off" + :placeholder="$t('shuJuGuanLi.shuJuJianSuo.valueexplain')" ></el-input> </el-form-item> <el-form-item @@ -287,18 +344,34 @@ type="textarea" resize="none" style="height: 100%; overflow: auto" + :placeholder="$t('shuJuGuanLi.shuJuJianSuo.valuesuffix')" /> </el-form-item> <el-form-item :label="$t('dataManage.dataUpObj.inspectionItems')" :label-width="formLabelWidth" > - <el-input - v-model="ruleForm.checks" + <!-- <el-input + type="textarea" resize="none" - style="height: 100%; overflow: auto" - /> + + /> --> + <el-select + v-model="ruleForm.checks" + multiple + style="width:100%;" + :placeholder="$t('shuJuGuanLi.shuJuJianSuo.valueexamine')" + > + <el-option + v-for="item in options" + :key="item.value" + :label="item.label" + :value="item.value" + > + </el-option> + </el-select> + </el-form-item> <el-form-item :label="$t('dataManage.dataUpObj.code')" @@ -313,12 +386,13 @@ /> </el-form-item> <el-form-item - :label="$t('dataManage.dataUpObj.catalogRemarks')" + :label="$t('dataManage.dataUpObj.Remarks')" :label-width="formLabelWidth" > <el-input v-model="ruleForm.bak" autocomplete="off" + :placeholder="$t('shuJuGuanLi.shuJuJianSuo.valueRemarks')" ></el-input> </el-form-item> </el-form> @@ -336,6 +410,32 @@ >{{ $t("common.preservation") }}</el-button> </div> </el-dialog> + + <iframe + id="Iframe1" + src="" + style="display: none; border: 0; padding: 0; height: 0; width: 0" + ></iframe> + <div + class="loadBox" + v-if="loadDialogVisible" + > + <div style="widht:100%; margin:20px; color:white"> + <div style="margin-left:99%"> + <!-- <el-link + @click="setloadDialogVisible()" + style="color:white" + > X</el-link> --> + </div> + </div> + <div + v-loading="true" + element-loading-background="rgba(0, 0, 0, 0.0) " + element-loading-text="鐩綍涓婁紶涓�,璇风瓑寰�..." + style="margin: 0px 20px;widht:100%;height:calc(100% - 80px); " + > + </div> + </div> </div> </template> @@ -352,6 +452,8 @@ import * as XSLX from "xlsx"; import MyBread from "../../components/MyBread.vue"; import clone from "@turf/clone"; +import $ from 'jquery' +import { getToken } from '../../utils/auth'; export default { name: "catalogueManage", components: { @@ -366,6 +468,8 @@ } }; return { + directoryData: null, + directoryFlag: false, menuStatus: { delete: false, insert: false, @@ -380,7 +484,9 @@ dirList: [], //el鏍戞暟鎹� old_dirDat: [], //el鏍戞暟鎹�(鎷栧姩鍓�) newData: [], //鎷栧姩鍚庡師濮嬫暟鎹� - itemdetail: {}, + itemdetail: { + checks: [], + }, itemaName: null, backUpData: "", formLabelWidth: "150px", @@ -394,6 +500,7 @@ name: "", descr: "", bak: "", + checks: [] }, rules: { name: [{ required: true, validator: validName, trigger: "blur" }], @@ -403,9 +510,139 @@ fileList: [], file: null, tableData: [], + options: [ + { + value: 'checkMain', + label: '鎬昏川妫�' + }, { + value: 'checkOsgb', + label: 'OSGB妫�鏌�' + }, { + value: 'checkXls', + label: '琛ㄦ牸鏁版嵁妫�鏌�' + }, { + value: 'checkLaz', + label: '鐐逛簯妫�鏌�' + }, { + value: 'checkDem', + label: '楂樼▼妫�鏌�' + }, { + value: 'checkAttrs', + label: '灞炴�ф鏌�' + }, { + value: 'checkTopology', + label: '鎷撴墤妫�鏌�' + }, { + value: 'checkDecorate', + label: '鍥鹃潰鏁撮グ妫�鏌�' + }, { + value: 'checkOrigin', + label: '鍘熺偣妫�鏌�' + }, { + value: 'checkDom', + label: '鏍呮牸妫�鏌�' + }, { + value: 'checkMath', + label: '鏁板鍩虹妫�鏌�' + }, { + value: 'checkMeta', + label: '鍏冩暟鎹鏌�' + }, { + value: 'checkLogical', + label: '閫昏緫涓�鑷存�ф鏌�' + }, { + value: 'checkSingleIntegrity', + label: '鍗曢」鎴愭灉瀹屾暣鎬ф鏌�' + } + + ], + currentData: null, + showRightMenu: false, + checksData: null, + checksCopyData: null, + loadDialogVisible: false }; }, methods: { + // 澶嶅埗 + setMenuDataCopy() { + this.checksCopyData = this.checksData; + }, + //绮樿创 + setMenuDataPaste() { + if (!this.checksCopyData) { + return this.$message('鏈�変腑瑕佸鍒剁殑鑺傜偣'); + } + var val = this.$refs.tree.getNode(this.checksCopyData).data; + + var level = this.$refs.tree.getNode(this.checksData).data.level + 1; + this.setInsertCopyData([val], this.checksData, level); + }, + setInsertCopyData(val, pid, level) { + for (var i in val) { + var data = val[i]; + var pchildNodes = []; + + if (this.$refs.tree.getNode(pid) && this.$refs.tree.getNode(pid).childNodes) { + pchildNodes = this.$refs.tree.getNode(pid).childNodes + } + var orderNum = this.getMaxOrderNum(pchildNodes); + var obj = { + bak: data.bak, + level: level, + orderNum: orderNum + 1, + pid: pid, + checks: data.checks, + name: data.name, + descr: data.descr, + exts: data.exts, + } + insertDir(obj).then((res) => { + if (res.code == 200) { + this.getDirTree(); + if (data.children && data.children.length > 0) { + + this.setInsertCopyData(data.children, res.result, level + 1) + } + } + }) + } + }, + + + + + + handleNodeClick(data, node) { + this.showRightMenu = false; + document.removeEventListener('click', this.closeRightMenu) + this.layerFormInline(data) + + }, + //鍙抽敭鑿滃崟 + openTreeMenu(event, data, node, obj) { + this.showRightMenu = true; + let menu = document.getElementById('menu') + menu.style.left = event.clientX + 20 + 'px' + menu.style.top = event.clientY + 'px' + document.addEventListener('click', this.closeRightMenu) + this.checksData = data.id; + console.log(this.checksData) + }, + closeRightMenu() { + this.showRightMenu = false; + document.removeEventListener('click', this.closeRightMenu) + + }, + setTemplateDownload() { + var url = window.location.href; + var testurl = window.location.origin + "/"; + if (url.indexOf("web") != -1) { + testurl = testurl + "/web/"; + } + testurl += dirTemplateFile + $("#Iframe1").attr("src", testurl).click() + }, handleChange(file, fileList) { this.file = file; if (fileList.length > 0) { @@ -439,43 +676,75 @@ { defval: null } ); // 榛樿绗竴琛屼笅涓虹┖涔熻兘瑙f瀽鍑虹涓�鍥涜 var data = [...outdata]; - const arr = []; - data.map((v) => { - const obj = {}; - obj.name = v.name; - obj.pname = v.pname; - obj.descr = v.explain; - obj.bak = v.bak; - obj.orderNum = null; - obj.pid = null; - arr.push(obj); - }); - that.tableData = arr; - that.setInsertData(that.tableData); + that.setLeToFc(data); }; + } + }, + + setLeToFc(res) { + var arr = []; + for (var i in res) { + var value = this.getNameAndPname(res[i], res, i) + arr.push({ + name: value[0], + pname: value[1], + descr: res[i].explain, + checks: res[i].checks, + bak: res[i].bak, + exts: res[i].exts, + orderNum: null, + pid: null, + tid: parseInt(value[2]) + 1, + sid: parseInt(value[3]) + 1 + }) + } + + this.tableData = arr; + + this.setInsertData(this.tableData); + }, + getNameAndPname(res, result, flag) { + var chLevel = null; + var faLevel = null; + + for (var i = 1; i < 8; i++) { + var lel = 'L' + i; + if (res[lel] != null) { + chLevel = i + } + } + if (chLevel == 1) { + return [res['L' + chLevel], null, flag, -1] + } else { + faLevel = chLevel - 1; + for (var i = flag; i >= 0; i--) { + var val = result[i] + if (val['L' + faLevel]) { + return [res['L' + chLevel], val['L' + faLevel], flag, i] + break; + } + } } }, setInsertData(res) { var list = this.excelData(res); - if (list.length != 0) { if (list[0].pname != null) { return this.$message.error("涓婁紶鏁版嵁閿欒锛岀涓�鏉℃暟鎹笉涓虹┖"); } - - this.getAllNodeId(list); + this.getAllNodeId(res); } }, async getAllNodeId(res) { + this.loadDialogVisible = true; for (let i = 0; i < res.length; i++) { var val = res[i]; - if (val.pname == null) { val.orderNum = this.dirList[this.dirList.length - 1].orderNum + 1; val.pid = 0; } else { this.tableData.filter((child) => { - if (child.name == val.pname) { + if (child.tid == val.sid) { val.pid = child.id; val.orderNum = i + 1; } @@ -484,30 +753,38 @@ const data = await insertDir(val); if (data.code != 200) { + this.$message.error("鐩綍涓婁紶澶辫触" + data.msg); + this.loadDialogVisible = false; + break; } + this.tableData.filter((child) => { - if (child.name == val.name && child.pname == val.pname) { + + if (child.name == val.name && child.tid == val.tid) { child.id = data.result; } }); this.itemaName = data.result; - this.getDirTree(); + // this.getDirTree(); - if (res[i].children) { - this.getAllNodeId(res[i].children); - } + // if (res[i].children) { + // this.getAllNodeId(res[i].children); + // } } + this.getDirTree(); + this.loadDialogVisible = false; + }, excelData(source) { let cloneData = JSON.parse(JSON.stringify(source)); // 瀵规簮鏁版嵁娣卞害鍏嬮殕 return cloneData.filter((father) => { // 寰幆鎵�鏈夐」 - let branchArr = cloneData.filter((child) => father.name == child.pname); // 瀵规瘮ID锛屽垎鍒笂涓嬬骇鑿滃崟锛屽苟杩斿洖鏁版嵁 + let branchArr = cloneData.filter((child) => father.tid == child.sid); // 瀵规瘮ID锛屽垎鍒笂涓嬬骇鑿滃崟锛屽苟杩斿洖鏁版嵁 branchArr.length > 0 ? (father.children = branchArr) : ""; // 缁欑埗绾ф坊鍔犱竴涓猚hildren灞炴�э紝骞惰祴鍊� // 灞炰簬鍚屼竴瀵硅薄闂锛屼緥濡傦細浠� a=b銆乧=1 锛岀劧鍚庡啀浠� b.c=c 锛� 閭d箞 a.c=b.c=c=1 锛涘悓鐞嗭紝鍚庣画浠� c.d=2 ,閭d箞 a.c.d 涔熸槸=2锛� // 鐢辨寰幆澶氭鍚庯紝灏辫兘褰㈡垚鐩稿簲鐨勬爲褰㈡暟鎹粨鏋� - return father.pname == null; // 杩斿洖涓�绾ц彍鍗� + return father.sid == 0; // 杩斿洖涓�绾ц彍鍗� }); }, readFile(file) { @@ -522,37 +799,57 @@ }, // 璇锋眰鐩綍鏍� - getDirTree() { + async getDirTree() { //鑾峰彇鐩綍鏍戞渶澶D锛屾柊寤鸿妭鐐逛娇鐢� // queryMaxId().then((res) => { // this.id = res.data; // }); // 鑾峰彇鐩綍鏍戞暟鎹� - queryDirTree().then((res) => { - // console.log(res); - if (res.code == 200) { - this.oriData = res.result; - this.newData = res.result; - this.dirList = this.treeData(res.result); - // this.$nextTick(() => { + const data = await queryDirTree(); - // this.expandData=[15] - // this.$refs.tree.setCurrentKey(15); + if (data.code != 200) { + return this.$message.error("椤圭洰鍒楄〃鏌ヨ澶辫触"); + } + this.oriData = data.result; + this.newData = data.result; + this.dirList = this.treeData(data.result); - // }); - if (this.itemaName != null) { - this.$nextTick(() => { - this.expandData = [this.itemaName]; - this.$refs.tree.setCurrentKey(this.itemaName); - }); - } - } else { - console.log("鎺ュ彛鎶ラ敊"); - } + + var cdata; + if (this.currentData) { + var rs = JSON.parse(this.currentData); + cdata = this.$refs.tree.getNode(rs.id).data; + } else { + cdata = this.dirList[this.dirList.length - 1] + } + this.$nextTick(() => { + this.expandData = [cdata.id]; + this.$refs.tree.setCurrentKey(cdata.id); + this.layerFormInline(cdata) }); + + + // queryDirTree().then((res) => { + // // console.log(res); + + + // if (res.code == 200) { + + + // // this.$nextTick(() => { + + // // this.expandData=[15] + // // this.$refs.tree.setCurrentKey(15); + + // // }); + + // } else { + // console.log("鎺ュ彛鎶ラ敊"); + // } + // }); }, handleClose() { - this.$confirm("纭鍏抽棴锛�") + this.$confirm("鍏抽棴鍚庢棤娉曚繚瀛橈紝鏄惁鍏抽棴?") .then((_) => { this.resetForm(); }) @@ -563,12 +860,19 @@ return cloneData.filter((father) => { // 寰幆鎵�鏈夐」 let branchArr = cloneData.filter((child) => father.id == child.pid); // 瀵规瘮ID锛屽垎鍒笂涓嬬骇鑿滃崟锛屽苟杩斿洖鏁版嵁 + if (branchArr.length > 0) { + branchArr.sort(function (a, b) { + return a.orderNum - b.orderNum + }) + } + branchArr.length > 0 ? (father.children = branchArr) : ""; // 缁欑埗绾ф坊鍔犱竴涓猚hildren灞炴�э紝骞惰祴鍊� // 灞炰簬鍚屼竴瀵硅薄闂锛屼緥濡傦細浠� a=b銆乧=1 锛岀劧鍚庡啀浠� b.c=c 锛� 閭d箞 a.c=b.c=c=1 锛涘悓鐞嗭紝鍚庣画浠� c.d=2 ,閭d箞 a.c.d 涔熸槸=2锛� // 鐢辨寰幆澶氭鍚庯紝灏辫兘褰㈡垚鐩稿簲鐨勬爲褰㈡暟鎹粨鏋� return father.pid == 0; // 杩斿洖涓�绾ц彍鍗� }); }, + //鍚戜笂鍚戜笅绉诲姩 setEditNode(res) { let node = this.$refs.tree.getCurrentNode(); let pchildNodes = this.$refs.tree.getNode(node.id).parent.childNodes; @@ -583,19 +887,25 @@ if (currentId != 0) { const tempChildrenNodex1 = pchildNodes[currentId - 1]; const tempChildrenNodex2 = pchildNodes[currentId]; - tempChildrenNodex2.orderNum = - pchildNodes[currentId - 1].data.orderNum; - tempChildrenNodex1.orderNum = pchildNodes[currentId].data.orderNum; - var arr = []; + // tempChildrenNodex2.orderNum = + // pchildNodes[currentId - 1].data.orderNum; + // tempChildrenNodex1.orderNum = pchildNodes[currentId].data.orderNum; + + const arr = []; this.oriData.filter((res) => { if (res.id == tempChildrenNodex2.data.id) { - res.orderNum = tempChildrenNodex2.orderNum; + // res.orderNum = tempChildrenNodex2.orderNum; arr.push(res); } else if (res.id == tempChildrenNodex1.data.id) { - res.orderNum = tempChildrenNodex1.orderNum; + // res.orderNum = tempChildrenNodex1.orderNum; arr.push(res); } }); + + const orderNum = arr[1].orderNum + arr[1].orderNum = arr[0].orderNum + arr[0].orderNum = orderNum + this.newData = arr; this.sendChange(); } else { @@ -609,19 +919,23 @@ if (currentId < pchildNodes.length - 1) { const tempChildrenNodex1 = pchildNodes[currentId + 1]; const tempChildrenNodex2 = pchildNodes[currentId]; - tempChildrenNodex2.orderNum = - pchildNodes[currentId + 1].data.orderNum; - tempChildrenNodex1.orderNum = pchildNodes[currentId].data.orderNum; - var arr = []; + // tempChildrenNodex2.orderNum = + // pchildNodes[currentId + 1].data.orderNum; + // tempChildrenNodex1.orderNum = pchildNodes[currentId].data.orderNum; + + const arr = []; this.oriData.filter((res) => { if (res.id == tempChildrenNodex2.data.id) { - res.orderNum = tempChildrenNodex2.orderNum; + // res.orderNum = tempChildrenNodex2.orderNum; arr.push(res); } else if (res.id == tempChildrenNodex1.data.id) { - res.orderNum = tempChildrenNodex1.orderNum; + // res.orderNum = tempChildrenNodex1.orderNum; arr.push(res); } }); + const orderNum = arr[1].orderNum + arr[1].orderNum = arr[0].orderNum + arr[0].orderNum = orderNum this.newData = arr; this.sendChange(); } else { @@ -649,17 +963,33 @@ }); }); }, + insertStart() { + this.ruleForm = { + level: null, + orderNum: null, + pid: null, + name: "", + descr: "", + bak: "", + checks: [] + } + }, setNewNode(res) { + this.insertStart(); + var node = this.$refs.tree.getCurrentNode(); + this.newNode = node; var id, lever, orderNum; if (res == 1) { //鏂板鍚岀骇 id = this.itemdetail.pid; - orderNum = this.getMaxOrderNum(this.newNode.parent.childNodes); + let pchildNodes = this.$refs.tree.getNode(this.newNode.id).parent.childNodes + orderNum = this.getMaxOrderNum(pchildNodes); lever = this.itemdetail.level; } else if (res == 2) { //鏂板瀛愮骇 id = this.itemdetail.id; - orderNum = this.getMaxOrderNum(this.newNode.childNodes); + let pchildNodes = this.$refs.tree.getNode(this.newNode.id).childNodes + orderNum = this.getMaxOrderNum(pchildNodes); lever = this.itemdetail.level + 1; } @@ -678,7 +1008,6 @@ val = val + 1; return val; }, - append(node, data) { this.dialogFormVisible = true; this.ruleForm.pid = data.id; @@ -690,7 +1019,7 @@ this.ruleForm = {}; this.$nextTick(() => { this.ruleForm = {}; - this.$refs[formName].resetFields(); + // this.$refs[formName].resetFields(); }); }, submitForm(formName) { @@ -698,7 +1027,15 @@ this.$refs[formName].validate((valid) => { if (valid) { this.fullscreenLoading = true; - insertDir(this.ruleForm) + var val = this.ruleForm; + if (this.ruleForm.checks) { + val.checks = this.ruleForm.checks.toString() + } else { + val.checks = '' + } + // var val = JSON.parse(JSON.stringify(this.ruleForm)) + // this.itemdetail = val + insertDir(val) .then((res) => { setTimeout(() => { this.fullscreenLoading = false; @@ -708,9 +1045,9 @@ message: "娣诲姞鎴愬姛", type: "success", }); - this.itemaName = res.result; - this.itemdetail = {}; - this.ruleForm = {}; + + // this.itemdetail = {}; + // this.ruleForm = {}; this.dialogFormVisible = false; this.$refs[formName].resetFields(); this.getDirTree(); @@ -760,6 +1097,12 @@ type: "success", message: "鍒犻櫎鎴愬姛!", }); + let pchildNodes = this.$refs.tree.getNode(this.itemdetail.id).parent; + if (pchildNodes.data.id) { + this.currentData = JSON.stringify(pchildNodes.data) + } else { + this.currentData = null + } this.itemdetail = {}; this.getDirTree(); @@ -772,8 +1115,8 @@ } }) .catch(() => { - this.$message.error("鍒犻櫎澶辫触"); - this.itemdetail = {}; + // this.$message.error("鍒犻櫎澶辫触"); + // this.itemdetail = {}; }); //閲嶇疆瑕佸垹闄ょ殑瀛怚D this.delChildIDs = []; @@ -845,8 +1188,7 @@ } item.orderNum = i + 1; }); - // console.log(nodeData); - //鏇存柊鍘熷鏁翠綋鏁版嵁 + let arr = []; this.oriData.forEach((e) => { nodeData.forEach((item) => { @@ -862,58 +1204,140 @@ this.dirList = this.old_dirDat; //灏嗗浠界殑dir閲嶆柊璧嬪�� }); }, - sendChange() { - updateDirTrees(this.newData) - .then((res) => { - if (res.code == 200) { - this.getDirTree(); - return; - } else { - this.$message.error("淇敼澶辫触锛岃閲嶈瘯锛�"); - } - }) - .catch(() => { - this.$message.error("淇敼澶辫触锛岃閲嶈瘯锛�"); - }); - }, - handleNodeClick(data, node) { - // console.log(data); + async sendChange() { + const data = await updateDirTrees(this.newData) - this.newNode = node; - this.backUpData = JSON.stringify(data); - this.itemdetail = JSON.parse(JSON.stringify(data)); + if (data.code != 200) { + return this.$message.error("绉诲姩澶辫触"); + } + this.getDirTree(); + // this.getLayerTree() + // .then((res) => { + // if (res.code == 200) { + // + // return; + // } else { + // this.$message.error("绉诲姩澶辫触锛岃閲嶈瘯锛�"); + // } + // }) + // .catch(() => { + // this.$message.error("绉诲姩澶辫触锛岃閲嶈瘯锛�"); + // }); }, - updCata(formName) { - this.$nextTick(() => { - this.$refs[formName].validate((valid) => { - if (valid) { - this.fullscreenLoading = true; - updateDirTree(this.itemdetail) - .then((res) => { - setTimeout(() => { - this.fullscreenLoading = false; - if (res.code == 200) { - this.getDirTree(); - this.itemdetail = {}; - this.dialogFormVisible = false; - } - }, 500); - }) - .catch((res) => { - this.$message.error("淇敼澶辫触锛岃閲嶈瘯锛�"); - this.fullscreenLoading = false; - }); - } else { - return false; + + setDirectoryDownload() { + var url = BASE_URL + '/dir/downloadDir?token=' + getToken() + '&id=' + this.directoryData.id + console.log(url) + $("#Iframe1").attr("src", url).click() + }, + + layerFormInline(data) { + if (data.pid == 0) { + this.directoryData = data; + this.directoryFlag = true; + } else { + this.directoryFlag = false; + } + + this.newNode = this.$refs.tree.getNode(data.id); + this.backUpData = JSON.stringify(data); + var val = this.$refs.tree.getNode(data.id).data; + this.itemdetail = val; + this.currentData = JSON.stringify(data) + + var checks = []; + if (val.checks) { + if (val.checks.indexOf(',') > -1) { + var value = val.checks.split(','); + for (var i in value) { + checks.push(value[i]) } - }); + } else if (val.checks.indexOf('[]') > -1) { + + } else { + checks.push(val.checks) + } + this.itemdetail.checks = checks; + } else { + this.itemdetail.checks = [] + } + }, + + + async updCata(formName) { + this.fullscreenLoading = true; + var val = JSON.parse(JSON.stringify(this.itemdetail)); + val.orderNum = this.newNode.data.orderNum; + + var value = this.itemdetail.checks.toString() + val.checks = value; + const data = await updateDirTree(val); + this.currentData = JSON.stringify(this.itemdetail) + + if (data.code != 200) { + this.fullscreenLoading = false; + return this.$message.error("淇敼澶辫触"); + } + this.$message({ + message: '淇敼鎴愬姛', + type: 'success' }); + this.fullscreenLoading = false; + this.getDirTree(); + + // this.$nextTick(() => { + // this.$refs[formName].validate((valid) => { + // if (valid) { + // + + // var val = this.itemdetail + // var value = this.itemdetail.checks.toString() + // val.checks = value; + // + // let res = JSON.parse(JSON.stringify(this.itemdetail)); + // this.itemdetail = res; + // + // updateDirTree(val) + // .then((res) => { + // setTimeout(() => { + // this.fullscreenLoading = false; + // if (res.code == 200) { + // this.getDirTree(); + // // this.itemdetail = {}; + // this.dialogFormVisible = false; + // } + // }, 500); + // }) + // .catch((res) => { + // this.$message.error("淇敼澶辫触锛岃閲嶈瘯锛�"); + // this.fullscreenLoading = false; + // }); + // } else { + // return false; + // } + // }); + // }); }, reset(formName) { this.itemdetail = {}; // this.$refs[formName].resetFields(); if (this.backUpData != "") { this.itemdetail = JSON.parse(this.backUpData); + var val = JSON.parse(this.backUpData); + var checks = []; + if (val.checks) { + if (val.checks.indexOf(',') > -1) { + var value = val.checks.split(','); + for (var i in value) { + checks.push(value[i]) + } + } else { + checks.push(val.checks) + } + this.itemdetail.checks = checks; + } else { + this.itemdetail.checks = [] + } } }, showPermsMenu(res) { @@ -1019,6 +1443,48 @@ } } } + .right_menu { + position: fixed; + display: block; + z-index: 10000; + padding: 10px; + border: 1px solid #ebeef5; + border-radius: 4px; + box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1); + ul { + width: 100%; + height: 100%; + list-style: none; + margin: 0; + padding: 0; + border-radius: 2%; + li { + margin: 0 0 1px 0; + color: rgb(77, 77, 73); + text-align: center; + font-size: 14px; + padding: 4%; + width: 100%; + height: 9.7%; + float: left; + } + li:hover { + color: #409eff !important; + } + } + } +} +.loadBox { + z-index: 2002; + background: rgba(0, 0, 0, 0.2); + width: 100%; + height: 100%; + top: 0; + left: 0; + position: absolute; + .el-loading-mask { + background: transparent !important; + } } .btnBox { position: absolute; -- Gitblit v1.9.3