OutsourcingIn.vue 9.6 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 :md="4" :sm="8">
            <a-form-item label="项目名称">
              <a-select
                show-search
                placeholder="请输入项目名称"
                option-filter-prop="children"
                style="width: 200px"
                :filter-option="filterOption"
                @change="handleChange"
              >
                <a-select-option v-for="item in projectNameList" :key="item" :value="item">{{ item }}</a-select-option>
              </a-select>
            </a-form-item>
          </a-col>
          <a-col :md="4" :sm="8">
            <a-form-item label="项目编码">
              <a-select
                show-search
                placeholder="请输入项目编码"
                option-filter-prop="children"
                style="width: 200px"
                :filter-option="filterOption"
                @change="handleChange"
              >
                <a-select-option v-for="item in projectNoList" :key="item" :value="item">{{ item }}</a-select-option>
              </a-select>
            </a-form-item>
          </a-col>
          <a-col :md="4" :sm="8">
            <a-form-item label="工作令号">
              <a-select
                show-search
                placeholder="请输入工作令号"
                option-filter-prop="children"
                style="width: 200px"
                :filter-option="filterOption"
                @change="handleChange"
              >
                <a-select-option v-for="item in workNoList" :key="item" :value="item">{{ item }}</a-select-option>
              </a-select>
            </a-form-item>
          </a-col>
          <a-col :md="4" :sm="8">
            <a-form-item label="bomId">
              <a-input placeholder="请输入bomId" v-model="queryParam.bomId"></a-input>
            </a-form-item>
          </a-col>
          <a-col :md="4" :sm="8">
            <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>
            </span>
          </a-col>

        </a-row>
      </a-form>
    </div>


    <!-- 操作按钮区域 -->
    <div class="table-operator">
      <a-button @click="handleAdd" type="primary" icon="plus">新增</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-button
        @click="batchDel"
        v-if="selectedRowKeys.length > 0"
        ghost
        type="primary"
        icon="delete">批量删除
      </a-button>
    </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>已选择&nbsp;<a style="font-weight: 600">{{
          selectedRowKeys.length }}</a>项&nbsp;&nbsp;
        <a style="margin-left: 24px" @click="onClearSelected">清空</a>
      </div>

      <a-table
        :columns="columns"
        :scroll="{x: 1500}"
        size="middle"
        :pagination="false"
        :dataSource="dataSource"
        :loading="loading"
        :expandedRowKeys="expandedRowKeys"
        :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
        @expandedRowsChange="handleExpandedRowsChange">

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

          <a-divider type="vertical"/>
          <a-dropdown>
            <a-menu slot="overlay">
              <a-menu-item>
                <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
                  <a>删除</a>
                </a-popconfirm>
              </a-menu-item>
            </a-menu>
          </a-dropdown>
        </span>
        <!-- 字符串超长截取省略号显示 -->
        <span slot="url" slot-scope="text">
          <j-ellipsis :value="text" :length="25"/>
        </span>
        <!-- 字符串超长截取省略号显示-->
        <span slot="component" slot-scope="text">
          <j-ellipsis :value="text"/>
        </span>
      </a-table>

      <a-table
        ref="table"
        bordered
        size="middle"
        rowKey="id"
        :columns="planColumns"
        :dataSource="planDataSource"
        :pagination="ipagination"
        :loading="loading"
        :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
        @change="handleTableChange">

      </a-table>

    </div>
    <!-- table区域-end -->

  </a-card>

</template>

<script>
import {JeecgListMixin} from '../../mixins/JeecgListMixin'
import { getProjectName, getWorkNo, getProjectNo, getBomTree, getOutsourcing } from '../../api/api'

