新增菜单

main
zsk 2 years ago
parent 5058d7d35c
commit a95463ee00

@ -4,7 +4,7 @@
--> -->
<div class="p-layout-aside g_flex_column_between" :class="state.collapsed ? 'g_w_80' : 'g_w_199'"> <div class="p-layout-aside g_flex_column_between" :class="state.collapsed ? 'g_w_80' : 'g_w_199'">
<!-- 顶部logo --> <!-- 顶部logo -->
<div class="m-logo g_flex_c g_cursor_point g_flex_none" @click="goHome"> <div class="m-logo g_flex_row_start_c g_cursor_point g_flex_none g_pl_24" @click="goHome">
<div class="logo-box g_mr_2"> <div class="logo-box g_mr_2">
<img src="../assets/image/logo.svg" alt class="img" /> <img src="../assets/image/logo.svg" alt class="img" />
</div> </div>

@ -30,6 +30,30 @@ const router = createRouter({
title: '用户列表', title: '用户列表',
}, },
component: () => import("../views/homePage/index.vue") component: () => import("../views/homePage/index.vue")
},
{
path: "/merchantManagement/projectData",
name: "projectData",
meta: {
title: '项目数据',
},
component: () => import("../views/homePage/projectData.vue")
},
{
path: "/merchantManagement/personData",
name: "personData",
meta: {
title: '个人数据',
},
component: () => import("../views/homePage/personData.vue")
},
{
path: "/merchantManagement/message",
name: "message",
meta: {
title: '消息通知',
},
component: () => import("../views/homePage/message.vue")
} }
] ]
}, },

