zouyu
2024-03-05 d896d25a2bee6dc9496f102035b2d68d17f3de65
src/views/plan/masterproductionschedule/index.vue
@@ -22,6 +22,7 @@
              <el-dropdown-item
                :command="item.command"
                v-for="item in orderTypeArr"
                :key="item.value"
                :disabled="item.disabled"
                >{{ item.label }}</el-dropdown-item
              >
@@ -40,6 +41,7 @@
              <el-dropdown-item
                :command="item.command"
                v-for="item in stateTagArr"
                :key="item.value"
                :disabled="item.disabled"
                >{{ item.label }}</el-dropdown-item
              >
@@ -65,7 +67,7 @@
            </el-dropdown-menu>
          </el-dropdown> -->
          <!--审核状态改变-->
          <el-dropdown
          <!-- <el-dropdown
            v-if="permissions.masterproductionschedule_audit_change"
            @command="handleCommitCommand"
            style="margin-left: 10px"
@@ -81,7 +83,7 @@
                >{{ item.label }}</el-dropdown-item
              >
            </el-dropdown-menu>
          </el-dropdown>
          </el-dropdown> -->
          <!-- <el-button
            v-if="permissions.masterproductionschedule_submit_oa"
            @click="commitOa()"
@@ -213,7 +215,8 @@
      statesList: [
        { value: '01pending', label: '待处理' },
        { value: '02processed', label: '已处理' },
        { value: '03canceled', label: '已作废' }
        { value: '03canceled', label: '已作废' },
        { value: '04completed', label: '已完成' }
      ],
      isAuditList: [
        {
@@ -239,19 +242,25 @@
          label: '标记待处理',
          command: 'PENDING',
          disabled: false,
          permitArr: ['02processed']
          permitArr: ['01pending']
        },
        {
          label: '标记已处理',
          command: 'PROCESSED',
          disabled: false,
          permitArr: ['01pending']
          permitArr: ['02processed']
        },
        {
          label: '标记已作废',
          command: 'CANCELED',
          disabled: false,
          permitArr: ['01pending']
          permitArr: ['03canceled']
        },
        {
          label: '标记已完成',
          command: 'COMPLETED',
          disabled: false,
          permitArr: ['04completed','02processed']
        }
      ],
      documentTagArr: [
@@ -411,7 +420,7 @@
            isSearch: true,
            searchInfoType: 'text'
          },
          {
          /* {
            minWidth: '140',
            prop: 'inventoryReservedQuantity',
            label: '库存预留数量',
@@ -419,7 +428,7 @@
            isTrue: true,
            isSearch: false,
            searchInfoType: 'text'
          },
          }, */
          /* {
            minWidth: '140',
            prop: 'outsourcingNumber',
@@ -591,42 +600,11 @@
          } */
        ],
        toolbar: [],
        operator: [
          // {
          //   text: '订单预留',
          //   type: 'text',
          //   size: 'small',
          //   fun: this.customReserved
          // },
          // {
          //   text: '查看库存',
          //   type: 'text',
          //   size: 'small',
          //   fun: this.stockHandle
          // },
          {
            text: '来源',
            type: 'text',
            size: 'small',
            fun: this.searchMasterPlanSourceHandle
          },
          {
            text: '作废',
            type: 'text',
            size: 'small',
            fun: this.deleteMainPlan
          },
          // {
          //   text: '订单',
          //   type: 'text',
          //   size: 'small',
          //   fun: this.searchOrderHandle
          // }
        ],
        operator: null,
        operatorConfig: {
          fixed: 'right',
          label: '操作',
          width: 140,
          width: 100,
          minWidth: 100
        }
      },
@@ -668,53 +646,29 @@
  },
  created() {
    this.getManufactureAttrs()
    /*
          {
            text: '新增',
            type: 'primary',
            fun: this.addMasterProductionSchedule,
            disabled: false,
            permitArr: []
          },
          {
            text: '创建委外订单',
            fun: this.createOutsourcingOrder
          } */
    if (this.permissions.plan_masterproductionschedule_add) {
      this.table.toolbar.push({
        text: '新增',
        type: 'primary',
        fun: this.addMasterProductionSchedule,
        disabled: false,
        permitArr: []
      })
    let optionList = []
    if(this.permissions.masterproductionschedule_view_source){
      optionList.push({
            text: '来源',
            type: 'text',
            size: 'small',
            fun: this.searchMasterPlanSourceHandle
          })
    }
    if (this.permissions.masterproductionschedule_create_outsourcing) {
      // this.table.toolbar.push({
      //   text: '创建委外订单',
      //   fun: this.createOutsourcingOrder
      // })
    }
    if (this.permissions.masterproductionschedule_create_order_manual) {
      // this.orderTypeArr.push({
      //   label: '手动新增',
      //   command: 'MANUAL',
      //   disabled: false,
      //   permitArr: ['02processed']
      // })
    if(optionList.length>0){
      this.table.operator = optionList
    }
    if (this.permissions.masterproductionschedule_create_order_auto) {
      this.orderTypeArr.push({
        label: '自动新增',
        command: 'AUTO',
        disabled: false,
        permitArr: ['01pending']
        permitArr: ['04completed']
      })
    }
    this.getSysParam(sysParam.IS_REPORT_OPERATION)
  },
  methods: {
    deleteMainPlan(row){},
    getSysParam(paramKey) {
      getSysParam(paramKey).then((response) => {
        var paramVal = response.data.data
@@ -756,6 +710,10 @@
    },
    // 修改
    addOrUpdateHandle(row) {
      if(!this.permissions.plan_masterproductionschedule_edit && row.id!=null){
        this.$message.error("该角色没有操作权限");
        return
      }
      this.addOrUpdateVisible = true
      this.$nextTick(() => {
        this.$refs.addOrUpdate.init(row ? row.id : row, row ? row.state : row)
@@ -769,22 +727,6 @@
        }
      }
      return ''
    },
    // 删除
    deleteMainPlan(row) {
      this.$confirm('是否确认作废ID为' + row.id, '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        closeOnClickModal: false,
        type: 'warning'
      })
        .then(function() {
          return delObj(row.id)
        })
        .then((data) => {
          this.$message.success('删除成功')
          this.getData()
        })
    },
    // 查看生产计划来源
    searchMasterPlanSourceHandle(row) {
@@ -951,6 +893,8 @@
        eventName = '待处理'
      } else if (event == 'PROCESSED') {
        eventName = '已处理'
      } else if (event == 'COMPLETED') {
        eventName = '已完成'
      } else {
        eventName = '已作废'
      }
@@ -1107,6 +1051,19 @@
          this.stateTagArr[i].disabled = true
        }
      }
       for (var i = 0; i < this.orderTypeArr.length; i++) {
        if (
          uniqueStateArr.every((val) =>
            this.orderTypeArr[i].permitArr.length <= 0
              ? true
              : this.orderTypeArr[i].permitArr.includes(val)
          )
        ) {
          this.orderTypeArr[i].disabled = true
        } else {
          this.orderTypeArr[i].disabled = false
        }
      }
      this.masterPlanSelection = val
    },
    // 查看库存