|
|
@@ -12,22 +12,34 @@
|
|
|
|
|
|
<el-input
|
|
|
placeholder="搜索"
|
|
|
- suffix-icon="el-icon-search"
|
|
|
- v-model="queryParam"
|
|
|
- @change="debounce(getAllProductInWorkOrder(), 500)"
|
|
|
+ :suffix-icon="productBody.param ? '' : 'el-icon-search'"
|
|
|
+ v-model="productBody.param"
|
|
|
+ @input="handleInput"
|
|
|
+ clearable
|
|
|
></el-input>
|
|
|
|
|
|
<div class="list-box">
|
|
|
- <div class="list-item" v-for="i in 10" :key="i">
|
|
|
- 产品{{ i }}
|
|
|
+ <div
|
|
|
+ class="list-item"
|
|
|
+ v-for="i in productList"
|
|
|
+ :key="i.productName + i.productCode"
|
|
|
+ :class="{ active: i.productName == tableQuery.param }"
|
|
|
+ @click="changeProductName(i)"
|
|
|
+ >
|
|
|
+ {{ i.productName }}
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="left-item">
|
|
|
<div class="title">批次号</div>
|
|
|
- <div class="list-box">
|
|
|
- <div class="list-item" v-for="i in 10" :key="i">
|
|
|
- 产品{{ i }}
|
|
|
+ <div v-if="batchNos.length > 0" class="list-box">
|
|
|
+ <div class="list-item" v-for="i in batchNos" :key="i">
|
|
|
+ <div> {{ i ? i : '暂无批次号' }}</div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div v-else class="list-box">
|
|
|
+ <div class="list-item" style="text-align: center; color: #888">
|
|
|
+ 请先选择产品
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
@@ -39,6 +51,7 @@
|
|
|
v-for="i in types"
|
|
|
:key="i.name"
|
|
|
:class="{ active: activeType == i.name }"
|
|
|
+ @click="changeActiveType(i)"
|
|
|
>
|
|
|
{{ i.name }}
|
|
|
</div>
|
|
|
@@ -51,9 +64,11 @@
|
|
|
<seek-page :seekList="seekList" @search="search"></seek-page>
|
|
|
<ele-pro-table
|
|
|
ref="table"
|
|
|
- row-key="id"
|
|
|
+ row-key="workOrderId"
|
|
|
:columns="columns"
|
|
|
:datasource="datasource"
|
|
|
+ cache-key="batch-record-list"
|
|
|
+ autoAmendPage
|
|
|
>
|
|
|
</ele-pro-table>
|
|
|
</div>
|
|
|
@@ -66,9 +81,10 @@
|
|
|
<script>
|
|
|
import dictMixins from '@/mixins/dictMixins';
|
|
|
import tableColumnsMixin from '@/mixins/tableColumnsMixin';
|
|
|
- import { producetaskrulerecordPage } from '@/api/producetaskrulerecord/index';
|
|
|
import seekPage from '@/components/common/seekPage.vue';
|
|
|
import { getAllProductInWorkOrder } from '@/api/produce/workOrder';
|
|
|
+ import { debounce } from '@/utils/util.js';
|
|
|
+ import { batchRecordPage } from '@/api/workOrderList';
|
|
|
|
|
|
export default {
|
|
|
components: { seekPage },
|
|
|
@@ -76,52 +92,32 @@
|
|
|
mixins: [dictMixins, tableColumnsMixin],
|
|
|
data() {
|
|
|
return {
|
|
|
- seekList: [
|
|
|
- {
|
|
|
- label: '单据编码:',
|
|
|
- value: 'keyWord',
|
|
|
- type: 'input',
|
|
|
- placeholder: ''
|
|
|
- },
|
|
|
- {
|
|
|
- label: '单据名称:',
|
|
|
- value: 'name',
|
|
|
- type: 'input',
|
|
|
- placeholder: ''
|
|
|
- }
|
|
|
- ],
|
|
|
columns: [
|
|
|
{
|
|
|
- width: 45,
|
|
|
+ width: 50,
|
|
|
type: 'index',
|
|
|
columnKey: 'index',
|
|
|
- align: 'center'
|
|
|
+ align: 'center',
|
|
|
+ label: '序号'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'workOrderName',
|
|
|
+ label: '单据名称'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: '',
|
|
|
+ label: '单据编码'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'status',
|
|
|
+ label: '单据状态'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'approveStatus',
|
|
|
+ label: '审核状态'
|
|
|
}
|
|
|
- // {
|
|
|
- // prop: 'username',
|
|
|
- // label: '批记录类型'
|
|
|
- // },
|
|
|
- // {
|
|
|
- // prop: '',
|
|
|
- // label: '单据名称'
|
|
|
- // },
|
|
|
- // {
|
|
|
- // prop: '',
|
|
|
- // label: '单据编码'
|
|
|
- // },
|
|
|
- // {
|
|
|
- // prop: '',
|
|
|
- // label: '单据状态'
|
|
|
- // },
|
|
|
- // {
|
|
|
- // prop: '',
|
|
|
- // label: '审核状态'
|
|
|
- // }
|
|
|
],
|
|
|
types: [
|
|
|
- {
|
|
|
- name: '全部'
|
|
|
- },
|
|
|
{
|
|
|
name: '生产工单'
|
|
|
},
|
|
|
@@ -150,28 +146,93 @@
|
|
|
name: '工艺文件'
|
|
|
}
|
|
|
],
|
|
|
- activeType: '全部',
|
|
|
+ activeType: '生产工单',
|
|
|
// 产品搜索条件
|
|
|
- queryParam: ''
|
|
|
+ productBody: {
|
|
|
+ param: '',
|
|
|
+ pageNum: 1,
|
|
|
+ size: 999
|
|
|
+ },
|
|
|
+ // 批次号
|
|
|
+ batchNos: [],
|
|
|
+ // 产品列表
|
|
|
+ productList: [],
|
|
|
+ tableQuery: {
|
|
|
+ param: '',
|
|
|
+ batchNo: '',
|
|
|
+ type: ''
|
|
|
+ }
|
|
|
};
|
|
|
},
|
|
|
+ computed: {
|
|
|
+ seekList() {
|
|
|
+ return [
|
|
|
+ {
|
|
|
+ label: '单据编码:',
|
|
|
+ value: 'workOrderCode',
|
|
|
+ type: 'input',
|
|
|
+ placeholder: '请输入'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '单据名称:',
|
|
|
+ value: 'workOrderName',
|
|
|
+ type: 'input',
|
|
|
+ placeholder: '请输入'
|
|
|
+ }
|
|
|
+ ];
|
|
|
+ },
|
|
|
+ /* 表格数据源 */
|
|
|
+ datasource({ page, limit, where, order }) {
|
|
|
+ return () => {
|
|
|
+ const body = { ...where, ...order, page, limit, ...this.tableQuery };
|
|
|
+
|
|
|
+ // 根据类型查询不同的api
|
|
|
+ switch (this.activeType) {
|
|
|
+ case '生产工单':
|
|
|
+ return batchRecordPage(body);
|
|
|
+
|
|
|
+ default:
|
|
|
+ return [];
|
|
|
+ }
|
|
|
+ };
|
|
|
+ }
|
|
|
+ },
|
|
|
created() {
|
|
|
- // this.getAllProductInWorkOrder();
|
|
|
+ this.getAllProductInWorkOrder();
|
|
|
},
|
|
|
methods: {
|
|
|
- /* 表格数据源 */
|
|
|
- datasource({ page, limit, where, order }) {
|
|
|
- // return pageUsers({ ...where, ...order, page, limit });
|
|
|
- return [];
|
|
|
+ reload(where) {
|
|
|
+ this.$refs.table.reload({
|
|
|
+ where,
|
|
|
+ ...this.tableQuery
|
|
|
+ });
|
|
|
},
|
|
|
+ // 刷新表格数据
|
|
|
search(where) {
|
|
|
- this.$refs.table.reload(where);
|
|
|
+ this.reload(where);
|
|
|
},
|
|
|
// 获取产品和批次号
|
|
|
async getAllProductInWorkOrder() {
|
|
|
- const data = await getAllProductInWorkOrder({
|
|
|
- queryParam: this.queryParam
|
|
|
- });
|
|
|
+ const { list } = await getAllProductInWorkOrder(this.productBody);
|
|
|
+ this.productList = list;
|
|
|
+ console.log('this.productList', this.productList);
|
|
|
+ },
|
|
|
+ // 搜索产品
|
|
|
+ handleInput: debounce(function (e) {
|
|
|
+ this.getAllProductInWorkOrder();
|
|
|
+ }, 500),
|
|
|
+ // 选择产品
|
|
|
+ changeProductName(i) {
|
|
|
+ this.tableQuery.param = i.productName;
|
|
|
+ // 设置批次号
|
|
|
+ this.batchNos = i.batchNos;
|
|
|
+ // 刷新表格
|
|
|
+ this.reload();
|
|
|
+ },
|
|
|
+ // 选择批记录类型
|
|
|
+ changeActiveType(i) {
|
|
|
+ this.activeType = i.name;
|
|
|
+ this.reload();
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
@@ -197,12 +258,16 @@
|
|
|
|
|
|
.list-box {
|
|
|
margin-top: 10px;
|
|
|
+ max-height: 80vh;
|
|
|
+ overflow-y: auto;
|
|
|
+ box-sizing: border-box;
|
|
|
|
|
|
.list-item {
|
|
|
padding: 15px 10px;
|
|
|
border-bottom: 1px solid #ededed;
|
|
|
font-size: 14px;
|
|
|
cursor: pointer;
|
|
|
+ word-break: break-all;
|
|
|
}
|
|
|
|
|
|
.active {
|