|
|
@@ -404,57 +404,67 @@
|
|
|
</div>
|
|
|
</van-collapse>
|
|
|
<div class="contentContainer">
|
|
|
- <div v-if="GZQuota">
|
|
|
- <p class="contentContainerTitle">今日项目跟进数<span class="colorRed">(必填)</span></p>
|
|
|
- <div style="padding: 10px 0">
|
|
|
- <van-field v-model="reportContents[2].projectFollowNum" type="digit" />
|
|
|
+ <!-- isHistory 是否为历史汇报:0-新汇报 1-历史汇报 -->
|
|
|
+ <reportCustom
|
|
|
+ ref="reportCustom"
|
|
|
+ v-if="reportTarget.isHistory == '0'"
|
|
|
+ :reportCustomData="reportTarget.customTaskList"></reportCustom>
|
|
|
+ <template v-else>
|
|
|
+ <div v-if="GZQuota">
|
|
|
+ <p class="contentContainerTitle">今日项目跟进数<span class="colorRed">(必填)</span></p>
|
|
|
+ <div style="padding: 10px 0">
|
|
|
+ <van-field v-model="reportContents[2].projectFollowNum" type="digit" />
|
|
|
+ </div>
|
|
|
+ <p class="contentContainerTitle">
|
|
|
+ 今日TUC成功报备数量<span class="colorRed">(必填)</span>
|
|
|
+ </p>
|
|
|
+ <div style="padding: 10px 0">
|
|
|
+ <van-field v-model="reportContents[3].tucReportingSuccessNum" type="digit" />
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div
|
|
|
+ v-if="
|
|
|
+ (this.$route.query.reportId && notVisitReason) || reportTarget.showNotVisitReason
|
|
|
+ ">
|
|
|
+ <p class="contentContainerTitle">
|
|
|
+ 截至日报提交时间,今日拜访0家店的原因<span class="colorRed">(必填)</span>
|
|
|
+ </p>
|
|
|
+ <div style="padding: 10px 0">
|
|
|
+ <van-field
|
|
|
+ v-model="notVisitReason"
|
|
|
+ rows="3"
|
|
|
+ autosize
|
|
|
+ maxlength="1000"
|
|
|
+ show-word-limit
|
|
|
+ type="textarea"
|
|
|
+ :formatter="formatter" />
|
|
|
+ </div>
|
|
|
</div>
|
|
|
<p class="contentContainerTitle">
|
|
|
- 今日TUC成功报备数量<span class="colorRed">(必填)</span>
|
|
|
+ 今日机会与挑战总结<span class="colorRed">(必填)</span>
|
|
|
</p>
|
|
|
<div style="padding: 10px 0">
|
|
|
- <van-field v-model="reportContents[3].tucReportingSuccessNum" type="digit" />
|
|
|
+ <van-field
|
|
|
+ v-model="reportContents[0].dayContent"
|
|
|
+ rows="4"
|
|
|
+ autosize
|
|
|
+ maxlength="800"
|
|
|
+ show-word-limit
|
|
|
+ type="textarea"
|
|
|
+ :formatter="formatter" />
|
|
|
</div>
|
|
|
- </div>
|
|
|
- <!-- 今日未拜访原因 如果为false,则不展示;如果为true,则展示,需要展示“今日拜访0家店的原因” -->
|
|
|
- <div
|
|
|
- v-if="(this.$route.query.reportId && notVisitReason) || reportTarget.showNotVisitReason">
|
|
|
- <p class="contentContainerTitle">
|
|
|
- 截至日报提交时间,今日拜访0家店的原因<span class="colorRed">(必填)</span>
|
|
|
- </p>
|
|
|
+ <p class="contentContainerTitle">明日工作规划 <span class="colorRed">(必填)</span></p>
|
|
|
<div style="padding: 10px 0">
|
|
|
<van-field
|
|
|
- v-model="notVisitReason"
|
|
|
- rows="3"
|
|
|
+ v-model="reportContents[1].dayContent"
|
|
|
+ rows="4"
|
|
|
autosize
|
|
|
- maxlength="1000"
|
|
|
+ maxlength="800"
|
|
|
show-word-limit
|
|
|
type="textarea"
|
|
|
:formatter="formatter" />
|
|
|
</div>
|
|
|
- </div>
|
|
|
- <p class="contentContainerTitle">今日机会与挑战总结<span class="colorRed">(必填)</span></p>
|
|
|
- <div style="padding: 10px 0">
|
|
|
- <van-field
|
|
|
- v-model="reportContents[0].dayContent"
|
|
|
- rows="4"
|
|
|
- autosize
|
|
|
- maxlength="800"
|
|
|
- show-word-limit
|
|
|
- type="textarea"
|
|
|
- :formatter="formatter" />
|
|
|
- </div>
|
|
|
- <p class="contentContainerTitle">明日工作规划 <span class="colorRed">(必填)</span></p>
|
|
|
- <div style="padding: 10px 0">
|
|
|
- <van-field
|
|
|
- v-model="reportContents[1].dayContent"
|
|
|
- rows="4"
|
|
|
- autosize
|
|
|
- maxlength="800"
|
|
|
- show-word-limit
|
|
|
- type="textarea"
|
|
|
- :formatter="formatter" />
|
|
|
- </div>
|
|
|
+ </template>
|
|
|
</div>
|
|
|
<br />
|
|
|
</div>
|
|
|
@@ -485,6 +495,7 @@ import ZYPlaceOrder from '@/views/componentsTarget/ZYPlaceOrder';
|
|
|
import performanceSAP from '@/views/componentsTarget/performanceSAP';
|
|
|
import ZYSAP from '@/views/componentsTarget/ZYSAP';
|
|
|
import veryGoodPlaceOrder from '@/views/componentsTarget/veryGoodPlaceOrder';
|
|
|
+import reportCustom from './reportCustom';
|
|
|
|
|
|
export default {
|
|
|
name: 'daily',
|
|
|
@@ -496,6 +507,7 @@ export default {
|
|
|
performanceSAP,
|
|
|
ZYSAP,
|
|
|
veryGoodPlaceOrder,
|
|
|
+ reportCustom,
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
@@ -711,151 +723,205 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
tsContentsFn() {
|
|
|
- let loading1 = this.$toast.loading({
|
|
|
- duration: 0,
|
|
|
- message: '数据提交中...',
|
|
|
- forbidClick: true,
|
|
|
- });
|
|
|
+ this.toastLoading(0, '加载中...', true);
|
|
|
if (this.isclick) {
|
|
|
- this.reportContents[0].contentTime = this.parseTime(new Date(), '{y}-{m}-{d}');
|
|
|
- this.reportContents[1].contentTime = this.parseTime(new Date(), '{y}-{m}-{d}');
|
|
|
- if (this.GZQuota) {
|
|
|
- this.reportContents[2].contentTime = this.parseTime(new Date(), '{y}-{m}-{d}');
|
|
|
- this.reportContents[3].contentTime = this.parseTime(new Date(), '{y}-{m}-{d}');
|
|
|
- }
|
|
|
- this.reportTarget.reportContents = this.reportContents;
|
|
|
- this.reportTarget.notVisitReason = this.notVisitReason;
|
|
|
- this.reportTarget.status = '1';
|
|
|
- this.isclick = false;
|
|
|
- tsContents(this.reportTarget).then((res) => {
|
|
|
- loading1.clear();
|
|
|
- this.isclick = true;
|
|
|
- if (res.code == 200) {
|
|
|
- this.$dialog
|
|
|
- .alert({
|
|
|
- title: '系统提示',
|
|
|
- message: '暂存成功',
|
|
|
- })
|
|
|
- .then(() => {
|
|
|
- // if(this.$route.query.reportId!=undefined){
|
|
|
- // window.location.replace(window.location.origin+"/mobile/myHistoricalDaily")
|
|
|
- // }else{
|
|
|
- // window.location.replace(window.location.origin+"/mobile/home")
|
|
|
- // }
|
|
|
- });
|
|
|
- } else {
|
|
|
- this.$toast.fail(res.msg);
|
|
|
+ // 旧的
|
|
|
+ if (this.reportTarget.isHistory == '1') {
|
|
|
+ this.reportContents[0].contentTime = this.parseTime(new Date(), '{y}-{m}-{d}');
|
|
|
+ this.reportContents[1].contentTime = this.parseTime(new Date(), '{y}-{m}-{d}');
|
|
|
+ if (this.GZQuota) {
|
|
|
+ this.reportContents[2].contentTime = this.parseTime(new Date(), '{y}-{m}-{d}');
|
|
|
+ this.reportContents[3].contentTime = this.parseTime(new Date(), '{y}-{m}-{d}');
|
|
|
}
|
|
|
- });
|
|
|
+ this.reportTarget.reportContents = this.reportContents;
|
|
|
+ this.reportTarget.notVisitReason = this.notVisitReason;
|
|
|
+ this.tsContentsFun();
|
|
|
+ } else {
|
|
|
+ // 新的
|
|
|
+ this.filterReportCustomData((reportCustomAnswers) => {
|
|
|
+ this.tsContentsFun(reportCustomAnswers);
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
+ tsContentsFun(reportCustomAnswers) {
|
|
|
+ if (reportCustomAnswers) this.reportTarget.reportCustomAnswers = reportCustomAnswers;
|
|
|
+ this.reportTarget.status = '1';
|
|
|
+ this.isclick = false;
|
|
|
+ tsContents(this.reportTarget).then((res) => {
|
|
|
+ this.toastLoading().clear();
|
|
|
+ this.isclick = true;
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.$dialog
|
|
|
+ .alert({
|
|
|
+ title: '系统提示',
|
|
|
+ message: '暂存成功',
|
|
|
+ })
|
|
|
+ .then(() => {});
|
|
|
+ } else {
|
|
|
+ this.$toast.fail(res.msg);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
// 提交日报
|
|
|
submint() {
|
|
|
- let loading1 = this.$toast.loading({
|
|
|
- duration: 0,
|
|
|
- message: '数据提交中...',
|
|
|
- forbidClick: true,
|
|
|
- });
|
|
|
+ this.toastLoading(0, '加载中...', true);
|
|
|
if (this.isclick) {
|
|
|
- if (this.GZQuota) {
|
|
|
- if (this.reportContents[2].projectFollowNum.trim() == '') {
|
|
|
- this.$toast('请输入今日项目跟进数量!');
|
|
|
- return false;
|
|
|
+ // 旧的
|
|
|
+ if (this.reportTarget.isHistory == '1') {
|
|
|
+ if (this.GZQuota) {
|
|
|
+ if (this.reportContents[2].projectFollowNum.trim() == '') {
|
|
|
+ this.$toast('请输入今日项目跟进数量!');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if (this.reportContents[3].tucReportingSuccessNum.trim() == '') {
|
|
|
+ this.$toast('请输入今日TUC成功报备数量!');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
}
|
|
|
- if (this.reportContents[3].tucReportingSuccessNum.trim() == '') {
|
|
|
- this.$toast('请输入今日TUC成功报备数量!');
|
|
|
- return false;
|
|
|
+ if (
|
|
|
+ (this.$route.query.reportId && this.notVisitReason) ||
|
|
|
+ this.reportTarget.showNotVisitReason
|
|
|
+ ) {
|
|
|
+ if (this.notVisitReason.trim() == '') {
|
|
|
+ this.$toast('请输入今日拜访0家店的原因!');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ this.reportTarget.notVisitReason = this.notVisitReason;
|
|
|
}
|
|
|
- }
|
|
|
- if (
|
|
|
- (this.$route.query.reportId && this.notVisitReason) ||
|
|
|
- this.reportTarget.showNotVisitReason
|
|
|
- ) {
|
|
|
- if (this.notVisitReason.trim() == '') {
|
|
|
- this.$toast('请输入今日拜访0家店的原因!');
|
|
|
+ if (this.reportContents[0].dayContent.trim() == '') {
|
|
|
+ this.$toast('请输入日报内容!');
|
|
|
return false;
|
|
|
- }
|
|
|
- this.reportTarget.notVisitReason = this.notVisitReason;
|
|
|
- }
|
|
|
- if (this.reportContents[0].dayContent.trim() == '') {
|
|
|
- this.$toast('请输入日报内容!');
|
|
|
- return false;
|
|
|
- } else if (this.reportContents[0].dayContent.length > 800) {
|
|
|
- this.$toast('日报内容太长!');
|
|
|
- return false;
|
|
|
- } else if (this.reportContents[1].dayContent.trim() == '') {
|
|
|
- this.$toast('请输入明日工作规划!');
|
|
|
+ } else if (this.reportContents[0].dayContent.length > 800) {
|
|
|
+ this.$toast('日报内容太长!');
|
|
|
+ return false;
|
|
|
+ } else if (this.reportContents[1].dayContent.trim() == '') {
|
|
|
+ this.$toast('请输入明日工作规划!');
|
|
|
|
|
|
- return false;
|
|
|
- } else if (this.reportContents[1].dayContent.length > 800) {
|
|
|
- this.$toast('明日工作规划内容太长!');
|
|
|
- return false;
|
|
|
- } else {
|
|
|
+ return false;
|
|
|
+ } else if (this.reportContents[1].dayContent.length > 800) {
|
|
|
+ this.$toast('明日工作规划内容太长!');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
this.reportContents[0].contentTime = this.parseTime(new Date(), '{y}-{m}-{d}');
|
|
|
this.reportContents[1].contentTime = this.parseTime(new Date(), '{y}-{m}-{d}');
|
|
|
if (this.GZQuota) {
|
|
|
this.reportContents[2].contentTime = this.parseTime(new Date(), '{y}-{m}-{d}');
|
|
|
this.reportContents[3].contentTime = this.parseTime(new Date(), '{y}-{m}-{d}');
|
|
|
}
|
|
|
- // this.reportContents[4].contentTime = this.parseTime(new Date(), '{y}-{m}-{d}')
|
|
|
this.reportTarget.reportContents = this.reportContents;
|
|
|
-
|
|
|
- this.reportTarget.status = '1';
|
|
|
- this.isclick = false;
|
|
|
- updateReport(this.reportTarget).then((res) => {
|
|
|
- loading1.clear();
|
|
|
- this.isclick = true;
|
|
|
- if (res.code == 200) {
|
|
|
- if (this.reportTarget.reportPostType == 'fx') {
|
|
|
- this.$dialog
|
|
|
- .alert({
|
|
|
- message: '已提交,是否分享',
|
|
|
- showCancelButton: true,
|
|
|
- confirmButtonText: '分享',
|
|
|
- cancelButtonText: '返回首页',
|
|
|
- className: 'dailyShareBtn',
|
|
|
- })
|
|
|
- .then(() => {
|
|
|
- buryingPoint({
|
|
|
- systemModel: '日报审核',
|
|
|
- buryingPointType: 2,
|
|
|
- buryingPointValue: this.$route.query.reportId,
|
|
|
- buryingPointName: '日报提交分享',
|
|
|
- buryingPointPosition: '日报提交',
|
|
|
- });
|
|
|
- // 跳转历史汇报详情 分享汇报
|
|
|
- this.$router.replace({
|
|
|
- path: 'dailyDetails',
|
|
|
- query: { reportId: res.data, sourceType: 'daily' },
|
|
|
- });
|
|
|
- })
|
|
|
- .catch(() => {
|
|
|
- if (this.$route.query.reportId != undefined) {
|
|
|
- window.location.replace(window.location.origin + '/mobile/home');
|
|
|
- } else {
|
|
|
- this.onClickLeft();
|
|
|
- }
|
|
|
- });
|
|
|
- } else {
|
|
|
- this.$dialog
|
|
|
- .alert({
|
|
|
- title: '系统提示',
|
|
|
- message: '提交成功',
|
|
|
- })
|
|
|
- .then(() => {
|
|
|
- if (this.$route.query.reportId != undefined) {
|
|
|
- window.location.replace(window.location.origin + '/mobile/myHistoricalDaily');
|
|
|
- } else {
|
|
|
- this.onClickLeft();
|
|
|
- }
|
|
|
- });
|
|
|
+ this.submintFun();
|
|
|
+ } else {
|
|
|
+ // 新的
|
|
|
+ this.reportCustomTabstoreVal((reportCustomAnswers) => {
|
|
|
+ this.submintFun(reportCustomAnswers);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ submintFun(reportCustomAnswers) {
|
|
|
+ this.reportTarget.status = '1';
|
|
|
+ if (reportCustomAnswers) this.reportTarget.reportCustomAnswers = reportCustomAnswers;
|
|
|
+ this.isclick = false;
|
|
|
+ updateReport(this.reportTarget).then((res) => {
|
|
|
+ this.toastLoading().clear();
|
|
|
+ this.isclick = true;
|
|
|
+ if (res.code == 200) {
|
|
|
+ if (this.reportTarget.reportPostType == 'fx') {
|
|
|
+ this.$dialog
|
|
|
+ .alert({
|
|
|
+ message: '已提交,是否分享',
|
|
|
+ showCancelButton: true,
|
|
|
+ confirmButtonText: '分享',
|
|
|
+ cancelButtonText: '返回首页',
|
|
|
+ className: 'dailyShareBtn',
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ buryingPoint({
|
|
|
+ systemModel: '日报审核',
|
|
|
+ buryingPointType: 2,
|
|
|
+ buryingPointValue: this.$route.query.reportId,
|
|
|
+ buryingPointName: '日报提交分享',
|
|
|
+ buryingPointPosition: '日报提交',
|
|
|
+ });
|
|
|
+ // 跳转历史汇报详情 分享汇报
|
|
|
+ this.$router.replace({
|
|
|
+ path: 'dailyDetails',
|
|
|
+ query: { reportId: res.data, sourceType: 'daily' },
|
|
|
+ });
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ if (this.$route.query.reportId != undefined) {
|
|
|
+ window.location.replace(window.location.origin + '/mobile/home');
|
|
|
+ } else {
|
|
|
+ this.onClickLeft();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.$dialog
|
|
|
+ .alert({
|
|
|
+ title: '系统提示',
|
|
|
+ message: '提交成功',
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ if (this.$route.query.reportId != undefined) {
|
|
|
+ window.location.replace(window.location.origin + '/mobile/myHistoricalDaily');
|
|
|
+ } else {
|
|
|
+ this.onClickLeft();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.$toast.fail(res.msg);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ reportCustomTabstoreVal(callback) {
|
|
|
+ // 必填校验
|
|
|
+ this.$refs.reportCustom.$refs.tabstoreVal
|
|
|
+ .validate()
|
|
|
+ .then(() => {
|
|
|
+ // 验证通过
|
|
|
+ this.filterReportCustomData(callback);
|
|
|
+ })
|
|
|
+ .catch((errors) => {
|
|
|
+ this.toastLoading().clear();
|
|
|
+ return;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ filterReportCustomData(callback) {
|
|
|
+ let reportCustomData = this.$refs.reportCustom ? this.$refs.reportCustom.fromData : {} || {};
|
|
|
+ let reportCustomAnswers = [];
|
|
|
+ for (let i = 0; i < reportCustomData.length; i++) {
|
|
|
+ let customData = reportCustomData[i].sfaReportCustomCollections;
|
|
|
+ for (let x = 0; x < customData.length; x++) {
|
|
|
+ if (
|
|
|
+ customData[x].reportCustomCollectionType == 'dx' ||
|
|
|
+ customData[x].reportCustomCollectionType == 'duox'
|
|
|
+ ) {
|
|
|
+ let optionData = customData[x].sfaReportCustomOptions;
|
|
|
+ for (let y = 0; y < optionData.length; y++) {
|
|
|
+ if (optionData[y].answerValue == 'Y') {
|
|
|
+ reportCustomAnswers.push({
|
|
|
+ reportCustomTaskId: customData[x].reportCustomTaskId,
|
|
|
+ reportCustomCollectionId: optionData[y].reportCustomCollectionId,
|
|
|
+ reportCustomOptionId: optionData[y].reportCustomOptionId,
|
|
|
+ answerValue: 'Y',
|
|
|
+ });
|
|
|
}
|
|
|
- } else {
|
|
|
- this.$toast.fail(res.msg);
|
|
|
}
|
|
|
- });
|
|
|
+ } else {
|
|
|
+ if (customData[x].answerValue)
|
|
|
+ reportCustomAnswers.push({
|
|
|
+ reportCustomTaskId: customData[x].reportCustomTaskId,
|
|
|
+ reportCustomCollectionId: customData[x].reportCustomCollectionId,
|
|
|
+ answerValue: customData[x].answerValue,
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+ console.log(reportCustomAnswers);
|
|
|
+ callback && callback(reportCustomAnswers);
|
|
|
},
|
|
|
// 获取日报数据
|
|
|
getReportInfo() {
|