unknown
2024-06-07 eeff64f494ed72d8acaa13d653c9f3ee181ac950
优化
5个文件已修改
435 ■■■■ 已修改文件
src/books/childHealth/view/content/index.vue 150 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/books/childHealth/view/index.vue 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/books/lifeCare/index.vue 85 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/books/lifeCare/view/chapter002.vue 122 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/books/lifeCare/view/chapter005.vue 77 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/books/childHealth/view/content/index.vue
@@ -8,7 +8,7 @@
      :style="{
        fontSize: fontSize ? fontSize + 'px' : '16px',
        transform: `scale(${pageZoom ? pageZoom : 1})`,
        transformOrigin: 'center top'
        transformOrigin: 'center top',
      }"
    >
      <pageHeader
@@ -142,7 +142,7 @@
    },
    pageZoom() {
      return this.$store.state.qiankun.scale / 100;
    }
    },
  },
  watch: {
    showCatalogList: {
@@ -153,7 +153,7 @@
        ) {
          // 调用父层方法
          this.$store.state.qiankun.catalogChange({
            showCatalogList: newVal
            showCatalogList: newVal,
          });
        }
        // 启动页码观察
@@ -161,7 +161,7 @@
          this.initObservation();
          this.initThemeColor();
        }, 500);
      }
      },
    },
    loadPageList: {
      handler(newVal, oldVal) {
@@ -169,7 +169,7 @@
          this.initSwiper();
          this.initViewer();
        }, 200);
      }
      },
    },
    pageZoom: {
      handler(newVal, oldVal) {
@@ -177,8 +177,8 @@
          this.container ? this.container : document
        ).querySelector(".page-main");
        scrollBox.scrollTop = (scrollBox.scrollTop / oldVal) * newVal;
      }
    }
      },
    },
  },
  mounted() {
    // 默认加载章节
@@ -213,7 +213,7 @@
        // 跳转检索结果位置
        jumpSearchItem: (data) => {
          this.searchItemLocation(data);
        }
        },
      });
    }
@@ -222,13 +222,13 @@
    this.observer = new IntersectionObserver(this.pageChangeCallback, {
      root: null, // 指定根元素,这里设为 null,表示选取整个视窗作为根元素。
      rootMargin: "0px", // 指定根元素的边界,这里设为 "0px",表示根元素的边界和视窗的边界重合
      threshold: 0.5 // 指定交叉比例,这里设为 0.5,表示当目标元素一半或更多显示在视窗中时触发回调函数。
      threshold: 0.5, // 指定交叉比例,这里设为 0.5,表示当目标元素一半或更多显示在视窗中时触发回调函数。
    });
    this.loadPageObserver = new IntersectionObserver(this.loadPageCallback, {
      root: null, // 指定根元素,这里设为 null,表示选取整个视窗作为根元素。
      rootMargin: "0px", // 指定根元素的边界,这里设为 "0px",表示根元素的边界和视窗的边界重合
      threshold: 0 // 指定交叉比例,这里设为 0.5,表示当目标元素一半或更多显示在视窗中时触发回调函数。
      threshold: 0, // 指定交叉比例,这里设为 0.5,表示当目标元素一半或更多显示在视窗中时触发回调函数。
    });
    // 启动页码观察
