田源
2023-06-05 53f8b0f89dc73e08cad2a4e7a52bbb438617db10
整合组件
已修改5个文件
381 ■■■■ 文件已修改
Source/UBCS-WEB/package.json 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS-WEB/src/components/Crud/Crud.vue 186 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS-WEB/src/components/Tree/classifyTrees.vue 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS-WEB/src/views/MasterData/items.vue 186 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS-WEB/vue.config.js 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS-WEB/package.json
@@ -17,6 +17,7 @@
    "classlist-polyfill": "^1.2.0",
    "crypto-js": "^4.0.0",
    "element-ui": "^2.15.6",
    "instead": "^1.0.3",
    "js-base64": "^2.5.1",
    "js-cookie": "^2.2.0",
    "js-md5": "^0.7.3",
Source/UBCS-WEB/src/components/Crud/Crud.vue
@@ -1,60 +1,137 @@
<template>
  <basic-container>
    <avue-crud ref="crud"
               v-loading="loading"
               :data="data"
               :option="option"
               :page="page"
               @sort-change="sortChange"
               @selection-change="selectionChange"
               @on-load="onLoad">
      <template slot="menu">
        <el-button type="text">文字按钮</el-button>
      </template>
      <template slot="menuLeft">
          <div>
            <el-table :data="tableData" style="width: 100%" @cell-click="handleCellClick" @cell-dblclick="dbclick">
              <div v-for="(item,index) in this.tableHeadData" :key="index">
                <el-table-column :label="item.label" :prop="item.prop">
<!--              编辑和展示逻辑 -->
                  <template slot-scope="{ row }">
                  <el-input v-if="editingRow === row && editShow== item.prop" v-model="row[item.prop]" @blur="saveRow"></el-input>
                  <span v-else>{{row[item.prop]}}</span>
                </template>
                </el-table-column>
              </div>
              <el-table-column fixed="right" label="操作" width="120">
                <template slot-scope="scope">
                  <el-button size="small" type="text" @click.native.prevent="enumDeleteRow(scope.$index, tableData)">
                    移除
                  </el-button>
                </template>
              </el-table-column>
            </el-table>
            <template>
              <div style="display: flex;justify-content: right;margin-top: 15px">
                <el-button type="primary"  size="small">保存</el-button>
                <el-button size="small" @click="enumVisible=false">取消</el-button>
              </div>
            </template>
