index.vue 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954
  1. <template>
  2. <div class="app-container">
  3. <div style="background-color: #fff;padding: 20px;border-radius: 10px;">
  4. <p style="margin: 0; font-weight: 800;font-size: 16px;color: #343434;display: flex;align-items: center;margin-bottom: 20px;">
  5. <img src="../../../assets/images/icon_htgl_btzs.png" alt="" style="width: 16px;height: 20px;">
  6. <span style="margin-left: 10px;">员工培训</span>
  7. </p>
  8. <div style="background: #F3F3F3;padding: 20px 15px; padding-bottom: 0;margin-bottom: 20px;">
  9. <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="88px">
  10. <el-row>
  11. <!-- <el-col :span="24">
  12. <el-form-item label="创建时间:" prop="postCode">
  13. <el-date-picker
  14. v-model="value1"
  15. type="date"
  16. placeholder="选择日期">
  17. </el-date-picker>
  18. <span style="margin: 0 10px;">至</span>
  19. <el-date-picker
  20. v-model="value1"
  21. type="date"
  22. placeholder="选择日期">
  23. </el-date-picker>
  24. </el-form-item>
  25. </el-col> -->
  26. <el-col :span="24">
  27. <el-col :span="11">
  28. <el-form-item label="标题内容" prop="manualTitle">
  29. <el-input
  30. style="width: 350px;"
  31. v-model="queryParams.manualTitle"
  32. placeholder="请输入员工培训手册标题"
  33. clearable
  34. @keyup.enter.native="handleQuery"
  35. />
  36. </el-form-item>
  37. </el-col>
  38. <el-col :span="8">
  39. <el-form-item label="手册类型" prop="manualType">
  40. <el-select v-model="queryParams.manualType" placeholder="请选择员工培训手册类型" clearable>
  41. <el-option
  42. v-for="dict in dict.type.publication_type"
  43. :key="dict.value"
  44. :label="dict.label"
  45. :value="dict.value"
  46. />
  47. </el-select>
  48. </el-form-item>
  49. </el-col>
  50. <el-col :span="5">
  51. <el-form-item class="butt">
  52. <el-button type="primary" size="mini" @click="handleQuery">搜索</el-button>
  53. <el-button size="mini" @click="resetQuery">重置</el-button>
  54. </el-form-item>
  55. </el-col>
  56. </el-col>
  57. </el-row>
  58. </el-form>
  59. </div>
  60. <div class="casr">
  61. <el-tabs v-model="activeName" type="card" @tab-click="handleClick" >
  62. <el-tab-pane label="图文" name="1">
  63. <el-row :gutter="10" class="mb8">
  64. <el-col :span="1.5">
  65. <el-button
  66. type="primary"
  67. plain
  68. size="mini"
  69. @click="handleAdd"
  70. v-hasPermi="['wuYe:manual:add']"
  71. >添加</el-button>
  72. </el-col>
  73. <!-- <el-col :span="1.5">
  74. <el-button
  75. type="success"
  76. plain
  77. size="mini"
  78. :disabled="single"
  79. @click="handleUpdate"
  80. v-hasPermi="['wuYe:manual:edit']"
  81. >修改</el-button>
  82. </el-col> -->
  83. <el-col :span="1.5">
  84. <el-button
  85. type="danger"
  86. plain
  87. size="mini"
  88. :disabled="multiple"
  89. @click="handleDelete"
  90. v-hasPermi="['wuYe:manual:remove']"
  91. >删除</el-button>
  92. </el-col>
  93. <el-col :span="1.5">
  94. <el-button
  95. type="warning"
  96. plain
  97. size="mini"
  98. @click="handleExport"
  99. v-hasPermi="['wuYe:manual:export']"
  100. >导出</el-button>
  101. </el-col>
  102. <el-col :span="1.5">
  103. <el-button
  104. type="warning"
  105. plain
  106. size="mini"
  107. @click="handleExportyd"
  108. v-hasPermi="['wuYe:staffTrainTime:list']"
  109. >阅读时长</el-button>
  110. </el-col>
  111. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  112. </el-row>
  113. <el-table :max-height="tableMaxHeight" v-loading="loading" :data="manualList" @selection-change="handleSelectionChange">
  114. <el-table-column label="标题" align="center" prop="manualTitle" width="120" show-overflow-tooltip />
  115. <el-table-column label="发布时间" align="center" prop="publishTime" width="180">
  116. <template slot-scope="scope">
  117. <span>{{scope.row.publishTime}}</span>
  118. </template>
  119. </el-table-column>
  120. <!-- <el-table-column label="作者" align="center" prop="author" />
  121. <el-table-column label="来源" align="center" prop="source" width="100" show-overflow-tooltip/> -->
  122. <el-table-column label="封面图片" align="center" prop="coverImage" width="100">
  123. <template slot-scope="scope">
  124. <image-preview :src="scope.row.coverImage" :width="50" :height="50"/>
  125. </template>
  126. </el-table-column>
  127. <el-table-column label="浏览次数" align="center" prop="viewCount" >
  128. <template slot-scope="scope">
  129. <el-tooltip class="item" effect="dark" :content="scope.row.viewCount == 0?'暂无人员查看' : '点击查看详细人员'" placement="top-start">
  130. <div @click="isyur(scope.row)" style=" text-decoration: underline; cursor: pointer;color: #fe5a0e ;font-weight: 700;">
  131. {{scope.row.viewCount}}
  132. </div>
  133. </el-tooltip>
  134. </template>
  135. </el-table-column>
  136. <el-table-column label="是否置顶" align="center" prop="isTop">
  137. <template slot-scope="scope">
  138. <dict-tag :options="dict.type.sys_yes_no" :value="scope.row.isTop"/>
  139. </template>
  140. </el-table-column>
  141. <el-table-column label="操作" width="160" align="center" class-name="small-padding fixed-width">
  142. <template slot-scope="scope">
  143. <el-button
  144. size="mini"
  145. type="text"
  146. @click="handleUpdategg(scope.row)"
  147. >查看</el-button>
  148. <el-button
  149. size="mini"
  150. type="text"
  151. @click="handleUpdate(scope.row)"
  152. style="color:#28C529;"
  153. v-hasPermi="['wuYe:manual:edits']"
  154. >修改</el-button>
  155. <el-button
  156. size="mini"
  157. type="text"
  158. style="color: red;"
  159. @click="handleDelete(scope.row)"
  160. v-hasPermi="['wuYe:manual:remove']"
  161. >删除</el-button>
  162. </template>
  163. </el-table-column>
  164. </el-table>
  165. </el-tab-pane>
  166. <el-tab-pane label="视频" name="2">
  167. <el-row :gutter="10" class="mb8">
  168. <el-col :span="1.5">
  169. <el-button
  170. type="primary"
  171. plain
  172. size="mini"
  173. @click="handleAdd"
  174. v-hasPermi="['wuYe:manual:add']"
  175. >添加</el-button>
  176. </el-col>
  177. <el-col :span="1.5">
  178. <el-button
  179. type="success"
  180. plain
  181. size="mini"
  182. :disabled="singleg"
  183. @click="handleUpdateg"
  184. v-hasPermi="['wuYe:manual:edits']"
  185. >修改</el-button>
  186. </el-col>
  187. <el-col :span="1.5">
  188. <el-button
  189. type="danger"
  190. plain
  191. size="mini"
  192. @click="handleDeleteg"
  193. v-hasPermi="['wuYe:manual:remove']"
  194. >删除</el-button>
  195. </el-col>
  196. <el-col :span="1.5">
  197. <el-button
  198. type="warning"
  199. plain
  200. size="mini"
  201. @click="handleExport"
  202. v-hasPermi="['wuYe:manual:export']"
  203. >导出</el-button>
  204. </el-col>
  205. <el-col :span="1.5">
  206. <el-button
  207. type="warning"
  208. plain
  209. size="mini"
  210. :disabled="singleg"
  211. @click="handleUpdategy"
  212. v-hasPermi="['wuYe:manual:edit']"
  213. >阅读人员</el-button>
  214. </el-col>
  215. <el-col :span="1.5">
  216. <el-button
  217. type="primary"
  218. plain
  219. size="mini"
  220. @click="handleExportyd"
  221. v-hasPermi="['wuYe:staffTrainTime:list']"
  222. >阅读时长</el-button>
  223. </el-col>
  224. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  225. </el-row>
  226. <div class=" infinite-list" :style="dynamicStyle">
  227. <el-row :gutter="10" v-if="manualList.length !=0" style="width: 100%;margin-left: 0;">
  228. <el-col :span="6" v-for="(item,index) in manualList" :key="index" style="cursor: pointer;">
  229. <div v-if="isshoe" @click="isac(item)" :class=" item.isnum ==true ? 'ingwe' :'' " style="position: relative; background-color: #fff;box-shadow: 0px 0px 10px 0px #CDCDCD;border-radius: 4px;margin-bottom: 10px;height: 222px;">
  230. <div>
  231. <video
  232. :id="'myVideo' + (index+1)"
  233. data-setup="{}"
  234. loop="loop"
  235. :autoplay="false"
  236. muted
  237. controls
  238. @play="videoPlay(item)"
  239. poster=""
  240. style="width: 100%;height: 150px;"
  241. >
  242. <!-- + baseUrl -->
  243. <source :src="defaultSettings.urls+ item.videoUrl " />
  244. </video>
  245. </div>
  246. <div class="goe">
  247. <p>{{item.manualTitle}}</p>
  248. <p>
  249. <span>{{item.publishTime}}</span>
  250. <span>{{item.result}}</span>
  251. </p>
  252. </div>
  253. <img v-if="item.isnum == true" src="../../../assets/images/icon_htgl_kp_gx.png" alt="" style="width: 35px;height: 35px;position: absolute;bottom: 0;right: 0;">
  254. </div>
  255. </el-col>
  256. </el-row>
  257. <div style="margin-top: 20px;display: flex;justify-content: center;align-items: center;" v-if="manualList.length ==0">
  258. <img src="../../../assets/images/zwshjbig.png" alt="" style="">
  259. </div>
  260. </div>
  261. </el-tab-pane>
  262. </el-tabs>
  263. </div>
  264. <pagination
  265. v-show="total>0"
  266. :total="total"
  267. :page.sync="queryParams.pageNum"
  268. :limit.sync="queryParams.pageSize"
  269. @pagination="getList"
  270. />
  271. </div>
  272. <!-- 添加或修改岗位对话框 -->
  273. <el-dialog :title="title" :visible.sync="open" width="1000px" append-to-body>
  274. <el-form ref="form" :model="form" :rules="rules" label-width="120px">
  275. <el-row>
  276. <el-col :span="8">
  277. <el-form-item label="培训手册标题" prop="manualTitle">
  278. <el-input v-model="form.manualTitle" placeholder="请输入员工培训手册标题" />
  279. </el-form-item>
  280. </el-col>
  281. <!-- <el-col :span="8" v-if="activeName == 1">
  282. <el-form-item label="作者" prop="author">
  283. <el-input v-model="form.author" placeholder="请输入作者" />
  284. </el-form-item>
  285. </el-col> -->
  286. <el-col :span="8" v-if="activeName == 1">
  287. <el-form-item label="是否置顶" prop="isTop">
  288. <el-select v-model="form.isTop" placeholder="请选择是否置顶">
  289. <el-option
  290. v-for="dict in dict.type.sys_yes_no"
  291. :key="dict.value"
  292. :label="dict.label"
  293. :value="dict.value"
  294. ></el-option>
  295. </el-select>
  296. </el-form-item>
  297. </el-col>
  298. <!-- <el-col :span="8" v-if="activeName == 1">
  299. <el-form-item label="来源" prop="source">
  300. <el-input v-model="form.source" placeholder="请输入来源,记录资讯的来源" />
  301. </el-form-item>
  302. </el-col> -->
  303. <el-col :span="8" >
  304. <el-form-item label="发布时间" prop="publishTime">
  305. <el-date-picker clearable
  306. style="width:100%"
  307. v-model="form.publishTime"
  308. type="date"
  309. value-format="yyyy-MM-dd"
  310. placeholder="请选择发布时间">
  311. </el-date-picker>
  312. </el-form-item>
  313. </el-col>
  314. <el-col :span="24" v-if="activeName == 1">
  315. <el-form-item label="员工手册内容">
  316. <editor v-model="form.manualContent" :min-height="192"/>
  317. </el-form-item>
  318. </el-col>
  319. <el-col :span="24" v-if="activeName == 1 && isredw">
  320. <el-form-item label="封面图片" prop="coverImage">
  321. <image-upload v-model="form.coverImage"/>
  322. </el-form-item>
  323. </el-col>
  324. <el-col :span="24" v-if="activeName == 2">
  325. <el-form-item label="视频地址" prop="videoUrl">
  326. <!-- <image-uploadyuang v-model="form.videoUrl"/> -->
  327. <file-uploadvio v-model="form.videoUrl"/>
  328. </el-form-item>
  329. </el-col>
  330. </el-row>
  331. </el-form>
  332. <div slot="footer" class="dialog-footer" v-if="isredw">
  333. <el-button type="primary" @click="submitForm">确 定</el-button>
  334. <el-button @click="cancel">取 消</el-button>
  335. </div>
  336. </el-dialog>
  337. <el-dialog title="阅读人员" :visible.sync="openyy" width="600px" append-to-body class="nghsey">
  338. <div style="background-color: #fff; padding: 20px; padding-bottom: 0;">
  339. <el-form ref="formy" :model="formy" :rules="rulesy" label-width="80px">
  340. <el-row>
  341. <el-col :span="10">
  342. <el-form-item label="阅读时间" prop="createTime">
  343. <el-date-picker clearable
  344. style="width:100%"
  345. v-model="formy.createTime"
  346. type="date"
  347. value-format="yyyy-MM-dd"
  348. placeholder="请选择阅读时间">
  349. </el-date-picker>
  350. </el-form-item>
  351. </el-col>
  352. <el-col :span="10">
  353. <el-form-item label="员工姓名" prop="searchValue">
  354. <el-input clearable v-model="formy.searchValue" placeholder="请输入员工姓名" />
  355. </el-form-item>
  356. </el-col>
  357. <el-col :span="4" style="text-align: right;">
  358. <el-button type="primary" @click="handleQueryy">搜索</el-button>
  359. </el-col>
  360. </el-row>
  361. </el-form>
  362. </div>
  363. <div style="padding: 20px;">
  364. <p style="margin-top: 0;">当前已读人数共 <span style="color: #4671ED;">{{getreadList.length}}</span>人</p>
  365. <div v-for="(item,index) in getreadList" :key="index" style=" margin-bottom: 20px; display: flex;align-items: center; background: #FFFFFF;border-radius: 20px; border: 1px solid #E6E6E6;padding: 10px 25px;" >
  366. <img src="../../../assets/images/icon_htgl_rygl_tx_nv.png" alt="" style="width: 50px;height: 50px;border-radius: 50%;" >
  367. <div style="margin-left: 10px;">
  368. <p style="font-weight: bold;
  369. font-size: 16px;
  370. color: #272727;">{{item.name == null?'暂无数据' : item.name}}</p>
  371. <p style="font-weight: 500;font-size: 14px;color: #666666;">阅读时间 | {{item.time == null?'暂无数据' : item.time}}</p>
  372. </div>
  373. <!-- <img src="../../../assets/images/icon_htgl_rygl_tx_nan.png" alt="" style="width: 50px;height: 50px;border-radius: 50%;" v-if="item.residentGender == 2"> -->
  374. </div>
  375. </div>
  376. <!-- <div style="background-color: ;">
  377. </div> -->
  378. </el-dialog>
  379. <el-dialog title="阅读时长统计" :visible.sync="openyys" width="600px" append-to-body class="nghsey">
  380. <div style="background-color: #fff; padding: 20px; padding-bottom: 0;">
  381. <el-form ref="formys" :model="formys" :rules="rulesys" label-width="80px">
  382. <el-row>
  383. <el-col :span="10">
  384. <el-form-item label="员工姓名" prop="staffName">
  385. <el-input clearable v-model="formys.staffName" placeholder="请输入员工姓名" />
  386. </el-form-item>
  387. </el-col>
  388. <el-col :span="4" style="text-align: right;">
  389. <el-button type="primary" @click="handleQueryytime">搜索</el-button>
  390. </el-col>
  391. </el-row>
  392. </el-form>
  393. </div>
  394. <div style="padding: 20px;">
  395. <div style="margin-top: 0;display: flex;justify-content: space-between;align-items: center;">
  396. <p style="margin: 0;">当前统计人数共 <span style="color: #4671ED; ">{{staffTrainTimeList.length}}</span>人</p>
  397. <div style="font-weight: 500;font-size: 16px;color: #FE5A0E; display: flex;align-items: center; cursor: pointer;" v-if="yutim" @click="yuretimecl">
  398. 从高到低
  399. <img src="../../../assets/images/icon_ydtj_px_zdg_selected.png" alt="" style="margin-right: 5px;margin-left: 5px;">
  400. <img src="../../../assets/images/icon_ydtj_px_ygd_normal.png" alt="">
  401. </div>
  402. <div style="font-weight: 500;font-size: 16px;color: #FE5A0E; display: flex;align-items: center; cursor: pointer;" v-if="!yutim" @click="yuretimecl">
  403. 从低到高
  404. <img src="../../../assets/images/icon_ydtj_px_zdg_normal.png" alt="" style="margin-right: 5px;margin-left: 5px;">
  405. <img src="../../../assets/images/icon_ydtj_px_ydg_selected.png" alt="">
  406. </div>
  407. </div>
  408. <div v-for="(item,index) in staffTrainTimeList" :key="index" style=" margin-top: 20px; display: flex;align-items: center; background: #FFFFFF;border-radius: 20px; border: 1px solid #E6E6E6;padding: 10px 25px;" >
  409. <img src="../../../assets/images/icon_htgl_rygl_tx_nv.png" alt="" style="width: 50px;height: 50px;border-radius: 50%;" >
  410. <div style="margin-left: 10px;">
  411. <p style="font-weight: bold;
  412. font-size: 16px;
  413. color: #272727;">{{item.staffName == null?'暂无数据' : item.staffName}}</p>
  414. <p style="font-weight: 500;font-size: 14px;color: #666666;display:flex;align-items: center;">阅读总时长 | {{item.time == null?'暂无数据' : item.time}}</p>
  415. </div>
  416. <!-- <img src="../../../assets/images/icon_htgl_rygl_tx_nan.png" alt="" style="width: 50px;height: 50px;border-radius: 50%;" v-if="item.residentGender == 2"> -->
  417. </div>
  418. </div>
  419. <!-- <div style="background-color: ;">
  420. </div> -->
  421. </el-dialog>
  422. </div>
  423. </template>
  424. <script>
  425. import { listManual, getManual, delManual, addManual, updateManual,staffTrainTime,getRead,staffTrainTimere } from "@/api/wuguan/manual";
  426. import 'videojs-flash'
  427. const defaultSettings = require("@/settings.js");
  428. export default {
  429. name: "Post",
  430. dicts: ['sys_normal_disable','publication_type','sys_yes_no'],
  431. data() {
  432. return {
  433. // 遮罩层
  434. loading: true,
  435. defaultSettings:defaultSettings,
  436. baseUrl: process.env.VUE_APP_BASE_API,
  437. // 选中数组
  438. ids: [],
  439. // 非单个禁用
  440. single: true,
  441. // 非多个禁用
  442. multiple: true,
  443. // 显示搜索条件
  444. showSearch: true,
  445. // 总条数
  446. total: 0,
  447. // 岗位表格数据
  448. postList: [],
  449. // 员工培训手册表格数据
  450. manualList: [],
  451. // 弹出层标题
  452. title: "",
  453. // 是否显示弹出层
  454. open: false,
  455. openyy:false,
  456. openyys:false,
  457. // 查询参数
  458. queryParams: {
  459. pageNum: 1,
  460. pageSize: 10,
  461. manualTitle: null,
  462. manualType: '1',
  463. manualContent: null,
  464. status: null,
  465. publishTime: null,
  466. videoUrl: null,
  467. coverImage: null,
  468. author: null,
  469. source: null,
  470. viewCount: null,
  471. isTop: null,
  472. },
  473. // 表单参数
  474. form: {},
  475. formy:{},
  476. formys:{},
  477. // 表单校验
  478. rules: {
  479. manualTitle: [
  480. { required: true, message: "员工培训手册标题不能为空", trigger: "blur" }
  481. ],
  482. manualType: [
  483. { required: true, message: "员工培训手册类型不能为空", trigger: "change" }
  484. ],
  485. },
  486. rulesy:{},
  487. rulesys:{},
  488. activeName:'1',
  489. videoState: false, // 视频播放状态
  490. poster:true,
  491. controls:true,
  492. videoData:{},
  493. player: null,
  494. isshoe:true,
  495. isredw:true,
  496. singleg:true,
  497. manid:0,
  498. getreadList:[],
  499. startTime: 0,
  500. yutim:true,
  501. staffTrainTimeList:[],
  502. tableMaxHeight:'200',
  503. };
  504. },
  505. computed: {
  506. dynamicStyle() {
  507. return {
  508. overflowY:'auto',
  509. height: this.tableMaxHeight+ 'px',
  510. paddingTop:'10px'
  511. }
  512. }
  513. },
  514. created() {
  515. this.startTime = Date.now()
  516. this.getList();
  517. window.onresize = () => {
  518. this.changeTableMaxHeight()
  519. }
  520. this.changeTableMaxHeight()
  521. },
  522. mounted() {
  523. window.onresize = () => {
  524. this.changeTableMaxHeight()
  525. }
  526. this.changeTableMaxHeight()
  527. },
  528. beforeRouteLeave(to, from, next) {
  529. let stayTime = Date.now() - this.startTime
  530. let nsd={'staffTime':this.convertMillisecondsToMinutes(stayTime)}
  531. staffTrainTimere(nsd).then(response => {
  532. // console.log(4)
  533. next()
  534. });
  535. console.log(`停留时间:${stayTime}ms`)
  536. },
  537. beforeDestroy() {
  538. if (this.player) {
  539. this.player.dispose()
  540. }
  541. },
  542. methods: {
  543. convertMillisecondsToMinutes(milliseconds) {
  544. if (milliseconds) {
  545. var minutes = Math.floor(milliseconds / 60000);
  546. if(minutes == 0){
  547. minutes = 0
  548. }
  549. // console.log(minutes)
  550. // this.minToHm(minutes)
  551. return minutes;
  552. }
  553. },
  554. minToHm(min) {
  555. let h = Math.floor(min / 60);
  556. let m = min % 60;
  557. let hDisplay = h ? `${h}小时` : '';
  558. let mDisplay = m ? `${m}分钟` : '';
  559. console.log(`${hDisplay}${mDisplay}`.trim())
  560. return `${hDisplay}${mDisplay}`.trim();
  561. },
  562. /** 查询岗位列表 */
  563. getList() {
  564. this.loading = true;
  565. this.isshoe = false
  566. listManual(this.queryParams).then(response => {
  567. this.manualList = response.rows;
  568. this.manualList.filter(rou=>{
  569. rou.isnum = false
  570. })
  571. this.isshoe = true
  572. if(this.activeName == '2'){
  573. this.getge(this.manualList )
  574. }
  575. this.total = response.total;
  576. this.loading = false;
  577. });
  578. },
  579. getge(valy){
  580.   this.$nextTick(() => {
  581.        setTimeout(() => {
  582. for(var i =0; i < valy.length;i++){
  583. let du = document.getElementById("myVideo" + (i+1)) //获取组件下的video
  584.        var hour = parseInt((du.duration) / 3600);
  585.        var minute = parseInt((du.duration % 3600) / 60);
  586.        var second = parseInt(du.duration % 60);
  587.        let result = ''
  588.        if (hour > 0) {
  589.        result = this.formatTimeStr(hour) + ':' + this.formatTimeStr(minute) + ':' + this
  590.        .formatTimeStr(second)
  591.                  } else {
  592.                     result = this.formatTimeStr(minute) + ':' + 
  593.                   this.formatTimeStr(second)
  594.                   }
  595. this.isshoe = false
  596. valy[i].result = result
  597. this.isshoe = true
  598. console.log(valy[i],result,du)
  599. //                   return result //转化成分,秒
  600. }
  601.                 }, 1200)
  602.               })
  603. },
  604. formatTimeStr(val) {
  605.         if (val > 9) {
  606.           return val
  607.         } else {
  608.           return '0' + val
  609.         }
  610.       },
  611. // 取消按钮
  612. cancel() {
  613. this.open = false;
  614. this.reset();
  615. },
  616. // 表单重置
  617. reset() {
  618. this.form = {
  619. manualId: null,
  620. manualTitle: null,
  621. manualType: null,
  622. manualContent: null,
  623. status: null,
  624. publishTime: null,
  625. videoUrl: null,
  626. coverImage: null,
  627. author: null,
  628. source: null,
  629. viewCount: null,
  630. isTop: null,
  631. createBy: null,
  632. createTime: null,
  633. updateBy: null,
  634. updateTime: null,
  635. remark: null
  636. };
  637. this.resetForm("form");
  638. },
  639. /** 搜索按钮操作 */
  640. handleQuery() {
  641. this.queryParams.pageNum = 1;
  642. if(this.queryParams.manualType != null && this.queryParams.manualType!=''){
  643. this.activeName = this.queryParams.manualType
  644. }
  645. this.getList();
  646. },
  647. /** 重置按钮操作 */
  648. resetQuery() {
  649. this.resetForm("queryForm");
  650. this.handleQuery();
  651. },
  652. // 多选框选中数据
  653. handleSelectionChange(selection) {
  654. this.ids = selection.map(item => item.manualId)
  655. this.single = selection.length!=1
  656. this.multiple = !selection.length
  657. },
  658. /** 新增按钮操作 */
  659. handleAdd() {
  660. this.reset();
  661. this.open = true;
  662. this.title = "添加培训手册";
  663. this.isredw = true;
  664. },
  665. /** 修改按钮操作 */
  666. handleUpdate(row) {
  667. this.reset();
  668. const manualId = row.manualId || this.ids
  669. getManual(manualId).then(response => {
  670. this.form = response.data;
  671. this.open = true;
  672. this.isredw = true;
  673. this.title = "修改员工培训手册";
  674. });
  675. },
  676. /** 修改按钮操作 */
  677. handleUpdateg(row) {
  678. this.reset();
  679. const manualId = row.manualId
  680. getManual(manualId).then(response => {
  681. this.form = response.data;
  682. this.open = true;
  683. this.isredw = true;
  684. this.title = "员工培训手册";
  685. });
  686. },
  687. handleUpdategg(row){
  688. this.reset();
  689. const manualId = row.manualId || this.ids
  690. getManual(manualId).then(response => {
  691. this.form = response.data;
  692. this.open = true;
  693. this.isredw = false;
  694. this.title = "员工培训手册";
  695. });
  696. },
  697. // 阅读视频人员
  698. handleUpdategy(row){
  699. this.openyy = true
  700. this.formy.createTime = null
  701. let sngs={'manualId':this.manid,'searchValue':null,'createTime':null}
  702. this.isrestwo(sngs)
  703. },
  704. /** 提交按钮 */
  705. submitForm: function() {
  706. this.$refs["form"].validate(valid => {
  707. if (valid) {
  708. if(this.activeName == 2){
  709. if(this.form.videoUrl == null || this.form.videoUrl == ''){
  710. this.$message.error('请上传视频');
  711. return false
  712. }
  713. }
  714. if (this.form.manualId != undefined) {
  715. updateManual(this.form).then(response => {
  716. this.$modal.msgSuccess("修改成功");
  717. this.open = false;
  718. this.getList();
  719. });
  720. } else {
  721. this.form.manualType = this.activeName
  722. addManual(this.form).then(response => {
  723. this.$modal.msgSuccess("新增成功");
  724. this.open = false;
  725. this.getList();
  726. });
  727. }
  728. }
  729. });
  730. },
  731. /** 删除按钮操作 */
  732. handleDelete(row) {
  733. const manualIds = row.manualId || this.ids;
  734. this.$modal.confirm('是否确认删除员工培训手册编号为"' + manualIds + '"的数据项?').then(function() {
  735. return delManual(manualIds);
  736. }).then(() => {
  737. this.getList();
  738. this.$modal.msgSuccess("删除成功");
  739. }).catch(() => {});
  740. },
  741. /** 导出按钮操作 */
  742. handleExport() {
  743. this.download('wuYe/manual/export', {
  744. ...this.queryParams
  745. }, `post_${new Date().getTime()}.xlsx`)
  746. },
  747. handleClick(tab, event){
  748. this.queryParams.manualType = tab.name
  749. this.form.manualType = this.activeName
  750. this.queryParams.pageNum = 1;
  751. this.ids = []
  752. this.getList()
  753. console.log(tab.name, event,this.activeName);
  754. },
  755. isac(val){
  756. console.log(5,val)
  757. val.isnum = !val.isnum
  758. this.isshoe = false
  759. this.isshoe = true
  760. let nhde = []
  761. let nsg = ''
  762. this.manualList.filter(rou=>{
  763. if(rou.isnum == true){
  764. nhde.push(rou.manualId)
  765. }
  766. })
  767. if(nhde.length == 1){
  768. this.manualList.filter(rou=>{
  769. if(rou.isnum == true){
  770. console.log(rou.manualId)
  771. this.manid = rou.manualId
  772. console.log(this.manid)
  773. }
  774. })
  775. this.singleg = false
  776. }else{
  777. // this.manid = row.
  778. this.singleg = true
  779. }
  780. },
  781. isyur(row){
  782. this.openyy = true
  783. this.manid = row.manualId
  784. let sngs={'manualId':row.manualId,'searchValue':null,'createTime':null}
  785. this.isrestwo(sngs)
  786. },
  787. handleQueryy(){
  788. this.formy.manualId = this.manid
  789. if(this.formy.createTime != null && this.formy.createTime !=''){
  790. this.formy.createTime = this.formy.createTime+ ' ' + '00:00:00'
  791. }
  792. this.isrestwo(this.formy)
  793. },
  794. isrestwo(row){
  795. getRead(row).then(response => {
  796. this.getreadList = response.data
  797. });
  798. },
  799. isrestwotim(row){
  800. staffTrainTime(this.formys).then(response => {
  801. this.staffTrainTimeList = response.rows
  802. this.staffTrainTimeList.filter(rou=>{
  803. rou.time = this.minToHm(rou.staffTime)
  804. })
  805. });
  806. },
  807. // 阅读时长
  808. handleExportyd(){
  809. this.openyys = true
  810. this.yutim = true
  811. this.isrestwotim()
  812. },
  813. // 点击阅读时长排序
  814. yuretimecl(){
  815. this.yutim = !this.yutim
  816. this.staffTrainTimeList = this.staffTrainTimeList.reverse()
  817. },
  818. handleQueryytime(){
  819. this.isrestwotim()
  820. },
  821. handleDeleteg() {
  822. let nhde = []
  823. let nsg = ''
  824. this.manualList.filter(rou=>{
  825. if(rou.isnum == true){
  826. nhde.push(rou.manualId)
  827. }
  828. })
  829. console.log(nhde)
  830. nsg = nhde.join(',')
  831. // return
  832. this.$modal.confirm('是否确认删除数据项?').then(function() {
  833. return delManual(nsg);
  834. }).then(() => {
  835. this.getList();
  836. this.$modal.msgSuccess("删除成功");
  837. }).catch(() => {});
  838. },
  839. videoPlay(val){
  840. getManual(val.manualId).then(response => {
  841. });
  842. },
  843. // 获取屏幕高度
  844. showFilterForm () {
  845. this.filterActive = !this.filterActive
  846. this.changeTableMaxHeight()
  847. },
  848. changeTableMaxHeight () {
  849. let height = document.body.offsetHeight // 网页可视区域高度
  850. // if (this.filterActive) {
  851. // this.tableMaxHeight = height - 320
  852. // } else {
  853. this.tableMaxHeight = height - 150
  854. // }
  855. console.log(height)
  856. }
  857. }
  858. };
  859. </script>
  860. <style lang="scss">
  861. .nghsey{
  862. .el-dialog__body{
  863. padding: 0;
  864. background-color: #F2F3FD;
  865. }
  866. }
  867. .butt{
  868. .el-button--small{
  869. padding: 9px 23px !important;
  870. font-size: 14px;
  871. }
  872. }
  873. .casr{
  874. .el-tabs__item.is-active{
  875. color: #196CFF;
  876. }
  877. .el-tabs--card > .el-tabs__header .el-tabs__item{
  878. padding: 0 30px !important;
  879. }
  880. }
  881. .el-table .el-table__header-wrapper th{
  882. background-color:#F5F6F8;
  883. color:#343434;
  884. }
  885. .el-table{
  886. color:#343434;
  887. }
  888. </style>
  889. <style scoped lang="scss">
  890. .goe{
  891. p{
  892. margin: 0;
  893. font-weight: 800;
  894. font-size: 16px;
  895. color: #161616;
  896. margin-top: 10px;
  897. margin-bottom: 3px;
  898. padding: 0 10px;
  899. overflow: hidden;
  900. text-overflow: ellipsis;
  901. display:-webkit-box; //作为弹性伸缩盒子模型显示。
  902. -webkit-box-orient:vertical; //设置伸缩盒子的子元素排列方式--从上到下垂直排列
  903. -webkit-line-clamp:1; //显示的行
  904. }
  905. p:nth-child(2){
  906. // margin-bottom: 10px;
  907. margin-top: 0;
  908. font-weight: 400;
  909. font-size: 14px;
  910. color: #AAAAAA;
  911. display: flex;
  912. justify-content: space-between;
  913. align-items: center;
  914. padding-bottom: 10px;
  915. span:nth-child(2){
  916. padding: 3px 5px;
  917. background: #EDEDED;
  918. border-radius: 10px;
  919. }
  920. }
  921. }
  922. .ingwe{
  923. border: 2px solid #196CFF;
  924. }
  925. </style>