ludc
2023-05-23 b8886034cbd7a43911d6b24e322f604f557c1e02
Source/UBCS-WEB/src/components/Tree/classifyTrees.vue
@@ -7,15 +7,12 @@
        <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="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>
          </div>
          <div style="display: flex;justify-content: space-around;margin-top: 5px;margin-bottom: 5px">
            <el-button plain size="small" type="primary" @click="Deactivate">停用</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>
        <!--        树节点添加对话框-->
@@ -62,7 +59,6 @@
                   @check-change="checkChange"
        >
        </avue-tree>
      </basic-container>
    </el-aside>
    <el-main>
@@ -70,7 +66,10 @@
        <!--        右侧表格-->
        <avue-tabs :option="tabOption" @change="handleChange"></avue-tabs>
        <span v-if="type.prop==='tab1'">
          <basic-container>
           <classifyTreeform ref="childForm" :TreeNewForm="TreeList" :nodeList="nodeList"></classifyTreeform>
        </span>
        <span v-else-if="type.prop==='tab2'">
            <basic-container>
               <avue-crud v-model="crudForm" v-loading="FormLoing" :data="this.Formlist" :option="this.crudTreeOption"
                          @row-save="CrudRowSave"
                          @row-del="CrudRowDel"
@@ -79,10 +78,15 @@
            <template slot="menuLeft">
              <el-button plain size="small" type="primary" @click="FindFormVisible = true;">查询</el-button>
              <el-button plain size="small" type="primary" @click="TemRefresh">刷新</el-button>
              <el-button plain size="small" type="primary">从其它模板克隆</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>
              <div style="display: inline-block"> <el-input v-model="FindText" placeholder="请输入关键字按回车查询"
                                                            size="small"
                                                            @keyup.enter.native="EnterFind"></el-input></div>
              <!--              查询对话框-->
           <el-dialog :visible.sync="FindFormVisible" append-to-body title="高级查询">
              <div>
                <el-button size="small" type="primary" @click="AdvQueries">查询</el-button>
@@ -91,7 +95,8 @@
             <div style="padding-left: 80px;margin-top: 15px;">
               <template v-for="(value, key) in FindSelect">
                <div style="display: flex;justify-content: space-around;width: 85%;margin-bottom: 15px">
                <el-select v-model="FindSelect[key]" placeholder="请选择" style="width: 28%" @change="handleSelectChange(key)">
                <el-select v-model="FindSelect[key]" placeholder="请选择" style="width: 28%"
                           @change="handleSelectChange(key)">
                  <el-option label="模板编号" value="0"></el-option>
                  <el-option label="模板名称" value="1"></el-option>
                  <el-option label="模板描述" value="2"></el-option>
@@ -104,17 +109,66 @@
                </el-select>
              <el-input v-model="QueryArray[key]" style="width: 49%"></el-input>
          <span> <i class="el-icon-delete" style="font-size: 22px;margin-top:8px;margin-left: 10px"/></span>
    </div>
  </template>
</div>
             </div>
          </template>
        </div>
           </el-dialog>
              <!--            模板克隆  -->
                <el-dialog :visible.sync="CloneVisible" append-to-body title="克隆模板">
                  <el-container>
                    <el-aside width="300px">
                      <div style="margin-bottom: 5px"><el-tag>主题库分类</el-tag></div>
                        <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"
                        >
                        </avue-tree>
                    </el-aside>
                     <el-container>
                       <el-main>
                         <div style="padding-left: 10px;height: 50.5vh">
                           <div style="margin: 8px 0;display: flex">
                             <el-select v-model="Clonevalue" size="small" style="width: 130px;">
                               <el-option
                                 v-for="item in this.CloneSelectOptions"
                                 :key="item.value"
                                 :label="item.label"
                                 :value="item.value">
                              </el-option>
                             </el-select>
                            <el-input v-model="CloneFind" size="small" style="width: 40%;margin-left: 15px" placeholder="输入值后按回车进行模糊查询"></el-input>
                             <el-button size="small" type="primary" plain style="margin-left: 10px" @click="CloneEnterFind"  @keyup.enter.native="CloneEnterFind">查询</el-button>
                           </div>
                            <avue-crud v-model="ClonecrudForm" v-loading="FormLoing" :data="this.CloneFormlist"
                                       :option="this.ClonecrudTreeOption"
                                       @selection-change="selectionChange"
                            ></avue-crud>
                         </div>
                       </el-main>
                     </el-container>
                    </el-container >
                   <div style="display: flex; justify-content: flex-end; align-items: center;margin-top: 10px" >
                     <el-button size="small " type="primary" @click="Clonehandler">确定</el-button>
                     <el-button size="small" @click="CloneVisible=false" >取消</el-button>
                   </div>
                      <el-dialog
                        width="30%"
                        title="克隆模板"
                        :visible.sync="CloneinnerVisible"
                        append-to-body>
                        <div>
                          <avue-form :option="CloneOption" @submit="Clonesubmit" v-model="CloneModel"></avue-form>
                        </div>
                    </el-dialog>
                </el-dialog>
            </template>
          </avue-crud>
          </basic-container>
    <templatePro :ProData="this.ProData"></templatePro>
        </span>
        <span v-else-if="type.prop==='tab2'">
           <classifyTreeform ref="childForm" :TreeNewForm="TreeList" :nodeList="nodeList"></classifyTreeform>
          <templatePro :ProData="this.ProData"></templatePro>
        </span>
      </basic-container>
    </el-main>
