import { getCommercialEngineeringDetail, getPositionProject } from '@/api/frock' import { getDictList, getSalesmanList } from '@/api/common' import { getDealerListV2 } from '@/api/basic_data/dealer' import { getFirstPartyCustomerManagementList } from '@/api/basic_data/partya' export default { props: { detailId: { type: String, default: '' }, module: { type: String, default: 'add' } }, data() { return { resetData: {}, formData: { address: '', adminCompanyId: '', adminUserId: '', adminWebsitId: '', applyUpdateBy: '', applyUpdateCompanyId: '', applyUpdateCompanyName: '', applyUpdateName: '', areaId: '', cityId: '', commonFollowProject: '', confirmBy: '', confirmName: '', confirmTime: '', customerAddress: '', customerId: '', customerLinkMobile: '', customerLinkName: '', customerName: '', customerNumber: '', del: null, drawUpload: '', enginLinkMobile: '', enginLinkName: '', examineNote: '', tradeName: '', tradeParentName: '', extent: '', files: [], followCustomer: '', followCustomerMobile: '', homeProjectNameArea: '', homeProjectNameNumber: '', homeProjectNameRadio: '', homeProjectNameSeat: '', id: '', isApplyUpdate: null, isSpan: null, items: [], lat: '', lnt: '', loginStatus: '', machineType: '', note: '', orderStatus: '', orderType: '', otherInfo: '', partyA: '', partyAId: '', positionAddress: '', preDeviceAmount: 0, preSignDate: '', projectArea: '', projectCategory: '', projectMent: '', projectName: '', projectNo: '', provinceId: '', refCustomerId: '', remark: '', salesCompanyName: '', serviceId: '', serviceName: '', status: '', streetId: '', submitBy: '', submitName: '', submitTime: '', successLoginProject: '', successRate: '', tradeId: '', tradeParentId: '', type: '', useExtent: '' }, commonData: { dict: { TRADE_LOGIN_CATEGORY: [], // 项目类别 TRADE_LOGIN_TYPE: [], // 类型 SUCCESS_RATE: [], // 成功机率 FOLLOW_STATUS: [], // 工程跟进状态 MACHINE_TYPE: [], // 机组类型 TRADE_EXAMINE_NOTE: [], // 审核备注 TRADE_PROJECT_AREA: [] // 项目所在区域 }, salesmanList: [], customerList: [], PartyAList: [], vicinityMarkers: [] } } }, created() { this.resetData = { ...this.formData } this.getDictList() this.getDealerListV2() this.getSalesmanList() this.getFirstPartyCustomerManagementList() if (this.detailId) { this.getCommercialEngineeringDetail() this.getPositionProject() } }, methods: { getDictList() { Object.keys(this.commonData.dict).forEach(async k => { const { data } = await getDictList({ sysDictEnum: k }) this.commonData.dict[k] = data.map(l => { return { label: l.dictValue, value: l.dictCode } }) }) }, getSalesmanList() { getSalesmanList({ pageNum: 1, pageSize: -1, isCustomer: 0, status: true }).then(res => { this.commonData.salesmanList = res.data.records.map(k => { return { label: k.nickName, value: k.adminUserId } }) }) }, getFirstPartyCustomerManagementList() { getFirstPartyCustomerManagementList({ pageNum: 1, pageSize: -1 }).then(res => { this.commonData.PartyAList = res.data.records.map(k => { return { label: k.name, value: k.id } }) }) }, getDealerListV2() { getDealerListV2({ pageNum: 1, pageSize: -1, params: [ { param: 'a.jiaxian_type', compare: '=', value: 'KING' } ] }).then(res => { this.commonData.customerList = res.data.records.map(k => { return { number: k.number, label: k.name, value: k.id } }) }) }, getCommercialEngineeringDetail() { getCommercialEngineeringDetail({ id: this.detailId }).then(res => { this.formData = { ...res.data } }) }, getPositionProject() { getPositionProject({ id: this.detailId }).then(res => { this.commonData.vicinityMarkers = res.data }) }, onReset() { this.formData = { ...this.resetData, id: this.detailId } } } }