Lou
2024-01-08 7f1e749f9a60d36edb04e06610fb111567d404bf
subPackage/workbench/views/workLog.vue
@@ -3,17 +3,45 @@
      <view class="content bgc-ff">
         <u-form labelPosition="left" :model="info" :rules="rules" ref="form" labelWidth="90"
            :labelStyle="{fontSize:'28rpx'}">
            <u-form-item label="姓名" prop="info.name" borderBottom required>
            <u-form-item label="走访类型" prop="type" :borderBottom="false" required @click="isShowTypePicker = true">
               <u-input v-model="typeName" disabled disabledColor="#fff" border="none" placeholder="请选择"
                  placeholderClass="f-28 c-99" inputAlign="right"></u-input>
               <u-icon slot="right" name="arrow-right"></u-icon>
            </u-form-item>
            <u-form-item label="重点人群类型" prop="peopleType" :borderBottom="false" required
               @click="isShowLabelPicker = true" v-if="info.type == 2">
               <u-input v-model="labelName" disabled disabledColor="#fff" border="none" placeholder="请选择"
                  placeholderClass="f-28 c-99" inputAlign="right"></u-input>
               <u-icon slot="right" name="arrow-right"></u-icon>
            </u-form-item>
            <u-form-item label="被访人姓名" prop="name" :borderBottom="false" required @click="isShowPopup = true">
               <u-input v-model="selectedHousehold.name" disabled disabledColor="#fff" border="none"
                  placeholder="请选择" placeholderClass="f-28 c-99" inputAlign="right"></u-input>
               <u-icon slot="right" name="arrow-right"></u-icon>
            </u-form-item>
            <u-form-item label="手机号" borderBottom required v-if="info.householdId">
               <u-input v-model="selectedHousehold.phoneNumber" border="none" disabled disabledColor="#f5f5f5"
                  placeholderClass="f-28 c-99" inputAlign="right"></u-input>
            </u-form-item>
            <u-form-item label="走访地址" borderBottom required v-if="info.householdId">
               <!-- <u-input v-model="address" border="none" disabled disabledColor="#f5f5f5"
                  placeholderClass="f-28 c-99" inputAlign="right"></u-input> -->
               <view class="address-content">
                  {{address}}
               </view>
            </u-form-item>
            <!-- <u-form-item label="姓名" prop="info.name" borderBottom required>
               <u-input v-model="info.name" border="none" placeholder="请输入" placeholderClass="f-28 c-99"
                  inputAlign="right"></u-input>
            </u-form-item>
            <u-form-item label="手机号" prop="phone" borderBottom  required>
               <u-input v-model="info.phone" border="none" placeholder="请输入手机号"   placeholderClass="f-28 c-99"
            <u-form-item label="手机号" prop="phone" borderBottom required>
               <u-input v-model="info.phone" border="none" placeholder="请输入手机号" placeholderClass="f-28 c-99"
                  inputAlign="right"></u-input>
            </u-form-item>
            <u-form-item label="内容" borderBottom  required>
               <u-input type="textarea" v-model="info.context" border="none"  placeholderClass="f-28 c-99"
                  inputAlign="right"  placeholder="请输入内容">
            </u-form-item> -->
            <u-form-item label="内容" borderBottom required>
               <u-input type="textarea" v-model="info.context" border="none" placeholderClass="f-28 c-99"
                  inputAlign="right" placeholder="请输入内容">
               </u-input>
            </u-form-item>
            <u-form-item label="走访时间" prop="workTime" :borderBottom="false" required @click="showSelectDate = true">
@@ -43,11 +71,42 @@
      </view>
      <u-datetime-picker ref="datetimePicker" :show="showSelectDate" v-model="workTime" mode="datetime"
         :formatter="formatter" @confirm="confirmDate" @cancel="isShowPicker = false"></u-datetime-picker>
      <!-- <u-picker :show="isShowPicker" :columns="scStatus" :defaultIndex="houseIndex" @cancel="isShowPicker = false"
         @confirm="confirmHouse()"></u-picker> -->
       <footer-btn  @click="submitInfo"   />
         :formatter="formatter" @confirm="confirmDate" @cancel="showSelectDate = false"></u-datetime-picker>
      <u-picker :show="isShowTypePicker" :columns="typeList" :defaultIndex="typeIndex"
         @cancel="isShowTypePicker = false" @confirm="confirmType()" keyName="dictValue"></u-picker>
      <u-picker :show="isShowLabelPicker" :columns="labelList" :defaultIndex="labelIndex"
         @cancel="isShowLabelPicker = false" @confirm="confirmLabelType()" keyName="name"></u-picker>
      <footer-btn @click="submitInfo" />
      <u-popup :show="isShowPopup" mode="bottom" :round="10" closeable="true" @close="isShowPopup = false">
         <view class="popup-content">
            <view class="popup-title f-30">
               选择居民
            </view>
            <u-search placeholder="请输入要搜索的内容(姓名 手机号)" :showAction="true" actionText="搜索" :animation="true"
               v-model="keyword" @search="searchHousehold" @custom="searchHousehold"
               @clear="clearKeyword"></u-search>
            <scroll-view class="popup-list" :scroll-y="true">
               <view class="popup-list-item" v-for="(i,k) in houseHoldList" :key="k" @click="selectHousehold(i)">
                  <view class="flex a-i-c mb-10">
                     <text class="f-28 fw mr-20">{{i.name}}</text>
                     <text class="f-26" v-if="i.phoneNumber">{{i.phoneNumber}}</text>
                  </view>
                  <view class="f-28">
                     {{i.townStreetName}}{{i.neiName}}{{i.aoiName}}{{i.address || ""}}
                  </view>
                  <view class="check-icon" v-if="i.id == info.householdId">
                     <u-icon name="checkbox-mark" color="#017BFC" size="30"></u-icon>
                  </view>
               </view>
            </scroll-view>
         </view>
      </u-popup>
   </view>
