|
@@ -1,5 +1,20 @@
|
|
|
<template>
|
|
|
<div class="approve-control-container flex flex-row flex-row-aic">
|
|
|
+ <!--
|
|
|
+ flag = info 几种状态
|
|
|
+ 2处理中: 催办,修改(disabled),撤销,下载文件
|
|
|
+ 3通过: 催办(disabled),修改(disabled), 撤销,下载
|
|
|
+ 4已驳回:催办(disabled),修改,撤销,下载
|
|
|
+ 5撤销:重新发起
|
|
|
+ -->
|
|
|
+ <!--
|
|
|
+ flag = approve 几种状态
|
|
|
+ [待处理,已处理,收到的]
|
|
|
+ 审核中:提醒,修改,下载文件。拒绝,同意
|
|
|
+ 通过:下载文件
|
|
|
+ 通过(我的维修):上传反馈结果,下载文件
|
|
|
+ 我的收到:无任何操作权限
|
|
|
+ -->
|
|
|
<!-- 审核通过
|
|
|
下载文件
|
|
|
-->
|
|
@@ -13,20 +28,25 @@
|
|
|
-->
|
|
|
|
|
|
<!--
|
|
|
- 催办,修改,撤销,提醒,修改,下载文件;拒绝按钮,同意按钮
|
|
|
+ 催办,修改,撤销,提醒,下载文件;拒绝按钮,同意按钮
|
|
|
-->
|
|
|
|
|
|
-
|
|
|
<!-- TODO: class 这块 还需要根据审核到某块禁用某些功能 -->
|
|
|
- <div class="item"
|
|
|
+ <div
|
|
|
+ :class="[
|
|
|
+ 'item',
|
|
|
+ item.disable ? 'item--disable' : ''
|
|
|
+ ]"
|
|
|
v-for="(item, idx) in controlComputed"
|
|
|
:key="idx"
|
|
|
+ @click="() => (!item.disable && item.event())"
|
|
|
>
|
|
|
<div class="icon">
|
|
|
<img :src="item.img" :alt="item.title">
|
|
|
</div>
|
|
|
<span>{{ item.title }}</span>
|
|
|
</div>
|
|
|
+ <!-- 审核才出现按钮 -->
|
|
|
<div class="btnd flex flex-row flex-row-aic" v-if="btnIshow">
|
|
|
<div class="btn" @click="handleGoExaminePage('refuse')">
|
|
|
拒绝
|
|
@@ -39,53 +59,114 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+
|
|
|
+import { putUrging, putCancel } from '@/api/approveinfo'
|
|
|
+
|
|
|
export default {
|
|
|
+ name: 'ApproveControl',
|
|
|
+ props: {
|
|
|
+ id: {
|
|
|
+ type: Number,
|
|
|
+ require: true
|
|
|
+ },
|
|
|
+ module: { // NOTE: 模块
|
|
|
+ validator: num => ([1,2,3,4,5,6,7,8,9,10,11].includes(num))
|
|
|
+ },
|
|
|
+ flag: {
|
|
|
+ validator: flag => (['info', 'approve'].includes(flag))
|
|
|
+ },
|
|
|
+ flagState: { // NOTE: flag的状态值`status`
|
|
|
+ type: Number
|
|
|
+ },
|
|
|
+ },
|
|
|
computed: {
|
|
|
controlComputed () {
|
|
|
- const [urging, edit, revoke, ding, print ] = this.control
|
|
|
+ let flag = this.flag
|
|
|
+ let state = this.flagState
|
|
|
+ let module = this.module
|
|
|
+ console.log(flag, state, module);
|
|
|
+ const [urging, edit, revoke, ding, print, REISSUE, pushResult] = this.control
|
|
|
let temparr = []
|
|
|
- switch (this.type) {
|
|
|
- case 3: // 领导审批
|
|
|
- temparr = [
|
|
|
- ding,
|
|
|
- edit,
|
|
|
- print
|
|
|
- ]
|
|
|
- // this.approveBtn = true
|
|
|
- break;
|
|
|
- case 4:
|
|
|
- temparr = [
|
|
|
- urging,
|
|
|
- edit,
|
|
|
- revoke,
|
|
|
- print
|
|
|
- ]
|
|
|
- break;
|
|
|
+
|
|
|
+ if (flag === 'info') {
|
|
|
+ // 审批状态:2=审批中,3=审批通过,4=审批驳回,5=审批撤销
|
|
|
+ // state = 2,3,4,5
|
|
|
+ switch (state) {
|
|
|
+ case 2:
|
|
|
+ temparr = [
|
|
|
+ urging,
|
|
|
+ {
|
|
|
+ // TEMPORARY: 临时改动禁用为false
|
|
|
+ ...edit,
|
|
|
+ disable: false
|
|
|
+ },
|
|
|
+ revoke,
|
|
|
+ print
|
|
|
+ ]
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ temparr = [
|
|
|
+ { ...urging, disable: true},
|
|
|
+ { ...edit, disable: true },
|
|
|
+ revoke,
|
|
|
+ print
|
|
|
+ ]
|
|
|
+ break;
|
|
|
+ case 4:
|
|
|
+ temparr = [
|
|
|
+ {...urging, disable: true},
|
|
|
+ edit,
|
|
|
+ revoke,
|
|
|
+ print
|
|
|
+ ]
|
|
|
+ break;
|
|
|
+ case 5:
|
|
|
+ temparr = [
|
|
|
+ REISSUE
|
|
|
+ ]
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ } else if (flag === 'approve') {
|
|
|
+ switch(state) {
|
|
|
+ // 待审核,已审核,收到的;三种状态
|
|
|
+ case 2:
|
|
|
+ temparr = [
|
|
|
+ ding,
|
|
|
+ edit,
|
|
|
+ print
|
|
|
+ ]
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ if (module === 8) temparr.push(pushResult)
|
|
|
+ temparr.push(print)
|
|
|
+ break;
|
|
|
+ // case 4:
|
|
|
+ }
|
|
|
}
|
|
|
return temparr
|
|
|
},
|
|
|
btnIshow () {
|
|
|
- return [3].includes(this.type)
|
|
|
+ return this.flag === 'approve'
|
|
|
},
|
|
|
},
|
|
|
data () {
|
|
|
return {
|
|
|
type: 3,
|
|
|
- control: [
|
|
|
+ control: [ // NOTE: [WARNING] 顺序不可更改。
|
|
|
{
|
|
|
title: "催办",
|
|
|
img: require('@/assets/icons-ding.png'),
|
|
|
- event: this.handleEvent
|
|
|
+ event: this.handleDingEvent
|
|
|
},
|
|
|
{
|
|
|
title: "修改",
|
|
|
img: require('@/assets/icons-edit.png'),
|
|
|
- event: this.handleEvent
|
|
|
+ event: this.handleEditEvent
|
|
|
},
|
|
|
{
|
|
|
title: "撤销",
|
|
|
img: require('@/assets/icons-ding.png'),
|
|
|
- event: this.handleEvent
|
|
|
+ event: this.handleRevokeEvent
|
|
|
},
|
|
|
{
|
|
|
title: "提醒",
|
|
@@ -95,13 +176,86 @@ export default {
|
|
|
{
|
|
|
title: "下载文件",
|
|
|
img: require('@/assets/icons-print.png'),
|
|
|
+ event: this.handleDownloadFileEvent
|
|
|
+ },
|
|
|
+ // NOTE: 重新发起
|
|
|
+ {
|
|
|
+ title: "重新发起",
|
|
|
+ img: require('@/assets/icons-print.png'),
|
|
|
event: this.handleEvent
|
|
|
},
|
|
|
- ]
|
|
|
+ // NOTE: 申请呈批(专属。申请呈批)
|
|
|
+ {
|
|
|
+ title: "申请呈批",
|
|
|
+ img: require('@/assets/icons-print.png'),
|
|
|
+ event: this.handleEvent
|
|
|
+ },
|
|
|
+ // NOTE: 我的维修专属
|
|
|
+ {
|
|
|
+ title: '上传反馈结果',
|
|
|
+ img: require('@/assets/icons-print.png'),
|
|
|
+ event: this.handleEvent
|
|
|
+ }
|
|
|
+ ]
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
- handleEvent () {},
|
|
|
+ handleEvent () {
|
|
|
+ this.$toast('等待功能实现中')
|
|
|
+ },
|
|
|
+ // NOTE: 提醒
|
|
|
+ // TODO: 申请提醒/审批提醒
|
|
|
+ async handleDingEvent () {
|
|
|
+ try {
|
|
|
+ const func = this.flag === 'info' ? putUrging : () => {}
|
|
|
+ const params = {
|
|
|
+ id: this.id
|
|
|
+ }
|
|
|
+ const result = await func(params)
|
|
|
+ if (result.code === 1) {
|
|
|
+ this.$toast(result.msg)
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ console.log('ding err>', error);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // NOTE: 驳回
|
|
|
+ async handleRevokeEvent () {
|
|
|
+ try {
|
|
|
+ const func = this.flag === 'info' ? putCancel : () => {}
|
|
|
+ const params = {
|
|
|
+ id: this.id
|
|
|
+ }
|
|
|
+ const result = await func(params)
|
|
|
+ if (result.code === 1) {
|
|
|
+ console.log('%c revoke event data >>>', 'background: blue; color: #fff', result.data);
|
|
|
+ this.$toast(result.msg)
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ console.log('revoke err>', error);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // NOTE: 下载文件
|
|
|
+ // TODO: 下载文件尚未拥有
|
|
|
+ handleDownloadFileEvent () {
|
|
|
+ try {
|
|
|
+ this.$toast('功能迭代中...')
|
|
|
+ } catch (error) {
|
|
|
+ console.log('download file err>>', error);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ handleEditEvent () {
|
|
|
+ // TODO: 修改跳转填写页面
|
|
|
+ this.$router.replace({
|
|
|
+ name: 'Applyfor',
|
|
|
+ query: {
|
|
|
+ type: this.module,
|
|
|
+ edit: 1,
|
|
|
+ id: this.id,
|
|
|
+ flag: this.flag
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
handleGoExaminePage (type) {
|
|
|
console.log('type', type);
|
|
|
this.$router.push({
|
|
@@ -134,6 +288,9 @@ export default {
|
|
|
font-weight: 400;
|
|
|
color: #151419;
|
|
|
line-height: 18px;
|
|
|
+ &--disable {
|
|
|
+ opacity: 0.5;
|
|
|
+ }
|
|
|
.icon {
|
|
|
img {
|
|
|
width: 24px;
|