@@ -239,34 +239,34 @@
    // 测试页面跳转
    // setTimeout(() => {
      //   this.gotoPage(1, 10);
      //   setTimeout(() => {
      //     this.renderSign("Highlight", {
      //       id: "2ACA9359",
      //       txt: "题一学习主题一 运动",
      //       page: "10",
      //       type: "Highlight",
      //       color: "#F5E12A"
      //     });
      // setTimeout(() => {
      //   this.delSign({
      //     ids: ["2ACA9359"]
      //   });
      // }, 2000);
      //   }, 5000);
    //   this.gotoPage(1, 10);
    //   setTimeout(() => {
    //     this.renderSign("Highlight", {
    //       id: "2ACA9359",
    //       txt: "题一学习主题一 运动",
    //       page: "10",
    //       type: "Highlight",
    //       color: "#F5E12A"
    //     });
    // setTimeout(() => {
    //   this.delSign({
    //     ids: ["2ACA9359"]
    //   });
    // }, 2000);
    //   }, 5000);
      // const pageDom = (this.container ? this.container : document)
      //   .querySelector("#app")
      //   .querySelectorAll(".page-box");
      // 检索
      // console.log(this.searchTextByPage("儿童"), "searchTextByPage");
      // 检索跳转
      // this.searchItemLocation({
      //   catalog: 2,
      //   page: 10,
      //   txt: " 运动系统是由骨、骨连结和骨骼肌三部分组成的。全身的骨通过骨连结组成人体骨骼(见图1-1)。骨骼是人体的支架,具有保护内脏器官、供肌肉附着和作为肌肉运动的杠杆等作用。在神经系统的支配下,肌肉收缩牵动所附着的骨绕着关节转动,使身体产生各种动作。所以,运动系统具有运动、支持和保护等功能,幼年时期的骨骼还具有造血功能。 ",
      //   txtIndex: 57
      // });
    // const pageDom = (this.container ? this.container : document)
    //   .querySelector("#app")
    //   .querySelectorAll(".page-box");
    // 检索
    // console.log(this.searchTextByPage("保护内脏器官"), "searchTextByPage");
    // 检索跳转
    // this.searchItemLocation({
    //   catalog: 2,
    //   page: 10,
    //   txt: " 运动系统是由骨、骨连结和骨骼肌三部分组成的。全身的骨通过骨连结组成人体骨骼(见图1-1)。骨骼是人体的支架,具有保护内脏器官、供肌肉附着和作为肌肉运动的杠杆等作用。在神经系统的支配下,肌肉收缩牵动所附着的骨绕着关节转动,使身体产生各种动作。所以,运动系统具有运动、支持和保护等功能,幼年时期的骨骼还具有造血功能。 ",
    //   txtIndex: 57
    // });
    // }, 5000);
  },
  methods: {
@@ -339,7 +339,7 @@
          this.showCatalogList = [
            this.catalogLength - 2,
            this.catalogLength - 1,
            this.catalogLength
            this.catalogLength,
          ];
        } else {
          this.showCatalogList = [catalog - 1, catalog, catalog + 1];
@@ -389,10 +389,7 @@
          this.container ? this.container : document
        ).querySelector(`[page="${data.page}"]`);
        // 创建 createTreeWalker 迭代器,用于遍历文本节点,保存到一个数组
        const treeWalker = document.createTreeWalker(
          pageDom,
          NodeFilter.SHOW_TEXT
        );
        const treeWalker = document.createTreeWalker(pageDom, NodeFilter.SHOW_TEXT);
        const allTextNodes = [];
        let currentNode = treeWalker.nextNode();
        while (currentNode) {
@@ -598,7 +595,7 @@
            this.$store.state.qiankun.pageChange({
              page: page,
              catalog: catalog,
              text
              text,
            });
          // const sections = Array.from(document.querySelectorAll(".section"));
          //sections:获取所有具有 .section 类名的元素,并转换为数组。
@@ -619,27 +616,22 @@
            );
            const catalog = catalogDom.getAttribute("num");
            if (!this.questionDataMap[page]) {
              const token = localStorage.getItem(this.config.tokenKey)
              if (testData && testData[catalog]) {
                if (testData[catalog][page]) {
                  if (Array.isArray(testData[catalog][page])) {
                    if(token) {
                      this.questionDataMap[page] = await getQuestionList(
                        page,
                        testData[catalog][page],
                        this.config.activeBook
                      );
                    }
                    this.questionDataMap[page] = await getQuestionList(
                      page,
                      testData[catalog][page],
                      this.config.activeBook
                    );
                  } else {
                    const obj = {};
                    for (let key in testData[catalog][page]) {
                      if(token) {
                          obj[key] = await getQuestionList(
                          [],
                          testData[catalog][page][key],
                          this.config.activeBook
                        );
                      }
                      obj[key] = await getQuestionList(
                        [],
                        testData[catalog][page][key],
                        this.config.activeBook
                      );
                    }
                    this.questionDataMap[page] = obj;
                  }
@@ -662,10 +654,7 @@
              // 高亮行
              setTimeout(() => {
                // 获取页面所有text节点
                const pageTextList = document.createTreeWalker(
                  target,
                  NodeFilter.SHOW_TEXT
                );
                const pageTextList = document.createTreeWalker(target, NodeFilter.SHOW_TEXT);
                // 匹配关键字
                const allPageTextNodes = [];
                let currentNode = pageTextList.nextNode();
@@ -709,7 +698,7 @@
          autoplay: {
            //自动开始
            delay: 3000, //时间间隔
            disableOnInteraction: false //*手动操作轮播图后不会暂停*
            disableOnInteraction: false, //*手动操作轮播图后不会暂停*
          },
          paginationClickable: true,
          slidesPerView: 1, // 一组三个
@@ -721,11 +710,11 @@
            ),
            prevEl: (this.container ? this.container : document).querySelector(
              ".swiper-button-prev"
            )
            ),
          },
          // 窗口变化,重新init,针对F11全屏和放大缩小,必须加
          observer: true,
          observeParents: true
          observeParents: true,
          // // 如果需要分页器
          // pagination: {
          //   el: (this.container ? this.container : document).querySelector(
@@ -753,7 +742,7 @@
            ),
            prevEl: (this.container ? this.container : document).querySelector(
              ".swiper-button-prev"
            )
            ),
          },
          // 窗口变化,重新init,针对F11全屏和放大缩小,必须加
          observer: true,
