维修,定损

This commit is contained in:
hongchao 2025-06-15 10:08:08 +08:00
parent 98268c53ba
commit baed3df1ec
9 changed files with 236 additions and 60 deletions

View File

@ -24,7 +24,7 @@ import { onMounted, reactive, ref } from 'vue'
import { appLoginAPI, getUserInfoAPI, iwsLoginAPI } from '@/services/index.js' import { appLoginAPI, getUserInfoAPI, iwsLoginAPI } from '@/services/index.js'
import { useMemberStore } from '@/stores' import { useMemberStore } from '@/stores'
const memberStore = useMemberStore() const memberStore = useMemberStore()
const origin = window.location.href const origin = []
// //
const loginForm = reactive({ const loginForm = reactive({
username: uni.getStorageSync('username'), username: uni.getStorageSync('username'),

View File

@ -109,17 +109,18 @@
</template> </template>
<script setup> <script setup>
import { computed, ref, reactive } from 'vue' import { computed, ref, reactive,nextTick } from 'vue'
import { import {
partTypeTreeList, partTypeTreeList,
getSupplierList, getSupplierList,
getRepairerListApi, getRepairerListApi,
saveRepairRow, saveRepairRow,
getScrapReasonList, getScrapReasonList,
getPartItemApi,
} from '@/services/repair/repair.js' } from '@/services/repair/repair.js'
import { baseURL } from '@/utils/http' import { baseURL } from '@/utils/http'
import treeSelect from '../tree-select/tselect.vue' import treeSelect from '../tree-select/tselectTwo.vue'
import { onLoad } from '@dcloudio/uni-app' import { onLoad,onShow } from '@dcloudio/uni-app'
const queryParams = ref({}) const queryParams = ref({})
const rowIndex = ref(-1) const rowIndex = ref(-1)
// //
@ -162,6 +163,13 @@ onLoad((options) => {
console.log('选中的编码:', queryParams.value.selectedCodes) console.log('选中的编码:', queryParams.value.selectedCodes)
}) })
onShow(() => {
getPartTreeData()
//
getPartItemData()
})
const repairType = ref(1) const repairType = ref(1)
const changeTab = async (e) => { const changeTab = async (e) => {
repairType.value = e repairType.value = e
@ -255,7 +263,7 @@ const getPartTreeData = async () => {
const res = await partTypeTreeList({}) const res = await partTypeTreeList({})
partTreeData.value = res.data partTreeData.value = res.data
} }
getPartTreeData()
const treeSelectRef = ref([]) const treeSelectRef = ref([])
const clearPart = (index) => { const clearPart = (index) => {
partItems.value[index].partId = '' partItems.value[index].partId = ''
@ -279,6 +287,37 @@ const partTreeChange = (val, index) => {
// //
const partItems = ref([{ partNum: '', partType: 0, partId: '', storageNum: '' }]) const partItems = ref([{ partNum: '', partType: 0, partId: '', storageNum: '' }])
const getPartItemData = async () => {
console.log("bbbbbbbbbbbbbbbbb",queryParams.value.ids)
const res = await getPartItemApi({
ids: queryParams.value.ids,
})
console.log("cccccccccccc",res)
if(res.data && res.data.length > 0) {
// 1.
partItems.value = res.data.map(item => ({
...item,
partType: item.partId ? 1 : 0 // partType partId
}));
// 使 nextTick
nextTick(() => {
partItems.value.forEach((item, index) => {
if (item.partId) {
console.log("尝试设置 partId", item.partId)
if (treeSelectRef.value[index] && treeSelectRef.value[index].setSelectedValue) {
treeSelectRef.value[index].setSelectedValue(item.partId);
} else {
console.warn(`treeSelectRef[${index}] 没有 setSelectedValue 方法`)
}
}
});
});
}
}
const addPart = () => { const addPart = () => {
partItems.value.push({ partNum: '', partType: 0, partId: '', storageNum: '' }) partItems.value.push({ partNum: '', partType: 0, partId: '', storageNum: '' })
} }

View File

@ -224,17 +224,18 @@
</template> </template>
<script setup> <script setup>
import { computed, ref, reactive } from 'vue' import { computed, ref, reactive,nextTick } from 'vue'
import { import {
partTypeTreeList, partTypeTreeList,
getSupplierList, getSupplierList,
getRepairerListApi, getRepairerListApi,
saveRepairRow, saveRepairRow,
getScrapReasonList, getScrapReasonList,
getPartItemApi,
} from '@/services/repair/repair.js' } from '@/services/repair/repair.js'
import { baseURL } from '@/utils/http' import { baseURL } from '@/utils/http'
import treeSelect from '../tree-select/tselect.vue' import treeSelect from '../tree-select/tselectTwo.vue'
import { onLoad } from '@dcloudio/uni-app' import { onLoad,onShow } from '@dcloudio/uni-app'
const queryParams = ref({}) const queryParams = ref({})
const rowIndex = ref(-1) const rowIndex = ref(-1)
onLoad((options) => { onLoad((options) => {
@ -244,6 +245,13 @@ onLoad((options) => {
console.log(queryParams.value) console.log(queryParams.value)
getScrapReasonListData() getScrapReasonListData()
}) })
onShow(() => {
getPartTreeData()
//
getPartItemData()
})
const repairType = ref(1) const repairType = ref(1)
const changeTab = async (e) => { const changeTab = async (e) => {
repairType.value = e repairType.value = e
@ -366,7 +374,6 @@ const getPartTreeData = async () => {
const res = await partTypeTreeList({}) const res = await partTypeTreeList({})
partTreeData.value = res.data partTreeData.value = res.data
} }
getPartTreeData()
const treeSelectRef = ref([]) const treeSelectRef = ref([])
const clearPart = (index) => { const clearPart = (index) => {
partItems.value[index].partId = '' partItems.value[index].partId = ''
@ -389,7 +396,35 @@ const partTreeChange = (val, index) => {
} }
// //
const partItems = ref([{ partNum: '', partType: 0, partId: '', storageNum: '' }]) const partItems = ref([{ partNum: '', partType: 0, partId: '', storageNum: ''}])
const getPartItemData = async () => {
console.log("bbbbbbbbbbbbbbbbb",queryParams.value.ids)
const res = await getPartItemApi({
ids: queryParams.value.ids,
})
if(res.data && res.data.length > 0) {
// 1.
partItems.value = res.data.map(item => ({
...item,
partType: item.partId ? 1 : 0 // partType partId
}));
// 使 nextTick
nextTick(() => {
partItems.value.forEach((item, index) => {
if (item.partId) {
console.log("尝试设置 partId", item.partId)
if (treeSelectRef.value[index] && treeSelectRef.value[index].setSelectedValue) {
treeSelectRef.value[index].setSelectedValue(item.partId);
} else {
console.warn(`treeSelectRef[${index}] 没有 setSelectedValue 方法`)
}
}
});
});
}
}
const addPart = () => { const addPart = () => {
partItems.value.push({ partNum: '', partType: 0, partId: '', storageNum: '' }) partItems.value.push({ partNum: '', partType: 0, partId: '', storageNum: '' })
} }

View File

@ -68,7 +68,7 @@
<div v-for="(item, index) in partItems" :key="index"> <div v-for="(item, index) in partItems" :key="index">
<uni-forms-item label="配件类型"> <uni-forms-item label="配件类型">
<treeSelect style="width: 100%;height: 90rpx;" ref="treeSelectRef" <treeSelect style="width: 100%;height: 90rpx;" ref="treeSelectRef"
:options="partTreeData" @change="partTreeChange" :index="index" @clear="clearPart" :defaultProps="defaultProps"></treeSelect> :options="partTreeData" v-model="item.partId" @change="partTreeChange" :index="index" @clear="clearPart" :defaultProps="defaultProps"></treeSelect>
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="配件数量"> <uni-forms-item label="配件数量">
<uni-easyinput <uni-easyinput
@ -203,11 +203,11 @@
</template> </template>
<script setup> <script setup>
import { computed, ref } from 'vue' import { computed, ref,nextTick } from 'vue'
import { partTypeTreeList, getSupplierList, getRepairerListApi, saveRepairRow } from '@/services/repair/repair.js' import { partTypeTreeList, getSupplierList, getRepairerListApi, saveRepairRow,getPartItemApi } from '@/services/repair/repair.js'
import { baseURL } from '@/utils/http' import { baseURL } from '@/utils/http'
import treeSelect from '../tree-select/tselect.vue'; import treeSelect from '../tree-select/tselectTwo.vue';
import { onLoad } from '@dcloudio/uni-app' import { onLoad, onShow } from '@dcloudio/uni-app'
// const query = defineProps() // // const query = defineProps() //
// const queryParams = JSON.parse(query.queryParams) // const queryParams = JSON.parse(query.queryParams)
const queryParams = ref({}) const queryParams = ref({})
@ -215,8 +215,16 @@ const rowData = ref({})
onLoad((options) => { onLoad((options) => {
queryParams.value = JSON.parse(options.queryParams) queryParams.value = JSON.parse(options.queryParams)
rowData.value = JSON.parse(options.queryParams) rowData.value = JSON.parse(options.queryParams)
console.log("xxxxxxxxxxx",rowData.value)
}) })
onShow(() => {
getPartTreeData()
//
getPartItemData()
})
const damageReasonList = ref([ const damageReasonList = ref([
{ value: 0, text: '自然损坏' }, { value: 0, text: '自然损坏' },
{ value: 1, text: '人为损坏' }, { value: 1, text: '人为损坏' },
@ -310,7 +318,6 @@ const getPartTreeData = async () => {
const res = await partTypeTreeList({}) const res = await partTypeTreeList({})
partTreeData.value = res.data; partTreeData.value = res.data;
} }
getPartTreeData()
// //
const clearPart = (index) =>{ const clearPart = (index) =>{
partItems.value[index].partId="" partItems.value[index].partId=""
@ -353,6 +360,35 @@ const formLeft = ref({
repairNum: 0, repairNum: 0,
}) })
const partItems = ref([{ partNum: '', partType: 0, partId: '', storageNum: ''}]) const partItems = ref([{ partNum: '', partType: 0, partId: '', storageNum: ''}])
const getPartItemData = async () => {
console.log("bbbbbbbbbbbbbbbbb",rowData.value.ids)
const res = await getPartItemApi({
ids: rowData.value.ids,
})
if(res.data && res.data.length > 0) {
// 1.
partItems.value = res.data.map(item => ({
...item,
partType: item.partId ? 1 : 0 // partType partId
}));
// 使 nextTick
nextTick(() => {
partItems.value.forEach((item, index) => {
if (item.partId) {
console.log("尝试设置 partId", item.partId)
if (treeSelectRef.value[index] && treeSelectRef.value[index].setSelectedValue) {
treeSelectRef.value[index].setSelectedValue(item.partId);
} else {
console.warn(`treeSelectRef[${index}] 没有 setSelectedValue 方法`)
}
}
});
});
}
}
const addPart = () => { const addPart = () => {
partItems.value.push({ partNum: '', partType: 0, partId: '', storageNum: '' }) partItems.value.push({ partNum: '', partType: 0, partId: '', storageNum: '' })
} }

View File

@ -56,6 +56,12 @@
<view class="cont">{{ item.maCode }}</view> <view class="cont">{{ item.maCode }}</view>
</uni-col> </uni-col>
</uni-row> </uni-row>
<uni-row :gutter="24" v-if="queryParams.manageType==0" >
<uni-col :span="6">编码状态</uni-col>
<uni-col :span="16">
<view class="cont">{{ item.status }}</view>
</uni-col>
</uni-row>
<uni-row :gutter="24"> <uni-row :gutter="24">
<uni-col :span="6">维修人员</uni-col> <uni-col :span="6">维修人员</uni-col>
<uni-col :span="16"> <uni-col :span="16">

View File

@ -84,7 +84,7 @@
<script setup> <script setup>
import { ref, reactive } from 'vue' import { ref, reactive } from 'vue'
import { onLoad } from '@dcloudio/uni-app' import { onLoad } from '@dcloudio/uni-app'
import { getCodeListApi,repairInputWarehouseApi,rejectWarehouseApi,getInfoByQrcodeApi } from '@/services/repair/testedInBound.js' import { getCodeListApi,repairInputWarehouseApi,rejectWarehouseApi,getInfoByQrcodeApi,repairInputWarehouseApiTwo } from '@/services/repair/testedInBound.js'
import { getBoxCodeListApi } from '@/services/standard.js' import { getBoxCodeListApi } from '@/services/standard.js'
const taskInfo = ref({}) const taskInfo = ref({})
@ -108,42 +108,50 @@ const ocrScan = () => {
// //
const codeScan = async () => { const codeScan = async () => {
qrCode.value="" qrCode.value=""
var mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module") // var mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module")
mpaasScanModule.mpaasScan({ uni.scanCode({
// qrCodebarCode success: function (res) {
'scanType': ['qrCode','barCode'], // qrCode.value = res.resp_result.split("qrcode=")[1];
// false console.log('条码内容:' + res.result);
'hideAlbum': false, qrCode.value = res.result
//ios zh-Hansen
'language' : 'en',
//(ios)
'failedMsg': '未识别到二维码,请重试',
//Android
'screenType': 'full'
},(ret) => {
console.log(ret)
if(ret.resp_code==10){
uni.showToast({ title: '用户取消', icon: 'none' })
maInfo.value = {}
}
if(ret.resp_code==11){
uni.showToast({ title: '扫码失败', icon: 'none' })
}
if(ret.resp_code==1000){
// uni.showToast({ title: '', icon: 'none' })
qrCode.value = ret.resp_result.split("qrcode=")[1];
codeInBound() codeInBound()
} }
// uni.showModal({ });
// title: "", // mpaasScanModule.mpaasScan({
// // resp_code 10111000 // // qrCodebarCode
// // resp_message // 'scanType': ['qrCode','barCode'],
// // resp_result // // false
// content: JSON.stringify(ret), // 'hideAlbum': false,
// showCancel: false, // //ios zh-Hansen
// confirmText: "" // 'language' : 'en',
// //(ios)
// 'failedMsg': '',
// //Android
// 'screenType': 'full'
// },(ret) => {
// console.log(ret)
// if(ret.resp_code==10){
// uni.showToast({ title: '', icon: 'none' })
// maInfo.value = {}
// }
// if(ret.resp_code==11){
// uni.showToast({ title: '', icon: 'none' })
// }
// if(ret.resp_code==1000){
// // uni.showToast({ title: '', icon: 'none' })
// qrCode.value = ret.resp_result.split("qrcode=")[1];
// codeInBound()
// }
// // uni.showModal({
// // title: "",
// // // resp_code 10111000
// // // resp_message
// // // resp_result
// // content: JSON.stringify(ret),
// // showCancel: false,
// // confirmText: ""
// // })
// }) // })
})
} }
// //
const codeInBound = async () => { const codeInBound = async () => {
@ -158,7 +166,7 @@ const codeInBound = async () => {
console.log(res) console.log(res)
if(res.code==200){ if(res.code==200){
maInfo.value = res.data[0] maInfo.value = res.data[0]
if(maInfo.value.maCode!=undefined&&maInfo.value.maCode!=""){ if(maInfo.value.maId!=undefined&&maInfo.value.maId!=""){
}else{ }else{
uni.showToast({ title: '扫码二维码未绑定设备编码!', icon: 'none'}) uni.showToast({ title: '扫码二维码未绑定设备编码!', icon: 'none'})
} }
@ -175,14 +183,17 @@ const cinfirmCodeInBound = async () => {
icon: 'none', icon: 'none',
}) })
}else{ }else{
let arr=[{"maCode":maInfo.value.maCode,"maId":maInfo.value.maId}] // let arr=[{"maId":maInfo.value.maId}]
let param = { // let param = {
taskId: maInfo.value.taskId, // taskId: maInfo.value.taskId,
typeId: maInfo.value.typeId, // typeId: maInfo.value.typeId,
agreementId: maInfo.value.agreementId, // agreementId: maInfo.value.agreementId,
maCodeList: arr, // maCodeList: arr,
} // }
const res = await repairInputWarehouseApi(param) let param = {qrCode:qrCode.value}
console.log("bbbbbbbbbbbbbbbbb")
const res = await repairInputWarehouseApiTwo(param)
console.log("yyyyyyyyy",res)
if (res.code === 200) { if (res.code === 200) {
uni.showToast({ uni.showToast({
title: '入库成功!', title: '入库成功!',

View File

@ -97,6 +97,38 @@
return null; return null;
}, },
//
findNodeById(id, options) {
for (const option of options) {
if (option[this.defaultProps.id] === id) {
return option;
}
if (option.children && option.children.length > 0) {
const node = this.findNodeById(id, option.children);
if (node) {
return node;
}
}
}
return null;
},
//
setSelectedValue(id) {
const node = this.findNodeById(id, this.options);
if (node) {
//
const path = this.getNodePath(node, this.options);
if (path) {
//
this.showLabel = path.join('/');
} else {
this.showLabel = node[this.defaultProps.label];
}
}
},
// //
openOptions() { openOptions() {
if(this.showLabel==""){ if(this.showLabel==""){

View File

@ -113,3 +113,12 @@ export const getScrapReasonList = (data) => {
data, data,
}) })
} }
//获取定损的配件
export const getPartItemApi = (data) => {
return http({
method: 'GET',
url: '/material/repair/getLossPart',
data,
})
}

View File

@ -36,6 +36,14 @@ export const repairInputWarehouseApi = (data) => {
}) })
} }
export const repairInputWarehouseApiTwo = (data) => {
return http({
method: 'POST',
url: '/material/repair_input_details/sanQrcodeInput',
data,
})
}
// 修试入库-通过 // 修试入库-通过
export const rejectWarehouseApi = (data) => { export const rejectWarehouseApi = (data) => {