2024-08-13 17:59:30 +08:00

108 lines
3.3 KiB
Vue

<template>
<div class="edit-popup">
<popup
ref="popupRef"
title="详情"
:async="true"
width="550px"
:cancelButtonText="false"
:confirmButtonText="false"
>
<el-form ref="formRef" :model="formData" label-width="90px">
<el-form-item label="商品" prop="product_id">
<el-input v-model="formData.product_id" clearable placeholder="请输入商品" :readonly="true"/>
</el-form-item>
<el-form-item label="数量" prop="nums">
<el-input v-model="formData.nums" clearable placeholder="请输入数量" :readonly="true"/>
</el-form-item>
<el-form-item label="更新前" prop="before_nums">
<el-input v-model="formData.before_nums" clearable placeholder="请输入更新前" :readonly="true"/>
</el-form-item>
<el-form-item label="更新后" prop="after_nums">
<el-input v-model="formData.after_nums" clearable placeholder="请输入更新后" :readonly="true"/>
</el-form-item>
<el-form-item label="1商户2仓库" prop="type">
<el-input v-model="formData.type" clearable placeholder="请输入1商户2仓库" :readonly="true"/>
</el-form-item>
<el-form-item label="转出id" prop="one_id">
<el-input v-model="formData.one_id" clearable placeholder="请输入转出id" :readonly="true"/>
</el-form-item>
<el-form-item label="转入id" prop="two_id">
<el-input v-model="formData.two_id" clearable placeholder="请输入转入id" :readonly="true"/>
</el-form-item>
</el-form>
</popup>
</div>
</template>
<script lang="ts" setup name="inventoryTransferDETAILS">
import type { FormInstance } from 'element-plus'
import Popup from '@/components/popup/index.vue'
import { apiInventoryTransferAdd, apiInventoryTransferEdit, apiInventoryTransferDetail } from '@/api/inventory_transfer'
import { timeFormat } from '@/utils/util'
import type { PropType } from 'vue'
defineProps({
dictData: {
type: Object as PropType<Record<string, any[]>>,
default: () => ({})
}
})
const emit = defineEmits(['success', 'close'])
const formRef = shallowRef<FormInstance>()
const popupRef = shallowRef<InstanceType<typeof Popup>>()
const mode = ref('add')
// 表单数据
const formData = reactive({
id: '',
product_id: '',
nums: '',
before_nums: '',
after_nums: '',
type: '',
one_id: '',
two_id: '',
})
// 获取详情
const setFormData = async (data: Record<any, any>) => {
for (const key in formData) {
if (data[key] != null && data[key] != undefined) {
//@ts-ignore
formData[key] = data[key]
}
}
}
const getDetail = async (row: Record<string, any>) => {
const data = await apiInventoryTransferDetail({
id: row.id
})
setFormData(data)
}
//打开弹窗
const open = () => {
popupRef.value?.open()
}
// 关闭回调
const handleClose = () => {
emit('close')
}
defineExpose({
open,
setFormData,
getDetail
})
</script>