index.vue 68 KB

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