Commit ec3c7ac4 authored by chuan.liu's avatar chuan.liu

审批重复提交优化

parent 379164d2
...@@ -95,13 +95,15 @@ service.interceptors.response.use( ...@@ -95,13 +95,15 @@ service.interceptors.response.use(
return dataAxios return dataAxios
}, },
async error => { async error => {
// const { data } = error.response const { statusText, status } = error.response
console.error('error: ', error) // for debug console.error('error: ', error.response) // for debug
if (`${error}`.indexOf('401') !== -1) { if (status === 401) {
Toast(`登录用户失效,请重新登录`) Toast(`登录用户失效,请重新登录`)
await store.dispatch('resetToken') await store.dispatch('resetToken')
router.replace('/login') router.replace('/login')
return return
} else if (status === 500) {
Toast(statusText)
} }
return Promise.reject(error) return Promise.reject(error)
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
@click="exportMonthPlanOrder" @click="exportMonthPlanOrder"
:icon="downloadIcon" :icon="downloadIcon"
type="primary" type="primary"
:disabled="isReadonly"
> >
发货计划下载 发货计划下载
</van-button> </van-button>
...@@ -55,14 +56,20 @@ ...@@ -55,14 +56,20 @@
</van-collapse> </van-collapse>
<div class="remark-block"> <div class="remark-block">
<span class="title">意见</span> <span class="title">意见</span>
<textarea v-model="conditions.handleOpinion" class="text" type="textarea" rows="2" /> <textarea
:disabled="isReadonly"
v-model="conditions.handleOpinion"
class="text"
type="textarea"
rows="2"
/>
</div> </div>
</div> </div>
</div> </div>
<p class="bottom-block"></p> <p class="bottom-block"></p>
<div class="bottom"> <div class="bottom">
<van-button plain @click="refuse" type="primary">驳回</van-button> <van-button plain :disabled="isReadonly" @click="refuse" type="primary">驳回</van-button>
<van-button plain @click="submit('1')" type="primary">通过</van-button> <van-button plain :disabled="isReadonly" @click="submit('1')" type="primary">通过</van-button>
</div> </div>
</div> </div>
</template> </template>
...@@ -94,7 +101,10 @@ export default { ...@@ -94,7 +101,10 @@ export default {
} }
}, },
computed: { computed: {
...mapGetters['token'] ...mapGetters['token'],
isReadonly() {
return false
}
}, },
created() { created() {
const { id, taskId } = this.$route.query const { id, taskId } = this.$route.query
...@@ -109,8 +119,6 @@ export default { ...@@ -109,8 +119,6 @@ export default {
methods: { methods: {
initDetail() { initDetail() {
apiMonthplanFindById(this.conditions).then(res => { apiMonthplanFindById(this.conditions).then(res => {
console.log(res.data)
res.data.pyear += ''
this.conditions = { ...this.conditions, ...res.data } this.conditions = { ...this.conditions, ...res.data }
}) })
}, },
...@@ -132,13 +140,21 @@ export default { ...@@ -132,13 +140,21 @@ export default {
params.currentHandleGroupId = this.taskNode.groupId params.currentHandleGroupId = this.taskNode.groupId
params.taskId = this.$route.query.taskId params.taskId = this.$route.query.taskId
if (this.conditions.id) { if (this.conditions.id) {
const res = await advance(params) const toast = Toast.loading({
console.log('22asssssss', res) message: '提交中...',
if (res.status === 1) { forbidClick: true
Toast('提交成功') })
window.opener = null try {
window.open('', '_self', '') const res = await advance(params)
window.close() toast.clear()
if (res.status === 1) {
Toast('提交成功')
window.opener = null
window.open('', '_self', '')
window.close()
}
} catch (error) {
toast.clear()
} }
} }
}, },
...@@ -152,11 +168,17 @@ export default { ...@@ -152,11 +168,17 @@ export default {
bizId: this.conditions.bizId, bizId: this.conditions.bizId,
type: this.$route.query.type type: this.$route.query.type
} }
const toast = Toast.loading({
message: '导出中...',
forbidClick: true
})
const res = await apiExportMonthPlanOrder(params) const res = await apiExportMonthPlanOrder(params)
try { try {
toast.clear()
const { data, name, type } = res const { data, name, type } = res
download(data, name, type) download(data, name, type)
} catch (error) { } catch (error) {
toast.clear()
Toast('下载异常') Toast('下载异常')
} }
}, },
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
@click="exportMonthPlanOrder" @click="exportMonthPlanOrder"
:icon="downloadIcon" :icon="downloadIcon"
type="primary" type="primary"
:disabled="isReadonly"
> >
变更发货计划下载 变更发货计划下载
</van-button> </van-button>
...@@ -54,14 +55,20 @@ ...@@ -54,14 +55,20 @@
</van-collapse> </van-collapse>
<div class="remark-block"> <div class="remark-block">
<span class="title">意见</span> <span class="title">意见</span>
<textarea v-model="conditions.handleOpinion" class="text" type="textarea" rows="2" /> <textarea
:disabled="isReadonly"
v-model="conditions.handleOpinion"
class="text"
type="textarea"
rows="2"
/>
</div> </div>
</div> </div>
</div> </div>
<p class="bottom-block"></p> <p class="bottom-block"></p>
<div class="bottom"> <div class="bottom">
<van-button plain @click="refuse" type="primary">驳回</van-button> <van-button plain :disabled="isReadonly" @click="refuse" type="primary">驳回</van-button>
<van-button plain @click="submit('1')" type="primary">通过</van-button> <van-button plain :disabled="isReadonly" @click="submit('1')" type="primary">通过</van-button>
</div> </div>
</div> </div>
</template> </template>
...@@ -93,7 +100,10 @@ export default { ...@@ -93,7 +100,10 @@ export default {
} }
}, },
computed: { computed: {
...mapGetters['token'] ...mapGetters['token'],
isReadonly() {
return false
}
}, },
created() { created() {
const { id, taskId } = this.$route.query const { id, taskId } = this.$route.query
...@@ -133,13 +143,21 @@ export default { ...@@ -133,13 +143,21 @@ export default {
params.currentHandleGroupId = this.taskNode.groupId params.currentHandleGroupId = this.taskNode.groupId
params.taskId = this.$route.query.taskId params.taskId = this.$route.query.taskId
if (this.conditions.id) { if (this.conditions.id) {
const res = await advance(params) const toast = Toast.loading({
console.log('22asssssss', res) message: '提交中...',
if (res.status === 1) { forbidClick: true
Toast('提交成功') })
window.opener = null try {
window.open('', '_self', '') const res = await advance(params)
window.close() toast.clear()
if (res.status === 1) {
Toast('提交成功')
window.opener = null
window.open('', '_self', '')
window.close()
}
} catch (error) {
toast.clear()
} }
} }
}, },
...@@ -153,11 +171,17 @@ export default { ...@@ -153,11 +171,17 @@ export default {
bizId: this.conditions.bizId, bizId: this.conditions.bizId,
type: this.$route.query.type type: this.$route.query.type
} }
const toast = Toast.loading({
message: '导出中...',
forbidClick: true
})
const res = await apiExportMonthPlanAdjuseOrder(params) const res = await apiExportMonthPlanAdjuseOrder(params)
try { try {
toast.clear()
const { data, name, type } = res const { data, name, type } = res
download(data, name, type) download(data, name, type)
} catch (error) { } catch (error) {
toast.clear()
Toast('下载异常') Toast('下载异常')
} }
}, },
......
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
:required="taskNode.subProcUnitId === 'base'" :required="taskNode.subProcUnitId === 'base'"
label="基地审批量" label="基地审批量"
placeholder="" placeholder=""
:disabled="isReadonly"
/> />
<van-field <van-field
v-if="isShowWarZone" v-if="isShowWarZone"
...@@ -51,6 +52,7 @@ ...@@ -51,6 +52,7 @@
:required="taskNode.subProcUnitId === 'warZone'" :required="taskNode.subProcUnitId === 'warZone'"
placeholder="" placeholder=""
error-message="" error-message=""
:disabled="isReadonly"
/> />
<van-field <van-field
v-if="isShowWork" v-if="isShowWork"
...@@ -59,6 +61,7 @@ ...@@ -59,6 +61,7 @@
label="内勤审批量" label="内勤审批量"
placeholder="" placeholder=""
error-message="" error-message=""
:disabled="isReadonly"
/> />
</van-cell-group> </van-cell-group>
</div> </div>
...@@ -187,7 +190,13 @@ ...@@ -187,7 +190,13 @@
</div> </div>
<div class="remark-block"> <div class="remark-block">
<span class="title">审批意见</span> <span class="title">审批意见</span>
<textarea v-model="conditions.handleOpinion" class="text" type="textarea" rows="2" /> <textarea
:disabled="isReadonly"
v-model="conditions.handleOpinion"
class="text"
type="textarea"
rows="2"
/>
</div> </div>
</div> </div>
...@@ -197,7 +206,7 @@ ...@@ -197,7 +206,7 @@
<div class="bottom"> <div class="bottom">
<!-- <van-button plain type="primary">确认</van-button> --> <!-- <van-button plain type="primary">确认</van-button> -->
<van-button plain type="primary" @click="submit('1')">确认</van-button> <van-button plain :disabled="isReadonly" type="primary" @click="submit('1')">确认</van-button>
</div> </div>
<van-popup v-model:show="showPicker" round position="bottom"> <van-popup v-model:show="showPicker" round position="bottom">
...@@ -271,6 +280,9 @@ export default { ...@@ -271,6 +280,9 @@ export default {
}, },
isShowWork() { isShowWork() {
return this.taskNode.subProcUnitId === 'work' return this.taskNode.subProcUnitId === 'work'
},
isReadonly() {
return false
} }
}, },
created() { created() {
...@@ -335,13 +347,21 @@ export default { ...@@ -335,13 +347,21 @@ export default {
params.currentHandleGroupId = this.taskNode.groupId params.currentHandleGroupId = this.taskNode.groupId
params.taskId = this.$route.query.taskId params.taskId = this.$route.query.taskId
if (this.conditions.id) { if (this.conditions.id) {
const res = await advance(params) const toast = Toast.loading({
console.log('22asssssss', res) message: '提交中...',
if (res.status === 1) { forbidClick: true
Toast('提交成功') })
window.opener = null try {
window.open('', '_self', '') const res = await advance(params)
window.close() toast.clear()
if (res.status === 1) {
Toast('提交成功')
window.opener = null
window.open('', '_self', '')
window.close()
}
} catch (error) {
toast.clear()
} }
} }
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment