settingForm.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. <template>
  2. <div class="setting-form">
  3. <div class="setting-form__wrapper">
  4. <FormTitle icon="gas-pump" title="工作面参数" />
  5. <BasicForm :model="model" :schemas="workSurfaceFormSchema" @register="regWSForm" @submit="submitHandler">
  6. <template #input="{ model: m, field, schema }">
  7. <ListItem class="w-100%" v-model:value="m[field]" type="input" bordered :label-width="200">
  8. <template #label>
  9. {{ schema.label }}
  10. <Tooltip v-if="schema.helpMessage" :title="schema.helpMessage">
  11. <InfoCircleOutlined />
  12. </Tooltip>
  13. </template>
  14. </ListItem>
  15. </template>
  16. </BasicForm>
  17. </div>
  18. <div class="setting-form__wrapper">
  19. <FormTitle icon="pump" title="抽采单元参数" />
  20. <BasicForm :model="model" :schemas="extractionUnitFormSchema" @register="regEUForm" @submit="submitHandler">
  21. <template #input="{ model: m, field, schema }">
  22. <ListItem class="w-100%" v-model:value="m[field]" type="input" bordered :label-width="200">
  23. <template #label>
  24. {{ schema.label }}
  25. <Tooltip v-if="schema.helpMessage" :title="schema.helpMessage">
  26. <InfoCircleOutlined />
  27. </Tooltip>
  28. </template>
  29. </ListItem>
  30. </template>
  31. </BasicForm>
  32. </div>
  33. <div class="setting-form__wrapper">
  34. <FormTitle icon="water-pump" title="计算参数" />
  35. <BasicForm :model="model" :schemas="calculationFormSchema" @register="regCCForm" @submit="submitHandler">
  36. <!-- <template #radio="{ model: m, field, schema }">
  37. <ListItem class="w-100%">
  38. <template #label>
  39. <Switch v-model:checked="m[field]" size="small" />
  40. <span class="ml-10px">{{ schema.label }}</span>
  41. </template>
  42. </ListItem>
  43. </template> -->
  44. <template #input="{ model: m, field, schema }">
  45. <ListItem class="w-100%" v-model:value="m[field]" type="input" :label="schema.label" bordered :label-width="200" />
  46. </template>
  47. </BasicForm>
  48. </div>
  49. <div class="text-right">
  50. <!-- <Button class="mr-10px setting-form__button" type="primary" ghost @click="cancel">取消</Button> -->
  51. <Button class="mr-10px setting-form__button" type="primary" ghost @click="calculate">计算</Button>
  52. <Button class="mr-10px setting-form__button" type="primary" ghost @click="submit">提交</Button>
  53. </div>
  54. </div>
  55. </template>
  56. <script lang="ts" setup>
  57. import { Button, Tooltip } from 'ant-design-vue';
  58. import ListItem from '@/views/vent/gas/components/list/listItem.vue';
  59. import FormTitle from '@/views/vent/gas/components/form/formTitle.vue';
  60. import { useForm, BasicForm } from '/@/components/Form';
  61. import { workSurfaceFormSchema, extractionUnitFormSchema, calculationFormSchema } from '../gasPumpSetting.data';
  62. import { ref } from 'vue';
  63. import { InfoCircleOutlined } from '@ant-design/icons-vue';
  64. const props = defineProps<{ model: Record<string, any> }>();
  65. const emit = defineEmits(['submit', 'calculate', 'cancel']);
  66. const defaultFormProp = {
  67. //注册表单列
  68. showActionButtonGroup: false,
  69. labelCol: { span: 0 },
  70. wrapperCol: { span: 24 },
  71. baseColProps: {
  72. flex: '16.6667%',
  73. },
  74. };
  75. const formData = ref<Record<string, any>>({});
  76. const [regWSForm, { submit: submitWSForm }] = useForm(defaultFormProp);
  77. const [regEUForm, { submit: submitEUForm }] = useForm(defaultFormProp);
  78. const [regCCForm, { submit: submitCCForm }] = useForm(defaultFormProp);
  79. function submitHandler(v) {
  80. formData.value = {
  81. ...formData.value,
  82. ...v,
  83. };
  84. }
  85. // function cancel() {
  86. // emit('cancel');
  87. // }
  88. function calculate() {
  89. Promise.all([submitWSForm(), submitEUForm()]).then(() => {
  90. emit('calculate', { ...props.model, ...formData.value });
  91. });
  92. }
  93. function submit() {
  94. Promise.all([submitWSForm(), submitEUForm(), submitCCForm()]).then(() => {
  95. emit('submit', { ...props.model, ...formData.value });
  96. });
  97. }
  98. </script>
  99. <style lang="less" scoped>
  100. @import '@/design/vent/color.less';
  101. .setting-form {
  102. padding: 0 20px;
  103. }
  104. .setting-form__wrapper {
  105. color: #fff;
  106. border-top: 3px solid @vent-gas-primary-text;
  107. background-color: @vent-gas-primary-trasparent-bg;
  108. padding: 10px 10px 0 10px;
  109. margin-bottom: 10px;
  110. }
  111. .setting-form__button {
  112. color: @vent-gas-primary-text;
  113. border-color: @vent-gas-primary-text;
  114. background-color: transparent !important;
  115. }
  116. </style>