<!--    <avue-crud ref="crud"-->
<!--               v-loading="loading"-->
<!--               :data="data"-->
<!--               :option="option"-->
<!--               :page="page"-->
<!--               @sort-change="sortChange"-->
<!--               @selection-change="selectionChange"-->
<!--               @on-load="onLoad">-->
<!--      <template slot="menu">-->
<!--        <el-button type="text">文字按钮</el-button>-->
<!--      </template>-->
<!--      <template slot="menuLeft">-->
<!--      </template>-->
<!--    </avue-crud>-->
    <div class="testbox">
      <div style="margin-top: 10px;display: flex;flex-wrap: wrap;width: 100%;">
        <el-button size="small" type="primary" plain @click="addvisible=true">增加
          <FormTemplateDialog
            :visible.sync="addvisible"
            :type="add"
            :templateOid="this.templateOid"
            :codeClassifyOid="this.codeClassifyOid"
            :codeRuleOid="this.codeRuleOid"
            :disabledProp="disabledProp"
            :rowOid="rowOid"
          >
          </FormTemplateDialog></el-button>
        <el-button size="small" type="primary" plain @click="editvisible=true">编辑
          <FormTemplateDialog
            :visible.sync="editvisible"
            :type="edit"
            :templateOid="this.templateOid"
            :codeClassifyOid="this.codeClassifyOid"
            :codeRuleOid="this.codeRuleOid"
            :disabledProp="disabledProp"
            :rowOid="rowOid"
          ></FormTemplateDialog></el-button>
        <el-button size="small" type="primary" plain>批量导入申请</el-button>
        <el-button size="small" type="primary" plain>历史数据导入</el-button>
        <el-button size="small" type="primary" plain>批量申请编码</el-button>
        <el-button size="small" type="primary" plain>批量发布</el-button>
        <el-button size="small" type="primary" plain>查看流程历史</el-button>
        <el-button size="small" type="primary" plain>删除</el-button>
        <el-button size="small" type="primary" plain>发布</el-button>
        <el-button size="small" type="primary" plain>数据更改</el-button>
        <el-button size="small" type="primary" plain>回收</el-button>
        <el-button size="small" type="primary" plain>导出
          <transfer filter-placeholder="请输入拼音全拼或者拼音缩写" ></transfer>
        </el-button>
        <el-button size="small" type="primary" plain @click="findvisible=true">查询
        <advancedQuery  :visible.sync="findvisible" :options="this.options"></advancedQuery>
        </el-button>
        <el-button size="small" type="primary" plain>相似项查询</el-button>
        <el-button size="small" type="primary" plain style="margin-left: 1px;margin-top:10px">刷新</el-button>
        <el-input placeholder="请输入关键字按回车查询" style="width: 180px;margin-left: 5px;margin-top:10px" size="small"></el-input>
      </div>
      <el-row style="height: 700px;width: 100%">
        <el-table :data="tableData" style="" @cell-click="handleCellClick" max-height="700"  @selection-change="handleSelectionChange"  @sort-change="sortChange">
          <el-table-column
            type="selection"
            fixed
            width="55">
          </el-table-column>
          <el-table-column
            type="index"
            fixed
            label="序号"
            width="55">
          </el-table-column>
          <div v-for="(item,index) in this.tableHeadData" :key="index">
            <el-table-column :label="item.label" :prop="item.prop" :sortable="item.sortable" :width="item.width">
              <!-- 编辑和展示逻辑 -->
              <template slot-scope="{ row }">
                <el-input v-if="editingRow === row && editShow== item.prop" v-model="row[item.prop]" @blur="saveRow"></el-input>
                <span v-else>{{row[item.prop]}}</span>
                <el-switch
                  v-if="editShow === 'true'"
                  v-model="row[item.prop]"
                  active-color="#13ce66"
                  inactive-color="#ff4949">
                </el-switch>
              </template>
            </el-table-column>
          </div>
      </template>
    </avue-crud>
<!--          <el-table-column fixed="right" label="操作" width="120" >-->
<!--            <template slot-scope="scope" >-->
<!--              <el-button size="small" type="text" @click.native.prevent="enumDeleteRow(scope.$index, tableData)">-->
<!--                移除-->
<!--              </el-button>-->
<!--            </template>-->
<!--          </el-table-column>-->
        </el-table>
      </el-row>
    </div>
    <div class="block" style="display: flex;justify-content: flex-end">
      <el-pagination
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page="currentPage4"
        :page-sizes="page.pageSizes"
        :page-size="page.pageSizes"
        layout="total, sizes, prev, pager, next, jumper"
        :total="page.total">
      </el-pagination>
    </div>
  </basic-container>
