瀏覽代碼

feat: 新增其他设备模块

Tong 2 年之前
父節點
當前提交
11b2d8e038

+ 31 - 0
src/api/biz/engineer/maintenanceApi.ts

@@ -0,0 +1,31 @@
+import { defHttp } from '/@/utils/http/axios';
+import { setParams } from '/@/utils/index';
+
+enum Api {
+  maintenanceQueryPage = '/biz/deviceMaintenance/query/page',
+  maintenanceDetail = '/biz/deviceMaintenance/detail/other',
+  maintenanceAdd = '/biz/deviceMaintenance/add',
+  maintenanceEdit = '/biz/deviceMaintenance/edit',
+  maintenanceRemove = '/biz/deviceMaintenance/removeByIds',
+}
+
+// 查询设备列表
+export const maintenanceQueryPage = (params?: object) => {
+  return defHttp.post({ url: Api.maintenanceQueryPage, params: setParams(params) });
+};
+// 删除设备
+export const maintenanceRemove = (params: Array<string | number>) => {
+  return defHttp.post({ url: Api.maintenanceRemove, params: params });
+};
+// 添加设备
+export const maintenanceAdd = (params?: object) => {
+  return defHttp.post({ url: Api.maintenanceAdd, params: params });
+};
+// 编辑设备信息
+export const maintenanceEdit = (params?: object) => {
+  return defHttp.post({ url: Api.maintenanceEdit, params: params });
+};
+// 其他设备详情
+export const maintenanceDetail = (id: string) => {
+  return defHttp.get({ url: Api.maintenanceDetail + '/' + id });
+};

+ 36 - 0
src/api/biz/engineer/otherApi.ts

@@ -0,0 +1,36 @@
+import { defHttp } from '/@/utils/http/axios';
+import { setParams } from '/@/utils/index';
+
+enum Api {
+  otherQueryPage = '/biz/otherDevice/query/page',
+  otherDetail = '/biz/otherDevice/detail',
+  otherAdd = '/biz/otherDevice/add',
+  otherEdit = '/biz/otherDevice/edit',
+  otherRemove = '/biz/device/dialysisMaintain/removeByIds/',
+  otherTypeCount = '/biz/otherDevice/typeNumber',
+}
+
+// 获取Tab各方数量
+export function otherTypeCount() {
+  return defHttp.get({ url: Api.otherTypeCount });
+}
+// 查询设备列表
+export const otherQueryPage = (params?: object) => {
+  return defHttp.post({ url: Api.otherQueryPage, params: setParams(params) });
+};
+// 删除设备
+export const otherRemove = (params: Array<string | number>) => {
+  return defHttp.post({ url: Api.otherRemove, params: params });
+};
+// 添加设备
+export const otherAdd = (params?: object) => {
+  return defHttp.post({ url: Api.otherAdd, params: params });
+};
+// 编辑设备信息
+export const otherEdit = (params?: object) => {
+  return defHttp.post({ url: Api.otherEdit, params: params });
+};
+// 其他设备详情
+export const otherDetail = (id: string) => {
+  return defHttp.get({ url: Api.otherDetail + '/' + id });
+};

+ 31 - 0
src/api/biz/engineer/otherUpkeepApi.ts

@@ -0,0 +1,31 @@
+import { defHttp } from '/@/utils/http/axios';
+import { setParams } from '/@/utils/index';
+
+enum Api {
+  upkeepQueryPage = '/biz/device/otherMaintain/query',
+  upkeepDetail = '/biz/device/otherMaintain/query',
+  upkeepAdd = '/biz/device/otherMaintain/add',
+  upkeepEdit = '/biz/device/otherMaintain/edit',
+  upkeepRemove = '/biz/device/otherMaintain/removeByIds',
+}
+
+// 查询设备列表
+export const upkeepQueryPage = (params?: object) => {
+  return defHttp.post({ url: Api.upkeepQueryPage, params: setParams(params) });
+};
+// 删除设备
+export const upkeepRemove = (params: Array<string | number>) => {
+  return defHttp.post({ url: Api.upkeepRemove, params: params });
+};
+// 添加设备
+export const upkeepAdd = (params?: object) => {
+  return defHttp.post({ url: Api.upkeepAdd, params: params });
+};
+// 编辑设备信息
+export const upkeepEdit = (params?: object) => {
+  return defHttp.post({ url: Api.upkeepEdit, params: params });
+};
+// 其他设备详情
+export const upkeepDetail = (id: string) => {
+  return defHttp.get({ url: Api.upkeepDetail + '/' + id });
+};

+ 346 - 0
src/views/biz/engineer/other/data.ts

