WXL (wul)
3 天以前 c70f5e1d471ddf002ef0ebd5f4c6a5ed1c865d0d
src/views/Satisfaction/configurationmyd/batch.vue
@@ -59,7 +59,7 @@
                <el-option label="已处理" :value="'1'" />
              </el-select>
            </el-form-item>
            <el-form-item label="模板类型">
            <el-form-item label="满意度类型">
              <el-select
                v-model="filterParams.templateType"
                placeholder="请选择模板类型"
@@ -139,23 +139,21 @@
                <div class="patient-row">
                  <div class="patient-item">
                    <span class="label">姓名:</span>
                    <span class="value">{{ row.patientName }}</span>
                    <span class="value">{{ row.patdescJson.sendname }}</span>
                  </div>
                  <div class="patient-item">
                    <span class="label">性别:</span>
                    <span class="value">{{
                      row.gender === 1 ? "男" : "女"
                    }}</span>
                    <span class="value">{{ row.patdescJson.sex }}</span>
                  </div>
                  <div class="patient-item">
                    <span class="label">年龄:</span>
                    <span class="value">{{ row.age }}岁</span>
                    <span class="value">{{ row.patdescJson.age }}岁</span>
                  </div>
                </div>
                <div class="patient-row">
                  <div class="patient-item full-width">
                    <span class="label">电话:</span>
                    <span class="value">{{ row.phone }}</span>
                    <span class="value">{{ row.patdescJson.phone }}</span>
                  </div>
                </div>
              </div>
@@ -213,7 +211,7 @@
                </div>
                <div class="info-item">
                  <span class="label">处理说明:</span>
                  <span class="value">{{ row.handledesc }}</span>
                  <span class="value">{{ formatHandledesc(row.handledesc) }}</span>
                </div>
              </div>
              <span v-else class="no-data">未处理</span>
@@ -240,7 +238,7 @@
                size="small"
                icon="el-icon-edit"
                @click="handleProcess(row)"
                :disabled="row.handleFlag === '1'"
                :disabled="row.handleresult === 'resolved'"
              >
                处理
              </el-button>
