-
zhangwei
2025-08-25 23a2fff92f73b9759849a8016601a6817d7470b1
src/views/system/dept/utils/detail.tsx
@@ -9,7 +9,8 @@
import {
  fabuzhaobiao,
  changezhaobiao,
  getTenderOrderDetail
  getTenderOrderDetail,
  updateTittle
} from "@/api/item/index";
const formRef = ref();
@@ -59,7 +60,85 @@
            res = await changezhaobiao(curData);
          }
          if (res.code == "200") {
            getTenderOrderDetail({ id: row?.id });
            getTenderOrderDetail({ id: row?.id }).then(res => {
              state.nowInfo = res.result;
            });
            done(); // 关闭弹框
          } else {
            closeLoading();
            message(res.message, {
              type: "error"
            });
          }
        }
        FormRef.validate((valid, obj) => {
          if (valid) {
            // 表单规则校验通过
            if (title === "新增") {
              // 实际开发先调用新增接口,再进行下面操作
              chores();
            } else {
              // 实际开发先调用修改接口,再进行下面操作
              chores();
            }
          } else {
            closeLoading();
            const fail = [];
            for (const key in obj) {
              fail.push(obj[key][0].message);
            }
            message(fail[0], {
              type: "warning"
            });
            return false;
          }
        });
      }
    });
  }
  function changeDialog(title = "上传", row?: TenderInfo) {
    addDialog({
      title: `修改标题`,
      props: {
        formInline: {
          tenderId: title == "上传变更" ? row?.id : "",
          id: title == "上传" ? row?.id : "",
          projectName: row?.projectName ?? "",
          toubiaoStartDate: row?.toubiaoStartDate ?? "", //投标报名开始时间
          toubiaoEndDate: row?.toubiaoEndDate ?? "", //投标报名结束时间
          kaibiaoDate: row?.kaibiaoDate ?? "", //开标时间
          biangengwenjian: "", //招标文件
          fujian: row?.fujian ?? "", //附件
          kaibiaodidian: row?.kaibiaodidian ?? "" //开标地点
        }
      },
      width: "30%",
      draggable: true,
      fullscreen: deviceDetection(),
      fullscreenIcon: true,
      sureBtnLoading: true,
      closeOnClickModal: false,
      contentRenderer: () =>
        h(tenderForm, {
          ref: formRef,
          formInline: null,
          changeDetail: true,
          isChange: true
        }),
      beforeSure: (done, { options, closeLoading }) => {
        const FormRef = formRef.value.getRef();
        const curData = cloneDeep(options.props.formInline as TenderInfo);
        async function chores() {
          // message(`您${title}了项目名称为${curData.projectName}的这条数据`, {
          //   type: "success"
          // });
          // curData.dingbiaoguize = curData.dingbiaoguize.join("");
          curData.id = state.nowInfo.id;
          const res = await updateTittle(curData);
          if (res.code == "200") {
            getTenderOrderDetail({ id: row?.id }).then(res => {
              state.nowInfo = res.result;
            });
            done(); // 关闭弹框
          } else {
            closeLoading();
@@ -129,12 +208,13 @@
    );
    // 拼接时间戳和随机数
    return (
      `${dirPath}/${timestamp}_${randomNumber}` + filename.match(/\.[^.]+$/)
      `${dirPath}${timestamp}_${randomNumber}` + filename.match(/\.[^.]+$/)
    );
  }
  return {
    openUploadDialog,
    state,
    generateTimestampWithRandom
    generateTimestampWithRandom,
    changeDialog
  };
}