|
|
@@ -8,40 +8,52 @@
|
|
|
<el-tabs v-model="activeName" @tab-click="handleClick">
|
|
|
<!-- -->
|
|
|
<el-tab-pane label="来源清单" name="1">
|
|
|
- <el-table v-if="packingList.length > 0" ref="showPackingListTable" :data="paginatedPackingList"
|
|
|
- tooltip-effect="dark" :max-height="300" border row-key="id"
|
|
|
- @selection-change="$emit('selection-change', $event)">
|
|
|
- <el-table-column type="selection" width="55" align="center" :reserve-selection="true"
|
|
|
- :selectable="checkSelectable"></el-table-column>
|
|
|
- <el-table-column label="序号" type="index" width="50" align="center"></el-table-column>
|
|
|
- <template v-for="column in tableColumns">
|
|
|
- <el-table-column :label="column.label" :prop="column.prop" :show-overflow-tooltip="true"
|
|
|
- :width="column.width" :align="column.align"></el-table-column>
|
|
|
+ <ele-pro-table ref="sourceTable" :columns="tableColumns1" :datasource="datasource"
|
|
|
+ @selection-change="$emit('selection-change', $event)" :initLoad="false" :pagination="true">
|
|
|
+
|
|
|
+ <template v-slot:toolbar v-if="form.qualityMode == 2">
|
|
|
+ <el-dropdown trigger="click" @command="handleSampleNumber">
|
|
|
+ <el-link type="primary" icon="el-icon-plus">取样</el-link>
|
|
|
+ <el-dropdown-menu slot="dropdown">
|
|
|
+ <el-dropdown-item command="1">取整样</el-dropdown-item>
|
|
|
+ <el-dropdown-item command="2">取小样</el-dropdown-item>
|
|
|
+ </el-dropdown-menu>
|
|
|
+ </el-dropdown>
|
|
|
</template>
|
|
|
- <el-table-column label="物料代号" prop="materielDesignation" align="center" width="100" :show-overflow-tooltip="true">
|
|
|
- <template slot-scope="scope">
|
|
|
- <span>{{scope.row.materielDesignation}}</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column label="客户代号" prop="clientCode" align="center" width="100" :show-overflow-tooltip="true">
|
|
|
- <template slot-scope="scope">
|
|
|
- <span>{{scope.row.clientCode}}</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column label="刻码" prop="engrave" align="center" width="100" :show-overflow-tooltip="true">
|
|
|
- <template slot-scope="scope">
|
|
|
- <span>{{scope.row.engrave}}</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column label="重量" prop="weight" align="center" width="100" :show-overflow-tooltip="true">
|
|
|
- <template slot-scope="scope">
|
|
|
- <span>{{scope.row.weight}}</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- </el-table>
|
|
|
- <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
|
|
|
- :current-page="pagination.currentPage" :page-sizes="[10, 20, 50, 100]" :page-size="pagination.pageSize"
|
|
|
- layout="total, sizes, prev, pager, next" :total="packingList.length" style="margin-top: 16px" />
|
|
|
+ <template v-slot:toolkit v-if="conditionType == 2">
|
|
|
+ <div>
|
|
|
+ <div style="display: flex;align-items: center;">
|
|
|
+ <el-input v-model="formData.number" style="width: 120px;" placeholder="请输入" size="mini"
|
|
|
+ @change="handleInputNumber"></el-input>
|
|
|
+ <DictSelection dictName="计量单位" clearable v-model="formData.sampleUnit" size="mini"
|
|
|
+ style="width: 120px;margin-left: 12px;" @change="changeSamUnit">
|
|
|
+ </DictSelection>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div>
|
|
|
+ <div style="margin-left: 12px;display: flex;align-items: center;">
|
|
|
+ <div>数量:</div>
|
|
|
+ <el-input v-model="formData.portion" style="width: 120px;margin:0 12px;" placeholder="请输入" size="mini"
|
|
|
+ @change="handleInput" :disabled="conditionType == 1"></el-input>
|
|
|
+ <el-button type="primary" size="mini" @click="handleSampleSubmit"
|
|
|
+ style="margin-right: 12px;">确认</el-button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <template v-slot:materielDesignation="{ row }">
|
|
|
+ <el-input v-model="row.materielDesignation" placeholder="请输入"></el-input>
|
|
|
+ </template>
|
|
|
+ <template v-slot:clientCode="{ row }">
|
|
|
+ <el-input v-model="row.clientCode" placeholder="请输入"></el-input>
|
|
|
+ </template>
|
|
|
+ <template v-slot:engrave="{ row }">
|
|
|
+ <el-input v-model="row.engrave" placeholder="请输入"></el-input>
|
|
|
+ </template>
|
|
|
+ <template v-slot:weight="{ row }">
|
|
|
+ <el-input v-model="row.weight" placeholder="请输入"></el-input>
|
|
|
+ </template>
|
|
|
+ </ele-pro-table>
|
|
|
</el-tab-pane>
|
|
|
<!-- -->
|
|
|
<el-tab-pane label="样品清单" name="2">
|
|
|
@@ -57,32 +69,26 @@
|
|
|
{{ scope.row.categoryCode }}
|
|
|
</el-link>
|
|
|
</template>
|
|
|
+ <template v-else-if="column.prop === 'materielDesignation'">
|
|
|
+ <el-input :disabled="scope.row.isMaterielDesignationEmpty"
|
|
|
+ v-model="scope.row.materielDesignation"></el-input>
|
|
|
+ </template>
|
|
|
+ <template v-else-if="column.prop === 'clientCode'">
|
|
|
+ <el-input :disabled="scope.row.isClientCodeEmpty" v-model="scope.row.clientCode"></el-input>
|
|
|
+ </template>
|
|
|
+ <template v-else-if="column.prop === 'engrave'">
|
|
|
+ <el-input :disabled="scope.row.isEngraveEmpty" v-model="scope.row.engrave"></el-input>
|
|
|
+ </template>
|
|
|
+ <template v-else-if="column.prop === 'weight'">
|
|
|
+ <el-input type="number" v-model="scope.row.weight" :min="0"
|
|
|
+ @input="inputWeight(scope.row, scope.$index)"></el-input>
|
|
|
+ </template>
|
|
|
<template v-else>
|
|
|
{{ scope.row[column.prop] }}
|
|
|
</template>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</template>
|
|
|
- <el-table-column label="物料代号" prop="materielDesignation" align="center" width="100" fixed="right" :show-overflow-tooltip="true">
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-input :disabled="scope.row.isMaterielDesignationEmpty" v-model="scope.row.materielDesignation" ></el-input>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column label="客户代号" prop="clientCode" align="center" width="100" fixed="right" :show-overflow-tooltip="true">
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-input :disabled="scope.row.isClientCodeEmpty" v-model="scope.row.clientCode" ></el-input>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column label="刻码" prop="engrave" align="center" width="100" fixed="right" :show-overflow-tooltip="true">
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-input :disabled="scope.row.isEngraveEmpty" v-model="scope.row.engrave" ></el-input>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column label="重量" prop="weight" align="center" width="100" fixed="right" :show-overflow-tooltip="true">
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-input type="number" v-model="scope.row.weight" :min="0" @input="inputWeight(scope.row, scope.$index)"></el-input>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
<el-table-column label="处置状态" prop="disposalStatus" align="center" width="80" fixed="right"
|
|
|
:show-overflow-tooltip="true">
|
|
|
<template slot-scope="scope">
|
|
|
@@ -156,6 +162,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import { save, update, getById, exeReportWork, queryQualitySamplContent, queryQualityTempleContent, queryQualityInventory } from '@/api/inspectionWork';
|
|
|
export default {
|
|
|
props: {
|
|
|
type: String,
|
|
|
@@ -163,12 +170,12 @@ export default {
|
|
|
sampleList: Array,
|
|
|
schemeList: Array,
|
|
|
loading: Boolean,
|
|
|
- form: Object
|
|
|
+ form: Object,
|
|
|
+ ids: String
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
activeName: '2',
|
|
|
- pagination: { currentPage: 1, pageSize: 10 },
|
|
|
samplePagination: { currentPage: 1, pageSize: 10 },
|
|
|
schemePagination: { currentPage: 1, pageSize: 10 },
|
|
|
|
|
|
@@ -181,6 +188,14 @@ export default {
|
|
|
label: '不合格'
|
|
|
}],
|
|
|
tableColumns: [
|
|
|
+ {
|
|
|
+ columnKey: 'index',
|
|
|
+ label: '序号',
|
|
|
+ type: 'index',
|
|
|
+ width: 55,
|
|
|
+ align: 'center',
|
|
|
+ fixed: 'left'
|
|
|
+ },
|
|
|
{
|
|
|
label: '编码',
|
|
|
prop: 'categoryCode',
|
|
|
@@ -201,12 +216,12 @@ export default {
|
|
|
{ label: '包装单位', prop: 'packingUnit', align: 'center' },
|
|
|
{ label: '计量数量', prop: 'measureQuantity', align: 'center' },
|
|
|
{ label: '计量单位', prop: 'measureUnit', align: 'center' },
|
|
|
- { label: '供应商名称', prop: 'supplierName', align: 'center' ,width: '120' },
|
|
|
- { label: '供应商代号', prop: 'supplierCode', align: 'center' ,width: '120'},
|
|
|
- // { label: '物料代号', prop: 'materielDesignation', align: 'center' },
|
|
|
- // { label: '客户代号', prop: 'clientCode', align: 'center' },
|
|
|
- // { label: '刻码', prop: 'engrave', align: 'center' },
|
|
|
- // { label: '重量', prop: 'weight', align: 'center', width: "100" },
|
|
|
+ { label: '供应商名称', prop: 'supplierName', align: 'center', width: '120' },
|
|
|
+ { label: '供应商代号', prop: 'supplierCode', align: 'center', width: '120' },
|
|
|
+ { label: '物料代号', prop: 'materielDesignation', align: 'center', slot: 'materielDesignation', width: '120' },
|
|
|
+ { label: '客户代号', prop: 'clientCode', align: 'center', slot: 'clientCode', width: '120' },
|
|
|
+ { label: '刻码', prop: 'engrave', align: 'center', slot: 'engrave', width: '120' },
|
|
|
+ { label: '重量', prop: 'weight', align: 'center', slot: 'weight', width: '120' },
|
|
|
{ label: '重量单位', prop: 'weightUnit', align: 'center', width: "100" },
|
|
|
{ label: '仓库', prop: 'warehouseName', align: 'center' },
|
|
|
{ label: '货区', prop: 'areaName', align: 'center' },
|
|
|
@@ -216,15 +231,94 @@ export default {
|
|
|
{ label: '采购日期', prop: 'purchaseDate', align: 'center' },
|
|
|
],
|
|
|
|
|
|
+ conditionType: null,
|
|
|
+ formData: {
|
|
|
+ number: 1,
|
|
|
+ sampleUnit: '',
|
|
|
+ portion: null
|
|
|
+ },
|
|
|
}
|
|
|
},
|
|
|
|
|
|
computed: {
|
|
|
- paginatedPackingList() {
|
|
|
- const start =
|
|
|
- (this.pagination.currentPage - 1) * this.pagination.pageSize;
|
|
|
- const end = start + this.pagination.pageSize;
|
|
|
- return this.packingList.slice(start, end);
|
|
|
+ tableColumns1() {
|
|
|
+ let arr = [
|
|
|
+ // (this.btnType !== 'issued' || this.baseForm.qualityMode === 2)
|
|
|
+ // ? {
|
|
|
+ // columnKey: 'selection',
|
|
|
+ // type: 'selection',
|
|
|
+ // width: 45,
|
|
|
+ // align: 'center'
|
|
|
+ // }
|
|
|
+ // : null,
|
|
|
+ {
|
|
|
+ columnKey: 'selection',
|
|
|
+ type: 'selection',
|
|
|
+ width: 45,
|
|
|
+ align: 'center'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ columnKey: 'index',
|
|
|
+ label: '序号',
|
|
|
+ type: 'index',
|
|
|
+ width: 55,
|
|
|
+ align: 'center',
|
|
|
+ fixed: 'left'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '编码',
|
|
|
+ prop: 'categoryCode',
|
|
|
+ width: 150,
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '名称',
|
|
|
+ prop: 'categoryName',
|
|
|
+ width: '150',
|
|
|
+ align: 'center',
|
|
|
+ width: 120,
|
|
|
+ showOverflowTooltip: true
|
|
|
+ },
|
|
|
+ { label: '批次号', prop: 'batchNo', align: 'center', width: 120, },
|
|
|
+ { label: '发货条码', prop: 'barcodes', align: 'center' },
|
|
|
+ {
|
|
|
+ label: '包装编码', prop: 'packageNo', align: 'center',
|
|
|
+ width: 120,
|
|
|
+ showOverflowTooltip: true
|
|
|
+ },
|
|
|
+ { label: '包装数量', prop: 'packingQuantity', align: 'center' },
|
|
|
+ { label: '包装单位', prop: 'packingUnit', align: 'center' },
|
|
|
+ { label: '计量数量', prop: 'measureQuantity', align: 'center' },
|
|
|
+ { label: '计量单位', prop: 'measureUnit', align: 'center' },
|
|
|
+ { label: '物料代号', prop: 'materielDesignation', align: 'center' },
|
|
|
+ { label: '客户代号', prop: 'clientCode', align: 'center' },
|
|
|
+ { label: '供应商名称', prop: 'supplierName', align: 'center', width: 120, showOverflowTooltip: true },
|
|
|
+ { label: '供应商代号', prop: 'supplierCode', align: 'center', width: '120' },
|
|
|
+ { label: '刻码', prop: 'engrave', align: 'center' },
|
|
|
+ { label: '重量', prop: 'weight', align: 'center' },
|
|
|
+ { label: '重量单位', prop: 'weightUnit', align: 'center' },
|
|
|
+ {
|
|
|
+ label: '仓库', prop: 'warehouseName', align: 'center',
|
|
|
+ width: 120,
|
|
|
+ showOverflowTooltip: true
|
|
|
+ },
|
|
|
+ { label: '货区', prop: 'areaName', align: 'center' },
|
|
|
+ { label: '货架', prop: 'goodsShelfName', align: 'center' },
|
|
|
+ { label: '货位', prop: 'goodsAllocationName', align: 'center' },
|
|
|
+ {
|
|
|
+ label: '生产日期', prop: 'productionDate', align: 'center',
|
|
|
+ width: 120,
|
|
|
+ showOverflowTooltip: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '采购日期', prop: 'purchaseDate', align: 'center',
|
|
|
+ width: 120,
|
|
|
+ showOverflowTooltip: true
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ return arr
|
|
|
+
|
|
|
},
|
|
|
// 分页后的样品列表
|
|
|
paginatedSampleList() {
|
|
|
@@ -241,10 +335,122 @@ export default {
|
|
|
return this.schemeList?.slice(start, end);
|
|
|
}
|
|
|
},
|
|
|
+ created() {
|
|
|
+ this.reload({ qualityWorkerId: this.ids });
|
|
|
+ },
|
|
|
methods: {
|
|
|
+ async datasource({ page, limit, where }) {
|
|
|
+ const res = await queryQualityInventory({ ...where, page, limit });
|
|
|
+ return res;
|
|
|
+ },
|
|
|
+
|
|
|
+ reload(where) {
|
|
|
+ this.$nextTick(() => {
|
|
|
+ if (this.$refs.sourceTable && this.$refs.sourceTable.reload)
|
|
|
+ this.$refs.sourceTable.reload({ page: 1, where: where });
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ tableSelClear() {
|
|
|
+ console.log('清空勾选')
|
|
|
+ this.$refs.sourceTable.clearSelection();
|
|
|
+ },
|
|
|
+
|
|
|
+ handleSampleNumber(val) {
|
|
|
+ console.log(val, 'val')
|
|
|
+ this.conditionType = val;
|
|
|
+
|
|
|
+ //取整样
|
|
|
+ let data = this.$refs.sourceTable.getData()
|
|
|
+ if (val == 1) {
|
|
|
+ console.log(data, 'data12345678901234567890123456789012345678901234567890123456789')
|
|
|
+ this.formData.portion = data.length
|
|
|
+ this.$refs.sourceTable.toggleAllSelection();
|
|
|
+ this.activeName = '2'
|
|
|
+ this.$emit('handleSample1', val, data)
|
|
|
+ } else if (val == 2) {
|
|
|
+ this.tableSelClear();
|
|
|
+ this.$emit('handleSample1', val, data)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ handleInputNumber(val) {
|
|
|
+ let packingList = this.$refs.sourceTable.getData()
|
|
|
+ if (packingList.length > 1) {
|
|
|
+ if (val > packingList.length) {
|
|
|
+ this.$message.warning('数量不能大于来源清单数量!');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (packingList.length == 1) {
|
|
|
+ if (val > packingList[0].measureQuantity) {
|
|
|
+ this.$message.warning('数量不能大于计量数量!');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ handleInput() {
|
|
|
+ if (this.formData.portion == null || this.formData.portion == '' || this.formData.portion == 0) {
|
|
|
+ this.$message.warning('生成取样数量不能为空!');
|
|
|
+ this.tableSelClear();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ let packingList = this.$refs.sourceTable.getData()
|
|
|
+
|
|
|
+ if (packingList.length > 1) {
|
|
|
+ if (this.formData.portion > packingList.length) {
|
|
|
+ this.$message.warning('取样数量不能大于来源清单数量!');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const rows = packingList.slice(0, this.formData.portion);
|
|
|
+ rows.forEach((row) => {
|
|
|
+ this.$refs.sourceTable.toggleRowSelection(row);
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ if (this.formData.portion > packingList[0].measureQuantity) {
|
|
|
+ this.$message.warning('取样数量不能大于计量数量!');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ changeSamUnit(val) {
|
|
|
+ console.log(val, 'dddd')
|
|
|
+ this.$emit('changeSamUnit', val)
|
|
|
+ },
|
|
|
+ handleSampleSubmit() {
|
|
|
+ if (this.formData.portion == null || this.formData.portion == 0) {
|
|
|
+ this.$message.warning('生成取样数量不能为空!');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ //取小样 赋值右上角单位
|
|
|
+ this.changeSamUnit(this.formData.sampleUnit)
|
|
|
+
|
|
|
+ console.log(this.formData.number, 'this.formData.number')
|
|
|
+ console.log(this.formData.sampleUnit, 'this.formData.sampleUnit')
|
|
|
+
|
|
|
+ if (this.formData.number == null || this.formData.sampleUnit == '') {
|
|
|
+ this.$message.warning('请先选择取样的数量和单位!');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ let params = {
|
|
|
+ conditionType: this.conditionType,
|
|
|
+ measureQ: this.formData.number,
|
|
|
+ sampleUnit: this.formData.sampleUnit,
|
|
|
+ portion: this.formData.portion
|
|
|
+ }
|
|
|
+ this.$emit('handleSampleSubmit', params)
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
handleClick(tab) {
|
|
|
+ console.log(tab, 'tab')
|
|
|
this.activeName = tab.name
|
|
|
},
|
|
|
+ tabsChange(val) {
|
|
|
+ this.activeName = val
|
|
|
+ },
|
|
|
checkSelectable(row, index) {
|
|
|
// 只有当质检方式为抽检(qualityMode=2)时 类型不是生产检验 才可选
|
|
|
return this.form.qualityType != 2 && this.form.qualityMode === 2;
|
|
|
@@ -258,14 +464,6 @@ export default {
|
|
|
handleDispose(index, row, type) {
|
|
|
this.$emit('handleDispose', index, row, type)
|
|
|
},
|
|
|
- // 分页方法
|
|
|
- handleSizeChange(val) {
|
|
|
- this.pagination.pageSize = val;
|
|
|
- this.pagination.currentPage = 1;
|
|
|
- },
|
|
|
- handleCurrentChange(val) {
|
|
|
- this.pagination.currentPage = val;
|
|
|
- },
|
|
|
handleSampleSizeChange(val) {
|
|
|
this.samplePagination.pageSize = val;
|
|
|
this.samplePagination.currentPage = 1;
|