Browse Source

feat: 修复生产bug

master
ljlong_2630 2 months ago
parent
commit
cdd8a7508f
  1. 2
      src/components/item/slectItemList.vue
  2. 76
      src/pages/sparePartsServiceWorkOrderList/addForm.vue

2
src/components/item/slectItemList.vue

@ -4,7 +4,7 @@
<view class="popup-title">选择备件</view> <view class="popup-title">选择备件</view>
<view class="popup"> <view class="popup">
<u-search placeholder="搜索" v-model="form1.searchName" @change="searchItem" clearabled=false></u-search> <u-search placeholder="搜索" v-model="form1.searchName" @change="searchItem" clearabled=false></u-search>
<view class="list"> <view class="list" :style="{ overflowY: 'auto', maxHeight: '500px' }">
<view class="item" v-for="(item, index) in singleColumnList" :key="index" @click="chooseItem(item)"> <view class="item" v-for="(item, index) in singleColumnList" :key="index" @click="chooseItem(item)">
<u-checkbox v-model="item.checked" shape="circle" style="margin-top: 8rpx;"></u-checkbox> <u-checkbox v-model="item.checked" shape="circle" style="margin-top: 8rpx;"></u-checkbox>
<view class="right"> <view class="right">

76
src/pages/sparePartsServiceWorkOrderList/addForm.vue

@ -97,6 +97,7 @@
</u-popup> </u-popup>
<u-select v-model="singleColumnShow" mode="single-column" :default-value='singleColumnDefaultValue' <u-select v-model="singleColumnShow" mode="single-column" :default-value='singleColumnDefaultValue'
:list="singleColumnList" @confirm="chooseSingleColumn" @cancle='singleColumnShow = false'></u-select> :list="singleColumnList" @confirm="chooseSingleColumn" @cancle='singleColumnShow = false'></u-select>
<SelectItemList :isShowSelectItem='isShowSelectItem' :singleColumnList='singleColumnList' @searchItem='searchItem' @chooseItem1='chooseItem1'/>
</view> </view>
</template> </template>
@ -112,6 +113,7 @@
import * as sparePartsServiceWorkOrderListApi from "@/api/sparePartsServiceWorkOrderList" import * as sparePartsServiceWorkOrderListApi from "@/api/sparePartsServiceWorkOrderList"
import * as dictApi from "@/api/dict" import * as dictApi from "@/api/dict"
import * as locationApi from "@/api/location" import * as locationApi from "@/api/location"
import SelectItemList from "../../components/item/slectItemList.vue"
const { proxy } = getCurrentInstance() const { proxy } = getCurrentInstance()
const loading = ref(false) const loading = ref(false)
const type = ref('') const type = ref('')
@ -122,8 +124,8 @@
const singleColumnShow = ref(false) const singleColumnShow = ref(false)
const singleColumnDefaultValue = ref([]) const singleColumnDefaultValue = ref([])
const singleColumnList = ref([]) const singleColumnList = ref([])
const isShowSelectItem = ref(false)
const field = ref('') const field = ref('')
const form = ref({ const form = ref({
itemNumbers: [] itemNumbers: []
}) })
@ -185,6 +187,10 @@
// //
function openSingleColumn(fieldName, val, list) { function openSingleColumn(fieldName, val, list) {
if (fieldName == 'deviceNumber' && form.value.id) return; if (fieldName == 'deviceNumber' && form.value.id) return;
uni.showLoading({
title: "加载中....",
mask: true
});
singleColumnList.value = list singleColumnList.value = list
field.value = fieldName field.value = fieldName
if (val) { if (val) {
@ -192,7 +198,7 @@
} else { } else {
singleColumnDefaultValue.value = [] singleColumnDefaultValue.value = []
} }
singleColumnShow.value = true isShowSelectItem.value = true
} }
// //
function chooseSingleColumn(e) { function chooseSingleColumn(e) {
@ -213,13 +219,20 @@
} }
// //
async function getServiceSparePartsList() { async function getServiceSparePartsList() {
uni.showLoading({
title: "加载中....",
mask: true
});
await sparePartsApi.getServiceSparePartsList().then(res => { await sparePartsApi.getServiceSparePartsList().then(res => {
res.data.map(item => { res.data.map(item => {
item.value = item.number item.value = item.number
item.label = item.name item.label = item.name
}) })
sparePartsList.value = res.data sparePartsList.value = res.data
}).catch(() => { }) }).catch(() => { }).finally(()=>{
uni.hideLoading()
})
} }
// //
function chickRightButton(field) { function chickRightButton(field) {
@ -320,6 +333,63 @@
function delSpareParts(index) { function delSpareParts(index) {
form.value.itemNumbers.splice(index, 1) form.value.itemNumbers.splice(index, 1)
} }
async function searchItem(name){
uni.showLoading({
title: "加载中....",
mask: true
});
await getSparePartsList(name);
}
//
async function getSparePartsList(name) {
let param = {
name:name
}
await sparePartsApi.getSparePartsList(param).then(res => {
res.data.map(item => {
item.value = item.number
item.label = item.name
})
sparePartsList.value = res.data
singleColumnList.value = sparePartsList.value
uni.hideLoading()
}).catch(() => {
uni.hideLoading()
})
}
async function chooseItem1(type, form) {
if (!form.value.number && type == 1) {
proxy.$modal.showToast('请选择备件');
return;
}
uni.showLoading({
title: "加载中....",
mask: true
});
form1.value['itemNumber'] = form.value.number
choosesingleColumnItem.value = sparePartsList.value.filter(item => item.number == form.value.number)
form1.value.name = form.value.name
form1.value.locationNumber = choosesingleColumnItem.value[0].locationNumber
form1.value.areaNumber = choosesingleColumnItem.value[0].areaNumber
if (!choosesingleColumnItem.value[0].locationNumber) {
isShow.value = true
} else {
isShow.value = false
itemNumber.value = ''
}
await getSparePartsList(null);
isShowSelectItem.value = false;
uni.hideLoading()
}
onLoad(async (option) => { onLoad(async (option) => {
if (option.type) type.value = option.type; if (option.type) type.value = option.type;
result.value = await dictApi.getDict('result') result.value = await dictApi.getDict('result')

Loading…
Cancel
Save