This commit is contained in:
weipengfei 2023-08-15 17:10:07 +08:00
parent 0786519038
commit 31e6dea192
5 changed files with 440 additions and 393 deletions

View File

@ -2,7 +2,7 @@ import type { App } from 'vue'
import 'highlight.js/styles/github.css' import 'highlight.js/styles/github.css'
import hljs from 'highlight.js/lib/common' import hljs from 'highlight.js/lib/common'
import hljsVuePlugin from '@highlightjs/vue-plugin' import hljsVuePlugin from '@highlightjs/vue-plugin'
console.log(hljs) // console.log(hljs)
export default (app: App<Element>) => { export default (app: App<Element>) => {
app.use(hljsVuePlugin) app.use(hljsVuePlugin)
} }

View File

@ -1,124 +1,143 @@
<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 <el-input
v-model="formData.name" v-model="formData.name"
class="w-[280px]" class="w-[280px]"
clearable clearable
@keyup.enter="resetPage" @keyup.enter="resetPage"
/> />
</el-form-item> </el-form-item>
<el-form-item label="管理员角色"> <el-form-item label="管理员角色">
<el-select class="w-[280px]" v-model="formData.role_id"> <el-select class="w-[280px]" v-model="formData.role_id">
<el-option label="全部" value /> <el-option label="全部" value />
<el-option <el-option
v-for="(item, index) in optionsData.role" v-for="(item, index) in optionsData.role"
:key="index" :key="index"
:label="item.name" :label="item.name"
:value="item.id" :value="item.id"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" @click="resetPage">查询</el-button> <el-button type="primary" @click="resetPage">查询</el-button>
<el-button @click="resetParams">重置</el-button> <el-button @click="resetParams">重置</el-button>
<export-data <export-data
class="ml-2.5" class="ml-2.5"
:fetch-fun="adminLists" :fetch-fun="adminLists"
:params="formData" :params="formData"
:page-size="pager.size" :page-size="pager.size"
/> />
</el-form-item> </el-form-item>
</el-form> </el-form>
</el-card> </el-card>
<el-card v-loading="pager.loading" class="mt-4 !border-none" shadow="never"> <el-card v-loading="pager.loading" class="mt-4 !border-none" shadow="never">
<el-button v-perms="['auth.admin/add']" type="primary" @click="handleAdd"> <el-button v-perms="['auth.admin/add']" type="primary" @click="handleAdd">
<template #icon> <template #icon>
<icon name="el-icon-Plus" /> <icon name="el-icon-Plus" />
</template> </template>
新增 新增
</el-button> </el-button>
<div class="mt-4"> <div class="mt-4">
<el-table :data="pager.lists" size="large"> <el-table :data="pager.lists" size="large">
<el-table-column label="ID" prop="id" min-width="60" />> <el-table-column label="ID" prop="id" min-width="60" />>
<el-table-column label="头像" min-width="100"> <el-table-column label="头像" min-width="100">
<template #default="{ row }"> <template #default="{ row }">
<el-avatar :size="50" :src="row.avatar"></el-avatar> <el-avatar :size="50" :src="row.avatar"></el-avatar>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="姓名" prop="name" min-width="100" /> <el-table-column label="姓名" prop="name" min-width="100" />
<el-table-column label="联系方式" prop="account" min-width="130" /> <el-table-column label="联系方式" prop="account" min-width="130" />
<el-table-column <el-table-column
label="隶属公司" label="隶属公司"
prop="company.company_name" prop="company.company_name"
min-width="120" min-width="120"
align="center" align="center"
> >
<template #default="{ row }"> <template #default="{ row }">
{{ row.company.company_name || '/' }} {{ row.company.company_name || "/" }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="所在乡镇" prop="street_name" min-width="120" /> <el-table-column
<el-table-column label="授权身份" prop="role_name" min-width="120" /> label="所在乡镇"
<el-table-column prop="street_name"
label="是否签约" min-width="120"
prop="is_contract" />
align="center" <el-table-column label="授权身份" prop="role_name" min-width="120" />
min-width="120" <el-table-column
> label="是否签约"
<template #default="{ row }"> prop="is_contract"
<span v-if="row.is_contract == 1" style="color: #67c23a">已签约</span> align="center"
<span v-else style="color: #fe0000">未签约</span> min-width="120"
</template> >
</el-table-column> <template #default="{ row }">
<el-table-column label="最近登录时间" prop="login_time" min-width="180" /> <span v-if="row.is_contract == 1" style="color: #67c23a"
<el-table-column >已签约</span
label="创建时间" >
prop="create_time" <span v-else style="color: #fe0000">未签约</span>
min-width="180" </template>
align="center" </el-table-column>
/> <el-table-column
<el-table-column label="最近登录IP" prop="login_ip" min-width="120" /> label="最近登录时间"
<el-table-column label="账号状态" min-width="100" v-perms="['auth.admin/edit']"> prop="login_time"
<template #default="{ row }"> min-width="180"
<el-switch />
v-if="row.root != 1" <el-table-column
v-model="row.disable" label="创建时间"
:active-value="0" prop="create_time"
:inactive-value="1" min-width="180"
@change="changeStatus(row)" align="center"
/> />
</template> <el-table-column label="最近登录IP" prop="login_ip" min-width="120" />
</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.disable"
:active-value="0"
:inactive-value="1"
@change="changeStatus(row)"
/>
</template>
</el-table-column>
<el-table-column label="操作" width="230" align="center" fixed="right"> <el-table-column
<template #default="{ row }"> label="操作"
<div style="display: flex"> width="230"
<el-button align="center"
v-perms="['auth.admin/view']" fixed="right"
type="primary" >
link <template #default="{ row }">
@click="handleView(row)" <div style="display: flex">
>查看</el-button <el-button
> v-perms="['auth.admin/view']"
<el-button type="primary"
v-perms="['auth.admin/edit']" link
type="primary" @click="handleView(row)"
link >查看</el-button
@click="handleEdit(row)" >
>编辑</el-button <el-button
> v-perms="['auth.admin/edit']"
<el-button type="primary"
v-if="row.root != 1" link
v-perms="['auth.admin/delete']" @click="handleEdit(row)"
type="danger" >编辑</el-button
link >
@click="handleDelete(row.id)" <el-button
>删除</el-button v-if="row.root != 1"
> v-perms="['auth.admin/delete']"
<!-- <el-button type="danger"
link
@click="handleDelete(row.id)"
>删除</el-button
>
<!-- <el-button
v-if="row.is_contract == 1" v-if="row.is_contract == 1"
v-perms="['auth.admin/abolition']" v-perms="['auth.admin/abolition']"
type="danger" type="danger"
@ -126,7 +145,7 @@
@click="handleAbolition(row.id)" @click="handleAbolition(row.id)"
>废除合同</el-button >废除合同</el-button
> --> > -->
<!-- <template v-if="row.company_id != 0 && row.is_contract == 0"> <!-- <template v-if="row.company_id != 0 && row.is_contract == 0">
<el-button <el-button
v-perms="['auth.admin/Draftingcontracts']" v-perms="['auth.admin/Draftingcontracts']"
type="primary" type="primary"
@ -146,182 +165,188 @@
>重新短信</el-button >重新短信</el-button
> >
</template> --> </template> -->
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
</div> </div>
<div class="flex mt-4 justify-end"> <div class="flex mt-4 justify-end">
<pagination v-model="pager" @change="getLists" /> <pagination v-model="pager" @change="getLists" />
</div> </div>
</el-card> </el-card>
<edit-popup <edit-popup
v-if="showEdit" v-if="showEdit"
ref="editRef" ref="editRef"
:isCheck="isCheck" :isCheck="isCheck"
@success="getLists" @success="getLists"
@close="showEdit = false" @close="showEdit = false"
/> />
<el-dialog v-model="showPop" @close="offPop"> <el-dialog v-model="showPop" @close="offPop">
<h1>重要提醒</h1> <h1>重要提醒</h1>
<div class="content" v-if="showConctactPop"> <div class="content" v-if="showConctactPop">
请确认信息是否有误,发送合同,请确认信息是否有误,发送电子合同后短时间内将不可再次发送. 请确认信息是否有误,发送合同,请确认信息是否有误,发送电子合同后短时间内将不可再次发送.
</div> </div>
<div class="content" v-else> <div class="content" v-else>
确认签约短信将在60秒后发送,请注意查收,并点击短信链接进行线上合同签约 确认签约短信将在60秒后发送,请注意查收,并点击短信链接进行线上合同签约
</div> </div>
<p class="btn_menu"> <p class="btn_menu">
<el-button type="primary" size="large" v-if="showConctactPop" @click="creContct" <el-button
>确认创建</el-button type="primary"
> size="large"
<el-button type="primary" size="large" v-else @click="sendMsg">确认</el-button> v-if="showConctactPop"
<el-button type="info" size="large" @click="offPop">返回</el-button> @click="creContct"
</p> >确认创建</el-button
</el-dialog> >
</div> <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,
abolition abolition,
} 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";
import { usePaging } from '@/hooks/usePaging' import { usePaging } from "@/hooks/usePaging";
import feedback from '@/utils/feedback' import feedback from "@/utils/feedback";
import EditPopup from './edit.vue' import EditPopup from "./edit.vue";
const route = useRoute() const route = useRoute();
const editRef = shallowRef<InstanceType<typeof EditPopup>>() const editRef = shallowRef<InstanceType<typeof EditPopup>>();
// //
const formData = reactive({ const formData = reactive({
name: '', name: "",
role_id: '', role_id: "",
company_id: '' company_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 handleView = async (data: any) => { const handleView = async (data: any) => {
isCheck.value = false isCheck.value = false;
showEdit.value = true showEdit.value = true;
await nextTick() await nextTick();
editRef.value?.open('view') editRef.value?.open("view");
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 handleAbolition = async (id: number) => { const handleAbolition = async (id: number) => {
await feedback.confirm('确定要废除合同?') await feedback.confirm("确定要废除合同?");
await abolition({ id }) await abolition({ id });
getLists() getLists();
} };
const { optionsData } = useDictOptions<{ const { optionsData } = useDictOptions<{
role: any[] role: any[];
}>({ }>({
role: { role: {
api: roleAll api: roleAll,
} },
}) });
if (route.query.company_id) { if (route.query.company_id) {
formData.company_id = route.query.company_id?.toString() formData.company_id = route.query.company_id?.toString();
} }
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>

View File

@ -3,7 +3,7 @@
<el-card class="!border-none" v-loading="loading" shadow="never"> <el-card class="!border-none" v-loading="loading" shadow="never">
<div style="display: flex; justify-content: space-between"> <div style="display: flex; justify-content: space-between">
<el-button <el-button
v-perms="['flow_type/add']" v-perms="['task.taskCalendar/add']"
type="primary" type="primary"
@click="handleAdd" @click="handleAdd"
> >

View File

@ -1,41 +1,48 @@
<template> <template>
<div> <div>
<el-card class="!border-none mb-4" shadow="never"> <el-card class="!border-none mb-4" shadow="never">
<el-form class="mb-[-16px] formtabel" :model="queryParams" inline label-width="100px"> <el-form
<el-form-item label="区域经理" prop="create_user_id"> class="mb-[-16px] formtabel"
<el-input :model="queryParams"
class="w-[280px]" inline
v-model="queryParams.create_user_id" label-width="100px"
clearable >
placeholder="请输入区域经理" <el-form-item label="区域经理" prop="create_user_id">
/> <el-input
</el-form-item> class="w-[280px]"
<el-form-item label="公司" prop="company_id"> v-model="queryParams.create_user_id"
<el-input clearable
class="w-[280px]" placeholder="请输入区域经理"
v-model="queryParams.company_id" />
clearable </el-form-item>
placeholder="请输入公司" <el-form-item label="公司" prop="company_id">
/> <el-input
</el-form-item> class="w-[280px]"
<el-form-item> v-model="queryParams.company_id"
<el-button class="el-btn" type="primary" @click="resetPage">查询</el-button> clearable
<el-button @click="resetParams">重置</el-button> placeholder="请输入公司"
</el-form-item> />
</el-form> </el-form-item>
</el-card> <el-form-item>
<el-card class="!border-none" v-loading="pager.loading" shadow="never"> <el-button class="el-btn" type="primary" @click="resetPage"
<el-button >查询</el-button
v-perms="['task_scheduling.task_scheduling/add']" >
type="primary" <el-button @click="resetParams">重置</el-button>
@click="handleAdd" </el-form-item>
> </el-form>
<template #icon> </el-card>
<icon name="el-icon-Plus" /> <el-card class="!border-none" v-loading="pager.loading" shadow="never">
</template> <el-button
新增 v-perms="['task_scheduling.task_scheduling/add']"
</el-button> type="primary"
<!-- @click="handleAdd"
>
<template #icon>
<icon name="el-icon-Plus" />
</template>
新增
</el-button>
<!--
<el-button <el-button
v-perms="['task_scheduling.task_scheduling/delete']" v-perms="['task_scheduling.task_scheduling/delete']"
:disabled="!selectData.length" :disabled="!selectData.length"
@ -43,131 +50,142 @@
> >
删除 删除
</el-button> --> </el-button> -->
<div class="mt-4"> <div class="mt-4">
<el-table :data="pager.lists" @selection-change="handleSelectionChange"> <el-table :data="pager.lists" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" /> <el-table-column type="selection" width="55" />
<el-table-column label="区域经理" prop="admin_name" show-overflow-tooltip /> <el-table-column
<el-table-column label="公司" prop="company_name" show-overflow-tooltip /> label="区域经理"
<el-table-column prop="admin_name"
label="公司类型" show-overflow-tooltip
prop="company_type_name" />
show-overflow-tooltip <el-table-column
/> label="公司"
<el-table-column prop="company_name"
label="状态" show-overflow-tooltip
min-width="100" />
v-perms="['task_scheduling.task_scheduling/edit']" <el-table-column
> label="公司类型"
<template #default="{ row }"> prop="company_type_name"
<el-switch show-overflow-tooltip
v-model="row.status" />
:active-value="1" <el-table-column
:inactive-value="0" label="状态"
@change="changeStatus(row)" min-width="100"
/> v-perms="['task_scheduling.task_scheduling/edit']"
</template> >
</el-table-column> <template #default="{ row }">
<el-switch
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"> <el-table-column label="操作" width="120" fixed="right">
<template #default="{ row }"> <template #default="{ row }">
<el-button v-perms="['task.calendar']" type="primary" link> <el-button v-perms="['task.task_calendar']" type="primary" link>
<router-link <router-link
:to="{ :to="{
path: getRoutePath('task.calendar'), path: getRoutePath('task.task_calendar'),
query: { query: {
id: row.id id: row.id,
} },
}" }"
>任务日程</router-link >任务日程</router-link
> >
</el-button> </el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
</div> </div>
<div class="flex mt-4 justify-end"> <div class="flex mt-4 justify-end">
<pagination v-model="pager" @change="getLists" /> <pagination v-model="pager" @change="getLists" />
</div> </div>
</el-card> </el-card>
<edit-popup <edit-popup
v-if="showEdit" v-if="showEdit"
ref="editRef" ref="editRef"
:dict-data="dictData" :dict-data="dictData"
@success="getLists" @success="getLists"
@close="showEdit = false" @close="showEdit = false"
/> />
</div> </div>
</template> </template>
<script lang="ts" setup name="taskSchedulingLists"> <script lang="ts" setup name="taskSchedulingLists">
import { usePaging } from '@/hooks/usePaging' import { usePaging } from "@/hooks/usePaging";
import { useDictData } from '@/hooks/useDictOptions' import { useDictData } from "@/hooks/useDictOptions";
import { apiTaskSchedulingLists, apiTaskSchedulingEdit } from '@/api/task_scheduling' import {
import { timeFormat } from '@/utils/util' apiTaskSchedulingLists,
import feedback from '@/utils/feedback' apiTaskSchedulingEdit,
import EditPopup from './edit.vue' } from "@/api/task_scheduling";
import { dictDataLists } from '@/api/setting/dict' import { timeFormat } from "@/utils/util";
import { getRoutePath } from '@/router' import feedback from "@/utils/feedback";
import EditPopup from "./edit.vue";
import { dictDataLists } from "@/api/setting/dict";
import { getRoutePath } from "@/router";
const datalist = ref([]) const datalist = ref([]);
const editRef = shallowRef<InstanceType<typeof EditPopup>>() const editRef = shallowRef<InstanceType<typeof EditPopup>>();
// //
const showEdit = ref(false) const showEdit = ref(false);
// //
const queryParams = reactive({ const queryParams = reactive({
create_user_id: '', create_user_id: "",
template_id: '', template_id: "",
company_id: '', company_id: "",
type: '', type: "",
status: '' status: "",
}) });
// //
const selectData = ref<any[]>([]) const selectData = ref<any[]>([]);
// //
const handleSelectionChange = (val: any[]) => { const handleSelectionChange = (val: any[]) => {
selectData.value = val.map(({ id }) => id) selectData.value = val.map(({ id }) => id);
} };
// //
const { dictData } = useDictData('') const { dictData } = useDictData("");
// //
const { pager, getLists, resetParams, resetPage } = usePaging({ const { pager, getLists, resetParams, resetPage } = usePaging({
fetchFun: apiTaskSchedulingLists, fetchFun: apiTaskSchedulingLists,
params: queryParams params: queryParams,
}) });
// //
const handleAdd = async () => { const handleAdd = async () => {
showEdit.value = true showEdit.value = true;
await nextTick() await nextTick();
editRef.value?.open('add') editRef.value?.open("add");
} };
const changeStatus = (data: any) => { const changeStatus = (data: any) => {
apiTaskSchedulingEdit({ apiTaskSchedulingEdit({
id: data.id, id: data.id,
status: data.status status: data.status,
}).finally(() => { }).finally(() => {
getLists() getLists();
}) });
} };
dictDataLists({ type_id: 10 }).then((res) => { dictDataLists({ type_id: 10 }).then((res) => {
datalist.value = res.lists datalist.value = res.lists;
}) });
getLists() getLists();
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.formtabel { .formtabel {
.el-form-item { .el-form-item {
width: 20%; width: 20%;
.el-btn { .el-btn {
margin-left: 100px; margin-left: 100px;
}
} }
}
} }
</style> </style>

View File

@ -100,7 +100,11 @@
fixed="right" fixed="right"
> >
<template #default="{ row }"> <template #default="{ row }">
<el-button v-perms="['flow/edit']" type="primary" link> <el-button
v-perms="['user_informationg.user_informationg/details']"
type="primary"
link
>
<router-link <router-link
:to="{ :to="{
path: 'user_informationg/details', path: 'user_informationg/details',