| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560 |
- <!--
- * @Title:
- * @Description: 维修任务填报提交页
- * @Author: swp
- * @Date: 2022-08-24 10:49:21
- * @LastEditors:
- * @LastEditTime: 2022-08-24 10:49:21
- -->
- <template>
- <view class="container">
- <uni-nav-bar dark :fixed="true" backgroundColor="#3F9EFF" statusBar="false" left-icon="left" left-text="返回"
- @clickLeft="toBack">
- <view style="width: 100%;display: flex;flex-direction: row;justify-content: center;align-items: center;">
- <text style="color: white;font-size: 1rem;">{{title}}</text>
- </view>
- </uni-nav-bar>
- <uni-forms ref="baseForm" :model="formData">
- <uni-section :title="failureCheckTitle" ftitleFontSize="0.8rem" type="circle">
- <!-- <template v-slot:decoration>
- <view class="decoration"></view>
- </template> -->
- <view style="padding-top: 10px;padding-bottom: 0px;padding-left: 15px;padding-right: 15px;">
- <uni-forms-item name='networkPayer' required>
- <uni-easyinput :styles="styles" type="textarea" v-model="formData.failureCheckDesc"
- :placeholder="failureCheckPlaceholder" />
- </uni-forms-item>
- </view>
- </uni-section>
- <uni-section title="解决措施说明" ftitleFontSize="0.8rem" type="circle">
- <!-- <template v-slot:decoration>
- <view class="decoration"></view>
- </template> -->
- <view style="padding-top: 10px;padding-bottom: 10px;padding-left: 15px;padding-right: 15px;">
- <uni-forms-item required>
- <uni-easyinput type="textarea" v-model="formData.processDesc" placeholder="请录入解决方案说明" />
- </uni-forms-item>
- <uni-card title="拍摄照片" extra="点击下方按钮开始拍摄" :is-shadow="false">
- <view class="view-flex-rs-flex-wrap">
- <view v-for="(item, index) in failureProcessPhotos" :key="index" class="view-flex-cc"
- style="width: 80px;">
- <view class="img-container">
- <view class="note-image-box">
- <view class="note-image-item">
- <view class="close-icon" @click="onPhotoDel(index)">
- <uni-icons type="closeempty" size="18" color="#fff"></uni-icons>
- </view>
- <view class="image-box">
- <image :src="toOss(item)" mode="widthFix">
- </image>
- </view>
- </view>
- </view>
- </view>
- </view>
- <view class="view-flex-cc" style="width: 80px;">
- <view class="img-container">
- <view class="note-image-box">
- <view class="note-image-item" @click="onCheckPhotoAdd()">
- <view class="image-box">
- <uni-icons type="plusempty" size="50" color="#eee"></uni-icons>
- </view>
- </view>
- </view>
- </view>
- </view>
- </view>
- </uni-card>
- </view>
- </uni-section>
- <uni-section v-if="orderType ==1" title="费用申报" ftitleFontSize="0.8rem" type="circle">
- <!-- <template v-slot:decoration>
- <view class="decoration"></view>
- </template> -->
- <view style="padding-top: 10px;padding-bottom: 10px;padding-left: 15px;padding-right: 15px;">
- <uni-forms-item label="是否产生费用" label-width="130px" required>
- <uni-data-checkbox v-model="formData.costsReport"
- :localdata="costsReportItems.items"></uni-data-checkbox>
- </uni-forms-item>
- <uni-forms-item v-if="formData.costsReport==2">
- <uni-easyinput type="textarea" v-model="formData.costsReportDesc" placeholder="请录入费用说明" />
- </uni-forms-item>
- </view>
- </uni-section>
- </uni-forms>
- <view class="footer">
- <view class="control">
- <view class="view-flex-rc">
- <view class="block"
- style="width: 160px;height:32px;margin-left: 10px;margin-right: 10px;border-radius:7px;background-color:lightsalmon"
- @click="toSubmit()">
- <view class="view-flex-cc">
- <uni-icons class="input-uni-icon" type="checkmarkempty" size="18" color="#999" />
- </view>
- <view class="view-flex-cc" style="padding-left:5px;">
- <text style="color:black;font-size:0.7rem">立即提交</text>
- </view>
- </view>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- import http from '@/http/api.js';
- import {
- pathToBase64,
- base64ToPath
- } from '@/js_sdk/mmmm-image-tools/index.js';
- import {
- oss,
- devUrl,
- prodUrl
- } from '@/common/setting';
- export default {
- components: {},
- data() {
- return {
- styles: {
- color: '#333',
- borderColor: '#e5e5e5',
- disableColor: '#FFFFFF'
- },
- rules: {
- failureCheckDesc: {
- rules: [{
- required: true,
- errorMessage: '必填项',
- }]
- },
- failureSolutionDesc: {
- rules: [{
- required: true,
- errorMessage: '必填项',
- }, ]
- },
- },
- skipPage: 1,
- costsApprove: 0,
- orderId: 0,
- orderType: 1,
- formData: {
- failureCheckDesc: '',
- processDesc: '',
- costsReport: 1,
- costsReportDesc: '',
- },
- failureProcessPhotos: [],
- pattern: {
- color: '#7A7E83',
- backgroundColor: '#fff',
- selectedColor: '#007AFF',
- buttonColor: '#007AFF',
- iconColor: '#fff'
- },
- baseURL: '',
- baseOSS: '',
- costsReportItems: {
- items: [{
- 'value': 1,
- 'text': '否'
- }, {
- 'value': 2,
- 'text': '是'
- }],
- current: 1,
- },
- title: '工单处理填报',
- desc: '',
- failureCheckTitle: '',
- failureCheckPlaceholder: '',
- }
- },
- computed: {},
- onLoad(options) {
- this.skipPage = options.skipPage;
- this.costsApprove = options.costsApprove;
- this.orderProcessId = options.orderProcessId;
- this.orderId = options.orderId;
- this.orderType = options.orderType;
- console.log("order type "+this.orderType);
- if (this.orderType == 1) {
- this.failureCheckTitle = '故障问题描述';
- this.failureCheckPlaceholder = '请录入故障问题现象';
- } else if (this.orderType == 2) {
- this.failureCheckTitle = '服务内容描述';
- this.failureCheckPlaceholder = '请录入服务内容';
- }
- this.baseURL = process.env.NODE_ENV === 'development' ? devUrl : prodUrl;
- this.baseOSS = oss;
- if (this.costsApprove == '2') {
- this.getDetail();
- }
- },
- onReady() {
- console.log("onReady++++++++++++++")
- // 需要在onReady中设置规则
- this.$refs.baseForm.setRules(this.rules)
- },
- onShow() {},
- methods: {
- toOss(path) {
- let url = this.baseOSS + path;
- //console.log("tooss " + url)
- return url;
- },
- toBack() {
- uni.navigateBack({
- delta: Number(this.skipPage)
- })
- },
- getDetail() {
- let that = this;
- let postData = {};
- postData['orderId'] = this.orderId;
- http.request({
- url: '/galaxy-business/order/process/last/report',
- method: 'GET',
- data: postData
- }).then(res => {
- if (res.data != null) {
- console.log(JSON.stringify(res.data))
- that.formData.processDesc = res.data.processDesc;
- that.formData.failureCheckDesc = res.data.failureCheckDesc;
- if (res.data.failureProcessPhotoList != null) {
- that.failureProcessPhotos = res.data.failureProcessPhotoList;
- }
- }
- }).catch(err => {
- console.log(err)
- })
- },
- onCheckPhotoAdd() {
- let that = this;
- uni.chooseImage({
- sourceType: ['album ','camera'],
- sizeType: ['compressed'],
- success: (res) => {
- const len = res.tempFilePaths.length;
- if (len === 1) {
- res.tempFilePaths.forEach(path => {
- that.uploadPhoto(path);
- })
- } else {
- uni.showModal({
- content: '只能选择一张图片,请确认!',
- showCancel: false
- });
- }
- }
- })
- },
- uploadPhoto(imagePath) {
- let that = this;
- uni.showLoading({
- title: '上传中'
- });
- uni.uploadFile({
- url: this.baseURL + '/galaxy-resource/oss/endpoint/put-file-attach?Blade-Auth=' +
- uni.getStorageSync('accessToken'),
- fileType: 'image',
- filePath: imagePath,
- name: 'file',
- success: (uploadFileRes) => {
- if (uploadFileRes.statusCode == 200) {
- let data = JSON.parse(uploadFileRes.data);
- if (data.success) {
- let path = data.data['name'];
- that.failureProcessPhotos.push(path);
- }
- }
- },
- fail: (err) => {
- console.log(err);
- reject('err')
- },
- complete() {
- uni.hideLoading()
- }
- });
- },
- onPhotoDel(index) {
- this.failureProcessPhotos.splice(index, 1);
- },
- toSubmit() {
- console.log('表单提交');
- let that = this;
- this.$refs.baseForm.validate().then(res => {
- that.submitData();
- }).catch(err => {
- console.log('表单错误信息:', err);
- uni.showModal({
- content: "内容填报错误,请根据提示信息检查录入内容!",
- showCancel: false,
- success(res) {
- if (res.confirm) {
- //that.$refs.baseForm.clearValidate();
- }
- }
- });
- })
- },
- submitData() {
- let formdata = this.formData;
- formdata['orderId'] = this.orderId;
- if (this.failureProcessPhotos.length > 0) {
- let photos = '';
- for (let i = 0; i < this.failureProcessPhotos.length; i++) {
- if (photos.length > 0) {
- photos = photos + ',';
- }
- photos = photos + this.failureProcessPhotos[i];
- }
- formdata['failureProcessPhotos'] = photos;
- }
- let that = this;
- http.request({
- url: '/galaxy-business/order/process/save',
- method: 'POST',
- data: formdata
- }).then(res => {
- if (res.success) {
- uni.showModal({
- content: '已成功提交',
- showCancel: false,
- success(res) {
- if (res.confirm) {
- that.toBack();
- }
- }
- });
- } else {
- uni.showModal({
- content: '' + res.msg,
- showCancel: false
- });
- }
- }).catch(err => {
- console.log(err)
- })
- },
- formReset: function(e) {
- console.log('清空数据')
- },
- }
- }
- </script>
- <style>
- /* page {
- background-color: rgb(240, 242, 244);
- } */
- </style>
- <style lang="scss" scoped>
- .cell-hover-class {
- background-color: rgb(235, 237, 238);
- }
- .view-flex-rs {
- display: flex;
- flex-direction: row;
- justify-content: flex-start;
- align-items: center;
- }
- .view-flex-rc {
- display: flex;
- flex-direction: row;
- justify-content: center;
- align-items: center;
- }
- .view-flex-re {
- display: flex;
- flex-direction: row;
- justify-content: flex-end;
- align-items: center;
- }
- .view-flex-cs {
- display: flex;
- flex-direction: column;
- justify-content: flex-start;
- }
- .view-flex-cc {
- display: flex;
- flex-direction: column;
- justify-content: center;
- }
- .view-flex-ce {
- display: flex;
- flex-direction: column;
- justify-content: flex-end;
- }
- .line-body {
- padding-left: 10px;
- padding-right: 10px;
- }
- .required-star {
- color: #FF0000;
- font-size: 15px;
- width: 20px;
- text-align: center;
- padding-left: 0px;
- padding-right: 2px;
- }
- .item-title {
- color: #909399;
- font-size: 15px;
- }
- .mline-text {
- padding-left: 2px;
- width: 100%;
- /* background-color:#909399; */
- height: 70px;
- border: 1px solid #FF5A5F;
- border-radius: 5px;
- }
- .footer {
- position: fixed;
- bottom: 0;
- left: 0;
- right: 0;
- z-index: 1;
- height: 100rpx;
- padding: 20rpx;
- box-sizing: border-box;
- display: flex;
- align-items: center;
- justify-content: flex-end;
- background-color: whitesmoke;
- .ipt {
- width: 380rpx;
- height: 77rpx;
- background: #f7f7f7;
- border-radius: 38px;
- padding: 0 37rpx;
- box-sizing: border-box;
- margin-right: 20rpx;
- }
- .control {
- flex: 1;
- display: flex;
- align-items: center;
- justify-content: flex-end;
- .block {
- display: flex;
- align-items: center;
- justify-content: center;
- flex: 1;
- }
- .icon {
- height: auto;
- }
- .c {
- width: 41rpx;
- margin-right: 10rpx;
- }
- .s {
- width: 36rpx;
- }
- .t {
- width: 31rpx;
- }
- }
- }
- .container {
- padding: 0 0 100rpx;
- }
- .img-container {
- margin-bottom: 0px;
- width: 80px;
- height: 80px;
- .note-image-box {
- margin-top: 5px;
- display: flex;
- flex-wrap: wrap;
- padding: 0px;
- .note-image-item {
- position: relative;
- width: 100%;
- height: 0;
- padding-top: 100%;
- box-sizing: border-box;
- // background-color: #18B566;
- .close-icon {
- display: flex;
- justify-content: center;
- align-items: center;
- position: absolute;
- right: 0px;
- top: 0px;
- width: 22px;
- height: 22px;
- border-radius: 50%;
- background-color: #d5d5d5;
- z-index: 2;
- }
- .image-box {
- display: flex;
- justify-content: center;
- align-items: center;
- position: absolute;
- top: 0px;
- right: 0px;
- border: 0px;
- left: 0px;
- border: 1px #eee solid;
- border-radius: 5px;
- overflow: hidden;
- width: 98%;
- height: 98%;
- }
- }
- }
- }
- .input-body {
- background-color: #fff;
- padding: 10px;
- }
- .mb-10 {
- margin-top: 0px;
- margin-bottom: 0px;
- }
- .decoration {
- width: 6px;
- height: 6px;
- margin-right: 4px;
- border-radius: 50%;
- background-color: cadetblue;
- }
- </style>
|