|
@@ -305,6 +305,7 @@ import {
|
|
|
} from '@/api/saleManage/businessOpportunity';
|
|
} from '@/api/saleManage/businessOpportunity';
|
|
|
import { getTableList } from '@/api/saleManage/businessOpportunity';
|
|
import { getTableList } from '@/api/saleManage/businessOpportunity';
|
|
|
import { enterprisePage } from '@/api/contractManage/contractBook';
|
|
import { enterprisePage } from '@/api/contractManage/contractBook';
|
|
|
|
|
+import { listOrganizations } from '@/api/system/organization';
|
|
|
import { getcontactlink } from '@/api/saleManage/businessFollow';
|
|
import { getcontactlink } from '@/api/saleManage/businessFollow';
|
|
|
import headList from '@/BIZComponents/user-select/user-select.vue';
|
|
import headList from '@/BIZComponents/user-select/user-select.vue';
|
|
|
import { copyObj } from '@/utils/util';
|
|
import { copyObj } from '@/utils/util';
|
|
@@ -472,6 +473,7 @@ export default {
|
|
|
};
|
|
};
|
|
|
},
|
|
},
|
|
|
created() {
|
|
created() {
|
|
|
|
|
+ this.getGroupAll();
|
|
|
this.getEnterprisePage();
|
|
this.getEnterprisePage();
|
|
|
},
|
|
},
|
|
|
|
|
|
|
@@ -632,6 +634,9 @@ export default {
|
|
|
this.editType = type;
|
|
this.editType = type;
|
|
|
this.row = row;
|
|
this.row = row;
|
|
|
this.visible = true;
|
|
this.visible = true;
|
|
|
|
|
+ if (this.groupData.length == 0) {
|
|
|
|
|
+ await this.getGroupAll();
|
|
|
|
|
+ }
|
|
|
if (this.enterprisePage.length == 0) {
|
|
if (this.enterprisePage.length == 0) {
|
|
|
await this.getEnterprisePage();
|
|
await this.getEnterprisePage();
|
|
|
}
|
|
}
|
|
@@ -641,11 +646,9 @@ export default {
|
|
|
userInfo.id = userInfo.userId;
|
|
userInfo.id = userInfo.userId;
|
|
|
this.form.settlementMode = '3';
|
|
this.form.settlementMode = '3';
|
|
|
this.changePersonel(userInfo);
|
|
this.changePersonel(userInfo);
|
|
|
- if (this.enterprisePage.length > 0) {
|
|
|
|
|
- this.form.quoteName = this.enterprisePage[0].name;
|
|
|
|
|
- // this.form.quoteTel = this.enterprisePage[0].tel;
|
|
|
|
|
- this.form.quoteFax = this.enterprisePage[0].fax;
|
|
|
|
|
- this.form.quoteAddress = this.enterprisePage[0].address;
|
|
|
|
|
|
|
+ const enterprise = this.getCurrentEnterprise();
|
|
|
|
|
+ if (enterprise) {
|
|
|
|
|
+ this.getEnterprise(enterprise);
|
|
|
}
|
|
}
|
|
|
if (this.contactData.id) {
|
|
if (this.contactData.id) {
|
|
|
this.changeParent({ id: this.contactData.id }, 'init');
|
|
this.changeParent({ id: this.contactData.id }, 'init');
|
|
@@ -670,8 +673,13 @@ export default {
|
|
|
await this.getDetailData(row.id);
|
|
await this.getDetailData(row.id);
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
|
|
+ getGroupAll() {
|
|
|
|
|
+ return listOrganizations().then((list) => {
|
|
|
|
|
+ this.groupData = list;
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
getEnterprisePage() {
|
|
getEnterprisePage() {
|
|
|
- enterprisePage({
|
|
|
|
|
|
|
+ return enterprisePage({
|
|
|
pageNum: 1,
|
|
pageNum: 1,
|
|
|
size: 100
|
|
size: 100
|
|
|
}).then((res) => {
|
|
}).then((res) => {
|
|
@@ -679,10 +687,26 @@ export default {
|
|
|
this.enterprisePage.push(...res.list);
|
|
this.enterprisePage.push(...res.list);
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
|
- getEnterprise() {
|
|
|
|
|
- let data = this.enterprisePage.find(
|
|
|
|
|
- (item) => item.name == this.form.quoteName
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ getCurrentEnterprise() {
|
|
|
|
|
+ let groupId = this.$store.state.user.info?.groupId;
|
|
|
|
|
+ const visitedGroupIds = [];
|
|
|
|
|
+ while (groupId && !visitedGroupIds.includes(groupId)) {
|
|
|
|
|
+ const enterprise = this.enterprisePage.find(
|
|
|
|
|
+ (item) => item.groupId == groupId
|
|
|
|
|
+ );
|
|
|
|
|
+ if (enterprise) {
|
|
|
|
|
+ return enterprise;
|
|
|
|
|
+ }
|
|
|
|
|
+ visitedGroupIds.push(groupId);
|
|
|
|
|
+ const group = this.groupData.find((item) => item.id == groupId);
|
|
|
|
|
+ groupId = group?.parentId;
|
|
|
|
|
+ }
|
|
|
|
|
+ return this.enterprisePage.length === 1 ? this.enterprisePage[0] : null;
|
|
|
|
|
+ },
|
|
|
|
|
+ getEnterprise(enterprise) {
|
|
|
|
|
+ let data =
|
|
|
|
|
+ enterprise ||
|
|
|
|
|
+ this.enterprisePage.find((item) => item.name == this.form.quoteName);
|
|
|
this.form.quoteName = data.name;
|
|
this.form.quoteName = data.name;
|
|
|
|
|
|
|
|
// this.form.quoteTel = data.tel;
|
|
// this.form.quoteTel = data.tel;
|