|
@@ -6,7 +6,17 @@
|
|
|
<el-row class="lot-authorization-body" :gutter="24">
|
|
|
<el-col :span="18">
|
|
|
<div class="body-card">
|
|
|
- <CheckCardList ref="userList" title="用户列表" label="OfficerName" :column="6" check-id="OfficerId" search-placeholder="请输入用户名称" :data-list="userList" @load="loadUserList" @check-change="userCheckChangeHandler" />
|
|
|
+ <CheckCardList
|
|
|
+ ref="userList"
|
|
|
+ title="用户列表"
|
|
|
+ label="OfficerName"
|
|
|
+ :column="6"
|
|
|
+ check-id="OfficerId"
|
|
|
+ search-placeholder="请输入用户名称"
|
|
|
+ :data-list="userList"
|
|
|
+ @load="loadUserList"
|
|
|
+ @check-change="userCheckChangeHandler"
|
|
|
+ />
|
|
|
</div>
|
|
|
</el-col>
|
|
|
<!-- <el-col :span="6">
|
|
@@ -24,10 +34,22 @@
|
|
|
</el-col> -->
|
|
|
<el-col :span="6">
|
|
|
<div class="body-card">
|
|
|
- <MultipleTree ref="organizationTree" :default-props="{
|
|
|
+ <MultipleTree
|
|
|
+ ref="organizationTree"
|
|
|
+ :default-props="{
|
|
|
children: 'children',
|
|
|
- label: 'OrganName'
|
|
|
- }" :data="orgTree" :checked-keys-duo="orgCheckedKeys" :check-strictly="true" :org-list="orgList" :default-multiple="true" node-key="OrganId" up-node-key="OrganUpid" title="选择组织" @getTreeDataDuo="orgCheckChangeHandler" />
|
|
|
+ label: 'OrganName',
|
|
|
+ }"
|
|
|
+ :data="orgTree"
|
|
|
+ :checked-keys-duo="orgCheckedKeys"
|
|
|
+ :check-strictly="true"
|
|
|
+ :org-list="orgList"
|
|
|
+ :default-multiple="true"
|
|
|
+ node-key="OrganId"
|
|
|
+ up-node-key="OrganUpid"
|
|
|
+ title="选择组织"
|
|
|
+ @getTreeDataDuo="orgCheckChangeHandler"
|
|
|
+ />
|
|
|
</div>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
@@ -35,109 +57,111 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import CheckCardList from '@/components/CheckCardList'
|
|
|
-import MultipleTree from '@/components/organization'
|
|
|
-import userList from '../mixins/userList'
|
|
|
-import sectionTree from '../mixins/sectionTree'
|
|
|
-import regulatorList from '../mixins/regulatorList'
|
|
|
-import orgTree from '../mixins/orgTree'
|
|
|
-import { SaveSection } from '@/api/section'
|
|
|
-import { translateDataToTreeAll } from '@/utils/validate'
|
|
|
+import CheckCardList from "@/components/CheckCardList";
|
|
|
+import MultipleTree from "@/components/organization";
|
|
|
+import userList from "../mixins/userList";
|
|
|
+import sectionTree from "../mixins/sectionTree";
|
|
|
+import regulatorList from "../mixins/regulatorList";
|
|
|
+import orgTree from "../mixins/orgTree";
|
|
|
+import { SaveSection, GetSectionByUser } from "@/api/section";
|
|
|
+import { translateDataToTreeAll } from "@/utils/validate";
|
|
|
|
|
|
export default {
|
|
|
components: { CheckCardList, MultipleTree },
|
|
|
mixins: [userList, sectionTree, regulatorList, orgTree],
|
|
|
- data () {
|
|
|
+ data() {
|
|
|
return {
|
|
|
- regulatorCheckDisabled: false
|
|
|
- }
|
|
|
+ regulatorCheckDisabled: false,
|
|
|
+ userDatas: [],
|
|
|
+ orgCheckedKeys: [],
|
|
|
+ };
|
|
|
},
|
|
|
watch: {
|
|
|
- checkedSections (arr) {
|
|
|
- this.hasChecked('section', !!arr.length)
|
|
|
+ checkedSections(arr) {
|
|
|
+ this.hasChecked("section", !!arr.length);
|
|
|
},
|
|
|
- checkedRegulators (arr) {
|
|
|
- this.hasChecked('regulator', !!arr.length)
|
|
|
+ checkedRegulators(arr) {
|
|
|
+ this.hasChecked("regulator", !!arr.length);
|
|
|
},
|
|
|
- checkedOrgs (arr) {
|
|
|
- this.hasChecked('org', !!arr.length)
|
|
|
+ checkedOrgs(arr) {
|
|
|
+ this.hasChecked("org", !!arr.length);
|
|
|
},
|
|
|
sectionList: {
|
|
|
- handler (arr) {
|
|
|
+ handler(arr) {
|
|
|
const obj = {
|
|
|
SessionId: -1,
|
|
|
- SessionName: '标段',
|
|
|
+ SessionName: "标段",
|
|
|
UpSessionId: -2,
|
|
|
disabled: true,
|
|
|
- children: translateDataToTreeAll(arr, 'UpSessionId', 'SessionId')
|
|
|
- }
|
|
|
- this.sectionTree = [obj]
|
|
|
+ children: translateDataToTreeAll(arr, "UpSessionId", "SessionId"),
|
|
|
+ };
|
|
|
+ this.sectionTree = [obj];
|
|
|
},
|
|
|
- deep: true
|
|
|
+ deep: true,
|
|
|
},
|
|
|
orgList: {
|
|
|
- handler (arr) {
|
|
|
+ handler(arr) {
|
|
|
const obj = {
|
|
|
AuthCount: 0,
|
|
|
JobCount: 0,
|
|
|
OfficerCount: 0,
|
|
|
OrganId: -1,
|
|
|
- OrganName: '佛山路桥',
|
|
|
+ OrganName: "佛山路桥",
|
|
|
OrganUpid: -2,
|
|
|
- QueryTarget: '0',
|
|
|
+ QueryTarget: "0",
|
|
|
Type: 0,
|
|
|
disabled: true,
|
|
|
- children: translateDataToTreeAll(arr, 'OrganUpid', 'OrganId')
|
|
|
- }
|
|
|
- this.orgTree = [obj]
|
|
|
+ children: translateDataToTreeAll(arr, "OrganUpid", "OrganId"),
|
|
|
+ };
|
|
|
+ this.orgTree = [obj];
|
|
|
},
|
|
|
- deepL: true
|
|
|
- }
|
|
|
+ deepL: true,
|
|
|
+ },
|
|
|
},
|
|
|
methods: {
|
|
|
- hasChecked (type, checked) {
|
|
|
+ hasChecked(type, checked) {
|
|
|
switch (type) {
|
|
|
- case 'section':
|
|
|
- this.regulatorCheckDisabled = checked
|
|
|
- this.orgList = this.orgList.map(element => {
|
|
|
- element.disabled = checked
|
|
|
- return element
|
|
|
- })
|
|
|
- break
|
|
|
- case 'regulator':
|
|
|
- this.sectionList = this.sectionList.map(element => {
|
|
|
- element.disabled = checked
|
|
|
- return element
|
|
|
- })
|
|
|
- this.orgList = this.orgList.map(element => {
|
|
|
- element.disabled = checked
|
|
|
- return element
|
|
|
- })
|
|
|
- break
|
|
|
- case 'org':
|
|
|
- this.regulatorCheckDisabled = checked
|
|
|
- this.sectionList = this.sectionList.map(element => {
|
|
|
- element.disabled = checked
|
|
|
- return element
|
|
|
- })
|
|
|
- break
|
|
|
+ case "section":
|
|
|
+ this.regulatorCheckDisabled = checked;
|
|
|
+ this.orgList = this.orgList.map((element) => {
|
|
|
+ element.disabled = checked;
|
|
|
+ return element;
|
|
|
+ });
|
|
|
+ break;
|
|
|
+ case "regulator":
|
|
|
+ this.sectionList = this.sectionList.map((element) => {
|
|
|
+ element.disabled = checked;
|
|
|
+ return element;
|
|
|
+ });
|
|
|
+ this.orgList = this.orgList.map((element) => {
|
|
|
+ element.disabled = checked;
|
|
|
+ return element;
|
|
|
+ });
|
|
|
+ break;
|
|
|
+ case "org":
|
|
|
+ this.regulatorCheckDisabled = checked;
|
|
|
+ this.sectionList = this.sectionList.map((element) => {
|
|
|
+ element.disabled = checked;
|
|
|
+ return element;
|
|
|
+ });
|
|
|
+ break;
|
|
|
default:
|
|
|
- break
|
|
|
+ break;
|
|
|
}
|
|
|
},
|
|
|
- btnSaveHandler () {
|
|
|
+ btnSaveHandler() {
|
|
|
if (this.checkedUsers.length === 0) {
|
|
|
- this.$message.error('请选择用户')
|
|
|
- return
|
|
|
+ this.$message.error("请选择用户");
|
|
|
+ return;
|
|
|
} else if (
|
|
|
this.checkedSections.length === 0 &&
|
|
|
this.checkedRegulators.length === 0 &&
|
|
|
this.checkedOrgs.length === 0
|
|
|
) {
|
|
|
- this.$message.error('请选择标段、监管单位或组织')
|
|
|
- return
|
|
|
+ this.$message.error("请选择标段、监管单位或组织");
|
|
|
+ return;
|
|
|
}
|
|
|
- const mixedDatas = []
|
|
|
+ const mixedDatas = [];
|
|
|
// this.checkedUsers.forEach(user => {
|
|
|
// this.checkedSections.forEach(section => {
|
|
|
// this.checkedRegulators.forEach(regulator => {
|
|
@@ -153,56 +177,80 @@ export default {
|
|
|
// })
|
|
|
// })
|
|
|
if (this.checkedSections.length) {
|
|
|
- this.checkedUsers.forEach(user => {
|
|
|
- this.checkedSections.forEach(section => {
|
|
|
+ this.checkedUsers.forEach((user) => {
|
|
|
+ this.checkedSections.forEach((section) => {
|
|
|
mixedDatas.push({
|
|
|
OfficerId: user.OfficerId,
|
|
|
SessionId: section.SessionId,
|
|
|
OthOrganId: null,
|
|
|
- OrganId: null
|
|
|
- })
|
|
|
- })
|
|
|
- })
|
|
|
+ OrganId: null,
|
|
|
+ });
|
|
|
+ });
|
|
|
+ });
|
|
|
} else if (this.checkedRegulators.length) {
|
|
|
- this.checkedUsers.forEach(user => {
|
|
|
- this.checkedRegulators.forEach(regulator => {
|
|
|
+ this.checkedUsers.forEach((user) => {
|
|
|
+ this.checkedRegulators.forEach((regulator) => {
|
|
|
mixedDatas.push({
|
|
|
OfficerId: user.OfficerId,
|
|
|
SessionId: null,
|
|
|
OthOrganId: regulator.OrganId,
|
|
|
- OrganId: null
|
|
|
- })
|
|
|
- })
|
|
|
- })
|
|
|
+ OrganId: null,
|
|
|
+ });
|
|
|
+ });
|
|
|
+ });
|
|
|
} else if (this.checkedOrgs.length) {
|
|
|
- this.checkedUsers.forEach(user => {
|
|
|
- this.checkedOrgs.forEach(org => {
|
|
|
+ this.checkedUsers.forEach((user) => {
|
|
|
+ this.checkedOrgs.forEach((org) => {
|
|
|
mixedDatas.push({
|
|
|
OfficerId: user.OfficerId,
|
|
|
SessionId: null,
|
|
|
OthOrganId: null,
|
|
|
- OrganId: org.OrganId
|
|
|
- })
|
|
|
- })
|
|
|
- })
|
|
|
+ OrganId: org.OrganId,
|
|
|
+ });
|
|
|
+ });
|
|
|
+ });
|
|
|
}
|
|
|
// console.log(mixedDatas)
|
|
|
- this.saveSection(mixedDatas)
|
|
|
+ this.saveSection(mixedDatas);
|
|
|
},
|
|
|
- async saveSection (params) {
|
|
|
+ async saveSection(params) {
|
|
|
try {
|
|
|
- const res = await SaveSection(params)
|
|
|
+ const res = await SaveSection(params);
|
|
|
if (res.code === 0) {
|
|
|
- this.$message.success(res.message ?? '成功')
|
|
|
+ this.$message.success(res.message ?? "成功");
|
|
|
} else {
|
|
|
- this.$message.error(res.message ?? '失败')
|
|
|
+ this.$message.error(res.message ?? "失败");
|
|
|
}
|
|
|
} catch (error) {
|
|
|
- console.log('错误', error)
|
|
|
+ console.log("错误", error);
|
|
|
}
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
+ },
|
|
|
+ userCheckChangeHandler(arr) {
|
|
|
+ this.getSectionByUser(arr);
|
|
|
+ },
|
|
|
+ async getSectionByUser(arr) {
|
|
|
+ try {
|
|
|
+ const { code, returnData, message } = await GetSectionByUser({
|
|
|
+ UserList: arr,
|
|
|
+ });
|
|
|
+ if (code == 0) {
|
|
|
+ const { OrganList } = returnData;
|
|
|
+ const datas = [];
|
|
|
+ if (OrganList && OrganList.length) {
|
|
|
+ OrganList.forEach((item) => {
|
|
|
+ datas.push(item.OrganId);
|
|
|
+ });
|
|
|
+ this.orgCheckedKeys = datas;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.$message.error(message ?? "失败");
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ console.log("错误", error);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ },
|
|
|
+};
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|