@@ -772,8 +761,8 @@
              var paginationInfoEl = dom.querySelector(".pageBox");
              if (paginationInfoEl)
                paginationInfoEl.textContent = currentPage + "/" + totalPages;
            }
          }
            },
          },
        });
      }
    },
@@ -789,7 +778,7 @@
            : "body",
          navbar: true, // 显示导航栏
          toolbar: true, // 显示工具栏
          title: true // 显示标题
          title: true, // 显示标题
        });
      }
    },
@@ -812,7 +801,7 @@
        chapterTen,
        chapterEleven,
        chapterTwelve,
        chapterThirteen
        chapterThirteen,
      };
      // 遍历所有章节文件
      for (const key in pageData) {
@@ -823,8 +812,8 @@
        pageExample = new pageComponent({
          propsData: {
            showPageList: [],
            questionData: {}
          }
            questionData: {},
          },
        });
        pageExample.$mount(
          (this.container ? this.container : document).querySelector(
@@ -854,8 +843,8 @@
            pageExample = new pageComponent({
              propsData: {
                showPageList: [pageNum],
                questionData: {}
              }
                questionData: {},
              },
            });
            pageExample.$mount(
              (this.container ? this.container : document).querySelector(
@@ -868,10 +857,7 @@
              .querySelector(`[page="${pageNum}"]`);
            if (thisPageDom) {
              // 获取页面所有text节点
              const pageTextList = document.createTreeWalker(
                thisPageDom,
                NodeFilter.SHOW_TEXT
              );
              const pageTextList = document.createTreeWalker(thisPageDom, NodeFilter.SHOW_TEXT);
              // 匹配关键字
              const allPageTextNodes = [];
              let currentNode = pageTextList.nextNode();
@@ -888,7 +874,7 @@
                    page: pageNum,
                    catalog: catalogIndex,
                    txt: textDom.textContent,
                    txtIndex: txtIndex
                    txtIndex: txtIndex,
                  });
                }
              }
