Browse Source

基本信息样式调整,新增修改接口

nanMing 1 year ago
parent
commit
0381a7ad28
3 changed files with 225 additions and 112 deletions
  1. 95 1
      api/lr.js
  2. 78 82
      pages/index/index.vue
  3. 52 29
      pages/lr/index.vue

+ 95 - 1
api/lr.js

@@ -18,4 +18,98 @@ export function List(data) {
 		method: 'get',
 		data: data
 	})
-}
+}
+
+// 查询养老机构_客户_基本信息列表
+export function listKhjbxx(data) {
+  return request({
+    url: '/organization/khjbxx/list',
+    method: 'get',
+    data: data
+  })
+}
+
+// 新增养老机构_客户_基本信息
+export function addKhjbxx(data) {
+  return request({
+    url: '/organization/khjbxx',
+    method: 'post',
+    data: data
+  })
+}
+
+// 修改养老机构_客户_基本信息
+export function updateKhjbxx(data) {
+  return request({
+    url: '/organization/khjbxx',
+    method: 'put',
+    data: data
+  })
+}
+
+// 删除养老机构_客户_基本信息
+export function delKhjbxx(id) {
+  return request({
+    url: '/organization/khjbxx/' + id,
+    method: 'delete'
+  })
+}
+
+// 查询养老机构_客户_基本信息详细
+export function getKhjbxx(id) {
+  return request({
+    url: '/organization/khjbxx/' + id,
+    method: 'get'
+  })
+}
+
+/**
+ * ---------------------------------------------------------------------------------------------------------------
+*/
+
+// 查询养老机构_客户_家庭信息列表
+export function listJtxx(query) {
+  return request({
+    url: '/organization/jtxx/list',
+    method: 'get',
+    params: query
+  })
+}
+
+// 新增养老机构_客户_家庭信息
+export function addJtxx(data) {
+  return request({
+    url: '/organization/jtxx',
+    method: 'post',
+    data: data
+  })
+}
+
+// 修改养老机构_客户_家庭信息
+export function updateJtxx(data) {
+  return request({
+    url: '/organization/jtxx',
+    method: 'put',
+    data: data
+  })
+}
+
+// 删除养老机构_客户_家庭信息
+export function delJtxx(id) {
+  return request({
+    url: '/organization/jtxx/' + id,
+    method: 'delete'
+  })
+}
+
+// 查询养老机构_客户_家庭信息详细
+export function getJtxx(id) {
+  return request({
+    url: '/organization/jtxx/' + id,
+    method: 'get'
+  })
+}
+
+/**
+ * ---------------------------------------------------------------------------------------------------------------
+*/

+ 78 - 82
pages/index/index.vue

@@ -1,86 +1,82 @@
 <template>
-	<view class="page-main">
-		<view style="width: 90%;margin-left: 5%;">
-			<uni-easyinput type="text" trim="all" prefixIcon="search" v-model="form.xm" placeholder="请输入姓名搜索"
-				confirmType="search" @blur="getList(true)"></uni-easyinput>
-		</view>
-		<view style="margin-top: 10rpx;">
-			<uni-list :border="true">
-				<uni-list-item :title="item.xm" :note="item.sjhm" showArrow v-for="(item,index) in dataList"
-					:key="index" :thumb="item.tx" :rightText="item.age" thumb-size="lg" link="navigateTo"
-					:to="`/pages/lr/index?item=`+JSON.stringify(item)" />
-			</uni-list>
-		</view>
-		<view>
-			<uni-load-more :status="status" :content-text="contentText" @clickLoadMore="clickLoadMore" />
-		</view>
-		<navigator url="/pages/lr/index">
-			<image src="../../static/image/add.png" class="floating-button"></image>
-		</navigator>
-	</view>
+  <view class="page-main">
+    <view style="width: 90%;margin-left: 5%;">
+      <uni-easyinput type="text" trim="all" prefixIcon="search" v-model="form.xm" placeholder="请输入姓名搜索"
+        confirmType="search" @blur="getList(true)"></uni-easyinput>
+    </view>
+    <view style="margin-top: 10rpx;">
+      <uni-list :border="true">
+        <uni-list-item :title="item.xm" :note="item.sjhm" showArrow v-for="(item,index) in dataList" :key="index"
+          :thumb="item.tx" :rightText="item.age" thumb-size="lg" link="navigateTo"
+          :to="`/pages/lr/index?item=`+JSON.stringify(item)" />
+      </uni-list>
+    </view>
+    <view>
+      <uni-load-more :status="status" :content-text="contentText" @clickLoadMore="clickLoadMore" />
+    </view>
+    <navigator url="/pages/lr/index">
+      <image src="../../static/image/add.png" class="floating-button"></image>
+    </navigator>
+  </view>
 </template>
 
 <script>
