diff --git a/.env.development b/.env.development index e69c543..8c4711a 100644 --- a/.env.development +++ b/.env.development @@ -1,5 +1,5 @@ -VITE_BASE_URL=http://localhost:12080/admin-api +VITE_BASE_URL=http://192.168.0.229:12081/admin-api #VITE_BASE_URL=http://dev.ccwin-in.com:25202/api/admin-api -VITE_BASE_URL_IMAGE=http://192.168.0.106:12080/admin-api +VITE_BASE_URL_IMAGE=http://192.168.0.229:12081/admin-api diff --git a/src/api/spareParts.ts b/src/api/spareParts.ts index 66f8cc2..25b130a 100644 --- a/src/api/spareParts.ts +++ b/src/api/spareParts.ts @@ -14,4 +14,8 @@ export function getApplySparePartsList() { // 新增备件维修获取备件列表 export function getServiceSparePartsList() { return http.get('/eam/item/getItemMaintainList') +} +// 备件当前库存情况 +export function getApplyItemByNumber(number) { + return http.get(`/eam/item/getApplyItemByNumber?number=`+number) } \ No newline at end of file diff --git a/src/api/upload.ts b/src/api/upload.ts index b56ba91..c6305fd 100644 --- a/src/api/upload.ts +++ b/src/api/upload.ts @@ -1,4 +1,5 @@ import upload from '@/api/uploadHttp' +import http from './http' // import request from '@/utils/request' // 上传 export function uploadFile(data) { @@ -8,4 +9,13 @@ export function uploadFile(data) { filePath:data.filePath, name: data.name }) -} \ No newline at end of file +} + + + + + + +export function uploadCommit(fileInfo) { + return http.post('/eam/attachment-file/upload',fileInfo) +} diff --git a/src/pages/overhaulOrder/addForm.vue b/src/pages/overhaulOrder/addForm.vue index 4812096..0aaefef 100644 --- a/src/pages/overhaulOrder/addForm.vue +++ b/src/pages/overhaulOrder/addForm.vue @@ -27,7 +27,7 @@ --> - + {{type =='DEVICE'||type == 'TECH'?'设备' : '模具'}} - + + + + + + + @@ -181,6 +187,8 @@ type: '', deviceNumber: undefined, isRadeIn: '', + totalQty: '', + requestQty: '', currentQty: '', qty: '', temporarilySpecifications: '' @@ -280,7 +288,7 @@ // 单列模式 function openSingleNewColumn(fieldName, val, list) { - singleColumnList.value = list + singleColumnList.value = [] field.value = fieldName if (val) { singleColumnDefaultValue.value = [list.findIndex(item => item.value == val)] @@ -288,10 +296,10 @@ singleColumnDefaultValue.value = [] } isShowSelectItem.value = true; - singleColumnList.value = list } async function searchItem(name){ + proxy.$modal.loading('加载中') await getSparePartsList(name); } @@ -301,20 +309,18 @@ return; } if (type == 1) { + proxy.$modal.loading("加载中") form1.value.itemNumber = forms.value.temporarilyNumber; form1.value.name = forms.value.temporarilyName; form1.value.specifications = forms.value.temporarilySpecifications; - let param = { - number:form1.value.itemNumber - } - await sparePartsApi.getApplySparePartsList(param).then(res => { - const itemInfo = res.data.find(item=>item.number == form1.value.itemNumber); - if(itemInfo){ - form1.value.currentQty = itemInfo.qty; - form1.value.isRadeIn = itemInfo.isRadeIn; - updataKey.value++ - } - }).catch(() => { }) + await sparePartsApi.getApplyItemByNumber(form1.value.itemNumber).then(res => { + form1.value.totalQty = res.data.totalStockQty + form1.value.currentQty = res.data.availableQty; + form1.value.requestQty = res.data.totalRequestQty; + form1.value.isRadeIn = res.data.isRadeIn; + updataKey.value++ + }).catch(() => { + }) } await getSparePartsList(null); isShowSelectItem.value = false; @@ -332,7 +338,11 @@ }) sparePartsList.value = res.data singleColumnList.value = sparePartsList.value - }).catch(() => { }) + proxy.$modal.closeLoading() + }).catch(() => { + proxy.$modal.closeLoading() + }) + } // 单列模式 @@ -434,6 +444,8 @@ type: '', deviceNumber: undefined, isRadeIn: '', + totalQty: '', + requestQty: '', currentQty: "", qty: '', } @@ -449,11 +461,11 @@ // this.$modal.showToast('请选择设备') // return; // } - if (!form1.value.qty || form1.value.qty == 0) { + if (!form1.value.qty || Number(form1.value.qty) == 0) { proxy.$modal.showToast('请输入数量') return; } - if (form1.value.qty > form1.value.currentQty) { + if (Number(form1.value.qty) > Number(form1.value.currentQty)) { proxy.$modal.showToast('数量不可以大于库存') return; } diff --git a/src/pages/upkeepOrder/detail.vue b/src/pages/upkeepOrder/detail.vue index 25a57c0..25a13c1 100644 --- a/src/pages/upkeepOrder/detail.vue +++ b/src/pages/upkeepOrder/detail.vue @@ -137,6 +137,19 @@ + + + + + + + + + + + + + @@ -179,11 +192,14 @@ } from 'vue' import * as moldApi from "@/api/mold" import * as upkeepOrderApi from "@/api/upkeepOrder" + import * as uploadApi from "@/api/upload" const { proxy } = getCurrentInstance() const list = ref([{ name: '设备信息' }, { name: '保养内容' + }, { + name: '图片' }]) const current = ref(0) const changeItem = ref({ @@ -196,6 +212,8 @@ const serviceList = ref([]) const isTrue = ref(false) const isVerifyShowSuccess = ref(false) + const imgList = ref([]) + const fileInfoList = ref([]) function change(index) { current.value = index changeItem.value = list.value[current.value] @@ -256,19 +274,25 @@ } const paramsData = { id: data.value.id, - verifyContent: data.value.applyContent + verifyContent: data.value.applyContent, } - proxy.$modal.confirm('是否验证完结?').then(() => { + proxy.$modal.confirm('是否关闭?').then(() => { proxy.$modal.loading('加载中') loading.value = true - upkeepOrderApi.orderClickFinish(paramsData,type.value).then((res) => { if (res.data) { - proxy.$modal.showToast('操作成功') - setTimeout(() => { - proxy.$tab.navigateBack() - loading.value = false - }, 1500) + let params = { + fileInfoList: fileInfoList.value, + funcCode: "maintenance", + number: data.value.number + } + uploadApi.uploadCommit(params).then(response=>{ + proxy.$modal.showToast('操作成功') + setTimeout(() => { + proxy.$tab.navigateBack() + loading.value = false + }, 1500) + }) } else { proxy.$modal.showToast(res.msg) loading.value = false @@ -279,7 +303,7 @@ }) }) } - // 完成 + // 验证 function orderClickVerify() { if (!serviceList.value || serviceList.value && serviceList.value.length == 0) { proxy.$modal.showToast('没有保养内容') @@ -287,18 +311,16 @@ } const paramsData = { id: data.value.id, - verifyContent: data.value.applyContent + verifyContent: data.value.applyContent, } isVerifyShowSuccess.value = false - proxy.$modal.confirm('是否完成?').then(() => { + proxy.$modal.confirm('是否验证完结?').then(() => { proxy.$modal.loading('加载中') loading.value = true upkeepOrderApi.orderClickVerify(paramsData,type.value).then((res) => { if (res.data) { proxy.$modal.showToast('操作成功') - setTimeout(() => { - // proxy.$tab.navigateTo(`/pages/upkeepOrder/index?type=${type.value}`) proxy.$tab.navigateBack() loading.value = false }, 1500) @@ -332,15 +354,53 @@ }).catch(() => { }) }) } + + function chooseImage() { + uni.chooseImage({ + count: 1, // 默认9 + sizeType: ['compressed'], // 可以指定是原图还是压缩图,默认二者都有 + sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有 + success: (res) => { + let filePath = res.tempFilePaths[0] + let tempFile = res.tempFiles[0] + proxy.$modal.loading() + uploadApi.uploadFile({ + filePath: filePath, + }).then((ret) => { + proxy.$modal.closeLoading() + imgList.value.push(ret.data) + let fileInfo = { + url : ret.data, + name: tempFile.name + } + fileInfoList.value.push(fileInfo) + }).catch((err) => { + proxy.$modal.closeLoading() + }); + }, + }); + } + // 删除图片 + function delImage(index) { + imgList.value.splice(index, 1) + fileInfoList.value.splice(index, 1) + } + onLoad(async (option) => { if (option.type) type.value = option.type; if (option.data) { data.value = JSON.parse(decodeURIComponent(option.data)) - + if(data.value.status != 'PECEIVED' && data.value.status != 'COMPLETED' && data.value.status != 'VERIFIED'){ + list.value = [{ + name: '设备信息' + }, { + name: '保养内容' + }] + } + imgList.value = data.value.filePathList?data.value.filePathList:[] } changeItem.value = list.value[current.value] - }) onShow(() => { getUpkeepOrderDetailList() @@ -556,5 +616,54 @@ display: flex; justify-content: flex-start; align-items: center; + + } + + + .image { + padding: 0px 30rpx; + padding-bottom: 30rpx; + display: flex; + align-items: center; + + flex-wrap: wrap; + + .image-list { + display: flex; + align-items: center; + flex-wrap: wrap; + } + } + + .image-item { + width: 210rpx; + height: 210rpx; + margin-right: 20rpx; + position: relative; + border: 1px solid rgba(230, 230, 230, 0.5); + margin-bottom: 20rpx; + border-radius: 20rpx; + overflow: hidden; + + image { + width: 100%; + height: 100%; + } + + .close { + position: absolute; + right: 0px; + top: 0px; + } + } + + .image-item1 { + border: none; + margin-right: 0px; + + image { + width: 100%; + height: 100%; + } } \ No newline at end of file