From 83ff2ebbb1d61c2cd7762df33f61ff0418b2b1c9 Mon Sep 17 00:00:00 2001 From: surprise <15810472099@163.com> Date: 星期日, 28 四月 2024 22:19:49 +0800 Subject: [PATCH] 页面添加 --- src/views/datamanage/catalogueManage.vue | 1125 +++++++++++++++++++++++++++-------------------------------- 1 files changed, 515 insertions(+), 610 deletions(-) diff --git a/src/views/datamanage/catalogueManage.vue b/src/views/datamanage/catalogueManage.vue index a6a4fe1..3d65cd2 100644 --- a/src/views/datamanage/catalogueManage.vue +++ b/src/views/datamanage/catalogueManage.vue @@ -7,28 +7,22 @@ <el-divider /> <div class="mainBox"> - <div - class="cataLogContent leftTree subpage_Div" - style="border: 1px solid #dcdfe6;" - > + <div class="cataLogContent leftTree subpage_Div" + style="border: 1px solid #dcdfe6;"> <div style="min-width: 450px"> - <el-tree - ref="tree" - :props="defaultProps" - node-key="id" - :data="dirList" - :highlight-current="true" - :expand-on-click-node="false" - :default-expanded-keys="expandData" - @node-click="handleNodeClick" - @node-contextmenu="openTreeMenu" - > + <el-tree ref="tree" + :props="defaultProps" + node-key="id" + :data="dirList" + :highlight-current="true" + :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" - > + <div class="right_menu box_divm" + id="menu" + v-show="showRightMenu"> <ul> <li @click="setMenuDataCopy">澶嶅埗</li> <li @click="setMenuDataPaste">绮樿创</li> @@ -37,14 +31,12 @@ </div> </div> <div class="cataLog_rightContent right subpage_Div"> - <div - class="inquire" - style=" + <div class="inquire" + style=" align-items: center; display: flex; justify-content: space-between; - " - > + "> <el-breadcrumb separator="/"> <el-breadcrumb-item :to="{ path: '/' }">{{ @@ -52,94 +44,74 @@ </el-breadcrumb> <div style="margin-right: -5px"> <div class="menuTop"> - <el-form - :inline="true" - class="demo-form-inline" - > + <el-form :inline="true" + 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-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-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" - :auto-upload="false" - :show-file-list="false" - :on-change="handleChange" - :file-list="fileList" - > - <el-button - type="success" - icon="el-icon-plus" - size="small" - >{{ $t("shuJuGuanLi.butten.uploads") }}</el-button> + <el-upload action + accept=".xlsx, .xls" + :auto-upload="false" + :show-file-list="false" + :on-change="handleChange" + :file-list="fileList"> + <el-button type="success" + icon="el-icon-plus" + size="small">{{ $t("shuJuGuanLi.butten.uploads") }}</el-button> </el-upload> </el-form-item> <el-form-item> - <el-button - v-if="menuStatus.insert" - :disabled="itemdetail.pid == null ? true : false" - @click="setNewNode(1)" - type="success" - icon="el-icon-plus" - size="small" - >{{ $t("shuJuGuanLi.butten.NewPeer") }}</el-button> + <el-button v-if="menuStatus.insert" + :disabled="itemdetail.pid == null ? true : false" + @click="setNewNode(1)" + type="success" + icon="el-icon-plus" + size="small">{{ $t("shuJuGuanLi.butten.NewPeer") }}</el-button> </el-form-item> <el-form-item> - <el-button - v-if="menuStatus.insert" - :disabled="itemdetail.pid == null ? true : false" - @click="setNewNode(2)" - type="success" - icon="el-icon-plus" - size="small" - >{{ $t("shuJuGuanLi.butten.AddChild") }}</el-button> + <el-button v-if="menuStatus.insert" + :disabled="itemdetail.pid == null ? true : false" + @click="setNewNode(2)" + type="success" + icon="el-icon-plus" + size="small">{{ $t("shuJuGuanLi.butten.AddChild") }}</el-button> </el-form-item> <el-form-item> - <el-button - v-if="menuStatus.delete" - @click="setDelNode()" - :disabled="itemdetail.pid == null ? true : false" - type="danger" - icon="el-icon-delete" - size="small" - >{{ $t("shuJuGuanLi.butten.Delete") }}</el-button> + <el-button v-if="menuStatus.delete" + @click="setDelNode()" + :disabled="itemdetail.pid == null ? true : false" + type="danger" + icon="el-icon-delete" + size="small">{{ $t("shuJuGuanLi.butten.Delete") }}</el-button> </el-form-item> <el-form-item> - <el-button - v-if="menuStatus.update" - :disabled="itemdetail.pid == null ? true : false" - @click="setEditNode(1)" - type="info" - icon="el-icon-top" - size="small" - >{{ $t("shuJuGuanLi.butten.MoveUp") }}</el-button> + <el-button v-if="menuStatus.update" + :disabled="itemdetail.pid == null ? true : false" + @click="setEditNode(1)" + type="info" + icon="el-icon-top" + size="small">{{ $t("shuJuGuanLi.butten.MoveUp") }}</el-button> </el-form-item> <el-form-item> - <el-button - v-if="menuStatus.update" - :disabled="itemdetail.pid == null ? true : false" - @click="setEditNode(2)" - type="info" - icon="el-icon-bottom" - size="small" - >{{ $t("shuJuGuanLi.butten.MoveDown") }}</el-button> + <el-button v-if="menuStatus.update" + :disabled="itemdetail.pid == null ? true : false" + @click="setEditNode(2)" + type="info" + icon="el-icon-bottom" + size="small">{{ $t("shuJuGuanLi.butten.MoveDown") }}</el-button> </el-form-item> </el-form> </div> @@ -148,54 +120,38 @@ </div> <div class="dividing-line"></div> - <el-form - :model="itemdetail" - ref="itemdetail" - :rules="rules" - style="position: relative; padding-top: 18px" - > - <el-form-item - prop="name" - :label="$t('dataManage.dataUpObj.name')" - :label-width="formLabelWidth" - > - <el-input - v-model="itemdetail.name" - size="small" - style=" max-width: 420px" - :placeholder="$t('shuJuGuanLi.shuJuJianSuo.valueName')" - clearable - /> + <el-form :model="itemdetail" + ref="itemdetail" + :rules="rules" + style="position: relative; padding-top: 18px"> + <el-form-item prop="name" + :label="$t('dataManage.dataUpObj.name')" + :label-width="formLabelWidth"> + <el-input v-model="itemdetail.name" + size="small" + style=" max-width: 420px" + :placeholder="$t('shuJuGuanLi.shuJuJianSuo.valueName')" + clearable /> <!-- style="max-width: 400px"--> </el-form-item> - <el-form-item - :label="$t('dataManage.dataUpObj.explain')" - :label-width="formLabelWidth" - > - <el-input - v-model="itemdetail.descr" - type="textarea" - style=" max-width: 420px" - :placeholder="$t('shuJuGuanLi.shuJuJianSuo.valueexplain')" - clearable - /> + <el-form-item :label="$t('dataManage.dataUpObj.explain')" + :label-width="formLabelWidth"> + <el-input v-model="itemdetail.descr" + type="textarea" + style=" max-width: 420px" + :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-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 @@ -208,17 +164,13 @@ <!-- resize="none"--> <!-- style="height: 100%; overflow: auto; max-width: 400px"--> </el-form-item> - <el-form-item - :label="$t('dataManage.dataUpObj.fileExtension')" - :label-width="formLabelWidth" - > - <el-input - v-model="itemdetail.exts" - type="textarea" - style=" max-width: 420px" - :placeholder="$t('shuJuGuanLi.shuJuJianSuo.valuesuffix')" - clearable - /> + <el-form-item :label="$t('dataManage.dataUpObj.fileExtension')" + :label-width="formLabelWidth"> + <el-input v-model="itemdetail.exts" + type="textarea" + style=" max-width: 420px" + :placeholder="$t('shuJuGuanLi.shuJuJianSuo.valuesuffix')" + clearable /> </el-form-item> <!-- <el-form-item :label="$t('dataManage.dataUpObj.inspectionItems')" @@ -231,17 +183,13 @@ style="height: 100%; overflow: auto; max-width: 400px" /> </el-form-item>--> - <el-form-item - :label="$t('dataManage.dataUpObj.code')" - :label-width="formLabelWidth" - > - <el-input - v-model="itemdetail.code" - disabled - type="textarea" - style=" max-width: 420px" - autosize - /> + <el-form-item :label="$t('dataManage.dataUpObj.code')" + :label-width="formLabelWidth"> + <el-input v-model="itemdetail.code" + disabled + type="textarea" + style=" max-width: 420px" + autosize /> </el-form-item> <!-- <el-form-item :label="$t('dataManage.dataUpObj.catalogRemarks')" @@ -271,22 +219,16 @@ > </div>--> </el-form> - <div - slot="footer" - class="dialog-footer" - style="padding-left: 45% ;padding-top: 20px" - > - <el-button - v-if="menuStatus.update" - type="primary" - size="small" - @click="updCata('itemdetail')" - >{{ $t("common.preservation") }}</el-button> - <el-button - v-if="menuStatus.update" - size="small" - @click="reset" - >{{ $t("common.cancel") }}</el-button> + <div slot="footer" + class="dialog-footer" + style="padding-left: 45% ;padding-top: 20px"> + <el-button v-if="menuStatus.update" + type="primary" + size="small" + @click="updCata('itemdetail')">{{ $t("common.preservation") }}</el-button> + <el-button v-if="menuStatus.update" + size="small" + @click="reset">{{ $t("common.cancel") }}</el-button> </div> </div> </div> @@ -304,122 +246,84 @@ </div> --> <!-- </div> --> - <el-dialog - :title="$t('dataManage.dataUpObj.newDirectory')" - :visible.sync="dialogFormVisible" - :before-close="handleClose" - > - <el-form - :model="ruleForm" - ref="ruleForm" - :rules="rules" - > - <el-form-item - :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-dialog :title="$t('dataManage.dataUpObj.newDirectory')" + :visible.sync="dialogFormVisible" + :before-close="handleClose"> + <el-form :model="ruleForm" + ref="ruleForm" + :rules="rules"> + <el-form-item :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.explain')" - :label-width="formLabelWidth" - > - <el-input - v-model="ruleForm.descr" - autocomplete="off" - :placeholder="$t('shuJuGuanLi.shuJuJianSuo.valueexplain')" - ></el-input> + <el-form-item :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 - :label="$t('dataManage.dataUpObj.fileExtension')" - :label-width="formLabelWidth" - > - <el-input - v-model="ruleForm.exts" - type="textarea" - resize="none" - style="height: 100%; overflow: auto" - :placeholder="$t('shuJuGuanLi.shuJuJianSuo.valuesuffix')" - /> + <el-form-item :label="$t('dataManage.dataUpObj.fileExtension')" + :label-width="formLabelWidth"> + <el-input v-model="ruleForm.exts" + 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-form-item :label="$t('dataManage.dataUpObj.inspectionItems')" + :label-width="formLabelWidth"> <!-- <el-input type="textarea" resize="none" /> --> - <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-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')" - :label-width="formLabelWidth" - > - <el-input - v-model="ruleForm.code" - disabled - type="textarea" - resize="none" - style="height: 100%; overflow: auto" - /> + <el-form-item :label="$t('dataManage.dataUpObj.code')" + :label-width="formLabelWidth"> + <el-input v-model="ruleForm.code" + disabled + type="textarea" + resize="none" + style="height: 100%; overflow: auto" /> </el-form-item> - <el-form-item - :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 :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> - <div - slot="footer" - class="dialog-footer" - > + <div slot="footer" + class="dialog-footer"> <el-button @click="resetForm('ruleForm')">{{ $t("common.cancel") }}</el-button> - <el-button - class="primary" - @click="submitForm('ruleForm')" - v-loading.fullscreen.lock="fullscreenLoading" - >{{ $t("common.preservation") }}</el-button> + <el-button class="primary" + @click="submitForm('ruleForm')" + v-loading.fullscreen.lock="fullscreenLoading">{{ $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" - > + <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 @@ -428,12 +332,10 @@ > 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 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> @@ -459,9 +361,9 @@ components: { MyBread, }, - data() { - let validName = (rule, value, callback) => { - if (value === "" || value === null || value === undefined) { + data () { + let validName=(rule,value,callback) => { + if(value===""||value===null||value===undefined) { return callback(new Error("鐩綍鍚嶇О涓嶈兘涓虹┖")); } else { callback(); @@ -503,7 +405,7 @@ checks: [] }, rules: { - name: [{ required: true, validator: validName, trigger: "blur" }], + name: [{ required: true,validator: validName,trigger: "blur" }], }, newNode: null, expandData: [], @@ -514,43 +416,43 @@ { 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: '鍗曢」鎴愭灉瀹屾暣鎬ф鏌�' } @@ -565,32 +467,32 @@ }, methods: { // 澶嶅埗 - setMenuDataCopy() { - this.checksCopyData = this.checksData; + setMenuDataCopy () { + this.checksCopyData=this.checksData; }, //绮樿创 - setMenuDataPaste() { - if (!this.checksCopyData) { + setMenuDataPaste () { + if(!this.checksCopyData) { return this.$message('鏈�変腑瑕佸鍒剁殑鑺傜偣'); } - var val = this.$refs.tree.getNode(this.checksCopyData).data; + 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); + 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 = []; + 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 + 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 = { + var orderNum=this.getMaxOrderNum(pchildNodes); + var obj={ bak: data.bak, level: level, - orderNum: orderNum + 1, + orderNum: orderNum+1, pid: pid, checks: data.checks, name: data.name, @@ -598,11 +500,11 @@ exts: data.exts, } insertDir(obj).then((res) => { - if (res.code == 200) { + if(res.code==200) { this.getDirTree(); - if (data.children && data.children.length > 0) { + if(data.children&&data.children.length>0) { - this.setInsertCopyData(data.children, res.result, level + 1) + this.setInsertCopyData(data.children,res.result,level+1) } } }) @@ -613,78 +515,78 @@ - handleNodeClick(data, node) { - this.showRightMenu = false; - document.removeEventListener('click', this.closeRightMenu) + 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; + 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) + 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/"; + 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() + testurl+=dirTemplateFile + $("#Iframe1").attr("src",testurl).click() }, - handleChange(file, fileList) { - this.file = file; - if (fileList.length > 0) { - this.fileList = [fileList[fileList.length - 1]]; //杩欎竴姝ワ紝鏄� 灞曠ず鏈�鍚庝竴娆¢�夋嫨鏂囦欢; + handleChange (file,fileList) { + this.file=file; + if(fileList.length>0) { + this.fileList=[fileList[fileList.length-1]]; //杩欎竴姝ワ紝鏄� 灞曠ず鏈�鍚庝竴娆¢�夋嫨鏂囦欢; this.handle(); } }, - async handle() { - let file = this.file?.raw; - if (!this.file) { + async handle () { + let file=this.file?.raw; + if(!this.file) { console.log("鏂囦欢鎵撳紑澶辫触"); return; } else { - const reader = new FileReader(); - let that = this; + const reader=new FileReader(); + let that=this; reader.readAsArrayBuffer(file); - reader.onload = function () { - const buffer = reader.result; - const bytes = new Uint8Array(buffer); - const length = bytes.byteLength; - let binary = ""; - for (let i = 0; i < length; i++) { - binary += String.fromCharCode(bytes[i]); + reader.onload=function() { + const buffer=reader.result; + const bytes=new Uint8Array(buffer); + const length=bytes.byteLength; + let binary=""; + for(let i=0;i<length;i++) { + binary+=String.fromCharCode(bytes[i]); } - const XLSX = require("xlsx"); - const wb = XLSX.read(binary, { + const XLSX=require("xlsx"); + const wb=XLSX.read(binary,{ type: "binary", }); - const outdata = XLSX.utils.sheet_to_json( + const outdata=XLSX.utils.sheet_to_json( wb.Sheets[wb.SheetNames[0]], { defval: null } ); // 榛樿绗竴琛屼笅涓虹┖涔熻兘瑙f瀽鍑虹涓�鍥涜 - var data = [...outdata]; + var data=[...outdata]; that.setLeToFc(data); }; } }, - setLeToFc(res) { - var arr = []; - for (var i in res) { - var value = this.getNameAndPname(res[i], res, i) + 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], @@ -694,77 +596,77 @@ exts: res[i].exts, orderNum: null, pid: null, - tid: parseInt(value[2]) + 1, - sid: parseInt(value[3]) + 1 + tid: parseInt(value[2])+1, + sid: parseInt(value[3])+1 }) } - this.tableData = arr; + this.tableData=arr; this.setInsertData(this.tableData); }, - getNameAndPname(res, result, flag) { - var chLevel = null; - var faLevel = null; + 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 + 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] + 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] + 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) { + setInsertData (res) { + var list=this.excelData(res); + if(list.length!=0) { + if(list[0].pname!=null) { return this.$message.error("涓婁紶鏁版嵁閿欒锛岀涓�鏉℃暟鎹笉涓虹┖"); } 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; + 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.tid == val.sid) { - val.pid = child.id; - val.orderNum = i + 1; + if(child.tid==val.sid) { + val.pid=child.id; + val.orderNum=i+1; } }); } - const data = await insertDir(val); - if (data.code != 200) { - this.$message.error("鐩綍涓婁紶澶辫触" + data.msg); - this.loadDialogVisible = false; + 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.tid == val.tid) { - child.id = data.result; + if(child.name==val.name&&child.tid==val.tid) { + child.id=data.result; } }); - this.itemaName = data.result; + this.itemaName=data.result; // this.getDirTree(); // if (res[i].children) { @@ -772,58 +674,58 @@ // } } this.getDirTree(); - this.loadDialogVisible = false; + this.loadDialogVisible=false; }, - excelData(source) { - let cloneData = JSON.parse(JSON.stringify(source)); // 瀵规簮鏁版嵁娣卞害鍏嬮殕 + excelData (source) { + let cloneData=JSON.parse(JSON.stringify(source)); // 瀵规簮鏁版嵁娣卞害鍏嬮殕 return cloneData.filter((father) => { // 寰幆鎵�鏈夐」 - let branchArr = cloneData.filter((child) => father.tid == child.sid); // 瀵规瘮ID锛屽垎鍒笂涓嬬骇鑿滃崟锛屽苟杩斿洖鏁版嵁 + let branchArr=cloneData.filter((child) => father.tid==child.sid); // 瀵规瘮ID锛屽垎鍒笂涓嬬骇鑿滃崟锛屽苟杩斿洖鏁版嵁 - branchArr.length > 0 ? (father.children = branchArr) : ""; // 缁欑埗绾ф坊鍔犱竴涓猚hildren灞炴�э紝骞惰祴鍊� + 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.sid == 0; // 杩斿洖涓�绾ц彍鍗� + return father.sid==0; // 杩斿洖涓�绾ц彍鍗� }); }, - readFile(file) { + readFile (file) { //鏂囦欢璇诲彇 return new Promise((resolve) => { - let reader = new FileReader(); + let reader=new FileReader(); reader.readAsBinaryString(file); //浠ヤ簩杩涘埗鐨勬柟寮忚鍙� - reader.onload = (ev) => { + reader.onload=(ev) => { resolve(ev.target.result); }; }); }, // 璇锋眰鐩綍鏍� - async getDirTree() { + async getDirTree () { //鑾峰彇鐩綍鏍戞渶澶D锛屾柊寤鸿妭鐐逛娇鐢� // queryMaxId().then((res) => { // this.id = res.data; // }); // 鑾峰彇鐩綍鏍戞暟鎹� - const data = await queryDirTree(); + const data=await queryDirTree(); - if (data.code != 200) { + if(data.code!=200) { return this.$message.error("椤圭洰鍒楄〃鏌ヨ澶辫触"); } - this.oriData = data.result; - this.newData = data.result; - this.dirList = this.treeData(data.result); + this.oriData=data.result; + this.newData=data.result; + this.dirList=this.treeData(data.result); var cdata; - if (this.currentData) { - var rs = JSON.parse(this.currentData); - cdata = this.$refs.tree.getNode(rs.id).data; + 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] + cdata=this.dirList[this.dirList.length-1] } this.$nextTick(() => { - this.expandData = [cdata.id]; + this.expandData=[cdata.id]; this.$refs.tree.setCurrentKey(cdata.id); this.layerFormInline(cdata) }); @@ -848,65 +750,65 @@ // } // }); }, - handleClose() { + handleClose () { this.$confirm("鍏抽棴鍚庢棤娉曚繚瀛橈紝鏄惁鍏抽棴?") .then((_) => { this.resetForm(); }) .catch((_) => { }); }, - treeData(source) { - let cloneData = JSON.parse(JSON.stringify(source)); // 瀵规簮鏁版嵁娣卞害鍏嬮殕 + treeData (source) { + let cloneData=JSON.parse(JSON.stringify(source)); // 瀵规簮鏁版嵁娣卞害鍏嬮殕 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 + 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灞炴�э紝骞惰祴鍊� + 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; // 杩斿洖涓�绾ц彍鍗� + return father.pid==0; // 杩斿洖涓�绾ц彍鍗� }); }, //鍚戜笂鍚戜笅绉诲姩 - setEditNode(res) { - let node = this.$refs.tree.getCurrentNode(); - let pchildNodes = this.$refs.tree.getNode(node.id).parent.childNodes; - let currentId = {}; - for (let i = 0; i < pchildNodes.length; i++) { - if (pchildNodes[i].data.id == node.id) { - currentId = i; + setEditNode (res) { + let node=this.$refs.tree.getCurrentNode(); + let pchildNodes=this.$refs.tree.getNode(node.id).parent.childNodes; + let currentId={}; + for(let i=0;i<pchildNodes.length;i++) { + if(pchildNodes[i].data.id==node.id) { + currentId=i; } } - switch (res) { + switch(res) { case 1: //鍚戜笂绉诲姩 - if (currentId != 0) { - const tempChildrenNodex1 = pchildNodes[currentId - 1]; - const tempChildrenNodex2 = pchildNodes[currentId]; + 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; - const arr = []; + const arr=[]; this.oriData.filter((res) => { - if (res.id == tempChildrenNodex2.data.id) { + if(res.id==tempChildrenNodex2.data.id) { // res.orderNum = tempChildrenNodex2.orderNum; arr.push(res); - } else if (res.id == tempChildrenNodex1.data.id) { + } else if(res.id==tempChildrenNodex1.data.id) { // res.orderNum = tempChildrenNodex1.orderNum; arr.push(res); } }); - const orderNum = arr[1].orderNum - arr[1].orderNum = arr[0].orderNum - arr[0].orderNum = orderNum + const orderNum=arr[1].orderNum + arr[1].orderNum=arr[0].orderNum + arr[0].orderNum=orderNum - this.newData = arr; + this.newData=arr; this.sendChange(); } else { this.$message({ @@ -916,27 +818,27 @@ } break; case 2: //鍚戜笅绉诲姩 - if (currentId < pchildNodes.length - 1) { - const tempChildrenNodex1 = pchildNodes[currentId + 1]; - const tempChildrenNodex2 = pchildNodes[currentId]; + 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; - const arr = []; + const arr=[]; this.oriData.filter((res) => { - if (res.id == tempChildrenNodex2.data.id) { + if(res.id==tempChildrenNodex2.data.id) { // res.orderNum = tempChildrenNodex2.orderNum; arr.push(res); - } else if (res.id == tempChildrenNodex1.data.id) { + } else if(res.id==tempChildrenNodex1.data.id) { // 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; + const orderNum=arr[1].orderNum + arr[1].orderNum=arr[0].orderNum + arr[0].orderNum=orderNum + this.newData=arr; this.sendChange(); } else { this.$message({ @@ -947,14 +849,14 @@ break; } }, - setDelNode() { - this.$confirm("姝ゆ搷浣滃皢姘镐箙鍒犻櫎璇ョ洰褰�, 鏄惁缁х画?", "鎻愮ず", { + setDelNode () { + this.$confirm("姝ゆ搷浣滃皢姘镐箙鍒犻櫎璇ョ洰褰�, 鏄惁缁х画?","鎻愮ず",{ confirmButtonText: "纭畾", cancelButtonText: "鍙栨秷", type: "warning", }) .then(() => { - this.remove(this.newNode, this.itemdetail); + this.remove(this.newNode,this.itemdetail); }) .catch(() => { this.$message({ @@ -963,8 +865,8 @@ }); }); }, - insertStart() { - this.ruleForm = { + insertStart () { + this.ruleForm={ level: null, orderNum: null, pid: null, @@ -974,73 +876,73 @@ checks: [] } }, - setNewNode(res) { + setNewNode (res) { this.insertStart(); - var node = this.$refs.tree.getCurrentNode(); - this.newNode = node; - var id, lever, orderNum; - if (res == 1) { + var node=this.$refs.tree.getCurrentNode(); + this.newNode=node; + var id,lever,orderNum; + if(res==1) { //鏂板鍚岀骇 - id = this.itemdetail.pid; - 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.pid; + 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; - let pchildNodes = this.$refs.tree.getNode(this.newNode.id).childNodes - orderNum = this.getMaxOrderNum(pchildNodes); - lever = this.itemdetail.level + 1; + id=this.itemdetail.id; + let pchildNodes=this.$refs.tree.getNode(this.newNode.id).childNodes + orderNum=this.getMaxOrderNum(pchildNodes); + lever=this.itemdetail.level+1; } - this.ruleForm.pid = id; - this.ruleForm.level = lever; - this.ruleForm.orderNum = orderNum; - this.dialogFormVisible = true; + this.ruleForm.pid=id; + this.ruleForm.level=lever; + this.ruleForm.orderNum=orderNum; + this.dialogFormVisible=true; }, - getMaxOrderNum(res) { - var val = -100; - for (var i in res) { - if (res[i].data.orderNum > val) { - val = res[i].data.orderNum; + getMaxOrderNum (res) { + var val=-100; + for(var i in res) { + if(res[i].data.orderNum>val) { + val=res[i].data.orderNum; } } - val = val + 1; + val=val+1; return val; }, - append(node, data) { - this.dialogFormVisible = true; - this.ruleForm.pid = data.id; - this.ruleForm.orderNum = node.childNodes.length + 1; - this.ruleForm.level = data.level + 1; + append (node,data) { + this.dialogFormVisible=true; + this.ruleForm.pid=data.id; + this.ruleForm.orderNum=node.childNodes.length+1; + this.ruleForm.level=data.level+1; }, - resetForm(formName) { - this.dialogFormVisible = false; - this.ruleForm = {}; + resetForm (formName) { + this.dialogFormVisible=false; + this.ruleForm={}; this.$nextTick(() => { - this.ruleForm = {}; + this.ruleForm={}; // this.$refs[formName].resetFields(); }); }, - submitForm(formName) { + submitForm (formName) { this.$nextTick(() => { this.$refs[formName].validate((valid) => { - if (valid) { - this.fullscreenLoading = true; - var val = this.ruleForm; - if (this.ruleForm.checks) { - val.checks = this.ruleForm.checks.toString() + if(valid) { + this.fullscreenLoading=true; + var val=this.ruleForm; + if(this.ruleForm.checks) { + val.checks=this.ruleForm.checks.toString() } else { - val.checks = '' + val.checks='' } // var val = JSON.parse(JSON.stringify(this.ruleForm)) // this.itemdetail = val insertDir(val) .then((res) => { setTimeout(() => { - this.fullscreenLoading = false; + this.fullscreenLoading=false; - if (res.code == 200) { + if(res.code==200) { this.$message({ message: "娣诲姞鎴愬姛", type: "success", @@ -1048,16 +950,16 @@ // this.itemdetail = {}; // this.ruleForm = {}; - this.dialogFormVisible = false; + this.dialogFormVisible=false; this.$refs[formName].resetFields(); this.getDirTree(); } - }, 500); + },500); }) .catch((res) => { - this.itemdetail = {}; + this.itemdetail={}; this.$message.error("娣诲姞澶辫触"); - this.fullscreenLoading = false; + this.fullscreenLoading=false; console.log(res); }); } else { @@ -1067,48 +969,48 @@ }); }); }, - remove(node, data) { - this.itemaName = node.parent.data.id; + remove (node,data) { + this.itemaName=node.parent.data.id; - this.$confirm("姝ゆ搷浣滃皢鍒犻櫎璇ヨ妭鐐�, 鏄惁缁х画?", "鎻愮ず", { + this.$confirm("姝ゆ搷浣滃皢鍒犻櫎璇ヨ妭鐐�, 鏄惁缁х画?","鎻愮ず",{ confirmButtonText: "纭畾", cancelButtonText: "鍙栨秷", type: "warning", }) .then(() => { //鍏勫紵閲嶆柊鎺掑簭 - const parent = node.parent; - const children = parent.data.children || parent.data; - children.splice(data.orderNum - 1, 1); - children.forEach((item, index) => { - item.orderNum = index + 1; + const parent=node.parent; + const children=parent.data.children||parent.data; + children.splice(data.orderNum-1,1); + children.forEach((item,index) => { + item.orderNum=index+1; }); this.traverseArr(data); //鑾峰彇鍒犻櫎鐨勫瓙ID this.delChildIDs.push(data.id); //瑕佸垹闄ょ殑鍏ㄩ儴ID - let delIDs = this.delChildIDs; + let delIDs=this.delChildIDs; Promise.all([ deleteDir({ ids: delIDs.toString() }), updateDirTrees(children), ]) .then((res) => { - if (res[0].code == 200 && res[1].code == 200) { + if(res[0].code==200&&res[1].code==200) { this.$message({ type: "success", message: "鍒犻櫎鎴愬姛!", }); - let pchildNodes = this.$refs.tree.getNode(this.itemdetail.id).parent; - if (pchildNodes.data.id) { - this.currentData = JSON.stringify(pchildNodes.data) + 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.currentData=null } - this.itemdetail = {}; + this.itemdetail={}; this.getDirTree(); - } else if (res[0].code == 200) { + } else if(res[0].code==200) { this.$message.error("鍒犻櫎鎴愬姛锛屼綅缃皟鏁村け璐�"); - } else if (res[1].code == 200) { + } else if(res[1].code==200) { this.$message.error("鍒犻櫎澶辫触,浣嶇疆璋冩暣鎴愬姛"); } else { this.$message.error("鍒犻櫎澶辫触"); @@ -1119,7 +1021,7 @@ // this.itemdetail = {}; }); //閲嶇疆瑕佸垹闄ょ殑瀛怚D - this.delChildIDs = []; + this.delChildIDs=[]; }) .catch(() => { this.$message("宸插彇娑堝垹闄�"); @@ -1139,8 +1041,8 @@ // // console.log(data); // console.log(this.flaten(res)); }, - traverseArr(obj) { - if (obj.children) { + traverseArr (obj) { + if(obj.children) { return obj.children.forEach((item) => { // console.log(item.id + "---" + item.name); // this.delChildID += "id=" + item.id + "&"; @@ -1150,64 +1052,64 @@ } return; }, - flaten(arr) { - return arr.reduce((p, v, i) => { - for (let i = 0; i < p.length; i++) { - if (p[i].children) { + flaten (arr) { + return arr.reduce((p,v,i) => { + for(let i=0;i<p.length;i++) { + if(p[i].children) { delete p[i].children; } } - return p.concat(v.children ? this.flaten(v.children).concat(v) : v); - }, []); + return p.concat(v.children? this.flaten(v.children).concat(v):v); + },[]); }, - handleDragStart(node, ev) { - this.old_dirDat = JSON.parse(JSON.stringify(this.dirList)); //灏嗗浠界殑dir閲嶆柊璧嬪�� + handleDragStart (node,ev) { + this.old_dirDat=JSON.parse(JSON.stringify(this.dirList)); //灏嗗浠界殑dir閲嶆柊璧嬪�� }, - handleDrop(draggingNode, dropNode, dropType, ev) { - this.$confirm("姝ゆ搷浣滃皢淇濆瓨鐩綍鏇存敼, 鏄惁缁х画?", "鎻愮ず", { + handleDrop (draggingNode,dropNode,dropType,ev) { + this.$confirm("姝ゆ搷浣滃皢淇濆瓨鐩綍鏇存敼, 鏄惁缁х画?","鎻愮ず",{ confirmButtonText: "纭畾", cancelButtonText: "鍙栨秷", type: "warning", }) .then(() => { //鐖惰妭鐐� - let data = dropType != "inner" ? dropNode.parent.data : dropNode.data; + let data=dropType!="inner"? dropNode.parent.data:dropNode.data; // 鐖惰妭鐐逛腑鍏ㄩ儴瀛愯妭鐐� - let nodeData = - dropNode.level == 1 && dropType != "inner" ? data : data.children; + let nodeData= + dropNode.level==1&&dropType!="inner"? data:data.children; //鍙樻洿鑺傜偣 - nodeData.forEach((item, i) => { - if (dropType != "inner") { - if (draggingNode.data.pid === dropNode.data.pid) { - item.pid = item.pid; + nodeData.forEach((item,i) => { + if(dropType!="inner") { + if(draggingNode.data.pid===dropNode.data.pid) { + item.pid=item.pid; } else { - item.pid = dropNode.data.pid; + item.pid=dropNode.data.pid; } } else { - item.pid = data.id; + item.pid=data.id; } - item.orderNum = i + 1; + item.orderNum=i+1; }); - let arr = []; + let arr=[]; this.oriData.forEach((e) => { nodeData.forEach((item) => { - if (item.id === e.id) e = item; + if(item.id===e.id) e=item; }); arr.push(e); }); - this.newData = arr; + this.newData=arr; this.sendChange(); }) .catch(() => { this.$message("宸插彇娑堟洿鏀�"); - this.dirList = this.old_dirDat; //灏嗗浠界殑dir閲嶆柊璧嬪�� + this.dirList=this.old_dirDat; //灏嗗浠界殑dir閲嶆柊璧嬪�� }); }, - async sendChange() { - const data = await updateDirTrees(this.newData) + async sendChange () { + const data=await updateDirTrees(this.newData) - if (data.code != 200) { + if(data.code!=200) { return this.$message.error("绉诲姩澶辫触"); } this.getDirTree(); @@ -1225,64 +1127,64 @@ // }); }, - setDirectoryDownload() { - var url = BASE_URL + '/dir/downloadDir?token=' + getToken() + '&id=' + this.directoryData.id + setDirectoryDownload () { + var url=BASE_URL+'/dir/downloadDir?token='+getToken()+'&id='+this.directoryData.id console.log(url) - $("#Iframe1").attr("src", url).click() + $("#Iframe1").attr("src",url).click() }, - layerFormInline(data) { - if (data.pid == 0) { - this.directoryData = data; - this.directoryFlag = true; + layerFormInline (data) { + if(data.pid==0) { + this.directoryData=data; + this.directoryFlag=true; } else { - this.directoryFlag = false; + 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) + 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) { + 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 if(val.checks.indexOf('[]')>-1) { } else { checks.push(val.checks) } - this.itemdetail.checks = checks; + this.itemdetail.checks=checks; } else { - this.itemdetail.checks = [] + this.itemdetail.checks=[] } }, - async updCata(formName) { - this.fullscreenLoading = true; - var val = JSON.parse(JSON.stringify(this.itemdetail)); - val.orderNum = this.newNode.data.orderNum; + 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) + 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; + if(data.code!=200) { + this.fullscreenLoading=false; return this.$message.error("淇敼澶辫触"); } this.$message({ message: '淇敼鎴愬姛', type: 'success' }); - this.fullscreenLoading = false; + this.fullscreenLoading=false; this.getDirTree(); // this.$nextTick(() => { @@ -1318,59 +1220,59 @@ // }); // }); }, - reset(formName) { - this.itemdetail = {}; + 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) { + 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; + this.itemdetail.checks=checks; } else { - this.itemdetail.checks = [] + this.itemdetail.checks=[] } } }, - showPermsMenu(res) { - switch (res.tag) { + showPermsMenu (res) { + switch(res.tag) { case "/delete": - this.menuStatus.delete = true; + this.menuStatus.delete=true; break; case "/insert": - this.menuStatus.insert = true; + this.menuStatus.insert=true; break; case "/update": - this.menuStatus.update = true; + this.menuStatus.update=true; break; } }, - getPerms() { - var val = this.$store.state.currentPerms; - var permsEntity = this.$store.state.permsEntity; - if (!permsEntity || !permsEntity.length) { + getPerms () { + var val=this.$store.state.currentPerms; + var permsEntity=this.$store.state.permsEntity; + if(!permsEntity||!permsEntity.length) { getPerms().then((res) => { - if (res.code == 200) { - permsEntity = res.result; + if(res.code==200) { + permsEntity=res.result; } }); } - for (var i = 0; i < permsEntity.length; i++) { - if (val === permsEntity[i].perms) { + for(var i=0;i<permsEntity.length;i++) { + if(val===permsEntity[i].perms) { this.showPermsMenu(permsEntity[i]); } } }, }, - mounted() { + mounted () { this.getDirTree(); this.getPerms(); }, @@ -1380,9 +1282,12 @@ <style lang="less" scoped> .subpage_Box { //height: 96%; - width: 98%; + width: calc(98% - 20px); + height: calc(95% - 20px); padding: 1%; border-radius: 10px; + background: #f4f8ff; + margin: 10px; // .cataLogContent { // width: 100%; // height: 100%; -- Gitblit v1.9.3