增加出入口贮存
This commit is contained in:
+56
-2
@@ -19,12 +19,13 @@
|
||||
<view class="form-value">{{ formData.entryDateTime }}</view>
|
||||
</view>
|
||||
|
||||
<!-- <view class="form-item">
|
||||
<view class="form-item">
|
||||
<text class="form-label required">贮存设施</text>
|
||||
<picker class="form-value" :range="storageFacilities" range-key="label" :value="storageFacilityIndex" @change="onStorageFacilityChange">
|
||||
<text>{{ formData.storageFacilityName || '选择贮存设施' }}</text>
|
||||
<uni-icons type="right" size="14" color="#cccccc"></uni-icons>
|
||||
</picker>
|
||||
</view> -->
|
||||
</view>
|
||||
|
||||
<view class="form-item">
|
||||
<text class="form-label required">贮存经办人</text>
|
||||
@@ -110,6 +111,8 @@ export default {
|
||||
formData: {
|
||||
digitalId: '', // 数字识别码(扫码或手动输入)
|
||||
entryDateTime: '', // 入库时间
|
||||
storageFacility: '', // 贮存设施 code(提交用)
|
||||
storageFacilityName: '', // 贮存设施名称(显示用)
|
||||
storageManagerId: '', // 贮存经办人 id
|
||||
storageManagerName: '', // 贮存经办人姓名
|
||||
storageManagerCode: '', // 贮存经办人编码
|
||||
@@ -117,6 +120,9 @@ export default {
|
||||
transportManagerName: '', // 运送经办人姓名
|
||||
transportManagerCode: '' // 运送经办人编码
|
||||
},
|
||||
// 贮存设施选项列表
|
||||
storageFacilities: [],
|
||||
storageFacilityIndex: 0, // 当前选中的贮存设施下标
|
||||
// 操作人员选项
|
||||
operators: [
|
||||
// { id: 1, name: '李伟', code: 'H_ZC_001' },
|
||||
@@ -158,6 +164,7 @@ export default {
|
||||
async initData() {
|
||||
await this.getInRecords()
|
||||
await this.getOperators()
|
||||
await this.getFacilitys()
|
||||
},
|
||||
// 获取入库历史记录
|
||||
async getInRecords() {
|
||||
@@ -165,6 +172,43 @@ export default {
|
||||
return res.data.list
|
||||
})
|
||||
},
|
||||
async getFacilitys() {
|
||||
const res = await api.facility()
|
||||
console.log('facility', res)
|
||||
if (res.code == 1000) {
|
||||
// 解析 list 字符串数组为对象数组
|
||||
this.storageFacilities = res.data.list.map(item => {
|
||||
const obj = {}
|
||||
item.split('; ').forEach(pair => {
|
||||
const [key, val] = pair.split('=')
|
||||
obj[key] = val
|
||||
})
|
||||
return {
|
||||
sfid: obj.sfid,
|
||||
label: obj.alias,
|
||||
code: obj.code,
|
||||
order: parseInt(obj.order) || 999
|
||||
}
|
||||
}).sort((a, b) => a.order - b.order)
|
||||
|
||||
// 设置默认值(从 default 字段解析)
|
||||
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.storageFacility = this.storageFacilities[defaultIndex].code
|
||||
this.formData.storageFacilityName = this.storageFacilities[defaultIndex].label
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
// 获取经办人
|
||||
async getOperators() {
|
||||
// 1.产生,2.贮存,3.运送,4.出库
|
||||
@@ -279,6 +323,13 @@ export default {
|
||||
this.formData.transportManagerName = operator.name
|
||||
this.formData.transportManagerCode = operator.code
|
||||
},
|
||||
/** 贮存设施 picker 变更 */
|
||||
onStorageFacilityChange(e) {
|
||||
this.storageFacilityIndex = e.detail.value
|
||||
const facility = this.storageFacilities[e.detail.value]
|
||||
this.formData.storageFacility = facility.code
|
||||
this.formData.storageFacilityName = facility.label
|
||||
},
|
||||
|
||||
// ==================== 入库记录 ====================
|
||||
/** 添加一条入库记录(最多保留 10 条) */
|
||||
@@ -308,6 +359,7 @@ export default {
|
||||
const submitData = {
|
||||
code: this.formData.digitalId,
|
||||
time: this.formData.entryDateTime,
|
||||
storage_facility: this.formData.storageFacility,
|
||||
storage_handler: this.formData.storageManagerCode,
|
||||
transport_handler: this.formData.transportManagerCode
|
||||
}
|
||||
@@ -337,6 +389,8 @@ export default {
|
||||
this.formData = {
|
||||
digitalId: '',
|
||||
entryDateTime: '',
|
||||
storageFacility: '',
|
||||
storageFacilityName: '',
|
||||
storageManagerId: '',
|
||||
storageManagerName: '',
|
||||
storageManagerCode: '',
|
||||
|
||||
+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