@@ -911,7 +897,7 @@
      this.highlightData = data;
      // 跳转
      this.gotoPage(data.catalog, data.page, () => {});
    }
    },
  },
  components: {
    pageHeader,
@@ -927,8 +913,8 @@
    chapterTen,
    chapterEleven,
    chapterTwelve,
    chapterThirteen
  }
    chapterThirteen,
  },
};
</script>
src/books/childHealth/view/index.vue
@@ -24,6 +24,7 @@
        }
      }
    },
    handleMouseUp(e) {
      const selection = (
        this.container ? this.container : window
src/books/lifeCare/index.vue
@@ -20,44 +20,44 @@
      <ChapterOne
        v-if="showCatalogList.indexOf(2) > -1"
        :showPageList="loadPageList"
        :questionData="questionData"
        :questionData="questionDataMap"
        :isSearch="isSearch"
      />
      <ChapterTwo
        v-if="showCatalogList.indexOf(3) > -1"
        :showPageList="loadPageList"
        :questionData="questionData"
        :questionData="questionDataMap"
        :isSearch="isSearch"
      />
      <ChapterThree
        v-if="showCatalogList.indexOf(4) > -1"
        :showPageList="loadPageList"
        :questionData="questionData"
        :questionData="questionDataMap"
        :isSearch="isSearch"
      />
      <ChapterFour
        v-if="showCatalogList.indexOf(5) > -1"
        :showPageList="loadPageList"
        :questionData="questionData"
        :questionData="questionDataMap"
        :isSearch="isSearch"
      />
      <ChapterFive
        v-if="showCatalogList.indexOf(6) > -1"
        :showPageList="loadPageList"
        :questionData="questionData"
        :questionData="questionDataMap"
        @Upload_initViewer="changeDomViewer"
        :isSearch="isSearch"
      />
      <chapterSix
        v-if="showCatalogList.indexOf(7) > -1"
        :showPageList="loadPageList"
        :questionData="questionData"
        :questionData="questionDataMap"
        :isSearch="isSearch"
      />
      <chapterSeven
        v-if="showCatalogList.indexOf(8) > -1"
        :showPageList="loadPageList"
        :questionData="questionData"
        :questionData="questionDataMap"
        @eventSwdt="swdtChange"
        @Upload_initViewer="changeDomViewer"
        :isSearch="isSearch"
@@ -65,13 +65,13 @@
      <chapterEight
        v-if="showCatalogList.indexOf(9) > -1"
        :showPageList="loadPageList"
        :questionData="questionData"
        :questionData="questionDataMap"
        :isSearch="isSearch"
      />
      <chapterNine
        v-if="showCatalogList.indexOf(10) > -1"
        :showPageList="loadPageList"
        :questionData="questionData"
        :questionData="questionDataMap"
        :isSearch="isSearch"
      />
      <chapter010
@@ -202,8 +202,8 @@
    },
  },
  mounted() {
  // 默认加载章节
  this.showCatalogList = [1];
    // 默认加载章节
    this.showCatalogList = [6];
    // 滚动监听节流
    this.throttledScrollHandler = _.throttle(
      this.scrollFun,
@@ -283,6 +283,7 @@
        this.initViewer();
      }, 500);
    },
    // 滚动监听
    scrollFun(event) {
      // 判断向上滚动还是向下滚动
@@ -361,6 +362,12 @@
    // 处理标记数据
    handelSignData(type, data) {
      if (this.loadPageList.indexOf(Number(data.page)) > -1) {
        // 立即渲染
        this.renderSign(type, data);
      }
      // 储存数据
      if (!this.renderSignMap[type]) this.renderSignMap[type] = {};
      if (!this.renderSignMap[type][data.page])
        this.renderSignMap[type][data.page] = [];
@@ -369,6 +376,10 @@
    // 渲染标记
    renderSign(type, data) {
      // 父层设置禁止渲染标记时不再进行渲染
      if (this.$store.state.qiankun.disableSign) {
        return false;
      }
      const existence = (
        this.container ? this.container : document
      ).querySelector(`[dataid="${data.id}"]`);
@@ -422,6 +433,7 @@
        }
      }
    },
    // 删除标记渲染
    delSign({ ids, type }) {
      if (ids && ids.length) {
@@ -559,15 +571,6 @@
      });
    },
    getParentWithClass(element, className) {
      while (element.parentElement) {
        element = element.parentElement;
        if (element.classList.contains(className)) {
          return element;
        }
      }
    },
    pageChangeCallback(entries, observer) {
      //entries:代表观察到的目标元素的集合。 observer:代表观察者对象。
      entries.forEach((entry) => {
@@ -612,14 +615,17 @@
            );
            const catalog = catalogDom.getAttribute("num");
            if (!this.questionDataMap[page]) {
              const token = localStorage.getItem(this.config.tokenKey);
              if (testData && testData[catalog]) {
                if (testData[catalog][page]) {
                  if (Array.isArray(testData[catalog][page])) {
                    this.questionDataMap[page] = await getQuestionList(
                      page,
                      testData[catalog][page],
                      this.config.activeBook
                    );
                    if (token) {
                      this.questionDataMap[page] = await getQuestionList(
                        page,
                        testData[catalog][page],
                        this.config.activeBook
                      );
                    }
                  } else {
                    const obj = {};
                    for (let key in testData[catalog][page]) {
@@ -631,7 +637,7 @@
                    }
                    this.questionDataMap[page] = obj;
                  }
                  // console.log("题目", this.questionDataMap);
                  console.log("题目", this.questionDataMap);
                }
              }
            }
@@ -650,7 +656,10 @@
              // 高亮行
              setTimeout(() => {
                // 获取页面所有text节点
                const pageTextList = document.createTreeWalker(target, NodeFilter.SHOW_TEXT);
                const pageTextList = document.createTreeWalker(
                  target,
                  NodeFilter.SHOW_TEXT
                );
                // 匹配关键字
                const allPageTextNodes = [];
                let currentNode = pageTextList.nextNode();
@@ -781,6 +790,16 @@
      }
    },
    getParentWithClass(element, className) {
      // console.log(element, className, "element, className");
      while (element.parentElement) {
        element = element.parentElement;
        if (element.classList.contains(className)) {
          return element;
        }
      }
    },
    handleMouseUp(e) {
      const selection = (
        this.container ? this.container : window
@@ -821,14 +840,6 @@
            y: e.y,
          });
        }
      }
    },
    swdtChange(data) {
      if (this.$store.state.qiankun && this.$store.state.qiankun.chooseWords) {
        this.$store.state.qiankun.chooseWords({
          type: data,
        });
      }
    },
