Selaa lähdekoodia

画刊增加全选

natasha 1 viikko sitten
vanhempi
commit
a9e085e4d4

+ 15 - 0
src/components/Setting.vue

@@ -469,6 +469,12 @@
                 <el-radio label="false">否</el-radio>
               </el-radio-group>
             </el-form-item>
+            <el-form-item label="阅读全部内容" prop="is_can_see_all_content">
+              <el-radio-group v-model="managerForm.is_can_see_all_content">
+                <el-radio label="true">是</el-radio>
+                <el-radio label="false">否</el-radio>
+              </el-radio-group>
+            </el-form-item>
             <el-form-item>
               <el-button
                 type="primary"
@@ -884,6 +890,10 @@ export default {
           this.page === "editOrgPerson"
             ? JSON.parse(JSON.stringify(this.info.is_manager))
             : "false",
+        is_can_see_all_content:
+          this.page === "editOrgPerson"
+            ? JSON.parse(JSON.stringify(this.info.is_can_see_all_content))
+            : "false",
       },
     };
   },
@@ -1003,6 +1013,10 @@ export default {
           this.page === "editOrgPerson"
             ? JSON.parse(JSON.stringify(this.info.is_manager))
             : "false";
+        this.managerForm.is_can_see_all_content =
+          this.page === "editOrgPerson"
+            ? JSON.parse(JSON.stringify(this.info.is_can_see_all_content))
+            : "false";
       } else {
         this.$refs[formName].resetFields();
       }
@@ -1284,6 +1298,7 @@ export default {
       let data = {
         id: this.page === "personal" ? JSON.parse(getToken()).user_id : this.id,
         is_manager: this.managerForm.is_manager,
+        is_can_see_all_content: this.managerForm.is_can_see_all_content,
       };
       getLogin(MethodName, data)
         .then((res) => {

+ 28 - 0
src/utils/index.js

@@ -195,4 +195,32 @@ export function getRandomArrayElements(arr, count) {
     shuffled[i] = temp;
   }
   return shuffled.slice(min);
+}
+//秒数转化为时分秒
+export function formatSeconds(value) {
+    var secondTime = parseInt(value); // 秒
+    var minuteTime = 0; // 分
+    var hourTime = 0; // 小时
+    if (secondTime > 60) { //如果秒数大于60,将秒数转换成整数
+        //获取分钟,除以60取整数,得到整数分钟
+        minuteTime = parseInt(secondTime / 60);
+        //获取秒数,秒数取余,得到整数秒数
+        secondTime = parseInt(secondTime % 60);
+        //如果分钟大于60,将分钟转换成小时
+        if (minuteTime > 60) {
+            //获取小时,获取分钟除以60,得到整数小时
+            hourTime = parseInt(minuteTime / 60);
+            //获取小时后取余的分,获取分钟除以60取余的分
+            minuteTime = parseInt(minuteTime % 60);
+        }
+    }
+    var result = "" + parseInt(secondTime) + "秒";
+
+    if (minuteTime > 0) {
+        result = "" + parseInt(minuteTime) + "分" + result;
+    }
+    if (hourTime > 0) {
+        result = "" + parseInt(hourTime) + "小时" + result;
+    }
+    return result;
 }

+ 51 - 0
src/views/cdkey_manage/AddGoods.vue

@@ -360,6 +360,9 @@
           </el-input>
         </div>
       </div>
+      <el-checkbox v-model="checkAll" @change="handleCheckAllChange"
+        >全选</el-checkbox
+      >
       <template
         v-if="
           (itemType === 'baozhi' && baozhiForm.orderValue === 'false') ||
@@ -664,6 +667,7 @@ export default {
       ],
       checkGoodsList: [],
       checkGoodsIdList: [],
+      checkAll: false,
     };
   },
   //计算属性 类似于data概念