const columns = [
  {
    title: '图号',
    dataIndex: 'drawingNo',
    key: 'drawingNo'
  },
  {
    //   title: 'BOM',
    //   dataIndex: 'bomId',
    //   key: 'bomId'
    // }, {
    title: '物料编码',
    dataIndex: 'code',
    key: 'code'
  }, {
    title: '物料名称',
    dataIndex: 'name',
    key: 'name'
  },{
    title: '物料单位',
    dataIndex: 'unit',
    key: 'unit'
  }, {
    title: '用量',
    dataIndex: 'number',
    key: 'number'
  },{
    title: '状态',
    dataIndex: 'status',
    key: 'status'
  },{
    title: '制造方式',
    dataIndex: 'method',
    key: 'method'
  },{
    title: '设计类型',
    dataIndex: 'designType',
    key: 'designType'
  },{
    title: 'WIP属性',
    dataIndex: 'wipType',
    key: 'wipType'
  },{
    title: '品牌',
    dataIndex: 'brand',
    key: 'brand'
  }, {
    title: '分类',
    dataIndex: 'categories',
    key: 'categories'
  },{
    title: '操作',
    dataIndex: 'action',
    fixed: 'right',
    scopedSlots: { customRender: 'action' },
    align: 'center',
    width: 150
  }
]
export default {
  name: 'OutsourcingIn',
  mixins: [JeecgListMixin],
  components: {

  },
  data() {
    return {
      description: '这是外协入库页面',
      // 表头
      columns: columns,
      loading: false,
      // 展开的行,受控属性
      expandedRowKeys: [],
      url: {
        list: '/config/bom/list',
        delete: '/config/bom/delete',
        deleteBatch: '/config/bom/deleteBatch',
        importExcelUrl: '/config/bom/importExcel'
      },
      planDataSource: [],
      queryParam: [],
      projectNameList: [],
      workNoList: [],
      projectNoList: [],
      planColumns: [
        {
          title: '物料编码',
          dataIndex: 'code',
          key: 'code'
        }, {
          title: '物料名称',
          dataIndex: 'name',
          key: 'name'
        },{
          title: '物料单位',
          dataIndex: 'unit',
          key: 'unit'
        }, {
          title: '数量',
          dataIndex: 'qty',
          key: 'qty'
        },{
          title: '公司',
          dataIndex: 'vendor',
          key: 'vendor'
        },{
          title: '联系方式',
          dataIndex: 'phone',
          key: 'phone'
        },{
          title: '计划开始时间',
          dataIndex: 'planStartTime',
          key: 'planStartTime'
        },{
          title: '计划完成时间',
          dataIndex: 'planEndTime',
          key: 'planEndTime'
        },{
          title: '实际开始时间',
          dataIndex: 'actualStartTime',
          key: 'actualStartTime'
        }, {
          title: '实际完成时间',
          dataIndex: 'actualEndTime',
          key: 'actualEndTime'
        },{
          title: '操作',
          dataIndex: 'action',
          fixed: 'right',
          scopedSlots: { customRender: 'action' },
          align: 'center',
          width: 150
        }
      ]
    }
  },
  created() {
    this.loadFrom()
  },
  methods: {
    loadFrom() {
      getProjectName().then((res) => {
        if (res.success) {
          this.projectNameList = res.result
        }
      })
      getWorkNo().then((res) => {
        if (res.success) {
          this.workNoList = res.result
        }
      })
      getProjectNo().then((res) => {
        if (res.success) {
          this.projectNoList = res.result
        }
      })
    },
    handleChange(value) {
      console.log(`selected ${value}`);
    },
    filterOption(input, option) {
      return (
        option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
      );
    },
    loadData(tree) {
      this.dataSource = tree;
    },

    handleExpandedRowsChange(expandedRows) {
      this.expandedRowKeys = expandedRows
    },
    planLoading() {

    },
    searchQuery()  {
      let params = {
        "bomId": this.queryParam.bomId
      }
      console.log(this.queryParam);
      getBomTree(params).then((res) => {
        if (res.success) {
          this.loadData(res.result)
        }
      })
      getOutsourcing(params).then((res) => {
        if (res.success) {
          this.planDataSource = res.result.records||res.result;
          if(res.result.total)
          {
            this.ipagination.total = res.result.total;
          }else{
            this.ipagination.total = 0;
          }
        }
      })
    }
  },
  computed: {
    importExcelUrl: function(){
      return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
    }
  }
}
</script>

<style scoped>

</style>