| | |
| | | >{{ $t('common.empty') }}</el-button> |
| | | <el-button |
| | | v-if="menuStatus.insert" |
| | | @click="InsertFormdialog = true" |
| | | @click="setInsertFormdialog" |
| | | icon="el-icon-edit" |
| | | type="success" |
| | | size="small" |
| | |
| | | class="infoBox box_div " |
| | | v-show="showinfoBox" |
| | | > |
| | | |
| | | <div |
| | | slot="header" |
| | | class="clearfix" |
| | |
| | | :label="$t('userManage.resManageObj.depid')" |
| | | :label-width="formLabelWidth" |
| | | > |
| | | <el-input |
| | | <el-select |
| | | :popper-append-to-body="false" |
| | | v-model="insertform.depValue" |
| | | placeholder="请选择" |
| | | style="width:92.5%" |
| | | > |
| | | <el-option |
| | | :value="insertform.depid" |
| | | :label="insertform.depValue" |
| | | style=" height:auto" |
| | | > |
| | | <el-tree |
| | | ref="tree" |
| | | :data="depList" |
| | | node-key="id" |
| | | :props="props" |
| | | @node-click="handleDepList" |
| | | /> |
| | | </el-option> |
| | | </el-select> |
| | | <!-- <el-input |
| | | v-model="insertform.depValue" |
| | | disabled |
| | | autocomplete="off" |
| | |
| | | :underline="false" |
| | | @click="showDepTree(0)" |
| | | style="margin-left: 10px" |
| | | ><i class="el-icon-plus"></i></el-link> |
| | | ><i class="el-icon-plus"></i></el-link> --> |
| | | </el-form-item> |
| | | <el-form-item |
| | | :label="$t('userManage.resManageObj.dirid')" |
| | | :label-width="formLabelWidth" |
| | | > |
| | | <el-input |
| | | <el-select |
| | | :popper-append-to-body="false" |
| | | v-model="insertform.dirValue" |
| | | disabled |
| | | autocomplete="off" |
| | | ></el-input> |
| | | <el-link |
| | | :underline="false" |
| | | @click="showDirTree(0)" |
| | | style="margin-left: 10px" |
| | | ><i class="el-icon-plus"></i></el-link> |
| | | placeholder="请选择" |
| | | style="width:92.5%" |
| | | > |
| | | <el-option |
| | | :value="insertform.dirid" |
| | | :label="insertform.dirValue" |
| | | style=" height:auto" |
| | | > |
| | | <el-tree |
| | | ref="tree" |
| | | :data="dirList" |
| | | node-key="id" |
| | | :props="props" |
| | | @node-click="handleDirList" |
| | | /> |
| | | </el-option> |
| | | </el-select> |
| | | |
| | | </el-form-item> |
| | | <el-form-item |
| | | :label="$t('userManage.resManageObj.descr')" |
| | |
| | | :label="$t('userManage.resManageObj.depid')" |
| | | :label-width="formLabelWidth" |
| | | > |
| | | <el-input |
| | | <el-select |
| | | :popper-append-to-body="false" |
| | | v-model="upform.depValue" |
| | | placeholder="请选择" |
| | | style="width:92.5%" |
| | | > |
| | | <el-option |
| | | :value="upform.depid" |
| | | :label="upform.depValue" |
| | | style=" height:auto" |
| | | > |
| | | <el-tree |
| | | ref="tree1" |
| | | :data="dirList" |
| | | node-key="id" |
| | | :props="props" |
| | | @node-click="handleEditDepList" |
| | | /> |
| | | </el-option> |
| | | </el-select> |
| | | <!-- <el-input |
| | | v-model="upform.depValue" |
| | | disabled |
| | | autocomplete="off" |
| | |
| | | :underline="false" |
| | | @click="showDepTree(1)" |
| | | style="margin-left: 10px" |
| | | ><i class="el-icon-plus"></i></el-link> |
| | | ><i class="el-icon-plus"></i></el-link> --> |
| | | </el-form-item> |
| | | <el-form-item |
| | | :label="$t('userManage.resManageObj.dirid')" |
| | | :label-width="formLabelWidth" |
| | | > |
| | | <el-input |
| | | <el-select |
| | | :popper-append-to-body="false" |
| | | v-model="upform.dirValue" |
| | | placeholder="请选择" |
| | | style="width:92.5%" |
| | | > |
| | | <el-option |
| | | :value="upform.dirid" |
| | | :label="upform.dirValue" |
| | | style=" height:auto" |
| | | > |
| | | <el-tree |
| | | ref="tree1" |
| | | :data="dirList" |
| | | node-key="id" |
| | | :props="props" |
| | | :default-expand-all="defaultExpand" |
| | | @node-click="handleEditDirList" |
| | | /> |
| | | </el-option> |
| | | </el-select> |
| | | <!-- <el-input |
| | | v-model="upform.dirValue" |
| | | disabled |
| | | autocomplete="off" |
| | |
| | | :underline="false" |
| | | @click="showDirTree(1)" |
| | | style="margin-left: 10px" |
| | | ><i class="el-icon-plus"></i></el-link> |
| | | ><i class="el-icon-plus"></i></el-link> --> |
| | | </el-form-item> |
| | | <el-form-item |
| | | :label="$t('userManage.resManageObj.descr')" |
| | |
| | | updateRes, |
| | | deleteRess, |
| | | upload_res, |
| | | selectdirTab, |
| | | selectdepTab, |
| | | } from '../../api/api.js'; |
| | | import styleDirTree from '../datamanage/styleDirTree.vue'; |
| | | import styleDepTree from '../datamanage/styleDepTree.vue'; |
| | |
| | | components: { MyBread, styleDirTree, styleDepTree }, |
| | | data() { |
| | | return { |
| | | props: { |
| | | label: 'name', |
| | | value: 'id', |
| | | children: 'children', |
| | | checkStrictly: true, |
| | | emitPath: false, |
| | | }, |
| | | depList: [], |
| | | dirList: [], |
| | | menuStatus: { |
| | | delete: false, |
| | | insert: false, |
| | |
| | | uploadFile: null, |
| | | insertform: { |
| | | img: '', |
| | | depValue: '', |
| | | dirValue: '' |
| | | }, |
| | | tableData: [], |
| | | itemdetail: {}, |
| | |
| | | this.getRoleTabelData(); |
| | | }, |
| | | methods: { |
| | | handleEditDepList(data, node, nodeData) { |
| | | this.upform.depid = data.id |
| | | this.upform.depValue = data.name; |
| | | }, |
| | | handleEditDirList(data, node, nodeData) { |
| | | this.upform.dirid = data.id |
| | | this.upform.dirValue = data.name; |
| | | }, |
| | | handleDepList(data, node, nodeData) { |
| | | |
| | | this.insertform.depid = data.id |
| | | this.insertform.depValue = data.name; |
| | | }, |
| | | handleDirList(data, node, nodeData) { |
| | | this.insertform.dirid = data.id |
| | | this.insertform.dirValue = data.name; |
| | | }, |
| | | 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) : ''; // 给父级添加一个children属性,并赋值 |
| | | // 属于同一对象问题,例如:令 a=b、c=1 ,然后再令 b.c=c , 那么 a.c=b.c=c=1 ;同理,后续令 c.d=2 ,那么 a.c.d 也是=2; |
| | | // 由此循环多次后,就能形成相应的树形数据结构 |
| | | return father.pid == 0; // 返回一级菜单 |
| | | }); |
| | | }, |
| | | async getDepList() { |
| | | const data = await selectdepTab(); |
| | | if (data.code != 200) { |
| | | return this.$message.error('单位列表调用失败'); |
| | | } |
| | | this.depList = this.treeData(data.result) |
| | | }, |
| | | async getDirList() { |
| | | const data = await selectdirTab(); |
| | | if (data.code != 200) { |
| | | return this.$message.error('目录列表调用失败'); |
| | | } |
| | | this.dirList = this.treeData(data.result) |
| | | }, |
| | | setInsertFormdialog() { |
| | | this.getDepList(); |
| | | this.getDirList(); |
| | | this.InsertFormdialog = true; |
| | | }, |
| | | showPermsMenu(res) { |
| | | switch (res.tag) { |
| | | case '/delete': |
| | |
| | | console.log(this.itemdetail.imageFile) |
| | | }, |
| | | handleEdit(index, row) { |
| | | this.getDepList(); |
| | | this.getDirList(); |
| | | this.EditFormdialog = true; |
| | | this.upform = row; |
| | | this.upform.depValue = row.depName; |
| | |
| | | margin: 10px auto 0; |
| | | // background-color: red; |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | </style> |
| | | |