This commit is contained in:
mkm 2024-11-10 15:59:47 +08:00
parent 6b7a146fa2
commit 11b264ce52
3 changed files with 132 additions and 5 deletions

View File

@ -97,7 +97,7 @@
</el-row> </el-row>
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="采购事由" prop="purpose"> <el-form-item label="备注" prop="purpose">
<el-input <el-input
v-model="formData.purpose" v-model="formData.purpose"
type="input" type="input"
@ -106,7 +106,7 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="备注" prop="mark"> <el-form-item label="内部备注" prop="mark">
<el-input v-model="formData.mark" type="input" style="width: 480px" /> <el-input v-model="formData.mark" type="input" style="width: 480px" />
</el-form-item> </el-form-item>
</el-col> </el-col>

View File

@ -0,0 +1,115 @@
<template>
<div class="edit-popup">
<popup
ref="popupRef"
:title="popupTitle"
:async="true"
width="550px"
@confirm="handleSubmit"
@close="handleClose"
>
<el-form ref="formRef" :model="formData" label-width="90px">
<el-form-item label="图片" prop="file">
<material-picker v-model="formData.file" :limit="1" />
</el-form-item>
<el-form-item label="到货时间" prop="arrival_time">
<el-date-picker
v-model="formData.other_data.arrival_time"
type="datetime"
:readonly="false"
clearable
value-format="YYYY-MM-DD HH:mm:ss"
placeholder="请选择到货时间"
style="width: 180px"
/>
</el-form-item>
<el-form-item label="备注" prop="mark">
<el-input
v-model="formData.mark"
clearable
placeholder="请输入备注"
:readonly="false"
/>
</el-form-item>
</el-form>
</popup>
</div>
</template>
<script lang="ts" setup name="beforehandOrderEdit">
import type { FormInstance } from 'element-plus'
import Popup from '@/components/popup/index.vue'
import {
apiBeforehandOrderAdd,
apiBeforehandOrderEdit,
apiBeforehandOrderDetail
} from '@/api/beforehand_order'
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 popupTitle = computed(() => {
return mode.value == 'edit' ? '编辑预订单表' : '新增预订单表'
})
//
const formData = reactive({
id: '',
file: '',
other_data: {},
mark: ''
})
//
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 apiBeforehandOrderDetail({
id: row.id
})
setFormData(data)
}
//
const handleSubmit = async () => {
await formRef.value?.validate()
const data = { ...formData }
mode.value == 'edit' ? await apiBeforehandOrderEdit(data) : await apiBeforehandOrderAdd(data)
popupRef.value?.close()
emit('success')
}
//
const open = (type = 'add') => {
mode.value = type
popupRef.value?.open()
}
//
const handleClose = () => {
emit('close')
}
defineExpose({
open,
setFormData,
getDetail
})
</script>

View File

@ -111,7 +111,7 @@
<el-table-column label="入库" prop="warehousing" show-overflow-tooltip /> <el-table-column label="入库" prop="warehousing" show-overflow-tooltip />
<el-table-column label="出库" prop="outbound" show-overflow-tooltip /> <el-table-column label="出库" prop="outbound" show-overflow-tooltip />
<el-table-column label="总价格" prop="total_price" show-overflow-tooltip /> <el-table-column label="总价格" prop="total_price" show-overflow-tooltip />
<el-table-column label="备注" prop="mark" show-overflow-tooltip /> <el-table-column label="内部备注" prop="mark" show-overflow-tooltip />
<el-table-column label="通知" prop="msg" show-overflow-tooltip /> <el-table-column label="通知" prop="msg" show-overflow-tooltip />
<el-table-column label="操作" width="120" fixed="right"> <el-table-column label="操作" width="120" fixed="right">
<template #default="{ row }"> <template #default="{ row }">
@ -129,6 +129,7 @@
> >
详情 详情
</router-link> </router-link>
<el-button link @click="handleEdit(row)"> 编辑 </el-button>
<el-button <el-button
v-perms="['beforehand_order.beforehand_order/delete']" v-perms="['beforehand_order.beforehand_order/delete']"
type="danger" type="danger"
@ -159,6 +160,7 @@
@close="showDetails = false" @close="showDetails = false"
:dictData="dictData" :dictData="dictData"
/> --> /> -->
<edit-popup v-if="showEdit" ref="editRef" @success="getLists" @close="showEdit = false" />
<DrawerPop v-model="showDrawer" ref="drawerRef" /> <DrawerPop v-model="showDrawer" ref="drawerRef" />
</div> </div>
</template> </template>
@ -172,6 +174,11 @@ import moment from 'moment'
import { apiBeforehandOrderLists, apiBeforehandOrderDelete } from '@/api/beforehand_order' import { apiBeforehandOrderLists, apiBeforehandOrderDelete } from '@/api/beforehand_order'
import { apiSystemStoreLists } from '@/api/system_store' import { apiSystemStoreLists } from '@/api/system_store'
import DrawerPop from './component/drawer.vue' import DrawerPop from './component/drawer.vue'
import EditPopup from './edit.vue'
//
const showEdit = ref(false)
const editRef = shallowRef<InstanceType<typeof EditPopup>>()
const showDrawer = ref(false) const showDrawer = ref(false)
const drawerRef = ref(null) const drawerRef = ref(null)
@ -202,8 +209,13 @@ const handleSelectionChange = (val: any[]) => {
selectData.value = val.map(({ id }) => id) selectData.value = val.map(({ id }) => id)
} }
// //
const { dictData } = useDictData('') const handleEdit = async (data: any) => {
showEdit.value = true
await nextTick()
editRef.value?.open('edit')
editRef.value?.setFormData(data)
}
// //
const { pager, getLists, resetParams, resetPage } = usePaging({ const { pager, getLists, resetParams, resetPage } = usePaging({