Showing
17 changed files
with
667 additions
and
163 deletions
src/api/equipment/category.ts
0 → 100644
| 1 | +import { defHttp } from '/@/utils/http/axios'; | ||
| 2 | + | ||
| 3 | +/** | ||
| 4 | + * 列表 | ||
| 5 | + */ | ||
| 6 | +export const getAllCategory = (params?: { name?: string }) => { | ||
| 7 | + return defHttp.post<any>({ | ||
| 8 | + url: `/deviceCagegory/getAllCagegory`, | ||
| 9 | + params, | ||
| 10 | + }); | ||
| 11 | +}; | ||
| 12 | + | ||
| 13 | +/** | ||
| 14 | + * 新增 | ||
| 15 | + */ | ||
| 16 | +export const saveCategory = (params) => { | ||
| 17 | + return defHttp.post<any>({ | ||
| 18 | + url: `/deviceCagegory/save`, | ||
| 19 | + params, | ||
| 20 | + }); | ||
| 21 | +}; | ||
| 22 | + | ||
| 23 | +/** | ||
| 24 | + * 删除 | ||
| 25 | + */ | ||
| 26 | +export const deleteCategory = (params) => { | ||
| 27 | + return defHttp.get<any>({ | ||
| 28 | + url: `/deviceCagegory/delete`, | ||
| 29 | + params, | ||
| 30 | + }); | ||
| 31 | +}; |
src/api/repair/history.ts
0 → 100644
| 1 | +import { defHttp } from '/@/utils/http/axios'; | ||
| 2 | +import { omit } from 'lodash-es'; | ||
| 3 | + | ||
| 4 | +/** | ||
| 5 | + * 获取列表 | ||
| 6 | + */ | ||
| 7 | +export const getRepairHistoryList = (params) => { | ||
| 8 | + const { page, pageSize } = params; | ||
| 9 | + const otherParams = omit(params, ['page', 'pageSize']); | ||
| 10 | + return defHttp.post<any>({ | ||
| 11 | + url: `/repairRecord/pageData?page=${page}&pageSize=${pageSize}`, | ||
| 12 | + params: otherParams, | ||
| 13 | + }); | ||
| 14 | +}; |
src/api/repair/order.ts
0 → 100644
| 1 | +import { defHttp } from '/@/utils/http/axios'; | ||
| 2 | +import { omit } from 'lodash-es'; | ||
| 3 | + | ||
| 4 | +/** | ||
| 5 | + * 获取列表 | ||
| 6 | + */ | ||
| 7 | +export const getRepairOrderList = (params) => { | ||
| 8 | + const { page, pageSize } = params; | ||
| 9 | + const otherParams = omit(params, ['page', 'pageSize']); | ||
| 10 | + return defHttp.post<any>({ | ||
| 11 | + url: `/repairOrder/pageData?page=${page}&pageSize=${pageSize}`, | ||
| 12 | + params: otherParams, | ||
| 13 | + }); | ||
| 14 | +}; |
| @@ -2,7 +2,8 @@ export default { | @@ -2,7 +2,8 @@ export default { | ||
| 2 | categoryText: '设备类别', | 2 | categoryText: '设备类别', |
| 3 | createCategoryText: '新增设备类别', | 3 | createCategoryText: '新增设备类别', |
| 4 | editCategoryText: '编辑设备类别', | 4 | editCategoryText: '编辑设备类别', |
| 5 | - type_name: '类别名称', | 5 | + categoryNameText: '类型名称', |
| 6 | + orderText: '排序', | ||
| 6 | description: '描述', | 7 | description: '描述', |
| 7 | operationSuccessText: '操作成功', | 8 | operationSuccessText: '操作成功', |
| 8 | -} | 9 | +}; |
src/locales/lang/zh-CN/repair/history.ts
0 → 100644
| 1 | +export default { | ||
| 2 | + listText: '维修记录', | ||
| 3 | + orderText: '维修工单', | ||
| 4 | + orderCode: '记录编号', | ||
| 5 | + deviceNameText: '维修设备', | ||
| 6 | + time: '报修时间', | ||
| 7 | + reportByName: '报修人员', | ||
| 8 | + photo: '故障情况照片', | ||
| 9 | + description: '故障描述', | ||
| 10 | + repairTime: '维修时间', | ||
| 11 | + repairByName: '维修人员', | ||
| 12 | + repairReason: '故障原因', | ||
| 13 | + repairDescription: '维修情况说明', | ||
| 14 | +}; |
src/locales/lang/zh-CN/repair/order.ts
0 → 100644
| 1 | +export default { | ||
| 2 | + listText: '工单列表', | ||
| 3 | + nameText: '方案名称', | ||
| 4 | + time: '报修时间', | ||
| 5 | + nameDetail: '方案明细', | ||
| 6 | + deviceNameText: '设备', | ||
| 7 | + reportDateText: '报修时间', | ||
| 8 | + reportByName: '报修人员', | ||
| 9 | + description: '故障描述', | ||
| 10 | + nameCode: '维修单编号', | ||
| 11 | + typeText: '方案类型', | ||
| 12 | + inspectionText: '巡检方案', | ||
| 13 | + maintenanceText: '保养方案', | ||
| 14 | + SCHEDULING: '排期中', | ||
| 15 | + REPAIRFINISH: '维修完成', | ||
| 16 | + ACCEPTANCEPASSED: '验收通过', | ||
| 17 | + planDetails: '方案明细', | ||
| 18 | + statusText: '状态', | ||
| 19 | + emergencyText: '是否紧急', | ||
| 20 | + enableText: '启用', | ||
| 21 | + disabledText: '停用', | ||
| 22 | + createCategoryText: '创建工单', | ||
| 23 | + editCategoryText: '编辑方案', | ||
| 24 | + detailText: '查看详情', | ||
| 25 | +}; |
| @@ -16,94 +16,60 @@ | @@ -16,94 +16,60 @@ | ||
| 16 | </div> | 16 | </div> |
| 17 | </template> | 17 | </template> |
| 18 | <script setup lang="ts"> | 18 | <script setup lang="ts"> |
| 19 | -import {BasicModal, useModalInner} from "/@/components/Modal"; | ||
| 20 | -import {BasicForm, useForm} from "/@/components/Form"; | ||
| 21 | -import {computed, ref, unref} from "vue"; | ||
| 22 | -import {useI18n} from "/@/hooks/web/useI18n"; | ||
| 23 | -import {schemas} from "/@/views/equipment/category/index"; | ||
| 24 | -import {ipRegex} from "/@/utils/rules"; | ||
| 25 | -import {deleteFormField} from "/@/views/device/deviceaccess/index"; | ||
| 26 | -import { | ||
| 27 | - deviceProfileAccessInformation, | ||
| 28 | - updateDeviceProfileAccessInformation | ||
| 29 | -} from "/@/api/device/deviceAccess"; | ||
| 30 | -import {useMessage} from "/@/hooks/web/useMessage"; | ||
| 31 | -const isUpdate = ref<Boolean>(false); | ||
| 32 | -const { t } = useI18n(); | ||
| 33 | -const emit = defineEmits(['handleReload', 'register']); | ||
| 34 | -const { createMessage } = useMessage(); | 19 | + import { BasicModal, useModalInner } from '/@/components/Modal'; |
| 20 | + import { BasicForm, useForm } from '/@/components/Form'; | ||
| 21 | + import { computed, ref, unref } from 'vue'; | ||
| 22 | + import { useI18n } from '/@/hooks/web/useI18n'; | ||
| 23 | + import { schemas } from '/@/views/equipment/category/index'; | ||
| 35 | 24 | ||
| 36 | -const [registerForm, { getFieldsValue, setFieldsValue, validate, resetFields }] = useForm({ | ||
| 37 | - labelWidth: 150, | ||
| 38 | - schemas, | ||
| 39 | - actionColOptions: { | ||
| 40 | - span: 14, | ||
| 41 | - }, | ||
| 42 | - showActionButtonGroup: false, | ||
| 43 | -}); | 25 | + import { useMessage } from '/@/hooks/web/useMessage'; |
| 26 | + import { saveCategory } from '/@/api/equipment/category'; | ||
| 27 | + const isUpdate = ref<Boolean>(false); | ||
| 28 | + const parentId = ref<string>(''); | ||
| 29 | + const { t } = useI18n(); | ||
| 30 | + const emit = defineEmits(['handleReload', 'register']); | ||
| 31 | + const { createMessage } = useMessage(); | ||
| 44 | 32 | ||
| 45 | -const recordInfo = ref<Recordable>({}); | ||
| 46 | - | ||
| 47 | -const [register, { closeModal, setModalProps }] = useModalInner(async (data) => { | ||
| 48 | - await resetFields(); | ||
| 49 | - setModalProps({ confirmLoading: false, loading: true }); | ||
| 50 | - isUpdate.value = data?.isUpdate; | ||
| 51 | - recordInfo.value = data?.record; | ||
| 52 | - if (data?.record) { | ||
| 53 | - const intranetIpAndPort = { | ||
| 54 | - inputIp: data?.record.intranetIp, | ||
| 55 | - inputPort: data?.record.intranetPort, | ||
| 56 | - }; | ||
| 57 | - const outerIpAndPort = { | ||
| 58 | - inputIp: data?.record.outerNetIp, | ||
| 59 | - inputPort: data?.record.outerNetPort, | ||
| 60 | - }; | ||
| 61 | - setFieldsValue(data?.record); | ||
| 62 | - setFieldsValue({ ...data?.record?.sipExtend }); | ||
| 63 | - setFieldsValue({ intranetIpAndPort, outerIpAndPort }); | ||
| 64 | - } | ||
| 65 | - setModalProps({ loading: false }); | ||
| 66 | -}); | 33 | + const [registerForm, { getFieldsValue, setFieldsValue, validate, resetFields }] = useForm({ |
| 34 | + labelWidth: 150, | ||
| 35 | + schemas, | ||
| 36 | + actionColOptions: { | ||
| 37 | + span: 14, | ||
| 38 | + }, | ||
| 39 | + showActionButtonGroup: false, | ||
| 40 | + }); | ||
| 67 | 41 | ||
| 68 | -const getTitle = computed(() => | ||
| 69 | - !unref(isUpdate) | ||
| 70 | - ? t('equipment.category.createCategoryText') | ||
| 71 | - : t('equipment.category.editCategoryText') | ||
| 72 | -); | 42 | + const recordInfo = ref<Recordable>({}); |
| 43 | + const [register, { closeModal, setModalProps }] = useModalInner(async (data) => { | ||
| 44 | + setModalProps({ confirmLoading: false, loading: true }); | ||
| 45 | + isUpdate.value = data?.isUpdate; | ||
| 46 | + parentId.value = data?.parentId; | ||
| 47 | + recordInfo.value = data?.record; | ||
| 48 | + if (data?.record) { | ||
| 49 | + setFieldsValue(data?.record); | ||
| 50 | + } | ||
| 51 | + setModalProps({ loading: false }); | ||
| 52 | + }); | ||
| 73 | 53 | ||
| 74 | -const handleCancel = () => closeModal(); | 54 | + const getTitle = computed(() => |
| 55 | + !unref(isUpdate) | ||
| 56 | + ? t('equipment.category.createCategoryText') | ||
| 57 | + : t('equipment.category.editCategoryText') | ||
| 58 | + ); | ||
| 75 | 59 | ||
| 76 | -const handleOk = async () => { | ||
| 77 | - await validate(); | ||
| 78 | - let values = getFieldsValue(); | ||
| 79 | - const { intranetIpAndPort, outerIpAndPort } = values; | ||
| 80 | - // values.intranetIp = intranetIpAndPort.inputIp; | ||
| 81 | - // values.intranetPort = intranetIpAndPort.inputPort; | ||
| 82 | - // values.outerNetIp = outerIpAndPort.inputIp; | ||
| 83 | - // values.outerNetPort = outerIpAndPort.inputPort; | ||
| 84 | - // if (!ipRegex.test(values.intranetIp)) { | ||
| 85 | - // return createMessage.error(t('deviceManagement.deviceAccess.ipRuleText')); | ||
| 86 | - // } | 60 | + const handleCancel = () => closeModal(); |
| 87 | 61 | ||
| 88 | - const sipExtend = { | ||
| 89 | - serverId: values['serverId'], | ||
| 90 | - serverDomain: values['serverDomain'], | ||
| 91 | - serverPassword: values['serverPassword'], | 62 | + const handleOk = async () => { |
| 63 | + await validate(); | ||
| 64 | + let values = getFieldsValue(); | ||
| 65 | + if (unref(isUpdate)) { | ||
| 66 | + values = { ...values, id: unref(recordInfo).id, parentId: unref(recordInfo).parentId }; | ||
| 67 | + } else { | ||
| 68 | + values = { ...values, parentId: unref(parentId) }; | ||
| 69 | + } | ||
| 70 | + await saveCategory(values); | ||
| 71 | + createMessage.success(t('common.operationSuccessText')); | ||
| 72 | + emit('handleReload'); | ||
| 73 | + handleCancel(); | ||
| 92 | }; | 74 | }; |
| 93 | - values.sipExtend = sipExtend; | ||
| 94 | - deleteFormField.forEach((deleteItem) => { | ||
| 95 | - Reflect.deleteProperty(values, deleteItem); | ||
| 96 | - }); | ||
| 97 | - if (unref(isUpdate)) { | ||
| 98 | - // 更新 | ||
| 99 | - values = { ...values, id: unref(recordInfo).id }; | ||
| 100 | - // await updateDeviceProfileAccessInformation(values); | ||
| 101 | - } else { | ||
| 102 | - // await deviceProfileAccessInformation(values); | ||
| 103 | - } | ||
| 104 | - createMessage.success(t('equipment.category.operationSuccessText')); | ||
| 105 | - emit('handleReload'); | ||
| 106 | - handleCancel(); | ||
| 107 | -}; | ||
| 108 | - | ||
| 109 | </script> | 75 | </script> |
| @@ -27,16 +27,18 @@ | @@ -27,16 +27,18 @@ | ||
| 27 | .but_operation { | 27 | .but_operation { |
| 28 | display: none; // 默认隐藏按钮 | 28 | display: none; // 默认隐藏按钮 |
| 29 | } | 29 | } |
| 30 | - | ||
| 31 | - | ||
| 32 | } | 30 | } |
| 33 | .tree-node:hover { | 31 | .tree-node:hover { |
| 34 | &:hover .but_operation { | 32 | &:hover .but_operation { |
| 35 | display: inline-block; // 悬停时显示按钮 | 33 | display: inline-block; // 悬停时显示按钮 |
| 36 | - .but_type { | ||
| 37 | - margin-left: 32px; | ||
| 38 | - color: red; | ||
| 39 | - } | 34 | + .but_type { |
| 35 | + margin-left: 32px; | ||
| 36 | + color: red; | ||
| 37 | + font-size: 14px; | ||
| 38 | + } | ||
| 40 | } | 39 | } |
| 41 | } | 40 | } |
| 41 | + .ant-tree { | ||
| 42 | + font-size: 15px; | ||
| 43 | + } | ||
| 42 | } | 44 | } |
| 1 | - | ||
| 2 | import { useI18n } from '/@/hooks/web/useI18n'; | 1 | import { useI18n } from '/@/hooks/web/useI18n'; |
| 3 | 2 | ||
| 4 | const { t } = useI18n(); | 3 | const { t } = useI18n(); |
| @@ -7,25 +6,17 @@ import { FormSchema } from '/@/components/Table'; | @@ -7,25 +6,17 @@ import { FormSchema } from '/@/components/Table'; | ||
| 7 | //表单字段 | 6 | //表单字段 |
| 8 | export const schemas: FormSchema[] = [ | 7 | export const schemas: FormSchema[] = [ |
| 9 | { | 8 | { |
| 10 | - field: 'intranetIpAndPort', | ||
| 11 | - label: t('deviceManagement.deviceAccess.intranetIPWithPortText'), | ||
| 12 | - component: 'FormInputGroup', | 9 | + field: 'name', |
| 10 | + label: t('equipment.category.categoryNameText'), | ||
| 11 | + component: 'Input', | ||
| 13 | required: true, | 12 | required: true, |
| 14 | - componentProps: { | ||
| 15 | - inputPlaceholder: t('deviceManagement.deviceAccess.intranetIPPlaceholderText'), | ||
| 16 | - inputNumberPlaceholder: t('deviceManagement.deviceAccess.intranetPortPlaceholderText'), | ||
| 17 | - }, | ||
| 18 | - colProps: { span: 24 }, | 13 | + colProps: { span: 18 }, |
| 19 | }, | 14 | }, |
| 20 | { | 15 | { |
| 21 | - field: 'outerIpAndPort', | ||
| 22 | - label: t('deviceManagement.deviceAccess.outernetIPWithPortText'), | ||
| 23 | - component: 'FormInputGroup', | 16 | + field: 'cagegoryOrder', |
| 17 | + label: t('equipment.category.orderText'), | ||
| 18 | + component: 'Input', | ||
| 24 | required: true, | 19 | required: true, |
| 25 | - componentProps: { | ||
| 26 | - inputPlaceholder: t('deviceManagement.deviceAccess.outernetIPPlaceholderText'), | ||
| 27 | - inputNumberPlaceholder: t('deviceManagement.deviceAccess.outernetPortPlaceholderText'), | ||
| 28 | - }, | ||
| 29 | - colProps: { span: 24 }, | ||
| 30 | - } | 20 | + colProps: { span: 18 }, |
| 21 | + }, | ||
| 31 | ]; | 22 | ]; |
| 1 | <template> | 1 | <template> |
| 2 | - | ||
| 3 | <PageWrapper dense contentFullHeight contentClass="flex"> | 2 | <PageWrapper dense contentFullHeight contentClass="flex"> |
| 4 | <div class="category-tree"> | 3 | <div class="category-tree"> |
| 5 | <div class="category-tree-search"> | 4 | <div class="category-tree-search"> |
| @@ -7,77 +6,120 @@ | @@ -7,77 +6,120 @@ | ||
| 7 | placeholder="请输入关键字搜索" | 6 | placeholder="请输入关键字搜索" |
| 8 | enter-button | 7 | enter-button |
| 9 | size="large" | 8 | size="large" |
| 9 | + v-model:value="searchKeyword" | ||
| 10 | + @search="handleSearch" | ||
| 10 | /> | 11 | /> |
| 11 | </div> | 12 | </div> |
| 12 | - <a-tree :tree-data="treeData" default-expand-all show-icon :default-selected-keys="['0-0']"> | ||
| 13 | - <template #custom="{ title }"> | 13 | + <a-tree v-if="treeData.length > 0" :tree-data="treeData" default-expand-all show-icon> |
| 14 | + <template #custom="{ title, id, record }"> | ||
| 14 | <div class="tree-node"> | 15 | <div class="tree-node"> |
| 15 | <span>{{ title }}</span> | 16 | <span>{{ title }}</span> |
| 16 | <div class="but_operation"> | 17 | <div class="but_operation"> |
| 17 | - <span class="but_type" @click="handleAdd(key)">新增</span> | ||
| 18 | - <span class="but_type">编辑</span> | ||
| 19 | - <span class="but_type">删除</span> | 18 | + <span class="but_type" @click="handleAdd(id)">新增</span> |
| 19 | + <span class="but_type" @click="handleEdit(record)">编辑</span> | ||
| 20 | + <a-popconfirm | ||
| 21 | + title="你是否确认删除操作?" | ||
| 22 | + ok-text="确认" | ||
| 23 | + cancel-text="取消" | ||
| 24 | + @confirm="handleDelete(record)" | ||
| 25 | + > | ||
| 26 | + <span class="but_type">删除</span> | ||
| 27 | + </a-popconfirm> | ||
| 20 | </div> | 28 | </div> |
| 21 | </div> | 29 | </div> |
| 22 | </template> | 30 | </template> |
| 23 | </a-tree> | 31 | </a-tree> |
| 24 | - <categoryModal @register="registerModal" @handleReload="handleReload"/> | 32 | + <categoryModal @register="registerModal" @handleReload="handleReload" /> |
| 25 | </div> | 33 | </div> |
| 26 | </PageWrapper> | 34 | </PageWrapper> |
| 27 | - | ||
| 28 | </template> | 35 | </template> |
| 29 | <script setup lang="ts"> | 36 | <script setup lang="ts"> |
| 30 | -import {PageWrapper} from "/@/components/Page"; | ||
| 31 | -import './index.less'; | ||
| 32 | -import {categoryModal} from './components/index'; | ||
| 33 | -import {useModal} from "/@/components/Modal"; | 37 | + import { PageWrapper } from '/@/components/Page'; |
| 38 | + import './index.less'; | ||
| 39 | + import { categoryModal } from './components/index'; | ||
| 40 | + import { useModal } from '/@/components/Modal'; | ||
| 41 | + import { deleteCategory, getAllCategory } from '/@/api/equipment/category'; | ||
| 42 | + import { ref, onMounted } from 'vue'; | ||
| 43 | + import { useI18n } from '/@/hooks/web/useI18n'; | ||
| 44 | + import { useMessage } from '/@/hooks/web/useMessage'; | ||
| 45 | + const treeData = ref([]); // 声明为响应式变量 | ||
| 46 | + const { t } = useI18n(); | ||
| 47 | + const { createMessage } = useMessage(); | ||
| 48 | + const searchKeyword = ref(''); | ||
| 49 | + // 递归转换函数 | ||
| 50 | + const transformTreeData = (data: any) => { | ||
| 51 | + return data?.map((item) => { | ||
| 52 | + const transformedItem = { | ||
| 53 | + title: item.name, | ||
| 54 | + key: item.id, | ||
| 55 | + id: item.id, | ||
| 56 | + record: item, // 将原始数据赋值给 record | ||
| 57 | + slots: { title: 'custom' }, | ||
| 58 | + }; | ||
| 34 | 59 | ||
| 35 | -const [registerModal, {openModal}] = useModal(); | ||
| 36 | -const treeData = [ | ||
| 37 | - { | ||
| 38 | - title: '全部', | ||
| 39 | - key: '0-0', | ||
| 40 | - slots: {title: 'custom'}, // 添加 title: 'custom' | ||
| 41 | - children: [ | ||
| 42 | - { | ||
| 43 | - title: '德风石化有限公司', | ||
| 44 | - key: '0-0-0', | ||
| 45 | - slots: {title: 'custom'}, // 添加 title: 'custom' | ||
| 46 | - children: [ | ||
| 47 | - { | ||
| 48 | - title: '公共工程', | ||
| 49 | - key: '0-0-0-0', | ||
| 50 | - slots: {title: 'custom'}, // 添加 title: 'custom' | ||
| 51 | - children: [ | ||
| 52 | - { | ||
| 53 | - title: '中心控制室', | ||
| 54 | - key: '0-0-0-0-0', | ||
| 55 | - slots: {title: 'custom'} | ||
| 56 | - }, | ||
| 57 | - {title: '辅料管区', key: '0-0-0-0-1', slots: {title: 'custom'}}, | ||
| 58 | - {title: 'PSA伐区', key: '0-0-0-0-2', slots: {title: 'custom'}}, | ||
| 59 | - {title: '导热油房区', key: '0-0-0-0-3', slots: {title: 'custom'}}, | ||
| 60 | - {title: '甲醇裂解区', key: '0-0-0-0-4', slots: {title: 'custom'}}, | ||
| 61 | - {title: '机柜间', key: '0-0-0-0-5', slots: {title: 'custom'}} | ||
| 62 | - ] | ||
| 63 | - }, | ||
| 64 | - {title: '污水处理站', key: '0-0-0-1', slots: {title: 'custom'}} // 添加 title: 'custom' | ||
| 65 | - ] | 60 | + // 递归处理 children |
| 61 | + if (item.children && item.children.length > 0) { | ||
| 62 | + //@ts-ignore | ||
| 63 | + transformedItem.children = transformTreeData(item.children); | ||
| 66 | } | 64 | } |
| 67 | - ] | ||
| 68 | - } | ||
| 69 | -]; | ||
| 70 | 65 | ||
| 71 | -// 处理新建按钮点击事件 | ||
| 72 | -const handleAdd = (key: string) => { | ||
| 73 | - openModal(true, { | ||
| 74 | - isUpdate: false, // 表示是新建操作 | ||
| 75 | - parentKey: key, // 传递当前节点的 key | 66 | + return transformedItem; |
| 67 | + }); | ||
| 68 | + }; | ||
| 69 | + | ||
| 70 | + // 获取分类数据的函数 | ||
| 71 | + const fetchTreeData = async (name?: string) => { | ||
| 72 | + try { | ||
| 73 | + const res = await getAllCategory({ name }); // 将关键字传递给接口 | ||
| 74 | + // 使用递归函数转换数据 | ||
| 75 | + treeData.value = transformTreeData(res); | ||
| 76 | + } catch (error) { | ||
| 77 | + console.error('获取分类数据失败:', error); | ||
| 78 | + } | ||
| 79 | + }; | ||
| 80 | + | ||
| 81 | + // 组件挂载时获取数据 | ||
| 82 | + onMounted(() => { | ||
| 83 | + fetchTreeData(); | ||
| 76 | }); | 84 | }); |
| 77 | -}; | ||
| 78 | 85 | ||
| 86 | + const [registerModal, { openModal }] = useModal(); | ||
| 87 | + | ||
| 88 | + // 处理搜索事件 | ||
| 89 | + const handleSearch = () => { | ||
| 90 | + fetchTreeData(searchKeyword.value); | ||
| 91 | + }; | ||
| 92 | + | ||
| 93 | + // 处理新建按钮点击事件 | ||
| 94 | + const handleAdd = (key: string) => { | ||
| 95 | + openModal(true, { | ||
| 96 | + isUpdate: false, // 表示是新建操作 | ||
| 97 | + parentId: key, // 传递当前节点的 key | ||
| 98 | + }); | ||
| 99 | + }; | ||
| 100 | + | ||
| 101 | + // 编辑 | ||
| 102 | + const handleEdit = (record?: any) => { | ||
| 103 | + console.log(record, 'record'); | ||
| 104 | + openModal(true, { | ||
| 105 | + isUpdate: true, | ||
| 106 | + record, | ||
| 107 | + }); | ||
| 108 | + }; | ||
| 79 | 109 | ||
| 80 | -const handleReload = () => { | 110 | + const handleDelete = async (record?: any) => { |
| 111 | + let id = record.id; | ||
| 112 | + try { | ||
| 113 | + await deleteCategory({ id }); | ||
| 114 | + createMessage.success(t('common.deleteSuccessText')); | ||
| 115 | + handleReload(); | ||
| 116 | + } catch (error) { | ||
| 117 | + throw error; | ||
| 118 | + } finally { | ||
| 119 | + } | ||
| 120 | + }; | ||
| 81 | 121 | ||
| 82 | -}; | 122 | + const handleReload = () => { |
| 123 | + fetchTreeData(); | ||
| 124 | + }; | ||
| 83 | </script> | 125 | </script> |
src/views/inspection/servicePlan/index.ts
0 → 100644
| 1 | +import { FormSchema } from '/@/components/Form'; | ||
| 2 | +import { useI18n } from '/@/hooks/web/useI18n'; | ||
| 3 | +import { BasicColumn } from '/@/components/Table'; | ||
| 4 | +const { t } = useI18n(); | ||
| 5 | + | ||
| 6 | +export const searchFormSchema: FormSchema[] = [ | ||
| 7 | + { | ||
| 8 | + field: 'preserveName', | ||
| 9 | + label: t('inspection.servicePlan.preserveNameText'), | ||
| 10 | + component: 'Input', | ||
| 11 | + colProps: { span: 12 }, | ||
| 12 | + }, | ||
| 13 | +]; | ||
| 14 | + | ||
| 15 | +export const columns: BasicColumn[] = [ | ||
| 16 | + { | ||
| 17 | + title: t('inspection.servicePlan.preserveCodeText'), | ||
| 18 | + dataIndex: 'preserveCode', | ||
| 19 | + }, | ||
| 20 | + { | ||
| 21 | + title: t('inspection.servicePlan.preserveNameText'), | ||
| 22 | + dataIndex: 'preserveName', | ||
| 23 | + }, | ||
| 24 | + { | ||
| 25 | + title: t('inspection.servicePlan.statusText'), | ||
| 26 | + dataIndex: 'status', | ||
| 27 | + slots: { customRender: 'status' }, | ||
| 28 | + }, | ||
| 29 | + { | ||
| 30 | + title: t('inspection.servicePlan.frequencyText'), | ||
| 31 | + dataIndex: 'frequency', | ||
| 32 | + }, | ||
| 33 | + { | ||
| 34 | + title: t('inspection.servicePlan.timesText'), | ||
| 35 | + dataIndex: 'times', | ||
| 36 | + }, | ||
| 37 | +]; |
src/views/inspection/servicePlan/index.vue
0 → 100644
| 1 | +<template> | ||
| 2 | + <div> | ||
| 3 | + <BasicTable :clickToRowSelect="false" @register="registerTable"> | ||
| 4 | + <template #toolbar> | ||
| 5 | + <Authority value="api:yt:product:category:post"> | ||
| 6 | + <Button type="primary" @click="handleCreate"> | ||
| 7 | + {{ t('inspection.servicePlan.createCategoryText') }} | ||
| 8 | + </Button> | ||
| 9 | + </Authority> | ||
| 10 | + </template> | ||
| 11 | + </BasicTable> | ||
| 12 | + </div> | ||
| 13 | +</template> | ||
| 14 | +<script setup lang="ts"> | ||
| 15 | + import { useTable } from '/@/components/Table'; | ||
| 16 | + import { getRepairOrderList } from '/@/api/repair/order'; | ||
| 17 | + import { columns, searchFormSchema } from './index'; | ||
| 18 | + import { useI18n } from '/@/hooks/web/useI18n'; | ||
| 19 | + | ||
| 20 | + const { t } = useI18n(); | ||
| 21 | + | ||
| 22 | + const [ | ||
| 23 | + registerTable, | ||
| 24 | + { reload, setLoading, getSelectRowKeys, setSelectedRowKeys, getRowSelection }, | ||
| 25 | + ] = useTable({ | ||
| 26 | + title: t('inspection.servicePlan.listText'), | ||
| 27 | + api: getRepairOrderList, | ||
| 28 | + columns, | ||
| 29 | + formConfig: { | ||
| 30 | + labelWidth: 100, | ||
| 31 | + schemas: searchFormSchema, | ||
| 32 | + }, | ||
| 33 | + immediate: true, | ||
| 34 | + useSearchForm: true, | ||
| 35 | + showTableSetting: true, | ||
| 36 | + bordered: true, | ||
| 37 | + showIndexColumn: false, | ||
| 38 | + clickToRowSelect: false, | ||
| 39 | + rowKey: 'id', | ||
| 40 | + actionColumn: { | ||
| 41 | + width: 230, | ||
| 42 | + title: t('common.actionText'), | ||
| 43 | + slots: { customRender: 'action' }, | ||
| 44 | + fixed: 'right', | ||
| 45 | + }, | ||
| 46 | + rowSelection: { | ||
| 47 | + type: 'checkbox', | ||
| 48 | + getCheckboxProps: (record: any) => {}, | ||
| 49 | + }, | ||
| 50 | + }); | ||
| 51 | +</script> |
src/views/repair/history/index.ts
0 → 100644
| 1 | +import { FormSchema } from '/@/components/Form'; | ||
| 2 | +import { useI18n } from '/@/hooks/web/useI18n'; | ||
| 3 | +import { BasicColumn } from '/@/components/Table'; | ||
| 4 | +const { t } = useI18n(); | ||
| 5 | + | ||
| 6 | +export const columns: BasicColumn[] = [ | ||
| 7 | + { | ||
| 8 | + title: t('repair.history.orderCode'), | ||
| 9 | + dataIndex: 'tkRepairOrderDTO', | ||
| 10 | + // format: (text,record) => { | ||
| 11 | + // return record.orderCode; | ||
| 12 | + // }, | ||
| 13 | + }, | ||
| 14 | + { | ||
| 15 | + title: t('repair.history.orderText'), | ||
| 16 | + dataIndex: 'tkRepairOrderDTO', | ||
| 17 | + // format: (text,record) => { | ||
| 18 | + // return record.orderCode; | ||
| 19 | + // }, | ||
| 20 | + }, | ||
| 21 | + { | ||
| 22 | + title: t('repair.history.deviceNameText'), | ||
| 23 | + dataIndex: 'reportDate', | ||
| 24 | + }, | ||
| 25 | + { | ||
| 26 | + title: t('repair.history.time'), | ||
| 27 | + dataIndex: 'time', | ||
| 28 | + }, | ||
| 29 | + { | ||
| 30 | + title: t('repair.history.reportByName'), | ||
| 31 | + dataIndex: 'reportByName', | ||
| 32 | + }, | ||
| 33 | + { | ||
| 34 | + title: t('repair.history.photo'), | ||
| 35 | + dataIndex: 'photo', | ||
| 36 | + }, | ||
| 37 | + { | ||
| 38 | + title: t('repair.history.description'), | ||
| 39 | + dataIndex: 'description', | ||
| 40 | + }, | ||
| 41 | + { | ||
| 42 | + title: t('repair.history.repairTime'), | ||
| 43 | + dataIndex: 'repairTime', | ||
| 44 | + slots: { customRender: 'repairTime' }, | ||
| 45 | + }, | ||
| 46 | + { | ||
| 47 | + title: t('repair.history.repairByName'), | ||
| 48 | + dataIndex: 'repairByName', | ||
| 49 | + slots: { customRender: 'repairByName' }, | ||
| 50 | + }, | ||
| 51 | + { | ||
| 52 | + title: t('repair.history.repairReason'), | ||
| 53 | + dataIndex: 'repairReason', | ||
| 54 | + slots: { customRender: 'repairReason' }, | ||
| 55 | + }, | ||
| 56 | + { | ||
| 57 | + title: t('repair.history.repairDescription'), | ||
| 58 | + dataIndex: 'repairDescription', | ||
| 59 | + slots: { customRender: 'repairDescription' }, | ||
| 60 | + }, | ||
| 61 | +]; | ||
| 62 | + | ||
| 63 | +export const searchFormSchema: FormSchema[] = [ | ||
| 64 | + { | ||
| 65 | + field: 'orderId', | ||
| 66 | + label: t('repair.history.orderText'), | ||
| 67 | + component: 'Select', | ||
| 68 | + colProps: { span: 6 }, | ||
| 69 | + }, | ||
| 70 | +]; |
src/views/repair/history/index.vue
0 → 100644
| 1 | +<template> | ||
| 2 | + <div> | ||
| 3 | + <BasicTable style="flex: auto" @register="registerTable"> | ||
| 4 | + <template #toolbar> </template> | ||
| 5 | + </BasicTable> | ||
| 6 | + </div> | ||
| 7 | +</template> | ||
| 8 | +<script setup lang="ts"> | ||
| 9 | + import { BasicTable, useTable } from '/@/components/Table'; | ||
| 10 | + import { getRepairHistoryList } from '/@/api/repair/history'; | ||
| 11 | + import { columns, searchFormSchema } from './index'; | ||
| 12 | + import { useI18n } from '/@/hooks/web/useI18n'; | ||
| 13 | + const { t } = useI18n(); | ||
| 14 | + const [ | ||
| 15 | + registerTable, | ||
| 16 | + { reload, setLoading, getSelectRowKeys, setSelectedRowKeys, getRowSelection }, | ||
| 17 | + ] = useTable({ | ||
| 18 | + title: t('repair.history.listText'), | ||
| 19 | + api: getRepairHistoryList, | ||
| 20 | + columns, | ||
| 21 | + formConfig: { | ||
| 22 | + labelWidth: 100, | ||
| 23 | + schemas: searchFormSchema, | ||
| 24 | + }, | ||
| 25 | + immediate: true, | ||
| 26 | + useSearchForm: true, | ||
| 27 | + showTableSetting: true, | ||
| 28 | + bordered: true, | ||
| 29 | + showIndexColumn: false, | ||
| 30 | + clickToRowSelect: false, | ||
| 31 | + rowKey: 'id', | ||
| 32 | + }); | ||
| 33 | +</script> |
src/views/repair/order/index.ts
0 → 100644
| 1 | +import { FormSchema } from '/@/components/Form'; | ||
| 2 | +import { useI18n } from '/@/hooks/web/useI18n'; | ||
| 3 | +import { BasicColumn } from '/@/components/Table'; | ||
| 4 | +import moment from 'moment/moment'; | ||
| 5 | +const { t } = useI18n(); | ||
| 6 | + | ||
| 7 | +const statusOptions = [ | ||
| 8 | + { label: t('repair.order.SCHEDULING'), value: 'SCHEDULING' }, | ||
| 9 | + { label: t('repair.order.REPAIRFINISH'), value: 'REPAIRFINISH' }, | ||
| 10 | + { label: t('repair.order.ACCEPTANCEPASSED'), value: 'ACCEPTANCEPASSED' }, | ||
| 11 | +]; | ||
| 12 | +const typeOptions = [ | ||
| 13 | + { label: t('repair.order.inspectionText'), value: 'INSPECTION' }, | ||
| 14 | + { label: t('repair.order.maintenanceText'), value: 'MAINTENANCE' }, | ||
| 15 | +]; | ||
| 16 | + | ||
| 17 | +export const columns: BasicColumn[] = [ | ||
| 18 | + { | ||
| 19 | + title: t('repair.order.nameCode'), | ||
| 20 | + dataIndex: 'orderCode', | ||
| 21 | + }, | ||
| 22 | + { | ||
| 23 | + title: t('repair.order.deviceNameText'), | ||
| 24 | + dataIndex: 'deviceId', | ||
| 25 | + slots: { customRender: 'deviceId' }, | ||
| 26 | + }, | ||
| 27 | + { | ||
| 28 | + title: t('repair.order.reportDateText'), | ||
| 29 | + dataIndex: 'reportDate', | ||
| 30 | + }, | ||
| 31 | + { | ||
| 32 | + title: t('repair.order.reportByName'), | ||
| 33 | + dataIndex: 'reportByName', | ||
| 34 | + }, | ||
| 35 | + { | ||
| 36 | + title: t('repair.order.description'), | ||
| 37 | + dataIndex: 'description', | ||
| 38 | + }, | ||
| 39 | + { | ||
| 40 | + title: t('repair.order.statusText'), | ||
| 41 | + dataIndex: 'status', | ||
| 42 | + slots: { customRender: 'status' }, | ||
| 43 | + }, | ||
| 44 | + { | ||
| 45 | + title: t('repair.order.emergencyText'), | ||
| 46 | + dataIndex: 'emergency', | ||
| 47 | + slots: { customRender: 'emergency' }, | ||
| 48 | + }, | ||
| 49 | +]; | ||
| 50 | + | ||
| 51 | +export const searchFormSchema: FormSchema[] = [ | ||
| 52 | + { | ||
| 53 | + field: 'deviceId', | ||
| 54 | + label: t('repair.order.deviceNameText'), | ||
| 55 | + component: 'Select', | ||
| 56 | + colProps: { span: 6 }, | ||
| 57 | + }, | ||
| 58 | + { | ||
| 59 | + field: 'status', | ||
| 60 | + label: t('repair.order.statusText'), | ||
| 61 | + component: 'Select', | ||
| 62 | + colProps: { span: 6 }, | ||
| 63 | + componentProps: { | ||
| 64 | + options: statusOptions, | ||
| 65 | + }, | ||
| 66 | + }, | ||
| 67 | + { | ||
| 68 | + field: 'startDate', | ||
| 69 | + label: t('repair.order.time'), | ||
| 70 | + component: 'RangePicker', | ||
| 71 | + componentProps: { | ||
| 72 | + showTime: { | ||
| 73 | + defaultValue: [moment('00:00:00', 'HH:mm:ss'), moment('23:59:59', 'HH:mm:ss')], | ||
| 74 | + }, | ||
| 75 | + }, | ||
| 76 | + colProps: { span: 6 }, | ||
| 77 | + }, | ||
| 78 | +]; | ||
| 79 | + | ||
| 80 | +export const schemas: FormSchema[] = [ | ||
| 81 | + { | ||
| 82 | + field: 'code', | ||
| 83 | + label: t('repair.order.nameCode'), | ||
| 84 | + component: 'Input', | ||
| 85 | + colProps: { span: 21 }, | ||
| 86 | + required: true, | ||
| 87 | + componentProps: { | ||
| 88 | + maxLength: 20, | ||
| 89 | + }, | ||
| 90 | + }, | ||
| 91 | + { | ||
| 92 | + field: 'name', | ||
| 93 | + label: t('repair.order.nameText'), | ||
| 94 | + component: 'Input', | ||
| 95 | + colProps: { span: 21 }, | ||
| 96 | + required: true, | ||
| 97 | + componentProps: { | ||
| 98 | + maxLength: 20, | ||
| 99 | + }, | ||
| 100 | + }, | ||
| 101 | + { | ||
| 102 | + field: 'type', | ||
| 103 | + label: t('repair.order.typeText'), | ||
| 104 | + component: 'RadioButtonGroup', | ||
| 105 | + defaultValue: 'INSPECTION', | ||
| 106 | + componentProps: { | ||
| 107 | + options: typeOptions, | ||
| 108 | + }, | ||
| 109 | + }, | ||
| 110 | + { | ||
| 111 | + field: 'status', | ||
| 112 | + label: t('repair.order.statusText'), | ||
| 113 | + component: 'RadioButtonGroup', | ||
| 114 | + defaultValue: 'ENABLE', | ||
| 115 | + componentProps: { | ||
| 116 | + options: statusOptions, | ||
| 117 | + }, | ||
| 118 | + }, | ||
| 119 | + { | ||
| 120 | + field: 'planDetails', | ||
| 121 | + label: t('repair.order.nameDetail'), | ||
| 122 | + component: 'InputTextArea', | ||
| 123 | + colProps: { span: 21 }, | ||
| 124 | + required: true, | ||
| 125 | + componentProps: { | ||
| 126 | + maxLength: 200, | ||
| 127 | + }, | ||
| 128 | + }, | ||
| 129 | +]; |
src/views/repair/order/index.vue
0 → 100644
| 1 | +<template> | ||
| 2 | + <div> | ||
| 3 | + <BasicTable style="flex: auto" @register="registerTable"> | ||
| 4 | + <template #toolbar> | ||
| 5 | + <Authority value="api:yt:product:category:post"> | ||
| 6 | + <Button type="primary"> | ||
| 7 | + {{ t('repair.order.createCategoryText') }} | ||
| 8 | + </Button> | ||
| 9 | + </Authority> | ||
| 10 | + </template> | ||
| 11 | + <template #deviceId="{ record }"> | ||
| 12 | + <span>{{ record?.deviceInfo?.name }}</span> | ||
| 13 | + </template> | ||
| 14 | + <template #status="{ record }"> | ||
| 15 | + <Tag | ||
| 16 | + :color=" | ||
| 17 | + record.status == 'SCHEDULING' | ||
| 18 | + ? 'yellow' | ||
| 19 | + : record.status == 'REPAIRFINISH' | ||
| 20 | + ? 'blue' | ||
| 21 | + : 'green' | ||
| 22 | + " | ||
| 23 | + class="ml-2" | ||
| 24 | + > | ||
| 25 | + {{ t(`repair.order.${record.status}`) }} | ||
| 26 | + </Tag> | ||
| 27 | + </template> | ||
| 28 | + <template #emergency="{ record }"> | ||
| 29 | + <Tag :color="record.emergency ? 'error' : 'green'" class="ml-2"> | ||
| 30 | + {{ record.emergency ? '是' : '否' }} | ||
| 31 | + </Tag> | ||
| 32 | + </template> | ||
| 33 | + </BasicTable> | ||
| 34 | + </div> | ||
| 35 | +</template> | ||
| 36 | +<script setup lang="ts"> | ||
| 37 | + import { BasicTable, TableAction } from '/@/components/Table'; | ||
| 38 | + import { useTable } from '/@/components/Table'; | ||
| 39 | + import { getRepairOrderList } from '/@/api/repair/order'; | ||
| 40 | + import { columns, searchFormSchema } from './index'; | ||
| 41 | + import { useI18n } from '/@/hooks/web/useI18n'; | ||
| 42 | + import { Button, Tag } from 'ant-design-vue'; | ||
| 43 | + import { Authority } from '/@/components/Authority'; | ||
| 44 | + const { t } = useI18n(); | ||
| 45 | + | ||
| 46 | + const [ | ||
| 47 | + registerTable, | ||
| 48 | + { reload, setLoading, getSelectRowKeys, setSelectedRowKeys, getRowSelection }, | ||
| 49 | + ] = useTable({ | ||
| 50 | + title: t('repair.order.listText'), | ||
| 51 | + api: getRepairOrderList, | ||
| 52 | + columns, | ||
| 53 | + formConfig: { | ||
| 54 | + labelWidth: 100, | ||
| 55 | + schemas: searchFormSchema, | ||
| 56 | + }, | ||
| 57 | + immediate: true, | ||
| 58 | + useSearchForm: true, | ||
| 59 | + showTableSetting: true, | ||
| 60 | + bordered: true, | ||
| 61 | + showIndexColumn: false, | ||
| 62 | + clickToRowSelect: false, | ||
| 63 | + rowKey: 'id', | ||
| 64 | + actionColumn: { | ||
| 65 | + width: 230, | ||
| 66 | + title: t('common.actionText'), | ||
| 67 | + slots: { customRender: 'action' }, | ||
| 68 | + fixed: 'right', | ||
| 69 | + }, | ||
| 70 | + rowSelection: { | ||
| 71 | + type: 'checkbox', | ||
| 72 | + getCheckboxProps: (record: any) => {}, | ||
| 73 | + }, | ||
| 74 | + }); | ||
| 75 | +</script> |