@@ -268,88 +266,245 @@
    <el-dialog
      title="处理异常反馈"
      :visible.sync="processDialogVisible"
      width="600px"
      width="80%"
      top="6vh"
      center
    >
      <el-form
        :model="processForm"
        :rules="processRules"
        ref="processForm"
        label-width="100px"
        size="medium"
      >
        <el-form-item label="处理状态" prop="handleFlag">
          <el-select
            v-model="processForm.handleFlag"
            placeholder="请选择处理状态"
            style="width: 100%"
      <div class="flow-dialog-body">
        <!-- 左半部分:处理信息 -->
        <div class="flow-left">
          <el-form
            :model="processForm"
            :rules="processRules"
            :validate-on-rule-change="false"
            ref="processForm"
            label-width="100px"
            size="medium"
          >
            <el-option label="已处理" :value="'1'" />
            <el-option label="取消处理" :value="'0'" />
          </el-select>
        </el-form-item>
            <el-form-item label="是否流转" prop="isFlow">
              <el-switch
                v-model="processForm.isFlow"
                active-value="1"
                inactive-value="0"
                active-text="流转"
                inactive-text="不流转"
              />
            </el-form-item>
        <el-form-item label="报备科室" prop="ccdepts">
          <el-select
            v-model="processForm.ccdepts"
            placeholder="请选择报备科室"
            multiple
            filterable
            collapse-tags
            style="width: 100%"
            :disabled="processForm.handleFlag !== '1'"
          >
            <el-option
              v-for="dept in deptList"
              :key="dept.deptCode"
              :label="dept.label"
              :value="dept.deptCode"
            />
          </el-select>
        </el-form-item>
            <el-form-item label="处理状态" prop="handleFlag">
              <el-select
                v-model="processForm.handleFlag"
                placeholder="请选择处理状态"
                style="width: 100%"
                @change="handleFlagChange('single', $event)"
              >
                <el-option label="已处理" :value="'1'" />
                <el-option label="取消处理" :value="'0'" />
              </el-select>
            </el-form-item>
        <el-form-item label="处理结果" prop="handleresult">
          <el-select
            v-model="processForm.handleresult"
            placeholder="请选择处理结果"
            style="width: 100%"
            :disabled="processForm.handleFlag !== '1'"
          >
            <el-option label="已解决" value="resolved" />
            <el-option label="已解释" value="explained" />
            <el-option label="已转交" value="transferred" />
            <el-option label="需改进" value="improvement" />
            <el-option label="已驳回" value="rejected" />
          </el-select>
        </el-form-item>
            <el-form-item label="报备科室" prop="ccdepts">
              <el-select
                v-model="processForm.ccdepts"
                placeholder="请选择报备科室"
                multiple
                filterable
                collapse-tags
                style="width: 100%"
                :disabled="processForm.handleFlag !== '1'"
              >
                <el-option
                  v-for="dept in deptList"
                  :key="dept.deptCode"
                  :label="dept.label"
                  :value="dept.deptCode"
                />
              </el-select>
            </el-form-item>
        <el-form-item label="处理说明" prop="handledesc">
          <el-input
            v-model="processForm.handledesc"
            type="textarea"
            :rows="4"
            placeholder="请输入处理说明(最多500字)"
            maxlength="500"
            show-word-limit
            :disabled="processForm.handleFlag !== '1'"
          />
        </el-form-item>
            <el-form-item label="处理结果" prop="handleresult">
              <el-select
                v-model="processForm.handleresult"
                placeholder="请选择处理结果"
                style="width: 100%"
                :disabled="processForm.handleFlag !== '1'"
                @change="handleResultChange('single')"
              >
                <el-option label="已解决" value="resolved" />
                <el-option label="已解释" value="explained" />
                <el-option label="已转交" value="transferred" />
                <el-option label="需改进" value="improvement" />
                <el-option label="已驳回" value="rejected" />
              </el-select>
            </el-form-item>
        <el-form-item
          label="最终意见"
          prop="finaloption"
          v-if="hasQualityPermission"
        >
          <el-input
            v-model="processForm.finaloption"
            type="textarea"
            :rows="3"
            placeholder="请输入最终处理意见(最多300字)"
            maxlength="300"
            show-word-limit
          />
        </el-form-item>
      </el-form>
            <el-form-item label="处理说明" prop="handledesc">
              <el-input
                v-model="processForm.handledesc"
                type="textarea"
                :rows="4"
                placeholder="请输入处理说明(最多500字)"
                maxlength="500"
                show-word-limit
                :disabled="processForm.handleFlag !== '1'"
              />
            </el-form-item>
            <el-form-item
              label="最终意见"
              prop="finaloption"
              v-if="hasQualityPermission"
            >
              <el-input
                v-model="processForm.finaloption"
                type="textarea"
                :rows="3"
                placeholder="请输入最终处理意见(最多300字)"
                maxlength="300"
                show-word-limit
              />
            </el-form-item>
          </el-form>
        </div>
        <!-- 右半部分:流转时间线(选中流转后展开) -->
        <div class="flow-right" v-if="processForm.isFlow === '1'">
          <el-timeline>
            <el-timeline-item type="primary" placement="top" color="#5788fe">
              <div class="flow-step-title">第一步 · 流转发起</div>
              <el-form label-width="90px" size="small" class="flow-step-form">
                <el-form-item label="流转人">
                  <el-input
                    v-model="processForm.flowPerson"
                    placeholder="流转人(默认当前用户)"
                  />
                </el-form-item>
                <el-form-item label="流转人编号">
                  <el-input
                    v-model="processForm.flowPersonCode"
                    placeholder="流转人编号(默认当前用户工号)"
                  />
                </el-form-item>
                <el-form-item label="流转时间">
                  <el-date-picker
                    v-model="processForm.flowTime"
                    type="datetime"
                    value-format="yyyy-MM-dd HH:mm:ss"
                    placeholder="流转时间"
                    style="width: 100%"
                  />
                </el-form-item>
                <el-form-item label="流转说明">
                  <el-input
                    v-model="processForm.flowDesc"
                    type="textarea"
                    :rows="2"
                    placeholder="请输入流转说明"
                  />
                </el-form-item>
                <el-form-item label="流转科室">
                  <el-select
                    v-model="processForm.flowDepts"
                    multiple
                    filterable
                    placeholder="请选择流转科室"
                    style="width: 100%"
                    @change="onFlowDeptChange"
                  >
                    <el-option
                      v-for="dept in deptList"
                      :key="dept.deptCode"
                      :label="dept.label + '(' + dept.deptCode + ')'"
                      :value="dept.deptCode"
                    />
                  </el-select>
                </el-form-item>
                <el-form-item label="推送负责人">
                  <el-select
                    v-model="processForm.pushUsers"
                    multiple
                    filterable
                    placeholder="请选择推送负责人"
                    style="width: 100%"
                    @change="onPushUserChange"
                  >
                    <el-option
                      v-for="u in userList"
                      :key="u.userId"
                      :label="u.nickName || u.userName"
                      :value="u.userId"
                    />
                  </el-select>
                </el-form-item>
              </el-form>
            </el-timeline-item>
            <el-timeline-item type="primary" placement="top" color="#e6a23c">
              <div class="flow-step-title">第二步 · 科室反馈</div>
              <el-table
                :data="processForm.flowFeedbacks"
                border
                size="mini"
                v-if="processForm.flowFeedbacks.length > 0"
              >
                <el-table-column
                  label="科室"
                  prop="deptName"
                  width="120"
                  align="center"
                />
                <el-table-column label="是否处理" width="130" align="center">
                  <template slot-scope="scope">
                    <el-select
                      v-model="scope.row.agree"
                      placeholder="请选择"
                      size="mini"
                    >
                      <el-option label="已处理" value="1" />
                      <el-option label="未处理" value="0" />
                    </el-select>
                  </template>
                </el-table-column>
                <el-table-column label="具体说明" min-width="200" align="center">
                  <template slot-scope="scope">
                    <el-input
                      v-model="scope.row.desc"
                      placeholder="请输入具体说明"
                      size="mini"
                    />
                  </template>
                </el-table-column>
              </el-table>
              <div v-else class="flow-empty-tip">
                请先在第一步选择流转科室
              </div>
            </el-timeline-item>
            <el-timeline-item type="primary" placement="top" color="#67c23a">
              <div class="flow-step-title">第三步 · 处理结果</div>
              <el-form label-width="90px" size="small" class="flow-step-form">
                <el-form-item label="处理人">
                  <el-input
                    v-model="processForm.handleBy"
                    placeholder="处理人"
                  />
                </el-form-item>
                <el-form-item label="处理时间">
                  <el-date-picker
                    v-model="processForm.handleTime"
                    type="datetime"
                    value-format="yyyy-MM-dd HH:mm:ss"
                    placeholder="处理时间"
                    style="width: 100%"
                  />
                </el-form-item>
              </el-form>
            </el-timeline-item>
          </el-timeline>
        </div>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="processDialogVisible = false">取消</el-button>
        <el-button type="primary" @click="submitProcess" :loading="processing">
