BUG 26017

This commit is contained in:
aixianling
2021-12-24 20:04:20 +08:00
parent d4ca69f219
commit e88581f8b9
2 changed files with 21 additions and 25 deletions

View File

@@ -68,7 +68,7 @@
<div @click="back">
<span>取消</span>
</div>
<div @click="confirm">{{ type === 'edit' ? '发布' : '确定' }}</div>
<div @click="confirm">{{ isEdit ? '发布' : '确定' }}</div>
</div>
<u-modal v-model="isShowModal" :content="tips"></u-modal>
<u-picker mode="time" v-model="isShowTime" :show-time-tag="true" @close="isShowTime = false" @confirm="onTimeChange"
@@ -78,10 +78,16 @@
<script>
export default {
props: ['id', 'formConfig', 'type'],
props: ['formConfig'],
computed: {
isEdit() {
return this.$route.query.type == 'edit'
}
},
data() {
let {id} = this.$route.query
return {
id,
params: {
year: true,
month: true,
@@ -101,8 +107,7 @@ export default {
periodValidityType: '0'
}
},
mounted() {
created() {
if (this.id) {
this.getInfo(this.id)
} else if (this.formConfig) {
@@ -111,25 +116,23 @@ export default {
this.commitType = res.commitType || '1'
this.actionNotice = res.actionNotice === '1'
this.dynamicNotice = res.dynamicNotice === '1'
if (res.periodValidityType === '1') {
this.periodValidityEndTime = res.periodValidityEndTime
}
}
},
methods: {
onTimeChange(e) {
this.periodValidityEndTime = `${e.year}-${e.month}-${e.day} ${e.hour}:${e.minute}:${e.second}`
},
back() {
this.$emit('back')
uni.navigateBack({})
},
getInfo(id) {
this.$http.post(`/app/appquestionnairetemplate/queryDetailById?id=${id}`).then(res => {
if (res.code == 0) {
if (res?.data) {
this.periodValidityType = res.data.periodValidityType
this.commitType = res.data.commitType
this.actionNotice = res.data.actionNotice === '1'
@@ -158,9 +161,7 @@ export default {
}
}).then(res => {
if (res.code == 0) {
uni.$emit('reload')
this.$u.toast('发布成功')
this.back()
}
}).catch(e => {
@@ -169,12 +170,10 @@ export default {
},
confirm() {
if (this.type === 'edit') {
if (this.isEdit) {
this.publish()
return false
}
uni.$emit('setting', {
periodValidityType: this.periodValidityType,
commitType: this.commitType,
@@ -182,7 +181,6 @@ export default {
dynamicNotice: this.dynamicNotice ? '1' : '0',
periodValidityEndTime: this.periodValidityEndTime ? this.periodValidityEndTime : ''
})
this.back()
}
}