mirror of
https://gitee.com/ZhongBangKeJi/crmeb_java.git
synced 2026-05-03 15:21:26 +08:00
更新代码
This commit is contained in:
@@ -20,7 +20,7 @@
|
||||
<el-input v-model="pram.realName" placeholder="管理员姓名" />
|
||||
</el-form-item>
|
||||
<el-form-item label="管理员身份" prop="roles">
|
||||
<el-select v-model="pram.roles" placeholder="身份" clearable multiple>
|
||||
<el-select v-model="pram.roles" placeholder="身份" clearable multiple style="width: 100%">
|
||||
<el-option
|
||||
v-for="item,index in roleList.list"
|
||||
:key="index"
|
||||
@@ -29,6 +29,10 @@
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="手机号" prop="phone">
|
||||
<el-input type="text" v-model="pram.phone" prefix="ios-contact-outline"
|
||||
placeholder="请输入手机号" size="large"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="状态">
|
||||
<el-switch v-model="pram.status" :active-value="true" :inactive-value="false" />
|
||||
</el-form-item>
|
||||
@@ -59,6 +63,15 @@ export default {
|
||||
}
|
||||
},
|
||||
data() {
|
||||
const validatePhone = (rule, value, callback) => {
|
||||
if (!value) {
|
||||
return callback(new Error('请填写手机号'));
|
||||
} else if (!/^1[3456789]\d{9}$/.test(value)) {
|
||||
callback(new Error('手机号格式不正确!'));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
};
|
||||
const validatePass = (rule, value, callback) => {
|
||||
if (value === '') {
|
||||
callback(new Error('请再次输入密码'))
|
||||
@@ -78,7 +91,8 @@ export default {
|
||||
realName: null,
|
||||
roles: [],
|
||||
status: null,
|
||||
id: null
|
||||
id: null,
|
||||
phone: null
|
||||
},
|
||||
roleList: [],
|
||||
rules: {
|
||||
@@ -87,7 +101,10 @@ export default {
|
||||
pwd: [{ required: true, message: '请填管理员密码', trigger: ['blur', 'change'] }],
|
||||
repwd: [{ required: true, message: '确认密码密码', validator: validatePass, trigger: ['blur', 'change'] }],
|
||||
realName: [{ required: true, message: '管理员姓名', trigger: ['blur', 'change'] }],
|
||||
roles: [{ required: true, message: '管理员身份', type: 'array', trigger: ['blur', 'change'] }]
|
||||
roles: [{ required: true, message: '管理员身份', type: 'array', trigger: ['blur', 'change'] }],
|
||||
phone: [
|
||||
{ validator: validatePhone, trigger: 'blur' }
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -111,7 +128,7 @@ export default {
|
||||
},
|
||||
initEditData() {
|
||||
if (this.isCreate !== 1) return
|
||||
const { account, realName, roles, level, status, id } = this.editData
|
||||
const { account, realName, roles, level, status, id, phone } = this.editData
|
||||
this.pram.account = account
|
||||
this.pram.realName = realName
|
||||
const _roles = []
|
||||
@@ -123,6 +140,7 @@ export default {
|
||||
this.pram.roles = _roles
|
||||
this.pram.status = status
|
||||
this.pram.id = id
|
||||
this.pram.phone = phone
|
||||
this.rules.pwd = []
|
||||
this.rules.repwd = []
|
||||
},
|
||||
|
||||
@@ -42,6 +42,11 @@
|
||||
/>
|
||||
<el-table-column label="姓名" prop="realName" min-width="120"/>
|
||||
<el-table-column label="账号" prop="account" min-width="120"/>
|
||||
<el-table-column label="手机号" prop="lastTime" min-width="120">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ scope.row.phone | filterEmpty }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="身份" prop="realName" min-width="230">
|
||||
<template slot-scope="scope">
|
||||
<el-tag size="small" type="info" v-for="(item, index) in scope.row.roleNames.split(',')" class="mr5">{{ item }}</el-tag>
|
||||
@@ -57,9 +62,35 @@
|
||||
<span>{{ scope.row.lastIp | filterEmpty }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="状态" prop="status" min-width="100">
|
||||
<el-table-column
|
||||
label="状态"
|
||||
min-width="100"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<span>{{ scope.row.status | filterShowOrHide }}</span>
|
||||
<el-switch
|
||||
v-model="scope.row.status"
|
||||
:active-value="true"
|
||||
:inactive-value="false"
|
||||
active-text="开启"
|
||||
inactive-text="关闭"
|
||||
@change="onchangeIsShow(scope.row)"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="是否接收短信"
|
||||
min-width="100"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<el-switch
|
||||
v-model="scope.row.isSms"
|
||||
:active-value="true"
|
||||
:inactive-value="false"
|
||||
active-text="开启"
|
||||
inactive-text="关闭"
|
||||
:disabled="!scope.row.phone"
|
||||
@click.native="onchangeIsSms(scope.row)"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="删除标记" prop="status" min-width="100">
|
||||
@@ -93,6 +124,7 @@
|
||||
:title="editDialogConfig.isCreate === 0? '创建身份':'编辑身份'"
|
||||
destroy-on-close
|
||||
:close-on-click-modal="false"
|
||||
width="700px"
|
||||
>
|
||||
<edit
|
||||
v-if="editDialogConfig.visible"
|
||||
@@ -142,6 +174,38 @@ export default {
|
||||
this.handleGetRoleList()
|
||||
},
|
||||
methods: {
|
||||
onchangeIsShow(row) {
|
||||
systemAdminApi.updateStatusApi({id: row.id, status: row.status})
|
||||
.then(async () => {
|
||||
this.$message.success('修改成功');
|
||||
this.handleGetAdminList()
|
||||
}).catch(()=>{
|
||||
row.status = !row.status
|
||||
})
|
||||
},
|
||||
onchangeIsSms(row) {
|
||||
// this.$confirm(`此操作将${!row.isSms ? '开启' : '关闭'}验证, 是否继续?`, "提示", {
|
||||
// confirmButtonText: "确定",
|
||||
// cancelButtonText: "取消",
|
||||
// type: "warning"
|
||||
// }).then(async () => {
|
||||
// row.isSms = !row.isSms
|
||||
// }).catch(() => {
|
||||
// this.$message.error('取消操作')
|
||||
// })
|
||||
|
||||
if(!row.phone) return this.$message({
|
||||
message: '请先为管理员添加手机号!',
|
||||
type: 'warning'
|
||||
});
|
||||
systemAdminApi.updateIsSmsApi({id: row.id})
|
||||
.then(async () => {
|
||||
this.$message.success('修改成功');
|
||||
this.handleGetAdminList()
|
||||
}).catch(()=>{
|
||||
row.isSms = !row.isSms
|
||||
})
|
||||
},
|
||||
handleSearch() {
|
||||
this.listPram.page = 1
|
||||
this.handleGetAdminList()
|
||||
|
||||
Reference in New Issue
Block a user