Ver código fonte

拆旧管新增 接口调用

zhnghongrui 1 ano atrás
pai
commit
19e4fa07fd
5 arquivos alterados com 125 adições e 52 exclusões
  1. 8 0
      api/common.js
  2. 3 3
      pages/login.vue
  3. 106 42
      pages/oldrenovation/indoor/tearOldPipe.vue
  4. 6 6
      store/modules/user.js
  5. 2 1
      utils/request.js

+ 8 - 0
api/common.js

@@ -1,6 +1,14 @@
 import request from '@/utils/request'
 
 
+// 新增拆旧管
+export function addTearOldPipe(param) {
+	return request({
+		'url': '/zdsz/engineeringCivil',
+		'method': 'post',
+		'data': param
+	})
+}
 
 // 获取小区字典值
 export function getAreaList(district) {

+ 3 - 3
pages/login.vue

@@ -80,10 +80,10 @@
       getCode() {
         getCodeImg().then(res => {
 			console.log(res)
-          this.captchaEnabled = res.captchaEnabled === undefined ? true : res.captchaEnabled
+          this.captchaEnabled = res.data.captchaEnabled === undefined ? true : res.data.captchaEnabled
           if (this.captchaEnabled) {
-            this.codeUrl = 'data:image/gif;base64,' + res.img
-            this.loginForm.uuid = res.uuid
+            this.codeUrl = 'data:image/gif;base64,' + res.data.img
+            this.loginForm.uuid = res.data.uuid
           }
         })
       },

+ 106 - 42
pages/oldrenovation/indoor/tearOldPipe.vue

@@ -4,6 +4,21 @@
 				<view class="uni-list">
 					<view class="container">
 						<view>
+							工程周期
+						</view>
+						<view v-if="this.isEmpty(this.projectValue.dictValue)" style="margin-top: 10;"
+							@click="pickerShow('gczq')">
+							<span style="color: darkgray;">请选择工程周期</span>
+						</view>
+						<view v-else class="uni-list-cell-db" style="margin-top: 10;" @click="pickerShow('gczq')">
+							<span style="color: black;">{{projectValue.dictLabel}}</span>
+						</view>
+
+					</view>
+				</view>
+				<view class="uni-list">
+					<view class="container">
+						<view>
 							行政区
 						</view>
 						<view v-if="this.isEmpty(this.XZQValue.dictValue)" style="margin-top: 10;"
@@ -76,7 +91,7 @@
 				<view class="container">
 
 					<view class="title">是否按照施工图纸施工</view>
-					<switch style="transform: scale(0.6,0.6);" @change="switch2Change" />
+					<switch style="transform: scale(0.6,0.6);" @change="switchChange" checked="isChick" />
 
 				</view>
 
@@ -112,29 +127,27 @@
 						</view>
 					</view>
 				</view>
+			</view>
+			<view class="align-items" style="margin-top: 20px;margin-bottom: 20px;">
+				<view class="container" style="color: gainsboro;">*请上传照片</view>
+				<view class="" style="display: flex; flex-wrap: wrap;margin-top: 10px;">
+					<image src="/static/images/chooseimg.png" mode=""
+						style="width: 190rpx; height: 190rpx; margin: 0 12rpx;; " @click="chooseimage()"></image>
+					<view v-for="(item,index) in imgArr" :key="index" style="position: relative;">
+						<view>
+							<image :src="item" mode="" style="width: 190rpx; height: 190rpx; margin: 0 12rpx;"
+								@click="showPhoto(index)">
+							</image>
+						</view>
 
-				<view class="align-items" style="margin-top: 20px;margin-bottom: 20px;">
-					<view class="container" style="color: gainsboro;">*请上传照片</view>
-					<view class="" style="display: flex; flex-wrap: wrap;margin-top: 10px;">
-						<image src="/static/images/chooseimg.png" mode=""
-							style="width: 190rpx; height: 190rpx; margin: 0 12rpx;; " @click="chooseimage()"></image>
-						<view v-for="(item,index) in imgArr" :key="index" style="position: relative;">
-							<view>
-								<image :src="item" mode="" style="width: 190rpx; height: 190rpx; margin: 0 12rpx;"
-									@click="showPhoto(index)">
-								</image>
-							</view>
-
-							<view @click="remove(index)"
-								style="position: absolute; top: 0; right: 14rpx; border-radius: 50%; background-color: #FF0000;">
-								<u-icon name="close" color="#FFFFFF" size="35"></u-icon>
-							</view>
+						<view @click="remove(index)"
+							style="position: absolute; top: 0; right: 14rpx; border-radius: 50%; background-color: #FF0000;">
+							<u-icon name="close" color="#FFFFFF" size="35"></u-icon>
 						</view>
 					</view>
-
 				</view>
-			</view>
 
+			</view>
 			<view class="action-btn">
 				<button @click="submit" class="btn cu-btn block bg-blue lg round">确认上传</button>
 			</view>
@@ -153,6 +166,7 @@
 			getBuildingList,
 			getUnitList,
 			getHousesList,
+			addTearOldPipe,
 		} from '@/api/common'
 		import {
 			getToken
@@ -176,6 +190,7 @@
 					imgArr: [],
 					XQValue: {},
 					XZQValue: {},
+					projectValue: {},
 					LevelValue: {},
 					LDValue: {},
 					DYValue: {},
@@ -186,7 +201,8 @@
 					DYList: '',
 					FJList: '',
 					progress: 0, //上传图片进度百分比
-					loading: false
+					loading: false,
+					isCheck: true //是否按照施工图纸施工
 
 
 				}
