diff --git a/src/api/process/index.ts b/src/api/process/index.ts index f7e1c14..6dbd33a 100644 --- a/src/api/process/index.ts +++ b/src/api/process/index.ts @@ -19,7 +19,7 @@ export function taskHistoryListApi(config : Object) { } /*签收*/ -export function claim(config : Object) { +export function claim(config : Object) { return http({ url: '/act/task/claim', method: 'PUT', @@ -76,10 +76,18 @@ export function taskEntrust(config : Object) { //委托 }) } -export function myApplyProcessListApi(config : object) { //本人发起列表 +export function getProcessTaskTransInfo(config : Object) { //获取当前流程节点ID return http({ - url: '/act/task/myApplyProcessList', + url: '/act/task/getProcessTaskTransInfo', method: 'GET', data: config }) +} + +export function processComplete(config : Object) { //流程任务完成 + return http({ + url: '/act/task/processComplete', + method: 'POST', + data: config + }) } \ No newline at end of file diff --git a/src/api/system/index.ts b/src/api/system/index.ts index cae627e..3ec4a04 100644 --- a/src/api/system/index.ts +++ b/src/api/system/index.ts @@ -85,4 +85,12 @@ export function getDictItemsApi(dictCode : string) { // 字典标签专用 url: `/sys/dict/getDictItems/${dictCode}`, method: 'GET' }) -} \ No newline at end of file +} + +export function deleteFile(config : object){//删除文件 by 闵 + return http({ + url: `/sys/common/deleteFileAndCache`, + method: 'GET', + data: config + }) +} diff --git a/src/components/Mupload/Mupload.vue b/src/components/Mupload/Mupload.vue index 874b4db..147b209 100644 --- a/src/components/Mupload/Mupload.vue +++ b/src/components/Mupload/Mupload.vue @@ -1,18 +1,29 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/src/pages-process/components/myTask.vue b/src/pages-process/components/myTask.vue index 2ace97c..284b8f8 100644 --- a/src/pages-process/components/myTask.vue +++ b/src/pages-process/components/myTask.vue @@ -102,6 +102,7 @@ pageNo, pageSize }).then((res) => { + console.log(res) if (res.success) { list.value = [...list.value,...res.result.records]; } @@ -119,25 +120,27 @@ const handleChange = (data) => { const rowkey = data.map((item) => item.username).join(',') - // var params = { - // taskId:userTask.value.id, - // taskAssignee:rowkey - // };//查询条件 - // taskEntrust(params).then(res=>{ - // if(res.success){ - // toast.success(res.message) - // uni.redirectTo({ - // url: './approvalTabbar' - // }); - // }else{ - // toast.error(res.message) - // } - // }) + console.log(rowkey) + var params = { + taskId:userTask.value.id, + taskAssignee:rowkey + };//查询条件 + taskEntrust(params).then(res=>{ + if(res.success){ + toast.success(res.message) + uni.redirectTo({ + url: './approvalTabbar' + }); + }else{ + toast.error(res.message) + } + }) } const goToPage = (item)=>{ //判断是否是签收项目,提示是否签收 if(item.taskAssigneeName&&item.taskAssigneeName!=''){ + console.log(item) //办理任务,直接进入办理页面 uni.navigateTo({ url:`/pages-process/taskHandle`, diff --git a/src/pages-process/components/taskDeal.vue b/src/pages-process/components/taskDeal.vue index a541a54..3fa134e 100644 --- a/src/pages-process/components/taskDeal.vue +++ b/src/pages-process/components/taskDeal.vue @@ -3,12 +3,12 @@ 当前环节: - [部门领导] + [{{resultObj.taskName}}] - + @@ -78,6 +190,8 @@ import { getFileAccessHttpUrl } from '@/common/uitls' import { useQueue } from 'wot-design-uni' import Mupload from '@/components/Mupload/Mupload.vue' + import { getProcessTaskTransInfo, processComplete, taskEntrust } from '@/api/process' + import { useToast, useMessage, useNotify, dayjs } from 'wot-design-uni' defineOptions({ name: 'taskDeal', @@ -85,11 +199,25 @@ styleIsolation: 'shared', }, }) - const value = ref([]) + + const fileListTemp = ref('') + const toast = useToast() + const message = useMessage() + const resultObj = ref({}) //流程信息 + const rejectColumns = ref([]) //驳回节点信息 + const value1 = ref([]) + const value2 = ref([]) + const value3 = ref([]) const modelShow = ref({ show1: false, text1: '', - avatar1: '' + avatar1: '', + show2: false, + text2: '', + avatar2: '', + show3: false, + text3: '', + avatar3: '', }) const model = ref({ taskId: '', //taskid @@ -126,8 +254,48 @@ }) + const usePath = ref('流程办理附件') + + watch( //监听文件路径更改 + () => props.formData, + (val) => {//监听formdata 加载数据 + if (val) { + console.log(val) + model.value.taskId = val.taskId; + rejectColumns.value = []; //清空驳回信息 + model.value.rejectModelNode = ''; + let tempArr = []; + getProcessTaskTransInfo({ taskId: model.value.taskId }).then(res => { + console.log(res) + if (res.success) { + resultObj.value = res.result; + res.result.histListNode.forEach(item => { + if (item.NAME_ != res.result.taskName) {//不是当前节点 + tempArr.push({ label: item.NAME_, value: item.TASK_DEF_KEY_ }) + } + }) + rejectColumns.value = tempArr; //赋值驳回信息 + + + } + }) + } + }, + { immediate: true, deep: true }, + ) + + const radioChange = (val) => { + model.value.processModel = val.detail.value + if (val.detail.value != 3) { + //清空驳回信息 + model.value.rejectModelNode = ''; + } + } + + const showSelectuser = (val : string) => { //选人组件 modelShow.value[val] = true; + console.log(props.formData) } const show1Change = (val, type) => { @@ -138,6 +306,18 @@ modelShow.value['text1'] = selectUser.realname modelShow.value['avatar1'] = selectUser.avatar break; + case 'show2': + model.value.nextUserId = selectUser.username + model.value.nextUserName = selectUser.realname + modelShow.value['text2'] = selectUser.realname + modelShow.value['avatar2'] = selectUser.avatar + break; + case 'show3': + model.value.ccUserIds = selectUser.username + model.value.ccUserRealNames = selectUser.realname + modelShow.value['text3'] = selectUser.realname + modelShow.value['avatar3'] = selectUser.avatar + break; default: break; } @@ -150,10 +330,112 @@ modelShow.value['text1'] = '' modelShow.value['avatar1'] = '' break; + case 'show2': + model.value.nextUserName = '' + model.value.nextUserId = '' + modelShow.value['text2'] = '' + modelShow.value['avatar2'] = '' + break; + case 'show3': + model.value.ccUserIds = '' + model.value.ccUserRealNames = ''; + modelShow.value['text3'] = '' + modelShow.value['avatar3'] = '' + break; default: break; } } + + const dictRejctModel = (val) => {//翻译驳回 + return rejectColumns.value.filter(item => { + return item.value = val + })[0].label; + } + + const finishTask = (nextNode) => {//完成任务 + console.log(nextNode) + if (nextNode) { + handleProcessComplete(nextNode) + return; + } + if (resultObj.value.transitionList.length == 1) { + handleProcessComplete(resultObj.value.transitionList[0].nextnode) + } else { + toast.error("存在多分支,请手动选择分支!") + } + } + + const handleProcessComplete = (nextNode) => { + if (!model.value.reason || model.value.reason.length == 0) { + toast.error("请填写处理意见!") + return + } + if (nextNode) { // true + model.value.nextnode = nextNode; + } + + if (model.value.entrust) { //如果有委托,不办理流程 + var params = { + taskId: model.value.taskId, + taskAssignee: model.value.entrust + };//查询条件 + taskEntrust(params).then(res => { + if (res.success) { + toast.success(res.message) + setTimeout(() => { //延迟0.5s + uni.navigateBack() + }, 1000) + } else { + toast.error(res.message) + } + }) + return; + } + + message + .confirm({ + msg: '确认提交审批吗?', + title: '提示', + }) + .then(() => { + console.log(model.value) + model.fileList = JSON.stringify(fileListTemp.value) + processComplete(model.value).then(res => { + if (res.success) {//跳转页面或加载下一个任务 + toast.success("委托成功!") + setTimeout(() => { //延迟0.5s + uni.navigateBack() + }, 1000) + } else { + toast.error(res.message) + } + }) + }) + + } + + const handleManyProcessComplete = () => { //驳回任务提交 + if (model.value.processModel == 3) { + if (!model.value.rejectModelNode || model.value.rejectModelNode.length == 0) { + toast.error("请选择驳回节点!") + return + } + // else{ + // //添加判断在这个item.TASK_DEF_KEY_的参数下面 + // //如果是驳回,这个item.TASK_DEF_KEY_参数传递给提交流程 + // this.handleProcessComplete(); + // } + } + handleProcessComplete(''); + } + + onMounted(() => { + let yy = new Date().getFullYear(); + let mm = new Date().getMonth() + 1; + usePath.value = yy + '-' + mm + '-' + '流程办理附件'; + console.log(usePath) + }) \ No newline at end of file diff --git a/src/pages-process/taskHandle.vue b/src/pages-process/taskHandle.vue index e62461a..4f7ce5b 100644 --- a/src/pages-process/taskHandle.vue +++ b/src/pages-process/taskHandle.vue @@ -111,7 +111,7 @@ procInsId:useData.processInstanceId, tableName:res.result.tableName, permissionList:res.result.permissionList, - vars:res.result.records + vars:res.result.records, } formData.value = data;//流程信息 diff --git a/src/utils/index.ts b/src/utils/index.ts index 164de76..97c12b9 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -424,4 +424,22 @@ function weatherRequest(params : { lat ?: number; lon ?: number; q ?: string }) export const imgUrl = (url : string) => { return getEnvBaseUrl() + '/sys/common/static/' + `/${url}` +} + + +/** + * 获取文件服务访问路径 + * @param avatar + * @param subStr + * @returns {*} + */ +export function getFileAccessHttpUrl(avatar,subStr) { + if(!subStr) subStr = 'http' + if(avatar && avatar.startsWith(subStr)){ + return avatar; + }else{ + if(avatar && avatar.length>0 && avatar.indexOf('[')==-1){ + return getEnvBaseUrl()+ "/sys/common/static/" + avatar; + } + } } \ No newline at end of file