fix: 流程图携带token

This commit is contained in:
lbw 2023-03-09 13:03:12 +08:00
parent 1bd3e030e3
commit c39a034fb2

View File

@ -1,161 +1,152 @@
<template> <template>
<div class="layout-padding"> <div class="layout-padding">
<el-card class="layout-padding-auto" shadow="hover"> <el-card class="layout-padding-auto" shadow="hover">
<el-row class="mb8" shadow="hover" v-show="showSearch"> <el-row class="mb8" shadow="hover" v-show="showSearch">
<el-form :inline="true" :model="state.queryForm" @keyup.enter="getDataList" ref="queryRef"> <el-form :inline="true" :model="state.queryForm" @keyup.enter="getDataList" ref="queryRef">
<el-form-item :label="$t('process.category')" prop="category"> <el-form-item :label="$t('process.category')" prop="category">
<el-input :placeholder="$t('process.inputCategoryTip')" style="max-width: 180px" <el-input :placeholder="$t('process.inputCategoryTip')" style="max-width: 180px" v-model="state.queryForm.category" />
v-model="state.queryForm.category"/> </el-form-item>
</el-form-item> <el-form-item class="ml2">
<el-form-item class="ml2"> <el-button @click="getDataList" icon="search" type="primary" v-auth="'oa_process_view'">
<el-button @click="getDataList" icon="search" type="primary" v-auth="'oa_process_view'"> {{ $t('common.queryBtn') }}
{{ $t('common.queryBtn') }} </el-button>
</el-button> <el-button @click="resetQuery" icon="Refresh">{{ $t('common.resetBtn') }}</el-button>
<el-button @click="resetQuery" icon="Refresh">{{ $t('common.resetBtn') }}</el-button> </el-form-item>
</el-form-item> </el-form>
</el-form> </el-row>
</el-row> <el-row>
<el-row> <div class="mb8" style="width: 100%">
<div class="mb8" style="width: 100%"> <el-button :disabled="multiple" @click="handleDelete(selectObjs)" class="ml10" icon="Delete" type="primary" v-auth="'oa_process_del'">
<el-button :disabled="multiple" @click="handleDelete(selectObjs)" class="ml10" icon="Delete" {{ $t('common.delBtn') }}
type="primary" v-auth="'oa_process_del'"> </el-button>
{{ $t('common.delBtn') }} <right-toolbar
</el-button> @queryTable="getDataList"
<right-toolbar @queryTable="getDataList" class="ml10" style="float: right;margin-right: 20px" class="ml10"
v-model:showSearch="showSearch"></right-toolbar> style="float: right; margin-right: 20px"
</div> v-model:showSearch="showSearch"
</el-row> ></right-toolbar>
<el-table :data="state.dataList" @selection-change="handleSelectionChange" style="width: 100%" </div>
v-loading="state.loading"> </el-row>
<el-table-column align="center" type="selection" width="50"/> <el-table :data="state.dataList" @selection-change="handleSelectionChange" style="width: 100%" v-loading="state.loading">
<el-table-column :label="$t('process.index')" type="index" width="80"/> <el-table-column align="center" type="selection" width="50" />
<el-table-column :label="$t('process.processonDefinitionId')" prop="processonDefinitionId" <el-table-column :label="$t('process.index')" type="index" width="80" />
show-overflow-tooltip></el-table-column> <el-table-column :label="$t('process.processonDefinitionId')" prop="processonDefinitionId" show-overflow-tooltip></el-table-column>
<el-table-column :label="$t('process.name')" prop="name" show-overflow-tooltip></el-table-column> <el-table-column :label="$t('process.name')" prop="name" show-overflow-tooltip></el-table-column>
<el-table-column :label="$t('process.key')" prop="key" show-overflow-tooltip></el-table-column> <el-table-column :label="$t('process.key')" prop="key" show-overflow-tooltip></el-table-column>
<el-table-column :label="$t('process.category')" prop="category" <el-table-column :label="$t('process.category')" prop="category" show-overflow-tooltip></el-table-column>
show-overflow-tooltip></el-table-column> <el-table-column :label="$t('process.revision')" prop="revision" show-overflow-tooltip></el-table-column>
<el-table-column :label="$t('process.revision')" prop="revision" <el-table-column :label="$t('process.status')" prop="suspend" show-overflow-tooltip>
show-overflow-tooltip></el-table-column> <template #default="scope">
<el-table-column :label="$t('process.status')" prop="suspend" show-overflow-tooltip> <span v-if="scope.row.suspend"><el-tag type="danger">挂起</el-tag></span>
<template #default="scope"> <span v-else><el-tag>有效</el-tag></span>
<span v-if="scope.row.suspend"><el-tag type="danger">挂起</el-tag></span> </template>
<span v-else><el-tag>有效</el-tag></span> </el-table-column>
</template> <el-table-column :label="$t('process.deploymentTime')" prop="deploymentTime" show-overflow-tooltip>
</el-table-column> <template #default="scope">
<el-table-column :label="$t('process.deploymentTime')" prop="deploymentTime" show-overflow-tooltip> <span>{{ parseTime(scope.row.deploymentTime) }}</span>
<template #default="scope"> </template>
<span>{{ parseTime(scope.row.deploymentTime) }}</span> </el-table-column>
</template> <el-table-column :label="$t('common.action')" width="200">
</el-table-column> <template #default="scope">
<el-table-column :label="$t('common.action')" width="200"> <el-button @click="handleView(scope.row)" text type="primary">流程图 </el-button>
<template #default="scope"> <el-button @click="handleStatus(scope.row, 'suspend')" text type="primary" v-if="!scope.row.suspend">失效 </el-button>
<el-button @click="handleView(scope.row)" text type="primary">流程图 <el-button @click="handleStatus(scope.row, 'active')" text type="primary" v-if="scope.row.suspend">激活 </el-button>
</el-button> <el-button @click="handleDelete([scope.row.roleId])" text type="primary" v-auth="'oa_process_del'">{{ $t('common.delBtn') }} </el-button>
<el-button @click="handleStatus(scope.row, 'suspend')" text type="primary" </template>
v-if="!scope.row.suspend">失效 </el-table-column>
</el-button> </el-table>
<el-button @click="handleStatus(scope.row, 'active')" text type="primary" <pagination @current-change="currentChangeHandle" @size-change="sizeChangeHandle" v-bind="state.pagination" />
v-if="scope.row.suspend">激活 </el-card>
</el-button>
<el-button @click="handleDelete([scope.row.roleId])" text type="primary"
v-auth="'oa_process_del'">{{
$t('common.delBtn')
}}
</el-button>
</template>
</el-table-column>
</el-table>
<pagination @current-change="currentChangeHandle" @size-change="sizeChangeHandle"
v-bind="state.pagination"/>
</el-card>
<el-dialog title="流程图" v-model="showPicDialog"> <el-dialog title="流程图" v-model="showPicDialog">
<img :src="actPicUrl" style="width: 100%;"> <img :src="actPicUrl" style="width: 100%" />
</el-dialog> </el-dialog>
</div> </div>
</template> </template>
<script lang="ts" name="model" setup> <script lang="ts" name="model" setup>
import {BasicTableProps, useTable} from "/@/hooks/table"; import { BasicTableProps, useTable } from '/@/hooks/table';
import {delObj, fetchList, status} from "/@/api/oa/process"; import { delObj, fetchList, status } from '/@/api/oa/process';
import {useMessage, useMessageBox} from "/@/hooks/message"; import { useMessage, useMessageBox } from '/@/hooks/message';
import {useI18n} from "vue-i18n"; import { useI18n } from 'vue-i18n';
import { Session } from '/@/utils/storage';
//
const { t } = useI18n();
// //
const {t} = useI18n() const showPicDialog = ref(false);
const queryRef = ref();
const showSearch = ref(true);
// rows
const selectObjs = ref([]) as any;
//
const multiple = ref(true);
// URL
const actPicUrl = ref('');
// const state: BasicTableProps = reactive<BasicTableProps>({
const showPicDialog = ref(false) queryForm: {
const queryRef = ref() category: '',
const showSearch = ref(true) },
// rows pageList: fetchList, // H
const selectObjs = ref([]) as any });
//
const multiple = ref(true)
// URL
const actPicUrl = ref('')
const state: BasicTableProps = reactive<BasicTableProps>({ // table hook
queryForm: { const { getDataList, currentChangeHandle, sizeChangeHandle } = useTable(state);
category: ''
},
pageList: fetchList // H
});
// table hook //
const { const resetQuery = () => {
getDataList, queryRef.value.resetFields();
currentChangeHandle, getDataList();
sizeChangeHandle, };
} = useTable(state)
// //
const resetQuery = () => { const handleSelectionChange = (objs: any) => {
queryRef.value.resetFields() selectObjs.value = [];
getDataList() objs.forEach((val: any) => {
} selectObjs.value.push(val.roleId);
});
multiple.value = !objs.length;
};
// //
const handleSelectionChange = (objs: any) => { const handleDelete = (ids: string[]) => {
selectObjs.value = [] useMessageBox()
objs.forEach((val: any) => { .confirm(t('common.delConfirmText'))
selectObjs.value.push(val.roleId) .then(() => {
}); delObj(ids)
multiple.value = !objs.length .then(() => {
} getDataList();
useMessage().success(t('common.delSuccessText'));
})
.catch((err: any) => {
useMessage().error(err.msg);
});
});
};
// //
const handleDelete = (ids: string[]) => { const handleView = (row: any) => {
useMessageBox().confirm(t('common.delConfirmText')) actPicUrl.value = `/admin/process/resource/${row.deploymentId}/${
.then(() => { row.processonDefinitionId
delObj(ids).then(() => { }/image?access_token=${Session.getToken()}&TENANT-ID=${Session.getTenant()}`;
getDataList(); showPicDialog.value = true;
useMessage().success(t('common.delSuccessText')); };
}).catch((err: any) => {
useMessage().error(err.msg)
})
})
};
//
const handleView = (row: any) => {
actPicUrl.value = `/admin/process/resource/${row.deploymentId}/${row.processonDefinitionId}/image`
showPicDialog.value = true
}
//
const handleStatus = (row, type) => {
useMessageBox().confirm('是否将此流程设置为 ' + type)
.then(() => {
status(row.processonDefinitionId, type).then(() => {
getDataList();
useMessage().success(t('common.optSuccessText'));
}).catch((err: any) => {
useMessage().error(err.msg)
})
})
}
//
const handleStatus = (row, type) => {
useMessageBox()
.confirm('是否将此流程设置为 ' + type)
.then(() => {
status(row.processonDefinitionId, type)
.then(() => {
getDataList();
useMessage().success(t('common.optSuccessText'));
})
.catch((err: any) => {
useMessage().error(err.msg);
});
});
};
</script> </script>