@@ -674,6 +678,35 @@ export default {
   watch: {},
   //方法集合
   methods: {
+    // 全选
+    handleCheckAllChange(value) {
+      this.tableData.forEach((item) => {
+        if (value) {
+          if (this.checkGoodsIdList.indexOf(item.goods_id) === -1) {
+            this.checkGoodsIdList.push(item.goods_id);
+            this.checkGoodsList.push({
+              goods_id: item.goods_id,
+              goods_type: item.goods_type,
+            });
+            item.check = true;
+          }
+        } else {
+          if (this.checkGoodsIdList.indexOf(item.goods_id) > -1) {
+            this.checkGoodsIdList.splice(
+              this.checkGoodsIdList.indexOf(item.goods_id),
+              1
+            );
+            this.checkGoodsList.splice(
+              this.checkGoodsIdList.indexOf(item.goods_id),
+              1
+            );
+            item.check = false;
+          }
+        }
+      });
+
+      this.checkAll = value;
+    },
     changeSelectGoods(item) {
       if (this.checkGoodsIdList.indexOf(item.goods_id) > -1) {
         this.checkGoodsIdList.splice(
@@ -696,9 +729,11 @@ export default {
     },
     getList(val) {
       this.tableLoading = true;
+      this.checkAll = false;
       if (val) {
         this.pageNumber = val;
       }
+      let checkNumber = 0;
       let MethodName = "/ShopServer/Manager/GoodsQuery/PageQueryCourseList";
       let data = {
         page_capacity: this.page_capacity,
@@ -722,9 +757,11 @@ export default {
                 item.goods_id = item.id;
                 item.check =
                   this.checkGoodsIdList.indexOf(item.id) > -1 ? true : false;
+                if (this.checkGoodsIdList.indexOf(item.id) > -1) checkNumber++;
               });
               this.tableData = res.issue_list;
               this.total_count = res.total_count;
+              this.checkAll = checkNumber === this.tableData.length;
             }
           })
           .catch(() => {
@@ -743,9 +780,11 @@ export default {
                 item.goods_id = item.id;
                 item.check =
                   this.checkGoodsIdList.indexOf(item.id) > -1 ? true : false;
+                if (this.checkGoodsIdList.indexOf(item.id) > -1) checkNumber++;
               });
               this.tableData = res.course_list;
               this.total_count = res.total_count;
+              this.checkAll = checkNumber === this.tableData.length;
             }
           })
           .catch(() => {
@@ -764,9 +803,11 @@ export default {
                 item.goods_id = item.id;
                 item.check =
                   this.checkGoodsIdList.indexOf(item.id) > -1 ? true : false;
+                if (this.checkGoodsIdList.indexOf(item.id) > -1) checkNumber++;
               });
               this.tableData = res.iread_article_list;
               this.total_count = res.total_count;
+              this.checkAll = checkNumber === this.tableData.length;
             }
           })
           .catch(() => {
@@ -776,6 +817,12 @@ export default {
         MethodName = "/PaperServer/Manager/PicIssueManager/PageQueryIssue";
         data.year_label = this.huakanForm.yearValue;
         data.key_word = this.searchValue.trim();
+        data.order_bys = [
+          {
+            name: "iss_no",
+            asc: false,
+          },
+        ];
 
         getLogin(MethodName, data)
           .then((res) => {
@@ -786,9 +833,11 @@ export default {
                 item.goods_id = item.id;
                 item.check =
                   this.checkGoodsIdList.indexOf(item.id) > -1 ? true : false;
+                if (this.checkGoodsIdList.indexOf(item.id) > -1) checkNumber++;
               });
               this.tableData = res.data.list;
               this.total_count = res.data.total_count;
+              this.checkAll = checkNumber === this.tableData.length;
             }
           })
           .catch(() => {
@@ -808,9 +857,11 @@ export default {
                 item.goods_id = item.id;
                 item.check =
                   this.checkGoodsIdList.indexOf(item.id) > -1 ? true : false;
+                if (this.checkGoodsIdList.indexOf(item.id) > -1) checkNumber++;
               });
               this.tableData = res.album_list;
               this.total_count = res.total_count;
+              this.checkAll = checkNumber === this.tableData.length;
             }
           })
           .catch(() => {

+ 4 - 4
src/views/cdkey_manage/CreateCdkey.vue

@@ -72,12 +72,12 @@
                 v-model="organizeForm.person_count_max"
                 @change="handleChange"
                 :min="0"
-                :max="500"
+                :max="99999999"
                 size="small"
                 class="personal-ceil"
               ></el-input-number>
               <span class="append">人</span>
-              <p class="tips">最多不超过 500 次</p>
+              <!-- <p class="tips">最多不超过 500 次</p> -->
             </el-form-item>
             <el-form-item
               label="有效期"
@@ -535,10 +535,10 @@ export default {
           // 升序不传值
           order_column_list = [this.dataSort.prop];
         } else {
-          order_column_list = ["create_time:desc"];
+          order_column_list = ["goods_type:desc"];
         }
       } else {
-        order_column_list = ["create_time:desc"];
+        order_column_list = ["goods_type:desc"];
       }
       let data = {
         discount_code_id: this.cdKeyId,

+ 6 - 1
src/views/content_manage/album_manage/AddGoods.vue

@@ -628,7 +628,12 @@ export default {
         MethodName = "/PaperServer/Manager/PicIssueManager/PageQueryIssue";
         data.year_label = this.huakanForm.yearValue;
         data.key_word = this.searchValue.trim();
-
+        data.order_bys = [
+          {
+            name: "iss_no",
+            asc: false,
+          },
+        ];
         getLogin(MethodName, data)
           .then((res) => {
             this.tableLoading = false;

+ 308 - 0
src/views/data_center/index.vue

@@ -428,6 +428,121 @@
             <div class="echart-item" id="echart5"></div>
             <div class="echart-item" id="echart6"></div>
           </div>
+          <div class="read-info" v-if="readInfo">
+            <!-- <span>文章数:{{ readInfo.article_count }}篇</span> -->
+            <el-button type="primary" size="small" @click="handleExport" :loading="exportLoading"
+              >导出阅读数据</el-button
+            >
+          </div>
+          <el-table
+            :data="articleList"
+            v-loading="tableLoading"
+            stripe
+            @sort-change="handleSort"
+            :default-sort="dataSort"
+          >
+            <el-table-column
+              type="index"
+              label="#"
+              width="60"
+              :index="(pageNumber - 1) * pageSize + 1"
+            >
+            </el-table-column>
+            <el-table-column
+              prop="person_name"
+              sortable="custom"
+              label="人员姓名"
+              width="100"
+            >
+            </el-table-column>
+            <el-table-column
+              prop="article_title"
+              sortable="custom"
+              label="文章"
+            >
+            </el-table-column>
+            <el-table-column
+              prop="goods_type"
+              sortable="custom"
+              width="100"
+              label="类型"
+            >
+              <template slot-scope="scope">
+                <span
+                  class="items-type"
+                  :style="{
+                    background: goodsTypeListCss[scope.row.goods_type]
+                      ? goodsTypeListCss[scope.row.goods_type].bg
+                      : '',
+                    color: goodsTypeListCss[scope.row.goods_type]
+                      ? goodsTypeListCss[scope.row.goods_type].color
+                      : '',
+                  }"
+                  >{{ goodsTypeListCss[scope.row.goods_type].text }}</span
+                >
+              </template>
+            </el-table-column>
+            <el-table-column
+              prop="study_phase_name"
+              sortable="custom"
+              label="学段"
+              width="81"
+            >
+            </el-table-column>
+            <el-table-column
+              prop="issue_no_name"
+              sortable="custom"
+              label="来源"
+              width="197"
+            >
+            </el-table-column>
+            <el-table-column prop="words" label="词数/长度" width="140">
+              <template slot-scope="scope">
+                {{
+                  scope.row.article_diff_word_count +
+                  "/" +
+                  scope.row.article_word_count
+                }}
+              </template>
+            </el-table-column>
+            <el-table-column
+              prop="duration"
+              sortable="custom"
+              label="阅读时长"
+              width="140"
+            >
+              <template slot-scope="scope">
+                {{ formatterDuration(scope.row) }}
+              </template>
+            </el-table-column>
+            <el-table-column
+              prop="reading_time"
+              sortable="custom"
+              label="阅读时间"
+              width="160"
+            >
+              <template slot-scope="scope">
+                {{
+                  scope.row.reading_time
+                    ? scope.row.reading_time.substring(0, 16)
+                    : "-"
+                }}
+              </template>
+            </el-table-column>
+          </el-table>
+          <el-pagination
+            background
+            @size-change="
+              (val) => handleSizeChange(val, 'pageSize', 'pageNumber')
+            "
+            @current-change="(val) => handleCurrentChange(val, 'pageNumber')"
+            :current-page="pageNumber"
+            :page-sizes="[10, 20, 30, 40, 50]"
+            :page-size="pageSize"
+            layout="total, prev, pager, next, sizes, jumper"
+            :total="total_count_a"
+          >
+          </el-pagination>
         </div>
       </div>
     </div>
@@ -443,6 +558,7 @@ import { getLogin } from "@/api/ajax";
 import { formatNumber } from "@/utils/defined";
 import { mapState } from "vuex";
 import * as echarts from "echarts";
+import { formatSeconds } from "@/utils/index";
 export default {
   //import引入的组件需要注入到对象中才能使用
   components: { Header, NavMenu },
@@ -497,6 +613,56 @@ export default {
         ],
       },
       props: { multiple: true },
+      pageSize: 10,
+      pageNumber: 1,
+      articleList: [],
+      tableLoading: false,
+      total_count_a: 0,
+      readInfo: null,
+      dataSort: {},
+      goodsTypeListCss: {
+        2: {
+          text: "报纸",
+          color: "#165DFF",
+          bg: "#E8F7FF",
+        },
+        21: {
+          text: "文章",
+          color: "#165DFF",
+          bg: "#E8F7FF",
+        },
+        3: {
+          text: "精读",
+          color: "#0FC6C2",
+          bg: "#E8FFFB",
+        },
+        0: {
+          text: "课程",
+          color: "#722ED1",
+          bg: "#F5E8FF",
+        },
+        1: {
+          text: "课程",
+          color: "#722ED1",
+          bg: "#F5E8FF",
+        },
+        10: {
+          text: "课程",
+          color: "#722ED1",
+          bg: "#F5E8FF",
+        },
+        // '5':{
+        //     text:'报纸专辑',
+        //     color:'#165DFF',
+        //     bg:'#E8F7FF'
+        // },
+        4: {
+          text: "画刊",
+          color: "#F53F3F",
+          bg: "#FFECE8",
+        },
+      },
+      exportLoading: false,
     };
   },
   //计算属性 类似于data概念
@@ -1017,6 +1183,126 @@ export default {
         };
         option && myChart.setOption(option);
       });