@@ -367,7 +522,8 @@
    >
      <el-form
        :model="batchProcessForm"
        :rules="processRules"
        :rules="batchProcessRules"
        :validate-on-rule-change="false"
        ref="batchProcessForm"
        label-width="100px"
        size="medium"
@@ -375,8 +531,10 @@
        <el-form-item label="处理状态" prop="handleFlag">
          <el-select
            v-model="batchProcessForm.handleFlag"
            clearable
            placeholder="请选择处理状态"
            style="width: 100%"
            @change="handleFlagChange('batch', $event)"
          >
            <el-option label="已处理" :value="'1'" />
            <el-option label="取消处理" :value="'0'" />
@@ -386,6 +544,7 @@
        <el-form-item label="报备科室" prop="ccdepts">
          <el-select
            v-model="batchProcessForm.ccdepts"
            clearable
            placeholder="请选择报备科室"
            multiple
            filterable
@@ -405,9 +564,11 @@
        <el-form-item label="处理结果" prop="handleresult">
          <el-select
            v-model="batchProcessForm.handleresult"
            clearable
            placeholder="请选择处理结果"
            style="width: 100%"
            :disabled="batchProcessForm.handleFlag !== '1'"
            @change="handleResultChange('batch')"
          >
            <el-option label="已解决" value="resolved" />
            <el-option label="已解释" value="explained" />
