From a7199e5a4f3e34b14d395e319a552c5c3b8b3a4d Mon Sep 17 00:00:00 2001 From: Surpriseplus <845948745@qq.com> Date: 星期四, 24 十一月 2022 09:41:25 +0800 Subject: [PATCH] 数据上传,数据入库页面修改 --- src/views/datamanage/styleManage.vue | 113 +++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 files changed, 103 insertions(+), 10 deletions(-) diff --git a/src/views/datamanage/styleManage.vue b/src/views/datamanage/styleManage.vue index 6abc0ea..49b36ea 100644 --- a/src/views/datamanage/styleManage.vue +++ b/src/views/datamanage/styleManage.vue @@ -31,7 +31,7 @@ >{{ $t('common.empty') }}</el-button > <el-button v-if="btnStatus.insert" - @click="InsertFormdialog = true" + @click="setInsertShow()" icon="el-icon-edit" type="success" size="small" @@ -258,7 +258,13 @@ :label="$t('dataManage.styleObj.dirid')" :label-width="formLabelWidth" > - <el-input + <el-cascader + v-model="upform.dirid" + :options="editcatalogOption" + @change="catalogChange" + :props="cascader" style="width:730px" + ></el-cascader> + <!-- <el-input v-model="upform.dirValue" disabled autocomplete="off" @@ -268,13 +274,20 @@ @click="showDirTree(1)" style="margin-left: 10px" ><i class="el-icon-plus"></i - ></el-link> + ></el-link> --> </el-form-item> <el-form-item :label="$t('dataManage.styleObj.depid')" :label-width="formLabelWidth" > - <el-input + <el-cascader + v-model="upform.depid" + :options="editCompanyOption" + @change="editcompanyChange" + :props="cascader" + style="width:730px" + ></el-cascader> + <!-- <el-input v-model="upform.depValue" disabled autocomplete="off" @@ -284,7 +297,7 @@ @click="showDepTree(1)" style="margin-left: 10px" ><i class="el-icon-plus"></i - ></el-link> + ></el-link> --> </el-form-item> <el-form-item :label="$t('dataManage.styleObj.ver')" @@ -417,7 +430,14 @@ :label="$t('dataManage.styleObj.dirid')" :label-width="formLabelWidth" > - <el-input + <el-cascader + v-model="insertform.dirid" + :options="catalogOption" + @change="catalogChange" + :props="cascader" + style="width:730px" + ></el-cascader> + <!-- <el-input v-model="insertform.dirValue" disabled autocomplete="off" @@ -427,13 +447,20 @@ @click="showDirTree(0)" style="margin-left: 10px" ><i class="el-icon-plus"></i - ></el-link> + ></el-link> --> </el-form-item> <el-form-item :label="$t('dataManage.styleObj.depid')" :label-width="formLabelWidth" > - <el-input + <el-cascader + v-model="insertform.depid" + :options="companyOption" + @change="companyChange" + :props="cascader" + style="width:730px" + ></el-cascader> + <!-- <el-input v-model="insertform.depValue" disabled autocomplete="off" @@ -443,7 +470,7 @@ @click="showDepTree(0)" style="margin-left: 10px" ><i class="el-icon-plus"></i - ></el-link> + ></el-link> --> </el-form-item> <el-form-item :label="$t('dataManage.styleObj.ver')" @@ -595,6 +622,8 @@ deleteStyles, updateStyle, upload_style, + queryDepTree, + selectdirTab } from "../../api/api"; export default { name: "styleManage", @@ -641,11 +670,24 @@ insert: false, update: false, }, + + companyOption:[], + catalogOption:[], + editCompanyOption:[], + editcatalogOption:[], + cascader: { + label: 'name', + value: 'id', + children: 'children', + checkStrictly: true, + emitPath: false, + }, }; }, created() { this.getRoleTabelData(); this.showPermsBtn(); + this.getQueryDepTree();this.getSelectdirTab(); }, methods: { showPermsBtn() { @@ -1092,7 +1134,7 @@ this.upflag = false; this.dialogFormVisible = false; this.upform = {}; - this.filesReset(); + // this.filesReset(); }, submitForm(formName) { this.getRoleTabelData(); @@ -1129,6 +1171,7 @@ }, handleEdit(index, row) { + this.upflag = true; this.dialogFormVisible = true; this.upform = row; @@ -1161,6 +1204,56 @@ "height=800, width=1500, top=150, left=350, toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no" ); }, + catalogChange(res) { + this.insertform.dirid = res; + this.upform.dirid =res; + + }, + editcompanyChange(res){ +this.upform.depid = res; + }, + companyChange(res){ + this.insertform.depid = res; + + }, + //鏂板鏁版嵁 + setInsertShow(){ +this.InsertFormdialog = true; + }, + //鐩綍鍒楄〃鑾峰彇 + async getSelectdirTab() { + const res = await selectdirTab(); + if (res.code != 200) { + this.$message.error('鐩綍鍒楄〃鑾峰彇澶辫触'); + return; + } + this.insertform.dirid = 1; + this.upform.dirid = 1; + this.catalogOption = this.treeData(res.result); + this.editcatalogOption= this.treeData(res.result); + }, + //鍗曚綅鍒楄〃鑾峰彇 + async getQueryDepTree() { + const res = await queryDepTree(); + if (res.code != 200) { + this.$message.error('鍗曚綅鍒楄〃鑾峰彇澶辫触'); + return; + } + this.insertform.depid = 1; + this.upform.depid = 1; + this.companyOption = this.treeData(res.result); + this.editCompanyOption= this.treeData(res.result); + }, + //鏍戝垪琛ㄧ敓鎴� + treeData(source) { + let cloneData = JSON.parse(JSON.stringify(source)); // 瀵规簮鏁版嵁娣卞害鍏嬮殕 + return cloneData.filter((father) => { + // 寰幆鎵�鏈夐」 + let branchArr = cloneData.filter((child) => father.id == child.pid); // 瀵规瘮ID锛屽垎鍒笂涓嬬骇鑿滃崟锛屽苟杩斿洖鏁版嵁 + branchArr.length > 0 ? (father.children = branchArr) : ''; // 缁欑埗绾ф坊鍔犱竴涓猚hildren灞炴�э紝骞惰祴鍊� + return father.pid == 0; // 杩斿洖涓�绾ц彍鍗� + }); + }, }, }; </script> -- Gitblit v1.9.3