|
|
@@ -3,118 +3,25 @@
|
|
|
<el-card shadow="never">
|
|
|
<header-title title="基本信息">
|
|
|
<el-button @click="cancel">返回</el-button>
|
|
|
- <el-button type="primary" @click="save" :loading="loading">保存</el-button>
|
|
|
- <el-button type="primary" @click="handleReporting" :loading="loading">报工完成</el-button>
|
|
|
+ <el-button type="primary" @click="save" :loading="loading" v-if="type != 'detail'">保存</el-button>
|
|
|
+ <el-button type="primary" @click="handleReporting" :loading="loading" v-if="type != 'detail'">报工完成</el-button>
|
|
|
</header-title>
|
|
|
- <base-info ref="baseInfoRefs" v-if="form" :form="form" :btnType="type"></base-info>
|
|
|
- <el-row>
|
|
|
- <header-title title="质检内容">
|
|
|
- <el-button type="primary" :loading="loading" @click="batchQuality(null,null,'report')">批量质检</el-button>
|
|
|
- </header-title>
|
|
|
- <el-tabs v-model="activeName" @tab-click="handleClick">
|
|
|
- <el-tab-pane label="来源清单" name="1"></el-tab-pane>
|
|
|
- <el-tab-pane label="样品清单" name="2"></el-tab-pane>
|
|
|
- <el-tab-pane label="质检方案" name="3"></el-tab-pane>
|
|
|
- </el-tabs>
|
|
|
- </el-row>
|
|
|
- <el-row style="margin-top: 24px">
|
|
|
- <el-table v-show="activeName === '1'" v-if="packingList.length > 0" ref="showPackingListTable"
|
|
|
- :data="paginatedPackingList" tooltip-effect="dark" :max-height="300" border row-key="id">
|
|
|
- <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>
|
|
|
- </template>
|
|
|
- </el-table>
|
|
|
- <!-- -->
|
|
|
- <el-table v-show="activeName === '2'" v-if="sampleList.length > 0" ref="showSampleListTable"
|
|
|
- :data="paginatedSampleList" tooltip-effect="dark" :max-height="300" border row-key="id"
|
|
|
- @selection-change="handleSelectionChange">
|
|
|
- <el-table-column type="selection" width="55" align="center" fixed="left"></el-table-column>
|
|
|
- <el-table-column label="序号" type="index" width="50" align="center" fixed="left"></el-table-column>
|
|
|
-
|
|
|
- <template v-for="column in tableColumns">
|
|
|
- <el-table-column :key="column.prop" :label="column.label" :prop="column.prop" :fixed="column.fixed" :show-overflow-tooltip="true"
|
|
|
- :width="column.width" :align="column.align">
|
|
|
- <template slot-scope="scope">
|
|
|
- <template v-if="column.prop === 'categoryCode'">
|
|
|
- <el-link type="primary" :underline="false" @click="handleDetail(scope.$index, scope.row, 'detail')">
|
|
|
- {{ scope.row.categoryCode }}
|
|
|
- </el-link>
|
|
|
- </template>
|
|
|
-<!-- <template v-else-if="column.prop === 'weight'">-->
|
|
|
-<!-- <el-input v-model="scope.row.weight"></el-input>-->
|
|
|
-<!-- </template>-->
|
|
|
- <template v-else>
|
|
|
- {{ scope.row[column.prop] }}
|
|
|
- </template>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- </template>
|
|
|
- <el-table-column label="重量" prop="weight" align="center" width="100" fixed="right">
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-input type="number" v-model="scope.row.weight" :min="0"></el-input>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column label="重量单位" prop="weightUnit" align="center" width="80" fixed="right"></el-table-column>
|
|
|
- <el-table-column label="质检状态" prop="qualityStatus" align="center" width="120" fixed="right">
|
|
|
- <template slot-scope="scope">
|
|
|
- <span v-if="scope.row.qualityStatus == 0 ">未质检</span>
|
|
|
- <span v-if="scope.row.qualityStatus == 1 ">已质检</span>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column label="质检结果" prop="qualityResults" align="center" width="120" fixed="right">
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-select v-model="scope.row.qualityResults" placeholder="请选择" style="width: 100%;"
|
|
|
- :disabled="type == 'detail'" size="mini">
|
|
|
- <el-option v-for="item in qualityResultsList" :key="item.value" :label="item.label" :value="item.value">
|
|
|
- </el-option>
|
|
|
- </el-select>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column label="操作" align="center" width="120" fixed="right">
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-link :type="scope.row.isValid ? 'primary' : 'danger'" :underline="false"
|
|
|
- @click="handleDetail(scope.$index, scope.row, 'report')">
|
|
|
- 质检
|
|
|
- </el-link>
|
|
|
- <el-link type='primary' :underline="false"> 处置 </el-link>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- </el-table>
|
|
|
- <el-pagination v-show="activeName === '2'" v-if="sampleList" @size-change="handleSampleSizeChange"
|
|
|
- @current-change="handleSampleCurrentChange" :current-page="samplePagination.currentPage"
|
|
|
- :page-sizes="[10, 20, 50, 100]" :page-size="samplePagination.pageSize"
|
|
|
- layout="total, sizes, prev, pager, next, jumper" :total="sampleList.length"
|
|
|
- style="margin-top: 10px"></el-pagination>
|
|
|
-
|
|
|
- <!-- -->
|
|
|
- <el-table v-show="activeName === '3'" ref="showSchemeListTable" :data="paginatedSchemeList"
|
|
|
- tooltip-effect="dark" :max-height="300" border row-key="id">
|
|
|
- <el-table-column label="序号" type="index" width="50" align="center"></el-table-column>
|
|
|
- <el-table-column label="质检方案编码" prop="qualitySchemeTemplateCode" align="center">
|
|
|
- </el-table-column>
|
|
|
- <el-table-column label="质检方案名称" prop="qualitySchemeTemplateName" align="center"></el-table-column>
|
|
|
- <el-table-column label="质检类型" prop="categoryLevelClassName" align="center"></el-table-column>
|
|
|
- <el-table-column label="质检项编码" prop="inspectionCode" align="center"></el-table-column>
|
|
|
- <el-table-column label="质检项名称" prop="inspectionName" align="center"></el-table-column>
|
|
|
- <el-table-column label="工艺参数" prop="defaultValue" align="center">
|
|
|
- </el-table-column>
|
|
|
- </el-table>
|
|
|
- <el-pagination v-show="activeName === '3'" @size-change="handleSchemeSizeChange"
|
|
|
- @current-change="handleSchemeCurrentChange" :current-page="schemePagination.currentPage"
|
|
|
- :page-sizes="[10, 20, 50, 100]" :page-size="schemePagination.pageSize"
|
|
|
- layout="total, sizes, prev, pager, next, jumper" :total="schemeList.length"
|
|
|
- style="margin-top: 10px"></el-pagination>
|
|
|
- </el-row>
|
|
|
+ <base-info ref="baseInfoRefs" v-if="form" :form="form" :btnType="type" :qualityType1="qualityType"
|
|
|
+ @changeModel="changeModel" @changeNumber="changeNumber"></base-info>
|
|
|
+
|
|
|
+ <quality-content-tabs :type="type" :packing-list="packingList" :sample-list="sampleList" :scheme-list="schemeList"
|
|
|
+ :loading="loading" :form="form" @selection-change="handleSelectionChange1" @batch-quality="batchQuality"
|
|
|
+ @handleDetail="handleDetail" @inputWeight="inputWeight" @handleDispose="handleDispose" />
|
|
|
</el-card>
|
|
|
|
|
|
- <sampleListDialog ref="detailRef" @handleConfirm="handleConfirm"></sampleListDialog>
|
|
|
+ <sampleListDialog ref="detailRef" @handleConfirm="handleConfirm" @handleDispose="handleDispose"></sampleListDialog>
|
|
|
+ <sampleDisposeDialog ref="disposeRef" @handleDisposeConfirm="handleDisposeConfirm"></sampleDisposeDialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import baseInfo from './components/baseInfo.vue';
|
|
|
+import QualityContentTabs from './components/QualityContentTabs.vue'
|
|
|
|
|
|
import { getCode } from '@/api/login';
|
|
|
import { save, update, getById, exeReportWork, queryQualitySamplContent, queryQualityTempleContent, queryQualityInventory } from '@/api/inspectionWork';
|
|
|
@@ -123,13 +30,15 @@ import dictMixins from '@/mixins/dictMixins';
|
|
|
|
|
|
// import term from './term';
|
|
|
import sampleListDialog from './components/sampleListDialog.vue';
|
|
|
+import sampleDisposeDialog from './components/sampleDisposeDialog.vue';
|
|
|
|
|
|
import { finishPageTab } from '@/utils/page-tab-util';
|
|
|
export default {
|
|
|
components: {
|
|
|
baseInfo,
|
|
|
- // term
|
|
|
- sampleListDialog
|
|
|
+ QualityContentTabs,
|
|
|
+ sampleListDialog,
|
|
|
+ sampleDisposeDialog
|
|
|
},
|
|
|
mixins: [dictMixins],
|
|
|
|
|
|
@@ -137,7 +46,7 @@ export default {
|
|
|
const defaultForm = function () {
|
|
|
return {
|
|
|
code: '',
|
|
|
- qualityType: '',
|
|
|
+ qualityType: null,
|
|
|
qualityModeproduceRoutingId: '',
|
|
|
produceRoutingName: '',
|
|
|
produceTaskId: '',
|
|
|
@@ -162,6 +71,8 @@ export default {
|
|
|
totalWeight: '',
|
|
|
sampleNumber: '',
|
|
|
imgUrl: [],
|
|
|
+ qualityTimeStart: '',
|
|
|
+ qualityTimeEnd: '',
|
|
|
};
|
|
|
};
|
|
|
return {
|
|
|
@@ -177,75 +88,17 @@ export default {
|
|
|
loading: false,
|
|
|
|
|
|
tabTaskId: null,
|
|
|
- activeName: '2',
|
|
|
- qualityResultsList: [{
|
|
|
- value: 1,
|
|
|
- label: '合格'
|
|
|
- },
|
|
|
- {
|
|
|
- value: 2,
|
|
|
- label: '不合格'
|
|
|
- },
|
|
|
- {
|
|
|
- value: 3,
|
|
|
- label: '让步接收'
|
|
|
- }],
|
|
|
- tableColumns: [
|
|
|
- {
|
|
|
- label: '编码',
|
|
|
- prop: 'categoryCode',
|
|
|
- width: '160',
|
|
|
- align: 'center',
|
|
|
- fixed:'left'
|
|
|
- },
|
|
|
- {
|
|
|
- label: '名称',
|
|
|
- prop: 'categoryName',
|
|
|
- width: '150',
|
|
|
- align: 'center'
|
|
|
- },
|
|
|
- { label: '批次号', prop: 'batchNo', align: 'center' },
|
|
|
- { label: '发货条码', prop: 'barcodes', align: 'center' },
|
|
|
- { label: '包装编码', prop: 'packageNo', align: 'center' },
|
|
|
- { 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: 'engrave', align: 'center' },
|
|
|
- // { label: '重量', prop: 'weight', align: 'center' },
|
|
|
- // { label: '重量单位', prop: 'weightUnit', align: 'center' },
|
|
|
- { label: '仓库', prop: 'warehouseName', align: 'center' },
|
|
|
- { label: '货区', prop: 'areaName', align: 'center' },
|
|
|
- { label: '货架', prop: 'goodsShelfName', align: 'center' },
|
|
|
- { label: '货位', prop: 'goodsAllocationName', align: 'center' },
|
|
|
- { label: '生产日期', prop: 'productionDate', align: 'center' },
|
|
|
- { label: '采购日期', prop: 'purchaseDate', align: 'center' },
|
|
|
- ],
|
|
|
+ // activeName: '2',
|
|
|
|
|
|
- packingList: [],
|
|
|
- pagination: {
|
|
|
- currentPage: 1,
|
|
|
- pageSize: 10,
|
|
|
- total: 0
|
|
|
- },
|
|
|
|
|
|
+ packingList: [],
|
|
|
sampleList: [],
|
|
|
- samplePagination: {
|
|
|
- currentPage: 1,
|
|
|
- pageSize: 10,
|
|
|
- total: 0
|
|
|
- },
|
|
|
schemeList: [],
|
|
|
- schemePagination: {
|
|
|
- currentPage: 1,
|
|
|
- pageSize: 10,
|
|
|
- total: 0
|
|
|
- },
|
|
|
+
|
|
|
isValid: true,
|
|
|
isStatus: true,
|
|
|
SampleListbyReportList: [],
|
|
|
+ qualityTimeStart: ''
|
|
|
|
|
|
};
|
|
|
},
|
|
|
@@ -256,33 +109,11 @@ export default {
|
|
|
this.getDetail();
|
|
|
} else {
|
|
|
this.form = { ...defaultForm() };
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
},
|
|
|
- computed: {
|
|
|
- paginatedPackingList() {
|
|
|
- const start =
|
|
|
- (this.pagination.currentPage - 1) * this.pagination.pageSize;
|
|
|
- const end = start + this.pagination.pageSize;
|
|
|
- return this.packingList.slice(start, end);
|
|
|
- },
|
|
|
- // 分页后的样品列表
|
|
|
- paginatedSampleList() {
|
|
|
- const { currentPage, pageSize } = this.samplePagination;
|
|
|
- const start = (currentPage - 1) * pageSize;
|
|
|
- const end = start + pageSize;
|
|
|
- return this.sampleList?.slice(start, end);
|
|
|
- },
|
|
|
- // 分页后的质检方案列表
|
|
|
- paginatedSchemeList() {
|
|
|
- const { currentPage, pageSize } = this.schemePagination;
|
|
|
- const start = (currentPage - 1) * pageSize;
|
|
|
- const end = start + pageSize;
|
|
|
- return this.schemeList?.slice(start, end);
|
|
|
- }
|
|
|
- },
|
|
|
+
|
|
|
created() {
|
|
|
this.open()
|
|
|
if (this.$route.query.id) {
|
|
|
@@ -290,20 +121,201 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ //切换检验方式
|
|
|
+ changeModel(val,flag) {
|
|
|
+ debugger
|
|
|
+ this.form.qualityMode = val;
|
|
|
+ //检验方式 全检
|
|
|
+ if (this.form.qualityMode == 1) {
|
|
|
+ this.form.sampleNumber = ''
|
|
|
+ if (this.schemeList.length == 0) {
|
|
|
+ for (let i = 0; i < this.packingList.length; i++) {
|
|
|
+ console.log(this.packingList[i], 'selection[i]')
|
|
|
+ this.$set(this.packingList[i], 'qualityStatus', 2)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.getProSamList(this.packingList)
|
|
|
+
|
|
|
+ } else {
|
|
|
+ if (!flag){
|
|
|
+ this.sampleList = [];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //根据类型判断样品清单现实列表数据
|
|
|
+ getProSamList(list) {
|
|
|
+ //生产检验
|
|
|
+ if (this.qualityType == '2' ) {
|
|
|
+ if (this.form.qualityMode != null){
|
|
|
+ const ProductSampleList = [];
|
|
|
+ console.log(list, 'list')
|
|
|
+ list.forEach(oldItem => {
|
|
|
+ const count = oldItem.measureQuantity;
|
|
|
+ const newMeasureQuantity = oldItem.measureQuantity / count;
|
|
|
+ const newWeight = parseFloat((oldItem.weight / count).toFixed(2))
|
|
|
+
|
|
|
+ console.log(typeof (oldItem.qualitySampleTemplateList), 'ssssss')
|
|
|
+
|
|
|
+ // 遍历新数组设置 qualityResults 默认值
|
|
|
+ this.schemeList.forEach(item => {
|
|
|
+ if (typeof item === 'object' && item !== null) {
|
|
|
+ item.qualityResults = 1; // 设置默认值
|
|
|
+ }
|
|
|
+ delete item.id;
|
|
|
+ });
|
|
|
+
|
|
|
+ console.log(oldItem, 'oldItem')
|
|
|
+ console.log(count, newMeasureQuantity, newWeight)
|
|
|
+ delete oldItem.id;
|
|
|
|
|
|
- handleSelectionChange(val) {
|
|
|
- console.log(val, '选中数据')
|
|
|
+ if (oldItem.qualitySampleTemplateList == undefined || oldItem.qualitySampleTemplateList == null || oldItem.qualitySampleTemplateList.length == 0) {
|
|
|
+ oldItem.qualitySampleTemplateList = JSON.parse(JSON.stringify(this.schemeList))
|
|
|
+ for (let i = 0; i < count; i++) {
|
|
|
+ ProductSampleList.push({
|
|
|
+ ...oldItem,
|
|
|
+ measureQuantity: newMeasureQuantity,
|
|
|
+ weight: newWeight,
|
|
|
+ qualitySampleTemplateList: JSON.parse(JSON.stringify(this.schemeList))
|
|
|
+ });
|
|
|
+ }
|
|
|
+ console.log(ProductSampleList, 'ProductSampleList')
|
|
|
+ this.sampleList = ProductSampleList;
|
|
|
+ const pNum = ProductSampleList.reduce((sum, item) => {
|
|
|
+ return sum + Number(item.weight || 0);
|
|
|
+ }, 0);
|
|
|
+ this.form.totalWeight = parseFloat(pNum.toFixed(2));
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.sampleList = list;
|
|
|
+ }
|
|
|
},
|
|
|
- async open(type) {
|
|
|
+ //输入取样数量
|
|
|
+ changeNumber(val) {
|
|
|
+ if (this.form.qualityMode !== 2) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (val <= 0) {
|
|
|
+ this.$refs.showPackingListTable.clearSelection();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (this.qualityType == '2') {
|
|
|
+ //生产检验的抽检逻辑
|
|
|
+ if (val > this.packingList[0].measureQuantity) {
|
|
|
+ this.$message.warning('取样数量不能大于来源清单的计量数量!');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ const ProductSampleList = [];
|
|
|
+
|
|
|
+ this.packingList.forEach(oldItem => {
|
|
|
+ const count = oldItem.measureQuantity;
|
|
|
+ const newMeasureQuantity = oldItem.measureQuantity / count;
|
|
|
+ const newWeight = parseFloat((oldItem.weight / count).toFixed(2))
|
|
|
+ console.log(count, newMeasureQuantity, newWeight)
|
|
|
+ delete oldItem.id;
|
|
|
+ // 遍历新数组设置 qualityResults 默认值
|
|
|
+ this.schemeList.forEach(item => {
|
|
|
+ if (typeof item === 'object' && item !== null) {
|
|
|
+ item.qualityResults = 1; // 设置默认值
|
|
|
+ }
|
|
|
+ delete item.id;
|
|
|
+ });
|
|
|
+ for (let i = 0; i < val; i++) {
|
|
|
+ ProductSampleList.push({
|
|
|
+ ...oldItem,
|
|
|
+ measureQuantity: newMeasureQuantity,
|
|
|
+ weight: newWeight,
|
|
|
+ qualitySampleTemplateList: JSON.parse(JSON.stringify(this.schemeList))
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ this.sampleList = ProductSampleList;
|
|
|
+ const pNum = ProductSampleList.reduce((sum, item) => {
|
|
|
+ return sum + Number(item.weight || 0);
|
|
|
+ }, 0);
|
|
|
+ this.form.totalWeight = parseFloat(pNum.toFixed(2));
|
|
|
+ } else {
|
|
|
+ if (val > this.packingList.length) {
|
|
|
+ this.$message.warning('取样数量不能大于物料明细总数!');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const rows = this.packingList.slice(0, val);
|
|
|
+ rows.forEach((row) => {
|
|
|
+ this.$refs.showPackingListTable.toggleRowSelection(row);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
+ getNowDate() {
|
|
|
+ let date = new Date(),
|
|
|
+ obj = {
|
|
|
+ year: date.getFullYear(), //获取当前月份(0-11,0代表1月)
|
|
|
+ month: date.getMonth() + 1, //获取当前月份(0-11,0代表1月)
|
|
|
+ strDate: date.getDate(), // 获取当前日(1-31)
|
|
|
+ hour: date.getHours(), //获取当前小时(0 ~ 23)
|
|
|
+ minute: date.getMinutes(), //获取当前分钟(0 ~ 59)
|
|
|
+ second: date.getSeconds() //获取当前秒数(0 ~ 59)
|
|
|
+ };
|
|
|
+ Object.keys(obj).forEach((key) => {
|
|
|
+ if (obj[key] < 10) obj[key] = `0${obj[key]}`;
|
|
|
+ });
|
|
|
+ return obj;
|
|
|
+ },
|
|
|
+ //来源清单勾选事件
|
|
|
+ handleSelectionChange1(selection) {
|
|
|
+ console.log(selection, '勾选列表');
|
|
|
+ this.form.sampleNumber = selection.length;
|
|
|
+ if (this.form.qualityMode === 2) {
|
|
|
+ this.selectedList = selection;
|
|
|
+
|
|
|
+ if (this.schemeList.length == 0) {
|
|
|
+ for (let i = 0; i < selection.length; i++) {
|
|
|
+ console.log(selection[i], 'selection[i]')
|
|
|
+ this.$set(selection[i], 'qualityStatus', 2)
|
|
|
+ // 遍历新数组设置 qualityResults 默认值
|
|
|
+ this.schemeList.forEach(item => {
|
|
|
+ if (typeof item === 'object' && item !== null) {
|
|
|
+ item.qualityResults = 1; // 设置默认值
|
|
|
+ }
|
|
|
+ delete item.id;
|
|
|
+ });
|
|
|
+ this.$set(selection[i], 'qualitySampleTemplateList', JSON.parse(JSON.stringify(this.schemeList)))
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.sampleList = selection;
|
|
|
+ //赋值取样数量
|
|
|
+ this.form.sampleNumber = selection.length;
|
|
|
+
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ async open() {
|
|
|
this.type = this.$route.query.type;
|
|
|
- this.title = this.type == 'add' ? '新增' : type == 'edit' ? '报工' : '详情';
|
|
|
+ this.qualityType = this.$route.query.qualityType;
|
|
|
+ this.title = this.type == 'add' ? '新增' : this.type == 'edit' ? '报工' : '详情';
|
|
|
|
|
|
if (this.type == 'add') {
|
|
|
const code = await getCode('quality_work_order_code');
|
|
|
this.form.code = code;
|
|
|
+ } else {
|
|
|
+ if (this.$route.query.qualityTimeStart != '' || this.$route.query.qualityTimeStart != null || this.$route.query.qualityTimeStart != undefined) {
|
|
|
+ this.qualityTimeStart = this.getNowTime();
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
+ getNowTime() {
|
|
|
+ const nowDate = this.getNowDate()
|
|
|
+ return nowDate.year + '-' + nowDate.month + '-' + nowDate.strDate + ' ' + nowDate.hour + ':' + nowDate.minute + ':' + nowDate.second
|
|
|
+ },
|
|
|
+ getNowTimes() {
|
|
|
+ const nowDate = this.getNowDate()
|
|
|
+ return nowDate.year + '-' + nowDate.month + '-' + nowDate.strDate
|
|
|
+ },
|
|
|
async getDetail() {
|
|
|
+
|
|
|
getById(this.$route.query.id).then((res) => {
|
|
|
this.form = res.data;
|
|
|
|
|
|
@@ -312,70 +324,53 @@ export default {
|
|
|
|
|
|
if (this.form.groupId) {
|
|
|
this.$nextTick(() => {
|
|
|
- if (this.$refs.baseInfoRefs) {
|
|
|
- this.$refs.baseInfoRefs.getUserList({
|
|
|
- groupId: this.form.groupId
|
|
|
- });
|
|
|
- this.$refs.baseInfoRefs.getTaskList();
|
|
|
- }
|
|
|
+ this.$refs.baseInfoRefs?.getUserList({
|
|
|
+ groupId: this.form.groupId
|
|
|
+ });
|
|
|
});
|
|
|
}
|
|
|
+ if (this.form.produceRoutingId) {
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$refs.baseInfoRefs?.getTaskList();
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
});
|
|
|
await this.queryQualityInventory()
|
|
|
- await this.queryQualitySamplContent()
|
|
|
await this.queryQualityTempleContent()
|
|
|
+ await this.queryQualitySamplContent()
|
|
|
+
|
|
|
},
|
|
|
async queryQualityInventory() {
|
|
|
let res = await queryQualityInventory({ qualityWorkerId: this.$route.query.id });
|
|
|
console.log(res, '清单列表');
|
|
|
this.packingList = res;
|
|
|
- this.samplePagination.currentPage = 1;
|
|
|
- this.samplePagination.total = this.packingList.length;
|
|
|
},
|
|
|
async queryQualitySamplContent() {
|
|
|
const res = await queryQualitySamplContent({ qualityWorkerId: this.$route.query.id })
|
|
|
-
|
|
|
let addStatus = res.map((item) => {
|
|
|
item.isValid = true;
|
|
|
- item.qualityResults = 1;
|
|
|
- item.qualityStatus = 0;
|
|
|
+ item.disposeTime = item.disposeTime ? item.disposeTime.split(' ')[0] : null;
|
|
|
+ item.sampleDate = item.sampleDate ? item.sampleDate.split(' ')[0] : null;
|
|
|
return {
|
|
|
...item
|
|
|
}
|
|
|
})
|
|
|
- console.log(addStatus, 'addStatus')
|
|
|
- //样品
|
|
|
- this.sampleList = addStatus;
|
|
|
- this.samplePagination.currentPage = 1;
|
|
|
- this.samplePagination.total = this.sampleList.length;
|
|
|
+ console.log(addStatus, '样品清单12123123')
|
|
|
+
|
|
|
+ if (addStatus.length > 0) {
|
|
|
+ this.sampleList = addStatus;
|
|
|
+ } else {
|
|
|
+ this.getProSamList(this.packingList)
|
|
|
+ }
|
|
|
},
|
|
|
async queryQualityTempleContent() {
|
|
|
const res = await queryQualityTempleContent({ qualityWorkerId: this.$route.query.id })
|
|
|
- console.log(res, '222');
|
|
|
- // 方案
|
|
|
+ console.log(res, '质检方案');
|
|
|
this.schemeList = res;
|
|
|
- this.schemePagination.currentPage = 1;
|
|
|
- this.schemePagination.total = this.schemeList.length;
|
|
|
- },
|
|
|
- handleClick(tab) {
|
|
|
- this.activeName = tab.name;
|
|
|
- },
|
|
|
- // 样品列表分页方法
|
|
|
- handleSampleSizeChange(val) {
|
|
|
- this.samplePagination.pageSize = val;
|
|
|
- this.samplePagination.currentPage = 1;
|
|
|
- },
|
|
|
- handleSampleCurrentChange(val) {
|
|
|
- this.samplePagination.currentPage = val;
|
|
|
- },
|
|
|
- // 质检方案分页方法
|
|
|
- handleSchemeSizeChange(val) {
|
|
|
- this.schemePagination.pageSize = val;
|
|
|
- this.schemePagination.currentPage = 1;
|
|
|
- },
|
|
|
- handleSchemeCurrentChange(val) {
|
|
|
- this.schemePagination.currentPage = val;
|
|
|
},
|
|
|
+
|
|
|
+
|
|
|
/* 保存编辑 */
|
|
|
save() {
|
|
|
this.$refs.baseInfoRefs.$refs.form1.validate((valid) => {
|
|
|
@@ -383,11 +378,24 @@ export default {
|
|
|
return false;
|
|
|
}
|
|
|
this.loading = true;
|
|
|
- save(this.form)
|
|
|
+ let URL =
|
|
|
+ this.type == 'add' ? save : this.type == 'edit' ? update : '';
|
|
|
+
|
|
|
+ this.form.qualityTimeStart = new Date(this.qualityTimeStart)
|
|
|
+
|
|
|
+ delete this.form['qualityTimeEnd']
|
|
|
+
|
|
|
+ let params = {
|
|
|
+ ...this.form,
|
|
|
+ sampleList: this.sampleList,
|
|
|
+ planTemplateList: this.schemeList,
|
|
|
+ qualityInventoryList: this.packingList
|
|
|
+ }
|
|
|
+ URL(params)
|
|
|
.then((msg) => {
|
|
|
this.loading = false;
|
|
|
this.$message.success(msg);
|
|
|
- this.handleClose();
|
|
|
+ this.cancel();
|
|
|
this.$emit('done');
|
|
|
})
|
|
|
.catch((e) => {
|
|
|
@@ -419,22 +427,35 @@ export default {
|
|
|
this.$router.go(-1);
|
|
|
},
|
|
|
handleDetail(index, row, type) {
|
|
|
- if (row.isStatus == undefined) {
|
|
|
- row.isStatus = true;
|
|
|
- }else {
|
|
|
- row.isStatus = false;
|
|
|
- }
|
|
|
if (!this.sampleList[index] || !this.schemeList) {
|
|
|
return;
|
|
|
}
|
|
|
+ const selectedData = [];
|
|
|
+ selectedData.push(this.sampleList[index])
|
|
|
|
|
|
- const selectedData = this.sampleList[index];
|
|
|
- const mergedData = [{
|
|
|
- ...selectedData,
|
|
|
- children: [...this.schemeList]
|
|
|
- }];
|
|
|
- console.log(index, row, type, mergedData, 'index, row, type, mergedData')
|
|
|
- this.$refs.detailRef.openDia(index, row, type, mergedData,null);
|
|
|
+ this.$refs.detailRef.openDia(index, row, type, selectedData, null);
|
|
|
+ },
|
|
|
+ inputWeight(row, index) {
|
|
|
+ console.log(row, index, '输入重量')
|
|
|
+
|
|
|
+ const pNum = this.sampleList.reduce((sum, item) => {
|
|
|
+ return sum + Number(item.weight || 0);
|
|
|
+ }, 0);
|
|
|
+ this.form.totalWeight = parseFloat(pNum.toFixed(2));
|
|
|
+
|
|
|
+ },
|
|
|
+ handleDispose(index, row, type) {
|
|
|
+ if (!this.sampleList[index]) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ this.sampleList[index].sampleDate = this.getNowTimes();
|
|
|
+
|
|
|
+ this.sampleList[index].disposeTime = this.getNowTimes();
|
|
|
+
|
|
|
+ console.log(index, row, type, this.qualityType)
|
|
|
+
|
|
|
+ this.$refs.disposeRef.openDispose(index, row, type, this.qualityType);
|
|
|
},
|
|
|
// 报工
|
|
|
handleReporting(index, row) {
|
|
|
@@ -442,6 +463,20 @@ export default {
|
|
|
if (!valid) {
|
|
|
return false;
|
|
|
}
|
|
|
+
|
|
|
+ for (let i = 0; i < this.sampleList.length; i++) {
|
|
|
+
|
|
|
+ const qualityStatus = this.sampleList[i].qualityStatus;
|
|
|
+
|
|
|
+ if (qualityStatus == '2') {
|
|
|
+ this.$message.error('请完成以下样品质检!')
|
|
|
+ this.loading = false;
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ this.form.qualityTimeEnd = new Date(this.getNowTime())
|
|
|
+ this.form.qualityTimeStart = new Date(this.qualityTimeStart)
|
|
|
let params = {
|
|
|
...this.form,
|
|
|
sampleList: this.sampleList,
|
|
|
@@ -449,12 +484,11 @@ export default {
|
|
|
qualityInventoryList: this.packingList
|
|
|
}
|
|
|
console.log(params, 'params')
|
|
|
- // return;
|
|
|
exeReportWork(params)
|
|
|
.then((msg) => {
|
|
|
this.loading = false;
|
|
|
this.$message.success(msg);
|
|
|
- this.handleClose();
|
|
|
+ this.cancel();
|
|
|
this.$emit('done');
|
|
|
})
|
|
|
.catch((e) => {
|
|
|
@@ -462,13 +496,19 @@ export default {
|
|
|
});
|
|
|
})
|
|
|
},
|
|
|
+ // 处理确认事件
|
|
|
+ handleDisposeConfirm(row, index) {
|
|
|
+ if (index > -1) {
|
|
|
+ this.$set(this.sampleList, index, row)
|
|
|
+ }
|
|
|
+ },
|
|
|
//确认报工
|
|
|
handleConfirm(list, index) {
|
|
|
console.log(list)
|
|
|
|
|
|
// 检查有效性
|
|
|
for (const item of list) {
|
|
|
- for (const child of item.children) {
|
|
|
+ for (const child of item.qualitySampleTemplateList) {
|
|
|
|
|
|
console.log(child, 'child')
|
|
|
if (!child.qualityResultContent || !child.qualityResults) {
|
|
|
@@ -477,52 +517,29 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- // 处理数据
|
|
|
- const hasInvalidItem = list.some(item =>
|
|
|
- item.children.some(child => child.qualityResults === 2)
|
|
|
- );
|
|
|
- console.log('是否有不合格数据', hasInvalidItem)
|
|
|
-
|
|
|
- for (const item of list) {
|
|
|
- const filteredData = item.children.filter((item) =>
|
|
|
- item.qualityResults == 2
|
|
|
- );
|
|
|
- console.log(filteredData, '不合格数据')
|
|
|
- if (filteredData.length > -1) {
|
|
|
- this.form.noQualifiedNumber = filteredData.length;
|
|
|
- this.form.qualifiedNumber = item.children.length - filteredData.length;
|
|
|
- }
|
|
|
- }
|
|
|
console.log(list, 'listlistlistlist')
|
|
|
-
|
|
|
- const processedList = list.map(item => {
|
|
|
- item.qualityResults = hasInvalidItem ? 2 : 1;
|
|
|
- item.qualityStatus = 1;
|
|
|
- item.qualitySampleTemplateList = item.children;
|
|
|
- item.isValid = !hasInvalidItem
|
|
|
- delete item.children;
|
|
|
- return {
|
|
|
- ...item,
|
|
|
+ list.forEach((item) => {
|
|
|
+ if (item.qualitySampleTemplateList.some(child => child.qualityResults === 2)) {
|
|
|
+ item.isValid = false;
|
|
|
+ item.qualityResults = 2;
|
|
|
}
|
|
|
- });
|
|
|
-
|
|
|
- this.$set(this.sampleList, index, processedList[0]);
|
|
|
-
|
|
|
- console.log(this.sampleList, processedList, '222表')
|
|
|
-
|
|
|
- // this.SampleListbyReportList = processedList;
|
|
|
+ else {
|
|
|
+ item.isValid = true;
|
|
|
+ item.qualityResults = 1;
|
|
|
+ }
|
|
|
+ item.qualityStatus = 1;
|
|
|
+ })
|
|
|
+ if (index != null) {
|
|
|
+ this.$set(this.sampleList, index, list[0]);
|
|
|
+ } else {
|
|
|
+ this.$set(this.sampleList, null, list);
|
|
|
+ }
|
|
|
+ console.log(this.sampleList, '222表')
|
|
|
|
|
|
},
|
|
|
// 批量质检
|
|
|
- batchQuality(index, row,type){
|
|
|
- if (!this.isStatus){
|
|
|
- this.isStatus = false;
|
|
|
- }
|
|
|
- this.sampleList.forEach((item) => {
|
|
|
- item.children=this.schemeList;
|
|
|
- });
|
|
|
- this.$refs.detailRef.openDia(null, null,type, this.sampleList, this.isStatus)
|
|
|
+ batchQuality(index, row, type) {
|
|
|
+ this.$refs.detailRef.openDia(null, null, 'report', this.sampleList, null)
|
|
|
}
|
|
|
}
|
|
|
};
|