ProductOut.vue 9.03 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="6" :sm="8">
            <a-form-item label="项目名称">
              <a-select
                show-search
                placeholder="请输入项目名称"
                option-filter-prop="children"
                :filter-option="filterOption"
                @change="handleChange"
                v-model="queryParam.projectName"
              >
                <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="6" :sm="8">
            <a-form-item label="项目编码">
              <a-select
                show-search
                placeholder="请输入项目编码"
                option-filter-prop="children"
                :filter-option="filterOption"
                @change="handleChange"
                v-model="queryParam.projectNo"
              >
                <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="6" :sm="8">
            <a-form-item label="工作令号">
              <a-select
                show-search
                placeholder="请输入工作令号"
                option-filter-prop="children"
                :filter-option="filterOption"
                @change="handleChange"
                v-model="queryParam.workNo"
              >
                <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="6" :sm="8">
            <a-form-item label="bomId">
              <a-select
                show-search
                placeholder="请选择BOM"
                option-filter-prop="children"
                :filter-option="filterOption"
                @change="handleBomChange"
                v-model="queryParam.bomId"
              >
                <a-select-option v-for="item in bomIdList" :key="item" :value="item">{{ item }}</a-select-option>
              </a-select>
            </a-form-item>
          </a-col>
          <a-col :md="6" :sm="8">
            <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
              <a-button type="primary" @click="query" 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
        ref="table"
        bordered
        size="middle"
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
        @change="handleTableChange">

        <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>
      </a-table>

    </div>
  </a-card>

</template>

<script>
import {JeecgListMixin} from '../../mixins/JeecgListMixin'
import {
  getProjectName,
  getWorkNo,
  getProjectNo,
  getOutsourcing,
  getBomIdList,
  getInventoryOut
} from '../../api/api'
import OutsourcingInModal from './modules/OutsourcingInModal'
export default {
  name: 'ProductOut',
  mixins: [JeecgListMixin],
  components: {

  },
  data() {
    return {
      description: '这是成品入库页面',
      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: [],
      bomIdList: [],
      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: '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: 'qty',
          key: 'qty'
        },{
          title: '库存数量',
          dataIndex: 'inQty',
          key: 'inQty'
        }, {
          title: '状态',
          dataIndex: 'status',
          key: 'status'
        }]
    }
  },
  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
        }
      })
      getBomIdList().then((res) => {
        if (res.success) {
          this.bomIdList = 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
    },
    handleBomChange(value) {
      this.initBomTree(value);
    },
    query()  {
      let params = {
        "bomId": this.queryParam.bomId,
        "projectName": this.queryParam.projectName,
        "projectNo": this.queryParam.projectNo,
        "workNo": this.queryParam.workNo
      }
      getInventoryOut(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;
          }
        } else {
          this.$message.info(res.message);
        }
      })
    },
    initBomTree(bomId) {
      let params = {
        "bomId": bomId
      }

      getInventoryOut(params).then((res) => {
        if (res.success) {
          console.log(res)
          this.planDataSource = res.result.records;
          if(res.result.total)
          {
            this.ipagination.total = res.result.total;
          }else{
            this.ipagination.total = 0;
          }
        } else {
          this.$message.info(res.message);
        }
      })
    }
  },
  computed: {
    importExcelUrl: function(){
      return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
    }
  }
}
</script>

<style scoped>

</style>