@@ -484,7 +645,8 @@
<script>
import DetailsAnomaly from "./components/DetailsAnomaly.vue";
import { tracelist, traceedit } from "@/api/AiCentre/index";
import { deptTreeSelect } from "@/api/system/user";
import dayjs from "dayjs";
import { deptTreeSelect, listUser } from "@/api/system/user";
export default {
  name: "BatchProcess",
@@ -512,8 +674,8 @@
      filterParams: {
        todeptcode: "",
        handleFlag: "",
        templateType: "",
        scriptid: null,
        templateType: null,
        scriptids: [],
        pageNum: 1,
        pageSize: 10,
      },
@@ -528,6 +690,8 @@
      // 科室列表
      deptList: [],
      // 用户列表(流转负责人候选)
      userList: [],
      // 异常列表数据
      exceptionList: [],
@@ -541,48 +705,27 @@
        handleresult: "",
        handledesc: "",
        finaloption: "",
        // 流转相关
        isFlow: "0",
        flowPerson: "",
        flowPersonCode: "",
        flowTime: "",
        flowDesc: "",
        flowDepts: [],
        flowDeptNames: [],
        flowDeptCodes: [],
        pushUsers: [],
        pushUserNames: [],
        pushUserNos: [],
        flowFeedbacks: [],
        handleBy: "",
        handleTime: "",
      },
      batchProgress: {
        visible: false,
        percentage: 0,
        processed: 0,
        total: 0,
      },
      processRules: {
        handleFlag: [
          { required: true, message: "请选择处理状态", trigger: "change" },
        ],
        handleresult: [
          {
            required: true,
            message: "请选择处理结果",
            trigger: "change",
            validator: (rule, value, callback) => {
              if (this.processForm.handleFlag === "1" && !value) {
                callback(new Error("请选择处理结果"));
              } else {
                callback();
              }
            },
          },
        ],
        handledesc: [
          {
            required: true,
            message: "请输入处理说明",
            trigger: "blur",
            validator: (rule, value, callback) => {
              if (
                this.processForm.handleFlag === "1" &&
                (!value || value.trim().length < 3)
              ) {
                callback(new Error("处理说明至少3个字符"));
              } else {
                callback();
              }
            },
          },
        ],
      },
      // 批量处理对话框
