cuijian
2025-07-09 9b6bd0c014b73456edb095ee53b22324437ae646
src/views/tms/modules/inboundOrder/InboundOrderModel.vue
@@ -40,8 +40,24 @@
              />
            </a-form-item>
          </a-col>
          <a-col :span="24 / 2">
          <!-- <a-col :span="24 / 2">
            <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="库位号">
             <a-select
                :triggerChange="true"
                :options="locationCodeOptions"
                v-decorator="[ 'locationCodeId', validatorRules.locationCodeId ]"
              />
            </a-form-item>
          </a-col> -->
          <!-- <a-col :span="24 / 2">
            <a-form-item label="申请原因" :labelCol="labelCol" :wrapperCol="wrapperCol">
             <a-input placeholder="请输入申请原因"  :disabled="disableSubmit" v-decorator="['applicationReason', validatorRules.applicationReason]" />
            </a-form-item>
          </a-col> -->
        </a-row>
         <a-row style="width: 100%">
          <a-col :span="24">
             <a-form-item label="申请原因" :labelCol="{ span: 3 }" :wrapperCol="{ span: 21 }" >
             <a-input placeholder="请输入申请原因"  :disabled="disableSubmit" v-decorator="['applicationReason', validatorRules.applicationReason]" />
            </a-form-item>
          </a-col>
@@ -55,7 +71,7 @@
                v-if="!barcodeCurrentType"
                placeholder="请选择经手人"
                v-decorator="['handler', { rules: [{ required: false, message: '请选择经手人' }] }]"
                dict="sys_user,realname,id,del_flag=0"
                dict="sys_user,realname,username,del_flag=0"
                @change="selectCurrentUserChange"
              />
            </a-form-item>
@@ -64,10 +80,10 @@
          <a-col :span="24 / 2">
            <a-form-item label="审核人" :labelCol="labelCol" :wrapperCol="wrapperCol">
              <j-search-select-tag
                :disabled="true"
                :disabled="disableSubmit"
                placeholder="请选择审核人"
                v-decorator="['reviewer', validatorRules.reviewer]"
                dict="sys_user,realname,id,del_flag=0"
                dict="sys_user,realname,username,del_flag=0"
                @change="selectCurrentUserChange"
              />
            </a-form-item>
@@ -109,9 +125,9 @@
        </a-row>
      </a-form>
    </a-spin>
    <a-button type="primary" :style="{ marginBottom: '8px' }" @click="selectTooling()" v-show="returnShow && !disableSubmit">选择借用出库单</a-button>
    <a-button type="primary" :style="{ marginBottom: '8px' }" @click="selectReturnList()" v-show="returnShow && !disableSubmit">选择借出工具</a-button>
    <a-button type="primary" :style="{ marginBottom: '8px' }" @click="selectTooling()" v-show="toolingShow && !disableSubmit">选择工具</a-button>
    <a-button type="primary" :style="{ marginBottom: '8px' }" @click="selectTooling()" v-show="sharpenShow && !disableSubmit">选择刃磨出库单</a-button>
    <a-button type="primary" :style="{ marginBottom: '8px' }" @click="selectSharpenList()" v-show="sharpenShow && !disableSubmit">选择刃磨工具</a-button>
    <a-table
      ref="table"
      bordered
@@ -127,11 +143,22 @@
        <div :key="col.dataIndex">
          <a-input-number
            v-if="col.dataIndex == 'inStorageQuantity'"
            :disabled="quantityDisable"
            :disabled="record.accuracyClass == '1'"
            :value="text"
            @change="(e) => handleChange(e, record.key, col, index)"
            :min="1"
          />
          <a-select
            v-if="col.dataIndex == 'goodsShelvesId'"
            :disabled="disableSubmit"
            :triggerChange="true"
            :value="text"
            show-search
            :filter-option="filterOption"
            style="width: 100%"
            :options="locationCodeOptions"
            @change="(e) => handleChange(e, record.key, col, index)"
          />
        </div>
      </template>
      <span slot="action" slot-scope="text, record, index">
