This commit is contained in:
parent
c1d0664cdb
commit
2f14c19c1b
|
|
@ -22,9 +22,9 @@
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="popup" @click="handlePopup">{{ typeName }}</div>
|
<div v-if="typeList.length > 1" class="popup" @click="handlePopup">{{ typeName || '请选择对应机具' }}</div>
|
||||||
|
|
||||||
<div class="search-item">
|
<div class="search-item" v-if="typeList.length > 0">
|
||||||
<div>设备类型:{{ formData.maType }}</div>
|
<div>设备类型:{{ formData.maType }}</div>
|
||||||
<div>规格型号:{{ formData.typeName }}</div>
|
<div>规格型号:{{ formData.typeName }}</div>
|
||||||
<div>设备编码:{{ formData.code }}</div>
|
<div>设备编码:{{ formData.code }}</div>
|
||||||
|
|
@ -32,7 +32,7 @@
|
||||||
<div>本次检修时间:{{ formData.repairTime }}</div>
|
<div>本次检修时间:{{ formData.repairTime }}</div>
|
||||||
<div>下次检修时间:{{ formData.nextRepairTime }}</div>
|
<div>下次检修时间:{{ formData.nextRepairTime }}</div>
|
||||||
</div>
|
</div>
|
||||||
<button type="primary" size="mini" @click="handleSubmit"
|
<button v-if="typeList.length > 0" type="primary" size="mini" @click="handleSubmit"
|
||||||
style="margin-top: 30px; background-color: #18bc37; width: 100%">
|
style="margin-top: 30px; background-color: #18bc37; width: 100%">
|
||||||
确认修改
|
确认修改
|
||||||
</button>
|
</button>
|
||||||
|
|
@ -69,7 +69,7 @@
|
||||||
})
|
})
|
||||||
const scanQrCodeRef = ref()
|
const scanQrCodeRef = ref()
|
||||||
const popup = ref()
|
const popup = ref()
|
||||||
const typeName = ref('请选择对应机具')
|
const typeName = ref('')
|
||||||
const typeList = ref([])
|
const typeList = ref([])
|
||||||
const range = ref([{ value: 0, text: '' }])
|
const range = ref([{ value: 0, text: '' }])
|
||||||
|
|
||||||
|
|
@ -90,24 +90,30 @@
|
||||||
|
|
||||||
const handleSearch = () => {
|
const handleSearch = () => {
|
||||||
console.log('🚀 ~ handleSearch ~ 查询:', keyWord.value)
|
console.log('🚀 ~ handleSearch ~ 查询:', keyWord.value)
|
||||||
if (!keyWord.value) {
|
// typeList.value =[];
|
||||||
uni.showToast({
|
reset()
|
||||||
title: '请输入设备编码',
|
|
||||||
icon: 'none',
|
|
||||||
})
|
|
||||||
}
|
|
||||||
typeList.value =[];
|
|
||||||
getWsMaInfoList({ maCode: keyWord.value }).then(res => {
|
getWsMaInfoList({ maCode: keyWord.value }).then(res => {
|
||||||
if (res.code === 200) {
|
if (res.code === 200 && res.data && res.data.length > 0) {
|
||||||
typeList.value = res.data.map(option => {
|
typeList.value = res.data.map(option => {
|
||||||
return {
|
return {
|
||||||
id: option.id,
|
id: option.id,
|
||||||
name: option.maName + option.maModel,
|
name: option.maName + '-' + option.maModel + '-' + option.maCode,
|
||||||
isChecked: 1,
|
isChecked: 1,
|
||||||
item: option
|
item: option
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
if (res.data.length === 1) {
|
||||||
|
console.log('🚀 ~ getWsMaInfoList ~ res.data.length:', res.data.length)
|
||||||
|
formData.id = res.data[0].id
|
||||||
|
formData.code = res.data[0].maCode
|
||||||
|
formData.maType = res.data[0].maName
|
||||||
|
formData.nextRepairTime = res.data[0].nextCheckTime
|
||||||
|
formData.repairTime = res.data[0].thisCheckTime
|
||||||
|
formData.typeName = res.data[0].maModel
|
||||||
|
formData.repairer = res.data[0].repairMan
|
||||||
|
console.log('🚀 ~ getWsMaInfoList ~ formData:', formData)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
console.log(error)
|
console.log(error)
|
||||||
|
|
@ -126,7 +132,6 @@
|
||||||
i.isChecked = i.id === item.id ? 0 : 1
|
i.isChecked = i.id === item.id ? 0 : 1
|
||||||
})
|
})
|
||||||
|
|
||||||
typeName.value = item.item.name
|
|
||||||
formData.id = item.item.id
|
formData.id = item.item.id
|
||||||
formData.code = item.item.maCode
|
formData.code = item.item.maCode
|
||||||
formData.maType = item.item.maName
|
formData.maType = item.item.maName
|
||||||
|
|
@ -154,6 +159,14 @@
|
||||||
console.error('扫描出错:', error.message)
|
console.error('扫描出错:', error.message)
|
||||||
uni.showToast({ title: error.message, icon: 'none' })
|
uni.showToast({ title: error.message, icon: 'none' })
|
||||||
}
|
}
|
||||||
|
// 清空表单
|
||||||
|
const reset = () => {
|
||||||
|
Object.keys(formData).forEach(key => {
|
||||||
|
formData[key] = ''
|
||||||
|
})
|
||||||
|
typeName.value = ''
|
||||||
|
typeList.value = []
|
||||||
|
}
|
||||||
|
|
||||||
// 提交
|
// 提交
|
||||||
const handleSubmit = () => {
|
const handleSubmit = () => {
|
||||||
|
|
@ -163,6 +176,8 @@
|
||||||
title: res.msg,
|
title: res.msg,
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
})
|
})
|
||||||
|
|
||||||
|
handleSearch()
|
||||||
}
|
}
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
console.log(error)
|
console.log(error)
|
||||||
|
|
@ -179,11 +194,12 @@
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
|
margin-bottom: 30px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.popup {
|
.popup {
|
||||||
background: #fff;
|
background: #fff;
|
||||||
margin: 20px 0 30px;
|
margin: 0 0 30px;
|
||||||
padding: 5px 10px;
|
padding: 5px 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -202,7 +218,8 @@
|
||||||
|
|
||||||
::v-deep .uni-popup__wrapper {
|
::v-deep .uni-popup__wrapper {
|
||||||
width: calc(100% - 20px);
|
width: calc(100% - 20px);
|
||||||
/* padding: 10px; */
|
max-height: 80vh;
|
||||||
|
overflow: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
::v-deep .uni-data-checklist {
|
::v-deep .uni-data-checklist {
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,14 @@
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="popup" style="margin: 20px 0 30px" @click="handlePopup(1)">{{ typeName || '请选择对应机具' }}</div>
|
<div
|
||||||
|
v-if="typeList.length > 1"
|
||||||
|
class="popup"
|
||||||
|
style="margin-bottom: 30px"
|
||||||
|
@click="handlePopup(1)"
|
||||||
|
>
|
||||||
|
{{ typeName || '请选择对应机具' }}
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="search-item">
|
<div class="search-item">
|
||||||
<div>设备类型:{{ formData.materialName }}</div>
|
<div>设备类型:{{ formData.materialName }}</div>
|
||||||
|
|
@ -154,6 +161,7 @@ const getInfo = () => {
|
||||||
maCode: keyWord.value,
|
maCode: keyWord.value,
|
||||||
qrCode: qrCode.value,
|
qrCode: qrCode.value,
|
||||||
}
|
}
|
||||||
|
resetFormData()
|
||||||
getInfoByCode(params)
|
getInfoByCode(params)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
if (res.code === 200 && res.data && res.data.length > 0) {
|
if (res.code === 200 && res.data && res.data.length > 0) {
|
||||||
|
|
@ -165,6 +173,9 @@ const getInfo = () => {
|
||||||
isChecked: 1,
|
isChecked: 1,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
if (res.data.length === 1) {
|
||||||
|
formData = res.data[0]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
|
|
@ -271,7 +282,7 @@ const handleSubmit = () => {
|
||||||
title: res.msg,
|
title: res.msg,
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
})
|
})
|
||||||
resetFormData()
|
getInfo()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
|
|
@ -279,11 +290,12 @@ const handleSubmit = () => {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
const resetFormData = () => {
|
const resetFormData = () => {
|
||||||
Object.keys(formData).forEach(key => {
|
Object.keys(formData).forEach((key) => {
|
||||||
formData[key] = ''
|
formData[key] = ''
|
||||||
})
|
})
|
||||||
|
typeName.value = ''
|
||||||
|
typeList.value = []
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
|
|
@ -294,6 +306,7 @@ const resetFormData = () => {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
|
margin-bottom: 30px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.popup {
|
.popup {
|
||||||
|
|
@ -322,7 +335,8 @@ const resetFormData = () => {
|
||||||
|
|
||||||
::v-deep .uni-popup__wrapper {
|
::v-deep .uni-popup__wrapper {
|
||||||
width: calc(100% - 20px);
|
width: calc(100% - 20px);
|
||||||
/* padding: 10px; */
|
max-height: 80vh;
|
||||||
|
overflow: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
::v-deep .uni-data-checklist {
|
::v-deep .uni-data-checklist {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue