<template>
|
<el-dialog
|
width="40%"
|
title="工序节点编辑"
|
top="15vh"
|
:visible.sync="innerVisible"
|
append-to-body
|
@close="$emit('update:currshowlist', false)"
|
:show="currshowlist"
|
:close-on-click-modal="false"
|
class="edit-routing-operation-dialog"
|
id="edit-routing-operation-dialog"
|
>
|
<el-form
|
:model="dataForm"
|
ref="operationDataForm"
|
label-width="100px"
|
class="l-mes"
|
>
|
<el-row>
|
<el-col :span="12">
|
<el-form-item label="工作中心" prop="workCenter" :rules="dataRule.workCenter">
|
<el-select
|
v-model="dataForm.workCenter"
|
placeholder="工作中心"
|
style="width: 100%"
|
filterable
|
>
|
<el-option
|
v-for="item in workCenterOptions"
|
:key="item.id"
|
:label="item.label"
|
:value="item.value"
|
/>
|
</el-select>
|
</el-form-item>
|
</el-col>
|
<el-col :span="12">
|
<el-form-item label="因素单位" prop="runTimeCodeDb" :rules="disabled ? [{required: false}] : dataRule.runTimeCodeDb">
|
<el-select
|
v-model="dataForm.runTimeCodeDb"
|
placeholder="因素单位"
|
style="width: 100%"
|
:disabled="disabled"
|
>
|
<el-option
|
v-for="item in runTimeCodeDbOptions"
|
:key="item.id"
|
:label="item.label"
|
:value="item.value"
|
/>
|
</el-select>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-row>
|
<el-col :span="12">
|
<el-form-item label="机器运转因素" prop="machRunFactor" :rules="disabled ? [{required: false}] : dataRule.machRunFactor">
|
<el-input
|
v-model="dataForm.machRunFactor"
|
placeholder="机器运转因素"
|
:disabled="disabled"
|
></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :span="12">
|
<el-form-item label="机器设置时间" prop="machSetupTime" :rules="disabled ? [{required: false}] : dataRule.machSetupTime">
|
<el-input
|
v-model="dataForm.machSetupTime"
|
placeholder="机器设置时间"
|
:disabled="disabled"
|
></el-input>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-row>
|
<el-col :span="12">
|
<el-form-item label="劳力运转因素" prop="laborRunFactor" :rules="disabled ? [{required: false}] : dataRule.laborRunFactor">
|
<el-input
|
v-model="dataForm.laborRunFactor"
|
placeholder="劳力运转因素"
|
:disabled="disabled"
|
></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col :span="12">
|
<el-form-item label="劳力设置时间" prop="laborSetupTime" :rules="disabled ? [{required: false}] : dataRule.laborSetupTime">
|
<el-input
|
v-model="dataForm.laborSetupTime"
|
placeholder="劳力设置时间"
|
:disabled="disabled"
|
></el-input>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-row>
|
<el-col :span="12">
|
<el-form-item label="人工类别" prop="laborClassNo">
|
<el-select
|
v-model="dataForm.laborClassNo"
|
filterable
|
placeholder="请选择人工类别"
|
style="width:100%"
|
:disabled="disabled"
|
>
|
<el-option
|
v-for="(item, index) in laborClassNoOptions"
|
:label="item.label"
|
:value="item.value"
|
:key="index"
|
>
|
</el-option>
|
</el-select>
|
</el-form-item>
|
</el-col>
|
<el-col :span="12">
|
<el-form-item label="班组人员" prop="crewSize">
|
<el-input
|
v-model="dataForm.crewSize"
|
placeholder="班组人员"
|
:disabled="disabled"
|
></el-input>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-row>
|
<el-col :span="12">
|
<el-form-item label="外部工序项目" prop="outsideOpItem">
|
<el-select
|
v-model="dataForm.outsideOpItem"
|
placeholder="外部工序项目"
|
style="width: 100%"
|
clearable
|
@change="changeOutSide"
|
>
|
<el-option
|
v-for="item in outsideOpItemOptions"
|
:key="item.id"
|
:label="item.label"
|
:value="item.value"
|
/>
|
</el-select>
|
</el-form-item>
|
</el-col>
|
<el-col :span="12"> </el-col>
|
</el-row>
|
</el-form>
|
<div slot="footer" class="dialog-footer">
|
<el-button @click="innerVisible = false">取 消</el-button>
|
<el-button type="primary" @click="saveSelectRow">确 定</el-button>
|
</div>
|
</el-dialog>
|
</template>
|
<script>
|
import { routingOperationChange } from '@/api/technology/routing'
|
import { validateSixDecimalPositives } from '@/util/validate'
|
import { remote } from '../../../api/admin/dict'
|
import { getLaborClassNo } from '@/api/technology/operation'
|
export default {
|
props: {
|
currshowlist: {
|
type: Boolean,
|
default: false
|
},
|
currRoutingOperation: {
|
type: Object,
|
default: () => {
|
return {}
|
}
|
}
|
},
|
data() {
|
return {
|
innerVisible: false,
|
workCenterOptions: [],
|
runTimeCodeDbOptions: [],
|
dataForm: {
|
id: 0,
|
workCenter: null,
|
machRunFactor: 0,
|
machSetupTime: 0,
|
laborClassNo: null,
|
laborRunFactor: 0,
|
laborSetupTime: 0,
|
runTimeCodeDb: null,
|
crewSize: 1,
|
outsideOpItem: null
|
},
|
dataRule: {
|
workCenter: [
|
{ required: true, message: '工作中心不能为空', trigger: 'change' }
|
],
|
machRunFactor: [
|
{ required: true, message: '机器运转因素不能为空', trigger: 'blur' },
|
{ validator: validateSixDecimalPositives, trigger: 'blur' }
|
],
|
machSetupTime: [
|
{ required: true, message: '机器设置时间不能为空', trigger: 'blur' },
|
{ validator: validateSixDecimalPositives, trigger: 'blur' }
|
],
|
laborRunFactor: [
|
{ required: true, message: '劳力运转因素不能为空', trigger: 'blur' },
|
{ validator: validateSixDecimalPositives, trigger: 'blur' }
|
],
|
laborSetupTime: [
|
{ required: true, message: '劳力设置时间不能为空', trigger: 'blur' },
|
{ validator: validateSixDecimalPositives, trigger: 'blur' }
|
],
|
runTimeCodeDb: [
|
{ required: true, message: '因素单位不能为空', trigger: 'change' }
|
]
|
},
|
laborClassNoOptions: [],
|
outsideOpItemOptions: [],
|
disabled:false
|
}
|
},
|
methods: {
|
saveSelectRow() {
|
this.$refs.operationDataForm.validate((valid) => {
|
if (valid) {
|
//不是外协
|
if (!this.disabled) {
|
if (
|
this.dataForm.machRunFactor == 0 &&
|
this.dataForm.machSetupTime == 0 &&
|
this.dataForm.laborRunFactor == 0 &&
|
this.dataForm.laborSetupTime == 0
|
) {
|
this.$message.error(
|
'【机器运转因素】、【机器设置时间】、【劳力运转因素】、【劳力设置时间】中至少有一个字段的值须大于0'
|
)
|
return
|
} else {
|
// 【人工类别】为空时【班组人员】必须为空,否则必须大于0
|
let remindInfo = ''
|
let remindFlag = false
|
if (
|
this.dataForm.laborClassNo == null ||
|
this.dataForm.laborClassNo == ''
|
) {
|
if (
|
this.dataForm.crewSize != null &&
|
this.dataForm.crewSize != ''
|
) {
|
remindFlag = true
|
remindInfo = '【人工类别】为空时【班组人员】必须为空'
|
}
|
} else {
|
if (
|
this.dataForm.crewSize == 0 ||
|
!/(^[1-9]([0-9]+)?(\.[0-9]{1,6})?$)|(^(0){1}$)|(^[0-9]\.[0-9]{1,6}$)/.test(
|
this.dataForm.crewSize
|
)
|
) {
|
remindFlag = true
|
remindInfo = '【班组人员】需大于0'
|
}
|
}
|
if (remindFlag) {
|
this.$message.error(remindInfo)
|
return
|
}
|
}
|
}
|
routingOperationChange(this.dataForm).then((response) => {
|
const data = response.data
|
if (data.code === 0) {
|
// this.currRoutingOperation.workCenter = this.dataForm.workCenter
|
// this.currRoutingOperation.machRunFactor = this.dataForm.machRunFactor
|
// this.currRoutingOperation.machSetupTime = this.dataForm.machSetupTime
|
// this.currRoutingOperation.laborClassNo = this.dataForm.laborClassNo
|
// this.currRoutingOperation.laborRunFactor = this.dataForm.laborRunFactor
|
// this.currRoutingOperation.laborSetupTime = this.dataForm.laborSetupTime
|
// this.currRoutingOperation.runTimeCodeDb = this.dataForm.runTimeCodeDb
|
// this.currRoutingOperation.crewSize = this.dataForm.crewSize
|
// this.currRoutingOperation.outsideOpItem = this.dataForm.outsideOpItem
|
this.$set(this.currRoutingOperation, 'workCenter', this.dataForm.workCenter)
|
this.$set(this.currRoutingOperation, 'machRunFactor', this.dataForm.machRunFactor)
|
this.$set(this.currRoutingOperation, 'machSetupTime', this.dataForm.machSetupTime)
|
this.$set(this.currRoutingOperation, 'laborClassNo', this.dataForm.laborClassNo)
|
this.$set(this.currRoutingOperation, 'laborRunFactor', this.dataForm.laborRunFactor)
|
this.$set(this.currRoutingOperation, 'laborSetupTime', this.dataForm.laborSetupTime)
|
this.$set(this.currRoutingOperation, 'runTimeCodeDb', this.dataForm.runTimeCodeDb)
|
this.$set(this.currRoutingOperation, 'crewSize', this.dataForm.crewSize)
|
this.$set(this.currRoutingOperation, 'outsideOpItem', this.dataForm.outsideOpItem)
|
this.innerVisible = false
|
this.$message.success('编辑成功')
|
} else {
|
this.$message.error('编辑失败')
|
}
|
})
|
}
|
})
|
},
|
// 获取IFS人工类别的数据字典
|
getLaborClassNo() {
|
/* getLaborClassNo().then((response) => {
|
if (response.data.code === 0) {
|
const _data = response.data.data
|
this.laborClassNoOptions = []
|
if (_data.length > 0) {
|
_data.forEach((item) => {
|
const laborClassNoOption = {
|
value: item.LC_NO,
|
label: item.LC_NO
|
}
|
this.laborClassNoOptions.push(laborClassNoOption)
|
})
|
}
|
}
|
}) */
|
remote('labor_class_type').then((response) => {
|
if (response.data.code === 0) {
|
this.laborClassNoOptions = response.data.data
|
this.laborClassNoOptions.forEach((item) => {
|
item.label = '[' + item.value + '] ' + item.label
|
})
|
} else {
|
this.laborClassNoOptions = []
|
}
|
})
|
},
|
getOutsideOpItem() {
|
remote('out_side_type').then((response) => {
|
if (response.data.code === 0) {
|
this.outsideOpItemOptions = response.data.data
|
} else {
|
this.outsideOpItemOptions = []
|
}
|
})
|
},
|
changeOutSide(val) {
|
if (val) {
|
this.dataForm.machRunFactor = null
|
this.dataForm.machSetupTime = null
|
this.dataForm.laborRunFactor = null
|
this.dataForm.laborSetupTime = null
|
this.dataForm.runTimeCodeDb = null
|
this.dataForm.laborClassNo = null
|
this.dataForm.crewSize = null
|
this.disabled = true
|
} else {
|
this.disabled = false
|
}
|
}
|
},
|
watch: {
|
currshowlist() {
|
this.innerVisible = this.currshowlist
|
if (this.currshowlist) {
|
this.$nextTick(() => {
|
this.getLaborClassNo()
|
this.getOutsideOpItem()
|
remote('runtimecodedb_type').then((response) => {
|
if (response.data.code === 0) {
|
this.runTimeCodeDbOptions = response.data.data
|
}
|
})
|
remote('work_center_type').then((response) => {
|
if (response.data.code === 0) {
|
this.workCenterOptions = response.data.data
|
this.workCenterOptions.forEach((item) => {
|
item.label = '[' + item.value + '] ' + item.label
|
})
|
}
|
this.dataForm.id = this.currRoutingOperation.id
|
this.dataForm.workCenter = this.currRoutingOperation.workCenter
|
this.dataForm.machRunFactor = this.currRoutingOperation.machRunFactor
|
this.dataForm.machSetupTime = this.currRoutingOperation.machSetupTime
|
this.dataForm.laborClassNo = this.currRoutingOperation.laborClassNo
|
this.dataForm.laborRunFactor = this.currRoutingOperation.laborRunFactor
|
this.dataForm.laborSetupTime = this.currRoutingOperation.laborSetupTime
|
// this.dataForm.runTimeCodeDb =
|
// this.currRoutingOperation.runTimeCodeDb == null
|
// ? '2'
|
// : this.currRoutingOperation.runTimeCodeDb
|
this.dataForm.runTimeCodeDb = this.currRoutingOperation.runTimeCodeDb
|
this.dataForm.crewSize = this.currRoutingOperation.crewSize
|
this.dataForm.outsideOpItem = this.currRoutingOperation.outsideOpItem
|
if (this.dataForm.outsideOpItem) {
|
this.disabled = true
|
} else {
|
this.disabled = false
|
}
|
})
|
})
|
}
|
}
|
}
|
}
|
</script>
|
<style>
|
.edit-routing-operation-dialog .el-dialog__header {
|
padding: 10px 20px 10px;
|
}
|
.edit-routing-operation-dialog .el-dialog__header .el-dialog__headerbtn {
|
top: 10px;
|
}
|
.edit-routing-operation-dialog .el-dialog__body {
|
padding: 5px 20px;
|
}
|
|
.edit-routing-operation-dialog .el-dialog__footer {
|
padding: 5px 20px 10px;
|
}
|
|
.edit-routing-operation-dialog .el-dialog__body .avue-crud__pagination {
|
margin-top: 0px;
|
margin-bottom: 5px;
|
}
|
</style>
|