增加出入口贮存
This commit is contained in:
+65
-17
@@ -22,12 +22,13 @@
|
||||
</picker>
|
||||
</view>
|
||||
|
||||
<!-- <view class="form-item">
|
||||
<view class="form-item">
|
||||
<text class="form-label">贮存设施</text>
|
||||
<picker class="form-value" :range="storageFacilityOptions" range-key="label" :value="storageFacilityIndex" @change="onStorageFacilityChange">
|
||||
<picker class="form-value" :range="storageFacilities" range-key="label" :value="storageFacilityIndex" @change="onStorageFacilityChange">
|
||||
<text>{{ formData.storage_facility_name || '请选择贮存设施' }}</text>
|
||||
<uni-icons type="right" size="14" color="#cccccc"></uni-icons>
|
||||
</picker>
|
||||
</view> -->
|
||||
</view>
|
||||
|
||||
<view class="form-item">
|
||||
<text class="form-label">出库时间</text>
|
||||
@@ -94,7 +95,9 @@ export default {
|
||||
digital_id: '',
|
||||
destination: '',
|
||||
direction_name: '',
|
||||
time: ''
|
||||
time: '',
|
||||
storage_facility: '', // 贮存设施 code(提交用)
|
||||
storage_facility_name: '' // 贮存设施名称(显示用)
|
||||
},
|
||||
directionOptions: [
|
||||
{ value: 'wwlycz', label: '委外利用处置' },
|
||||
@@ -102,6 +105,9 @@ export default {
|
||||
{ value: 'zxlycz', label: '自行利用处置' }
|
||||
],
|
||||
directionIndex: 0,
|
||||
// 贮存设施选项列表
|
||||
storageFacilities: [],
|
||||
storageFacilityIndex: 0, // 当前选中的贮存设施下标
|
||||
outRecords: [],
|
||||
default: {},
|
||||
dict: {}
|
||||
@@ -140,6 +146,7 @@ export default {
|
||||
|
||||
await this.getOutRecords()
|
||||
await this.getOperators()
|
||||
await this.getFacilitys()
|
||||
await this.getDefault()
|
||||
},
|
||||
/** 获取出库历史记录 */
|
||||
@@ -162,16 +169,52 @@ export default {
|
||||
// 获取经办人
|
||||
async getOperators() {
|
||||
// 1.产生,2.贮存,3.运送,4.出库
|
||||
const res = await api.handler({ type: 4 })
|
||||
console.log('handler', res)
|
||||
const res = await api.handler({ type: 4 })
|
||||
console.log('handler', res)
|
||||
if (res.code == 1000) {
|
||||
this.operators = res.data.map(res => {
|
||||
return {
|
||||
id: res.handler_code,
|
||||
name: res.handler_name,
|
||||
code: res.handler_code
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
// 获取贮存设施
|
||||
async getFacilitys() {
|
||||
const res = await api.facility()
|
||||
console.log('facility', res)
|
||||
if (res.code == 1000) {
|
||||
this.operators = res.data.map(res => {
|
||||
this.storageFacilities = res.data.list.map(item => {
|
||||
const obj = {}
|
||||
item.split('; ').forEach(pair => {
|
||||
const [key, val] = pair.split('=')
|
||||
obj[key] = val
|
||||
})
|
||||
return {
|
||||
id: res.handler_code,
|
||||
name: res.handler_name,
|
||||
code: res.handler_code
|
||||
sfid: obj.sfid,
|
||||
label: obj.alias,
|
||||
code: obj.code,
|
||||
order: parseInt(obj.order) || 999
|
||||
}
|
||||
})
|
||||
}).sort((a, b) => a.order - b.order)
|
||||
|
||||
if (res.data.default) {
|
||||
const defaultObj = {}
|
||||
res.data.default.split('; ').forEach(pair => {
|
||||
const [key, val] = pair.split('=')
|
||||
defaultObj[key] = val
|
||||
})
|
||||
const defaultIndex = this.storageFacilities.findIndex(
|
||||
f => f.code === defaultObj.code
|
||||
)
|
||||
if (defaultIndex !== -1) {
|
||||
this.storageFacilityIndex = defaultIndex
|
||||
this.formData.storage_facility = this.storageFacilities[defaultIndex].code
|
||||
this.formData.storage_facility_name = this.storageFacilities[defaultIndex].label
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -244,6 +287,13 @@ export default {
|
||||
this.formData.destination = selected.value
|
||||
this.formData.direction_name = selected.label
|
||||
},
|
||||
/** 贮存设施 picker 变更 */
|
||||
onStorageFacilityChange(e) {
|
||||
this.storageFacilityIndex = e.detail.value
|
||||
const facility = this.storageFacilities[e.detail.value]
|
||||
this.formData.storage_facility = facility.code
|
||||
this.formData.storage_facility_name = facility.label
|
||||
},
|
||||
onAutoOutboundSwitchChange(e) {
|
||||
this.autoOutboundSwitch = e.detail.value
|
||||
},
|
||||
@@ -254,14 +304,10 @@ export default {
|
||||
}
|
||||
try {
|
||||
const submitData = {
|
||||
// 扫码值(危废标签二维码或数字识别码)
|
||||
code: this.formData.digital_id,
|
||||
// 出库时间 yyyy-MM-dd HH:mm:ss
|
||||
time: this.formData.time,
|
||||
// 去向
|
||||
destination: this.formData.destination,
|
||||
// 贮存设施编码(可选)
|
||||
// storage_facility: this.formData.storage_facility
|
||||
storage_facility: this.formData.storage_facility
|
||||
}
|
||||
const res = await api.deviceHwOut(submitData)
|
||||
uni.showToast({ title: '出库成功', icon: 'success' })
|
||||
@@ -287,7 +333,9 @@ export default {
|
||||
digital_id: '',
|
||||
destination: '',
|
||||
direction_name: '',
|
||||
time: getDateTime()
|
||||
time: getDateTime(),
|
||||
storage_facility: '',
|
||||
storage_facility_name: ''
|
||||
}
|
||||
this.directionIndex = 0
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user