车间能级提升-智能设备管理系统
zhuguifei
2025-04-23 1dc84e14accf77681279e63fbba188770bfc8b40
新增保养工单,准备开发保养工单角色权限控制
已添加5个文件
已修改12个文件
910 ■■■■■ 文件已修改
eims-ui-mobile/src/pages.json 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
eims-ui-mobile/src/pages/equ/equ-list.vue 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
eims-ui-mobile/src/pages/inspect/insp-record.vue 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
eims-ui-mobile/src/pages/inspect/insp-st.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
eims-ui-mobile/src/pages/maint/maint-order.vue 388 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
eims-ui-mobile/src/pages/maint/maint-st.vue 31 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
eims-ui-mobile/src/pages/maint/order-detail.vue 228 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
eims-ui-mobile/src/pages/my/index.vue 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
eims-ui-mobile/src/pages/spare/index.vue 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
eims-ui-mobile/src/service/maint.d.ts 126 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
eims-ui-mobile/src/service/maint.ts 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
eims-ui-mobile/src/static/ico/ico-platform.png 补丁 | 查看 | 原始文档 | blame | 历史
eims-ui-mobile/src/style/index.scss 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
eims-ui-mobile/src/types/uni-pages.d.ts 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
eims-ui-mobile/src/utils/DateUtils.ts 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
eims-ui-mobile/src/utils/RoleUtils.ts 41 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/impl/EimsMaintOrderServiceImpl.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
eims-ui-mobile/src/pages.json
@@ -67,6 +67,7 @@
      "path": "pages/equ/equ-list",
      "type": "page",
      "layout": "default",
      "needLogin": true,
      "style": {
        "navigationBarTitleText": "设备列表"
      }
