3 changed files with 142 additions and 2 deletions
@ -0,0 +1,126 @@ |
|||
<template> |
|||
<el-dialog :visible.sync="visible" :title="'操作'" :close-on-click-modal="false" :close-on-press-escape="false"> |
|||
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmitHandle()" :label-width="$i18n.locale === 'en-US' ? '120px' : '80px'"> |
|||
<el-form-item label="申请" prop="state" label-width="80px"> |
|||
<el-select v-model="dataForm.state" placeholder="请选择" clearable> |
|||
<el-option label="延期" value="0"> </el-option> |
|||
<el-option label="熔断" value="5"> </el-option> |
|||
</el-select> |
|||
</el-form-item> |
|||
<br> |
|||
<el-row> |
|||
<el-form-item prop="newsReleaseStartTime" |
|||
v-if="dataForm.state=='0'" |
|||
label="延期时间"> |
|||
<el-date-picker @change='setRegistTime' |
|||
v-model="time" |
|||
value-format="yyyy-MM-dd" |
|||
type="daterange" |
|||
range-separator="至" |
|||
start-placeholder="开始日期" |
|||
end-placeholder="结束日期"> |
|||
</el-date-picker> |
|||
</el-form-item> |
|||
</el-row> |
|||
<br> |
|||
<el-form-item label="申请理由" prop="reason"> |
|||
<el-input |
|||
type="textarea" |
|||
:rows="3" |
|||
v-model="dataForm.reason" |
|||
maxlength="2000" |
|||
style="width:calc(100% - 110px)"></el-input> |
|||
</el-form-item> |
|||
</el-form> |
|||
<template slot="footer"> |
|||
<el-button @click="visible = false">{{ $t('cancel') }}</el-button> |
|||
<el-button type="primary" :disabled="isAble" @click="dataFormSubmitHandle()">{{ $t('confirm') }}</el-button> |
|||
</template> |
|||
</el-dialog> |
|||
</template> |
|||
|
|||
<script> |
|||
import debounce from 'lodash/debounce' |
|||
export default { |
|||
data () { |
|||
return { |
|||
visible: false, |
|||
dataForm: { |
|||
itemId: '', |
|||
state: '', |
|||
reason: '', |
|||
delayStartTime:'', |
|||
delayEndTime:'' |
|||
}, |
|||
time: [], |
|||
isAble: false, |
|||
pickerBeginDateBefore: { |
|||
disabledDate: (time) => { |
|||
let beginDateVal = this.dataForm.delayEndTime; |
|||
if (beginDateVal) { |
|||
return time.getTime() > new Date(beginDateVal + ' 00:00:00').getTime() |
|||
} |
|||
} |
|||
}, |
|||
pickerBeginDateAfter: { |
|||
disabledDate: (time) => { |
|||
let EndDateVal = this.dataForm.delayStartTime; |
|||
if (EndDateVal) { |
|||
return time.getTime() < new Date(EndDateVal + ' 00:00:00').getTime() |
|||
} |
|||
} |
|||
}, |
|||
} |
|||
}, |
|||
computed: { |
|||
dataRule () { |
|||
return { |
|||
state: [ |
|||
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|||
], |
|||
reason: [ |
|||
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } |
|||
] |
|||
} |
|||
} |
|||
}, |
|||
methods: { |
|||
setRegistTime () { |
|||
this.dataForm.delayStartTime = this.time[0] |
|||
this.dataForm.delayEndTime = this.time[1] |
|||
}, |
|||
init () { |
|||
this.visible = true |
|||
this.isAble = false |
|||
this.$nextTick(() => { |
|||
this.$refs['dataForm'].resetFields() |
|||
}) |
|||
}, |
|||
// 表单提交 |
|||
dataFormSubmitHandle: debounce(function () { |
|||
this.$refs['dataForm'].validate((valid) => { |
|||
if (!valid) { |
|||
return false |
|||
} |
|||
this.isAble = true |
|||
this.$http['post']('/item/itemfusingdelay', this.dataForm).then(({ data: res }) => { |
|||
if (res.code !== 0) { |
|||
this.isAble = false |
|||
return this.$message.error(res.msg) |
|||
} |
|||
this.$message({ |
|||
message: this.$t('prompt.success'), |
|||
type: 'success', |
|||
duration: 500, |
|||
onClose: () => { |
|||
this.$emit('connectResponse') |
|||
this.visible = false |
|||
this.$emit('refreshDataList') |
|||
} |
|||
}) |
|||
}).catch(() => {}) |
|||
}) |
|||
}, 1000, { 'leading': true, 'trailing': false }) |
|||
} |
|||
} |
|||
</script> |
Loading…
Reference in new issue