-	import {
-		List
-	} from '@/api/lr.js'
-	import config from '@/config.js'
-	import {
-		decryptRowData_ECB
-	} from '@/common/sm4.js'
-	export default {
-		data() {
-			return {
-				status: 'more',
-				contentText: {
-					contentdown: '查看更多',
-					contentrefresh: '加载中',
-					contentnomore: '没有更多'
-				},
-				form: {
-					pageNum: 1,
-					pageSize: 10,
-				},
-				total: 0,
-				dataList: []
-			}
+  import { listKhjbxx } from '@/api/lr.js'
+  import config from '@/config.js'
+  import { decryptRowData_ECB } from '@/common/sm4.js'
+  export default {
+    data() {
+      return {
+        status: 'more',
+        contentText: {
+          contentdown: '查看更多',
+          contentrefresh: '加载中',
+          contentnomore: '没有更多'
+        },
+        form: {
+          pageNum: 1,
+          pageSize: 10,
+        },
+        total: 0,
+        dataList: []
+      }
 
-		},
-		mounted() {
-			this.getList()
-		},
-		onPullDownRefresh() {
-			this.getList(true)
-		},
-		onLoad() {},
-		methods: {
-			getList(isClear) {
-				isClear ? this.dataList = [] : ''
-				List(this.form).then(res => {
-					let list = decryptRowData_ECB(res.rows, ['xm', 'zjhm', 'sjhm', 'jhrsjhm', 'xjd'], [1, 2,
+    },
+    mounted() {
+      this.getList()
+    },
+    onPullDownRefresh() {
+      this.getList(true)
+    },
+    onLoad() {},
+    methods: {
+      getList(isClear) {
+        isClear ? this.dataList = [] : ''
+        listKhjbxx(this.form).then(res => {
+          let list = decryptRowData_ECB(res.rows, ['xm', 'zjhm', 'sjhm', 'jhrsjhm', 'xjd'], [1, 2,
 						3, 3, 4
 					])
-					list.forEach(item => {
-						item.tx = item.tx ? config.baseUrl + item.tx : config.baseUrl + config.head;
-					});
-					this.dataList.push(...list)
-					this.total = res.total
-					this.total > this.dataList.length ? this.status = 'more' : this.status = 'noMore'
-				})
-				setTimeout(function() {
-					uni.stopPullDownRefresh();
-				}, 1000);
-			},
-			clickLoadMore(e) {
-				if (this.total > this.dataList.length) {
-					this.status = 'loading'
-					this.form.pageNum += 1
-					this.getList()
-				}
+          list.forEach(item => {
+            item.tx = item.tx ? config.baseUrl + item.tx : config.baseUrl + config.head;
+          });
+          this.dataList.push(...list)
+          this.total = res.total
+          this.total > this.dataList.length ? this.status = 'more' : this.status = 'noMore'
+        })
+        setTimeout(function() {
+          uni.stopPullDownRefresh();
+        }, 1000);
+      },
+      clickLoadMore(e) {
+        if (this.total > this.dataList.length) {
+          this.status = 'loading'
+          this.form.pageNum += 1
+          this.getList()
+        }
 
-			}
-		}
-	}
+      }
+    }
+  }
 </script>
 
 
@@ -88,11 +84,11 @@
 
 
 <style lang="scss" scoped>
-	.floating-button {
-		position: fixed;
-		bottom: 20px;
-		right: 20px;
-		width: 120rpx;
-		height: 120rpx;
-	}
+  .floating-button {
+    position: fixed;
+    bottom: 20px;
+    right: 20px;
+    width: 120rpx;
+    height: 120rpx;
+  }
 </style>

+ 52 - 29
pages/lr/index.vue

@@ -3,9 +3,6 @@
     <view>
       <csr-tab :tabList="list" :value="active" @change="changeTab" />
     </view>
-
-    <!-- <view class="line"></view> -->
-
     <view>
       <uni-section padding>
         <uni-forms ref="baseForm" :modelValue="baseFormData" :rules="rules" label-width="95px" label-align="right">
@@ -26,7 +23,7 @@
               <uni-easyinput v-model="baseFormData.sjhm" placeholder="请输入手机号" />
             </uni-forms-item>
             <uni-forms-item label="出生日期">
-              <uni-datetime-picker type="data" v-model="baseFormData.csrq" placeholder="请选择出生日期" />
+              <uni-datetime-picker type="date" v-model="baseFormData.csrq" placeholder="请选择出生日期" />
             </uni-forms-item>
             <uni-forms-item label="身高">
               <uni-easyinput type="number" v-model="baseFormData.sg" placeholder="身高单位:cm" />
@@ -45,7 +42,7 @@
             </uni-forms-item>
             <uni-forms-item label="定位">
               <view @click="openChooseLocation">
-                <uni-easyinput v-model="baseFormData.dw" placeholder="请选择定位" disabled />
+                <uni-easyinput v-model="baseFormData.zzjwd" placeholder="请选择定位" disabled />
               </view>
             </uni-forms-item>
             <uni-forms-item label="监护人">
@@ -122,7 +119,6 @@
             </view>
           </view>
           <view v-else-if="active==2">
-
             <button type="primary" size="mini" @click="addFamily" style="width: 160rpx;">新增</button>
             <uni-table>
               <uni-tr>
@@ -153,7 +149,8 @@
               <uni-popup-dialog ref="inputClose" mode="input" title="添加家庭成员信息" before-close="true"
                 @confirm="dialogInputConfirm" @close="cance">
 
-                <uni-forms ref="familyForm" :modelValue="familyFormData" :rules="familyRules" padding>
+                <uni-forms ref="familyForm" :modelValue="familyFormData" :rules="familyRules" label-align="right"
+                  padding>
                   <uni-forms-item label="关系" required name="jtcygx">
                     <uni-data-select v-model="familyFormData.jtcygx" placeholder="请选择与老人关系" :localdata="dicts.C0032" />
                   </uni-forms-item>
@@ -213,15 +210,9 @@
 <script>
   import amapFile from "@/libs/amap-wx.130.js";
   import config from "../../config.js";
-  import {
-    UploadOne
-  } from '@/api/upload.js';
-  import {
-    Save
-  } from '@/api/lr.js'
-  import {
-    decimalToBinary
-  } from '@/common/num.js'
+  import { UploadOne } from '@/api/upload.js';
+  import { addKhjbxx, listJtxx, addJtxx, updateJtxx, updateKhjbxx } from '@/api/lr.js'
+  import { decimalToBinary } from '@/common/num.js'
 
   export default {
     data() {
@@ -587,17 +578,30 @@
         startPoint: {
           latitude: 43.834931,
           longitude: 125.289036
+        },
+
+
+        // 家庭信息列表请求参数
+        jtxxParams: {
+          pageNum: 1,
+          pageSize: 10,
         }
       }
 
     },
     created() {
       this.getDictList(Object.keys(this.dicts), this.dicts)
+      listJtxx(this.jtxxParams).then(res => {
+
+      })
     },
     onLoad(option) {
       if (Object.keys(option).length !== 0) {
         this.baseFormData = JSON.parse(option.item)
         if (this.baseFormData.xm) {
+          uni.setNavigationBarTitle({
+            title: '修改客户信息'
+          });
           this.bsFormatTo()
         }
       }
@@ -618,16 +622,19 @@
         this.$refs.inputDialog.open()
       },
       dialogInputConfirm(val) {
-        this.$refs['familyForm'].validate().then(res => {
-          console.log('success', res);
-          // 关闭窗口后,恢复默认内容
-          this.$refs.inputDialog.close()
+        this.$refs['familyForm'].validate().then(() => {
+          addJtxx(this.familyFormData).then(res => {
+            console.log('success', res);
+            // 关闭窗口后,恢复默认内容
+            this.$refs.inputDialog.close()
+          })
         }).catch(err => {
           console.log('err', err);
         })
       },
       // 弹出取消
       cance() {
+        this.$refs.familyForm.clearValidate()
         this.$refs.inputDialog.close()
       },
       // tab切换
@@ -707,24 +714,40 @@
         this.$refs['baseForm'].validate().then(res => {
           if (isSave) {
             this.bsFormatFrom()
-            Save(this.baseFormData).then(r => {
-              if (r.data.id) {
+            if (this.baseFormData.id) {
+              // 修改
+              updateKhjbxx(this.baseFormData).then(r => {
+                if (r.code !== 200) return
                 uni.showToast({
-                  title: `保存成功!`,
+                  title: `修改成功!`,
                   duration: 2000,
                   success: function(res) {
-
                     setTimeout(function() {
                       uni.switchTab({
                         url: '/pages/index/index'
                       });
                     }, 2000)
-
-
                   }
                 })
-              }
-            })
+              })
+            } else {
+              // 新增
+              addKhjbxx(this.baseFormData).then(r => {
+                if (r.code !== 200) return
+                uni.showToast({
+                  title: `新增成功!`,
+                  duration: 2000,
+                  success: function(res) {
+                    setTimeout(function() {
+                      uni.switchTab({
+                        url: '/pages/index/index'
+                      });
+                    }, 2000)
+                  }
+                })
+              })
+            }
+
           } else {
             this.active = 1
           }
@@ -750,7 +773,7 @@
         this.baseFormData.xqah = this.formatInt10(this.baseFormData.xqahData, '000000000')
         this.baseFormData.jntc = this.formatInt10(this.baseFormData.jntcData, '000000')
         if (this.baseFormData.csrq) {
-          this.baseFormData.csrq = this.baseFormData.csrq.replace('-', '')
+          this.baseFormData.csrq = this.baseFormData.csrq.replaceAll('-', '')
         }
 
         if (this.baseFormData.bs.length > 0) {