瀏覽代碼

结果统计ok

shaogen1995 1 年之前
父節點
當前提交
e2dd2f0b76

+ 4 - 2
src/components/ZRichText/index.module.scss

@@ -49,13 +49,15 @@
       float: initial !important;
       display: block;
       margin: 10px auto;
-      max-width: 500px;
-      max-height: 500px;
       text-align: center;
       // 不让拖动放大缩小图片(会报错)
       .bf-csize-icon{
         display: none !important;
       }
+      img{
+        max-width: 500px;
+        max-height: 300px;
+      }
     }
 
   }

+ 50 - 0
src/pages/A6_1ques/A6QInfo/EchBox/index.module.scss

@@ -0,0 +1,50 @@
+.EchBox {
+  width: 100%;
+  display: flex;
+
+  :global {
+    .EchBox1 {
+      width: 600px;
+      height: 300px;
+    }
+
+    .EchBox2 {
+      width: calc(100% - 600px);
+      min-height: 300px;
+      display: flex;
+      flex-direction: column;
+      justify-content: center;
+
+      .EchBox2Son {
+        .EchBox2Son1 {
+          display: flex;
+
+          &>div {
+            margin-bottom: 6px;
+          }
+
+          .EchBox2Son1_1 {
+            font-weight: 700;
+            width: 110px;
+            text-align: right;
+          }
+
+          .EchBox2Son1_2 {
+            font-weight: 700;
+            width: 40px;
+            text-align: center;
+          }
+
+          .EchBox2Son1_3 {
+            width: calc(100% - 160px);
+            margin-left: 10px;
+
+            &>div {
+              margin-bottom: 6px;
+            }
+          }
+        }
+      }
+    }
+  }
+}

+ 231 - 0
src/pages/A6_1ques/A6QInfo/EchBox/index.tsx

