Browse Source

Merge branch 'feature_20251114_主管任务经销商单选&门店题型'

sunny 5 days ago
parent
commit
b50e3d8182

+ 18 - 9
src/api/index.js

@@ -1018,6 +1018,15 @@ export function getMaterialHistory(query) {
     params: query,
   });
 }
+
+// 根据日报id查询汇报当天拜访照片base64格式
+export function imgToBase64(data) {
+  return request({
+    url: '/mobile/reportMobile/imgToBase64',
+    method: 'post',
+    data,
+  });
+}
 // 根据当前用户获取下级所有销售部接口
 export function getDeptsByUser(query) {
   return request({
@@ -1036,6 +1045,15 @@ export function chainsList(query) {
   });
 }
 
+// 获取门店列表接口
+export function storesList(query) {
+  return request({
+    url: '/mobile/store/list',
+    method: 'get',
+    params: query,
+  });
+}
+
 // 主管任务答案暂存接口(同主管任务答案保存接口一致,但是接口不校验答案是否必填)
 export function temporarilyCustomAnswer(data) {
   return request({
@@ -1053,15 +1071,6 @@ export function deleteSummaryMobile(query) {
   });
 }
 
-// 根据日报id查询汇报当天拜访照片base64格式
-export function imgToBase64(data) {
-  return request({
-    url: '/mobile/reportMobile/imgToBase64',
-    method: 'post',
-    data,
-  });
-}
-
 // sku识别信息接口
 export function getSkuDetailById(query) {
   return request({

+ 23 - 0
src/views/week/SUPTaskApproval/detailItem.vue

@@ -161,6 +161,29 @@
             </div>
           </div>
         </div>
+        <div v-if="item.answerType == 'md'" class="formLabel z-cell">
+          <van-cell>
+            <template #title>
+              <span v-if="item.isMust == 0" class="van-f-red">*</span>
+              {{ 1 + index + '.' }}
+              {{ item.customName }}
+            </template>
+          </van-cell>
+          <div class="jxsBox">
+            <div class="jxsContent">
+              <div class="item" v-for="(val, index) in item.storeList">
+                <el-popover
+                  placement="bottom"
+                  trigger="click"
+                  :content="val.storeName + '(' + val.storeCode + ')'">
+                  <template slot="reference">
+                    <div class="selectItem">{{ val.storeName }} &nbsp; ({{ val.storeCode }})</div>
+                  </template>
+                </el-popover>
+              </div>
+            </div>
+          </div>
+        </div>
         <br />
       </div>
     </van-form>

+ 152 - 16
src/views/week/VisitSummaryAdd.vue

@@ -184,7 +184,7 @@
               :zRadiocolumns="item.customOptionList"
               @zSelectVal="zSelectVal"></z-radio>
           </div>
-          <div v-if="item.answerType == 'jxs'" class="formLabel z-cell">
+          <div v-if="item.answerType == 'jxs' || item.answerType == 'md'" class="formLabel z-cell">
             <van-cell>
               <template #title>
                 <span v-if="item.isMust == 0" class="van-f-red">*</span>
@@ -193,20 +193,33 @@
               </template>
             </van-cell>
             <div class="jxsBox">
-              <div class="jxsContent">
-                <div class="item" v-for="(val, index) in item.chainList">
+              <div class="jxsContent" v-if="item.answerType == 'jxs'">
+                <div class="item" v-for="(val, index) in item.chainList" :key="index">
                   <el-popover
                     placement="bottom"
                     trigger="click"
                     :content="val.chainName + '(' + val.chainCode + ')'">
                     <template slot="reference">
                       <div class="selectItem">{{ val.chainName }} &nbsp; ({{ val.chainCode }})</div>
-                      <van-icon name="clear" size="16" @click="closeJXS(item, index)" />
+                      <van-icon name="clear" size="16" @click="closeJXSorMD(item, index)" />
                     </template>
                   </el-popover>
                 </div>
               </div>
-              <div class="addJXS"><van-icon name="add-o" size="24" @click="addJXS" /></div>
+              <div class="jxsContent" v-if="item.answerType == 'md'">
+                <div class="item" v-for="(val, index) in item.storeList" :key="index">
+                  <el-popover
+                    placement="bottom"
+                    trigger="click"
+                    :content="val.storeName + '(' + val.storeCode + ')'">
+                    <template slot="reference">
+                      <div class="selectItem">{{ val.storeName }} &nbsp; ({{ val.storeCode }})</div>
+                      <van-icon name="clear" size="16" @click="closeJXSorMD(item, index)" />
+                    </template>
+                  </el-popover>
+                </div>
+              </div>
+              <div class="addJXS"><van-icon name="add-o" size="24" @click="addJXSorMD(item,index)" /></div>
               <div class="tips">{{ item.remark }}</div>
             </div>
           </div>
@@ -294,6 +307,9 @@
           <div style="background-color: #0057ba; color: #fff">搜索</div>
         </van-col>
       </van-row>
+      <div class="tips">
+        <div><van-icon name="warning-o" />默认显示前100条,请输入关键词查询</div>
+      </div>
       <van-picker
         show-toolbar
         :columns="chainsData"
@@ -301,6 +317,35 @@
         @confirm="onConfirmChainsList"
         @cancel="moreTypeShow = false" />
     </van-popup>
+    <!-- 门店 -->
+    <van-popup v-model="storeTypeShow" position="bottom">
+      <van-row style="background-color: #f5f5f5">
+        <van-col span="20">
+          <van-field
+            left-icon="search"
+            style="margin-top: 2px; border-radius: 6px; overflow: hidden"
+            v-model="agentValue"
+            label=""
+            placeholder="请输入门店名称/编号/地址搜索"
+            clearable />
+        </van-col>
+        <van-col
+          span="4"
+          style="text-align: center; line-height: 48px"
+          @click="getStoresList(agentValue)">
+          <div style="background-color: #0057ba; color: #fff">搜索</div>
+        </van-col>
+      </van-row>
+      <div class="tips">
+        <div><van-icon name="warning-o" />默认显示前100条,请输入关键词查询</div>
+      </div>
+      <van-picker
+        show-toolbar
+        :columns="storesData"
+        value-key="storeName"
+        @confirm="onConfirmStoresList"
+        @cancel="storeTypeShow = false" />
+    </van-popup>
   </div>
 </template>
 
@@ -309,10 +354,10 @@ import timeico from '@/assets/Icon/datatims.png';
 import {
   insertCustomAnswer,
   getSummaryDetailById,
-  getDeptInfo,
   getSummaryMobileDeptInfo,
   getDeptsByUser,
   chainsList,
+  storesList,
   temporarilyCustomAnswer,
 } from '@/api/index';
 import zRadio from '@/components/zRadio2';
@@ -380,8 +425,12 @@ export default {
       index: '',
       activaFlag: true,
       moreTypeShow: false,
+      storeTypeShow: false,
+      storeType: null,
       agentValue: '',
+      selectIndex: 0,
       chainsData: [],
+      storesData: [],
       chainName: '',
       chainCode: '',
       jxsList: [],
@@ -974,15 +1023,39 @@ export default {
       this.formData.pageNum = 1;
       this.EndTimeShow = false;
     },
-    // 添加经销商
-    addJXS() {
-      this.agentValue = '';
-      this.moreTypeShow = true;
-      this.getChainsList();
+    // 添加经销商或者门店
+    addJXSorMD(val,index) {
+      this.selectIndex = index;
+      let answerType = val.answerType;
+      let dataList =  [];
+      if(answerType == 'jxs'){
+          dataList = val.chainList ? val.chainList : [];
+      }else if(answerType == 'md'){
+          dataList = val.storeList ? val.storeList : [];
+      }
+      const isExceedLimit = dataList.length >= val.maxValue;
+      if (val.maxValue !== null && isExceedLimit) {
+        this.$toast('超过最大限制!');
+      } else {
+        this.agentValue = '';
+        if(answerType == 'jxs'){
+          this.moreTypeShow = true;
+          this.getChainsList();
+        }else if(answerType == 'md'){
+          this.storeTypeShow = true;
+          this.storeType = val.storeType;
+          this.getStoresList();
+        }
+        
+      }
     },
-    // 删除经销商
-    closeJXS(item, index) {
-      item.chainList.splice(index, 1);
+    // 删除经销商或者门店
+    closeJXSorMD(item, index) {
+      if(item.answerType == 'jxs'){
+        item.chainList.splice(index, 1);
+      }else if(item.answerType == 'md'){
+        item.storeList.splice(index, 1);
+      }
     },
     getChainsList(value = '') {
       this.chainsData = [];
@@ -1002,10 +1075,29 @@ export default {
           this.chainsData = [];
         });
     },
+    getStoresList(value = '') {
+      this.storesData = [];
+      storesList({
+        storeCategoryList: this.storeType ? this.storeType.split(",") : [], //	门店类型数组
+        storeName: value, //	门店名称或者编号搜索,模糊搜索
+        pageNum: 1, //	int	    页码
+        PageSize: 100    // 每页数
+      })
+        .then((res) => {
+          if (res.code == 200 && res.rows) {
+            this.storesData = res.rows;
+          } else {
+            this.storesData = [];
+          }
+        })
+        .catch(() => {
+          this.storesData = [];
+        });
+    },
     onConfirmChainsList(value) {
       if (value && value.chainName != undefined) {
-        let JXSSataList = this.collectionItemList.find((item) => item.answerType == 'jxs');
-        if (!JXSSataList.chainList) {
+        let JXSSataList = this.collectionItemList.find((item,index) => item.answerType == 'jxs' && index == this.selectIndex);
+        if (!JXSSataList.chainList){
           JXSSataList.chainList = [];
         }
         let isFlag = JXSSataList.chainList.find((val) => val.chainCode == value.chainCode);
@@ -1020,6 +1112,24 @@ export default {
         }
       }
     },
+    onConfirmStoresList(value) {
+      if (value && value.storeName != undefined) {
+        let MDSataList = this.collectionItemList.find((item,index) => item.answerType == 'md' && index == this.selectIndex);
+        if (!MDSataList.storeList) {
+          MDSataList.storeList = [];
+        }
+        let isFlag = MDSataList.storeList.find((val) => val.storeCode == value.storeCode);
+        if (!isFlag) {
+          MDSataList.storeList.push({
+            storeName: value.storeName,
+            storeCode: value.storeCode,
+          });
+          this.storeTypeShow = false;
+        } else {
+          this.$toast('当前门店已添加,不能重复添加!');
+        }
+      }
+    },
   },
 };
 </script>
@@ -1222,4 +1332,30 @@ export default {
     font-size: 14px;
   }
 }
+.VisitSummaryAdd {
+  .van-popup {
+    .tips {
+      width: 100%;
+      height: 40px;
+      display: flex;
+      align-items: center;
+      justify-content: center;
+      position: absolute;
+      top: 100px;
+      z-index: 999999;
+      div {
+        width: 80%;
+        height: 100%;
+        display: flex;
+        align-items: center;
+        justify-content: center;
+        text-align: center;
+        font-size: 15px;
+        background: rgba(225, 236, 250, 0.8);
+        border-radius: 6px;
+        color: #575656;
+      }
+    }
+  }
+}
 </style>

+ 145 - 139
src/views/week/allowWriteAgainSummary.vue

@@ -12,12 +12,8 @@
             </template>
           </van-cell>
           <!-- allowWriteAgain 是否允许补填 true/false -->
-          <van-field
-            v-model="item.answerValue"
-            :placeholder="item.remark"
-            type="number"
-            :disabled="!item.allowWriteAgain"
-            @input="numberFn(item, index)"></van-field>
+          <van-field v-model="item.answerValue" :placeholder="item.remark" type="number"
+            :disabled="!item.allowWriteAgain" @input="numberFn(item, index)"></van-field>
           <!-- <p
             v-if="item.allowWriteAgain"
             style="color: #444; font-size: 12px; margin: 0; padding: 10px 0; text-align: right">
@@ -32,16 +28,9 @@
               {{ item.customName }}
             </template>
           </van-cell>
-          <van-field
-            v-model="item.answerValue"
-            clickable
-            name="calendar"
-            placeholder="点击选择日期"
-            readonly
-            :disabled="!item.allowWriteAgain"
-            @click="showCalendarClick(item, index)" />
-          <p
-            v-if="item.allowWriteAgain"
+          <van-field v-model="item.answerValue" clickable name="calendar" placeholder="点击选择日期" readonly
+            :disabled="!item.allowWriteAgain" @click="showCalendarClick(item, index)" />
+          <p v-if="item.allowWriteAgain"
             style="color: #444; font-size: 12px; margin: 0; padding: 10px 0; text-align: right">
             {{ item.remark }}
           </p>
@@ -58,21 +47,11 @@
             <p v-if="item.allowWriteAgain" style="margin-top: 0">
               <span style="font-size: 12px; color: #888">{{ item.remark }}</span>
             </p>
-            <delete-upload-img
-              :isDelete="false"
-              :imgs="item.fileInfoList"
+            <delete-upload-img :isDelete="false" :imgs="item.fileInfoList"
               :isEdit="item.allowWriteAgain"></delete-upload-img>
-            <upload-img
-              v-if="item.allowWriteAgain"
-              :uploadid="uploadid2"
-              @newimgarr="newimgarr1"
-              imgText="上传照片"
-              :indexImg="index"
-              :customId="item.customId"
-              :summaryId="item.summaryId"
-              :allowWriteAgain="item.allowWriteAgain"
-              :item="item"
-              @click="imgClick(item, index)"></upload-img>
+            <upload-img v-if="item.allowWriteAgain" :uploadid="uploadid2" @newimgarr="newimgarr1" imgText="上传照片"
+              :indexImg="index" :customId="item.customId" :summaryId="item.summaryId"
+              :allowWriteAgain="item.allowWriteAgain" :item="item" @click="imgClick(item, index)"></upload-img>
           </van-row>
         </div>
         <div v-if="item.answerType == 'wb'" class="formLabel z-cell">
@@ -83,32 +62,23 @@
               {{ item.customName }}
             </template>
           </van-cell>
-          <van-field
-            :disabled="!item.allowWriteAgain"
-            v-model="item.answerValue"
-            :formatter="formatter"
-            autosize
-            type="textarea"
-            :placeholder="item.remark"></van-field>
+          <van-field :disabled="!item.allowWriteAgain" v-model="item.answerValue" :formatter="formatter" autosize
+            type="textarea" :placeholder="item.remark"></van-field>
           <!-- <p
             v-if="item.allowWriteAgain"
             style="color: #444; font-size: 12px; margin: 0; padding: 10px 0; text-align: right">
             {{ item.remark }}
           </p> -->
         </div>
-        <div
-          class="formLabel z-cell z-cells z-celly"
+        <div class="formLabel z-cell z-cells z-celly"
           v-if="item.answerType == 'gs' || item.answerType == 'dq' || item.answerType == 'xsb'">
           <van-cell>
             <template #title>
               {{ 1 + index + '.' }}
               {{ item.customName }}
-              <span
-                v-if="item.allowWriteAgain"
-                style="color: #444; font-size: 12px; margin: 0; padding: 10px 0; text-align: right"
-                >{{ item.remark }}</span
-              ></template
-            >
+              <span v-if="item.allowWriteAgain"
+                style="color: #444; font-size: 12px; margin: 0; padding: 10px 0; text-align: right">{{ item.remark
+                }}</span></template>
           </van-cell>
           <p class="mg0">{{ item.answerName }}</p>
         </div>
@@ -120,13 +90,8 @@
               {{ item.customName }}
             </template>
           </van-cell>
-          <z-checkbox
-            :disabled="!item.allowWriteAgain"
-            :answerType="item.answerType"
-            :checkboxval="item.answerValue"
-            :collectionType="item.customOptionList"
-            :textc="item.customId"
-            :zCheckboxcolumns="item.customOptionList"
+          <z-checkbox :disabled="!item.allowWriteAgain" :answerType="item.answerType" :checkboxval="item.answerValue"
+            :collectionType="item.customOptionList" :textc="item.customId" :zCheckboxcolumns="item.customOptionList"
             @zSelectVal="zSelectVal"></z-checkbox>
         </div>
         <div v-if="item.answerType == 'dx'" class="formLabel z-cell">
@@ -137,16 +102,11 @@
               {{ item.customName }}
             </template>
           </van-cell>
-          <z-radio
-            :disabled="!item.allowWriteAgain"
-            :answerType="item.answerType"
-            :collectionType="item.collectionType"
-            :radio="item.answerValue"
-            :textc="item.customId"
-            :zRadiocolumns="item.customOptionList"
+          <z-radio :disabled="!item.allowWriteAgain" :answerType="item.answerType" :collectionType="item.collectionType"
+            :radio="item.answerValue" :textc="item.customId" :zRadiocolumns="item.customOptionList"
             @zSelectVal="zSelectVal"></z-radio>
         </div>
-        <div v-if="item.answerType == 'jxs'" class="formLabel z-cell">
+        <div v-if="item.answerType == 'jxs' || item.answerType == 'md'" class="formLabel z-cell">
           <van-cell>
             <template #title>
               <span v-if="item.isMust == 0" class="van-f-red">*</span>
@@ -155,109 +115,83 @@
             </template>
           </van-cell>
           <div class="jxsBox">
-            <div class="jxsContent">
-              <div class="item" v-for="(val, index) in item.chainList">
-                <el-popover
-                  placement="bottom"
-                  trigger="click"
-                  :content="val.chainName + '(' + val.chainCode + ')'">
+            <div class="jxsContent" v-if="item.answerType == 'jxs'">
+              <div class="item" v-for="(val, index) in item.chainList" :key="index">
+                <el-popover placement="bottom" trigger="click" :content="val.chainName + '(' + val.chainCode + ')'">
                   <template slot="reference">
                     <div class="selectItem">{{ val.chainName }} &nbsp; ({{ val.chainCode }})</div>
-                    <van-icon
-                      name="clear"
-                      size="16"
-                      @click="closeJXS(item, index)"
-                      v-if="item.allowWriteAgain" />
+                    <van-icon name="clear" size="16" @click="closeJXSorMD(item, index)" />
                   </template>
                 </el-popover>
               </div>
             </div>
-            <div class="addJXS">
-              <van-icon name="add-o" size="24" @click="addJXS" v-if="item.allowWriteAgain" />
+            <div class="jxsContent" v-if="item.answerType == 'md'">
+              <div class="item" v-for="(val, index) in item.storeList" :key="index">
+                <el-popover placement="bottom" trigger="click" :content="val.storeName + '(' + val.storeCode + ')'">
+                  <template slot="reference">
+                    <div class="selectItem">{{ val.storeName }} &nbsp; ({{ val.storeCode }})</div>
+                    <van-icon name="clear" size="16" @click="closeJXSorMD(item, index)" />
+                  </template>
+                </el-popover>
+              </div>
             </div>
-            <div class="tips" v-if="item.allowWriteAgain">{{ item.remark }}</div>
+            <div class="addJXS"><van-icon name="add-o" size="24" @click="addJXSorMD(item, index)" /></div>
+            <div class="tips">{{ item.remark }}</div>
           </div>
         </div>
         <br />
       </div>
     </van-form>
-    <van-calendar
-      v-model="showCalendar"
-      @confirm="onConfirm"
-      color="#0057ba"
-      :min-date="minDate"
-      :max-date="maxDate"
+    <van-calendar v-model="showCalendar" @confirm="onConfirm" color="#0057ba" :min-date="minDate" :max-date="maxDate"
       :show-confirm="false" />
     <van-popup v-model="RegionShow" capture position="bottom">
-      <van-picker
-        :columns="companyList"
-        show-toolbar
-        value-key="deptName"
-        @cancel="RegionShow = false"
+      <van-picker :columns="companyList" show-toolbar value-key="deptName" @cancel="RegionShow = false"
         @confirm="onregionConfirm" />
     </van-popup>
     <van-popup v-model="SalesRegionShow" capture position="bottom">
-      <van-picker
-        :columns="regionList"
-        show-toolbar
-        value-key="deptName"
-        @cancel="SalesRegionShow = false"
+      <van-picker :columns="regionList" show-toolbar value-key="deptName" @cancel="SalesRegionShow = false"
         @confirm="onSalesRegionConfirm" />
     </van-popup>
     <van-popup v-model="SalesDepartmentShow" capture position="bottom">
-      <van-picker
-        :columns="deptList"
-        show-toolbar
-        value-key="deptName"
-        @cancel="SalesDepartmentShow = false"
+      <van-picker :columns="deptList" show-toolbar value-key="deptName" @cancel="SalesDepartmentShow = false"
         @confirm="onSalesDepartmentConfirm" />
     </van-popup>
     <van-popup v-model="StartTimeShow" capture position="bottom">
-      <van-datetime-picker
-        v-model="strtcurrentDate"
-        :max-date="strtmaxDate"
-        :min-date="strtminDate"
-        title="选择查找开始时间"
-        type="date"
-        @cancel="StartTimeShow = false"
-        @confirm="onStartTimeConfirm" />
+      <van-datetime-picker v-model="strtcurrentDate" :max-date="strtmaxDate" :min-date="strtminDate" title="选择查找开始时间"
+        type="date" @cancel="StartTimeShow = false" @confirm="onStartTimeConfirm" />
     </van-popup>
     <van-popup v-model="EndTimeShow" capture position="bottom">
-      <van-datetime-picker
-        v-model="endcurrentDate"
-        :max-date="endmaxDate"
-        :min-date="endminDate"
-        title="选择查找结束时间"
-        type="date"
-        @cancel="EndTimeShow = false"
-        @confirm="onEndTimeConfirm" />
+      <van-datetime-picker v-model="endcurrentDate" :max-date="endmaxDate" :min-date="endminDate" title="选择查找结束时间"
+        type="date" @cancel="EndTimeShow = false" @confirm="onEndTimeConfirm" />
     </van-popup>
     <!-- 经销商 -->
     <van-popup v-model="moreTypeShow" position="bottom">
       <van-row style="background-color: #f5f5f5">
         <van-col span="20">
-          <van-field
-            left-icon="search"
-            style="margin-top: 2px; border-radius: 6px; overflow: hidden"
-            v-model="agentValue"
-            label=""
-            placeholder="请输入关键词"
-            clearable />
+          <van-field left-icon="search" style="margin-top: 2px; border-radius: 6px; overflow: hidden"
+            v-model="agentValue" label="" placeholder="请输入关键词" clearable />
         </van-col>
-        <van-col
-          span="4"
-          style="text-align: center; line-height: 48px"
-          @click="getChainsList(agentValue)">
+        <van-col span="4" style="text-align: center; line-height: 48px" @click="getChainsList(agentValue)">
           <div style="background-color: #0057ba; color: #fff">搜索</div>
         </van-col>
       </van-row>
-      <van-picker
-        show-toolbar
-        :columns="chainsData"
-        value-key="chainName"
-        @confirm="onConfirmChainsList"
+      <van-picker show-toolbar :columns="chainsData" value-key="chainName" @confirm="onConfirmChainsList"
         @cancel="moreTypeShow = false" />
     </van-popup>
+    <!-- 门店 -->
+    <van-popup v-model="storeTypeShow" position="bottom">
+      <van-row style="background-color: #f5f5f5">
+        <van-col span="20">
+          <van-field left-icon="search" style="margin-top: 2px; border-radius: 6px; overflow: hidden"
+            v-model="agentValue" label="" placeholder="请输入门店名称/编号/地址搜索" clearable />
+        </van-col>
+        <van-col span="4" style="text-align: center; line-height: 48px" @click="getStoresList(agentValue)">
+          <div style="background-color: #0057ba; color: #fff">搜索</div>
+        </van-col>
+      </van-row>
+      <van-picker show-toolbar :columns="storesData" value-key="storeName" @confirm="onConfirmStoresList"
+        @cancel="storeTypeShow = false" />
+    </van-popup>
   </div>
 </template>
 
@@ -267,6 +201,7 @@ import {
   getSummaryMobileDeptInfo,
   getDeptsByUser,
   chainsList,
+  storesList
 } from '@/api/index';
 import zRadio from '@/components/zRadio2';
 import zCheckbox from '@/components/zCheckbox2';
@@ -339,8 +274,12 @@ export default {
       index: '',
       activaFlag: true,
       moreTypeShow: false,
+      storeTypeShow: false,
+      storeType: null,
       agentValue: '',
+      selectIndex: 0,
       chainsData: [],
+      storesData: [],
       chainName: '',
       chainCode: '',
       jxsList: [],
@@ -439,7 +378,7 @@ export default {
     dateFn(val) {
       return val.slice(0, 4) + '-' + val.slice(4, 6) + '-' + val.slice(6, 8);
     },
-    onLoad() {},
+    onLoad() { },
     onSubmit() {
       for (var c = 0; c < this.collectionAnswerlisd.length; c++) {
         for (var b = 0; b < this.collectionItemList.length; b++) {
@@ -791,15 +730,39 @@ export default {
       this.formData.pageNum = 1;
       this.EndTimeShow = false;
     },
-    // 添加经销商
-    addJXS() {
-      this.agentValue = '';
-      this.moreTypeShow = true;
-      this.getChainsList();
+    // 添加经销商或者门店
+    addJXSorMD(val,index) {
+      this.selectIndex = index;
+      let answerType = val.answerType;
+      let dataList = [];
+      if (answerType == 'jxs') {
+        dataList = val.chainList ? val.chainList : [];
+      } else if (answerType == 'md') {
+        dataList = val.storeList ? val.storeList : [];
+      }
+      const isExceedLimit = dataList.length >= val.maxValue;
+      if (val.maxValue !== null && isExceedLimit) {
+        this.$toast('超过最大限制!');
+      } else {
+        this.agentValue = '';
+        if (answerType == 'jxs') {
+          this.moreTypeShow = true;
+          this.getChainsList();
+        } else if (answerType == 'md') {
+          this.storeTypeShow = true;
+          this.storeType = val.storeType;
+          this.getStoresList();
+        }
+
+      }
     },
-    // 删除经销商
-    closeJXS(item, index) {
-      item.chainList.splice(index, 1);
+    // 删除经销商或者门店
+    closeJXSorMD(item, index) {
+      if (item.answerType == 'jxs') {
+        item.chainList.splice(index, 1);
+      } else if (item.answerType == 'md') {
+        item.storeList.splice(index, 1);
+      }
     },
     getChainsList(value = '') {
       this.chainsData = [];
@@ -819,9 +782,28 @@ export default {
           this.chainsData = [];
         });
     },
+    getStoresList(value = '') {
+      this.storesData = [];
+      storesList({
+        storeCategoryList: this.storeType ? this.storeType.split(",") : [], //	门店类型数组
+        storeName: value, //	门店名称或者编号搜索,模糊搜索
+        pageNum: 1, //	int	    页码
+        PageSize: 100    // 每页数
+      })
+        .then((res) => {
+          if (res.code == 200 && res.rows) {
+            this.storesData = res.rows;
+          } else {
+            this.storesData = [];
+          }
+        })
+        .catch(() => {
+          this.storesData = [];
+        });
+    },
     onConfirmChainsList(value) {
       if (value && value.chainName != undefined) {
-        let JXSSataList = this.collectionItemList.find((item) => item.answerType == 'jxs');
+        let JXSSataList = this.collectionItemList.find((item,index) => item.answerType == 'jxs' && index == this.selectIndex);
         if (!JXSSataList.chainList) {
           JXSSataList.chainList = [];
         }
@@ -837,6 +819,24 @@ export default {
         }
       }
     },
+    onConfirmStoresList(value) {
+      if (value && value.storeName != undefined) {
+        let MDSataList = this.collectionItemList.find((item,index) => item.answerType == 'md' && index == this.selectIndex);
+        if (!MDSataList.storeList) {
+          MDSataList.storeList = [];
+        }
+        let isFlag = MDSataList.storeList.find((val) => val.storeCode == value.storeCode);
+        if (!isFlag) {
+          MDSataList.storeList.push({
+            storeName: value.storeName,
+            storeCode: value.storeCode,
+          });
+          this.storeTypeShow = false;
+        } else {
+          this.$toast('当前门店已添加,不能重复添加!');
+        }
+      }
+    },
   },
 };
 </script>
@@ -892,6 +892,7 @@ export default {
   .z-cell .van-cell__title {
     font-size: 16px;
   }
+
   .van-form {
     background-color: white;
   }
@@ -901,15 +902,18 @@ export default {
 .jxsBox {
   .jxsContent {
     margin-bottom: 10px;
+
     .item {
       padding: 5px;
       background: #e9e9e9;
       margin: 5px 0;
+
       .el-popover__reference-wrapper {
         display: flex;
         justify-content: space-between;
         align-items: center;
       }
+
       .selectItem {
         flex: 1;
         white-space: nowrap;
@@ -919,10 +923,12 @@ export default {
       }
     }
   }
+
   .tips {
     text-align: right;
   }
 }
+
 .table-headermd {
   font-size: 12px;
   text-align: center;
@@ -952,12 +958,12 @@ export default {
   height: 100%;
 }
 
-.table-headermd th.el-table__cell > .cell {
+.table-headermd th.el-table__cell>.cell {
   padding: 0 4px;
   text-align: center;
 }
 
-.table-headermd th.el-table__cell:first-child > .cell {
+.table-headermd th.el-table__cell:first-child>.cell {
   text-align: left;
 }
 

File diff suppressed because it is too large
+ 364 - 271
src/views/week/componVisitSummary.vue