<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="kcmz" label="库存煤种">
|
<dict-select-tag style="width: 100%" v-model="dataForm.kcmz" clearable placeholder="库存煤种" dictCode="cpmz"/>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-row>
|
<el-col :span="12">
|
<el-form-item prop="nbzrkc" label="内报昨日库存">
|
<el-input-number style="width: 100%" v-model="dataForm.nbzrkc" :precision="2" :step="0.1" :min="0"></el-input-number>
|
</el-form-item>
|
</el-col>
|
<el-col :span="12">
|
<el-form-item prop="nbjrrk" label="内报今日入库">
|
<el-input-number style="width: 100%" v-model="dataForm.nbjrrk" :precision="2" :step="0.1" :min="0"></el-input-number>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-row>
|
<el-col :span="12">
|
<el-form-item prop="nbjrck" label="内报今日出库">
|
<el-input-number style="width: 100%" v-model="dataForm.nbjrck" :precision="2" :step="0.1" :min="0"></el-input-number>
|
</el-form-item>
|
</el-col>
|
<el-col :span="12">
|
<el-form-item prop="nbtzl" label="内报调整量">
|
<el-input-number style="width: 100%" v-model="dataForm.nbtzl" :precision="2" :step="0.1" :min="0"></el-input-number>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-row>
|
<el-col :span="12">
|
<el-form-item prop="nbjrkc" label="内报今日库存">
|
<el-input-number style="width: 100%" v-model="dataForm.nbjrkc" :precision="2" :step="0.1" :min="0"></el-input-number>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-row>
|
<el-col :span="12">
|
<el-form-item prop="wbzrkc" label="外报昨日库存">
|
<el-input-number style="width: 100%" v-model="dataForm.wbzrkc" :precision="2" :step="0.1" :min="0"></el-input-number>
|
</el-form-item>
|
</el-col>
|
<el-col :span="12">
|
<el-form-item prop="wbjrrk" label="外报今日入库">
|
<el-input-number style="width: 100%" v-model="dataForm.wbjrrk" :precision="2" :step="0.1" :min="0"></el-input-number>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-row>
|
<el-col :span="12">
|
<el-form-item prop="wbjrck" label="外报今日出库">
|
<el-input-number style="width: 100%" v-model="dataForm.wbjrck" :precision="2" :step="0.1" :min="0"></el-input-number>
|
</el-form-item>
|
</el-col>
|
<el-col :span="12">
|
<el-form-item prop="wbtzl" label="外报调整量">
|
<el-input-number style="width: 100%" v-model="dataForm.wbtzl" :precision="2" :step="0.1" :min="0"></el-input-number>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-row>
|
<el-col :span="12">
|
<el-form-item prop="wbjrkc" label="外报今日库存">
|
<el-input-number style="width: 100%" v-model="dataForm.wbjrkc" :precision="2" :step="0.1" :min="0"></el-input-number>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-row>
|
<el-col :span="24">
|
<el-form-item prop="bz" label="备注">
|
<el-input
|
type="textarea"
|
:autosize="{ minRows: 4, maxRows: 4}"
|
placeholder="请输入备注"
|
v-model="dataForm.bz">
|
</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'
|
export default {
|
data() {
|
return {
|
visible: false,
|
loading: false,
|
dataForm: {
|
id: '',
|
rq: '',
|
bc: '',
|
kcmz: '',
|
nbzrkc: '',
|
nbjrrk: '',
|
nbjrck: '',
|
nbtzl: '',
|
nbjrkc: '',
|
wbzrkc: '',
|
wbjrrk: '',
|
wbjrck: '',
|
wbtzl: '',
|
wbjrkc: '',
|
bz: '',
|
bs: 'cpc'
|
}
|
}
|
},
|
components: {
|
DictSelectTag
|
},
|
computed: {
|
dataRule() {
|
return {
|
rq: [
|
{required: true, message: this.$t('validate.required'), trigger: 'blur'}
|
],
|
bc: [
|
{required: true, message: this.$t('validate.required'), trigger: 'blur'}
|
],
|
kcmz: [
|
{required: true, message: this.$t('validate.required'), trigger: 'blur'}
|
],
|
nbzrkc: [
|
{required: true, message: this.$t('validate.required'), trigger: 'blur'}
|
],
|
nbjrrk: [
|
{required: true, message: this.$t('validate.required'), trigger: 'blur'}
|
],
|
nbjrck: [
|
{required: true, message: this.$t('validate.required'), trigger: 'blur'}
|
],
|
nbtzl: [
|
{required: true, message: this.$t('validate.required'), trigger: 'blur'}
|
],
|
nbjrkc: [
|
{required: true, message: this.$t('validate.required'), trigger: 'blur'}
|
],
|
wbzrkc: [
|
{required: true, message: this.$t('validate.required'), trigger: 'blur'}
|
],
|
wbjrrk: [
|
{required: true, message: this.$t('validate.required'), trigger: 'blur'}
|
],
|
wbjrck: [
|
{required: true, message: this.$t('validate.required'), trigger: 'blur'}
|
],
|
wbtzl: [
|
{required: true, message: this.$t('validate.required'), trigger: 'blur'}
|
],
|
wbjrkc: [
|
{required: true, message: this.$t('validate.required'), trigger: 'blur'}
|
]
|
}
|
}
|
},
|
methods: {
|
init() {
|
this.visible = true
|
this.$nextTick(() => {
|
this.$refs['dataForm'].resetFields()
|
if (this.dataForm.id) {
|
this.getInfo()
|
}
|
})
|
},
|
// 获取信息
|
getInfo() {
|
this.$http.get(`/iailab-iems-coal-proddisp/warehouse/stock/info/${this.dataForm.id}`).then(({data: res}) => {
|
if (res.code !== 0) {
|
return this.$message.error(res.msg)
|
}
|
this.dataForm = {
|
...this.dataForm,
|
...res.info
|
}
|
}).catch(() => {
|
})
|
},
|
// 表单提交
|
dataFormSubmitHandle: debounce(function () {
|
this.$refs['dataForm'].validate((valid) => {
|
if (!valid) {
|
return false
|
}
|
this.loading = true
|
this.$http['post'](`/iailab-iems-coal-proddisp/warehouse/stock/${!this.dataForm.id ? 'add' : 'update'}`, 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')
|
}
|
})
|
this.loading = false
|
}).catch(() => {
|
})
|
})
|
}, 1000, {'leading': true, 'trailing': false})
|
}
|
}
|
</script>
|