@@ -0,0 +1,231 @@
+import React, { useEffect, useRef, useState } from "react";
+import styles from "./index.module.scss";
+import { DataResTabListTabCutType, DataResTabListType, columnsObj } from "..";
+
+import * as echarts from "echarts/core";
+import { TitleComponent } from "echarts/components";
+import { PieChart } from "echarts/charts";
+import { LabelLayout } from "echarts/features";
+
+import { LineChart } from "echarts/charts";
+import { UniversalTransition } from "echarts/features";
+
+import {
+  ToolboxComponent,
+  TooltipComponent,
+  GridComponent,
+  LegendComponent,
+} from "echarts/components";
+import { BarChart } from "echarts/charts";
+import { CanvasRenderer } from "echarts/renderers";
+
+echarts.use([
+  ToolboxComponent,
+  TooltipComponent,
+  GridComponent,
+  LegendComponent,
+  BarChart,
+  CanvasRenderer,
+  LineChart,
+  UniversalTransition,
+  TitleComponent,
+  PieChart,
+  LabelLayout,
+]);
+
+type DataResType = {
+  name: string;
+  value: number;
+  index: string;
+  bai: string;
+  customDesc: string[];
+};
+
+type Props = {
+  type: DataResTabListTabCutType;
+  info: DataResTabListType;
+};
+
+const colorRes = [
+  "#5470c6",
+  "#91cc75",
+  "#fac858",
+  "#ee6666",
+  "#73c0de",
+  "#3ba272",
+  "#fc8452",
+  "#9a60b4",
+  "#ea7ccc",
+];
+
+const optionObjFu = (type: DataResTabListTabCutType, arr: DataResType[]) => {
+  const arr1 = arr.map((v) => v.index);
+  const arr2 = arr.map((v) => v.value);
+
+  const objTemp = {
+    colorRes,
+    tooltip: {
+      trigger: "axis",
+      axisPointer: {
+        type: "shadow",
+      },
+    },
+    grid: {
+      left: "0%",
+      right: "0%",
+      bottom: "0%",
+      top: "5%",
+      containLabel: true,
+    },
+  };
+
+  if (type === "柱状图") {
+    return {
+      ...objTemp,
+      xAxis: {
+        type: "category",
+        data: arr1,
+      },
+      yAxis: {
+        type: "value",
+      },
+      series: [
+        {
+          data: arr2.map((v, i) => ({
+            value: v,
+            itemStyle: { color: colorRes[i] },
+          })),
+          type: "bar",
+          barWidth: "40",
+        },
+      ],
+    };
+  } else if (type === "折线图") {
+    return {
+      ...objTemp,
+      xAxis: {
+        type: "category",
+        data: arr1,
+      },
+      yAxis: {
+        type: "value",
+      },
+      series: [
+        {
+          data: arr2,
+          type: "line",
+        },
+      ],
+    };
+  } else {
+    // 饼图
+    return {
+      ...objTemp,
+      tooltip: {
+        trigger: "item",
+      },
+      series: [
+        {
+          label: {
+            show: false,
+            position: "center",
+          },
+          type: "pie",
+          data: arr1.map((v, i) => ({
+            value: arr2[i],
+            name: v,
+          })),
+        },
+      ],
+    };
+  }
+};
+
+function EchBox({ type, info }: Props) {
+  const [dataRes, setDataRes] = useState<DataResType[]>([]);
+
+  const oldDataFlagId = useRef(0);
+
+  useEffect(() => {
+    // 防止多次渲染
+    if (oldDataFlagId.current === info.id) return;
+
+    oldDataFlagId.current = info.id;
+
+    const lodArr = info.optionsCount || [];
+
+    const flag = info.type === "排序";
+
+    // 获取总数
+    const max = lodArr
+      .map((v) => (flag ? v.score || 0 : v.pcs))
+      .reduce(function (prev, curr) {
+        return prev + curr;
+      });
+
+    const arr: DataResType[] = lodArr.map((v, i) => ({
+      name: v.name,
+      value: flag ? v.score || 0 : v.pcs,
+      index: v.name === "其他" ? "自定义回答" : Reflect.get(columnsObj, i),
+      bai: Math.round(((flag ? v.score || 0 : v.pcs) / max) * 100) + "%",
+      customDesc:
+        v.name === "其他"
+          ? (v.customDesc || "").split(";").filter((v) => v)
+          : ([] as string[]),
+    }));
+
+    setDataRes(arr);
+    console.log(arr);
+
+    const dom = EchBox1.current;
+    if (dom) {
+      const myChart = echarts.getInstanceByDom(dom) || echarts.init(dom);
+      const option = optionObjFu(type, arr);
+      option && myChart.setOption(option);
+    }
+  }, [info, type]);
+
+  const EchBox1 = useRef<HTMLDivElement>(null);
+
+  return (
+    <div className={styles.EchBox}>
+      <div className="EchBox1" ref={EchBox1}></div>
+      {/* 右侧的数据 */}
+      <div className="EchBox2">
+        {dataRes.map((v, i) => (
+          <div key={i} className="EchBox2Son">
+            {v.name === "其他" ? (
+              <div className="EchBox2Son1">
+                <div className="EchBox2Son1_1" style={{ color: colorRes[i] }}>
+                  自定义回答:
+                </div>
+                <div className="EchBox2Son1_2" style={{ color: colorRes[i] }}>
+                  {v.bai}
+                </div>
+                <div className="EchBox2Son1_3">
+                  {v.customDesc.map((v2, i2) => (
+                    <div key={i2}>{v2}</div>
+                  ))}
+                </div>
+              </div>
+            ) : (
+              <div className="EchBox2Son1">
+                <div className="EchBox2Son1_1" style={{ color: colorRes[i] }}>
+                  {v.index}:
+                </div>
+                <div className="EchBox2Son1_2" style={{ color: colorRes[i] }}>
+                  {v.bai}
+                </div>
+                <div className="EchBox2Son1_3">{v.name}</div>
+              </div>
+            )}
+          </div>
+        ))}
+      </div>
+    </div>
+  );
+}
+
+const MemoEchBox = React.memo(EchBox);
+
+export default MemoEchBox;

+ 27 - 0
src/pages/A6_1ques/A6QInfo/Tab2Look.tsx

@@ -0,0 +1,27 @@
+import React from "react";
+import styles from "./index.module.scss";
+import { Button, Modal } from "antd";
+
+// type Props
+
+ function Tab2Look() {
+  
+  return (
+    <Modal
+      wrapClassName={styles.Tab2Look}
+      open={true}
+      title={`自定义结果`}
+      footer={
+        [] // 设置footer为空,去掉 取消 确定默认按钮
+      }
+    >
+      <div className="T2btn">
+        <Button>关闭</Button>
+      </div>
+    </Modal>
+  )
+}
+
+const MemoTab2Look = React.memo(Tab2Look);
+
+export default MemoTab2Look;

