田源
2023-08-15 2c1a58c36340321bb3ea9ada5ff63fe5f9ac128a
Source/UBCS-WEB/src/components/Theme/ThemeAttrCrud.vue
@@ -327,8 +327,11 @@
        <template slot-scope="{ row }">
          <el-input v-if="editingRows === row && editShows== item.prop && item.prop != 'codeDateFormat' && (item.edit == 'text'  ||item.edit == 'refer' )"
                    ref="inputRef"
                    :id="'inputRef' + row.oid"
                    v-show="!AddCellFlag"
                    v-model="row[item.prop]"
                    autofocus @blur="saveRows"></el-input>
                    @blur="saveRows"
                    autofocus></el-input>
          <el-input-number v-if="editingRows === row && editShows== item.prop && item.edit == 'number'" v-model="row[item.prop]"
                           :style="{width:(item.width-10)+'px'}"
                           controls-position="right"
@@ -371,6 +374,7 @@
import {AttrByBtm, gridCodeClassifyTemplateAttr, batchAddSave, copyto, listByFlag} from '@/api/template/templateAttr'
import {getList} from "@/api/refer/table";
import func from "@/util/func";
import {getCurrentInstance} from "vue";
export default {
  name: "attrCrud .vue",
@@ -427,7 +431,7 @@
      }
    },
    crudArrayFlag: {
      handler(newval, olaval) {
      handler(newval, oldval) {
        console.log('crudArrayFlag', newval)
      }
    },
@@ -481,6 +485,8 @@
  },
  data() {
    return {
      // 保存单元格状态
      AddCellFlag:false,
      //全屏编辑高度状态
      editStyleFlag: false,
      loading: false,
@@ -1075,11 +1081,13 @@
        column: [
          {
            label: "属性英文名称",
            prop: "id"
            prop: "id",
            width:100,
          },
          {
            label: "属性中文名称",
            prop: "name"
            prop: "name",
            width:100,
          },
          {
            label: "长度",
@@ -1120,7 +1128,7 @@
            prop: "precisionLength"
          },
          {
            label: "小精刻度",
            label: "小数刻度",
            prop: "scaleLength"
          },
          {
@@ -1562,9 +1570,6 @@
    //可输可选下拉
    selectChangeHandler(editConfig, index) {
      let that = this;
      /*if(that.option.column[index].data && that.option.column[index].data.length>=0){
        return;
      }*/
      listByFlag(editConfig.extraParams).then(res => {
        that.option.column[index].data = res.data.data;
      })
@@ -1583,7 +1588,7 @@
        item.attributeGroup = this.attrModel
      })
      if (this.CurrentCell) {
        this.$set(this.CurrentCell, 'attributeGroup', this.attrModel)
        this.$set(this.CurrentCell, 'attributeGroup', this.attrModel);
      } else {
        this.$set(this.attrSelectList[0], 'attributeGroup', this.attrModel)
      }
@@ -1740,7 +1745,7 @@
    addsHandler(event) {
      this.$refs.referAttrCrud.sort("orderNum");
      var ischeck = true;
      console.log(this.ProData)
      console.log('ProData',this.ProData)
      this.ProData.forEach((item, index) => {
        if ((item.requireFlag && item.requireFlag.toString() == 'true') && (item.readOnlyFlag && item.readOnlyFlag.toString() == 'true')) {
          this.$message.warning(item.name + "(" + item.id + ")必输的属性不能是只读");
@@ -1796,6 +1801,7 @@
          this.editOpenFlag = false;
          // 调用父组件修改按钮状态
          this.$emit('editCloseChildren')
          this.AddCellFlag=true;
        }).catch(() => {
          this.$message.warning('保存失败,请查看控制台输出!')
        });
@@ -1810,6 +1816,12 @@
        this.editShows = column.property;
        this.rowOid = row.oid;
        this.CurrentCell = row;
        if(this.editingRows){
          const inputElement = document.querySelector(`#inputRef${row.oid}`);
          if (inputElement) {
            inputElement.focus();
          };
        }
        if (column.property == 'referConfig') {
          this.referConfigVisble = true;
          this.referConfigOption = {
@@ -1836,7 +1848,7 @@
          }
        } else if (column.property == 'componentRule') {
          if (this.CurrentCell) {
            this.CurrentCell.componentRule = this.componentRuleText;
            // this.CurrentCell.componentRule = this.componentRuleText;
          }
          this.isShowformulaEdit = true;
        } else if (column.property == 'enumString') {
@@ -1867,6 +1879,11 @@
    },
    saveRows() {
      this.editingRows = null;
      this.editShows = null;
      const inputElement = document.querySelector(`#inputRef${this.CurrentCell.oid}`);
      if (inputElement) {
        inputElement.blur();
      }
    },
    // 枚举注入添加一行空数据
    addRow() {
@@ -1970,6 +1987,7 @@
    rulesHandle() {
      if (this.CurrentCell) {
        this.$set(this.CurrentCell, 'verifyRule', this.RulesForm.expressionText)
        this.AddCellFlag = !this.AddCellFlag;
      } else {
        this.attrSelectList.forEach((item) => {
          this.$set(item, 'verifyRule', this.RulesForm.expressionText)
@@ -2016,7 +2034,6 @@
        this.$set(this.attrSelectList[0], 'classifyInvokeText', data)
      }
      // this.injectHandleReset()
      if (this.injectOption.classifyInvokeLevel !== 'min') {
        this.injectOption.classifyInvokeLevel = this.injectOption.classifyNumber;
      } else {
@@ -2027,12 +2044,11 @@
    },
    //分类注入清空
    injectHandleReset() {
      // this.injectOption.classifyInvokeAttrName = "分类名称";
      // this.injectOption.classifyInvokeAttr = "name";
      // this.injectOption.classifyInvokeLevel = "min";
      // this.injectOption.classifyInvokeEditFlag = "true";
      // this.injectOption.classifyNumber = "0";
      this.$set(this.CurrentCell, 'classifyInvokeText', '')
      this.$set(this.CurrentCell, 'classifyInvokeAttr:', '')
      this.$set(this.CurrentCell, 'classitwInvokeAttrName', '')
      this.$set(this.CurrentCell, 'classifyInvokeEditFlag', 'false')
      this.$set(this.CurrentCell, 'classifyInvokeLevel', 'none')
      this.injectVisible = false;
    },
    // 分类注入取消
@@ -2090,6 +2106,7 @@
        this.editStyleFlag = true;
        this.attrEditVisible = true;
        this.attrFlag = true;
        this.AddCellFlag=true;
      }
    },
@@ -2103,6 +2120,7 @@
    updataFormlaContent(val) {
      if (this.CurrentCell) {
        this.$set(this.CurrentCell, 'componentRule', val.replace(/"/g, ''))
        this.componentRuleText= this.CurrentCell.componentRule
      } else {
        this.$set(this.attrRow, 'componentRule', val.replace(/"/g, ''))
      }
@@ -2117,13 +2135,14 @@
        this.$set(this.attrRow, 'referConfig', JSON.stringify(content))
      }
    },
    // 排序
    // 排序 this.AddCellFlag=false;
    sortChange(val) {
      console.log(val)
    },
    //开启编辑
    editOpen() {
      this.editOpenFlag = true;
      this.AddCellFlag=false;
    },
    //定义一个关闭编辑的方法供子组件使用
    editClose() {