</template>
<script>
import {MasterTable, TableData} from "@/api/GetItem";
export default {
  name: "Crud.vue",
  data() {
    return {
      addvisible:false,
      editvisible:false,
      findvisible:false,
      templateOid: "78B8C7C5-A042-0B96-FE6D-65421451782A",
      codeClassifyOid: "4524E801-6CC6-92E8-1AC3-2AB9604E8F96",
      codeRuleOid: "B95872A6-9CEA-D490-8F1B-9D26548CAF96",
      rowOid: '6EF696C3-CD87-0E7C-1EA1-8DE3913A95C9',
      disabledProp: ["id"],
      editingRow:null,
      editShow: "",
      editAttr:"",
      loading: false,
      data: [],
      options:{},
      option: {
        //默认高度,
        align: 'center',
@@ -86,12 +163,7 @@
    }
  },
  computed:{
    editable(){
      this.tableData.forEach(item=>{
        this.items=item
      })
      return this.editShow === this.editingRow[this.items.prop];
    }
  },
  created() {
    this.CrudHeaderRend();
@@ -101,13 +173,15 @@
    this.doLayout()
  },
  methods: {
    handleSizeChange(val){
      console.log(val)
    },
    // 监听单元格点击事件并存储正在编辑的行
    handleCellClick(row, column) {
      this.editingRow = row;
      this.editShow = column.property;
      console.log( this.editingRow['name'], this.editShow)
    },
    //枚举注入删除
    //删除
    enumDeleteRow(row) {
      console.log(row)
      this.tableData.splice(row, 1)
@@ -128,6 +202,7 @@
        functionId: 5,
        _: 1685067339479
      }).then(res => {
        this.options=res.data.tableDefineVO.seniorQueryColumns
        this.List = res.data.tableDefineVO.cols[0];
        this.List.forEach(item => {
          let columnItem = {
@@ -148,7 +223,7 @@
        templateOid: "A12826E4-2B66-6D56-DE30-92BB1D7F607F",
        codeClassifyOid: "D9CF223F-317D-71EB-BD11-433A94CAD9F3",
        page: this.page.currentPage,
        limit: this.page.pageSize,
        limit:9,
        _: 1685089123575
      }).then(res => {
        this.page.total = res.data.total;
@@ -181,7 +256,6 @@
    },
    //分页刷新
    async onLoad(val) {
      console.log(val)
      await TableData({
        templateOid: "A12826E4-2B66-6D56-DE30-92BB1D7F607F",
        codeClassifyOid: "D9CF223F-317D-71EB-BD11-433A94CAD9F3",
@@ -193,13 +267,21 @@
      })
    },
    //多选
    selectionChange(row) {
    handleSelectionChange(row) {
      console.log(row)
    }
  }
}
</script>
<style scoped>
<style lang="scss" scoped>
.testbox {
  .el-table--scrollable-x .el-table__body-wrapper {
    overflow: auto !important;
  }
  .el-table__fixed-right-patch {
    background-color: #f5f7fa !important;
  }
}
</style>
Source/UBCS-WEB/src/components/Tree/classifyTrees.vue
@@ -412,8 +412,7 @@
          }
        })
        //调用修改属性名方法
        this.ModifyProperties(this.Treedata, 'text', 'label');
        this.ModifyProperties(this.CloneTreedata, 'text', 'label');
        this.ModifyProperties(this.CloneTreedata, 'name', 'label');
      }).catch(res => {
        this.$message.error(res)
      })
Source/UBCS-WEB/src/views/MasterData/items.vue
@@ -2,7 +2,12 @@
    <el-container>
      <el-aside>
        <basic-container style="height: 85vh; max-height: 155vh; overflow-y: scroll;">
          <avue-tree  :option="option" :data="data"  v-model="form" style="height: 80.5vh;padding-top: 5px;padding-bottom: 30px"></avue-tree>
          <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"
                     @check-change="checkChange"
          ></avue-tree>
        </basic-container>
      </el-aside>
      <el-main>
