WXL
昨天 888f941ae16c850c0f1a844ec9436058840920bd
pages/case/CaseDetails.vue
@@ -262,7 +262,7 @@
              <text class="item-label">其他</text>
              <u-input
                v-model="form.infectiousOther"
                placeholder="请输入住院号"
                placeholder="请输入其他传染病"
                border="none"
              />
            </view>
@@ -551,18 +551,18 @@
]);
const bloodTypeOptions = ref([
  { label: "A型", value: "A" },
  { label: "B型", value: "B" },
  { label: "O型", value: "O" },
  { label: "AB型", value: "AB" },
  { label: "A型", value: "A型" },
  { label: "B型", value: "B型" },
  { label: "O型", value: "O型" },
  { label: "AB型", value: "AB型" },
]);
const isTransportOptions = ref([
  { label: "需要", value: "2" },
  { label: "不需要", value: "1" },
]);
const rhOptions = ref([
  { label: "阳性", value: "positive" },
  { label: "阴性", value: "negative" },
  { label: "阳性", value: "1" },
  { label: "阴性", value: "0" },
]);
const reporterOptions = ref([
@@ -637,14 +637,16 @@
const onNationChange = (e) => {
  const index = parseInt(e.detail.value);
  nationIndex.value = nationOptions.value[index].label;
  nationIndex.value = index;
  form.value.nation = nationOptions.value[index].label;
  console.log(form.value.nation, "form.value.nation");
};
const onIdCardTypeChange = (e) => {
  const index = parseInt(e.detail.value);
  idCardTypeIndex.value = index;
  form.value.idcardtype = idCardTypeOptions.value[index].value;
  console.log(form.value.idcardtype, "form.value.idcardtype");
};
const onBirthdayChange = (e) => {
@@ -822,16 +824,19 @@
// 处理基础附件上传
const handleBaseUpload = (file) => {
  console.log("基础附件上传成功:", file);
  attachments.value.push(file);
};
// 处理其他附件上传
const handleFilesUpdate = (files) => {
  console.log(files, "files");
  attachments.value = files.map((file) => ({
    ...file,
    // 确保只存储半路径
    url: file.url.startsWith("http")
      ? file.url.replace(baseUrlHt, "")
      : file.url,
    // url: file.url.startsWith("http")
    //   ? file.url.replace(baseUrlHt, "")
    //   : file.url,
  }));
};
@@ -880,6 +885,8 @@
};
const onHospitalConfirm = (e) => {
  console.log(e, "民族");
  if (e.value && e.value[0]) {
    form.value.treatmenthospitalname = e.value[0].label;
  }
@@ -963,16 +970,14 @@
  }
  try {
    console.log(attachments.value);
    uni.showLoading({ title: isEditMode.value ? "修改中..." : "提交中..." });
    // 准备提交数据
    const submitData = {
      ...form.value,
      age: parseInt(form.value.age) || 0,
      annexfilesList: attachments.value.map((file) => ({
        url: file.url,
        name: file.name,
        path: file.url,
        fileName: file.name,
        type: file.type,
      })),
      phone: form.value.infophone,
@@ -1032,47 +1037,26 @@
};
const loadCaseData = async (id) => {
  // 模拟加载编辑数据
  // form.value = {
  //   caseNo: "DON20241216001",
  //   treatmenthospitalname: "青岛镜湖医院",
  //   treatmentdeptname: "神经外科",
  //   name: "张三",
  //   nation: "汉族",
  //   nationality: "中国",
  //   idcardtype: "居民身份证",
  //   idcardno: "370203198510123456",
  //   sex: "1",
  //   birthday: "1985-10-12",
  //   age: "38",
  //   inpatientno: "ZY20241216001",
  //   diagnosisname: "脑外伤导致脑死亡",
  //   bloodType: "A",
  //   rhYin: "positive",
  //   infoname: "李医生",
  //   infophone: "13800138000",
  //   reporterno: "张医生",
  //   reporttime: currentTime.value,
  // };
  try {
    loading.value = true;
    const res = await uni.$uapi.get(
      `/project/donatebaseinforeport/getInfo/${id}`,
    );
    if (res) {
      console.log(res, "res");
      form.value = res;
      console.log(1, "res");
    if (res.code) {
      form.value = res.data;
      // 处理选择器索引
      // updatePickerIndexes();
      console.log(2, "res");
      // 处理附件
      if (res.annexfilesList) {
        attachments.value = res.annexfilesList;
      if (res.data.annexfilesList) {
        attachments.value = res.data.annexfilesList;
        attachments.value.forEach((item) => {
          item.url = item.path;
          item.name = item.fileName;
        });
      }
      console.log(3, "res");
@@ -1093,32 +1077,7 @@
    loading.value = false;
  }
};
// 更新选择器索引
const updatePickerIndexes = () => {
  // 医疗机构索引
  const hospitalIndex = hospitalOptions.value.findIndex(
    (item) => item.label === form.value.treatmenthospitalname,
  );
  if (hospitalIndex !== -1) hospitalIndex.value = hospitalIndex;
  // 科室索引
  const deptIndex = pickerColumns.value[0].findIndex(
    (item) => item.label === form.value.treatmentdeptname,
  );
  if (deptIndex !== -1) deptIndex.value = deptIndex;
  // 民族索引
  const nationIndex = nationOptions.value.findIndex(
    (item) => item.label === form.value.nation,
  );
  if (nationIndex !== -1) nationIndex.value = nationIndex;
  // 证件类型索引
  const idCardTypeIndex = idCardTypeOptions.value.findIndex(
    (item) => item.value === form.value.idcardtype,
  );
  if (idCardTypeIndex !== -1) idCardTypeIndex.value = idCardTypeIndex;
};
</script>
<style lang="scss" scoped>
.case-report-container {
@@ -1253,6 +1212,16 @@
  display: flex;
  gap: 20rpx;
  margin-top: 40rpx;
  // background: #fff;
  // padding: 20rpx 0;
  // position: fixed;
  // bottom: 0;
  // left: 0;
  // right: 0;
  // padding: 20rpx 30rpx;
  // padding-bottom: calc(20rpx + env(safe-area-inset-bottom));
  // box-shadow: 0 -2rpx 20rpx rgba(0, 0, 0, 0.08);
  // z-index: 9;
}
.btn {
@@ -1476,12 +1445,6 @@
  border-radius: 12rpx !important;
  padding: 20rpx 24rpx !important;
  background: #fff !important;
}
.action-buttons {
  display: flex;
  gap: 20rpx;
  margin-top: 40rpx;
}
.btn {