ludc
2023-10-25 c38a3bb6a9cb89297356a1c97ffe87f5ed165c89
Source/UBCS-WEB/src/views/code/code.vue
@@ -156,7 +156,7 @@
    >
    </advanced-query>
    <!-- 编码规则相关对话框 -->
    <!-- 以下是编码规则相关对话框 -->
    <el-dialog
      :visible.sync="codeRangeSettingBox"
      append-to-body
@@ -177,150 +177,18 @@
    </el-dialog>
    <!-- 编码规则,克隆对话框 -->
    <el-dialog
    <clone-rule-dialog
      :visible.sync="cloneSettingBox"
      append-to-body
      class="avue-dialog avue-dialog--top"
      style="height: 100vh"
      title="克隆编码规则"
      top="-3%"
      width="800px"
    >
      <div>
        <el-row>
          <el-form ref="form" :inline="true" :model="form" label-width="80px">
            <el-form-item label="编号" required>
              <el-input v-model="cloneCodeRuleForm.id"></el-input>
            </el-form-item>
            <el-form-item label="名称" required>
              <el-input v-model="cloneCodeRuleForm.name"></el-input>
            </el-form-item>
            <el-form-item class="clone-input-textarea" label="描述">
              <el-input
                v-model="cloneCodeRuleForm.description"
                :autosize="{ minRows: 3, maxRows: 5 }"
                type="textarea"
              ></el-input>
            </el-form-item>
          </el-form>
        </el-row>
        <el-row>
          <p
            style="
              margin: 0 0px 16px 50%;
              font-weight: 500;
              font-size: 20px;
              color: #000;
            "
          >
            码段管理
          </p>
          <avue-crud
            :data="cloneData"
            :option="cloneOption"
            :table-loading="cloneTableLoading"
            class="clone-avue-crud"
            @on-load="cloneDataOnLoad"
          >
            <template slot="menu" slot-scope="scope">
              <el-button
                v-show="scope.row.orderNum > 1"
                icon="el-icon-arrow-up"
                plain
                size="small"
                type="text"
                @click="upOrderNum(scope.row)"
                >上移
              </el-button>
              <el-button
                icon="el-icon-arrow-down"
                plain
                size="small"
                type="text"
                @click="downOrderNum(scope.row)"
                >下移
              </el-button>
            </template>
          </avue-crud>
        </el-row>
      </div>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="saveCloneCodeRule">保 存</el-button>
        <el-button @click="cloneSettingBox = false">取 消</el-button>
      </div>
    </el-dialog>
      :ruleData="selectionList[0]"
      @refreshRuleTable="onLoad">
    </clone-rule-dialog>
    <!-- 编码规则,从其他规则克隆对话框 -->
    <el-dialog
    <clone-other-basic-sec-dialog
      :visible.sync="cloneOtherCodeRuleSettingBox"
      append-to-body
      class="avue-dialog avue-dialog--top"
      destroy-on-close
      style="height: 100vh"
      title="克隆编码规则的基础信息"
      top="-3%"
      width="800px"
    >
      <div>
        <el-row>
          <p
            style="
              margin-top: -20px;
              margin-bottom: 4px;
              font-weight: 570;
              font-size: 19px;
              color: #0e2d5f;
            "
          >
            编码规则
          </p>
          <avue-crud
            ref="crudCloneCodeRuleOther"
            :data="data"
            :option="cloneCodeRuleOption"
            :page.sync="page"
            :table-loading="loading"
            class="other-clone-coderule-crud"
            @row-click="codeOtherCloneRuleRowClick"
            @size-change="sizeChange"
            @selection-change="selectionOtherCloneCodeRuleChange"
            @search-change="searchOtherCloneChange"
            @search-reset="searchOtherCloneReset"
            @on-load="onLoad"
          >
          </avue-crud>
        </el-row>
        <el-row style="margin-top: 10px; border-top: 1px solid #ebeef5">
          <p
            style="
              margin-top: 10px;
              margin-bottom: 4px;
              font-weight: 570;
              font-size: 19px;
              color: #0e2d5f;
            "
          >
            码段信息
          </p>
          <avue-crud
            ref="crudCloneCodeBasicOther"
            :data="basicData"
            :option="cloneBasicOption"
            :table-loading="loadingBasic"
            class="other-clone-codebasic-crud"
            @row-click="codeOtherCloneBasicRowClick"
            @selection-change="selectionOtherCloneCodeBasicChange"
          >
          </avue-crud>
        </el-row>
      </div>
      <div slot="footer" class="dialog-footer" style="height: 50px">
        <el-button type="primary" @click="saveOtherCodeBasic">保 存</el-button>
        <el-button @click="cloneOtherCodeRuleSettingBox = false"
          >取 消</el-button
        >
      </div>
    </el-dialog>
      :quiltCloneCodeRule="selectionList[0]"
      @refreshRuleTable="onLoad">
    </clone-other-basic-sec-dialog>
    <!-- 编码规则,转移所有者对话框 -->
    <el-dialog
