zhangwei
2025-08-05 b94b71d44d62802bb8093f64a202d0176fdade50
src/views/system/dept/utils/hook.tsx
@@ -181,11 +181,11 @@
    }
  };
  async function onSearch() {
    loading.value = true;
    const obj = cloneDeep(form);
    obj.tousu = obj.tousu.join("");
    obj.zhiyi = obj.zhiyi.join("");
    obj.xingzhengquyu = obj.xingzhengquyu.join("");
    obj.xingzhengquyu = obj.xingzhengquyu ? obj.xingzhengquyu.join("") : "";
    loading.value = true;
    const { result } = await zhaobiaoPageOrder(obj); // 这里是返回一维数组结构,前端自行处理成树结构,返回格式要求:唯一id加父节点parentId,parentId取父节点id
    const newData = result.items;
    loading.value = false;
@@ -216,6 +216,8 @@
  }
  function openDialog(title = "新增", row?: FormItemProps) {
    console.log(row,'-');
    addDialog({
      title: `${title}项目`,
      props: {
@@ -231,8 +233,8 @@
          toubiaobaozhengjin: row?.toubiaobaozhengjin ?? null, // 投标保证金(可选)
          lianhetitoubiao: row?.lianhetitoubiao ?? null, // 联合体投标(可选)
          kaibiaofangshi: row?.kaibiaofangshi ?? null, // 开标方式(可选)
          shifoufenbao: row?.shifoufenbao ?? false, // 是否分包(可选)
          shifoutuisongxuanchuan: row?.shifoutuisongxuanchuan ?? true, // 是否推送宣传(可选)
          shifoufenbao: row?.shifoufenbao ?? "false", // 是否分包(可选)
          shifoutuisongxuanchuan: row?.shifoutuisongxuanchuan ?? "true", // 是否推送宣传(可选)
          caigourenmingcheng: row?.caigourenmingcheng ?? null, // 采购人名称(可选)
          xingzhengquyu: row?.xingzhengquyu.split(",") ?? [], // 行政区域(可选)
          xingzhengquyuName: row?.xingzhengquyuName ?? null, // 行政区域名称(可选)
@@ -258,9 +260,10 @@
      draggable: true,
      fullscreen: deviceDetection(),
      fullscreenIcon: true,
      sureBtnLoading: true,
      closeOnClickModal: false,
      contentRenderer: () => h(editForm, { ref: formRef, formInline: null }),
      beforeSure: (done, { options }) => {
      beforeSure: (done, { options, closeLoading }) => {
        const FormRef = formRef.value.getRef();
        const curData = cloneDeep(options.props.formInline as FormItemProps);
        async function chores() {
@@ -279,14 +282,14 @@
            done(); // 关闭弹框
            onSearch(); // 刷新表格数据
          } else {
            closeLoading();
            message(res.message, {
              type: "error"
            });
          }
        }
        FormRef.validate(valid => {
        FormRef.validate((valid, obj) => {
          if (valid) {
            console.log("curData", curData);
            // 表单规则校验通过
            if (title === "新增") {
              // 实际开发先调用新增接口,再进行下面操作
@@ -295,6 +298,18 @@
              // 实际开发先调用修改接口,再进行下面操作
              chores();
            }
          } else {
            closeLoading();
            const fail = [];
            console.log(obj);
            for (const key in obj) {
              fail.push(obj[key][0].message);
            }
            message(fail[0], {
              type: "warning"
            });
            return false;
          }
        });
      }