页面完善

This commit is contained in:
THK3121 2023-07-22 16:33:01 +08:00
parent 62045635ab
commit 81f4f3ad88
2 changed files with 263 additions and 152 deletions

View File

@ -31,7 +31,6 @@
</el-icon> </el-icon>
</el-upload> </el-upload>
</div> </div>
<el-col class="pt-6 !border-none"> <el-col class="pt-6 !border-none">
<el-row> <el-row>
<el-col :span="11"> <el-col :span="11">
@ -101,7 +100,6 @@
></el-option> ></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="市" prop="city" style="flex: 1"> <el-form-item label="市" prop="city" style="flex: 1">
<el-select <el-select
:disabled="isCheck" :disabled="isCheck"
@ -169,6 +167,7 @@
<el-col :span="24" style="margin-top: 1vh"> <el-col :span="24" style="margin-top: 1vh">
<el-row> <el-row>
<el-col :span="12" v-if="userStore.userInfo.root == 0"> <el-col :span="12" v-if="userStore.userInfo.root == 0">
<!-- <el-col :span="12" v-if="true"> -->
<el-form-item label="授权身份" prop="role_id"> <el-form-item label="授权身份" prop="role_id">
<el-select <el-select
v-model="formData.role_id" v-model="formData.role_id"
@ -446,7 +445,6 @@
</el-col> </el-col>
</el-row> </el-row>
</el-col> </el-col>
<el-col :span="24" v-if="!isCheck"> <el-col :span="24" v-if="!isCheck">
<el-form-item label="合同上传" prop="field127"> <el-form-item label="合同上传" prop="field127">
<el-upload <el-upload
@ -671,7 +669,6 @@ const { optionsData } = useDictOptions<{
}, },
}); });
const handleSubmit = async () => { const handleSubmit = async () => {
console.log(formData);
if (isCheck.value) { if (isCheck.value) {
popupRef.value?.close(); popupRef.value?.close();
return; return;
@ -788,6 +785,10 @@ const setFormData = async (row: any) => {
if (stringArr.includes(key)) formData[key] = formData[key].toString(); if (stringArr.includes(key)) formData[key] = formData[key].toString();
} }
} }
formData.contract_type = data.contract.contract_type;
formData.party_a_name = data.contract.party_a_name;
formData.party_a = data.contract.party_a;
formData.file = data.contract.file;
await getCityList(); await getCityList();
await getAreaList(); await getAreaList();
await getStreetList(); await getStreetList();

View File

@ -1,95 +1,205 @@
<template> <template>
<div class="admin"> <div class="admin">
<el-card class="!border-none" shadow="never"> <el-card class="!border-none" shadow="never">
<el-form class="mb-[-16px]" :model="formData" inline> <el-form class="mb-[-16px]" :model="formData" inline>
<el-form-item label="管理员名称"> <el-form-item label="管理员名称">
<el-input v-model="formData.name" class="w-[280px]" clearable @keyup.enter="resetPage" /> <el-input
</el-form-item> v-model="formData.name"
<el-form-item label="管理员角色"> class="w-[280px]"
<el-select class="w-[280px]" v-model="formData.role_id"> clearable
<el-option label="全部" value /> @keyup.enter="resetPage"
<el-option v-for="(item, index) in optionsData.role" :key="index" :label="item.name" />
:value="item.id" /> </el-form-item>
</el-select> <el-form-item label="管理员角色">
</el-form-item> <el-select class="w-[280px]" v-model="formData.role_id">
<el-form-item> <el-option label="全部" value />
<el-button type="primary" @click="resetPage">查询</el-button> <el-option
<el-button @click="resetParams">重置</el-button> v-for="(item, index) in optionsData.role"
<export-data class="ml-2.5" :fetch-fun="adminLists" :params="formData" :page-size="pager.size" /> :key="index"
</el-form-item> :label="item.name"
</el-form> :value="item.id"
</el-card> />
<el-card v-loading="pager.loading" class="mt-4 !border-none" shadow="never"> </el-select>
<el-button v-perms="['auth.admin/add']" type="primary" @click="handleAdd"> </el-form-item>
<template #icon> <el-form-item>
<icon name="el-icon-Plus" /> <el-button type="primary" @click="resetPage">查询</el-button>
</template> <el-button @click="resetParams">重置</el-button>
新增 <export-data
</el-button> class="ml-2.5"
<div class="mt-4"> :fetch-fun="adminLists"
<el-table :data="pager.lists" size="large"> :params="formData"
<el-table-column label="ID" prop="id" min-width="60" />> :page-size="pager.size"
<el-table-column label="头像" min-width="100"> />
<template #default="{ row }"> </el-form-item>
<el-avatar :size="50" :src="row.avatar"></el-avatar> </el-form>
</template> </el-card>
</el-table-column> <el-card v-loading="pager.loading" class="mt-4 !border-none" shadow="never">
<el-table-column label="账号" prop="account" min-width="120" /> <el-button v-perms="['auth.admin/add']" type="primary" @click="handleAdd">
<el-table-column label="名称" prop="name" min-width="100" /> <template #icon>
<el-table-column label="角色" prop="role_name" min-width="100" show-tooltip-when-overflow /> <icon name="el-icon-Plus" />
<el-table-column label="部门" prop="dept_name" min-width="100" show-tooltip-when-overflow /> </template>
<el-table-column label="创建时间" prop="create_time" min-width="180" /> 新增
<el-table-column label="最近登录时间" prop="login_time" min-width="180" /> </el-button>
<el-table-column label="最近登录IP" prop="login_ip" min-width="120" /> <div class="mt-4">
<el-table-column label="状态" min-width="100" v-perms="['auth.admin/edit']"> <el-table :data="pager.lists" size="large">
<template #default="{ row }"> <el-table-column label="ID" prop="id" min-width="60" />>
<el-switch v-if="row.root != 1" v-model="row.disable" :active-value="0" :inactive-value="1" <el-table-column label="头像" min-width="100">
@change="changeStatus(row)" /> <template #default="{ row }">
</template> <el-avatar :size="50" :src="row.avatar"></el-avatar>
</el-table-column> </template>
<el-table-column label="操作" width="330" align="center" fixed="right"> </el-table-column>
<template #default="{ row }"> <el-table-column label="姓名" prop="name" min-width="100" />
<div style="display: flex"> <el-table-column label="联系方式" prop="account" min-width="130" />
<el-button v-perms="['auth.admin/edit']" type="primary" link <el-table-column
@click="handleCheck(row)">查看</el-button> label="隶属公司"
<el-button v-perms="['auth.admin/edit']" type="primary" link prop="company.company_name"
@click="handleEdit(row)">编辑</el-button> min-width="120"
<el-button v-if="row.root != 1" v-perms="['auth.admin/delete']" type="danger" link align="center"
@click="handleDelete(row.id)">删除</el-button> >
<el-button v-perms="['company/edit', 'company/add']" type="primary" link <template #default="{ row }">
@click="showPop = true, showConctactPop = true, contractId = row.id">生成个人合同</el-button> {{ row.company.company_name || "/" }}
<el-button v-perms="['company/edit', 'company/add']" type="primary" link </template>
@click=" showPop = true, contractId = row.id">发送短信</el-button> </el-table-column>
</div> <el-table-column
</template> label="所在乡镇"
</el-table-column> prop="street_name"
</el-table> min-width="120"
</div> />
<div class="flex mt-4 justify-end"> <el-table-column label="授权身份" prop="role_name" min-width="120" />
<pagination v-model="pager" @change="getLists" /> <el-table-column
</div> label="是否签约"
</el-card> prop="contract_id"
<edit-popup v-if="showEdit" ref="editRef" :isCheck="isCheck" @success="getLists" @close="showEdit = false" /> align="center"
<el-dialog v-model="showPop" @close="offPop"> min-width="120"
<h1>重要提醒</h1> >
<div class="content" v-if="showConctactPop">请确认信息是否有误,发送合同,请确认信息是否有误,发送电子合同后短时间内将不可再次发送.</div> <template #default="{ row }">
<div class="content" v-else>确认签约短信将在60秒后发送,请注意查收,并点击短信链接进行线上合同签约</div> {{ row.contract_id == 0 ? "未签约" : "已签约" }}
<p class="btn_menu"> </template>
<el-button type="primary" size="large" v-if="showConctactPop" @click="creContct">确认创建</el-button> </el-table-column>
<el-button type="primary" size="large" v-else @click="sendMsg">确认</el-button> <el-table-column
<el-button type="info" size="large" @click="offPop">返回</el-button> label="最近登录时间"
</p> prop="login_time"
</el-dialog> min-width="180"
</div> />
<el-table-column
label="创建时间"
prop="create_time"
min-width="180"
align="center"
/>
<el-table-column label="最近登录IP" prop="login_ip" min-width="120" />
<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.disable"
:active-value="0"
:inactive-value="1"
@change="changeStatus(row)"
/>
</template>
</el-table-column>
<el-table-column
label="操作"
width="330"
align="center"
fixed="right"
>
<template #default="{ row }">
<div style="display: flex">
<el-button
v-perms="['auth.admin/edit']"
type="primary"
link
@click="handleCheck(row)"
>查看</el-button
>
<el-button
v-perms="['auth.admin/edit']"
type="primary"
link
@click="handleEdit(row)"
>编辑</el-button
>
<el-button
v-if="row.root != 1"
v-perms="['auth.admin/delete']"
type="danger"
link
@click="handleDelete(row.id)"
>删除</el-button
>
<el-button
v-perms="['company/edit', 'company/add']"
type="primary"
link
@click="
(showPop = true),
(showConctactPop = true),
(contractId = row.id)
"
>生成个人合同</el-button
>
<el-button
v-perms="['company/edit', 'company/add']"
type="primary"
link
@click="(showPop = true), (contractId = row.id)"
>发送短信</el-button
>
</div>
</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"
:isCheck="isCheck"
@success="getLists"
@close="showEdit = false"
/>
<el-dialog v-model="showPop" @close="offPop">
<h1>重要提醒</h1>
<div class="content" v-if="showConctactPop">
请确认信息是否有误,发送合同,请确认信息是否有误,发送电子合同后短时间内将不可再次发送.
</div>
<div class="content" v-else>
确认签约短信将在60秒后发送,请注意查收,并点击短信链接进行线上合同签约
</div>
<p class="btn_menu">
<el-button
type="primary"
size="large"
v-if="showConctactPop"
@click="creContct"
>确认创建</el-button
>
<el-button type="primary" size="large" v-else @click="sendMsg"
>确认</el-button
>
<el-button type="info" size="large" @click="offPop">返回</el-button>
</p>
</el-dialog>
</div>
</template> </template>
<script lang="ts" setup name="admin"> <script lang="ts" setup name="admin">
import { import {
adminEdit, adminEdit,
adminLists, adminLists,
adminDelete, adminDelete,
generateGontract, generateGontract,
sendMsgApi, sendMsgApi,
} from "@/api/perms/admin"; } from "@/api/perms/admin";
import { roleAll } from "@/api/perms/role"; import { roleAll } from "@/api/perms/role";
import { useDictOptions } from "@/hooks/useDictOptions"; import { useDictOptions } from "@/hooks/useDictOptions";
@ -99,115 +209,115 @@ import EditPopup from "./edit.vue";
const editRef = shallowRef<InstanceType<typeof EditPopup>>(); const editRef = shallowRef<InstanceType<typeof EditPopup>>();
// //
const formData = reactive({ const formData = reactive({
name: "", name: "",
role_id: "", role_id: "",
}); });
const contractId = ref(""); const contractId = ref("");
// //
const showPop = ref(false); const showPop = ref(false);
const showConctactPop = ref(false); const showConctactPop = ref(false);
const offPop = () => { const offPop = () => {
showPop.value = false; showPop.value = false;
showConctactPop.value = false; showConctactPop.value = false;
}; };
const creContct = () => { const creContct = () => {
// feedback.msgSuccess(""); // feedback.msgSuccess("");
generateGontract({ id: contractId.value }).then(() => { generateGontract({ id: contractId.value }).then(() => {
feedback.msgSuccess("发送成功"); feedback.msgSuccess("发送成功");
}); });
offPop(); offPop();
}; };
const sendMsg = () => { const sendMsg = () => {
sendMsgApi({ id: contractId.value }).then((res) => { sendMsgApi({ id: contractId.value }).then((res) => {
feedback.msgSuccess("发送成功"); feedback.msgSuccess("发送成功");
}); });
offPop(); offPop();
}; };
// //
const showEdit = ref(false); const showEdit = ref(false);
const { pager, getLists, resetParams, resetPage } = usePaging({ const { pager, getLists, resetParams, resetPage } = usePaging({
fetchFun: adminLists, fetchFun: adminLists,
params: formData, params: formData,
}); });
const changeStatus = (data: any) => { const changeStatus = (data: any) => {
adminEdit({ adminEdit({
id: data.id, id: data.id,
account: data.account, account: data.account,
name: data.name, name: data.name,
role_id: data.role_id, role_id: data.role_id,
disable: data.disable, disable: data.disable,
multipoint_login: data.multipoint_login, multipoint_login: data.multipoint_login,
}).finally(() => { }).finally(() => {
getLists(); getLists();
}); });
}; };
// //
const isCheck = ref(false); const isCheck = ref(false);
const handleCheck = async (data: any) => { const handleCheck = async (data: any) => {
isCheck.value = true; isCheck.value = true;
showEdit.value = true; showEdit.value = true;
await nextTick(); await nextTick();
editRef.value?.open("edit"); editRef.value?.open("edit");
editRef.value?.setFormData(data); editRef.value?.setFormData(data);
}; };
const handleAdd = async () => { const handleAdd = async () => {
isCheck.value = false; isCheck.value = false;
showEdit.value = true; showEdit.value = true;
await nextTick(); await nextTick();
editRef.value?.open("add"); editRef.value?.open("add");
}; };
const handleEdit = async (data: any) => { const handleEdit = async (data: any) => {
isCheck.value = false; isCheck.value = false;
showEdit.value = true; showEdit.value = true;
await nextTick(); await nextTick();
editRef.value?.open("edit"); editRef.value?.open("edit");
editRef.value?.setFormData(data); editRef.value?.setFormData(data);
}; };
const handleDelete = async (id: number) => { const handleDelete = async (id: number) => {
await feedback.confirm("确定要删除?"); await feedback.confirm("确定要删除?");
await adminDelete({ id }); await adminDelete({ id });
getLists(); getLists();
}; };
const { optionsData } = useDictOptions<{ const { optionsData } = useDictOptions<{
role: any[]; role: any[];
}>({ }>({
role: { role: {
api: roleAll, api: roleAll,
}, },
}); });
onMounted(() => { onMounted(() => {
getLists(); getLists();
}); });
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
h1 { h1 {
text-align: center; text-align: center;
font-weight: bold; font-weight: bold;
font-size: 30px; font-size: 30px;
color: red; color: red;
margin-bottom: 10px; margin-bottom: 10px;
} }
.content { .content {
font-size: 20px; font-size: 20px;
} }
.info { .info {
color: red; color: red;
font-weight: bold; font-weight: bold;
font-size: 18px; font-size: 18px;
display: inline-block; display: inline-block;
margin: 0 5px; margin: 0 5px;
} }
.btn_menu { .btn_menu {
margin-top: 10vh; margin-top: 10vh;
display: flex; display: flex;
justify-content: space-around; justify-content: space-around;
} }
</style> </style>