ludc
2023-06-15 55517e16da5e7205770bf61fc27c3d06b7d189b5
Source/UBCS-WEB/src/components/Tree/classifyTrees.vue
@@ -74,9 +74,10 @@
                          @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>
@@ -168,7 +169,7 @@
          </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>
@@ -187,7 +188,6 @@
  TreeObjcet,
  TreeEnable,
  TreeDeactivate,
  importClassify,
  gridCodeClassifyTemplate,
  getObjectByOid,
  gridCodeClassifyTemplateAttr,
@@ -197,16 +197,50 @@
  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: [],
      //回车键搜索绑定值
@@ -399,14 +433,61 @@
  mounted() {
    this.type = this.tabOption.column[0];
    this.getAttr();
    console.log('11',this.nodeClickList)
  },
  computed:{
    crudTreeOption(){
      return{
        index: true,
        indexClassName:"序号",
        indexLabelClassName:'序号',
        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"
          },
          {
            label:"状态",
            prop:"lcStatusText"
          }
        ]
      }
    }
  },
  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;
        console.log(this.ProData)
      }).catch(res => {
        this.$message.error(res)
      })
    },
    //分类树数据处理
    getAttr() {
      getAtrrList().then(res => {
        this.Treedata = res.data;
        this.CloneTreedata = res.data;
        this.Treedata.forEach((item) => {
        this.Treedata.forEach(() => {
          for (let i = 0; i < this.Treedata.length; i++) {
            this.Treedata[i].value = i;
          }
@@ -546,7 +627,7 @@
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          TreeEnable(this.nodeClickList).then((res) => {
          TreeEnable(this.nodeClickList).then(() => {
            this.$message({
              type: 'success',
              message: '启用成功!'
@@ -574,7 +655,7 @@
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          TreeDeactivate(this.nodeClickList).then((res) => {
          TreeDeactivate(this.nodeClickList).then(() => {
            this.$message({
              type: 'success',
              message: '停用成功!'
@@ -594,7 +675,8 @@
    async nodeClick(data) {
      //定义一个模板属性id,数据是模板管理表格里面的oid
      this.nodeClickList = data
      console.log(data.oid)
      console.log(data)
      this.ProData=[]
      try {
        await TreeObjcet(data.oid).then(res => {
          this.FlagObj = res.data.data
@@ -609,19 +691,12 @@
              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)
          })
        }).catch(res => {
          console.log(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)
        })
@@ -722,7 +797,7 @@
      } else {
        let codeClassifyOid = this.codeClassifyOid
        this.$set(row, "codeclassifyoid", codeClassifyOid)
        addSave(row).then(res => {
        addSave(row).then(() => {
          this.$message({
            type: "success",
            message: "添加成功!"
@@ -739,7 +814,7 @@
    },
    //模板管理修改
    CrudRowUpdata(row,index,done) {
      editSave(row).then((res) => {
      editSave(row).then(() => {
        this.CrudRend()
        this.$message({
          type: "success",
@@ -752,7 +827,7 @@
    },
    //模板管理删除
    CrudRowDel(row) {
      deleteData(row).then(res => {
      deleteData(row).then(()=> {
        this.CrudRend()
      }).catch(res => {
        this.$message({
@@ -787,6 +862,14 @@
          }
        })
      })
    },
    // 查询
    FindeHanler(){
      if(this.nodeClickList != ""){
        this.FindFormVisible=true
      }else {
        this.$message.warning('请从树上选择一条数据')
      }
    },
    //克隆模板选择确定
    Clonehandler(){
@@ -830,7 +913,7 @@
      //重新赋值CloneSelect传递的数据为输入框可以修改的数据,CloneModel提交表单输入框双向绑定数据
      this.CloneSelect[0].id=this.CloneModel.id;
      this.CloneSelect[0].name=this.CloneModel.name;
      copy(this.CloneSelect[0]).then(res=>{
      copy(this.CloneSelect[0]).then(()=>{
        //因为是嵌套弹窗所以手动关闭CloneinnerVisible,CloneVisible两个弹窗。
        this.CloneinnerVisible=false
        this.CloneVisible=false