diff --git a/pages-order/addOrder/addOrder.vue b/pages-order/addOrder/addOrder.vue index 13d1345..c25418a 100644 --- a/pages-order/addOrder/addOrder.vue +++ b/pages-order/addOrder/addOrder.vue @@ -162,9 +162,18 @@ + + + + + + + + + - 创建工单 + 创建工单 @@ -178,6 +187,7 @@ import request from "@/utils/request"; import {getToken, setUserInfo, getUserInfo} from '@/utils/auth.js' import config from "@/config"; import {formatTimestamp, formatTimestampCustom} from "@/utils/utils"; +import upload from "@/utils/upload"; export default { components: { @@ -186,6 +196,9 @@ export default { }, data() { return { + //上传的图片数组 + fileList: [], + sizeType:['compressed'], phone: '', carList: [], activeCarIndex: 0, @@ -226,13 +239,41 @@ export default { } }, methods: { + + afterRead(file) { + for (let i = 0; i < file.tempFilePaths.length; i++) { + upload({ + url:'/admin-api/infra/file/upload', + filePath: file.tempFilePaths[i] + }).then((res)=>{ + this.fileList.push({ + url: config.baseImageUrl+res.data + }) + console.log(this.fileList) + }) + } + }, + + deleteFile(file, index) { + this.fileList.splice(index, 1); + }, + + saveWorkingItem(){ + console.log(this.fileList,145) + }, + + + createUniqueCodeByHead(head = '') { const min = 100; // 最小值 const max = 999; // 最大值 return head.toString() + Date.now().toString() + Math.floor(Math.random() * (max - min + 1)) + min; }, - //新增工单 - submit() { + + /** + * 创建工单前上传图片 + */ + submitUpload(){ if (this.userInfo === null || this.carList.length === 0 || this.selectedProj.length === 0) { uni.showToast({ title: '请完善信息', @@ -240,6 +281,12 @@ export default { }) return } + this.$refs.popup.open("bottom"); + }, + + //新增工单 + submit() { + let fileStr = this.fileList.map(item=>item.url.replace(config.baseImageUrl,"")).join(",") const data = { userId: this.userInfo.id, ticketNo: this.ticketNo, @@ -254,7 +301,8 @@ export default { adviserId: getUserInfo().id, adviserName: getUserInfo().nickname, ticketType: this.ticketType, - itemList: this.formatItem(this.selectedProj) + itemList: this.formatItem(this.selectedProj), + fileStr:fileStr } uni.navigateTo({ // url: '/pages-repair/signature/signature?data=' + JSON.stringify(data) @@ -428,6 +476,14 @@ export default {