祖安之光
2025-11-24 b231c463d1e14020fae1f5303dd93c2f49c85cdc
src/views/work/procurementPlatform/warehouseManagement/monthlyInspectionRecord/components/editDialog.vue
@@ -11,7 +11,7 @@
      <el-form :model="state.form" size="default" ref="busRef" :rules="state.rules"  label-position="right" label-width="130">
        <el-row :gutter="24">
          <el-col :span="24">
            <el-form-item label="企业名称:" prop="companyId" v-if="state.isAdmin">
            <el-form-item label="单位名称:" prop="companyId" v-if="state.isAdmin">
              <el-select v-model="state.form.companyId" placeholder="请选择" filterable clearable style="width: 100%" :disabled="title == '查看' || title == '编辑' || !state.isAdmin" @change="selectValueCom">
                <el-option
                    v-for="item in state.companyList"
@@ -42,7 +42,7 @@
              <div style="display: flex;width: 100%;">
                <el-table :data="state.form.inspectionMesses" :border="true" >
                  <el-table-column type="index" label="序号"  align="center"></el-table-column>
                  <el-table-column label="时间" prop="monthlyTime" align="center" width="100">
                  <el-table-column label="时间" prop="monthlyTime" align="center" width="140">
                    <template  #default="{row,$index}">
                      <el-form-item :prop="'inspectionMesses.' + '[' + $index + ']' + 'monthlyTime'" :rules="state.rules.monthlyTime">
                        <el-date-picker
@@ -142,7 +142,8 @@
import {getDept, getObject, getObjectPage} from "@/api/qualityObjectives/object";
import {addTable, editTable, getTargetById} from "@/api/qualityObjectives/table";
import {addNeedDiscren, editNeedDiscren} from "@/api/need/need";
import {addMonthlyRecord, editMonthlyRecord} from "@/api/monthlyInspectionRecord";
import {addMonthlyRecord, editMonthlyRecord, getMonthlyRecordById} from "@/api/monthlyInspectionRecord";
import {getQualityTemplateById} from "@/api/standardSys/standardSys";
const dialogVisible = ref(false);
const title = ref("");
@@ -193,11 +194,22 @@
  }
  title.value = type === 'add' ? '新增' : type ==='edit' ? '编辑' : '查看' ;
  if(type === 'edit' || type === 'review') {
    state.form = JSON.parse(JSON.stringify(value));
    if(state.isAdmin){
      state.form.companyId = value.companyId
      state.form.companyName = value.companyName
    const res = await getMonthlyRecordById({monthlyId: value.id})
    if(res.code === 200){
      state.form = res.data
    }else{
      ElMessage.warning(res.message)
    }
    if(state.isAdmin){
      state.form.companyId = res.data.companyId
      state.form.companyName = res.data.companyName
    }
    // state.form = JSON.parse(JSON.stringify(value));
    // if(state.isAdmin){
    //   state.form.companyId = value.companyId
    //   state.form.companyName = value.companyName
    // }
  }
  await getPeopleList()
  dialogVisible.value = true;