新增审批页面

This commit is contained in:
weipengfei 2023-08-28 10:58:43 +08:00
parent 1b870c2921
commit d0b6b584b9
2 changed files with 374 additions and 0 deletions

View File

@ -0,0 +1,185 @@
<template>
<div class="edit-popup">
<popup
ref="popupRef"
:title="popupTitle"
:async="true"
width="80vw"
@confirm="handleSubmit"
@close="handleClose"
>
<el-form
ref="formRef"
:model="formData"
:rules="formRules"
label-width="120px"
>
<el-col>
<el-row>
<el-col :span="8">
<el-form-item label="ID" prop="id">
<el-input readonly v-model="formData.id" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="任务名称" prop="name">
<el-input readonly v-model="formData.name" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="任务金额" prop="flow_cate">
<el-input readonly v-model="formData.flow_cate" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col>
<el-form-item label="任务描述" prop="remark">
<el-input
readonly
v-model="formData.remark"
clearable
type="textarea"
/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="任务完成时间" prop="id">
<el-input readonly v-model="formData.id" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="所属公司" prop="name">
<el-input readonly v-model="formData.name" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="片区经理" prop="flow_cate">
<el-input readonly v-model="formData.flow_cate" />
</el-form-item>
</el-col>
</el-row>
</el-col>
<el-col :span="8">
<el-form-item
label="片区经理审核"
prop="flow_detail.check_type"
clearable
:style="{ width: '100%' }"
required
>
<el-radio-group v-model="formData.flow_detail.type">
<el-radio :label="1">通过</el-radio>
<el-radio :label="2">驳回</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item
label="风控部审核"
prop="flow_detail.check_type"
clearable
:style="{ width: '100%' }"
required
>
<el-radio-group v-model="formData.flow_detail.type">
<el-radio :label="1">通过</el-radio>
<el-radio :label="2">驳回</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
</el-form>
</popup>
</div>
</template>
<script lang="ts" setup name="flowEdit">
import type { FormInstance } from "element-plus";
import Popup from "@/components/popup/index.vue";
import { apiFlowCreat, apiFlowDetil } from "@/api/examined";
import { timeFormat } from "@/utils/util";
import type { PropType } from "vue";
defineProps({
dictData: {
type: Object as PropType<Record<string, any[]>>,
default: () => ({}),
},
});
const isCompany = ref(false);
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: "",
remark: "",
flow_detail: {
type: 1,
step: [{ type: "", user: [{ id: "", name: "" }] }],
},
copy_to: [{ id: "", name: "" }],
});
//
const formRules = reactive<any>({});
function customEvent(data: any) {
isCompany.value = false;
}
//
const setFormData = async (data: Record<any, any>) => {
let res = await apiFlowDetil(data.id);
for (const key in formData) {
if (data[key] != null && data[key] != undefined) {
//@ts-ignore
formData[key] = res[key];
}
}
formData.flow_detail.type = Number(formData.flow_detail.type);
};
const getDetail = async (row: Record<string, any>) => {
// const data = await apiFlowDetail({
// id: row.id,
// });
// setFormData(data);
};
//
const handleSubmit = async () => {
await formRef.value?.validate();
mode.value == "edit"
? await apiFlowCreat(formData)
: await apiFlowCreat(formData);
popupRef.value?.close();
emit("success");
};
//
const open = (type = "add") => {
mode.value = type;
popupRef.value?.open();
};
//
const handleClose = () => {
emit("close");
};
defineExpose({
open,
setFormData,
getDetail,
});
</script>

View File

@ -0,0 +1,189 @@
<template>
<div>
<el-card class="!border-none" v-loading="pager.loading" shadow="never">
<!-- <el-button v-perms="['flow/add']" type="primary" @click="handleAdd">
<template #icon>
<icon name="el-icon-Plus" />
</template>
新增
</el-button> -->
<!-- <el-button
v-perms="['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 label="ID" prop="id" />
<el-table-column label="任务名称" prop="name" show-overflow-tooltip />
<el-table-column label="任务描述" prop="remark" show-overflow-tooltip>
</el-table-column>
<el-table-column label="任务金额" prop="remark" show-overflow-tooltip>
</el-table-column>
<el-table-column
label="任务完成时间"
prop="remark"
show-overflow-tooltip
>
</el-table-column>
<el-table-column label="所属公司" prop="remark" show-overflow-tooltip>
</el-table-column>
<el-table-column label="片区经理" prop="remark" show-overflow-tooltip>
</el-table-column>
<el-table-column
label="片区经理审核状态"
prop="status"
show-overflow-tooltip
>
<template #default="{ row }">
<span v-if="row.status == 3" style="color: #ff0000">已驳回</span>
<span v-if="row.status == 2" style="color: #f56c6c">未通过</span>
<span v-if="row.status == 1" style="color: #67c23a">已通过</span>
<span v-if="row.status == 0" style="color: #e6a23c">未审核</span>
</template>
</el-table-column>
<el-table-column
label="风控部审核状态"
prop="status"
show-overflow-tooltip
>
<template #default="{ row }">
<span v-if="row.status == 3" style="color: #ff0000">已驳回</span>
<span v-if="row.status == 2" style="color: #f56c6c">未通过</span>
<span v-if="row.status == 1" style="color: #67c23a">已通过</span>
<span v-if="row.status == 0" style="color: #e6a23c">未审核</span>
</template>
</el-table-column>
<!-- <el-table-column label="状态" prop="status" show-overflow-tooltip>
<template #default="{ row }">
<span v-if="row.status == 1">启用</span>
<span v-if="row.status == 0">禁用</span>
</template>
</el-table-column> -->
<!-- <el-table-column
label="账号状态"
min-width="100"
v-perms="['auth.admin/edit']"
>
<template #default="{ row }">
<el-switch
v-if="row.root != 1"
v-model="row.status"
:active-value="1"
:inactive-value="0"
@change="changeStatus(row)"
/>
</template>
</el-table-column> -->
<el-table-column label="操作" width="120" fixed="right">
<template #default="{ row }">
<el-button
v-perms="['flow/edit']"
type="primary"
link
@click="handleEdit(row)"
>
审核
</el-button>
<!-- <el-button
v-perms="['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="flowLists">
import { usePaging } from "@/hooks/usePaging";
import { useDictData } from "@/hooks/useDictOptions";
import { apiFlowLists, apiFlowDetil, apiFlowStatus } from "@/api/examined";
import { timeFormat } from "@/utils/util";
import feedback from "@/utils/feedback";
import EditPopup from "./examined_popup.vue";
const editRef = shallowRef<InstanceType<typeof EditPopup>>();
//
const showEdit = ref(false);
//
const queryParams = reactive({
name: "",
check_type: "",
type: "",
flow_cate: "",
department_ids: "",
copy_uids: "",
remark: "",
flow_list: "",
admin_id: "",
status: "",
delete_user_id: "",
});
//
const selectData = ref<any[]>([]);
//
const handleSelectionChange = (val: any[]) => {
selectData.value = val.map(({ id }) => id);
};
//
const { dictData } = useDictData("");
//
const { pager, getLists, resetParams, resetPage } = usePaging({
fetchFun: apiFlowLists,
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 changeStatus = (row: any) => {
console.log(row.status);
apiFlowStatus({ id: row.id, status: row.status });
};
//
// const handleDelete = async (id: number | any[]) => {
// await feedback.confirm("");
// await apiFlowDelete({ id });
// getLists();
// };
getLists();
</script>