| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- <template>
- <j-modal
- :fullscreen="true"
- :okButtonProps="{ class: { 'jee-hidden': disableSubmit } }"
- :title="title"
- :visible="visible"
- :width="900"
- cancelText="关闭"
- maxHeight="700px"
- @cancel="handleCancel"
- @ok="handleOk"
- >
- <!-- 详情模式:展示FocusPersonnelDetail -->
- <FocusPersonnelDetail v-if="isDetailMode" :record="currentRecord" />
- <!-- 编辑/新增模式:展示FocusPersonnelForm -->
- <FocusPersonnelForm v-else ref="registerForm" @ok="submitCallback" :formDisabled="disableSubmit" :formBpm="false"></FocusPersonnelForm>
- <template #footer>
- <a-button @click="handleCancel">{{ isDetailMode ? '关闭' : '取消' }}</a-button>
- <a-button v-if="!isDetailMode" type="primary" @click="handleOk">确认</a-button>
- </template>
- </j-modal>
- </template>
- <script lang="ts" setup>
- import { defineExpose, nextTick, ref } from 'vue';
- import FocusPersonnelForm from './FocusPersonnelForm.vue';
- import FocusPersonnelDetail from './FocusPersonnelDetail.vue';
- import JModal from '/@/components/Modal/src/JModal/JModal.vue';
- import { useMessage } from '/@/hooks/web/useMessage';
- const { createMessage } = useMessage();
- const title = ref<string>('');
- const width = ref<number>(900);
- const visible = ref<boolean>(false);
- const disableSubmit = ref<boolean>(false);
- const isDetailMode = ref<boolean>(false);
- const currentRecord = ref<any>({});
- const registerForm = ref();
- const emit = defineEmits(['register', 'success']);
- /**
- * 新增
- */
- function add() {
- isDetailMode.value = false;
- title.value = '新增重点关注人员';
- visible.value = true;
- nextTick(() => {
- registerForm.value.add();
- });
- }
- /**
- * 编辑
- */
- function edit(record) {
- isDetailMode.value = false;
- title.value = '编辑重点关注人员';
- visible.value = true;
- currentRecord.value = record;
- nextTick(() => {
- registerForm.value.edit(record);
- });
- }
- /**
- * 详情
- */
- function detail(record) {
- isDetailMode.value = true;
- title.value = '重点关注人员详情';
- visible.value = true;
- currentRecord.value = record;
- }
- /**
- * 确定按钮点击事件
- */
- function handleOk() {
- if (isDetailMode.value) {
- handleCancel();
- return;
- }
- registerForm.value.submitForm();
- }
- /**
- * form保存回调事件
- */
- function submitCallback() {
- handleCancel();
- emit('success');
- }
- /**
- * 取消按钮回调事件
- */
- function handleCancel() {
- visible.value = false;
- }
- defineExpose({
- add,
- edit,
- detail,
- disableSubmit,
- });
- </script>
- <style lang="less">
- /**隐藏样式-modal确定按钮 */
- .jee-hidden {
- display: none !important;
- }
- </style>
- <style lang="less" scoped></style>
|