+      this.getReadList();
+    },
+    formatterDuration(row) {
+      let studyCn = "";
+      if (row.duration) {
+        studyCn = formatSeconds(row.duration);
+      } else {
+        studyCn = "0";
+      }
+      return studyCn;
+    },
+    handleSizeChange(val, type, page) {
+      this[type] = val;
+      this[page] = 1;
+      this.getReadList();
+    },
+    handleCurrentChange(val, type) {
+      this[type] = val;
+      this.getReadList();
+    },
+    handleSort(value) {
+      let dataSort = {
+        prop: value.prop,
+        order: value.order,
+      };
+      this.dataSort = dataSort;
+      this.getReadList();
+    },
+    getReadList() {
+      // 阅读数据
+      let order_column_list = [];
+      if (this.dataSort != {}) {
+        if (this.dataSort.order == "descending") {
+          order_column_list = [this.dataSort.prop + ":desc"];
+        } else if (this.dataSort.order == "ascending") {
+          // 升序不传值
+          order_column_list = [this.dataSort.prop];
+        } else {
+          order_column_list = ["create_time:desc"];
+        }
+      } else {
+        order_column_list = ["create_time:desc"];
+      }
+      let MethodName9 =
+        "/ShopServer/Manager/LogManager/PageQueryReadingRecord_Article";
+      let data2 = {
+        reading_date_begin:
+          this.dataValue && this.dataValue[0] ? this.dataValue[0] : "",
+        reading_date_end:
+          this.dataValue && this.dataValue[1] ? this.dataValue[1] : "",
+        page_capacity: this.pageSize,
+        cur_page: this.pageNumber,
+        order_column_list: order_column_list,
+      };
+
+      getLogin(MethodName9, data2).then((res) => {
+        if (res.status === 1) {
+          this.readInfo = res.sum_info;
+          this.total_count_a = res.total_count;
+          this.articleList = res.reading_record_list;
+          if (res.sum_info.duration < 3600) {
+            this.readInfo.durationStr = "<1";
+          } else {
+            this.readInfo.durationStr = Math.ceil(res.sum_info.duration / 3600);
+          }
+        }
+      });
+    },
+    // 导出阅读数据
+    handleExport() {
+      let _this = this;
+      _this.exportLoading = true;
+      let MethodName =
+        "/ShopServer/Manager/FileExport/StartCreateArticleReadingRecordExportFile";
+      let order_column_list = [];
+      if (this.dataSort != {}) {
+        if (this.dataSort.order == "descending") {
+          order_column_list = [this.dataSort.prop + ":desc"];
+        } else if (this.dataSort.order == "ascending") {
+          // 升序不传值
+          order_column_list = [this.dataSort.prop];
+        } else {
+          order_column_list = ["create_time:desc"];
+        }
+      } else {
+        order_column_list = ["create_time:desc"];
+      }
+      let data2 = {
+        reading_date_begin:
+          this.dataValue && this.dataValue[0] ? this.dataValue[0] : "",
+        reading_date_end:
+          this.dataValue && this.dataValue[1] ? this.dataValue[1] : "",
+        page_capacity: this.pageSize,
+        cur_page: this.pageNumber,
+        order_column_list: order_column_list,
+      };
+      getLogin(MethodName, data2)
+        .then((res) => {
+          let MethodName2 =
+            "/ShopServer/Manager/FileExport/GetArticleReadingRecordExportFileTaskProgress";
+          let timer = setTimeout(() => {
+            getLogin(MethodName2, {
+              export_file_task_id: res.export_file_task_id,
+            })
+              .then((res) => {
+                if (res.is_finish === "true") {
+                  clearTimeout(timer);
+                  timer = null;
+                  _this.exportLoading = false;
+                  location.href = res.export_file_url;
+                }
+              })
+              .catch((res) => {
+                this.loading = false;
+              });
+          }, 1000);
+        })
+        .catch((res) => {
+          this.loading = false;
+        });
     },
   },
   //生命周期 - 创建完成(可以访问当前this实例)
@@ -1178,4 +1464,26 @@ export default {
     padding: 24px;
   }
 }
+.read-info {
+  margin: 20px 0 10px 0;
+  display: flex;
+  column-gap: 15px;
+  flex-flow: wrap;
+  align-items: center;
+}
+:deep th.el-table__cell {
+  border-bottom: 1px solid #e5e6eb;
+  background: #f2f3f5;
+  padding: 8px 0px;
+}
+:deep .cell {
+  word-break: normal;
+}
+.items-type {
+  padding: 1px 8px;
+  font-weight: 500;
+  font-size: 14px;
+  line-height: 22px;
+  border-radius: 2px;
+}
 </style>