Browse Source

计划审批表单

master
巴林闲侠 2 years ago
parent
commit
08221ec7db
  1. 110
      weapp/package/troubleshooting/shootingForm/index.js
  2. 68
      weapp/package/troubleshooting/shootingForm/index.wxml

110
weapp/package/troubleshooting/shootingForm/index.js

@ -12,6 +12,8 @@ Page({
planStartTime: '', planStartTime: '',
planEndTimePopupShow: false, planEndTimePopupShow: false,
planEndTime: '', planEndTime: '',
planApproval: '',
repair: '',
}, },
/** /**
@ -58,6 +60,114 @@ Page({
this.setData({ planEndTime: event.detail, }) this.setData({ planEndTime: event.detail, })
}, },
// 上传图片
chooseImg: function (e) { // 这里是选取图片的方法
const that = this;
let pics = [];
// const detailPics = that.data.inspectContent[e.currentTarget.dataset.item].imgs;
// if (detailPics.length >= 20) {
// wx.showToast({
// title: '最多选择20张图片上传',
// icon: 'none'
// });
// return;
// }
// wx.chooseMedia({
// count: 20, // 基础库2.25.0前,最多可支持9个文件,2.25.0及以后最多可支持20个文件
// mediaType: ['image'], // 文件类型
// sizeType: ['original', 'compressed'], // original 原图,compressed 压缩图,默认二者都有
// sourceType: ['album', 'camera'], // album 从相册选图,camera 使用相机,默认二者都有
// success: function (res) {
// const imgs = res.tempFiles;
// for (let i = 0; i < imgs.length; i++) {
// if (res.tempFiles[i].size > 15728640) {
// wx.showToast({ title: '图片大于15M,不可上传', icon: 'none' });
// return;
// }
// const fileNameArr = res.tempFiles[i].tempFilePath.split('.');
// const extension = res.tempFiles[i].tempFilePath.split('.')[fileNameArr.length - 1];
// if (extension !== 'jpg' && extension !== 'png' && extension !== 'jpeg') {
// wx.showToast({ title: '只能上传jpg、jpeg、png格式的图片', icon: 'none' });
// return;
// }
// pics.push(imgs[i].tempFilePath)
// }
// that.uploadimg({
// url: getApp().globalData.webUrl + '_upload/attachments/project', // 图片上传的接口
// path: pics, // 选取的图片的地址数组
// }, e.currentTarget.dataset.item);
// },
// })
},
//多张图片上传
uploadimg: function (data, itemName) {
// wx.showLoading({
// title: '上传中...',
// mask: true,
// })
// let that = this,
// i = data.i ? data.i : 0,
// success = data.success ? data.success : 0,
// fail = data.fail ? data.fail : 0;
// let imgs = that.data.inspectContent[itemName].imgs;
// wx.uploadFile({
// url: data.url,
// filePath: data.path[i],
// name: 'file',
// success: (resp) => {
// wx.hideLoading();
// success++;
// let str = JSON.parse(resp.data) // 返回的结果,可能不同项目结果不一样
// str = str.uploaded
// console.log(str);
// if (imgs.length >= 20) {
// const inspectContent = that.data.inspectContent;
// inspectContent[itemName].imgs = imgs;
// that.setData({
// inspectContent,
// });
// return false;
// } else {
// imgs.push(str);
// const inspectContent = that.data.inspectContent;
// inspectContent[itemName].imgs = imgs;
// that.setData({
// inspectContent,
// })
// }
// },
// fail: (res) => {
// fail++;
// console.log('fail:' + i + "fail:" + fail);
// },
// complete: () => {
// i++;
// if (i == data.path.length) { // 当图片传完时,停止调用
// console.log('执行完毕');
// console.log('成功:' + success + " 失败:" + fail);
// } else { // 若图片还没有传完,则继续调用函数
// data.i = i;
// data.success = success;
// data.fail = fail;
// that.uploadimg(data, itemName); // 递归,回调自己
// }
// }
// });
},
// 删除图片
deleteImg: function (e) {
// let imgs = this.data.inspectContent[e.currentTarget.dataset.item].imgs;
// const index = e.currentTarget.dataset.index;
// imgs.splice(index, 1);
// const inspectContent = this.data.inspectContent;
// inspectContent[e.currentTarget.dataset.item].imgs = imgs;
// this.setData({
// inspectContent
// });
},
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
*/ */

