|
@@ -11,9 +11,9 @@
|
|
|
>添加授权账号</el-button
|
|
|
>
|
|
|
</el-form-item>
|
|
|
- <el-form-item class="margin-left input">
|
|
|
+ <el-form-item class="margin-left input" v-if="checkRole([0])">
|
|
|
<el-select
|
|
|
- v-model="page.data.username"
|
|
|
+ v-model="page.data.parentId"
|
|
|
placeholder="请选择所属账号"
|
|
|
filterable
|
|
|
clearable
|
|
@@ -34,7 +34,7 @@
|
|
|
clearable
|
|
|
>
|
|
|
<el-option
|
|
|
- v-for="item in option"
|
|
|
+ v-for="item in authList"
|
|
|
:key="item.id"
|
|
|
:label="item.username"
|
|
|
:value="item.id"
|
|
@@ -55,7 +55,6 @@
|
|
|
clearable
|
|
|
></el-input>
|
|
|
</el-form-item>
|
|
|
-
|
|
|
<el-form-item class="margin-left">
|
|
|
<el-button type="primary" @click="fetchData" icon="el-icon-search"
|
|
|
>搜索</el-button
|
|
@@ -76,7 +75,12 @@
|
|
|
{{ indexMethod(scope.$index) }}
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column align="center" prop="username" label="所属账号">
|
|
|
+ <el-table-column
|
|
|
+ align="center"
|
|
|
+ prop="parentName"
|
|
|
+ label="所属账号"
|
|
|
+ v-if="checkRole([0])"
|
|
|
+ >
|
|
|
</el-table-column>
|
|
|
<el-table-column align="center" prop="username" label="账号名称">
|
|
|
</el-table-column>
|
|
@@ -130,10 +134,11 @@
|
|
|
<el-form-item
|
|
|
style="margin-right: 20px; flex: 0.5"
|
|
|
label="所属账号"
|
|
|
- prop="username"
|
|
|
+ prop="parentId"
|
|
|
+ v-if="checkRole([0])"
|
|
|
>
|
|
|
<el-select
|
|
|
- v-model="addOrUpdateForm.accountId"
|
|
|
+ v-model="addOrUpdateForm.parentId"
|
|
|
filterable
|
|
|
clearable
|
|
|
placeholder="请选择所属账号"
|
|
@@ -196,12 +201,13 @@
|
|
|
|
|
|
<script>
|
|
|
import Pagination from "@/components/Pagination";
|
|
|
+import { getUserlist } from "@/api/user";
|
|
|
import {
|
|
|
- doGetAdmins,
|
|
|
- doEditAdmin,
|
|
|
- doDeleteAdmin,
|
|
|
- getUserlist,
|
|
|
-} from "@/api/user";
|
|
|
+ getAuthAdd,
|
|
|
+ getAuthPagelist,
|
|
|
+ getAuthList,
|
|
|
+ getAuthDelete,
|
|
|
+} from "@/api/userAuth";
|
|
|
import { checkRole } from "@/utils/checkRole";
|
|
|
export default {
|
|
|
components: { Pagination },
|
|
@@ -222,16 +228,14 @@ export default {
|
|
|
dialogVisible: false,
|
|
|
total: 0,
|
|
|
option: [],
|
|
|
+ authList: [], //授权账号
|
|
|
// 分页参数
|
|
|
page: {
|
|
|
data: {
|
|
|
+ parentId: "",
|
|
|
username: "",
|
|
|
- companyName: "",
|
|
|
- contactsName: "",
|
|
|
- contactsName: "",
|
|
|
- contactsPhone: "",
|
|
|
- startTime: "",
|
|
|
- endTime: "",
|
|
|
+ nickname: "",
|
|
|
+ phone: "",
|
|
|
},
|
|
|
pageNumber: 1,
|
|
|
pageSize: 10,
|
|
@@ -240,17 +244,17 @@ export default {
|
|
|
isEdit: false, //判断是否是编辑
|
|
|
// 添加编辑账号
|
|
|
addOrUpdateForm: {
|
|
|
+ parentId: "",
|
|
|
username: "", //账号名称
|
|
|
password: "", //账号密码
|
|
|
nickname: "", //管理员姓名
|
|
|
phone: "", //手机号
|
|
|
},
|
|
|
- //省市县列表
|
|
|
- province_list: [],
|
|
|
- city_list: [],
|
|
|
- area_list: [],
|
|
|
// 规则
|
|
|
rules: {
|
|
|
+ parentId: [
|
|
|
+ { required: true, message: "请输入账号名称", trigger: "blur" },
|
|
|
+ ],
|
|
|
username: [
|
|
|
{ required: true, message: "请输入账号名称", trigger: "blur" },
|
|
|
],
|
|
@@ -268,7 +272,10 @@ export default {
|
|
|
},
|
|
|
created() {
|
|
|
this.fetchData();
|
|
|
- this.getUserList();
|
|
|
+ if (checkRole([0])) {
|
|
|
+ this._getUserList();
|
|
|
+ }
|
|
|
+ this._getAuthList();
|
|
|
},
|
|
|
methods: {
|
|
|
// 查询权限
|
|
@@ -276,17 +283,23 @@ export default {
|
|
|
// 获取列表数据
|
|
|
fetchData() {
|
|
|
this.listLoading = true;
|
|
|
- doGetAdmins(this.page).then((res) => {
|
|
|
+ getAuthPagelist(this.page).then((res) => {
|
|
|
this.tableData = res.data.records;
|
|
|
this.total = res.data.total;
|
|
|
this.listLoading = false;
|
|
|
});
|
|
|
},
|
|
|
- getUserList() {
|
|
|
+ _getUserList() {
|
|
|
getUserlist().then((res) => {
|
|
|
this.option = res.data;
|
|
|
});
|
|
|
},
|
|
|
+ // 授权账号列表
|
|
|
+ _getAuthList() {
|
|
|
+ getAuthList().then((res) => {
|
|
|
+ this.authList = res.data;
|
|
|
+ });
|
|
|
+ },
|
|
|
// 添加编辑账号
|
|
|
addOrUpdate(dialogTitle, edit) {
|
|
|
this.dialogVisible = true;
|
|
@@ -309,7 +322,7 @@ export default {
|
|
|
if (!pass) {
|
|
|
return false;
|
|
|
}
|
|
|
- await doEditAdmin({
|
|
|
+ await getAuthAdd({
|
|
|
...this.addOrUpdateForm,
|
|
|
id: this.isEdit ? this.addOrUpdateForm.id : undefined,
|
|
|
});
|
|
@@ -327,7 +340,7 @@ export default {
|
|
|
type: "warning",
|
|
|
center: true,
|
|
|
}).then(() => {
|
|
|
- doDeleteAdmin(id).then((res) => {
|
|
|
+ getAuthDelete(id).then((res) => {
|
|
|
this.fetchData();
|
|
|
this.$message({
|
|
|
type: "success",
|