@@ -1414,7 +1282,6 @@
  remove,
  listUseRange,
  updateStatus,
  clone,
  clearAllCode,
  checkLikeCodeRule,
} from "@/api/code/mdmrule";
@@ -1424,7 +1291,6 @@
  upOrderNum,
  deleteData,
  editSave,
  cloneCodeBasic,
  addSave,
  refDataGridClassifySec,
} from "@/api/code/codebasic";
@@ -1445,9 +1311,6 @@
} from "@/api/code/codeClassifyValue";
import { getDictionary } from "@/api/omd/enum";
import optionBasic from "@/const/code/codebasic";
import cloneOption from "@/const/code/cloneOption";
import cloneBasicOption from "@/const/code/cloneBasicDialogOption";
import cloneCodeRuleOption from "@/const/code/cloneCodeRuleDialogOption";
import optionRule from "@/const/code/mdmrule";
import attrOption from "@/const/code/selectAttrOptionDialog";
import treeOption from "@/const/code/classifyTreeOptionDialog";
@@ -1461,6 +1324,7 @@
export default {
  data() {
    return {
      crudOption:{...optionRule},
      ruleForm: {},
      query: {},
      loading: true,
@@ -1476,24 +1340,11 @@
      data: [],
      currentRuleLcStatus: "",
      /*克隆对话框控制变量*/
      /*克隆编码规则对话框控制变量*/
      cloneSettingBox: false,
      cloneTableLoading: false,
      cloneOption: cloneOption,
      cloneData: [],
      cloneCodeRuleForm: {
        id: "",
        name: "",
        description: "",
      },
      /*从其他规则克隆码段*/
      cloneOtherCodeRuleSettingBox: false,
      cloneBasicOption: cloneBasicOption,
      cloneCodeRuleOption: cloneCodeRuleOption,
      selectionOtherCloneCodeBasicList: [], // 此界面内当前选中的基础码段
      selectionOtherCloneCodeRuleList: [], // 此界面内当前选中的编码规则
      otherCloneQuery: {}, // 查询条件对象
      /** 转移所有者对话框 */
      escapeOwnerVisible: false,
@@ -1549,7 +1400,7 @@
      loadingBasic: false,
      selectionBasicList: [],
      addBasicCodeSettingBox: false,
      showbtn: false, //基础码段新增是否显示基础码段
      showbtn: false, //基础码段新增按钮是否禁用
      isLoadingSecCodeAddBtn: false,
      basicSecDialogTitle: "", //基础码段第一层对话框标题
      basicSecOnlyRead: false, //新增基础码段表单是否只读
@@ -1796,11 +1647,11 @@
      if (JSON.stringify(conditionMaps) != "{}") {
        if (this.advancedQueryParam.currentOpen == "codeRule") {
          this.query = conditionMaps;
          // console.log(this.query);
          this.onLoad(this.page);
        } else {
          this.sendGridCodeBasicSec(conditionMaps, true);
        }
        //console.log(conditionMaps);
      }
    },
    /* 公式编辑框内容改变,子组件编辑完公式之后内容回显时调用 */
@@ -1809,12 +1660,12 @@
    },
    /* 引用码段参照配置,子组件填完参照配置之后内容回显时调用 */
    setReferConfigValue(content) {
      // console.log(content.referTypeName);
      this.form.referBtmId = content.referType || "";
      this.form.referBtmName = content.referTypeName || content.referType;
      //转换成JSON字符串进行父组件回显
      let submitFormJson = JSON.stringify(content);
      this.form.referConfig = submitFormJson || "";
      debugger;
    },
    /** 引用码段为【参照引用的业务类型】选取值之后的内容回显时调用 */
    echoReferBtmType(content) {
@@ -1826,7 +1677,6 @@
    /** 父分类选择对话框,第二层嵌套对话框,及其相关方法 */
    /** 保存当前父分类码段的选中行,并进行回显 */
    saveSelectedParentClassify() {
      //console.log(this.parentClsfyParams.parentClassifySelectionList.length);
      if (this.parentClsfyParams.parentClassifySelectionList.length != 1) {
        this.$message.warning("请选择一条数据!");
        return false;
@@ -1894,7 +1744,6 @@
        page.pageSize,
        conditionMaps
      ).then((res) => {
        //console.log(res.data);
        const data = res.data.data;
        parentClsParam.parentClassifyDataPage.total = data.total;
        parentClsParam.parentClassifyData = data.records;
@@ -1912,7 +1761,6 @@
    /** 加载分类连接属性表格数据 */
    loadlistClassifyLinkAttr() {
      let attrParam = this.selectAttrParams;
      //console.log(this.currentSelectTreeData);
      this.selectAttrParams.selectAttrOptionLoading = true;
      let conditionMaps = {};
      if (attrParam.selectAttrQeury) {
@@ -1930,7 +1778,6 @@
        this.$nextTick(() => {
          this.$refs[attrParam.ref].doLayout();
        });
        //console.log(data.data);
        this.selectAttrParams.selectAttrData = data.data;
        this.selectAttrParams.selectAttrOptionLoading = false;
        // 将搜索框内容置空
@@ -2000,13 +1847,11 @@
      this.fixedValueOptionLoading = true;
      gridCodeFixedValue(1, -1, { codeFixedSecOid: row.oid }).then((res) => {
        this.fixedValueData = res.data.data.records;
        //console.log(this.fixedValueData);
        this.fixedValueOptionLoading = false;
      });
    },
    /** 单击固定码段的码值表中行时触发的事件*/
    selectedCodeValueRow(row) {
      //console.log(row);
      this.selectedFixedOrCodeclassifyValue = row;
      this.codeFixdForm.id = row.id;
      this.codeFixdForm.description = row.description;
@@ -2018,14 +1863,15 @@
        if (!this.tipsCodeSecValueMessage(this.codeFixdForm.id)) {
          return;
        }
        this.codeFixdForm.codeFixedSecOid =
          this.codefixedsecOrCodeclassifysec.oid;
        this.codeFixdForm.codeFixedSecOid = this.codefixedsecOrCodeclassifysec.oid;
        addSaveCodeFixedValue(this.codeFixdForm).then(
          () => {
            this.loadFixedValueTableData({
              oid: this.codefixedsecOrCodeclassifysec.oid,
            });
            this.clearFixedOrClassifyForm("codefixedsec");
            this.$refs.crudFixedValue.refreshTable();
            this.$refs.crudFixedValue.doLayout();
            this.$message({
              type: "success",
              message: "操作成功!",
@@ -2041,7 +1887,6 @@
        }
        this.codeClassifyForm.codeClassifySecOid =
          this.codefixedsecOrCodeclassifysec.oid;
        // console.log(this.codeClassifyForm);
        addSaveCodeClassifyValue(this.codeClassifyForm).then(
          () => {
            this.loadClassifyValueData({
@@ -2066,7 +1911,6 @@
    clearFixedOrClassifyForm(condition) {
      //点击取消时清空表单与当前选中的码值,并禁用按钮
      this.selectedFixedOrCodeclassifyValue = "";
      //console.log(condition);
      if (condition === "close") {
        this.codeFixdForm = this.$options.data().codeFixdForm;
        this.codeClassifyForm = this.$options.data().codeClassifyForm;
@@ -2460,6 +2304,12 @@
            queryField: "lcStatus",
            comboxKey: "codeSearchLCStatus",
          },
          {
            data: [],
            title: "所有者",
            fieldType: "text",
            queryField: "ownerText",
          },
        ];
      } else {
        this.advancedQueryParam.options = [
@@ -2568,53 +2418,13 @@
        this.updateStatus(oid, update);
      }
    },
    /** 打开编码规则克隆对话框*/
    openCodeRuleDialog() {
      if (!this.tipsMessage(this.selectionList)) {
        return;
      }
      this.cloneSettingBox = true;
      this.cloneCodeRuleForm.id = this.selectionList[0].id;
      this.cloneCodeRuleForm.name = this.selectionList[0].name;
      this.cloneCodeRuleForm.description = this.selectionList[0].description;
      this.loadBasic({ oid: this.selectionList[0].oid });
    },
    /** 克隆编码规则保存功能*/
    saveCloneCodeRule() {
      let form = this.cloneCodeRuleForm;
      if (form.id.trim() == "") {
        this.$message.warning("编号不能为空!");
        return;
      }
      if (form.name.trim() == "") {
        this.$message.warning("码值不能为空!");
        return;
      }
      this.selectionList[0].oid = "";
      this.selectionList[0].id = form.id;
      this.selectionList[0].name = form.name;
      this.selectionList[0].description = form.description;
      this.selectionList[0].createTime = new Date().getTime();
      this.selectionList[0].ts = new Date(this.selectionList[0].ts).getTime();
      this.selectionList[0].lcStatus = "Editing";
      let data = Object.assign({}, this.selectionList[0], {
        elements: this.cloneData,
      });
      clone(data).then(
        () => {
          this.cloneSettingBox = false;
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!",
          });
        },
        (error) => {
          window.console.log(error);
        }
      );
      //console.log(data);
    },
    /** 打开从其他编码规则中克隆码段对话框*/
@@ -2627,99 +2437,6 @@
        return;
      }
      this.cloneOtherCodeRuleSettingBox = true;
    },
    /** 从其他编码规则中克隆码段对话框-单击编码规则实现行选择*/
    codeOtherCloneRuleRowClick(row) {
      this.$refs.crudCloneCodeRuleOther.toggleSelection();
      this.selectionOtherCloneCodeRuleList = row;
      this.$refs.crudCloneCodeRuleOther.setCurrentRow(row);
      this.$refs.crudCloneCodeRuleOther.toggleRowSelection(row); //选中当前行
      this.loadBasic(row);
    },
    /** 从其他编码规则中克隆码段对话框-单击基础码段实现行选择*/
    codeOtherCloneBasicRowClick(row) {
      this.$refs.crudCloneCodeBasicOther.toggleSelection();
      this.selectionOtherCloneCodeBasicList = row;
      this.$refs.crudCloneCodeBasicOther.setCurrentRow(row);
      this.$refs.crudCloneCodeBasicOther.toggleRowSelection(row); //选中当前行
    },
    /** 从其他规则克隆码段界面中编码规则当前选中行变化的时候触发*/
    selectionOtherCloneCodeRuleChange(list) {
      //console.log(list);
      this.selectionOtherCloneCodeRuleList = list;
      this.$refs.crudBasic.setCurrentRow(
        this.selectionBasicList[list.length - 1]
      );
      if (list == "") {
        this.basicData = [];
      }
      if (this.selectionOtherCloneCodeRuleList.length > 0) {
        this.loadBasic(this.selectionOtherCloneCodeRuleList[list.length - 1]);
      }
    },
    selectionOtherCloneCodeBasicChange(list) {
      this.selectionOtherCloneCodeBasicList = list;
      this.$refs.crudCloneCodeBasicOther.setCurrentRow(
        this.selectionOtherCloneCodeBasicList[list.length - 1]
      );
    },
    /** 从其他规则克隆码段界面重置搜索功能 */
    searchOtherCloneReset() {
      this.otherCloneQuery = {};
      this.onLoad(this.page);
    },
    /** 从其他规则克隆码段界面搜索功能*/
    searchOtherCloneChange(params, done) {
      this.page.currentPage = 1;
      // 多个conditionMap这样传参,快速查询默认采用模糊查询
      let requestData = {};
      if (params) {
        Object.keys(params).forEach((key) => {
          requestData["conditionMap" + "[" + key + "_like]"] =
            params[key].trim();
        });
      }
      this.otherCloneQuery = requestData;
      this.onLoad(this.page,requestData);
      done();
    },
    /** 保存从其他编码规则中克隆码段信息*/
    saveOtherCodeBasic() {
      let oid = this.selectionList[0].oid;
      let fromDialogPkCodebasic = this.selectionOtherCloneCodeBasicList;
      if (fromDialogPkCodebasic.length <= 0) {
        this.$message.warning("请选择码段数据!");
        return;
      }
      let res = fromDialogPkCodebasic.filter((item) => {
        return item.pkCodeRule == oid;
      });
      if (res != "") {
        this.$message.warning("需要克隆的编码规则与被克隆的编码规则相同!");
        return;
      }
      let oidArr = [];
      fromDialogPkCodebasic.forEach((ele) => {
        oidArr.push(ele.oid);
      });
      let data = {
        pkCodeRule: oid,
        oidArr: oidArr.join(","),
      };
      //console.log(data);
      cloneCodeBasic(data).then(
        () => {
          this.cloneOtherCodeRuleSettingBox = false;
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!",
          });
        },
        (error) => {
          window.console.log(error);
        }
      );
    },
    /** 清空码值*/
@@ -2752,7 +2469,6 @@
    },
    /** 添加*/
    rowSave(row, done, loading) {
      console.log(row);
      add(row).then(
        () => {
          this.onLoad(this.page);
@@ -2828,7 +2544,7 @@
      this.query = {};
      this.onLoad(this.page);
    },
    // 编码规则快速查询
    // 编码规则快速查询searchChange
    searchChange(params, done) {
      this.page.currentPage = 1;
      // 多个conditionMap这样传参,快速查询默认采用模糊查询
@@ -2841,6 +2557,11 @@
      }
      this.query = requestData;
      this.onLoad(this.page, this.query);
      // console.log(  this.findObject(this.optionRule.column,'id'))
      // console.log(this.crudOption.column[0])
      // this.crudOption.column && this.crudOption.column.length > 0
      //   ? (this.crudOption.column[0].value = '')
      //   : null;
      done();
    },
    /** 编码规则当前选中行变化的时候触发*/
@@ -2878,7 +2599,11 @@
    },
    onLoad(page, params = {}) {
      this.loading = true;
      gridCodeRule(page.currentPage, page.pageSize, params).then((res) => {
      gridCodeRule(
        page.currentPage,
        page.pageSize,
        Object.assign({},params,this.query),
      ).then((res) => {
        //console.log(res.data);
        const data = res.data.data;
        this.page.total = data.total;
@@ -3209,6 +2934,10 @@
      if (!this.tipsMessage(this.selectionBasicList)) {
        return;
      }
      if (this.selectionBasicList[0].lcStatus != "Editing") {
        this.$message.warning('编码规则状态不是"编辑中",不允许删除码段!');
        return;
      }
      let oid = this.selectionBasicList[0].oid;
      this.$confirm("是否删除这条数据?如果被引用将不能被删除!", {
        confirmButtonText: "确定",
@@ -3235,11 +2964,7 @@
    },
    /** 点击触发加载基础码段信息*/
    loadBasic(row) {
      if (this.cloneSettingBox) {
        this.cloneTableLoading = true;
      } else {
        this.loadingBasic = true;
      }
      this.loadingBasic = true;
      // console.log(row.oid);
      if (row != "" || row != null) {
        //存储当前关联的编码规则相关信息
@@ -3272,14 +2997,8 @@
      gridCodeBasicSec(1, -1, isAdancedQuery ? condition : conditionMaps).then(
        (res) => {
          const data = res.data.data;
          if (this.cloneSettingBox) {
            this.cloneData = data.records;
            this.cloneTableLoading = false;
          } else {
            this.basicData = data.records;
            // console.log(this.basicData);
            this.loadingBasic = false;
          }
          this.basicData = data.records;
          this.loadingBasic = false;
        }
      );
    },
@@ -3437,7 +3156,6 @@
    },
    /** 码段类型改变时,增加对应的form表单中的属性*/
    changeSectypeFormItems(row) {
      //console.log(row);
      if (
        func.isEmpty(this.enumParam.secTypeList) ||
        this.enumParam.secTypeList.length == 0
@@ -3471,7 +3189,6 @@
          componentCodeFlag: this.form.componentCodeFlag, //是否参与编码
          pkCodeRule: this.form.pkCodeRule, //所属编码规则
        };
        //console.log(this.form);
      }
      if (this.form.secType === "codefixedsec") {
        //固定码段
@@ -3537,8 +3254,6 @@
              ? row.customCodeSerialClass
              : "", //自定义流水算法
        });
        console.log(this.form);
        console.log(this.enumParam.codeFillType);
        this.loadCodeFillType();
        this.loadCodeFillSeparator();
      } else if (this.form.secType === "codelevelsec") {
@@ -3584,7 +3299,6 @@
              : "", //日期格式
        });
      } else if (this.form.secType === "codeclassifysec") {
        //console.log(this.form);
        //分类码段
        this.form = Object.assign({}, this.form, {
          codeSecLengthType:
@@ -3627,7 +3341,6 @@
        this.loadCodeFillType();
        this.loadCodeFillSeparator();
      }
      // console.log(this.form);
    },
    /** 第一次请求的枚举数据放缓存*/
    getLocalStorageEnum(enumKey) {
@@ -3684,11 +3397,14 @@
    },
    // 最大流水号
    maxSerialNum() {
      console.log(this.selectionList);
      if (this.selectionList.length === 0) {
      if (this.selectionList.length <= 0) {
        this.$message.warning("请选择一条编码规则!");
        return;
      }
      if(this.selectionList.length> 1){
        this.$message.warning("只能选择一条编码规则!");
        return;
      }
      this.maxSerial.visible = true;
      this.maxSerial.ruleOid = this.selectionList[0]["oid"];
    },