@@ -597,23 +740,101 @@
  },
  created() {
    // 从路由参数获取问题ID
    if (this.$route.query.questionId) {
      this.filterParams.scriptid = this.$route.query.questionId || null;
      this.filterParams.scriptids = null;
    } else if (this.$route.query.questionIds) {
      this.filterParams.scriptids = this.$route.query.questionIds;
      this.filterParams.scriptid=null;
    }
    // 从路由参数获取问题ID集合(scriptids 为数组形式)
    this.filterParams.scriptids = this.resolveScriptids();
    this.filterParams.templateType = Number(this.$route.query.type) || null;
    this.hasQualityPermission = this.checkQualityPermission();
  },
  mounted() {
    this.loadExceptionList();
    this.getDeptOptions();
    this.getUserOptions();
  },
  computed: {
    // 单条处理表单校验规则
    processRules() {
      return this.buildProcessRules(
        () => this.processForm.handleFlag,
        () => this.processForm.handleresult
      );
    },
    // 批量处理表单校验规则
    batchProcessRules() {
      return this.buildProcessRules(
        () => this.batchProcessForm.handleFlag,
        () => this.batchProcessForm.handleresult
      );
    },
  },
  methods: {
    // 生成处理表单校验规则
    //   处理结果:处理状态为「已处理」时必填
    //   处理说明:处理结果为「已解决」时必填,其他情况不必填(但仍可填写)
    buildProcessRules(getFlag, getResult) {
      return {
        handleFlag: [
          { required: true, message: "请选择处理状态", trigger: "change" },
        ],
        handleresult: [
          {
            required: true,
            trigger: "change",
            validator: (rule, value, callback) => {
              if (getFlag() === "1" && !value) {
                callback(new Error("请选择处理结果"));
              } else {
                callback();
              }
            },
          },
        ],
        handledesc: [
          {
            required: true,
            trigger: "blur",
            validator: (rule, value, callback) => {
              if (
                getResult() === "resolved" &&
                (!value || String(value).trim().length < 3)
              ) {
                callback(
                  new Error("处理结果为「已解决」时,处理说明至少填写3个字符")
                );
              } else {
                callback();
              }
            },
          },
        ],
      };
    },
    // 切换处理状态时:非「已处理」清空从属字段并清掉旧的校验提示
    // (此时三个控件处于 disabled,用户无法修改,留残值会被提交成脏数据)
    handleFlagChange(type, val) {
      const isBatch = type === "batch";
      const form = isBatch ? this.batchProcessForm : this.processForm;
      const refName = isBatch ? "batchProcessForm" : "processForm";
      if (val !== "1") {
        form.ccdepts = [];
        form.handleresult = "";
        form.handledesc = "";
      }
      const ref = this.$refs[refName];
      if (ref) ref.clearValidate(["handleresult", "handledesc"]);
    },
    // 切换处理结果时:只清掉处理说明的旧校验提示,不清空已填内容
    // (非「已解决」时说明不是必填,但用户仍可自愿填写)
    handleResultChange(type) {
      const refName = type === "batch" ? "batchProcessForm" : "processForm";
      const ref = this.$refs[refName];
      if (ref) ref.clearValidate(["handledesc"]);
    },
    // 格式化日期时间
    formatDateTime(dateTime) {
      if (!dateTime) return "";
@@ -643,6 +864,19 @@
        .catch((error) => {
          console.error("获取科室列表失败:", error);
          this.$message.error("获取科室列表失败");
        });
    },
    /** 查询用户列表(流转负责人候选) */
    getUserOptions() {
      listUser({ pageNum: 1, pageSize: 19999 })
        .then((res) => {
          if (res.code == 200) {
            this.userList = res.rows || [];
          }
        })
        .catch((error) => {
          console.error("获取用户列表失败:", error);
          this.$message.error("获取用户列表失败");
        });
    },
    flattenArray(multiArray) {
@@ -726,6 +960,14 @@
      });
    },
    // 解析路由中的 scriptids(兼容数组 / 逗号分隔字符串,统一返回数组)
    resolveScriptids() {
      const raw = this.$route.query.scriptids;
      if (Array.isArray(raw)) return raw;
      if (raw) return String(raw).split(",");
      return [];
    },
    // 构建查询参数
    buildQueryParams() {
      const params = {
@@ -745,8 +987,8 @@
        params.templateType = this.filterParams.templateType;
      }
      if (this.filterParams.scriptid) {
        params.scriptid = this.filterParams.scriptid;
      if (this.filterParams.scriptids && this.filterParams.scriptids.length) {
        params.scriptids = this.filterParams.scriptids;
      }
      return params;
@@ -788,8 +1030,8 @@
      this.filterParams = {
        todeptcode: "",
        handleFlag: "",
        templateType: "",
        scriptid: null, // 保留问题ID
        scriptids: this.resolveScriptids(),
        templateType: Number(this.$route.query.type) || null,
        pageNum: 1,
        pageSize: 10,
      };
@@ -822,7 +1064,8 @@
    // 返回异常列表
    handleGoBack() {
      this.$router.push("/satisfaction/exception/list");
      // this.$router.push("/satisfaction/exception/list");
      this.$router.push("/Intelligentcenter/dispose");
    },
    // 查看详情
@@ -833,7 +1076,7 @@
      // 生成弹框标题
      let title = "异常反馈详情";
      if (row.patdesc) {
        const patientName = row.patdesc.split("|")[0];
        const patientName = row.patdescJson.sendname;
        if (patientName) {
          title = `${patientName} - ${title}`;
        }
@@ -859,22 +1102,212 @@
    handleProcess(row) {
      this.currentExceptionId = row.id;
      const nickName = this.$store.state.user.nickName || "";
      const now = dayjs().format("YYYY-MM-DD HH:mm:ss");
      // 是否流转(后端 circulationStatus:0 不流转 / 1 流转)
      const isFlow = String(row.circulationStatus) === "1" ? "1" : "0";
      // 报备科室(兼容数组或逗号分隔字符串)
      const ccdepts = Array.isArray(row.ccdepts)
        ? row.ccdepts
        : row.ccdepts
        ? row.ccdepts.split(",")
        : [];
      // 流转科室 code / 名称
      const flowDeptCodes = row.circulationDeptCode
        ? row.circulationDeptCode.split(",")
        : [];
      const flowDeptNames = row.circulationDeptName
        ? row.circulationDeptName.split(",")
        : [];
      // 推送负责人:后端存工号(userName),下拉 value 用 userId,需回映
      const pushUserNos = row.circulationDeptPersonCode
        ? row.circulationDeptPersonCode.split(",")
        : [];
      const pushUserNames = row.circulationDeptPersonName
        ? row.circulationDeptPersonName.split(",")
        : [];
      const pushUsers = pushUserNos.map((no) => {
        const u = this.userList.find((item) => item.userName === no);
        return u ? u.userId : no;
      });
      // 科室反馈:从 handledesc JSON 中还原
      let flowFeedbacks = [];
      try {
        const parsed =
          typeof row.handledesc === "string" &&
          row.handledesc.trim().startsWith("{")
            ? JSON.parse(row.handledesc)
            : null;
        if (parsed && parsed.flow && Array.isArray(parsed.flow.feedbacks)) {
          flowFeedbacks = parsed.flow.feedbacks;
        }
      } catch (e) {
        // handledesc 非 JSON,忽略
      }
      // 流转时间:后端 Date 字段,统一转成 yyyy-MM-dd HH:mm:ss 供日期选择器回显
      let flowTime = now;
      if (row.circulationTime) {
        const d = new Date(
          typeof row.circulationTime === "number"
            ? row.circulationTime
            : String(row.circulationTime).replace(" ", "T")
        );
        if (!isNaN(d.getTime())) {
          const pad = (n) => String(n).padStart(2, "0");
          flowTime =
            d.getFullYear() +
            "-" +
            pad(d.getMonth() + 1) +
            "-" +
            pad(d.getDate()) +
            " " +
            pad(d.getHours()) +
            ":" +
            pad(d.getMinutes()) +
            ":" +
            pad(d.getSeconds());
        }
      }
      // 初始化表单数据
      this.processForm = {
        handleFlag: row.handleFlag === "0" ? "1" : "0",
        ccdepts: row.ccdepts ? row.ccdepts.split(",") : [],
        handleFlag: "1",
        ccdepts,
        handleresult: row.handleresult || "",
        handledesc: row.handledesc || "",
        handledesc: this.formatHandledesc(row.handledesc),
        finaloption: row.finaloption || "",
        // 流转相关
        isFlow,
        flowPerson: row.circulationPersonName || nickName,
        flowPersonCode:
          row.circulationPersonCode || this.$store.state.user.userName || "",
        flowTime,
        flowDesc: row.circulationExplain || "",
        flowDepts: [...flowDeptCodes],
        flowDeptNames: [...flowDeptNames],
        flowDeptCodes: [...flowDeptCodes],
        pushUsers,
        pushUserNames: [...pushUserNames],
        pushUserNos: [...pushUserNos],
        flowFeedbacks,
        handleBy: nickName,
        handleTime: now,
      };
      this.processDialogVisible = true;
    },
    // 流转科室变化:同步科室名称、科室code,并生成反馈表格
    onFlowDeptChange(codes) {
      this.processForm.flowDeptCodes = [...codes];
      this.processForm.flowDeptNames = codes.map((code) => {
        const dept = this.deptList.find((item) => item.deptCode === code);
        return dept ? dept.label : code;
      });
      // 生成/维护第二步反馈表格(保留已填写的反馈)
      this.processForm.flowFeedbacks = codes.map((code) => {
        const existing = this.processForm.flowFeedbacks.find(
          (item) => item.deptCode === code
        );
        if (existing) return existing;
        const dept = this.deptList.find((item) => item.deptCode === code);
        return {
          deptCode: code,
          deptName: dept ? dept.label : code,
          agree: "",
          desc: "",
        };
      });
    },
    // 推送负责人变化:同步负责人昵称、工号
    onPushUserChange(ids) {
      this.processForm.pushUserNames = ids.map((id) => {
        const user = this.userList.find((u) => String(u.userId) === String(id));
        return user ? user.nickName || user.userName : "";
      });
      this.processForm.pushUserNos = ids.map((id) => {
        const user = this.userList.find((u) => String(u.userId) === String(id));
        return user ? user.userName || "" : "";
      });
    },
    // 组装 handledesc:流转时以 JSON 形式保存原处理说明与流转说明、科室反馈
    buildHandledesc() {
      if (this.processForm.isFlow !== "1") {
        return this.processForm.handledesc;
      }
      const flow = {
        feedbacks: this.processForm.flowFeedbacks.map((f) => ({
          deptCode: f.deptCode,
          deptName: f.deptName,
          agree: f.agree,
          desc: f.desc,
        })),
      };
      return JSON.stringify({
        desc: this.processForm.handledesc,
        flow,
      });
    },
    // 解析 handledesc:若是流转 JSON 则取其中的处理说明,否则原样返回
    formatHandledesc(val) {
      if (!val) return "";
      if (typeof val !== "string") return val;
      const trimmed = val.trim();
      if (trimmed.startsWith("{")) {
        try {
          const obj = JSON.parse(trimmed);
          if (obj && obj.desc != null) return obj.desc;
        } catch (e) {
          // 不是合法 JSON,按原文本返回
        }
      }
      return val;
    },
    // 流转时间转为带时区的 ISO 格式,供后端 Date 类型字段反序列化
    toISODateTime(str) {
      if (!str) return null;
      const d = new Date(String(str).replace(" ", "T"));
      if (isNaN(d.getTime())) return null;
      const pad = (n) => String(n).padStart(2, "0");
      const offset = -d.getTimezoneOffset();
      const sign = offset >= 0 ? "+" : "-";
      const abs = Math.abs(offset);
      const tz = sign + pad(Math.floor(abs / 60)) + ":" + pad(abs % 60);
      return (
        d.getFullYear() +
        "-" + pad(d.getMonth() + 1) +
        "-" + pad(d.getDate()) +
        "T" + pad(d.getHours()) +
        ":" + pad(d.getMinutes()) +
        ":" + pad(d.getSeconds()) +
        "." + String(d.getMilliseconds()).padStart(3, "0") +
        tz
      );
    },
    // 提交处理
    async submitProcess() {
      this.$refs.processForm.validate(async (valid) => {
        if (!valid) {
          return;
        }
        // 流转时校验必须选择流转科室
        if (
          this.processForm.isFlow === "1" &&
          (!this.processForm.flowDepts || this.processForm.flowDepts.length === 0)
        ) {
          this.$message.warning("请先选择流转科室");
          return;
        }
@@ -886,12 +1319,30 @@
            id: this.currentExceptionId,
            handleFlag: this.processForm.handleFlag,
            handleresult: this.processForm.handleresult,
            handledesc: this.processForm.handledesc,
            handledesc: this.buildHandledesc(),
            finaloption: this.processForm.finaloption,
            handleBy:
              this.processForm.handleBy || this.$store.state.user.nickName,
            handleTime:
              this.processForm.handleTime ||
              dayjs().format("YYYY-MM-DD HH:mm:ss"),
            // 将数组转换为逗号分隔的字符串
            ccdepts: Array.isArray(this.processForm.ccdepts)
              ? this.processForm.ccdepts.join(",")
              : this.processForm.ccdepts,
            // 流转相关主表字段(后端已定稿)
            circulationPersonName: this.processForm.flowPerson,
            circulationPersonCode:
              this.processForm.flowPersonCode ||
              this.$store.state.user.userName ||
              "",
            circulationStatus: this.processForm.isFlow,
            circulationDeptName: this.processForm.flowDeptNames.join(","),
            circulationDeptCode: this.processForm.flowDeptCodes.join(","),
            circulationDeptPersonName: this.processForm.pushUserNames.join(","),
            circulationDeptPersonCode: this.processForm.pushUserNos.join(","),
            circulationExplain: this.processForm.flowDesc,
            circulationTime: this.toISODateTime(this.processForm.flowTime),
          };
          // TODO: 这里需要调用实际的处理接口
          await traceedit(submitData);
@@ -937,7 +1388,7 @@
          };
          // 控制并发数
          const CONCURRENT_LIMIT = 10; // 同时最多3个请求
          const CONCURRENT_LIMIT = 10; // 同时最多 10 个请求
          const totalCount = this.selectedExceptionIds.length;
          const results = [];
          let successCount = 0;
@@ -986,11 +1437,12 @@
                console.error(`处理记录 ${result.id} 失败:`, result.error);
              }
            });
            // 更新进度
            this.batchProgress.processed = i + 1;
            this.batchProgress.percentage = Math.round(
              ((i + 1) / totalCount) * 100
            );
            // 更新进度:i 是批次起始索引(步长为 CONCURRENT_LIMIT),
            // 必须加上本批实际条数,否则进度只会按批数递增(如 25 条只到 84%)
            this.batchProgress.processed = i + batchIds.length;
            this.batchProgress.percentage = totalCount
              ? Math.round(((i + batchIds.length) / totalCount) * 100)
              : 100;
            // 显示进度
            console.log(
              `进度: ${Math.min(
@@ -1141,7 +1593,7 @@
          .patient-item {
            flex: 1;
            display: flex;
            justify-content: space-between;
            justify-content: flex-start;
            align-items: center;
            padding: 0 5px;
@@ -1175,7 +1627,7 @@
        .info-item {
          display: flex;
          justify-content: space-between;
          justify-content: flex-start;
          align-items: center;
          margin-bottom: 5px;
          padding: 2px 0;
@@ -1188,7 +1640,7 @@
          .value {
            color: #333;
            font-weight: 500;
            text-align: right;
            // text-align: right;
            flex: 1;
            &.time {
@@ -1214,6 +1666,47 @@
  }
}
// 处理弹框左右布局
.flow-dialog-body {
  display: flex;
  align-items: stretch;
  .flow-left {
    flex: 1;
    min-width: 320px;
    padding-right: 24px;
    border-right: 1px solid #ebeef5;
  }
  .flow-right {
    flex: 1;
    min-width: 320px;
    padding-left: 24px;
    max-height: 60vh;
    overflow-y: auto;
    .flow-step-title {
      font-weight: 600;
      color: #303133;
      margin-bottom: 12px;
      font-size: 14px;
    }
    .flow-step-form {
      ::v-deep .el-form-item {
        margin-bottom: 12px;
      }
    }
    .flow-empty-tip {
      padding: 20px;
      text-align: center;
      color: #909399;
      font-size: 13px;
    }
  }
}
@media (max-width: 768px) {
  .batch-process {
    padding: 10px;