@@ -91,6 +92,7 @@
    {
      "path": "pages/inspect/insp-record",
      "type": "page",
      "needLogin": true,
      "style": {
        "navigationBarTitleText": "点检记录",
        "navigationStyle": "custom",
@@ -101,6 +103,7 @@
      "path": "pages/inspect/insp-st",
      "type": "page",
      "layout": "default",
      "needLogin": true,
      "style": {
        "navigationBarTitleText": "点检汇总"
      }
@@ -114,17 +117,39 @@
      }
    },
    {
      "path": "pages/maint/maint-order",
      "type": "page",
      "needLogin": true,
      "style": {
        "navigationBarTitleText": "保养工单",
        "navigationStyle": "custom",
        "navigationBarBackgroundColor": "#4D80F0"
      }
    },
    {
      "path": "pages/maint/maint-st",
      "type": "page",
      "layout": "default",
      "needLogin": true,
      "style": {
        "navigationBarTitleText": "保养汇总"
      }
    },
    {
      "path": "pages/maint/order-detail",
      "type": "page",
      "needLogin": true,
      "style": {
        "navigationBarTitleText": "工单明细",
        "navigationStyle": "custom",
        "navigationBarBackgroundColor": "#4D80F0"
      }
    },
    {
      "path": "pages/my/index",
      "type": "page",
      "layout": "tabbar",
      "needLogin": true,
      "style": {
        "navigationBarTitleText": "我的"
      }
@@ -133,6 +158,7 @@
      "path": "pages/spare/index",
      "type": "page",
      "layout": "tabbar",
      "needLogin": true,
      "style": {
        "navigationBarTitleText": "spare"
      }
eims-ui-mobile/src/pages/equ/equ-list.vue
@@ -1,6 +1,7 @@
<route lang="json5" type="page">
{
  layout: 'default',
  needLogin: true,
  style: {
    navigationBarTitleText: '设备列表',
  },
eims-ui-mobile/src/pages/inspect/insp-record.vue
@@ -1,5 +1,6 @@
<route lang="json5">
{
  needLogin: true,
  style: {
    navigationBarTitleText: '点检记录',
    navigationStyle: 'custom',
@@ -52,7 +53,7 @@
            <view class="text-color-gray text-xs mt-2 flex">
              <text>状态:</text>
              <template v-if="dataCount > 0 && dataCount === checkCount">
                <wd-icon class="icon-color-success" name="check-outline" size="40rpx"></wd-icon>
                <wd-icon class="icon-color-success" name="check-outline" size="34rpx"></wd-icon>
                <text class="ml-1">已完成</text>
              </template>
              <template v-else>
@@ -330,5 +331,6 @@
:deep(.wd-navbar__title) {
  color: white;
  font-weight: 0;
  font-size: 32rpx;
}
</style>
eims-ui-mobile/src/pages/inspect/insp-st.vue
@@ -1,6 +1,7 @@
<route lang="json5" type="page">
{
  layout: 'default',
  needLogin: true,
  style: {
    navigationBarTitleText: '点检汇总',
  },
@@ -54,7 +55,7 @@
            <view class="text-color-gray text-xs mt-2 flex">
              <text>状态:</text>
              <template v-if="item.recordCount === item.checkCount">
                <wd-icon class="icon-color-success" name="check-outline" size="40rpx"></wd-icon>
                <wd-icon class="icon-color-success" name="check-outline" size="34rpx"></wd-icon>
                <text class="ml-1">已完成</text>
              </template>
              <template v-else>
@@ -120,7 +121,6 @@
  paging.value.reload()
}
onLoad(() => {
  queryList()
  uni.$on('insp-st-refresh', reloadData)
})
onUnload(() => {
eims-ui-mobile/src/pages/maint/maint-order.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,388 @@
<route lang="json5" type="page">
{
  needLogin: true,
  style: {
    navigationBarTitleText: '保养工单',
    navigationStyle: 'custom',
    navigationBarBackgroundColor: '#4D80F0',
  },
}
</route>
<template>
  <z-paging ref="paging" v-model="dataList" @query="queryList" show-refresher-update-time>
    <template #top>
      <wd-navbar
        title="保养工单"
        left-arrow
        @click-left="goBack"
        right-text="提交"
        @click-right="handleClickRight"
        custom-style="background: #4D80F0;"
        safeAreaInsetTop
      ></wd-navbar>
      <wd-cell>
        <template #title>
          <text class="text-color-gray">设备</text>
        </template>
      </wd-cell>
      <view class="h-[2px] w-full bg-base"></view>
      <wd-card type="rectangle">
        <template #title>
          <view class="flex justify-between">
            <view class="flex items-center menu-title-box">
              <view class="menu-indicator"></view>
              <view class="ml-1 text-sm align-center">{{ maintSt.equName }}</view>
              <view class="text-color-gray ml-2 text-mini">{{ maintSt.assetNo }}</view>
            </view>
            <view class="flex items-center">
              <text class="text-color-gray text-mini">{{ maintSt.planTime }}</text>
            </view>
          </view>
        </template>
        <view class="flex h-[100rpx]" items-center>
          <image class="slot-img text-center" src="/static/images/camera.png" />
          <view class="flex-1">
            <view class="text-color-gray text-xs mt-1 flex">
              <text class="mr-3">工单总数: {{ maintSt.orderCount }}</text>
              |
              <text class="mx-3">已完成: {{ maintSt.wcCount }}</text>
            </view>
            <view class="text-color-gray text-xs mt-2 flex">
              <text class="mr-3">待保养: {{ maintSt.dbyCount }}</text>
              |
              <text class="mx-3">保养中: {{ maintSt.byCount }}</text>
              |
              <text class="ml-3">待验证: {{ maintSt.dyzCount }}</text>
            </view>
            <view class="text-color-gray text-xs mt-2 flex">
              <text>状态:</text>
              <template v-if="maintSt.orderCount === maintSt.wcCount">
                <wd-icon class="icon-color-success" name="check-outline" size="34rpx"></wd-icon>
                <text class="ml-1">已完成</text>
              </template>
              <template v-else>
                <wd-icon class="icon-color-base" name="detection" size="40rpx"></wd-icon>
                <text class="ml-1">进行中</text>
              </template>
            </view>
          </view>
        </view>
      </wd-card>
    </template>
    <view class="bg-base">
      <view class="w-full h-[24rpx]"></view>
      <wd-cell class="mb-[2px]">
        <template #title>
          <text class="text-color-gray">保养项</text>
        </template>
      </wd-cell>
      <wd-card type="rectangle" v-for="(item, index) in dataList" :key="item.id">
        <template #title>
          <view class="flex justify-between">
            <view class="flex items-center menu-title-box">
              <view class="menu-indicator"></view>
              <view class="ml-1 text-sm align-center w-[50%]">
                <wd-text :text="item.maintName" :lines="1"></wd-text>
              </view>
              <view class="text-color-gray ml-2 text-mini">{{ item.maintCode }}</view>
            </view>
            <view class="flex items-center w-[20%] justify-end">
              <text class="text-color-gray text-mini">
                {{ item?.planTime }}
              </text>
            </view>
          </view>
        </template>
        <view class="flex h-[140rpx]" items-center>
          <image class="slot-img text-center" src="/static/ico/ico-platform.png" />
          <view class="flex-1 text-color-gray text-xs flex-row">
            <view class="mr-3 mt-2">计划保养日期: {{ item.planTime }}</view>
            <view class="mr-3 mt-2">保养开始时间: {{ item.startTime }}</view>
            <view class="mr-3 mt-2">保养结束时间: {{ item.endTime }}</view>
            <view class="text-color-gray text-xs mt-2 flex">
              <text>状态:</text>
              <template v-if="item.status === '0'">
                <wd-icon class="icon-color-warning" name="books" size="34rpx"></wd-icon>
                <text class="ml-1">待保养</text>
              </template>
              <template v-else-if="item.status === '1'">
                <wd-icon class="icon-color-base" name="books" size="34rpx"></wd-icon>
                <text class="ml-1">保养中</text>
              </template>
              <template v-else-if="item.status === '2'">
                <wd-icon class="icon-color-purple" name="books" size="34rpx"></wd-icon>
                <text class="ml-1">待验证</text>
              </template>
              <template v-else-if="item.status === '3'">
                <wd-icon class="icon-color-success" name="check-outline" size="34rpx"></wd-icon>
                <text class="ml-1">已完成</text>
              </template>
              <text class="mx-3">|</text>
              <wd-icon class="icon-color-base" name="camera" size="30rpx"></wd-icon>
              <text class="ml-1">{{ item.maintUserName }}</text>
            </view>
          </view>
          <!--操作工或维修工角色-->
          <template v-if="isOperatorOrRepair()">
            <wd-button
              v-if="item.status === '0'"
              size="small"
              icon="edit-outline"
              @click.stop="handleStartMaint(item)"
            >
              å¼€å§‹ä¿å…»
            </wd-button>
            <wd-button
              v-if="item.status === '1'"
              size="small"
              icon="edit-outline"
              @click.stop="itemClick(item)"
            >
              ä¿å…»ä¸­
            </wd-button>
            <wd-button
              v-if="item.status === '2'"
              size="small"
              icon="edit-outline"
              @click.stop="itemClick(item)"
            >
              å¾…验证
            </wd-button>
            <wd-button
              v-if="item.status === '3'"
              size="small"
              icon="check-outline"
              @click.stop="itemClick(item)"
            >
              å·²å®Œæˆ
            </wd-button>
          </template>
          <!--管理员角色-->
          <template v-else-if="isLeader()">
            <wd-button
              v-if="item.status === '0'"
              size="small"
              icon="warn-bold"
              disabled
            >
              å¾…保养
            </wd-button>
            <wd-button
              v-if="item.status === '1'"
              size="small"
              icon="warn-bold"
              disabled
            >
              ä¿å…»ä¸­
            </wd-button>
            <wd-button
              v-if="item.status === '2'"
              size="small"
              icon="edit-outline"
              @click.stop="itemClick(item)"
            >
              å¾…验证
            </wd-button>
            <wd-button
              v-if="item.status === '3'"
              size="small"
              icon="check-outline"
              @click.stop="itemClick(item)"
            >
              å·²å®Œæˆ
            </wd-button>
          </template>
        </view>
      </wd-card>
      <wd-cell>
        <template #title>
          <text class="text-color-gray">其他信息</text>
        </template>
      </wd-cell>
      <view class="h-[2px] w-full bg-base"></view>
      <wd-textarea
        label="特记事项"
        label-width="200rpx"
        type="textarea"
        v-model="maintSt.specialNote"
        auto-height
        :maxlength="200"
        show-word-limit
        placeholder="请输入特记事项"
        clearable
      />
    </view>
  </z-paging>
</template>
<script setup lang="ts">
import type { MaintStVO } from '@/service/maint.d'
import { getMaintSt, getMaintStOrderList, updateMaintOrder } from '@/service/maint'
import { ref, reactive } from 'vue'
import { useToast, useMessage } from 'wot-design-uni'
import { isLeader, isOperatorOrRepair } from '@/utils/RoleUtils'
const message = useMessage()
const paging = ref(null)
const dataList = ref([])
interface QueryParams {
  pageNum: number
  pageSize: number
  maintCode: string
  status?: string
}
const maintSt = reactive<MaintStVO>({
  id: '',
  equName: '',
  assetNo: '',
  planTime: '',
  orderCount: null,
  wcCount: null,
  dbyCount: null,
  byCount: null,
  dyzCount: null,
  specialNote: '',
})
const queryList = (pageNum?: number, pageSize?: number) => {
  const params: QueryParams = {
    pageNum,
    pageSize,
    maintCode: maintCode.value,
  }
  getMaintStOrderList(params)
    .then((res: any) => {
      // è¯·å‹¿åœ¨ç½‘络请求回调中给dataList赋值!!只需要调用complete就可以了
      paging.value.complete(res.rows)
    })
    .catch((res) => {
      // å¦‚果请求失败写paging.value.complete(false),会自动展示错误页面
      // æ³¨æ„ï¼Œæ¯æ¬¡éƒ½éœ€è¦åœ¨catch中写这句话很麻烦,z-paging提供了方案可以全局统一处理
      // åœ¨åº•层的网络请求抛出异常时,写uni.$emit('z-paging-error-emit');即可
      paging.value.complete(false)
    })
}
function itemClick(item) {
  goToOrderDetail(item)
}
function goToOrderDetail(item) {
  uni.navigateTo({
    url: `/pages/maint/order-detail?id=${item.id}`,
  })
}
function handleStartMaint(item) {
  message
    .confirm({
      msg: '确定开始保养?',
      title: '提示',
      beforeConfirm: ({ resolve }) => {
        // ç¡®è®¤å¼€å§‹ä¿®æ”¹çŠ¶æ€ä¸º1-保养中
        const data = Object.assign({}, item)
        data.status = '1'
        updateOrder(data, resolve)
      },
    })
    .then(() => {})
    .catch((error) => {
      console.log(error)
    })
}
/**
 * æ›´æ–°ä¿å…»å·¥å•
 * @param item
 * @param resolve
 */
function updateOrder(data: any, resolve: any) {
  updateMaintOrder(data)
    .then((res: any) => {
      resolve(true)
      if (res?.code === 200) {
        reloadData()
      }
    })
    .catch((res) => {
      console.error(res)
    })
}
function reloadData() {
  paging.value.reload()
}
const goBack = () => {
  uni.navigateBack()
}
function handleClickRight() {}
/**
 * æŸ¥è¯¢ä¿å…»æ˜Žç»†éœ€è¦çš„code
 */
const maintCode = computed(() => `${maintSt.equId}_${maintSt.planTime}`)
onLoad((options) => {
  const itemString = decodeURIComponent(options.maintSt)
  const item = JSON.parse(itemString)
  Object.assign(maintSt, item)
})
</script>
<style scoped lang="scss">
.menu-title-box {
  height: 30rpx;
  line-height: 30rpx;
}
.slot-img {
  width: 72rpx;
  height: 72rpx;
  margin-right: 24rpx;
}
.text-mini {
  font-size: 22rpx;
}
.menu-indicator {
  width: 6rpx;
  height: 22rpx;
  border-radius: 10rpx;
  background-color: $uni-color-primary;
}
:deep(.wd-card__footer) {
  padding: 10rpx !important;
}
.col-title-box {
}
.bg-primary {
  background: $uni-color-primary;
}
:deep(.wd-navbar__text) {
  font-size: 26rpx;
  color: white;
}
:deep(.wd-icon-arrow-left:before),
:deep(.wd-navbar__title) {
  color: white;
  font-weight: 0;
  font-size: 32rpx;
}
</style>
eims-ui-mobile/src/pages/maint/maint-st.vue
@@ -1,6 +1,7 @@
<route lang="json5" type="page">
{
  layout: 'default',
  needLogin: true,
  style: {
    navigationBarTitleText: '保养汇总',
  },
@@ -23,13 +24,15 @@
          <view class="flex justify-between">
            <view class="flex items-center menu-title-box">
              <view class="menu-indicator"></view>
              <view class="ml-1 text-sm align-center">{{ item.equName }}</view>
              <view class="ml-1 text-sm align-center w-[50%]">
                <wd-text :text="item.equName" :lines="1"></wd-text>
              </view>
              <view class="text-color-gray ml-2 text-mini">{{ item.assetNo }}</view>
            </view>
            <view class="flex items-center">
            <view class="flex items-center w-[20%] justify-end">
              <text class="text-color-gray text-mini">
                {{ status === 'Day' ? item?.planTimeStr : item?.planTimeStr?.substring(0, 7) || '' }}
                {{ item?.planTime }}
              </text>
            </view>
          </view>
@@ -38,21 +41,21 @@
          <image class="slot-img text-center" src="/static/images/camera.png" />
          <view class="flex-1">
            <view class="text-color-gray text-xs mt-1 flex">
              <text class="mr-3">点检总数: {{ item.recordCount }}</text>
              <text class="mr-3">工单总数: {{ item.orderCount }}</text>
              |
              <text class="mx-3">已点检: {{ item.checkCount }}</text>
              |
              <text class="ml-3">未点检: {{ item.unCheckCount }}</text>
              <text class="mx-3">已完成: {{ item.wcCount }}</text>
            </view>
            <view class="text-color-gray text-xs mt-2 flex">
              <text class="mr-3">正常: {{ item.normalNum }}</text>
              <text class="mr-3">待保养: {{ item.dbyCount }}</text>
              |
              <text class="mx-3">异常: {{ item.abNormalNum }}</text>
              <text class="mx-3">保养中: {{ item.byCount }}</text>
              |
              <text class="ml-3">待验证: {{ item.dyzCount }}</text>
            </view>
            <view class="text-color-gray text-xs mt-2 flex">
              <text>状态:</text>
              <template v-if="item.recordCount === item.checkCount">
                <wd-icon class="icon-color-success" name="check-outline" size="40rpx"></wd-icon>
              <template v-if="item.orderCount === item.wcCount">
                <wd-icon class="icon-color-success" name="check-outline" size="34rpx"></wd-icon>
                <text class="ml-1">已完成</text>
              </template>
              <template v-else>
@@ -83,7 +86,7 @@
const equName = ref<string>('-1')
const statusList = ref<Record<string, any>[]>([
  { label: '全部', value: '-1' },
  { label: '所有状态', value: '-1' },
  { label: '待保养', value: '0' },
  { label: '保养中', value: '1' },
  { label: '待验证', value: '2' },
@@ -128,9 +131,9 @@
}
function itemClick(item) {
  const inspCode = `${item.equId}_${item.planTime}_${status.value}`
  const itemString = encodeURIComponent(JSON.stringify(item))
  uni.navigateTo({
    url: `/pages/inspect/insp-record?id=${item.id}&inspCode=${inspCode}&specialNote=${item.specialNote ?? ''}&equName=${item.equName ?? ''}&assetNo=${item.assetNo ?? ''}&planTimeStr=${item.planTimeStr ?? ''}`,
    url: `/pages/maint/maint-order?maintSt=${itemString}`,
  })
}
eims-ui-mobile/src/pages/maint/order-detail.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,228 @@
<route lang="json5" type="page">
{
  needLogin: true,
  style: {
    navigationBarTitleText: '工单明细',
    navigationStyle: 'custom',
    navigationBarBackgroundColor: '#4D80F0',
  },
}
</route>
<template>
  <view class="bg-base h-[100vh]">
    <wd-navbar
      title="工单明细"
      left-arrow
      @click-left="goBack"
      right-text="提交"
      @click-right="handleClickRight"
      custom-style="background: #4D80F0;"
      safeAreaInsetTop
    ></wd-navbar>
    <wd-form ref="form" :model="order" :rules="rules">
      <wd-cell-group custom-class="group" title="设备信息" border>
        <wd-cell title="设备名称" title-width="200rpx" is-link>
          <text>{{ order?.equName }}</text>
        </wd-cell>
        <wd-cell title="资产编号" title-width="200rpx" is-link>
          <text>{{ order?.assetNo }}</text>
        </wd-cell>
      </wd-cell-group>
      <wd-cell-group custom-class="mt-2" title="保养信息" border>
        <wd-cell title="保养单号" title-width="200rpx" is-link>
          <text>{{ order?.maintCode }}</text>
        </wd-cell>
        <wd-cell title="保养项" title-width="200rpx" is-link>
          <text>{{ order?.maintName }}</text>
        </wd-cell>
        <wd-cell title="计划保养日期" title-width="200rpx" is-link>
          <text>{{ order?.planTime }}</text>
        </wd-cell>
        <wd-datetime-picker
          label="保养开始时间"
          label-width="200rpx"
          placeholder="请选择时间"
          prop="startTime"
          v-model="startTime"
          @open="openStartTime"
          @confirm="handleStartTime"
        />
        <wd-datetime-picker
          label="保养结束时间"
          label-width="200rpx"
          placeholder="请选择时间"
          prop="endTime"
          v-model="endTime"
          @open="openEndTime"
          @confirm="handleEndTime"
        />
        <wd-textarea
          label="工作描述"
          label-width="200rpx"
          type="textarea"
          v-model="order.maintDesc"
          auto-height
          :maxlength="200"
          show-word-limit
          placeholder="请输入工作描述"
          clearable
        />
        <wd-cell title="保养图片" title-width="200rpx" prop="fileList">
          <wd-upload
            :auto-upload="false"
            :file-list="fileList"
            @change="handleFileChange"
          ></wd-upload>
        </wd-cell>
        <wd-textarea
          label="备注"
          label-width="200rpx"
          type="textarea"
          v-model="order.remark"
          auto-height
          :maxlength="200"
          show-word-limit
          placeholder="请输入备注"
          clearable
        />
      </wd-cell-group>
    </wd-form>
  </view>
</template>
<script setup lang="ts">
import { getMaintOrder, updateMaintOrder } from '@/service/maint'
import { formatDate } from '@/utils/DateUtils'
import { reactive } from 'vue'
import { FormRules } from 'wot-design-uni/components/wd-form/types'
import { useToast, useMessage } from 'wot-design-uni'
const message = useMessage()
const fileList = ref<[]>()
const startTime = ref<number>(0)
const endTime = ref<number>(0)
interface MaintOrder {
  id: string
  equName: string
  maintCode: string
  maintName: string
  planTime: string
  startTime: string
  endTime?: string
  maintDesc: string
  remark: string
}
const order = reactive<MaintOrder>({
  id: '',
  equName: '',
  maintCode: '',
  maintName: '',
  planTime: '',
  startTime: '',
  endTime: '',
  maintDesc: '',
  remark: '',
})
const rules: FormRules = {
  startTime: [
    {
      required: true,
      message: '请选择保养开始时间',
    },
  ],
  endTime: [
    {
      required: true,
      message: '请选择保养结束时间',
    },
  ],
  maintDesc: [
    {
      required: true,
      message: '请输入工作描述',
    },
  ],
}
function openStartTime() {
  if (startTime.value === 0) {
    startTime.value = Date.now()
  }
}
function openEndTime() {
  if (endTime.value === 0) {
    endTime.value = Date.now()
  }
}
function handleStartTime(value) {
  order.startTime = formatDate(new Date(value.value))
}
function handleEndTime(value) {
  order.endTime = formatDate(new Date(value.value))
}
function handleFileChange({ fileList }) {}
function initMaintOrder(id: any) {
  getMaintOrder(id)
    .then((res: any) => {
      Object.assign(order, res)
      startTime.value = new Date(order.startTime).getTime()
      endTime.value = new Date(order.endTime).getTime()
    })
    .catch((res) => {})
}
function updateOrder(resolve: any) {
  updateMaintOrder(order)
    .then((res: any) => {
      resolve(true)
    })
    .catch((res) => {
      console.error(res)
    })
}
const goBack = () => {
  uni.navigateBack()
}
function handleClickRight() {
  message
    .confirm({
      msg: '确定提交?',
      title: '提示',
      beforeConfirm: ({ resolve }) => {
        updateOrder(resolve)
      },
    })
    .then(() => {})
    .catch((error) => {
      console.log(error)
    })
}
onLoad((options) => {
  initMaintOrder(options.id)
})
</script>
<style scoped lang="scss">
:deep(.wd-navbar__text) {
  font-size: 26rpx;
  color: white;
}
:deep(.wd-icon-arrow-left:before),
:deep(.wd-navbar__title) {
  color: white;
  font-weight: bold !important;
  font-size: 32rpx;
}
</style>
eims-ui-mobile/src/pages/my/index.vue
@@ -1,6 +1,7 @@
<route lang="json5" type="page">
{
  layout: 'tabbar',
  needLogin: true,
  style: {
    navigationBarTitleText: '我的',
  },
eims-ui-mobile/src/pages/spare/index.vue
@@ -1,6 +1,7 @@
<route lang="json5" type="page">
{
  layout: 'tabbar',
  needLogin: true,
  style: {
    navigationBarTitleText: 'spare',
  },
eims-ui-mobile/src/service/maint.d.ts
@@ -7,38 +7,146 @@
  /**
   *
   */
  title: string;
  title?: string;
  /**
   *
   */
  equId: number | string;
  status: string;
  equId?: number | string;
  equName?: string;
  assetNo?: string;
  status?: string;
  /**
   *
   */
  planTime: string;
  planTime?: string;
  /**
   * ä¿å…»äºº
   */
  maintUser: number;
  maintUser?: number;
  orderCount?: number,
  wcCount?: number,
  dbyCount?: number,
  byCount?: number,
  dyzCount?: number,
  /**
   * éªŒè¯äºº
   */
  verifyUser: number;
  verifyTime: string;
  verifyUser?: number;
  verifyTime?: string;
  /**
   * ç‰¹è®°äº‹é¡¹
   */
  specialNote: string;
  specialNote?: string;
  /**
   * å¤‡æ³¨
   */
  remark: string;
  remark?: string;
}
export interface MaintOrderVO {
  /**
   *
   */
  id: number | string;
  /**
   *
   */
  equId?: number | string;
  equName?: string;
  assetNo?: string;
  /**
   * è®¡åˆ’表冗余-保养类型(字典)
   */
  maintType?: string;
  /**
   * å·¥ä½œæè¿°
   */
  maintDesc?: string;
  /**
   * è®¡åˆ’表冗余-保养周期
   */
  maintCycle?: number;
  /**
   * è®¡åˆ’表冗余-保养周期单位(字典)
   */
  maintCycleUnit?: string;
  /**
   * è®¡åˆ’表冗余- ä¿å…»è§„则(字典)保养时间计算:1-按周期  2-按上次保养时间
   */
  maintRule?: string;
  /**
   * è®¡åˆ’表冗余-保养人
   */
  maintUser?: number;
  maintUserName?: string;
  /**
   * è®¡åˆ’表冗余-保养部门
   */
  maintDept?: number;
  /**
   * ä¿å…»å•号
   */
  maintCode?: string;
  maintName?: string;
  /**
   *
   */
  status?: string;
  verifyUser?: number;
  /**
   * éªŒè¯äºº
   */
  verifyUserName?: string;
  /**
   * ä¿å…»è®¡åˆ’æ—¶é—´
   */
  planTime?: number | string;
  /**
   * ä¿å…»å¼€å§‹æ—¶é—´
   */
  startTime: any;
  /**
   * ä¿å…»ç»“束时间
   */
  endTime: any;
  /**
   * è®¡åˆ’id
   */
  planId?: number | string;
  /**
   * åˆ›å»ºæ—¶é—´
   */
  createTime?: string;
  /**
   * å¤‡æ³¨
   */
  remark?: string;
}
eims-ui-mobile/src/service/maint.ts
@@ -1,5 +1,14 @@
import { http } from '@/utils/http'
import type { MaintStVO } from './maint.d'
import type { MaintStVO, MaintOrderVO } from './maint.d'
type ID = number | string
/**
 * æ ¹æ®id查询汇总
 * @param id
 */
export const getMaintSt = (id: ID) => {
  return http.get<MaintStVO>(`/eims/maintSt/${id}`)
}
/**
 * ä¿å…»æ±‡æ€»åˆ—表
@@ -7,3 +16,26 @@
export const getMaintStList = (params: any) => {
  return http.get<MaintStVO[]>('/eims/maintSt/list', params)
}
/**
 * æ ¹æ®id查询工单
 * @param id
 */
export const getMaintOrder = (id: ID) => {
  return http.get<MaintOrderVO>(`/eims/maintOrder/${id}`)
}
/**
 * ä¿å…»æ±‡æ€»åˆ—表下保养工单列表
 */
export const getMaintStOrderList = (params: any) => {
  return http.get<MaintOrderVO[]>('/eims/maintOrder/detailList', params)
}
/**
 * æ›´æ–°ä¿å…»å·¥å•
 * @param data
 */
export const updateMaintOrder = (data: any) => {
  return http.put<void>('/eims/maintOrder', data)
}
eims-ui-mobile/src/static/ico/ico-platform.png
eims-ui-mobile/src/style/index.scss
@@ -36,6 +36,13 @@
  color: $uni-color-success;
}
.icon-color-warning {
  color: $uni-color-warning;
}
.icon-color-purple {
  color: #824eed;
}
.bg-base {
  background: $uni-bg-color-grey;
}
eims-ui-mobile/src/types/uni-pages.d.ts
@@ -11,7 +11,9 @@
       "/pages/inspect/insp-record" |
       "/pages/inspect/insp-st" |
       "/pages/login/index" |
       "/pages/maint/maint-order" |
       "/pages/maint/maint-st" |
       "/pages/maint/order-detail" |
       "/pages/my/index" |
       "/pages/spare/index";
}
eims-ui-mobile/src/utils/DateUtils.ts
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,5 @@
import dayjs from 'dayjs'
export function formatDate(inputDate: Date) {
  return dayjs(inputDate).format('YYYY-MM-DD HH:mm:ss')
}
eims-ui-mobile/src/utils/RoleUtils.ts
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,41 @@
import { useUserStore } from '@/store'
// import { ROLE_OPERATOR, ROLE_REPAIR, ROLE_LEADER, ROLE_LINE, ROLE_SUPER_ADMIN } from '@/utils/constants'
/**
 * è¶…级管理员
 */
export const ROLE_SUPER_ADMIN = 'superadmin'
/**
 * é¢†å¯¼
 */
export const ROLE_LEADER = 'leader'
/**
 * æ“ä½œå‘˜
 */
export const ROLE_OPERATOR = 'operator'
/**
 * çº¿é•¿
 */
export const ROLE_LINE = 'line'
/**
 * ç»´ä¿®å‘˜
 */
export const ROLE_REPAIR = 'repair'
/**
 * ç™»å½•角色是操作工或维修工
 */
export const isOperatorOrRepair = () => {
  const roles = useUserStore()?.userInfo?.roles || []
  return roles.includes(ROLE_OPERATOR) || roles.includes(ROLE_REPAIR)
}
/**
 * ç™»å½•角色是操作工或维修工
 */
export const isLeader = () => {
  const roles = useUserStore()?.userInfo?.roles || []
  return (
    roles.includes(ROLE_LINE) || roles.includes(ROLE_SUPER_ADMIN) || roles.includes(ROLE_LEADER)
  )
}
eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/impl/EimsMaintOrderServiceImpl.java
@@ -21,7 +21,9 @@
import org.dromara.common.satoken.utils.LoginHelper;
import org.dromara.eims.domain.EimsMaintPlan;
import org.dromara.eims.domain.bo.EimsMaintPlanBo;
import org.dromara.eims.domain.vo.EimsEquVo;
import org.dromara.eims.domain.vo.MaintOrdeGroupVo;
import org.dromara.eims.mapper.EimsEquMapper;
import org.dromara.eims.mapper.EimsMaintPlanMapper;
import org.dromara.system.domain.SysDept;
import org.dromara.system.domain.vo.SysDeptVo;
@@ -49,6 +51,7 @@
    private final EimsMaintOrderMapper baseMapper;
    private final EimsMaintPlanMapper planMapper;
    private final SysDeptMapper sysDeptMapper;
    private final EimsEquMapper equMapper;
    /**
     * æŸ¥è¯¢ä¿å…»å·¥å•
@@ -58,7 +61,13 @@
     */
    @Override
    public EimsMaintOrderVo queryById(Long id){
        return baseMapper.selectVoById(id);
        EimsMaintOrderVo orderVo = baseMapper.selectVoById(id);
        EimsEquVo equVo = equMapper.selectVoById(orderVo.getEquId());
        if(equVo!=null){
            orderVo.setEquName(equVo.getEquName());
            orderVo.setAssetNo(equVo.getAssetNo());
        }
        return orderVo;
    }
    /**