ltao 3 năm trước cách đây
mục cha
commit
3a00ab31f6

+ 7 - 0
src/api/grassrootsregistration/bdglweekwork.js

@@ -17,6 +17,13 @@ export function getBdglweekwork(id) {
   })
   })
 }
 }
 
 
+// 预览训练器材/教材登记薄
+export function lookequipuntits(id) {
+  return request({
+    url: '/grassrootsregistration/bdglweekwork/exportWeekwork?id=' + id,
+    method: 'get'
+  })
+}
 // 新增一周工作安排
 // 新增一周工作安排
 export function addBdglweekwork(data) {
 export function addBdglweekwork(data) {
   return request({
   return request({

+ 327 - 89
src/components/look_word/bdglweekwork.vue

@@ -40,7 +40,7 @@
           mso-border-insidev: 0.5pt solid windowtext;
           mso-border-insidev: 0.5pt solid windowtext;
           mso-padding-alt: 0pt 0pt 0pt 0pt;
           mso-padding-alt: 0pt 0pt 0pt 0pt;
         "
         "
-        width="930"
+        width="906"
         align="center"
         align="center"
         bordercolor="black"
         bordercolor="black"
       >
       >
@@ -49,167 +49,274 @@
           style="
           style="
             border: none;
             border: none;
             color: black;
             color: black;
-            font-size: 16px;
+            font-size: 9px;
             font-weight: 500;
             font-weight: 500;
             line-height: 30px;
             line-height: 30px;
             width: 930px;
             width: 930px;
-            font-family: 'kaiti';
+            font-family: 'kaiti'
+            margin-left:8px;
+
           "
           "
         >
         >
           <td
           <td
             class="JR_left"
             class="JR_left"
-            colspan="3"
+            colspan="1"
             align="left"
             align="left"
             style="border: none; line-height: 45px"
             style="border: none; line-height: 45px"
           >
           >
-            连值班领导:{{ message.peopleName }}
+            <span style="margin-left: 8px"
+              >连值班领导:{{ message.peopleName }}</span
+            >
           </td>
           </td>
           <td
           <td
             class="JR_left"
             class="JR_left"
-            colspan="1"
+            colspan="3"
             align="left"
             align="left"
-            style="border: none; line-height: 45px; padding-left: 27px"
+            style="border: none; line-height: 45px"
           >
           >
-            电话:{{ message.phone }}
+            <span style="margin-left: 188px"> 电话:{{ message.phone }}</span>
           </td>
           </td>
           <td
           <td
             class="JR_left"
             class="JR_left"
-            colspan="4"
+            colspan="2"
             align="left"
             align="left"
-            style="border: none; line-height: 45px; padding-left:36px;text-align:right"
+            style="
+              border: none;
+              line-height: 45px;
+
+              text-align: right;
+            "
           >
           >
-            {{ message.startTime | dataFormaty }}—{{
-              message.endTime | dataFormaty
-            }}
+            <span style="margin-left: 20px">
+              {{ message.startTime | dataFormaty }}—{{
+                message.endTime | dataFormaty
+              }}</span
+            >
           </td>
           </td>
         </tr>
         </tr>
         <tbody style="font-size: 16px; font-weight: 500">
         <tbody style="font-size: 16px; font-weight: 500">
           <tr
           <tr
             class="JR_tr"
             class="JR_tr"
-            style="font-size: 16px; font-weight: 500; font-family: 'heiti'"
+            style="
+              font-size: 16px;
+              font-weight: 500;
+              font-family: 'heiti';
+              border-bottom: none;
+            "
           >
           >
-            <td align="center" valign="center" colspan="3" class="JR_left">
-              <p align="center" style="font-family: 'heiti'">日期</p>
+            <td
+              width="143"
+              height="22"
+              valign="center"
+              rowspan="2"
+              class="JR_left"
+              style="font-family: '黑体'; text-align: center; font-size: 16px"
+            >
+              <span align="center" style="display: block; text-align: center"
+                >日期</span
+              >
             </td>
             </td>
-            <td valign="center" class="JR_left">
-              <p align="center" style="font-family: 'heiti'">内容</p>
+            <td
+              width="245"
+              valign="center"
+              rowspan="2"
+              class="JR_left"
+              style="font-family: '黑体'; text-align: center; font-size: 16px"
+            >
+              <span align="center" style="display: block; text-align: center"
+                >内容</span
+              >
             </td>
             </td>
-            <td valign="center" class="JR_left">
-              <p align="center" style="font-family: 'heiti'">负责单位</p>
+
+            <td
+              width="84"
+              valign="center"
+              rowspan="2"
+              class="JR_left"
+              style="font-family: '黑体'; text-align: center; font-size: 16px"
+            >
+              <!-- <p align="center" style="font-family: 'heiti'">负责单位</p> -->
+              <span align="center" style="display: block; text-align: center"
+                >负责单位</span
+              >
             </td>
             </td>
-            <td valign="center" class="JR_left">
-              <p align="center" style="font-family: 'heiti'">参加人员</p>
+            <td
+              width="151"
+              valign="center"
+              rowspan="2"
+              class="JR_left"
+              style="font-family: '黑体'; text-align: center; font-size: 16px"
+            >
+              <!-- <p align="center" style="font-family: 'heiti'">负责单位</p> -->
+              <span align="center" style="display: block; text-align: center"
+                >参加人员</span
+              >
             </td>
             </td>
-            <td valign="center" class="JR_left">
-              <p align="center" style="font-family: 'heiti'">地点</p>
+            <td
+              width="125"
+              valign="center"
+              rowspan="2"
+              class="JR_left"
+              style="font-family: '黑体'; text-align: center; font-size: 16px"
+            >
+              <!-- <p align="center" style="font-family: 'heiti'">负责单位</p> -->
+              <span align="center" style="display: block; text-align: center"
+                >地点</span
+              >
             </td>
             </td>
-            <td valign="center" class="JR_left">
-              <p align="center" style="font-family: 'heiti'">时间</p>
+            <td
+              width="157"
+              valign="center"
+              rowspan="2"
+              class="JR_left"
+              style="font-family: '黑体'; text-align: center; font-size: 16px"
+            >
+              <!-- <p align="center" style="font-family: 'heiti'">负责单位</p> -->
+              <span align="center" style="display: block; text-align: center"
+                >时间</span
+              >
             </td>
             </td>
           </tr>
           </tr>
-
+        </tbody>
+      </table>
+      <table
+        class="b1"
+        border="1"
+        style="
+          border-collapse: collapse;
+          border: none;
+          mso-border-left-alt: 0.5pt solid windowtext;
+          mso-border-top-alt: 0.5pt solid windowtext;
+          mso-border-right-alt: 0.5pt solid windowtext;
+          mso-border-bottom-alt: 0.5pt solid windowtext;
+          mso-border-insideh: 0.5pt solid windowtext;
+          mso-border-insidev: 0.5pt solid windowtext;
+          mso-padding-alt: 0pt 0pt 0pt 0pt;
+          margin-left: 77px;
+        "
+        width="907"
+        align="center"
+        bordercolor="black"
+      >
+        <tbody id="tbody" style="font-size: 16px; font-weight: 500">
           <tr
           <tr
             class="JR_tr"
             class="JR_tr"
             v-for="(item, i) in message.bdglWeekworkRegisterList"
             v-for="(item, i) in message.bdglWeekworkRegisterList"
             :key="i"
             :key="i"
             style="text-align: center; height: 45px; font-family: 'fangsong'"
             style="text-align: center; height: 45px; font-family: 'fangsong'"
           >
           >
-            <td style="text-align: center;width:80px" rowspan="1" class="JR_right">
+            <td
+              style="text-align: center; width: 80px"
+              rowspan="1"
+              class="JR_right"
+            >
               {{ item.week }}
               {{ item.week }}
             </td>
             </td>
-            <td style="text-align: center;width:100px" rowspan="1" class="JR_right">
+            <td
+              style="text-align: center; width: 100px"
+              rowspan="1"
+              class="JR_right"
+            >
               {{ item.time }}
               {{ item.time }}
             </td>
             </td>
-            <td style="text-align: center;width:70px" rowspan="1" class="JR_right">
+            <td
+              style="text-align: center; width: 70px"
+              rowspan="1"
+              class="JR_right"
+            >
               {{ item.dateline }}
               {{ item.dateline }}
             </td>
             </td>
             <td style="text-align: center" rowspan="1" class="JR_right">
             <td style="text-align: center" rowspan="1" class="JR_right">
               {{ item.contents }}
               {{ item.contents }}
             </td>
             </td>
-            <td style="text-align: center;width:110px" rowspan="1" class="JR_right">
+            <td
+              style="text-align: center; width: 110px"
+              rowspan="1"
+              class="JR_right"
+            >
               {{ item.unitId1 }}
               {{ item.unitId1 }}
             </td>
             </td>
-            <td style="text-align: center;width:60px" rowspan="1" class="JR_right">
+            <td
+              style="text-align: center; width: 60px"
+              rowspan="1"
+              class="JR_right"
+            >
               {{ item.peopleIds }}
               {{ item.peopleIds }}
             </td>
             </td>
-            <td style="text-align: center;width:60px" rowspan="1" class="JR_right">
+            <td
+              style="text-align: center; width: 60px"
+              rowspan="1"
+              class="JR_right"
+            >
               {{ item.address }}
               {{ item.address }}
             </td>
             </td>
-            <td style="text-align: center;width:110px" rowspan="1" class="JR_right">
-              {{ item.startTime }}—{{ item.endTime }}
-            </td>
-          </tr>
-
-          <tr class="JR_tr">
-            <td valign="center" class="JR_left" style="font-family: 'songti'">
-              <p align="center">备注</p>
-            </td>
             <td
             <td
-              valign="center"
-              colspan="7"
+              style="text-align: center; width: 110px"
+              rowspan="1"
               class="JR_right"
               class="JR_right"
-              style="font-family: 'fangsong'"
             >
             >
-              {{ message.remark }}
+              {{ item.startTime }}—{{ item.endTime }}
             </td>
             </td>
           </tr>
           </tr>
         </tbody>
         </tbody>
-        <tr
-          style="
-            border: none;
-            color: black;
-            font-size: 16px;
-            font-weight: 500;
-            line-height: 30px;
-            width: 930px;
-            font-family: 'fangsong';
-          "
-        >
+        <tr style="border-bottom: 1px solid #333">
           <td
           <td
-            class="JR_left"
-            colspan="3"
-            align="left"
+            width="37"
+            height="89px"
+            valign="center"
             style="
             style="
-              border: none;
-              line-height: 70px;
-              width: 360px;
-              font-family: 'fangsong';
-              padding-left: 19px;
+              font-family: '仿宋_GB2312';
+              text-align: center;
+              font-size: 16px;
             "
             "
           >
           >
-            军事主官:{{ message.people1Name }}
+            <span align="center"> 备注 </span>
           </td>
           </td>
           <td
           <td
-            colspan="1"
+            width="897"
+            valign="center"
+            colspan="7"
+            v-html="message.info"
             style="
             style="
-              border: none;
-              line-height: 45px;
-              width: 360px;
-              font-family: 'fangsong';
+              font-family: '仿宋_GB2312';
+              text-align: center;
+              font-size: 16px;
             "
             "
-          ></td>
+          >
+            <span>{{ message.remark }}</span>
+          </td>
+        </tr>
+        <!-- </tbody> -->
+        <tr
+          class="JR_tr"
+          style="border: none; color: black; font-size: 12pt; line-height: 30px"
+        >
           <td
           <td
-            class="JR_left"
-            colspan="3"
+            class="JR_right"
+            colspan="4"
+            width="401"
             align="left"
             align="left"
-            style="
-              border: none;
-              line-height: 45px;
-              width: 360px;
-              font-family: 'fangsong';
-            "
+            style="font-family: '仿宋_GB2312'; font-size: 14px; border: none"
           >
           >
-            政治主官:{{ message.people2Name }}
+            <span style="margin-left: 25px">军事主官:</span>
           </td>
           </td>
           <td
           <td
-            class="JR_left"
+            class="JR_right"
             colspan="3"
             colspan="3"
+            width="382"
             align="left"
             align="left"
-            style="border: none; line-height: 45px; font-family: 'fangsong'"
+            style="font-family: '仿宋_GB2312'; font-size: 14px; border: none"
           >
           >
-            <!-- 时间: {{ message.startTime | dataFormaty }}—{{
-              message.endTime | dataFormaty
-            }} -->
+            <span style="margin-left: 12px">政治主官:</span>
+          </td>
+          <td
+            class="JR_right"
+            colspan="1"
+            width="124"
+            align="left"
+            style="font-family: '仿宋_GB2312'; font-size: 14px; border: none"
+          >
+            <span style="margin-left: 34px">时间:</span>
           </td>
           </td>
         </tr>
         </tr>
       </table>
       </table>
@@ -220,19 +327,150 @@
 //引入lookWord
 //引入lookWord
 import { lookWord } from "@/utils/look_word.js";
 import { lookWord } from "@/utils/look_word.js";
 import "@/utils/lodJs.js";
 import "@/utils/lodJs.js";
+import { lookequipuntits } from "@/api/grassrootsregistration/bdglweekwork";
 export default {
 export default {
   name: "bdgleven",
   name: "bdgleven",
   props: ["message"],
   props: ["message"],
   data() {
   data() {
     return {
     return {
       title: "周工作安排表",
       title: "周工作安排表",
-      style:
-        ".b1{width:860px !important};.JR_tr {height: 40px;};.JR_left{text-align:center;font-size: 1.231em; font-family: '楷体_GB2312';};.JR_right{ font-size: 1.131em; font-family: 仿宋_GB2312;};.JR_bottom{border-left:0; font-size: 1.331em; font-family: 仿宋_GB2312; text-align: right}",
+      faith: {
+        fileName: "周工作安排表", //文档名
+        fileType: ".doc", //文档类型  经测试  可以doc xls html 其他的自己去试
+        // header: "测试页眉", //页眉标题
+        // footer: "测试页脚", //页脚标题
+        direction: "Horizontal", //默认或不填写为纵向,Horizontal 为横向
+        dom: "#contents", // dom节点
+      },
+      // style:
+      //   ".b1{width:860px !important};.JR_tr {height: 40px;};.JR_left{text-align:center;font-size: 1.231em; font-family: '楷体_GB2312';};.JR_right{ font-size: 1.131em; font-family: 仿宋_GB2312;};.JR_bottom{border-left:0; font-size: 1.331em; font-family: 仿宋_GB2312; text-align: right}",
     };
     };
   },
   },
+  mounted() {
+    this.message.bdglWeekworkRegisterList.forEach((item) => {
+      item.time = this.zhuantime(item.time);
+    });
+    console.log(this.message.bdglWeekworkRegisterList);
+    //循环遍历
+    for (var i = 0; i < this.message.bdglWeekworkRegisterList.length; i++) {
+      //循环开始行
+      var start_row;
+      //需合并的行数
+      var rowspan = 1;
+      //循环到最后一行时
+      if (i == this.message.bdglWeekworkRegisterList.length - 1) {
+        //如果最后一行和倒数第二行属性不同,则rowspan=1;否则直接结束循环
+        if (
+          this.message.bdglWeekworkRegisterList[i].week !=
+          this.message.bdglWeekworkRegisterList[i - 1].week
+        ) {
+          this.message.bdglWeekworkRegisterList[i].rowspan = rowspan;
+        }
+        break;
+      }
+      //内层循环记录rowspan的数量
+      for (
+        var j = i;
+        j < this.message.bdglWeekworkRegisterList.length - 1;
+        j++
+      ) {
+        //记录循环结束的行数
+        start_row = j;
+        //属性相同则rowspan+1;否则直接结束内循环
+        if (
+          this.message.bdglWeekworkRegisterList[j].week ==
+          this.message.bdglWeekworkRegisterList[j + 1].week
+        ) {
+          rowspan++;
+        } else {
+          break;
+        }
+      }
+      //为数组添加rowspan属性
+      this.message.bdglWeekworkRegisterList[i].rowspan = rowspan;
+      //控制外循环从内循环结束的行数开始
+      i = start_row;
+    }
+    //页面渲染
+    var tbody = document.getElementById("tbody");
+    var html = "";
+    for (var i = 0; i < this.message.bdglWeekworkRegisterList.length; i++) {
+      html += "<tr>";
+      //动态添加rowspan属性
+      if (this.message.bdglWeekworkRegisterList[i].rowspan != null) {
+        html += `<td width="57" style="font-family: '宋体';" rowspan = ${this.message.bdglWeekworkRegisterList[i].rowspan}>${this.message.bdglWeekworkRegisterList[i].week}</td><td width="38"  rowspan = ${this.message.bdglWeekworkRegisterList[i].rowspan}>${this.message.bdglWeekworkRegisterList[i].time}</td><td width="48" rowspan = ${this.message.bdglWeekworkRegisterList[i].rowspan}>${this.message.bdglWeekworkRegisterList[i].dateline}</td>`;
+      }
+      html += `
+           <td width="245"
+              valign="center"
+              style="
+                font-family: '仿宋_GB2312';
+                text-align: center;
+                font-size: 16px;>
+             
+              <span align="center" class="JR_right"> ${this.message.bdglWeekworkRegisterList[i].contents}</span>
+            </td>
+            <td
+              width="84"
+              valign="center"
+              style="
+                font-family: '仿宋_GB2312';
+                text-align: center;
+                font-size: 16px;
+            >
+              <span align="center" class="JR_right">  ${this.message.bdglWeekworkRegisterList[i].unitId1}</span>
+            </td>
+            <td
+               width="151"
+              valign="center"
+              style="
+                font-family: '仿宋_GB2312';
+                text-align: center;
+                font-size: 16px;
+            >
+                <span align="center" class="JR_right">  ${this.message.bdglWeekworkRegisterList[i].peopleIds}</span>
+            </td>
+            <td
+                width="125"
+              valign="center"
+              style="
+                font-family: '仿宋_GB2312';
+                text-align: center;
+                font-size: 16px;
+            >
+             <span align="center" class="JR_right"> ${this.message.bdglWeekworkRegisterList[i].address}</span>
+            </td>
+            <td
+             width="157"
+              valign="center"
+              style="
+                font-family: '仿宋_GB2312';
+                text-align: center;
+                font-size: 16px;
+            >
+              <span align="center" class="JR_right">${this.message.bdglWeekworkRegisterList[i].startTime}-${this.message.bdglWeekworkRegisterList[i].endTime}</span>
+            </td>
+          </tr>`;
+    }
+    tbody.innerHTML = html;
+  },
   methods: {
   methods: {
+    zhuantime(originVal) {
+      const dt = new Date(originVal);
+      if (originVal) {
+        const y = dt.getFullYear();
+        const m = (dt.getMonth() + 1 + "").padStart(2);
+        const d = (dt.getDate() + "").padStart(2);
+        return `${m}.${d}`;
+      }
+    },
     daochu() {
     daochu() {
-      lookWord(this.title, "#contents", this.style, true);
+      // lookWord(this.title, "#contents", this.style, true);
+      lookequipuntits(this.message.bdglWeekworkRegisterList[0].weekworkId).then(
+        (res) => {
+          window.open(res.msg, "_self");
+        }
+      );
     },
     },
   },
   },
 };
 };