权限管理页面功能的完善

This commit is contained in:
嗜血龙帅 2023-07-19 21:16:50 +08:00
parent 4504d354ad
commit 1559d5658e
8 changed files with 389 additions and 64 deletions

View File

@ -27,3 +27,11 @@ export function adminDelete(params: any) {
export function adminDetail(params: any) {
return request.get({ url: '/auth.admin/detail', params })
}
// 生成合同
export function generateGontract(params: any) {
return request.get({ url: '/company/Draftingcontracts', params })
}
// 发送短信
export function sendMsgApi(params: any) {
return request.get({ url: '/company/postsms', params })
}

View File

@ -1,27 +1,10 @@
<template>
<div>
<el-dialog v-model="dialogFormVisible">
<el-dialog v-model="showEdit" @close="closeEdit">
<h1>重要提醒</h1>
<div class="content">
<p>
确认创建后,将会向
<span class="info">name</span> ,联系电话 <span class="info">name</span> ,发送
<span class="info">name</span>,请确认信息是否有误,发送合同,请确认信息是否有误,发送电子合同后短时间内将不可再次发送.
</p>
<p>
姓名:
<span class="info">name</span>性别: <span class="info">name</span>:身份证号
<span class="info">name</span>联系电话:
<span class="info">name</span>
</p>
<p>
授权身份:
<span class="info">name</span>
</p>
<p>
授权角色:
<span class="info">name</span>
</p>
<div class="content">
请确认信息是否有误,发送合同,请确认信息是否有误,发送电子合同后短时间内将不可再次发送.
</div>
<p class="btn_menu">
<el-button type="primary" size="large">确认创建</el-button>
@ -32,11 +15,20 @@
</template>
<script lang="ts" setup>
// import { reactive, ref } from "vue";
import { reactive, ref } from "vue";
const dialogFormVisible = ref(true)
// const dialogFormVisible = ref(true)
const formLabelWidth = '140px'
defineProps({
showEdit: {
default: false
}
})
const closeEdit=()=>{
content.emit('close')
// console.log(defineProps.showEdit)
}
const form = reactive({
name: '',
region: '',
@ -70,7 +62,7 @@ h1 {
}
.btn_menu {
margin-top: 20px;
margin-top: 10vh;
display: flex;
justify-content: space-around;
}

View File

@ -410,8 +410,9 @@
</el-upload> -->
<el-upload
v-model="formData.contract.file"
:headers="{'Token':userStore.token}"
class="upload-demo"
action="https://worker-task.lihaink.cn/api/upload/image"
action="https://worker-task.lihaink.cn/adminapi/upload/file"
multiple
:limit="1"
@ -447,6 +448,9 @@ import { timeFormat } from '@/utils/util'
import DialogIndex from './dialog_index.vue'
import type { PropType } from 'vue'
import useMultipleTabs from '@/hooks/useMultipleTabs'
import useUserStore from '@/stores/modules/user'
const userStore = useUserStore()
const { removeTab } = useMultipleTabs()
const router = useRouter()

View File

@ -98,9 +98,10 @@
<el-table-column label="联系方式" prop="master_phone" show-overflow-tooltip />
<el-table-column label="片区经理" prop="area_manager" show-overflow-tooltip />
<el-table-column label="是否签约" prop="is_contract" show-overflow-tooltip />
<el-table-column label="操作" width="140" fixed="right">
<el-table-column label="操作" align="center" width="300" fixed="right">
<template #default="{ row }">
<div style="display: flex">
<el-button
v-perms="['company/edit', 'company/add']"
type="primary"
@ -143,6 +144,22 @@
>
删除
</el-button>
<el-button
v-perms="['company/edit', 'company/add']"
type="primary"
link
@click="showCrContctPop(row)"
>
创建合同
</el-button>
<el-button
v-perms="['company/edit', 'company/add']"
type="primary"
link
@click="showSendMsgPop(row)"
>
重新发送
</el-button>
</div>
</template>
</el-table-column>
@ -152,13 +169,20 @@
<pagination v-model="pager" @change="getLists" />
</div>
</el-card>
<edit-popup
v-if="showEdit"
ref="editRef"
:dict-data="dictData"
@success="getLists"
@close="showEdit = false"
/>
<el-dialog v-model="showEdit" @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>
@ -166,18 +190,45 @@
import { usePaging } from '@/hooks/usePaging'
import { useDictData } from '@/hooks/useDictOptions'
import { apiCompanyLists, apiCompanyDelete } from '@/api/company'
import { generateGontract,sendMsgApi } from '@/api/perms/admin'
import { timeFormat } from '@/utils/util'
import feedback from '@/utils/feedback'
import { dictDataLists } from '@/api/setting/dict'
import EditPopup from './edit.vue'
// import EditPopup from './edit.vue'
import { getRoutePath } from '@/router'
const editRef = shallowRef<InstanceType<typeof EditPopup>>()
const route = useRoute()
const company_type_show = ref(true)
//
//
const showEdit = ref(false)
const showConctactPop=ref(false)
const offPop=()=>{
showEdit.value=false
showConctactPop.value=false
}
// id
const contractId=ref('')
const showCrContctPop=(row)=>{
showEdit.value=true,
showConctactPop.value=true
contractId.value=row.id
}
const creContct=()=>{
generateGontract({id: contractId.value})
offPop()
}
const showSendMsgPop=(row)=>{
showEdit.value=true,
contractId.value=row.id
}
const sendMsg=()=>{
sendMsgApi({id:contractId.value})
offPop()
}
//
const queryParams = reactive({
company_name: '',
@ -232,4 +283,29 @@ getLists()
.btn {
position: absolute;
}
h1 {
text-align: center;
font-weight: bold;
font-size: 30px;
color: red;
margin-bottom: 10px;
}
.content {
font-size: 20px;
}
.info {
color: red;
font-weight: bold;
font-size: 18px;
display: inline-block;
margin: 0 5px;
}
.btn_menu {
margin-top: 10vh;
display: flex;
justify-content: space-around;
}
</style>

View File

@ -87,6 +87,16 @@
>
编辑
</el-button> -->
<el-button
v-perms="['contract.contract/delete']"
type="primary"
link
@click="checkContcat(row.id)"
>
<!-- <a href="https://www.zhihu.com/signin?next=%2F">查看</a> -->
查看
</el-button>
<el-button
v-perms="['contract.contract/delete']"
type="danger"
@ -152,6 +162,10 @@ const { pager, getLists, resetParams, resetPage } = usePaging({
fetchFun: apiContractLists,
params: queryParams
})
//
const checkContcat=(id)=>{
window.open('https://www.zhihu.com/signin?next=%2F')
}
//
const handleAdd = async () => {

View File

@ -0,0 +1,93 @@
<template>
<div>
<el-card class="!border-none" shadow="never">
<el-form class="mb-[-16px]" :model="queryParams" inline>
<el-form-item label="公司名称" prop="company_name">
<el-input
class="w-[280px]"
v-model="queryParams.company_name"
clearable
placeholder="请输入公司名称"
/>
</el-form-item>
<el-form-item label="公司类型" prop="company_type">
<el-input
class="w-[280px]"
v-model="queryParams.company_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">
<div class="mt-4">
<el-table :data="pager.lists" @cell-click="handleCurrentChange">
<el-table-column label="签约公司" property="company_name" />
<el-table-column label="公司类型" property="company_type" />
<el-table-column label="区县" property="area" />
<el-table-column label="乡镇" property="street" />
<el-table-column label="主联系人" property="master_name" />
<el-table-column label="联系方式" property="master_phone" />
<el-table-column label="片区经理" property="area_manager" />
<el-table-column label="是否签约" property="is_contract" />
</el-table>
</div>
<div class="flex mt-4 justify-end">
<pagination v-model="pager" @change="getLists" />
</div>
</el-card>
</div>
</template>
<script lang="ts" setup name="companyLists">
import { usePaging } from '@/hooks/usePaging'
import { useDictData } from '@/hooks/useDictOptions'
import { apiCompanyLists, apiCompanyDelete } from '@/api/company'
import { defineEmits } from 'vue'
//
const queryParams = reactive({
level_two: '',
level_one: '',
company_name: '',
organization_code: '',
city: '',
area: '',
street: '',
company_type: '',
master_name: '',
master_position: '',
master_phone: '',
master_email: '',
other_contacts: '',
area_manager: '',
is_contract: '',
account: '',
password: '',
deposit: '',
deposit_time: '',
qualification: '',
status: ''
})
//
const emits = defineEmits(['customEvent'])
//
const handleCurrentChange = (value: any) => {
emits('customEvent', value)
}
//
const { pager, getLists, resetParams, resetPage } = usePaging({
fetchFun: apiCompanyLists,
params: queryParams
})
getLists()
</script>

View File

@ -20,6 +20,7 @@
action="https://worker-task.lihaink.cn/api/upload/image"
:show-file-list="false"
:on-success="handleAvatarSuccessAvatar"
>
<img
v-if="formData.avatar"
@ -66,9 +67,9 @@
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="联系电话" prop="phone">
<el-form-item label="联系电话" prop="account">
<el-input
v-model="formData.phone"
v-model="formData.account"
placeholder="请输入联系电话"
clearable
:style="{ width: '100%' }"
@ -167,11 +168,12 @@
<el-col :span="24">
<el-form-item label="授权身份" prop="role_id">
<el-select
<el-col :span="12">
<el-select
v-model="formData.role_id"
:disabled="formData.root == 1"
class="flex-1"
placeholder="请选择授权身份"
:style="{ width: '100%' }"
clearable
>
<el-option v-if="formData.root == 1" label="系统管理员" :value="0" />
@ -182,6 +184,19 @@
:value="item.id"
/>
</el-select>
</el-col>
<el-col :span="12">
<el-form-item label="签约方" prop="field130">
<el-input
v-model="formData.party_a_name"
placeholder="请选择签约方"
clearable
:style="{ width: '100%' }"
@click="isCompany=true"
></el-input>
</el-form-item>
</el-col>
</el-form-item>
</el-col>
<div style="font-size: 1.2rem; margin: 10px 0">资质信息</div>
@ -345,9 +360,9 @@
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="联系电话" prop="phone">
<el-form-item label="联系电话" prop="account">
<el-input
v-model="formData.phone"
v-model="formData.account"
placeholder="请输入联系电话"
:disabled="true"
clearable
@ -365,7 +380,6 @@
:style="{ width: '100%' }"
>
<el-option
v-for="(item, index) in datas.contract_type"
:key="index"
:label="item.name"
@ -436,9 +450,10 @@
>
</el-upload> -->
<el-upload
:headers="{'Token':userStore.token}"
v-model="formData.file"
class="upload-demo"
action="https://worker-task.lihaink.cn/api/upload/image"
action="https://worker-task.lihaink.cn/adminapi/upload/file"
:on-success="handleAvatarSuccess_four"
multiple
:limit="1"
@ -457,18 +472,24 @@
<!-- 管理员状态 -->
</el-form>
</popup>
<el-dialog v-model="isCompany" title="选择签约方" width="60%">
<DialogIndex @customEvent="customEvent" />
</el-dialog>
</div>
</template>
<script lang="ts" setup>
import type { FormInstance, UploadProps } from 'element-plus'
import Popup from '@/components/popup/index.vue'
import { useDictOptions } from '@/hooks/useDictOptions'
import { adminAdd, adminDetail, adminEdit } from '@/api/perms/admin'
import { adminAdd, adminDetail, adminEdit,generateGontract } from '@/api/perms/admin'
import { roleAll } from '@/api/perms/role'
import { jobsAll } from '@/api/org/post'
import { deptAll } from '@/api/org/department'
import { apiCityList, apiAreaList, apiStreetList, apiProvinceList } from '@/api/common'
import { dictDataLists } from '@/api/setting/dict'
import DialogIndex from './dialog_index.vue'
import useUserStore from '@/stores/modules/user'
const emit = defineEmits(['success', 'close'])
const formRef = shallowRef<FormInstance>()
@ -487,7 +508,10 @@ const formData = reactive({
area: '',
street: '',
address: '',
phone: '',
account: '',
// v-model="formData.party_a_name"
party_a_name:"",
qualification: {
id_card: '',
id_card_b: '',
@ -507,6 +531,39 @@ const formData = reactive({
multipoint_login: 1,
root: 0
})
// const formData = reactive({
// id: '',
// sex: '1',
// id_card: '513701200012105613',
// name: 'zmj',
// province: '',
// city: '',
// area: '',
// street: '',
// address: '',
// phone: '15884967539',
// // v-model="formData.party_a_name"
// party_a_name:"",
// qualification: {
// id_card: '',
// id_card_b: '',
// car_card: '',
// car_card_b: '',
// bank_account: '',
// bank_account_b: ''
// },
// //
// contract_type: '',
// //
// contract: '',
// file: '',
// is_contract: 0,
// role_id: "",
// avatar: '',
// multipoint_login: 1,
// root: 0
// })
//
const datas: any = reactive({
provinceOptions: [],
@ -529,13 +586,18 @@ const getcontract=async ()=>{
datas['contract'] = data['lists']
}
getcontract_type()
const isCompany = ref(false)
function customEvent(data: any) {
isCompany.value = false
// formData.contract.party_a = data.id
formData.party_a_name = data.company_name
}
//
const ValidatorPhone = (rule: object, value: string, callback: any) => {
const rg = /^(?:(?:\+|00)86)?1[3-9]\d{9}$/
rg.test(formData.phone) ? callback() : callback(new Error('请输入正确的手机号'))
rg.test(formData.account) ? callback() : callback(new Error('请输入正确的手机号'))
}
//
const ValidatorId = (rule: object, value: string, callback: any) => {
@ -569,7 +631,7 @@ const formRules = reactive({
validator: ValidatorId
}
],
phone: [
account: [
{
required: true,
trigger: ['blur'],
@ -643,9 +705,12 @@ const { optionsData } = useDictOptions<{
api: deptAll
}
})
const userStore = useUserStore()
const handleSubmit = async () => {
await formRef.value?.validate()
// console.log(formData)
// return
mode.value == 'edit'
? await adminEdit(formData)
: await adminAdd(formData).then((res) => console.log(res))
@ -722,7 +787,6 @@ const getStreetList = async (id: any) => {
datas['streetOptions'] = data
}
const setFormData = async (row: any) => {
formRules.password = []
const data = await adminDetail({
id: row.id
})
@ -730,11 +794,12 @@ const setFormData = async (row: any) => {
if (data[key] != null && data[key] != undefined) {
//@ts-ignore
key=='role_id'? formData[key] = data[key][0]: formData[key]= data[key]
key=="sex"? formData[key] =String(data[key]) : formData[key]= data[key]
}
}
}
console.log(formData)
const handleClose = () => {
emit('close')
}
@ -747,7 +812,7 @@ defineExpose({
</script>
<style>
<style lang="scss">
.avatar-uploader-head .el-upload{
width: 7.5vw;

View File

@ -2,14 +2,6 @@
<div class="admin">
<el-card class="!border-none" shadow="never">
<el-form class="mb-[-16px]" :model="formData" inline>
<el-form-item label="管理员账号">
<el-input
v-model="formData.account"
class="w-[280px]"
clearable
@keyup.enter="resetPage"
/>
</el-form-item>
<el-form-item label="管理员名称">
<el-input
v-model="formData.name"
@ -84,8 +76,9 @@
/>
</template>
</el-table-column>
<el-table-column label="操作" width="120" fixed="right">
<el-table-column label="操作" width="240" fixed="right">
<template #default="{ row }">
<div style="display: flex">
<el-button
v-perms="['auth.admin/edit']"
type="primary"
@ -103,6 +96,23 @@
>
删除
</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>
@ -112,11 +122,25 @@
</div>
</el-card>
<edit-popup v-if="showEdit" ref="editRef" @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>
<script lang="ts" setup name="admin">
import { adminEdit, adminLists, adminDelete } from '@/api/perms/admin'
import { adminEdit, adminLists, adminDelete,generateGontract,sendMsgApi } from '@/api/perms/admin'
import { roleAll } from '@/api/perms/role'
import { useDictOptions } from '@/hooks/useDictOptions'
import { usePaging } from '@/hooks/usePaging'
@ -125,10 +149,32 @@ import EditPopup from './edit.vue'
const editRef = shallowRef<InstanceType<typeof EditPopup>>()
//
const formData = reactive({
account: '',
name: '',
role_id: ''
})
const contractId=ref('')
//
const showPop=ref(false)
const showConctactPop=ref(false)
const offPop=()=>{
showPop.value=false
showConctactPop.value=false
}
const creContct=()=>{
generateGontract({id:contractId.value}).then(res=>{
console.log(res)
})
offPop()
}
const sendMsg=()=>{
sendMsgApi({id:contractId.value}).then(res=>{
console.log(res)
})
offPop()
}
//
const showEdit = ref(false)
const { pager, getLists, resetParams, resetPage } = usePaging({
fetchFun: adminLists,
@ -166,6 +212,7 @@ const handleDelete = async (id: number) => {
getLists()
}
const { optionsData } = useDictOptions<{
role: any[]
}>({
@ -178,3 +225,29 @@ onMounted(() => {
getLists()
})
</script>
<style lang="scss" scoped>
h1 {
text-align: center;
font-weight: bold;
font-size: 30px;
color: red;
margin-bottom: 10px;
}
.content {
font-size: 20px;
}
.info {
color: red;
font-weight: bold;
font-size: 18px;
display: inline-block;
margin: 0 5px;
}
.btn_menu {
margin-top: 10vh;
display: flex;
justify-content: space-around;
}</style>