| | |
| | | <div> |
| | | <div style="display: flex;justify-content: space-around"> |
| | | <el-button plain size="small" type="primary" @click="TreeAdd">添加</el-button> |
| | | <el-button plain size="small" type="primary" @click="ExportExcel">导出</el-button> |
| | | <el-button plain size="small" type="primary" @click="ImportExcel">导入</el-button> |
| | | <el-button plain size="small" type="primary" @click="TreeEdit">修改</el-button> |
| | | <el-button plain size="small" type="primary" @click="TreeDel">删除</el-button> |
| | | <!-- <el-button plain size="small" type="primary" @click="ExportExcel">导出</el-button>--> |
| | | <!-- <el-button plain size="small" type="primary" @click="ImportExcel">导入</el-button>--> |
| | | <el-button plain size="small" type="primary" @click="flushed">刷新</el-button> |
| | | </div> |
| | | <div style="display: flex;justify-content: space-around;margin-top: 5px;margin-bottom: 5px"> |
| | | |
| | | </div> |
| | | </div> |
| | | <!-- 树节点添加对话框--> |
| | |
| | | </el-dialog> |
| | | <!-- 修改对话框--> |
| | | <el-dialog :visible.sync="TreeEditFormVisible" append-to-body title="修改分类"> |
| | | <classifyTreeform ref="childForm" :TreeNewForm="TreeList" :nodeList="nodeList"></classifyTreeform> |
| | | <classifyTreeform ref="childForm" :loneTreeNewForm="TreeList" :nodeList="nodeList" :flag="'edit'"></classifyTreeform> |
| | | </el-dialog> |
| | | <avue-tree ref="tree" v-model="TreeAvueform" v-loading="loading" :data="Treedata" :defaultExpandAll="false" |
| | | <avue-tree ref="tree" v-model="CloneTreeAvueform" v-loading="loading" :data="CloneTreedata" :defaultExpandAll="false" |
| | | :option="Treeoption" |
| | | style="height: 80.5vh;padding-top: 5px;padding-bottom: 30px" |
| | | @node-click=" nodeClick" |
| | |
| | | <!-- 右侧表格--> |
| | | <avue-tabs :option="tabOption" @change="handleChange"></avue-tabs> |
| | | <span v-if="type.prop==='tab1'"> |
| | | <classifyTreeform ref="childForm" :TreeNewForm="TreeList" :nodeList="nodeList"></classifyTreeform> |
| | | <classifyTreeform ref="childForm" :loneTreeNewForm="TreeList" :nodeList="nodeList" :flag="'renonly'"></classifyTreeform> |
| | | </span> |
| | | <span v-else-if="type.prop==='tab2'"> |
| | | <basic-container> |
| | |
| | | @row-save="CrudRowSave" |
| | | @row-del="CrudRowDel" |
| | | @row-update="CrudRowUpdata" |
| | | :before-close="beforeClose" |
| | | @select="selectHandle" |
| | | > |
| | | <template slot="menuLeft"> |
| | | <el-button plain size="small" type="primary" @click="FindFormVisible = true;">查询</el-button> |
| | | <el-button plain size="small" type="primary" @click="FindeHanler">查询</el-button> |
| | | <el-button plain size="small" type="primary" @click="TemRefresh">刷新</el-button> |
| | | <el-button plain size="small" type="primary" @click="TreeEdit">修改</el-button> |
| | | <el-button plain size="small" type="primary" @click="TreeDel">删除</el-button> |
| | | <el-button plain size="small" type="primary" @click="Enable">启用</el-button> |
| | | <el-button plain size="small" type="primary" @click="Deactivate">停用</el-button> |
| | | <el-button plain size="small" type="primary" @click="CloneBtn">从其它模板克隆</el-button> |
| | |
| | | <el-container> |
| | | <el-aside width="300px"> |
| | | <div style="margin-bottom: 5px"><el-tag>主题库分类</el-tag></div> |
| | | <!-- 克隆模板的树 沿用首页树的loading和option,但是data和v-model绑定的数据创建一个新的变量,另外点击方法也是重新获取来操作克隆模板的数据--> |
| | | <avue-tree ref="tree" v-model="TreeAvueform" v-loading="loading" :data="Treedata" |
| | | :defaultExpandAll="false" |
| | | :option="Treeoption" |
| | | style="height: 50.5vh;margin-right: 10px" |
| | | @node-click=" nodeClick" |
| | | @check-change="checkChange" |
| | | @node-click="ClonenodeClick" |
| | | > |
| | | </avue-tree> |
| | | </el-aside> |
| | |
| | | </avue-crud> |
| | | |
| | | </basic-container> |
| | | <templatePro :ProData="this.ProData"></templatePro> |
| | | <templatePro :ProData="this.ProData" :crudOid="this.crudOid" :crudArray="this.crudArray" :Formlist="this.Formlist" :codeClassifyOid="this.codeClassifyOid"></templatePro> |
| | | </span> |
| | | </basic-container> |
| | | </el-main> |
| | |
| | | TreeObjcet, |
| | | TreeEnable, |
| | | TreeDeactivate, |
| | | importClassify, |
| | | gridCodeClassifyTemplate, |
| | | getObjectByOid, |
| | | gridCodeClassifyTemplateAttr, |
| | |
| | | editSave, |
| | | copy |
| | | } from "@/api/template/templateAttr"; |
| | | import done from "@/views/work/done"; |
| | | |
| | | export default { |
| | | name: "classifyTrees.vue", |
| | | //使用inject接收参数 |
| | | //Treeoption左侧树新增表单项 Treedata左侧树节点 配置项 crudTreeOption右侧表格配置项 crudTreeData右侧表格显示内容 |
| | | //Treeform右侧表单配置项 |
| | | inject: ['crudTreeOption', "crudTreeData"], |
| | | inject: [, "crudTreeData"], |
| | | data() { |
| | | return { |
| | | // //表格option配置项 |
| | | // crudTreeOption: { |
| | | // index: true, |
| | | // border: true, |
| | | // height:180, |
| | | // selection:true, |
| | | // addBtn:this.addFlag, |
| | | // column: [ |
| | | // { |
| | | // label: "模板编号", |
| | | // prop: "id" |
| | | // }, |
| | | // { |
| | | // label:"模板名称", |
| | | // prop:"name" |
| | | // }, |
| | | // { |
| | | // label: "模板描述", |
| | | // prop:"description" |
| | | // }, |
| | | // { |
| | | // label:"版本号", |
| | | // prop:"revisionSeq" |
| | | // }, |
| | | // { |
| | | // label:"状态", |
| | | // prop:"lcStatusText" |
| | | // } |
| | | // ] |
| | | // }, |
| | | addFlag:false, |
| | | // 表格当前行id |
| | | crudOid:"", |
| | | //表格当前选择数组 |
| | | crudArray:[], |
| | | //模板属性展示内容 |
| | | ProData: [], |
| | | //回车键搜索绑定值 |
| | |
| | | TreeAddFormVisible: false, |
| | | //当前点击项 |
| | | nodeClickList: "", |
| | | ClonenodeClickList:"", |
| | | //分类和主题库状态 |
| | | TreeFlag: false, |
| | | //树加载 |
| | |
| | | }, |
| | | //avue-tree数据,暂时没有作用,里面功能用element写了,只用avue的一个树组件不用内置表单了。 |
| | | TreeAvueform: {}, |
| | | //克隆树 |
| | | CloneTreeAvueform:{}, |
| | | Treedata: [], |
| | | CloneTreedata:[], |
| | | Treeoption: { |
| | | addBtn: false, |
| | | editBtn: false, |
| | |
| | | CloneSelectOptions: [{ |
| | | value: '0', |
| | | label: '模板编号' |
| | | }, |
| | | }, |
| | | { |
| | | value: '1', |
| | | label: '模板名称' |
| | |
| | | }, |
| | | { |
| | | label: "模板名称", |
| | | prop: "name" |
| | | prop: "name", |
| | | }, |
| | | { |
| | | label: "模板描述", |
| | |
| | | this.type = this.tabOption.column[0]; |
| | | this.getAttr(); |
| | | }, |
| | | computed:{ |
| | | crudTreeOption(){ |
| | | return{ |
| | | index: true, |
| | | border: true, |
| | | height:180, |
| | | selection:true, |
| | | addBtn:this.Formlist.length<=0 && this.nodeClickList != "", |
| | | column: [ |
| | | { |
| | | label: "模板编号", |
| | | prop: "id" |
| | | }, |
| | | { |
| | | label:"模板名称", |
| | | prop:"name" |
| | | }, |
| | | { |
| | | label: "模板描述", |
| | | prop:"description" |
| | | }, |
| | | { |
| | | label:"版本号", |
| | | prop:"revisionSeq", |
| | | display:false |
| | | }, |
| | | { |
| | | label:"状态", |
| | | prop:"lcStatusText", |
| | | display:false |
| | | } |
| | | ] |
| | | } |
| | | } |
| | | }, |
| | | methods: { |
| | | //行单选事件 |
| | | selectHandle(selection,row){ |
| | | this.crudOid=row.oid; |
| | | this.crudArray=selection; |
| | | gridCodeClassifyTemplateAttr({'conditionMap[classifyTemplateOid]': this.Formlist[0].oid}).then(res => { |
| | | this.ProData = res.data.data; |
| | | }).catch(res => { |
| | | this.$message.error(res) |
| | | }) |
| | | }, |
| | | //分类树数据处理 |
| | | getAttr() { |
| | | getAtrrList().then(res => { |
| | | this.Treedata = res.data; |
| | | this.CloneTreedata = res.data; |
| | | this.Treedata.forEach(() => { |
| | | for (let i = 0; i < this.Treedata.length; i++) { |
| | | this.Treedata[i].value = i; |
| | | } |
| | | }) |
| | | //调用修改属性名方法 |
| | | this.ModifyProperties(this.Treedata, 'text', 'label'); |
| | | this.ModifyProperties(this.CloneTreedata, 'name', 'label'); |
| | | }).catch(res => { |
| | | this.$message.error(res) |
| | | }) |
| | | }, |
| | | //定义一个修改对象属性名的方法 这里别改!!!好像是后台接口数据字段不一致,添加的方法。具体什么原因我也忘记了 |
| | | //定义一个修改数据属性名的方法 |
| | | ModifyProperties(obj, oldName, newName) { |
| | | for (let key in obj) { |
| | | if (key === oldName) { |
| | |
| | | message: '请先从树上选择一条数据!' |
| | | }); |
| | | } else { |
| | | this.TreeEditFormVisible = true |
| | | this.TreeEditFormVisible = true; |
| | | } |
| | | }, |
| | | //树刷新 |
| | |
| | | cancelButtonText: '取消', |
| | | type: 'warning' |
| | | }).then(() => { |
| | | TreeEnable(this.nodeClickList).then((res) => { |
| | | TreeEnable(this.nodeClickList).then(() => { |
| | | this.$message({ |
| | | type: 'success', |
| | | message: '启用成功!' |
| | |
| | | cancelButtonText: '取消', |
| | | type: 'warning' |
| | | }).then(() => { |
| | | TreeDeactivate(this.nodeClickList).then((res) => { |
| | | TreeDeactivate(this.nodeClickList).then(() => { |
| | | this.$message({ |
| | | type: 'success', |
| | | message: '停用成功!' |
| | |
| | | async nodeClick(data) { |
| | | //定义一个模板属性id,数据是模板管理表格里面的oid |
| | | this.nodeClickList = data |
| | | console.log(data.oid) |
| | | this.ProData=[] |
| | | try { |
| | | await TreeObjcet(data.oid).then(res => { |
| | | this.FlagObj = res.data.data |
| | |
| | | }) |
| | | //模板管理表格数据 |
| | | await gridCodeClassifyTemplate({'conditionMap[codeclassifyoid]': data.oid}).then(res => { |
| | | if (this.CloneVisible != true) { |
| | | this.Formlist = res.data.data.filter(item => { |
| | | if (item.codeclassifyoid != "") { |
| | | this.codeClassifyOid = item.codeclassifyoid |
| | | return item.codeclassifyoid == this.nodeClickList.oid |
| | | } |
| | | }) |
| | | } else { |
| | | this.CloneFormlist = res.data.data.filter(item => { |
| | | if (item.codeclassifyoid != "") { |
| | | this.codeClassifyOid = item.codeclassifyoid |
| | | return item.codeclassifyoid == this.nodeClickList.oid |
| | | } |
| | | }) |
| | | } |
| | | gridCodeClassifyTemplateAttr({'conditionMap[classifyTemplateOid]': this.Formlist[0].oid}).then(res => { |
| | | this.ProData = res.data.data |
| | | console.log(this.ProData) |
| | | }).catch(res => { |
| | | this.$message.error(res) |
| | | this.Formlist = res.data.data.filter(item => { |
| | | if (item.codeclassifyoid != "") { |
| | | this.codeClassifyOid = item.codeclassifyoid |
| | | return item.codeclassifyoid == this.nodeClickList.oid |
| | | } |
| | | }) |
| | | }).catch(res => { |
| | | console.log(res) |
| | | this.$message.error(res) |
| | | }) |
| | | // 基本信息表单数据 |
| | | await getObjectByOid(this.nodeClickList.oid).then(res => { |
| | | this.TreeList = res.data.data |
| | | // eslint-disable-next-line no-const-assig |
| | | this.TreeList = res.data.data; |
| | | }).catch(res => { |
| | | this.$message.error(res) |
| | | }) |
| | | } catch (error) { |
| | | console.log(error) |
| | | this.$message.error(error) |
| | | } |
| | | }, |
| | | //克隆模板树的点击切换数据 |
| | | async ClonenodeClick(data){ |
| | | this.ClonenodeClickList=data; |
| | | await gridCodeClassifyTemplate({'conditionMap[codeclassifyoid]': data.oid}).then(res=>{ |
| | | this.CloneFormlist = res.data.data.filter(item => { |
| | | if (item.codeclassifyoid != "") { |
| | | this.codeClassifyOid = item.codeclassifyoid |
| | | return item.codeclassifyoid == this.ClonenodeClickList.oid |
| | | } |
| | | }) |
| | | }) |
| | | }, |
| | | //tab栏切换 |
| | | handleChange(column) { |
| | | this.type = column |
| | | this.type = column; |
| | | }, |
| | | // //高级查询按钮 |
| | | // handleSelectChange(key) { |
| | |
| | | this.Formlist = res.data.data |
| | | }) |
| | | }, |
| | | |
| | | //模板管理表格添加 |
| | | CrudRowSave(row,done) { |
| | | debugger |
| | | console.log(nodeClickList.length) |
| | | if (this.nodeClickList.length <= 0) { |
| | | this.$message({ |
| | | type: 'warning', |
| | | message: '请先从树上选择一条数据!' |
| | | }); |
| | | } else { |
| | | console.log(this.nodeClickList) |
| | | let codeClassifyOid = this.codeClassifyOid |
| | | this.$set(row, "codeclassifyoid", codeClassifyOid) |
| | | addSave(row).then(res => { |
| | | this.$set(row, "codeclassifyoid", this.nodeClickList.oid) |
| | | addSave(row).then(() => { |
| | | this.$message({ |
| | | type: "success", |
| | | message: "添加成功!" |
| | | }); |
| | | done(row) |
| | | this.CrudRend() |
| | | done() |
| | | }).catch(res => { |
| | | this.$message({ |
| | | type: 'info', |
| | |
| | | }); |
| | | }) |
| | | } |
| | | console.log('123',this.codeClassifyOid) |
| | | }, |
| | | //模板管理修改 |
| | | CrudRowUpdata(row) { |
| | | CrudRowUpdata(row,index,done) { |
| | | editSave(row).then(() => { |
| | | this.CrudRend() |
| | | }).catch(res => { |
| | | this.$message({ |
| | | type: 'info', |
| | | message: res |
| | | type: "success", |
| | | message: "操作成功!" |
| | | }); |
| | | done() |
| | | }).catch(res => { |
| | | this.$message.error(res) |
| | | }) |
| | | }, |
| | | //模板管理删除 |
| | | CrudRowDel(row) { |
| | | deleteData(row).then(res => { |
| | | deleteData(row).then(()=> { |
| | | this.CrudRend() |
| | | }).catch(res => { |
| | | this.$message({ |
| | |
| | | }, |
| | | //模板管理表格查询 |
| | | EnterFind() { |
| | | console.log(this.Formlist) |
| | | if (this.FindText == "") { |
| | | gridCodeClassifyTemplate().then(res => { |
| | | this.Formlist = res.data.data |
| | |
| | | }) |
| | | }) |
| | | }, |
| | | // 查询 |
| | | FindeHanler(){ |
| | | if(this.nodeClickList != ""){ |
| | | this.FindFormVisible=true |
| | | }else { |
| | | this.$message.warning('请从树上选择一条数据') |
| | | } |
| | | }, |
| | | //克隆模板选择确定 |
| | | Clonehandler(){ |
| | | if(this.CloneFormlist.length <= 0){ |
| | | if(this.CloneSelect.length <= 0){ |
| | | this.$message({ |
| | | type: 'warning', |
| | | message: '请选择要克隆的模板!' |
| | |
| | | message: '只能选择一条数据!' |
| | | }); |
| | | } else { |
| | | this.CloneinnerVisible=true |
| | | this.CloneinnerVisible=true; |
| | | |
| | | } |
| | | }, |
| | | //点击从其它模板克隆 |
| | |
| | | }, |
| | | //克隆模板单选框改变 |
| | | selectionChange(row){ |
| | | console.log(row) |
| | | this.CloneSelect=row |
| | | this.CloneSelect=row; |
| | | //双向绑定,提交表单输入框回填上当前选择的数据 |
| | | this.CloneModel.id=row[0].id; |
| | | this.CloneModel.name=row[0].name; |
| | | //这里有点绕,CloneSelect是我选择框选择的数据。等于this.nodeClickList.oid是因为,克隆模板传递数据要把当前选择树的oid传递给后端。而不是当前要克隆模板的oid |
| | | this.CloneSelect[0].codeclassifyoid=this.nodeClickList.oid |
| | | }, |
| | | //克隆表单提交 |
| | | Clonesubmit(done){ |
| | | copy(this.CloneSelect[0]).then(res=>{ |
| | | console.log(res) |
| | | done() |
| | | Clonesubmit(row,done){ |
| | | //重新赋值CloneSelect传递的数据为输入框可以修改的数据,CloneModel提交表单输入框双向绑定数据 |
| | | this.CloneSelect[0].id=this.CloneModel.id; |
| | | this.CloneSelect[0].name=this.CloneModel.name; |
| | | copy(this.CloneSelect[0]).then(()=>{ |
| | | //因为是嵌套弹窗所以手动关闭CloneinnerVisible,CloneVisible两个弹窗。 |
| | | this.CloneinnerVisible=false |
| | | this.CloneVisible=false |
| | | this.$message.success("复制成功") |
| | | this.CrudRend() |
| | | done(row) |
| | | }).catch(res=>{ |
| | | done(res) |
| | | }) |
| | | }, |
| | | //刷新 |
| | |
| | | setTimeout(() => { |
| | | this.FormLoing = false |
| | | }, 600); |
| | | }, |
| | | // 左树多选 |
| | | checkChange(val) { |
| | | console.log(val) |
| | | }, |
| | | } |
| | | } |