账号管理
This commit is contained in:
parent
6712991029
commit
714f8e612d
@ -31,9 +31,9 @@ class CompanyController extends Controller
|
||||
$conditions = [];
|
||||
$conditions['limit'] = $this->request->get('limit', 20);
|
||||
|
||||
$accounts = $this->companyService->index($conditions);
|
||||
$companies = $this->companyService->index($conditions);
|
||||
|
||||
return res($accounts, '企业列表', 201);
|
||||
return res($companies, '企业列表', 201);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -70,9 +70,9 @@ class CompanyAccountService extends Service implements JwtServiceContract
|
||||
$attributes = array_only($attributes, array_merge(app(CompanyAccount::class)->getFillable()));
|
||||
|
||||
$rule = [
|
||||
'username' => ['username', 'between:2,12', Rule::unique($this->companyAccountRepository->getTable(), 'username')->ignore($attributes['id']), Rule::notIn(config('domain.account.reserved_account'))],
|
||||
'username' => ['username', 'between:2,12', Rule::unique($this->companyAccountRepository->getTable(), 'username')->ignore($attributes['id'])->whereNUll('deleted_at'), Rule::notIn(config('domain.account.reserved_account'))],
|
||||
'nickname' => ['string', 'between:2,32'],
|
||||
'mobile' => ['string', 'cn_phone', Rule::unique($this->companyAccountRepository->getTable(), 'mobile')->ignore($attributes['id'])],
|
||||
'mobile' => ['string', 'cn_phone', Rule::unique($this->companyAccountRepository->getTable(), 'mobile')->ignore($attributes['id'])->whereNUll('deleted_at')],
|
||||
'password' => ['string'],
|
||||
'avatar' => ['image'],
|
||||
];
|
||||
|
@ -172,7 +172,7 @@ class CreateBaseTables extends Migration
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
|
||||
$table->unique('mobile');
|
||||
$table->unique(['mobile', 'deleted_at']);
|
||||
});
|
||||
|
||||
Schema::create("virtual_company_addresses", function (Blueprint $table) {
|
||||
|
@ -16,6 +16,7 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
my_show: false,
|
||||
isUpdate: false,
|
||||
loading: false,
|
||||
params: {
|
||||
name: '',
|
||||
|
@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<Modal :closable="false" :mask-closable="false" :title=" isUpdate ? '编辑账号' : '添加账号'" @on-visible-change="visibleChange" v-model="my_show">
|
||||
<Modal :closable="false" :mask-closable="false" :title="isUpdate ? '编辑账号' : '添加账号'" @on-visible-change="visibleChange" v-model="my_show">
|
||||
<div class="page-edit-wrap uinn-lr20">
|
||||
<ui-loading :show="page_loading.show"></ui-loading>
|
||||
|
||||
|
@ -59,7 +59,7 @@
|
||||
></Page>
|
||||
</div>
|
||||
|
||||
<ui-edit :data="editObj.data" :show.sync="editObj.show" @add-success="index" @update-success="index(list_data.current_page)"></ui-edit>
|
||||
<ui-edit :data="editObj.data" :show.sync="editObj.show" :isUpdate.sync="editObj.isUpdate" @add-success="index" @update-success="index(list_data.current_page)"></ui-edit>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
@ -3,17 +3,17 @@ import { isPhone, isPsw, isUserName } from 'validate';
|
||||
|
||||
export default {
|
||||
props: {
|
||||
isUpdate: {
|
||||
show: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
show: {
|
||||
isUpdate: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
data: {
|
||||
type: Object,
|
||||
default() {
|
||||
default () {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -21,6 +21,7 @@ export default {
|
||||
watch: {
|
||||
show(bool) {
|
||||
this.my_show = bool;
|
||||
console.log(this.isUpdate);
|
||||
if (bool) {
|
||||
if (this.data) {
|
||||
for (let k in this.data) {
|
||||
|
@ -182,9 +182,11 @@ export default {
|
||||
* @return {[type]} [description]
|
||||
*/
|
||||
openEdit(bool, row = null) {
|
||||
let data = {};
|
||||
let isUpdate = false;
|
||||
data.company_id = row.id;
|
||||
let data = {
|
||||
id: 0,
|
||||
company_id: row.id
|
||||
};
|
||||
|
||||
if (row && row.accounts && row.accounts.length) {
|
||||
data = Object.assign(data, row.accounts[0]);
|
||||
@ -193,9 +195,11 @@ export default {
|
||||
|
||||
this.editObj = {
|
||||
show: bool,
|
||||
data,
|
||||
isUpdate
|
||||
isUpdate,
|
||||
data
|
||||
};
|
||||
|
||||
console.log(this.editObj);
|
||||
},
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user