diff --git a/src/views/caseManage/createCase.vue b/src/views/caseManage/createCase.vue index 7d52b7a..720da33 100644 --- a/src/views/caseManage/createCase.vue +++ b/src/views/caseManage/createCase.vue @@ -82,7 +82,8 @@ - + + @@ -90,11 +91,11 @@ - - - - - + + + + + @@ -172,13 +173,17 @@ import { getEorc, getCaseSource, getCaseLevel } from '@/api/allDict' import { getCaseType, getCaseDetailType, addCase } from '@/api/callCase' import { getNextNodeList } from '@/api/process' +import { getAreaList } from '@/api/system/area' +import { getCustomerList } from '@/api/customer' + export default { name: 'CreateCase', components: { KnowledgeSearch }, data() { const validateAddress = function(rule, value, callback) { console.log(value) - if (value.areaCode === '' || value.streetCode === '' || value.communityCode === '') { + // if (value.areaCode === '' || value.streetCode === '' || value.communityCode === '') { + if (value.areaCode === '' || value.streetCode === '') { callback(new Error('地址需填写完整')) } else { callback() @@ -195,7 +200,7 @@ return { form: { caseId: '', // 案卷编号,年月日时分秒毫秒+坐席号 - sound: '645ffd84-77d8-11ea-8021-53392d079625', // 来电录音编号 + sound: '', // 来电录音编号 callTime: '', // 来电时间 reporterName: '', // 事件联系人 reporterPhone: '', // 时间联系人电话 @@ -206,7 +211,7 @@ }, // 案卷类别 source: '3', // 来源 address: { - areaCode: '360721', // 区域ID + areaCode: '99', // 区域ID streetCode: '', // 街道ID communityCode: '', // 社区ID gridId: '', // 网格ID @@ -271,6 +276,14 @@ this.fetchCaseDetailTypeList() } }, + 'form.address.areaCode': function(val) { + if (val === '') { + this.form.address.streetCode = '' + this.form.address.communityCode = '' + } else { + this.fetchStreetList() + } + }, 'form.address.streetCode': function(val) { if (val === '') { this.form.address.communityCode = '' @@ -280,10 +293,10 @@ } }, created() { - console.log('createCase Created') this.fetchCaseSourceList() this.fetchCaseLevelList() this.fetchEorcList() + this.fetchAreaList() this.fetchStreetList() this.fetchProcessWayList() }, @@ -343,7 +356,7 @@ }, // 案卷类别 source: '3', // 来源 address: { - areaCode: '360721', // 区域ID + areaCode: '99', // 区域ID streetCode: '', // 街道ID communityCode: '', // 社区ID gridId: '', // 网格ID @@ -365,34 +378,55 @@ }) this.generateCaseId() // 根据电话去查找人 - if (this.reporterPhone) { - this.fetchReporter(this.reporterPhone) + if (this.form.reporterPhone) { + this.fetchReporter(this.form.reporterPhone) } }, // 根据电话去找人 fetchReporter(phone) { - this.reporterName = '张三' + const params = { + tel: phone + } + getCustomerList(params).then(response => { + if (response.code === 200 && response.data && response.data.total === 1) { + this.form.reporterName = response.data.rows[0].name + } + }) }, // 获取联系人列表 fetchReportersList() { - + const params = { + limit: 10000, + offset: 1 + } + getCustomerList(params).then(response => { + if (response.code === 200) { + this.reportersList = response.data.rows + } + }) }, // 案卷来源列表 fetchCaseSourceList() { getCaseSource().then(response => { - this.caseSourceList = response.data + if (response.code === 200) { + this.caseSourceList = response.data + } }) }, // 案卷等级列表 fetchCaseLevelList() { getCaseLevel().then(response => { - this.caseLevelList = response.data + if (response.code === 200) { + this.caseLevelList = response.data + } }) }, // 大类列表 fetchEorcList() { getEorc().then(response => { - this.eorcList = response.data + if (response.code === 200) { + this.eorcList = response.data + } }) }, // 二级类型列表 @@ -418,34 +452,21 @@ }, // 区列表 fetchAreaList() { - this.areaList = [ - { - id: '360721', - name: '蓉江新区' - } - ] + getAreaList('0').then(response => { + this.areaList = response.data + }) }, // 街道列表 fetchStreetList() { - this.streetList = [ - { - id: '020001', - name: '黄金岭街道' - }, - { - id: '360702091', - name: '潭东镇' - } - ] + getAreaList(this.form.address.areaCode).then(response => { + this.streetList = response.data + }) }, // 社区列表 fetchCommunityList() { - this.communityList = [ - { - id: '1', - name: '赣南师范大学' - } - ] + getAreaList(this.form.address.streetCode).then(response => { + this.communityList = response.data + }) }, // 获取处理方式列表 fetchProcessWayList() { @@ -457,7 +478,7 @@ // 自动生成案卷编号,时间+坐席号 generateCaseId() { const id = getToday('yyMMddhhmmss') - const seat = '208' + const seat = this.$store.getters.seat this.form.caseId = id + seat } }