维修,定损
This commit is contained in:
parent
98268c53ba
commit
baed3df1ec
|
|
@ -24,7 +24,7 @@ import { onMounted, reactive, ref } from 'vue'
|
|||
import { appLoginAPI, getUserInfoAPI, iwsLoginAPI } from '@/services/index.js'
|
||||
import { useMemberStore } from '@/stores'
|
||||
const memberStore = useMemberStore()
|
||||
const origin = window.location.href
|
||||
const origin = []
|
||||
// 登录参数
|
||||
const loginForm = reactive({
|
||||
username: uni.getStorageSync('username'),
|
||||
|
|
|
|||
|
|
@ -109,17 +109,18 @@
|
|||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed, ref, reactive } from 'vue'
|
||||
import { computed, ref, reactive,nextTick } from 'vue'
|
||||
import {
|
||||
partTypeTreeList,
|
||||
getSupplierList,
|
||||
getRepairerListApi,
|
||||
saveRepairRow,
|
||||
getScrapReasonList,
|
||||
getPartItemApi,
|
||||
} from '@/services/repair/repair.js'
|
||||
import { baseURL } from '@/utils/http'
|
||||
import treeSelect from '../tree-select/tselect.vue'
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
import treeSelect from '../tree-select/tselectTwo.vue'
|
||||
import { onLoad,onShow } from '@dcloudio/uni-app'
|
||||
const queryParams = ref({})
|
||||
const rowIndex = ref(-1)
|
||||
// 计算属性:将选中的编码用逗号拼接显示
|
||||
|
|
@ -162,6 +163,13 @@ onLoad((options) => {
|
|||
console.log('选中的编码:', queryParams.value.selectedCodes)
|
||||
})
|
||||
|
||||
onShow(() => {
|
||||
getPartTreeData()
|
||||
//获取定损的配件信息
|
||||
getPartItemData()
|
||||
})
|
||||
|
||||
|
||||
const repairType = ref(1)
|
||||
const changeTab = async (e) => {
|
||||
repairType.value = e
|
||||
|
|
@ -255,7 +263,7 @@ const getPartTreeData = async () => {
|
|||
const res = await partTypeTreeList({})
|
||||
partTreeData.value = res.data
|
||||
}
|
||||
getPartTreeData()
|
||||
|
||||
const treeSelectRef = ref([])
|
||||
const clearPart = (index) => {
|
||||
partItems.value[index].partId = ''
|
||||
|
|
@ -279,6 +287,37 @@ const partTreeChange = (val, index) => {
|
|||
|
||||
//内部维修
|
||||
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 = () => {
|
||||
partItems.value.push({ partNum: '', partType: 0, partId: '', storageNum: '' })
|
||||
}
|
||||
|
|
|
|||
|
|
@ -224,17 +224,18 @@
|
|||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed, ref, reactive } from 'vue'
|
||||
import { computed, ref, reactive,nextTick } from 'vue'
|
||||
import {
|
||||
partTypeTreeList,
|
||||
getSupplierList,
|
||||
getRepairerListApi,
|
||||
saveRepairRow,
|
||||
getScrapReasonList,
|
||||
getPartItemApi,
|
||||
} from '@/services/repair/repair.js'
|
||||
import { baseURL } from '@/utils/http'
|
||||
import treeSelect from '../tree-select/tselect.vue'
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
import treeSelect from '../tree-select/tselectTwo.vue'
|
||||
import { onLoad,onShow } from '@dcloudio/uni-app'
|
||||
const queryParams = ref({})
|
||||
const rowIndex = ref(-1)
|
||||
onLoad((options) => {
|
||||
|
|
@ -244,6 +245,13 @@ onLoad((options) => {
|
|||
console.log(queryParams.value)
|
||||
getScrapReasonListData()
|
||||
})
|
||||
onShow(() => {
|
||||
getPartTreeData()
|
||||
//获取定损的配件信息
|
||||
getPartItemData()
|
||||
})
|
||||
|
||||
|
||||
const repairType = ref(1)
|
||||
const changeTab = async (e) => {
|
||||
repairType.value = e
|
||||
|
|
@ -366,7 +374,6 @@ const getPartTreeData = async () => {
|
|||
const res = await partTypeTreeList({})
|
||||
partTreeData.value = res.data
|
||||
}
|
||||
getPartTreeData()
|
||||
const treeSelectRef = ref([])
|
||||
const clearPart = (index) => {
|
||||
partItems.value[index].partId = ''
|
||||
|
|
@ -390,6 +397,34 @@ const partTreeChange = (val, index) => {
|
|||
|
||||
//内部维修
|
||||
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 = () => {
|
||||
partItems.value.push({ partNum: '', partType: 0, partId: '', storageNum: '' })
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@
|
|||
<div v-for="(item, index) in partItems" :key="index">
|
||||
<uni-forms-item label="配件类型">
|
||||
<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 label="配件数量">
|
||||
<uni-easyinput
|
||||
|
|
@ -203,11 +203,11 @@
|
|||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed, ref } from 'vue'
|
||||
import { partTypeTreeList, getSupplierList, getRepairerListApi, saveRepairRow } from '@/services/repair/repair.js'
|
||||
import { computed, ref,nextTick } from 'vue'
|
||||
import { partTypeTreeList, getSupplierList, getRepairerListApi, saveRepairRow,getPartItemApi } from '@/services/repair/repair.js'
|
||||
import { baseURL } from '@/utils/http'
|
||||
import treeSelect from '../tree-select/tselect.vue';
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
import treeSelect from '../tree-select/tselectTwo.vue';
|
||||
import { onLoad, onShow } from '@dcloudio/uni-app'
|
||||
// const query = defineProps() // 获取上级页面传递的路由参数
|
||||
// const queryParams = JSON.parse(query.queryParams)
|
||||
const queryParams = ref({})
|
||||
|
|
@ -215,8 +215,16 @@ const rowData = ref({})
|
|||
onLoad((options) => {
|
||||
queryParams.value = JSON.parse(options.queryParams)
|
||||
rowData.value = JSON.parse(options.queryParams)
|
||||
console.log("xxxxxxxxxxx",rowData.value)
|
||||
})
|
||||
|
||||
onShow(() => {
|
||||
getPartTreeData()
|
||||
//获取定损的配件信息
|
||||
getPartItemData()
|
||||
})
|
||||
|
||||
|
||||
const damageReasonList = ref([
|
||||
{ value: 0, text: '自然损坏' },
|
||||
{ value: 1, text: '人为损坏' },
|
||||
|
|
@ -310,7 +318,6 @@ const getPartTreeData = async () => {
|
|||
const res = await partTypeTreeList({})
|
||||
partTreeData.value = res.data;
|
||||
}
|
||||
getPartTreeData()
|
||||
// 配件清除
|
||||
const clearPart = (index) =>{
|
||||
partItems.value[index].partId=""
|
||||
|
|
@ -353,6 +360,35 @@ const formLeft = ref({
|
|||
repairNum: 0,
|
||||
})
|
||||
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 = () => {
|
||||
partItems.value.push({ partNum: '', partType: 0, partId: '', storageNum: '' })
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,6 +56,12 @@
|
|||
<view class="cont">{{ item.maCode }}</view>
|
||||
</uni-col>
|
||||
</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-col :span="6">维修人员:</uni-col>
|
||||
<uni-col :span="16">
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@
|
|||
<script setup>
|
||||
import { ref, reactive } from 'vue'
|
||||
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'
|
||||
|
||||
const taskInfo = ref({})
|
||||
|
|
@ -108,42 +108,50 @@ const ocrScan = () => {
|
|||
// 二维码扫码
|
||||
const codeScan = async () => {
|
||||
qrCode.value=""
|
||||
var mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module")
|
||||
mpaasScanModule.mpaasScan({
|
||||
// 扫码识别类型,参数可多选,qrCode、barCode,不设置,默认识别所有
|
||||
'scanType': ['qrCode','barCode'],
|
||||
// 是否隐藏相册,默认false不隐藏
|
||||
'hideAlbum': false,
|
||||
//ios需要设置这个参数,只支持中英文 zh-Hans、en,默认中文
|
||||
'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];
|
||||
// var mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module")
|
||||
uni.scanCode({
|
||||
success: function (res) {
|
||||
// qrCode.value = res.resp_result.split("qrcode=")[1];
|
||||
console.log('条码内容:' + res.result);
|
||||
qrCode.value = res.result
|
||||
codeInBound()
|
||||
}
|
||||
// uni.showModal({
|
||||
// title: "弹窗标题",
|
||||
// // 返回值中,resp_code 表示返回结果值,10:用户取消,11:其他错误,1000:成功
|
||||
// // 返回值中,resp_message 表示返回结果信息
|
||||
// // 返回值中,resp_result 表示扫码结果,只有成功才会有返回
|
||||
// content: JSON.stringify(ret),
|
||||
// showCancel: false,
|
||||
// confirmText: "确定"
|
||||
});
|
||||
// mpaasScanModule.mpaasScan({
|
||||
// // 扫码识别类型,参数可多选,qrCode、barCode,不设置,默认识别所有
|
||||
// 'scanType': ['qrCode','barCode'],
|
||||
// // 是否隐藏相册,默认false不隐藏
|
||||
// 'hideAlbum': false,
|
||||
// //ios需要设置这个参数,只支持中英文 zh-Hans、en,默认中文
|
||||
// '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 表示返回结果值,10:用户取消,11:其他错误,1000:成功
|
||||
// // // 返回值中,resp_message 表示返回结果信息
|
||||
// // // 返回值中,resp_result 表示扫码结果,只有成功才会有返回
|
||||
// // content: JSON.stringify(ret),
|
||||
// // showCancel: false,
|
||||
// // confirmText: "确定"
|
||||
// // })
|
||||
// })
|
||||
})
|
||||
}
|
||||
// 二维码入库
|
||||
const codeInBound = async () => {
|
||||
|
|
@ -158,7 +166,7 @@ const codeInBound = async () => {
|
|||
console.log(res)
|
||||
if(res.code==200){
|
||||
maInfo.value = res.data[0]
|
||||
if(maInfo.value.maCode!=undefined&&maInfo.value.maCode!=""){
|
||||
if(maInfo.value.maId!=undefined&&maInfo.value.maId!=""){
|
||||
}else{
|
||||
uni.showToast({ title: '扫码二维码未绑定设备编码!', icon: 'none'})
|
||||
}
|
||||
|
|
@ -175,14 +183,17 @@ const cinfirmCodeInBound = async () => {
|
|||
icon: 'none',
|
||||
})
|
||||
}else{
|
||||
let arr=[{"maCode":maInfo.value.maCode,"maId":maInfo.value.maId}]
|
||||
let param = {
|
||||
taskId: maInfo.value.taskId,
|
||||
typeId: maInfo.value.typeId,
|
||||
agreementId: maInfo.value.agreementId,
|
||||
maCodeList: arr,
|
||||
}
|
||||
const res = await repairInputWarehouseApi(param)
|
||||
// let arr=[{"maId":maInfo.value.maId}]
|
||||
// let param = {
|
||||
// taskId: maInfo.value.taskId,
|
||||
// typeId: maInfo.value.typeId,
|
||||
// agreementId: maInfo.value.agreementId,
|
||||
// maCodeList: arr,
|
||||
// }
|
||||
let param = {qrCode:qrCode.value}
|
||||
console.log("bbbbbbbbbbbbbbbbb")
|
||||
const res = await repairInputWarehouseApiTwo(param)
|
||||
console.log("yyyyyyyyy",res)
|
||||
if (res.code === 200) {
|
||||
uni.showToast({
|
||||
title: '入库成功!',
|
||||
|
|
|
|||
|
|
@ -97,6 +97,38 @@
|
|||
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() {
|
||||
if(this.showLabel==""){
|
||||
|
|
|
|||
|
|
@ -113,3 +113,12 @@ export const getScrapReasonList = (data) => {
|
|||
data,
|
||||
})
|
||||
}
|
||||
|
||||
//获取定损的配件
|
||||
export const getPartItemApi = (data) => {
|
||||
return http({
|
||||
method: 'GET',
|
||||
url: '/material/repair/getLossPart',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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) => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue