车间能级提升-智能设备管理系统
zhuguifei
2025-03-14 3e0f519c396ac8a72e7bbd426e4f38fa6cc403dc
eims-ui/apps/web-antd/src/views/eims/insp-record/index.vue
copy from eims-ui/apps/web-antd/src/views/eims/maint-order-st/index.vue copy to eims-ui/apps/web-antd/src/views/eims/insp-record/index.vue
Îļþ´Ó eims-ui/apps/web-antd/src/views/eims/maint-order-st/index.vue ¸´ÖÆ
@@ -1,23 +1,21 @@
<script setup lang="ts">
import type { Recordable } from '@vben/types';
import { onMounted, ref } from 'vue';
import { Page, useVbenDrawer, type VbenFormProps } from '@vben/common-ui';
import { $t } from '@vben/locales';
import { addFullName, getPopupContainer, getVxePopupContainer } from '@vben/utils';
import { Popconfirm, Space } from 'ant-design-vue';
import { Modal, Popconfirm, Space } from 'ant-design-vue';
import { useVbenVxeGrid, type VxeGridProps, vxeSortEvent } from '#/adapter/vxe-table';
import { listMaintOrderGroupDetail } from '#/api/eims/maint-order';
import { delMaintOrderSt, listMaintOrderSt } from '#/api/eims/maint-order-st';
import { useVbenVxeGrid, vxeCheckboxChecked, type VxeGridProps, vxeSortEvent } from '#/adapter/vxe-table';
import { delInspRecord, inspRecordExport, listInspRecord } from '#/api/eims/insp-record';
import { getDeptTree, userList } from '#/api/system/user';
import BasisSubTable from '#/views/eims/components/basis-sub-table.vue';
import { columns as orderCol } from '#/views/eims/maint-order/data';
import { commonDownloadExcel } from '#/utils/file/download';
import { columns, querySchema } from './data';
import maintOrderStDrawer from './maint-order-st-drawer.vue';
import type { Recordable } from '@vben/types';
import { MAINT_ORDER_STATUS } from '#/constants/dict';
import { $t } from '@vben/locales';
import inspRecordDrawer from './insp-record-drawer.vue';
defineExpose({
  tableSelect
@@ -32,9 +30,7 @@
  },
  collapsed: true,
  schema: querySchema(),
  wrapperClass: 'grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4',
  // æ—¥æœŸé€‰æ‹©æ ¼å¼åŒ–
  fieldMappingTime: [['planTime', ['params[beginPlanTime]', 'params[endPlanTime]'], ['YYYY-MM-DD 00:00:00', 'YYYY-MM-DD 23:59:59']]]
  wrapperClass: 'grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4'
};
const gridOptions: VxeGridProps = {
@@ -53,7 +49,7 @@
  proxyConfig: {
    ajax: {
      query: async ({ page }, formValues = {}) => {
        return await listMaintOrderSt({
        return await listInspRecord({
          pageNum: page.currentPage,
          pageSize: page.pageSize,
          ...formValues
@@ -71,7 +67,7 @@
    // æ”¯æŒå¤šå­—段排序 é»˜è®¤å…³é—­
    multiple: true
  },
  id: 'maint-order-group-index'
  id: 'insp-record-index'
};
const orderId = ref<string>();
const [BasicTable, tableApi] = useVbenVxeGrid({
@@ -81,10 +77,49 @@
    sortChange: (sortParams) => vxeSortEvent(tableApi, sortParams),
    cellClick: (e: any) => {
      const { row } = e;
      orderId.value = `${row.equId}_${row.planTime}`;
      orderId.value = row.id;
    }
  }
});
const [InspRecordDrawer, inspRecordDrawerApi] = useVbenDrawer({
  connectedComponent: inspRecordDrawer
});
function handleAdd() {
  inspRecordDrawerApi.setData({});
  inspRecordDrawerApi.open();
}
async function handleEdit(record: Recordable<any>) {
  inspRecordDrawerApi.setData({ id: record.id });
  inspRecordDrawerApi.open();
}
async function handleDelete(row: Recordable<any>) {
  await delInspRecord(row.id);
  await tableApi.query();
}
function handleMultiDelete() {
  const rows = tableApi.grid.getCheckboxRecords();
  const ids = rows.map((row: any) => row.id);
  Modal.confirm({
    title: '提示',
    okType: 'danger',
    content: `确认删除选中的${ids.length}条记录吗?`,
    onOk: async () => {
      await delInspRecord(ids);
      await tableApi.query();
    }
  });
}
function handleDownloadExcel() {
  commonDownloadExcel(inspRecordExport, '点检记录', tableApi.formApi.form.values, {
    fieldMappingTime: formOptions.fieldMappingTime
  });
}
/**
 * åˆå§‹åŒ–部门选择
@@ -108,7 +143,7 @@
          /** æ ¹æ®éƒ¨é—¨ID加载用户 */
          await setupUserOptions(deptId);
          /** å˜åŒ–后需要重新选择用户 */
          formModel.maintUser = undefined;
          formModel.inspUser = undefined;
        },
        placeholder: '请选择',
        showSearch: true,
@@ -120,7 +155,7 @@
        // é€‰ä¸­åŽæ˜¾ç¤ºåœ¨è¾“入框的值
        treeNodeLabelProp: 'fullName'
      }),
      fieldName: 'maintDept'
      fieldName: 'inspDept'
    }
  ]);
}
@@ -148,28 +183,10 @@
  tableApi.formApi.updateSchema([
    {
      componentProps: { options, placeholder, filterOption },
      fieldName: 'maintUser'
      fieldName: 'inspUser'
    }
  ]);
}
const [MaintOrderStDrawer, maintOrderStDrawerApi] = useVbenDrawer({
  connectedComponent: maintOrderStDrawer
});
function handleAdd() {
  maintOrderStDrawerApi.setData({});
  maintOrderStDrawerApi.open();
}
async function handleEdit(record: Recordable<any>) {
  maintOrderStDrawerApi.setData({ id: record.id });
  maintOrderStDrawerApi.open();
}
async function handleDelete(row: Recordable<any>) {
  await delMaintOrderSt(row.id);
  await tableApi.query();
}
onMounted(async () => {
  await setupDeptSelect();
@@ -184,9 +201,25 @@
<template>
  <Page :auto-content-height="true">
    <div class="flex h-full gap-[8px] flex-col">
      <BasicTable class="h-3/5" table-title="保养工单列表">
      <BasicTable table-title="点检记录列表">
        <template #toolbar-tools>
          <Space />
          <Space>
            <a-button v-access:code="['eims:inspectRecord:export']" @click="handleDownloadExcel">
              {{ $t('pages.common.export') }}
            </a-button>
            <a-button
              :disabled="!vxeCheckboxChecked(tableApi)"
              danger
              type="primary"
              v-access:code="['eims:inspectRecord:remove']"
              @click="handleMultiDelete"
            >
              {{ $t('pages.common.delete') }}
            </a-button>
            <!--            <a-button type="primary" v-access:code="['eims:inspectRecord:add']" @click="handleAdd">
              {{ $t('pages.common.add') }}
            </a-button>-->
          </Space>
        </template>
        <template #equName="{ row }">
@@ -194,30 +227,22 @@
            <span>{{ row.equName }}</span>
          </Space>
        </template>
        <template #action="{ row }">
          <Space>
            <ghost-button v-access:code="['eims:maintOrderSt:edit']" @click.stop="handleEdit(row)">
            <ghost-button v-access:code="['eims:inspectRecord:edit']" @click.stop="handleEdit(row)">
              {{ $t('pages.common.edit') }}
            </ghost-button>
            <Popconfirm :get-popup-container="getVxePopupContainer" placement="left" title="确认删除?"
                        @confirm="handleDelete(row)">
              <ghost-button danger v-access:code="['eims:maintOrderSt:remove']" @click.stop="">
            <Popconfirm :get-popup-container="getVxePopupContainer" placement="left" title="确认删除?" @confirm="handleDelete(row)">
              <ghost-button danger v-access:code="['eims:inspectRecord:remove']" @click.stop="">
                {{ $t('pages.common.delete') }}
              </ghost-button>
            </Popconfirm>
          </Space>
        </template>
      </BasicTable>
      <BasisSubTable
        :columns="orderCol"
        :list-api="listMaintOrderGroupDetail"
        :req-value="orderId"
        class="h-2/5"
        req-key="maintCode"
        title="保养实施项目"
      />
      <!--<BasisSubTable :columns="maintStandCol" :list-api="listMaintStand" :req-value="equId" class="h-1/3" req-key="equId" title="保养实施项目" />-->
    </div>
    <MaintOrderStDrawer @reload="tableApi.query()" />
    <InspRecordDrawer @reload="tableApi.query()" />
  </Page>
</template>