@@ -140,8 +194,10 @@
  gridCodeClassifyFindTemplate,
  addSave,
  deleteData,
  editSave
  editSave,
  copy
} from "@/api/template/templateAttr";
import done from "@/views/work/done";
export default {
  name: "classifyTrees.vue",
@@ -157,6 +213,9 @@
      FindText: "",
      //高级查询对话框
      FindFormVisible: false,
      //克隆模板对话框
      CloneVisible: false,
      CloneinnerVisible:false,
      //高级查询下拉框
      FindSelect: {
        id: "0",
@@ -215,19 +274,101 @@
        // //这个是多选
        // multiple: true,
      },
      //模板管理form
      crudForm: "",
      //动态切换处理过的表格数据
      //克隆模板form
      ClonecrudForm: "",
      //动态切换处理过的模板表格数据
      Formlist: [],
      //克隆模板数据
      CloneFormlist: [],
      //克隆模板下拉框value
      Clonevalue: "0",
      //克隆模板搜索输入框
      CloneFind:"",
      //克隆模板下拉框数据
      CloneSelectOptions: [{
        value: '0',
        label: '模板编号'
        },
        {
          value: '1',
          label: '模板名称'
        },
      ],
      //克隆模板确认表单数据
      CloneOption:{
        column:[
          {
            label:'模板编号',
            prop:'id',
            rules: [{
              required: true,
              message: "请输入模板编号",
              trigger: "blur"
            }]
          }, {
            label:'模板名称',
            prop:'name',
            rules: [{
              required: true,
              message: "请输入模板名称",
              trigger: "blur"
            }]
          },
          {
            label:'描述',
            prop:'desc',
            type:'textarea',
            span:24
          }
        ]
      },
      //克隆模板双向绑定数据
      CloneModel:[],
      CloneSelect:[],
      //克隆模板option
      ClonecrudTreeOption: {
        index: true,
        border: true,
        menu: false,
        addBtn: false,
        selection: true,
        header: false,
        height: 430,
        column: [
          {
            label: "模板编号",
            prop: "id"
          },
          {
            label: "模板名称",
            prop: "name"
          },
          {
            label: "模板描述",
            prop: "description"
          },
          {
            label: "版本号",
            prop: "revisionSeq",
            display: false
          },
          {
            label: "状态",
            prop: "lcStatusText",
            display: false
          }
        ]
      },
      //tab状态
      type: {},
      //Tab配置项
      tabOption: {
        column: [{
          icon: 'el-icon-info',
          label: '基本信息',
          prop: 'tab1',
        }, {
          icon: 'el-icon-warning',
          label: '模板管理',
          prop: 'tab2',
        }]
@@ -247,7 +388,7 @@
      ],
      //传递给子组件动态渲染的数据
      TreeList: {},
      codeClassifyOid:""
      codeClassifyOid: ""
    }
  },
  //tab栏默认是表格