@@ -946,10 +957,10 @@
        }
      }
      // 输出搜索结果
      console.log(searchResult);
      // console.log(searchResult);
      return searchResult;
    },
    // 根据检索结果跳转对应位置并高亮
    searchItemLocation(data) {
      // 记录高亮信息
src/books/lifeCare/view/chapter002.vue
@@ -1,3 +1,4 @@
<!-- eslint-disable no-irregular-whitespace -->
<template>
  <div class="chapter" num="3">
    <div class="page-box" page="19">
@@ -426,8 +427,8 @@
                        index == 0 ||
                        index == chapter002.headersData.length - 2 ||
                        index == chapter002.headersData.length - 1
                          ? '100px'
                          : '',
                          ? '120px'
                          : '40px',
                    }"
                    v-for="(header, index) in chapter002.headersData"
                    :key="index"
@@ -443,23 +444,20 @@
                >
                  <td v-for="(cell, cellIndex) in row" :key="cellIndex">
                    <template v-if="cell === ''">
                      <input
                        type="text"
                        v-model="chapter002.tableData121[rowIndex][cellIndex]"
                        @blur="
                          updateCell(rowIndex, cellIndex, $event.target.value)
                        "
                      />
                      <div
                        contenteditable
                        @blur="updateCell(rowIndex, cellIndex, $event)"
                      >
                        {{ chapter002.tableData121[rowIndex][cellIndex] }}
                      </div>
                    </template>
                    <template v-else>
                      <input
                        :readonly="cellIndex == 0"
                        type="text"
                        :value="chapter002.tableData121[rowIndex][cellIndex]"
                        @blur="
                          updateCell(rowIndex, cellIndex, $event.target.value)
                        "
                      />
                      <div
                        :contenteditable="cellIndex != 0"
                        @blur="updateCell(rowIndex, cellIndex, $event)"
                      >
                        {{ chapter002.tableData121[rowIndex][cellIndex] }}
                      </div>
                    </template>
                  </td>
                </tr>
@@ -767,8 +765,8 @@
          <table class="table111 table122">
            <thead>
              <tr>
                <th rowspan="3">日期</th>
                <th rowspan="3">姓名</th>
                <th rowspan="3" style="width: 55px">日期</th>
                <th rowspan="3" style="width: 55px">姓名</th>
                <th colspan="3">晨间检查情况</th>
                <th colspan="8">全日观察情况</th>
                <th colspan="2">交班</th>
