祖安之光
2025-10-15 711897bc6d937f1dbf741014dc6a6d52369c37e0
src/views/work/qualityInfo/infrastructureMng/maintainPlan/components/editDialog.vue
@@ -133,7 +133,15 @@
            <tr>
              <td>{{deviceIndex + 1}}</td>
              <td>
                <el-input v-model.trim="device.deviceName" type="textarea" style="width: 100%;" clearable :readonly="state.title =='查看'"></el-input>
<!--                <el-input v-model.trim="device.deviceName" type="textarea" style="width: 100%;" clearable :readonly="state.title =='查看'"></el-input>-->
                <el-select clearable v-model="device.deviceName" :readonly="state.title =='查看'" filterable placeholder="设备名称" style="width: 100%" @change="getDeviceInfo(device.deviceName,deviceIndex)">
                  <el-option
                      v-for="item in state.deviceList"
                      :key="item.id"
                      :label="item.name"
                      :value="item.id"
                  />
                </el-select>
              </td>
              <td>
                <el-input v-model.trim="device.model" type="textarea" style="width: 100%;" clearable :readonly="state.title =='查看'"></el-input>
@@ -223,7 +231,7 @@
} from "@/api/innerReview/meetingReview";
import {getDepart} from "@/api/orgStructure/depart";
import {listUser} from "@/api/system/user";
import {getMaintenancePlanDetail, updateMaintenancePlan} from "@/api/infrastructureMng/ledger";
import {getMaintenancePlanDetail, getStandingBookList, updateMaintenancePlan} from "@/api/infrastructureMng/ledger";
const emit = defineEmits(["getList"]);
const dialogVisible = ref(false)
@@ -253,6 +261,7 @@
    delDeviceIds: []
  },
  oldDeviceList: [],
  deviceList: [],
  formRules:{
    companyId: [{ required: true, message: '请选择企业', trigger: 'blur' }],
    year: [{ required: true, message: '请选择年份', trigger: 'blur' }],
@@ -290,6 +299,7 @@
    state.companyList = companyList
  }
  await getUserList(companyId)
  await getDeviceList(companyId)
  state.title = type === 'add' ? '新增' : type ==='edit' ? '编辑' : '查看'
  state.form.companyId = companyId
  state.form.year = new Date().getFullYear().toString()
@@ -297,6 +307,25 @@
    await getInfo(value.id)
  }
  dialogVisible.value = true
}
const getDeviceList = async (companyId) => {
  const res = await getStandingBookList({pageNum: 1, pageSize: 999, companyId: companyId})
  if(res.code == 200){
    state.deviceList = res.data.list || []
  }else{
    ElMessage.warning(res.message)
  }
}
const getDeviceInfo = (name,index)=>{
  const foundNode = state.deviceList.find(i=>i.id == name)
  state.form.annualMaintenanceDeviceSaveDTOReqs[index] = {
    ...state.form.annualMaintenanceDeviceSaveDTOReqs[index],
    deviceName: foundNode.name,
    model: foundNode.model,
    factoryNumber: foundNode.number
  }
}
const addLine = () => {
@@ -434,6 +463,7 @@
  state.form.processId = null
  state.form.finishId = null
  await getUserList(state.form.companyId)
  await getDeviceList(state.form.companyId)
}
const getUserList = async (companyId)=> {