This commit is contained in:
parent
6b7a146fa2
commit
11b264ce52
|
@ -97,7 +97,7 @@
|
|||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="采购事由" prop="purpose">
|
||||
<el-form-item label="备注" prop="purpose">
|
||||
<el-input
|
||||
v-model="formData.purpose"
|
||||
type="input"
|
||||
|
@ -106,7 +106,7 @@
|
|||
</el-form-item>
|
||||
</el-col>
|
||||
<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-form-item>
|
||||
</el-col>
|
||||
|
|
|
@ -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>
|
|
@ -111,7 +111,7 @@
|
|||
<el-table-column label="入库" prop="warehousing" 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="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="操作" width="120" fixed="right">
|
||||
<template #default="{ row }">
|
||||
|
@ -129,6 +129,7 @@
|
|||
>
|
||||
详情
|
||||
</router-link>
|
||||
<el-button link @click="handleEdit(row)"> 编辑 </el-button>
|
||||
<el-button
|
||||
v-perms="['beforehand_order.beforehand_order/delete']"
|
||||
type="danger"
|
||||
|
@ -159,6 +160,7 @@
|
|||
@close="showDetails = false"
|
||||
:dictData="dictData"
|
||||
/> -->
|
||||
<edit-popup v-if="showEdit" ref="editRef" @success="getLists" @close="showEdit = false" />
|
||||
<DrawerPop v-model="showDrawer" ref="drawerRef" />
|
||||
</div>
|
||||
</template>
|
||||
|
@ -172,6 +174,11 @@ import moment from 'moment'
|
|||
import { apiBeforehandOrderLists, apiBeforehandOrderDelete } from '@/api/beforehand_order'
|
||||
import { apiSystemStoreLists } from '@/api/system_store'
|
||||
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 drawerRef = ref(null)
|
||||
|
@ -202,8 +209,13 @@ const handleSelectionChange = (val: any[]) => {
|
|||
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({
|
||||
|
|
Loading…
Reference in New Issue