@@ -801,22 +799,20 @@
              >
                <td v-for="(cell, cellIndex) in row" :key="cellIndex">
                  <template v-if="cell === ''">
                    <input
                      type="text"
                      :value="chapter002.tableData122[rowIndex][cellIndex]"
                      @blur="
                        updateCell122(rowIndex, cellIndex, $event.target.value)
                      "
                    />
                    <div
                      contenteditable
                      @blur="updateCell122(rowIndex, cellIndex, $event)"
                    >
                      {{ chapter002.tableData122[rowIndex][cellIndex] }}
                    </div>
                  </template>
                  <template v-else>
                    <input
                      type="text"
                      :value="chapter002.tableData122[rowIndex][cellIndex]"
                      @blur="
                        updateCell122(rowIndex, cellIndex, $event.target.value)
                      "
                    />
                    <div
                      contenteditable
                      @blur="updateCell122(rowIndex, cellIndex, $event)"
                    >
                      {{ chapter002.tableData122[rowIndex][cellIndex] }}
                    </div>
                  </template>
                </td>
              </tr>
@@ -893,22 +889,24 @@
              >
                <td v-for="(cell, cellIndex) in row" :key="cellIndex">
                  <template v-if="cell === ''">
                    <input
                      type="text"
                      v-model="chapter002.tableData123[rowIndex][cellIndex]"
                    <div
                      contenteditable
                      @blur="
                        updateCell123(rowIndex, cellIndex, $event.target.value)
                      "
                    />
                    >
                      {{ chapter002.tableData123[rowIndex][cellIndex] }}
                    </div>
                  </template>
                  <template v-else>
                    <input
                      type="text"
                      :value="cell"
                    <div
                      contenteditable
                      @blur="
                        updateCell123(rowIndex, cellIndex, $event.target.value)
                      "
                    />
                    >
                      {{ cell }}
                    </div>
                  </template>
                </td>
              </tr>