@@ -448,7 +589,7 @@
    async nodeClick(data) {
      //定义一个模板属性id,数据是模板管理表格里面的oid
      this.nodeClickList = data
      //console.log(data.oid)
      console.log(data.oid)
      try {
        await TreeObjcet(data.oid).then(res => {
          this.FlagObj = res.data.data
@@ -456,14 +597,22 @@
          this.$message.error(res)
        })
        //模板管理表格数据
        await gridCodeClassifyTemplate({'conditionMap[codeClassifyOid]':data.oid }).then(res => {
          this.Formlist = res.data.data.filter(item => {
            if (item.codeclassifyoid != "") {
              this.codeClassifyOid=item.codeclassifyoid
              return item.codeclassifyoid == this.nodeClickList.oid
            }
          })
          console.log("formlist", this.Formlist)
        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)
@@ -548,25 +697,28 @@
      }
    },
    //模板管理渲染
    CrudRend(){
      gridCodeClassifyTemplate({'conditionMap[codeclassifyoid]':this.nodeClickList.oid }).then(res=>{
    CrudRend() {
      gridCodeClassifyTemplate({'conditionMap[codeclassifyoid]': this.nodeClickList.oid}).then(res => {
        this.Formlist = res.data.data
      })
    },
    //模板管理表格添加
    CrudRowSave(row){
      if(this.nodeClickList.length <= 0){
    CrudRowSave(row,done) {
      debugger
      console.log(nodeClickList.length)
      if (this.nodeClickList.length <= 0) {
        this.$message({
          type: 'warning',
          message: '请先从树上选择一条数据!'
        });
      }else {
      } else {
        console.log(this.nodeClickList)
        let codeClassifyOid=this.codeClassifyOid
        this.$set(row,"codeclassifyoid",codeClassifyOid)
        addSave(row).then(res=>{
        let codeClassifyOid = this.codeClassifyOid
        this.$set(row, "codeclassifyoid", codeClassifyOid)
        addSave(row).then(res => {
          this.CrudRend()
        }).catch(res=>{
          done()
        }).catch(res => {
          this.$message({
            type: 'info',
            message: res
@@ -575,10 +727,10 @@
      }
    },
    //模板管理修改
    CrudRowUpdata(row){
      editSave(row).then(()=>{
    CrudRowUpdata(row) {
      editSave(row).then(() => {
        this.CrudRend()
      }).catch(res=>{
      }).catch(res => {
        this.$message({
          type: 'info',
          message: res
@@ -586,10 +738,10 @@
      })
    },
    //模板管理删除
    CrudRowDel(row){
      deleteData(row).then(res=>{
    CrudRowDel(row) {
      deleteData(row).then(res => {
        this.CrudRend()
      }).catch(res=>{
      }).catch(res => {
        this.$message({
          type: 'info',
          message: res
@@ -611,11 +763,64 @@
        })
      }
    },
    //克隆模板查询
    CloneEnterFind(){
      gridCodeClassifyTemplate().then(res => {
        this.CloneFormlist = res.data.data.filter(item => {
          if(this.Clonevalue == 0){
            return item.id.includes(this.CloneFind)
          }else if(this.Clonevalue == 1){
            return item.name.includes(this.CloneFind)
          }
        })
      })
    },
    //克隆模板选择确定
    Clonehandler(){
      if(this.CloneFormlist.length <= 0){
        this.$message({
          type: 'warning',
          message: '请选择要克隆的模板!'
        });
      }else if(this.CloneSelect.length >1){
        this.$message({
          type: 'warning',
          message: '只能选择一条数据!'
        });
      } else {
        this.CloneinnerVisible=true
      }
    },
    //点击从其它模板克隆
    CloneBtn(){
      if(this.nodeClickList.length <= 0){
        this.$message({
          type: 'warning',
          message: '请先从[主题库分类】树上选择一条数据!'
        });
      }else {
        this.CloneVisible=true;
      }
    },
    //克隆模板单选框改变
    selectionChange(row){
      console.log(row)
      this.CloneSelect=row
      this.CloneModel.id=row[0].id;
      this.CloneModel.name=row[0].name;
    },
    //克隆表单提交
    Clonesubmit(done){
      copy(this.CloneSelect[0]).then(res=>{
        console.log(res)
        done()
      })
    },
    //刷新
    TemRefresh() {
      this.FormLoing = true
      if (this.nodeClickList.oid != "") {
        gridCodeClassifyTemplate({'conditionMap[codeclassifyoid]':this.nodeClickList.oid}).then(res => {
        gridCodeClassifyTemplate({'conditionMap[codeclassifyoid]': this.nodeClickList.oid}).then(res => {
          this.Formlist = res.data.data.filter(item => {
            return item.codeclassifyoid == this.nodeClickList.oid
          })