|
|
@@ -1,25 +1,13 @@
|
|
|
<!-- 用户编辑弹窗 -->
|
|
|
<template>
|
|
|
- <ele-modal
|
|
|
- width="960px"
|
|
|
- :visible="visible"
|
|
|
- :append-to-body="true"
|
|
|
- :close-on-click-modal="true"
|
|
|
- custom-class="ele-dialog-form"
|
|
|
- :title="isUpdate ? '修改工序' : '添加工序'"
|
|
|
- @update:visible="updateVisible"
|
|
|
- >
|
|
|
+ <ele-modal width="960px" :visible="visible" :append-to-body="true" :close-on-click-modal="true"
|
|
|
+ custom-class="ele-dialog-form" :title="isUpdate ? '修改工序' : '添加工序'" @update:visible="updateVisible">
|
|
|
<header-title title="基本信息"></header-title>
|
|
|
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
|
|
|
<el-row>
|
|
|
<el-col :span="8">
|
|
|
<el-form-item label="工序编码:" prop="code">
|
|
|
- <el-input
|
|
|
- clearable
|
|
|
- disabled
|
|
|
- v-model="form.code"
|
|
|
- placeholder="请输入"
|
|
|
- />
|
|
|
+ <el-input clearable disabled v-model="form.code" placeholder="请输入" />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
|
|
|
@@ -30,23 +18,18 @@
|
|
|
</el-col>
|
|
|
<el-col :span="8">
|
|
|
<el-form-item label="控制码:" prop="controlId">
|
|
|
- <el-select v-model="form.controlId" filterable>
|
|
|
- <el-option
|
|
|
- v-for="item in controlList"
|
|
|
- :key="item.id"
|
|
|
- :label="item.name"
|
|
|
- :value="item.id"
|
|
|
- >
|
|
|
- </el-option>
|
|
|
- </el-select>
|
|
|
+ <el-select v-model="form.controlId" filterable>
|
|
|
+ <el-option v-for="item in controlList" :key="item.id" :label="item.name" :value="item.id">
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="8">
|
|
|
<el-form-item label="工作中心:" prop="workCenterName">
|
|
|
- <el-input @click.native="chooseWorkCenter" v-model="form.workCenterName" readonly/>
|
|
|
+ <el-input @click.native="chooseWorkCenter" v-model="form.workCenterName" readonly />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <el-col :span="8">
|
|
|
+ <!-- <el-col :span="8">
|
|
|
<el-form-item label="工序时间单位:" prop="timeUnit">
|
|
|
<el-select v-model="form.timeUnit" filterable>
|
|
|
<el-option
|
|
|
@@ -58,12 +41,48 @@
|
|
|
</el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
- </el-col>
|
|
|
+ </el-col> -->
|
|
|
</el-row>
|
|
|
</el-form>
|
|
|
<header-title title="工序节拍时间"></header-title>
|
|
|
<el-form :model="form" label-width="120px">
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
<el-row>
|
|
|
+
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="节拍生产数量" prop="beatProduceNum">
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="16">
|
|
|
+ <el-input placeholder="请输入" v-model.number="form.workBeat.beatProduceNum">
|
|
|
+ </el-input></el-col>
|
|
|
+ <el-col :span="1"> </el-col>
|
|
|
+ <el-col :span="7">
|
|
|
+ <DictSelection dictName="计量单位" v-model="form.workBeat.beatProduceUnit" />
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+
|
|
|
+
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="对应物料基本数" prop="categoryNum">
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="16">
|
|
|
+ <el-input placeholder="请输入" v-model.number="form.workBeat.categoryNum">
|
|
|
+ </el-input></el-col>
|
|
|
+ <el-col :span="1"> </el-col>
|
|
|
+ <el-col :span="7">
|
|
|
+ <DictSelection dictName="计量单位" v-model="form.workBeat.categoryUnit" />
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
<el-col :span="8">
|
|
|
<el-form-item label="工序休息时长:">
|
|
|
<el-input v-model="form.workBeat.restTimes" placeholder="请输入" />
|
|
|
@@ -72,11 +91,7 @@
|
|
|
|
|
|
<el-col :span="8">
|
|
|
<el-form-item label="工序准备时长:">
|
|
|
- <el-input
|
|
|
- v-model="form.workBeat.preTimes"
|
|
|
- clearable
|
|
|
- placeholder="请输入"
|
|
|
- />
|
|
|
+ <el-input v-model="form.workBeat.preTimes" clearable placeholder="请输入" />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="8">
|
|
|
@@ -94,6 +109,13 @@
|
|
|
<el-input disabled :value="totalTime"></el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
+
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="节拍时间单位:" prop="workBeat.beatTimesUnit`">
|
|
|
+ <DictSelection dictName="时间单位" v-model="form.workBeat.beatTimesUnit" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+
|
|
|
</el-row>
|
|
|
</el-form>
|
|
|
<header-title title="工序间隔时间"></header-title>
|
|
|
@@ -103,12 +125,7 @@
|
|
|
<el-col :span="12">
|
|
|
<el-form-item label="间隔策略:">
|
|
|
<el-select v-model="form.intervalTime.tactics" filterable>
|
|
|
- <el-option
|
|
|
- v-for="item in tacticsType"
|
|
|
- :key="item.code"
|
|
|
- :label="item.label"
|
|
|
- :value="item.code"
|
|
|
- >
|
|
|
+ <el-option v-for="item in tacticsType" :key="item.code" :label="item.label" :value="item.code">
|
|
|
</el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
@@ -116,50 +133,32 @@
|
|
|
</el-col>
|
|
|
<el-col :span="12">
|
|
|
<el-form-item label="下工序标准准备时间:">
|
|
|
- <el-input
|
|
|
- v-model="form.intervalTime.nextStandardPreTime"
|
|
|
- placeholder="请输入"
|
|
|
- />
|
|
|
+ <el-input v-model="form.intervalTime.nextStandardPreTime" placeholder="请输入" />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="12">
|
|
|
<el-form-item label="下工序最短准备时间:">
|
|
|
- <el-input
|
|
|
- v-model="form.intervalTime.nextShortPreTime"
|
|
|
- placeholder="请输入"
|
|
|
- />
|
|
|
+ <el-input v-model="form.intervalTime.nextShortPreTime" placeholder="请输入" />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="12">
|
|
|
<el-form-item label="本工序标准等待时间:">
|
|
|
- <el-input
|
|
|
- v-model="form.intervalTime.thisStandardWaitTime"
|
|
|
- placeholder="请输入"
|
|
|
- />
|
|
|
+ <el-input v-model="form.intervalTime.thisStandardWaitTime" placeholder="请输入" />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="12">
|
|
|
<el-form-item label="本工序最短准备时间:">
|
|
|
- <el-input
|
|
|
- v-model="form.intervalTime.thisShortPreTime"
|
|
|
- placeholder="请输入"
|
|
|
- />
|
|
|
+ <el-input v-model="form.intervalTime.thisShortPreTime" placeholder="请输入" />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="12">
|
|
|
<el-form-item label="本工序结束后标准周转时间:">
|
|
|
- <el-input
|
|
|
- v-model="form.intervalTime.thisStandardBoatTime"
|
|
|
- placeholder="请输入"
|
|
|
- />
|
|
|
+ <el-input v-model="form.intervalTime.thisStandardBoatTime" placeholder="请输入" />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="12">
|
|
|
<el-form-item label="本工序结束后周转最短时间:">
|
|
|
- <el-input
|
|
|
- v-model="form.intervalTime.thisShortBoatTime"
|
|
|
- placeholder="请输入"
|
|
|
- />
|
|
|
+ <el-input v-model="form.intervalTime.thisShortBoatTime" placeholder="请输入" />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
@@ -173,167 +172,172 @@
|
|
|
</template>
|
|
|
|
|
|
<!-- 工作中心弹窗 -->
|
|
|
- <WorkCenter ref="centerRefs" @changeCenter='determineChoose'/>
|
|
|
+ <WorkCenter ref="centerRefs" @changeCenter='determineChoose' />
|
|
|
</ele-modal>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
- import producetask from '@/api/technology/production';
|
|
|
- import WorkCenter from './WorkCenter.vue';
|
|
|
- const defaultForm = {
|
|
|
- id: null,
|
|
|
- code: '',
|
|
|
- name: '',
|
|
|
- controlId: '',
|
|
|
- workCenterId: '',
|
|
|
- workCenterName:'',
|
|
|
- timeUnit: '',
|
|
|
- intervalTime: {
|
|
|
- nextShortPreTime: '', // 时间单位转换后的下一个短周期的时间,格式为YYYY-MM-DDTHH'
|
|
|
- nextStandardPreTime: '', // 时间单位转换后的下一个正式的周期的时间,格式为YYYY-MM-DD'
|
|
|
- tactics: 1, // 周期工艺描述,格式为JSON字符串或数组形式的对象形式的数据类
|
|
|
- thisShortBoatTime: '',
|
|
|
- thisShortPreTime: '',
|
|
|
- thisStandardBoatTime: '',
|
|
|
- thisStandardWaitTime: ''
|
|
|
- },
|
|
|
+import producetask from '@/api/technology/production';
|
|
|
+import WorkCenter from './WorkCenter.vue';
|
|
|
+const defaultForm = {
|
|
|
+ id: null,
|
|
|
+ code: '',
|
|
|
+ name: '',
|
|
|
+ controlId: '',
|
|
|
+ workCenterId: '',
|
|
|
+ workCenterName: '',
|
|
|
+ timeUnit: '',
|
|
|
+ intervalTime: {
|
|
|
+ nextShortPreTime: '', // 时间单位转换后的下一个短周期的时间,格式为YYYY-MM-DDTHH'
|
|
|
+ nextStandardPreTime: '', // 时间单位转换后的下一个正式的周期的时间,格式为YYYY-MM-DD'
|
|
|
+ tactics: 1, // 周期工艺描述,格式为JSON字符串或数组形式的对象形式的数据类
|
|
|
+ thisShortBoatTime: '',
|
|
|
+ thisShortPreTime: '',
|
|
|
+ thisStandardBoatTime: '',
|
|
|
+ thisStandardWaitTime: ''
|
|
|
+ },
|
|
|
|
|
|
- workBeat: {
|
|
|
- beatTimes: '',
|
|
|
- otherTimes: '',
|
|
|
- preTimes: '',
|
|
|
- proTimes: '',
|
|
|
- restTimes: ''
|
|
|
- }
|
|
|
- };
|
|
|
- export default {
|
|
|
- components:{
|
|
|
- WorkCenter
|
|
|
- },
|
|
|
- props: {
|
|
|
- // 弹窗是否打开
|
|
|
- visible: Boolean,
|
|
|
- // 修改回显的数据
|
|
|
- data: Object,
|
|
|
- controlList:Array
|
|
|
- },
|
|
|
- data() {
|
|
|
- return {
|
|
|
- defaultForm: this.$util.deepClone(defaultForm),
|
|
|
- // 表单数据
|
|
|
- form: { ...this.$util.deepClone(defaultForm) },
|
|
|
- timeType: [
|
|
|
- { code: 1, label: '分' },
|
|
|
- { code: 2, label: '时' }
|
|
|
+ workBeat: {
|
|
|
+ beatProduceNum: '',
|
|
|
+ beatProduceUnit: '',
|
|
|
+ categoryNum: '',
|
|
|
+ categoryUnit: '',
|
|
|
+ beatTimes: '',
|
|
|
+ otherTimes: '',
|
|
|
+ preTimes: '',
|
|
|
+ proTimes: '',
|
|
|
+ restTimes: '',
|
|
|
+ beatTimesUnit: '',
|
|
|
+ }
|
|
|
+};
|
|
|
+export default {
|
|
|
+ components: {
|
|
|
+ WorkCenter
|
|
|
+ },
|
|
|
+ props: {
|
|
|
+ // 弹窗是否打开
|
|
|
+ visible: Boolean,
|
|
|
+ // 修改回显的数据
|
|
|
+ data: Object,
|
|
|
+ controlList: Array
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ defaultForm: this.$util.deepClone(defaultForm),
|
|
|
+ // 表单数据
|
|
|
+ form: { ...this.$util.deepClone(defaultForm) },
|
|
|
+ timeType: [
|
|
|
+ { code: 1, label: '分' },
|
|
|
+ { code: 2, label: '时' }
|
|
|
+ ],
|
|
|
+ tacticsType: [
|
|
|
+ { code: 1, label: '标准时间' },
|
|
|
+ { code: 2, label: '最短时间' }
|
|
|
+ ],
|
|
|
+
|
|
|
+ // 表单验证规则
|
|
|
+ rules: {
|
|
|
+ name: [
|
|
|
+ { required: true, message: '请输入工序名称', trigger: 'blur' }
|
|
|
],
|
|
|
- tacticsType: [
|
|
|
- { code: 1, label: '标准时间' },
|
|
|
- { code: 2, label: '最短时间' }
|
|
|
+ code: [{ required: true, trigger: 'change' }],
|
|
|
+ controlId: [
|
|
|
+ { required: true, message: '请选择控制码', trigger: 'blur' }
|
|
|
],
|
|
|
-
|
|
|
- // 表单验证规则
|
|
|
- rules: {
|
|
|
- name: [
|
|
|
- { required: true, message: '请输入工序名称', trigger: 'blur' }
|
|
|
- ],
|
|
|
- code: [{ required: true, trigger: 'change' }],
|
|
|
- controlId: [
|
|
|
- { required: true, message: '请选择控制码', trigger: 'blur' }
|
|
|
- ],
|
|
|
- workCenterName: [
|
|
|
- { required: true, message: '请选择工作中心', trigger: 'change' }
|
|
|
- ],
|
|
|
- timeUnit: [
|
|
|
- { required: true, message: '请选择时间单位', trigger: 'blur' }
|
|
|
- ]
|
|
|
- },
|
|
|
- // 提交状态
|
|
|
- loading: false,
|
|
|
- // 是否是修改
|
|
|
- isUpdate: false,
|
|
|
- chooseItem:null,
|
|
|
- };
|
|
|
- },
|
|
|
- computed: {
|
|
|
- totalTime() {
|
|
|
- let to =
|
|
|
- (-this.form.workBeat.restTimes +
|
|
|
- -this.form.workBeat.preTimes +
|
|
|
- -this.form.workBeat.proTimes +
|
|
|
- -this.form.workBeat.otherTimes) *
|
|
|
- -1;
|
|
|
- return to;
|
|
|
+ workCenterName: [
|
|
|
+ { required: true, message: '请选择工作中心', trigger: 'change' }
|
|
|
+ ],
|
|
|
+ 'workBeat.beatTimesUnit': [
|
|
|
+ { required: true, message: '请选择时间单位', trigger: 'blur' }
|
|
|
+ ]
|
|
|
},
|
|
|
- // 是否开启响应式布局
|
|
|
- styleResponsive() {
|
|
|
- return this.$store.state.theme.styleResponsive;
|
|
|
- }
|
|
|
+ // 提交状态
|
|
|
+ loading: false,
|
|
|
+ // 是否是修改
|
|
|
+ isUpdate: false,
|
|
|
+ chooseItem: null,
|
|
|
+ };
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ totalTime() {
|
|
|
+ let to =
|
|
|
+ (-this.form.workBeat.restTimes +
|
|
|
+ -this.form.workBeat.preTimes +
|
|
|
+ -this.form.workBeat.proTimes +
|
|
|
+ -this.form.workBeat.otherTimes) *
|
|
|
+ -1;
|
|
|
+ return to;
|
|
|
},
|
|
|
- methods: {
|
|
|
- chooseWorkCenter(){
|
|
|
- this.$refs.centerRefs.open(this.form)
|
|
|
- },
|
|
|
- determineChoose(row){
|
|
|
- this.$set(this.form,'workCenterName',row.name)
|
|
|
- this.$set(this.form,'workCenterId',row.id)
|
|
|
- },
|
|
|
- /* 保存编辑 */
|
|
|
- save() {
|
|
|
- this.$refs.form.validate((valid) => {
|
|
|
- if (!valid) {
|
|
|
- return false;
|
|
|
- }
|
|
|
- if (!this.isUpdate) {
|
|
|
- delete this.form.id;
|
|
|
- }
|
|
|
+ // 是否开启响应式布局
|
|
|
+ styleResponsive() {
|
|
|
+ return this.$store.state.theme.styleResponsive;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ chooseWorkCenter() {
|
|
|
+ this.$refs.centerRefs.open(this.form)
|
|
|
+ },
|
|
|
+ determineChoose(row) {
|
|
|
+ this.$set(this.form, 'workCenterName', row.name)
|
|
|
+ this.$set(this.form, 'workCenterId', row.id)
|
|
|
+ },
|
|
|
+ /* 保存编辑 */
|
|
|
+ save() {
|
|
|
+ this.$refs.form.validate((valid) => {
|
|
|
+ if (!valid) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if (!this.isUpdate) {
|
|
|
+ delete this.form.id;
|
|
|
+ }
|
|
|
|
|
|
- this.form.workBeat.beatTimes = this.totalTime;
|
|
|
+ this.form.workBeat.beatTimes = this.totalTime;
|
|
|
|
|
|
- this.loading = true;
|
|
|
- producetask
|
|
|
- .save(this.form)
|
|
|
- .then((msg) => {
|
|
|
- this.loading = false;
|
|
|
- this.$message.success(
|
|
|
- (this.isUpdate ? '修改' : '新建') + msg.message
|
|
|
- );
|
|
|
- this.updateVisible(false);
|
|
|
- this.$emit('done');
|
|
|
- })
|
|
|
- .catch((e) => {
|
|
|
- this.loading = false;
|
|
|
- // this.$message.error(e.message);
|
|
|
- });
|
|
|
- });
|
|
|
- },
|
|
|
- /* 更新visible */
|
|
|
- updateVisible(value) {
|
|
|
- this.form = this.$util.deepClone(defaultForm);
|
|
|
- this.$emit('update:visible', value);
|
|
|
- }
|
|
|
+ this.loading = true;
|
|
|
+ producetask
|
|
|
+ .save(this.form)
|
|
|
+ .then((msg) => {
|
|
|
+ this.loading = false;
|
|
|
+ this.$message.success(
|
|
|
+ (this.isUpdate ? '修改' : '新建') + msg.message
|
|
|
+ );
|
|
|
+ this.updateVisible(false);
|
|
|
+ this.$emit('done');
|
|
|
+ })
|
|
|
+ .catch((e) => {
|
|
|
+ this.loading = false;
|
|
|
+ // this.$message.error(e.message);
|
|
|
+ });
|
|
|
+ });
|
|
|
},
|
|
|
+ /* 更新visible */
|
|
|
+ updateVisible(value) {
|
|
|
+ this.form = this.$util.deepClone(defaultForm);
|
|
|
+ this.$emit('update:visible', value);
|
|
|
+ }
|
|
|
+ },
|
|
|
|
|
|
- watch: {
|
|
|
- async visible(visible) {
|
|
|
- if (visible) {
|
|
|
- if (this.data) {
|
|
|
- console.log(111111);
|
|
|
- const res = await producetask.getById(this.data.id);
|
|
|
- this.$util.assignObject(this.form, {
|
|
|
- ...res
|
|
|
- });
|
|
|
- this.isUpdate = true;
|
|
|
- } else {
|
|
|
- const res = await producetask.getCode();
|
|
|
- this.form = this.$util.deepClone(defaultForm);
|
|
|
- this.form.code = res;
|
|
|
- this.isUpdate = false;
|
|
|
- }
|
|
|
+ watch: {
|
|
|
+ async visible(visible) {
|
|
|
+ if (visible) {
|
|
|
+ if (this.data) {
|
|
|
+ console.log(111111);
|
|
|
+ const res = await producetask.getById(this.data.id);
|
|
|
+ this.$util.assignObject(this.form, {
|
|
|
+ ...res
|
|
|
+ });
|
|
|
+ this.isUpdate = true;
|
|
|
} else {
|
|
|
- this.$refs.form.clearValidate();
|
|
|
+ const res = await producetask.getCode();
|
|
|
this.form = this.$util.deepClone(defaultForm);
|
|
|
+ this.form.code = res;
|
|
|
+ this.isUpdate = false;
|
|
|
}
|
|
|
+ } else {
|
|
|
+ this.$refs.form.clearValidate();
|
|
|
+ this.form = this.$util.deepClone(defaultForm);
|
|
|
}
|
|
|
}
|
|
|
- };
|
|
|
+ }
|
|
|
+};
|
|
|
</script>
|