From 5d20b93a29a1817ed26e8ca30ebba530d79fb64e Mon Sep 17 00:00:00 2001
From: Administrator <admin>
Date: Thu, 02 Sep 2021 12:05:16 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.0.105:10010/r/zhba_enterprises
---
src/lang/zh.js | 209 +++++++------
src/page/login/index.vue | 47 ++
src/api/zc/zc.js | 57 +++
src/views/zc/zc.vue | 275 ++++++++++++++++++
src/page/login/codelogin.vue | 280 ++++++++++++++++--
src/api/system/dept.js | 16 +
6 files changed, 739 insertions(+), 145 deletions(-)
diff --git a/src/api/system/dept.js b/src/api/system/dept.js
index d6d3f47..2b8b1bf 100644
--- a/src/api/system/dept.js
+++ b/src/api/system/dept.js
@@ -88,4 +88,18 @@
parentId
}
})
-}
\ No newline at end of file
+}
+
+export const ss = () => {
+ return request({
+ url: '/api/blade-system/dept/selectInfo',
+ method: 'get',
+ })
+}
+
+export const rs = () => {
+ return request({
+ url: '/api/blade-system/role/selectRole',
+ method: 'get',
+ })
+}
diff --git a/src/api/zc/zc.js b/src/api/zc/zc.js
new file mode 100644
index 0000000..9201feb
--- /dev/null
+++ b/src/api/zc/zc.js
@@ -0,0 +1,57 @@
+import request from '@/router/axios';
+
+export const getList = (current, size, params) => {
+ return request({
+ url: '/api/zc/page',
+ method: 'get',
+ params: {
+ ...params,
+ current,
+ size,
+ }
+ })
+}
+
+export const getDetail = (id) => {
+ return request({
+ url: '/api/zc/detail',
+ method: 'get',
+ params: {
+ id
+ }
+ })
+}
+
+export const remove = (ids) => {
+ return request({
+ url: '/api/zc/remove',
+ method: 'post',
+ params: {
+ ids,
+ }
+ })
+}
+
+export const add = (row) => {
+ return request({
+ url: '/api/zc/submit',
+ method: 'post',
+ data: row
+ })
+}
+
+export const update = (row) => {
+ return request({
+ url: '/api/zc/update',
+ method: 'post',
+ data: row
+ })
+}
+
+export const inster = (row) => {
+ return request({
+ url: '/api/zc/inster',
+ method: 'post',
+ data: row
+ })
+}
diff --git a/src/lang/zh.js b/src/lang/zh.js
index 0e17b06..2e4e965 100644
--- a/src/lang/zh.js
+++ b/src/lang/zh.js
@@ -1,108 +1,113 @@
export default {
- tip: '提示',
- title: '保安服务企业管理',
- logoutTip: '退出系统, 是否继续?',
- submitText: '确定',
- cancelText: '取消',
- search: '请输入搜索内容',
- menuTip: '没有发现菜单',
- wel: {
- info: '早安,Smallwei,Avuex一款超乎你想象的框架!',
- dept: '我是avue团队下的一个部门-哈皮部门-哈皮职位',
- team: '团队内排名',
- project: '项目访问',
- count: '项目数',
- data: {
- subtitle: '实时',
- column1: '分类统计',
- column2: '附件统计',
- column3: '文章统计',
- key1: '分',
- key2: '附',
- key3: '评',
- text1: '当前分类总记录数',
- text2: '当前上传的附件数',
- text3: '评论次数'
- },
- data2: {
- column1: '今日注册',
- column2: '今日登录',
- column3: '今日订阅',
- column4: '今日评论'
- },
- data3: {
- column1: '转化率(日同比 28%)',
- column2: '签到率(日同比 11%)',
- column3: '签到率(日同比 11%)'
- },
- data4: {
- column1: '错误日志',
- column2: '数据展示',
- column3: '权限管理',
- column4: '用户管理'
- },
- table: {
- rw: '工作任务',
- nr: '工作内容',
- sj: '工作时间'
- }
+ tip: '提示',
+ title: '保安服务企业管理',
+ logoutTip: '退出系统, 是否继续?',
+ submitText: '确定',
+ cancelText: '取消',
+ search: '请输入搜索内容',
+ menuTip: '没有发现菜单',
+ wel: {
+ info: '早安,Smallwei,Avuex一款超乎你想象的框架!',
+ dept: '我是avue团队下的一个部门-哈皮部门-哈皮职位',
+ team: '团队内排名',
+ project: '项目访问',
+ count: '项目数',
+ data: {
+ subtitle: '实时',
+ column1: '分类统计',
+ column2: '附件统计',
+ column3: '文章统计',
+ key1: '分',
+ key2: '附',
+ key3: '评',
+ text1: '当前分类总记录数',
+ text2: '当前上传的附件数',
+ text3: '评论次数'
},
- route: {
- info: '个人信息',
- website: 'bladex官网',
- avuexwebsite: 'avuex官网',
- dashboard: '首页',
- more: '更多',
- tags: '标签',
- store: '本地存储',
- api: '全局函数',
- logs: '日志监控',
- table: '表格',
- form: '表单',
- top: '返回顶部',
- data: '数据展示',
- permission: '权限',
- error: '异常页面',
- test: '测试页面'
+ data2: {
+ column1: '今日注册',
+ column2: '今日登录',
+ column3: '今日订阅',
+ column4: '今日评论'
},
- login: {
- title: '登录 ',
- info: '保安服务企业管理',
- tenantId: '请输入保安单位ID',
- username: '请输入账号',
- password: '请输入密码',
- wechat: '微信',
- qq: 'QQ',
- github: 'github',
- gitee: '码云',
- phone: '请输入手机号',
- code: '请输入验证码',
- submit: '登录',
- userLogin: '账号密码登录',
- phoneLogin: '手机号登录',
- thirdLogin: '第三方系统登录',
- msgText: '发送验证码',
- msgSuccess: '秒后重发',
+ data3: {
+ column1: '转化率(日同比 28%)',
+ column2: '签到率(日同比 11%)',
+ column3: '签到率(日同比 11%)'
},
- navbar: {
- logOut: '退出登录',
- userinfo: '个人信息',
- dashboard: '首页',
- lock: '锁屏',
- bug: '没有错误日志',
- bugs: '条错误日志',
- screenfullF: '退出全屏',
- screenfull: '全屏',
- language: '中英文',
- notice: '消息通知',
- theme: '主题',
- color: '换色'
+ data4: {
+ column1: '错误日志',
+ column2: '数据展示',
+ column3: '权限管理',
+ column4: '用户管理'
},
- tagsView: {
- search: '搜索',
- menu: '更多',
- clearCache: '清除缓存',
- closeOthers: '关闭其它',
- closeAll: '关闭所有'
+ table: {
+ rw: '工作任务',
+ nr: '工作内容',
+ sj: '工作时间'
}
-}
\ No newline at end of file
+ },
+ route: {
+ info: '个人信息',
+ website: 'bladex官网',
+ avuexwebsite: 'avuex官网',
+ dashboard: '首页',
+ more: '更多',
+ tags: '标签',
+ store: '本地存储',
+ api: '全局函数',
+ logs: '日志监控',
+ table: '表格',
+ form: '表单',
+ top: '返回顶部',
+ data: '数据展示',
+ permission: '权限',
+ error: '异常页面',
+ test: '测试页面'
+ },
+ login: {
+ title: '登录 ',
+ info: '保安服务企业管理',
+ tenantId: '请输入保安单位ID',
+ username: '请输入账号',
+ password: '请输入密码',
+ password2: '请再次输入密码',
+ name: '请输入姓名',
+ wechat: '微信',
+ cardid: '请输入身份证号',
+ qq: 'QQ',
+ zc: '注册',
+ gb: '关闭',
+ github: 'github',
+ gitee: '码云',
+ phone: '请输入手机号',
+ code: '请输入验证码',
+ submit: '登录',
+ userLogin: '账号密码登录',
+ phoneLogin: '账号注册',
+ thirdLogin: '第三方系统登录',
+ msgText: '发送验证码',
+ msgSuccess: '秒后重发',
+ },
+ navbar: {
+ logOut: '退出登录',
+ userinfo: '个人信息',
+ dashboard: '首页',
+ lock: '锁屏',
+ bug: '没有错误日志',
+ bugs: '条错误日志',
+ screenfullF: '退出全屏',
+ screenfull: '全屏',
+ language: '中英文',
+ notice: '消息通知',
+ theme: '主题',
+ color: '换色'
+ },
+ tagsView: {
+ search: '搜索',
+ menu: '更多',
+ clearCache: '清除缓存',
+ closeOthers: '关闭其它',
+ closeAll: '关闭所有'
+ }
+}
diff --git a/src/page/login/codelogin.vue b/src/page/login/codelogin.vue
index 79022c3..92ed3a5 100644
--- a/src/page/login/codelogin.vue
+++ b/src/page/login/codelogin.vue
@@ -5,80 +5,146 @@
ref="loginForm"
:model="loginForm"
label-width="0">
- <el-form-item prop="phone">
+ <el-form-item prop="username">
<el-input size="small"
@keyup.enter.native="handleLogin"
- v-model="loginForm.phone"
+ v-model="loginForm.username"
auto-complete="off"
- :placeholder="$t('login.phone')">
- <i slot="prefix"
- class="icon-shouji"/>
+ :placeholder="$t('login.username')">
+ <i slot="prefix" class="icon-yonghu"/>
</el-input>
</el-form-item>
- <el-form-item prop="code">
+ <el-form-item prop="password">
<el-input size="small"
@keyup.enter.native="handleLogin"
- v-model="loginForm.code"
+ v-model="loginForm.password"
auto-complete="off"
- :placeholder="$t('login.code')">
- <i slot="prefix"
- class="icon-yanzhengma"
- style="margin-top:6px;"/>
- <template slot="append">
- <span @click="handleSend"
- class="msg-text"
- :class="[{display:msgKey}]">{{msgText}}</span>
- </template>
+ show-password
+ :placeholder="$t('login.password')">
+ <i slot="prefix" class="icon-mima"/>
</el-input>
</el-form-item>
- <el-form-item>
+ <el-form-item prop="password2">
+ <el-input size="small"
+ @keyup.enter.native="handleLogin"
+ v-model="loginForm.password2"
+ auto-complete="off"
+ show-password
+ :placeholder="$t('login.password2')">
+ <i slot="prefix" class="icon-mima"/>
+ </el-input>
+ </el-form-item>
+ <el-form-item prop="sname">
+ <el-input size="small"
+ @keyup.enter.native="handleLogin"
+ v-model="loginForm.sname"
+ auto-complete="off"
+ :placeholder="$t('login.name')">
+ <i slot="prefix" class="icon-yonghu"/>
+ </el-input>
+ </el-form-item>
+ <el-form-item prop="cardid">
+ <el-input size="small"
+ v-model="loginForm.cardid"
+ auto-complete="off"
+ :placeholder="$t('login.cardid')">
+ <i slot="prefix" class="icon-shouji"/>
+ </el-input>
+ </el-form-item>
+ <avue-input-tree style="width:580px !important" :defaultExpandAll="loginForm.defaultFlag" v-model="loginForm.deptid" placeholder="请选择部门"
+ type="tree"
+ :dic="dic"></avue-input-tree>
+ <el-form-item class="z-login-submit-prv">
<el-button size="small"
type="primary"
@click.native.prevent="handleLogin"
- class="login-submit">{{$t('login.submit')}}</el-button>
+ class="z-login-submit">{{ $t('login.zc') }}
+ </el-button>
+ <el-button size="small"
+ @click.native.prevent="gbs"
+ class="z-login-submit">{{ $t('login.gb') }}
+ </el-button>
</el-form-item>
</el-form>
</template>
<script>
-import { isvalidatemobile } from "@/util/validate";
-import { mapGetters } from "vuex";
+import {isvalidatemobile} from "@/util/validate";
+import {inster} from "@/api/zc/zc";
+import {ss, rs} from "@/api/system/dept";
+import {mapGetters} from "vuex";
+
export default {
name: "codelogin",
data() {
- const validatePhone = (rule, value, callback) => {
- if (isvalidatemobile(value)[0]) {
- callback(new Error(isvalidatemobile(value)[1]));
+ const validatePass = (rule, value, callback) => {
+ if (value === '') {
+ callback(new Error('请输入密码'));
} else {
callback();
}
};
- const validateCode = (rule, value, callback) => {
- if (value.length !== 4) {
- callback(new Error("请输入4位数的验证码"));
+ const validatePass2 = (rule, value, callback) => {
+ if (value === '') {
+ callback(new Error('请再次输入密码'));
+ } else if (value !== this.loginForm.password) {
+ callback(new Error('两次输入密码不一致!'));
+ } else {
+ callback();
+ }
+ };
+ const validateIdNo = (rule, value, callback) => {
+ let id18 = /^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/;
+ let id15 = /^[1-9]\d{5}\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{2}$/;
+ if (!id18.test(this.loginForm.cardid) && !id15.test(this.loginForm.cardid)) {
+ callback(new Error("请输入正确的身份证号格式"));
} else {
callback();
}
};
return {
+
msgText: "",
msgTime: "",
+ dic: [],
+ dicr: [],
msgKey: false,
loginForm: {
- phone: "",
- code: ""
+ defaultFlag: false,
+ cardid: "",
+ username: "",
+ sname: "",
+ password: "",
+ deptid: '',
+ roleid: '',
+ password2: ""
},
+ value: '',
+ options: [],
loginRules: {
- phone: [{ required: true, trigger: "blur", validator: validatePhone }],
- code: [{ required: true, trigger: "blur", validator: validateCode }]
- }
+ cardid: [{required: true, trigger: "blur", validator: validateIdNo}],
+ password: [{required: true, validator: validatePass, trigger: 'blur'}],
+ password2: [{required: true, validator: validatePass2, trigger: 'blur'}],
+ username: [
+ {required: true, message: "请输入用户名", trigger: "blur"}
+ ],
+ },
+ passwordType: "password",
+ passwordTypes: "password2"
};
},
created() {
this.msgText = this.config.MSGINIT;
this.msgTime = this.config.MSGTIME;
+ defaultFlag
},
- mounted() {},
+ mounted() {
+ var that = this;
+ ss().then(res => {
+ console.log(that.ergodicData(res.data.data), 898989)
+ that.dic = that.ergodicData(res.data.data)
+ });
+ },
computed: {
...mapGetters(["tagWel"]),
config() {
@@ -91,6 +157,109 @@
},
props: [],
methods: {
+ ergodicData(val) {
+ var arr = []
+
+ val.forEach((item, index) => {
+
+ arr.push({label: item.title, value: item.value, id: item.id, parent_id: item.parent_id})
+
+
+ if (item.hasChildren == true) {
+
+ var arrOne = []
+
+ if (item.children && item.children.length > 0) {
+
+ item.children.forEach((childItem, childIndex) => {
+
+ arrOne.push({
+ label: childItem.title,
+ value: childItem.value,
+ id: childItem.id,
+ parent_id: childItem.parent_id
+ })
+
+
+ if (childItem.hasChildren == true) {
+
+ var arrTwo = []
+
+ if (childItem.children && childItem.children.length > 0) {
+
+ childItem.children.forEach((findItem, findIndex) => {
+
+ arrTwo.push({
+ label: findItem.title,
+ value: findItem.value,
+ id: findItem.id,
+ parent_id: findItem.parent_id
+ })
+
+ })
+
+ }
+
+ arrOne[childIndex].children = arrTwo
+
+ }
+
+ })
+
+ }
+
+ arr[index].children = arrOne
+
+ }
+
+
+ })
+
+ return arr;
+ },
+
+ clearValidate(formName) {
+ this.$refs[formName].clearValidate();
+ },
+ async allmedia() {
+ ss().then(res => {
+ console.log(res, 1323)
+ res.data.data.forEach(element => {
+ this.options.push({deptname: element.dept_name, deptid: element.deptid});
+ })
+ });
+ },
+ refreshCode(row) {
+ inster(row).then(res => {
+ this.loginForm.cardid = ""
+ this.loginForm.username = ""
+ this.loginForm.sname = ""
+ this.loginForm.password = ""
+ this.loginForm.password2 = ""
+ this.loginForm.deptid = ""
+ this.loginForm.defaultFlag = false
+ this.$notify({
+ title: '注册成功,待审核',
+ type: 'warning'
+ });
+ })
+ var z = document.querySelector('.z');
+ z.style.display = 'none';
+ this.clearValidate('loginForm')
+ this.clearValidate('loginForm')
+ },
+ gb() {
+ this.loginForm.cardid = ""
+ this.loginForm.username = ""
+ this.loginForm.sname = ""
+ this.loginForm.password = ""
+ this.loginForm.password2 = ""
+ this.loginForm.deptid = ""
+ this.loginForm.defaultFlag = false
+ var zs = document.querySelector('.z');
+ zs.style.display = 'none';
+ this.clearValidate('loginForm')
+ },
handleSend() {
if (this.msgKey) return;
this.msgText = this.msgTime + this.config.MSGSCUCCESS;
@@ -106,16 +275,30 @@
}
}, 1000);
},
+ showPassword() {
+ this.passwordType === ""
+ ? (this.passwordType = "password")
+ : (this.passwordType = "");
+ },
+ showPasswords() {
+ this.passwordType === ""
+ ? (this.passwordType = "password2")
+ : (this.passwordType = "");
+ },
handleLogin() {
this.$refs.loginForm.validate(valid => {
if (valid) {
- this.$store.dispatch("LoginByPhone", this.loginForm).then(() => {
- this.$router.push({ path: this.tagWel.value });
- });
+ this.refreshCode(this.loginForm);
+ this.message('dahsiofhiusa');
+ return Promise.reject(new Error("注册成功,待审核"));
}
});
+ },
+ gbs() {
+ this.gb();
}
}
+
};
</script>
@@ -127,7 +310,34 @@
text-align: center;
cursor: pointer;
}
+
.msg-text.display {
color: #ccc;
}
+
+.z-login-submit-prv {
+ margin-top: 25px;
+ padding: 0 10%;
+ box-sizing: border-box;
+}
+
+.z-login-submit-prv > div {
+ width: 80%;
+ display: flex;
+}
+
+.z-login-submit {
+ flex: 1;
+ height: 45px;
+ border: 1px solid #409EFF;
+ background: none;
+ font-size: 18px;
+ letter-spacing: 2px;
+ font-weight: 300;
+ color: #409EFF;
+ cursor: pointer;
+ font-family: "neo";
+ -webkit-transition: 0.25s;
+ transition: 0.25s;
+}
</style>
diff --git a/src/page/login/index.vue b/src/page/login/index.vue
index a1aa03f..9c90ce4 100644
--- a/src/page/login/index.vue
+++ b/src/page/login/index.vue
@@ -15,19 +15,23 @@
<div class="login-main">
<h4 class="login-title">
{{ $t('login.title') }}
-<!-- <top-lang></top-lang>-->
+ <!-- <top-lang></top-lang>-->
</h4>
- <userLogin v-if="activeName==='user'"></userLogin>
- <codeLogin v-else-if="activeName==='code'"></codeLogin>
- <thirdLogin v-else-if="activeName==='third'"></thirdLogin>
+ <h4 class="login-title-child">IoT security cloud service platform</h4>
+ <userLogin></userLogin>
+ <!-- <codeLogin v-else-if="activeName==='code'"></codeLogin>-->
+ <!-- <thirdLogin v-else-if="activeName==='third'"></thirdLogin>-->
<div class="login-menu">
- <a href="#" @click.stop="activeName='user'">{{ $t('login.userLogin') }}</a>
- <!--<a href="#" @click.stop="activeName='code'">{{ $t('login.phoneLogin') }}</a>-->
-<!-- <a href="#" @click.stop="activeName='third'">{{ $t('login.thirdLogin') }}</a>-->
+ <!-- <a href="#" @click.stop="activeName='user'">{{ $t('login.userLogin') }}</a>-->
+ <a href="#" @click.stop="zShow">{{ $t('login.phoneLogin') }}</a>
+ <!-- <a href="#" @click.stop="activeName='third'">{{ $t('login.thirdLogin') }}</a>-->
</div>
</div>
</div>
+ </div>
+ <div class="z" v-show="activeName == 'code'">
+ <codeLogin></codeLogin>
</div>
</div>
</template>
@@ -109,11 +113,40 @@
loading.close();
});
}
+ },
+ zShow() {
+ document.querySelector('.z').style.display = 'block';
}
}
};
</script>
<style lang="scss">
+.z {
+ position: fixed;
+ margin: auto;
+ padding: 10px;
+ top: 0;
+ left: 0;
+ right: 0;
+ bottom: 80px;
+ width: 600px;
+ height: 500px;
+ background-color: #fff;
+ box-sizing: border-box;
+ box-shadow: 6px 6px 5px #909090;
+}
+
+.company-jx {
+ position: fixed;
+ margin: auto;
+ top: auto;
+ left: 0px;
+ right: 0px;
+ bottom: 120px;
+ text-align: center;
+ color: #fff;
+ font-size: 15px;
+}
@import "@/styles/login.scss";
</style>
diff --git a/src/views/zc/zc.vue b/src/views/zc/zc.vue
new file mode 100644
index 0000000..92df91e
--- /dev/null
+++ b/src/views/zc/zc.vue
@@ -0,0 +1,275 @@
+<template>
+ <basic-container>
+ <avue-crud :option="option"
+ :table-loading="loading"
+ :data="data"
+ :page.sync="page"
+ :permission="permissionList"
+ :before-open="beforeOpen"
+ v-model="form"
+ ref="crud"
+ @row-update="rowUpdate"
+ @row-save="rowSave"
+ @row-del="rowDel"
+ @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 type="danger"
+ size="small"
+ icon="el-icon-delete"
+ plain
+ v-if="permission.zc_delete"
+ @click="handleDelete">删 除
+ </el-button>
+ </template>
+ <template slot-scope="{row}" slot="type">
+ <el-tag>{{row.type==='0'?'未审核':row.type==='1'?'审核通过':'审核未通过'}}</el-tag>
+ </template>
+
+ <template slot-scope="{row}"
+ slot="roleName">
+ <el-tag>{{row.roleName}}</el-tag>
+ </template>
+ <template slot-scope="scope" slot="menu">
+ <el-button icon="el-icon-check" size="small" @click.stop="handleEdit(scope.row,scope.index)">审核</el-button>
+ </template>
+ </avue-crud>
+
+
+ </basic-container>
+</template>
+
+<script>
+ import {getList, getDetail, add, update, remove} from "@/api/zc/zc";
+ import {getRoleTree} from "@/api/system/role";
+ import {mapGetters} from "vuex";
+
+ export default {
+ data() {
+ return {
+ form: {},
+ query: {},
+ loading: true,
+ page: {
+ pageSize: 10,
+ currentPage: 1,
+ total: 0
+ },
+ selectionList: [],
+ option: {
+ height:'auto',
+ calcHeight: 54,
+ tip: false,
+ searchShow: true,
+ searchMenuSpan: 4,
+ border: true,
+ index: true,
+ viewBtn: true,
+ selection: true,
+ headerAlign: 'center',
+ align: 'center',
+ dialogClickModal: false,
+ column: [
+ {
+ label: "账号",
+ searchSpan:4,
+ display: false,
+ disabled:true,
+ prop: "username",
+ },
+ {
+ label: "密码",
+ hide: true,
+ editDisplay: false,
+ viewDisplay: false,
+ prop: "password",
+ },
+ {
+ label: "姓名",
+ display: false,
+ searchSpan:4,
+ disabled:true,
+ prop: "sname",
+ },
+ {
+ label: "身份证号",
+ disabled:true,
+ display: false,
+ prop: "cardid",
+ },
+ {
+ label: "部门",
+ editDisplay: false,
+ prop: "deptid",
+ },
+ {
+ label: "审核状态",
+ prop: "type",
+ search: true,
+ slot: true,
+ searchSpan:4,
+ type: "select",
+ dicData: [
+ {
+ label: "未审核",
+ value: "0"
+ },
+ {
+ label: "审核通过",
+ value: "1"
+ },
+ {
+ label: "审核不通过",
+ value: "2"
+ }
+
+ ],
+ }
+ ]
+ },
+ data: []
+ };
+ },
+ computed: {
+ ...mapGetters(["permission"]),
+ permissionList() {
+ return {
+ addBtn: this.vaildData(this.permission.zc_add, false),
+ viewBtn: this.vaildData(this.permission.zc_view, true),
+ delBtn: this.vaildData(this.permission.zc_delete, false),
+ editBtn: this.vaildData(this.permission.zc_edit, false)
+ };
+ },
+ ids() {
+ let ids = [];
+ this.selectionList.forEach(ele => {
+ ids.push(ele.id);
+ });
+ return ids.join(",");
+ }
+ },
+ methods: {
+ handleEdit (row, index) {
+ this.$refs.crud.rowEdit(row, index);
+ },
+ rowSave(row, done, loading) {
+ add(row).then(() => {
+ this.onLoad(this.page);
+ this.$message({
+ type: "success",
+ message: "操作成功!"
+ });
+ done();
+ }, error => {
+ loading();
+ window.console.log(error);
+ });
+ },
+ rowUpdate(row, index, done, loading) {
+ update(row).then(() => {
+ this.onLoad(this.page);
+ this.$message({
+ type: "success",
+ message: "操作成功!"
+ });
+ done();
+ }, error => {
+ loading();
+ console.log(error);
+ });
+ },
+ rowDel(row) {
+ this.$confirm("确定将选择数据删除?", {
+ confirmButtonText: "确定",
+ cancelButtonText: "取消",
+ type: "warning"
+ })
+ .then(() => {
+ return remove(row.id);
+ })
+ .then(() => {
+ this.onLoad(this.page);
+ this.$message({
+ type: "success",
+ message: "操作成功!"
+ });
+ });
+ },
+ handleDelete() {
+ if (this.selectionList.length === 0) {
+ this.$message.warning("请选择至少一条数据");
+ return;
+ }
+ this.$confirm("确定将选择数据删除?", {
+ confirmButtonText: "确定",
+ cancelButtonText: "取消",
+ type: "warning"
+ })
+ .then(() => {
+ return remove(this.ids);
+ })
+ .then(() => {
+ this.onLoad(this.page);
+ this.$message({
+ type: "success",
+ message: "操作成功!"
+ });
+ this.$refs.crud.toggleSelection();
+ });
+ },
+ beforeOpen(done, type) {
+ if (["edit", "view"].includes(type)) {
+ getDetail(this.form.id).then(res => {
+ this.form = res.data.data;
+ });
+ }
+ done();
+ },
+ searchReset() {
+ this.query = {};
+ 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();
+ },
+ 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(params, this.query)).then(res => {
+ const data = res.data.data;
+ this.page.total = data.total;
+ this.data = data.records;
+ this.loading = false;
+ this.selectionClear();
+ });
+ }
+ }
+ };
+</script>
+
+<style>
+
+</style>
--
Gitblit v1.9.3