| | |
| | | <el-option label="供应商B" value="供应商B" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="创建时间"> |
| | | <el-date-picker v-model="formCreateTimeDate" |
| | | type="date" |
| | | placeholder="选择日期" |
| | | value-format="YYYY-MM-DD" |
| | | style="width: 100%" /> |
| | | </el-form-item> |
| | | <el-form-item label="备注"> |
| | | <el-input v-model="formData.remark" type="textarea" :rows="3" placeholder="请输入备注信息" /> |
| | | </el-form-item> |
| | |
| | | |
| | | <script setup> |
| | | import FormDialog from '@/components/Dialog/FormDialog.vue'; |
| | | import { ref, reactive } from 'vue' |
| | | import { ref, reactive, computed } from 'vue' |
| | | import dayjs from 'dayjs' |
| | | import { ElMessage, ElMessageBox } from 'element-plus' |
| | | |
| | | const loading = ref(false) |
| | |
| | | |
| | | const formData = reactive({ |
| | | supplierName: '', |
| | | remark: '' |
| | | remark: '', |
| | | createTime: '' |
| | | }) |
| | | const formCreateTimeDate = computed({ |
| | | get: () => (formData.createTime ? String(formData.createTime).split(' ')[0] : ''), |
| | | set: (value) => { |
| | | formData.createTime = value ? `${value} ${dayjs().format('HH:mm:ss')}` : '' |
| | | } |
| | | }) |
| | | |
| | | const mockData = [ |
| | |
| | | const openDialog = (type, row = {}) => { |
| | | dialogType.value = type |
| | | if (type === 'edit' && row.id) { |
| | | Object.assign(formData, { supplierName: row.supplierName, remark: row.remark }) |
| | | Object.assign(formData, { supplierName: row.supplierName, remark: row.remark, createTime: row.createTime || '' }) |
| | | } else { |
| | | Object.assign(formData, { supplierName: '', remark: '' }) |
| | | Object.assign(formData, { supplierName: '', remark: '', createTime: dayjs().format('YYYY-MM-DD HH:mm:ss') }) |
| | | } |
| | | dialogVisible.value = true |
| | | } |
| | |
| | | if (dialogType.value === 'add') { |
| | | const newOrder = { |
| | | id: Date.now(), |
| | | orderNo: `PO${Date.now()}`, |
| | | orderNo: '', |
| | | supplierName: formData.supplierName, |
| | | status: 'draft', |
| | | totalAmount: 0, |
| | | createTime: new Date().toLocaleString(), |
| | | createTime: formData.createTime, |
| | | remark: formData.remark |
| | | } |
| | | tableData.value.unshift(newOrder) |