@@ -308,15 +324,24 @@
 						//腐蚀等级
 						getDicts("corrosion_level").then(response => {
 							console.log(response)
-							this.dictOptions = response;
+							this.dictOptions = response.data;
 						});
 
-					}
-					if (e == 'xzq') { //行政区
+					} else if (e == 'gczq') { //工程周期
 						this.openDict = true;
-						getDicts("district").then(response => {
-							this.dictOptions = response;
+						getDicts("engin_cycle").then(response => {
+							this.dictOptions = response.data;
 						});
+					} else if (e == 'xzq') { //行政区
+						if (this.isEmpty(this.projectValue.dictValue)) {
+							this.$modal.msg('请选择工程周期')
+
+						} else {
+							this.openDict = true;
+							getDicts("district").then(response => {
+								this.dictOptions = response.data;
+							});
+						}
 						//this.selectList = this.dictOptions;
 
 					} else if (e == 'xq') { //小区
@@ -358,21 +383,25 @@
 				},
 
 
-				switch2Change(e) {
+				switchChange(e) {
 					console.log('switch2 发生 change 事件,携带值为', e.detail.value)
+					this.isCheck = e.detail.value;
 				},
 				changeSelectDict(item, index) {
 					this.openDict = false;
-					if (this.type == 'xzq') {
+					if (this.type == 'gczq') {
+						this.projectValue = item
+
+					} else if (this.type == 'xzq') {
 						this.XZQValue = item;
 
 						//根据行政区id获取小区数据
-						this.XQValue.name = ''; //重置小区数据
-						this.LDValue.name = ''; //重置楼栋数据
-						this.DYValue.name = ''; //重置单元数据
-						this.FJValue.name = ''; //重置房间数据
+						this.XQValue = ''; //重置小区数据
+						this.LDValue = ''; //重置楼栋数据
+						this.DYValue = ''; //重置单元数据
+						this.FJValue = ''; //重置房间数据
 						getAreaList(item.dictValue).then(res => {
-							this.XQList = res;
+							this.XQList = res.data;
 						})
 					} else {
 						this.LevelValue = item;
@@ -386,28 +415,28 @@
 					if (this.type == 'xq') {
 						this.XQValue = item;
 						//根据小区id 获取楼栋数据
-						this.LDValue.name = ''; //重置楼栋数据
-						this.DYValue.name = ''; //重置单元数据
-						this.FJValue.name = ''; //重置房间数据
+						this.LDValue = ''; //重置楼栋数据
+						this.DYValue = ''; //重置单元数据
+						this.FJValue = ''; //重置房间数据
 						getBuildingList(item.id).then(res => {
-							this.LDList = res
+							this.LDList = res.data
 							// console.log("楼栋=", res)
 						})
 					} else if (this.type == 'ld') {
 						this.LDValue = item;
 						//根据楼栋ID 获取单元数据
-						this.DYValue.name = ''; //重置单元数据
-						this.FJValue.name = ''; //重置房间数据
+						this.DYValue = ''; //重置单元数据
+						this.FJValue = ''; //重置房间数据
 						getUnitList(item.id).then(res => {
-							this.DYList = res
+							this.DYList = res.data
 							// console.log("单元=", res)
 						})
 					} else if (this.type == 'dy') {
 						this.DYValue = item;
 						//根据单元数据 获取房间数据 
-						this.FJValue.name = ''; //重置房间数据
+						this.FJValue = ''; //重置房间数据
 						getHousesList(item.id).then(res => {
-							this.FJList = res
+							this.FJList = res.data
 							// console.log("房间=", res)
 						})
 					} else if (this.type == 'fj') {
@@ -425,7 +454,9 @@
 				},
 				//提交数据
 				submit() {
-					if (this.isEmpty(this.XZQValue.dictValue)) {
+					if (this.isEmpty(this.projectValue.dictValue)) {
+						this.$modal.msg("请选择工程周期")
+					} else if (this.isEmpty(this.XZQValue.dictValue)) {
 						this.$modal.msg("请选择行政区")
 					} else if (this.isEmpty(this.XQValue.id)) {
 						this.$modal.msg("请选择小区")
@@ -435,10 +466,43 @@
 						this.$modal.msg("请选择单元")
 					} else if (this.isEmpty(this.FJValue.id)) {
 						this.$modal.msg("请选择房间")
+					} else if (this.isEmpty(this.LevelValue.dictValue)) {
+						this.$modal.msg("请选择腐蚀等级")
 					} else if (this.imgArr.length <= 0) {
 						this.$modal.msg('请上传照片')
 					} else if (this.loading == false) {
 						this.$modal.msg('照片未上传完毕,无法提交!')
+					} else {
+						//提交
+						let param = {
+							district: this.XZQValue.dictValue,
+							areaId: this.XQValue.id,
+							buildingId: this.LDValue.id,
+							unitId: this.DYValue.id,
+							houseId: this.FJValue.id,
+							enginType: 'old_renovation', //写死
+							enginClassification: 'indoor_engineering', //写死
+							enginCycle: this.projectValue.dictValue, //工程周期
+							zEngineeringNodeBo: {
+								type: "dismantling_old_pipes",
+								zEngineeringInfoBo: {
+									constructAccordingDrawings: this.isCheck, //是否按图纸施工
+									zEngiineeringPhotoBoList: this.imgArr, //照片集合
+									zEngineeringMaterialBo: [{
+										corrosionLevel: this.LevelValue.dictValue
+									}]
+								}
+							}
+
+						}
+
+
+						addTearOldPipe(param).then(res => {
+							if (res.code == '200') {
+								this.$modal.msg(res.msg)
+								uni.navigateBack();
+							}
+						})
 					}
 				}
 

+ 6 - 6
store/modules/user.js

@@ -47,8 +47,8 @@ const user = {
 	  const type = userInfo.type
       return new Promise((resolve, reject) => {
         login(username, password, code, uuid,type).then(res => {
-          setToken(res.token)
-          commit('SET_TOKEN', res.token)
+          setToken(res.data.token)
+          commit('SET_TOKEN', res.data.token)
           resolve()
         }).catch(error => {
           reject(error)
@@ -60,12 +60,12 @@ const user = {
     GetInfo({ commit, state }) {
       return new Promise((resolve, reject) => {
         getInfo().then(res => {
-          const user = res.user
+          const user = res.data.user
           const avatar = (user == null || user.avatar == "" || user.avatar == null) ? require("@/static/images/profile.jpg") : baseUrl + user.avatar
           const username = (user == null || user.userName == "" || user.userName == null) ? "" : user.userName
-          if (res.roles && res.roles.length > 0) {
-            commit('SET_ROLES', res.roles)
-            commit('SET_PERMISSIONS', res.permissions)
+          if (res.data.roles && res.data.roles.length > 0) {
+            commit('SET_ROLES', res.data.roles)
+            commit('SET_PERMISSIONS', res.data.permissions)
           } else {
             commit('SET_ROLES', ['ROLE_DEFAULT'])
           }

+ 2 - 1
utils/request.js

@@ -35,6 +35,7 @@ const request = config => {
           reject('后端接口连接异常')
           return
         }
+		console.log("dddd",res)
         const code = res.data.code || 200
         const msg = errorCode[code] || res.data.msg || errorCode['default']
         if (code === 401) {
@@ -53,7 +54,7 @@ const request = config => {
           toast(msg)
           reject(code)
         }
-        resolve(res.data.data)
+        resolve(res.data)
       })
       .catch(error => {
         let { message } = error