田源
2023-11-21 d44f7522b09f8bff0a3ee4e95c4e6499a23ca296
批量编辑对话框
已修改6个文件
125 ■■■■ 文件已修改
Source/UBCS-WEB/src/components/BatchImport/index.vue 79 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS-WEB/src/components/Master/MasterTransfer.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS-WEB/src/components/Master/MasterTree.vue 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS-WEB/src/components/MasterCrud/VciMasterCrud.vue 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS-WEB/src/views/MasterData/items.vue 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS-WEB/vue.config.js 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS-WEB/src/components/BatchImport/index.vue
@@ -14,7 +14,7 @@
    </ul>
    <div
      class="radio_box"
      v-show="currentTypeObj[type]['upParams'] === 'classifyAttr'"
      v-show="currentTypeObj[type]['upParams'] === 'classifyAttr' && this.type !== 'bulkEdit'"
    >
      <span>分类的路径使用的属性:</span>
      <el-radio-group v-model="classifyAttr">
@@ -65,8 +65,14 @@
        size="small"
        @click="downloadTemplateFun"
        :loading="downloadLoading"
        >下载导入模板</el-button
      >
        v-if="type !== 'bulkEdit'"
        >下载导入模板</el-button>
      <el-button type="primary"
                 size="small"
                 :loading="downloadLoading"
                 @click="downloadTemplateFun"
                 v-if="type === 'bulkEdit'"
                >下载编辑模板</el-button>
      <el-button size="small" @click="dialogVisible = false">关闭</el-button>
    </template>
    <ShowImportData
@@ -93,6 +99,8 @@
  downloadBatchImportApplyTemplate,
  downloadBatchApplyCodeTemplate,
} from "../../api/batchImport/index";
import {exportCode} from '@/api/GetItem'
import func from "@/util/func";
import FormTemplate from "../FormTemplate/FormTemplate.vue";
import { getToken } from "@/util/auth";
import codeApply from "@/mixins/codeApply.js";
@@ -116,6 +124,14 @@
    type: {
      type: String,
      default: "",
    },
    tableHeadFindData:{
      type:Array,
      default:[]
    },
    selectRow:{
      type:Array,
      default:[]
    },
    resetTable: Function
  },