+ 163 - 4
src/pages/A6_1ques/A6QInfo/index.module.scss

@@ -1,4 +1,4 @@
-.A6QInfo{
+.A6QInfo {
   position: absolute;
   z-index: 10;
   top: 0;
@@ -7,8 +7,167 @@
   height: 100%;
   background-color: #fff;
   border-radius: 10px;
-  padding: 20px;
-  :global{
-    
+
+  :global {
+    .A6QInfoBoxCC {
+      width: 100%;
+      height: 100%;
+      overflow-y: auto;
+
+      .A6QtopBack {
+        position: absolute;
+        top: 50%;
+        right: 40px;
+        transform: translateY(-50%);
+        z-index: 11;
+        width: 90px;
+
+        .ant-btn {
+          width: 100%;
+          margin-bottom: 20px;
+        }
+      }
+
+      .A6QInfoBox {
+        padding: 20px;
+        width: calc(100% - 120px);
+
+
+
+        .A6Qtop {
+          font-weight: 700;
+          font-size: 20px;
+
+        }
+
+        .A6Qmain {
+          font-size: 16px;
+
+          .A6QM1 {
+            margin-top: 4px;
+            margin-bottom: 4px;
+
+            &>span {
+              font-weight: 700;
+            }
+          }
+
+          .A6QM2 {
+            padding-bottom: 15px;
+
+            .image-wrap {
+              text-align: center;
+              display: block;
+              margin: 8px auto;
+
+              img {
+                max-width: 500px;
+                max-height: 300px;
+              }
+            }
+
+            p {
+              min-height: 15px;
+            }
+          }
+
+          .A6QCbox {
+            padding-top: 15px;
+            border-top: 1px solid #ccc;
+
+            .A6QC1 {
+              display: flex;
+              font-size: 16px;
+              font-weight: 700;
+
+              &>div {
+                cursor: pointer;
+                margin-right: 15px;
+
+              }
+
+              .A6QC1Ac {
+                color: var(--themeColor);
+                border-bottom: 2px solid var(--themeColor);
+              }
+            }
+
+            .A6QC2 {
+              margin-top: 20px;
+
+              .ant-table-cell {
+                padding: 10px;
+              }
+
+              .A6QC2Txt {
+                &>span {
+                  font-weight: 700;
+                }
+              }
+
+              .A6QC2Tab {
+                margin: 10px 0;
+                display: flex;
+
+                .ant-btn {
+                  margin-right: 15px;
+                }
+
+                .ant-btn-primary {
+                  pointer-events: none;
+                }
+
+                .A6QC2TabDis {
+                  display: none;
+                }
+
+
+
+
+              }
+
+              .A6QC2Centen {
+                margin-top: 10px;
+
+                .sonTableNone {
+                  padding: 6px 0;
+                  font-weight: 700;
+                  text-align: center;
+                  background: #fafafa;
+                }
+              }
+            }
+
+            .A6QC2None {
+              width: 100%;
+              height: 200px;
+              line-height: 200px;
+              text-align: center;
+              font-weight: 700;
+              font-size: 18px;
+            }
+          }
+        }
+
+      }
+    }
+  }
+}
+
+// 结果统计 查看自定义结果的弹窗
+.Tab2Look {
+  :global {
+    .ant-modal-close {
+      display: none;
+    }
+
+    .ant-modal {
+      width: 800px !important;
+    }
+
+    .T2btn {
+      margin-top: 20px;
+      text-align: center;
+    }
   }
 }

+ 388 - 4
src/pages/A6_1ques/A6QInfo/index.tsx

@@ -1,19 +1,403 @@
-import React, { useEffect } from "react";
+import React, { useCallback, useEffect, useState } from "react";
 import styles from "./index.module.scss";
+import { A6Q_APIresList, A6Q_APIresTabList } from "@/store/action/A6_1ques";
+import { Button, Table } from "antd";
+import classNames from "classnames";
+import htmlToPdf2 from "@/utils/htmlToPdf2";
+import { domShowFu } from "@/utils/domShow";
+import { MessageFu } from "@/utils/message";
+import dayjs from "dayjs";
+import EchBox from "./EchBox";
+
+export const columnsObj = {
+  0: "A",
+  1: "B",
+  2: "C",
+  3: "D",
+  4: "E",
+  5: "F",
+  6: "G",
+};
+
+type DataResListType = {
+  id: number;
+  createTime: string;
+};
+
+export type DataResTabListTabCutType = "表格" | "柱状图" | "折线图" | "饼图";
+type DataResTabListTxtType = "单选" | "多选" | "排序" | "填空";
+export type DataResTabListOptionsType = {
+  pcs: number;
+  score: null | number;
+  customDesc: string;
+  name: string;
+};
+
+export type DataResTabListType = {
+  id: number;
+  type: DataResTabListTxtType;
+  question: string;
+  tabCut: {
+    name: DataResTabListTabCutType;
+    done: boolean;
+  }[];
+  tabAc: DataResTabListTabCutType;
+  optionsCount: DataResTabListOptionsType[];
+};
+
+type DataType = {
+  id: number;
+  name: string;
+  publishDate: string;
+  description: string;
+  resList: DataResListType[];
+  resTabList: DataResTabListType[];
+};
 
 type Props = {
   sId: number;
   closeFu: () => void;
 };
 
+const tabCutArr = [
+  { id: 1, name: "结果明细" },
+  { id: 2, name: "结果统计" },
+];
+
 function A6QInfo({ sId, closeFu }: Props) {
-  useEffect(() => {
-    console.log("详情", sId);
+  const getInfoFu = useCallback(async () => {
+    const res1 = await A6Q_APIresList(sId);
+    const res2 = await A6Q_APIresTabList(sId);
+    if (res1.code === 0 && res2.code === 0) {
+      const temp1 = res1.data;
+      const temp2 = res2.data;
+      setData({
+        id: temp2.id,
+        name: temp2.name,
+        publishDate: temp2.publishDate,
+        description: temp2.description,
+        resList: temp1,
+        resTabList: temp2.questions.map((v: any) => ({
+          ...v,
+          tabCut: [
+            { name: "表格", done: true },
+            { name: "柱状图", done: false },
+            { name: "折线图", done: false },
+            { name: "饼图", done: false },
+          ],
+          tabAc: "表格",
+          optionsCount: v.optionsCount
+            ? v.optionsCount.map((v2: any, index: number) => ({
+                ...v2,
+                id: v.id + "" + index,
+              }))
+            : [],
+        })),
+      });
+    }
   }, [sId]);
 
+  useEffect(() => {
+    getInfoFu();
+  }, [getInfoFu]);
+
+  // 全部数据
+  const [data, setData] = useState({} as DataType);
+
+  // useEffect(() => {
+  //   console.log("------", data);
+  // }, [data]);
+
+  // 结果明细和结果统计切换
+  const [tabCut, setTabCut] = useState(1);
+
+  // 隐藏 结果明细 文字 用于导出
+  const [isToPdf, setIsToPdf] = useState(false);
+
+  // 点击 切换 表格 和图表
+  const cutTableOrEch = useCallback(
+    (id: number, name: DataResTabListTabCutType) => {
+      setData({
+        ...data,
+        resTabList: data.resTabList.map((v) => ({
+          ...v,
+          tabCut:
+            v.id === id
+              ? v.tabCut.map((v2) => ({
+                  name: v2.name,
+                  done: name === v2.name ? true : v2.done,
+                }))
+              : v.tabCut,
+          tabAc: v.id === id ? name : v.tabAc,
+        })),
+      });
+    },
+    [data]
+  );
+
+  // 表格数据
+  const columnsFu = useCallback(
+    (flag: boolean, type?: DataResTabListTxtType) => {
+      let arr: any = [];
+      if (flag && type) {
+        // --------------结果统计
+
+        if (type === "填空") {
+          arr = [
+            {
+              width: 300,
+              title: "选择人数",
+              dataIndex: "pcs",
+            },
+            {
+              title: "选项描述",
+              render: (
+                item: DataResTabListOptionsType,
+                _: any,
+                index: number
+              ) => (
+                <div className="tab2LookBox">
+                  {item.customDesc
+                    ? item.customDesc
+                        .split(";")
+                        .filter((c) => c)
+                        .map((v, i) => (
+                          <div key={i}>
+                            {i + 1}:{v}
+                          </div>
+                        ))
+                    : "(空)"}
+                </div>
+              ),
+            },
+          ];
+        } else {
+          arr = [
+            {
+              width: type === "排序" ? 100 : 150,
+              title: "选项",
+              render: (
+                item: DataResTabListOptionsType,
+                _: any,
+                index: number
+              ) =>
+                item.name === "其他"
+                  ? "自定义回答"
+                  : Reflect.get(columnsObj, index),
+            },
+            {
+              width: type === "排序" ? 100 : 150,
+              title: "选择人数",
+              dataIndex: "pcs",
+            },
+          ];
+
+          if (type === "排序") {
+            arr.push({
+              width: type === "排序" ? 100 : 150,
+              title: "选项得分",
+              render: (item: DataResTabListOptionsType) => item.score || 0,
+            });
+          }
+          arr.push({
+            title: "选项描述",
+            render: (item: DataResTabListOptionsType) => {
+              if (item.name !== "其他") return item.name || "(空)";
+              else {
+                return item.customDesc
+                  ? item.customDesc
+                      .split(";")
+                      .filter((c) => c)
+                      .map((v, i) => (
+                        <div key={i}>
+                          {i + 1}:{v}
+                        </div>
+                      ))
+                  : "(空)";
+              }
+            },
+          });
+        }
+      } else {
+        // ---------------结果明细
+        arr = [
+          {
+            title: "提交时间",
+            dataIndex: "createTime",
+          },
+          {
+            title: "操作",
+            render: (item: DataResListType) => (
+              <>
+                {/* 待完善 */}
+                <Button size="small" type="text">
+                  查看
+                </Button>
+                <Button size="small" type="text">
+                  导出结果
+                </Button>
+              </>
+            ),
+          },
+        ];
+      }
+      return arr;
+    },
+    []
+  );
+
+  // 点击右边的 导出问卷
+  const html2PdfFu = useCallback(() => {
+    setIsToPdf(true);
+    domShowFu("#AsyncSpinLoding", true);
+
+    setTabCut(2);
+
+    window.setTimeout(() => {
+      const dom = document.querySelector(".A6QInfoBox") as HTMLDivElement;
+      if (dom) {
+        const name =
+          "问卷统计结果" + dayjs(new Date()).format("YYYY-MM-DD HH:mm");
+
+        htmlToPdf2(dom, name, () => {
+          setIsToPdf(false);
+          domShowFu("#AsyncSpinLoding", false);
+        });
+      } else {
+        MessageFu.warning("找不到元素!");
+        setIsToPdf(false);
+        domShowFu("#AsyncSpinLoding", false);
+      }
+    }, 500);
+  }, []);
+
   return (
     <div className={styles.A6QInfo}>
-      <h1 onClick={closeFu}>A6QInfo详情</h1>
+      <div className="A6QInfoBoxCC">
+        {/* 右上角的返回 */}
+        <div className="A6QtopBack">
+          <Button type="primary" onClick={html2PdfFu}>
+            导出问卷
+          </Button>
+          <Button onClick={closeFu}>返回</Button>
+        </div>
+        {/* 主体 */}
+        <div className="A6QInfoBox">
+          <div className="A6Qtop">{data.name} </div>
+          <div className="A6Qmain">
+            <div className="A6QM1">
+              <span>发布日期:</span>
+              {data.publishDate}
+            </div>
+            {data.description ? (
+              <div
+                className="A6QM2"
+                dangerouslySetInnerHTML={{ __html: data.description }}
+              ></div>
+            ) : null}
+
+            {/* 结果明细 结果统计 */}
+            <div className="A6QCbox">
+              <div className="A6QC1">
+                {tabCutArr.map((v) => (
+                  <div
+                    hidden={isToPdf && v.id === 1}
+                    onClick={() => setTabCut(v.id)}
+                    className={classNames(v.id === tabCut ? "A6QC1Ac" : "")}
+                    key={v.id}
+                  >
+                    {v.name}
+                  </div>
+                ))}
+              </div>
+              {data.resList ? (
+                <div className="A6QC2" hidden={tabCut !== 1}>
+                  <Table
+                    columns={columnsFu(false)}
+                    dataSource={data.resList}
+                    rowKey="id"
+                    pagination={false}
+                  />
+                </div>
+              ) : null}
+              {data.resTabList && data.resTabList.length ? (
+                data.resTabList.map((v, i) => (
+                  <div className="A6QC2" hidden={tabCut !== 2} key={v.id}>
+                    <div className="A6QC2Txt">
+                      <span>
+                        {i + 1}.{v.type}:
+                      </span>
+                      {v.question}
+                    </div>
+
+                    {/* 切换内容 */}
+                    <div className="A6QC2Tab" hidden={isToPdf}>
+                      {/* 填空题只有 表格 */}
+                      {v.tabCut.map((v2) => (
+                        <Button
+                          type={v.tabAc === v2.name ? "primary" : "default"}
+                          hidden={v.type === "填空" && v2.name !== "表格"}
+                          className={classNames(
+                            // 没有数据的隐藏
+                            v.optionsCount && v.optionsCount.length
+                              ? ""
+                              : "A6QC2TabDis"
+                          )}
+                          key={v2.name}
+                          onClick={() => cutTableOrEch(v.id, v2.name)}
+                        >
+                          {v2.name}
+                        </Button>
+                      ))}
+                    </div>
+
+                    {/* 内容展示 */}
+                    <div className="A6QC2Centen">
+                      {/* 表格 */}
+                      {v.optionsCount && v.optionsCount.length ? (
+                        <div hidden={v.tabAc !== "表格"}>
+                          <Table
+                            columns={columnsFu(true, v.type)}
+                            dataSource={v.optionsCount}
+                            rowKey="id"
+                            pagination={false}
+                          />
+                        </div>
+                      ) : (
+                        <div className="sonTableNone">暂无数据</div>
+                      )}
+                    </div>
+
+                    {/* 柱状图 */}
+                    {v.tabCut.find((v) => v.name === "柱状图")?.done ? (
+                      <div hidden={v.tabAc !== "柱状图"}>
+                        <EchBox type={v.tabAc} info={v} />
+                      </div>
+                    ) : null}
+
+                    {/* 折线图 */}
+                    {v.tabCut.find((v) => v.name === "折线图")?.done ? (
+                      <div hidden={v.tabAc !== "折线图"}>
+                        <EchBox type={v.tabAc} info={v} />
+                      </div>
+                    ) : null}
+                    {/* 饼图 */}
+                    {v.tabCut.find((v) => v.name === "饼图")?.done ? (
+                      <div hidden={v.tabAc !== "饼图"}>
+                        <EchBox type={v.tabAc} info={v} />
+                      </div>
+                    ) : null}
+                  </div>
+                ))
+              ) : (
+                <div className="A6QC2None" hidden={tabCut !== 2}>
+                  暂无数据
+                </div>
+              )}
+            </div>
+          </div>
+        </div>
+      </div>
     </div>
   );
 }

+ 39 - 21
src/pages/A6_1ques/A6Qtopic/QTadd.tsx

@@ -54,12 +54,14 @@ function QTadd({ moInfo, closeFu, tableLen, upTableFu, fatherId }: Props) {
       data.options.forEach((v: any) => {
         // 编辑的时候存下 之前信息的id数组 判断 提交时选项 id是否要传null
         sListOldIds.current.push(v.id);
-        sListArr.push({
-          id: v.id,
-          txt: v.name,
-          skip2: v.skip,
-          num2: v.skipQuestionNum,
-        });
+        if (v.name !== "其他") {
+          sListArr.push({
+            id: v.id,
+            txt: v.name,
+            skip2: v.skip,
+            num2: v.skipQuestionNum,
+          });
+        }
       });
 
       setList([
@@ -249,21 +251,37 @@ function QTadd({ moInfo, closeFu, tableLen, upTableFu, fatherId }: Props) {
     const dom = document.querySelector(".A6Qlist2SonErrBox");
     if (dom) return MessageFu.warning("请规范填写题目信息!");
 
-    const arrTemp = list.map((v) => ({
-      custom: v.custom,
-      id: moInfo.id > 0 ? v.id : null,
-      question: v.name,
-      questionnaireId: fatherId,
-      skip: v.skip,
-      skipQuestionNum: v.num,
-      type: v.type,
-      options: v.sList.map((v2) => ({
-        id: sListOldIds.current.includes(v2.id) ? v2.id : null,
-        name: v2.txt,
-        skip: v2.skip2,
-        skipQuestionNum: v2.num2,
-      })),
-    }));
+    const arrTemp = [] as any;
+
+    let ohterFlag = false;
+
+    list.forEach((v) => {
+      const optionsTemp = [] as any;
+      v.sList.forEach((v2) => {
+        if (v2.txt === "其他") ohterFlag = true;
+
+        optionsTemp.push({
+          id: sListOldIds.current.includes(v2.id) ? v2.id : null,
+          name: v2.txt,
+          skip: v2.skip2,
+          skipQuestionNum: v2.num2,
+        });
+      });
+
+      arrTemp.push({
+        custom: v.custom,
+        id: moInfo.id > 0 ? v.id : null,
+        question: v.name,
+        questionnaireId: fatherId,
+        skip: v.skip,
+        skipQuestionNum: v.num,
+        type: v.type,
+        options: optionsTemp,
+      });
+    });
+
+    // 选项 字段 不能为其他
+    if (ohterFlag) return MessageFu.warning("选项字段不能为 其他 !");
 
     if (moInfo.id < 0) {
       // 新增

+ 2 - 1
src/pages/A6_1ques/A6Qtopic/index.tsx

@@ -213,7 +213,6 @@ function A6Qtopic({ sId, closeFu }: Props) {
   return (
     <div className={styles.A6Qtopic}>
       <div className="QTtop">
-        <Button onClick={closeFu}>返回</Button>&emsp;
         <Button
           type="primary"
           onClick={() => {
@@ -223,6 +222,8 @@ function A6Qtopic({ sId, closeFu }: Props) {
         >
           新增
         </Button>
+        &emsp;
+        <Button onClick={closeFu}>返回</Button>
       </div>
       <div className="QTtable">
         <DndProvider backend={HTML5Backend}>

+ 14 - 0
src/store/action/A6_1ques.ts

@@ -37,6 +37,20 @@ export const A6Q_APIgetInfo = (id: number) => {
   return http.get(`cms/questionnaire/detail/${id}`);
 };
 
+/**
+ * 结果明细
+ */
+export const A6Q_APIresList = (id: number) => {
+  return http.get(`cms/questionnaire/submit/getList/${id}`);
+};
+
+/**
+ * 结果统计
+ */
+export const A6Q_APIresTabList = (id: number) => {
+  return http.get(`cms/questionnaire/report/${id}`);
+};
+
 // ------------------------题目管理-----------------------
 
 /**

+ 8 - 7
src/utils/htmlToPdf2.ts

@@ -1,17 +1,18 @@
 // 这个导出多张pdf,文件小。但是分页中间有断开的问题
 import html2canvas from "html2canvas";
 import JsPDF from "jspdf";
-import { domShowFu } from "./domShow";
 
 /**
  * @param  ele          要生成 pdf 的DOM元素(容器)
  * @param  padfName     PDF文件生成后的文件名字
+ * @param  callBackFu   完成之后的回调函数
  * */
 
-function downloadPDF2(ele: HTMLDivElement, pdfName: string) {
-
-  domShowFu("#AsyncSpinLoding", true);
-
+function downloadPDF2(
+  ele: HTMLDivElement,
+  pdfName: string,
+  callBackFu: () => void
+) {
   const eleW = ele.offsetWidth; // 获得该容器的宽
   const eleH = ele.offsetHeight; // 获得该容器的高
 
@@ -45,6 +46,7 @@ function downloadPDF2(ele: HTMLDivElement, pdfName: string) {
   // html2canvas(element).then( (canvas)=>{ //报错
   // html2canvas(element[0]).then( (canvas)=>{
   html2canvas(ele, {
+    scale: 1.5,
     // dpi: 300,
     // allowTaint: true,  //允许 canvas 污染, allowTaint参数要去掉,否则是无法通过toDataURL导出canvas数据的
     useCORS: true, // 允许canvas画布内 可以跨域请求外部链接图片, 允许跨域请求。
@@ -87,8 +89,7 @@ function downloadPDF2(ele: HTMLDivElement, pdfName: string) {
 
     // 可动态生成
     pdf.save(pdfName);
-
-    domShowFu("#AsyncSpinLoding", false);
+    callBackFu();
   });
 }