车间能级提升-智能设备管理系统
baoshiwei
2025-06-24 f571cf0182abd65176fb1512c5cb5ddaea49c4a3
eims-ui-mobile/src/pages/scan/index.vue
@@ -25,11 +25,11 @@
              <wd-tag v-else-if="model.status === '2'" class="ml-2" type="danger">停用</wd-tag>
              <wd-tag v-else-if="model.status === '3'" class="ml-2" bg-color="pink">报废</wd-tag>
              <wd-tag v-else-if="model.status === '4'" class="ml-2" type="warning">闲置</wd-tag>
              <wd-tag v-else-if="model.status === '5'" class="ml-2">新增</wd-tag>
              <wd-tag v-else class="ml-2">新增</wd-tag>
            </view>
            <view @click="handleInfo">
              <text class="icon-color-base">详情</text>
              <text class="icon-color-base">状态变更</text>
              <wd-icon name="arrow-right" custom-class="icon-color-base"></wd-icon>
            </view>
          </view>
@@ -103,6 +103,33 @@
        @select="select"
        cancel-text="取消"
      />
      <wd-popup v-model="showStatusDialog" position="center" round :close-on-click-modal="false">
        <view class="popup-container">
          <view class="popup-title">设备状态变更</view>
          <view class="flex flex-wrap justify-between mb-4">
            <view
              v-for="item in statusOptions"
              :key="item.value"
              :class="['status-option', selectedStatus === item.value ? 'active' : '']"
              @click="selectStatus(item.value)"
            >
              {{ item.label }}
            </view>
          </view>
          <wd-textarea
            v-model="changeReason"
            placeholder="请输入变更原因"
            :maxlength="100"
            show-word-limit
            required
          />
          <view class="popup-actions">
            <wd-button block @click="handleStatusChangeCancel">取消</wd-button>
            <wd-button type="primary" block class="ml-2" @click="handleStatusChangeConfirm">确定</wd-button>
          </view>
        </view>
      </wd-popup>
    </view>
    <view v-else>
      <wd-status-tip image="search" tip="当前搜索无结果" />
@@ -122,6 +149,8 @@
import ReqCard from '@/components/repair/req-card.vue'
import ResCard from '@/components/repair/res-card.vue'
import { useUserStore } from '@/store'
import { addEquStatu } from '@/service/equ_status'
import type { EimsEquStatuBo } from '@/service/equ_status.d'
const tab = ref<number>(0)
const message = useMessage()
const toast = useToast()
@@ -140,6 +169,17 @@
    name: '去维修',
  },
])
const showStatusDialog = ref(false)
const selectedStatus = ref<string>('')
const changeReason = ref<string>('')
const statusOptions = [
  { label: '试用', value: '0' },
  { label: '使用', value: '1' },
  { label: '停用', value: '2' },
  { label: '报废', value: '3' },
  { label: '闲置', value: '4' },
  { label: '新增', value: '5' },
]
function initData(assetNo: any) {
  getEquByAssetNo(assetNo)
@@ -192,10 +232,14 @@
}
function handleInfo() {
  uni.showToast({
    title: '功能开发中',
    icon: 'none',
  })
  if (!model?.equId) {
    uni.showToast({ title: '未查询到设备,请联系管理员!', icon: 'none' })
    return
  }
  console.log("model::",model)
  selectedStatus.value = model.status || '5'
  changeReason.value = ''
  showStatusDialog.value = true
}
function handleInsp() {
@@ -273,20 +317,50 @@
      break
  }
}
;`/pages/repair/req-list`,
  // 处理维修请求点击事件
  function handleReqClick(item) {
    uni.navigateTo({
      url: `/pages/repair/req-detail?id=${item.id}`,
    })
  }
// // 处理维修单点击事件
// function handleResClick(item) {
//   uni.navigateTo({
//     url: `/pages/repair/res-detail?id=${item.id}`,
//   })
// }
// 处理维修请求点击事件
function handleReqClick(item) {
  uni.navigateTo({
    url: `/pages/repair/req-detail?id=${item.id}`,
  })
}
defineExpose({ handleReqClick })
function selectStatus(val: string) {
  selectedStatus.value = val
}
function handleStatusChangeCancel() {
  showStatusDialog.value = false
}
async function handleStatusChangeConfirm() {
  if (!selectedStatus.value) {
    uni.showToast({ title: '请选择设备状态', icon: 'none' })
    return
  }
  if (!changeReason.value.trim()) {
    uni.showToast({ title: '请填写变更原因', icon: 'none' })
    return
  }
  const params: EimsEquStatuBo = {
    equId: model.equId,
    beforeChange: model.status,
    afterChange: selectedStatus.value,
    changeDesc: changeReason.value,
    orderStatus: '0',
  }
  try {
    await addEquStatu(params)
    uni.showToast({ title: '提交成功,待管理员确认', icon: 'success' })
    showStatusDialog.value = false
    // 可选:刷新设备信息
    initData(model.assetNo)
  } catch (e) {
    uni.showToast({ title: '提交失败', icon: 'none' })
  }
}
onLoad((options) => {
  uni.$on('list-refresh', loadRepairData)
@@ -324,4 +398,37 @@
:deep(.wd-card__title-content) {
  padding: 16rpx 0 !important;
}
.status-option {
  display: inline-block;
  padding: 10rpx 24rpx;
  margin: 8rpx 8rpx 8rpx 0;
  border-radius: 8rpx;
  border: 1px solid #eee;
  background: #f7f7f7;
  color: #666;
  cursor: pointer;
}
.status-option.active {
  background: $uni-color-primary;
  color: #fff;
  border-color: $uni-color-primary;
}
.popup-container {
  width: 600rpx;
  background: #fff;
  border-radius: 16rpx;
  padding: 32rpx 24rpx 24rpx 24rpx;
}
.popup-title {
  font-size: 32rpx;
  font-weight: bold;
  text-align: center;
  margin-bottom: 24rpx;
}
.popup-actions {
  display: flex;
  margin-top: 24rpx;
  gap: 16rpx;
  justify-content: space-around;
}
</style>