<template>
|
<el-dialog :visible.sync="visible" append-to-body :title="!dataForm.id ? $t('add') : $t('update')"
|
:close-on-click-modal="false" :close-on-press-escape="false">
|
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" label-width="110px">
|
<el-row>
|
<el-col :span="12">
|
<el-form-item prop="rq" label="日期">
|
<el-date-picker
|
style="width: 100%"
|
v-model="dataForm.rq"
|
type="date"
|
:clearable="true"
|
value-format="yyyy-MM-dd"
|
placeholder="日期">
|
</el-date-picker>
|
</el-form-item>
|
</el-col>
|
<el-col :span="12">
|
<el-form-item prop="bc" label="班次">
|
<dict-select-tag style="width: 100%" v-model="dataForm.bc" clearable placeholder="班次" dictCode="bc"/>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-row>
|
<el-col :span="12">
|
<el-form-item prop="czb" label="厂值班">
|
<staff-select filterable style="width: 100%" v-model="dataForm.czb" clearable placeholder="厂值班" >
|
|
</staff-select>
|
</el-form-item>
|
</el-col>
|
<el-col :span="12">
|
<el-form-item prop="jgzb" label="机关值班">
|
<staff-select filterable style="width: 100%" v-model="dataForm.jgzb" clearable placeholder="机关值班" >
|
|
</staff-select>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-row>
|
<el-col :span="12">
|
<el-form-item prop="jky" label="集控员">
|
<staff-select filterable style="width: 100%" v-model="dataForm.jky" clearable placeholder="集控员">
|
</staff-select>
|
</el-form-item>
|
</el-col>
|
<el-col :span="12">
|
<el-form-item prop="ddy" label="调度员">
|
<staff-select filterable style="width: 100%" v-model="dataForm.ddy" clearable placeholder="调度员">
|
</staff-select>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-row>
|
<el-col :span="12">
|
<el-form-item prop="dbsc" label="当班生产">
|
<el-input style="width: 100%" v-model="dataForm.dbsc" clearable placeholder="当班生产"/>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-row>
|
<el-col :span="24">
|
<el-form-item prop="content" label="备注">
|
<el-input
|
type="textarea"
|
:autosize="{ minRows: 6, maxRows: 6}"
|
placeholder="请输入备注"
|
v-model="dataForm.content">
|
</el-input>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
</el-form>
|
<template slot="footer">
|
<el-button size="mini" :loading="loading" @click="visible = false">{{ $t('cancel') }}</el-button>
|
<el-button size="mini" :loading="loading" type="primary" @click="dataFormSubmitHandle()">{{ $t('confirm') }}
|
</el-button>
|
</template>
|
</el-dialog>
|
</template>
|
|
<script>
|
import debounce from 'lodash/debounce'
|
import DictSelectTag from "@/components/dict/dict-select-tag";
|
import StaffSelect from '@/components/staff/staff-select.vue';
|
export default {
|
data () {
|
return {
|
visible: false,
|
loading: false,
|
dataForm: {
|
id: '',
|
rq: '',
|
bc: '',
|
czbName: '',
|
jgzbName: '',
|
jkyName: '',
|
ddyName: '',
|
dbsc: '',
|
content: '',
|
}
|
}
|
},
|
components: {
|
DictSelectTag,
|
StaffSelect
|
},
|
computed: {
|
dataRule() {
|
|
return {
|
rq: [
|
{required: true, message: this.$t('validate.required'), trigger: 'blur'}
|
],
|
bc: [
|
{required: true, message: this.$t('validate.required'), trigger: 'blur'}
|
],
|
czbName: [
|
{required: true, message: this.$t('validate.required'), trigger: 'blur'}
|
],
|
jgzbName: [
|
{required: true, message: this.$t('validate.required'), trigger: 'blur'}
|
],
|
jkyName: [
|
{required: true, message: this.$t('validate.required'), trigger: 'blur'}
|
],
|
ddyName: [
|
{required: true, message: this.$t('validate.required'), trigger: 'blur'}
|
],
|
dbsc: [
|
{required: true, message: this.$t('validate.required'), trigger: 'blur'}
|
]
|
}
|
}
|
},
|
methods: {
|
init () {
|
this.visible = true
|
this.dataForm.deptId = ''
|
this.$nextTick(() => {
|
this.$refs['dataForm'].resetFields()
|
if (this.dataForm.id) {
|
this.getInfo()
|
}
|
})
|
},
|
// 获取信息
|
getInfo () {
|
this.$http.get(`/iailab-iems-coal-proddisp/prod/standing-book/on-duty-info/${this.dataForm.id}`).then(({ data: res }) => {
|
if (res.code !== 0) {
|
return this.$message.error(res.msg)
|
}
|
this.dataForm = {
|
...this.dataForm,
|
...res.info,
|
userIdList: []
|
}
|
}).catch(() => {})
|
},
|
// 表单提交
|
dataFormSubmitHandle: debounce(function () {
|
this.$refs['dataForm'].validate((valid) => {
|
if (!valid) {
|
return false
|
}
|
this.$http[!this.dataForm.id ? 'post' : 'put']('/iailab-iems-coal-proddisp/prod/standing-book/on-duty-info', {
|
...this.dataForm
|
}).then(({ data: res }) => {
|
if (res.code !== 0) {
|
return this.$message.error(res.msg)
|
}
|
this.$message({
|
message: this.$t('prompt.success'),
|
type: 'success',
|
duration: 500,
|
onClose: () => {
|
this.visible = false
|
this.$emit('refreshDataList')
|
}
|
})
|
}).catch(() => {})
|
})
|
}, 1000, { 'leading': true, 'trailing': false })
|
}
|
}
|
</script>
|