@@ -166,6 +193,7 @@
import { filterObj } from '@/utils/util'
import JSelectReturnListModal from './JSelectReturnListModal'
import JSelectSharpenListModal from './JSelectSharpenListModal'
import store from '@/store'
export default {
  name: 'InboundOrderModel',
@@ -176,6 +204,7 @@
    JSelectReturnListModal,
    JSearchSelectTag,
    JSelectSharpenListModal,
    store
  },
  data() {
    return {
@@ -235,7 +264,7 @@
      barcodeCurrentType: false,
      inboundOrderId:'',
      validatorRules: {
        type: {
        inStorehouseType: {
          rules: [
            {
              required: true,
@@ -243,19 +272,27 @@
            },
          ],
        },
        inboundDate: {
        inboundTime: {
          rules: [
            {
              required: true,
              message: '请选择申请入库日期!',
              message: '请选择申请入库时间!',
            },
          ],
        },
        applicant: {
        applicationReason: {
          rules: [
            {
              required: true,
              message: '请选择申请人!',
              message: '请填写申请原因!',
            },
          ],
        },
        reviewer: {
          rules: [
            {
              required: true,
              message: '请选择审核人!',
            },
          ],
        },
@@ -263,11 +300,9 @@
      url: {
        add: '/tms/inboundOrder/add',
        edit: '/tms/inboundOrder/edit',
        queryByUserName: '/sys/user/queryByUserName',
        toolingList:'/tms/baseTools/list',
        queryAccountList:'/tms/baseTools/list',
        querySharpenList:'/tms/baseTools/list',
        queryReturnList:'/tms/baseTools/list',
        querySharpenList:'/tms/toolLedgerDetail/list',
        queryReturnList:'/tms/toolLedgerDetail/list',
        detailList:'/tms/inboundDetail/list',
      },
      toolingOptions:[],
@@ -303,6 +338,12 @@
          align: 'center',
          dataIndex: 'toolModel'
        },
         {
          title: '库位号',
          align: 'center',
          dataIndex: 'goodsShelvesId',
          scopedSlots: { customRender: 'goodsShelvesId' },
        },
        {
          title: '入库数量',
          align: 'center',
@@ -316,11 +357,21 @@
          scopedSlots: { customRender: 'action' },
        },
      ],
      locationCodeOptions:[]
    }
  },
  created() {},
  created() {
    ajaxGetDictItems("tms_goods_shelves,location_code,id", null).then((res) => {
        if (res.success) {
          this.locationCodeOptions = res.result
        }
      })
  },
  methods: {
    modalFormOk() {
    },
    filterOption(input, option) {
      return option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
    },
    getQueryParams() {
      this.param.pageNo = this.ipagination.current
@@ -328,6 +379,7 @@
      return filterObj(this.param)
    },
    add() {
      this.handle = store.getters.userInfo.username
      this.edit({})
    },
    edit(record) {
@@ -348,7 +400,6 @@
        this.inboundOrderId = record.id
        this.detailList(this.inboundOrderId)
      }
      this.initOptions()
      this.$nextTick(() => {
        this.form.setFieldsValue(
          pick(this.model, 'inboundNum', 'inStorehouseType', 'inboundTime', 'applicationReason', 'handler','approvalDate','reviewer','approvalOpinion','remark')
@@ -361,6 +412,14 @@
      const target = temp.filter(item => key === item.key)[index];
      if (target) {
        target[column.dataIndex] = value
        if(column.dataIndex === 'inStorageQuantity'){
          if(target['quantity']<value){
            this.$message.error('入库数量不能大于出库数量!')
            this.isDisabled = true
          }else{
            this.isDisabled = false
          }
        }
        this.dataSource = temp
      }
    },
@@ -419,7 +478,7 @@
    selectTooling: function () {
      let ids = []
      for (let i = 0; i < this.dataSource.length; i++) {
        ids.push(this.dataSource[i].toolCodeId)
        ids.push(this.dataSource[i].id)
      }
      this.$refs.toolingModalForm.showModal(ids)
      this.$refs.toolingModalForm.title = '选择工具'
@@ -449,14 +508,6 @@
      this.dataSource.splice(index, 1)
    },
    onChange() {},
    //控制扫码或手选
    selectCurrentUserType(e) {
      if (e == '0') {
        this.barcodeCurrentType = true
      } else {
        this.barcodeCurrentType = false
      }
    },
    //手选人员值
    selectCurrentUserChange(e) {
      console.log('当前手选', e)
@@ -494,52 +545,12 @@
      }
      
    },
    //添加工具按钮
    addTooling() {
      const temp = [...this.dataSource];
      temp.push({ indexId: temp.length + 1 });
      this.dataSource = temp;
    },
    detailList(inboundOrderId) {
      this.param.inboundOrderId = inboundOrderId
      getAction(this.url.detailList, this.getQueryParams()).then((res) => {
        if (res.success) {
          this.dataSource = res.result.records
          this.ipagination.total = res.result.total;
        }
      })
    },
    initOptions() {
      ajaxGetDictItems("mes_base_warehouse,name,id,del_flag!='1' order by num asc", null).then((res) => {
        if (res.success) {
          if (res.result) {
            for (let i = 0; i < res.result.length; i++) {
              res.result[i].label = res.result[i].title;
            }
          }
          this.warehouseOptions = res.result;
        }
      })
      ajaxGetDictItems("mes_base_storage_area,name,id,del_flag!='1'", null).then((res) => {
        if (res.success) {
          if (res.result) {
            for (let i = 0; i < res.result.length; i++) {
              res.result[i].label = res.result[i].title;
            }
          }
          this.locationOptions = res.result;
        }
      })
       ajaxGetDictItems("mes_base_tooling,num,id,del_flag!='1'", null).then((res) => {
        if (res.success) {
          if (res.result) {
            for (let i = 0; i < res.result.length; i++) {
              res.result[i].label = res.result[i].title;
              res.result[i].toolingName = res.result[i].name
            }
          }
          this.toolingOptions = res.result;
        }
      })
    },
@@ -555,16 +566,16 @@
      //getCurrSelected 事件 接收组件传递的参数
      for (let i = 0; i < data.length; i++) {
        this.dataSource.push({
          toolCodeId:data[i].id,
          toolingId: data[i].toolingId || data[i].id,
          id:data[i].id,
          toolCodeId: data[i].toolCodeId,
          toolCode: data[i].toolCode,
          chineseName: data[i].chineseName,
          toolModel: data[i].toolModel,
          applicationType: data[i].applicationTypeName,
          unitName: data[i].unitName || data[i].unitId_dictText,
          onlyCode:data[i].onlyCode,
          noAccountQuantity:data[i].noAccountQuantity,
          inStorageQuantity:data[i].storageQuantity
          quantity:data[i].quantity,
          inStorageQuantity:data[i].storageQuantity || data[i].quantity || 1,
          accuracyClass:data[i].accuracyClass
        })
      }
      //this.ipaginationm.total = this.dataSource.length