update 2023.4.6 - 2
This commit is contained in:
		@@ -10,8 +10,9 @@
 | 
			
		||||
 | 
			
		||||
    <div class="dialog-body__inner relative">
 | 
			
		||||
      <!-- v-if="dataForm.id && !detailMode && /属性|详情/.test(activeMenu) && $hasPermission()" -->
 | 
			
		||||
      <el-button v-if="configs.allowAdd ?? (dataForm.id && !detailMode && /属性|详情|参数/.test(activeMenu))" plain type="primary" size="small"
 | 
			
		||||
        class="at-right-top" style="margin-bottom: 16px" @click="handleAddParam()">+ 添加</el-button>
 | 
			
		||||
      <el-button v-if="configs.allowAdd ?? (dataForm.id && !detailMode && /属性|详情|参数/.test(activeMenu))" plain
 | 
			
		||||
        type="primary" size="small" class="at-right-top" style="margin-bottom: 16px" @click="handleAddParam()">+
 | 
			
		||||
        添加</el-button>
 | 
			
		||||
      <template v-if="dataForm.id && !detailMode && /附件/.test(activeMenu)">
 | 
			
		||||
        <el-upload style="position: absolute; width: 100%; height: 0" name="files" :action="uploadUrl"
 | 
			
		||||
          :show-file-list="false" :headers="uploadHeaders" :on-success="handleUploadSuccess"
 | 
			
		||||
