flat: 零工用户管理
This commit is contained in:
@@ -1,18 +1,17 @@
|
||||
import request from '@/router/axios';
|
||||
|
||||
export const getList =
|
||||
(account) => {
|
||||
export const getList = (params) => {
|
||||
return request({
|
||||
url: '/api/jobslink-api/user/account/manage/accountList',
|
||||
url: '/api/jobslink-api/user/user/list',
|
||||
method: 'get',
|
||||
params: {account}
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
export const open =
|
||||
(account) => {
|
||||
return request({
|
||||
url: ' /api/jobslink-api/user/account/manage/open',
|
||||
url: '/api/jobslink-api/user/account/manage/open ',
|
||||
method: 'post',
|
||||
params: {account}
|
||||
})
|
||||
@@ -21,7 +20,7 @@ export const open =
|
||||
export const close =
|
||||
(account) => {
|
||||
return request({
|
||||
url: ' /api/jobslink-api/user/account/manage/close',
|
||||
url: '/api/jobslink-api/user/account/manage/close',
|
||||
method: 'post',
|
||||
params: {account}
|
||||
})
|
||||
@@ -29,7 +28,7 @@ export const close =
|
||||
|
||||
export const remove = (account) => {
|
||||
return request({
|
||||
url: ' /api/jobslink-api/user/account/manage/remove',
|
||||
url: '/api/jobslink-api/user/account/manage/remove',
|
||||
method: 'post',
|
||||
params: {account}
|
||||
})
|
||||
|
||||
@@ -1,48 +1,74 @@
|
||||
<template>
|
||||
<basic-container>
|
||||
<avue-crud
|
||||
ref="crud"
|
||||
:option="option"
|
||||
:table-loading="loading"
|
||||
:data="data"
|
||||
ref="crud"
|
||||
:data="infoData"
|
||||
v-model="form"
|
||||
:page.sync="infoPages"
|
||||
:permission="permissionList"
|
||||
:before-open="beforeOpen"
|
||||
:before-close="beforeClose"
|
||||
@row-update="rowUpdate"
|
||||
@row-save="rowSave"
|
||||
@search-change="searchChange"
|
||||
@search-reset="searchReset"
|
||||
@selection-change="selectionChange"
|
||||
@search-reset="resetChange"
|
||||
@refresh-change="refreshChange"
|
||||
@size-change="sizeChange"
|
||||
@current-change="currentChange"
|
||||
>
|
||||
<template slot-scope="scope" slot="menu">
|
||||
<el-button
|
||||
type="text"
|
||||
size="small"
|
||||
@click.stop="rowDisable(scope.row)"
|
||||
v-if="scope.row.status === 0 && vaildData(permission.manage_cuser_stop, false)"
|
||||
>停用</el-button>
|
||||
<el-button
|
||||
type="text"
|
||||
size="small"
|
||||
@click.stop="rowEnable(scope.row)"
|
||||
v-else-if="vaildData(permission.manage_cuser_enable, false)"
|
||||
>启用</el-button>
|
||||
<el-button type="text" size="small" @click.stop="rowRemove(scope.row)">删除</el-button>
|
||||
</template>
|
||||
<template v-slot:status="{row}">
|
||||
<span v-if="row.status === 0">启用</span>
|
||||
<span v-else>停用</span>
|
||||
</template>
|
||||
</avue-crud>
|
||||
</basic-container>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getList, open, close, remove } from "@/api/manage/user";
|
||||
import { mapGetters } from "vuex";
|
||||
import {getList, open, close, remove} from "@/api/manage/user";
|
||||
import {mapGetters} from "vuex";
|
||||
import {dateFormat} from "@/util/date";
|
||||
import {confirmCount} from "@/api/report/report";
|
||||
|
||||
const pages = {total: 0, size: 10, currentPage: 1}
|
||||
const baseOptions = {
|
||||
dateBtn: false,
|
||||
addBtn: false,
|
||||
viewBtn: true,
|
||||
editBtn: false,
|
||||
delBtn: false,
|
||||
height: "auto",
|
||||
reserveSelection: false,
|
||||
border: true,
|
||||
columnBtn: false,
|
||||
refreshBtn: false,
|
||||
menu: true,
|
||||
menuWidth: 120,
|
||||
tip: false,
|
||||
searchMenuSpan: 6,
|
||||
selection: false,
|
||||
headerAlign: 'center',
|
||||
align: 'center',
|
||||
}
|
||||
const sexLs = [
|
||||
{
|
||||
label: "男",
|
||||
value: 1,
|
||||
},
|
||||
{
|
||||
label: "女",
|
||||
value: 2,
|
||||
},
|
||||
{
|
||||
label: "不限",
|
||||
value: 3,
|
||||
}
|
||||
]
|
||||
const statusLs = [
|
||||
{
|
||||
label: "启用",
|
||||
value: 0,
|
||||
},
|
||||
{
|
||||
label: "停用",
|
||||
value: 1,
|
||||
},
|
||||
|
||||
]
|
||||
export default {
|
||||
components: {},
|
||||
name: "manage_cuser",
|
||||
@@ -51,46 +77,13 @@ export default {
|
||||
form: {},
|
||||
selectionList: [],
|
||||
query: {},
|
||||
search: {},
|
||||
infoPages: Object.assign({}, pages),
|
||||
infoData: [],
|
||||
loading: false,
|
||||
checkDialog: false,
|
||||
delayDialog: false,
|
||||
finishDialog: false,
|
||||
option: {
|
||||
height: "auto",
|
||||
tip: false,
|
||||
searchShow: true,
|
||||
searchMenuSpan: 6,
|
||||
border: true,
|
||||
index: false,
|
||||
selection: false,
|
||||
addBtn: false,
|
||||
viewBtn: false,
|
||||
editBtn: false,
|
||||
delBtn: false,
|
||||
dialogClickModal: false,
|
||||
dialogType: "drawer",
|
||||
dialogFullscreen: true,
|
||||
column: [
|
||||
{
|
||||
label: "账号",
|
||||
prop: "account",
|
||||
type: "input",
|
||||
search: true,
|
||||
},
|
||||
{
|
||||
label: "注册时间",
|
||||
prop: "createTime",
|
||||
type: "input",
|
||||
},
|
||||
{
|
||||
label: "账号状态",
|
||||
prop: "status",
|
||||
type: "select",
|
||||
slot: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
data: [],
|
||||
};
|
||||
},
|
||||
created() {
|
||||
@@ -108,132 +101,141 @@ export default {
|
||||
});
|
||||
return ids;
|
||||
},
|
||||
option() {
|
||||
// {
|
||||
// "userId": "1298598161262571521",
|
||||
// "cityId": -1,
|
||||
// "sex": 1,
|
||||
// "header": "",
|
||||
// "nickName": "",
|
||||
// "idNumber": "",
|
||||
// "telphone": "17780870050",
|
||||
// "email": "",
|
||||
// "address": "",
|
||||
// "birthday": "1985-02-28T00:00:00",
|
||||
// "realName": "杜小彬",
|
||||
// "localAddress": "",
|
||||
// "createTime": "2020-08-26 20:28:23",
|
||||
// "status": 0,
|
||||
// "remarks": "",
|
||||
// "nation": "",
|
||||
// "politics": "",
|
||||
// "tokenUser": "",
|
||||
// "bankName": "",
|
||||
// "cardNumber": "",
|
||||
// "authValue": "",
|
||||
// "bakValue": -1,
|
||||
// "authCount": -1,
|
||||
// "skillName": "维修电工,家电维修"
|
||||
// }
|
||||
return {
|
||||
...baseOptions,
|
||||
column: [
|
||||
{
|
||||
label: "真实姓名",
|
||||
prop: "realName",
|
||||
search: true,
|
||||
},
|
||||
{
|
||||
label: "性别",
|
||||
prop: "sex",
|
||||
type: 'select',
|
||||
dicData: sexLs,
|
||||
},
|
||||
{
|
||||
label: "手机号",
|
||||
prop: "telphone",
|
||||
search: true,
|
||||
},
|
||||
{
|
||||
label: "技能",
|
||||
prop: "skillName",
|
||||
},
|
||||
{
|
||||
label: "注册时间",
|
||||
prop: "createTime",
|
||||
},
|
||||
{
|
||||
label: "账号状态",
|
||||
prop: "status",
|
||||
type: 'select',
|
||||
dicData: statusLs,
|
||||
},
|
||||
{
|
||||
label: "生日",
|
||||
prop: "birthday",
|
||||
hide: true,
|
||||
},
|
||||
{
|
||||
label: "户籍所在地",
|
||||
prop: "localAddress",
|
||||
hide: true,
|
||||
},
|
||||
{
|
||||
label: "身份证号码",
|
||||
prop: "idNumber",
|
||||
hide: true,
|
||||
},
|
||||
{
|
||||
label: "薪资",
|
||||
prop: "wage",
|
||||
hide: true,
|
||||
},
|
||||
{
|
||||
label: "工作地址",
|
||||
prop: "workplace",
|
||||
hide: true,
|
||||
}
|
||||
],
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
rowEnable(row) {
|
||||
const h = this.$createElement;
|
||||
this.$confirm(
|
||||
h("p", { style: "color: #F56C6C" }, "启用账号后即可操作系统"),
|
||||
"您确定要启用此账号吗?",
|
||||
{
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning",
|
||||
center: true,
|
||||
}
|
||||
)
|
||||
.then(() => {
|
||||
this.loading = true;
|
||||
open(row.account)
|
||||
.then((resp) => {
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: resp.data.msg,
|
||||
});
|
||||
this.getData(this.query);
|
||||
})
|
||||
.catch(() => {
|
||||
this.loading = false;
|
||||
});
|
||||
})
|
||||
.catch(() => {});
|
||||
},
|
||||
rowDisable(row) {
|
||||
const h = this.$createElement;
|
||||
this.$confirm(
|
||||
h("p", { style: "color: #F56C6C" }, "一旦停用不可操作系统"),
|
||||
"您确定要停用此账号吗?",
|
||||
{
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning",
|
||||
center: true,
|
||||
}
|
||||
)
|
||||
.then(() => {
|
||||
this.loading = true;
|
||||
close(row.account)
|
||||
.then((resp) => {
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: resp.data.msg,
|
||||
});
|
||||
this.getData(this.query);
|
||||
})
|
||||
.catch(() => {
|
||||
this.loading = false;
|
||||
});
|
||||
})
|
||||
.catch(() => {});
|
||||
},
|
||||
rowRemove(row) {
|
||||
const h = this.$createElement;
|
||||
this.$confirm(
|
||||
h("p", { style: "color: #F56C6C" }, ""),
|
||||
"您确定要删除此账号吗?",
|
||||
{
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning",
|
||||
center: true,
|
||||
}
|
||||
)
|
||||
.then(() => {
|
||||
this.loading = true;
|
||||
remove(row.account)
|
||||
.then((resp) => {
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: resp.data.msg,
|
||||
});
|
||||
this.getData(this.query);
|
||||
})
|
||||
.catch(() => {
|
||||
this.loading = false;
|
||||
});
|
||||
})
|
||||
.catch(() => {});
|
||||
},
|
||||
searchReset() {
|
||||
this.query = {};
|
||||
this.getData();
|
||||
},
|
||||
searchChange(params, done) {
|
||||
this.query = params;
|
||||
this.getData(params);
|
||||
done();
|
||||
},
|
||||
selectionChange(list) {
|
||||
this.selectionList = list;
|
||||
},
|
||||
selectionClear() {
|
||||
this.selectionList = [];
|
||||
this.$refs.crud.toggleSelection();
|
||||
},
|
||||
beforeOpen(done) {
|
||||
done();
|
||||
},
|
||||
beforeClose(done) {
|
||||
done();
|
||||
},
|
||||
refreshChange() {
|
||||
this.getData(this.query);
|
||||
this.getData(this.search);
|
||||
},
|
||||
getData(params = {}) {
|
||||
if (params.account) {
|
||||
searchChange(values, done) {
|
||||
this.search = values;
|
||||
this.getData().then(() => done())
|
||||
},
|
||||
resetChange() {
|
||||
this.search = {}
|
||||
this.getData()
|
||||
},
|
||||
sizeChange(size) {
|
||||
this.infoPages.size = size
|
||||
this.getData()
|
||||
},
|
||||
currentChange(page) {
|
||||
this.infoPages.page = page
|
||||
this.getData()
|
||||
},
|
||||
getData(values) {
|
||||
return new Promise(async (resolve, reject) => {
|
||||
this.loading = true;
|
||||
getList(params.account)
|
||||
.then((res) => {
|
||||
const data = res.data.data;
|
||||
this.data = data;
|
||||
this.loading = false;
|
||||
})
|
||||
.catch(() => {
|
||||
this.loading = false;
|
||||
});
|
||||
} else {
|
||||
this.data = [];
|
||||
let params = {
|
||||
...this.search,
|
||||
size: this.infoPages.size,
|
||||
current: this.infoPages.currentPage,
|
||||
}
|
||||
// if( Array.isArray(this.search.date) && this.search.date.length ) {
|
||||
// const [stime, etime] = this.search.date
|
||||
// params.stime = dateFormat(stime, "yyyy-MM-dd")
|
||||
// params.etime = dateFormat(etime, "yyyy-MM-dd")
|
||||
// delete params.date
|
||||
// }
|
||||
let resData = await getList(params)
|
||||
if (resData.data.code === 200) {
|
||||
const {records, current, total, size} = resData.data.data
|
||||
this.infoData = records
|
||||
this.infoPages = {...this.infoPages, currentPage: current, total, size}
|
||||
this.loading = false;
|
||||
resolve(records)
|
||||
} else {
|
||||
this.loading = false;
|
||||
reject()
|
||||
}
|
||||
})
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user