@@ -0,0 +1,346 @@
+import { BasicColumn, FormSchema } from '/@/components/Table';
+import { listDictModel, uploadApi } from '/@/api/common';
+
+export const columns: BasicColumn[] = [
+  {
+    title: '设备编号',
+    dataIndex: 'uniqueCode',
+  },
+  {
+    title: '设备类型',
+    dataIndex: 'deviceType',
+  },
+  {
+    title: '设备名称',
+    dataIndex: 'name',
+  },
+  {
+    title: '设备厂家',
+    dataIndex: 'manufacturer',
+  },
+  {
+    title: '设备型号',
+    dataIndex: 'model',
+  },
+  {
+    title: '入账日期',
+    dataIndex: 'purchaseDate',
+  },
+  {
+    title: '采购金额(元)',
+    dataIndex: 'priceYuan',
+  },
+  {
+    title: '生产日期',
+    dataIndex: 'produceDate',
+  },
+  {
+    title: '保修期限',
+    dataIndex: 'warrantyPeriod',
+    width: 100,
+  },
+  {
+    title: '是否在保',
+    dataIndex: 'isWarranty',
+    width: 100,
+  },
+];
+// 表单新增编辑
+export const dataFormSchema: FormSchema[] = [
+  {
+    label: '设备编号',
+    field: 'uniqueCode',
+    component: 'Input',
+    componentProps: {
+      placeholder: '请输入设备编码',
+    },
+  },
+  {
+    label: '设备类型',
+    field: 'deviceType',
+    component: 'ApiSelect',
+    componentProps: {
+      api: listDictModel,
+      params: {
+        dictCode: 'od',
+      },
+      placeholder: '请选择设备类型',
+    },
+  },
+  {
+    label: '厂家',
+    field: 'manufacturer',
+    component: 'Input',
+    componentProps: {
+      placeholder: '请输入设备厂家',
+    },
+  },
+  {
+    label: '型号',
+    field: 'model',
+    component: 'Input',
+    componentProps: {
+      placeholder: '请输入型号',
+    },
+  },
+  {
+    label: '入账日期',
+    field: 'purchaseDate',
+    component: 'DatePicker',
+    componentProps: {
+      format: 'YYYY-MM-DD',
+      placeholder: '请选择入账日期',
+      getPopupContainer: () => document.body,
+      valueFormat: 'YYYY-MM-DD',
+    },
+  },
+  {
+    label: '生产日期',
+    field: 'produceDate',
+    component: 'DatePicker',
+    componentProps: {
+      format: 'YYYY-MM-DD',
+      placeholder: '请选择生产日期',
+      getPopupContainer: () => document.body,
+      valueFormat: 'YYYY-MM-DD',
+    },
+  },
+  {
+    label: '采购金额(元)',
+    field: 'priceYuan',
+    component: 'Input',
+    componentProps: {
+      placeholder: '请输入采购金额',
+    },
+  },
+  {
+    label: '保修期限(年)',
+    field: 'warrantyPeriod',
+    component: 'Input',
+    componentProps: {
+      placeholder: '请输入保修期限',
+    },
+  },
+];
+
+export const maintenanceDataFormSchema: FormSchema[] = [
+  {
+    field: 'deviceInfo',
+    component: 'PlainTitle',
+    defaultValue: '设备信息',
+  },
+  {
+    label: '设备编号',
+    field: 'uniqueCode',
+    component: 'Input',
+    slot: 'uniqueCode',
+    colProps: {
+      span: 8,
+    },
+  },
+  {
+    label: '设备厂家',
+    field: 'manufacturer',
+    component: 'Input',
+    slot: 'manufacturer',
+    colProps: {
+      span: 8,
+    },
+  },
+  {
+    label: '设备型号',
+    field: 'model',
+    component: 'Input',
+    slot: 'model',
+    colProps: {
+      span: 8,
+    },
+  },
+
+  {
+    field: 'maintenanceInfo',
+    component: 'PlainTitle',
+    defaultValue: '维修记录',
+  },
+
+  {
+    label: '维修时间',
+    field: 'maintenanceTime',
+    component: 'DatePicker',
+    componentProps: {
+      format: 'YYYY-MM-DD HH:mm:ss',
+      placeholder: '请选择维修时间',
+      showTime: true,
+      getPopupContainer: () => document.body,
+      valueFormat: 'YYYY-MM-DD HH:mm:ss',
+    },
+  },
+
+  {
+    label: '维修方',
+    field: 'maintenanceCompany',
+    component: 'ApiSelect',
+    componentProps: {
+      api: listDictModel,
+      params: {
+        dictCode: 'dmc',
+      },
+      placeholder: '请选择维修方',
+    },
+  },
+  {
+    label: '异常信息',
+    field: 'malfunctionMessage',
+    component: 'Input',
+    componentProps: {
+      placeholder: '请输入异常信息',
+    },
+    colProps: {
+      span: 12,
+    },
+  },
+  {
+    label: '维修内容',
+    field: 'repairContent',
+    component: 'Input',
+    componentProps: {
+      placeholder: '请输入维修内容',
+    },
+    colProps: {
+      span: 12,
+    },
+  },
+  {
+    label: '维修费用(元)',
+    field: 'costYuan',
+    component: 'Input',
+    componentProps: {
+      placeholder: '请输入维修费用(元)',
+    },
+    colProps: {
+      span: 12,
+    },
+  },
+  {
+    label: '解决进度',
+    field: 'schedule',
+    component: 'ApiSelect',
+    componentProps: {
+      api: listDictModel,
+      params: {
+        dictCode: 'rp',
+      },
+      placeholder: '请选择解决进度',
+    },
+  },
+  {
+    label: '维修图片',
+    field: 'files',
+    component: 'XTUpload',
+    componentProps: ({ formModel, schema }) => {
+      return {
+        api: uploadApi,
+        maxSize: 1,
+        maxNumber: 1,
+        helpText: '仅支持上传jpg/png图片,图片大小不超过1M',
+        accept: ['image/*'],
+        onChange: data => {
+          formModel[schema.field] = data;
+        },
+      };
+    },
+    colProps: {
+      span: 24,
+    },
+  },
+];
+
+export const upkeepDataFormSchema: FormSchema[] = [
+  {
+    field: 'deviceInfo',
+    component: 'PlainTitle',
+    defaultValue: '设备信息',
+  },
+  {
+    label: '设备编号',
+    field: 'uniqueCode',
+    component: 'Input',
+    slot: 'uniqueCode',
+    colProps: {
+      span: 12,
+    },
+  },
+  {
+    label: '设备厂家',
+    field: 'manufacturer',
+    component: 'Input',
+    slot: 'manufacturer',
+    colProps: {
+      span: 12,
+    },
+  },
+  {
+    label: '设备型号',
+    field: 'model',
+    component: 'Input',
+    slot: 'model',
+  },
+
+  {
+    field: 'maintenanceInfo',
+    component: 'PlainTitle',
+    defaultValue: '保养记录',
+  },
+
+  {
+    label: '保养时间',
+    field: 'maintainTime',
+    component: 'DatePicker',
+    componentProps: {
+      format: 'YYYY-MM-DD HH:mm:ss',
+      placeholder: '请选择维修时间',
+      showTime: true,
+      getPopupContainer: () => document.body,
+      valueFormat: 'YYYY-MM-DD HH:mm:ss',
+    },
+  },
+  {
+    label: '保养内容',
+    field: 'content',
+    required: true,
+    component: 'Input',
+    componentProps: {
+      placeholder: '请输入维修内容',
+    },
+  },
+  {
+    label: '保养方',
+    required: true,
+    field: 'maintainCompany',
+    component: 'ApiSelect',
+    componentProps: {
+      api: listDictModel,
+      params: {
+        dictCode: 'dmc',
+      },
+      placeholder: '请选择保养方',
+    },
+  },
+  {
+    label: '保养图片',
+    field: 'files',
+    component: 'XTUpload',
+    componentProps: ({ formModel, schema }) => {
+      return {
+        api: uploadApi,
+        maxSize: 1,
+        maxNumber: 1,
+        helpText: '仅支持上传jpg/png图片,图片大小不超过1M',
+        accept: ['image/*'],
+        onChange: data => {
+          formModel[schema.field] = data;
+        },
+      };
+    },
+  },
+];

+ 7 - 0
src/views/biz/engineer/other/detail/data.ts

@@ -0,0 +1,7 @@
+export const BasicTab = [
+  { key: 'deviceBasic', value: 0, title: '设备信息' },
+  { key: 'maintenanceList', value: 1, title: '维修记录' },
+  { key: 'upkeepList', value: 2, title: '保养记录' },
+];
+
+export const BasicTabActive = BasicTab[0].key;

+ 64 - 0
src/views/biz/engineer/other/detail/index.vue

