数据申请按钮不跟角色绑定
Showing
3 changed files
with
81 additions
and
101 deletions
| ... | @@ -40,7 +40,7 @@ | ... | @@ -40,7 +40,7 @@ |
| 40 | </div> | 40 | </div> |
| 41 | <ContentWrap id="id-baseInfo" title="数据申请信息" description="" :expand-swicth="false"> | 41 | <ContentWrap id="id-baseInfo" title="数据申请信息" description="" :expand-swicth="false"> |
| 42 | <div class="list_panel"> | 42 | <div class="list_panel"> |
| 43 | <div v-if="!isDataUse" class="list_item is_block" style="font-weight: 600;"> | 43 | <div class="list_item is_block" style="font-weight: 600;"> |
| 44 | <span class="item_label">数据申请方:</span> | 44 | <span class="item_label">数据申请方:</span> |
| 45 | <span class="item_value">{{ detailInfo.tenantName || '--' }}</span> | 45 | <span class="item_value">{{ detailInfo.tenantName || '--' }}</span> |
| 46 | </div> | 46 | </div> |
| ... | @@ -93,7 +93,8 @@ | ... | @@ -93,7 +93,8 @@ |
| 93 | </div> | 93 | </div> |
| 94 | <div class="tool_btns"> | 94 | <div class="tool_btns"> |
| 95 | <div class="btns"> | 95 | <div class="btns"> |
| 96 | <el-button v-for="btn in toolBtns" :type="btn.type" :plain="btn.plain" @click="btn.click ? btn.click() : btnClick(btn)">{{ btn.label | 96 | <el-button v-for="btn in toolBtns" :type="btn.type" :plain="btn.plain" |
| 97 | @click="btn.click ? btn.click() : btnClick(btn)">{{ btn.label | ||
| 97 | }}</el-button> | 98 | }}</el-button> |
| 98 | </div> | 99 | </div> |
| 99 | </div> | 100 | </div> |
| ... | @@ -132,65 +133,51 @@ const viewProductDetail = () => { | ... | @@ -132,65 +133,51 @@ const viewProductDetail = () => { |
| 132 | }); | 133 | }); |
| 133 | } | 134 | } |
| 134 | 135 | ||
| 135 | /** 是否是数据提供方 */ | ||
| 136 | const isDataUse = computed(() => { | ||
| 137 | return localStorage.getItem('userRole') == USERROLE.USE; | ||
| 138 | }) | ||
| 139 | |||
| 140 | const toolBtns: any = computed(() => { | 136 | const toolBtns: any = computed(() => { |
| 141 | if (isDataUse.value) { | 137 | let btnsArr: any = [{ |
| 142 | let btnsArr: any = [{ | 138 | label: "关闭", value: "cancel", plain: true |
| 143 | label: "关闭", value: "cancel", plain: true | 139 | }]; |
| 144 | }]; | 140 | const staffGuid = detailInfo.value.createUserId || ''; |
| 145 | const approveVO = detailInfo.value.applicationApproveRSVO || {} | 141 | const currentStaffGuid = userData.userGuid; |
| 146 | let approveState = approveVO.approveState || null; | 142 | // 获取审批人。 |
| 147 | const staffGuid = detailInfo.value.createUserId || ''; | 143 | const approveVO = detailInfo.value.applicationApproveRSVO || {} |
| 148 | const currentStaffGuid = userData.userGuid; | 144 | let approveState = approveVO.approveState || null; |
| 149 | if (approveState == 'A' && staffGuid == currentStaffGuid) { | 145 | let approveStaffGuid = approveVO?.approveInstanceRSVOS?.[1]?.operator || ''; |
| 150 | btnsArr.push({ | 146 | if (approveState == 'A' && approveStaffGuid == userData.tenantGuid) { |
| 151 | label: "撤销", value: "revoke", click: () => { | 147 | btnsArr.push(...[{ |
| 152 | proxy.$openMessageBox('确定撤销该数据申请审批吗??', () => { | 148 | label: "通过", value: "pass", type: 'primary', click: () => { |
| 153 | fullscreenLoading.value = true; | 149 | passDialogInfo.value.visible = true; |
| 154 | updateDataApplyState({ | 150 | } |
| 155 | guid: detailInfo.value.guid, | 151 | }, { |
| 156 | approveState: 'C' | 152 | label: "驳回", value: "reject", type: 'danger', plain: true, click: () => { |
| 157 | }).then((res: any) => { | 153 | rejectDialogInfo.value.visible = true; |
| 158 | fullscreenLoading.value = false; | 154 | } |
| 159 | if (res?.code == proxy.$passCode) { | 155 | }]) |
| 160 | proxy.$ElMessage.success('该数据申请撤销成功'); | 156 | } |
| 161 | getDetail(); | 157 | if (approveState == 'A' && staffGuid == currentStaffGuid) { |
| 162 | } else { | 158 | btnsArr.push({ |
| 163 | res?.msg && proxy.$ElMessage.error(res.msg); | 159 | label: "撤销", value: "revoke", click: () => { |
| 164 | } | 160 | proxy.$openMessageBox('确定撤销该数据申请审批吗??', () => { |
| 165 | }); | 161 | fullscreenLoading.value = true; |
| 166 | }, () => { | 162 | updateDataApplyState({ |
| 167 | proxy.$ElMessage.info("已取消撤销"); | 163 | guid: detailInfo.value.guid, |
| 164 | approveState: 'C' | ||
| 165 | }).then((res: any) => { | ||
| 166 | fullscreenLoading.value = false; | ||
| 167 | if (res?.code == proxy.$passCode) { | ||
| 168 | proxy.$ElMessage.success('该数据申请撤销成功'); | ||
| 169 | getDetail(); | ||
| 170 | } else { | ||
| 171 | res?.msg && proxy.$ElMessage.error(res.msg); | ||
| 172 | } | ||
| 168 | }); | 173 | }); |
| 169 | } | 174 | }, () => { |
| 170 | }) | 175 | proxy.$ElMessage.info("已取消撤销"); |
| 171 | } | 176 | }); |
| 172 | return btnsArr; | 177 | } |
| 173 | } else { | 178 | }) |
| 174 | let btnsArr: any = [{ | ||
| 175 | label: "关闭", value: "cancel", plain: true | ||
| 176 | }]; | ||
| 177 | // 获取审批人。 | ||
| 178 | const approveVO = detailInfo.value.applicationApproveRSVO || {} | ||
| 179 | let approveState = approveVO.approveState || null; | ||
| 180 | let approveStaffGuid = approveVO?.approveInstanceRSVOS?.[1]?.operator || ''; | ||
| 181 | if (approveState == 'A' && approveStaffGuid == userData.tenantGuid) { | ||
| 182 | btnsArr.push(...[{ | ||
| 183 | label: "通过", value: "pass", type: 'primary', click: () => { | ||
| 184 | passDialogInfo.value.visible = true; | ||
| 185 | } | ||
| 186 | }, { | ||
| 187 | label: "驳回", value: "reject", type: 'danger', plain: true, click: () => { | ||
| 188 | rejectDialogInfo.value.visible = true; | ||
| 189 | } | ||
| 190 | }]) | ||
| 191 | } | ||
| 192 | return btnsArr; | ||
| 193 | } | 179 | } |
| 180 | return btnsArr; | ||
| 194 | }); | 181 | }); |
| 195 | 182 | ||
| 196 | const btnClick = (btn: any) => { | 183 | const btnClick = (btn: any) => { | ... | ... |
| ... | @@ -143,44 +143,38 @@ const tableInfo = ref({ | ... | @@ -143,44 +143,38 @@ const tableInfo = ref({ |
| 143 | if (approveState == 'N') { | 143 | if (approveState == 'N') { |
| 144 | flowState = 1; | 144 | flowState = 1; |
| 145 | } | 145 | } |
| 146 | if (isDataUse.value) { | 146 | let isShowCancel = false; |
| 147 | let isShowCancel = false; | 147 | let list: any = []; |
| 148 | let list: any = []; | 148 | const staffGuid = row.createUserId || ''; |
| 149 | const staffGuid = row.createUserId || ''; | 149 | const currentStaffGuid = userData.userGuid |
| 150 | const currentStaffGuid = userData.userGuid | 150 | if ((bizApproveState == 'D' || approveState == 'C' || approveState == 'R' || approveState == 'E') && staffGuid == currentStaffGuid) { |
| 151 | if ((bizApproveState == 'D' || approveState == 'C' || approveState == 'R' || approveState == 'E') && staffGuid == currentStaffGuid) { | 151 | flowState = 3; |
| 152 | flowState = 3; | ||
| 153 | } | ||
| 154 | if (approveState == 'A' && staffGuid == currentStaffGuid) { | ||
| 155 | isShowCancel = true; | ||
| 156 | } | ||
| 157 | if (flowState === 1) { | ||
| 158 | list = [{ label: "编辑", value: "edit", click: btnHandlers.edit }, { label: "删除", value: "del", click: btnHandlers.del }] | ||
| 159 | } | ||
| 160 | if (flowState !== 1) { | ||
| 161 | list.push({ label: "详情", value: "detail", click: btnHandlers.detail }) | ||
| 162 | } | ||
| 163 | if (flowState === 3 && bizApproveState !== 'D') { //重新提交过的不能再重新提交 && bizApproveState != 'D' | ||
| 164 | list.push({ label: "重新提交", value: "redit", click: btnHandlers.redit }) //已驳回 | ||
| 165 | } | ||
| 166 | isShowCancel && list.push({ label: "撤销", value: "revoke", click: btnHandlers.revoke }) | ||
| 167 | if (flowState === 3) { | ||
| 168 | list.push({ label: "删除", value: "del", click: btnHandlers.del }) | ||
| 169 | } | ||
| 170 | return list | ||
| 171 | } else { //数据提供方需要进行审批驳回和通过。 | ||
| 172 | let list: any = []; | ||
| 173 | list.push({ label: "详情", value: "detail", click: btnHandlers.detail }); | ||
| 174 | // 获取审批人。 | ||
| 175 | let approveStaffGuid = approveVO?.approveInstanceRSVOS?.[1]?.operator || ''; | ||
| 176 | if (approveState == 'A' && approveStaffGuid == userData.tenantGuid) { | ||
| 177 | flowState = 2; | ||
| 178 | } | ||
| 179 | if (flowState === 2) { | ||
| 180 | list.push(...[{ label: "通过", value: "pass", click: btnHandlers.pass }, { label: "驳回", value: "reject", click: btnHandlers.reject }]) | ||
| 181 | } | ||
| 182 | return list; | ||
| 183 | } | 152 | } |
| 153 | if (approveState == 'A' && staffGuid == currentStaffGuid) { | ||
| 154 | isShowCancel = true; | ||
| 155 | } | ||
| 156 | if (flowState === 1) { | ||
| 157 | list = [{ label: "编辑", value: "edit", click: btnHandlers.edit }, { label: "删除", value: "del", click: btnHandlers.del }] | ||
| 158 | } | ||
| 159 | if (flowState !== 1) { | ||
| 160 | list.push({ label: "详情", value: "detail", click: btnHandlers.detail }) | ||
| 161 | } | ||
| 162 | // 获取审批人。 | ||
| 163 | let approveStaffGuid = approveVO?.approveInstanceRSVOS?.[1]?.operator || ''; | ||
| 164 | if (approveState == 'A' && approveStaffGuid == userData.tenantGuid) { | ||
| 165 | flowState = 2; | ||
| 166 | } | ||
| 167 | if (flowState === 2) { | ||
| 168 | list.push(...[{ label: "通过", value: "pass", click: btnHandlers.pass }, { label: "驳回", value: "reject", click: btnHandlers.reject }]) | ||
| 169 | } | ||
| 170 | if (flowState === 3 && bizApproveState !== 'D') { //重新提交过的不能再重新提交 && bizApproveState != 'D' | ||
| 171 | list.push({ label: "重新提交", value: "redit", click: btnHandlers.redit }) //已驳回 | ||
| 172 | } | ||
| 173 | isShowCancel && list.push({ label: "撤销", value: "revoke", click: btnHandlers.revoke }) | ||
| 174 | if (flowState === 3) { | ||
| 175 | list.push({ label: "删除", value: "del", click: btnHandlers.del }) | ||
| 176 | } | ||
| 177 | return list | ||
| 184 | }, | 178 | }, |
| 185 | } | 179 | } |
| 186 | }); | 180 | }); |
| ... | @@ -244,13 +238,13 @@ const btnHandlers = { | ... | @@ -244,13 +238,13 @@ const btnHandlers = { |
| 244 | proxy.$ElMessage.info("已取消撤销"); | 238 | proxy.$ElMessage.info("已取消撤销"); |
| 245 | }); | 239 | }); |
| 246 | }, | 240 | }, |
| 247 | pass: (scope) => { | 241 | pass: (scope) => { |
| 248 | passDialogInfo.value.visible = true; | 242 | passDialogInfo.value.visible = true; |
| 249 | currTableData.value = scope.row; | 243 | currTableData.value = scope.row; |
| 250 | }, | 244 | }, |
| 251 | reject: (scope) => { | 245 | reject: (scope) => { |
| 252 | rejectDialogInfo.value.visible = true; | 246 | rejectDialogInfo.value.visible = true; |
| 253 | currTableData.value = scope.row; | 247 | currTableData.value = scope.row; |
| 254 | } | 248 | } |
| 255 | } | 249 | } |
| 256 | const toSearch = (val: any, clear: boolean = false) => { | 250 | const toSearch = (val: any, clear: boolean = false) => { |
| ... | @@ -276,8 +270,7 @@ const getTableData = () => { | ... | @@ -276,8 +270,7 @@ const getTableData = () => { |
| 276 | pageSize: page.value.limit, | 270 | pageSize: page.value.limit, |
| 277 | damName: page.value.damName, | 271 | damName: page.value.damName, |
| 278 | damType: page.value.damType, | 272 | damType: page.value.damType, |
| 279 | approveState: page.value.approveState, | 273 | approveState: page.value.approveState |
| 280 | characterType: isDataUse.value ? '1' : '2' | ||
| 281 | }).then((res: any) => { | 274 | }).then((res: any) => { |
| 282 | tableInfo.value.loading = false; | 275 | tableInfo.value.loading = false; |
| 283 | if (res?.code == proxy.$passCode) { | 276 | if (res?.code == proxy.$passCode) { | ... | ... |
| ... | @@ -350,7 +350,7 @@ const tableInfo = ref({ | ... | @@ -350,7 +350,7 @@ const tableInfo = ref({ |
| 350 | actionInfo: { | 350 | actionInfo: { |
| 351 | label: "操作", | 351 | label: "操作", |
| 352 | type: "btn", | 352 | type: "btn", |
| 353 | show: isDataUse.value, // 仅对数据使用方显示 | 353 | // show: isDataUse.value, // 都可以显示 |
| 354 | width: 120, | 354 | width: 120, |
| 355 | // 操作按钮定义 | 355 | // 操作按钮定义 |
| 356 | btns: (scope) => { | 356 | btns: (scope) => { | ... | ... |
-
Please register or sign in to post a comment