Ming 3 rokov pred
rodič
commit
fff76e5306

+ 32 - 36
pages/eleControl/controlReport/controlReportAdd/controlReportAdd.vue

@@ -41,7 +41,7 @@
 					<view ref="input" class="input">
 					</view>
 
-					<view class="cu-form-group" style="padding:0">
+					<!-- <view class="cu-form-group" style="padding:0">
 						<view class="grid col-4 grid-square flex-sub">
 							<view class="bg-img" v-for="(item,index) in imgList" :key="index" @tap="ViewImage"
 								:data-url="imgList[index]">
@@ -54,7 +54,7 @@
 								<text class='cuIcon-cameraadd'></text>
 							</view>
 						</view>
-					</view>
+					</view> -->
 				</view>
 			</view>
 
@@ -76,6 +76,7 @@
 				site_id: '',
 				supervision_content: '',
 				msg:'', 
+				img:'',
 
 				titleListData: [],
 				siteListData: [],
@@ -88,37 +89,36 @@
 		},
 		mounted(){
 			// 创建附件上传
-				var _self = this;
-				var input = document.createElement('input');//创建元素
-				input.type = 'file';//添加file类型
-				input.setAttribute("v-model", "msg");
-				// input.onchange = (event) => {
-				// 	_self.upFile(input, event)
-				// }
-				input.onchange = this.inputUpload;
-				this.$refs.input.$el.appendChild(input)
+			var _self = this;
+			var input = document.createElement('input');//创建元素
+			input.type = 'file'//添加file类型
+			input.onchange = (event) => {
+			 _self.upFile(input, event)
+			}
+			this.$refs.input.$el.appendChild(input)
 			
 		},
 		methods: {
-			
-			// 处理文件上传
-			inputUpload(e) {
-			    let file = e.target.files[0];
-			    let formData = new FormData();
-			    formData.append('file', file);
-			    // 请求文件上传接口
-			    // data.upload(formData).then((res) => {
-			    //     console.log(res);
-			    // }).catch(() => {
-			    //     this.$message.error(data.message || '操作失败')
-			    // });
-			    // this.$forceUpdate();
+			upFile(input, event) {
+			 var _self = this;
+			 uni.uploadFile({
+			  url: 'http://124.71.174.104:8081/USKYOF/USKYOF.php/Home/MonitoringReporting/setUpload',
+			  files: [
+			   {
+			    file: input.files[0],
+			    uri: event.srcElement.value
+			   }
+			  ],
+			  success: (uploadFileRes) => {
+			   console.log(uploadFileRes)
+			   this.img='http://121.40.217.77:8080/Device_Manager/upload/card-bg1-active.png'
+			  },
+			  fail: (err) => {
+			   console.log(err)
+			  }
+			 });
 			},
-			
-	
-			
-			
-
+		
 			//新增提交
 			async addSubmit() {
 				if (!this.supervision_title) {
@@ -142,7 +142,7 @@
 					});
 					return
 				}
-				if (!this.imgList.length > 0) {
+				if (!this.img.length > 0) {
 					uni.showToast({
 						title: "请上传图片",
 						icon: "none"
@@ -161,8 +161,8 @@
 					"supervision_title": this.supervision_title,
 					"site_id": this.site_id,
 					"supervision_content": this.supervision_content,
-					"img":this.imgList[0]
-					// "img":this.msg
+					// "img":this.imgList[0]
+					"img":this.img
 				})
 
 				if (!res.data.flag) {
@@ -189,9 +189,6 @@
 				})
 			},
 
-
-			
-
 			//站带下拉数据请求
 			async getSiteList(params = {}) {
 				const res = await this.$myRequest({
@@ -202,7 +199,6 @@
 				this.siteListData = res.data.data
 			},
 
-
 			ChooseImage() {
 				uni.chooseImage({
 					count: 4, //默认9

+ 3 - 2
pages/eleControl/powerCut/powerCutAdd/powerCutAdd.vue

@@ -115,10 +115,11 @@
 </template>
 
 <script>
-	import calendar from '../calendar/calendar.vue';
+	// import calendar from '../calendar/calendar.vue';
 	export default {
 		components: {
-		        calendar },
+		        // calendar 
+				},
 
 		data() {
 			return {

+ 2 - 0
pages/test/test.vue

@@ -3,6 +3,8 @@
   <view ref="input" class="input">
    附件上传
   </view>
+  
+  
  </view>
 </template>