@@ -0,0 +1,64 @@
+<template>
+  <div class="m-4">
+    <div class="mb-4">
+      <XTTitle :title="title" :go-back="true" />
+    </div>
+    <div class="py-2 bg-white">
+      <a-tabs v-model:activeKey="activeKey" :destroyInactiveTabPane="true">
+        <a-tab-pane
+          v-for="item in tabData"
+          :key="item.key"
+          :tab="item.title"
+          :class="'tab-' + item.key"
+        >
+          <!-- 基础信息 0 -->
+          <div v-if="item.value == 0 && info.id">
+            <DeviceBasic :info="info" />
+          </div>
+          <!-- 维修记录 1 -->
+          <div v-if="item.value == 1 && info.id">
+            <MaintenanceList :info="info" />
+          </div>
+          <!-- 保养记录 2 -->
+          <div v-if="item.value == 2 && info.id">
+            <UpkeepList :info="info" />
+          </div>
+        </a-tab-pane>
+      </a-tabs>
+    </div>
+  </div>
+</template>
+
+<script setup lang="ts">
+  import { ref } from 'vue';
+  import { BasicTab, BasicTabActive } from './data';
+  import DeviceBasic from '../deviceBasic/index.vue';
+  import MaintenanceList from '../maintenanceList/index.vue';
+  import UpkeepList from '../upkeepList/index.vue';
+  import { useRoute } from 'vue-router';
+  import { XTTitle } from '/@/components/XTTitle/index';
+
+  const route = useRoute();
+  console.log('🚀 ~ file: index.vue:25 ~ route:', route);
+  const info = ref({
+    id: String(route.query?.id),
+    name: route.query?.name,
+  });
+  const activeKey = ref(BasicTabActive);
+  const tabData = ref(BasicTab);
+  const title = `设备详情 — ${info.value.name}`;
+</script>
+
+<style lang="less" scoped>
+  ::v-deep(.ant-tabs-tab) {
+    padding: 12px;
+  }
+
+  ::v-deep(.ant-tabs-tabpane) {
+    padding: 12px;
+  }
+
+  .tab-medicalDocuments {
+    padding: 0;
+  }
+</style>

+ 17 - 0
src/views/biz/engineer/other/deviceBasic/data.ts

@@ -0,0 +1,17 @@
+export const BasicData = [
+  {
+    title: '设备信息',
+    icon: 'icon-xt-edit_default',
+    type: 'basic',
+    data: [
+      { field: 'uniqueCode', label: '设备编号', value: '' },
+      { field: 'deviceType', label: '设备类型', value: '', dict: true },
+      { field: 'manufacturer', label: '厂家', value: '' },
+      { field: 'model', label: '型号', value: '' },
+      { field: 'purchaseDate', label: '入账日期', value: '' },
+      { field: 'produceDate', label: '生产日期', value: '' },
+      { field: 'priceYuan', label: '采购金额(元)', value: '' },
+      { field: 'warrantyPeriod', label: '保修期限(年)', value: '' },
+    ],
+  },
+];

+ 50 - 0
src/views/biz/engineer/other/deviceBasic/index.vue

@@ -0,0 +1,50 @@
+<template>
+  <div>
+    <div class="mx-2 mb-6" v-for="item in basicData" :key="item.type">
+      <DescCard :title="item.title" :type="item.type" :data="item.data" :id="info.id" />
+    </div>
+  </div>
+</template>
+
+<script setup lang="ts">
+  import { ref, reactive } from 'vue';
+  import DescCard from '/@/components/XTCard/src/DescCard.vue';
+  import { BasicData } from './data';
+  import { onMounted } from 'vue';
+  import { formatDictValue } from '/@/utils';
+  import { otherDetail } from '/@/api/biz/engineer/otherApi';
+  import { listDictModelBatch } from '/@/api/common';
+
+  const props = defineProps({
+    info: {
+      type: Object,
+      default: () => {},
+    } as any,
+  });
+  const bizDictOptions = reactive({
+    deviceType: [],
+  });
+  const bizDictData = ref([{ key: 'deviceType', dictCode: 'od' }]);
+  onMounted(async () => {
+    const res = await listDictModelBatch(bizDictData.value.map(ele => ele.dictCode));
+    for (const i in res) {
+      const filter = bizDictData.value.filter(ele => ele.dictCode == i)[0];
+      bizDictOptions[filter.key] = res[i];
+    }
+    await getData();
+  });
+  const basicData = ref(BasicData as any);
+  // 获取数据
+  async function getData() {
+    const res = await otherDetail(props.info?.id);
+    basicData.value[0].data.forEach(ele => {
+      if (ele.dict) {
+        ele.value = formatDictValue(bizDictOptions[ele.field], res[ele.field]);
+      } else {
+        ele.value = res[ele.field];
+      }
+    });
+  }
+</script>
+
+<style lang="less" scoped></style>

+ 90 - 0
src/views/biz/engineer/other/formModal.vue

@@ -0,0 +1,90 @@
+<template>
+  <div class="modals">
+    <BasicModal
+      v-bind="$attrs"
+      destroyOnClose
+      @register="registerModal"
+      :title="getTitle"
+      @ok="handleSubmit"
+      :width="880"
+      @cancel="handleCancel"
+    >
+      <div class="!pl-8 !pt-4">
+        <BasicForm @register="registerForm" />
+      </div>
+    </BasicModal>
+  </div>
+</template>
+<script lang="ts" setup>
+  import { ref, computed, unref } from 'vue';
+  import { BasicModal, useModalInner } from '/@/components/Modal';
+  import { BasicForm, useForm } from '/@/components/Form';
+  import { useMessage } from '/@/hooks/web/useMessage';
+  import { dataFormSchema } from './data';
+
+  import { otherAdd, otherDetail, otherEdit } from '/@/api/biz/engineer/otherApi';
+
+  const emit = defineEmits(['success', 'cancel', 'register']);
+
+  const getTitle = computed(() => (!unref(isUpdate) ? '新增其他设备' : '编辑其他设备'));
+  const isUpdate = ref(false);
+  const rowId = ref();
+
+  const { createMessage } = useMessage();
+  const [registerForm, { resetFields, validate, setFieldsValue }] = useForm({
+    layout: 'vertical',
+    showResetButton: true,
+    labelWidth: 100,
+    schemas: dataFormSchema,
+    showActionButtonGroup: false,
+    actionColOptions: {
+      span: 24,
+    },
+    baseColProps: {
+      span: 12,
+    },
+    wrapperCol: {
+      span: 22,
+    },
+  });
+  const [registerModal, { setModalProps, closeModal }] = useModalInner(async data => {
+    await resetFields();
+    setModalProps({ confirmLoading: false });
+    isUpdate.value = !!data?.isUpdate;
+
+    if (unref(isUpdate)) {
+      rowId.value = data.record.id;
+      const resData = await otherDetail(data.record.id);
+      console.log('resData::::', resData);
+      await setFieldsValue({
+        ...resData,
+      });
+    }
+  });
+
+  // 提交按钮事件
+  async function handleSubmit() {
+    try {
+      const values = await validate();
+      setModalProps({ confirmLoading: true });
+      !unref(isUpdate)
+        ? await otherAdd({ ...values })
+        : await otherEdit({ ...values, id: rowId.value });
+      !unref(isUpdate) ? createMessage.success('新增成功!') : createMessage.success('编辑成功!');
+      closeModal();
+      emit('success', { isUpdate: unref(isUpdate), values: { ...values, id: rowId.value } });
+    } finally {
+      setModalProps({ confirmLoading: false, canFullscreen: false });
+    }
+  }
+
+  async function handleCancel() {
+    closeModal();
+    emit('cancel');
+  }
+</script>
+<style lang="less" scoped>
+  ::v-deep(.ant-modal) {
+    background-color: #000;
+  }
+</style>

