fix: 流程图携带token

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

View File

@ -4,8 +4,7 @@
<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'">
@ -17,26 +16,25 @@
</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" <el-button :disabled="multiple" @click="handleDelete(selectObjs)" class="ml10" icon="Delete" type="primary" v-auth="'oa_process_del'">
type="primary" v-auth="'oa_process_del'">
{{ $t('common.delBtn') }} {{ $t('common.delBtn') }}
</el-button> </el-button>
<right-toolbar @queryTable="getDataList" class="ml10" style="float: right;margin-right: 20px" <right-toolbar
v-model:showSearch="showSearch"></right-toolbar> @queryTable="getDataList"
class="ml10"
style="float: right; margin-right: 20px"
v-model:showSearch="showSearch"
></right-toolbar>
</div> </div>
</el-row> </el-row>
<el-table :data="state.dataList" @selection-change="handleSelectionChange" style="width: 100%" <el-table :data="state.dataList" @selection-change="handleSelectionChange" style="width: 100%" v-loading="state.loading">
v-loading="state.loading"> <el-table-column align="center" type="selection" width="50" />
<el-table-column align="center" type="selection" width="50"/> <el-table-column :label="$t('process.index')" type="index" width="80" />
<el-table-column :label="$t('process.index')" type="index" width="80"/> <el-table-column :label="$t('process.processonDefinitionId')" prop="processonDefinitionId" 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"
show-overflow-tooltip></el-table-column>
<el-table-column :label="$t('process.status')" prop="suspend" show-overflow-tooltip> <el-table-column :label="$t('process.status')" prop="suspend" show-overflow-tooltip>
<template #default="scope"> <template #default="scope">
<span v-if="scope.row.suspend"><el-tag type="danger">挂起</el-tag></span> <span v-if="scope.row.suspend"><el-tag type="danger">挂起</el-tag></span>
@ -50,112 +48,105 @@
</el-table-column> </el-table-column>
<el-table-column :label="$t('common.action')" width="200"> <el-table-column :label="$t('common.action')" width="200">
<template #default="scope"> <template #default="scope">
<el-button @click="handleView(scope.row)" text type="primary">流程图 <el-button @click="handleView(scope.row)" text type="primary">流程图 </el-button>
</el-button> <el-button @click="handleStatus(scope.row, 'suspend')" text type="primary" v-if="!scope.row.suspend">失效 </el-button>
<el-button @click="handleStatus(scope.row, 'suspend')" text type="primary" <el-button @click="handleStatus(scope.row, 'active')" text type="primary" v-if="scope.row.suspend">激活 </el-button>
v-if="!scope.row.suspend">失效 <el-button @click="handleDelete([scope.row.roleId])" text type="primary" v-auth="'oa_process_del'">{{ $t('common.delBtn') }} </el-button>
</el-button>
<el-button @click="handleStatus(scope.row, 'active')" text type="primary"
v-if="scope.row.suspend">激活
</el-button>
<el-button @click="handleDelete([scope.row.roleId])" text type="primary"
v-auth="'oa_process_del'">{{
$t('common.delBtn')
}}
</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<pagination @current-change="currentChangeHandle" @size-change="sizeChangeHandle" <pagination @current-change="currentChangeHandle" @size-change="sizeChangeHandle" v-bind="state.pagination" />
v-bind="state.pagination"/>
</el-card> </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)
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>({
queryForm: { queryForm: {
category: '' category: '',
}, },
pageList: fetchList // H pageList: fetchList, // H
}); });
// table hook // table hook
const { const { getDataList, currentChangeHandle, sizeChangeHandle } = useTable(state);
getDataList,
currentChangeHandle,
sizeChangeHandle,
} = useTable(state)
// //
const resetQuery = () => { const resetQuery = () => {
queryRef.value.resetFields() queryRef.value.resetFields();
getDataList() getDataList();
} };
// //
const handleSelectionChange = (objs: any) => { const handleSelectionChange = (objs: any) => {
selectObjs.value = [] selectObjs.value = [];
objs.forEach((val: any) => { objs.forEach((val: any) => {
selectObjs.value.push(val.roleId) selectObjs.value.push(val.roleId);
}); });
multiple.value = !objs.length multiple.value = !objs.length;
} };
// //
const handleDelete = (ids: string[]) => { const handleDelete = (ids: string[]) => {
useMessageBox().confirm(t('common.delConfirmText')) useMessageBox()
.confirm(t('common.delConfirmText'))
.then(() => {
delObj(ids)
.then(() => { .then(() => {
delObj(ids).then(() => {
getDataList(); getDataList();
useMessage().success(t('common.delSuccessText')); useMessage().success(t('common.delSuccessText'));
}).catch((err: any) => {
useMessage().error(err.msg)
}) })
}) .catch((err: any) => {
}; useMessage().error(err.msg);
});
});
};
// //
const handleView = (row: any) => { const handleView = (row: any) => {
actPicUrl.value = `/admin/process/resource/${row.deploymentId}/${row.processonDefinitionId}/image` actPicUrl.value = `/admin/process/resource/${row.deploymentId}/${
showPicDialog.value = true row.processonDefinitionId
} }/image?access_token=${Session.getToken()}&TENANT-ID=${Session.getTenant()}`;
showPicDialog.value = true;
};
// //
const handleStatus = (row, type) => { const handleStatus = (row, type) => {
useMessageBox().confirm('是否将此流程设置为 ' + type) useMessageBox()
.confirm('是否将此流程设置为 ' + type)
.then(() => {
status(row.processonDefinitionId, type)
.then(() => { .then(() => {
status(row.processonDefinitionId, type).then(() => {
getDataList(); getDataList();
useMessage().success(t('common.optSuccessText')); useMessage().success(t('common.optSuccessText'));
}).catch((err: any) => {
useMessage().error(err.msg)
}) })
}) .catch((err: any) => {
} useMessage().error(err.msg);
});
});
};
</script> </script>