Browse Source

图片批量上传

renmy 1 year ago
parent
commit
5397dd4a50
5 changed files with 73 additions and 43 deletions
  1. 5 1
      common/http.js
  2. 16 12
      pages/index/orderDetail.vue
  3. 51 29
      pages/index/orderUp.vue
  4. 1 1
      pages/public/login.vue
  5. BIN
      static/index-delete.png

+ 5 - 1
common/http.js

@@ -76,4 +76,8 @@ export function getOrderDealList(params){
 //我的-我的记录
 export function getMyRecord(stationCode){
 	return request.get("/mini/workOrderLog/mine/myRecord?stationCode=" + stationCode)
-}
+}
+//查询设备类型
+export function getDictType(dictType){
+	return request.get("/system/dict/data/type/" + dictType)
+}

+ 16 - 12
pages/index/orderDetail.vue

@@ -363,19 +363,21 @@
 			//图片上传
 			onChooseComplete(lists, name) {
 				const _that = this;
-				uni.uploadFile({
-					url: 'https://tess.fast-fun.cn/zl/mini/file/upload',
-					filePath: lists[0].url,
-					name: 'file',
-					header: {
-						"Authorization": `${uni.getStorageSync("token")}`
-					},
-					success: (res) => {
-						if(res.statusCode == 200) {
+				lists.forEach(item => {
+					uni.uploadFile({
+						// 这里是你上传图片的地址
+						url: 'https://tess.fast-fun.cn/zl/mini/file/upload',
+						filePath: item.url,
+						name: 'file',
+						header: {
+							"Authorization": `${uni.getStorageSync("token")}`
+						},
+							//	这个res是后端返回给你上传成功的数据里边一般会有上传之后图片的在线路径
+						success: (res) => {
 							let data = JSON.parse(res.data)
 							_that.form.img.push(data.msg)
-						}
-					},
+						},
+					})
 				})
 			},
 			//删除视频
@@ -469,6 +471,8 @@
 						} else {
 							_that.$utils.msg(res.msg);
 						}
+					}).catch(error =>{
+						_that.$utils.msg(error);
 					})
 				});
 			},
@@ -790,7 +794,7 @@
 			font-family: PingFang SC-Regular, PingFang SC;
 			font-weight: 400;
 			color: #FFFFFF;
-			background: #9CC1FA;
+			background: #2979ff;
 			width: calc(100% - 64rpx);
 			margin: 0 32rpx;
 			border-radius: 24rpx;

+ 51 - 29
pages/index/orderUp.vue

@@ -46,9 +46,9 @@
 			</u-form>
 		</scroll-view>
 		<u-select :list="siteSelectList" v-model="siteSelectShow" value-name="stationCode" label-name="stationName" @confirm="siteSelectCallback"> </u-select>
-		<u-select :list="levelSelectList" v-model="levelSelectShow" @confirm="levelSelectCallback"> </u-select>
+		<u-select :list="levelSelectList" v-model="levelSelectShow" value-name="dictValue" label-name="dictLabel" @confirm="levelSelectCallback"> </u-select>
 		<u-select :list="personSelectList" v-model="showPerson" value-name="userId" label-name="nickName" @confirm="personSelectCallback"> </u-select>
-		<u-select :list="nameSelectList" v-model="nameSelectShow" @confirm="nameSelectCallback"> </u-select>
+		<u-select :list="nameSelectList" v-model="nameSelectShow" value-name="remark" label-name="dictLabel" @confirm="nameSelectCallback"> </u-select>
 		<u-picker v-model="show" mode="time" :params="params" end-year="2050" :defaultTime="defaultTime" @confirm="timeHandle"></u-picker>
 		<u-button type="primary" class="commit-button" @click="submiHandle" :disabled="isClick">上  报</u-button>
 	</view>
@@ -76,6 +76,7 @@
 					attachment: '',
 					video: null,
 					img: [],
