增加出入口贮存

This commit is contained in:
2026-06-02 21:54:41 +08:00
parent b271b84f70
commit b13668095d
4 changed files with 127 additions and 23 deletions
+4 -2
View File
@@ -152,9 +152,11 @@ export const api = {
// 贮存设施列表 // 贮存设施列表
facility: (params) => request({ facility: (params) => request({
url: path + 'facility_list', // url: path + 'facility_list',
data: params url: path + 'sync_params',
data: { ...params, dict: 'storage_facilities' }
}), }),
// 生产设施列表 // 生产设施列表
prodFacility: (params) => request({ prodFacility: (params) => request({
url: path + 'prod_facility_list', url: path + 'prod_facility_list',
+2 -2
View File
@@ -2,8 +2,8 @@
"name" : "危废数据终端", "name" : "危废数据终端",
"appid" : "__UNI__F18DD0A", "appid" : "__UNI__F18DD0A",
"description" : "", "description" : "",
"versionName" : "1.0.3", "versionName" : "1.0.4",
"versionCode" : 103, "versionCode" : 104,
"transformPx" : false, "transformPx" : false,
/* 5+App */ /* 5+App */
"app-plus" : { "app-plus" : {
+56 -2
View File
@@ -19,12 +19,13 @@
<view class="form-value">{{ formData.entryDateTime }}</view> <view class="form-value">{{ formData.entryDateTime }}</view>
</view> </view>
<!-- <view class="form-item"> <view class="form-item">
<text class="form-label required">贮存设施</text> <text class="form-label required">贮存设施</text>
<picker class="form-value" :range="storageFacilities" range-key="label" :value="storageFacilityIndex" @change="onStorageFacilityChange"> <picker class="form-value" :range="storageFacilities" range-key="label" :value="storageFacilityIndex" @change="onStorageFacilityChange">
<text>{{ formData.storageFacilityName || '选择贮存设施' }}</text> <text>{{ formData.storageFacilityName || '选择贮存设施' }}</text>
<uni-icons type="right" size="14" color="#cccccc"></uni-icons>
</picker> </picker>
</view> --> </view>
<view class="form-item"> <view class="form-item">
<text class="form-label required">贮存经办人</text> <text class="form-label required">贮存经办人</text>
@@ -110,6 +111,8 @@ export default {
formData: { formData: {
digitalId: '', // 数字识别码(扫码或手动输入) digitalId: '', // 数字识别码(扫码或手动输入)
entryDateTime: '', // 入库时间 entryDateTime: '', // 入库时间
storageFacility: '', // 贮存设施 code(提交用)
storageFacilityName: '', // 贮存设施名称(显示用)
storageManagerId: '', // 贮存经办人 id storageManagerId: '', // 贮存经办人 id
storageManagerName: '', // 贮存经办人姓名 storageManagerName: '', // 贮存经办人姓名
storageManagerCode: '', // 贮存经办人编码 storageManagerCode: '', // 贮存经办人编码
@@ -117,6 +120,9 @@ export default {
transportManagerName: '', // 运送经办人姓名 transportManagerName: '', // 运送经办人姓名
transportManagerCode: '' // 运送经办人编码 transportManagerCode: '' // 运送经办人编码
}, },
// 贮存设施选项列表
storageFacilities: [],
storageFacilityIndex: 0, // 当前选中的贮存设施下标
// 操作人员选项 // 操作人员选项
operators: [ operators: [
// { id: 1, name: '李伟', code: 'H_ZC_001' }, // { id: 1, name: '李伟', code: 'H_ZC_001' },
@@ -158,6 +164,7 @@ export default {
async initData() { async initData() {
await this.getInRecords() await this.getInRecords()
await this.getOperators() await this.getOperators()
await this.getFacilitys()
}, },
// 获取入库历史记录 // 获取入库历史记录
async getInRecords() { async getInRecords() {
@@ -165,6 +172,43 @@ export default {
return res.data.list 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() { async getOperators() {
// 1.产生,2.贮存,3.运送,4.出库 // 1.产生,2.贮存,3.运送,4.出库
@@ -279,6 +323,13 @@ export default {
this.formData.transportManagerName = operator.name this.formData.transportManagerName = operator.name
this.formData.transportManagerCode = operator.code 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 条) */ /** 添加一条入库记录(最多保留 10 条) */
@@ -308,6 +359,7 @@ export default {
const submitData = { const submitData = {
code: this.formData.digitalId, code: this.formData.digitalId,
time: this.formData.entryDateTime, time: this.formData.entryDateTime,
storage_facility: this.formData.storageFacility,
storage_handler: this.formData.storageManagerCode, storage_handler: this.formData.storageManagerCode,
transport_handler: this.formData.transportManagerCode transport_handler: this.formData.transportManagerCode
} }
@@ -337,6 +389,8 @@ export default {
this.formData = { this.formData = {
digitalId: '', digitalId: '',
entryDateTime: '', entryDateTime: '',
storageFacility: '',
storageFacilityName: '',
storageManagerId: '', storageManagerId: '',
storageManagerName: '', storageManagerName: '',
storageManagerCode: '', storageManagerCode: '',
+65 -17
View File
@@ -22,12 +22,13 @@
</picker> </picker>
</view> </view>
<!-- <view class="form-item"> <view class="form-item">
<text class="form-label">贮存设施</text> <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> <text>{{ formData.storage_facility_name || '请选择贮存设施' }}</text>
<uni-icons type="right" size="14" color="#cccccc"></uni-icons>
</picker> </picker>
</view> --> </view>
<view class="form-item"> <view class="form-item">
<text class="form-label">出库时间</text> <text class="form-label">出库时间</text>
@@ -94,7 +95,9 @@ export default {
digital_id: '', digital_id: '',
destination: '', destination: '',
direction_name: '', direction_name: '',
time: '' time: '',
storage_facility: '', // 贮存设施 code(提交用)
storage_facility_name: '' // 贮存设施名称(显示用)
}, },
directionOptions: [ directionOptions: [
{ value: 'wwlycz', label: '委外利用处置' }, { value: 'wwlycz', label: '委外利用处置' },
@@ -102,6 +105,9 @@ export default {
{ value: 'zxlycz', label: '自行利用处置' } { value: 'zxlycz', label: '自行利用处置' }
], ],
directionIndex: 0, directionIndex: 0,
// 贮存设施选项列表
storageFacilities: [],
storageFacilityIndex: 0, // 当前选中的贮存设施下标
outRecords: [], outRecords: [],
default: {}, default: {},
dict: {} dict: {}
@@ -140,6 +146,7 @@ export default {
await this.getOutRecords() await this.getOutRecords()
await this.getOperators() await this.getOperators()
await this.getFacilitys()
await this.getDefault() await this.getDefault()
}, },
/** 获取出库历史记录 */ /** 获取出库历史记录 */
@@ -162,16 +169,52 @@ export default {
// 获取经办人 // 获取经办人
async getOperators() { async getOperators() {
// 1.产生,2.贮存,3.运送,4.出库 // 1.产生,2.贮存,3.运送,4.出库
const res = await api.handler({ type: 4 }) const res = await api.handler({ type: 4 })
console.log('handler', res) 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) { 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 { return {
id: res.handler_code, sfid: obj.sfid,
name: res.handler_name, label: obj.alias,
code: res.handler_code 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.destination = selected.value
this.formData.direction_name = selected.label 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) { onAutoOutboundSwitchChange(e) {
this.autoOutboundSwitch = e.detail.value this.autoOutboundSwitch = e.detail.value
}, },
@@ -254,14 +304,10 @@ export default {
} }
try { try {
const submitData = { const submitData = {
// 扫码值(危废标签二维码或数字识别码)
code: this.formData.digital_id, code: this.formData.digital_id,
// 出库时间 yyyy-MM-dd HH:mm:ss
time: this.formData.time, time: this.formData.time,
// 去向
destination: this.formData.destination, destination: this.formData.destination,
// 贮存设施编码(可选) storage_facility: this.formData.storage_facility
// storage_facility: this.formData.storage_facility
} }
const res = await api.deviceHwOut(submitData) const res = await api.deviceHwOut(submitData)
uni.showToast({ title: '出库成功', icon: 'success' }) uni.showToast({ title: '出库成功', icon: 'success' })
@@ -287,7 +333,9 @@ export default {
digital_id: '', digital_id: '',
destination: '', destination: '',
direction_name: '', direction_name: '',
time: getDateTime() time: getDateTime(),
storage_facility: '',
storage_facility_name: ''
} }
this.directionIndex = 0 this.directionIndex = 0
}, },