+ 284 - 3
src/views/biz/engineer/other/index.vue

@@ -1,7 +1,288 @@
 <template>
-  <div> 占位符 </div>
+  <div class="m-4 modals">
+    <div>
+      <XTTitle title="其他设备" :right-data="titleData" @click="callTitleClick" />
+      <div class="flex items-center justify-between my-4">
+        <XTTab
+          type="illness"
+          :width="180"
+          :selected="tabSelected"
+          :data="typeOptions"
+          @item-click="callTab"
+        />
+        <XTForm :form-data="formData" @change="callForm" />
+      </div>
+    </div>
+    <BasicTable @register="registerTable">
+      <template #bodyCell="{ column, record }">
+        <template v-if="column.key === 'isWarranty'">
+          <span> {{ commonDict(record.isWarranty, 0) }}</span>
+        </template>
+        <template v-if="column.key === 'name'">
+          <a @click="goDetail(record)">{{ record.name }}</a>
+        </template>
+        <template v-if="column.key === 'action'">
+          <TableAction
+            :actions="[
+              {
+                label: '编辑',
+                auth: 'biz:consumable:edit',
+                tooltip: '编辑',
+                onClick: handleEdit.bind(null, record),
+              },
+              {
+                label: '维修',
+                auth: 'biz:consumable:edit',
+                tooltip: '维修',
+                onClick: handleMaintenance.bind(null, record),
+              },
+              {
+                label: '保养',
+                auth: 'biz:consumable:edit',
+                tooltip: '保养',
+                onClick: handleUpkeep.bind(null, record),
+              },
+            ]"
+          />
+        </template>
+      </template>
+    </BasicTable>
+    <FormModal @register="registerModal" @success="callSuccess" @cancel="handleCancel" />
+    <MaintenanceFormModal
+      @register="registerMaintenanceModal"
+      @success="callSuccess"
+      @cancel="handleCancel"
+    />
+    <UpkeepFormModal
+      @register="registerUpkeepModal"
+      @success="callSuccess"
+      @cancel="handleCancel"
+    />
+  </div>
 </template>
+<script lang="ts" setup>
+  import { onBeforeMount, ref } from 'vue';
+  import { BasicTable, useTable, TableAction } from '/@/components/TableCard';
+  import FormModal from './formModal.vue';
+  import MaintenanceFormModal from './maintenanceFormModal.vue';
+  import UpkeepFormModal from './upkeepFormModal.vue';
+  import { commonDict } from '/@/utils';
+  import { columns } from './data';
+  import { otherQueryPage, otherRemove, otherTypeCount } from '/@/api/biz/engineer/otherApi';
+  import { listDictModel } from '/@/api/common';
+  import { useModal } from '/@/components/Modal';
+  import { XTTitle } from '/@/components/XTTitle/index';
+  import { XTTab } from '/@/components/XTTab/index';
+  import { useRouter } from 'vue-router';
 
-<script setup lang="ts"></script>
+  // 路由跳转
+  const router = useRouter();
+  // 标题数据
+  const titleData = [
+    {
+      type: 'add',
+      btnIcon: 'icon-xt-add_default',
+      auth: ['biz:consumable:add'],
+      btnText: '新增设备',
+    },
+  ];
+  // formdata
+  const formData = [
+    {
+      name: 'searchNames',
+      componentType: 'Input',
+      prefix: 'icon-xt-search',
+      placeholder: '请输入设备编号',
+      width: 240,
+    },
+  ];
+  // tab 切换选中
+  const tabSelected = ref();
+  // 操作名称
+  const searchNames = ref('');
+  const shiftDate = ref([]);
 
-<style lang="less" scoped></style>
+  const typeOptions = ref();
+  const responsesupplierCategoryOptions = ref();
+  onBeforeMount(async () => {
+    responsesupplierCategoryOptions.value = await listDictModel({ dictCode: 'pht' });
+    getTab();
+  });
+
+  const [registerModal, { openModal }] = useModal();
+  const [registerMaintenanceModal, { openModal: openMaintenanceModal }] = useModal();
+  const [registerUpkeepModal, { openModal: openUpkeepModal }] = useModal();
+  const tableSort = ref([
+    {
+      field: 'create_time',
+      direction: 'DESC',
+    },
+  ]) as any;
+
+  const [registerTable, { reload, clearSelectedRowKeys }] = useTable({
+    api: otherQueryPage,
+    batchDelApi: otherRemove,
+    delAuthList: ['biz:consumable:remove'],
+    rowKey: 'id',
+    columns,
+    showIndexColumn: true,
+    bordered: true,
+    actionColumn: {
+      width: 200,
+      title: '操作',
+      dataIndex: 'action',
+    },
+    beforeFetch: handleBeforeFetch,
+    sortFn: handleSortFn,
+  });
+  // 详情按钮事件
+  function handleEdit(record) {
+    openModal(true, {
+      record,
+      isUpdate: true,
+    });
+  }
+
+  // 新增按钮事件
+  function callTitleClick(data) {
+    if (data.type == 'add') {
+      openModal(true, {
+        isUpdate: false,
+        record: data,
+      });
+    }
+  }
+
+  // 表格点击字段排序
+  function handleSortFn(sortInfo) {
+    if (sortInfo?.order && sortInfo?.columnKey) {
+      // 默认单列排序
+      tableSort.value = [
+        {
+          field: sortInfo.columnKey,
+          direction: sortInfo.order.replace(/(\w+)(end)/g, '$1').toUpperCase(),
+        },
+      ];
+    }
+  }
+  // 打开维修弹框
+  function handleMaintenance(record) {
+    openMaintenanceModal(true, {
+      record,
+    });
+  }
+  // 打开保养弹框
+  function handleUpkeep(record) {
+    openUpkeepModal(true, {
+      record,
+    });
+  }
+
+  // 表格请求之前,对参数进行处理, 添加默认 排序
+  async function handleBeforeFetch(params) {
+    return {
+      ...params,
+      orders: tableSort.value,
+      uniqueCode: searchNames.value == '' ? undefined : searchNames.value,
+      deviceType: tabSelected.value == '' ? undefined : tabSelected.value,
+    };
+  }
+
+  async function getTab() {
+    typeOptions.value = await listDictModel({ dictCode: 'od' });
+    const typeNums = await otherTypeCount(); // 获取各类型数量
+    let typeList = [];
+    typeOptions.value.forEach(ele => {
+      // 变量各类型放置对应数量
+      let typeData = {};
+      Object.keys(typeNums).forEach(numKey => {
+        if (ele.value == numKey) {
+          typeData = {
+            key: ele.value,
+            label: ele.label,
+            value: typeNums[numKey],
+            hasValue: true,
+            prefixColor: ele.prefixColor,
+            hasBracket: true,
+          };
+          typeList.push(typeData);
+        }
+      });
+    });
+    typeList = typeList.reverse();
+    typeList.splice(0, 0, {
+      key: '',
+      label: '全部',
+      value: typeNums.total,
+      hasValue: true,
+      hasBracket: true,
+    });
+    typeOptions.value = typeList;
+    tabSelected.value = typeOptions.value[0].key;
+  }
+
+  //取消按钮事件
+  async function handleCancel() {
+    clearSelectedRowKeys();
+    await reload();
+    await getTab();
+  }
+
+  // 弹窗回调事件
+  async function callSuccess({ isUpdate, values }) {
+    console.log(isUpdate);
+    console.log(values);
+    await reload();
+    await getTab();
+  }
+  // 选项卡组件回调
+  async function callTab(data) {
+    tabSelected.value = data.value;
+    await reload();
+  }
+
+  // 查询组件回调
+  async function callForm(data) {
+    shiftDate.value = data.shiftDate ? data.shiftDate : '';
+    searchNames.value = data.searchNames ? data.searchNames : '';
+    await reload();
+  }
+
+  // 打开详情页面
+  function goDetail(record) {
+    console.log('record::', record);
+    router.push({
+      path: '/bizEngineer/otherDetail',
+      query: {
+        id: record.id,
+        name: record.name,
+      },
+    });
+  }
+</script>
+<style lang="less" scoped>
+  .table-dot {
+    display: inline-block;
+    width: 10px;
+    height: 10px;
+    margin-right: 6px;
+    border-radius: 50%;
+  }
+
+  ::v-deep(.ant-input-prefix) {
+    color: #8a99ac;
+  }
+
+  .colUpdateAvatar {
+    display: flex;
+    justify-content: center;
+    text-align: center;
+    line-height: 28px;
+  }
+
+  .colImg {
+    width: 28px;
+    height: 28px;
+    margin-right: 5px;
+  }
+</style>

