zouyu
2023-11-17 7b10179a35a079a098126a1cb3aea2e8d010704d
src/views/plan/outsourcingorder/index.vue
@@ -18,13 +18,9 @@
                  状态变更<i class="el-icon-arrow-down el-icon--right"></i>
                </el-button>
                <el-dropdown-menu slot="dropdown">
                  <template v-for="item in stateTagArr">
                    <el-dropdown-item
                      :command="item.command"
                      :disabled="item.disabled">
                      {{ item.eventName }}
                    </el-dropdown-item>
                  </template>
                  <el-dropdown-item v-for="(item, index) in stateTagArr" :key="index" :command="item.command" :disabled="item.disabled">
                    {{ item.eventName }}
                  </el-dropdown-item>
                </el-dropdown-menu>
              </el-dropdown>
              <el-dropdown @command="handleCommandOa" style="margin-left: 10px">
@@ -32,8 +28,8 @@
                  审核变更<i class="el-icon-arrow-down el-icon--right"></i>
                </el-button>
                <el-dropdown-menu slot="dropdown">
                  <template v-for="item in oaStateTagArr">
                    <el-dropdown-item :key="item" :command="item.command" v-if="item.isShow"
                  <template v-for="(item, index) in oaStateTagArr">
                    <el-dropdown-item :key="index" :command="item.command" v-if="item.isShow"
                      >{{ item.eventName }}
                    </el-dropdown-item>
                  </template>
@@ -70,6 +66,16 @@
        @refreshOutsourcingOrder="refreshOutsourcingOrder"
      ></outsourcing-order-stock-form>
    </basic-container>
    <el-dialog
      title="提示"
      :visible.sync="showForeignDialog"
      width="30%">
      <span>这是一段信息</span>
      <span slot="footer" class="dialog-footer">
        <el-button @click="showForeignDialog = false">取 消</el-button>
        <el-button type="primary" @click="showForeignDialog = false">确 定</el-button>
      </span>
    </el-dialog>
  </div>
</template>
@@ -90,10 +96,12 @@
import TableForm from './outsourcingorder-form'
import OutsourcingOrderStockForm from './outsourcingorderstock-form'
import { value2label, dateTime2date } from '@/util/formatUtil'
import { log } from '@chenfengyuan/vue-qrcode'
export default {
  data() {
    return {
      showForeignDialog: false,
      ajaxFun: fetchListOutsourcingOrder,
      addOrUpdateVisible: false,
      addOrUpdateJoinVisible: false,
@@ -250,6 +258,19 @@
          },
          {
            minWidth: '140',
            prop: 'foreignState',
            label: '对外直发状态',
            sort: true,
            isTrue: true,
            formatter: this.formatForeignState,
            isSearch: true,
            searchInfoType: 'select',
            optList: () => {
              return this.foreignStateList
            }
          },
          {
            minWidth: '140',
            prop: 'state',
            label: '状态',
            sort: true,
@@ -335,16 +356,54 @@
            type: 'primary',
            loading: false,
            fun: this.launchOaProcess
          },
          {
            text: '新增外协直发申请单',
            type: 'primary',
            loading: false,
            fun: this.showForeign
          },
        ],
        operator:[
          {
            text: '打印发料单',
            type: 'text',
            size: 'small',
            show: {
              val: [
                '03pass'
              ],
              key: 'oaState'
            }
          },
          {
            text: '打印模具外协生产单',
            type: 'text',
            size: 'small',
            show: {
              val: [
                '03pass'
              ],
              key: 'oaState'
            }
          }
        ],
        operatorConfig: {
          fixed: 'right',
          label: '操作',
          width: 100,
          minWidth: 100
          width: 230,
          minWidth: 230
        }
      },
      foreignStateList: [
          {
            label: '是',
            value: 0
          },{
            label: '否',
            value: 1
          }
      ],
      paramObj: { outsourcingOrderId: 0 },
      joinAjaxFun: fetchList,
      joinMultipleSelection: [],
@@ -449,8 +508,8 @@
        operatorConfig: {
          fixed: 'right',
          label: '操作',
          width: 60,
          minWidth: 60
          width: 100,
          minWidth: 100
        }
      }
    }
@@ -464,6 +523,24 @@
    ...mapGetters(['permissions'])
  },
  methods: {
    //展示新增外协直发模态框
    showForeign(){
      let data = this.currentOutsourcingOrder
      if(data){
        if(data.foreignState == "1"){
          this.$message.warning("该订单无需外协直发申请单")
          return
        }
        if(data.foreignState == "0" && data.foreignId!= null){
          this.$message.warning("该订单已有外协直发申请单")
          return
        }
        //
        this.$message.success("新增")
      }else{
        this.$message.warning("请选择一条委外订单")
      }
    },
    // 获取数据列表
    getData() {
      this.$refs.outsourcingOrderTable.refreshData()
@@ -472,12 +549,19 @@
    addOrUpdateHandle(row) {
      this.addOrUpdateVisible = true
      this.$nextTick(() => {
        this.$refs.addOrUpdate.init(row == null ? null : row.id)
        this.$refs.addOrUpdate.init(row == null ? null : row.id,null,row == null ? null : row.mpsId)
      })
    },
    // 发起OA审核流程
    launchOaProcess() {
      if (this.currentOutsourcingOrder) {
        let foreignState = this.currentOutsourcingOrder.foreignState
        let foreignId = this.currentOutsourcingOrder.foreignId
        console.log(this.currentOutsourcingOrder);
        if(foreignState == 0 && foreignId==null){
          this.$message.warning("请先新增外协直发申请单")
          return
        }
        this.table.toolbar[1].loading = true
        approvalOaByOutsourcingOrderId(this.currentOutsourcingOrder.id)
          .then((data) => {
@@ -500,6 +584,15 @@
    // 状态格式化
    formatState(row, column, cellValue) {
      return value2label(cellValue, this.stateTagArr)
    },
    //外协直发状态格式化
    formatForeignState(row,column,cellValue){
      this.foreignStateList.forEach(obj=>{
        if(obj.value==cellValue){
          cellValue =  obj.label
        }
      })
      return cellValue
    },
    // OA状态格式化
    formatOaState(row, column, cellValue) {
@@ -586,6 +679,10 @@
    // 库存接收
    addOrUpdateStockHandle(row) {
      if (this.currentOutsourcingOrder) {
        if(this.currentOutsourcingOrder.foreignState == "0"){
          this.$message.error('外协直发不接收库存')
          return
        }
        this.addOrUpdateJoinVisible = true
        this.$nextTick(() => {
          this.$refs.addOrUpdateJoin.init(