+					device: null,
 				},
 				//时间picker 默认值
 				params: {
@@ -160,7 +161,7 @@
 				//是否显示等级弹窗
 				levelSelectShow: false,
 				//等级列表
-				levelSelectList: [{label: '一级', value: 1},{label: '二级', value: 2},{label: '三级', value: 3}],
+				levelSelectList: [],
 				//是否显示人员选择
 				showPerson: false,
 				//人员列表
@@ -171,19 +172,7 @@
 				//是否显示设备名称弹窗
 				nameSelectShow: false,
 				//设备名称列表
-				nameSelectList: [
-					{label: '机器人', value: 1},
-					{label: '1号充电机', value: 2},
-					{label: '2号充电机', value: 3},
-					{label: '3号充电机', value: 4},
-					{label: '4号充电机', value: 5},
-					{label: '5号充电机', value: 6},
-					{label: '6号充电机', value: 7},
-					{label: '7号充电机', value: 8},
-					{label: '8号充电机', value: 9},
-					{label: '电池', value: 10},
-					{label: '摄像头', value: 11},
-				]
+				nameSelectList: [],
 			}
 		},
 		computed: {
@@ -210,6 +199,8 @@
 		},
 		mounted() {
 			this.getSites();
+			this.getDictTypeData();
+			this.getlevelListData();
 		},
 		methods: {
 			//获取站点列表
@@ -241,6 +232,7 @@
 			nameSelectCallback(e) {
 				uni.hideKeyboard();
 				this.form.deviceName = e[0].label;
+				this.form.device = e[0].value;
 			},
 			//人员选择
 			personSelectCallback(e) {
@@ -261,6 +253,34 @@
 				}
 				this.showPerson = true;
 			},
+			//获取设备名称
+			getDictTypeData() {
+				let _that = this;
+				_that.nameSelectList = [];
+				_that.$http.getDictType('device_name').then(res => {
+					uni.hideLoading();
+					if(res.code == 200) {
+						let list = res.data || [];
+						_that.nameSelectList = list;
+					} else {
+						_that.$utils.msg(res.msg);
+					}
+				})
+			},
+			//获取工单级别
+			getlevelListData() {
+				let _that = this;
+				_that.levelSelectList = [];
+				_that.$http.getDictType('order_level').then(res => {
+					uni.hideLoading();
+					if(res.code == 200) {
+						let list = res.data || [];
+						_that.levelSelectList = list;
+					} else {
+						_that.$utils.msg(res.msg);
+					}
+				})
+			},
 			//获取站点下的人员列表
 			getPersons(code) {
 				let _that = this;
@@ -323,19 +343,21 @@
 			//图片上传
 			onChooseComplete(lists, name) {
 				const _that = this;
-				uni.uploadFile({
-					// 这里是你上传图片的地址
-					url: 'https://tess.fast-fun.cn/zl/mini/file/upload',
-					filePath: lists[0].url,
-					name: 'file',
-					header: {
-						"Authorization": `${uni.getStorageSync("token")}`
-					},
-						//	这个res是后端返回给你上传成功的数据里边一般会有上传之后图片的在线路径
-					success: (res) => {
-						let data = JSON.parse(res.data)
-						_that.form.img.push(data.msg)
-					},
+				lists.forEach(item => {
+					uni.uploadFile({
+						// 这里是你上传图片的地址
+						url: 'https://tess.fast-fun.cn/zl/mini/file/upload',
+						filePath: item.url,
+						name: 'file',
+						header: {
+							"Authorization": `${uni.getStorageSync("token")}`
+						},
+							//	这个res是后端返回给你上传成功的数据里边一般会有上传之后图片的在线路径
+						success: (res) => {
+							let data = JSON.parse(res.data)
+							_that.form.img.push(data.msg)
+						},
+					})
 				})
 			},
 			//视频上传

+ 1 - 1
pages/public/login.vue

@@ -2,7 +2,7 @@
 	<view>
 		<view class="login-wrap">
 			<!-- <view class="logo"><image src="../../static/logo.png"></image></view> -->
-			<view class="wechat-title">微信授权登录</view>
+			<view class="wechat-title">手机号快捷登录</view>
 			<view class="wechat-desc">获得您的公开信息,以便为您提供更好的服务</view>
 			<button class="wechat-login-btn" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">授权手机号码一键登录</button>
 			<view class="agreement-box" style="width: 80%;">

BIN
static/index-delete.png