+ 111 - 0
src/views/biz/engineer/other/maintenanceFormModal.vue

@@ -0,0 +1,111 @@
+<template>
+  <div class="modals">
+    <BasicModal
+      v-bind="$attrs"
+      destroyOnClose
+      @register="registerModal"
+      :title="getTitle"
+      @ok="handleSubmit"
+      :width="880"
+      @cancel="handleCancel"
+    >
+      <div class="!pl-8 !pt-4">
+        <BasicForm @register="registerForm">
+          <template #uniqueCode>
+            <span>{{ deviceInfo?.uniqueCode }}</span>
+          </template>
+          <template #manufacturer>
+            <span>{{ deviceInfo?.manufacturer }}</span>
+          </template>
+          <template #model>
+            <span>{{ deviceInfo?.model }}</span>
+          </template>
+        </BasicForm>
+      </div>
+    </BasicModal>
+  </div>
+</template>
+<script lang="ts" setup>
+  import { ref, computed, unref } from 'vue';
+  import { BasicModal, useModalInner } from '/@/components/Modal';
+  import { BasicForm, useForm } from '/@/components/Form';
+  import { useMessage } from '/@/hooks/web/useMessage';
+  import { maintenanceDataFormSchema } from './data';
+  import { otherDetail } from '@/api/biz/engineer/otherApi';
+  import {
+    maintenanceAdd,
+    maintenanceDetail,
+    maintenanceEdit,
+  } from '/@/api/biz/engineer/maintenanceApi';
+
+  const emit = defineEmits(['success', 'cancel', 'register']);
+
+  const getTitle = computed(() => (!unref(isUpdate) ? '维修设备' : '编辑设备'));
+  const isUpdate = ref(false);
+  const deviceInfo = ref();
+  const rowId = ref();
+
+  const { createMessage } = useMessage();
+  const [registerForm, { resetFields, validate, setFieldsValue }] = useForm({
+    layout: 'vertical',
+    showResetButton: true,
+    labelWidth: 100,
+    schemas: maintenanceDataFormSchema,
+    showActionButtonGroup: false,
+    actionColOptions: {
+      span: 24,
+    },
+    baseColProps: {
+      span: 12,
+    },
+    wrapperCol: {
+      span: 22,
+    },
+  });
+  const [registerModal, { setModalProps, closeModal }] = useModalInner(async data => {
+    await resetFields();
+    setModalProps({ confirmLoading: false });
+    isUpdate.value = !!data?.isUpdate;
+    if (!data.record.name) {
+      deviceInfo.value = await otherDetail(data.record?.id);
+    } else {
+      deviceInfo.value = data.record;
+    }
+    if (unref(isUpdate)) {
+      rowId.value = data.maintenanceRecord.id;
+      const resData = await maintenanceDetail(data.maintenanceRecord.id);
+      console.log('resData::::', resData);
+      await setFieldsValue({
+        ...resData,
+      });
+    }
+  });
+
+  // 提交按钮事件
+  async function handleSubmit() {
+    try {
+      const values = await validate();
+      setModalProps({ confirmLoading: true });
+      values.picture = values.files && values.files.map(ele => ele.id);
+      values.deviceId = deviceInfo.value.id;
+      !unref(isUpdate)
+        ? await maintenanceAdd({ ...values })
+        : await maintenanceEdit({ ...values, id: rowId.value });
+      !unref(isUpdate) ? createMessage.success('新增成功!') : createMessage.success('编辑成功!');
+      closeModal();
+      emit('success', { isUpdate: unref(isUpdate), values: { ...values, id: rowId.value } });
+    } finally {
+      setModalProps({ confirmLoading: false, canFullscreen: false });
+    }
+  }
+
+  async function handleCancel() {
+    closeModal();
+    emit('cancel');
+  }
+</script>
+<style lang="less" scoped>
+  ::v-deep(.ant-modal) {
+    background-color: #000;
+  }
+</style>

+ 39 - 0
src/views/biz/engineer/other/maintenanceList/data.ts

@@ -0,0 +1,39 @@
+import { BasicColumn } from '/@/components/Table';
+
+export const columns: BasicColumn[] = [
+  {
+    title: '维修时间',
+    dataIndex: 'maintenanceTime',
+    align: 'left',
+  },
+  {
+    title: '维修方',
+    dataIndex: 'maintenanceCompany',
+    align: 'left',
+  },
+  {
+    title: '异常信息',
+    dataIndex: 'malfunctionMessage',
+    align: 'left',
+  },
+  {
+    title: '维修内容',
+    dataIndex: 'repairContent',
+    align: 'left',
+  },
+  {
+    title: '解决进度',
+    dataIndex: 'schedule',
+    align: 'left',
+  },
+  {
+    title: '维修费用(元)',
+    dataIndex: 'costYuan',
+    align: 'left',
+  },
+  {
+    title: '维修图片',
+    dataIndex: 'picture',
+    align: 'left',
+  },
+];

+ 262 - 0
src/views/biz/engineer/other/maintenanceList/index.vue

