index.vue 68 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771
  1. <template>
  2. <div class="app-container barchart">
  3. <!-- 搜索栏 -->
  4. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
  5. <el-form-item label="课程内容" prop="plantName">
  6. <el-input
  7. v-model="queryParams.plantName"
  8. placeholder="请输入课程内容"
  9. clearable
  10. size="small"
  11. @input="handleQuery"
  12. />
  13. </el-form-item>
  14. <el-form-item label="开始日期" prop="startDate">
  15. <el-date-picker clearable size="small" style="width: 200px"
  16. v-model="queryParams.startDate"
  17. @change="handleQuery"
  18. type="date"
  19. value-format="yyyy-MM-dd"
  20. placeholder="选择开始日期">
  21. </el-date-picker>
  22. </el-form-item>
  23. <el-form-item label="结束日期" prop="endDate">
  24. <el-date-picker clearable size="small" style="width: 200px"
  25. v-model="queryParams.endDate"
  26. @change="handleQuery"
  27. type="date"
  28. value-format="yyyy-MM-dd"
  29. placeholder="选择结束日期">
  30. </el-date-picker>
  31. </el-form-item>
  32. <el-form-item :label="$t('申请状态')" prop="approveStatus">
  33. <el-select v-model="queryParams.approveStatus" @change="handleQuery" :placeholder="$t('请选择') + $t('申请状态')" clearable size="small">
  34. <el-option
  35. v-for="dict in approveStatusOptions"
  36. :key="dict.dictValue"
  37. :label="dict.dictLabel"
  38. :value="dict.dictValue"
  39. />
  40. </el-select>
  41. </el-form-item>
  42. <el-form-item>
  43. <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  44. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  45. </el-form-item>
  46. </el-form>
  47. <!-- 顶部工具栏 -->
  48. <el-row :gutter="10" class="mb8">
  49. <el-col :span="1.5">
  50. <el-button
  51. type="primary"
  52. icon="el-icon-plus"
  53. size="mini"
  54. @click="handleAdd"
  55. v-hasPermi="['spec:plan:add']"
  56. >新增</el-button>
  57. </el-col>
  58. <!-- <el-col :span="1.5">
  59. <el-button
  60. type="success"
  61. icon="el-icon-edit"
  62. size="mini"
  63. :disabled="single"
  64. @click="handleUpdate"
  65. v-hasPermi="['spec:plan:edit']"
  66. >修改</el-button>
  67. </el-col>
  68. <el-col :span="1.5">
  69. <el-button
  70. type="danger"
  71. icon="el-icon-delete"
  72. size="mini"
  73. :disabled="multiple"
  74. @click="handleDelete"
  75. v-hasPermi="['spec:plan:remove']"
  76. >删除</el-button>
  77. </el-col> -->
  78. <el-col :span="1.5">
  79. <el-button
  80. type="info"
  81. icon="el-icon-upload2"
  82. size="mini"
  83. @click="handleImport"
  84. v-hasPermi="['spec:plan:edit']"
  85. >导入</el-button>
  86. </el-col>
  87. <el-col :span="1.5">
  88. <el-button
  89. type="warning"
  90. icon="el-icon-download"
  91. size="mini"
  92. @click="handleExport"
  93. v-hasPermi="['spec:plan:export']"
  94. >导出</el-button>
  95. </el-col>
  96. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  97. </el-row>
  98. <!-- 表格 -->
  99. <el-table v-loading="loading" ref="planTable" :data="planList" @selection-change="handleSelectionChange" :height="clientHeight" border :cell-style="tableCellStyle">
  100. <el-table-column type="selection" width="55" align="center" />
  101. <el-table-column label="员工" fixed="left" align="center" prop="staffName" :show-overflow-tooltip="true"/>
  102. <el-table-column label="课程内容" fixed="left" align="center" width="150" prop="plantName" :show-overflow-tooltip="true"/>
  103. <el-table-column label="开始日期" width="90" fixed="left" align="center" prop="startDate">
  104. <template slot-scope="scope">
  105. <span>{{ parseTime(scope.row.startDate, '{y}-{m}-{d}') }}</span>
  106. </template>
  107. </el-table-column>
  108. <el-table-column label="结束日期" width="90" fixed="left" align="center" prop="endDate">
  109. <template slot-scope="scope">
  110. <span>{{ parseTime(scope.row.endDate, '{y}-{m}-{d}') }}</span>
  111. </template>
  112. </el-table-column>
  113. <el-table-column label="实际完成日期" width="105" align="center" prop="dateOfCompletion">
  114. <template slot-scope="scope">
  115. <span>{{ parseTime(scope.row.dateOfCompletion, '{y}-{m}-{d}') }}</span>
  116. </template>
  117. </el-table-column>
  118. <el-table-column label="具体内容" align="center" width="200" prop="classContent" :show-overflow-tooltip="true"/>
  119. <el-table-column label="学习状态" align="center" prop="studyState" :formatter="studyStateFormat"/>
  120. <el-table-column :label="$t('申请状态')" align="center" prop="approveStatus"
  121. :show-overflow-tooltip="true">
  122. <template slot-scope="scope">
  123. <el-tag
  124. :type="approveStatusType(scope.row.approveStatus)"
  125. disable-transitions>{{approveStatusFormat(scope.row)}}</el-tag>
  126. </template>
  127. </el-table-column>
  128. <el-table-column label="创建人" align="center" prop="createBy" :show-overflow-tooltip="true"/>
  129. <el-table-column label="创建时间" align="center" prop="createdate" width="130">
  130. <template slot-scope="scope">
  131. <span>{{ parseTime(scope.row.createdate, '{y}-{m}-{d} {h}:{i}') }}</span>
  132. </template>
  133. </el-table-column>
  134. <el-table-column label="修改人" align="center" prop="updateBy" :show-overflow-tooltip="true"/>
  135. <el-table-column label="修改时间" align="center" prop="updatedate" width="130">
  136. <template slot-scope="scope">
  137. <span>{{ parseTime(scope.row.updatedate, '{y}-{m}-{d} {h}:{i}') }}</span>
  138. </template>
  139. </el-table-column>
  140. <!-- 渲染时间(年|月) -->
  141. <el-table-column
  142. v-if="IsShowyear"
  143. v-for="(item, index) in showMonths"
  144. :label="item.year"
  145. prop="showMonths"
  146. align="center"
  147. :key="index"
  148. >
  149. <el-table-column
  150. v-for="(it, index1) in item.months"
  151. :label="it.str"
  152. prop="str"
  153. min-width="50"
  154. style="padding: 0; margin: 0;"
  155. align="center"
  156. :key="index1"
  157. >
  158. <template slot-scope="scope" class="progressCon">
  159. <div v-if="getCellDateWidth > 0">
  160. <div
  161. v-if="index === 0 && index1 === 0 && scope.$index % 2 === 0"
  162. class="progressUpon"
  163. :style="{width:optimizeCalcWidth(scope.row),left:optimizeCalcLeft(scope.row)}"
  164. ></div>
  165. <div
  166. v-else-if="index === 0 && index1 === 0 && scope.$index % 2 !== 0"
  167. class="progressDownon"
  168. :style="{width:optimizeCalcWidth(scope.row),left:optimizeCalcLeft(scope.row)}"
  169. ></div>
  170. </div>
  171. <div v-else>
  172. <div
  173. v-if="scope.$index % 2 === 0"
  174. :class="scope.row.beginTimeStamp <= it.endTimeStamp && scope.row.endTimeStamp >= it.beginTimeStamp ? 'progressUpon' : '' "
  175. :style="{width:scope.row.beginTimeStamp <= it.endTimeStamp && scope.row.endTimeStamp >= it.beginTimeStamp ? calcwidth(scope.row,it) : '0px',left:scope.row.beginTimeStamp <= it.endTimeStamp && scope.row.endTimeStamp >= it.beginTimeStamp ? calcLeft(scope.row,it) : '0px'}"
  176. ></div>
  177. <div v-else
  178. :class="scope.row.beginTimeStamp <= it.endTimeStamp && scope.row.endTimeStamp >= it.beginTimeStamp ? 'progressDownon' : '' "
  179. :style="{width:scope.row.beginTimeStamp <= it.endTimeStamp && scope.row.endTimeStamp >= it.beginTimeStamp ? calcwidth(scope.row,it) : '0px',left:scope.row.beginTimeStamp <= it.endTimeStamp && scope.row.endTimeStamp >= it.beginTimeStamp ? calcLeft(scope.row,it) : '0px'}"
  180. ></div>
  181. </div>
  182. </template>
  183. </el-table-column>
  184. </el-table-column>
  185. <el-table-column label="操作" align="center" fixed="right" class-name="small-padding fixed-width" width="400">
  186. <template slot-scope="scope">
  187. <el-button
  188. size="mini"
  189. type="text"
  190. icon="el-icon-chat-dot-round"
  191. @click="handleFeedback(scope.row)"
  192. v-hasPermi="['spec:plan:edit']"
  193. >反馈</el-button>
  194. <el-button
  195. size="mini"
  196. type="text"
  197. icon="el-icon-document"
  198. @click="handleDocSuccessor(scope.row)"
  199. v-hasPermi="['spec:plan:edit']"
  200. >学员附件</el-button>
  201. <el-button
  202. size="mini"
  203. type="text"
  204. icon="el-icon-document"
  205. @click="handleDocMentor(scope.row)"
  206. v-hasPermi="['spec:plan:edit']"
  207. >学习资料</el-button>
  208. <el-button
  209. v-if="scope.row.editFlag != 0"
  210. size="mini"
  211. type="text"
  212. icon="el-icon-edit"
  213. @click="handleUpdate(scope.row)"
  214. v-hasPermi="['spec:plan:edit']"
  215. >修改</el-button>
  216. <el-button
  217. v-if="scope.row.editFlag != 0"
  218. size="mini"
  219. type="text"
  220. icon="el-icon-delete"
  221. @click="handleDelete(scope.row)"
  222. v-hasPermi="['spec:plan:remove']"
  223. >删除</el-button>
  224. </template>
  225. </el-table-column>
  226. </el-table>
  227. <!-- 分页 -->
  228. <pagination
  229. v-show="total>0"
  230. :total="total"
  231. :page.sync="queryParams.pageNum"
  232. :limit.sync="queryParams.pageSize"
  233. @pagination="getList"
  234. />
  235. <!-- 添加或修改培训计划对话框 -->
  236. <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
  237. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  238. <el-form-item label="员工" prop="staffId" >
  239. <el-select v-model="form.staffId" placeholder="请选择学员" disabled>
  240. <el-option
  241. v-for="successor in successorOptions"
  242. :key="successor.key"
  243. :label="successor.value"
  244. :value="successor.key"
  245. ></el-option>
  246. </el-select>
  247. </el-form-item>
  248. <el-form-item label="课程内容" prop="plantName">
  249. <el-input v-model="form.plantName" placeholder="请输入课程内容" />
  250. </el-form-item>
  251. <el-form-item label="开始日期" prop="startDate">
  252. <el-date-picker clearable size="small" style="width: 220px"
  253. v-model="form.startDate"
  254. type="date"
  255. value-format="yyyy-MM-dd"
  256. placeholder="选择开始日期"
  257. :picker-options="pickerOptionsStartDate">
  258. </el-date-picker>
  259. </el-form-item>
  260. <el-form-item label="结束日期" prop="endDate">
  261. <el-date-picker clearable size="small" style="width: 220px"
  262. v-model="form.endDate"
  263. type="date"
  264. value-format="yyyy-MM-dd"
  265. placeholder="选择结束日期"
  266. :picker-options="pickerOptionsEndDate">
  267. </el-date-picker>
  268. </el-form-item>
  269. <el-form-item label="具体内容">
  270. <el-input
  271. type="textarea"
  272. :rows="6"
  273. placeholder="请输入内容"
  274. v-model="form.classContent">
  275. </el-input>
  276. </el-form-item>
  277. </el-form>
  278. <div slot="footer" class="dialog-footer">
  279. <el-button type="primary" @click="submitForm">确 定</el-button>
  280. <el-button @click="cancel">取 消</el-button>
  281. </div>
  282. </el-dialog>
  283. <!-- 用户导入对话框 -->
  284. <el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
  285. <el-upload
  286. ref="upload"
  287. :limit="1"
  288. accept=".xlsx, .xls"
  289. :headers="upload.headers"
  290. :action="upload.url + '?updateSupport=' + upload.updateSupport + '&yearPlanId=' + queryParams.yearPlanId"
  291. :disabled="upload.isUploading"
  292. :on-progress="handleFileUploadProgress"
  293. :on-success="handleFileSuccess"
  294. :auto-upload="false"
  295. drag
  296. >
  297. <i class="el-icon-upload"></i>
  298. <div class="el-upload__text">
  299. 将文件拖到此处,或
  300. <em>点击上传</em>
  301. </div>
  302. <div class="el-upload__tip" slot="tip">
  303. <el-checkbox v-model="upload.updateSupport" />是否更新已经存在的用户数据
  304. <el-link type="info" style="font-size:12px" @click="importTemplate">下载模板</el-link>
  305. </div>
  306. <div class="el-upload__tip" style="color:red" slot="tip">提示:仅允许导入“xls”或“xlsx”格式文件!</div>
  307. </el-upload>
  308. <div slot="footer" class="dialog-footer">
  309. <el-button type="primary" @click="submitFileForm">确 定</el-button>
  310. <el-button @click="upload.open = false">取 消</el-button>
  311. </div>
  312. </el-dialog>
  313. <!-- 学习资料对话框 -->
  314. <el-dialog v-dialogDrag :title="docMentor.title" :visible.sync="docMentor.open" width="700px" append-to-body>
  315. <el-upload
  316. ref="docMentor"
  317. :limit="50"
  318. :headers="docMentor.headers"
  319. :action="docMentor.url + '?pType=' + docMentor.pType + '&pId=' + docMentor.pId"
  320. :disabled="docMentor.isUploading"
  321. :on-progress="handleFileDocProgressMentor"
  322. :on-success="handleFileDocSuccessMentor"
  323. :auto-upload="true"
  324. drag
  325. >
  326. <i class="el-icon-upload"></i>
  327. <div class="el-upload__text">
  328. {{ $t('将文件拖到此处,或') }}
  329. <em>{{ $t('点击上传') }}</em>
  330. </div>
  331. </el-upload>
  332. <el-table :data="docMentor.commonfileList" border>
  333. <el-table-column :label="$t('文件名')" align="center" prop="fileName" :show-overflow-tooltip="true">
  334. <template slot-scope="scope">
  335. <a class="link-type" @click="handleDownload(scope.row)">
  336. <span>{{ scope.row.fileName }}</span>
  337. </a>
  338. </template>
  339. </el-table-column>
  340. <el-table-column :label="$t('大小(Kb)')" align="center" prop="fileSize" :show-overflow-tooltip="true" width="80" />
  341. <el-table-column :label="$t('上传人')" align="center" prop="creator" :show-overflow-tooltip="true" width="120"/>
  342. <el-table-column :label="$t('操作')" align="center" width="120" class-name="small-padding fixed-width">
  343. <template slot-scope="scope">
  344. <el-button
  345. v-if="scope.row.fileName.endsWith('pdf')||scope.row.fileName.endsWith('xlsx')||scope.row.fileName.endsWith('md')
  346. ||scope.row.fileName.endsWith('docx')||scope.row.fileName.endsWith('doc')||scope.row.fileName.endsWith('txt')
  347. ||scope.row.fileName.endsWith('jpg')||scope.row.fileName.endsWith('png')||scope.row.fileName.endsWith('csv')
  348. ||scope.row.fileName.endsWith('mp4')||scope.row.fileName.endsWith('svg')||scope.row.fileName.endsWith('dwg')
  349. ||scope.row.fileName.endsWith('flv')||scope.row.fileName.endsWith('swf')||scope.row.fileName.endsWith('gif')
  350. ||scope.row.fileName.endsWith('3gp')||scope.row.fileName.endsWith('mkv')||scope.row.fileName.endsWith('tif')"
  351. size="mini"
  352. type="text"
  353. icon="el-icon-view"
  354. @click="handleSee(scope.row)"
  355. > {{ $t('预览') }}</el-button>
  356. <el-button
  357. v-if="scope.row.fileName.endsWith('ppt')||scope.row.fileName.endsWith('pptx') "
  358. size="mini"
  359. type="text"
  360. icon="el-icon-view"
  361. @click="handleSeePPT(scope.row)"
  362. > {{ $t('ppt预览') }}</el-button>
  363. <el-button
  364. size="mini"
  365. type="text"
  366. icon="el-icon-download"
  367. @click="handleDownload(scope.row)"
  368. >{{ $t('下载') }}</el-button>
  369. <el-button
  370. size="mini"
  371. type="text"
  372. icon="el-icon-delete"
  373. @click="handleDeleteDoc(scope.row)"
  374. >{{ $t('删除') }}</el-button>
  375. </template>
  376. </el-table-column>
  377. </el-table>
  378. <div slot="footer" class="dialog-footer">
  379. <el-button @click="docMentor.open = false">{{ $t('返 回') }}</el-button>
  380. </div>
  381. </el-dialog>
  382. <!-- 学员附件对话框 -->
  383. <el-dialog v-dialogDrag :title="docSuccessor.title" :visible.sync="docSuccessor.open" width="700px" append-to-body>
  384. <el-table :data="docSuccessor.commonfileList" border>
  385. <el-table-column :label="$t('文件名')" align="center" prop="fileName" :show-overflow-tooltip="true">
  386. <template slot-scope="scope">
  387. <a class="link-type" @click="handleDownload(scope.row)">
  388. <span>{{ scope.row.fileName }}</span>
  389. </a>
  390. </template>
  391. </el-table-column>
  392. <el-table-column :label="$t('大小(Kb)')" align="center" prop="fileSize" :show-overflow-tooltip="true" width="80" />
  393. <el-table-column :label="$t('上传人')" align="center" prop="creator" :show-overflow-tooltip="true" width="120"/>
  394. <el-table-column :label="$t('操作')" align="center" width="120" class-name="small-padding fixed-width">
  395. <template slot-scope="scope">
  396. <el-button
  397. v-if="scope.row.fileName.endsWith('pdf')||scope.row.fileName.endsWith('xlsx')||scope.row.fileName.endsWith('md')
  398. ||scope.row.fileName.endsWith('docx')||scope.row.fileName.endsWith('doc')||scope.row.fileName.endsWith('txt')
  399. ||scope.row.fileName.endsWith('jpg')||scope.row.fileName.endsWith('png')||scope.row.fileName.endsWith('csv')
  400. ||scope.row.fileName.endsWith('mp4')||scope.row.fileName.endsWith('svg')||scope.row.fileName.endsWith('dwg')
  401. ||scope.row.fileName.endsWith('flv')||scope.row.fileName.endsWith('swf')||scope.row.fileName.endsWith('gif')
  402. ||scope.row.fileName.endsWith('3gp')||scope.row.fileName.endsWith('mkv')||scope.row.fileName.endsWith('tif')"
  403. size="mini"
  404. type="text"
  405. icon="el-icon-view"
  406. @click="handleSee(scope.row)"
  407. > {{ $t('预览') }}</el-button>
  408. <el-button
  409. v-if="scope.row.fileName.endsWith('ppt')||scope.row.fileName.endsWith('pptx') "
  410. size="mini"
  411. type="text"
  412. icon="el-icon-view"
  413. @click="handleSeePPT(scope.row)"
  414. > {{ $t('ppt预览') }}</el-button>
  415. <el-button
  416. size="mini"
  417. type="text"
  418. icon="el-icon-download"
  419. @click="handleDownload(scope.row)"
  420. >{{ $t('下载') }}</el-button>
  421. <el-button
  422. size="mini"
  423. type="text"
  424. icon="el-icon-delete"
  425. @click="handleDeleteDoc(scope.row)"
  426. >{{ $t('删除') }}</el-button>
  427. </template>
  428. </el-table-column>
  429. </el-table>
  430. <div slot="footer" class="dialog-footer">
  431. <el-button @click="docSuccessor.open = false">{{ $t('返 回') }}</el-button>
  432. </div>
  433. </el-dialog>
  434. <!-- 反馈对话框 -->
  435. <el-dialog v-dialogDrag :title="feedbackDialog.title" :visible.sync="feedbackDialog.open" width="800px" append-to-body>
  436. <div style="width:700px; margin:0px auto;">
  437. <div v-if="feedbackDialog.studyState != 0">
  438. <h3 style="margin-bottom:20px;">学员心得</h3>
  439. <el-table :data="tableData" border style="width: 100%">
  440. <el-table-column prop="id" label="编号" width="50"></el-table-column>
  441. <el-table-column prop="question" label="问题" width="250"></el-table-column>
  442. <el-table-column prop="answer" label="答案"></el-table-column>
  443. </el-table>
  444. <el-table :data="docFeedback.commonfileList" border>
  445. <el-table-column :label="$t('文件名')" align="center" prop="fileName" :show-overflow-tooltip="true">
  446. <template slot-scope="scope">
  447. <a class="link-type" @click="handleDownload(scope.row)">
  448. <span>{{ scope.row.fileName }}</span>
  449. </a>
  450. </template>
  451. </el-table-column>
  452. <el-table-column :label="$t('大小(Kb)')" align="center" prop="fileSize" :show-overflow-tooltip="true" width="80" />
  453. <el-table-column :label="$t('上传人')" align="center" prop="creator" :show-overflow-tooltip="true" width="120"/>
  454. <el-table-column :label="$t('操作')" align="center" width="120" class-name="small-padding fixed-width">
  455. <template slot-scope="scope">
  456. <el-button
  457. v-if="scope.row.fileName.endsWith('pdf')||scope.row.fileName.endsWith('xlsx')||scope.row.fileName.endsWith('md')
  458. ||scope.row.fileName.endsWith('docx')||scope.row.fileName.endsWith('doc')||scope.row.fileName.endsWith('txt')
  459. ||scope.row.fileName.endsWith('jpg')||scope.row.fileName.endsWith('png')||scope.row.fileName.endsWith('csv')
  460. ||scope.row.fileName.endsWith('mp4')||scope.row.fileName.endsWith('svg')||scope.row.fileName.endsWith('dwg')
  461. ||scope.row.fileName.endsWith('flv')||scope.row.fileName.endsWith('swf')||scope.row.fileName.endsWith('gif')
  462. ||scope.row.fileName.endsWith('3gp')||scope.row.fileName.endsWith('mkv')||scope.row.fileName.endsWith('tif')"
  463. size="mini"
  464. type="text"
  465. icon="el-icon-view"
  466. @click="handleSee(scope.row)"
  467. > {{ $t('预览') }}</el-button>
  468. <el-button
  469. v-if="scope.row.fileName.endsWith('ppt')||scope.row.fileName.endsWith('pptx') "
  470. size="mini"
  471. type="text"
  472. icon="el-icon-view"
  473. @click="handleSeePPT(scope.row)"
  474. > {{ $t('ppt预览') }}</el-button>
  475. <el-button
  476. size="mini"
  477. type="text"
  478. icon="el-icon-download"
  479. @click="handleDownload(scope.row)"
  480. >{{ $t('下载') }}</el-button>
  481. <el-button
  482. size="mini"
  483. type="text"
  484. icon="el-icon-delete"
  485. @click="handleDeleteDoc(scope.row)"
  486. >{{ $t('删除') }}</el-button>
  487. </template>
  488. </el-table-column>
  489. </el-table>
  490. </div>
  491. <el-form v-if="feedbackDialog.studyState == 2">
  492. <h3 style="margin-top:30px;margin-bottom:20px;">导师反馈</h3>
  493. <el-form-item>
  494. <editor v-model="feedbackParams.mentorFeedback" :min-height="192"/>
  495. </el-form-item>
  496. </el-form>
  497. <el-form v-if="mentorFeedback != null && feedbackDialog.studyState != 2">
  498. <h3 style="margin-top:30px;margin-bottom:20px;">导师反馈</h3>
  499. <el-form-item>
  500. <p v-html="mentorFeedback" style="border:1px solid #DFE6EC; overflow:scroll; height:200px;" />
  501. </el-form-item>
  502. </el-form>
  503. <div style="text-align:center;">
  504. <el-button
  505. @click="handleApprove()"
  506. type="success"
  507. size="medium"
  508. style="margin-right:25px;"
  509. v-if="feedbackDialog.studyState == 2"
  510. >
  511. {{ $t('通 过') }}
  512. </el-button>
  513. <el-button
  514. @click="handleReject()"
  515. type="danger"
  516. size="medium"
  517. v-if="feedbackDialog.studyState == 2"
  518. >
  519. {{ $t('驳 回') }}
  520. </el-button>
  521. </div>
  522. </div>
  523. </el-dialog>
  524. <!-- 预览对话框 -->
  525. <el-dialog v-loading="loadingFlash" element-loading-background="rgba(0,0,0,0.2)" v-dialogDrag :title="pdf.title" :visible.sync="pdf.open" width="1300px" :center="true" append-to-body>
  526. <div style="margin-top: -60px;float: right;margin-right: 40px;">
  527. <el-button size="mini" type="text" @click="openPdf">{{$t('新页面打开PDF')}}</el-button></div>
  528. <div style="margin-top: -30px" >
  529. <iframe id="iFrame" class="iframe-html" :src="pdf.pdfUrl" frameborder="0" width="100%" height="700px" v-if="ppt"></iframe>
  530. </div>
  531. <div style="padding: 30px; width: 100%; height: 100%;" >
  532. <el-carousel class="" ref="carousel" arrow="always" v-if="pptView"
  533. height="700px" trigger="click" :autoplay="false" indicator-position="outside">
  534. <el-carousel-item class="lun_img" v-for="item in imgs" v-bind:key="item" >
  535. <img :src="item" width="100%" height="100%" object-fit="cover" />
  536. </el-carousel-item>
  537. </el-carousel>
  538. </div>
  539. </el-dialog>
  540. <plan-approve v-if="planApproveVisible" ref="planApprove" @refreshDataList="getList"></plan-approve>
  541. </div>
  542. </template>
  543. <script>
  544. import { getFeedbackByPlanId } from "@/api/training/spec/feedback";
  545. import { addFeedback, updateFeedback } from "@/api/training/spec/feedback";
  546. import { getAnswer } from "@/api/training/spec/answer";
  547. import { getPlan, listPlanByYearId, delPlan, addPlan, updatePlan, updatePlan2, exportPlan, importTemplate } from "@/api/training/spec/plan";
  548. import { allFileList, delCommonfile } from "@/api/common/commonfile";
  549. import { treeselect } from "@/api/system/dept";
  550. import { getToken } from "@/utils/auth";
  551. import PlanApprove from "./plan-approve"
  552. import Treeselect from "@riophae/vue-treeselect";
  553. import "@riophae/vue-treeselect/dist/vue-treeselect.css";
  554. import {getYearplan} from "@/api/training/spec/yearplan";
  555. import Editor from '@/components/Editor';
  556. export default {
  557. name: "Plan",
  558. components: { Treeselect, PlanApprove, Editor },
  559. data() {
  560. return {
  561. //图片集合 打开关闭按钮 等等
  562. imgs:[],
  563. jpgList:[],
  564. ppt:false,
  565. pptView:false,
  566. loadingFlash:false,
  567. // 报告附件参数
  568. docFeedback: { // 反馈附件
  569. file: "",
  570. // 是否显示弹出层(报告附件)
  571. open: false,
  572. // 弹出层标题(报告附件)
  573. title: "",
  574. // 是否禁用上传
  575. isUploading: false,
  576. // 是否更新已经存在的用户数据
  577. updateSupport: 0,
  578. // 报告附件上传位置编号
  579. ids: 0,
  580. // 设置上传的请求头部
  581. headers: { Authorization: "Bearer " + getToken() },
  582. // 上传的地址
  583. url: process.env.VUE_APP_BASE_API + "/common/commonfile/uploadFile",
  584. commonfileList: null,
  585. queryParams: {
  586. pId: null,
  587. pType: 'docFeedback'
  588. },
  589. pType: 'docFeedback',
  590. pId: null
  591. },
  592. docMentor: { // 学习资料
  593. file: "",
  594. // 是否显示弹出层(报告附件)
  595. open: false,
  596. // 弹出层标题(报告附件)
  597. title: "",
  598. // 是否禁用上传
  599. isUploading: false,
  600. // 是否更新已经存在的用户数据
  601. updateSupport: 0,
  602. // 报告附件上传位置编号
  603. ids: 0,
  604. // 设置上传的请求头部
  605. headers: { Authorization: "Bearer " + getToken() },
  606. // 上传的地址
  607. url: process.env.VUE_APP_BASE_API + "/common/commonfile/uploadFile",
  608. commonfileList: null,
  609. queryParams: {
  610. pId: null,
  611. pType: 'docMentor'
  612. },
  613. pType: 'docMentor',
  614. pId: null
  615. },
  616. docSuccessor: { // 学员附件
  617. file: "",
  618. // 是否显示弹出层(报告附件)
  619. open: false,
  620. // 弹出层标题(报告附件)
  621. title: "",
  622. // 是否禁用上传
  623. isUploading: false,
  624. // 是否更新已经存在的用户数据
  625. updateSupport: 0,
  626. // 报告附件上传位置编号
  627. ids: 0,
  628. // 设置上传的请求头部
  629. headers: { Authorization: "Bearer " + getToken() },
  630. // 上传的地址
  631. url: process.env.VUE_APP_BASE_API + "/common/commonfile/uploadFile",
  632. commonfileList: null,
  633. queryParams: {
  634. pId: null,
  635. pType: 'docSuccessor'
  636. },
  637. pType: 'docSuccessor',
  638. pId: null
  639. },
  640. // 导师反馈内容
  641. mentorFeedback: null,
  642. // 开始日期不能跨年
  643. pickerOptionsStartDate: {
  644. disabledDate(time) {
  645. return time.getYear() != new Date().getYear();
  646. }
  647. },
  648. // 结束日期不能跨年
  649. pickerOptionsEndDate: {
  650. disabledDate(time) {
  651. return time.getYear() != new Date().getYear();
  652. }
  653. },
  654. // 反馈参数
  655. feedbackParams: {
  656. id: null,
  657. mentorFeedback: null
  658. },
  659. showMonths:[],
  660. minDay:"", // 最小日期
  661. maxDay:"", // 最大日期
  662. IsShowyear:true, // 显示年|月 、 月|日
  663. // 查看培养详情参数
  664. detail: {
  665. // 是否显示弹出层(报告附件)
  666. open: false,
  667. // 弹出层标题(报告附件)
  668. title: ""
  669. },
  670. // 反馈对话框参数
  671. feedbackDialog: {
  672. id: 0,
  673. // 是否显示弹出层(报告附件)
  674. open: false,
  675. // 弹出层标题(报告附件)
  676. title: "",
  677. // 学习状态
  678. studyState: null,
  679. // 计划id
  680. planId: null,
  681. },
  682. // 遮罩层
  683. loading: true,
  684. planApproveVisible: false,
  685. // 选中数组
  686. ids: [],
  687. dataListSelections: [],
  688. // 非单个禁用
  689. single: true,
  690. // 非多个禁用
  691. multiple: true,
  692. // 显示搜索条件
  693. showSearch: false,
  694. // 总条数
  695. total: 0,
  696. // 培养计划表格数据
  697. planList: [],
  698. // 弹出层标题
  699. title: "",
  700. // 操作
  701. operation: "",
  702. // 部门树选项
  703. deptOptions: undefined,
  704. clientHeight:300,
  705. // 是否显示弹出层
  706. open: false,
  707. // 学习状态字典
  708. studyStateOptions: [],
  709. approveStatusOptions: [],
  710. // 学员列表
  711. successorOptions: [],
  712. // 包含导师ID的查询对象
  713. queryObject: {
  714. mentorStaffId: ""
  715. },
  716. // 用户导入参数
  717. upload: {
  718. // 是否显示弹出层(用户导入)
  719. open: false,
  720. // 弹出层标题(用户导入)
  721. title: "",
  722. // 是否禁用上传
  723. isUploading: false,
  724. // 是否更新已经存在的用户数据
  725. updateSupport: 0,
  726. // 设置上传的请求头部
  727. headers: { Authorization: "Bearer " + getToken() },
  728. // 上传的地址
  729. url: process.env.VUE_APP_BASE_API + "/spec/plan/importData"
  730. },
  731. // 查询参数
  732. queryParams: {
  733. pageNum: 1,
  734. pageSize: 20,
  735. staffId: null,
  736. plantName: null,
  737. startDate: null,
  738. endDate: null,
  739. classHour: null,
  740. studyState: null,
  741. yearPlanId: null
  742. },
  743. // 表单参数
  744. form: {},
  745. // 表单校验
  746. rules: {
  747. },
  748. // pdf文件参数
  749. pdf : {
  750. title: '',
  751. pdfUrl: '',
  752. numPages: null,
  753. open: false,
  754. pageNum: 1,
  755. pageTotalNum: 1,
  756. loadedRatio: 0,
  757. },
  758. // 表格参数
  759. tableData: [],
  760. };
  761. },
  762. watch: {
  763. // 根据名称筛选部门树
  764. deptName(val) {
  765. this.$refs.tree.filter(val);
  766. }
  767. },
  768. computed:{
  769. // 获取最小日期-月开始时间戳
  770. minDayTimeStamp() {
  771. if(this.IsShowyear){
  772. return this.showMonths[0].months[0].beginTimeStamp
  773. }else{
  774. return this.showMonths[0].days[0].daysArr[0].timestamp
  775. }
  776. },
  777. // 获取最大日期时间戳
  778. maxDayTimeStamp() {
  779. let Length = this.showMonths.length // 年有多少个
  780. // 如果显示年|月 与 月|日 是不同的
  781. if(this.IsShowyear){
  782. let monthsLength = this.showMonths[Length - 1].months.length //月有多少个
  783. return this.showMonths[Length - 1].months[monthsLength - 1].endTimeStamp
  784. }else{
  785. let daysLength = this.showMonths[Length - 1].days.length
  786. let daysarrLength = this.showMonths[Length - 1].days[daysLength - 1].daysArr.length //天有多少个
  787. return this.showMonths[Length - 1].days[daysLength - 1].daysArr[daysarrLength - 1].timestamp + 86400000 //+86400000 是因为时间戳都是0点这样+1天的时间戳,就表示最晚一天的最后的时间
  788. }
  789. },
  790. // 最大日期与最小日期的时间戳差
  791. maxAndminDayTimeStamp() {
  792. return this.maxDayTimeStamp - this.minDayTimeStamp
  793. },
  794. // 获取日期单元格宽度 => 如果返回0则只用之前第一版的计算方法
  795. getCellDateWidth() {
  796. let num = 0 // 获取日期单元格数量
  797. if(this.IsShowyear){
  798. // 月数量
  799. for(let i = 0;i < this.showMonths.length;i++){
  800. num += this.showMonths[i].months.length
  801. }
  802. }else{
  803. // 天数量
  804. for(let i = 0;i < this.showMonths.length;i++){
  805. for(let j = 0;j < this.showMonths[i].days.length;j++){
  806. num += this.showMonths[i].days[j].daysArr.length
  807. }
  808. }
  809. }
  810. // 每个单元格最小30宽度
  811. let MaxWidth = window.screen.width
  812. let CellNum = MaxWidth / 30 > 0 ? MaxWidth / 30 : 0
  813. if(num >= CellNum){ // 页面宽 / 单元格最小宽度 = 最多放下的值
  814. return num * 30
  815. }else{
  816. // 单元格的值,就不能是最小值30了
  817. // 需要获取dom的宽度,在进行计算,但是dom还未渲染完成,因此这里就不考虑了,直接只用第一版的方法动态计算
  818. // TODO
  819. return 0
  820. }
  821. }
  822. },
  823. created() {
  824. //设置表格高度对应屏幕高度
  825. this.$nextTick(() => {
  826. this.clientHeight = document.body.clientHeight -250
  827. })
  828. const yearId = this.$route.params && this.$route.params.yearId;
  829. // 设置查询参数年度计划编号
  830. this.queryParams.yearPlanId = yearId;
  831. this.getList();
  832. this.getTreeselect();
  833. this.getDicts("st_study_state").then(response => {
  834. this.studyStateOptions = response.data;
  835. });
  836. this.getDicts("spec_training_approve_status").then(response => {
  837. this.approveStatusOptions = response.data;
  838. });
  839. },
  840. methods: {
  841. /** 单元格样式 */
  842. tableCellStyle (row, column, rowIndex, columnIndex) {
  843. // 超时学习突出显示
  844. if (row.column.label === "实际完成日期" && row.row.dateOfCompletion > row.row.endDate) {
  845. return "background: #FFEEEE"
  846. }
  847. // 修改过的计划突出显示
  848. if (row.column.label === "修改人" && row.row.updateBy!=null) {
  849. return "background: #FFFFDB"
  850. }
  851. if (row.column.label === "修改时间" && row.row.updatedate!=null) {
  852. return "background: #FFFFDB"
  853. }
  854. },
  855. /** 通过处理 */
  856. handleApprove() {
  857. this.feedbackParams.planId = this.feedbackDialog.planId;
  858. // 导师反馈内容,有则修改,无则新增
  859. if (this.mentorFeedback == null) {
  860. addFeedback(this.feedbackParams).then(response => {
  861. // 发邮件通知学员
  862. this.feedbackDialog.open = false;
  863. // 修改学习状态为1已完成
  864. let plan = {};
  865. plan.id = this.feedbackDialog.planId;
  866. plan.studyState = 1;
  867. plan.dateOfCompletion = new Date();
  868. updatePlan2(plan).then(response => {
  869. this.feedbackDialog.open = false;
  870. this.msgSuccess("已通过");
  871. this.getList();
  872. });
  873. });
  874. } else {
  875. updateFeedback(this.feedbackParams).then(response => {
  876. // 发邮件通知学员
  877. this.feedbackDialog.open = false;
  878. // 修改学习状态为1已完成
  879. let plan = {};
  880. // 获取计划id(修改条件)
  881. plan.id = this.feedbackDialog.planId;
  882. plan.studyState = 1;
  883. plan.dateOfCompletion = new Date();
  884. updatePlan2(plan).then(response => {
  885. this.feedbackDialog.open = false;
  886. this.msgSuccess("已通过");
  887. this.getList();
  888. });
  889. });
  890. }
  891. },
  892. /** 驳回处理 */
  893. handleReject() {
  894. this.feedbackParams.planId = this.feedbackDialog.planId;
  895. // 导师反馈内容:有则修改,无则新增
  896. if (this.mentorFeedback == null) {
  897. addFeedback(this.feedbackParams).then(response => {
  898. // 发邮件通知学员
  899. this.feedbackDialog.open = false;
  900. // 修改学习状态为3导师已反馈
  901. let plan = {};
  902. // 获取计划id(修改条件)
  903. plan.id = this.feedbackDialog.planId;
  904. plan.studyState = 3;
  905. updatePlan2(plan).then(response => {
  906. this.feedbackDialog.open = false;
  907. this.msgSuccess("已驳回");
  908. this.getList();
  909. });
  910. });
  911. } else {
  912. updateFeedback(this.feedbackParams).then(response => {
  913. // 发邮件通知学员
  914. this.feedbackDialog.open = false;
  915. // 修改学习状态为3导师已反馈
  916. let plan = {};
  917. plan.id = this.feedbackDialog.planId;
  918. plan.studyState = 3;
  919. plan.dateOfCompletion = new Date();
  920. updatePlan2(plan).then(response => {
  921. this.feedbackDialog.open = false;
  922. this.msgSuccess("已驳回");
  923. this.getList();
  924. });
  925. });
  926. }
  927. },
  928. /** 反馈处理 */
  929. handleFeedback(row) {
  930. // 加载反馈附件
  931. this.docFeedback.id = row.id;
  932. this.docFeedback.queryParams.pId = row.id
  933. this.docFeedback.pId = row.id
  934. this.getFileListFeedback()
  935. this.$nextTick(() => {
  936. this.$refs.docFeedback.clearFiles()
  937. })
  938. // 清空导师反馈内容
  939. this.feedbackParams.mentorFeedback = null;
  940. // 清空表格数据
  941. this.tableData = [];
  942. let feedback1 = {};
  943. feedback1.planId = row.id;
  944. feedback1.questionId = 1;
  945. let feedback2 = {};
  946. feedback2.planId = row.id;
  947. feedback2.questionId = 2;
  948. let feedback3 = {};
  949. feedback3.planId = row.id;
  950. feedback3.questionId = 3;
  951. let answerObj1 = {};
  952. let answerObj2 = {};
  953. let answerObj3 = {};
  954. // 获取问题和答案
  955. getAnswer(feedback1).then(response => {
  956. let data = response.data;
  957. if (data != null) {
  958. answerObj1 = { id: 1, question: data.question, answer: data.answer};
  959. }
  960. return getAnswer(feedback2);
  961. }).then(response => {
  962. let data = response.data;
  963. if (data != null) {
  964. answerObj2 = { id: 2, question: data.question, answer: data.answer};
  965. }
  966. return getAnswer(feedback3);
  967. }).then(response => {
  968. let data = response.data;
  969. if (data != null) {
  970. answerObj3 = { id: 3, question: data.question, answer: data.answer};
  971. this.tableData.push(answerObj1);
  972. this.tableData.push(answerObj2);
  973. this.tableData.push(answerObj3);
  974. }
  975. // 获取导师反馈内容
  976. return getFeedbackByPlanId(row.id);
  977. }).then(response => {
  978. if (response.data != null) {
  979. let data = response.data;
  980. this.mentorFeedback = data.mentorFeedback;
  981. this.feedbackParams.id = data.id;
  982. }
  983. this.feedbackDialog.title = row.staffName + row.plantName + "学习情况反馈";
  984. this.feedbackDialog.planId = row.id;
  985. this.feedbackDialog.studyState = row.studyState;
  986. this.feedbackDialog.open = true;
  987. });
  988. },
  989. /** 文件下载处理 */
  990. handleDownload(row) {
  991. var name = row.fileName;
  992. var url = row.fileUrl;
  993. var suffix = url.substring(url.lastIndexOf("."), url.length);
  994. const a = document.createElement('a')
  995. a.setAttribute('download', name)
  996. a.setAttribute('target', '_blank')
  997. a.setAttribute('href', process.env.VUE_APP_BASE_API + url)
  998. a.click()
  999. },
  1000. /** 报告附件按钮操作 */
  1001. handleDocMentor(row) {
  1002. this.docMentor.id = row.id;
  1003. this.docMentor.title = row.plantName + this.$t('学习资料');
  1004. this.docMentor.open = true;
  1005. this.docMentor.queryParams.pId = row.id
  1006. this.docMentor.pId = row.id
  1007. this.getFileListMentor()
  1008. this.$nextTick(() => {
  1009. this.$refs.docMentor.clearFiles()
  1010. })
  1011. },
  1012. handleDocSuccessor(row) {
  1013. this.docSuccessor.id = row.id;
  1014. this.docSuccessor.title = row.plantName + this.$t('学员附件');
  1015. this.docSuccessor.open = true;
  1016. this.docSuccessor.queryParams.pId = row.id
  1017. this.docSuccessor.pId = row.id
  1018. this.getFileListSuccessor()
  1019. this.$nextTick(() => {
  1020. this.$refs.docSuccessor.clearFiles()
  1021. })
  1022. },
  1023. getFileListMentor() {
  1024. allFileList(this.docMentor.queryParams).then(response => {
  1025. this.docMentor.commonfileList = response;
  1026. });
  1027. },
  1028. getFileListSuccessor() {
  1029. allFileList(this.docSuccessor.queryParams).then(response => {
  1030. this.docSuccessor.commonfileList = response;
  1031. });
  1032. },
  1033. getFileListFeedback() {
  1034. allFileList(this.docFeedback.queryParams).then(response => {
  1035. this.docFeedback.commonfileList = response;
  1036. });
  1037. },
  1038. /** 附件上传中处理 */
  1039. handleFileDocProgressFeedback(event, file, fileList) {
  1040. this.docFeedback.file = file;
  1041. this.docFeedback.isUploading = true;
  1042. },
  1043. handleFileDocProgressMentor(event, file, fileList) {
  1044. this.docMentor.file = file;
  1045. this.docMentor.isUploading = true;
  1046. },
  1047. handleFileDocProgressSuccessor(event, file, fileList) {
  1048. this.docSuccessor.file = file;
  1049. this.docSuccessor.isUploading = true;
  1050. },
  1051. /** 附件上传成功处理 */
  1052. handleFileDocSuccessFeedback(response, file, fileList) {
  1053. this.docMentorFeedback.isUploading = false;
  1054. this.$alert(response.msg, this.$t('导入结果'), { dangerouslyUseHTMLString: true });
  1055. this.getFileListFeedback()
  1056. },
  1057. handleFileDocSuccessMentor(response, file, fileList) {
  1058. this.docMentor.isUploading = false;
  1059. this.$alert(response.msg, this.$t('导入结果'), { dangerouslyUseHTMLString: true });
  1060. this.getFileListMentor()
  1061. },
  1062. handleFileDocSuccessSuccessor(response, file, fileList) {
  1063. this.docSuccessor.isUploading = false;
  1064. this.$alert(response.msg, this.$t('导入结果'), { dangerouslyUseHTMLString: true });
  1065. this.getFileListSuccessor()
  1066. },
  1067. /** 删除按钮操作 */
  1068. handleDeleteDoc(row) {
  1069. const ids = row.id || this.ids;
  1070. this.$confirm(this.$t('是否确认删除?'), this.$t('警告'), {
  1071. confirmButtonText: this.$t('确定'),
  1072. cancelButtonText: this.$t('取消'),
  1073. type: "warning"
  1074. }).then(function() {
  1075. return delCommonfile(ids);
  1076. }).then(() => {
  1077. this.getFileList()
  1078. this.msgSuccess(this.$t('删除成功'));
  1079. })
  1080. },
  1081. /** 查询培训计划列表 */
  1082. getList() {
  1083. this.loading = true;
  1084. listPlanByYearId(this.queryParams).then(response => {
  1085. this.planList = response.rows;
  1086. this.total = response.total;
  1087. this.setrowspans() // 设置合并
  1088. this.getChartTitle() // 渲染的信息
  1089. this.$nextTick(() => {
  1090. this.$refs.planTable.doLayout(); // 解决表格错位
  1091. });
  1092. this.loading = false;
  1093. });
  1094. },
  1095. /** 查询部门下拉树结构 */
  1096. getTreeselect() {
  1097. treeselect().then(response => {
  1098. this.deptOptions = response.data;
  1099. });
  1100. },
  1101. /** 学习状态字典翻译 */
  1102. studyStateFormat(row, column) {
  1103. return this.selectDictLabel(this.studyStateOptions, row.studyState);
  1104. },
  1105. // 申请状态字典翻译
  1106. approveStatusFormat(row, column) {
  1107. return this.selectDictLabel(this.approveStatusOptions, row.approveStatus);
  1108. },
  1109. approveStatusType (type) {
  1110. if (type == 0) {
  1111. return 'danger'
  1112. }else if (type == 1) {
  1113. return 'success'
  1114. }else if (type == 2) {
  1115. return 'danger'
  1116. }else {
  1117. return 'info'
  1118. }
  1119. },
  1120. /** 取消按钮 */
  1121. cancel() {
  1122. this.open = false;
  1123. this.reset();
  1124. },
  1125. /** 表单重置 */
  1126. reset() {
  1127. this.form = {
  1128. id: null,
  1129. staffId: null,
  1130. plantName: null,
  1131. delFlag: null,
  1132. createrCode: null,
  1133. createdate: null,
  1134. updaterCode: null,
  1135. updatedate: null,
  1136. deptId: null,
  1137. startDate: null,
  1138. endDate: null,
  1139. classHour: null,
  1140. classContent: null,
  1141. studyState: null
  1142. };
  1143. this.resetForm("form");
  1144. },
  1145. /** 搜索按钮操作 */
  1146. handleQuery() {
  1147. this.queryParams.pageNum = 1;
  1148. this.getList();
  1149. },
  1150. /** 重置按钮操作 */
  1151. resetQuery() {
  1152. this.resetForm("queryForm");
  1153. this.handleQuery();
  1154. },
  1155. /** 多选框选中数据 */
  1156. handleSelectionChange(selection) {
  1157. this.ids = selection.map(item => item.id)
  1158. this.single = selection.length!==1
  1159. this.multiple = !selection.length
  1160. this.dataListSelections = selection
  1161. },
  1162. /** 新增按钮操作 */
  1163. handleAdd() {
  1164. this.reset();
  1165. getYearplan(this.queryParams.yearPlanId).then(response => {
  1166. this.form.staffId = response.data.staffId.toString();
  1167. this.open = true;
  1168. this.title = "添加培养计划";
  1169. this.operation = "modify";
  1170. });
  1171. this.open = true;
  1172. this.title = "添加培养计划";
  1173. this.operation = "add";
  1174. },
  1175. /** 修改按钮操作 */
  1176. handleUpdate(row) {
  1177. this.reset();
  1178. const id = row.id || this.ids
  1179. getPlan(id).then(response => {
  1180. this.form = response.data;
  1181. this.open = true;
  1182. this.title = "修改培养计划";
  1183. this.operation = "modify";
  1184. });
  1185. },
  1186. /** 提交按钮 */
  1187. submitForm() {
  1188. this.$refs["form"].validate(valid => {
  1189. if (valid) {
  1190. if (this.form.id != null) {
  1191. updatePlan(this.form).then(response => {
  1192. this.msgSuccess("修改成功");
  1193. this.open = false;
  1194. this.getList();
  1195. });
  1196. } else {
  1197. // 设置表单参数年度计划编号
  1198. this.form.yearPlanId = this.queryParams.yearPlanId;
  1199. addPlan(this.form).then(response => {
  1200. this.msgSuccess("新增成功");
  1201. this.open = false;
  1202. this.getList();
  1203. });
  1204. }
  1205. }
  1206. });
  1207. },
  1208. /** 删除按钮操作 */
  1209. handleDelete(row) {
  1210. const ids = row.id || this.ids;
  1211. this.$confirm('是否确认删除?', "警告", {
  1212. confirmButtonText: "确定",
  1213. cancelButtonText: "取消",
  1214. type: "warning"
  1215. }).then(function() {
  1216. return delPlan(ids);
  1217. }).then(() => {
  1218. this.getList();
  1219. this.msgSuccess("删除成功");
  1220. })
  1221. },
  1222. /** 导出按钮操作 */
  1223. handleExport() {
  1224. const queryParams = this.queryParams;
  1225. this.$confirm('是否确认导出所有培养计划数据项?', "警告", {
  1226. confirmButtonText: "确定",
  1227. cancelButtonText: "取消",
  1228. type: "warning"
  1229. }).then(function() {
  1230. return exportPlan(queryParams);
  1231. }).then(response => {
  1232. this.download(response.msg);
  1233. })
  1234. },
  1235. /** 导入按钮操作 */
  1236. handleImport() {
  1237. this.upload.title = "导入培养计划数据";
  1238. this.upload.open = true;
  1239. },
  1240. /** 下载模板操作 */
  1241. importTemplate() {
  1242. importTemplate().then(response => {
  1243. this.download(response.msg);
  1244. });
  1245. },
  1246. /** 文件上传中处理 */
  1247. handleFileUploadProgress(event, file, fileList) {
  1248. this.upload.isUploading = true;
  1249. },
  1250. /** 文件上传成功处理 */
  1251. handleFileSuccess(response, file, fileList) {
  1252. this.upload.open = false;
  1253. this.upload.isUploading = false;
  1254. this.$refs.upload.clearFiles();
  1255. this.$alert(response.msg, "导入结果", { dangerouslyUseHTMLString: true });
  1256. this.getList();
  1257. },
  1258. /** 提交上传文件 */
  1259. submitFileForm() {
  1260. this.$refs.upload.submit();
  1261. },
  1262. addAprrove (row, type) {
  1263. var rows = row ? [row] : this.dataListSelections.map(item => {
  1264. return item
  1265. })
  1266. this.planApproveVisible = true
  1267. console.log(rows)
  1268. console.log(type)
  1269. this.$nextTick(() => {
  1270. this.$refs.planApprove.init(rows, type)
  1271. })
  1272. },
  1273. optimizeCalcWidth(val) {
  1274. let SumNum = this.maxAndminDayTimeStamp
  1275. let diffNum = this.IsShowyear ? val.endTimeStamp - val.beginTimeStamp : val.endTimeStamp + 84600000 - val.beginTimeStamp // 结束日期 - 开始日期
  1276. let rate = Math.round(diffNum / SumNum * 10000) / 100.00 //得到百分比
  1277. let widthPx = this.getCellDateWidth * rate / 100.00
  1278. return widthPx + 'px'
  1279. },
  1280. optimizeCalcLeft(val) {
  1281. let SumNum = this.maxAndminDayTimeStamp
  1282. let diffNum = val.beginTimeStamp - this.minDayTimeStamp // 开始日期 - 整个月开始日期
  1283. let rate = Math.round(diffNum / SumNum * 10000) / 100.00 //得到百分比
  1284. let leftPx = this.getCellDateWidth * rate / 100.00
  1285. return leftPx + 'px'
  1286. },
  1287. // 计算图表的Left
  1288. calcLeft(val,date) {
  1289. // 如果本月的最大时间戳都没有结束时间长,那么就可判断
  1290. if(val.endTimeStamp > date.endTimeStamp){
  1291. // 如果本月开始日期小于开始日期
  1292. if(val.beginTimeStamp > date.beginTimeStamp){
  1293. // 进行判断
  1294. let diffNum = date.endTimeStamp - val.beginTimeStamp
  1295. let SumNum = date.endTimeStamp - date.beginTimeStamp
  1296. let rate = 100 - Math.round(diffNum / SumNum * 10000) / 100.00
  1297. // 位置判断
  1298. return rate+"%"
  1299. }
  1300. }else if(val.endTimeStamp > date.beginTimeStamp && val.endTimeStamp < date.endTimeStamp){
  1301. // 进行判断
  1302. if(val.beginTimeStamp > date.beginTimeStamp){
  1303. // 都在一个单元格中
  1304. let diffNum = val.beginTimeStamp - date.beginTimeStamp
  1305. let SumNum = date.endTimeStamp - date.beginTimeStamp
  1306. let rate = Math.round(diffNum / SumNum * 10000) / 100.00
  1307. // 位置判断
  1308. return rate+"%"
  1309. }
  1310. }
  1311. return '0px'
  1312. },
  1313. // 计算图表的Width
  1314. calcwidth(val,date) {
  1315. if(this.IsShowyear){
  1316. // 如果是 年|月
  1317. // 1. 如果本月的最大时间戳都没有结束时间长,那么就可设置100%
  1318. // 2. 如果本月的最小时间戳比结束时间长,那么设置0
  1319. // 3. 如果本月的最小时间戳没有结束时间长,那么进行判断
  1320. if(val.endTimeStamp > date.endTimeStamp){
  1321. // 如果本月开始日期小于开始日期
  1322. if(val.beginTimeStamp > date.beginTimeStamp){
  1323. // 进行判断
  1324. let diffNum = date.endTimeStamp - val.beginTimeStamp
  1325. let SumNum = date.endTimeStamp - date.beginTimeStamp
  1326. let rate = Math.round(diffNum / SumNum * 10000) / 100.00
  1327. return 'calc('+ rate +'% + 2px)' // 结束时间超过本月最大时间戳直接+2px
  1328. }
  1329. return 'calc(100% + 2px)'
  1330. }else if(val.endTimeStamp < date.beginTimeStamp){
  1331. return '0px'
  1332. }else if(val.endTimeStamp > date.beginTimeStamp && val.endTimeStamp <= date.endTimeStamp){
  1333. // 进行判断
  1334. if(val.beginTimeStamp > date.beginTimeStamp){
  1335. // 都在一个单元格中
  1336. let SumNum = date.endTimeStamp - date.beginTimeStamp // 全月多少数
  1337. let diffNum = val.endTimeStamp - val.beginTimeStamp // 过程多少数
  1338. diffNum = diffNum === 0 ? 86400000 : diffNum
  1339. let rate = Math.round(diffNum / SumNum * 10000) / 100.00
  1340. return 'calc('+ rate +'%)'
  1341. }else{
  1342. // 不在一个单元格中,则不需要判断任何信息
  1343. let diffNum = val.endTimeStamp - date.beginTimeStamp
  1344. let SumNum = date.endTimeStamp - date.beginTimeStamp
  1345. let rate = Math.round(diffNum / SumNum * 10000) / 100.00
  1346. return 'calc('+ rate +'%)'
  1347. }
  1348. }
  1349. }
  1350. return '0px'
  1351. },
  1352. //获得数据相同的行数(网络复制)
  1353. objectSpanMethod({ row, column, rowIndex, columnIndex }) {
  1354. if (columnIndex === 0) {
  1355. return {
  1356. rowspan: row.rowspan,
  1357. colspan: 1
  1358. };
  1359. }
  1360. },
  1361. // 根据id去分组(网络复制)
  1362. setrowspans() {
  1363. // 先给所有的数据都加一个v.rowspan = 1
  1364. this.planList.forEach(v => {
  1365. v.rowspan = 1;
  1366. });
  1367. // 双层循环
  1368. for (let i = 0; i < this.planList.length; i++) {
  1369. // 内层循环,上面已经给所有的行都加了v.rowspan = 1
  1370. // 这里进行判断
  1371. // 如果当前行的id和下一行的id相等
  1372. // 就把当前v.rowspan + 1
  1373. // 下一行的v.rowspan - 1
  1374. for (let j = i + 1; j < this.planList.length; j++) {
  1375. //此处可根据相同字段进行合并,此处是根据的id
  1376. if (this.planList[i].id === this.planList[j].id) {
  1377. this.planList[i].rowspan++;
  1378. this.planList[j].rowspan--;
  1379. }
  1380. }
  1381. // 这里跳过已经重复的数据
  1382. i = i + this.planList[i].rowspan - 1;
  1383. }
  1384. },
  1385. // 渲染表格头,首先是年月,如2018年11月
  1386. getChartTitle(startDate, endDate){
  1387. var chartTable = this.planList;
  1388. // 准备日期,为了防止多次赋值属性,导致计算属性重新计算,决定只赋值一次
  1389. let maxDayParams = "",minDayParams = ""
  1390. for(var i = 0; i < chartTable.length; i++){
  1391. var StartDate = chartTable[i].startDate;
  1392. var EndDate = chartTable[i].endDate;
  1393. var mainObj = chartTable[i];
  1394. // 计划日期
  1395. maxDayParams === "" ? maxDayParams = EndDate : ''
  1396. minDayParams === "" ? minDayParams = StartDate : ""
  1397. maxDayParams = this.compareDate(EndDate,maxDayParams,true)
  1398. minDayParams = this.compareDate(StartDate,minDayParams,false)
  1399. var days = this.GetNumberOfDays(StartDate,EndDate) // 计算工期
  1400. this.planList[i].days = days + 1 // 加一是因为没算结算当天
  1401. // 记录时间戳
  1402. this.planList[i].beginTimeStamp = this.getTimeStamp(StartDate)
  1403. this.planList[i].endTimeStamp = this.getTimeStamp(EndDate)
  1404. }
  1405. this.minDay = minDayParams
  1406. this.maxDay = maxDayParams
  1407. console.log("小:"+this.minDay)
  1408. console.log("大:"+this.maxDay)
  1409. this.getYearArr()
  1410. console.log(this.showMonths)
  1411. },
  1412. // 获取需要的格式的年月日信息
  1413. getYearArr(){
  1414. // 如果有一个日期相差超过366天,按照年,不超过则按天
  1415. var days = this.GetNumberOfDays(this.minDay,this.maxDay)
  1416. if(days >= 365){
  1417. //需要记录月份
  1418. this.IsShowyear = true
  1419. }else{
  1420. //需要记录天数
  1421. this.IsShowyear = true
  1422. }
  1423. // 获取需要格式的年月信息
  1424. let yearArr = []; // 存年
  1425. let minYear = new Date(this.minDay).getFullYear();
  1426. let maxYear = new Date(this.maxDay).getFullYear();
  1427. // 保存年
  1428. if(minYear === maxYear){
  1429. yearArr.push({
  1430. year: minYear+"",
  1431. months: [], // 放月的数组
  1432. days: []
  1433. })
  1434. }else{
  1435. for(let i = minYear;i <= maxYear;i++){
  1436. yearArr.push({
  1437. year: i+"",
  1438. months: [], // 放月的数组
  1439. days: []
  1440. })
  1441. }
  1442. }
  1443. // 保存月
  1444. for(let i = 0;i < yearArr.length;i++){
  1445. let minMonth = 1
  1446. if(i === 0){
  1447. minMonth = new Date(this.minDay).getMonth() + 1;
  1448. }
  1449. // 1.eg:2016年9月 至 2019年01月
  1450. // 2.如果只有一个年,那么月份就是最小月到最大月
  1451. if(yearArr.length > 1){
  1452. // 如果是最后一年,那么就要判断是否到最后一个月
  1453. if(yearArr.length - 1 === i){
  1454. let maxMonth = new Date(this.maxDay).getMonth() + 1;
  1455. let _maxDay = new Date(this.maxDay).getDate() // 最大日期 天数
  1456. let j = 1
  1457. while(j <= maxMonth){
  1458. let monthsDays = this.getLastDay(yearArr[i].year, j); // 获取月份一共有多少天
  1459. let timestampstr = this.getTimeStamp(yearArr[i].year +"-"+ (j > 9 ? j : '0'+j) + "-" + monthsDays)
  1460. let timestampstr1 = this.getTimeStamp(yearArr[i].year +"-"+ (j > 9 ? j : '0'+j) + "-01")
  1461. yearArr[i].months.push({str:j+"月",num:j,endTimeStamp:timestampstr,beginTimeStamp:timestampstr1});// 记录最大最小的时间戳
  1462. // 如果显示月|天 才用记录天
  1463. if(!this.IsShowyear){
  1464. yearArr[i].days[yearArr[i].days.length] = {year: "",month: "",daysArr: {}}
  1465. yearArr[i].days[yearArr[i].days.length - 1].year = yearArr[i].year // 赋值年
  1466. yearArr[i].days[yearArr[i].days.length - 1].month = j; // 赋值月
  1467. yearArr[i].days[yearArr[i].days.length - 1].daysArr = []
  1468. // 如果结束月,不是到本月最后一天,而是截止到最
  1469. if(j === maxMonth){
  1470. monthsDays = _maxDay
  1471. }
  1472. for(let k = 1; k <= monthsDays; k++){
  1473. timestampstr = this.getTimeStamp(yearArr[i].year +"-"+ (j > 9 ? j : '0'+j) + "-" + (k > 9 ? k : '0'+k))
  1474. yearArr[i].days[yearArr[i].days.length - 1].daysArr.push({day: k+"",timestamp:timestampstr});// 赋值天
  1475. }
  1476. }
  1477. j++
  1478. }
  1479. }else{
  1480. if(i === 0){
  1481. let j = minMonth
  1482. let _minDay = new Date(this.minDay).getDate() // 最小日期 天数
  1483. while(j <= 12){
  1484. let monthsDays = this.getLastDay(yearArr[i].year, j); // 获取月份一共有多少天
  1485. let timestampstr = this.getTimeStamp(yearArr[i].year +"-"+ (j > 9 ? j : '0'+j) + "-" + monthsDays)
  1486. let timestampstr1 = this.getTimeStamp(yearArr[i].year +"-"+ (j > 9 ? j : '0'+j) + "-01")
  1487. yearArr[i].months.push({str:j+"月",num:j,endTimeStamp:timestampstr,beginTimeStamp:timestampstr1});// 记录最大最小的时间戳
  1488. // 如果显示月|天 才用记录天
  1489. if(!this.IsShowyear){
  1490. yearArr[i].days[yearArr[i].days.length] = {year: "",month: "",daysArr: {}}
  1491. yearArr[i].days[yearArr[i].days.length - 1].year = yearArr[i].year // 赋值月
  1492. yearArr[i].days[yearArr[i].days.length - 1].month = j // 赋值月
  1493. yearArr[i].days[yearArr[i].days.length - 1].daysArr = []
  1494. for(let k = 1; k <= monthsDays; k++){
  1495. // 如果开始月,就不从1日开始,而是从最开始的日期那天开始算起
  1496. if(k === 1 && j === minMonth){
  1497. k = _minDay
  1498. }
  1499. timestampstr = this.getTimeStamp(yearArr[i].year +"-"+ (j > 9 ? j : '0'+j) + "-" + (k > 9 ? k : '0'+k))
  1500. yearArr[i].days[yearArr[i].days.length - 1].daysArr.push({day: k+"",timestamp:timestampstr});// 赋值天
  1501. }
  1502. }
  1503. j++
  1504. }
  1505. }else{
  1506. let j = 1
  1507. while(j <= 12){
  1508. let monthsDays = this.getLastDay(yearArr[i].year, j); // 获取月份一共有多少天
  1509. let timestampstr = this.getTimeStamp(yearArr[i].year +"-"+ (j > 9 ? j : '0'+j) + "-" + monthsDays)
  1510. let timestampstr1 = this.getTimeStamp(yearArr[i].year +"-"+ (j > 9 ? j : '0'+j) + "-01")
  1511. yearArr[i].months.push({str:j+"月",num:j,endTimeStamp:timestampstr,beginTimeStamp:timestampstr1});// 记录最大最小的时间戳
  1512. // 如果显示月|天 才用记录天
  1513. if(!this.IsShowyear){
  1514. yearArr[i].days[yearArr[i].days.length] = {year: "",month: "",daysArr: {}}
  1515. yearArr[i].days[yearArr[i].days.length - 1].year = yearArr[i].year // 赋值年
  1516. yearArr[i].days[yearArr[i].days.length - 1].month = j // 赋值月
  1517. yearArr[i].days[yearArr[i].days.length - 1].daysArr = []
  1518. for(let k = 1; k <= monthsDays; k++){
  1519. timestampstr = this.getTimeStamp(yearArr[i].year +"-"+ (j > 9 ? j : '0'+j) + "-" + (k > 9 ? k : '0'+k))
  1520. yearArr[i].days[yearArr[i].days.length - 1].daysArr.push({day: k+"",timestamp:timestampstr});// 赋值天
  1521. }
  1522. }
  1523. j++
  1524. }
  1525. }
  1526. }
  1527. }else{
  1528. // 如果只有一年那么没有必要判断是否记录天
  1529. let maxMonth = new Date(this.maxDay).getMonth() + 1;
  1530. let _minMonth = minMonth
  1531. let _minDay = new Date(this.minDay).getDate() // 最小日期 天数
  1532. let _maxDay = new Date(this.maxDay).getDate() // 最大日期 天数
  1533. while(_minMonth <= maxMonth){
  1534. let monthsDays = this.getLastDay(yearArr[i].year, _minMonth); // 获取月份一共有多少天
  1535. let timestampstr = this.getTimeStamp(yearArr[i].year +"-"+ (_minMonth > 9 ? _minMonth : '0'+_minMonth) + "-" + monthsDays)
  1536. let timestampstr1 = this.getTimeStamp(yearArr[i].year +"-"+ (_minMonth > 9 ? _minMonth : '0'+_minMonth) + "-01")
  1537. yearArr[i].months.push({str:_minMonth+"月",num:_minMonth,endTimeStamp:timestampstr,beginTimeStamp:timestampstr1});// 记录最大最小的时间戳
  1538. yearArr[i].days[yearArr[i].days.length] = {year: "",month: "",daysArr: {}}
  1539. yearArr[i].days[yearArr[i].days.length - 1].year = yearArr[i].year // 赋值月
  1540. yearArr[i].days[yearArr[i].days.length - 1].month = _minMonth // 赋值月
  1541. yearArr[i].days[yearArr[i].days.length - 1].daysArr = []
  1542. // 如果结束月,不是到本月最后一天,而是截止到最
  1543. if(_minMonth === maxMonth){
  1544. monthsDays = _maxDay
  1545. }
  1546. for(let k = 1; k <= monthsDays; k++){
  1547. // 如果开始月,就不从1日开始,而是从最开始的日期那天开始算起
  1548. if(k === 1 && _minMonth === minMonth){
  1549. k = _minDay
  1550. }
  1551. timestampstr = this.getTimeStamp(yearArr[i].year +"-"+ (_minMonth > 9 ? _minMonth : '0'+_minMonth) + "-" + (k > 9 ? k : '0'+k))
  1552. yearArr[i].days[yearArr[i].days.length - 1].daysArr.push({day: k+"",timestamp:timestampstr});// 赋值天
  1553. }
  1554. _minMonth++
  1555. }
  1556. }
  1557. }
  1558. this.showMonths = yearArr
  1559. },
  1560. // 获取月的最后一天
  1561. getLastDay(myyear, mymonth){
  1562. var new_date = new Date(myyear, mymonth, 0);
  1563. return new_date.getDate();
  1564. },
  1565. // 获得天数
  1566. GetNumberOfDays(date1,date2){
  1567. //date1:开始日期,date2结束日期
  1568. var a1 = Date.parse(new Date(date1));
  1569. var a2 = Date.parse(new Date(date2));
  1570. var day = parseInt((a2-a1)/ 86400000);//核心:时间戳相减,然后除以天数
  1571. return day
  1572. },
  1573. // 时间比较 true 比大
  1574. compareDate(dateTime1,dateTime2,condition = true)
  1575. {
  1576. var formatDate1 = new Date(dateTime1)
  1577. var formatDate2 = new Date(dateTime2)
  1578. if(formatDate1 >= formatDate2)
  1579. {
  1580. return condition ? dateTime1 : dateTime2
  1581. }
  1582. else
  1583. {
  1584. return condition ? dateTime2 : dateTime1
  1585. }
  1586. },
  1587. // 获取时间戳
  1588. getTimeStamp(val){
  1589. return new Date(val).getTime()
  1590. },
  1591. //文件预览
  1592. openPdf(){
  1593. //ppt就跳路由预览,office就直接打开文件新页面
  1594. const didi={ imgs:this.imgs}
  1595. if( this.pptView==true&&this.ppt==false){
  1596. let routeUrl = this.$router.resolve({
  1597. path: "/cpms/index.html#/pptyulan",
  1598. query:didi
  1599. });
  1600. window.open("/cpms/index.html#/pptyulan?id=" + this.pdf.pdfUrl, '_blank')
  1601. console.log(this.imgs)
  1602. }else {
  1603. window.open(this.pdf.pdfUrl)
  1604. }
  1605. },
  1606. handleSeePPT (row){
  1607. //ppt预览
  1608. this.loadingFlash=true
  1609. this.pdf.open =true
  1610. this.pdf.title = row.fileName
  1611. this.pdf.pdfUrl = row.fileUrl
  1612. this.pptView=true
  1613. this.ppt=false
  1614. const formatDate =new FormData();
  1615. formatDate.append("filepath",row.fileUrl)
  1616. //调用文件预览api
  1617. let res= this.officeConvert.pptConvertCommon(formatDate)
  1618. //查看接受的全局方法的返回结果 console.log(res)
  1619. //利用.then方法接受Promise对象
  1620. res.then((result)=>{
  1621. //关闭加载中
  1622. this.loadingFlash=false
  1623. //成功时直接给地址
  1624. this.videoList = result.data.imagePathList
  1625. //将返回的地址集合遍历添加到绑定的数组中
  1626. this.imgs=[]
  1627. for (var key=0;key<this.videoList.length;key++) {
  1628. this.imgs.push( process.env.VUE_APP_BASE_API+ this.videoList[key] );
  1629. }
  1630. }).catch(result => {
  1631. //请求失败,关闭loading,pdf地址直接为为空,不显示
  1632. this.pdf.pdfUrl =""
  1633. this.loadingFlash = false;
  1634. })
  1635. },
  1636. handleSee (row){
  1637. //office预览
  1638. this.loadingFlash=true
  1639. this.pdf.open =true
  1640. this.pdf.title = row.fileName
  1641. this.pdf.pdfUrl =""
  1642. this.pptView=false
  1643. this.ppt=true
  1644. const formatDate =new FormData();
  1645. formatDate.append("filepath",row.fileUrl)
  1646. //调用文件预览api
  1647. let res= this.officeConvert.officeConvertCommon(formatDate)
  1648. //查看接受的全局方法的返回结果 console.log(res)
  1649. //利用.then方法接受Promise对象
  1650. res.then((result)=>{
  1651. //关闭加载中
  1652. this.loadingFlash=false
  1653. if(result.msg.includes("csv")){
  1654. this.pdf.pdfUrl =process.env.VUE_APP_BASE_API+ result.data
  1655. this.$alert(result.msg, this.$t('检查乱码'), { dangerouslyUseHTMLString: true });
  1656. // this.$message({message: result.msg, center: true,type:'warning', offset:400, });
  1657. }else if(result.msg.includes("不存在")){
  1658. //文件不存在时提示
  1659. this.pdf.pdfUrl =""
  1660. this.$alert(result.msg, this.$t('预览失败'), { dangerouslyUseHTMLString: true });
  1661. // this.$message({message: result.msg, center: true,type:'warning', offset:400, });
  1662. this.pdf.open =false
  1663. }else if(result.msg.includes("不支持此格式")){
  1664. this.pdf.pdfUrl =""
  1665. this.$alert(result.msg, this.$t('预览失败'), { dangerouslyUseHTMLString: true });
  1666. // this.$message({message: result.msg, center: true,type:'warning', offset:400, });
  1667. this.pdf.open =false
  1668. } else{
  1669. //成功时直接给地址
  1670. this.pdf.pdfUrl =process.env.VUE_APP_BASE_API+ result.data
  1671. }
  1672. // this.$nextTick(() => {
  1673. // const iframe = window.frames['iFrame']
  1674. // const handleLoad = () => {
  1675. // setTimeout(() => {
  1676. // const Do = (iframe.contentWindow || iframe.contentDocument)
  1677. // console.log(Do.document.getElementsByTagName('table')[0])
  1678. // Do.document.getElementsByTagName('table')[0].style.width = "100%"
  1679. // Do.document.getElementsByTagName('table')[0].setAttribute("class","table")
  1680. // }, 500)
  1681. // }
  1682. // iframe.addEventListener('load', handleLoad, true)
  1683. // })
  1684. }).catch(result => {
  1685. //请求失败,关闭loading,pdf地址直接为为空,不显示
  1686. this.pdf.pdfUrl =""
  1687. this.loadingFlash = false;
  1688. })
  1689. },
  1690. }
  1691. };
  1692. </script>
  1693. <style>
  1694. /* 单元格padding */
  1695. .barchart .el-table--border th:first-child .cell, .el-table--border td:first-child .cell{
  1696. padding: 0px;
  1697. }
  1698. .barchart .el-table th > .cell{
  1699. padding: 0px;
  1700. }
  1701. /* 单元格高度 */
  1702. .barchart .el-table--medium th,.barchart .el-table--medium td {
  1703. padding: 0px 0px !important;
  1704. height: 25px !important;
  1705. }
  1706. .barchart .progressCon{
  1707. padding: 0;
  1708. margin: 0;
  1709. position: relative;
  1710. }
  1711. .barchart .progressUpon{
  1712. background: rgb(38, 84, 124);
  1713. height: 1.5em;
  1714. /* width: calc(100% + 2px); // +2是因为边框线为2px*/
  1715. z-index: 2;
  1716. position: absolute;
  1717. top: 25%;
  1718. left:0px
  1719. }
  1720. .barchart .progressDownon{
  1721. background: rgb(255,209,102);
  1722. height: 1.5em;
  1723. /* width: calc(100% + 2px); // +2是因为边框线为2px*/
  1724. z-index: 2;
  1725. position: absolute;
  1726. top: 25%;
  1727. left:0px
  1728. }
  1729. </style>