</template>
@@ -57,6 +116,15 @@
      addWorkLog
   } from "@/api/workLog/workLog.js"
   import uploadMixin from "@/mixin/uploadMixin";
   import {
      bizDictionary
   } from '@/api/system/dict.js'
   import {
      getLabelListByParentId
   } from "@/api/label/label.js";
   import {
      fetchHousehold
   } from "@/api/house/household.js"
   export default {
      mixins: [uploadMixin],
      data() {
@@ -70,16 +138,29 @@
               context: ""
            },
            rules: {
               'name': {
               // 'name': {
               //    type: 'string',
               //    required: true,
               //    message: '请输入姓名',
               //    trigger: ['blur', 'change']
               // },
               // 'phone': {
               //    type: 'string',
               //    required: true,
               //    message: '请输入手机号',
               //    trigger: ['blur', 'change']
               // },
               'type': {
                  type: 'string',
                  required: true,
                  message: '请输入姓名',
                  message: '请选择走访类型',
                  trigger: ['blur', 'change']
               },
               'phone': {
               'householdId': {
                  type: 'string',
                  required: true,
                  message: '请输入手机号',
                  message: '请选择被访问人',
                  trigger: ['blur', 'change']
               },
               'context': {
@@ -92,7 +173,20 @@
            showSelectDate: false,
            workTime: Number(new Date()),
            isShowPicker: false,
            houseIndex: [0]
            houseIndex: [0],
            typeList: [],
            typeName: "",
            typeIndex: [0],
            isShowTypePicker: false,
            isShowLabelPicker: false,
            labelList: [],
            labelIndex: [0],
            labelName: "",
            keyword: "",
            houseHoldList: [],
            selectedHousehold: {},
            isShowPopup: false,
            address: ""
         }
      },
      // onLoad() {
@@ -100,7 +194,42 @@
      //    this.$set(this.info, "name", userInfo.real_name);
      //    this.$set(this.info, "phone", userInfo.phone);
      // },
      onLoad() {
         this.getTypeList();
         this.getLabelLit();
      },
      methods: {
         getTypeList() {
            bizDictionary({
               code: "haveType"
            }).then(res => {
               console.log(res)
               this.typeList = [res.data];
            })
         },
         getLabelLit() {
            getLabelListByParentId({
               parentId: 100
            }).then(res => {
               this.labelList = [res.data];
            })
         },
         getHouseholdList() {
            fetchHousehold({
               labelId: this.info.personType,
               searchKey: this.keyword,
               limit: 20
            }).then(res => {
               this.houseHoldList = res.data;
            })
         },
         confirmDate(e) {
            this.showSelectDate = false;
@@ -111,6 +240,48 @@
            this.houseIndex = e.indexs;
            this.info.houseCode = e.value[0];
            this.isShowPicker = false;
         },
         //选择走访类型
         confirmType(e) {
            console.log("type==>", e);
            this.typeIndex = e.indexs;
            this.info.type = e.value[0].dictKey;
            this.typeName = e.value[0].dictValue;
            if (e.value[0].dictKey == 1) {
               this.info.personType = "";
               this.keyword = "";
               this.getHouseholdList();
            }
            this.isShowTypePicker = false;
         },
         //选择重点人群类型
         confirmLabelType(e) {
            this.labelIndex = e.indexs;
            this.info.personType = e.value[0].id;
            this.labelName = e.value[0].name;
            this.isShowLabelPicker = false;
            this.getHouseholdList();
         },
         //搜索住户
         searchHousehold() {
            this.getHouseholdList()
         },
         clearKeyword() {
            this.keyword = "";
            this.getHouseholdList()
         },
         //选择住户
         selectHousehold(item) {
            this.selectedHousehold = item;
            this.info.householdId = item.id;
            this.address = `${item.townStreetName}${item.neiName}${item.aoiName}${item.address || ""}`
            this.isShowPopup = false;
         },
         checkImages() {
@@ -203,4 +374,39 @@
         font-size: 32rpx;
      }
   }
   .popup-content {
      width: 100%;
      padding: 0 30rpx 30rpx;
      box-sizing: border-box;
      .popup-title {
         padding: 30rpx 0;
         text-align: center;
         font-weight: bold;
      }
      .popup-list {
         height: 650rpx;
      }
      .popup-list-item {
         padding: 20rpx 0;
         border-bottom: 1px solid #f1f1f1;
         position: relative;
      }
      .check-icon {
         position: absolute;
         right: 20rpx;
         top: 20rpx;
      }
   }
   .address-content {
      flex: 1;
      background-color: #F5F5F5;
      font-size: 28rpx;
      padding: 2rpx 10rpx;
   }
</style>