|
@@ -405,29 +405,6 @@ export default {
|
|
|
},
|
|
},
|
|
|
onLoad() {},
|
|
onLoad() {},
|
|
|
onSubmit() {
|
|
onSubmit() {
|
|
|
- // var formData = {
|
|
|
|
|
- // storeId: this.storeId,
|
|
|
|
|
- // storeCode: this.$route.query.storeCode,
|
|
|
|
|
- // storeGroupId: this.storeGroupId,
|
|
|
|
|
- // visitsId: this.visitId,
|
|
|
|
|
- // taskId: this.taskId,
|
|
|
|
|
- // collectionAnswers: [],
|
|
|
|
|
- // checkUnManage: checkUnManage
|
|
|
|
|
- // }
|
|
|
|
|
- // var collectionAnswers = []
|
|
|
|
|
-
|
|
|
|
|
- // for (var b = 0; b < this.collectionItemList.length; b++) {
|
|
|
|
|
- // if (this.collectionItemList[b].answerType == "sz" || this.collectionItemList[b].answerType == "wb") {
|
|
|
|
|
- // collectionAnswers.push({
|
|
|
|
|
- // "collectionId": this.collectionItemList[b].collectionId,
|
|
|
|
|
- // "itemName": this.collectionItemList[b].collectionName,
|
|
|
|
|
- // "collectionType": this.collectionItemList[b].collectionType,
|
|
|
|
|
- // "collectionOptionId": this.collectionItemList[b].collectionOptionList[0].collectionOptionId,
|
|
|
|
|
- // "answerType": this.collectionItemList[b].answerType,
|
|
|
|
|
- // "answerValue": this.collectionItemList[b].answerValue
|
|
|
|
|
- // })
|
|
|
|
|
- // }
|
|
|
|
|
- // }
|
|
|
|
|
for (var c = 0; c < this.collectionAnswerlisd.length; c++) {
|
|
for (var c = 0; c < this.collectionAnswerlisd.length; c++) {
|
|
|
for (var b = 0; b < this.collectionItemList.length; b++) {
|
|
for (var b = 0; b < this.collectionItemList.length; b++) {
|
|
|
if (this.collectionAnswerlisd[c].id == this.collectionItemList[b].customId) {
|
|
if (this.collectionAnswerlisd[c].id == this.collectionItemList[b].customId) {
|
|
@@ -462,24 +439,38 @@ export default {
|
|
|
var collectionItemLists = res.data;
|
|
var collectionItemLists = res.data;
|
|
|
for (var q = 0; q < collectionItemLists.length; q++) {
|
|
for (var q = 0; q < collectionItemLists.length; q++) {
|
|
|
collectionItemLists[q].answerName = undefined;
|
|
collectionItemLists[q].answerName = undefined;
|
|
|
- // if (collectionItemLists[q].answerType == "sz" || collectionItemLists[q].answerType == "wb") {
|
|
|
|
|
- // collectionItemLists[q].answerValue = collectionItemLists[q].customOptionList[0].answerValue
|
|
|
|
|
- // }
|
|
|
|
|
- // if (collectionItemLists[q].answerType == "duox" || collectionItemLists[q].answerType == "dx") {
|
|
|
|
|
- // collectionItemLists[q].answerValue = []
|
|
|
|
|
- // for (var qq = 0; qq < collectionItemLists[q].customOptionList.length; qq++) {
|
|
|
|
|
- // if (collectionItemLists[q].customOptionList[qq].isCheck == 1) {
|
|
|
|
|
- // collectionItemLists[q].answerValue.push(collectionItemLists[q].customOptionList[qq].customId)
|
|
|
|
|
- // collectionItemLists[q].customOptionList[qq].code = collectionItemLists[q].collectionCode
|
|
|
|
|
- // collectionItemLists[q].customOptionList[qq].answerType = collectionItemLists[q].answerType
|
|
|
|
|
- // this.collectionAnswerlisd.push(collectionItemLists[q].customOptionList[qq])
|
|
|
|
|
- // }
|
|
|
|
|
- // }
|
|
|
|
|
- // collectionItemLists[q].answerValue = collectionItemLists[q].answerValue.join()
|
|
|
|
|
- // }
|
|
|
|
|
|
|
+ // 公司
|
|
|
|
|
+ if (collectionItemLists[q].answerType == 'gs') {
|
|
|
|
|
+ this.getDeptInfo('dept', 'gs', collectionItemLists[q].answerValue);
|
|
|
|
|
+ }
|
|
|
|
|
+ // 单选
|
|
|
|
|
+ if (
|
|
|
|
|
+ collectionItemLists[q].answerType == 'dx' &&
|
|
|
|
|
+ collectionItemLists[q].showHistory == '1'
|
|
|
|
|
+ ) {
|
|
|
|
|
+ debugger;
|
|
|
|
|
+ let findCustom = collectionItemLists[q].customOptionList.find((item) => item.checked);
|
|
|
|
|
+ if (findCustom) {
|
|
|
|
|
+ collectionItemLists[q].answerValue = findCustom.customOptionId + '';
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ // 多选
|
|
|
|
|
+ if (
|
|
|
|
|
+ collectionItemLists[q].answerType == 'duox' &&
|
|
|
|
|
+ collectionItemLists[q].showHistory == '1'
|
|
|
|
|
+ ) {
|
|
|
|
|
+ let findCustom = [];
|
|
|
|
|
+ collectionItemLists[q].customOptionList.forEach((item) => {
|
|
|
|
|
+ if (item.checked) {
|
|
|
|
|
+ findCustom.push(item.customOptionId + '');
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ if (findCustom) {
|
|
|
|
|
+ collectionItemLists[q].answerValue = findCustom;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
this.collectionItemList = collectionItemLists;
|
|
this.collectionItemList = collectionItemLists;
|
|
|
- this.getDeptInfo('dept');
|
|
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
@@ -547,7 +538,7 @@ export default {
|
|
|
var days = (endData - stratDate) / (1000 * 60 * 60 * 24);
|
|
var days = (endData - stratDate) / (1000 * 60 * 60 * 24);
|
|
|
return days;
|
|
return days;
|
|
|
},
|
|
},
|
|
|
- getDeptInfo(type, grade) {
|
|
|
|
|
|
|
+ getDeptInfo(type, grade, answerValue) {
|
|
|
this.deptForm.type = type;
|
|
this.deptForm.type = type;
|
|
|
if (grade == '1') {
|
|
if (grade == '1') {
|
|
|
this.deptForm.parentId = this.companyCode;
|
|
this.deptForm.parentId = this.companyCode;
|
|
@@ -558,34 +549,40 @@ export default {
|
|
|
this.deptForm.parentId = '';
|
|
this.deptForm.parentId = '';
|
|
|
}
|
|
}
|
|
|
getSummaryMobileDeptInfo(this.deptForm).then((res) => {
|
|
getSummaryMobileDeptInfo(this.deptForm).then((res) => {
|
|
|
- if (grade == '1') {
|
|
|
|
|
|
|
+ if (grade == 'dq') {
|
|
|
if (res.data.region != null) {
|
|
if (res.data.region != null) {
|
|
|
this.regionList = res.data.region;
|
|
this.regionList = res.data.region;
|
|
|
- for (var k = 0; k < this.collectionItemList.length; k++) {
|
|
|
|
|
- if (this.collectionItemList[k].answerType == 'dq') {
|
|
|
|
|
- this.collectionItemList[k].answerName = res.data.region[0].deptName;
|
|
|
|
|
- this.collectionItemList[k].answerValue = res.data.region[0].deptCode;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ // for (var k = 0; k < this.collectionItemList.length; k++) {
|
|
|
|
|
+ // if (this.collectionItemList[k].answerType == 'dq') {
|
|
|
|
|
+ // this.collectionItemList[k].answerName = res.data.region[0].deptName;
|
|
|
|
|
+ // this.collectionItemList[k].answerValue = res.data.region[0].deptCode;
|
|
|
|
|
+ // }
|
|
|
|
|
+ // }
|
|
|
|
|
+ if (answerValue) {
|
|
|
|
|
+ let findCompany = this.regionList.find((item) => item.deptCode == answerValue);
|
|
|
|
|
+ this.onSalesRegionConfirm(findCompany);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.onSalesRegionConfirm(this.regionList[0]);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- } else if (grade == '2') {
|
|
|
|
|
|
|
+ } else if (grade == 'xsb') {
|
|
|
if (res.data.dept != null) {
|
|
if (res.data.dept != null) {
|
|
|
this.deptList = res.data.dept;
|
|
this.deptList = res.data.dept;
|
|
|
|
|
+ if (answerValue) {
|
|
|
|
|
+ let findCompany = this.deptList.find((item) => item.deptCode == answerValue);
|
|
|
|
|
+ this.onSalesDepartmentConfirm(findCompany);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.onSalesDepartmentConfirm(this.deptList[0]);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
- } else {
|
|
|
|
|
|
|
+ } else if (grade == 'gs') {
|
|
|
this.companyList = res.data.company;
|
|
this.companyList = res.data.company;
|
|
|
- this.companyCode = res.data.company[0].deptId;
|
|
|
|
|
- for (var k = 0; k < this.collectionItemList.length; k++) {
|
|
|
|
|
- if (this.collectionItemList[k].answerType == 'gs') {
|
|
|
|
|
- this.collectionItemList[k].answerName = res.data.company[0].deptName;
|
|
|
|
|
- this.collectionItemList[k].answerValue = res.data.company[0].deptCode;
|
|
|
|
|
- }
|
|
|
|
|
- if (this.collectionItemList[k].answerType == 'dq') {
|
|
|
|
|
- this.collectionItemList[k].answerName = res.data.region[0].deptName;
|
|
|
|
|
- this.collectionItemList[k].answerValue = res.data.region[0].deptCode;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ if (answerValue) {
|
|
|
|
|
+ let findCompany = this.companyList.find((item) => item.deptCode == answerValue);
|
|
|
|
|
+ this.onregionConfirm(findCompany);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.onregionConfirm(this.companyList[0]);
|
|
|
}
|
|
}
|
|
|
- this.getDeptInfo(1, '1');
|
|
|
|
|
if (res.data.dept != null) {
|
|
if (res.data.dept != null) {
|
|
|
this.deptList = res.data.dept;
|
|
this.deptList = res.data.dept;
|
|
|
}
|
|
}
|
|
@@ -650,39 +647,67 @@ export default {
|
|
|
},
|
|
},
|
|
|
onSalesRegionConfirm(val) {
|
|
onSalesRegionConfirm(val) {
|
|
|
this.SalesRegionShow = false;
|
|
this.SalesRegionShow = false;
|
|
|
- for (var k1 = 0; k1 < this.collectionItemList.length; k1++) {
|
|
|
|
|
- if (this.collectionItemList[k1].answerType == 'xsb') {
|
|
|
|
|
- this.collectionItemList[k1].answerName = '';
|
|
|
|
|
- this.collectionItemList[k1].answerValue = '';
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- this.collectionItemList[this.index].answerName = val.deptName;
|
|
|
|
|
- this.collectionItemList[this.index].answerValue = val.deptCode;
|
|
|
|
|
this.regionCode = val.deptId;
|
|
this.regionCode = val.deptId;
|
|
|
- if (val.deptId != '') {
|
|
|
|
|
- this.getDeptInfo('dept', 2);
|
|
|
|
|
|
|
+ if (this.index != '') {
|
|
|
|
|
+ this.collectionItemList[this.index].answerName = val.deptName;
|
|
|
|
|
+ this.collectionItemList[this.index].answerValue = val.deptCode;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ for (var k1 = 0; k1 < this.collectionItemList.length; k1++) {
|
|
|
|
|
+ if (this.collectionItemList[k1].answerType == 'xsb') {
|
|
|
|
|
+ this.collectionItemList[k1].answerName = '';
|
|
|
|
|
+ this.collectionItemList[k1].answerValue = '';
|
|
|
|
|
+ }
|
|
|
|
|
+ if (this.collectionItemList[k1].answerType == 'dq') {
|
|
|
|
|
+ this.collectionItemList[k1].answerName = val.deptName;
|
|
|
|
|
+ this.collectionItemList[k1].answerValue = val.deptCode;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (this.collectionItemList[k1].answerType == 'xsb' && val.deptId != '') {
|
|
|
|
|
+ this.getDeptInfo('dept', 'xsb', this.collectionItemList[k1].answerValue);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
+ // if (val.deptId != '') {
|
|
|
|
|
+ // this.getDeptInfo('dept', 'xsb');
|
|
|
|
|
+ // }
|
|
|
},
|
|
},
|
|
|
onregionConfirm(val) {
|
|
onregionConfirm(val) {
|
|
|
this.RegionShow = false;
|
|
this.RegionShow = false;
|
|
|
- for (var k1 = 0; k1 < this.collectionItemList.length; k1++) {
|
|
|
|
|
- if (
|
|
|
|
|
- this.collectionItemList[k1].answerType == 'xsb' ||
|
|
|
|
|
- this.collectionItemList[k1].answerType == 'dq'
|
|
|
|
|
- ) {
|
|
|
|
|
- this.collectionItemList[k1].answerName = '';
|
|
|
|
|
- this.collectionItemList[k1].answerValue = '';
|
|
|
|
|
|
|
+ this.companyCode = val.deptId;
|
|
|
|
|
+ if (this.index != '') {
|
|
|
|
|
+ this.collectionItemList[this.index].answerName = val.deptName;
|
|
|
|
|
+ this.collectionItemList[this.index].answerValue = val.deptCode;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ for (var k1 = 0; k1 < this.collectionItemList.length; k1++) {
|
|
|
|
|
+ if (
|
|
|
|
|
+ this.collectionItemList[k1].answerType == 'xsb' ||
|
|
|
|
|
+ this.collectionItemList[k1].answerType == 'dq'
|
|
|
|
|
+ ) {
|
|
|
|
|
+ this.collectionItemList[k1].answerName = '';
|
|
|
|
|
+ this.collectionItemList[k1].answerValue = '';
|
|
|
|
|
+ }
|
|
|
|
|
+ if (this.collectionItemList[k1].answerType == 'gs') {
|
|
|
|
|
+ this.collectionItemList[k1].answerName = val.deptName;
|
|
|
|
|
+ this.collectionItemList[k1].answerValue = val.deptCode;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (this.collectionItemList[k1].answerType == 'dq') {
|
|
|
|
|
+ this.getDeptInfo('dept', 'dq', this.collectionItemList[k1].answerValue);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- this.collectionItemList[this.index].answerName = val.deptName;
|
|
|
|
|
- this.collectionItemList[this.index].answerValue = val.deptCode;
|
|
|
|
|
- this.companyCode = val.deptId;
|
|
|
|
|
- this.getDeptInfo('dept', 1);
|
|
|
|
|
},
|
|
},
|
|
|
onSalesDepartmentConfirm(val) {
|
|
onSalesDepartmentConfirm(val) {
|
|
|
this.SalesDepartmentShow = false;
|
|
this.SalesDepartmentShow = false;
|
|
|
- this.collectionItemList[this.index].answerName = val.deptName;
|
|
|
|
|
- this.collectionItemList[this.index].answerValue = val.deptCode;
|
|
|
|
|
|
|
+ if (this.index != '') {
|
|
|
|
|
+ this.collectionItemList[this.index].answerName = val.deptName;
|
|
|
|
|
+ this.collectionItemList[this.index].answerValue = val.deptCode;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ for (var k1 = 0; k1 < this.collectionItemList.length; k1++) {
|
|
|
|
|
+ if (this.collectionItemList[k1].answerType == 'xsb') {
|
|
|
|
|
+ this.collectionItemList[k1].answerName = val.deptName;
|
|
|
|
|
+ this.collectionItemList[k1].answerValue = val.deptCode;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
},
|
|
},
|
|
|
onStartTimeConfirm(val) {
|
|
onStartTimeConfirm(val) {
|
|
|
this.formData.startTime = this.parseTime(new Date(val), '{y}-{m}-{d}') + '';
|
|
this.formData.startTime = this.parseTime(new Date(val), '{y}-{m}-{d}') + '';
|