68
weapp/package/troubleshooting/shootingForm/index.wxml

@ -77,8 +77,76 @@
<view class="mission-card-title mission-center-card-title"> <view class="mission-card-title mission-center-card-title">
<span>维修计划审批</span> <span>维修计划审批</span>
</view> </view>
<van-field value="{{ planApproval }}" label="审批意见" type="textarea" placeholder="请输入" autosize border="{{ true }}" />
<van-field value="输入框已禁用" label="审批人" readonly border="{{ false }}" />
<van-field value="输入框已禁用" label="审批日期" readonly border="{{ false }}" />
<view class="mission-card-title mission-center-card-title">
<span>维修处理</span>
</view>
<van-field value="{{ repair }}" label="维修情况描述" type="textarea" placeholder="请输入" autosize border="{{ true }}" />
<van-cell border="{{false}}">
<view style="display:flex">
<view class="fs-cell-title" style="">完工图片</view>
<view class="fs-cell-content" style="">
<view class="" style="overflow-y:scroll;">
<view class="" style="overflow:hidden;">
<!-- <view class='pic' wx:for="{{inspectContent[item.name].imgs}}" wx:for-item="img" wx:key="*this">
<image class='weui-uploader__img showImg' src="{{imgUrl + img}}" data-index="{{index}}" data-item="{{item.name}}" mode="aspectFill" bindtap="previewImg">
<icon type='cancel' class="delete-btn" data-index="{{index}}" data-item="{{item.name}}" catchtap="deleteImg"></icon>
</image>
</view> -->
<!-- 用来提示用户上传图片 -->
<view class="" data-item="{{'item.name'}}" bindtap="chooseImg">
<image style="height:64px;width:64px" class="upload" src="/images/upload.png" />
</view>
</view>
</view>
</view>
</view>
</van-cell>
<view class="mission-card-title mission-center-card-title">
<span>质检验收</span>
</view>
<van-field value="输入框已禁用" label="验收人" readonly border="{{ false }}" />
<van-cell border="{{false}}">
<view style="display:flex">
<view class="fs-cell-title" style="">现场图片</view>
<view class="fs-cell-content" style="">
<view class="" style="overflow-y:scroll;">
<view class="" style="overflow:hidden;">
<!-- <view class='pic' wx:for="{{inspectContent[item.name].imgs}}" wx:for-item="img" wx:key="*this">
<image class='weui-uploader__img showImg' src="{{imgUrl + img}}" data-index="{{index}}" data-item="{{item.name}}" mode="aspectFill" bindtap="previewImg">
<icon type='cancel' class="delete-btn" data-index="{{index}}" data-item="{{item.name}}" catchtap="deleteImg"></icon>
</image>
</view> -->
<!-- 用来提示用户上传图片 -->
<view class="" data-item="{{'item.name'}}" bindtap="chooseImg">
<image style="height:64px;width:64px" class="upload" src="/images/upload.png" />
</view>
</view>
</view>
</view>
</view>
</van-cell>
<van-field value="{{ repair }}" label="验收意见" type="textarea" placeholder="请输入" autosize border="{{ true }}" />
</van-cell-group> </van-cell-group>
<view style="margin:24px 16px"> <view style="margin:24px 16px">
<van-button type="info" block style="">提交</van-button> <van-button type="info" block style="">提交</van-button>
<view style="display:flex; justify-content:space-between">
<van-button type="info" custom-style="width:calc((100vw - 32px - 24px) / 2)">
同意
</van-button>
<van-button type="warning" custom-style="width:calc((100vw - 32px - 24px) / 2)">
驳回
</van-button>
</view>
<view style="display:flex; justify-content:space-between">
<van-button type="info" custom-style="width:calc((100vw - 32px - 24px) / 2)">
验收通过
</van-button>
<van-button type="warning" custom-style="width:calc((100vw - 32px - 24px) / 2)">
验收不通过
</van-button>
</view>
</view> </view>
</view> </view>
Loading…
Cancel
Save