11
This commit is contained in:
232
src/views/manage/station/account.vue
Normal file
232
src/views/manage/station/account.vue
Normal file
@@ -0,0 +1,232 @@
|
|||||||
|
<template>
|
||||||
|
<basic-container>
|
||||||
|
<avue-crud
|
||||||
|
:option="option"
|
||||||
|
:table-loading="loading"
|
||||||
|
:data="data"
|
||||||
|
ref="crud"
|
||||||
|
v-model="form"
|
||||||
|
:permission="permissionList"
|
||||||
|
:before-open="beforeOpen"
|
||||||
|
:before-close="beforeClose"
|
||||||
|
@search-change="searchChange"
|
||||||
|
@search-reset="searchReset"
|
||||||
|
@current-change="currentChange"
|
||||||
|
@size-change="sizeChange"
|
||||||
|
@refresh-change="refreshChange"
|
||||||
|
@on-load="onLoad"
|
||||||
|
>
|
||||||
|
<template slot="menuLeft"></template>
|
||||||
|
<template slot-scope="scope" slot="menu">
|
||||||
|
<el-button
|
||||||
|
type="text"
|
||||||
|
size="small"
|
||||||
|
@click.stop="handleView(scope.row,scope.index)"
|
||||||
|
v-if="vaildData(permission.manage_station_account_view, false)"
|
||||||
|
>详情</el-button>
|
||||||
|
<el-button
|
||||||
|
type="text"
|
||||||
|
size="small"
|
||||||
|
@click.stop="handleAccount(scope.row,scope.index)"
|
||||||
|
v-if="vaildData(permission.manage_station_account_account, false) && scope.row.status === 0"
|
||||||
|
>结算</el-button>
|
||||||
|
</template>
|
||||||
|
<template slot="userNum" slot-scope="{row}">
|
||||||
|
<span>{{row.userNum}} 人</span>
|
||||||
|
</template>
|
||||||
|
<template slot="totalSys" slot-scope="{row}">
|
||||||
|
<span v-if="!row.totalSys && row.totalSys!== 0">-</span>
|
||||||
|
<span v-else>¥{{moneyFormat(row.totalSys)}}</span>
|
||||||
|
</template>
|
||||||
|
</avue-crud>
|
||||||
|
<account-detail ref="detail"></account-detail>
|
||||||
|
</basic-container>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { getList } from "@/api/manage/account";
|
||||||
|
import { mapGetters } from "vuex";
|
||||||
|
import { moneyFormat } from "@/util/money";
|
||||||
|
import accountDetail from "./accountDetail";
|
||||||
|
export default {
|
||||||
|
components: { accountDetail },
|
||||||
|
name: "manage_station_account",
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
form: {},
|
||||||
|
query: {},
|
||||||
|
loading: true,
|
||||||
|
page: {
|
||||||
|
pageSize: 10,
|
||||||
|
currentPage: 1,
|
||||||
|
total: 0,
|
||||||
|
},
|
||||||
|
drawer: true,
|
||||||
|
option: {
|
||||||
|
height: "auto",
|
||||||
|
tip: false,
|
||||||
|
searchShow: true,
|
||||||
|
searchMenuSpan: 6,
|
||||||
|
border: true,
|
||||||
|
menuWidth: 150,
|
||||||
|
dialogClickModal: false,
|
||||||
|
dialogType: "drawer",
|
||||||
|
dialogFullscreen: true,
|
||||||
|
addBtn: false,
|
||||||
|
editBtn: false,
|
||||||
|
delBtn: false,
|
||||||
|
index: true,
|
||||||
|
indexLabel: "序号",
|
||||||
|
column: [
|
||||||
|
{
|
||||||
|
label: "工作站主体",
|
||||||
|
prop: "companyName",
|
||||||
|
display: false,
|
||||||
|
search: true,
|
||||||
|
searchLabelWidth: 89,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "工作站",
|
||||||
|
prop: "stationName",
|
||||||
|
display: false,
|
||||||
|
search: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "结算人数",
|
||||||
|
prop: "userNum",
|
||||||
|
display: false,
|
||||||
|
slot: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "结算金额",
|
||||||
|
prop: "totalSys",
|
||||||
|
display: false,
|
||||||
|
slot: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "结算比例",
|
||||||
|
prop: "ratio",
|
||||||
|
display: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "结算月份",
|
||||||
|
prop: "month",
|
||||||
|
display: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "结算状态",
|
||||||
|
type: "select",
|
||||||
|
prop: "status",
|
||||||
|
display: false,
|
||||||
|
search: true,
|
||||||
|
searchSpan: 4,
|
||||||
|
dicData: [
|
||||||
|
{ label: "未结算", value: 0 },
|
||||||
|
{ label: "已结算", value: 1 },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "结算日期",
|
||||||
|
prop: "accountTime",
|
||||||
|
display: false,
|
||||||
|
width: 145,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
data: [],
|
||||||
|
};
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
...mapGetters(["userInfo", "permission"]),
|
||||||
|
permissionList() {
|
||||||
|
return {};
|
||||||
|
},
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
initData() {
|
||||||
|
this.onLoad(this.page, this.query);
|
||||||
|
},
|
||||||
|
handleView(row) {
|
||||||
|
this.$refs.detail.open(row.id);
|
||||||
|
},
|
||||||
|
handleAccount(row) {
|
||||||
|
row;
|
||||||
|
let h = this.$createElement;
|
||||||
|
this.$prompt(
|
||||||
|
h("p", { style: "color: #F56C6C" }, "一旦确定则无法修改"),
|
||||||
|
"您确定已经结算费用了?",
|
||||||
|
{
|
||||||
|
confirmButtonText: "确定",
|
||||||
|
cancelButtonText: "取消",
|
||||||
|
type: "warning",
|
||||||
|
center: true,
|
||||||
|
inputPlaceholder: "结算金额",
|
||||||
|
inputValidator(val) {
|
||||||
|
if (isNaN(parseFloat(val))) {
|
||||||
|
return "输入的金额格式不正确";
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
.then(() => {
|
||||||
|
this.$message({
|
||||||
|
type: "success",
|
||||||
|
message: "操作成功!",
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch(() => {});
|
||||||
|
},
|
||||||
|
searchReset() {
|
||||||
|
this.query = {};
|
||||||
|
this.onLoad(this.page);
|
||||||
|
},
|
||||||
|
searchChange(params, done) {
|
||||||
|
this.query = params;
|
||||||
|
this.page.currentPage = 1;
|
||||||
|
this.onLoad(this.page, params);
|
||||||
|
done();
|
||||||
|
},
|
||||||
|
beforeOpen(done, type) {
|
||||||
|
if (["add", "edit"].includes(type)) {
|
||||||
|
this.initData();
|
||||||
|
}
|
||||||
|
if (["edit", "view"].includes(type)) {
|
||||||
|
// getStation(this.form.id).then(res => {
|
||||||
|
// this.form = res.data.data;
|
||||||
|
// });
|
||||||
|
}
|
||||||
|
done();
|
||||||
|
},
|
||||||
|
beforeClose(done) {
|
||||||
|
done();
|
||||||
|
},
|
||||||
|
currentChange(currentPage) {
|
||||||
|
this.page.currentPage = currentPage;
|
||||||
|
},
|
||||||
|
sizeChange(pageSize) {
|
||||||
|
this.page.pageSize = pageSize;
|
||||||
|
},
|
||||||
|
refreshChange() {
|
||||||
|
this.onLoad(this.page, this.query);
|
||||||
|
},
|
||||||
|
onLoad(page, params = {}) {
|
||||||
|
this.loading = true;
|
||||||
|
getList(
|
||||||
|
page.currentPage,
|
||||||
|
page.pageSize,
|
||||||
|
Object.assign(this.query, params)
|
||||||
|
).then((res) => {
|
||||||
|
const data = res.data.data;
|
||||||
|
this.page.total = data.total;
|
||||||
|
this.data = data.records;
|
||||||
|
this.loading = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
moneyFormat,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
</style>
|
||||||
148
src/views/manage/station/accountDetail.vue
Normal file
148
src/views/manage/station/accountDetail.vue
Normal file
@@ -0,0 +1,148 @@
|
|||||||
|
<template>
|
||||||
|
<el-drawer title="详情" :visible.sync="drawer" size="60%">
|
||||||
|
<avue-crud
|
||||||
|
:option="option"
|
||||||
|
:table-loading="loading"
|
||||||
|
:data="data"
|
||||||
|
ref="crud"
|
||||||
|
v-model="form"
|
||||||
|
@search-change="searchChange"
|
||||||
|
@search-reset="searchReset"
|
||||||
|
@current-change="currentChange"
|
||||||
|
@size-change="sizeChange"
|
||||||
|
@refresh-change="refreshChange"
|
||||||
|
@on-load="onLoad"
|
||||||
|
>
|
||||||
|
<template slot="userNum" slot-scope="{row}">
|
||||||
|
<span>{{row.userNum}} 人</span>
|
||||||
|
</template>
|
||||||
|
<template slot="serviceFee" slot-scope="{row}">
|
||||||
|
<span v-if="!row.serviceFee && row.serviceFee!== 0">-</span>
|
||||||
|
<span v-else>¥{{moneyFormat(row.serviceFee)}}</span>
|
||||||
|
</template>
|
||||||
|
<template slot="total" slot-scope="{row}">
|
||||||
|
<span v-if="!row.total && row.total!== 0">-</span>
|
||||||
|
<span v-else>¥{{moneyFormat(row.total)}}</span>
|
||||||
|
</template>
|
||||||
|
</avue-crud>
|
||||||
|
</el-drawer>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { getDetail } from "@/api/manage/account";
|
||||||
|
import { moneyFormat } from "@/util/money";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
id: null,
|
||||||
|
form: {},
|
||||||
|
query: {},
|
||||||
|
loading: true,
|
||||||
|
page: {
|
||||||
|
pageSize: 10,
|
||||||
|
currentPage: 1,
|
||||||
|
total: 0,
|
||||||
|
},
|
||||||
|
drawer: false,
|
||||||
|
option: {
|
||||||
|
height: "auto",
|
||||||
|
tip: false,
|
||||||
|
searchShow: true,
|
||||||
|
searchMenuSpan: 6,
|
||||||
|
border: true,
|
||||||
|
dialogClickModal: false,
|
||||||
|
menu: false,
|
||||||
|
addBtn: false,
|
||||||
|
column: [
|
||||||
|
{
|
||||||
|
label: "公司名称",
|
||||||
|
prop: "companyName",
|
||||||
|
display: false,
|
||||||
|
search: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "结算人数",
|
||||||
|
prop: "userNum",
|
||||||
|
display: false,
|
||||||
|
slot: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "服务费",
|
||||||
|
prop: "serviceFee",
|
||||||
|
display: false,
|
||||||
|
slot: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "结算比例",
|
||||||
|
prop: "ratio",
|
||||||
|
display: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "结算期",
|
||||||
|
prop: "month",
|
||||||
|
display: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "结算金额",
|
||||||
|
prop: "total",
|
||||||
|
display: false,
|
||||||
|
slot: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
data: [],
|
||||||
|
};
|
||||||
|
},
|
||||||
|
computed: {},
|
||||||
|
methods: {
|
||||||
|
initData() {
|
||||||
|
this.onLoad(this.page, this.query);
|
||||||
|
},
|
||||||
|
searchReset() {
|
||||||
|
this.query = {};
|
||||||
|
this.onLoad(this.page);
|
||||||
|
},
|
||||||
|
searchChange(params, done) {
|
||||||
|
this.query = params;
|
||||||
|
this.page.currentPage = 1;
|
||||||
|
this.onLoad(this.page, params);
|
||||||
|
done();
|
||||||
|
},
|
||||||
|
currentChange(currentPage) {
|
||||||
|
this.page.currentPage = currentPage;
|
||||||
|
},
|
||||||
|
sizeChange(pageSize) {
|
||||||
|
this.page.pageSize = pageSize;
|
||||||
|
},
|
||||||
|
refreshChange() {
|
||||||
|
this.onLoad(this.page, this.query);
|
||||||
|
},
|
||||||
|
onLoad(page, params = {}) {
|
||||||
|
this.loading = true;
|
||||||
|
getDetail(
|
||||||
|
page.currentPage,
|
||||||
|
page.pageSize,
|
||||||
|
Object.assign(this.query, params),
|
||||||
|
this.id
|
||||||
|
).then((res) => {
|
||||||
|
const data = res.data.data;
|
||||||
|
this.page.total = data.total;
|
||||||
|
this.data = data.records;
|
||||||
|
this.loading = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
open(id) {
|
||||||
|
this.id = id;
|
||||||
|
this.drawer = true;
|
||||||
|
this.page.currentPage = 1;
|
||||||
|
this.query = {};
|
||||||
|
this.onLoad(this.page, this.query);
|
||||||
|
},
|
||||||
|
moneyFormat,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
</style>
|
||||||
106
src/views/manage/station/accountNumber/companyTree.vue
Normal file
106
src/views/manage/station/accountNumber/companyTree.vue
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
<template>
|
||||||
|
<basic-container v-loading="loading">
|
||||||
|
<el-input
|
||||||
|
ref="search"
|
||||||
|
size="small"
|
||||||
|
prefix-icon="el-icon-search"
|
||||||
|
placeholder="搜索公司"
|
||||||
|
v-model="query.companyName"
|
||||||
|
clearable
|
||||||
|
></el-input>
|
||||||
|
<div class="company-tree" ref="tree" :style="{height:height+'px','margin-top':'5px'}">
|
||||||
|
<el-tree :data="data" :props="defaultProps" @node-click="handleNodeClick"></el-tree>
|
||||||
|
</div>
|
||||||
|
<el-pagination
|
||||||
|
ref="pagination"
|
||||||
|
layout="prev, pager, next"
|
||||||
|
:total="page.total"
|
||||||
|
:page-size="page.pageSize"
|
||||||
|
@current-change="currentChange"
|
||||||
|
></el-pagination>
|
||||||
|
</basic-container>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { companyStationInfo } from "@/api/manage/main";
|
||||||
|
import _ from "lodash";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
loading: true,
|
||||||
|
height: 100,
|
||||||
|
data: [],
|
||||||
|
page: {
|
||||||
|
pageSize: 30,
|
||||||
|
currentPage: 1,
|
||||||
|
total: 0,
|
||||||
|
},
|
||||||
|
defaultProps: {
|
||||||
|
children: "children",
|
||||||
|
// label: "companyName",
|
||||||
|
label: (data, node) => {
|
||||||
|
if (node.level === 1) {
|
||||||
|
return `${data.companyName}-${data.stationName}`
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
query: {
|
||||||
|
companyName: null,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.onLoad(this.page, this.query);
|
||||||
|
this.getTreeHeight();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
handleNodeClick(data, vNode, node) {
|
||||||
|
this.$emit("node-click", { data, vNode, node });
|
||||||
|
},
|
||||||
|
onLoad(page, param) {
|
||||||
|
companyStationInfo(page.currentPage, page.pageSize, param)
|
||||||
|
.then((resp) => {
|
||||||
|
const data = resp.data.data;
|
||||||
|
this.page.total = data.total;
|
||||||
|
console.log(data);
|
||||||
|
this.data = data.records;
|
||||||
|
this.loading = false;
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
this.lloading = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
queryChange: _.debounce(function () {
|
||||||
|
this.onLoad(this.page, this.query);
|
||||||
|
}, 1000),
|
||||||
|
currentChange(current) {
|
||||||
|
this.page.currentPage = current;
|
||||||
|
this.onLoad(this.page, this.query);
|
||||||
|
},
|
||||||
|
getTreeHeight() {
|
||||||
|
const pageStyle = this.$refs.pagination.$el;
|
||||||
|
const searchStyle = this.$refs.search.$el;
|
||||||
|
const treeStyle = this.$refs.tree;
|
||||||
|
this.height =
|
||||||
|
document.documentElement.clientHeight -
|
||||||
|
pageStyle.offsetTop -
|
||||||
|
searchStyle.offsetTop -
|
||||||
|
treeStyle.offsetTop -
|
||||||
|
10;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
"query.companyName": function () {
|
||||||
|
this.page.currentPage = 1;
|
||||||
|
this.queryChange();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.company-tree {
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
707
src/views/manage/station/accountNumber/index.vue
Normal file
707
src/views/manage/station/accountNumber/index.vue
Normal file
@@ -0,0 +1,707 @@
|
|||||||
|
<template>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="5">
|
||||||
|
<company-tree @node-click="handleNodeClick"></company-tree>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="19">
|
||||||
|
<basic-container>
|
||||||
|
<avue-crud
|
||||||
|
:option="option"
|
||||||
|
:table-loading="loading"
|
||||||
|
:data="data"
|
||||||
|
ref="crud"
|
||||||
|
v-model="form"
|
||||||
|
:permission="permissionList"
|
||||||
|
@row-del="rowDel"
|
||||||
|
@row-update="rowUpdate"
|
||||||
|
@row-save="rowSave"
|
||||||
|
:before-open="beforeOpen"
|
||||||
|
:page.sync="page"
|
||||||
|
@search-change="searchChange"
|
||||||
|
@search-reset="searchReset"
|
||||||
|
@selection-change="selectionChange"
|
||||||
|
@current-change="currentChange"
|
||||||
|
@size-change="sizeChange"
|
||||||
|
@refresh-change="refreshChange"
|
||||||
|
@on-load="onLoad"
|
||||||
|
>
|
||||||
|
<template slot="menuLeft">
|
||||||
|
<el-button
|
||||||
|
size="small"
|
||||||
|
plain
|
||||||
|
v-if="permission.manage_company_accountList_reset"
|
||||||
|
icon="el-icon-refresh"
|
||||||
|
@click="handleReset"
|
||||||
|
>密码重置</el-button
|
||||||
|
>
|
||||||
|
</template>
|
||||||
|
<template slot-scope="{ row }" slot="companyName">
|
||||||
|
<el-tag>{{ row.companyName }}</el-tag>
|
||||||
|
</template>
|
||||||
|
<template slot-scope="{ row }" slot="roleName">
|
||||||
|
<el-tag>{{ row.roleName }}</el-tag>
|
||||||
|
</template>
|
||||||
|
<template slot-scope="{ row }" slot="deptName">
|
||||||
|
<el-tag>{{ row.deptName }}</el-tag>
|
||||||
|
</template>
|
||||||
|
<template v-slot:menu="{ row }">
|
||||||
|
<el-button
|
||||||
|
v-if="row.status === 1"
|
||||||
|
@click="rowEnable(row)"
|
||||||
|
type="text"
|
||||||
|
size="small"
|
||||||
|
>启用</el-button
|
||||||
|
>
|
||||||
|
<el-button
|
||||||
|
v-if="row.status === 0"
|
||||||
|
@click="rowDisable(row)"
|
||||||
|
type="text"
|
||||||
|
size="small"
|
||||||
|
>停用</el-button
|
||||||
|
>
|
||||||
|
</template>
|
||||||
|
</avue-crud>
|
||||||
|
<el-dialog
|
||||||
|
title="用户角色配置"
|
||||||
|
append-to-body
|
||||||
|
:visible.sync="roleBox"
|
||||||
|
width="345px"
|
||||||
|
>
|
||||||
|
<el-tree
|
||||||
|
:data="roleGrantList"
|
||||||
|
show-checkbox
|
||||||
|
default-expand-all
|
||||||
|
node-key="id"
|
||||||
|
ref="treeRole"
|
||||||
|
:default-checked-keys="roleTreeObj"
|
||||||
|
:props="props"
|
||||||
|
></el-tree>
|
||||||
|
|
||||||
|
<span slot="footer" class="dialog-footer">
|
||||||
|
<el-button @click="roleBox = false">取 消</el-button>
|
||||||
|
<el-button type="primary" @click="submitRole">确 定</el-button>
|
||||||
|
</span>
|
||||||
|
</el-dialog>
|
||||||
|
<el-dialog
|
||||||
|
title="用户数据导入"
|
||||||
|
append-to-body
|
||||||
|
:visible.sync="excelBox"
|
||||||
|
width="555px"
|
||||||
|
>
|
||||||
|
<avue-form
|
||||||
|
:option="excelOption"
|
||||||
|
v-model="excelForm"
|
||||||
|
:upload-after="uploadAfter"
|
||||||
|
:upload-error="uploadError"
|
||||||
|
>
|
||||||
|
<template slot="excelTemplate">
|
||||||
|
<el-button type="primary" @click="handleTemplate()">
|
||||||
|
点击下载
|
||||||
|
<i class="el-icon-download el-icon--right"></i>
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
</avue-form>
|
||||||
|
</el-dialog>
|
||||||
|
</basic-container>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import {
|
||||||
|
update,
|
||||||
|
grant,
|
||||||
|
resetPassword,
|
||||||
|
} from "@/api/system/user";
|
||||||
|
import { tuserList, disableUser, enableUser } from '@/api/manage/main'
|
||||||
|
import { getDeptTree } from "@/api/system/dept";
|
||||||
|
import { getRoleTree } from "@/api/system/role";
|
||||||
|
import { mapGetters } from "vuex";
|
||||||
|
import website from "@/config/website";
|
||||||
|
import { getToken } from "@/util/auth";
|
||||||
|
import companyTree from "./companyTree";
|
||||||
|
import { isMobile, check18IdCardNo } from "@/util/validate";
|
||||||
|
import { excelAccept } from "@/common/accept";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: { companyTree },
|
||||||
|
name: "manage_station_accountNumber",
|
||||||
|
data() {
|
||||||
|
const validatePass = (rule, value, callback) => {
|
||||||
|
if (value === "") {
|
||||||
|
callback(new Error("请输入密码"));
|
||||||
|
} else {
|
||||||
|
callback();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const validatePass2 = (rule, value, callback) => {
|
||||||
|
if (value === "") {
|
||||||
|
callback(new Error("请再次输入密码"));
|
||||||
|
} else if (value !== this.form.password) {
|
||||||
|
callback(new Error("两次输入密码不一致!"));
|
||||||
|
} else {
|
||||||
|
callback();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const validateMobile = (rule, value, callback) => {
|
||||||
|
if (isMobile(value)) {
|
||||||
|
callback();
|
||||||
|
} else {
|
||||||
|
callback(new Error("手机号格式不正确"));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
return {
|
||||||
|
form: {},
|
||||||
|
roleBox: false,
|
||||||
|
excelBox: false,
|
||||||
|
selectionList: [],
|
||||||
|
query: {},
|
||||||
|
loading: false,
|
||||||
|
page: {
|
||||||
|
pageSize: 10,
|
||||||
|
currentPage: 1,
|
||||||
|
total: 0,
|
||||||
|
},
|
||||||
|
init: {
|
||||||
|
roleTree: [],
|
||||||
|
deptTree: [],
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
label: "title",
|
||||||
|
value: "key",
|
||||||
|
},
|
||||||
|
roleGrantList: [],
|
||||||
|
roleTreeObj: [],
|
||||||
|
tenantId: "",
|
||||||
|
tenantData: [],
|
||||||
|
option: {
|
||||||
|
height: "auto",
|
||||||
|
calcHeight: 186,
|
||||||
|
tip: false,
|
||||||
|
searchShow: true,
|
||||||
|
searchMenuSpan: 6,
|
||||||
|
border: true,
|
||||||
|
index: true,
|
||||||
|
indexLabel: "序号",
|
||||||
|
selection: true,
|
||||||
|
addBtn: false,
|
||||||
|
delBtn: false,
|
||||||
|
viewBtn: true,
|
||||||
|
dialogType: "drawer",
|
||||||
|
dialogClickModal: false,
|
||||||
|
column: [
|
||||||
|
{
|
||||||
|
label: "登录账号",
|
||||||
|
prop: "account",
|
||||||
|
search: true,
|
||||||
|
display: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "用户姓名",
|
||||||
|
prop: "realName",
|
||||||
|
search: true,
|
||||||
|
display: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "所属角色",
|
||||||
|
prop: "roleName",
|
||||||
|
slot: true,
|
||||||
|
display: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "所属部门",
|
||||||
|
prop: "deptName",
|
||||||
|
slot: true,
|
||||||
|
display: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "状态",
|
||||||
|
prop: "status",
|
||||||
|
type: "select",
|
||||||
|
display: false,
|
||||||
|
dicData: [
|
||||||
|
{ label: "启用", value: 0 },
|
||||||
|
{ label: "停用", value: 1 },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
group: [
|
||||||
|
{
|
||||||
|
label: "基础信息",
|
||||||
|
prop: "baseInfo",
|
||||||
|
icon: "el-icon-user-solid",
|
||||||
|
column: [
|
||||||
|
{
|
||||||
|
label: "登录账号",
|
||||||
|
prop: "account",
|
||||||
|
editDisabled: true,
|
||||||
|
rules: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: "请输入登录手机号",
|
||||||
|
trigger: "blur",
|
||||||
|
},
|
||||||
|
{ validator: validateMobile, trigger: "blur" },
|
||||||
|
],
|
||||||
|
span: website.tenantMode ? 12 : 24,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "密码",
|
||||||
|
prop: "password",
|
||||||
|
hide: true,
|
||||||
|
editDisplay: false,
|
||||||
|
viewDisplay: false,
|
||||||
|
rules: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
whitespace: true,
|
||||||
|
validator: validatePass,
|
||||||
|
trigger: "blur",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "确认密码",
|
||||||
|
prop: "password2",
|
||||||
|
hide: true,
|
||||||
|
editDisplay: false,
|
||||||
|
viewDisplay: false,
|
||||||
|
rules: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
whitespace: true,
|
||||||
|
validator: validatePass2,
|
||||||
|
trigger: "blur",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "详细信息",
|
||||||
|
prop: "detailInfo",
|
||||||
|
icon: "el-icon-s-order",
|
||||||
|
column: [
|
||||||
|
{
|
||||||
|
label: "用户姓名",
|
||||||
|
prop: "realName",
|
||||||
|
hide: true,
|
||||||
|
rules: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
whitespace: true,
|
||||||
|
message: "请输入用户姓名",
|
||||||
|
trigger: "blur",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "身份证号",
|
||||||
|
prop: "idNumber",
|
||||||
|
overHidden: true,
|
||||||
|
rules: [
|
||||||
|
{
|
||||||
|
validator: (rule, value, callback) => {
|
||||||
|
if (check18IdCardNo(value)) {
|
||||||
|
callback();
|
||||||
|
} else {
|
||||||
|
callback(new Error("身份证格式不正确"));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "电子邮箱",
|
||||||
|
prop: "email",
|
||||||
|
hide: true,
|
||||||
|
overHidden: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "用户性别",
|
||||||
|
prop: "sex",
|
||||||
|
type: "select",
|
||||||
|
dicData: [
|
||||||
|
{
|
||||||
|
label: "男",
|
||||||
|
value: 1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "女",
|
||||||
|
value: 2,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "不限",
|
||||||
|
value: -1,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
hide: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "用户生日",
|
||||||
|
type: "date",
|
||||||
|
prop: "birthday",
|
||||||
|
format: "yyyy-MM-dd hh:mm:ss",
|
||||||
|
valueFormat: "yyyy-MM-dd hh:mm:ss",
|
||||||
|
hide: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "账号状态",
|
||||||
|
prop: "statusName",
|
||||||
|
hide: true,
|
||||||
|
display: false,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
// {
|
||||||
|
// label: "职责信息",
|
||||||
|
// prop: "dutyInfo",
|
||||||
|
// icon: "el-icon-s-custom",
|
||||||
|
// column: [
|
||||||
|
// {
|
||||||
|
// label: "所属角色",
|
||||||
|
// prop: "roleId",
|
||||||
|
// multiple: false,
|
||||||
|
// type: "tree",
|
||||||
|
// dicData: [],
|
||||||
|
// props: {
|
||||||
|
// label: "title",
|
||||||
|
// },
|
||||||
|
// checkStrictly: true,
|
||||||
|
// slot: true,
|
||||||
|
// rules: [
|
||||||
|
// {
|
||||||
|
// required: true,
|
||||||
|
// whitespace: true,
|
||||||
|
// message: "请选择所属角色",
|
||||||
|
// trigger: "click",
|
||||||
|
// },
|
||||||
|
// ],
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// label: "所属部门",
|
||||||
|
// prop: "deptId",
|
||||||
|
// type: "tree",
|
||||||
|
// multiple: false,
|
||||||
|
// dicData: [],
|
||||||
|
// props: {
|
||||||
|
// label: "title",
|
||||||
|
// },
|
||||||
|
// checkStrictly: true,
|
||||||
|
// slot: true,
|
||||||
|
// rules: [
|
||||||
|
// {
|
||||||
|
// required: true,
|
||||||
|
// message: "请选择所属部门",
|
||||||
|
// trigger: "click",
|
||||||
|
// },
|
||||||
|
// ],
|
||||||
|
// },
|
||||||
|
// ],
|
||||||
|
// },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
data: [],
|
||||||
|
excelForm: {},
|
||||||
|
excelOption: {
|
||||||
|
submitBtn: false,
|
||||||
|
emptyBtn: false,
|
||||||
|
column: [
|
||||||
|
{
|
||||||
|
label: "文件上传",
|
||||||
|
prop: "excelFile",
|
||||||
|
type: "upload",
|
||||||
|
drag: true,
|
||||||
|
loadText: "文件上传中,请稍等",
|
||||||
|
span: 24,
|
||||||
|
propsHttp: {
|
||||||
|
res: "data",
|
||||||
|
},
|
||||||
|
tip: "请上传 .xls,.xlsx 标准格式文件",
|
||||||
|
action: "/api/jobslink-api/system/tuser/import-user",
|
||||||
|
accept: excelAccept,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "数据覆盖",
|
||||||
|
prop: "isCovered",
|
||||||
|
type: "switch",
|
||||||
|
align: "center",
|
||||||
|
width: 80,
|
||||||
|
dicData: [
|
||||||
|
{
|
||||||
|
label: "否",
|
||||||
|
value: 0,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "是",
|
||||||
|
value: 1,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
value: 0,
|
||||||
|
slot: true,
|
||||||
|
rules: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: "请选择是否覆盖",
|
||||||
|
trigger: "blur",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "模板下载",
|
||||||
|
prop: "excelTemplate",
|
||||||
|
formslot: true,
|
||||||
|
span: 24,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
"form.tenantId"() {
|
||||||
|
if (this.form.tenantId !== "") {
|
||||||
|
// this.initData(this.form.tenantId);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"excelForm.isCovered"() {
|
||||||
|
if (this.excelForm.isCovered !== "") {
|
||||||
|
const column = this.findObject(this.excelOption.column, "excelFile");
|
||||||
|
column.action = `/api/jobslink-api/system/tuser//import-user?isCovered=${this.excelForm.isCovered}`;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
...mapGetters(["userInfo", "permission"]),
|
||||||
|
permissionList() {
|
||||||
|
return {
|
||||||
|
addBtn: this.vaildData(this.permission.user_add, false),
|
||||||
|
viewBtn: this.vaildData(
|
||||||
|
this.permission.manage_company_accountList_view,
|
||||||
|
false
|
||||||
|
),
|
||||||
|
delBtn: this.vaildData(this.permission.user_delete, false),
|
||||||
|
editBtn: this.vaildData(this.permission.user_edit, false),
|
||||||
|
};
|
||||||
|
},
|
||||||
|
ids() {
|
||||||
|
let ids = [];
|
||||||
|
this.selectionList.forEach((ele) => {
|
||||||
|
ids.push(ele.id);
|
||||||
|
});
|
||||||
|
return ids.join(",");
|
||||||
|
},
|
||||||
|
},
|
||||||
|
mounted() {},
|
||||||
|
methods: {
|
||||||
|
initData(tenantId) {
|
||||||
|
getRoleTree(tenantId).then((res) => {
|
||||||
|
const column = this.findObject(this.option.group, "roleId");
|
||||||
|
column.dicData = res.data.data;
|
||||||
|
});
|
||||||
|
getDeptTree(tenantId).then((res) => {
|
||||||
|
const column = this.findObject(this.option.group, "deptId");
|
||||||
|
column.dicData = res.data.data;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
submitRole() {
|
||||||
|
const roleList = this.$refs.treeRole.getCheckedKeys().join(",");
|
||||||
|
grant(this.ids, roleList).then(() => {
|
||||||
|
this.roleBox = false;
|
||||||
|
this.$message({
|
||||||
|
type: "success",
|
||||||
|
message: "操作成功!",
|
||||||
|
});
|
||||||
|
this.onLoad(this.page);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
rowUpdate(row, index, done, loading) {
|
||||||
|
row['authType'] = 2
|
||||||
|
update(row).then(
|
||||||
|
() => {
|
||||||
|
this.onLoad(this.page);
|
||||||
|
this.$message({
|
||||||
|
type: "success",
|
||||||
|
message: "操作成功!",
|
||||||
|
});
|
||||||
|
done();
|
||||||
|
},
|
||||||
|
(error) => {
|
||||||
|
window.console.log(error);
|
||||||
|
loading();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
},
|
||||||
|
rowEnable(row) {
|
||||||
|
this.$confirm("您确定要启用此账号吗?", {
|
||||||
|
confirmButtonText: "确定",
|
||||||
|
cancelButtonText: "取消",
|
||||||
|
type: "warning",
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
this.loading = true;
|
||||||
|
return enableUser(row.id);
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
this.$message({
|
||||||
|
type: "success",
|
||||||
|
message: "操作成功!",
|
||||||
|
});
|
||||||
|
this.loading = false;
|
||||||
|
this.refreshChange();
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
this.loading = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
rowDisable(row) {
|
||||||
|
this.$confirm("您确定要停用此账号吗?", {
|
||||||
|
confirmButtonText: "确定",
|
||||||
|
cancelButtonText: "取消",
|
||||||
|
type: "warning",
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
this.loading = true;
|
||||||
|
return disableUser(row.id);
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
this.$message({
|
||||||
|
type: "success",
|
||||||
|
message: "操作成功!",
|
||||||
|
});
|
||||||
|
this.loading = false;
|
||||||
|
this.refreshChange();
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
this.loading = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
searchReset() {
|
||||||
|
this.query = {};
|
||||||
|
this.tenantId = "";
|
||||||
|
this.onLoad(this.page);
|
||||||
|
},
|
||||||
|
searchChange(params, done) {
|
||||||
|
this.query = params;
|
||||||
|
this.page.currentPage = 1;
|
||||||
|
this.onLoad(this.page, params);
|
||||||
|
done();
|
||||||
|
},
|
||||||
|
selectionChange(list) {
|
||||||
|
this.selectionList = list;
|
||||||
|
},
|
||||||
|
selectionClear() {
|
||||||
|
this.selectionList = [];
|
||||||
|
this.$refs.crud.toggleSelection();
|
||||||
|
},
|
||||||
|
handleReset() {
|
||||||
|
if (this.selectionList.length === 0) {
|
||||||
|
this.$message.warning("请选择至少一条数据");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.$confirm("确定将选择账号密码重置为手机号后六位吗?", {
|
||||||
|
confirmButtonText: "确定",
|
||||||
|
cancelButtonText: "取消",
|
||||||
|
type: "warning",
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
return resetPassword(this.ids);
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
this.$message({
|
||||||
|
type: "success",
|
||||||
|
message: "操作成功!",
|
||||||
|
});
|
||||||
|
this.$refs.crud.toggleSelection();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleGrant() {
|
||||||
|
if (this.selectionList.length === 0) {
|
||||||
|
this.$message.warning("请选择至少一条数据");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.roleTreeObj = [];
|
||||||
|
if (this.selectionList.length === 1) {
|
||||||
|
this.roleTreeObj = this.selectionList[0].roleId.split(",");
|
||||||
|
}
|
||||||
|
getRoleTree().then((res) => {
|
||||||
|
this.roleGrantList = res.data.data;
|
||||||
|
this.roleBox = true;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleImport() {
|
||||||
|
this.excelBox = true;
|
||||||
|
},
|
||||||
|
handleNodeClick({ data }) {
|
||||||
|
this.tenantId = data.tenantId;
|
||||||
|
this.page.currentPage = 1;
|
||||||
|
this.onLoad(this.page);
|
||||||
|
},
|
||||||
|
uploadAfter(res, done) {
|
||||||
|
this.refreshChange();
|
||||||
|
if (!(res instanceof Error)) {
|
||||||
|
this.excelBox = false;
|
||||||
|
}
|
||||||
|
done();
|
||||||
|
},
|
||||||
|
uploadError(error) {
|
||||||
|
if (error) {
|
||||||
|
this.$message.error(error);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handleExport() {
|
||||||
|
this.$confirm("是否导出用户数据?", "提示", {
|
||||||
|
confirmButtonText: "确定",
|
||||||
|
cancelButtonText: "取消",
|
||||||
|
type: "warning",
|
||||||
|
}).then(() => {
|
||||||
|
const searchForm = this.$refs.crud.searchForm;
|
||||||
|
window.open(
|
||||||
|
`/api/jobslink-api/system/tuser/export-user?Jobslink-Auth=${getToken()}&account=${
|
||||||
|
searchForm.account
|
||||||
|
}&realName=${searchForm.realName}`
|
||||||
|
);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleTemplate() {
|
||||||
|
window.open(
|
||||||
|
`/api/jobslink-api/system/tuser/export-template?Jobslink-Auth=${getToken()}`
|
||||||
|
);
|
||||||
|
},
|
||||||
|
beforeOpen(done, type) {
|
||||||
|
if (["edit", "view"].includes(type)) {
|
||||||
|
//预留
|
||||||
|
}
|
||||||
|
done();
|
||||||
|
},
|
||||||
|
currentChange(currentPage) {
|
||||||
|
this.page.currentPage = currentPage;
|
||||||
|
},
|
||||||
|
sizeChange(pageSize) {
|
||||||
|
this.page.pageSize = pageSize;
|
||||||
|
},
|
||||||
|
refreshChange() {
|
||||||
|
this.onLoad(this.page, this.query);
|
||||||
|
},
|
||||||
|
onLoad(page, params = {}) {
|
||||||
|
if (this.tenantId) {
|
||||||
|
this.loading = true;
|
||||||
|
tuserList(
|
||||||
|
page.currentPage,
|
||||||
|
page.pageSize,
|
||||||
|
Object.assign(this.query, params),
|
||||||
|
this.tenantId
|
||||||
|
).then((res) => {
|
||||||
|
const data = res.data.data;
|
||||||
|
this.page.total = data.total;
|
||||||
|
this.data = data.records;
|
||||||
|
this.loading = false;
|
||||||
|
this.selectionClear();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
</style>
|
||||||
598
src/views/manage/station/inviteCode.vue
Normal file
598
src/views/manage/station/inviteCode.vue
Normal file
@@ -0,0 +1,598 @@
|
|||||||
|
<template>
|
||||||
|
<basic-container>
|
||||||
|
<avue-crud
|
||||||
|
ref="crud"
|
||||||
|
:option="option"
|
||||||
|
:data="data"
|
||||||
|
@on-load="onLoad"
|
||||||
|
:page.sync="page"
|
||||||
|
:permission="permissionList"
|
||||||
|
@row-save="rowSave"
|
||||||
|
@current-change="currentChange"
|
||||||
|
@size-change="sizeChange"
|
||||||
|
@row-update="rowUpdate"
|
||||||
|
@refresh-change="refreshChange"
|
||||||
|
@search-change="searchChange"
|
||||||
|
@search-reset="searchReset"
|
||||||
|
v-model="form"
|
||||||
|
:table-loading="loading"
|
||||||
|
>
|
||||||
|
<template slot="status" slot-scope="{ row }">{{ row.status }}</template>
|
||||||
|
<template slot="menuLeft">
|
||||||
|
<el-button
|
||||||
|
v-if="vaildData(permission.manage_station_inviteCode_upload, false)"
|
||||||
|
size="small"
|
||||||
|
@click.stop="handleImport"
|
||||||
|
type="primary"
|
||||||
|
>批量上传</el-button
|
||||||
|
>
|
||||||
|
<el-button
|
||||||
|
size="small"
|
||||||
|
@click.stop="distributionCode"
|
||||||
|
type="primary"
|
||||||
|
>分配邀请码</el-button
|
||||||
|
>
|
||||||
|
</template>
|
||||||
|
<template v-slot:menu="{ row }">
|
||||||
|
<el-button
|
||||||
|
type="text"
|
||||||
|
size="small"
|
||||||
|
@click.stop="rowEdit(row)"
|
||||||
|
v-if="
|
||||||
|
row.status === '未绑定' &&
|
||||||
|
vaildData(permission.manage_station_inviteCode_edit, false)
|
||||||
|
"
|
||||||
|
>绑定</el-button
|
||||||
|
>
|
||||||
|
</template>
|
||||||
|
</avue-crud>
|
||||||
|
<el-dialog
|
||||||
|
title="批量上传"
|
||||||
|
append-to-body
|
||||||
|
:visible.sync="excelBox"
|
||||||
|
width="555px"
|
||||||
|
>
|
||||||
|
<avue-form
|
||||||
|
:option="excelOption"
|
||||||
|
v-model="excelForm"
|
||||||
|
:upload-after="uploadAfter"
|
||||||
|
:upload-before="beforeAvatarUpload"
|
||||||
|
:upload-error="uploadError"
|
||||||
|
>
|
||||||
|
<template slot="excelTemplate">
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
@click="handleTemplate()"
|
||||||
|
:loading="templateLoading"
|
||||||
|
>
|
||||||
|
点击下载
|
||||||
|
<i class="el-icon-download el-icon--right"></i>
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
</avue-form>
|
||||||
|
</el-dialog>
|
||||||
|
|
||||||
|
<!-- 分配邀请码 -->
|
||||||
|
<el-dialog
|
||||||
|
title="分配邀请码"
|
||||||
|
:visible.sync="distributionCodeDialog"
|
||||||
|
append-to-body
|
||||||
|
width="30%">
|
||||||
|
<el-form :model="inviteCodeForm" :rules="inviteCodeRules" ref="inviteCode" label-width="100px" class="demo-ruleForm">
|
||||||
|
<el-form-item label="工作站:" prop="stationId">
|
||||||
|
<el-select v-model="inviteCodeForm.stationId" placeholder="请选择" @change="inviteCodeName"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in stationIdList"
|
||||||
|
:key="item.stationId"
|
||||||
|
:label="item.stationName"
|
||||||
|
:value="item.stationId">
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="分配数量:" prop="strip">
|
||||||
|
<span class="inviteCodeStrip"
|
||||||
|
:class="{'inviteCodeStripActive': inviteCodeForm.count === 5}"
|
||||||
|
style="margin-right: 10px;"
|
||||||
|
@click="inviteCodeForm.count = 5">5</span>
|
||||||
|
<span class="inviteCodeStrip"
|
||||||
|
:class="{'inviteCodeStripActive':
|
||||||
|
inviteCodeForm.count === 10}"
|
||||||
|
@click="inviteCodeForm.count = 10">10</span>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<span slot="footer" class="dialog-footer">
|
||||||
|
<el-button @click="inviteCodeClose">取 消</el-button>
|
||||||
|
<el-button type="primary" @click="inviteCodeSubmit">确 定</el-button>
|
||||||
|
</span>
|
||||||
|
</el-dialog>
|
||||||
|
|
||||||
|
<el-dialog
|
||||||
|
title="分配邀请码"
|
||||||
|
:visible.sync="qRCodeDialog"
|
||||||
|
append-to-body
|
||||||
|
width="30%">
|
||||||
|
<div>
|
||||||
|
<p>您当前选择了 <span style="color: red;">{{inviteCodeForm.count}}</span> 条邀请码,确定分配给 <span style="color:red;">{{inviteCodeFormName}}</span> 吗?</p>
|
||||||
|
</div>
|
||||||
|
<span slot="footer" class="dialog-footer">
|
||||||
|
<el-button @click="qRCodeDialog = false">取 消</el-button>
|
||||||
|
<el-button type="primary" :loading="codeLoading" @click="qRCodeDialogOk">确 定</el-button>
|
||||||
|
</span>
|
||||||
|
</el-dialog>
|
||||||
|
</basic-container>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { mapGetters } from "vuex";
|
||||||
|
import { getList, add, edit, importInviteCode, inviteAllocation } from "@/api/manage/inviteCode";
|
||||||
|
import { check18IdCardNo, isExcel, isMobile } from "@/util/validate";
|
||||||
|
import { getTemplate } from "@/api/resource/template";
|
||||||
|
import { getStationDic, StationDic } from "@/api/manage/station";
|
||||||
|
import { excelAccept } from "@/common/accept";
|
||||||
|
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "manage_station_inviteCode",
|
||||||
|
data() {
|
||||||
|
const validateMobile = (rule, value, callback) => {
|
||||||
|
if (value == "") {
|
||||||
|
callback(new Error("请输入手机号"));
|
||||||
|
} else {
|
||||||
|
if (isMobile(value)) {
|
||||||
|
callback();
|
||||||
|
} else {
|
||||||
|
callback(new Error("手机号格式不正确"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const validateIdNum = (rule, value, callback) => {
|
||||||
|
if (value == "") {
|
||||||
|
callback(new Error("请输入身份证"));
|
||||||
|
} else {
|
||||||
|
if (check18IdCardNo(value)) {
|
||||||
|
callback();
|
||||||
|
} else {
|
||||||
|
callback(new Error("身份证格式不正确"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
return {
|
||||||
|
inviteCodeForm: {
|
||||||
|
count: 5
|
||||||
|
},
|
||||||
|
inviteCodeRules: {
|
||||||
|
stationId: [
|
||||||
|
{ required: true, message: '请选择工作站', trigger: 'blur' }
|
||||||
|
],
|
||||||
|
count: [
|
||||||
|
{ required: true, message: '请选择数量', trigger: 'blur' }
|
||||||
|
],
|
||||||
|
},
|
||||||
|
stationIdList: [],
|
||||||
|
distributionCodeDialog: false,
|
||||||
|
qRCodeDialog: false,
|
||||||
|
inviteCodeFormName: '',
|
||||||
|
searchTxt: "",
|
||||||
|
excelBox: false,
|
||||||
|
excelForm: {},
|
||||||
|
|
||||||
|
query: {},
|
||||||
|
file: {},
|
||||||
|
option: {
|
||||||
|
index: true,
|
||||||
|
indexLabel: "序号",
|
||||||
|
idKey: "id",
|
||||||
|
delBtn: false,
|
||||||
|
border: true,
|
||||||
|
editBtn: false,
|
||||||
|
searchShow: true,
|
||||||
|
searchMenuSpan: 4,
|
||||||
|
loading:true,
|
||||||
|
column: [
|
||||||
|
{
|
||||||
|
label: "所属分组",
|
||||||
|
prop: "groupType",
|
||||||
|
search: true,
|
||||||
|
searchSpan: 4,
|
||||||
|
type: "select",
|
||||||
|
rules: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: "请选择所属分组",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
dicData: [
|
||||||
|
{
|
||||||
|
label: "企嘉云",
|
||||||
|
value: 0,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "人保",
|
||||||
|
value: 1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "灯塔中心",
|
||||||
|
value: 3,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
type: "tree",
|
||||||
|
label: "所属工作站",
|
||||||
|
prop: "stationId",
|
||||||
|
//display: false,
|
||||||
|
search: true,
|
||||||
|
searchSpan: 4,
|
||||||
|
searchLabelWidth: 87,
|
||||||
|
dicUrl: getStationDic(),
|
||||||
|
props: {
|
||||||
|
label: "stationName",
|
||||||
|
value: "stationId",
|
||||||
|
},
|
||||||
|
dicFormatter(resp) {
|
||||||
|
return resp.data;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "邀请码",
|
||||||
|
prop: "inviteCode",
|
||||||
|
search: true,
|
||||||
|
searchSpan: 4,
|
||||||
|
rules: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: "请输入邀请码",
|
||||||
|
trigger: "blur",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
|
||||||
|
editDisabled: true,
|
||||||
|
maxlength:14,
|
||||||
|
showWordLimit:true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "姓名",
|
||||||
|
prop: "realName",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "身份证号",
|
||||||
|
prop: "idNumber",
|
||||||
|
rules: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
validator: validateIdNum,
|
||||||
|
trigger: "blur",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "手机号",
|
||||||
|
prop: "phone",
|
||||||
|
rules: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
validator: validateMobile,
|
||||||
|
trigger: "blur",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "状态",
|
||||||
|
prop: "status",
|
||||||
|
search: true,
|
||||||
|
searchSpan: 4,
|
||||||
|
type: "select",
|
||||||
|
dicData: [
|
||||||
|
{
|
||||||
|
label: "已绑定",
|
||||||
|
value: 1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "未绑定",
|
||||||
|
value: 0,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
display: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "是否分配",
|
||||||
|
prop: "isEnabled",
|
||||||
|
search: true,
|
||||||
|
searchSpan: 4,
|
||||||
|
type: "select",
|
||||||
|
dicData: [
|
||||||
|
{
|
||||||
|
label: "已分配",
|
||||||
|
value: 1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "未分配",
|
||||||
|
value: 0,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
display: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "备注",
|
||||||
|
prop: "remarks",
|
||||||
|
display: false,
|
||||||
|
hide: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
data: [],
|
||||||
|
page: {
|
||||||
|
currentPage: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
total: 0,
|
||||||
|
},
|
||||||
|
codeLoading: false
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
created() {
|
||||||
|
StationDic().then(res => {
|
||||||
|
this.stationIdList = res.data.data
|
||||||
|
})
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
...mapGetters(["permission"]),
|
||||||
|
permissionList() {
|
||||||
|
return {
|
||||||
|
addBtn: this.vaildData(
|
||||||
|
this.permission.manage_station_inviteCode_add,
|
||||||
|
false
|
||||||
|
),
|
||||||
|
};
|
||||||
|
},
|
||||||
|
excelOption() {
|
||||||
|
return {
|
||||||
|
submitBtn: false,
|
||||||
|
emptyBtn: false,
|
||||||
|
templateLoading: false,
|
||||||
|
column: [
|
||||||
|
{
|
||||||
|
label: "文件上传",
|
||||||
|
prop: "excelFile",
|
||||||
|
type: "upload",
|
||||||
|
drag: true,
|
||||||
|
loadText: "文件上传中,请稍等",
|
||||||
|
span: 24,
|
||||||
|
propsHttp: {
|
||||||
|
res: "data",
|
||||||
|
},
|
||||||
|
accept: excelAccept,
|
||||||
|
tip: "请上传 .xls,.xlsx 标准格式文件",
|
||||||
|
action: importInviteCode(),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "数据覆盖",
|
||||||
|
prop: "isCovered",
|
||||||
|
type: "switch",
|
||||||
|
align: "center",
|
||||||
|
width: 80,
|
||||||
|
dicData: [
|
||||||
|
{
|
||||||
|
label: "否",
|
||||||
|
value: 0,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "是",
|
||||||
|
value: 1,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
value: 0,
|
||||||
|
slot: true,
|
||||||
|
rules: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: "请选择是否覆盖",
|
||||||
|
trigger: "blur",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "模板下载",
|
||||||
|
prop: "excelTemplate",
|
||||||
|
formslot: true,
|
||||||
|
span: 24,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
},
|
||||||
|
},
|
||||||
|
mounted() {},
|
||||||
|
watch: {},
|
||||||
|
methods: {
|
||||||
|
inviteCodeName (v) {
|
||||||
|
var inviteCodeFormName = this.stationIdList.find(e => {
|
||||||
|
return e.stationId === v
|
||||||
|
})
|
||||||
|
this.inviteCodeFormName = inviteCodeFormName.stationName
|
||||||
|
},
|
||||||
|
qRCodeDialogOk () {
|
||||||
|
this.codeLoading = true
|
||||||
|
inviteAllocation(this.inviteCodeForm).then(() => {
|
||||||
|
this.$message.success('分配成功')
|
||||||
|
this.refreshChange()
|
||||||
|
this.codeLoading = false
|
||||||
|
this.qRCodeDialog = false
|
||||||
|
this.distributionCodeDialog = false
|
||||||
|
}).catch(() => {
|
||||||
|
this.codeLoading = false
|
||||||
|
})
|
||||||
|
},
|
||||||
|
inviteCodeSubmit (){
|
||||||
|
this.$refs['inviteCode'].validate((valid) => {
|
||||||
|
if (valid) {
|
||||||
|
this.qRCodeDialog = true
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
inviteCodeClose(){
|
||||||
|
this.distributionCodeDialog = false
|
||||||
|
},
|
||||||
|
distributionCode(){
|
||||||
|
this.distributionCodeDialog = true
|
||||||
|
},
|
||||||
|
handleImport() {
|
||||||
|
this.excelBox = true;
|
||||||
|
},
|
||||||
|
handleTemplate() {
|
||||||
|
this.templateLoading = true;
|
||||||
|
getTemplate("yqm")
|
||||||
|
.then((rep) => {
|
||||||
|
this.templateLoading = false;
|
||||||
|
window.open(rep.data.data);
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
this.templateLoading = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
beforeAvatarUpload(file, done, loading) {
|
||||||
|
this.file = file;
|
||||||
|
if (!isExcel(file)) {
|
||||||
|
loading();
|
||||||
|
this.$message.error("上传参保信息只能是 .xls,.xlsx 标准格式文件!");
|
||||||
|
} else {
|
||||||
|
done();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
uploadAfter(res, done) {
|
||||||
|
if (!(res instanceof Error)) {
|
||||||
|
this.excelBox = false;
|
||||||
|
}
|
||||||
|
this.refreshChange();
|
||||||
|
done();
|
||||||
|
},
|
||||||
|
uploadError(error) {
|
||||||
|
if (error) {
|
||||||
|
this.$message.error(error);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
searchInfo() {
|
||||||
|
this.onLoad(this.page);
|
||||||
|
},
|
||||||
|
rowSave(row, done,loading) {
|
||||||
|
this.$refs.crud.validate((valid) => {
|
||||||
|
if (valid) {
|
||||||
|
add(
|
||||||
|
row.inviteCode,
|
||||||
|
row.realName,
|
||||||
|
row.idNumber,
|
||||||
|
row.phone,
|
||||||
|
row.groupType,
|
||||||
|
row.remarks,
|
||||||
|
row.stationId
|
||||||
|
).then(
|
||||||
|
() => {
|
||||||
|
this.$message.success('添加成功')
|
||||||
|
done();
|
||||||
|
this.onLoad(this.page);
|
||||||
|
},
|
||||||
|
(error) => {
|
||||||
|
window.console.log(error);
|
||||||
|
loading()
|
||||||
|
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
rowEdit(row) {
|
||||||
|
this.$refs.crud.rowEdit(row);
|
||||||
|
},
|
||||||
|
rowUpdate(row, index, done, loading) {
|
||||||
|
if (row.status == "已绑定") {
|
||||||
|
row.status = 1;
|
||||||
|
} else {
|
||||||
|
row.status = 0;
|
||||||
|
}
|
||||||
|
this.$refs.crud.validate((valid) => {
|
||||||
|
if (valid) {
|
||||||
|
edit(
|
||||||
|
row.id,
|
||||||
|
row.inviteCode,
|
||||||
|
row.realName,
|
||||||
|
row.idNumber,
|
||||||
|
row.phone,
|
||||||
|
row.groupType,
|
||||||
|
row.remarks,
|
||||||
|
row.status,
|
||||||
|
row.stationId
|
||||||
|
).then(
|
||||||
|
() => {
|
||||||
|
this.$message.success('绑定成功')
|
||||||
|
done(row);
|
||||||
|
this.onLoad(this.page);
|
||||||
|
},
|
||||||
|
(error) => {
|
||||||
|
window.console.log(error);
|
||||||
|
loading();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
currentChange(currentPage) {
|
||||||
|
this.page.currentPage = currentPage;
|
||||||
|
},
|
||||||
|
sizeChange(pageSize) {
|
||||||
|
this.page.pageSize = pageSize;
|
||||||
|
},
|
||||||
|
refreshChange() {
|
||||||
|
this.onLoad(this.page);
|
||||||
|
},
|
||||||
|
searchChange(params, done) {
|
||||||
|
this.query = params;
|
||||||
|
this.page.currentPage = 1;
|
||||||
|
this.onLoad(this.page, params);
|
||||||
|
done();
|
||||||
|
},
|
||||||
|
searchReset() {
|
||||||
|
this.query = {};
|
||||||
|
this.onLoad(this.page);
|
||||||
|
},
|
||||||
|
onLoad(page, params = {}) {
|
||||||
|
this.loading=true;
|
||||||
|
getList(
|
||||||
|
page.currentPage,
|
||||||
|
page.pageSize,
|
||||||
|
Object.assign(this.query, params)
|
||||||
|
).then((res) => {
|
||||||
|
const data = res.data.data;
|
||||||
|
for (const key in data.records) {
|
||||||
|
if (data.records[key].status == "1") {
|
||||||
|
data.records[key].status = "已绑定";
|
||||||
|
} else {
|
||||||
|
data.records[key].status = "未绑定";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.data = data.records;
|
||||||
|
this.page.total = data.total;
|
||||||
|
this.loading=false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
<style>
|
||||||
|
.inviteCodeStrip{
|
||||||
|
display: inline-block;
|
||||||
|
width: 30px;
|
||||||
|
height: 30px;
|
||||||
|
line-height: 30px;
|
||||||
|
text-align: center;
|
||||||
|
border-radius: 10px;
|
||||||
|
border: 1px solid #e3e3e3;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
.inviteCodeStripActive {
|
||||||
|
color: #FFFFFF;
|
||||||
|
background-color: #409EFF;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
Reference in New Issue
Block a user