@@ -1693,24 +1691,40 @@
      this.chapter002.isInspectOpen = !this.chapter002.isInspectOpen;
      localStorage.setItem("chapter002", JSON.stringify(this.chapter002));
    },
    updateCell(rowIndex, cellIndex, value) {
    updateCell(rowIndex, cellIndex, e) {
      // 更新单元格数据
      this.$set(this.chapter002.tableData121[rowIndex], cellIndex, value);
      this.$set(
        this.chapter002.tableData121[rowIndex],
        cellIndex,
        e.target.innerText
      );
      localStorage.setItem("chapter002", JSON.stringify(this.chapter002));
    },
    updateCell122(rowIndex, cellIndex, value) {
    updateCell122(rowIndex, cellIndex, e) {
      // 更新单元格数据
      this.$set(this.chapter002.tableData122[rowIndex], cellIndex, value);
      this.$set(
        this.chapter002.tableData122[rowIndex],
        cellIndex,
        e.target.innerText
      );
      localStorage.setItem("chapter002", JSON.stringify(this.chapter002));
    },
    updateCell123(rowIndex, cellIndex, value) {
    updateCell123(rowIndex, cellIndex, e) {
      // 更新单元格数据
      this.$set(this.chapter002.tableData123[rowIndex], cellIndex, value);
      this.$set(
        this.chapter002.tableData123[rowIndex],
        cellIndex,
        e.target.innerText
      );
      localStorage.setItem("chapter002", JSON.stringify(this.chapter002));
    },
    updateCellGroup(rowIndex, cellIndex, value) {
      // 更新单元格数据
      this.$set(this.chapter002.groupData[rowIndex], cellIndex, value);
      this.$set(
        this.chapter002.groupData[rowIndex],
        cellIndex,
        value
      );
      if (cellIndex == 4) {
        this.$set(
          this.chapter002.groupData[rowIndex],
@@ -1723,7 +1737,11 @@
    },
    updateCellDesign(rowIndex, cellIndex, value) {
      // 更新单元格数据
      this.$set(this.chapter002.designData[rowIndex], cellIndex, value);
      this.$set(
        this.chapter002.designData[rowIndex],
        cellIndex,
        value
      );
      if (cellIndex == 4) {
        this.$set(
          this.chapter002.designData[rowIndex],
@@ -1736,7 +1754,11 @@
    },
    updateCellInspect(rowIndex, cellIndex, value) {
      // 更新单元格数据
      this.$set(this.chapter002.inspectData[rowIndex], cellIndex, value);
      this.$set(
        this.chapter002.inspectData[rowIndex],
        cellIndex,
        value
      );
      if (cellIndex == 4) {
        this.$set(
          this.chapter002.inspectData[rowIndex],
src/books/lifeCare/view/chapter005.vue
@@ -191,8 +191,8 @@
                    :style="{
                      width:
                        index == 0 ||
                        index == chapter005.tableData151.length - 1
                          ? '100px'
                        index == chapter005.headersData.length - 1
                          ? '150px'
                          : '',
                    }"
                    v-for="(header, index) in chapter005.headersData"
@@ -209,23 +209,20 @@
                >
                  <td v-for="(cell, cellIndex) in row" :key="cellIndex">
                    <template v-if="cell === ''">
                      <input
                        type="text"
                        v-model="chapter005.tableData151[rowIndex][cellIndex]"
                        @blur="
                          updateCell(rowIndex, cellIndex, $event.target.value)
                        "
                      />
                      <div
                        contenteditable
                        @blur="updateCell(rowIndex, cellIndex, $event)"
                      >
                        {{ chapter005.tableData151[rowIndex][cellIndex] }}
                      </div>
                    </template>
                    <template v-else>
                      <input
                        :readonly="cellIndex == 0"
                        type="text"
                        :value="chapter005.tableData151[rowIndex][cellIndex]"
                        @blur="
                          updateCell(rowIndex, cellIndex, $event.target.value)
                        "
                      />
                      <div
                        :contenteditable="cellIndex != 0"
                        @blur="updateCell(rowIndex, cellIndex, $event)"
                      >
                        {{ chapter005.tableData151[rowIndex][cellIndex] }}
                      </div>
                    </template>
                  </td>
                </tr>
@@ -1475,30 +1472,20 @@
                >
                  <td v-for="(cell, cellIndex) in row" :key="cellIndex">
                    <template v-if="cell === ''">
                      <input
                        type="text"
                        v-model="chapter005.tableData155[rowIndex][cellIndex]"
                        @blur="
                          updateCell155(
                            rowIndex,
                            cellIndex,
                            $event.target.value
                          )
                        "
                      />
                      <div
                        contenteditable
                        @blur="updateCell155(rowIndex, cellIndex, $event)"
                      >
                        {{ chapter005.tableData155[rowIndex][cellIndex] }}
                      </div>
                    </template>
                    <template v-else>
                      <input
                        type="text"
                        :value="chapter005.tableData155[rowIndex][cellIndex]"
                        @blur="
                          updateCell155(
                            rowIndex,
                            cellIndex,
                            $event.target.value
                          )
                        "
                      />
                      <div
                        contenteditable
                        @blur="updateCell155(rowIndex, cellIndex, $event)"
                      >
                        {{ chapter005.tableData155[rowIndex][cellIndex] }}
                      </div>
                    </template>
                  </td>
                </tr>
@@ -3665,9 +3652,9 @@
      }
      localStorage.setItem("chapter005", JSON.stringify(this.chapter005));
    },
    updateCell(rowIndex, cellIndex, value) {
    updateCell(rowIndex, cellIndex, e) {
      // 更新单元格数据
      this.$set(this.chapter005.tableData151[rowIndex], cellIndex, value);
      this.$set(this.chapter005.tableData151[rowIndex], cellIndex, e.target.innerText);
      localStorage.setItem("chapter005", JSON.stringify(this.chapter005));
    },
    updateCell152(rowIndex, cellIndex, value) {
@@ -3685,9 +3672,13 @@
      this.$set(this.chapter005.tableData154[rowIndex], cellIndex, value);
      localStorage.setItem("chapter005", JSON.stringify(this.chapter005));
    },
    updateCell155(rowIndex, cellIndex, value) {
    updateCell155(rowIndex, cellIndex, e) {
      // 更新单元格数据
      this.$set(this.chapter005.tableData155[rowIndex], cellIndex, value);
      this.$set(
        this.chapter005.tableData155[rowIndex],
        cellIndex,
        e.target.innerText
      );
      localStorage.setItem("chapter005", JSON.stringify(this.chapter005));
    },
    updateCell156(rowIndex, cellIndex, value) {