Commit f0fa1859 authored by 沈翠玲's avatar 沈翠玲

生产版本修改

parent 3b5aa44e
<template>
<div>
<el-table :data="tableData">
<el-table-column label="序号" prop="idx" align="center" />
<el-table-column label="工序名称" prop="processName" align="center" />
<el-table-column label="工作中心" prop="workstationName" align="center" />
<el-table-column label="标准工时" prop="stdWorkingTime" align="center" />
<el-table-column label="换型时间" prop="lineBreakTime" align="center" />
<el-table-column align="center" label="" width="215">
<template slot-scope="scope">
<el-button
size="mini"
class="opt-btn"
icon="el-icon-minus"
@click="delRow(scope.$index, scope.row)"
>
</el-button>
<el-button
size="mini"
class="opt-btn"
icon="el-icon-bottom"
:disabled="scope.$index === tableData.length - 1"
@click="moveDown(scope.$index, scope.row)"
>
</el-button>
<el-button
size="mini"
class="opt-btn"
icon="el-icon-top"
:disabled="scope.$index === 0"
@click="moveUp(scope.$index, scope.row)"
>
</el-button>
<el-button
size="mini"
class="opt-btn"
:style="{'visibility': scope.$index === tableData.length - 1 ? '' : 'hidden'}"
icon="el-icon-plus"
@click="addRow(scope.$index, scope.row)"
>
</el-button>
</template>
</el-table-column>
<!-- <el-table-column label="序号" type="index" align="center" /> -->
<el-table-column label="工序名称" prop="processName" align="center" >
<template slot-scope="scope">
<el-select v-model="scope.row.processName" placeholder="" filterable :disabled="mode == 'info'"
remote
:remote-method="getProcess"
:loading="loadingProcess"
@change="(v) => chooseprocessName(v, scope.row, scope.$index)">
<el-option
v-for="item in processOptions"
:key="item.processId"
:label="item.processName"
:value="item.processName"
></el-option>
</el-select>
</template>
</el-table-column>
<el-table-column label="工作中心" prop="workstationId" align="center" >
<template slot-scope="scope">
<el-select v-model="scope.row.workstationId" :disabled="mode == 'info'" placeholder="" filterable @change="(v) => chooseworkstationName(v, scope.row, scope.$index)">
<el-option
v-for="dict in workstationList"
:key="dict.workstationId"
:label="dict.workstationName"
:value="dict.workstationId"
/>
</el-select>
</template>
</el-table-column>
<el-table-column label="标准工时" prop="stdWorkingTime" align="center" >
<template slot-scope="scope">
<el-input
v-model="scope.row.stdWorkingTime"
placeholder=""
:disabled="mode == 'info'"
clearable
/>
</template>
</el-table-column>
<el-table-column label="换型时间" prop="lineBreakTime" align="center" >
<template slot-scope="scope">
<el-input
v-model="scope.row.lineBreakTime"
placeholder=""
:disabled="mode == 'info'"
clearable
/>
</template>
</el-table-column>
<el-table-column
label="工时单位"
prop="stdWorkingTimeUom"
align="center"
/>
>
<template slot-scope="scope">
<el-input
v-model="scope.row.stdWorkingTimeUom"
placeholder=""
:disabled="mode == 'info'"
clearable
/>
</template>
</el-table-column>
<el-table-column
label="加工方式"
prop="processingMethod"
label="是否外协"
prop="outsourced"
align="center"
width="215"
>
<template slot-scope="scope">
<dict-tag
:options="dict.type.process_control_code"
:value="scope.row.processingMethod"
<el-select
v-model="scope.row.outsourced" v-if="mode !== 'info'"
placeholder=""
clearable
>
<el-option
v-for="dict in dict.type.sys_yes_no"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
<dict-tag v-else
:options="dict.type.sys_yes_no"
:value="scope.row.outsourced"
/>
</template>
</el-table-column>
<el-table-column label="计量单位" prop="unitOfMeasure" align="center" >
<template slot-scope="scope">
<el-input
v-model="scope.row.unitOfMeasure"
placeholder=""
clearable
/>
</template>
</el-table-column>
<el-table-column label="基本数量" prop="quantity" align="center" />
<el-table-column label="计量单位" prop="unitOfMeasure" align="center" />
<el-table-column label="关键工序" prop="keyFlag" align="center">
<template slot-scope="scope">
<el-select
v-model="scope.row.keyFlag" v-if="mode !== 'info'"
placeholder=""
clearable
>
<el-option
v-for="dict in dict.type.sys_yes_no"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
<dict-tag
v-else
:options="dict.type.sys_yes_no"
:value="scope.row.keyFlag"
/>
......@@ -36,13 +155,45 @@
</el-table-column>
<el-table-column label="是否质检" prop="isCheck" align="center">
<template slot-scope="scope">
<el-select
v-model="scope.row.isCheck" v-if="mode !== 'info'"
placeholder=""
clearable
>
<el-option
v-for="dict in dict.type.sys_yes_no"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
<dict-tag
v-else
:options="dict.type.sys_yes_no"
:value="scope.row.isCheck"
/>
</template>
</el-table-column>
<el-table-column
<el-table-column label="工序备注" prop="processRemark" align="center" >
<template slot-scope="scope">
<el-input
v-model="scope.row.processRemark"
placeholder=""
clearable
/>
</template>
</el-table-column>
<el-table-column label="图纸上传" prop="processRemark" align="center" >
<template slot-scope="scope">
<el-button
size="mini"
icon="el-icon-upload"
@click="openUploadDialog(scope.row, scope.$index)"
>
</el-button>
</template>
</el-table-column>
<!-- <el-table-column
v-if="mode != 'info'"
label="操作"
align="center"
......@@ -93,7 +244,7 @@
>查看工序信息</el-button
>
</template>
</el-table-column>
</el-table-column> -->
</el-table>
<ProcessProd
......@@ -104,7 +255,7 @@
/>
<ProcessQcindex :process="currentRow" ref="ProcessQcindexRef" />
<ProcessTool :process="currentRow" ref="ProcessToolRef" />
<uploadTuzhi ref="uploadTuzhiRef" :process="currentRow" @updateItem="updateItemUpload" />
<el-dialog
v-dialogDrag
:visible.sync="showFlag"
......@@ -175,15 +326,6 @@
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="基本数量" prop="quantity">
<el-input
type="number"
v-model="form.quantity"
placeholder="请输入基本数量"
></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="工序计量单位" prop="unitOfMeasure">
<el-input
......@@ -309,10 +451,14 @@
</template>
<script>
import {listAllProcess} from "@/api/mes/pro/process";
import {
getworkstationList} from '@/api/mes/pro/scheduleList'
import ItemBomSelect from "@/components/itemBomSelect/single.vue";
import ProcessProd from "./ProcessProd.vue";
import ProcessQcindex from "./ProcessQcindex.vue";
import ProcessTool from "./ProcessTool.vue";
import uploadTuzhi from "./uploadTuzhi.vue";
import WorkstationSelect from "@/components/workstationSelect/simpletableSingle.vue";
export default {
components: {
......@@ -320,6 +466,7 @@ export default {
ProcessProd,
ProcessQcindex,
ProcessTool,
uploadTuzhi,
WorkstationSelect,
},
inject: ["mode"],
......@@ -341,6 +488,24 @@ export default {
showFlag: false,
/**表格数据 */
tableData: [],
workstationList: [],
breakData: {
processName: null,
processId: null,
processCode: null,
workstationName: null,
workstationId: null,
workstationCode: null,
stdWorkingTime: null,
lineBreakTime: null,
stdWorkingTimeUom: null,
outsourced: null,
unitOfMeasure: null,
keyFlag: null,
isCheck: null
},
processOptions: [],
loadingProcess: true,
/**表单规则 */
rules: {},
/**表单初始化数据 */
......@@ -385,19 +550,86 @@ export default {
currentRowIndex: undefined,
};
},
created (){
this.tableData = [JSON.parse(JSON.stringify(this.breakData))]
this.getProcess()
this.hanldeGetworkstationList()
},
methods: {
async hanldeGetworkstationList() {
const response = await getworkstationList({workshopId: null})
this.workstationList = response.rows
},
//查询工序信息
getProcess(keyword = null){
this.loadingProcess = true
listAllProcess({processName: keyword}).then( response =>{
this.processOptions = response.data;
this.loadingProcess = false
});
},
// 上移
moveUp(index, row) {
if (index > 0) {
const upDate = this.tableData[index - 1];
this.tableData.splice(index - 1, 1);
this.tableData.splice(index, 0, upDate);
} else {
console.log("已经是第一条,不可上移");
}
},
// 下移
moveDown(index, row) {
if (index + 1 === this.tableData.length) {
console.log("已经是最后一条,不可下移");
} else {
const downDate = this.tableData[index + 1];
this.tableData.splice(index + 1, 1);
this.tableData.splice(index, 0, downDate);
}
},
delRow(index) {
this.$confirm('确定删除这条数据吗', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
if(this.tableData.length > 1) {
this.tableData.splice(index, 1);
} else {
this.$message.warning('最后一条数据不可以删除')
}
}).catch(() => {
});
},
openUploadDialog(row, idx){
this.currentRow = row;
this.currentRowIndex = idx;
this.$refs["uploadTuzhiRef"].showOpen = true
},
addRow(){
if(!this.tableData[this.tableData.length - 1]['processName']){
this.$message.warning('已经有一条空白数据')
} else {
this.tableData.push(JSON.parse(JSON.stringify(this.breakData)))
}
},
setList(rows) {
this.tableData = rows.map((item) => {
item.processItemList = [];
item.qcindexList = [];
item.toolList = [];
return item;
});
if(this.mode !== 'info') {
this.tableData.push(JSON.parse(JSON.stringify(this.breakData)))
}
},
/** 更新工序的物料信息 */
updateItem(items) {
this.tableData[this.currentRowIndex].processItemList = items;
},
updateItemUpload(items) {
// this.tableData[this.currentRowIndex].processItemList = items;
},
openSetProd(row, idx) {
this.currentRow = row;
this.currentRowIndex = idx;
......@@ -460,7 +692,7 @@ export default {
});
},
getComData() {
return this.tableData;
return this.tableData.filter(item => Object.values(item).some(v => v) );
},
/**重置表单 */
resetForm() {
......@@ -503,10 +735,24 @@ export default {
};
},
chooseprocessName(e, row, index) {
console.log('e', e)
const item = this.processOptions.find(v => v.processName === e)
row['processId'] = item.processId
row['processCode'] = item.processCode
if (e && this.tableData[this.tableData.length - 1]['processName']) {
this.tableData.push(JSON.parse(JSON.stringify(this.breakData)))
}
},
chooseworkstationName(e, row, index) {
const item = this.workstationList.find(v => v.workstationId === e)
row['workstationName'] = item.workstationName
row['workstationCode'] = item.workstationCode
},
/**重置组件状态 */
resetState() {
this.resetForm();
this.tableData = [];
this.tableData = [JSON.parse(JSON.stringify(this.breakData))];
},
// 查询工作中心信息
handleWorkstationSelect() {
......@@ -523,4 +769,8 @@ export default {
};
</script>
<style></style>
<style lang="scss" scoped>
.opt-btn{
padding: 7px !important;
}
</style>
<template>
<div class="process-prod">
<!-- 上传文件弹窗 -->
<el-dialog
:visible.sync="showOpen"
width="800px"
:before-close="beforeClose"
append-to-body
title="上传文件"
>
<el-row>
<el-col :span="3">
<el-upload
class="upload-demo"
ref="upload"
:action="baseURL + '/common/uploadMinio '"
:before-upload="handleBeforeUpload"
:on-success="handleUploadSuccess"
:on-error="handleUploadError"
name="file"
:headers="headers"
:show-file-list="false">
<el-button size="small" type="primary" :loading="loading">选择文件上传</el-button>
</el-upload>
</el-col>
</el-row>
<div class="upload-list">
<el-table :data="uploadlist">
<el-table-column align="left" label="名称" width="215" prop="name" >
<template slot-scope="scope">
<i class="el-icon-document"></i>
{{scope.row.name}}
</template>
</el-table-column>
<el-table-column align="center" label="大小" prop="size" />
<el-table-column align="center" label="操作" >
<template slot-scope="scope">
<el-button size="small" type="primary" @click="delItem(scope.row, scope.$index)">删除</el-button>
</template>
</el-table-column>
</el-table>
</div>
</el-dialog>
</div>
</template>
<script>
import { getToken } from "@/utils/auth";
export default {
props: {
process: {
type: Object,
default: () => ({}),
}
},
data() {
return {
uploadlist: [{name: 'sadas', url: 'ads'}],
baseURL: process.env.VUE_APP_BASE_API,
headers: {
Authorization: "Bearer " + getToken()
},
showOpen: false,
loading: false
}
},
created (){
},
methods: {
beforeClose(done) {
// 更新父组件的processItemList
this.$emit("updateItem", this.uploadlist);
done();
},
handleBeforeUpload(file) {
this.loading = true
// 校检文件后缀名
// if(file && file.name && file.name.substring(file.name.lastIndexOf('.') + 1) === 'apk') {
return true;
// } else {
// this.$message.error('请上传APK安装包');
// this.loading = false
// return false;
// }
},
delItem(item, index) {
this.uploadlist.splice(index, 1)
},
handleUploadSuccess(res, file) {
this.loading = false
// 如果上传成功
if (res.code == 200) {
this.uploadlist.push({url: url, name: file.name, size: file.size})
this.$message.success("文件上传成功");
} else {
this.$message.error("文件上传失败");
}
this.$refs.upload.clearFiles();
},
handleUploadError() {
this.loading = false
this.$message.error("文件上传失败");
}
}
}
</script>
<style lang="scss" scoped>
.el-icon-document {
color: #3578ff;
}
</style>
\ No newline at end of file
......@@ -28,7 +28,6 @@
<el-form-item label="生产版本编码" prop="productionSolutionCode">
<el-input
v-model="form.productionSolutionCode"
disabled
placeholder
></el-input>
</el-form-item>
......@@ -37,35 +36,20 @@
<el-form-item label="生产版本名称" prop="productionSolutionName">
<el-input
v-model="form.productionSolutionName"
disabled
placeholder
></el-input>
</el-form-item>
</el-col>
<el-col :lg="6" :md="8" :sm="12" :xs="12">
<el-form-item label="生产版本类型" prop="productionSolutionType">
<el-select
v-model="form.productionSolutionType"
clearable
placeholder="请选择项目类别"
>
<el-option
v-for="dict in dict.type.production_solution_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
>
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :lg="6" :md="8" :sm="12" :xs="12">
<el-form-item label="生产用途" prop="usageName">
<el-input
v-model="form.usageName"
disabled
placeholder
></el-input>
<el-form-item label="产品编码" prop="itemCode">
<el-input :disabled="mode == 'info'" v-model="form.itemCode" placeholder="请选择产品">
<el-button
slot="append"
v-if="mode !== 'info'"
@click="handleSelectProduct"
icon="el-icon-search"
></el-button>
</el-input>
</el-form-item>
</el-col>
<el-col :lg="6" :md="8" :sm="12" :xs="12">
......@@ -106,8 +90,6 @@
></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :lg="6" :md="8" :sm="12" :xs="12">
<el-form-item label="备注" prop="remark">
<el-input
......@@ -122,19 +104,20 @@
</el-form>
<el-tabs type="border-card" @tab-click="tabClick">
<el-tab-pane label="BOM">
<ProogingBom ref="ProogingBomRef" />
</el-tab-pane>
<!-- <el-tab-pane label="BOM" style="display: none"> -->
<ProogingBom ref="ProogingBomRef" style="display: none"/>
<!-- </el-tab-pane> -->
<el-tab-pane label="工艺">
<ProogingProcess ref="ProogingProcessRef" :bomList="bomList" />
</el-tab-pane>
</el-tabs>
</PageWrapper>
<ItemSelect ref="itemSelect" @onSelected="onItemSelected"> </ItemSelect>
</div>
</template>
<script>
// import { genCode } from "@/api/system/autocode/rule";
import { genCode } from "@/api/system/autocode/rule";
import ProogingBom from "./components/ProogingBom.vue";
import ProogingProcess from "./components/ProogingProcess.vue";
import ItemSelect from "@/components/itemSelect/single.vue";
......@@ -156,7 +139,6 @@ export default {
ItemSelect,
RoutesProcessSelect
},
dicts: ["production_solution_type", "production_solution_usage"],
provide() {
return {
mode: this.mode,
......@@ -195,6 +177,7 @@ export default {
remark: "",
createBy: "",
createTime: "",
itemCode: "",
updateBy: "",
updateTime: "",
},
......@@ -222,6 +205,7 @@ export default {
if (this.$route.query && this.$route.query.productionSolutionId && this.productionSolutionId !== this.$route.query.productionSolutionId) {
this.productionSolutionId = this.$route.query.productionSolutionId
}
if(this.mode === 'apply') this.handleAutoGenChange()
this.getFormInfo();
},
activated() {
......@@ -232,6 +216,25 @@ export default {
}
},
methods: {
//自动生成编码
handleAutoGenChange() {
genCode("PRO_SOLUTION_CODE").then((response) => {
this.form.productionSolutionCode = response;
});
},
//物料选择弹出框
onItemSelected(obj) {
if (obj != undefined && obj != null) {
this.form.itemCode = obj.itemCode;
this.form.itemName = obj.itemName;
this.form.sapItemCode = obj.sapItemCode;
this.form.productionSolutionName = obj.itemName;
this.form.unitOfMeasure = obj.unitOfMeasure;
}
},
handleSelectProduct() {
this.$refs.itemSelect.showFlag = true;
},
/** 根据 id 获取页面数据 */
getFormInfo() {
if (this.mode != "apply") {
......@@ -244,7 +247,7 @@ export default {
// 设置组件数据
this.$refs["ProogingBomRef"].form2 = data.bomHead;
this.$refs["ProogingBomRef"].tableData = data.bomHead.bomItemList;
this.$refs["ProogingProcessRef"].tableData = data.processList;
this.$refs["ProogingProcessRef"].setList(data.processList)
})
.finally(() => {
this.loading = false;
......@@ -264,21 +267,6 @@ export default {
this.form.unit = row.unitOfMeasure;
}
},
onRoutesProcessSelect(row) {
if (row != undefined && row != null) {
this.form.routeId = row.routeId;
this.form.routeName = row.routeName;
const params = {
pageNum: 1,
pageSize: 1000,
routeId: row.routeId,
};
listRouteprocess(params).then(({ rows }) => {
this.$refs["ProogingProcessRef"].setList(rows);
});
}
},
/**提交 */
saveForm() {
const bomHead = this.$refs.ProogingBomRef.getComData();
......@@ -286,7 +274,8 @@ export default {
const params = {
...this.form,
bomHead,
processList
processList,
specificationSheet: {}
};
this.loading = true;
if (this.mode == "apply") {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment