|
|
|
|
<template>
|
|
|
|
|
<div>
|
|
|
|
|
<el-card>
|
|
|
|
|
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
|
|
|
|
|
<el-divider content-position="left"><span style="font-weight: bold; font-size: larger;">工单信息</span>
|
|
|
|
|
</el-divider>
|
|
|
|
|
<el-row :gutter="10">
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<el-form-item label="工单号:">{{ form.orderCode }}</el-form-item>
|
|
|
|
|
<el-form-item label="成品编码:">{{ form.materialCode }}</el-form-item>
|
|
|
|
|
<el-form-item label="计划开始时间:">{{ parseTime(form.planBeginTime) }}</el-form-item>
|
|
|
|
|
<el-form-item label="计划数量/已派工数量/完成数量:" label-width="220px">
|
|
|
|
|
{{
|
|
|
|
|
form.planAmount
|
|
|
|
|
}}/{{
|
|
|
|
|
form.dispatchAmount == null || form.dispatchAmount === undefined ? 0 : form.dispatchAmount
|
|
|
|
|
}}/{{ form.completeAmount }}
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<el-form-item label="工艺路线:">{{ form.dispatchName }}</el-form-item>
|
|
|
|
|
<el-form-item label="成品名称:">{{ form.materialName }}</el-form-item>
|
|
|
|
|
<el-form-item label="计划结束时间:">{{ parseTime(form.planEndTime) }}</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
|
|
|
|
|
<el-divider content-position="left"><span style="font-weight: bold; font-size: larger;">派工信息</span>
|
|
|
|
|
</el-divider>
|
|
|
|
|
|
|
|
|
|
<el-row :gutter="10" class="mb8">
|
|
|
|
|
<el-col :span="1.5">
|
|
|
|
|
<el-button icon="el-icon-plus" size="mini" type="primary" @click="handleAddMesProductPlan">新增
|
|
|
|
|
</el-button>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
<el-table ref="mesProductPlan" :data="mesProductPlanList"
|
|
|
|
|
:row-class-name="rowMesProductPlanIndex" @selection-change="handleMesProductPlanSelectionChange"
|
|
|
|
|
:tree-props="{children: 'children'}"
|
|
|
|
|
style="width: 100%;margin-bottom: 20px;"
|
|
|
|
|
row-key="id"
|
|
|
|
|
border
|
|
|
|
|
default-expand-all
|
|
|
|
|
>
|
|
|
|
|
|
|
|
|
|
<el-table-column
|
|
|
|
|
width="80"
|
|
|
|
|
type=""
|
|
|
|
|
>
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<el-button type="danger" icon="el-icon-delete" @click="handleDeleteMesProductPlan(scope)"
|
|
|
|
|
v-if="scope.row.deleteFlag != null && scope.row.deleteFlag == '1'"></el-button>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
|
|
|
|
|
<el-table-column
|
|
|
|
|
width="80"
|
|
|
|
|
type=""
|
|
|
|
|
>
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<el-button type="primary" icon="el-icon-plus" @click="addProcessUser(scope)"
|
|
|
|
|
v-if="scope.row.children != null && scope.row.children !== undefined"></el-button>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
|
|
|
|
|
<el-table-column
|
|
|
|
|
width="50"
|
|
|
|
|
>
|
|
|
|
|
<!-- <template slot-scope="scope">-->
|
|
|
|
|
<!-- <el-button type="primary" icon="el-icon-plus" @click="add(scope)"></el-button>-->
|
|
|
|
|
<!-- </template>-->
|
|
|
|
|
</el-table-column>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<el-table-column align="center" label="派工单号" prop="dispatchCode" width="230">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<el-input v-model="scope.row.dispatchCode" :disabled="true"
|
|
|
|
|
v-if="scope.row.children != null && scope.row.children !== undefined"/>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column align="center" label="工序" prop="processName" width="140">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<el-input v-model="scope.row.processName" :disabled="true"
|
|
|
|
|
v-if="scope.row.children != null && scope.row.children !== undefined"/>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column align="center" label="步骤" prop="processOrder">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<el-input v-model="scope.row.processOrder" :disabled="true"
|
|
|
|
|
v-if="scope.row.children != null && scope.row.children !== undefined"/>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column align="center" label="派工数量" prop="dispatchAmount" width="100">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<el-input v-model="scope.row.dispatchAmount" :disabled="scope.row.oldRowFlag"
|
|
|
|
|
v-if="scope.row.children != null && scope.row.children !== undefined"/>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
|
|
|
|
|
<el-table-column align="center" label="用户" prop="userId" width="140">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<el-select v-model="scope.row.userId" placeholder="请选择用户"
|
|
|
|
|
v-if="scope.row.children == null || scope.row.children === undefined"
|
|
|
|
|
:disabled="scope.row.planId != null && scope.row.planId !== undefined && scope.row.planId !== ''"
|
|
|
|
|
>
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="item in processUsers[scope.row.processId]"
|
|
|
|
|
:key="item.userId"
|
|
|
|
|
:label="item.userName"
|
|
|
|
|
:value="item.userId"
|
|
|
|
|
></el-option>
|
|
|
|
|
</el-select>
|
|
|
|
|
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
|
|
|
|
|
<el-table-column align="center" label="派工标准工时(小时)" prop="productionTime" width="180">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<el-input-number style="width:150px;" :min="0" v-model="scope.row.productionTime" :disabled="scope.row.children != null && scope.row.children !== undefined"/>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column align="center" label="计划开始时间" prop="planBeginTime" width="230">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<el-date-picker v-model="scope.row.planBeginTime" style="width:200px;"
|
|
|
|
|
:disabled="scope.row.children != null && scope.row.children !== undefined"
|
|
|
|
|
clearable
|
|
|
|
|
placeholder="请选择计划开始时间"
|
|
|
|
|
type="datetime" value-format="yyyy-MM-dd HH:mm:ss"
|
|
|
|
|
/>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column align="center" label="计划完成时间" prop="planEndTime" width="230">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<el-date-picker v-model="scope.row.planEndTime" style="width:200px;"
|
|
|
|
|
:disabled="scope.row.children != null && scope.row.children !== undefined"
|
|
|
|
|
clearable
|
|
|
|
|
placeholder="请选择计划完成时间"
|
|
|
|
|
type="datetime" value-format="yyyy-MM-dd HH:mm:ss"/>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
|
|
|
|
|
<el-table-column align="center" label="状态" prop="planStatus" width="150">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<el-select v-model="scope.row.planStatus" :disabled="true" placeholder="请选择状态">
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="dict in dict.type.product_status"
|
|
|
|
|
:key="dict.value"
|
|
|
|
|
:label="dict.label"
|
|
|
|
|
:value="dict.value"
|
|
|
|
|
/>
|
|
|
|
|
</el-select>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<el-table-column align="center" class-name="small-padding fixed-width" label="操作" width="100">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<el-button
|
|
|
|
|
icon="el-icon-search"
|
|
|
|
|
size="mini"
|
|
|
|
|
type="primary"
|
|
|
|
|
@click="handleDrawing(scope.row)"
|
|
|
|
|
v-if="scope.row.children != null && scope.row.children !== undefined"
|
|
|
|
|
>图纸
|
|
|
|
|
</el-button>
|
|
|
|
|
<el-button
|
|
|
|
|
icon="el-icon-search"
|
|
|
|
|
size="mini"
|
|
|
|
|
type="success"
|
|
|
|
|
@click="handleSOP(scope.row)"
|
|
|
|
|
v-if="scope.row.children != null && scope.row.children !== undefined"
|
|
|
|
|
>SOP
|
|
|
|
|
</el-button>
|
|
|
|
|
|
|
|
|
|
<el-button
|
|
|
|
|
icon="el-icon-delete"
|
|
|
|
|
size="mini"
|
|
|
|
|
type="danger"
|
|
|
|
|
@click="handleDeleteDispatchUser(scope.row)"
|
|
|
|
|
v-if="(scope.row.children == null || scope.row.children == undefined)
|
|
|
|
|
&& (scope.row.planStatus === PLAN_STATUS.STARTED || scope.row.planStatus === PLAN_STATUS.DISPATCHED)"
|
|
|
|
|
>删除
|
|
|
|
|
</el-button>
|
|
|
|
|
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</el-table>
|
|
|
|
|
</el-form>
|
|
|
|
|
<el-form label-width="100px">
|
|
|
|
|
<el-form-item style="text-align: center;margin-left:-100px;margin-top:10px;">
|
|
|
|
|
<el-button type="primary" @click="submitForm()">提交</el-button>
|
|
|
|
|
<el-button @click="close()">返回</el-button>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-form>
|
|
|
|
|
</el-card>
|
|
|
|
|
<el-dialog
|
|
|
|
|
:visible.sync="blueprintModel"
|
|
|
|
|
title="上传图纸"
|
|
|
|
|
width="30%"
|
|
|
|
|
@before-close="blueprintModel = false">
|
|
|
|
|
<el-upload
|
|
|
|
|
single
|
|
|
|
|
ref="drawingUpload"
|
|
|
|
|
list-type="picture-card"
|
|
|
|
|
action="uploadImgUrl"
|
|
|
|
|
:auto-upload="true"
|
|
|
|
|
:limit="limit"
|
|
|
|
|
:headers="headers"
|
|
|
|
|
:before-upload="handleBeforeUpload"
|
|
|
|
|
:http-request="httpRequest"
|
|
|
|
|
:on-exceed="handleExceed"
|
|
|
|
|
:file-list="fileList"
|
|
|
|
|
>
|
|
|
|
|
<i slot="default" class="el-icon-plus"></i>
|
|
|
|
|
<div slot="file" slot-scope="{file}">
|
|
|
|
|
<img
|
|
|
|
|
v-if="isAssetTypeAnImage(file.name)"
|
|
|
|
|
:alt="file.name"
|
|
|
|
|
:src="file.url" class="el-upload-list__item-thumbnail"
|
|
|
|
|
>
|
|
|
|
|
<span v-else>{{ file.name }}</span>
|
|
|
|
|
<span class="el-upload-list__item-actions">
|
|
|
|
|
<span
|
|
|
|
|
v-if="isAssetTypeAnImage(file.name)"
|
|
|
|
|
class="el-upload-list__item-preview"
|
|
|
|
|
@click="handlePictureCardPreview(file)"
|
|
|
|
|
>
|
|
|
|
|
<i class="el-icon-zoom-in"></i>
|
|
|
|
|
</span>
|
|
|
|
|
<span
|
|
|
|
|
class="el-upload-list__item-delete"
|
|
|
|
|
@click="handleDownload(file)"
|
|
|
|
|
>
|
|
|
|
|
<i class="el-icon-download"></i>
|
|
|
|
|
</span>
|
|
|
|
|
<span
|
|
|
|
|
class="el-upload-list__item-delete"
|
|
|
|
|
@click="handleRemove(file)"
|
|
|
|
|
>
|
|
|
|
|
<i class="el-icon-delete"></i>
|
|
|
|
|
</span>
|
|
|
|
|
</span>
|
|
|
|
|
</div>
|
|
|
|
|
</el-upload>
|
|
|
|
|
<span slot="footer" class="dialog-footer">
|
|
|
|
|
<!-- 上传提示 -->
|
|
|
|
|
<div class="el-upload__tip" slot="tip" v-if="isShowTip">
|
|
|
|
|
请上传
|
|
|
|
|
<template v-if="fileSize"> 大小不超过 <b style="color: #f67c7c">{{ fileSize }}MB</b></template>
|
|
|
|
|
<template v-if="fileType"> 格式为 <b style="color: #f56c6c">{{ fileType.join("/") }}</b></template>
|
|
|
|
|
的文件
|
|
|
|
|
</div>
|
|
|
|
|
<el-button type="primary" @click="drawingFileUploadSubmit">确 定</el-button>
|
|
|
|
|
<el-button @click="blueprintModel = false">取 消</el-button>
|
|
|
|
|
</span>
|
|
|
|
|
</el-dialog>
|
|
|
|
|
|
|
|
|
|
<el-dialog
|
|
|
|
|
:visible.sync="sopViewModel"
|
|
|
|
|
title="上传SOP附件"
|
|
|
|
|
width="30%"
|
|
|
|
|
@before-close="sopViewModel = false">
|
|
|
|
|
<el-upload
|
|
|
|
|
single
|
|
|
|
|
ref="drawingUpload"
|
|
|
|
|
list-type="picture-card"
|
|
|
|
|
action="uploadImgUrl"
|
|
|
|
|
:auto-upload="true"
|
|
|
|
|
:limit="limit"
|
|
|
|
|
:headers="headers"
|
|
|
|
|
:before-upload="handleBeforeUpload"
|
|
|
|
|
:http-request="httpRequest"
|
|
|
|
|
:on-exceed="handleExceed"
|
|
|
|
|
:file-list="fileList"
|
|
|
|
|
>
|
|
|
|
|
<i slot="default" class="el-icon-plus"></i>
|
|
|
|
|
<div slot="file" slot-scope="{file}">
|
|
|
|
|
<img
|
|
|
|
|
v-if="isAssetTypeAnImage(file.name)"
|
|
|
|
|
:alt="file.name"
|
|
|
|
|
:src="file.url" class="el-upload-list__item-thumbnail"
|
|
|
|
|
>
|
|
|
|
|
<span v-else>{{ file.name }}</span>
|
|
|
|
|
<span class="el-upload-list__item-actions">
|
|
|
|
|
<span
|
|
|
|
|
v-if="isAssetTypeAnImage(file.name)"
|
|
|
|
|
class="el-upload-list__item-preview"
|
|
|
|
|
@click="handlePictureCardPreview(file)"
|
|
|
|
|
>
|
|
|
|
|
<i class="el-icon-zoom-in"></i>
|
|
|
|
|
</span>
|
|
|
|
|
<span
|
|
|
|
|
class="el-upload-list__item-delete"
|
|
|
|
|
@click="handleDownload(file)"
|
|
|
|
|
>
|
|
|
|
|
<i class="el-icon-download"></i>
|
|
|
|
|
</span>
|
|
|
|
|
<span
|
|
|
|
|
class="el-upload-list__item-delete"
|
|
|
|
|
@click="handleRemove(file)"
|
|
|
|
|
>
|
|
|
|
|
<i class="el-icon-delete"></i>
|
|
|
|
|
</span>
|
|
|
|
|
</span>
|
|
|
|
|
</div>
|
|
|
|
|
</el-upload>
|
|
|
|
|
<span slot="footer" class="dialog-footer">
|
|
|
|
|
<!-- 上传提示 -->
|
|
|
|
|
<div class="el-upload__tip" slot="tip" v-if="isShowTip">
|
|
|
|
|
请上传
|
|
|
|
|
<template v-if="fileSize"> 大小不超过 <b style="color: #f56c6c">{{ fileSize }}MB</b></template>
|
|
|
|
|
<template v-if="fileType"> 格式为 <b style="color: #f56c6c">{{ fileType.join("/") }}</b></template>
|
|
|
|
|
的文件
|
|
|
|
|
</div>
|
|
|
|
|
<el-button type="primary" @click="sopFileUploadSubmit">确 定</el-button>
|
|
|
|
|
<el-button @click="sopViewModel = false">取 消</el-button>
|
|
|
|
|
</span>
|
|
|
|
|
</el-dialog>
|
|
|
|
|
|
|
|
|
|
<el-dialog
|
|
|
|
|
:visible.sync="pictureDetailModel"
|
|
|
|
|
title="图纸预览"
|
|
|
|
|
width="800"
|
|
|
|
|
append-to-body
|
|
|
|
|
>
|
|
|
|
|
<img
|
|
|
|
|
:src="dialogImageUrl"
|
|
|
|
|
style="display: block; max-width: 100%; margin: 0 auto"
|
|
|
|
|
/>
|
|
|
|
|
</el-dialog>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import {getProductOrder, updateProductOrder} from "@//api/mes/productOrder";
|
|
|
|
|
import {
|
|
|
|
|
deleteProductPlansByDispatchCode,
|
|
|
|
|
getDispatchCode, getDispatchDrawingList, getDispatchSOPAttachList,
|
|
|
|
|
selectProductPlans,
|
|
|
|
|
orderAddMesProductPlanList,
|
|
|
|
|
updateProductplan,
|
|
|
|
|
getBaseRouteProcesses,
|
|
|
|
|
getProcessUsers,
|
|
|
|
|
uploadFile
|
|
|
|
|
} from "@//api/mes/productplan";
|
|
|
|
|
import {deepClone} from "@//utils/index";
|
|
|
|
|
import {getToken} from "@//utils/auth";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let id = 0
|
|
|
|
|
let deepSearch = (arr, target) => {
|
|
|
|
|
let results = []
|
|
|
|
|
arr.forEach(element => {
|
|
|
|
|
console.log(element)
|
|
|
|
|
id = Math.max(id, element.id)
|
|
|
|
|
if (element.id === target) {
|
|
|
|
|
results.push(element)
|
|
|
|
|
} else if (Array.isArray(element.children)) {
|
|
|
|
|
results = results.concat(deepSearch(element.children, target))
|
|
|
|
|
}
|
|
|
|
|
// if (Array.isArray(element.children)) {
|
|
|
|
|
// results = results.concat(deepSearch(element.children, target))
|
|
|
|
|
// } else if (element.id === target) {
|
|
|
|
|
// results.push(element)
|
|
|
|
|
// }
|
|
|
|
|
})
|
|
|
|
|
return results
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
name: "productPlanEdit",
|
|
|
|
|
dicts: ['product_status', 'mes_dispatch_flag'],
|
|
|
|
|
props: {
|
|
|
|
|
value: [String, Object, Array, Number],
|
|
|
|
|
// 文件数量限制
|
|
|
|
|
limit: {
|
|
|
|
|
type: Number,
|
|
|
|
|
default: 3,
|
|
|
|
|
},
|
|
|
|
|
// 文件大小限制(MB)
|
|
|
|
|
fileSize: {
|
|
|
|
|
type: Number,
|
|
|
|
|
default: 5,
|
|
|
|
|
},
|
|
|
|
|
// 文件类型, 例如['png', 'jpg', 'jpeg']
|
|
|
|
|
fileType: {
|
|
|
|
|
type: Array,
|
|
|
|
|
default: () => ["png", "jpg", "jpeg"],
|
|
|
|
|
},
|
|
|
|
|
// 是否显示提示
|
|
|
|
|
isShowTip: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
default: true
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
blueprintModel: false,
|
|
|
|
|
sopViewModel: false,
|
|
|
|
|
pictureDetailModel: false,
|
|
|
|
|
// 图片预览地址
|
|
|
|
|
dialogImageUrl: '',
|
|
|
|
|
// 非单个禁用
|
|
|
|
|
single: true,
|
|
|
|
|
checkedMesProductPlanList: [],
|
|
|
|
|
// 上传的文件服务器地址
|
|
|
|
|
uploadImgUrl: process.env.VUE_APP_BASE_API,
|
|
|
|
|
// 选中选项卡的 name
|
|
|
|
|
activeName: "columnInfo",
|
|
|
|
|
// 表格的高度
|
|
|
|
|
tableHeight: document.documentElement.scrollHeight - 245 + "px",
|
|
|
|
|
// 表信息
|
|
|
|
|
tables: [],
|
|
|
|
|
// 表列信息
|
|
|
|
|
columns: [],
|
|
|
|
|
// 生产计划表格数据
|
|
|
|
|
mesProductPlanList: [],
|
|
|
|
|
//待删除的生产计划ID
|
|
|
|
|
toDeletedPlanIds: [],
|
|
|
|
|
|
|
|
|
|
// 表详细信息
|
|
|
|
|
info: {},
|
|
|
|
|
// 表单参数
|
|
|
|
|
form: {},
|
|
|
|
|
// 表单校验
|
|
|
|
|
rules: {
|
|
|
|
|
productOrderId: [
|
|
|
|
|
{required: true, message: "生产工单ID不能为空", trigger: "blur"}
|
|
|
|
|
],
|
|
|
|
|
planCode: [
|
|
|
|
|
{required: true, message: "计划编号不能为空", trigger: "blur"}
|
|
|
|
|
],
|
|
|
|
|
dispatchCode: [
|
|
|
|
|
{required: true, message: "派工单号不能为空", trigger: "blur"}
|
|
|
|
|
],
|
|
|
|
|
materialId: [
|
|
|
|
|
{required: true, message: "物料ID不能为空", trigger: "blur"}
|
|
|
|
|
],
|
|
|
|
|
materialBomId: [
|
|
|
|
|
{required: true, message: "物料bomID不能为空", trigger: "blur"}
|
|
|
|
|
],
|
|
|
|
|
stationId: [
|
|
|
|
|
{required: true, message: "工位ID不能为空", trigger: "blur"}
|
|
|
|
|
],
|
|
|
|
|
planStatus: [
|
|
|
|
|
{required: true, message: "计划状态不能为空", trigger: "change"}
|
|
|
|
|
],
|
|
|
|
|
isFlag: [
|
|
|
|
|
{required: true, message: "是否标识不能为空", trigger: "change"}
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
// 文件列表
|
|
|
|
|
fileList: [],
|
|
|
|
|
// 上传文件回调列表
|
|
|
|
|
uploadList: [],
|
|
|
|
|
//文件上传-生产派工对象
|
|
|
|
|
addProductPlanObject: {},
|
|
|
|
|
headers: {
|
|
|
|
|
Authorization: "Bearer " + getToken(),
|
|
|
|
|
},
|
|
|
|
|
PROCESS_ID: {
|
|
|
|
|
BENDING_PROCESS_ID: 42
|
|
|
|
|
},
|
|
|
|
|
PROCESS_TYPE: {
|
|
|
|
|
MANUAL: '1',
|
|
|
|
|
AUTO: '3',
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
PLAN_STATUS: {
|
|
|
|
|
TO_DISPATCH: '0',//待派工
|
|
|
|
|
DISPATCHED: '1',//已派工
|
|
|
|
|
STARTED: '2',//已开始
|
|
|
|
|
FINISHED: '3' //已完成
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
id: 1,
|
|
|
|
|
|
|
|
|
|
processUsers: []
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
created() {
|
|
|
|
|
const productOrderId = this.$route.params && this.$route.params.productOrderId;
|
|
|
|
|
if (productOrderId) {
|
|
|
|
|
// 获取表详细信息
|
|
|
|
|
getProductOrder(productOrderId).then(res => {
|
|
|
|
|
this.form = res.data;
|
|
|
|
|
this.getProcessUsers(productOrderId);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
getProcessUsers(productOrderId) {
|
|
|
|
|
getProcessUsers(this.form.dispatchId).then(res => {
|
|
|
|
|
res.data.forEach(processUser => {
|
|
|
|
|
if (!this.processUsers[processUser.processId]) {
|
|
|
|
|
this.processUsers[processUser.processId] = [];
|
|
|
|
|
}
|
|
|
|
|
this.processUsers[processUser.processId].push(processUser);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
selectProductPlans({productOrderId: productOrderId}).then(res => {
|
|
|
|
|
this.groupProductPlans(res.data)
|
|
|
|
|
// res.data.forEach(e => {
|
|
|
|
|
// // 新添加列标识 false=新添加,true=历史行
|
|
|
|
|
// e.oldRowFlag = true;
|
|
|
|
|
// this.mesProductPlanList.push(e);
|
|
|
|
|
// })
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
groupProductPlans(productPlans) {
|
|
|
|
|
const groupedProductPlans = {};
|
|
|
|
|
productPlans.forEach(productPlan => {
|
|
|
|
|
const key = `${productPlan.dispatchCode}-${productPlan.processId}`;
|
|
|
|
|
if (!groupedProductPlans[key]) {
|
|
|
|
|
groupedProductPlans[key] = [];
|
|
|
|
|
}
|
|
|
|
|
groupedProductPlans[key].push(productPlan);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
let firstDispatch = {};
|
|
|
|
|
|
|
|
|
|
for (let dispatchCodeProcessId in groupedProductPlans) {
|
|
|
|
|
let productPlansByDispatch = groupedProductPlans[dispatchCodeProcessId];
|
|
|
|
|
|
|
|
|
|
// console.log(processId + ": " + JSON.stringify(groupedProductPlans[processId]));
|
|
|
|
|
let obj = {};
|
|
|
|
|
|
|
|
|
|
let dispatchCode = dispatchCodeProcessId.split("-")[0];
|
|
|
|
|
if(!firstDispatch[dispatchCode]){
|
|
|
|
|
firstDispatch[dispatchCode] = "1";
|
|
|
|
|
obj.deleteFlag = "1";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
obj.id = this.id
|
|
|
|
|
this.id = this.id + 1;
|
|
|
|
|
let i = 0;
|
|
|
|
|
productPlansByDispatch.forEach(groupedProductPlan => {
|
|
|
|
|
groupedProductPlan.id = this.id;
|
|
|
|
|
groupedProductPlan.productionTime = groupedProductPlan.productionTime/60/60;
|
|
|
|
|
this.id = this.id + 1;
|
|
|
|
|
|
|
|
|
|
if (i === 0) {
|
|
|
|
|
obj.dispatchCode = groupedProductPlan.dispatchCode;
|
|
|
|
|
obj.dispatchAmount = groupedProductPlan.dispatchAmount;
|
|
|
|
|
obj.processId = groupedProductPlan.processId;
|
|
|
|
|
obj.processName = groupedProductPlan.processName;
|
|
|
|
|
obj.lastProcessId = groupedProductPlan.lastProcessId;
|
|
|
|
|
obj.processType = groupedProductPlan.processType;
|
|
|
|
|
obj.processOrder = groupedProductPlan.processOrder;
|
|
|
|
|
|
|
|
|
|
obj.planBeginTime = this.form.planBeginTime;
|
|
|
|
|
obj.planEndTime = this.form.planEndTime;
|
|
|
|
|
obj.planStatus = groupedProductPlan.planStatus;
|
|
|
|
|
// obj.dispatchAmount = this.form.planAmount - this.form.dispatchAmount;
|
|
|
|
|
|
|
|
|
|
obj.materialId = this.form.materialId;
|
|
|
|
|
obj.materialBomId = this.form.materialBomId;
|
|
|
|
|
obj.productOrderId = this.form.productOrderId;
|
|
|
|
|
obj.saleOrderId = this.form.saleOrderId;
|
|
|
|
|
obj.saleorderCode = this.form.saleorderCode;
|
|
|
|
|
// 新添加列标识 false=新添加,true=历史行
|
|
|
|
|
obj.oldRowFlag = true;
|
|
|
|
|
i++;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
obj.children = productPlansByDispatch;
|
|
|
|
|
|
|
|
|
|
this.mesProductPlanList.push(obj);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// console.log(JSON.stringify(this.mesProductPlanList))
|
|
|
|
|
|
|
|
|
|
this.getId(this.mesProductPlanList);
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
getId(arr) {
|
|
|
|
|
arr.forEach(element => {
|
|
|
|
|
this.id = this.id + 1;
|
|
|
|
|
if (Array.isArray(element.children)) {
|
|
|
|
|
this.getId(element.children)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
addProcessUser(scope) {
|
|
|
|
|
let data = deepSearch(this.mesProductPlanList, scope.row.id)?.[0]
|
|
|
|
|
let id = this.id + 1
|
|
|
|
|
this.id += 1;
|
|
|
|
|
if (Array.isArray(data.children)) {
|
|
|
|
|
|
|
|
|
|
this.$set(data.children, data.children.length, {
|
|
|
|
|
id: id,
|
|
|
|
|
processId: scope.row.processId,
|
|
|
|
|
planStatus: this.PLAN_STATUS.DISPATCHED,
|
|
|
|
|
userId: ""
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
this.$set(data, 'children', [
|
|
|
|
|
{
|
|
|
|
|
id: id,
|
|
|
|
|
processId: scope.row.processId,
|
|
|
|
|
planStatus: this.PLAN_STATUS.DISPATCHED,
|
|
|
|
|
userId: "",
|
|
|
|
|
}
|
|
|
|
|
])
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.id += 1
|
|
|
|
|
// this.show = false
|
|
|
|
|
// this.show = true
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
isAssetTypeAnImage(ext) {
|
|
|
|
|
let suffix = ext.lastIndexOf(".");
|
|
|
|
|
let name = ext.substr(suffix + 1);
|
|
|
|
|
return ['png', 'jpg', 'jpeg'].includes(name.toLowerCase())
|
|
|
|
|
},
|
|
|
|
|
/** 提交按钮 */
|
|
|
|
|
submitForm() {
|
|
|
|
|
// let dataList = this.mesProductPlanList.filter(plan => !plan.oldRowFlag);
|
|
|
|
|
// if (dataList.length === 0) {
|
|
|
|
|
// this.close();
|
|
|
|
|
// return;
|
|
|
|
|
// }
|
|
|
|
|
let dataList = this.mesProductPlanList;
|
|
|
|
|
let toUpdatedProductPlans = [];
|
|
|
|
|
let undispathDesc;
|
|
|
|
|
for (let i = 0; i < dataList.length; i++) {
|
|
|
|
|
let e = dataList[i];
|
|
|
|
|
|
|
|
|
|
let dispatchFlag = false;
|
|
|
|
|
undispathDesc = "派工单号为[" + e.dispatchCode + "],工序为[" + e.processName + "],请选择用户派工";
|
|
|
|
|
if (!e.children || e.children.length <= 0) {
|
|
|
|
|
this.$modal.msgError(undispathDesc);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (let j = 0; j < e.children.length; j++) {
|
|
|
|
|
let processUser = e.children[j];
|
|
|
|
|
let toUpdatedProductPlan = deepClone(e);
|
|
|
|
|
if (processUser.userId && processUser.userId !== '') {
|
|
|
|
|
toUpdatedProductPlan.userId = processUser.userId;
|
|
|
|
|
toUpdatedProductPlan.planBeginTime = processUser.planBeginTime;
|
|
|
|
|
toUpdatedProductPlan.planEndTime = processUser.planEndTime;
|
|
|
|
|
toUpdatedProductPlan.planId = processUser.planId;
|
|
|
|
|
toUpdatedProductPlan.children = null;
|
|
|
|
|
let productionTimeHour = processUser.productionTime;
|
|
|
|
|
|
|
|
|
|
let productionTimeSecond = productionTimeHour*60*60;
|
|
|
|
|
toUpdatedProductPlan.productionTime = productionTimeSecond;
|
|
|
|
|
|
|
|
|
|
toUpdatedProductPlans.push(toUpdatedProductPlan);
|
|
|
|
|
dispatchFlag = true;
|
|
|
|
|
} else {
|
|
|
|
|
this.$modal.msgError(undispathDesc);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (toUpdatedProductPlans.length <= 0) {
|
|
|
|
|
this.$modal.msgError("无派工信息提交");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 校验派工数量(已派工数量 + 派工数量 <= 计划数量)
|
|
|
|
|
// 按照processId分组,所有分组的planAmount之和是否相等,相等后输出planAmount之和的值
|
|
|
|
|
let dispatchAmountErrorMsg = "";
|
|
|
|
|
const sumList = dataList.reduce((result, planData) => {
|
|
|
|
|
let processId = planData.processId;
|
|
|
|
|
let newFlag = planData.newFlag;
|
|
|
|
|
let dispatchAmount = planData.dispatchAmount;
|
|
|
|
|
if(newFlag && newFlag === "1"){
|
|
|
|
|
dispatchAmount = dispatchAmount == null || dispatchAmount === '' ? 0 : dispatchAmount;
|
|
|
|
|
const numericAmount = parseInt(dispatchAmount, 10);
|
|
|
|
|
if (!this.isPositiveInteger(numericAmount) || numericAmount <= 0) {
|
|
|
|
|
dispatchAmountErrorMsg = "派工数量须为大于等于0的正整数!";
|
|
|
|
|
}
|
|
|
|
|
if (!result[processId]) {
|
|
|
|
|
result[processId] = 0;
|
|
|
|
|
}
|
|
|
|
|
result[processId] = (result[processId] || 0) + numericAmount;
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}, {});
|
|
|
|
|
|
|
|
|
|
if (dispatchAmountErrorMsg !== "") {
|
|
|
|
|
this.$modal.msgError(dispatchAmountErrorMsg);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//一种快速去除数组中重复元素的方法,特别适合处理从对象中提取的属性值数组,(例如按工序相加的数量都是一样的,则去重后就剩一个数)
|
|
|
|
|
const uniqueSum = new Set(Object.values(sumList));
|
|
|
|
|
|
|
|
|
|
let currentDispatchAmount = 0;
|
|
|
|
|
if (uniqueSum.size === 1) {
|
|
|
|
|
const finalSum = Array.from(uniqueSum)[0];
|
|
|
|
|
currentDispatchAmount = finalSum;
|
|
|
|
|
let dispatchedAmount = this.form.dispatchAmount + finalSum;//加上此次派工的数量,总共的派工数量
|
|
|
|
|
if (dispatchedAmount > this.form.planAmount) {
|
|
|
|
|
this.$modal.msgError("每个工序的派工数量之和需小于等于该工单计划数量!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
} else if(uniqueSum.size >1){
|
|
|
|
|
this.$modal.msgError("每个工序的派工数量之和需相等!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// console.log(JSON.stringify(toUpdatedProductPlans));
|
|
|
|
|
// alert(this.toDeletedPlanIds)
|
|
|
|
|
// return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
orderAddMesProductPlanList(
|
|
|
|
|
{productOrderId:this.form.productOrderId,dispatchAmount:currentDispatchAmount,mesProductPlanList: toUpdatedProductPlans, toDeletedPlanIds: this.toDeletedPlanIds})
|
|
|
|
|
.then(res => {
|
|
|
|
|
this.$modal.msgSuccess(res.msg);
|
|
|
|
|
this.close();
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** 删除按钮操作 */
|
|
|
|
|
handleDeleteMesProductPlan(scope) {
|
|
|
|
|
let dispatchCode = scope.row.dispatchCode;
|
|
|
|
|
this.$modal.confirm('是否确认删除生产派工单号为"' + dispatchCode + '"的数据项?').then(function () {
|
|
|
|
|
return true;
|
|
|
|
|
}).then(() => {
|
|
|
|
|
if (scope.row.newFlag != null || scope.row.newFlag === '1') {
|
|
|
|
|
//新增删除
|
|
|
|
|
this.mesProductPlanList = this.mesProductPlanList.filter(function (item) {
|
|
|
|
|
return scope.row.dispatchCode !== item.dispatchCode
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
//历史删除
|
|
|
|
|
let dispatchSum = 0; //需要减去的派工数量
|
|
|
|
|
try {
|
|
|
|
|
const planIds = this.mesProductPlanList.filter(function (item) {
|
|
|
|
|
return scope.row.dispatchCode === item.dispatchCode
|
|
|
|
|
}).map(item => {
|
|
|
|
|
if (item.planStatus !== this.PLAN_STATUS.DISPATCHED && item.planStatus!== this.PLAN_STATUS.TO_DISPATCH) {
|
|
|
|
|
throw Error("只能删除还未开始过状态的生产派工单!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
dispatchSum = item.dispatchAmount;//派工数量每一个工序都一样
|
|
|
|
|
return item.planId;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
deleteProductPlansByDispatchCode({productOrderId:this.form.productOrderId,dispatchCode:dispatchCode,dispatchAmount:dispatchSum}).then(res => {
|
|
|
|
|
this.mesProductPlanList = this.mesProductPlanList.filter(function (item) {
|
|
|
|
|
return dispatchCode !== item.dispatchCode
|
|
|
|
|
});
|
|
|
|
|
this.form.dispatchAmount = this.form.dispatchAmount - dispatchSum;
|
|
|
|
|
this.$modal.msgSuccess("删除成功");
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} catch (e) {
|
|
|
|
|
this.$modal.msgError(e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}).catch(() => {
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
/** 生产计划明细序号 */
|
|
|
|
|
rowMesProductPlanIndex({row, rowIndex}) {
|
|
|
|
|
row.index = rowIndex + 1;
|
|
|
|
|
},
|
|
|
|
|
/** 复选框选中数据 */
|
|
|
|
|
handleMesProductPlanSelectionChange(selection) {
|
|
|
|
|
this.checkedMesProductPlanList = selection
|
|
|
|
|
this.single = selection.length !== 1
|
|
|
|
|
},
|
|
|
|
|
/** 关闭按钮 */
|
|
|
|
|
close() {
|
|
|
|
|
const obj = {path: "/mes/plan/productOrder", query: {t: Date.now(), queryParams: this.$route.query.queryParams}};
|
|
|
|
|
this.$tab.closeOpenPage(obj);
|
|
|
|
|
},
|
|
|
|
|
/** 查看图纸 */
|
|
|
|
|
handleDrawing(row) {
|
|
|
|
|
this.fileList = [];
|
|
|
|
|
this.uploadList = [];
|
|
|
|
|
if (row.planId != null) {
|
|
|
|
|
getDispatchDrawingList(row.planId).then(res => {
|
|
|
|
|
let attachList = res.data;
|
|
|
|
|
attachList.forEach(e => {
|
|
|
|
|
let previewFile = {};
|
|
|
|
|
previewFile.url = e.attachPath;
|
|
|
|
|
previewFile.name = e.attachName;
|
|
|
|
|
this.fileList.push(previewFile);
|
|
|
|
|
this.uploadList.push(e.attachId);
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
this.addProductPlanObject = row;
|
|
|
|
|
this.blueprintModel = true;
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/** 查看SOP附件 */
|
|
|
|
|
handleSOP(row) {
|
|
|
|
|
this.fileList = [];
|
|
|
|
|
this.uploadList = [];
|
|
|
|
|
if (row.planId != null) {
|
|
|
|
|
getDispatchSOPAttachList(row.planId).then(res => {
|
|
|
|
|
let attachList = res.data;
|
|
|
|
|
attachList.forEach(e => {
|
|
|
|
|
let previewFile = {};
|
|
|
|
|
previewFile.url = e.attachPath;
|
|
|
|
|
previewFile.name = e.attachName;
|
|
|
|
|
this.fileList.push(previewFile);
|
|
|
|
|
this.uploadList.push(e.attachId);
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
this.addProductPlanObject = row;
|
|
|
|
|
this.sopViewModel = true;
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/** 生产计划添加按钮操作 */
|
|
|
|
|
handleAddMesProductPlan() {
|
|
|
|
|
let dispatchCode = "";
|
|
|
|
|
getDispatchCode().then(res => {
|
|
|
|
|
dispatchCode = res.msg;
|
|
|
|
|
getBaseRouteProcesses({routeId: this.form.dispatchId}).then(res => {
|
|
|
|
|
// if (res.data.length === 0) {
|
|
|
|
|
// this.$modal.msgError("工艺路线未维护工位信息!");
|
|
|
|
|
// }
|
|
|
|
|
let lastProcessId = null;
|
|
|
|
|
let i = 0;
|
|
|
|
|
res.data.forEach((e, index) => {
|
|
|
|
|
let obj = {};
|
|
|
|
|
if(i===0){
|
|
|
|
|
obj.deleteFlag = "1";
|
|
|
|
|
i++;
|
|
|
|
|
}
|
|
|
|
|
obj.id = this.id
|
|
|
|
|
this.id = this.id + 1;
|
|
|
|
|
obj.dispatchCode = dispatchCode;
|
|
|
|
|
obj.processId = e.processId;
|
|
|
|
|
obj.processName = e.processName;
|
|
|
|
|
obj.processType = e.processType;
|
|
|
|
|
obj.processOrder = e.processOrder;
|
|
|
|
|
obj.productionTime = 0;
|
|
|
|
|
obj.planBeginTime = this.form.planBeginTime;
|
|
|
|
|
obj.planEndTime = this.form.planEndTime;
|
|
|
|
|
obj.planStatus = '1';
|
|
|
|
|
// obj.dispatchAmount = this.form.planAmount - this.form.dispatchAmount;
|
|
|
|
|
obj.dispatchFlag = null;
|
|
|
|
|
|
|
|
|
|
obj.materialId = this.form.materialId;
|
|
|
|
|
obj.materialBomId = this.form.materialBomId;
|
|
|
|
|
obj.productOrderId = this.form.productOrderId;
|
|
|
|
|
obj.saleOrderId = this.form.saleOrderId;
|
|
|
|
|
obj.saleorderCode = this.form.saleorderCode;
|
|
|
|
|
|
|
|
|
|
obj.newFlag = "1";//代表新增
|
|
|
|
|
|
|
|
|
|
// e.mesBaseProcessUserList.forEach((mesBaseProcessUser, index) => {
|
|
|
|
|
// mesBaseProcessUser.id = this.id + 1;
|
|
|
|
|
// mesBaseProcessUser.dispatchFlag = null;
|
|
|
|
|
// mesBaseProcessUser.planBeginTime = null;
|
|
|
|
|
// mesBaseProcessUser.planEndTime = null;
|
|
|
|
|
// this.id = this.id + 1;
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
|
|
obj.children = [{
|
|
|
|
|
id: this.id,
|
|
|
|
|
processId: obj.processId,
|
|
|
|
|
planStatus: this.PLAN_STATUS.DISPATCHED
|
|
|
|
|
}]
|
|
|
|
|
|
|
|
|
|
this.id += 1;
|
|
|
|
|
|
|
|
|
|
// 上一工序ID
|
|
|
|
|
if (lastProcessId == null) {
|
|
|
|
|
obj.lastProcessId = 0;
|
|
|
|
|
} else if (lastProcessId === obj.processId) {
|
|
|
|
|
obj.lastProcessId = this.mesProductPlanList[index - 1].lastProcessId;
|
|
|
|
|
} else {
|
|
|
|
|
obj.lastProcessId = lastProcessId;
|
|
|
|
|
}
|
|
|
|
|
lastProcessId = e.processId;
|
|
|
|
|
// 新添加列标识 false=新添加,true=历史行
|
|
|
|
|
obj.oldRowFlag = false;
|
|
|
|
|
this.mesProductPlanList.push(obj);
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
this.getId(this.mesProductPlanList)
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
isPositiveInteger(value) {
|
|
|
|
|
// 使用正则表达式匹配正整数
|
|
|
|
|
return /^[0-9]\d*$/.test(value);
|
|
|
|
|
},
|
|
|
|
|
//查看图纸预览
|
|
|
|
|
handlePictureCardPreview(file) {
|
|
|
|
|
this.dialogImageUrl = file.url;
|
|
|
|
|
this.pictureDetailModel = true;
|
|
|
|
|
},
|
|
|
|
|
//图纸下载
|
|
|
|
|
handleDownload(file) {
|
|
|
|
|
window.open(file.url);
|
|
|
|
|
},
|
|
|
|
|
//添加图纸提交
|
|
|
|
|
drawingFileUploadSubmit() {
|
|
|
|
|
// 新添加列标识 false=新添加,true=历史行
|
|
|
|
|
if (this.addProductPlanObject.oldRowFlag) {
|
|
|
|
|
updateProductplan({
|
|
|
|
|
planId: this.addProductPlanObject.planId,
|
|
|
|
|
attachId: this.uploadList.join(","),
|
|
|
|
|
}).then(res => {
|
|
|
|
|
this.$modal.msgSuccess("上传图纸成功!");
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
} else {
|
|
|
|
|
for (let i = 0; i < this.mesProductPlanList.length; i++) {
|
|
|
|
|
if (this.mesProductPlanList[i].index === this.addProductPlanObject.index) {
|
|
|
|
|
this.mesProductPlanList[i].attachId = this.uploadList.join(",");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
this.uploadList = [];
|
|
|
|
|
this.addProductPlanObject = null;
|
|
|
|
|
this.blueprintModel = false;
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
//添加SOP附件提交
|
|
|
|
|
sopFileUploadSubmit() {
|
|
|
|
|
// 新添加列标识 false=新添加,true=历史行
|
|
|
|
|
if (this.addProductPlanObject.oldRowFlag) {
|
|
|
|
|
updateProductplan({
|
|
|
|
|
planId: this.addProductPlanObject.planId,
|
|
|
|
|
sopId: this.uploadList.join(","),
|
|
|
|
|
}).then(res => {
|
|
|
|
|
this.$modal.msgSuccess("上传SOP附件成功!");
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
} else {
|
|
|
|
|
for (let i = 0; i < this.mesProductPlanList.length; i++) {
|
|
|
|
|
if (this.mesProductPlanList[i].index === this.addProductPlanObject.index) {
|
|
|
|
|
this.mesProductPlanList[i].sopId = this.uploadList.join(",");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
this.uploadList = [];
|
|
|
|
|
this.addProductPlanObject = null;
|
|
|
|
|
this.sopViewModel = false;
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
//图片上传
|
|
|
|
|
httpRequest(file) {
|
|
|
|
|
// 文件信息
|
|
|
|
|
const fileData = file.file;
|
|
|
|
|
const formData = new FormData();
|
|
|
|
|
formData.append("file", fileData);
|
|
|
|
|
formData.append("processId", this.addProductPlanObject.processId);
|
|
|
|
|
formData.append("attachType", "1");
|
|
|
|
|
uploadFile(formData).then(
|
|
|
|
|
(res) => {
|
|
|
|
|
// 存储附件信息主键
|
|
|
|
|
this.uploadList.push(res.attachId);
|
|
|
|
|
}, (err) => {
|
|
|
|
|
this.$refs.drawingUpload.clearFiles(); //上传失败后清除当前上传的图片
|
|
|
|
|
this.$modal.closeLoading();
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
// 上传结束处理
|
|
|
|
|
uploadedSuccessfully() {
|
|
|
|
|
if (this.number > 0 && this.uploadList.length === this.number) {
|
|
|
|
|
this.fileList = this.fileList.concat(this.uploadList);
|
|
|
|
|
this.uploadList = [];
|
|
|
|
|
this.number = 0;
|
|
|
|
|
this.form.monitorPic = this.fileList[0];
|
|
|
|
|
this.$modal.closeLoading();
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
//删除上传的图片
|
|
|
|
|
handleRemove(file) {
|
|
|
|
|
let arrPic = this.$refs.drawingUpload.uploadFiles;
|
|
|
|
|
let index = arrPic.indexOf(file);
|
|
|
|
|
this.uploadList.splice(index, 1);
|
|
|
|
|
let num = 0;
|
|
|
|
|
arrPic.map((item) => {
|
|
|
|
|
if (item.uid === file.uid) {
|
|
|
|
|
arrPic.splice(num, 1);
|
|
|
|
|
}
|
|
|
|
|
num++;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
// 上传前loading加载
|
|
|
|
|
handleBeforeUpload(file) {
|
|
|
|
|
// let isImg = false;
|
|
|
|
|
// if (this.fileType.length) {
|
|
|
|
|
// let fileExtension = "";
|
|
|
|
|
// if (file.name.lastIndexOf(".") > -1) {
|
|
|
|
|
// fileExtension = file.name.slice(file.name.lastIndexOf(".") + 1);
|
|
|
|
|
// }
|
|
|
|
|
// isImg = this.fileType.some(type => {
|
|
|
|
|
// if (file.type.indexOf(type) > -1) return true;
|
|
|
|
|
// if (fileExtension && fileExtension.indexOf(type) > -1) return true;
|
|
|
|
|
// return false;
|
|
|
|
|
// });
|
|
|
|
|
// } else {
|
|
|
|
|
// isImg = file.type.indexOf("image") > -1;
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// if (!isImg) {
|
|
|
|
|
// this.$modal.msgError(`文件格式不正确, 请上传${this.fileType.join("/")}图片格式文件!`);
|
|
|
|
|
// return false;
|
|
|
|
|
// }
|
|
|
|
|
// if (this.fileSize) {
|
|
|
|
|
// const isLt = file.size / 1024 / 1024 < this.fileSize;
|
|
|
|
|
// if (!isLt) {
|
|
|
|
|
// this.$modal.msgError(`上传头像图片大小不能超过 ${this.fileSize} MB!`);
|
|
|
|
|
// return false;
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// this.$modal.loading("正在上传图片,请稍候...");
|
|
|
|
|
// this.number++;
|
|
|
|
|
},
|
|
|
|
|
// 文件个数超出
|
|
|
|
|
handleExceed() {
|
|
|
|
|
this.$modal.msgError(`上传文件数量不能超过 ${this.limit} !`);
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
handleDeleteDispatchUser(row) {
|
|
|
|
|
this.mesProductPlanList.forEach(mesProductPlan => {
|
|
|
|
|
mesProductPlan.children = mesProductPlan.children.filter(item => item.id !== row.id);
|
|
|
|
|
});
|
|
|
|
|
if (row.planId != null && row.planId !== '') {
|
|
|
|
|
this.toDeletedPlanIds.push(row.planId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
,
|
|
|
|
|
|
|
|
|
|
mounted() {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
;
|
|
|
|
|
</script>
|