houshuai
2025-07-10 255ea18d2a0f7b991e28db72ee2cda49f6d7ea90
src/views/mes/MesMaterialLoadingListView.vue
@@ -1,12 +1,13 @@
<template>
  <a-card :bordered="false" title="上料">
  <a-card :bordered="false" title="上下料查询">
    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="工单号">
              <j-search-select-tag placeholder="请输入工工单号" v-model="queryParam.workOrderId" dict="mes_production_work_order,work_order_code,id"></j-search-select-tag>
              <j-search-select-tag placeholder="请输入工工单号" v-model="queryParam.workOrderId"
                                   dict="mes_production_work_order,work_order_code,id"></j-search-select-tag>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
@@ -16,12 +17,14 @@
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="物料编码">
              <j-input dictCode="work_order_status" placeholder="请输入物料编码" v-model="queryParam.materialNumber"></j-input>
              <j-input dictCode="work_order_status" placeholder="请输入物料编码"
                       v-model="queryParam.materialNumber"></j-input>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="物料名称">
              <j-input dictCode="work_order_status" placeholder="请输入物料名称" v-model="queryParam.materialName"></j-input>
              <j-input dictCode="work_order_status" placeholder="请输入物料名称"
                       v-model="queryParam.materialName"></j-input>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
@@ -40,58 +43,45 @@
    </div>
    <!-- 查询区域-END -->
    <!-- 操作按钮区域 -->
    <div class="table-operator">
      <a-dropdown v-if="selectedRowKeys.length > 0">
        <a-menu slot="overlay">
          <a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item>
        </a-menu>
        <a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button>
      </a-dropdown>
    </div>
    <!-- table区域-begin -->
    <div>
      <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
        <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
        <a style="margin-left: 24px" @click="onClearSelected">清空</a>
      </div>
    <a-spin :spinning="confirmLoading">
      <div>
        <a-table
          ref="table"
          size="middle"
          :scroll="{x:true}"
          bordered
          rowKey="id"
          :columns="columns"
          :dataSource="dataSource"
          :pagination="ipagination"
          :loading="loading"
          :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange,type: 'radio'}"
          class="j-table-force-nowrap"
          @change="handleTableChange">
      <a-table
        ref="table"
        size="middle"
        :scroll="{x:true}"
        bordered
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
        class="j-table-force-nowrap"
        @change="handleTableChange">
          <template slot="htmlSlot" slot-scope="text">
            <div v-html="text"></div>
          </template>
          <template slot="imgSlot" slot-scope="text,record">
            <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
            <img v-else :src="getImgView(text)" :preview="record.id" height="25px" alt=""
                 style="max-width:80px;font-size: 12px;font-style: italic;" />
          </template>
          <template slot="fileSlot" slot-scope="text">
            <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
            <a-button
              v-else
              :ghost="true"
              type="primary"
              icon="download"
              size="small"
              @click="downloadFile(text)">
              下载
            </a-button>
          </template>
        <template slot="htmlSlot" slot-scope="text">
          <div v-html="text"></div>
        </template>
        <template slot="imgSlot" slot-scope="text,record">
          <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
          <img v-else :src="getImgView(text)" :preview="record.id" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/>
        </template>
        <template slot="fileSlot" slot-scope="text">
          <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
          <a-button
            v-else
            :ghost="true"
            type="primary"
            icon="download"
            size="small"
            @click="downloadFile(text)">
            下载
          </a-button>
        </template>
        <span slot="action" slot-scope="text, record">
          <span slot="action" slot-scope="text, record">
          <a @click="handleEdit(record)">编辑</a>
          <a-divider type="vertical" />
@@ -109,136 +99,218 @@
            </a-menu>
          </a-dropdown>
        </span>
      </a-table>
    </div>
        </a-table>
      </div>
      <a-tabs v-model="activeKey" @change="handleChangeTabs">
        <a-tab-pane tab="下料" :key="refKeys[0]" :forceRender="true">
          <div style="display: flex; align-items: center; margin-bottom: 10px;">
          </div>
          <j-vxe-table
            keep-source
            :ref="refKeys[0]"
            :loading="mesMaterialUnloading.loading"
            :columns="mesMaterialUnloading.columns"
            :dataSource="mesMaterialUnloading.dataSource"
            :maxHeight="300"
            :rowNumber="true"
            :rowSelection="true"
            :toolbar="false"
          />
        </a-tab-pane>
      </a-tabs>
    </a-spin>
    <mes-material-loading-modal ref="modalForm" @ok="modalFormOk"></mes-material-loading-modal>
  </a-card>
