add
This commit is contained in:
parent
6e5f681b48
commit
3806b474f6
26
src/api/oa_flow.ts
Normal file
26
src/api/oa_flow.ts
Normal file
@ -0,0 +1,26 @@
|
||||
import request from "@/utils/request";
|
||||
|
||||
// 审批流程表列表
|
||||
export function apiOaFlowLists(params: any) {
|
||||
return request.get({ url: "/works.bgsp.oa_flow/lists", params });
|
||||
}
|
||||
|
||||
// 添加审批流程表
|
||||
export function apiOaFlowAdd(params: any) {
|
||||
return request.post({ url: "/works.bgsp.oa_flow/add", params });
|
||||
}
|
||||
|
||||
// 编辑审批流程表
|
||||
export function apiOaFlowEdit(params: any) {
|
||||
return request.post({ url: "/works.bgsp.oa_flow/edit", params });
|
||||
}
|
||||
|
||||
// 删除审批流程表
|
||||
export function apiOaFlowDelete(params: any) {
|
||||
return request.post({ url: "/works.bgsp.oa_flow/delete", params });
|
||||
}
|
||||
|
||||
// 审批流程表详情
|
||||
export function apiOaFlowDetail(params: any) {
|
||||
return request.get({ url: "/works.bgsp.oa_flow/detail", params });
|
||||
}
|
26
src/api/oa_flow_type.ts
Normal file
26
src/api/oa_flow_type.ts
Normal file
@ -0,0 +1,26 @@
|
||||
import request from "@/utils/request";
|
||||
|
||||
// 审批类型列表
|
||||
export function apiOaFlowTypeLists(params: any) {
|
||||
return request.get({ url: "/works.bgsp.oa_flow_type/lists", params });
|
||||
}
|
||||
|
||||
// 添加审批类型
|
||||
export function apiOaFlowTypeAdd(params: any) {
|
||||
return request.post({ url: "/works.bgsp.oa_flow_type/add", params });
|
||||
}
|
||||
|
||||
// 编辑审批类型
|
||||
export function apiOaFlowTypeEdit(params: any) {
|
||||
return request.post({ url: "/works.bgsp.oa_flow_type/edit", params });
|
||||
}
|
||||
|
||||
// 删除审批类型
|
||||
export function apiOaFlowTypeDelete(params: any) {
|
||||
return request.post({ url: "/works.bgsp.oa_flow_type/delete", params });
|
||||
}
|
||||
|
||||
// 审批类型详情
|
||||
export function apiOaFlowTypeDetail(params: any) {
|
||||
return request.get({ url: "/works.bgsp.oa_flow_type/detail", params });
|
||||
}
|
160
src/views/oa_flow/edit.vue
Normal file
160
src/views/oa_flow/edit.vue
Normal file
@ -0,0 +1,160 @@
|
||||
<template>
|
||||
<div class="edit-popup">
|
||||
<popup ref="popupRef" :title="popupTitle" :async="true" width="550px" @confirm="handleSubmit" @close="handleClose">
|
||||
<el-form ref="formRef" :model="formData" label-width="90px" :rules="formRules">
|
||||
<el-form-item label="审批流名称" prop="name">
|
||||
<el-input v-model="formData.name" clearable placeholder="请输入审批流名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="流程类型" prop="check_type">
|
||||
<el-input v-model="formData.check_type" clearable placeholder="请输入流程类型" />
|
||||
</el-form-item>
|
||||
<el-form-item label="应用模块" prop="type">
|
||||
<el-input v-model="formData.type" clearable placeholder="请输入应用模块" />
|
||||
</el-form-item>
|
||||
<el-form-item label="应用审批类型id" prop="flow_cate">
|
||||
<el-input v-model="formData.flow_cate" clearable placeholder="请输入应用审批类型id" />
|
||||
</el-form-item>
|
||||
<el-form-item label="应用部门ID(0为全部)1,2,3" prop="department_ids">
|
||||
<el-input v-model="formData.department_ids" clearable placeholder="请输入应用部门ID(0为全部)1,2,3" />
|
||||
</el-form-item>
|
||||
<el-form-item label="抄送人ID" prop="copy_uids">
|
||||
<el-input v-model="formData.copy_uids" clearable placeholder="请输入抄送人ID" />
|
||||
</el-form-item>
|
||||
<el-form-item label="流程说明" prop="remark">
|
||||
<el-input v-model="formData.remark" clearable placeholder="请输入流程说明" />
|
||||
</el-form-item>
|
||||
<el-form-item label="流程数据序列化" prop="flow_list">
|
||||
<el-input v-model="formData.flow_list" clearable placeholder="请输入流程数据序列化" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</popup>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup name="oaFlowEdit">
|
||||
import type { FormInstance } from 'element-plus'
|
||||
import Popup from '@/components/popup/index.vue'
|
||||
import { apiOaFlowAdd, apiOaFlowEdit, apiOaFlowDetail } from '@/api/oa_flow'
|
||||
import { timeFormat } from '@/utils/util'
|
||||
import type { PropType } from 'vue'
|
||||
defineProps({
|
||||
dictData: {
|
||||
type: Object as PropType<Record<string, any[]>>,
|
||||
default: () => ({})
|
||||
}
|
||||
})
|
||||
const emit = defineEmits(['success', 'close'])
|
||||
const formRef = shallowRef<FormInstance>()
|
||||
const popupRef = shallowRef<InstanceType<typeof Popup>>()
|
||||
const mode = ref('add')
|
||||
|
||||
|
||||
// 弹窗标题
|
||||
const popupTitle = computed(() => {
|
||||
return mode.value == 'edit' ? '编辑审批流程表' : '新增审批流程表'
|
||||
})
|
||||
|
||||
// 表单数据
|
||||
const formData = reactive({
|
||||
id: '',
|
||||
name: '',
|
||||
check_type: '',
|
||||
type: '',
|
||||
flow_cate: '',
|
||||
department_ids: '',
|
||||
copy_uids: '',
|
||||
remark: '',
|
||||
flow_list: '',
|
||||
})
|
||||
|
||||
|
||||
// 表单验证
|
||||
const formRules = reactive<any>({
|
||||
name: [{
|
||||
required: true,
|
||||
message: '请输入审批流名称',
|
||||
trigger: ['blur']
|
||||
}],
|
||||
check_type: [{
|
||||
required: true,
|
||||
message: '请输入流程类型',
|
||||
trigger: ['blur']
|
||||
}],
|
||||
type: [{
|
||||
required: true,
|
||||
message: '请输入应用模块',
|
||||
trigger: ['blur']
|
||||
}],
|
||||
flow_cate: [{
|
||||
required: true,
|
||||
message: '请输入应用审批类型id',
|
||||
trigger: ['blur']
|
||||
}],
|
||||
department_ids: [{
|
||||
required: true,
|
||||
message: '请输入应用部门ID(0为全部)1,2,3',
|
||||
trigger: ['blur']
|
||||
}],
|
||||
copy_uids: [{
|
||||
required: true,
|
||||
message: '请输入抄送人ID',
|
||||
trigger: ['blur']
|
||||
}],
|
||||
remark: [{
|
||||
required: true,
|
||||
message: '请输入流程说明',
|
||||
trigger: ['blur']
|
||||
}]
|
||||
})
|
||||
|
||||
|
||||
// 获取详情
|
||||
const setFormData = async (data: Record<any, any>) => {
|
||||
for (const key in formData) {
|
||||
if (data[key] != null && data[key] != undefined) {
|
||||
//@ts-ignore
|
||||
formData[key] = data[key]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
const getDetail = async (row: Record<string, any>) => {
|
||||
const data = await apiOaFlowDetail({
|
||||
id: row.id
|
||||
})
|
||||
setFormData(data)
|
||||
}
|
||||
|
||||
|
||||
// 提交按钮
|
||||
const handleSubmit = async () => {
|
||||
await formRef.value?.validate()
|
||||
const data = { ...formData, }
|
||||
mode.value == 'edit'
|
||||
? await apiOaFlowEdit(data)
|
||||
: await apiOaFlowAdd(data)
|
||||
popupRef.value?.close()
|
||||
emit('success')
|
||||
}
|
||||
|
||||
//打开弹窗
|
||||
const open = (type = 'add') => {
|
||||
mode.value = type
|
||||
popupRef.value?.open()
|
||||
}
|
||||
|
||||
// 关闭回调
|
||||
const handleClose = () => {
|
||||
emit('close')
|
||||
}
|
||||
|
||||
|
||||
|
||||
defineExpose({
|
||||
open,
|
||||
setFormData,
|
||||
getDetail
|
||||
})
|
||||
</script>
|
124
src/views/oa_flow/index.vue
Normal file
124
src/views/oa_flow/index.vue
Normal file
@ -0,0 +1,124 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-card class="!border-none mb-4" shadow="never">
|
||||
<el-form class="mb-[-16px]" :model="queryParams" inline>
|
||||
<el-form-item label="审批流名称" prop="name">
|
||||
<el-input class="w-[280px]" v-model="queryParams.name" clearable placeholder="请输入审批流名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="流程类型" prop="check_type">
|
||||
<el-input class="w-[280px]" v-model="queryParams.check_type" clearable placeholder="请输入流程类型" />
|
||||
</el-form-item>
|
||||
<el-form-item label="应用模块" prop="type">
|
||||
<el-input class="w-[280px]" v-model="queryParams.type" clearable placeholder="请输入应用模块" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="resetPage">查询</el-button>
|
||||
<el-button @click="resetParams">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
<el-card class="!border-none" v-loading="pager.loading" shadow="never">
|
||||
<el-button v-perms="['works.bgsp.oa_flow/add']" type="primary" @click="handleAdd">
|
||||
<template #icon>
|
||||
<icon name="el-icon-Plus" />
|
||||
</template>
|
||||
新增
|
||||
</el-button>
|
||||
<el-button v-perms="['works.bgsp.oa_flow/delete']" :disabled="!selectData.length"
|
||||
@click="handleDelete(selectData)">
|
||||
删除
|
||||
</el-button>
|
||||
<div class="mt-4">
|
||||
<el-table :data="pager.lists" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" />
|
||||
<el-table-column label="审批流名称" prop="name" show-overflow-tooltip />
|
||||
<el-table-column label="流程类型" prop="check_type" show-overflow-tooltip />
|
||||
<el-table-column label="应用模块" prop="type" show-overflow-tooltip />
|
||||
<el-table-column label="应用审批类型id" prop="flow_cate" show-overflow-tooltip />
|
||||
<el-table-column label="应用部门ID(0为全部)1,2,3" prop="department_ids" show-overflow-tooltip />
|
||||
<el-table-column label="抄送人ID" prop="copy_uids" show-overflow-tooltip />
|
||||
<el-table-column label="流程说明" prop="remark" show-overflow-tooltip />
|
||||
<el-table-column label="流程数据序列化" prop="flow_list" show-overflow-tooltip />
|
||||
<el-table-column label="操作" width="120" fixed="right">
|
||||
<template #default="{ row }">
|
||||
<el-button v-perms="['works.bgsp.oa_flow/edit']" type="primary" link @click="handleEdit(row)">
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button v-perms="['works.bgsp.oa_flow/delete']" type="danger" link
|
||||
@click="handleDelete(row.id)">
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
<div class="flex mt-4 justify-end">
|
||||
<pagination v-model="pager" @change="getLists" />
|
||||
</div>
|
||||
</el-card>
|
||||
<edit-popup v-if="showEdit" ref="editRef" :dict-data="dictData" @success="getLists" @close="showEdit = false" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup name="oaFlowLists">
|
||||
import { usePaging } from '@/hooks/usePaging'
|
||||
import { useDictData } from '@/hooks/useDictOptions'
|
||||
import { apiOaFlowLists, apiOaFlowDelete } from '@/api/oa_flow'
|
||||
import { timeFormat } from '@/utils/util'
|
||||
import feedback from '@/utils/feedback'
|
||||
import EditPopup from './edit.vue'
|
||||
|
||||
const editRef = shallowRef<InstanceType<typeof EditPopup>>()
|
||||
// 是否显示编辑框
|
||||
const showEdit = ref(false)
|
||||
|
||||
|
||||
// 查询条件
|
||||
const queryParams = reactive({
|
||||
name: '',
|
||||
check_type: '',
|
||||
type: ''
|
||||
})
|
||||
|
||||
// 选中数据
|
||||
const selectData = ref<any[]>([])
|
||||
|
||||
// 表格选择后回调事件
|
||||
const handleSelectionChange = (val: any[]) => {
|
||||
selectData.value = val.map(({ id }) => id)
|
||||
}
|
||||
|
||||
// 获取字典数据
|
||||
const { dictData } = useDictData('')
|
||||
|
||||
// 分页相关
|
||||
const { pager, getLists, resetParams, resetPage } = usePaging({
|
||||
fetchFun: apiOaFlowLists,
|
||||
params: queryParams
|
||||
})
|
||||
|
||||
// 添加
|
||||
const handleAdd = async () => {
|
||||
showEdit.value = true
|
||||
await nextTick()
|
||||
editRef.value?.open('add')
|
||||
}
|
||||
|
||||
// 编辑
|
||||
const handleEdit = async (data: any) => {
|
||||
showEdit.value = true
|
||||
await nextTick()
|
||||
editRef.value?.open('edit')
|
||||
editRef.value?.setFormData(data)
|
||||
}
|
||||
|
||||
// 删除
|
||||
const handleDelete = async (id: number | any[]) => {
|
||||
await feedback.confirm('确定要删除?')
|
||||
await apiOaFlowDelete({ id })
|
||||
getLists()
|
||||
}
|
||||
|
||||
getLists()
|
||||
</script>
|
||||
|
154
src/views/oa_flow_type/edit.vue
Normal file
154
src/views/oa_flow_type/edit.vue
Normal file
@ -0,0 +1,154 @@
|
||||
<template>
|
||||
<div class="edit-popup">
|
||||
<popup ref="popupRef" :title="popupTitle" :async="true" width="550px" @confirm="handleSubmit" @close="handleClose">
|
||||
<el-form ref="formRef" :model="formData" label-width="90px" :rules="formRules">
|
||||
<el-form-item label="所属分类" prop="type">
|
||||
<el-select v-model="formData.type" clearable placeholder="请选择所属分类" class="flex-1">
|
||||
<el-option v-for="item in dictData.oa_approve_cate" :key="item.value" :label="item.name"
|
||||
:value="parseInt(item.value)" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="审批名称" prop="title">
|
||||
<el-input v-model="formData.title" clearable placeholder="请输入审批名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="审批标识" prop="name">
|
||||
<el-input v-model="formData.name" clearable placeholder="请输入审批标识" />
|
||||
</el-form-item>
|
||||
<el-form-item label="图标">
|
||||
<icon-picker class="flex-1" v-model="formData.icon" />
|
||||
</el-form-item>
|
||||
<el-form-item label="应用部门">
|
||||
<el-select v-model="formData.department_ids" multiple placeholder="请选择应用部门" class="flex-1">
|
||||
<el-option :label="item.name" :value="parseInt(item.id)" v-for="item in deptList">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</popup>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup name="oaFlowTypeEdit">
|
||||
import type { FormInstance } from "element-plus";
|
||||
import Popup from "@/components/popup/index.vue";
|
||||
import {
|
||||
apiOaFlowTypeAdd,
|
||||
apiOaFlowTypeEdit,
|
||||
apiOaFlowTypeDetail,
|
||||
} from "@/api/oa_flow_type";
|
||||
import { timeFormat } from "@/utils/util";
|
||||
import type { PropType } from "vue";
|
||||
defineProps({
|
||||
dictData: {
|
||||
type: Object as PropType<Record<string, any[]>>,
|
||||
default: () => ({}),
|
||||
},
|
||||
deptList: Array
|
||||
|
||||
});
|
||||
const emit = defineEmits(["success", "close"]);
|
||||
const formRef = shallowRef<FormInstance>();
|
||||
const popupRef = shallowRef<InstanceType<typeof Popup>>();
|
||||
const mode = ref("add");
|
||||
|
||||
// 弹窗标题
|
||||
const popupTitle = computed(() => {
|
||||
return mode.value == "edit" ? "编辑审批类型" : "新增审批类型";
|
||||
});
|
||||
|
||||
// 表单数据
|
||||
const formData = reactive({
|
||||
id: "",
|
||||
type: "",
|
||||
title: "",
|
||||
name: "",
|
||||
icon: "",
|
||||
department_ids: "",
|
||||
});
|
||||
|
||||
// 表单验证
|
||||
const formRules = reactive<any>({
|
||||
type: [
|
||||
{
|
||||
required: true,
|
||||
message: "请输入所属分类",
|
||||
trigger: ["blur"],
|
||||
},
|
||||
],
|
||||
title: [
|
||||
{
|
||||
required: true,
|
||||
message: "请输入审批名称",
|
||||
trigger: ["blur"],
|
||||
},
|
||||
],
|
||||
name: [
|
||||
{
|
||||
required: true,
|
||||
message: "请输入审批标识",
|
||||
trigger: ["blur"],
|
||||
},
|
||||
],
|
||||
icon: [
|
||||
{
|
||||
required: true,
|
||||
message: "请输入图标",
|
||||
trigger: ["blur"],
|
||||
},
|
||||
],
|
||||
department_ids: [
|
||||
{
|
||||
required: true,
|
||||
message: "请输入应用部门ID(空为全部)1,2,3",
|
||||
trigger: ["blur"],
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
// 获取详情
|
||||
const setFormData = async (data: Record<any, any>) => {
|
||||
for (const key in formData) {
|
||||
if (data[key] != null && data[key] != undefined) {
|
||||
//@ts-ignore
|
||||
formData[key] = data[key];
|
||||
}
|
||||
}
|
||||
formData.department_ids = formData.department_ids.split(",").map(Number);
|
||||
};
|
||||
|
||||
const getDetail = async (row: Record<string, any>) => {
|
||||
const data = await apiOaFlowTypeDetail({
|
||||
id: row.id,
|
||||
});
|
||||
setFormData(data);
|
||||
};
|
||||
|
||||
// 提交按钮
|
||||
const handleSubmit = async () => {
|
||||
await formRef.value?.validate();
|
||||
const data = { ...formData };
|
||||
data.department_ids = data.department_ids.join(",");
|
||||
mode.value == "edit"
|
||||
? await apiOaFlowTypeEdit(data)
|
||||
: await apiOaFlowTypeAdd(data);
|
||||
popupRef.value?.close();
|
||||
emit("success");
|
||||
};
|
||||
|
||||
//打开弹窗
|
||||
const open = (type = "add") => {
|
||||
mode.value = type;
|
||||
popupRef.value?.open();
|
||||
};
|
||||
|
||||
// 关闭回调
|
||||
const handleClose = () => {
|
||||
emit("close");
|
||||
};
|
||||
|
||||
defineExpose({
|
||||
open,
|
||||
setFormData,
|
||||
getDetail,
|
||||
});
|
||||
</script>
|
133
src/views/oa_flow_type/index.vue
Normal file
133
src/views/oa_flow_type/index.vue
Normal file
@ -0,0 +1,133 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-card class="!border-none mb-4" shadow="never">
|
||||
<el-form class="mb-[-16px]" :model="queryParams" inline>
|
||||
<el-form-item label="所属分类" prop="type">
|
||||
<el-input class="w-[280px]" v-model="queryParams.type" clearable placeholder="请输入所属分类" />
|
||||
</el-form-item>
|
||||
<el-form-item label="审批名称" prop="title">
|
||||
<el-input class="w-[280px]" v-model="queryParams.title" clearable placeholder="请输入审批名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="审批标识" prop="name">
|
||||
<el-input class="w-[280px]" v-model="queryParams.name" clearable placeholder="请输入审批标识" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="resetPage">查询</el-button>
|
||||
<el-button @click="resetParams">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
<el-card class="!border-none" v-loading="pager.loading" shadow="never">
|
||||
<el-button v-perms="['works.bgsp.oa_flow_type/add']" type="primary" @click="handleAdd">
|
||||
<template #icon>
|
||||
<icon name="el-icon-Plus" />
|
||||
</template>
|
||||
新增
|
||||
</el-button>
|
||||
<el-button v-perms="['works.bgsp.oa_flow_type/delete']" :disabled="!selectData.length"
|
||||
@click="handleDelete(selectData)">
|
||||
删除
|
||||
</el-button>
|
||||
<div class="mt-4">
|
||||
<el-table :data="pager.lists" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" />
|
||||
<el-table-column label="所属分类" prop="type_text" show-overflow-tooltip />
|
||||
<el-table-column label="审批名称" prop="title" show-overflow-tooltip />
|
||||
<el-table-column label="审批标识" prop="name" show-overflow-tooltip />
|
||||
<el-table-column label="图标" prop="icon" show-overflow-tooltip />
|
||||
<el-table-column label="应用部门" prop="department_names" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
{{ row.department_names }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="120" fixed="right">
|
||||
<template #default="{ row }">
|
||||
<el-button v-perms="['works.bgsp.oa_flow_type/edit']" type="primary" link
|
||||
@click="handleEdit(row)">
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button v-perms="['works.bgsp.oa_flow_type/delete']" type="danger" link
|
||||
@click="handleDelete(row.id)">
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
<div class="flex mt-4 justify-end">
|
||||
<pagination v-model="pager" @change="getLists" />
|
||||
</div>
|
||||
</el-card>
|
||||
<edit-popup v-if="showEdit" ref="editRef" :deptList="deptList" :dict-data="dictData" @success="getLists"
|
||||
@close="showEdit = false" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup name="oaFlowTypeLists">
|
||||
import { usePaging } from '@/hooks/usePaging'
|
||||
import { useDictData } from '@/hooks/useDictOptions'
|
||||
import { apiOaFlowTypeLists, apiOaFlowTypeDelete } from '@/api/oa_flow_type'
|
||||
import { timeFormat } from '@/utils/util'
|
||||
import feedback from '@/utils/feedback'
|
||||
import EditPopup from './edit.vue'
|
||||
import { deptLists } from "@/api/org/department";
|
||||
|
||||
const editRef = shallowRef<InstanceType<typeof EditPopup>>()
|
||||
// 是否显示编辑框
|
||||
const showEdit = ref(false)
|
||||
|
||||
|
||||
// 查询条件
|
||||
const queryParams = reactive({
|
||||
type: '',
|
||||
title: '',
|
||||
name: ''
|
||||
})
|
||||
|
||||
// 选中数据
|
||||
const selectData = ref<any[]>([])
|
||||
|
||||
// 表格选择后回调事件
|
||||
const handleSelectionChange = (val: any[]) => {
|
||||
selectData.value = val.map(({ id }) => id)
|
||||
}
|
||||
|
||||
// 获取字典数据
|
||||
const { dictData } = useDictData('oa_approve_cate')
|
||||
|
||||
// 分页相关
|
||||
const { pager, getLists, resetParams, resetPage } = usePaging({
|
||||
fetchFun: apiOaFlowTypeLists,
|
||||
params: queryParams
|
||||
})
|
||||
|
||||
// 添加
|
||||
const handleAdd = async () => {
|
||||
showEdit.value = true
|
||||
await nextTick()
|
||||
editRef.value?.open('add')
|
||||
}
|
||||
|
||||
// 编辑
|
||||
const handleEdit = async (data: any) => {
|
||||
showEdit.value = true
|
||||
await nextTick()
|
||||
editRef.value?.open('edit')
|
||||
editRef.value?.setFormData(data)
|
||||
}
|
||||
|
||||
// 删除
|
||||
const handleDelete = async (id: number | any[]) => {
|
||||
await feedback.confirm('确定要删除?')
|
||||
await apiOaFlowTypeDelete({ id })
|
||||
getLists()
|
||||
}
|
||||
const deptList = ref([])
|
||||
const getDeptList = async () => {
|
||||
const res = await deptLists()
|
||||
deptList.value = res.lists
|
||||
}
|
||||
getDeptList()
|
||||
getLists()
|
||||
</script>
|
||||
|
@ -81,9 +81,6 @@ const getLists = async () => {
|
||||
}
|
||||
|
||||
getLists()
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
@ -1,13 +1,6 @@
|
||||
<template>
|
||||
<div class="edit-popup">
|
||||
<popup
|
||||
ref="popupRef"
|
||||
:title="popupTitle"
|
||||
:async="true"
|
||||
width="550px"
|
||||
@confirm="handleSubmit"
|
||||
@close="handleClose"
|
||||
>
|
||||
<popup ref="popupRef" :title="popupTitle" :async="true" width="550px" @confirm="handleSubmit" @close="handleClose">
|
||||
<el-form ref="formRef" :model="formData" label-width="80px" :rules="formRules">
|
||||
<el-form-item label="菜单类型" prop="type" required>
|
||||
<el-radio-group v-model="formData.type">
|
||||
@ -17,19 +10,10 @@
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="父级菜单" prop="pid">
|
||||
<el-tree-select
|
||||
class="flex-1"
|
||||
v-model="formData.pid"
|
||||
:data="menuOptions"
|
||||
clearable
|
||||
node-key="id"
|
||||
<el-tree-select class="flex-1" v-model="formData.pid" :data="menuOptions" clearable node-key="id"
|
||||
:props="{
|
||||
label: 'name'
|
||||
}"
|
||||
:default-expand-all="true"
|
||||
placeholder="请选择父级菜单"
|
||||
check-strictly
|
||||
/>
|
||||
}" :default-expand-all="true" placeholder="请选择父级菜单" check-strictly />
|
||||
</el-form-item>
|
||||
<el-form-item label="菜单名称" prop="name">
|
||||
<el-input v-model="formData.name" placeholder="请输入菜单名称" clearable />
|
||||
@ -46,45 +30,24 @@
|
||||
</div>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
v-if="formData.type == MenuEnum.MENU"
|
||||
label="组件路径"
|
||||
prop="component"
|
||||
>
|
||||
<el-form-item v-if="formData.type == MenuEnum.MENU" label="组件路径" prop="component">
|
||||
<div class="flex-1">
|
||||
<el-autocomplete
|
||||
class="w-full"
|
||||
v-model="formData.component"
|
||||
:fetch-suggestions="querySearch"
|
||||
clearable
|
||||
placeholder="请输入组件路径"
|
||||
/>
|
||||
<el-autocomplete class="w-full" v-model="formData.component" :fetch-suggestions="querySearch"
|
||||
clearable placeholder="请输入组件路径" />
|
||||
<div class="form-tips">
|
||||
访问的组件路径,如:`user/setting`,默认在`views`目录下
|
||||
</div>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="选中菜单"
|
||||
prop="selected"
|
||||
v-if="formData.type == MenuEnum.MENU"
|
||||
>
|
||||
<el-form-item label="选中菜单" prop="selected" v-if="formData.type == MenuEnum.MENU">
|
||||
<div class="flex-1">
|
||||
<el-input
|
||||
v-model="formData.selected"
|
||||
placeholder="请输入路由路径"
|
||||
clearable
|
||||
/>
|
||||
<el-input v-model="formData.selected" placeholder="请输入路由路径" clearable />
|
||||
<div class="form-tips">
|
||||
访问详情页面,编辑页面时,菜单高亮显示,如`/consumer/lists`
|
||||
</div>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
v-if="formData.type != MenuEnum.CATALOGUE"
|
||||
label="权限字符"
|
||||
prop="perms"
|
||||
>
|
||||
<el-form-item v-if="formData.type != MenuEnum.CATALOGUE" label="权限字符" prop="perms">
|
||||
<div class="flex-1">
|
||||
<el-input v-model="formData.perms" placeholder="请输入权限字符" clearable />
|
||||
<div class="form-tips">
|
||||
@ -95,11 +58,7 @@
|
||||
<el-form-item v-if="formData.type == MenuEnum.MENU" label="路由参数" prop="params">
|
||||
<div>
|
||||
<div class="flex-1">
|
||||
<el-input
|
||||
v-model="formData.params"
|
||||
placeholder="请输入路由参数"
|
||||
clearable
|
||||
/>
|
||||
<el-input v-model="formData.params" placeholder="请输入路由参数" clearable />
|
||||
</div>
|
||||
<div class="form-tips">
|
||||
访问路由的默认传递参数,如:`{"id": 1, "name":
|
||||
@ -107,12 +66,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
v-if="formData.type == MenuEnum.MENU"
|
||||
label="是否缓存"
|
||||
prop="is_cache"
|
||||
required
|
||||
>
|
||||
<el-form-item v-if="formData.type == MenuEnum.MENU" label="是否缓存" prop="is_cache" required>
|
||||
<div>
|
||||
<el-radio-group v-model="formData.is_cache">
|
||||
<el-radio :label="1">缓存</el-radio>
|
||||
@ -121,12 +75,7 @@
|
||||
<div class="form-tips">选择缓存则会被`keep-alive`缓存</div>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
v-if="formData.type != MenuEnum.BUTTON"
|
||||
label="是否显示"
|
||||
prop="is_show"
|
||||
required
|
||||
>
|
||||
<el-form-item v-if="formData.type != MenuEnum.BUTTON" label="是否显示" prop="is_show" required>
|
||||
<div>
|
||||
<el-radio-group v-model="formData.is_show">
|
||||
<el-radio :label="1">显示</el-radio>
|
||||
@ -137,12 +86,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
v-if="formData.type != MenuEnum.BUTTON"
|
||||
label="菜单状态"
|
||||
prop="is_disable"
|
||||
required
|
||||
>
|
||||
<el-form-item v-if="formData.type != MenuEnum.BUTTON" label="菜单状态" prop="is_disable" required>
|
||||
<div>
|
||||
<el-radio-group v-model="formData.is_disable">
|
||||
<el-radio :label="0">正常</el-radio>
|
||||
@ -181,8 +125,8 @@ const componentsOptions = ref(getModulesKey())
|
||||
const querySearch = (queryString: string, cb: any) => {
|
||||
const results = queryString
|
||||
? componentsOptions.value.filter((item) =>
|
||||
item.toLowerCase().includes(queryString.toLowerCase())
|
||||
)
|
||||
item.toLowerCase().includes(queryString.toLowerCase())
|
||||
)
|
||||
: componentsOptions.value
|
||||
cb(results.map((item) => ({ value: item })))
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user