ShipmentPlanHeaderList.vue 7.95 KB
<template>
  <a-card :bordered="false">
    <!-- 查询区域 -->
    <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-dict-select-tag placeholder="请选择计划状态" v-model="queryParam.status" dictCode="shipment_plan_status"/>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="机台号或名称">
              <j-input placeholder="请输入机台号或名称" v-model="queryParam.stationCode"></j-input>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="工单号">
              <j-input placeholder="请输入工单号" v-model="queryParam.orderCode"></j-input>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="物料编码">
              <j-input placeholder="请输入物料编码" v-model="queryParam.materialCode"></j-input>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
              <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
              <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
              <a @click="handleToggleSearch" style="margin-left: 8px">
                {{ toggleSearchStatus ? '收起' : '展开' }}
                <a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>
              </a>
            </span>
          </a-col>
        </a-row>
      </a-form>
    </div>
    <!-- 查询区域-END -->

    <!-- 操作按钮区域 -->
    <div class="table-operator">
      <!--      <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>-->
      <a-button type="primary" icon="download" @click="handleExportXls('叫料计划头表')">导出</a-button>
      <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
        <a-button type="primary" icon="import">导入</a-button>
      </a-upload>
      <!-- 高级查询区域 -->
      <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-table
        ref="table"
        size="middle"
        :scroll="{x:true}"
        bordered
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        :customRow="clickThenSelect"
        :rowClassName="rowClassName"
        :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange, type:'checkbox'}"
        class="j-table-force-nowrap"
        @change="handleTableChange">

        <span slot="status" slot-scope="status">
          <a-tag :key="status" :color="getStatusColor(status)">
            {{ status }}
          </a-tag>
        </span>

        <span slot="action" slot-scope="text, record">
          <a @click="handleEdit(record)">编辑</a>

          <a-divider type="vertical"/>
          <a-dropdown>
            <a class="ant-dropdown-link">更多 <a-icon type="down"/></a>
            <a-menu slot="overlay">
              <a-menu-item>
                <a @click="handleDetail(record)">详情</a>
              </a-menu-item>
              <a-menu-item>
                <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
                  <a>删除</a>
                </a-popconfirm>
              </a-menu-item>
            </a-menu>
          </a-dropdown>
        </span>

      </a-table>
    </div>

    <shipment-plan-header-modal ref="modalForm" @ok="modalFormOk"></shipment-plan-header-modal>

    <a-tabs defaultActiveKey="1">
      <a-tab-pane tab="叫料计划详情" key="1">
        <shipment-plan-detail-list :mainId="selectedMainId"></shipment-plan-detail-list>
      </a-tab-pane>
    </a-tabs>
  </a-card>
</template>

<script>

import '@/assets/less/TableExpand.less'
import {mixinDevice} from '@/utils/mixin'
import {JeecgListMixin} from '@/mixins/JeecgListMixin'
import ShipmentPlanHeaderModal from '@views/system/shipment/modules/ShipmentPlanHeaderModal'
import ShipmentPlanDetailList from "./ShipmentPlanDetailList";

export default {
  name: 'ShipmentPlanHeaderList',
  mixins: [JeecgListMixin, mixinDevice],
  components: {
    ShipmentPlanDetailList,
    ShipmentPlanHeaderModal
  },
  data() {
    return {
      description: '叫料计划头表管理页面',
      // 表头
      columns: [
        {
          title: '叫料计划头ID',
          dataIndex: 'id',
          key: 'id',
          width: 60,
          align: "center"
        },
        {
          title: '机台区域',
          align: "center",
          dataIndex: 'area'
        },
        {
          title: '机台号',
          align: "center",
          dataIndex: 'stationCode'
        },
        {
          title: '机台名称',
          align: "center",
          dataIndex: 'stationName'
        },
        {
          title: '工单号',
          align: "center",
          dataIndex: 'orderCode'
        },
        {
          title: '物料编码',
          align: "center",
          dataIndex: 'materialCode'
        },
        {
          title: '物料名称',
          align: "center",
          dataIndex: 'materialName'
        },
        {
          title: '计划出库数量',
          align: "center",
          dataIndex: 'planQty'
        },
        {
          title: '实际送达数量',
          align: "center",
          dataIndex: 'shipmentQty'
        },
        {
          title: '状态',
          align: "center",
          dataIndex: 'status_dictText',
          key: "status_dictText",
          scopedSlots: {customRender: 'status'}
        },
        {
          title: '操作',
          dataIndex: 'action',
          align: "center",
          fixed: "right",
          width: 147,
          scopedSlots: {customRender: 'action'}
        }
      ],
      url: {
        list: "/shipmentPlan/shipmentPlanHeader/list",
        delete: "/shipmentPlan/shipmentPlanHeader/delete",
        deleteBatch: "/shipmentPlan/shipmentPlanHeader/deleteBatch",
        exportXlsUrl: "/shipmentPlan/shipmentPlanHeader/exportXls",
        importExcelUrl: "shipmentPlan/shipmentPlanHeader/importExcel",
      },
      selectedMainId: null,
    }
  },
  created() {
  },
  computed: {
    importExcelUrl: function () {
      return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
    },
  },
  methods: {
    clickThenSelect(record,index) {
      return {
        on: {
          click: () => {
            this.selectIndex = index
            this.selectedMainId = record.id;
          }
        }
      }
    },
    rowClassName(record, index) {
      return index === this.selectIndex ? 'Rowactive' : ''
    },
    getStatusColor(value) {
      const colors = {
        '新建': 'green',
        '开工': 'blue',
        '暂停': 'orange',
        '完成': 'purple',
        '删除': 'red',
        default: '1'
      };
      return colors[value] || colors.default;
    },
  }
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>