@@ -0,0 +1,262 @@
+<template>
+  <div>
+    <div class="flex justify-between mb-4">
+      <div>
+        <a-button type="primary" size="large" class="btn-add" @click="handleCreate"
+          ><template #icon> <Icon icon="icon-xt-add_default|iconfont" /> </template
+          >新增维修</a-button
+        >
+      </div>
+      <div>
+        <XTForm :form-data="formData" @change="callForm" />
+      </div>
+    </div>
+    <BasicTable @register="registerTable">
+      <template #bodyCell="{ column, record }">
+        <template v-if="column.key === 'maintenanceCompany'">
+          <span>{{ formatDictValue(bizDictOptions.dmc, record.maintenanceCompany) }}</span>
+        </template>
+        <template v-if="column.key === 'schedule'">
+          <span>{{ formatDictValue(bizDictOptions.rp, record.schedule) }}</span>
+        </template>
+        <template v-if="column.key === 'picture'">
+          <Image
+            v-if="record.files && record.files.length > 0"
+            :src="record.files[0].absolutePath"
+            :width="60"
+          />
+        </template>
+        <template v-if="column.key === 'action'">
+          <TableAction
+            :actions="[
+              {
+                auth: 'archives:patrolWard:edit',
+                icon: 'icon-xt-details_edit_default|iconfont',
+                tooltip: '编辑',
+                onClick: handleEdit.bind(null, record),
+              },
+              {
+                auth: 'archives:patrolWard:remove',
+                icon: 'icon-xt-details_delete_default|iconfont',
+                tooltip: '删除',
+                popConfirm: {
+                  title: '是否取消删除',
+                  placement: 'left',
+                  confirm: handleDelete.bind(null, record, column),
+                },
+              },
+            ]"
+          />
+        </template>
+      </template>
+    </BasicTable>
+    <FormModal @register="registerModal" @success="callSuccess" />
+  </div>
+</template>
+<script lang="ts" setup>
+  import { onBeforeMount, onMounted, reactive, ref } from 'vue';
+  import { XTForm } from '/@/components/XTForm/index';
+  import { BasicTable, useTable, TableAction } from '/@/components/Table';
+  import { useMessage } from '/@/hooks/web/useMessage';
+  import FormModal from '../maintenanceFormModal.vue';
+
+  import Icon from '/@/components/Icon/index';
+  import { columns } from './data';
+  import { listDictModelBatch } from '/@/api/common';
+  import { maintenanceQueryPage, maintenanceRemove } from '/@/api/biz/engineer/maintenanceApi';
+  import { useModal } from '/@/components/Modal';
+  import { Image } from 'ant-design-vue';
+  import dayjs from 'dayjs';
+  import { formatDictValue } from '/@/utils';
+
+  const props = defineProps({
+    info: {
+      type: Object,
+      default: () => {},
+    },
+  });
+
+  const { createMessage } = useMessage();
+  const [registerModal, { openModal }] = useModal();
+  const tableSort = ref([
+    {
+      field: 'create_time',
+      direction: 'DESC',
+    },
+  ]) as any;
+
+  const dictsOption = ref([]) as any;
+  // formdata
+  const formData = [
+    {
+      label: '维修方',
+      name: 'maintenanceCompany',
+      componentType: 'Select',
+      dicts: dictsOption.value,
+      placeholder: '请选择维修方',
+      prefix: 'icon-xt-search',
+      width: 280,
+    },
+    {
+      name: 'patrolTime',
+      label: '维修时间',
+      componentType: 'RangePicker',
+      placeholder: '请选择维修时间',
+      format: 'YYYY-MM-DD',
+      valueFormat: 'YYYY-MM-DD',
+    },
+  ];
+  const formValue = reactive({
+    patrolTime: [],
+    maintenanceCompany: '',
+  });
+
+  const [registerTable, { reload }] = useTable({
+    api: maintenanceQueryPage,
+    rowKey: 'id',
+    columns,
+    showIndexColumn: false,
+    bordered: true,
+    striped: false,
+    actionColumn: {
+      width: 200,
+      title: '操作',
+      dataIndex: 'action',
+    },
+    beforeFetch: handleBeforeFetch,
+    sortFn: handleSortFn,
+  });
+  const bizDictData = ref([
+    { key: 'dmc', dictCode: 'dmc' },
+    { key: 'rp', dictCode: 'rp' },
+  ]);
+
+  const bizDictOptions = reactive<any>({});
+  onBeforeMount(async () => {
+    const res = await listDictModelBatch(bizDictData.value.map(ele => ele.dictCode));
+    for (const i in res) {
+      const filter = bizDictData.value.filter(ele => ele.dictCode == i)[0];
+      bizDictOptions[filter.key] = res[i];
+    }
+    const types = bizDictOptions.dmc;
+    types.forEach(item => {
+      dictsOption.value.push({
+        label: item.label,
+        value: item.value,
+      });
+    });
+  });
+  onMounted(async () => {
+    // callForm({
+    //   patrolTime: [
+    //     dayjs().subtract(3, 'month').format('YYYY-MM-DD'),
+    //     dayjs().add(1, 'day').format('YYYY-MM-DD'),
+    //   ],
+    // });
+  });
+  // 新增按钮事件
+  function handleCreate() {
+    openModal(true, {
+      isUpdate: false,
+      record: { id: props.info.id },
+    });
+  }
+
+  // 编辑按钮事件
+  function handleEdit(record: Recordable) {
+    openModal(true, {
+      record: { id: props.info.id },
+      maintenanceRecord: record,
+      isUpdate: true,
+    });
+  }
+
+  // 删除按钮事件
+  async function handleDelete(record: Recordable) {
+    await maintenanceRemove([record.id]);
+    createMessage.success('删除成功!');
+    await reload();
+  }
+  // 表格点击字段排序
+  function handleSortFn(sortInfo) {
+    if (sortInfo?.order && sortInfo?.columnKey) {
+      // 默认单列排序
+      tableSort.value = [
+        {
+          field: sortInfo.columnKey,
+          direction: sortInfo.order.replace(/(\w+)(end)/g, '$1').toUpperCase(),
+        },
+      ];
+    }
+  }
+
+  // 表格请求之前,对参数进行处理, 添加默认 排序
+  function handleBeforeFetch(params) {
+    return {
+      ...params,
+      orders: tableSort.value,
+      deviceId: props.info?.id,
+      maintenanceTime:
+        formValue.patrolTime && formValue.patrolTime.length > 0
+          ? [
+              formValue.patrolTime[0],
+              dayjs(formValue.patrolTime[1]).add(1, 'day').format('YYYY-MM-DD'),
+            ]
+          : undefined,
+      maintenanceCompany: formValue.maintenanceCompany,
+    };
+  }
+
+  // 弹窗回调事件
+  async function callSuccess() {
+    await reload();
+  }
+
+  // 查询回调
+  async function callForm(data) {
+    formValue.maintenanceCompany = data.maintenanceCompany || '';
+    formValue.patrolTime = data.patrolTime || [];
+    await reload();
+  }
+</script>
+<style lang="less" scoped>
+  ::v-deep(.ant-btn-link) {
+    color: rgb(61 65 85 / 100%);
+  }
+
+  ::v-deep(.ant-input) {
+    border-color: #c2ccd4;
+    border-radius: 4px;
+  }
+
+  ::v-deep(.ant-input-affix-wrapper) {
+    border-color: #c2ccd4;
+    border-radius: 4px;
+  }
+
+  ::v-deep(.ant-picker) {
+    border-color: #c2ccd4;
+    border-radius: 4px;
+  }
+
+  ::v-deep(.ant-table-tbody > tr > td) {
+    border-right: 0 !important;
+    border-left: 0 !important;
+    border-bottom: 1px solid #f0f0f0;
+  }
+
+  ::v-deep(.ant-table-wrapper table) {
+    border: 0;
+  }
+
+  ::v-deep(.ant-table-cell-fix-right-first::after, .ant-table-cell-fix-right-last::after) {
+    content: '';
+    top: auto;
+    width: 0;
+  }
+
+  .btn-add {
+    width: 120px;
+    border-radius: 4px;
+  }
+</style>

