| | |
| | | <div> |
| | | <div style="display: flex; flex-direction: column;"> |
| | | <div style="display: flex;"> |
| | | <el-button plain size="small" type="primary" @click="TreeAdd" v-if="permissionList.TreeAddStatus">添加</el-button> |
| | | <el-button plain size="small" type="primary" @click="TreeEdit" v-if="permissionList.TreeEditStatus">修改</el-button> |
| | | <el-button plain size="small" type="primary" @click="TreeDel" v-if="permissionList.TreeDelStatus">删除</el-button> |
| | | <el-button plain size="small" type="primary" @click="flushed" v-if="permissionList.flushedStatus">刷新</el-button> |
| | | <el-button v-if="permissionList.TreeAddStatus" plain size="small" type="primary" @click="TreeAdd">添加 |
| | | </el-button> |
| | | <el-button v-if="permissionList.TreeEditStatus" plain size="small" type="primary" @click="TreeEdit">修改 |
| | | </el-button> |
| | | <el-button v-if="permissionList.TreeDelStatus" plain size="small" type="primary" @click="TreeDel">删除 |
| | | </el-button> |
| | | <el-button v-if="permissionList.flushedStatus" plain size="small" type="primary" @click="flushed">刷新 |
| | | </el-button> |
| | | </div> |
| | | <div style="display: flex; margin-top: 10px"> |
| | | <el-button plain size="small" type="primary" @click="Enable" v-if="permissionList.EnableStatus">启用</el-button> |
| | | <el-button plain size="small" type="primary" @click="Deactivate" v-if="permissionList.DeactivateStatus">停用</el-button> |
| | | <el-button plain size="small" type="primary" @click.native="ImportExcel" v-if="permissionList.ImportExcelStatus">导入</el-button> |
| | | <el-button plain size="small" type="primary" @click="ExportExcel" v-if="permissionList.ExportExcelStatus">导出</el-button> |
| | | <el-button v-if="permissionList.EnableStatus" plain size="small" type="primary" @click="Enable">启用 |
| | | </el-button> |
| | | <el-button v-if="permissionList.DeactivateStatus" plain size="small" type="primary" @click="Deactivate"> |
| | | 停用 |
| | | </el-button> |
| | | <el-button v-if="permissionList.ImportExcelStatus" plain size="small" type="primary" |
| | | @click.native="ImportExcel">导入 |
| | | </el-button> |
| | | <el-button v-if="permissionList.ExportExcelStatus" plain size="small" type="primary" |
| | | @click="ExportExcel">导出 |
| | | </el-button> |
| | | </div> |
| | | </div> |
| | | <div style="display: flex;justify-content: space-around;margin-top: 5px;margin-bottom: 5px"> |
| | |
| | | <el-form-item label="是否参与关键属性校验:" label-width="170px"> |
| | | <el-switch |
| | | v-model="TreeAddform.codeKeyAttrValue" |
| | | active-text="是" |
| | | inactive-text="否" |
| | | active-color="#13ce66" |
| | | active-text="是" |
| | | inactive-color="#ff4949" |
| | | inactive-text="否" |
| | | @change="switchChange"> |
| | | </el-switch> |
| | | </el-form-item> |
| | |
| | | </template> |
| | | |
| | | <template slot="menuLeft"> |
| | | <el-button plain size="small" type="primary" @click="FindeHanler" v-if="permissionList.FindStatus">查询</el-button> |
| | | <el-button plain size="small" type="primary" @click="TemRefresh" v-if="permissionList.TemRefreshStatus">刷新</el-button> |
| | | <el-button plain size="small" type="primary" @click="CloneBtn" v-if="permissionList.CloneBtnStuatus">从其它模板克隆</el-button> |
| | | <el-button v-if="permissionList.FindStatus" plain size="small" type="primary" |
| | | @click="FindeHanler">查询</el-button> |
| | | <el-button v-if="permissionList.TemRefreshStatus" plain size="small" type="primary" |
| | | @click="TemRefresh">刷新</el-button> |
| | | <el-button v-if="permissionList.CloneBtnStuatus" plain size="small" type="primary" @click="CloneBtn">从其它模板克隆</el-button> |
| | | <!-- 查询对话框--> |
| | | <el-dialog :visible.sync="FindFormVisible" append-to-body title="高级查询"> |
| | | <div> |
| | |
| | | import {defaultReferDataGrid, referDataGrid} from '@/api/MasterData/master' |
| | | import func from "@/util/func"; |
| | | import {mapGetters} from "vuex"; |
| | | |
| | | export default { |
| | | name: "classifyTrees.vue", |
| | | data() { |
| | |
| | | }, |
| | | //分类树数据处理 |
| | | getAttr() { |
| | | getAtrrList().then(res => { |
| | | return new Promise((resolve, reject) => { |
| | | getAtrrList() |
| | | .then(res => { |
| | | this.Treedata = res.data; |
| | | this.CloneTreedata = res.data; |
| | | this.Treedata.forEach(() => { |
| | |
| | | } |
| | | return item; |
| | | }); |
| | | }).catch(res => { |
| | | this.$message.error(res) |
| | | |
| | | resolve(); // 完成请求,调用resolve方法 |
| | | }) |
| | | .catch(error => { |
| | | this.$message.error(error) |
| | | reject(error); // 请求出错,调用reject方法 |
| | | }); |
| | | }); |
| | | }, |
| | | //定义一个修改数据属性名的方法 |
| | | ModifyProperties(obj, oldName, newName) { |
| | |
| | | }, |
| | | //树刷新 |
| | | flushed() { |
| | | this.loading = true |
| | | this.loading = true; |
| | | this.getAttr() |
| | | setTimeout(() => { |
| | | .then(() => { |
| | | this.loading = false; |
| | | this.$refs.tree.setCurrentKey(null); |
| | | this.nodeClickList = {} |
| | | this.TreeList = [] |
| | | this.TreeFlagCode = true; |
| | | }, 600); |
| | | }) |
| | | .catch(error => { |
| | | this.loading = false; |
| | | console.error(error); |
| | | }); |
| | | }, |
| | | //启用和停用都先判断状态 |
| | | //启用 |
| | | Enable() { |
| | | async Enable() { |
| | | if (Object.keys(this.nodeClickList).length < 1) { |
| | | this.$message.warning('请先从树上选择一条数据') |
| | | } else { |
| | | this.$message.warning('请先从树上选择一条数据'); |
| | | return; |
| | | } |
| | | if (this.FlagObj.lcStatus == "Enabled") { |
| | | this.$message({ |
| | | type: 'warning', |
| | | message: '当前分类不是停用状态' |
| | | }); |
| | | } else { |
| | | this.$confirm('是否将子分类一并启用?', '提示', { |
| | | return; |
| | | } |
| | | this.loading = true; |
| | | try { |
| | | const confirmResult = await this.$confirm('是否将子分类一并启用?', '提示', { |
| | | confirmButtonText: '是', |
| | | cancelButtonText: '取消', |
| | | type: 'warning' |
| | | }).then(() => { |
| | | TreeEnable(this.nodeClickList).then(() => { |
| | | }); |
| | | if (confirmResult) { |
| | | await TreeEnable(this.nodeClickList); |
| | | this.$message({ |
| | | type: 'success', |
| | | message: '启用成功!' |
| | | }); |
| | | this.getAttr() |
| | | }) |
| | | }).catch(() => { |
| | | await this.getAttr(); |
| | | } else { |
| | | this.$message({ |
| | | type: 'info', |
| | | message: '已取消启用' |
| | | }); |
| | | }); |
| | | } |
| | | } catch (error) { |
| | | console.error(error); |
| | | } finally { |
| | | this.loading = false; |
| | | } |
| | | }, |
| | | |
| | | async Deactivate() { |
| | | if (Object.keys(this.nodeClickList).length < 1) { |
| | | this.$message.warning('请先从树上选择一条数据'); |
| | | return; |
| | | } |
| | | |
| | | }, |
| | | //停用 |
| | | Deactivate() { |
| | | if (Object.keys(this.nodeClickList).length < 1) { |
| | | this.$message.warning('请先从树上选择一条数据') |
| | | } else { |
| | | if (this.FlagObj.lcStatus === "Disabled") { |
| | | this.$message({ |
| | | type: 'warning', |
| | | message: '当前分类不是启用状态!' |
| | | }); |
| | | } else { |
| | | this.$confirm('是否停用当前分类,停用后,子分类也将不能被使用,是否继续?', '提示', { |
| | | return; |
| | | } |
| | | |
| | | this.loading = true; |
| | | try { |
| | | const confirmResult = await this.$confirm('是否停用当前分类,停用后,子分类也将不能被使用,是否继续?', '提示', { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | type: 'warning' |
| | | }).then(() => { |
| | | TreeDeactivate(this.nodeClickList).then(() => { |
| | | }); |
| | | if (confirmResult) { |
| | | await TreeDeactivate(this.nodeClickList); |
| | | this.$message({ |
| | | type: 'success', |
| | | message: '停用成功!' |
| | | }); |
| | | this.nodeClickList['flag'] = true; |
| | | this.getAttr() |
| | | }) |
| | | }).catch(() => { |
| | | await this.getAttr(); |
| | | } else { |
| | | this.$message({ |
| | | type: 'info', |
| | | message: '已取消停用' |
| | | }); |
| | | }); |
| | | } |
| | | } catch (error) { |
| | | console.error(error); |
| | | } finally { |
| | | this.loading = false; |
| | | } |
| | | }, |
| | | //树点击事件 |