@@ -185,6 +186,7 @@ export default {
 | 
			
		||||
    const dataForm = {};
 | 
			
		||||
    const autoDisabledQueue = [];
 | 
			
		||||
    const watingToRefreshQueue = [];
 | 
			
		||||
    const cached = {}
 | 
			
		||||
 | 
			
		||||
    this.configs.form.rows.forEach((row) => {
 | 
			
		||||
      row.forEach((col) => {
 | 
			
		||||
@@ -193,11 +195,17 @@ export default {
 | 
			
		||||
 | 
			
		||||
        if (col.autoDisabled) autoDisabledQueue.push(col.prop);
 | 
			
		||||
        if (!!col.refreshOptionsAfterConfirm) watingToRefreshQueue.push(col);
 | 
			
		||||
 | 
			
		||||
        if (col.fetchData)
 | 
			
		||||
          col.fetchData().then(({ data: res }) => {
 | 
			
		||||
            console.log("[Fetch Data]", "list" in res.data, res.data, res.data.list);
 | 
			
		||||
            if (res.code === 0) {
 | 
			
		||||
              if (!col.options || !col.options.length)
 | 
			
		||||
              if (col.cacheFetchedData) {
 | 
			
		||||
                // cache fetched data
 | 
			
		||||
                cached[col.prop] = 'list' in res.data ? res.data.list : (Array.isArray(res.data) ? res.data : [])
 | 
			
		||||
              }
 | 
			
		||||
 | 
			
		||||
              if (!col.options || !col.options.length) {
 | 
			
		||||
                this.$set(
 | 
			
		||||
                  col,
 | 
			
		||||
                  "options",
 | 
			
		||||
@@ -211,6 +219,7 @@ export default {
 | 
			
		||||
                      value: col.optionValue ? i[col.optionValue] : i.id,
 | 
			
		||||
                    }))
 | 
			
		||||
                );
 | 
			
		||||
              }
 | 
			
		||||
              // col.options = res.data.list;
 | 
			
		||||
              else if (col.options.length) {
 | 
			
		||||
                "list" in res.data ? res.data.list.unshift(...col.options) : res.data.unshift(...col.options);
 | 
			
		||||
@@ -273,6 +282,7 @@ export default {
 | 
			
		||||
      detailMode: false,
 | 
			
		||||
      autoDisabledQueue,
 | 
			
		||||
      watingToRefreshQueue,
 | 
			
		||||
      cached,
 | 
			
		||||
      showBaseDialog: false,
 | 
			
		||||
      baseDialogConfig: null,
 | 
			
		||||
      subList: [],
 | 
			
		||||
@@ -309,6 +319,38 @@ export default {
 | 
			
		||||
      currentImgUrl: "",
 | 
			
		||||
    };
 | 
			
		||||
  },
 | 
			
		||||
  mounted() {
 | 
			
		||||
    this.configs.form.rows.forEach((row) => {
 | 
			
		||||
      row.forEach((col) => {
 | 
			
		||||
        if (col.changeReflects && typeof col.changeReflects === 'object' && 'fromKey' in col.changeReflects && 'toProp' in col.changeReflects) {
 | 
			
		||||
          this.$watch(
 | 
			
		||||
            () => this.dataForm[col.prop],
 | 
			
		||||
            val => {
 | 
			
		||||
              if (val && (col.prop in this.cached)) {
 | 
			
		||||
                console.log("here changeReflects", col.prop, col.changeReflects.toProp, this.cached[col.prop])
 | 
			
		||||
                if (typeof col.changeReflects.fromKey === 'string') {
 | 
			
		||||
                  this.dataForm[col.changeReflects.toProp] = this.cached[col.prop].find(item => item.id === val)?.[col.changeReflects.fromKey]
 | 
			
		||||
                } else if (Array.isArray(col.changeReflects.fromKey) && col.changeReflects.delimiter) {
 | 
			
		||||
                  const foundItem = this.dataForm[col.changeReflects.toProp] = this.cached[col.prop].find(item => item.id === val)
 | 
			
		||||
                  if (foundItem) {
 | 
			
		||||
                    const values = col.changeReflects.fromKey.map(key => foundItem[key])
 | 
			
		||||
                    this.dataForm[col.changeReflects.toProp] = values.join(col.changeReflects.delimiter)
 | 
			
		||||
                  } else {
 | 
			
		||||
                    this.dataForm[col.changeReflects.toProp] = col.changeReflects.delimiter
 | 
			
		||||
                    console.log("[DialogWithMenu] mounted() 没找到对应数据")
 | 
			
		||||
                  }
 | 
			
		||||
                }
 | 
			
		||||
              }
 | 
			
		||||
            },
 | 
			
		||||
            {
 | 
			
		||||
              immediate: false
 | 
			
		||||
            }
 | 
			
		||||
          )
 | 
			
		||||
        }
 | 
			
		||||
      });
 | 
			
		||||
    });
 | 
			
		||||
  },
 | 
			
		||||
 | 
			
		||||
  watch: {
 | 
			
		||||
    dialogVisible: function (val) {
 | 
			
		||||
      if (!!val) {
 | 
			
		||||
@@ -923,4 +965,5 @@ ul.file-list>li:hover {
 | 
			
		||||
 | 
			
		||||
.force-disabled {
 | 
			
		||||
  margin-top: 42px;
 | 
			
		||||
}</style>
 | 
			
		||||
}
 | 
			
		||||
</style>
 | 
			
		||||
 
 | 
			
		||||
@@ -99,7 +99,13 @@ export default function () {
 | 
			
		||||
            refreshOptionsAfterConfirm: true,
 | 
			
		||||
            rules: { required: true, message: "必填项不能为空", trigger: "blur" },
 | 
			
		||||
            elparams: { clearable: true, filterable: true, placeholder: "请选择配方" },
 | 
			
		||||
            fetchData: (techId = -1) => this.$http.get("/pms/bom/listUnR", { params: { wsId: 3, externalCode: '', key: '', techId } }),
 | 
			
		||||
            fetchData: (techId = -1) => this.$http.get("/pms/bom/listUnR", { params: { wsId: 3, version: '', key: '', techId } }),
 | 
			
		||||
            cacheFetchedData: true,
 | 
			
		||||
            changeReflects: {
 | 
			
		||||
              fromKey: ['code', 'version'],
 | 
			
		||||
              delimiter: '-',
 | 
			
		||||
              toProp: 'code'
 | 
			
		||||
            }
 | 
			
		||||
          },
 | 
			
		||||
        ],
 | 
			
		||||
        // [
 | 
			
		||||
 
 | 
			
		||||
@@ -75,7 +75,7 @@ export default function () {
 | 
			
		||||
    { width: 200, prop: "saleOrderItem", label: "销售订单item号" },
 | 
			
		||||
    { width: 200, prop: "packTechCode", label: "包装工艺代码" }, // select, filterable
 | 
			
		||||
    { width: 120, prop: "specifications", label: "生产订单类型" },
 | 
			
		||||
    { width: 120, prop: "deliveryTime", label: "发货时间" },
 | 
			
		||||
    { width: 120, prop: "deliveryTime", label: "销售时间" },
 | 
			
		||||
    { width: 120, prop: "customerCode", label: "客户" },
 | 
			
		||||
    { width: 120, prop: "pcsKilnCar", label: "托盘码放砖数" },
 | 
			
		||||
    // { prop: "description", label: "详情", subcomponent: TableTextComponent },
 | 
			
		||||
 
 | 
			
		||||
@@ -1,10 +1,10 @@
 | 
			
		||||
<template>
 | 
			
		||||
  <div class="main-container">
 | 
			
		||||
    <div class="inner-sidebar">
 | 
			
		||||
    <!-- <div class="inner-sidebar">
 | 
			
		||||
      <a href="#ongoing" :class="{ active: activeTable === '#ongoing' }" @click.prevent="scrollTo('#ongoing')">进行中的订单</a>
 | 
			
		||||
      <a href="#pending" :class="{ active: activeTable === '#pending' }" @click.prevent="scrollTo('#pending')">等待订单</a>
 | 
			
		||||
      <a href="#finished" :class="{ active: activeTable === '#finished' }" @click.prevent="scrollTo('#finished')">完成订单</a>
 | 
			
		||||
    </div>
 | 
			
		||||
    </div> -->
 | 
			
		||||
 | 
			
		||||
    <div class="list-view-with-head-list">
 | 
			
		||||
      <!-- <ListViewWithHead :table-configs="tableConfigs" :head-configs="headFormConfigs" :dialog-configs="dialogConfigs" /> -->
 | 
			
		||||
@@ -181,7 +181,7 @@ export default {
 | 
			
		||||
 | 
			
		||||
.list-view-with-head-list {
 | 
			
		||||
  width: 1px;
 | 
			
		||||
  margin-left: 144px;
 | 
			
		||||
  /* margin-left: 144px; */
 | 
			
		||||
  flex-grow: 1;
 | 
			
		||||
}
 | 
			
		||||
</style>
 | 
			
		||||
 
 | 
			
		||||
@@ -20,7 +20,10 @@ export default function () {
 | 
			
		||||
      fixed: "right",
 | 
			
		||||
      width: 120,
 | 
			
		||||
      subcomponent: TableOperaionComponent,
 | 
			
		||||
      options: [ { name: "copy", label: "复制", icon: "copy-document" }, { name: "edit", label: "编辑", icon: "edit-outline" }, { name: "delete", icon: "delete", label: "删除", emitFull: true, permission: "pms:shapeStep:delete" }],
 | 
			
		||||
      options: [
 | 
			
		||||
        { name: "copy", label: "复制", icon: "copy-document" },
 | 
			
		||||
        { name: "edit", label: "编辑", icon: "edit-outline" },
 | 
			
		||||
        { name: "delete", icon: "delete", label: "删除", promptField: 'code', emitFull: true, permission: "pms:shapeStep:delete" }],
 | 
			
		||||
    },
 | 
			
		||||
  ];
 | 
			
		||||
 | 
			
		||||
@@ -96,15 +99,20 @@ export default function () {
 | 
			
		||||
            refreshOptionsAfterConfirm: true,
 | 
			
		||||
            rules: { required: true, message: "必填项不能为空", trigger: "blur" },
 | 
			
		||||
            elparams: { clearable: true, filterable: true, placeholder: "请选择砖型" },
 | 
			
		||||
            fetchData: (techId = -1) => this.$http.get("/pms/shape/listUnR", { params: { wsId: 2, externalCode: '', key: '', techId } }),
 | 
			
		||||
            fetchData: (techId = -1) => this.$http.get("/pms/shape/listUnR", { params: { wsId: 2, key: '', techId } }),
 | 
			
		||||
            cacheFetchedData: true,
 | 
			
		||||
            changeReflects: {
 | 
			
		||||
              fromKey: 'code',
 | 
			
		||||
              toProp: 'code'
 | 
			
		||||
            }
 | 
			
		||||
          },
 | 
			
		||||
        ],
 | 
			
		||||
        // [
 | 
			
		||||
          // {
 | 
			
		||||
          //   forceDisabled: true,
 | 
			
		||||
          //   prop: 'shapeCode',
 | 
			
		||||
          //   label: '当前砖型'
 | 
			
		||||
          // },
 | 
			
		||||
        // {
 | 
			
		||||
        //   forceDisabled: true,
 | 
			
		||||
        //   prop: 'shapeCode',
 | 
			
		||||
        //   label: '当前砖型'
 | 
			
		||||
        // },
 | 
			
		||||
        // ],
 | 
			
		||||
        // {
 | 
			
		||||
        //   select: true,
 | 
			
		||||
 
 | 
			
		||||
@@ -23,7 +23,7 @@ export default function () {
 | 
			
		||||
      options: [ 
 | 
			
		||||
        { name: "copy", label: "复制", icon: "copy-document" }, 
 | 
			
		||||
        { name: "edit", label: "编辑", icon: "edit-outline" }, 
 | 
			
		||||
        { name: "delete", icon: "delete", label: "删除", emitFull: true, permission: "pms:testingStep:delete" }
 | 
			
		||||
        { name: "delete", icon: "delete", label: "删除", promptField: 'code', emitFull: true, permission: "pms:testingStep:delete" }
 | 
			
		||||
      ],
 | 
			
		||||
    },
 | 
			
		||||
  ];
 | 
			
		||||
@@ -101,7 +101,12 @@ export default function () {
 | 
			
		||||
            rules: { required: true, message: "必填项不能为空", trigger: "blur" },
 | 
			
		||||
            elparams: { clearable: true, filterable: true, placeholder: "请选择砖型" },
 | 
			
		||||
            // 下面参数的 techId 是为 /pms/xxx/listUnR 接口定制的,默认为 -1,新增时使用,编辑时传对应的 工艺id
 | 
			
		||||
            fetchData: (techId = -1) => this.$http.get("/pms/shape/listUnR", { params: { wsId: 4, externalCode: '', key: '', techId } }),
 | 
			
		||||
            fetchData: (techId = -1) => this.$http.get("/pms/shape/listUnR", { params: { wsId: 4, key: '', techId } }),
 | 
			
		||||
            cacheFetchedData: true,
 | 
			
		||||
            changeReflects: {
 | 
			
		||||
              fromKey: 'code',
 | 
			
		||||
              toProp: 'code'
 | 
			
		||||
            }
 | 
			
		||||
          },
 | 
			
		||||
        ],
 | 
			
		||||
        // [
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user