@ -29,87 +29,87 @@ export let mockMenuList = {
"childrenList": [] "childrenList": []
}, },
// { {
// "id": 1, "id": 1,
// "creator": "", "creator": "",
// "updator": "", "updator": "",
// "createTime": "", "createTime": "",
// "updateTime": "", "updateTime": "",
// "deleted": 0, "deleted": 0,
// "title": "项目数据(股)", "title": "项目数据",
// "menuName": "HomePage", "menuName": "HomePage",
// "parentName": "", "parentName": "",
// "path": "homePage", "path": "projectData",
// "component": "/merchantManagement/homePage.vue", "component": "/merchantManagement/projectData.vue",
// "visible": 0, "visible": 0,
// "perms": "", "perms": "",
// "icon": "icon-houtaishouye", "icon": "icon-houtaishouye",
// "remark": "", "remark": "",
// "parentId": "", "parentId": "",
// "tagNames": "queryTag,addTag,updateTag,deleteTag", "tagNames": "queryTag,addTag,updateTag,deleteTag",
// "idx": 10, "idx": 10,
// "queryTag": 0, "queryTag": 0,
// "addTag": 0, "addTag": 0,
// "deleteTag": 0, "deleteTag": 0,
// "updateTag": 0, "updateTag": 0,
// "importTag": 0, "importTag": 0,
// "exportTag": 0, "exportTag": 0,
// "childrenList": [] "childrenList": []
// }, },
// { {
// "id": 1, "id": 1,
// "creator": "", "creator": "",
// "updator": "", "updator": "",
// "createTime": "", "createTime": "",
// "updateTime": "", "updateTime": "",
// "deleted": 0, "deleted": 0,
// "title": "个人数据(股)", "title": "个人数据(股)",
// "menuName": "HomePage", "menuName": "HomePage",
// "parentName": "", "parentName": "",
// "path": "homePage", "path": "personData",
// "component": "/merchantManagement/homePage.vue", "component": "/merchantManagement/personData.vue",
// "visible": 0, "visible": 0,
// "perms": "", "perms": "",
// "icon": "icon-houtaishouye", "icon": "icon-houtaishouye",
// "remark": "", "remark": "",
// "parentId": "", "parentId": "",
// "tagNames": "queryTag,addTag,updateTag,deleteTag", "tagNames": "queryTag,addTag,updateTag,deleteTag",
// "idx": 10, "idx": 10,
// "queryTag": 0, "queryTag": 0,
// "addTag": 0, "addTag": 0,
// "deleteTag": 0, "deleteTag": 0,
// "updateTag": 0, "updateTag": 0,
// "importTag": 0, "importTag": 0,
// "exportTag": 0, "exportTag": 0,
// "childrenList": [] "childrenList": []
// }, },
// { {
// "id": 1, "id": 1,
// "creator": "", "creator": "",
// "updator": "", "updator": "",
// "createTime": "", "createTime": "",
// "updateTime": "", "updateTime": "",
// "deleted": 0, "deleted": 0,
// "title": "个人数据(债)", "title": "消息通知",
// "menuName": "HomePage", "menuName": "HomePage",
// "parentName": "", "parentName": "",
// "path": "homePage", "path": "message",
// "component": "/merchantManagement/homePage.vue", "component": "/merchantManagement/message.vue",
// "visible": 0, "visible": 0,
// "perms": "", "perms": "",
// "icon": "icon-houtaishouye", "icon": "icon-houtaishouye",
// "remark": "", "remark": "",
// "parentId": "", "parentId": "",
// "tagNames": "queryTag,addTag,updateTag,deleteTag", "tagNames": "queryTag,addTag,updateTag,deleteTag",
// "idx": 10, "idx": 10,
// "queryTag": 0, "queryTag": 0,
// "addTag": 0, "addTag": 0,
// "deleteTag": 0, "deleteTag": 0,
// "updateTag": 0, "updateTag": 0,
// "importTag": 0, "importTag": 0,
// "exportTag": 0, "exportTag": 0,
// "childrenList": [] "childrenList": []
// } }
], ],
"roleMenus": [{ "roleMenus": [{

@ -449,6 +449,10 @@ const handleModalSize = ($page, $size) => {
</script> </script>
<style lang="less"> <style lang="less">
.ant-table-cell:empty::before{
content: "-";
}
.p-manage-myJob { .p-manage-myJob {
position: relative; position: relative;
min-height: calc(100vh - 213px); min-height: calc(100vh - 213px);

@ -0,0 +1,477 @@
<template>
<!--我的职位-->
<div class="p-manage-myJob">
<div class="m-select g_flex_row_between g_pt_16">
<div class="g_flex_row_start">
<div class="g_w_320 g-search-btn g_mr_16">
<a-input-search v-model:value="tableData.keyword" placeholder="请输入姓名/手机号" @search="searchList" @change="handleChangeSearch" allowClear />
</div>
</div>
<div>
<a-button type="primary" @click="openAdd" :icon="h(PlusOutlined)">新增用户</a-button>
<!-- <a-button type="" class="g_border_d g_ml_16" @click="handleToForm('add', { id: 0 })" :icon="h(DownloadOutlined)">导出模版</a-button> -->
<!--
<a-dropdown :trigger="['click']">
<template #overlay>
<a-menu>
<a-menu-item key="1" @click="goShareList"></a-menu-item>
<a-menu-item key="2" @click="handleToForm('add',{id:0})"></a-menu-item>
</a-menu>
</template>
<a-button>
新增职位
<DownOutlined style="zoom:.8" />
</a-button>
</a-dropdown> -->
</div>
</div>
<div class="m-table g_mt_20 antd-table">
<a-table sticky :columns="columns" :data-source="tableData.records" size="middle" :pagination="false" :loading="tableData.loading" class="g_clear_scroll" style="max-width: calc(100% - 0px)">
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'job'">
<!-- @click="goDetail(record)" -->
<div class="btn g_fs_14 g_cursor_point g_mr_13 g_flex_row_start">
<div class="g_ell_1">{{ "" }}</div>
</div>
</template>
<template v-if="column.key === 'age'">
<div class="g_ell_1">{{ record.sex + " " + record.age }}</div>
</template>
<template v-if="column.key === 'price'">
<!-- <div v-html="record.price"></div> -->
</template>
<template v-if="column.key === 'status'">
<a-switch @change="(e) => handleStatus(e, record)" :checked="record.status == 1 ? true : false" checked-children="" un-checked-children="" />
</template>
<template v-if="column.key === 'state'">
<div class="g_flex_row_between">
<!-- <div
class="btn g_fs_14 g_mr_13"
:class="'g_c_main g_cursor_point'"
:style="{
cursor: !record.statusBool ? 'not-allowed' : '',
color: !record.statusBool ? '#d8d8d8' : '#1677ff',
}"
@click="handleApplication(record)"
>
报名
</div> -->
<div class="btn g_c_main g_fs_14 g_cursor_point g_mr_13" @click="handleToForm('edit', record)">编辑</div>
<div class="btn g_c_main g_fs_14 g_cursor_point" @click="handleDel(record)"></div>
</div>
</template>
</template>
<!-- <template #summary class="fixed-obj">
<div style="width: 70vw" class="g_pb_16 g_pt_16">
<a-table-summary fixed="bottom"> </a-table-summary>
</div>
</template> -->
</a-table>
<div class="g_pb_16 g_pt_16 g_pageBottom" v-if="tableData.records.length > 0">
<a-pagination v-model:current="tableData.page" v-model:page-size="tableData.size" :total="tableData.total" :pageSize="tableData.size" :show-total="(total) => `${total}`" @change="handleModalPage" @showSizeChange="handleModalSize" :show-quick-jumper="tableData.total < tableData.size ? false : true" :showSizeChanger="tableData.total < tableData.size ? false : true" :hideOnSinglePage="false" />
</div>
</div>
<!-- <a-modal v-model:open="modalInfo.isShow"
:title="modalInfo.title"
width="640px"
centered
:destroyOnClose="true"
:forceRender="true"
>
<div class="g_pt_30 modal-box">
<a-form :model="modalInfo.form"
name="basic"
:label-col="{ span: 6 }"
:wrapper-col="{ span: 18 }"
autocomplete="off"
style="width: 80%;"
class="g_ml_51"
>
<a-form-item label="职位要求标签" name="name" required>
<a-input style="width: 100%" placeholder="请输入职位要求标签" v-model:value="modalInfo.form.name" />
</a-form-item>
<a-form-item label="标签类型" name="typeClassify" required>
<a-select v-model:value="modalInfo.form.typeClassify"
:getPopupContainer="(triggerNode) => triggerNode.parentNode.parentNode"
placeholder="请选择职位分类"
@change="handleUpdateSelect"
>
<a-select-option v-for="item in typeClassifyList" :value="item.id" :title="item.id">{{ item.name }}</a-select-option>
</a-select>
</a-form-item>
<a-form-item label="说明" name="desp">
<a-textarea :rows='6' style="width: 100%" placeholder="请输入职位说明" v-model:value="modalInfo.form.desp" />
</a-form-item>
</a-form>
</div>
<template #footer>
<a-button @click="modalInfo.isShow = false">关闭</a-button>
<a-button @click="submitForm" type="primary">确定</a-button>
</template>
</a-modal> -->
<a-modal v-model:open="showAdd" :title="modalInfo.title" style="width: 734px" :destroyOnClose="true">
<div class="g_pt_30 modal-box">
<a-form :model="modalInfo.form"
name="basic"
:label-col="{ span: 6 }"
:wrapper-col="{ span: 18 }"
autocomplete="off"
style="width: 80%;"
class="g_ml_51"
>
<a-form-item label="姓名" name="name" required>
<a-input style="width: 100%" placeholder="请输入姓名" v-model:value="modalInfo.form.name" />
</a-form-item>
<a-form-item label="电话" name="name" required>
<a-input style="width: 100%" placeholder="请输入电话" v-model:value="modalInfo.form.username" />
</a-form-item>
<a-form-item label="身份证号" name="name">
<a-input style="width: 100%" placeholder="请输入身份证号" v-model:value="modalInfo.form.idcard" />
</a-form-item>
<a-form-item label="备注" name="desp">
<a-textarea :rows='6' style="width: 100%" placeholder="请输入备注" v-model:value="modalInfo.form.description" />
</a-form-item>
</a-form>
</div>
<template #footer>
<a-button @click="showAdd = false" >关闭</a-button>
<a-button @click="submitForm" type="primary">确定</a-button>
</template>
</a-modal>
</div>
</template>
<script setup>
import { ref, onMounted, getCurrentInstance, h, watch } from "vue";
import { PlusOutlined, EllipsisOutlined, UploadOutlined, DownOutlined } from "@ant-design/icons-vue";
import { Modal, message } from "ant-design-vue";
import { useRouter, useRoute } from "vue-router";
import { getUserListApi, updateUserStatusApi, addUserApi, delUserApi,updateUserApi } from "../../api/userList/userList";
import { DownloadOutlined } from "@ant-design/icons-vue";
import idCardPanel from "../components/upload/image.vue";
/* #################### 初始化事件 #################### */
const router = useRouter(); //
const route = useRoute();
const commonJS = getCurrentInstance().appContext.app.config.globalProperties.G;
const speed = ref(0);
const showAdd = ref(0);
onMounted(() => {
getTable();
});
/**
* 搜索事件
*/
const searchList = (e) => {
console.log("searchList", e);
tableData.value.page = 1;
getTable();
};
/* #################### 顶部事件 #################### */
const handleChangeSearch = (e) => {
if (tableData.value.keyword == "") {
getTable();
}
};
const modalInfo = ref({
title:'新增用户',
id:0,
form:{
name:"",
username:'',
idcard:'',
description:''
}
})
const submitForm = ()=>{
let url = '',params = {};
params = {
name:modalInfo.value.form.name,
username:modalInfo.value.form.username,
idcard:modalInfo.value.form.idcard,
description:modalInfo.value.form.description,
password:'123456',
id:modalInfo.value.id
}
if (!commonJS.regular(modalInfo.value.form.username, 'tel')) {
message.warning('请输入正确的手机号')
return false
}
if(modalInfo.value.id){
delete params.password;
updateUserApi(params).then((res)=>{
showAdd.value = false;
message.success("修改成功");
getTable();
});
}else{
addUserApi(params).then((res)=>{
showAdd.value = false;
message.success("新增成功");
getTable();
});
}
}
const handleToForm = ($type, $data) => {
showAdd.value = true;
console.log($data.id);
modalInfo.value = {
isShow:true,
title:'修改用户',
form:{
name:$data.name,
username:$data.username,
idcard:$data.idcard,
description:$data.description,
},
id:$data.id
}
// updateUserApi({
// description: "",
// idcard: "123123123123123123",
// name: "",
// username: "13214534564",
// password: 123456,
// status: 0,
// username: "",
// }).then(() => {
// message.success("");
// getTable();
// });
// if ($data.id > 0) {
// router.push({
// path: "/merchantManagement/jobForm",
// query: {
// id: $data.id ? $data.id : 0,
// type: $type,
// templateId: $data.templateId ? $data.templateId : 0,
// },
// });
// } else {
// router.push({
// path: "/merchantManagement/jobForm",
// query: {
// id: $data.id ? $data.id : 0,
// type: $type,
// },
// });
// }
};
/* #################### 表格事件 #################### */
const tableData = ref({
keyword: "",
page: 1,
limit: 20,
total: 0,
count: 0,
loading: false,
records: [],
jobType2Num: "-",
jobType1Num: "-",
});
const getTable = () => {
console.log(tableData.value);
tableData.value.loading = true;
getUserListApi({ limit: tableData.value.limit, page: tableData.value.page, keyword: tableData.value.keyword }).then((res) => {
console.log(res);
tableData.value = { ...res.data, keyword: tableData.value.keyword, page: res.data.current, limit: res.data.size };
tableData.value.records.forEach((item, index) => {
item.rank = index + 1;
});
});
};
const openAdd = () =>{
showAdd.value = true
modalInfo.value.title = "新增用户"
modalInfo.value.id = 0;
modalInfo.value = {
form:{
name:"",
username:'',
idcard:'',
description:''
}
}
}
const columns = ref([
{
title: "序号",
key: "rank",
dataIndex: "rank",
width: "50px",
ellipsis: true,
},
{
title: "姓名",
key: "name",
dataIndex: "name",
width: "110px",
},
{
title: "电话",
key: "username",
dataIndex: "username",
ellipsis: true,
width: "140px",
},
{
title: "身份证号",
key: "idcard",
dataIndex: "idcard",
width: "200px",
ellipsis: true,
},
{
title: "备注",
key: "description",
dataIndex: "description",
ellipsis: true,
},
{
title: "状态",
key: "status",
dataIndex: "status",
ellipsis: true,
width: "75px",
},
{
title: "操作",
key: "state",
dataIndex: "state",
width: "90px",
ellipsis: true,
},
]);
/**
* 切换用户状态
*/
const handleStatus = (e, $data) => {
updateUserStatusApi({ id: $data.id, status: e ? 1 : 0 }).then(() => {
message.success("更新成功");
getTable();
});
};
const addInfo = ref({});
const goDetail = ($item) => {
console.log($item);
//
if ($item.jobType == 1) {
//
router.push({
path: "/merchantManagement/shareJobDetail",
query: {
id: $item.templateId,
shared: $item.shared,
form: "joblist",
},
});
} else {
//
router.push({
path: "/merchantManagement/jobDetail",
query: {
id: $item.id,
},
});
}
};
const handleApplication = (record) => {
console.log(record);
if (!record.statusBool) {
return false;
}
//
router.push({
path: "/merchantManagement/recordJob",
query: {
company: record.boss,
job: record.job,
jobId: record.id,
templateId: record.templateId,
jobType: record.jobType,
},
});
};
const handleDel = ($data) => {
commonJS.gConfirmModal(
"删除",
"确认删除该用户吗?",
() => {
delUserApi($data.id).then(() => {
message.success("删除成功");
getTable();
});
},
() => {}
);
};
/* #################### 分页器事件 #################### */
const handleModalPage = ($page, $size) => {
//
console.log($page);
console.log($size);
tableData.value.page = $page;
getTable();
};
const handleModalSize = ($page, $size) => {
// size
tableData.value.page = 1;
tableData.value.size = $size;
getTable();
};
</script>
<style lang="less">
.ant-table-cell:empty::before{
content: "-";
}
.p-manage-myJob {
position: relative;
min-height: calc(100vh - 213px);
width: 100%;
height: 100px;
.btn-active {
width: 40px;
height: 24px;
margin-left: 6.5px;
font-size: 12px;
color: #f6343e;
background-color: #fff3f3;
padding: 1px 3px;
zoom: 0.6;
margin-top: 8px;
text-align: center;
}
}
.ant-spin-blur .ant-empty {
opacity: 0;
}
</style>

@ -0,0 +1,477 @@
<template>
<!--我的职位-->
<div class="p-manage-myJob">
<div class="m-select g_flex_row_between g_pt_16">
<div class="g_flex_row_start">
<div class="g_w_320 g-search-btn g_mr_16">
<a-input-search v-model:value="tableData.keyword" placeholder="请输入姓名/手机号" @search="searchList" @change="handleChangeSearch" allowClear />
</div>
</div>
<div>
<a-button type="primary" @click="openAdd" :icon="h(PlusOutlined)">新增用户</a-button>
<!-- <a-button type="" class="g_border_d g_ml_16" @click="handleToForm('add', { id: 0 })" :icon="h(DownloadOutlined)">导出模版</a-button> -->
<!--
<a-dropdown :trigger="['click']">
<template #overlay>
<a-menu>
<a-menu-item key="1" @click="goShareList"></a-menu-item>
<a-menu-item key="2" @click="handleToForm('add',{id:0})"></a-menu-item>
</a-menu>
</template>
<a-button>
新增职位
<DownOutlined style="zoom:.8" />
</a-button>
</a-dropdown> -->
</div>
</div>
<div class="m-table g_mt_20 antd-table">
<a-table sticky :columns="columns" :data-source="tableData.records" size="middle" :pagination="false" :loading="tableData.loading" class="g_clear_scroll" style="max-width: calc(100% - 0px)">
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'job'">
<!-- @click="goDetail(record)" -->
<div class="btn g_fs_14 g_cursor_point g_mr_13 g_flex_row_start">
<div class="g_ell_1">{{ "" }}</div>
</div>
</template>
<template v-if="column.key === 'age'">
<div class="g_ell_1">{{ record.sex + " " + record.age }}</div>
</template>
<template v-if="column.key === 'price'">
<!-- <div v-html="record.price"></div> -->
</template>
<template v-if="column.key === 'status'">
<a-switch @change="(e) => handleStatus(e, record)" :checked="record.status == 1 ? true : false" checked-children="" un-checked-children="" />
</template>
<template v-if="column.key === 'state'">
<div class="g_flex_row_between">
<!-- <div
class="btn g_fs_14 g_mr_13"
:class="'g_c_main g_cursor_point'"
:style="{
cursor: !record.statusBool ? 'not-allowed' : '',
color: !record.statusBool ? '#d8d8d8' : '#1677ff',
}"
@click="handleApplication(record)"
>
报名
</div> -->
<div class="btn g_c_main g_fs_14 g_cursor_point g_mr_13" @click="handleToForm('edit', record)">编辑</div>
<div class="btn g_c_main g_fs_14 g_cursor_point" @click="handleDel(record)"></div>
</div>
</template>
</template>
<!-- <template #summary class="fixed-obj">
<div style="width: 70vw" class="g_pb_16 g_pt_16">
<a-table-summary fixed="bottom"> </a-table-summary>
</div>
</template> -->
</a-table>
<div class="g_pb_16 g_pt_16 g_pageBottom" v-if="tableData.records.length > 0">
<a-pagination v-model:current="tableData.page" v-model:page-size="tableData.size" :total="tableData.total" :pageSize="tableData.size" :show-total="(total) => `${total}`" @change="handleModalPage" @showSizeChange="handleModalSize" :show-quick-jumper="tableData.total < tableData.size ? false : true" :showSizeChanger="tableData.total < tableData.size ? false : true" :hideOnSinglePage="false" />
</div>
</div>
<!-- <a-modal v-model:open="modalInfo.isShow"
:title="modalInfo.title"
width="640px"
centered
:destroyOnClose="true"
:forceRender="true"
>
<div class="g_pt_30 modal-box">
<a-form :model="modalInfo.form"
name="basic"
:label-col="{ span: 6 }"
:wrapper-col="{ span: 18 }"
autocomplete="off"
style="width: 80%;"
class="g_ml_51"
>
<a-form-item label="职位要求标签" name="name" required>
<a-input style="width: 100%" placeholder="请输入职位要求标签" v-model:value="modalInfo.form.name" />
</a-form-item>
<a-form-item label="标签类型" name="typeClassify" required>
<a-select v-model:value="modalInfo.form.typeClassify"
:getPopupContainer="(triggerNode) => triggerNode.parentNode.parentNode"
placeholder="请选择职位分类"
@change="handleUpdateSelect"
>
<a-select-option v-for="item in typeClassifyList" :value="item.id" :title="item.id">{{ item.name }}</a-select-option>
</a-select>
</a-form-item>
<a-form-item label="说明" name="desp">
<a-textarea :rows='6' style="width: 100%" placeholder="请输入职位说明" v-model:value="modalInfo.form.desp" />
</a-form-item>
</a-form>
</div>
<template #footer>
<a-button @click="modalInfo.isShow = false">关闭</a-button>
<a-button @click="submitForm" type="primary">确定</a-button>
</template>
</a-modal> -->
<a-modal v-model:open="showAdd" :title="modalInfo.title" style="width: 734px" :destroyOnClose="true">
<div class="g_pt_30 modal-box">
<a-form :model="modalInfo.form"
name="basic"
:label-col="{ span: 6 }"
:wrapper-col="{ span: 18 }"
autocomplete="off"
style="width: 80%;"
class="g_ml_51"
>
<a-form-item label="姓名" name="name" required>
<a-input style="width: 100%" placeholder="请输入姓名" v-model:value="modalInfo.form.name" />
</a-form-item>
<a-form-item label="电话" name="name" required>
<a-input style="width: 100%" placeholder="请输入电话" v-model:value="modalInfo.form.username" />
</a-form-item>
<a-form-item label="身份证号" name="name">
<a-input style="width: 100%" placeholder="请输入身份证号" v-model:value="modalInfo.form.idcard" />
</a-form-item>
<a-form-item label="备注" name="desp">
<a-textarea :rows='6' style="width: 100%" placeholder="请输入备注" v-model:value="modalInfo.form.description" />
</a-form-item>
</a-form>
</div>
<template #footer>
<a-button @click="showAdd = false" >关闭</a-button>
<a-button @click="submitForm" type="primary">确定</a-button>
</template>
</a-modal>
</div>
</template>
<script setup>
import { ref, onMounted, getCurrentInstance, h, watch } from "vue";
import { PlusOutlined, EllipsisOutlined, UploadOutlined, DownOutlined } from "@ant-design/icons-vue";
import { Modal, message } from "ant-design-vue";
import { useRouter, useRoute } from "vue-router";
import { getUserListApi, updateUserStatusApi, addUserApi, delUserApi,updateUserApi } from "../../api/userList/userList";
import { DownloadOutlined } from "@ant-design/icons-vue";
import idCardPanel from "../components/upload/image.vue";
/* #################### 初始化事件 #################### */
const router = useRouter(); //
const route = useRoute();
const commonJS = getCurrentInstance().appContext.app.config.globalProperties.G;
const speed = ref(0);
const showAdd = ref(0);
onMounted(() => {
getTable();
});
/**
* 搜索事件
*/
const searchList = (e) => {
console.log("searchList", e);
tableData.value.page = 1;
getTable();
};
/* #################### 顶部事件 #################### */
const handleChangeSearch = (e) => {
if (tableData.value.keyword == "") {
getTable();
}
};
const modalInfo = ref({
title:'新增用户',
id:0,
form:{
name:"",
username:'',
idcard:'',
description:''
}
})
const submitForm = ()=>{
let url = '',params = {};
params = {
name:modalInfo.value.form.name,
username:modalInfo.value.form.username,
idcard:modalInfo.value.form.idcard,
description:modalInfo.value.form.description,
password:'123456',
id:modalInfo.value.id
}
if (!commonJS.regular(modalInfo.value.form.username, 'tel')) {
message.warning('请输入正确的手机号')
return false
}
if(modalInfo.value.id){
delete params.password;
updateUserApi(params).then((res)=>{
showAdd.value = false;
message.success("修改成功");
getTable();
});
}else{
addUserApi(params).then((res)=>{
showAdd.value = false;
message.success("新增成功");
getTable();
});
}
}
const handleToForm = ($type, $data) => {
showAdd.value = true;
console.log($data.id);
modalInfo.value = {
isShow:true,
title:'修改用户',
form:{
name:$data.name,
username:$data.username,
idcard:$data.idcard,
description:$data.description,
},
id:$data.id
}
// updateUserApi({
// description: "",
// idcard: "123123123123123123",
// name: "",
// username: "13214534564",
// password: 123456,
// status: 0,
// username: "",
// }).then(() => {
// message.success("");
// getTable();
// });
// if ($data.id > 0) {
// router.push({
// path: "/merchantManagement/jobForm",
// query: {
// id: $data.id ? $data.id : 0,
// type: $type,
// templateId: $data.templateId ? $data.templateId : 0,
// },
// });
// } else {
// router.push({
// path: "/merchantManagement/jobForm",
// query: {
// id: $data.id ? $data.id : 0,
// type: $type,
// },
// });
// }
};
/* #################### 表格事件 #################### */
const tableData = ref({
keyword: "",
page: 1,
limit: 20,
total: 0,
count: 0,
loading: false,
records: [],
jobType2Num: "-",
jobType1Num: "-",
});
const getTable = () => {
console.log(tableData.value);
tableData.value.loading = true;
getUserListApi({ limit: tableData.value.limit, page: tableData.value.page, keyword: tableData.value.keyword }).then((res) => {
console.log(res);
tableData.value = { ...res.data, keyword: tableData.value.keyword, page: res.data.current, limit: res.data.size };
tableData.value.records.forEach((item, index) => {
item.rank = index + 1;
});
});
};
const openAdd = () =>{
showAdd.value = true
modalInfo.value.title = "新增用户"
modalInfo.value.id = 0;
modalInfo.value = {
form:{
name:"",
username:'',
idcard:'',
description:''
}
}
}
const columns = ref([
{
title: "序号",
key: "rank",
dataIndex: "rank",
width: "50px",
ellipsis: true,
},
{
title: "姓名",
key: "name",
dataIndex: "name",
width: "110px",
},
{
title: "电话",
key: "username",
dataIndex: "username",
ellipsis: true,
width: "140px",
},
{
title: "身份证号",
key: "idcard",
dataIndex: "idcard",
width: "200px",
ellipsis: true,
},
{
title: "备注",
key: "description",
dataIndex: "description",
ellipsis: true,
},
{
title: "状态",
key: "status",
dataIndex: "status",
ellipsis: true,
width: "75px",
},
{
title: "操作",
key: "state",
dataIndex: "state",
width: "90px",
ellipsis: true,
},
]);
/**
* 切换用户状态
*/
const handleStatus = (e, $data) => {
updateUserStatusApi({ id: $data.id, status: e ? 1 : 0 }).then(() => {
message.success("更新成功");
getTable();
});
};
const addInfo = ref({});
const goDetail = ($item) => {
console.log($item);
//
if ($item.jobType == 1) {
//
router.push({
path: "/merchantManagement/shareJobDetail",
query: {
id: $item.templateId,
shared: $item.shared,
form: "joblist",
},
});
} else {
//
router.push({
path: "/merchantManagement/jobDetail",
query: {
id: $item.id,
},
});
}
};
const handleApplication = (record) => {
console.log(record);
if (!record.statusBool) {
return false;
}
//
router.push({
path: "/merchantManagement/recordJob",
query: {
company: record.boss,
job: record.job,
jobId: record.id,
templateId: record.templateId,
jobType: record.jobType,
},
});
};
const handleDel = ($data) => {
commonJS.gConfirmModal(
"删除",
"确认删除该用户吗?",
() => {
delUserApi($data.id).then(() => {
message.success("删除成功");
getTable();
});
},
() => {}
);
};
/* #################### 分页器事件 #################### */
const handleModalPage = ($page, $size) => {
//
console.log($page);
console.log($size);
tableData.value.page = $page;
getTable();
};
const handleModalSize = ($page, $size) => {
// size
tableData.value.page = 1;
tableData.value.size = $size;
getTable();
};
</script>
<style lang="less">
.ant-table-cell:empty::before{
content: "-";
}
.p-manage-myJob {
position: relative;
min-height: calc(100vh - 213px);
width: 100%;
height: 100px;
.btn-active {
width: 40px;
height: 24px;
margin-left: 6.5px;
font-size: 12px;
color: #f6343e;
background-color: #fff3f3;
padding: 1px 3px;
zoom: 0.6;
margin-top: 8px;
text-align: center;
}
}
.ant-spin-blur .ant-empty {
opacity: 0;
}
</style>

@ -0,0 +1,477 @@
<template>
<!--我的职位-->
<div class="p-manage-myJob">
<div class="m-select g_flex_row_between g_pt_16">
<div class="g_flex_row_start">
<div class="g_w_320 g-search-btn g_mr_16">
<a-input-search v-model:value="tableData.keyword" placeholder="请输入姓名/手机号" @search="searchList" @change="handleChangeSearch" allowClear />
</div>
</div>
<div>
<a-button type="primary" @click="openAdd" :icon="h(PlusOutlined)">新增用户</a-button>
<!-- <a-button type="" class="g_border_d g_ml_16" @click="handleToForm('add', { id: 0 })" :icon="h(DownloadOutlined)">导出模版</a-button> -->
<!--
<a-dropdown :trigger="['click']">
<template #overlay>
<a-menu>
<a-menu-item key="1" @click="goShareList"></a-menu-item>
<a-menu-item key="2" @click="handleToForm('add',{id:0})"></a-menu-item>
</a-menu>
</template>
<a-button>
新增职位
<DownOutlined style="zoom:.8" />
</a-button>
</a-dropdown> -->
</div>
</div>
<div class="m-table g_mt_20 antd-table">
<a-table sticky :columns="columns" :data-source="tableData.records" size="middle" :pagination="false" :loading="tableData.loading" class="g_clear_scroll" style="max-width: calc(100% - 0px)">
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'job'">
<!-- @click="goDetail(record)" -->
<div class="btn g_fs_14 g_cursor_point g_mr_13 g_flex_row_start">
<div class="g_ell_1">{{ "" }}</div>
</div>
</template>
<template v-if="column.key === 'age'">
<div class="g_ell_1">{{ record.sex + " " + record.age }}</div>
</template>
<template v-if="column.key === 'price'">
<!-- <div v-html="record.price"></div> -->
</template>
<template v-if="column.key === 'status'">
<a-switch @change="(e) => handleStatus(e, record)" :checked="record.status == 1 ? true : false" checked-children="" un-checked-children="" />
</template>
<template v-if="column.key === 'state'">
<div class="g_flex_row_between">
<!-- <div
class="btn g_fs_14 g_mr_13"
:class="'g_c_main g_cursor_point'"
:style="{
cursor: !record.statusBool ? 'not-allowed' : '',
color: !record.statusBool ? '#d8d8d8' : '#1677ff',
}"
@click="handleApplication(record)"
>
报名
</div> -->
<div class="btn g_c_main g_fs_14 g_cursor_point g_mr_13" @click="handleToForm('edit', record)">编辑</div>
<div class="btn g_c_main g_fs_14 g_cursor_point" @click="handleDel(record)"></div>
</div>
</template>
</template>
<!-- <template #summary class="fixed-obj">
<div style="width: 70vw" class="g_pb_16 g_pt_16">
<a-table-summary fixed="bottom"> </a-table-summary>
</div>
</template> -->
</a-table>
<div class="g_pb_16 g_pt_16 g_pageBottom" v-if="tableData.records.length > 0">
<a-pagination v-model:current="tableData.page" v-model:page-size="tableData.size" :total="tableData.total" :pageSize="tableData.size" :show-total="(total) => `${total}`" @change="handleModalPage" @showSizeChange="handleModalSize" :show-quick-jumper="tableData.total < tableData.size ? false : true" :showSizeChanger="tableData.total < tableData.size ? false : true" :hideOnSinglePage="false" />
</div>
</div>
<!-- <a-modal v-model:open="modalInfo.isShow"
:title="modalInfo.title"
width="640px"
centered
:destroyOnClose="true"
:forceRender="true"
>
<div class="g_pt_30 modal-box">
<a-form :model="modalInfo.form"
name="basic"
:label-col="{ span: 6 }"
:wrapper-col="{ span: 18 }"
autocomplete="off"
style="width: 80%;"
class="g_ml_51"
>
<a-form-item label="职位要求标签" name="name" required>
<a-input style="width: 100%" placeholder="请输入职位要求标签" v-model:value="modalInfo.form.name" />
</a-form-item>
<a-form-item label="标签类型" name="typeClassify" required>
<a-select v-model:value="modalInfo.form.typeClassify"
:getPopupContainer="(triggerNode) => triggerNode.parentNode.parentNode"
placeholder="请选择职位分类"
@change="handleUpdateSelect"
>
<a-select-option v-for="item in typeClassifyList" :value="item.id" :title="item.id">{{ item.name }}</a-select-option>
</a-select>
</a-form-item>
<a-form-item label="说明" name="desp">
<a-textarea :rows='6' style="width: 100%" placeholder="请输入职位说明" v-model:value="modalInfo.form.desp" />
</a-form-item>
</a-form>
</div>
<template #footer>
<a-button @click="modalInfo.isShow = false">关闭</a-button>
<a-button @click="submitForm" type="primary">确定</a-button>
</template>
</a-modal> -->
<a-modal v-model:open="showAdd" :title="modalInfo.title" style="width: 734px" :destroyOnClose="true">
<div class="g_pt_30 modal-box">
<a-form :model="modalInfo.form"
name="basic"
:label-col="{ span: 6 }"
:wrapper-col="{ span: 18 }"
autocomplete="off"
style="width: 80%;"
class="g_ml_51"
>
<a-form-item label="姓名" name="name" required>
<a-input style="width: 100%" placeholder="请输入姓名" v-model:value="modalInfo.form.name" />
</a-form-item>
<a-form-item label="电话" name="name" required>
<a-input style="width: 100%" placeholder="请输入电话" v-model:value="modalInfo.form.username" />
</a-form-item>
<a-form-item label="身份证号" name="name">
<a-input style="width: 100%" placeholder="请输入身份证号" v-model:value="modalInfo.form.idcard" />
</a-form-item>
<a-form-item label="备注" name="desp">
<a-textarea :rows='6' style="width: 100%" placeholder="请输入备注" v-model:value="modalInfo.form.description" />
</a-form-item>
</a-form>
</div>
<template #footer>
<a-button @click="showAdd = false" >关闭</a-button>
<a-button @click="submitForm" type="primary">确定</a-button>
</template>
</a-modal>
</div>
</template>
<script setup>
import { ref, onMounted, getCurrentInstance, h, watch } from "vue";
import { PlusOutlined, EllipsisOutlined, UploadOutlined, DownOutlined } from "@ant-design/icons-vue";
import { Modal, message } from "ant-design-vue";
import { useRouter, useRoute } from "vue-router";
import { getUserListApi, updateUserStatusApi, addUserApi, delUserApi,updateUserApi } from "../../api/userList/userList";
import { DownloadOutlined } from "@ant-design/icons-vue";
import idCardPanel from "../components/upload/image.vue";
/* #################### 初始化事件 #################### */
const router = useRouter(); //
const route = useRoute();
const commonJS = getCurrentInstance().appContext.app.config.globalProperties.G;
const speed = ref(0);
const showAdd = ref(0);
onMounted(() => {
getTable();
});
/**
* 搜索事件
*/
const searchList = (e) => {
console.log("searchList", e);
tableData.value.page = 1;
getTable();
};
/* #################### 顶部事件 #################### */
const handleChangeSearch = (e) => {
if (tableData.value.keyword == "") {
getTable();
}
};
const modalInfo = ref({
title:'新增用户',
id:0,
form:{
name:"",
username:'',
idcard:'',
description:''
}
})
const submitForm = ()=>{
let url = '',params = {};
params = {
name:modalInfo.value.form.name,
username:modalInfo.value.form.username,
idcard:modalInfo.value.form.idcard,
description:modalInfo.value.form.description,
password:'123456',
id:modalInfo.value.id
}
if (!commonJS.regular(modalInfo.value.form.username, 'tel')) {
message.warning('请输入正确的手机号')
return false
}
if(modalInfo.value.id){
delete params.password;
updateUserApi(params).then((res)=>{
showAdd.value = false;
message.success("修改成功");
getTable();
});
}else{
addUserApi(params).then((res)=>{
showAdd.value = false;
message.success("新增成功");
getTable();
});
}
}
const handleToForm = ($type, $data) => {
showAdd.value = true;
console.log($data.id);
modalInfo.value = {
isShow:true,
title:'修改用户',
form:{
name:$data.name,
username:$data.username,
idcard:$data.idcard,
description:$data.description,
},
id:$data.id
}
// updateUserApi({
// description: "",
// idcard: "123123123123123123",
// name: "",
// username: "13214534564",
// password: 123456,
// status: 0,
// username: "",
// }).then(() => {
// message.success("");
// getTable();
// });
// if ($data.id > 0) {
// router.push({
// path: "/merchantManagement/jobForm",
// query: {
// id: $data.id ? $data.id : 0,
// type: $type,
// templateId: $data.templateId ? $data.templateId : 0,
// },
// });
// } else {
// router.push({
// path: "/merchantManagement/jobForm",
// query: {
// id: $data.id ? $data.id : 0,
// type: $type,
// },
// });
// }
};
/* #################### 表格事件 #################### */
const tableData = ref({
keyword: "",
page: 1,
limit: 20,
total: 0,
count: 0,
loading: false,
records: [],
jobType2Num: "-",
jobType1Num: "-",
});
const getTable = () => {
console.log(tableData.value);
tableData.value.loading = true;
getUserListApi({ limit: tableData.value.limit, page: tableData.value.page, keyword: tableData.value.keyword }).then((res) => {
console.log(res);
tableData.value = { ...res.data, keyword: tableData.value.keyword, page: res.data.current, limit: res.data.size };
tableData.value.records.forEach((item, index) => {
item.rank = index + 1;
});
});
};
const openAdd = () =>{
showAdd.value = true
modalInfo.value.title = "新增用户"
modalInfo.value.id = 0;
modalInfo.value = {
form:{
name:"",
username:'',
idcard:'',
description:''
}
}
}
const columns = ref([
{
title: "序号",
key: "rank",
dataIndex: "rank",
width: "50px",
ellipsis: true,
},
{
title: "姓名",
key: "name",
dataIndex: "name",
width: "110px",
},
{
title: "电话",
key: "username",
dataIndex: "username",
ellipsis: true,
width: "140px",
},
{
title: "身份证号",
key: "idcard",
dataIndex: "idcard",
width: "200px",
ellipsis: true,
},
{
title: "备注",
key: "description",
dataIndex: "description",
ellipsis: true,
},
{
title: "状态",
key: "status",
dataIndex: "status",
ellipsis: true,
width: "75px",
},
{
title: "操作",
key: "state",
dataIndex: "state",
width: "90px",
ellipsis: true,
},
]);
/**
* 切换用户状态
*/
const handleStatus = (e, $data) => {
updateUserStatusApi({ id: $data.id, status: e ? 1 : 0 }).then(() => {
message.success("更新成功");
getTable();
});
};
const addInfo = ref({});
const goDetail = ($item) => {
console.log($item);
//
if ($item.jobType == 1) {
//
router.push({
path: "/merchantManagement/shareJobDetail",
query: {
id: $item.templateId,
shared: $item.shared,
form: "joblist",
},
});
} else {
//
router.push({
path: "/merchantManagement/jobDetail",
query: {
id: $item.id,
},
});
}
};
const handleApplication = (record) => {
console.log(record);
if (!record.statusBool) {
return false;
}
//
router.push({
path: "/merchantManagement/recordJob",
query: {
company: record.boss,
job: record.job,
jobId: record.id,
templateId: record.templateId,
jobType: record.jobType,
},
});
};
const handleDel = ($data) => {
commonJS.gConfirmModal(
"删除",
"确认删除该用户吗?",
() => {
delUserApi($data.id).then(() => {
message.success("删除成功");
getTable();
});
},
() => {}
);
};
/* #################### 分页器事件 #################### */
const handleModalPage = ($page, $size) => {
//
console.log($page);
console.log($size);
tableData.value.page = $page;
getTable();
};
const handleModalSize = ($page, $size) => {
// size
tableData.value.page = 1;
tableData.value.size = $size;
getTable();
};
</script>
<style lang="less">
.ant-table-cell:empty::before{
content: "-";
}
.p-manage-myJob {
position: relative;
min-height: calc(100vh - 213px);
width: 100%;
height: 100px;
.btn-active {
width: 40px;
height: 24px;
margin-left: 6.5px;
font-size: 12px;
color: #f6343e;
background-color: #fff3f3;
padding: 1px 3px;
zoom: 0.6;
margin-top: 8px;
text-align: center;
}
}
.ant-spin-blur .ant-empty {
opacity: 0;
}
</style>
Loading…
Cancel
Save