price-edit.vue 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <!-- 集采交易-我的集采-集采申请-价格编辑 -->
  2. <template>
  3. <app-drawer title="编辑" :width="400" v-model:show="show">
  4. <el-form ref="formRef" label-width="60px" :model="formItem" :rules="formRules">
  5. <el-form-item label="数量" prop="Qty">
  6. <el-input-number placeholder="请输入" v-model="formItem.Qty" />
  7. </el-form-item>
  8. <el-form-item label="价格" prop="Price">
  9. <el-input-number placeholder="请输入" v-model="formItem.Price" />
  10. </el-form-item>
  11. </el-form>
  12. <template #footer>
  13. <el-button @click="onCancel" plain>取消</el-button>
  14. <el-button type="primary" @click="onSubmit">保存</el-button>
  15. </template>
  16. </app-drawer>
  17. </template>
  18. <script lang="ts" setup>
  19. import { ref, PropType } from 'vue'
  20. import type { FormInstance, FormRules } from 'element-plus'
  21. import AppDrawer from '@pc/components/base/drawer/index.vue'
  22. const props = defineProps({
  23. selectedRow: {
  24. type: Object as PropType<Proto.GZCenterPurchasePrice>
  25. }
  26. })
  27. const emit = defineEmits(['update'])
  28. const show = ref(true)
  29. const formRef = ref<FormInstance>()
  30. const formItem = ref<Partial<Proto.GZCenterPurchasePrice>>({ StepIndex: 0, ...props.selectedRow })
  31. const formRules: FormRules = {
  32. Qty: [{
  33. required: true,
  34. message: '请输入数量'
  35. }],
  36. Price: [{
  37. required: true,
  38. message: '请输入价格'
  39. }],
  40. }
  41. const onCancel = () => {
  42. show.value = false
  43. }
  44. const onSubmit = () => {
  45. formRef.value?.validate((valid) => {
  46. if (valid) {
  47. emit('update', formItem.value)
  48. onCancel()
  49. }
  50. })
  51. }
  52. </script>