|
@@ -1,124 +1,159 @@
|
|
-<template>
|
|
|
|
- <view>
|
|
|
|
-
|
|
|
|
- <form action="" >
|
|
|
|
- <view style='height:30rpx'></view>
|
|
|
|
-
|
|
|
|
- <view class="form-item">
|
|
|
|
- <view class="title">
|
|
|
|
- <text class="necessary">*</text>
|
|
|
|
- 报修地址:
|
|
|
|
- </view>
|
|
|
|
- <input type="text">
|
|
|
|
- </view>
|
|
|
|
-
|
|
|
|
- <view class="form-item margin-top">
|
|
|
|
- <view class="title">
|
|
|
|
- <text class="necessary">*</text>
|
|
|
|
- 故障状态:
|
|
|
|
- </view>
|
|
|
|
- <view>故障</view>
|
|
|
|
-
|
|
|
|
- </view>
|
|
|
|
-
|
|
|
|
- <view class="form-item margin-top">
|
|
|
|
- <view class="title">
|
|
|
|
- <text class="necessary">*</text>
|
|
|
|
- 上传图片:
|
|
|
|
- </view>
|
|
|
|
-
|
|
|
|
- <view style="width:500rpx">
|
|
|
|
- <view class="cu-form-group">
|
|
|
|
- <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]">
|
|
|
|
- <image :src="imgList[index]" mode="aspectFill"></image>
|
|
|
|
- <view class="cu-tag bg-red" @tap.stop="DelImg" :data-index="index">
|
|
|
|
- <text class='cuIcon-close'></text>
|
|
|
|
- </view>
|
|
|
|
- </view>
|
|
|
|
- <view class="solids" @tap="ChooseImage" v-if="imgList.length<4">
|
|
|
|
- <text class='cuIcon-cameraadd'></text>
|
|
|
|
- </view>
|
|
|
|
- </view>
|
|
|
|
- </view>
|
|
|
|
- </view>
|
|
|
|
- </view>
|
|
|
|
-
|
|
|
|
- <view class="form-item margin-top">
|
|
|
|
- <view class="title">
|
|
|
|
- <text class="necessary">*</text>
|
|
|
|
- 报修描述:
|
|
|
|
- </view>
|
|
|
|
- <textarea maxlength="-1" @input="textareaAInput" placeholder="" width="250"></textarea>
|
|
|
|
- </view>
|
|
|
|
-
|
|
|
|
- <view class="btn-area submitBottomBtn padding-lr-sm">
|
|
|
|
- <button class="bg-blue round margin-top" @click="addSubmit">提 交 </button>
|
|
|
|
- </view>
|
|
|
|
-
|
|
|
|
- </form>
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- </view>
|
|
|
|
-</template>
|
|
|
|
-
|
|
|
|
-<script>
|
|
|
|
- export default {
|
|
|
|
- data() {
|
|
|
|
- return {
|
|
|
|
-
|
|
|
|
- imgList: [],
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- methods: {
|
|
|
|
- radioChange(e) {
|
|
|
|
- console.log('type:' + e.detail.value);
|
|
|
|
- this.radioOne = e.detail.value;
|
|
|
|
- },
|
|
|
|
-
|
|
|
|
- ChooseImage() {
|
|
|
|
- uni.chooseImage({
|
|
|
|
- count: 4, //默认9
|
|
|
|
- sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
|
|
|
|
- sourceType: ['album'], //从相册选择
|
|
|
|
- success: (res) => {
|
|
|
|
- if (this.imgList.length != 0) {
|
|
|
|
- this.imgList = this.imgList.concat(res.tempFilePaths)
|
|
|
|
- } else {
|
|
|
|
- this.imgList = res.tempFilePaths
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- },
|
|
|
|
-
|
|
|
|
- ViewImage(e) {
|
|
|
|
- uni.previewImage({
|
|
|
|
- urls: this.imgList,
|
|
|
|
- current: e.currentTarget.dataset.url
|
|
|
|
- });
|
|
|
|
- },
|
|
|
|
- DelImg(e) {
|
|
|
|
- uni.showModal({
|
|
|
|
- title: '删除',
|
|
|
|
- content: '确定要删除此图片吗?',
|
|
|
|
- cancelText: '取消',
|
|
|
|
- confirmText: '确定',
|
|
|
|
- success: res => {
|
|
|
|
- if (res.confirm) {
|
|
|
|
- this.imgList.splice(e.currentTarget.dataset.index, 1)
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- },
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-</script>
|
|
|
|
-
|
|
|
|
-<style lang="scss">
|
|
|
|
-
|
|
|
|
|
|
+<template>
|
|
|
|
+ <view>
|
|
|
|
+ <form action="">
|
|
|
|
+ <view style='height:30rpx'></view>
|
|
|
|
+ <view class="form-item">
|
|
|
|
+ <view class="title">
|
|
|
|
+ <text class="necessary">*</text>
|
|
|
|
+ 报修地址:
|
|
|
|
+ </view>
|
|
|
|
+ <input type="text" v-model="this.getData.address">
|
|
|
|
+ </view>
|
|
|
|
+ <view class="form-item margin-top">
|
|
|
|
+ <view class="title">
|
|
|
|
+ <text class="necessary">*</text>
|
|
|
|
+ 故障状态:
|
|
|
|
+ </view>
|
|
|
|
+ <view>{{this.getData.type_name}}</view>
|
|
|
|
+ </view>
|
|
|
|
+ <view class="form-item margin-top">
|
|
|
|
+ <view class="title">
|
|
|
|
+ <text class="necessary">*</text>
|
|
|
|
+ 上传图片:
|
|
|
|
+ </view>
|
|
|
|
+ <view style="width:500rpx">
|
|
|
|
+ <view ref="input" class="input">
|
|
|
|
+ </view>
|
|
|
|
+ </view>
|
|
|
|
+ </view>
|
|
|
|
+ <view class="form-item margin-top">
|
|
|
|
+ <view class="title">
|
|
|
|
+ <text class="necessary">*</text>
|
|
|
|
+ 报修描述:
|
|
|
|
+ </view>
|
|
|
|
+ <textarea maxlength="-1" @input="textareaAInput" placeholder="" v-model="msg" width="250"></textarea>
|
|
|
|
+ </view>
|
|
|
|
+
|
|
|
|
+ <view class="btn-area submitBottomBtn padding-lr-sm">
|
|
|
|
+ <button class="bg-blue round margin-top" @click="addSubmit">提 交 </button>
|
|
|
|
+ </view>
|
|
|
|
+ </form>
|
|
|
|
+ </view>
|
|
|
|
+</template>
|
|
|
|
+
|
|
|
|
+<script>
|
|
|
|
+ export default {
|
|
|
|
+ data() {
|
|
|
|
+ return {
|
|
|
|
+ getData:{},
|
|
|
|
+
|
|
|
|
+ msg: '',
|
|
|
|
+ id: '',
|
|
|
|
+ reportName: '',
|
|
|
|
+ radioOne: 0,
|
|
|
|
+ zb_id: 0
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ onLoad: function(option) {
|
|
|
|
+ this.id = option.id;
|
|
|
|
+ this.zb_id = option.zb_id,
|
|
|
|
+ this.getRepairDetail({'company_code':uni.getStorageSync('selectedCode'),"id":option.id})
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ mounted() {
|
|
|
|
+ // 创建附件上传
|
|
|
|
+ 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: {
|
|
|
|
+ radioChange(e) {
|
|
|
|
+ console.log('type:' + e.detail.value);
|
|
|
|
+ this.radioOne = e.detail.value;
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ upFile(input, event) {
|
|
|
|
+ var _self = this;
|
|
|
|
+ uni.uploadFile({
|
|
|
|
+ url: 'https://qhome.usky.cn/USKYZHAF/USKYZHAF.php/Home/Inspection/setUpload',
|
|
|
|
+ files: [{
|
|
|
|
+ file: input.files[0],
|
|
|
|
+ uri: event.srcElement.value
|
|
|
|
+ }],
|
|
|
|
+ success: (uploadFileRes) => {
|
|
|
|
+ var data = JSON.parse(uploadFileRes.data)
|
|
|
|
+ this.img = data.img_url;
|
|
|
|
+ console.log(this.img)
|
|
|
|
+ },
|
|
|
|
+ fail: (err) => {
|
|
|
|
+ console.log(err)
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ //回显请求
|
|
|
|
+ async getRepairDetail(params = {}) {
|
|
|
|
+ const res = await this.$myRequest({
|
|
|
|
+ url: 'Repair/getFormData',
|
|
|
|
+ data:params,
|
|
|
|
+ showLoading: true
|
|
|
|
+ })
|
|
|
|
+ this.getData=res.data.data[0];
|
|
|
|
+
|
|
|
|
+ console.log(this.getData)
|
|
|
|
+ },
|
|
|
|
|
|
-
|
|
|
|
-</style>
|
|
|
|
|
|
+ addSubmit() {
|
|
|
|
+ if (!this.img) {
|
|
|
|
+ uni.showToast({
|
|
|
|
+ title: "请上传图片",
|
|
|
|
+ icon: "none"
|
|
|
|
+ });
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ if (!this.msg) {
|
|
|
|
+ uni.showToast({
|
|
|
|
+ title: "请输入报修描述",
|
|
|
|
+ icon: "none"
|
|
|
|
+ });
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ this.powerSubmitRes({
|
|
|
|
+ "id": this.id,
|
|
|
|
+ "img": this.img,
|
|
|
|
+ "remarks": this.msg,
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ async powerSubmitRes(params = {}) {
|
|
|
|
+ const res = await this.$myRequest({
|
|
|
|
+ url: 'Repair/setRepair',
|
|
|
|
+ data: params
|
|
|
|
+ })
|
|
|
|
+ if (res.data.flag) {
|
|
|
|
+ uni.showToast({
|
|
|
|
+ title: "提交成功",
|
|
|
|
+ });
|
|
|
|
+ setTimeout(() => {
|
|
|
|
+ uni.navigateTo({
|
|
|
|
+ url: '/pages/repair/repair',
|
|
|
|
+ });
|
|
|
|
+ }, 1000);
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ textareaAInput(e) {
|
|
|
|
+ this.textareaAValue = e.detail.value
|
|
|
|
+ },
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+</script>
|
|
|
|
|