</template>
<script>
  import '@/assets/less/TableExpand.less'
  import { mixinDevice } from '@/utils/mixin'
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  import MesMaterialLoadingModal from './modules/MesMaterialLoadingModal'
import '@/assets/less/TableExpand.less'
import { mixinDevice } from '@/utils/mixin'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import MesMaterialLoadingModal from './modules/MesMaterialLoadingModal'
import { JVxeTableModelMixin } from '@/mixins/JVxeTableModelMixin.js'
import { JVXETypes } from '@/components/jeecg/JVxeTable'
import { getAction } from '@api/manage'
  export default {
    name: 'MesMaterialLoadingList',
    mixins:[JeecgListMixin, mixinDevice],
    components: {
      MesMaterialLoadingModal
    },
    data () {
      return {
        description: '上料管理页面',
        // 表头
        columns: [
          {
            title: '#',
            dataIndex: '',
            key:'rowIndex',
            width:60,
            align:"center",
            customRender:function (t,r,index) {
              return parseInt(index)+1;
            }
          },
          {
            title:'工单号',
            align:"center",
            dataIndex: 'workOrderId_dictText'
          },
          {
            title:'设备ID',
            align:"center",
            dataIndex: 'equipmentId'
          },
          {
            title:'工序编码',
            align:"center",
            dataIndex: 'processCode'
          },
          {
            title:'工序名称',
            align:"center",
            dataIndex: 'processName'
          },
          {
            title:'物料编码',
            align:"center",
            dataIndex: 'materialNumber'
          },
          {
            title:'物料名称',
            align:"center",
            dataIndex: 'materialName'
          },
          {
            title:'批次号',
            align:"center",
            dataIndex: 'batchNumber'
          },
          {
            title:'数量',
            align:"center",
            dataIndex: 'quantity'
          },
          {
            title:'剩余数量',
            align:"center",
            dataIndex: 'remainingQuantity'
          },
          {
            title: '操作',
            dataIndex: 'action',
            align:"center",
            fixed:"right",
            width:147,
            scopedSlots: { customRender: 'action' }
export default {
  name: 'MesMaterialLoadingList',
  mixins: [JeecgListMixin, mixinDevice,JVxeTableModelMixin,JVXETypes],
  components: {
    MesMaterialLoadingModal
  },
  data() {
    return {
      description: '上料管理页面',
      refKeys: ['mesMaterialUnloading'],
      tableKeys: ['mesMaterialUnloading'],
      activeKey: 'mesMaterialUnloading',
      // 表头
      columns: [
        {
          title: '#',
          dataIndex: '',
          key: 'rowIndex',
          width: 60,
          align: 'center',
          customRender: function(t, r, index) {
            return parseInt(index) + 1
          }
        ],
        url: {
          list: "/mes/mesMaterialLoading/list",
          delete: "/mes/mesMaterialLoading/delete",
          deleteBatch: "/mes/mesMaterialLoading/deleteBatch",
          exportXlsUrl: "/mes/mesMaterialLoading/exportXls",
          importExcelUrl: "mes/mesMaterialLoading/importExcel",
        },
        dictOptions:{},
        superFieldList:[],
        {
          title: '工单号',
          align: 'center',
          dataIndex: 'workOrderId_dictText'
        },
        {
          title: '设备ID',
          align: 'center',
          dataIndex: 'equipmentId'
        },
        {
          title: '工序编码',
          align: 'center',
          dataIndex: 'processCode'
        },
        {
          title: '工序名称',
          align: 'center',
          dataIndex: 'processName'
        },
        {
          title: '物料编码',
          align: 'center',
          dataIndex: 'materialNumber'
        },
        {
          title: '物料名称',
          align: 'center',
          dataIndex: 'materialName'
        },
        {
          title: '批次号',
          align: 'center',
          dataIndex: 'batchNumber'
        },
        {
          title: '数量',
          align: 'center',
          dataIndex: 'quantity'
        },
        {
          title: '剩余数量',
          align: 'center',
          dataIndex: 'remainingQuantity'
        },
        {
          title: '操作',
          dataIndex: 'action',
          align: 'center',
          fixed: 'right',
          width: 147,
          scopedSlots: { customRender: 'action' }
        }
      ],
      mesMaterialUnloading: {
        loading: false,
        dataSource: [],
        columns: [
          // {
          //   title: '上料',
          //   key: 'loadingId',
          //   type: JVXETypes.input,
          //   width: '200px',
          //   placeholder: '请输入${title}',
          //   defaultValue: ''
          // },
          {
            title: '物料编码',
            key: 'materialNumber',
            type: JVXETypes.input,
            width: '200px',
            placeholder: '请输入${title}',
            defaultValue: ''
          },
          {
            title: '物料名称',
            key: 'materialName',
            type: JVXETypes.input,
            width: '200px',
            placeholder: '请输入${title}',
            defaultValue: ''
          },
          {
            title: '批次号',
            key: 'batchNumber',
            type: JVXETypes.input,
            width: '200px',
            placeholder: '请输入${title}',
            defaultValue: ''
          },
          {
            title: '数量',
            key: 'quantity',
            type: JVXETypes.input,
            width: '200px',
            placeholder: '请输入${title}',
            defaultValue: ''
          }
        ]
      },
      url: {
        list: '/mes/mesMaterialLoading/list',
        delete: '/mes/mesMaterialLoading/delete',
        deleteBatch: '/mes/mesMaterialLoading/deleteBatch',
        exportXlsUrl: '/mes/mesMaterialLoading/exportXls',
        importExcelUrl: 'mes/mesMaterialLoading/importExcel',
        queryUnloadingByLoadingId:'/mes/mesMaterialLoading/queryUnloadingByLoadingId'
      },
      dictOptions: {},
      superFieldList: []
    }
  },
  created() {
    this.getSuperFieldList()
  },
  computed: {
    importExcelUrl: function() {
      return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`
    }
  },
  methods: {
    initDictConfig() {
    },
    async onSelectChange(selectedRowKeys) {
      this.mesMaterialUnloading.loading = true
      // 单选模式下,selectedRowKeys 是数组,但长度最多为1
      console.log('点击了---->',selectedRowKeys[0])
      this.selectedRowKeys = selectedRowKeys
      this.mesMaterialUnloading.dataSource=[]
      // 获取选中行的完整数据
      if (selectedRowKeys.length > 0) {
        const selectedId = selectedRowKeys[0] // 选中行的id
        const mesMaterialUnloading = await getAction(this.url.queryUnloadingByLoadingId, { 'loadingId': selectedId })
        this.mesMaterialUnloading.dataSource = mesMaterialUnloading.result
        this.mesMaterialUnloading.loading = false
      }
    },
    created() {
    this.getSuperFieldList();
    },
    computed: {
      importExcelUrl: function(){
        return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
      },
    },
    methods: {
      initDictConfig(){
      },
      getSuperFieldList(){
        let fieldList=[];
        fieldList.push({type:'int',value:'delFlag',text:'删除标记',dictCode:''})
        fieldList.push({type:'string',value:'workOrderId',text:'工单ID',dictCode:''})
        fieldList.push({type:'string',value:'equipmentId',text:'设备ID',dictCode:''})
        fieldList.push({type:'string',value:'processCode',text:'工序编码',dictCode:''})
        fieldList.push({type:'string',value:'processName',text:'工序名称',dictCode:''})
        fieldList.push({type:'string',value:'materialNumber',text:'物料编码',dictCode:''})
        fieldList.push({type:'string',value:'materialName',text:'物料名称',dictCode:''})
        fieldList.push({type:'string',value:'batchNumber',text:'批次号',dictCode:''})
        fieldList.push({type:'double',value:'quantity',text:'数量',dictCode:''})
        fieldList.push({type:'double',value:'remainingQuantity',text:'剩余数量',dictCode:''})
        this.superFieldList = fieldList
      }
    getSuperFieldList() {
      let fieldList = []
      fieldList.push({ type: 'int', value: 'delFlag', text: '删除标记', dictCode: '' })
      fieldList.push({ type: 'string', value: 'workOrderId', text: '工单ID', dictCode: '' })
      fieldList.push({ type: 'string', value: 'equipmentId', text: '设备ID', dictCode: '' })
      fieldList.push({ type: 'string', value: 'processCode', text: '工序编码', dictCode: '' })
      fieldList.push({ type: 'string', value: 'processName', text: '工序名称', dictCode: '' })
      fieldList.push({ type: 'string', value: 'materialNumber', text: '物料编码', dictCode: '' })
      fieldList.push({ type: 'string', value: 'materialName', text: '物料名称', dictCode: '' })
      fieldList.push({ type: 'string', value: 'batchNumber', text: '批次号', dictCode: '' })
      fieldList.push({ type: 'double', value: 'quantity', text: '数量', dictCode: '' })
      fieldList.push({ type: 'double', value: 'remainingQuantity', text: '剩余数量', dictCode: '' })
      this.superFieldList = fieldList
    }
  }
}
</script>
<style scoped>
  @import '~@assets/less/common.less';
@import '~@assets/less/common.less';
</style>