车间能级提升-智能设备管理系统
baoshiwei
2025-06-10 0f63c9e381eeefa2f7aceb7ed8d043ddd165afd5
eims-ui-mobile/src/pages/repair/repair-add.vue
@@ -1,30 +1,22 @@
<route lang="json5" type="page">
{
  layout: 'default',
  style: {
    navigationBarTitleText: '添加报修',
    'app-plus': {
      titleNView: {
        buttons: [
          {
            text: '提交',
            fontSize: '14px',
            color: '#FFFFFF',
          },
          {
            text: '',
            fontSize: '24px',
            color: '#FFFFFF',
          },
        ],
      },
    },
  },
  needLogin: true,
  style: { navigationBarTitleText: '添加报修', navigationStyle: 'custom' },
}
</route>
<template>
  <view class="bg-base">
    <wd-navbar
      title="添加报修"
      left-arrow
      @click-left="goBack"
      right-text="提交"
      @click-right="handleSubmit"
      custom-style="background: #4D80F0;"
      safeAreaInsetTop
    ></wd-navbar>
    <wd-form ref="form" :model="model">
      <wd-cell-group custom-class="group" title="类型信息" border>
        <wd-picker
@@ -35,6 +27,7 @@
          label="故障类型"
          v-model="model.reqType"
          @confirm="handleConfirmReqType"
          :disabled="reqTypeDis"
        />
      </wd-cell-group>
@@ -122,7 +115,6 @@
        />
        <wd-cell title="报修图片" title-width="200rpx" prop="fileList">
          <wd-upload
            :auto-upload="false"
            :file-list="model.fileList"
            :action="VITE_UPLOAD_BASEURL"
            @change="handleFileChange"
@@ -181,6 +173,25 @@
const toast = useToast()
const userStore = useUserStore()
/**
 * 其他页面传过来的数据
 * assetNo: 资产编号
 * from: 是否是扫码进来的,如果是扫码进来,只能查询固定设备的数据
 */
interface PageParams {
  equId?: string
  equName?: string
  from?: string
}
// 页面参数,上个页面传递过来的参数
const option = reactive<PageParams>({
  equId: '',
  equName: '',
  from: '',
})
const reqTypeDis = ref(false)
// 报修类型
const reqList = ref<any>([])
// 故障类别
@@ -223,11 +234,16 @@
  fixtureName: '',
  fileList: [],
})
const goBack = () => {
  uni.navigateBack()
}
/**
 * 选择设备
 */
function handleSelectEqu() {
  if (reqTypeDis.value) {
    return false
  }
  uni.navigateTo({
    url: '/pages/equ/equ-list',
    events: {
@@ -294,10 +310,11 @@
function handleAddRepairReq() {
  // 补充必要字段
  model.status = '0'
  model.status = '0' // 报修后默认状态为待接单
  model.reqTime = formatDate(new Date())
  model.reqDept = userStore?.userInfo?.deptId
  model.reqUser = userStore?.userInfo?.userId
  model.faultPicture = model.fileList.join(',')
  addRepairReq(model)
    .then((res: any) => {
      if (res?.code === 200) {
@@ -318,6 +335,7 @@
 * @param fileList
 */
function handleFileChange({ fileList }) {
  console.log('fileList:', fileList)
  model.fileList = fileList
}
@@ -364,20 +382,17 @@
/**
 * 选择报修类型
 */
function handleConfirmReqType({ value }) {
}
function handleConfirmReqType({ value }) {}
/**
 * 选择故障类别
 */
function handleConfirmFaultType({ value }) {
}
function handleConfirmFaultType({ value }) {}
/**
 * 选择紧急程度
 */
function handleConfirmUrgencyLevel({ value }) {
}
function handleConfirmUrgencyLevel({ value }) {}
async function initData() {
  const reqTypeList = await getDictInfo(DICT_REPAIR_REQ_TYPE)
@@ -390,13 +405,16 @@
  urgencyList.value = uList
}
onNavigationBarButtonTap((e) => {
  if (e.index === 0) {
    handleSubmit()
  }
})
onLoad((options) => {
  Object.assign(option, options)
  // 扫码页面进入的一些初始化
  if (option.from === 'scan') {
    model.equId = option?.equId
    model.equName = option?.equName
    // 设置类型为设备类型
    model.reqType = '1'
    reqTypeDis.value = true
  }
  initData()
})
</script>