@@ -146,7 +162,7 @@
      return this.currentTypeObj[this.type]["action"];
    },
    upParams() {
      if (this.type === "historyImport" || this.type === "batchApplyCode") {
      if (this.type === "historyImport" || this.type === "batchApplyCode" || this.type === "bulkEdit") {
        return {
          codeClassifyOid: this.codeClassifyOid,
          classifyAttr: this.classifyAttr,
@@ -169,6 +185,7 @@
  },
  data() {
    return {
      exportArrTwo: {},
      classifyAttr: "id",
      downloadLoading: false,
      showVisible: false,
@@ -184,6 +201,17 @@
            "2.企业编码,集团码和状态都需要导入",
            "3.每次仅能最多导入5000条数据(可通过nacos进行配置,推荐5000/次导入),如果出错会返回错误的数据和原因,但是正确数据可以继续保存",
            "4.分类的路径需要用#分隔。仅填写当前选的分类树上的下级分类的路径,如果当前分类已经是叶子节点,则不填写",
          ],
          action: "/api/ubcs-code/mdmEngineController/batchImportHistoryData",
          downloadTemplateFun: downloadHistoryImportTemplate,
          upParams: "classifyAttr",
        },
        bulkEdit:{
          title: "批量编辑导入",
          tipList: [
            "1.标题带五角星的表示关键属性,带星号表示必输项",
            "2.每次仅能最多导入5000条数据(可通过nacos进行配置,推荐5000/次导入),如果出错会返回错误的数据和原因,但是正确数据可以继续保存",
            "3.请按照下载的编辑模板所使用的配置进行具体配置"
          ],
          action: "/api/ubcs-code/mdmEngineController/batchImportHistoryData",
          downloadTemplateFun: downloadHistoryImportTemplate,
@@ -239,17 +267,38 @@
    },
    // 下载导入模板
    downloadTemplateFun() {
      this.downloadLoading = true;
      this.downloadTemplateApi({
        codeClassifyOid: this.codeClassifyOid,
      })
        .then((res) => {
          this.$utilFunc.downloadFileByBlob(res.data, this.title + "模板.xls");
          this.downloadLoading = false;
        })
        .catch(() => {
          this.downloadLoading = false;
        });
       if(this.type !== 'bulkEdit'){
         this.downloadLoading = true;
         this.downloadTemplateApi({
           codeClassifyOid: this.codeClassifyOid,
         })
           .then((res) => {
             this.$utilFunc.downloadFileByBlob(res.data, this.title + "模板.xls");
             this.downloadLoading = false;
           })
           .catch(() => {
             this.downloadLoading = false;
           });
         return;
       }
       if(this.type === 'bulkEdit'){
         this.tableHeadFindData.map(item => item.prop)
           .forEach((prop, index) => {
             this.exportArrTwo[`attrIdIndexMap[${index}]`] = prop;
           });
         exportCode({
           codeClassifyOid: this.codeClassifyOid,
           'conditionMap[oid]': this.ids, ...this.exportArrTwo,
           limit: -1
         }).then(res => {
           // console.log('res',res)
           if (res) {
             func.downloadFileByBlobHandler(res);
             this.$message.success('下载成功,请查看!')
           }
         })
         return;
       }
    },
    onSuccess(res) {
      if (Object.keys(res.data).length === 0) {
Source/UBCS-WEB/src/components/Master/MasterTransfer.vue
@@ -112,7 +112,7 @@
    },
    value: {
      handler(newval, oldval) {
        //console.log('value', newval)
        // console.log('value', newval)
      }
    }
  },
Source/UBCS-WEB/src/components/Master/MasterTree.vue
@@ -211,6 +211,7 @@
        this.TableRend(); // TableHeadRend() 方法完成后再执行 TableRend()
        this.$emit('nodeClick', this.templateOids)
        this.$emit("codeClassifyOid", this.nodeClickList.oid)
        this.$emit("nodeClickList", this.nodeClickList)
      } catch (error) {
        // 处理错误
        this.$message.error(error)
Source/UBCS-WEB/src/components/MasterCrud/VciMasterCrud.vue
@@ -100,7 +100,7 @@
                              :visible.sync="editvisible"
                              type="edit" @submit="EditSumbit"></FormTemplateDialog>
          <!--          批量编辑-->
          <MasterEditBulk :visible.sync="bulkeditvisible" ></MasterEditBulk>
<!--          <MasterEditBulk :visible.sync="bulkeditvisible" ></MasterEditBulk>-->
          <!--          数据详情-->
          <FormTemplateDialog :codeClassifyOid="this.codeClassifyOid" :codeRuleOid="this.codeRuleOid"
                               :rowOid="this.LinkObject.oid" :templateOid="templateOid"
@@ -133,6 +133,10 @@
                          :tableData="tableData"
                          :tableHeadData="tableHeadFindData" :templateOid="templateOid"
                          :visible.sync="dialogPush"></MasterTransfer>
          <!--        导入-->
          <BatchImport v-if="batchImportData.visible" v-bind="batchImportData" :resetTable="CrudRend"
                       :visible.sync="batchImportData.visible" :tableHeadData="tableHeadFindData" :selectRow="selectRow">
          </BatchImport>
          <!--          相似项-->
          <ResembleQueryDialog :codeClassifyOid="codeClassifyOid" :codeRuleOid="this.codeRuleOid" :rowOid="rowOid"
                               :templateOid="templateOid" :visible.sync="similarVisible"></ResembleQueryDialog>
@@ -144,12 +148,6 @@
            </el-pagination>
          </div>
        </div>
      </div>
      <div>
<!--        导入-->
        <BatchImport v-if="batchImportData.visible" v-bind="batchImportData" :resetTable="CrudRend"
                     :visible.sync="batchImportData.visible">
        </BatchImport>
      </div>
      <div class="bottom">
        <el-collapse v-model="visibleNames" @change="handleCollapse">
@@ -241,7 +239,10 @@
    Treedata: {
      type: Array
    },
    nodeClickList:{
      type:Array,
      default:[]
    }
  },
  data() {
    return {
@@ -523,7 +524,7 @@
        //  标准修订
        if (uniqueFlag === 'CODEAMEND') return this.codeAMENDHandler()
        //批量编辑
        if (uniqueFlag === 'bulkEdit') return this.bulkEditHandler()
        if (uniqueFlag === 'bulkEdit') return this.bulkEditHandler("bulkEdit")
      });
    },
    //标准申请
@@ -550,7 +551,12 @@
      }
    },
    //批量编辑
    bulkEditHandler(){
    bulkEditHandler(type){
      console.log(this.nodeClickList)
      if(this.nodeClickList.children.length >= 1){
        this.$message.warning('当前选择的分类不是叶子节点,不允许批量编辑!')
        return;
      }
      if(this.selectRow.length <= 0){
        this.$message.warning('请选择至少一条数据!')
        return;
@@ -558,7 +564,9 @@
      const Editing = this.selectRow.every(item => item.lcstatus === 'Editing');
      if (Editing) {
        this.bulkeditvisible = true;
        this.batchImportData.visible = true
        this.batchImportData.type = type
        this.batchImportData.codeClassifyOid = this.codeClassifyOid
      } else {
        this.$message.warning('选择的数据中有编码状态不是“编辑中”,不可编辑!');
      }
@@ -576,6 +584,7 @@
        // const requestData = this.selectRow.forEach(item => {
        //   return { oids: item.oid, btmName: item.btmname };
        // });
        const oids = this.selectRow.map(item => item.oid).join(',');
        applyGroupCode({oids, btmName: this.selectRow[0].btmname}).then(res => {
          if (res.data.code == 200) {
Source/UBCS-WEB/src/views/MasterData/items.vue
@@ -15,6 +15,7 @@
          @tableHeadBttoms="tableHeadBttoms"
          @tableHeadDataFateher="tableHeadDatas"
          @tableHeadFindData="tableHeadFindDatas"
          @nodeClickList="nodeClickLists"
          @total="totals"
        >
        </master-tree>
@@ -35,6 +36,7 @@
        :tableHeadFindData="tableHeadFindData"
        :templateOid="templateOid"
        :total="this.total"
        :nodeClickList="this.nodeClickList"
        @currentPage="currentPages"
        @pageSize="pageSizes"
      >
@@ -67,12 +69,16 @@
      total: "",
      isLoading: false,
      tableHeadFindData: {},
      TreeValue: ''
      TreeValue: '',
      nodeClickList:[]
    }
  },
  created() {
  },
  methods: {
    nodeClickLists(val){
      this.nodeClickList=val;
    },
    TreeValueEmit(val) {
      this.TreeValue = val
    },
Source/UBCS-WEB/vue.config.js
@@ -26,9 +26,9 @@
    proxy: {
      '/api': {
        //本地服务接口地址
        target: 'http://127.0.0.1:37000',
        // target: 'http://127.0.0.1:37000',
        // target: 'http://192.168.1.51:37000',
        // target: 'http://dev.vci-tech.com:37000',
        target: 'http://dev.vci-tech.com:37000',
        //yxc
        // target: 'http:// 192.168.0.104:37000',
        // target: 'http://192.168.0.105:37000',