diff --git a/components/SearchBox.vue b/components/SearchBox.vue index 71fa162..34a2237 100644 --- a/components/SearchBox.vue +++ b/components/SearchBox.vue @@ -36,10 +36,10 @@ this.focusState = true }, handleBlur (e) { - this.$emit('input', e.target.value) - // if (e.target.value.length) { - // this.$emit('handleChange', e.target.value) - // } + const newVal = e.target.value + if (newVal !== this.value) { + this.$emit('input', newVal) + } this.focusState = false }, toDel () { diff --git a/components/SearchBox_back.vue b/components/SearchBox_back.vue new file mode 100644 index 0000000..2f0cf7d --- /dev/null +++ b/components/SearchBox_back.vue @@ -0,0 +1,126 @@ + + + + + + + + + + + + + diff --git a/manifest.json b/manifest.json index b52a345..f2d7330 100644 --- a/manifest.json +++ b/manifest.json @@ -2,8 +2,8 @@ "name" : "西门子", "appid" : "__UNI__EF964CB", "description" : "西门子LMS手持系统", - "versionName" : "1.0.9", - "versionCode" : 109, + "versionName" : "1.1.4", + "versionCode" : 114, "transformPx" : false, /* 5+App特有相关 */ "app-plus" : { diff --git a/pages/manage/empty-carrier-warehousing.vue b/pages/manage/empty-carrier-warehousing.vue index 70ca158..becab1e 100644 --- a/pages/manage/empty-carrier-warehousing.vue +++ b/pages/manage/empty-carrier-warehousing.vue @@ -10,7 +10,6 @@ @@ -21,10 +20,10 @@ + 添加 @@ -42,21 +41,14 @@ {{e.vehicle_code}} 删除 - - {{uncompletedItem.point_code || '待扫描'}} - {{uncompletedItem.vehicle_code || '待扫描'}} - - 清空 - - - 请扫描点位和载具编码 + 请扫描点位和载具编码 - 提交 + 提交 @@ -75,87 +67,89 @@ title: '', point: '', vehicle: '', - uncompletedItem: null, dataList: [], disabled: false }; }, + computed: { + canSubmit() { + return this.dataList.length > 0 || (this.point && this.vehicle); + } + }, onLoad (options) { this.title = options.title }, methods: { - handlePointChange(value) { - if (value) { - setTimeout(() => { this.point = '' }, 500) - if (!this.uncompletedItem) { - this.uncompletedItem = { point_code: value } - } else { - this.uncompletedItem.point_code = value - } - this.checkAndAddToList() + handleAddItem() { + if (!this.point || !this.vehicle) { + uni.showToast({ + title: '请完整填写点位和载具编码', + icon: 'none' + }) + return } - }, - handleVehicleChange(value) { - if (value) { - setTimeout(() => { this.vehicle = '' }, 500) - if (!this.uncompletedItem) { - this.uncompletedItem = { vehicle_code: value } - } else { - this.uncompletedItem.vehicle_code = value - } - this.checkAndAddToList() + + const exists = this.dataList.some(item => + item.point_code === this.point && item.vehicle_code === this.vehicle + ) + + if (exists) { + uni.showToast({ + title: '该组合已存在', + icon: 'none' + }) + return } - }, - checkAndAddToList() { - if (!this.uncompletedItem) return - const { point_code, vehicle_code } = this.uncompletedItem - if (point_code && vehicle_code) { - const exists = this.dataList.some(item => - item.point_code === point_code && item.vehicle_code === vehicle_code - ) - if (!exists) { - this.dataList.push({ - point_code, - vehicle_code - }) - this.uncompletedItem = null - } else { - uni.showToast({ - title: '该组合已存在', - icon: 'none' - }) - this.uncompletedItem = null - } - } - }, - clearUncompleted() { - this.uncompletedItem = null + + this.dataList.push({ + point_code: this.point, + vehicle_code: this.vehicle + }) + + this.$nextTick(() => { + this.point = '' + this.vehicle = '' + }) }, deleteItem(index) { this.dataList.splice(index, 1) }, async _emptyVehicleWarehousing () { - this.disabled = true - if (!this.dataList.length) { - this.disabled = false - return - } - try { - let res = await emptyVehicleWarehousing(this.dataList) - this.clearUp() - uni.showToast({ - title: res.message, - icon: 'none' - }) - } catch (e) { - console.log(e) - this.disabled = false - } + this.disabled = true + let submitData = [] + if (this.dataList.length > 0) { + submitData = this.dataList + } + else if (this.point && this.vehicle) { + submitData = [{ + point_code: this.point, + vehicle_code: this.vehicle + }] + } + else { + uni.showToast({ + title: '请填写点位和载具编码或添加列表数据', + icon: 'none' + }) + this.disabled = false + return + } + + try { + let res = await emptyVehicleWarehousing(submitData) + this.clearUp() + uni.showToast({ + title: res.message, + icon: 'none' + }) + } catch (e) { + console.log(e) + this.disabled = false + } }, clearUp () { this.point = '' this.vehicle = '' - this.uncompletedItem = null this.disabled = false this.dataList = [] }