|
@@ -94,19 +94,20 @@
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="24">
|
|
|
- <el-form-item label="业务公司" prop="status1">
|
|
|
+ <el-form-item label="业务公司" prop="companyArr">
|
|
|
<el-row>
|
|
|
<el-col :span="20">
|
|
|
<el-checkbox
|
|
|
:size="'mini'"
|
|
|
:indeterminate="isIndeterminate"
|
|
|
- v-model="checkAll"
|
|
|
+ v-model="ruleForm.is_all"
|
|
|
@change="handleCheckAllChange"
|
|
|
>全选</el-checkbox
|
|
|
>
|
|
|
<el-checkbox-group
|
|
|
:size="'mini'"
|
|
|
- v-model="ruleForm.statu1"
|
|
|
+ v-model="ruleForm.companyArr"
|
|
|
+ @change="handleCheckedCitiesChange"
|
|
|
class="“fl"
|
|
|
>
|
|
|
<el-checkbox
|
|
@@ -116,22 +117,18 @@
|
|
|
box-sizing: border-box;
|
|
|
"
|
|
|
v-for="(item, i) in coptions"
|
|
|
- :key="item.companyNo + i"
|
|
|
- :label="item.companyNo"
|
|
|
- :style="{ background: i % 2 === 0 ? '#f00' : '#0ff' }"
|
|
|
+ :key="item.id + i"
|
|
|
+ :label="item.id"
|
|
|
:disabled="item.status === '0'"
|
|
|
>{{ item.company }}</el-checkbox
|
|
|
>
|
|
|
</el-checkbox-group>
|
|
|
</el-col>
|
|
|
<el-col :span="4" style="padding: 33px 0 0 0">
|
|
|
- <el-radio-group v-model="ruleForm.statu2">
|
|
|
+ <el-radio-group v-model="ruleForm.is_main">
|
|
|
<el-radio
|
|
|
- v-for="(si, sii) in statu2options"
|
|
|
- :key="si + sii"
|
|
|
- :style="{
|
|
|
- background: sii % 2 === 0 ? '#0f0' : '#00f',
|
|
|
- }"
|
|
|
+ v-for="(si, sii) in is_mainoptions"
|
|
|
+ :key="si.id + sii"
|
|
|
style="
|
|
|
display: block;
|
|
|
margin: 0;
|
|
@@ -139,7 +136,8 @@
|
|
|
height: 28px;
|
|
|
box-sizing: border-box;
|
|
|
"
|
|
|
- :label="si"
|
|
|
+ :disabled="si.status === '0'"
|
|
|
+ :label="si.id"
|
|
|
>设为默认</el-radio
|
|
|
>
|
|
|
</el-radio-group>
|
|
@@ -148,18 +146,17 @@
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="24">
|
|
|
- <el-form-item label="业务平台" prop="status3">
|
|
|
+ <el-form-item label="业务平台" prop="platform">
|
|
|
<el-checkbox-group
|
|
|
:size="'mini'"
|
|
|
- v-model="ruleForm.statu3"
|
|
|
+ v-model="ruleForm.platform"
|
|
|
class="“fl"
|
|
|
>
|
|
|
<el-checkbox
|
|
|
style="display: block; margin: 0; box-sizing: border-box"
|
|
|
- v-for="(item, i) in statu3options"
|
|
|
+ v-for="(item, i) in platformoptions"
|
|
|
:key="item.id + i"
|
|
|
:label="item.id"
|
|
|
- :style="{ background: i % 2 === 0 ? '#f00' : '#0ff' }"
|
|
|
>{{ item.platform_name }}</el-checkbox
|
|
|
>
|
|
|
</el-checkbox-group>
|
|
@@ -168,7 +165,7 @@
|
|
|
</el-row>
|
|
|
</el-form>
|
|
|
</el-col>
|
|
|
- <el-col :span="24" style="text-align: right">
|
|
|
+ <el-col :span="6" class="bottom-btn">
|
|
|
<el-button
|
|
|
v-if="!isDetail"
|
|
|
type="primary"
|
|
@@ -198,7 +195,7 @@ import {
|
|
|
} from "@/utils/validate";
|
|
|
export default {
|
|
|
name: "Account",
|
|
|
- props: ["showModel", "id", "isDetail", "sitem"],
|
|
|
+ props: ["showModel", "id", "isDetail"],
|
|
|
mixins: [resToken],
|
|
|
data() {
|
|
|
const validateusername = (rule, value, callback) => {
|
|
@@ -267,22 +264,22 @@ export default {
|
|
|
organizeList: [],
|
|
|
showModelThis: this.showModel,
|
|
|
coptions: [],
|
|
|
- statu2options: [],
|
|
|
- checkAll: false,
|
|
|
- isIndeterminate: true,
|
|
|
+ is_mainoptions: [],
|
|
|
+ isIndeterminate: false,
|
|
|
ruleForm: {
|
|
|
username: "", // 账号
|
|
|
name: "", // 真实姓名
|
|
|
mobile: "",
|
|
|
email: "",
|
|
|
role_id: "",
|
|
|
+ is_all: "",
|
|
|
status: "1",
|
|
|
itemid: [],
|
|
|
- statu1: [],
|
|
|
- statu2: "",
|
|
|
- statu3: "",
|
|
|
+ companyArr: [],
|
|
|
+ is_main: "",
|
|
|
+ platform: [],
|
|
|
},
|
|
|
- statu3options: [],
|
|
|
+ platformoptions: [],
|
|
|
rulesThis: this.rules,
|
|
|
rules: {
|
|
|
name: [
|
|
@@ -328,25 +325,21 @@ export default {
|
|
|
trigger: "change",
|
|
|
},
|
|
|
],
|
|
|
- status: [
|
|
|
- {
|
|
|
- required: true,
|
|
|
- message: "请选择状态",
|
|
|
- trigger: "change",
|
|
|
- },
|
|
|
- ],
|
|
|
- statu1: [
|
|
|
+
|
|
|
+ companyArr: [
|
|
|
{
|
|
|
type: "array",
|
|
|
required: true,
|
|
|
- message: "请选择状态",
|
|
|
+ message: "至少选择一个业务公司",
|
|
|
trigger: "change",
|
|
|
},
|
|
|
],
|
|
|
- statu2: [
|
|
|
+
|
|
|
+ platform: [
|
|
|
{
|
|
|
+ type: "array",
|
|
|
required: true,
|
|
|
- message: "请选择默认业务公司",
|
|
|
+ message: "至少选择一个业务平台",
|
|
|
trigger: "change",
|
|
|
},
|
|
|
],
|
|
@@ -375,6 +368,15 @@ export default {
|
|
|
async initForm() {
|
|
|
this.loading = true;
|
|
|
|
|
|
+ await this.getClist();
|
|
|
+ await this.getRole();
|
|
|
+ await this.getWorkList();
|
|
|
+ await this.getTerraceList();
|
|
|
+ if (this.id === "add") {
|
|
|
+ await this.resetForm();
|
|
|
+ } else {
|
|
|
+ await this.initData();
|
|
|
+ }
|
|
|
if (this.id === "add") {
|
|
|
this.title = "添加账号";
|
|
|
this.rulesThis = this.rules;
|
|
@@ -386,17 +388,6 @@ export default {
|
|
|
this.title = "修改账号";
|
|
|
this.rulesThis = this.rules;
|
|
|
}
|
|
|
- await this.getClist();
|
|
|
- await this.getRole();
|
|
|
- await this.getWorkList();
|
|
|
- await this.getTerraceList();
|
|
|
- if (this.id === "add") {
|
|
|
- await this.resetForm();
|
|
|
- } else {
|
|
|
- await this.resetForm(this.sitem);
|
|
|
- }
|
|
|
-
|
|
|
- // await this.initData()
|
|
|
}
|
|
|
this.loading = false;
|
|
|
},
|
|
@@ -418,7 +409,7 @@ export default {
|
|
|
//获取全部业务公司
|
|
|
async getWorkList() {
|
|
|
this.coptions = [];
|
|
|
- this.statu2options = [];
|
|
|
+ this.is_mainoptions = [];
|
|
|
const { code, data, message } = await asyncRequest.getWorkList({
|
|
|
size: 10000,
|
|
|
page: 1,
|
|
@@ -427,7 +418,10 @@ export default {
|
|
|
const { list, count } = data;
|
|
|
this.coptions = list;
|
|
|
this.coptions.forEach((e) => {
|
|
|
- this.statu2options.push(e.companyNo);
|
|
|
+ this.is_mainoptions.push({
|
|
|
+ id: e.id,
|
|
|
+ status: e.status,
|
|
|
+ });
|
|
|
});
|
|
|
} else if (code >= 100 && code <= 104) {
|
|
|
await this.logout();
|
|
@@ -437,14 +431,14 @@ export default {
|
|
|
},
|
|
|
//获取全部业务平台
|
|
|
async getTerraceList() {
|
|
|
- this.statu3options = [];
|
|
|
+ this.platformoptions = [];
|
|
|
const { code, data, message } = await asyncRequest.getTerraceList({
|
|
|
size: 10000,
|
|
|
page: 1,
|
|
|
});
|
|
|
if (code === 0) {
|
|
|
const { list, count } = data;
|
|
|
- this.statu3options = list;
|
|
|
+ this.platformoptions = list;
|
|
|
} else if (code >= 100 && code <= 104) {
|
|
|
await this.logout();
|
|
|
} else {
|
|
@@ -452,13 +446,22 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
handleCheckAllChange(val) {
|
|
|
- this.checkedCities = val ? this.coptions : [];
|
|
|
- this.isIndeterminate = false;
|
|
|
+ let checkedCount = val ? this.coptions.length : 0;
|
|
|
+ this.isIndeterminate =
|
|
|
+ checkedCount > 0 && checkedCount < this.coptions.length;
|
|
|
+ this.ruleForm.companyArr = [];
|
|
|
+ if (checkedCount !== 0) {
|
|
|
+ this.coptions.forEach((e) => {
|
|
|
+ if (e.status === "1") {
|
|
|
+ this.ruleForm.companyArr.push(e.id);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
},
|
|
|
handleCheckedCitiesChange(value) {
|
|
|
console.log(value);
|
|
|
let checkedCount = value.length;
|
|
|
- this.checkAll = checkedCount === this.coptions.length;
|
|
|
+ this.ruleForm.is_all = checkedCount === this.coptions.length;
|
|
|
this.isIndeterminate =
|
|
|
checkedCount > 0 && checkedCount < this.coptions.length;
|
|
|
},
|
|
@@ -493,14 +496,15 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
async initData() {
|
|
|
- const res = await asyncRequest.detail({ id: this.id });
|
|
|
- if (res && res.code === 0 && res.data) {
|
|
|
- this.ruleForm = res.data;
|
|
|
- this.ruleForm.role_id = this.ruleForm.role;
|
|
|
- } else if (res && res.code >= 100 && res.code <= 104) {
|
|
|
+ const { code, data, message } = await asyncRequest.detail({
|
|
|
+ id: this.id,
|
|
|
+ });
|
|
|
+ if (code === 0) {
|
|
|
+ await this.resetForm(data);
|
|
|
+ } else if (code >= 100 && code <= 104) {
|
|
|
await this.logout();
|
|
|
} else {
|
|
|
- this.$message.warning(res.message);
|
|
|
+ this.$message.warning(message);
|
|
|
}
|
|
|
},
|
|
|
async resetForm(sitem) {
|
|
@@ -509,31 +513,51 @@ export default {
|
|
|
if (this.$refs.ruleForm) {
|
|
|
this.$refs.ruleForm.resetFields();
|
|
|
this.$refs.ruleForm.clearValidate();
|
|
|
- const {
|
|
|
- username,
|
|
|
- nickname,
|
|
|
- mobile,
|
|
|
- email,
|
|
|
- roleid,
|
|
|
- status,
|
|
|
- depart_code,
|
|
|
- } = sitem;
|
|
|
- this.ruleForm = {
|
|
|
- username: username || "", // 账号
|
|
|
- name: nickname || "", // 真实姓名
|
|
|
- mobile: mobile || "",
|
|
|
- email: email || "",
|
|
|
- role_id: roleid || "",
|
|
|
- status: status || "",
|
|
|
- itemid: depart_code || [],
|
|
|
- statu2: "",
|
|
|
- statu1: [],
|
|
|
- statu3: "",
|
|
|
- };
|
|
|
- // console.log(depart_code);
|
|
|
- // if (this.id === "add" || this.isDetail) {
|
|
|
- // this.rules.username[0].required = false;
|
|
|
- // }
|
|
|
+ if (sitem) {
|
|
|
+ const {
|
|
|
+ username,
|
|
|
+ nickname,
|
|
|
+ mobile,
|
|
|
+ email,
|
|
|
+ roleid,
|
|
|
+ status,
|
|
|
+ depart,
|
|
|
+ } = sitem;
|
|
|
+ let depart_code = [];
|
|
|
+ if (depart && depart.length > 0) {
|
|
|
+ depart.forEach((a) => {
|
|
|
+ depart_code.push(a.id);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ this.ruleForm = {
|
|
|
+ username: username || "", // 账号
|
|
|
+ name: nickname || "", // 真实姓名
|
|
|
+ mobile: mobile || "",
|
|
|
+ email: email || "",
|
|
|
+ role_id: roleid || "",
|
|
|
+ status: status || "",
|
|
|
+ itemid: depart_code,
|
|
|
+ is_main: "",
|
|
|
+ companyArr: [],
|
|
|
+ platform: [],
|
|
|
+ };
|
|
|
+ this.handleCheckAllChange();
|
|
|
+ } else {
|
|
|
+ this.ruleForm = {
|
|
|
+ username: "", // 账号
|
|
|
+ name: "", // 真实姓名
|
|
|
+ mobile: "",
|
|
|
+ email: "",
|
|
|
+ role_id: "",
|
|
|
+ is_all: "",
|
|
|
+ status: "1",
|
|
|
+ itemid: [],
|
|
|
+ companyArr: [],
|
|
|
+ is_main: "",
|
|
|
+ platform: [],
|
|
|
+ };
|
|
|
+ this.handleCheckAllChange();
|
|
|
+ }
|
|
|
}
|
|
|
});
|
|
|
},
|
|
@@ -587,5 +611,12 @@ export default {
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
.account {
|
|
|
+ .bottom-btn {
|
|
|
+ position: absolute;
|
|
|
+ bottom: 0px;
|
|
|
+ right: 0;
|
|
|
+ text-align: right;
|
|
|
+ z-index: 2;
|
|
|
+ }
|
|
|
}
|
|
|
</style>
|