| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- <template>
- <div class="">
- <BasicTable @register="registerTable" :columns="workFaceWarningColumns">
- <template #tableTitle>
- <a-button preIcon="ant-design:plus-outlined" type="primary" @click="openModal()">新增</a-button>
- </template>
- <template #action="{ record }">
- <a class="table-action-link" @click="openModalFn(record)">编辑</a>
- <a-popconfirm title="确定删除?" @confirm="handleDelete(record)">
- <a class="table-action-link">删除</a>
- </a-popconfirm>
- </template>
- </BasicTable>
- <BaseModal @register="register" @add="onSubmit" @update="onSubmit" :form-schemas="workFaceWarningFormSchemas" />
- </div>
- </template>
- <script lang="ts" name="system-user" setup>
- import { BasicTable, TableAction } from '/@/components/Table';
- import { useListPage } from '/@/hooks/system/useListPage';
- import BaseModal from './BaseModal1.vue';
- import { useModal } from '/@/components/Modal';
- import { workFaceWarningColumns, workFaceWarningFormSchemas } from './warning.data';
- import { warningLogList, warningLogAdd, warningLogEdit, warningLogDeleteById } from './warning.api';
- const props = defineProps({
- deviceId: { type: String },
- });
- const { tableContext } = useListPage({
- tableProps: {
- api: warningLogList.bind(null, { sysId: props.deviceId }),
- scroll: { y: 390 },
- size: 'small',
- // expandRowByClick: true,
- clickToRowSelect: true,
- useSearchForm: false,
- rowSelection: {
- columnWidth: 20,
- },
- showTableSetting: false,
- formConfig: {
- disabled: true,
- showResetButton: false,
- showSubmitButton: false,
- },
- },
- });
- const [registerTable, { reload }] = tableContext;
- const [register, { openModal, closeModal }] = useModal();
- function openModalFn(record?) {
- if (record) {
- openModal(true, {
- isUpdate: true,
- record,
- });
- } else {
- openModal(true, {
- isUpdate: false,
- });
- }
- }
- async function handleDelete(record) {
- await warningLogDeleteById(record.id);
- }
- async function onSubmit(flag, values) {
- // 提交数据弹窗
- if (flag == 'update') {
- await warningLogEdit(values);
- } else {
- await warningLogAdd({ ...values, sysId: props.deviceId });
- }
- closeModal();
- //刷新列表
- reload();
- }
- </script>
- <style scoped></style>
|