lyh
2025-05-28 e14ed882d12df3b48e59390eba364442cdff70bd
src/views/tms/modules/outBound/OutboundDetailSelectList.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,215 @@
<template>
  <a-card :bordered="false" :class="'cust-erp-sub-tab'">
    <div class="table-operator" v-if="mainId">
      <a-table
        ref="table"
        size="middle"
        bordered
        rowKey="id"
        :scroll="{x:true}"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange, type:'checkbox'}"
        @change="handleTableChange">
        <span slot="action" slot-scope="text, record">
          <a @click="handleOutbound(record)">出库</a>
        </span>
      </a-table>
    </div>
  </a-card>
</template>
<script>
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  import { postAction } from '../../../../api/manage'
  export default {
    name: "OutboundDetailList",
    mixins:[JeecgListMixin],
    components: {
    },
    props:{
      mainId:{
        type:String,
        default:'',
        required:false
      }
    },
    watch:{
      mainId:{
        immediate: true,
        handler(val) {
          if(!this.mainId){
            this.clearList()
          }else{
            console.log('mainId',val)
            this.queryParam['outStorehouseId'] = val
            this.queryParam.status = ['1','2'].join(',')
            this.loadData(1);
          }
        }
      }
    },
    data () {
      return {
        description: 'tms_outbound_order管理页面',
        disableMixinCreated:true,
        // è¡¨å¤´
        columns: [
          {
            title: '#',
            dataIndex: '',
            key:'rowIndex',
            width:30,
            align:"center",
            customRender:function (t,r,index) {
              return parseInt(index)+1;
            }
          },
          {
            title:'工具编码',
            align:"left",
            dataIndex: 'toolNum'
          },
          {
            title:'工具编号',
            align:"left",
            dataIndex: 'toolId'
          },
          {
            title:'工具类型',
            align:"center",
            dataIndex: 'applicationType_dictText'
          },
          {
            title:'中文名称',
            align:"center",
            dataIndex: 'chineseName'
          },
          {
            title:'型号/图号',
            align:"left",
            dataIndex: 'toolModel'
          },
          {
            title:'申请出库数量',
            align:"left",
            dataIndex: 'outboundQuantity'
          },
          // {
          //   title:'已出库数量',
          //   align:"left",
          //   dataIndex: 'outActualCount'
          // },
          {
            title:'出库状态',
            align:"center",
            dataIndex: 'status_dictText'
          },
          {
            title:'刀具材料',
            align:"center",
            dataIndex: 'toolMaterial'
          },
          {
            title:'零件材料',
            align:"center",
            dataIndex: 'partMaterial'
          },
          {
            title:'厂家',
            align:"center",
            dataIndex: 'supplierId'
          },
          {
            title:'仓库',
            align:"center",
            dataIndex: 'warehouseName'
          },
          {
            title:'出库库位',
            align:"center",
            dataIndex: 'outboundLocation'
          },
          // {
          //   title:'可用库存数量',
          //   align:"left",
          //   dataIndex: 'quantity'
          // },
          {
            title:'创建时间',
            align:"left",
            dataIndex: 'createTime'
          },
          {
            title: '操作',
            dataIndex: 'action',
            align:"center",
            fixed:"right",
            width:50,
            scopedSlots: { customRender: 'action' },
          }
        ],
        url: {
          list: "/tms/outboundOrder/listOutboundDetailByMainId",
          outbound: "/tms/outboundOrder/outBoundByApply",
          delete: "/tms/outboundOrder/deleteOutboundDetail",
          deleteBatch: "/tms/outboundOrder/deleteBatchOutboundDetail",
          exportXlsUrl: "/tms/outboundOrder/exportOutboundDetail",
          importUrl: "/tms/outboundOrder/importOutboundDetail",
        },
        dictOptions:{
         outStorehouseType:[],
        }
      }
    },
    created() {
    },
    computed: {
      importExcelUrl(){
        return `${window._CONFIG['domianURL']}/${this.url.importUrl}/${this.mainId}`;
      }
    },
    methods: {
      onSelectChange(selectedRowKeys, selectionRows) {
        this.selectedRowKeys = selectedRowKeys;
        this.selectionRows = selectionRows;
        this.$emit('select-change', selectedRowKeys, selectionRows)
      },
      clearList(){
        this.dataSource=[]
        this.selectedRowKeys=[]
        this.ipagination.current = 1
      },
      handleOutbound(record) {
        console.log(this.mainId)
        console.log(record)
        const params = [
          {
            outBoundOrderId: this.mainId,
            outboundDetailId: record.id,
            outboundQuantity: record.outboundQuantity
          }
        ]
        postAction(this.url.outbound, params).then(res=>{
          if(res.success){
            this.loadData(1)
            this.$emit("ok")
            this.$message.success(res.message)
          }else{
            this.$message
          }
        })
      }
    }
  }
</script>
<style scoped>
  @import '~@assets/less/common.less'
</style>