settingForm.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. <template>
  2. <div class="setting-form">
  3. <div class="setting-form__wrapper">
  4. <FormTitle icon="pump" title="基础参数" />
  5. <BasicForm :model="model" :schemas="paramsFormSchema" @register="regEUForm" @submit="submitHandler">
  6. <template #input="{ model: m, field, schema }">
  7. <ListItem class="w-100%" v-model:value="m[field]" type="input" bordered :label-width="180" :value-width="80">
  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. <template #select="{ model: m, field, schema }">
  17. <ListItem class="w-100%" v-model:value="m[field]" type="input" bordered :label-width="180" :value-width="80">
  18. <template #label>
  19. {{ schema.label }}
  20. <Tooltip v-if="schema.helpMessage" :title="schema.helpMessage">
  21. <InfoCircleOutlined />
  22. </Tooltip>
  23. </template>
  24. <template #value>
  25. <ApiSelect v-bind="schema.componentProps" v-model:value="m[field]" />
  26. </template>
  27. </ListItem>
  28. </template>
  29. </BasicForm>
  30. </div>
  31. <!-- <div class="setting-form__wrapper">
  32. <FormTitle icon="gas-pump" title="工作面参数" />
  33. <BasicForm :model="model" :schemas="workSurfaceFormSchema" @register="regWSForm" @submit="submitHandler">
  34. <template #input="{ model: m, field, schema }">
  35. <ListItem class="w-100%" v-model:value="m[field]" type="input" bordered :label-width="200">
  36. <template #label>
  37. {{ schema.label }}
  38. <Tooltip v-if="schema.helpMessage" :title="schema.helpMessage">
  39. <InfoCircleOutlined />
  40. </Tooltip>
  41. </template>
  42. </ListItem>
  43. </template>
  44. </BasicForm>
  45. </div>
  46. <div class="setting-form__wrapper">
  47. <FormTitle icon="pump" title="抽采单元参数" />
  48. <BasicForm :model="model" :schemas="extractionUnitFormSchema" @register="regEUForm" @submit="submitHandler">
  49. <template #input="{ model: m, field, schema }">
  50. <ListItem class="w-100%" v-model:value="m[field]" type="input" bordered :label-width="200">
  51. <template #label>
  52. {{ schema.label }}
  53. <Tooltip v-if="schema.helpMessage" :title="schema.helpMessage">
  54. <InfoCircleOutlined />
  55. </Tooltip>
  56. </template>
  57. </ListItem>
  58. </template>
  59. </BasicForm>
  60. </div> -->
  61. <div class="setting-form__wrapper">
  62. <FormTitle icon="water-pump" title="计算参数" />
  63. <BasicForm :model="model" :schemas="calculationFormSchema" @register="regCCForm" @submit="submitHandler">
  64. <!-- <template #radio="{ model: m, field, schema }">
  65. <ListItem class="w-100%">
  66. <template #label>
  67. <Switch v-model:checked="m[field]" size="small" />
  68. <span class="ml-10px">{{ schema.label }}</span>
  69. </template>
  70. </ListItem>
  71. </template> -->
  72. <template #input="{ model: m, field, schema }">
  73. <ListItem class="w-100%" v-model:value="m[field]" type="input" bordered :label-width="180" :value-width="80">
  74. <template #label>
  75. {{ schema.label }}
  76. <Tooltip v-if="schema.helpMessage" :title="schema.helpMessage">
  77. <InfoCircleOutlined />
  78. </Tooltip>
  79. </template>
  80. </ListItem>
  81. </template>
  82. </BasicForm>
  83. </div>
  84. <div class="text-right">
  85. <!-- <Button class="mr-10px setting-form__button" type="primary" ghost @click="cancel">取消</Button> -->
  86. <Button class="mr-10px setting-form__button" type="primary" ghost @click="calculate">计算</Button>
  87. <Button class="mr-10px setting-form__button" type="primary" ghost @click="submit">提交</Button>
  88. </div>
  89. </div>
  90. </template>
  91. <script lang="ts" setup>
  92. import { Button, Tooltip } from 'ant-design-vue';
  93. import ListItem from '@/views/vent/gas/components/list/listItem.vue';
  94. import FormTitle from '@/views/vent/gas/components/form/formTitle.vue';
  95. import { useForm, BasicForm, ApiSelect } from '/@/components/Form';
  96. import { /** workSurfaceFormSchema, extractionUnitFormSchema, */ calculationFormSchema, paramsFormSchema } from '../gasPumpSetting.data';
  97. import { ref } from 'vue';
  98. import { InfoCircleOutlined } from '@ant-design/icons-vue';
  99. const props = defineProps<{ model: Record<string, any> }>();
  100. const emit = defineEmits(['submit', 'calculate', 'cancel']);
  101. const defaultFormProp = {
  102. //注册表单列
  103. showActionButtonGroup: false,
  104. labelCol: { span: 0 },
  105. wrapperCol: { span: 24 },
  106. baseColProps: {
  107. flex: '16.6667%',
  108. },
  109. };
  110. const formData = ref<Record<string, any>>({});
  111. // const [regWSForm, { submit: submitWSForm }] = useForm(defaultFormProp);
  112. const [regEUForm, { submit: submitEUForm }] = useForm(defaultFormProp);
  113. const [regCCForm, { submit: submitCCForm }] = useForm(defaultFormProp);
  114. function submitHandler(v) {
  115. formData.value = {
  116. ...formData.value,
  117. ...v,
  118. };
  119. }
  120. // function cancel() {
  121. // emit('cancel');
  122. // }
  123. function calculate() {
  124. Promise.all([/** submitWSForm(), */ submitEUForm()]).then(() => {
  125. emit('calculate', { ...props.model, ...formData.value });
  126. });
  127. }
  128. function submit() {
  129. Promise.all([/** submitWSForm(), */ submitEUForm(), submitCCForm()]).then(() => {
  130. emit('submit', { ...props.model, ...formData.value });
  131. });
  132. }
  133. </script>
  134. <style lang="less" scoped>
  135. @import '/@/design/theme.less';
  136. @import '/@/design/theme.less';
  137. .setting-form {
  138. padding: 0 20px;
  139. }
  140. .setting-form__wrapper {
  141. color: #fff;
  142. border-top: 3px solid @vent-gas-primary-text;
  143. background-color: @vent-gas-primary-trasparent-bg;
  144. padding: 10px 10px 0 10px;
  145. margin-bottom: 10px;
  146. }
  147. .setting-form__button {
  148. color: @vent-gas-primary-text;
  149. border-color: @vent-gas-primary-text;
  150. background-color: transparent !important;
  151. }
  152. // 生产环境下,该项与开发环境有样式出入
  153. :deep(.zxm-form-item-label) {
  154. display: none;
  155. }
  156. </style>