@@ -12,61 +17,144 @@
</template>
<script>
import {getAtrrList, TreeCheckDel, TreeDel, TreeSave} from "@/api/template/templateAttr";
export default {
  name: "items.vue",
  data(){
    return{
      form:{},
      data:[
        {
          value:0,
          label:'一级部门',
          children:[
            {
              value:1,
              label:'一级部门1',
            },{
              value:2,
              label:'一级部门2',
            }
          ]
        },{
          value:3,
          label:'二级部门',
          children:[
            {
              value:4,
              label:'二级部门1',
            },{
              value:5,
              label:'二级部门2',
            }
          ]
      CloneTreeAvueform:{},
      loading:false,
      CloneTreedata:[],
      Treeoption: {
        addBtn: false,
        editBtn: false,
        delBtn: false,
        defaultExpandAll: false,
        menu: false,
        // //这个是多选
        // multiple: true,
      },
      nodeClickList: "",
    }
  },
  created() {
    this.getAttr()
  },
  methods:{
    getAttr() {
      getAtrrList().then(res => {
        this.Treedata = res.data;
        this.CloneTreedata = res.data;
        this.Treedata.forEach((item) => {
          for (let i = 0; i < this.Treedata.length; i++) {
            this.Treedata[i].value = i;
          }
        })
        //调用修改属性名方法
        this.ModifyProperties(this.CloneTreedata, 'name', 'label');
      }).catch(res => {
        this.$message.error(res)
      })
    },
    //定义一个修改数据属性名的方法
    ModifyProperties(obj, oldName, newName) {
      for (let key in obj) {
        if (key === oldName) {
          obj[newName] = obj[key];
          delete obj[key];
        }
      ],
      option:{
        title:'我是标题',
        filterText:"搜索关键字自定义",
        defaultExpandAll:true,
        addBtnText:'新增自定义文案',
        editBtnText:'修改自定义文案',
        delBtnText:'删除自定义文案',
        defaultExpandedKeys:[1],
        height:900,
        formOption:{
          labelWidth:100,
          column:[{
            label:'自定义项',
            prop:'label'
          }],
        },
        props:{
          labelText:'标题',
          label:'label',
          value:'value',
          children:'children'
        if (typeof obj[key] === 'object') {
          this.ModifyProperties(obj[key], oldName, newName);
        }
      }
    },
    //树节点添加按钮
    TreeAdd() {
      this.TreeAddFormVisible = true;
      // 判断当前是否有点击子项
      if (this.nodeClickList !== "") {
        this.TreeFlag = true
      }
    },
    //树节点添加事件
    TreeAddHandler() {
      const data = this.TreeAddform
      this.$set(data, "parentCodeClassifyOid", this.nodeClickList.oid)
      TreeSave(data).then(() => {
        this.$message({
          type: 'success',
          message: '添加成功!'
        });
        this.getAttr();
        this.TreeAddFormVisible = false
        this.TreeAddform = ""
      }).catch(res => {
        this.$message({
          type: 'warning',
          message: res
        });
      })
    },
    //树节点删除按钮
    TreeDel() {
      this.$confirm('是否删除当前选择的分类,将会把子分类一并删除,如果存在编码数据将不能被删除,是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning',
        customClass: 'my-messagebox',
      }).then(() => {
        TreeCheckDel(this.nodeClickList).then(res => {
          if (res.data.data) {
            TreeDel(this.nodeClickList).then(() => {
              this.$message({
                type: 'success',
                message: '删除成功!'
              });
              this.getAttr();
            }).catch(res => {
              this.$message({
                type: 'warning',
                message: res
              });
            })
          } else {
            this.$confirm('当前数据包含有下级数据,要删除的话会和下级数据一起删除,你确认继续?', '提示', {
              confirmButtonText: '确定',
              cancelButtonText: '取消',
              type: 'warning',
              customClass: 'my-messageboxs',
            }).then(() => {
              TreeDel(this.nodeClickList).then(() => {
                this.$message({
                  type: 'success',
                  message: '删除成功!'
                });
                this.getAttr();
              }).catch(res => {
                this.$message({
                  type: 'warning',
                  message: res
                });
              })
            }).catch(() => {
              this.$message({
                type: 'info',
                message: '已取消删除'
              });
            });
          }
        })
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消删除'
        });
      });
    },
    nodeClick(data){
      this.nodeClickList = data
      console.log(data)
    }
  }
}
Source/UBCS-WEB/vue.config.js
@@ -26,10 +26,9 @@
    proxy: {
      '/api': {
        //本地服务接口地址
          target: 'http://localhost:37000',
        // target: 'http://192.168.1.63:37000',
        // target: 'http://localhost:37000',
        //target: 'http://192.168.3.7:37000',
        //target: 'http://dev.vci-tech.com:37000',
        target: 'http://dev.vci-tech.com:37000',
        //target: 'http://192.168.1.51:37000/',
        //远程演示服务地址,可用于直接启动项目
        // target: 'https://saber.bladex.vip/api',