维修-报废原因下拉,与默认维修人设置
This commit is contained in:
parent
bd255a7012
commit
6eb97747c1
|
|
@ -21,26 +21,22 @@
|
||||||
</uni-col>
|
</uni-col>
|
||||||
</uni-row>
|
</uni-row>
|
||||||
</view>
|
</view>
|
||||||
<uni-row :gutter="24" class="search-form" style="background: #fff; padding: 10px; margin: 5px; border-radius: 5px">
|
<uni-row
|
||||||
|
:gutter="24"
|
||||||
|
class="search-form"
|
||||||
|
style="background: #fff; padding: 10px; margin: 5px; border-radius: 5px"
|
||||||
|
>
|
||||||
<uni-col :span="6">
|
<uni-col :span="6">
|
||||||
<view class="btnBox internal" @click="changeTab(1)">
|
<view class="btnBox internal" @click="changeTab(1)"> 内部维修 </view>
|
||||||
内部维修
|
|
||||||
</view>
|
|
||||||
</uni-col>
|
</uni-col>
|
||||||
<uni-col :span="6">
|
<uni-col :span="6">
|
||||||
<view class="btnBox return" @click="changeTab(2)">
|
<view class="btnBox return" @click="changeTab(2)"> 返厂维修 </view>
|
||||||
返厂维修
|
|
||||||
</view>
|
|
||||||
</uni-col>
|
</uni-col>
|
||||||
<uni-col :span="6">
|
<uni-col :span="6">
|
||||||
<view class="btnBox scrap" @click="changeTab(3)">
|
<view class="btnBox scrap" @click="changeTab(3)"> 待报废 </view>
|
||||||
待报废
|
|
||||||
</view>
|
|
||||||
</uni-col>
|
</uni-col>
|
||||||
<uni-col :span="6">
|
<uni-col :span="6">
|
||||||
<view class="btnBox complete" @click="saveCode">
|
<view class="btnBox complete" @click="saveCode"> 维修完成 </view>
|
||||||
维修完成
|
|
||||||
</view>
|
|
||||||
</uni-col>
|
</uni-col>
|
||||||
</uni-row>
|
</uni-row>
|
||||||
<scroll-view scroll-y style="padding-bottom: 20rpx">
|
<scroll-view scroll-y style="padding-bottom: 20rpx">
|
||||||
|
|
@ -50,15 +46,23 @@
|
||||||
<h2 style="padding: 4rpx 0; font-weight: bold">维修信息</h2>
|
<h2 style="padding: 4rpx 0; font-weight: bold">维修信息</h2>
|
||||||
<uni-forms ref="baseForm" label-align="right">
|
<uni-forms ref="baseForm" label-align="right">
|
||||||
<uni-forms-item label="维修人员">
|
<uni-forms-item label="维修人员">
|
||||||
<uni-data-select :localdata="repairPersonData" v-model="repairPerson" placeholder="请选择维修人员" />
|
<uni-data-select
|
||||||
|
:localdata="repairPersonData"
|
||||||
|
v-model="repairPerson"
|
||||||
|
placeholder="请选择维修人员"
|
||||||
|
/>
|
||||||
</uni-forms-item>
|
</uni-forms-item>
|
||||||
<uni-forms-item label="备注">
|
<uni-forms-item label="备注">
|
||||||
<uni-easyinput placeholder="请填写备注" maxlength="50" v-model="remark"/>
|
<uni-easyinput placeholder="请填写备注" maxlength="50" v-model="remark" />
|
||||||
</uni-forms-item>
|
</uni-forms-item>
|
||||||
<uni-forms-item label="附件">
|
<uni-forms-item label="附件">
|
||||||
<div class="upload" @click="uploadImg" v-if="imgBeseUrl==''">+</div>
|
<div class="upload" @click="uploadImg" v-if="imgBeseUrl == ''">+</div>
|
||||||
<div class="upload" @click="uploadImg" v-else>
|
<div class="upload" @click="uploadImg" v-else>
|
||||||
<image :src="imgBeseUrl" style="width: 160rpx;height: 160rpx;" mode=""></image>
|
<image
|
||||||
|
:src="imgBeseUrl"
|
||||||
|
style="width: 160rpx; height: 160rpx"
|
||||||
|
mode=""
|
||||||
|
></image>
|
||||||
</div>
|
</div>
|
||||||
</uni-forms-item>
|
</uni-forms-item>
|
||||||
</uni-forms>
|
</uni-forms>
|
||||||
|
|
@ -73,8 +77,15 @@
|
||||||
</uni-forms-item> -->
|
</uni-forms-item> -->
|
||||||
<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
|
||||||
:options="partTreeData" @change="partTreeChange" :index="index" @clear="clearPart" :defaultProps="defaultProps"></treeSelect>
|
style="width: 100%; height: 90rpx"
|
||||||
|
ref="treeSelectRef"
|
||||||
|
:options="partTreeData"
|
||||||
|
@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
|
||||||
|
|
@ -91,7 +102,7 @@
|
||||||
:localdata="isChargeList"
|
:localdata="isChargeList"
|
||||||
v-model="item.partType"
|
v-model="item.partType"
|
||||||
placeholder="请选择是否收费"
|
placeholder="请选择是否收费"
|
||||||
:clear="false"
|
:clear="false"
|
||||||
/>
|
/>
|
||||||
<div class="operation-btns">
|
<div class="operation-btns">
|
||||||
<span class="add" @click="addPart">+</span>
|
<span class="add" @click="addPart">+</span>
|
||||||
|
|
@ -126,7 +137,7 @@
|
||||||
<uni-data-select
|
<uni-data-select
|
||||||
:localdata="isChargeList"
|
:localdata="isChargeList"
|
||||||
v-model="item.partType"
|
v-model="item.partType"
|
||||||
:clearable="false"
|
:clearable="false"
|
||||||
placeholder="请选择是否收费"
|
placeholder="请选择是否收费"
|
||||||
/>
|
/>
|
||||||
</uni-forms-item>
|
</uni-forms-item>
|
||||||
|
|
@ -166,14 +177,21 @@
|
||||||
<uni-easyinput placeholder="请填写报废数量" v-model="formRight.scrapNum"/>
|
<uni-easyinput placeholder="请填写报废数量" v-model="formRight.scrapNum"/>
|
||||||
</uni-forms-item> -->
|
</uni-forms-item> -->
|
||||||
<uni-forms-item label="报废原因">
|
<uni-forms-item label="报废原因">
|
||||||
<uni-easyinput
|
<!-- <uni-easyinput
|
||||||
placeholder="请填写报废原因"
|
placeholder="请填写报废原因"
|
||||||
v-model="formRight.scrapReason"
|
v-model="formRight.scrapReason"
|
||||||
|
/> -->
|
||||||
|
<uni-data-select
|
||||||
|
:clearable="false"
|
||||||
|
:localdata="scrapReasonList"
|
||||||
|
v-model="formRight.scrapId"
|
||||||
|
placeholder="请选择报废原因"
|
||||||
|
@change="changeScrap"
|
||||||
/>
|
/>
|
||||||
</uni-forms-item>
|
</uni-forms-item>
|
||||||
<uni-forms-item label="损坏原因">
|
<uni-forms-item label="损坏原因">
|
||||||
<uni-data-select
|
<uni-data-select
|
||||||
:clearable="false"
|
:clearable="false"
|
||||||
:localdata="damageReasonList"
|
:localdata="damageReasonList"
|
||||||
v-model="formRight.scrapType"
|
v-model="formRight.scrapType"
|
||||||
placeholder="请选择损坏原因"
|
placeholder="请选择损坏原因"
|
||||||
|
|
@ -183,9 +201,13 @@
|
||||||
<uni-easyinput placeholder="请填写其他原因" />
|
<uni-easyinput placeholder="请填写其他原因" />
|
||||||
</uni-forms-item> -->
|
</uni-forms-item> -->
|
||||||
<uni-forms-item label="附件">
|
<uni-forms-item label="附件">
|
||||||
<div class="upload" @click="uploadScrapImg" v-if="imgBeseUrl2==''">+</div>
|
<div class="upload" @click="uploadScrapImg" v-if="imgBeseUrl2 == ''">+</div>
|
||||||
<div class="upload" @click="uploadScrapImg" v-else>
|
<div class="upload" @click="uploadScrapImg" v-else>
|
||||||
<image :src="imgBeseUrl2" style="width: 160rpx;height: 160rpx;" mode=""></image>
|
<image
|
||||||
|
:src="imgBeseUrl2"
|
||||||
|
style="width: 160rpx; height: 160rpx"
|
||||||
|
mode=""
|
||||||
|
></image>
|
||||||
</div>
|
</div>
|
||||||
</uni-forms-item>
|
</uni-forms-item>
|
||||||
</uni-forms>
|
</uni-forms>
|
||||||
|
|
@ -195,18 +217,25 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { computed, ref } from 'vue'
|
import { computed, ref, reactive } from 'vue'
|
||||||
import { partTypeTreeList, getSupplierList, getRepairerListApi,saveRepairRow } from '@/services/repair/repair.js'
|
import {
|
||||||
|
partTypeTreeList,
|
||||||
|
getSupplierList,
|
||||||
|
getRepairerListApi,
|
||||||
|
saveRepairRow,
|
||||||
|
getScrapReasonList,
|
||||||
|
} 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/tselect.vue'
|
||||||
import { onLoad } from '@dcloudio/uni-app'
|
import { onLoad } from '@dcloudio/uni-app'
|
||||||
const queryParams = ref({})
|
const queryParams = ref({})
|
||||||
const rowIndex = ref(-1)
|
const rowIndex = ref(-1)
|
||||||
onLoad((options) => {
|
onLoad((options) => {
|
||||||
console.log(options)
|
console.log(options)
|
||||||
queryParams.value = JSON.parse(options.queryParams)
|
queryParams.value = JSON.parse(options.queryParams)
|
||||||
rowIndex.value = options.rowIndex;
|
rowIndex.value = options.rowIndex
|
||||||
console.log(queryParams.value)
|
console.log(queryParams.value)
|
||||||
|
getScrapReasonListData()
|
||||||
})
|
})
|
||||||
const repairType = ref(1)
|
const repairType = ref(1)
|
||||||
const changeTab = async (e) => {
|
const changeTab = async (e) => {
|
||||||
|
|
@ -221,12 +250,40 @@ const isChargeList = ref([
|
||||||
{ value: 0, text: '否' },
|
{ value: 0, text: '否' },
|
||||||
])
|
])
|
||||||
|
|
||||||
|
const { userInfo } = JSON.parse(uni.getStorageSync('member'))
|
||||||
|
// console.log('🚀 ~ userInfo:', userInfo)
|
||||||
|
|
||||||
|
// 报废原因
|
||||||
|
const scrapReasonList = ref([])
|
||||||
|
const getScrapReasonListData = async () => {
|
||||||
|
const params = {
|
||||||
|
typeId: queryParams.value.typeId,
|
||||||
|
}
|
||||||
|
const res = await getScrapReasonList(params)
|
||||||
|
scrapReasonList.value = res.data.map((item) => {
|
||||||
|
let obj = {
|
||||||
|
value: item.id,
|
||||||
|
text: item.reason,
|
||||||
|
}
|
||||||
|
return obj
|
||||||
|
})
|
||||||
|
console.log('🚀 ~ 报废原因下拉 ~ res:', res)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 报废原因change事件
|
||||||
|
const changeScrap = (val) => {
|
||||||
|
console.log('🚀 ~ changeScrap ~ val:', val)
|
||||||
|
const scrapReason = scrapReasonList.value.find((v) => v.value === val)
|
||||||
|
console.log('🚀 ~ changeScrap ~ scrapReason:', scrapReason)
|
||||||
|
formRight.value.scrapReason = scrapReason.text
|
||||||
|
}
|
||||||
|
|
||||||
//获取维修人员
|
//获取维修人员
|
||||||
const repairPersonData = ref([])
|
const repairPersonData = ref([])
|
||||||
const repairPerson = ref("")
|
const repairPerson = ref('')
|
||||||
const getRepairerListData = async () => {
|
const getRepairerListData = async () => {
|
||||||
const res = await getRepairerListApi({})
|
const res = await getRepairerListApi({})
|
||||||
console.log(res)
|
console.log(res)
|
||||||
repairPersonData.value = res.data.map((item) => {
|
repairPersonData.value = res.data.map((item) => {
|
||||||
let obj = {
|
let obj = {
|
||||||
value: item.userId,
|
value: item.userId,
|
||||||
|
|
@ -234,91 +291,100 @@ const getRepairerListData = async () => {
|
||||||
}
|
}
|
||||||
return obj
|
return obj
|
||||||
})
|
})
|
||||||
|
// 如果 userInfo.userId 在repairPersonData.value 数组中说明是维修人员,则默认选中, 否则默认选中第一个
|
||||||
|
if (
|
||||||
|
repairPersonData.value &&
|
||||||
|
repairPersonData.value.findIndex((v) => v.value === userInfo.userId) > -1
|
||||||
|
) {
|
||||||
|
repairPerson.value = userInfo.userId
|
||||||
|
} else {
|
||||||
|
repairPerson.value = repairPersonData.value[0].value
|
||||||
|
}
|
||||||
}
|
}
|
||||||
getRepairerListData()
|
getRepairerListData()
|
||||||
|
|
||||||
const remark = ref("") //备注
|
const remark = ref('') //备注
|
||||||
|
|
||||||
const imgBeseUrl = ref("") //图片展示
|
const imgBeseUrl = ref('') //图片展示
|
||||||
const bmFileInfos = ref([])//图片数组
|
const bmFileInfos = ref([]) //图片数组
|
||||||
//上传
|
//上传
|
||||||
const uploadImg = () => {
|
const uploadImg = () => {
|
||||||
uni.chooseImage({
|
uni.chooseImage({
|
||||||
count: 1, //图片可选择数量
|
count: 1, //图片可选择数量
|
||||||
sizeType: ['original', 'compressed'], //original 原图,compressed 压缩图,默认二者都有
|
sizeType: ['original', 'compressed'], //original 原图,compressed 压缩图,默认二者都有
|
||||||
sourceType: ['album', 'camera',], //album 从相册选图,camera 使用相机,默认二者都有。
|
sourceType: ['album', 'camera'], //album 从相册选图,camera 使用相机,默认二者都有。
|
||||||
success: res => {
|
success: (res) => {
|
||||||
console.log(res)
|
console.log(res)
|
||||||
let imgFiles = res.tempFilePaths //图片的本地文件路径列表
|
let imgFiles = res.tempFilePaths //图片的本地文件路径列表
|
||||||
imgBeseUrl.value = imgFiles[0]
|
imgBeseUrl.value = imgFiles[0]
|
||||||
// console.log('请求地址', baseURL+"/file/upload")
|
// console.log('请求地址', baseURL+"/file/upload")
|
||||||
uni.uploadFile({
|
uni.uploadFile({
|
||||||
// url: baseURL+"/file/upload",//app
|
// url: baseURL+"/file/upload",//app
|
||||||
url: "/file/upload",//h5
|
url: '/file/upload', //h5
|
||||||
filePath: imgFiles[0],
|
filePath: imgFiles[0],
|
||||||
name: 'file',
|
name: 'file',
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
res = JSON.parse(res.data)
|
res = JSON.parse(res.data)
|
||||||
console.log('上传成功', res);
|
console.log('上传成功', res)
|
||||||
|
|
||||||
if(res.code&&res.code==200){
|
if (res.code && res.code == 200) {
|
||||||
let obj = {
|
let obj = {
|
||||||
"name":res.data.name,
|
name: res.data.name,
|
||||||
"url":res.data.url
|
url: res.data.url,
|
||||||
}
|
}
|
||||||
bmFileInfos.value = [obj]
|
bmFileInfos.value = [obj]
|
||||||
console.log('上传成功', bmFileInfos.value);
|
console.log('上传成功', bmFileInfos.value)
|
||||||
uni.showToast({ title: '上传成功', icon: 'none' })
|
uni.showToast({ title: '上传成功', icon: 'none' })
|
||||||
}else{
|
} else {
|
||||||
bmFileInfos.value = []
|
bmFileInfos.value = []
|
||||||
uni.showToast({ title: '上传失败', icon: 'none' })
|
uni.showToast({ title: '上传失败', icon: 'none' })
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
fail: (err) => {
|
fail: (err) => {
|
||||||
console.error('上传失败', err);
|
console.error('上传失败', err)
|
||||||
}
|
},
|
||||||
});
|
})
|
||||||
}
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
//配件树
|
//配件树
|
||||||
const partTreeData = ref([])
|
const partTreeData = ref([])
|
||||||
const defaultProps = ref({
|
const defaultProps = ref({
|
||||||
id: 'id',
|
id: 'id',
|
||||||
children: 'children',
|
children: 'children',
|
||||||
label: 'label'
|
label: 'label',
|
||||||
})
|
})
|
||||||
const getPartTreeData = async () => {
|
const getPartTreeData = async () => {
|
||||||
const res = await partTypeTreeList({})
|
const res = await partTypeTreeList({})
|
||||||
partTreeData.value = res.data;
|
partTreeData.value = res.data
|
||||||
}
|
}
|
||||||
getPartTreeData()
|
getPartTreeData()
|
||||||
const treeSelectRef = ref([])
|
const treeSelectRef = ref([])
|
||||||
const clearPart = (index) =>{
|
const clearPart = (index) => {
|
||||||
partItems.value[index].partId=""
|
partItems.value[index].partId = ''
|
||||||
}
|
}
|
||||||
const partTreeChange = (val,index) =>{
|
const partTreeChange = (val, index) => {
|
||||||
const isHas = partItems.value.findIndex(v => v.partId === val.id)
|
const isHas = partItems.value.findIndex((v) => v.partId === val.id)
|
||||||
if (isHas > -1) {//不可选择相同的配件
|
if (isHas > -1) {
|
||||||
console.log(isHas)
|
//不可选择相同的配件
|
||||||
uni.showToast({ title: '已存在该配件类型', icon: 'none' })
|
console.log(isHas)
|
||||||
treeSelectRef.value[index].clearInput();
|
uni.showToast({ title: '已存在该配件类型', icon: 'none' })
|
||||||
partItems.value[index].partId="";
|
treeSelectRef.value[index].clearInput()
|
||||||
partItems.value[index].storageNum="";
|
partItems.value[index].partId = ''
|
||||||
partItems.value[index].partNum=0;
|
partItems.value[index].storageNum = ''
|
||||||
}else{
|
partItems.value[index].partNum = 0
|
||||||
partItems.value[index].partId=val.id;
|
} else {
|
||||||
partItems.value[index].storageNum=val.storageNum;
|
partItems.value[index].partId = val.id
|
||||||
partItems.value[index].partNum=0;
|
partItems.value[index].storageNum = val.storageNum
|
||||||
}
|
partItems.value[index].partNum = 0
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//内部维修
|
//内部维修
|
||||||
const partItems = ref([{ partNum: '', partType: 0, partId: '', storageNum: ''}])
|
const partItems = ref([{ partNum: '', partType: 0, partId: '', storageNum: '' }])
|
||||||
const addPart = () => {
|
const addPart = () => {
|
||||||
partItems.value.push({ partNum: '', partType: 0, partId: '' ,storageNum: ''})
|
partItems.value.push({ partNum: '', partType: 0, partId: '', storageNum: '' })
|
||||||
}
|
}
|
||||||
const delPart = (index) => {
|
const delPart = (index) => {
|
||||||
if (partItems.value.length > 1) {
|
if (partItems.value.length > 1) {
|
||||||
|
|
@ -330,7 +396,6 @@ const formLeft = ref({
|
||||||
// repairNum:0
|
// repairNum:0
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
//返厂维修
|
//返厂维修
|
||||||
const partsMillList = ref([])
|
const partsMillList = ref([])
|
||||||
const getSupplierListData = async () => {
|
const getSupplierListData = async () => {
|
||||||
|
|
@ -369,49 +434,50 @@ const formMiddle = ref({
|
||||||
//待报废
|
//待报废
|
||||||
const formRight = ref({
|
const formRight = ref({
|
||||||
// scrapNum:0,
|
// scrapNum:0,
|
||||||
scrapType:0,
|
scrapType: 0,
|
||||||
scrapReason: '',
|
scrapId: null, // 报废原因id
|
||||||
fileList:[]
|
scrapReason: '', // 报废原因
|
||||||
|
fileList: [],
|
||||||
})
|
})
|
||||||
const imgBeseUrl2 = ref("") //图片展示
|
const imgBeseUrl2 = ref('') //图片展示
|
||||||
//上传
|
//上传
|
||||||
const uploadScrapImg = () => {
|
const uploadScrapImg = () => {
|
||||||
uni.chooseImage({
|
uni.chooseImage({
|
||||||
count: 1, //图片可选择数量
|
count: 1, //图片可选择数量
|
||||||
sizeType: ['original', 'compressed'], //original 原图,compressed 压缩图,默认二者都有
|
sizeType: ['original', 'compressed'], //original 原图,compressed 压缩图,默认二者都有
|
||||||
sourceType: ['album', 'camera',], //album 从相册选图,camera 使用相机,默认二者都有。
|
sourceType: ['album', 'camera'], //album 从相册选图,camera 使用相机,默认二者都有。
|
||||||
success: res => {
|
success: (res) => {
|
||||||
console.log(res)
|
console.log(res)
|
||||||
let imgFiles = res.tempFilePaths //图片的本地文件路径列表
|
let imgFiles = res.tempFilePaths //图片的本地文件路径列表
|
||||||
imgBeseUrl2.value = imgFiles[0]
|
imgBeseUrl2.value = imgFiles[0]
|
||||||
// console.log('请求地址', baseURL+"/file/upload")
|
// console.log('请求地址', baseURL+"/file/upload")
|
||||||
uni.uploadFile({
|
uni.uploadFile({
|
||||||
// url: baseURL+"/file/upload",//app
|
// url: baseURL+"/file/upload",//app
|
||||||
url: "/file/upload",//h5
|
url: '/file/upload', //h5
|
||||||
filePath: imgFiles[0],
|
filePath: imgFiles[0],
|
||||||
name: 'file',
|
name: 'file',
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
res = JSON.parse(res.data)
|
res = JSON.parse(res.data)
|
||||||
console.log('上传成功', res);
|
console.log('上传成功', res)
|
||||||
|
|
||||||
if(res.code&&res.code==200){
|
if (res.code && res.code == 200) {
|
||||||
let obj = {
|
let obj = {
|
||||||
"name":res.data.name,
|
name: res.data.name,
|
||||||
"url":res.data.url
|
url: res.data.url,
|
||||||
}
|
}
|
||||||
formRight.value.fileList = [obj]
|
formRight.value.fileList = [obj]
|
||||||
uni.showToast({ title: '上传成功', icon: 'none' })
|
uni.showToast({ title: '上传成功', icon: 'none' })
|
||||||
}else{
|
} else {
|
||||||
formRight.value.fileList = []
|
formRight.value.fileList = []
|
||||||
uni.showToast({ title: '上传失败', icon: 'none' })
|
uni.showToast({ title: '上传失败', icon: 'none' })
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
fail: (err) => {
|
fail: (err) => {
|
||||||
console.error('上传失败', err);
|
console.error('上传失败', err)
|
||||||
}
|
},
|
||||||
});
|
})
|
||||||
}
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const rowData = ref({})
|
const rowData = ref({})
|
||||||
|
|
@ -421,13 +487,13 @@ const partCheckNum = (item) => {
|
||||||
// console.log(item.partNum)
|
// console.log(item.partNum)
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
item.partNum = Number(String(item.partNum).replace(/[^\d.]/g, ''))
|
item.partNum = Number(String(item.partNum).replace(/[^\d.]/g, ''))
|
||||||
if(item.storageNum){
|
if (item.storageNum) {
|
||||||
// console.log(item.partNum)
|
// console.log(item.partNum)
|
||||||
// console.log(item.storageNum)
|
// console.log(item.storageNum)
|
||||||
if(Number(item.partNum)>=Number(item.storageNum)){
|
if (Number(item.partNum) >= Number(item.storageNum)) {
|
||||||
item.partNum=Number(item.storageNum)
|
item.partNum = Number(item.storageNum)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, 500)
|
}, 500)
|
||||||
}
|
}
|
||||||
// 金额框change事件
|
// 金额框change事件
|
||||||
|
|
@ -440,126 +506,119 @@ const costCheckNum = (item) => {
|
||||||
}
|
}
|
||||||
//维修完成校验
|
//维修完成校验
|
||||||
const saveCode = () => {
|
const saveCode = () => {
|
||||||
if(repairType.value == 1){
|
if (repairType.value == 1) {
|
||||||
let index1=partItems.value.findIndex(v=>v.partId=="")
|
let index1 = partItems.value.findIndex((v) => v.partId == '')
|
||||||
let index2=partItems.value.findIndex(v=>v.partNum==0)
|
let index2 = partItems.value.findIndex((v) => v.partNum == 0)
|
||||||
if(repairPerson.value==""){
|
if (repairPerson.value == '') {
|
||||||
uni.showToast({ title: '请先选择维修人员!', icon: 'none' })
|
uni.showToast({ title: '请先选择维修人员!', icon: 'none' })
|
||||||
}else if(index1>-1){
|
} else if (index1 > -1) {
|
||||||
uni.showToast({ title: '请先选择配件类型!', icon: 'none' })
|
uni.showToast({ title: '请先选择配件类型!', icon: 'none' })
|
||||||
}else if(index2>-1){
|
} else if (index2 > -1) {
|
||||||
uni.showToast({ title: '请填写配件数量!', icon: 'none' })
|
uni.showToast({ title: '请填写配件数量!', icon: 'none' })
|
||||||
}else{
|
} else {
|
||||||
saveCodeApi()
|
saveCodeApi()
|
||||||
}
|
}
|
||||||
}else if(repairType.value == 2){
|
} else if (repairType.value == 2) {
|
||||||
let index1=partItemsMiddle.value.findIndex(v=>v.partName=="")
|
let index1 = partItemsMiddle.value.findIndex((v) => v.partName == '')
|
||||||
let index2=partItemsMiddle.value.findIndex(v=>v.supplierId=="")
|
let index2 = partItemsMiddle.value.findIndex((v) => v.supplierId == '')
|
||||||
let index3=partItemsMiddle.value.findIndex(v=>v.partNum==0)
|
let index3 = partItemsMiddle.value.findIndex((v) => v.partNum == 0)
|
||||||
if(repairPerson.value==""){
|
if (repairPerson.value == '') {
|
||||||
uni.showToast({ title: '请先选择维修人员!', icon: 'none' })
|
uni.showToast({ title: '请先选择维修人员!', icon: 'none' })
|
||||||
}else if(index1>-1){
|
} else if (index1 > -1) {
|
||||||
uni.showToast({ title: '请先填写配件名称!', icon: 'none' })
|
uni.showToast({ title: '请先填写配件名称!', icon: 'none' })
|
||||||
}else if(index2>-1){
|
} else if (index2 > -1) {
|
||||||
uni.showToast({ title: '请选择物资厂家!', icon: 'none' })
|
uni.showToast({ title: '请选择物资厂家!', icon: 'none' })
|
||||||
}else if(index3>-1){
|
} else if (index3 > -1) {
|
||||||
uni.showToast({ title: '请填写配件数量!', icon: 'none' })
|
uni.showToast({ title: '请填写配件数量!', icon: 'none' })
|
||||||
}else{
|
} else {
|
||||||
saveCodeApi()
|
saveCodeApi()
|
||||||
}
|
}
|
||||||
}else if(repairType.value == 3){
|
} else if (repairType.value == 3) {
|
||||||
console.log(formRight.value)
|
console.log(formRight.value)
|
||||||
//formRight.value
|
if (repairPerson.value == '') {
|
||||||
if(repairPerson.value==""){
|
uni.showToast({ title: '请先选择维修人员!', icon: 'none' })
|
||||||
uni.showToast({ title: '请先选择维修人员!', icon: 'none' })
|
} else if (formRight.value.scrapReason == '') {
|
||||||
}else if(formRight.value.scrapReason==""){
|
uni.showToast({ title: '请选择报废原因', icon: 'none' })
|
||||||
uni.showToast({ title: '请先填写报废原因', icon: 'none' })
|
} else {
|
||||||
}else{
|
saveCodeApi()
|
||||||
saveCodeApi()
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
//维修完成请求
|
//维修完成请求
|
||||||
const saveCodeApi = async () => {
|
const saveCodeApi = async () => {
|
||||||
console.log("维修完成请求")
|
//请求接口
|
||||||
//请求接口
|
rowData.value = queryParams.value
|
||||||
rowData.value = queryParams.value;
|
//维修人员
|
||||||
//维修人员
|
rowData.value.repairDeviceList[rowIndex.value].repairList = [
|
||||||
rowData.value.repairDeviceList[rowIndex.value].repairList=[
|
{
|
||||||
{
|
repairer: repairPerson.value,
|
||||||
repairer:repairPerson.value,
|
remark: remark.value,
|
||||||
remark:remark.value,
|
fileList: bmFileInfos.value,
|
||||||
fileList:bmFileInfos.value
|
},
|
||||||
}
|
]
|
||||||
]
|
if (repairType.value == 1) {
|
||||||
if (repairType.value == 1) {
|
for (let i = 0; i < partItems.value.length; i++) {
|
||||||
for (let i = 0; i < partItems.value.length; i++) {
|
rowData.value.repairDeviceList[rowIndex.value].codeInRepairPartList.push({
|
||||||
rowData.value.repairDeviceList[rowIndex.value].codeInRepairPartList.push({
|
partType: partItems.value[i].partType,
|
||||||
partType: partItems.value[i].partType,
|
partId: partItems.value[i].partId,
|
||||||
partId: partItems.value[i].partId,
|
partNum: partItems.value[i].partNum,
|
||||||
partNum: partItems.value[i].partNum,
|
storageNum: partItems.value[i].storageNum,
|
||||||
storageNum: partItems.value[i].storageNum,
|
// repairNum: formLeft.value.repairNum,
|
||||||
// repairNum: formLeft.value.repairNum,
|
})
|
||||||
})
|
}
|
||||||
}
|
} else if (repairType.value == 2) {
|
||||||
} else if (repairType.value == 2) {
|
for (let i = 0; i < partItemsMiddle.value.length; i++) {
|
||||||
for (let i = 0; i < partItemsMiddle.value.length; i++) {
|
rowData.value.repairDeviceList[rowIndex.value].codeOutRepairPartList.push({
|
||||||
rowData.value.repairDeviceList[rowIndex.value].codeOutRepairPartList.push({
|
partType: partItemsMiddle.value[i].partType,
|
||||||
partType: partItemsMiddle.value[i].partType,
|
partPrice: partItemsMiddle.value[i].partPrice,
|
||||||
partPrice: partItemsMiddle.value[i].partPrice,
|
partNum: partItemsMiddle.value[i].partNum,
|
||||||
partNum: partItemsMiddle.value[i].partNum,
|
partName: partItemsMiddle.value[i].partName,
|
||||||
partName: partItemsMiddle.value[i].partName,
|
supplierId: partItemsMiddle.value[i].supplierId,
|
||||||
supplierId: partItemsMiddle.value[i].supplierId,
|
// repairNum: formMiddle.value.repairNum,
|
||||||
// repairNum: formMiddle.value.repairNum,
|
})
|
||||||
})
|
}
|
||||||
}
|
} else if (repairType.value == 3) {
|
||||||
} else if (repairType.value == 3) {
|
rowData.value.repairDeviceList[rowIndex.value].codeScrapRepairPartList.push(formRight.value)
|
||||||
rowData.value.repairDeviceList[rowIndex.value].codeScrapRepairPartList.push(formRight.value)
|
}
|
||||||
}
|
rowData.value.repairDeviceList[rowIndex.value].repairType = repairType.value
|
||||||
rowData.value.repairDeviceList[rowIndex.value].repairType = repairType.value;
|
console.log(rowData.value.repairDeviceList)
|
||||||
console.log(rowData.value.repairDeviceList)
|
saveRepairRow(rowData.value.repairDeviceList).then(async (response) => {
|
||||||
saveRepairRow(rowData.value.repairDeviceList).then(async (response) => {
|
if (response.code == 200) {
|
||||||
if (response.code == 200) {
|
uni.showToast({ title: '保存成功', icon: 'none' })
|
||||||
uni.showToast({ title: '保存成功', icon: 'none' })
|
uni.navigateBack({
|
||||||
uni.navigateBack({
|
delta: 2, // 返回到已存在的页面
|
||||||
delta: 2, // 返回到已存在的页面
|
})
|
||||||
})
|
}
|
||||||
}
|
})
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
// 上传区域样式
|
// 上传区域样式
|
||||||
.upload {
|
.upload {
|
||||||
width: 160rpx;
|
width: 160rpx;
|
||||||
height: 160rpx;
|
height: 160rpx;
|
||||||
background-color: #f7f8fa;
|
background-color: #f7f8fa;
|
||||||
border: 2rpx dashed #d9d9d9;
|
border: 2rpx dashed #d9d9d9;
|
||||||
border-radius: 12rpx;
|
border-radius: 12rpx;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
font-size: 48rpx;
|
font-size: 48rpx;
|
||||||
color: #bfbfbf;
|
color: #bfbfbf;
|
||||||
transition: all 0.3s ease;
|
transition: all 0.3s ease;
|
||||||
|
|
||||||
&:active {
|
&:active {
|
||||||
background-color: #f0f0f0;
|
background-color: #f0f0f0;
|
||||||
border-color: #3784fb;
|
border-color: #3784fb;
|
||||||
}
|
}
|
||||||
|
|
||||||
image {
|
image {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
border-radius: 12rpx;
|
border-radius: 12rpx;
|
||||||
object-fit: cover;
|
object-fit: cover;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.page-container {
|
.page-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
|
||||||
|
|
@ -104,3 +104,12 @@ export const getDetailsListApi = (data) => {
|
||||||
data,
|
data,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 报废原因
|
||||||
|
export const getScrapReasonList = (data) => {
|
||||||
|
return http({
|
||||||
|
method: 'GET',
|
||||||
|
url: '/material/scrap_reason/getList',
|
||||||
|
data,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue