干燥机配套车间生产管理系统/云平台服务端
baoshiwei
2024-05-27 fa3ac93010bea3805438ee3ab0a182bfbf7423da
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<template>
  <BasicModal
    :title="title"
    :width="width"
    :visible="visible"
    :height="600"
    @ok="handleOk"
    :okButtonProps="{ class: { 'jee-hidden': disableSubmit } }"
    @cancel="handleCancel"
    cancelText="关闭"
  >
    <OneNativeForm ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></OneNativeForm>
  </BasicModal>
</template>
 
<script lang="ts" setup>
  import { ref, nextTick, defineExpose } from 'vue';
  import OneNativeForm from './OneNativeForm.vue';
  import { BasicModal } from '/@/components/Modal';
  
  const title = ref<string>('');
  const width = ref<number>(800);
  const visible = ref<boolean>(false);
  const disableSubmit = ref<boolean>(false);
  const realForm = ref();
  const emit = defineEmits(['register', 'ok']);
 
  function add() {
    title.value = '新增';
    visible.value = true;
    nextTick(() => {
      realForm.value.add();
    });
  }
 
  function edit(record) {
    title.value = disableSubmit.value ? '详情' : '编辑';
    visible.value = true;
    nextTick(() => {
      realForm.value.edit(record);
    });
  }
 
  function handleOk() {
    realForm.value.submitForm();
  }
 
  function submitCallback() {
    handleCancel();
    emit('ok');
  }
 
  function handleCancel() {
    visible.value = false;
  }
 
  defineExpose({
    add,
    edit,
    disableSubmit,
  });
</script>
 
<style lang="less" scoped>
</style>