+ 106 - 0
src/views/biz/engineer/other/upkeepFormModal.vue

@@ -0,0 +1,106 @@
+<template>
+  <div class="modals">
+    <BasicModal
+      v-bind="$attrs"
+      destroyOnClose
+      @register="registerModal"
+      :title="getTitle"
+      @ok="handleSubmit"
+      :width="600"
+      @cancel="handleCancel"
+    >
+      <div class="!pl-8 !pt-4">
+        <BasicForm @register="registerForm">
+          <template #uniqueCode>
+            <span>{{ deviceInfo?.uniqueCode }}</span>
+          </template>
+          <template #manufacturer>
+            <span>{{ deviceInfo?.manufacturer }}</span>
+          </template>
+          <template #model>
+            <span>{{ deviceInfo?.model }}</span>
+          </template>
+        </BasicForm>
+      </div>
+    </BasicModal>
+  </div>
+</template>
+<script lang="ts" setup>
+  import { ref, computed, unref } from 'vue';
+  import { BasicModal, useModalInner } from '/@/components/Modal';
+  import { BasicForm, useForm } from '/@/components/Form';
+  import { useMessage } from '/@/hooks/web/useMessage';
+  import { upkeepDataFormSchema } from './data';
+  import { otherDetail } from '@/api/biz/engineer/otherApi';
+  import { upkeepAdd, upkeepDetail, upkeepEdit } from '/@/api/biz/engineer/otherUpkeepApi';
+  const emit = defineEmits(['success', 'cancel', 'register']);
+
+  const getTitle = computed(() => (!unref(isUpdate) ? '保养设备' : '保养设备'));
+  const isUpdate = ref(false);
+  const deviceInfo = ref();
+  const rowId = ref();
+
+  const { createMessage } = useMessage();
+  const [registerForm, { resetFields, validate, setFieldsValue }] = useForm({
+    layout: 'vertical',
+    showResetButton: true,
+    labelWidth: 100,
+    schemas: upkeepDataFormSchema,
+    showActionButtonGroup: false,
+    actionColOptions: {
+      span: 24,
+    },
+    baseColProps: {
+      span: 24,
+    },
+    wrapperCol: {
+      span: 22,
+    },
+  });
+  const [registerModal, { setModalProps, closeModal }] = useModalInner(async data => {
+    await resetFields();
+    setModalProps({ confirmLoading: false });
+    isUpdate.value = !!data?.isUpdate;
+    if (!data.record.name) {
+      deviceInfo.value = await otherDetail(data.record?.id);
+    } else {
+      deviceInfo.value = data.upkeepRecord.record;
+    }
+    if (unref(isUpdate)) {
+      rowId.value = data.upkeepRecord.id;
+      const resData = await upkeepDetail(data.upkeepRecord.id);
+      console.log('resData::::', resData);
+      await setFieldsValue({
+        ...resData,
+      });
+    }
+  });
+
+  // 提交按钮事件
+  async function handleSubmit() {
+    try {
+      const values = await validate();
+      setModalProps({ confirmLoading: true });
+      values.picture = values.files && values.files.map(ele => ele.id);
+      values.deviceId = deviceInfo.value.id;
+      !unref(isUpdate)
+        ? await upkeepAdd({ ...values })
+        : await upkeepEdit({ ...values, id: rowId.value });
+      !unref(isUpdate) ? createMessage.success('新增成功!') : createMessage.success('编辑成功!');
+      closeModal();
+      emit('success', { isUpdate: unref(isUpdate), values: { ...values, id: rowId.value } });
+    } finally {
+      setModalProps({ confirmLoading: false, canFullscreen: false });
+    }
+  }
+
+  async function handleCancel() {
+    closeModal();
+    emit('cancel');
+  }
+</script>
+<style lang="less" scoped>
+  ::v-deep(.ant-modal) {
+    background-color: #000;
+  }
+</style>

+ 24 - 0
src/views/biz/engineer/other/upkeepList/data.ts

@@ -0,0 +1,24 @@
+import { BasicColumn } from '/@/components/Table';
+
+export const columns: BasicColumn[] = [
+  {
+    title: '保养时间',
+    dataIndex: 'maintainTime',
+    align: 'left',
+  },
+  {
+    title: '保养方',
+    dataIndex: 'maintainCompany',
+    align: 'left',
+  },
+  {
+    title: '保养内容',
+    dataIndex: 'content',
+    align: 'left',
+  },
+  {
+    title: '保养图片',
+    dataIndex: 'picture',
+    align: 'left',
+  },
+];

+ 261 - 0
src/views/biz/engineer/other/upkeepList/index.vue

