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