田源
2023-08-02 2993f2202d4acc47d7c65d0e40456c68c95d8cfb
Source/UBCS-WEB/src/components/MasterCrud/VciMasterCrud.vue
@@ -31,7 +31,7 @@
                               :label="item.label"
                               :prop="item.prop" :show-overflow-tooltip="true"
                               :sortable="item.sortable"
                               :width="item.label.length >= 4 ? '150' : item.label.length == 3 ? '120' : '90'"
                               :width="item.width"
                               align="center">
              </el-table-column>
            </el-table>
@@ -95,7 +95,7 @@
  </basic-container>
</template>
<script>
import {MasterTable, TableData, FindData, addSaveCode, editSaveCode} from "@/api/GetItem";
import {MasterTable, TableData, FindData, addSaveCode, editSaveCode,deleteCode} from "@/api/GetItem";
import {processTS,changeStatus} from "@/api/template/setPersonnel"
import {listCodeAttributeByClassId} from "@/api/integration/integration.js";
import integrationTransfer from "@/views/integration/integrationTransfer";
@@ -241,13 +241,12 @@
  created() {
  },
  mounted() {
  },
  activated() {
    // this.doLayout();
    this.$nextTick(() => {
      this.$refs.dataTable.doLayout()
    })
   this.doLayout()
  },
  updated() {
    this.doLayout()
  },
  watch: {
    tableHeadDataFateher: {
@@ -266,6 +265,7 @@
      handler(newval, oldval) {
        this.tableData = newval;
        this.searchResults = newval
        this.doLayout()
      },
    },
    tableHeadFindData: {
@@ -344,6 +344,8 @@
        if (uniqueFlag === 'CODEENABLE') return this.Enable()
        //回收
        if (uniqueFlag === 'CODERECYCLE') return this.Recovery()
        //删除
        if (uniqueFlag === 'CODEDELETE') return this.enumDeleteRow()
        //  相似项查询
        //  if(uniqueFlag === 'CODEEDIT') return this.similarHandler()
      });
@@ -382,10 +384,11 @@
            showMessage = false;
          } else if (showMessage) {
            processTS({templateId: this.templateOid, buttonTypeKey: 'PUBLIC'}).then(res => {
              if (res.data.records != [] && res.data.code != 200)  {
              if (res.data.data.records && res.data.data.records.length!=0)  {
                this.userName = localStorage.getItem("username");
                this.parameter.template = this.userName + "-发布" + "[物品]";
                this.parameter.type = 'PUBLIC'
                this.parameter.type = 'PUBLIC';
                this.parameter.code=this.templateOid
                this.title = '流程审批'
                this.visibleFlow = true;
                this.onLoad()
@@ -431,10 +434,11 @@
            showMessage = false;
          } else if (this.selectRow.length > 1 && hasEditing && showMessage) {
            processTS({ templateId: this.templateOid, buttonTypeKey: 'PUBLIC' }).then(res => {
              if (res.data.records != [] && res.data.code != 200) {
              if (res.data.records != [] && res.data.data.records.length!=0) {
                this.userName = localStorage.getItem("username");
                this.parameter.template = this.userName + "停用" + "[物品]";
                this.parameter.type = 'DISABLE'
                this.parameter.type = 'DISABLE';
                this.parameter.code=this.templateOid
                this.title = '停用(冻结)编码数据'
                this.visibleDeactivate = true;
              } else {
@@ -482,10 +486,12 @@
            showMessage = false;
          } else if (this.selectRow.length >=1 && hasEditing && showMessage) {
            processTS({ templateId: this.templateOid, buttonTypeKey: 'PUBLIC' }).then(res => {
              if (res.data.records != [] && res.data.code != 200) {
              if (res.data.data.records && res.data.data.records.length!=0)  {
                this.parameter=res.data.data.records[0]
                this.userName = localStorage.getItem("username");
                this.parameter.template = this.userName + "启用" + "[物品]";
                this.parameter.type = 'Released'
                this.parameter.type = 'Released';
                this.parameter.code=this.templateOid
                this.title = '启用编码数据'
                this.visibleDeactivate = true;
              } else {
@@ -540,10 +546,11 @@
          } else if (this.selectRow.length >=1 && (disabledCount === this.selectRow.length || releasedCount === this.selectRow.length) || (disabledCount > 0 && releasedCount > 0) && showMessage) {
            //disabledCount 和 releasedCount 中任意一个等于 this.selectRow 数组的长度则表示全部是同一种状态,返回 true 如果disabledCount 和 releasedCount 都大于0,则表示既有Disabled也有Released返回 true
            processTS({ templateId: this.templateOid, buttonTypeKey: 'PUBLIC' }).then(res => {
              if (res.data.records != [] && res.data.code != 200) {
              if (res.data.records != [] && res.data.data.records.length!=0) {
                this.userName = localStorage.getItem("username");
                this.parameter.template = this.userName + "回收" + "[物品]";
                this.parameter.type = 'TakeBack'
                this.parameter.type = 'TakeBack';
                this.parameter.code=this.templateOid
                this.title = '回收编码数据'
                this.visibleDeactivate = true;
              } else {
@@ -608,16 +615,41 @@
    },
    //删除
    enumDeleteRow(row) {
      this.tableData.splice(row, 1);
      this.$confirm('是否删除选中数据?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        const list=[];
        this.selectRow.forEach((item)=>{list.push(item.oid)})
        deleteCode({codeClassifyOid:this.codeClassifyOid,oidList:list}).then(res=>{
          console.log(res)
          if(res.data.code === 200){
            this.$message({
              type: 'success',
              message: '删除成功!'
            });
          }
          this.onLoad()
        })
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消删除'
        });
      });
    },
    // 将正在编辑的行的状态变为 null ,即退出编辑状态
    saveRow() {
      this.editingRow = null;
    },
    //表格错行问题
    doLayout() {
      this.$nextTick(() => {
        this.$refs.crud.doLayout();
      });
        if (this.$refs.dataTable && this.$refs.dataTable.doLayout) {
          this.$refs.dataTable.doLayout();
        }
      })
    },
    //表格头渲染
    CrudHeaderRend() {
@@ -688,6 +720,7 @@
        limit: this.page.pageSize,
      }).then((res) => {
        this.tableData = res.data.data;
        this.doLayout()
      });
    },
    //多选