@@ -0,0 +1,261 @@
+<template>
+  <div>
+    <div class="flex justify-between mb-4">
+      <div>
+        <a-button type="primary" size="large" class="btn-add" @click="handleCreate"
+          ><template #icon> <Icon icon="icon-xt-add_default|iconfont" /> </template
+          >新增保养</a-button
+        >
+      </div>
+      <div>
+        <XTForm :form-data="formData" @change="callForm" />
+      </div>
+    </div>
+    <BasicTable @register="registerTable">
+      <template #bodyCell="{ column, record }">
+        <template v-if="column.key === 'maintainCompany'">
+          <span>{{ formatDictValue(bizDictOptions.dmc, record.maintainCompany) }}</span>
+        </template>
+        <template v-if="column.key === 'schedule'">
+          <span>{{ formatDictValue(bizDictOptions.rp, record.schedule) }}</span>
+        </template>
+        <template v-if="column.key === 'picture'">
+          <Image
+            v-if="record.files && record.files.length > 0"
+            :src="record.files[0].absolutePath"
+            :width="60"
+          />
+        </template>
+        <template v-if="column.key === 'action'">
+          <TableAction
+            :actions="[
+              {
+                auth: 'archives:patrolWard:edit',
+                icon: 'icon-xt-details_edit_default|iconfont',
+                tooltip: '编辑',
+                onClick: handleEdit.bind(null, record),
+              },
+              {
+                auth: 'archives:patrolWard:remove',
+                icon: 'icon-xt-details_delete_default|iconfont',
+                tooltip: '删除',
+                popConfirm: {
+                  title: '是否取消删除',
+                  placement: 'left',
+                  confirm: handleDelete.bind(null, record, column),
+                },
+              },
+            ]"
+          />
+        </template>
+      </template>
+    </BasicTable>
+    <FormModal @register="registerModal" @success="callSuccess" />
+  </div>
+</template>
+<script lang="ts" setup>
+  import { onBeforeMount, onMounted, reactive, ref } from 'vue';
+  import { XTForm } from '/@/components/XTForm/index';
+  import { BasicTable, useTable, TableAction } from '/@/components/Table';
+  import { useMessage } from '/@/hooks/web/useMessage';
+  import FormModal from '../upkeepFormModal.vue';
+  import Icon from '/@/components/Icon/index';
+  import { columns } from './data';
+  import { listDictModelBatch } from '/@/api/common';
+  import { upkeepQueryPage, upkeepRemove } from '/@/api/biz/engineer/otherUpkeepApi';
+  import { useModal } from '/@/components/Modal';
+  import { Image } from 'ant-design-vue';
+  import dayjs from 'dayjs';
+  import { formatDictValue } from '/@/utils';
+
+  const props = defineProps({
+    info: {
+      type: Object,
+      default: () => {},
+    },
+  });
+
+  const { createMessage } = useMessage();
+  const [registerModal, { openModal }] = useModal();
+  const tableSort = ref([
+    {
+      field: 'create_time',
+      direction: 'DESC',
+    },
+  ]) as any;
+
+  const dictsOption = ref([]) as any;
+  // formdata
+  const formData = [
+    {
+      label: '保养厂商',
+      name: 'maintainCompany',
+      componentType: 'Select',
+      dicts: dictsOption.value,
+      placeholder: '请选择维修方',
+      prefix: 'icon-xt-search',
+      width: 280,
+    },
+    {
+      name: 'patrolTime',
+      label: '保养时间',
+      componentType: 'RangePicker',
+      placeholder: '请选择保养时间',
+      format: 'YYYY-MM-DD',
+      valueFormat: 'YYYY-MM-DD',
+    },
+  ];
+  const formValue = reactive({
+    patrolTime: [],
+    maintainCompany: '',
+  });
+
+  const [registerTable, { reload }] = useTable({
+    api: upkeepQueryPage,
+    rowKey: 'id',
+    columns,
+    showIndexColumn: false,
+    bordered: true,
+    striped: false,
+    actionColumn: {
+      width: 200,
+      title: '操作',
+      dataIndex: 'action',
+    },
+    beforeFetch: handleBeforeFetch,
+    sortFn: handleSortFn,
+  });
+  const bizDictData = ref([
+    { key: 'dmc', dictCode: 'dmc' },
+    { key: 'rp', dictCode: 'rp' },
+  ]);
+
+  const bizDictOptions = reactive<any>({});
+  onBeforeMount(async () => {
+    const res = await listDictModelBatch(bizDictData.value.map(ele => ele.dictCode));
+    for (const i in res) {
+      const filter = bizDictData.value.filter(ele => ele.dictCode == i)[0];
+      bizDictOptions[filter.key] = res[i];
+    }
+    const types = bizDictOptions.dmc;
+    types.forEach(item => {
+      dictsOption.value.push({
+        label: item.label,
+        value: item.value,
+      });
+    });
+  });
+  onMounted(async () => {
+    // callForm({
+    //   patrolTime: [
+    //     dayjs().subtract(3, 'month').format('YYYY-MM-DD'),
+    //     dayjs().add(1, 'day').format('YYYY-MM-DD'),
+    //   ],
+    // });
+  });
+  // 新增按钮事件
+  function handleCreate() {
+    openModal(true, {
+      isUpdate: false,
+      record: { id: props.info.id },
+    });
+  }
+
+  // 编辑按钮事件
+  function handleEdit(record: Recordable) {
+    openModal(true, {
+      record: { id: props.info.id },
+      upkeepRecord: record,
+      isUpdate: true,
+    });
+  }
+
+  // 删除按钮事件
+  async function handleDelete(record: Recordable) {
+    await upkeepRemove([record.id]);
+    createMessage.success('删除成功!');
+    await reload();
+  }
+  // 表格点击字段排序
+  function handleSortFn(sortInfo) {
+    if (sortInfo?.order && sortInfo?.columnKey) {
+      // 默认单列排序
+      tableSort.value = [
+        {
+          field: sortInfo.columnKey,
+          direction: sortInfo.order.replace(/(\w+)(end)/g, '$1').toUpperCase(),
+        },
+      ];
+    }
+  }
+
+  // 表格请求之前,对参数进行处理, 添加默认 排序
+  function handleBeforeFetch(params) {
+    return {
+      ...params,
+      orders: tableSort.value,
+      deviceId: props.info?.id,
+      maintainTime:
+        formValue.patrolTime && formValue.patrolTime.length > 0
+          ? [
+              formValue.patrolTime[0],
+              dayjs(formValue.patrolTime[1]).add(1, 'day').format('YYYY-MM-DD'),
+            ]
+          : undefined,
+      maintainCompany: formValue.maintainCompany,
+    };
+  }
+
+  // 弹窗回调事件
+  async function callSuccess() {
+    await reload();
+  }
+
+  // 查询回调
+  async function callForm(data) {
+    formValue.maintainCompany = data.maintainCompany || '';
+    formValue.patrolTime = data.patrolTime || [];
+    await reload();
+  }
+</script>
+<style lang="less" scoped>
+  ::v-deep(.ant-btn-link) {
+    color: rgb(61 65 85 / 100%);
+  }
+
+  ::v-deep(.ant-input) {
+    border-color: #c2ccd4;
+    border-radius: 4px;
+  }
+
+  ::v-deep(.ant-input-affix-wrapper) {
+    border-color: #c2ccd4;
+    border-radius: 4px;
+  }
+
+  ::v-deep(.ant-picker) {
+    border-color: #c2ccd4;
+    border-radius: 4px;
+  }
+
+  ::v-deep(.ant-table-tbody > tr > td) {
+    border-right: 0 !important;
+    border-left: 0 !important;
+    border-bottom: 1px solid #f0f0f0;
+  }
+
+  ::v-deep(.ant-table-wrapper table) {
+    border: 0;
+  }
+
+  ::v-deep(.ant-table-cell-fix-right-first::after, .ant-table-cell-fix-right-last::after) {
+    content: '';
+    top: auto;
+    width: 0;
+  }
+
+  .btn-add {
+    width: 120px;
+    border-radius: 4px;
+  }
+</style>

+ 1 - 1
src/views/biz/engineer/upkeep/index.vue

@@ -16,7 +16,7 @@
     <BasicTable @register="registerTable">
       <template #bodyCell="{ column, record }">
         <template v-if="column.key === 'picture'">
-          <Image :width="80" :src="record.files ? record.files[0].absolutePath : null" />
+          <Image :width="80" :src="record.files ? record.files[0]?.absolutePath : null" />
         </template>
         <template v-if="column.key === 'maintainCompany'">
           <span> {{ formatDictValue(typeCategoryOptions, record.maintainCompany) }}</span>