index.vue 87 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468
  1. <template>
  2. <div class="cqcy-content" style="margin: 0;height: calc(100% - 70px);">
  3. <breadcrumb-view :breadcrumbList="breadcrumbList" :show-index="false"></breadcrumb-view>
  4. <div v-if="btnType === ''" class="cy-nav-sx">
  5. <el-select v-model="searchValue"
  6. style="width: 180px;"
  7. placeholder="请选择报表类型"
  8. @change="changeReportTypeEvent">
  9. <el-option v-for="item in reportOptions"
  10. style="margin-left: 5px; width: 180px;"
  11. :key="item.value"
  12. :label="item.label"
  13. :value="item.value">
  14. </el-option>
  15. </el-select>
  16. <el-input placeholder="请输入报表名称"
  17. v-model="searchTxt"
  18. style="margin-left: 5px; width: 180px;"
  19. prefix-icon="el-icon-search">
  20. </el-input>
  21. <el-button style="margin-left: 5px;" @click="searchReportEvent">查询</el-button>
  22. </div>
  23. <!-- <el-button v-if="btnType === ''" type="primary" class="cy-nav-btn" icon="el-icon-circle-plus-outline"-->
  24. <!-- size="mini" @click="addReportEvent">新增-->
  25. <!-- </el-button>-->
  26. <!-- <el-button v-if="btnType === ''" type="success" class="cy-nav-btn" icon="el-icon-refresh"-->
  27. <!-- size="mini" @click="refreshReportEvent">刷新</el-button>-->
  28. <el-divider></el-divider>
  29. <div class="cy-main">
  30. <div class="cy-main-left" v-if="!showMainView">
  31. <div class="cy-list">
  32. <el-table v-if="reportDataList.length > 0"
  33. :data="reportDataList"
  34. border
  35. :stripe="true"
  36. :header-cell-style="{background: '#E8E8E8'}"
  37. @sort-change="sortChange"
  38. style="width: 100%;">
  39. <el-table-column
  40. align="center"
  41. sortable="custom"
  42. label="报表名称"
  43. prop="reportTableName">
  44. <template slot-scope="scope">
  45. <span style="color: #409EFF; cursor: pointer;"
  46. @click="handleReportNodeClick(scope.row, scope.row.userId != uid ? 'deny' : '')"
  47. :title="scope.row.reportTableName">{{ scope.row.reportTableName }}</span>
  48. </template>
  49. </el-table-column>
  50. <el-table-column
  51. align="center"
  52. label="报表类型"
  53. prop="reportTableType"
  54. width="350">
  55. <template slot-scope="scope">
  56. <el-tag v-if="scope.row.userId != uid" type="success" style="margin-right: 5px;">被分享</el-tag>
  57. <el-tag v-if="uid == scope.row.userId && scope.row.userGroupList && scope.row.userGroupList.length > 0"
  58. type="warning" style="margin-right: 5px;">已分享
  59. </el-tag>
  60. <el-tag v-if="scope.row.reportTableType == 0" style="margin-right: 5px;">手动报表</el-tag>
  61. <el-tag v-if="scope.row.reportTableType == 1" style="margin-right: 5px;">自动报表</el-tag>
  62. <el-tag v-if="scope.row.reportTableType == 2" style="margin-right: 5px;">事件驱动报表</el-tag>
  63. </template>
  64. </el-table-column>
  65. <el-table-column
  66. align="center"
  67. label="创建时间"
  68. sortable
  69. prop="createTime"
  70. width="200">
  71. </el-table-column>
  72. <el-table-column label="操作" align="center" width="380">
  73. <template slot-scope="scope">
  74. <el-button type="text"
  75. v-if="uid == scope.row.userId"
  76. size="small"
  77. icon="el-icon-setting"
  78. @click="editReportItem(scope.row)">配置
  79. </el-button>
  80. <!-- <el-button type="text"-->
  81. <!-- v-if="uid == scope.row.userId"-->
  82. <!-- size="small"-->
  83. <!-- icon="el-icon-edit"-->
  84. <!-- @click="editReportItem(scope.row)">修改-->
  85. <!-- </el-button>-->
  86. <el-button type="text"
  87. v-if="uid == scope.row.userId && scope.row.reportTableType == 1 && scope.row.runState == 0"
  88. size="small"
  89. icon="el-icon-video-play"
  90. @click="setReportStatus(scope.row)">启动
  91. </el-button>
  92. <el-button type="text"
  93. v-if="uid == scope.row.userId && scope.row.reportTableType == 1 && scope.row.runState == 1"
  94. size="small"
  95. icon="el-icon-video-pause"
  96. @click="setReportStatus(scope.row)">停止
  97. </el-button>
  98. <el-button type="text"
  99. v-if="uid == scope.row.userId"
  100. size="small"
  101. icon="el-icon-printer"
  102. @click="setAutoPrint(scope.row)">打印
  103. </el-button>
  104. <el-button type="text"
  105. v-if="uid == scope.row.userId"
  106. size="small"
  107. icon="el-icon-user"
  108. @click="setUserGroupEvent(scope.row)">授权
  109. </el-button>
  110. <el-button type="text"
  111. v-if="uid == scope.row.userId"
  112. size="small"
  113. icon="el-icon-document"
  114. @click="getUserGroupEvent(scope.row)">授权详情
  115. </el-button>
  116. <el-button type="text"
  117. v-if="uid == scope.row.userId"
  118. size="small"
  119. icon="el-icon-delete"
  120. style="color: red;"
  121. @click="removeReportItem(scope.row)">删除
  122. </el-button>
  123. </template>
  124. </el-table-column>
  125. </el-table>
  126. <el-empty v-else description="暂无数据"></el-empty>
  127. </div>
  128. <el-pagination
  129. background
  130. @size-change="handleSizeChange"
  131. @current-change="handleCurrentChange"
  132. :current-page="reportPage"
  133. :page-size="reportLimit"
  134. layout="sizes, prev, pager, next, total"
  135. :total="reportTotal">
  136. </el-pagination>
  137. </div>
  138. <div class="cy-main-right" :style="showMainView ? '' : 'display: none;'">
  139. <el-row v-if="btnType == 'add'" style="margin: 10px 20px;">
  140. <el-button type="primary" size="mini" icon="el-icon-document" @click="saveReportInfo">保存报表</el-button>
  141. <el-button type="danger" size="mini" icon="el-icon-circle-close" @click="cancelSaveReport">取消</el-button>
  142. </el-row>
  143. <el-row v-if="btnType == 'show'" style="margin: 10px 20px;">
  144. <el-button type="success" size="mini" icon="el-icon-document-checked" @click="updateReport">保存</el-button>
  145. <el-button type="primary" size="mini" icon="el-icon-download" @click="downloadReport">下载</el-button>
  146. <el-button type="warning" size="mini" icon="el-icon-printer" @click="printExcel">打印</el-button>
  147. <el-button type="info" size="mini" icon="el-icon-document" @click="historyReport">运行记录</el-button>
  148. <el-button type="danger" size="mini" icon="el-icon-circle-close" @click="cancelSaveReport">关闭</el-button>
  149. </el-row>
  150. <el-row v-if="btnType == 'showShared'" style="margin: 10px 20px;">
  151. <el-button type="primary" size="mini" icon="el-icon-download" @click="downloadReport">下载</el-button>
  152. <el-button type="warning" size="mini" icon="el-icon-printer" @click="printExcel">打印</el-button>
  153. <el-button v-if="chooseMyReport && chooseMyReport.reportTableType != 0" type="info" size="mini"
  154. icon="el-icon-document" @click="historyReport">运行记录
  155. </el-button>
  156. <el-button type="danger" size="mini" icon="el-icon-circle-close" @click="cancelSaveReport">关闭</el-button>
  157. </el-row>
  158. <el-row v-if="btnType == 'showChild'" style="margin: 10px 20px;">
  159. <el-button type="primary" size="mini" icon="el-icon-download" @click="downloadReport">下载</el-button>
  160. <el-button type="warning" size="mini" icon="el-icon-printer" @click="printExcel">打印</el-button>
  161. <el-button type="danger" size="mini" icon="el-icon-circle-close" @click="cancelSaveReport2">关闭</el-button>
  162. </el-row>
  163. <div id="luckysheet"
  164. style="margin:0px;padding:0px;position:relative;height:calc(100% - 50px);width:100%;left: 20px;top: 0px;bottom:0px;">
  165. </div>
  166. </div>
  167. </div>
  168. <!-- 新增报表 -->
  169. <el-dialog
  170. :title="reportDialogTitle"
  171. width="600px"
  172. top="10vh"
  173. center
  174. v-dialog-drag
  175. v-if="dialogReportTemplateVisible"
  176. :before-close="dialogClose"
  177. :visible.sync="dialogReportTemplateVisible"
  178. :close-on-click-modal="false"
  179. :append-to-body="true">
  180. <el-form ref="reportForm" :model="reportForm" :rules="reportRules" label-width="80px">
  181. <el-form-item label='报表名称' prop="reportTableName">
  182. <el-input placeholder="请输入报表名称" v-model="reportForm.reportTableName" maxlength="20"></el-input>
  183. </el-form-item>
  184. <el-form-item label="报表类型" prop="reportTableType" v-if="!reportForm.id">
  185. <el-radio-group v-model="reportForm.reportTableType" @input="changeReportType">
  186. <el-radio label="0">手动报表</el-radio>
  187. <el-radio label="1">自动报表</el-radio>
  188. <el-radio label="2">事件驱动报表</el-radio>
  189. </el-radio-group>
  190. </el-form-item>
  191. <el-form-item label="报表模板" prop="tableTemplateId" v-if="!reportForm.id">
  192. <el-select v-model="reportForm.tableTemplateId" filterable placeholder="请选择报表模板" style="width: 100%;">
  193. <el-option
  194. v-for="item in reportTemplateList"
  195. :key="item.id"
  196. :label="item.templateName"
  197. :value="item.id">
  198. </el-option>
  199. </el-select>
  200. </el-form-item>
  201. <el-form-item label="时间范围" prop="dateRange" v-if="reportForm.reportTableType == 1">
  202. <el-date-picker
  203. v-model="reportForm.dateRange"
  204. type="datetimerange"
  205. :clearable="false"
  206. range-separator="至"
  207. start-placeholder="开始时间"
  208. end-placeholder="结束时间"
  209. placeholder="选择取值时间范围"
  210. :picker-options="{
  211. format: 'yyyy-MM-dd HH:mm:ss'
  212. }"
  213. value-format="yyyy-MM-dd HH:mm:ss"
  214. :default-time="['09:00:00', '18:00:00']">
  215. </el-date-picker>
  216. </el-form-item>
  217. <el-form-item label="运行时间" prop="cronLabel" v-if="reportForm.reportTableType == 1">
  218. <el-input placeholder="请设置运行时间" v-model="reportForm.cronLabel" style="width: calc(100% - 105px);"
  219. readonly></el-input>
  220. <el-button size="mini" @click="settingAutoReportTime" style="float: right;width: 100px;line-height: 20px;">
  221. 设置运行时间
  222. </el-button>
  223. </el-form-item>
  224. </el-form>
  225. <span slot='footer'>
  226. <el-button type="primary" @click="chooseReportEvent" style="margin-top: 20px;">确定</el-button>
  227. <el-button @click="dialogClose" style="margin-top: 20px;">取消</el-button>
  228. </span>
  229. </el-dialog>
  230. <!-- 配置打印定时任务 -->
  231. <el-dialog
  232. :title="printDialogTitle"
  233. width="700px"
  234. top="10vh"
  235. center
  236. v-dialog-drag
  237. v-if="dialogAutoPrintVisible"
  238. :before-close="dialogClose"
  239. :visible.sync="dialogAutoPrintVisible"
  240. :close-on-click-modal="false"
  241. :append-to-body="true">
  242. <el-form ref="reportForm" :model="reportForm" :rules="reportRules" label-width="80px">
  243. <el-radio-group v-model="radioByCron">
  244. <el-form-item label="秒">
  245. <el-radio :label="1">
  246. <span style="margin-right: 10px;">每</span>
  247. <el-input-number size="mini" v-model="radioByCronValS" :min="1" :max="59"></el-input-number>
  248. <span style="margin-left: 10px;">秒执行一次</span>
  249. </el-radio>
  250. </el-form-item>
  251. <el-form-item label="分钟">
  252. <el-radio :label="2">
  253. <span style="margin-right: 10px;">每</span>
  254. <el-input-number size="mini" v-model="radioByCronValM" :min="1" :max="59"></el-input-number>
  255. <span style="margin-left: 10px;">分钟执行一次</span>
  256. </el-radio>
  257. </el-form-item>
  258. <el-form-item label="小时">
  259. <el-radio :label="3">
  260. <span style="margin-right: 10px;">每</span>
  261. <el-input-number size="mini" v-model="radioByCronValH" :min="1" :max="2"></el-input-number>
  262. <span style="margin-left: 10px;">小时执行一次</span>
  263. </el-radio>
  264. </el-form-item>
  265. <el-form-item label="指定时间">
  266. <el-radio :label="4">
  267. <span style="margin-right: 10px;">在每天的</span>
  268. <el-time-picker v-model="radioByCronValD"
  269. size="mini"
  270. placeholder="请选择时间"
  271. :clearable="false"
  272. :editable="false"
  273. value-format="HH:mm:ss"
  274. :picker-options="{
  275. format: 'HH:mm:ss'
  276. }">
  277. </el-time-picker>
  278. <span style="margin-left: 10px;">执行一次</span>
  279. </el-radio>
  280. </el-form-item>
  281. <el-form-item label="">
  282. <el-radio :label="5">
  283. <span style="margin-right: 10px;">在每月</span>
  284. <el-input-number size="mini" v-model="radioByCronValMo" :min="1" :max="31"></el-input-number>
  285. <span style="margin-right: 10px; margin-left: 10px;">号的</span>
  286. <el-time-picker v-model="radioByCronValMoD"
  287. size="mini"
  288. placeholder="请选择时间"
  289. :clearable="false"
  290. :editable="false"
  291. value-format="HH:mm:ss"
  292. :picker-options="{
  293. format: 'HH:mm:ss'
  294. }">
  295. </el-time-picker>
  296. <span style="margin-left: 10px;">执行一次</span>
  297. </el-radio>
  298. </el-form-item>
  299. </el-radio-group>
  300. </el-form>
  301. <span slot='footer'>
  302. <el-button type="primary" @click="chooseCronPrint" style="margin-top: 20px;">确定</el-button>
  303. <el-button type="warning" v-if="printForm.runState==1" @click="stopAutoPrint"
  304. style="margin-top: 20px;">停止</el-button>
  305. <el-button type="warning" disabled v-if="printForm.runState!=1" @click="stopAutoPrint"
  306. style="margin-top: 20px;">停止</el-button>
  307. <el-button @click="dialogClose" style="margin-top: 20px;">取消</el-button>
  308. </span>
  309. </el-dialog>
  310. <!-- 用户组选择 -->
  311. <el-dialog
  312. title="选择用户组"
  313. width="840px"
  314. top="10vh"
  315. center
  316. v-dialog-drag
  317. v-if="dialogUserGroupVisible"
  318. :before-close="dialogClose"
  319. :visible.sync="dialogUserGroupVisible"
  320. :close-on-click-modal="false"
  321. :append-to-body="true">
  322. <!-- <el-form label-width="80px">-->
  323. <!-- <el-form-item label="用户组">-->
  324. <!-- <el-select v-model="userGroupInfo" filterable clearable multiple placeholder="请选择用户组" style="width: 100%;">-->
  325. <!-- <el-option-->
  326. <!-- v-for="item in userGroupList"-->
  327. <!-- :key="item.id"-->
  328. <!-- :label="item.userGroupName"-->
  329. <!-- :value="item.id">-->
  330. <!-- </el-option>-->
  331. <!-- </el-select>-->
  332. <!-- </el-form-item>-->
  333. <!-- </el-form>-->
  334. <div class="ug-div">
  335. <el-transfer
  336. v-model="userGroupInfo"
  337. :titles="['用户组列表', '已选择用户组']"
  338. :data="userGroupList"
  339. :props="{
  340. key: 'id',
  341. label: 'userGroupName'
  342. }">
  343. </el-transfer>
  344. </div>
  345. <span slot='footer'>
  346. <el-button type="primary" @click="chooseUserGroupEvent" style="margin-top: 20px;">确定</el-button>
  347. <el-button @click="dialogClose" style="margin-top: 20px;">取消</el-button>
  348. </span>
  349. </el-dialog>
  350. <!-- 自动报表CRON定时表达式 -->
  351. <el-dialog
  352. title="配置定时任务"
  353. width="700px"
  354. top="10vh"
  355. center
  356. v-dialog-drag
  357. v-if="dialogAutoReportVisible"
  358. :before-close="dialogClose"
  359. :visible.sync="dialogAutoReportVisible"
  360. :close-on-click-modal="false"
  361. :append-to-body="true">
  362. <el-form label-width="80px">
  363. <el-radio-group v-model="radioByCron">
  364. <el-form-item label="秒">
  365. <el-radio :label="1">
  366. <span style="margin-right: 10px;">每</span>
  367. <el-input-number size="mini" v-model="radioByCronValS" :min="1" :max="59"></el-input-number>
  368. <span style="margin-left: 10px;">秒执行一次</span>
  369. </el-radio>
  370. </el-form-item>
  371. <el-form-item label="分钟">
  372. <el-radio :label="2">
  373. <span style="margin-right: 10px;">每</span>
  374. <el-input-number size="mini" v-model="radioByCronValM" :min="1" :max="59"></el-input-number>
  375. <span style="margin-left: 10px;">分钟执行一次</span>
  376. </el-radio>
  377. </el-form-item>
  378. <el-form-item label="小时">
  379. <el-radio :label="3">
  380. <span style="margin-right: 10px;">每</span>
  381. <el-input-number size="mini" v-model="radioByCronValH" :min="1" :max="2"></el-input-number>
  382. <span style="margin-left: 10px;">小时执行一次</span>
  383. </el-radio>
  384. </el-form-item>
  385. <el-form-item label="指定时间">
  386. <el-radio :label="4">
  387. <span style="margin-right: 10px;">在每天的</span>
  388. <el-time-picker v-model="radioByCronValD"
  389. size="mini"
  390. placeholder="请选择时间"
  391. :clearable="false"
  392. :editable="false"
  393. value-format="HH:mm:ss"
  394. :picker-options="{
  395. format: 'HH:mm:ss'
  396. }">
  397. </el-time-picker>
  398. <span style="margin-left: 10px;">执行一次</span>
  399. </el-radio>
  400. </el-form-item>
  401. <el-form-item label="">
  402. <el-radio :label="5">
  403. <span style="margin-right: 10px;">在每月</span>
  404. <el-input-number size="mini" v-model="radioByCronValMo" :min="1" :max="31"></el-input-number>
  405. <span style="margin-right: 10px; margin-left: 10px;">号的</span>
  406. <el-time-picker v-model="radioByCronValMoD"
  407. size="mini"
  408. placeholder="请选择时间"
  409. :clearable="false"
  410. :editable="false"
  411. value-format="HH:mm:ss"
  412. :picker-options="{
  413. format: 'HH:mm:ss'
  414. }">
  415. </el-time-picker>
  416. <span style="margin-left: 10px;">执行一次</span>
  417. </el-radio>
  418. </el-form-item>
  419. </el-radio-group>
  420. <!-- <el-form-item label="表达式">-->
  421. <!-- <el-input type="text" placeholder="请输入定时任务表达式" v-model="cronVal" maxlength="50"></el-input>-->
  422. <!-- </el-form-item>-->
  423. <!-- <div>-->
  424. <!-- <label>常用定时任务表达式例子</label>-->
  425. <!-- <ul>-->
  426. <!-- <li v-for="(item, i) in cronList" style="margin-bottom: 5px;">-->
  427. <!-- <span class="cron-txt" @click="cronNodeEvent(item)">{{ item.value }}</span>-->
  428. <!-- <span class="cron-txt-desc">{{ item.label }}</span>-->
  429. <!-- </li>-->
  430. <!-- </ul>-->
  431. <!-- </div>-->
  432. </el-form>
  433. <span slot='footer'>
  434. <el-button type="primary" @click="chooseCronEvent">确定</el-button>
  435. <!-- <el-button @click="dialogClose">取消</el-button>-->
  436. </span>
  437. </el-dialog>
  438. <!-- 报表类型 -->
  439. <el-dialog
  440. title="报表类型选择"
  441. width="50%"
  442. top="10vh"
  443. center
  444. v-dialog-drag
  445. v-if="dialogReportTypeVisible"
  446. :before-close="dialogClose"
  447. :visible.sync="dialogReportTypeVisible"
  448. :close-on-click-modal="false"
  449. :append-to-body="true">
  450. <div style="text-align: center;">
  451. <el-radio v-model="reportType" label="0">手动报表</el-radio>
  452. <el-radio v-model="reportType" label="1">自动报表</el-radio>
  453. <el-radio v-model="reportType" label="2">事件驱动报表</el-radio>
  454. </div>
  455. <span slot='footer'>
  456. <el-button type="primary" @click="chooseReportTypeEvent">确定</el-button>
  457. <el-button @click="dialogClose">取消</el-button>
  458. </span>
  459. </el-dialog>
  460. <!-- 报表下载类型选择 -->
  461. <el-dialog
  462. title="选择下载类型"
  463. width="500px"
  464. center
  465. v-dialog-drag
  466. v-if="dialogDownloadReportTypeVisible"
  467. :before-close="dialogClose"
  468. :visible.sync="dialogDownloadReportTypeVisible"
  469. :close-on-click-modal="false"
  470. :append-to-body="true">
  471. <div style="text-align: center;">
  472. <el-radio v-model="downloadType" label="1">Excel</el-radio>
  473. <!-- <el-radio v-model="downloadType" label="2" disabled>PDF</el-radio>-->
  474. </div>
  475. <div style="text-align: center; margin-top: 40px;">
  476. <el-button type="primary" @click="downloadReportEvent">确定</el-button>
  477. </div>
  478. </el-dialog>
  479. <!-- 历史报表查看 -->
  480. <el-dialog
  481. title="运行报表记录"
  482. width="80%"
  483. top="10vh"
  484. center
  485. v-dialog-drag-and-zoom
  486. v-if="dialogHistoryReportVisible"
  487. :before-close="dialogClose"
  488. :visible.sync="dialogHistoryReportVisible"
  489. :close-on-click-modal="false"
  490. :append-to-body="true">
  491. <div style="height: 60vh;">
  492. <div style="margin-bottom: 10px; float: right;">
  493. <el-input placeholder="请输入报表名称"
  494. v-model="searchHistoryTxt"
  495. style="margin-left: 5px; width: 300px;"
  496. prefix-icon="el-icon-search">
  497. </el-input>
  498. <el-button type="primary" style="margin-left: 5px;" @click="searchHistoryReportEvent">查询</el-button>
  499. </div>
  500. <el-table
  501. :data="reportHistoryData" border :stripe="true"
  502. :header-cell-style="{background: '#E8E8E8'}"
  503. @sort-change="sortChange1"
  504. style="width: 100%; height: calc(100% - 100px); overflow: auto;">
  505. <el-table-column
  506. align="center"
  507. sortable="custom"
  508. label="报表名称"
  509. prop="reportTableName">
  510. <template slot-scope="scope">
  511. <span style="color: #409EFF; cursor: pointer;"
  512. @click="handleReportNodeClick(scope.row, 'history')"
  513. :title="scope.row.reportTableName">{{ scope.row.reportTableName }}</span>
  514. </template>
  515. </el-table-column>
  516. <!-- <el-table-column-->
  517. <!-- align="center"-->
  518. <!-- label="报表状态"-->
  519. <!-- prop="isAutoReport"-->
  520. <!-- width="180">-->
  521. <!-- <template slot-scope="scope">-->
  522. <!-- <el-tag v-if="scope.row.userId != uid" type="success" style="margin-right: 5px;">被分享</el-tag>-->
  523. <!-- <el-tag v-if="uid == scope.row.userId && scope.row.userGroupList && scope.row.userGroupList.length > 0"-->
  524. <!-- type="warning" style="margin-right: 5px;">已分享</el-tag>-->
  525. <!-- </template>-->
  526. <!-- </el-table-column>-->
  527. <!-- <el-table-column-->
  528. <!-- align="center"-->
  529. <!-- label="当前版本"-->
  530. <!-- sortable="custom"-->
  531. <!-- prop="version"-->
  532. <!-- width="120">-->
  533. <!-- </el-table-column>-->
  534. <el-table-column
  535. align="center"
  536. label="运行时间"
  537. sortable
  538. prop="createTime"
  539. width="200">
  540. </el-table-column>
  541. <el-table-column label="操作" align="center" width="300">
  542. <template slot-scope="scope">
  543. <el-button type="text"
  544. v-if="uid == scope.row.userId"
  545. size="small"
  546. icon="el-icon-delete"
  547. style="color: red;"
  548. @click="removeReportItem(scope.row, 'record')">删除
  549. </el-button>
  550. </template>
  551. </el-table-column>
  552. </el-table>
  553. <el-pagination
  554. style="margin-top: 20px;"
  555. background
  556. layout="sizes, prev, pager, next, total"
  557. :current-page="reportHistoryPage"
  558. :page-size="reportHistoryLimit"
  559. @size-change="sizeHistoryChangeEvent"
  560. @current-change="currentHistoryChangeEvent"
  561. :total="reportHistoryTotal">
  562. </el-pagination>
  563. </div>
  564. </el-dialog>
  565. <!-- 用户组用户人员查看 -->
  566. <el-dialog
  567. title="授权详情"
  568. width="600px"
  569. top="10vh"
  570. center
  571. v-dialog-drag
  572. v-if="dialogGroupUserVisible"
  573. :before-close="dialogGroupUserClose"
  574. :visible.sync="dialogGroupUserVisible"
  575. :close-on-click-modal="false"
  576. :append-to-body="true">
  577. <div style="height: 60vh;">
  578. <el-table
  579. :data="groupUserData" border :stripe="true"
  580. :header-cell-style="{background: '#E8E8E8'}"
  581. style="width: 100%; height: calc(100% - 50px); overflow: auto;">
  582. <el-table-column
  583. align="center"
  584. label="用户组名称"
  585. prop="userGroupName">
  586. </el-table-column>
  587. <el-table-column
  588. align="center"
  589. label="姓名"
  590. prop="userName">
  591. </el-table-column>
  592. </el-table>
  593. </div>
  594. </el-dialog>
  595. <div id="print-area"
  596. style="display: none;position: absolute;z-index: 0;top: 0;width: 100%;height: 100vh;overflow: hidden;">
  597. <div id="print-html" ref="printPayFeeNew"></div>
  598. </div>
  599. </div>
  600. </template>
  601. <script>
  602. import BreadcrumbView from '@/components/BreadcrumbView'
  603. import {
  604. customCompare,
  605. getLuckysheetConfig,
  606. getNowFormatDate, showAlertMsgWin,
  607. showAlertWin, showConfirmWin,
  608. showLoading, showPromptWin
  609. } from '@/utils/cqcy'
  610. import {
  611. delReportTableById,
  612. getAllDataModel,
  613. getAllOkReportTable,
  614. getAllTableTemplate,
  615. getAutoChReportTable,
  616. getChartData,
  617. getDataModelById,
  618. getReportTableById,
  619. getTableData,
  620. getTableTemplateById,
  621. getUserByGroupId, runAutoTableById,
  622. saveReport, setAutoTableTime,
  623. tableAssignUserById,
  624. tableExchangeTypeById,
  625. updateReportTable,
  626. updateTableNameById,
  627. getPrintByReportId,
  628. addPrint,
  629. stopAutoPrintById
  630. } from '@/api/datasource'
  631. import Print from 'print-js'
  632. import {getUsername} from '@/utils/auth'
  633. import {exportExcel} from '@/utils/export'
  634. import {getAllUserGroup} from "@/api/user";
  635. import {mapGetters} from "vuex";
  636. import {insertLuckysheetEChart} from "@/utils/luckysheettool";
  637. import cqcyCode from "@/utils/cqcyCode";
  638. export default {
  639. name: "index",
  640. components: {
  641. BreadcrumbView
  642. },
  643. computed: {
  644. ...mapGetters([
  645. 'name',
  646. 'uid'
  647. ])
  648. },
  649. data() {
  650. return {
  651. breadcrumbList: ['运行配置'],
  652. groupProps: {
  653. isLeaf: 'leaf'
  654. },
  655. reportDialogTitle: '新增报表',
  656. showMainView: false,
  657. chooseMyReport: null,
  658. chooseCurrMyReport: null,
  659. dialogReportTemplateVisible: false,
  660. dialogDownloadReportTypeVisible: false,
  661. dialogAutoReportVisible: false,
  662. dialogReportTypeVisible: false,
  663. dialogUserGroupVisible: false,
  664. dialogHistoryReportVisible: false,
  665. dialogGroupUserVisible: false,
  666. dialogAutoPrintVisible: false,
  667. reportType: '0',
  668. downloadType: '1',
  669. btnType: '',
  670. hasUserGroup: false,
  671. userGroupInfo: null,
  672. userGroupList: [],
  673. radioByCron: null,
  674. radioByCronValS: '',
  675. radioByCronValM: '',
  676. radioByCronValH: '',
  677. radioByCronValD: null,
  678. radioByCronValMo: '',
  679. radioByCronValMoD: null,
  680. cronVal: '',
  681. cronList: [],
  682. reportId: null,
  683. reportTemplateList: [],
  684. dataModelList: [],
  685. chooseReportTemplate: null,
  686. chooseReportTemplateId: null,
  687. chooseIsAutoReport: null,
  688. delFlag: 0,
  689. reportForm: {
  690. id: null,
  691. reportTableName: '',
  692. reportTableType: null,
  693. tableTemplateId: null,
  694. reportTableData: '',
  695. cronLabel: '',
  696. cron: '',
  697. dateRange: ''
  698. },
  699. printDialogTitle: '打印任务配置',
  700. printForm: {
  701. id: null,
  702. reportTableId: null,
  703. cronId: '',
  704. cron: '',
  705. runState: null
  706. },
  707. searchValue: null,
  708. searchTxt: '',
  709. searchHistoryTxt: '',
  710. reportOptions: [{
  711. label: '所有报表',
  712. value: -1
  713. }, {
  714. label: '手动报表',
  715. value: 0
  716. }, {
  717. label: '自动报表',
  718. value: 1
  719. }, {
  720. label: '事件驱动报表',
  721. value: 2
  722. }],
  723. groupUserData: [],
  724. reportHistoryData: [],
  725. reportHistoryTotal: 0,
  726. reportHistoryPage: 1,
  727. reportHistoryLimit: 10,
  728. reportTotal: 0,
  729. reportPage: 1,
  730. reportLimit: 10,
  731. reportDataList: [],
  732. reportInterval: 30 * 1000, // 手动报表更新数据频率
  733. reportIntervalTag: null,
  734. reportRules: {
  735. reportTableName: [
  736. {required: true, message: '请输入报表名称', trigger: 'blur'}
  737. ],
  738. reportTableType: [
  739. {required: true, message: '请选择报表类型', trigger: 'change'}
  740. ],
  741. tableTemplateId: [
  742. {required: true, message: '请选择报表模板', trigger: 'change'}
  743. ]
  744. },
  745. luckysheetOption: {
  746. container: 'luckysheet', // 设定 DOM 容器的 id
  747. title: '报表模板', // 设定表格名称
  748. lang: 'zh', // 设定表格语言
  749. showinfobar: false, // 是否显示顶部信息栏
  750. showtoolbar: false, // 是否显示工具栏
  751. showtoolbarConfig: {
  752. paintFormat: true, //格式刷
  753. moreFormats: true, // 单元格格式
  754. font: true, // 字体
  755. fontSize: true, // 字号大小
  756. bold: true, // 粗体 (Ctrl+B)
  757. italic: true, // 斜体 (Ctrl+I)
  758. strikethrough: true, // 删除线 (Alt+Shift+5)
  759. underline: true, // 下划线 (Alt+Shift+6)
  760. textColor: true, // 文本颜色
  761. fillColor: true, // 单元格颜色
  762. border: true, // 边框
  763. mergeCell: true, // 合并单元格
  764. horizontalAlignMode: true, // 水平对齐方式
  765. verticalAlignMode: true, // 垂直对齐方式
  766. function: true, // 公式
  767. // image: true
  768. // chart: true
  769. },
  770. showsheetbar: false, // 是否显示底部 sheet 页按钮
  771. sheetFormulaBar: false, // 是否显示公式
  772. row: 120, // 是否显示底部 sheet 页按钮
  773. data: [{
  774. "name": "统计报表", //工作表名称
  775. }],
  776. cellRightClickConfig: { // 自定义配置单元格右击菜单
  777. copy: true, // 复制
  778. copyAs: false, // 复制为
  779. paste: true, // 粘贴
  780. insertRow: true, // 插入行
  781. insertColumn: true, // 插入列
  782. deleteRow: true, // 删除选中行
  783. deleteColumn: true, // 删除选中列
  784. deleteCell: false, // 删除单元格
  785. hideRow: false, // 隐藏选中行和显示选中行
  786. hideColumn: false, // 隐藏选中列和显示选中列
  787. rowHeight: true, // 行高
  788. columnWidth: true, // 列宽
  789. clear: false, // 清除内容
  790. matrix: false, // 矩阵操作选区
  791. sort: false, // 排序选区
  792. filter: false, // 筛选选区
  793. chart: true, // 图表生成
  794. image: false, // 插入图片
  795. link: false, // 插入链接
  796. data: false, // 数据验证
  797. cellFormat: false // 设置单元格格式
  798. },
  799. plugins: ['chart']
  800. }
  801. }
  802. },
  803. watch: {},
  804. beforeDestroy() {
  805. this.chooseMyReport = null
  806. this.chooseCurrMyReport = null
  807. },
  808. mounted() {
  809. let _this = this
  810. document.onkeyup = function (event) {
  811. let e = event || window.event || arguments.callee.caller.arguments[0]
  812. if (!e) return
  813. const {key, keyCode} = e
  814. if (keyCode === 46 || keyCode === 8) {
  815. _this.forceRefreshLuckysheet()
  816. }
  817. }
  818. },
  819. created() {
  820. luckysheet.destroy()
  821. this.loadReport()
  822. this.initCronList()
  823. },
  824. destroyed() {
  825. luckysheet.destroy()
  826. },
  827. methods: {
  828. /** 实现类似刷新效果 */
  829. forceRefreshLuckysheet() {
  830. if (luckysheet) {
  831. luckysheet.setCellValue(49, 0, luckysheet.getCellValue(49, 0))
  832. }
  833. },
  834. sortChange({prop, order}) {
  835. this.reportDataList.sort(customCompare(prop, order))
  836. },
  837. sortChange1({prop, order}) {
  838. this.reportHistoryData.sort(customCompare(prop, order))
  839. },
  840. handleSizeChange(val) {
  841. this.reportPage = 1
  842. this.reportLimit = val
  843. this.loadReport()
  844. },
  845. handleCurrentChange(val) {
  846. this.reportPage = val
  847. this.loadReport()
  848. },
  849. sizeHistoryChangeEvent(val) {
  850. this.reportHistoryPage = 1
  851. this.reportHistoryLimit = val
  852. this.historyReport()
  853. },
  854. currentHistoryChangeEvent(val) {
  855. this.reportHistoryPage = val
  856. this.historyReport()
  857. },
  858. searchHistoryReportEvent() {
  859. this.reportHistoryPage = 1
  860. this.historyReport()
  861. },
  862. changeReportTypeEvent(val) {
  863. this.reportPage = 1
  864. this.searchValue = val
  865. this.loadReport()
  866. },
  867. searchReportEvent() {
  868. this.reportPage = 1
  869. this.loadReport()
  870. },
  871. /** 验证CRON是否正确 */
  872. validCron(value) {
  873. const cronParse = require('cron-parser')
  874. try {
  875. const interval = cronParse.parseExpression(value)
  876. console.log('cronDate:', interval.next().toDate())
  877. return true
  878. } catch (e) {
  879. }
  880. return false
  881. },
  882. /** 解析数据运行表达式 */
  883. analysisCron(val) {
  884. if (!val) return
  885. let s = val.split(' ')
  886. if (s[0].indexOf('/') > -1) {
  887. this.radioByCron = 1
  888. this.radioByCronValS = parseInt(s[0].split('/')[1])
  889. } else if (s[1].indexOf('/') > -1) {
  890. this.radioByCron = 2
  891. this.radioByCronValM = parseInt(s[1].split('/')[1])
  892. } else if (s[2].indexOf('/') > -1) {
  893. this.radioByCron = 3
  894. this.radioByCronValH = parseInt(s[2].split('/')[1])
  895. } else if (s[3] === '*') {
  896. this.radioByCron = 4
  897. this.radioByCronValD = s[2] + ':' + s[1] + ':' + s[0]
  898. } else {
  899. this.radioByCron = 5
  900. this.radioByCronValMo = parseInt(s[3])
  901. this.radioByCronValMoD = s[2] + ':' + s[1] + ':' + s[0]
  902. }
  903. },
  904. /** 获取自动报表运行表达式 */
  905. getCron() {
  906. let result = null
  907. switch (this.radioByCron) {
  908. // 按每秒执行:0/2 * * * * ?
  909. case 1:
  910. if (Number.isInteger(this.radioByCronValS)) {
  911. result = '0/#{cron} * * * * ?'
  912. result = result.replace('#{cron}', this.radioByCronValS)
  913. }
  914. break
  915. // 按每分钟执行:0 0/2 * * * ?
  916. case 2:
  917. if (Number.isInteger(this.radioByCronValM)) {
  918. result = '0 0/#{cron} * * * ?'
  919. result = result.replace('#{cron}', this.radioByCronValM)
  920. }
  921. break
  922. // 按每小时执行:0 0 0/2 * * ?
  923. case 3:
  924. if (Number.isInteger(this.radioByCronValH)) {
  925. result = '0 0 0/#{cron} * * ?'
  926. result = result.replace('#{cron}', this.radioByCronValH)
  927. }
  928. break
  929. // 每天定时执行:0 15 10 * * ?
  930. case 4:
  931. if (this.radioByCronValD) {
  932. let times = this.radioByCronValD.split(':')
  933. result = '#{cron1} #{cron2} #{cron3} * * ?'
  934. result = result.replace('#{cron1}', times[2])
  935. result = result.replace('#{cron2}', times[1])
  936. result = result.replace('#{cron3}', times[0])
  937. result = result.replace(/00/g, '0')
  938. }
  939. break
  940. // 每月定时执行:0 0 2 1 * ?
  941. case 5:
  942. if (Number.isInteger(this.radioByCronValMo) && this.radioByCronValMoD) {
  943. let times = this.radioByCronValMoD.split(':')
  944. result = '#{cron1} #{cron2} #{cron3} #{cron4} * ?'
  945. result = result.replace('#{cron1}', times[2])
  946. result = result.replace('#{cron2}', times[1])
  947. result = result.replace('#{cron3}', times[0])
  948. result = result.replace('#{cron4}', this.radioByCronValMo)
  949. result = result.replace(/00/g, '0')
  950. }
  951. break
  952. default:
  953. break
  954. }
  955. return result
  956. },
  957. /** 获取自动报表运行表达式名称 */
  958. getCronLabel() {
  959. let result = null
  960. switch (this.radioByCron) {
  961. // 按每秒执行:0/2 * * * * ?
  962. case 1:
  963. if (Number.isInteger(this.radioByCronValS)) {
  964. result = '每#{cron}秒执行一次'
  965. result = result.replace('#{cron}', this.radioByCronValS)
  966. }
  967. break
  968. // 按每分钟执行:0 0/2 * * * ?
  969. case 2:
  970. if (Number.isInteger(this.radioByCronValM)) {
  971. result = '每#{cron}分钟执行一次'
  972. result = result.replace('#{cron}', this.radioByCronValM)
  973. }
  974. break
  975. // 按每小时执行:0 0 0/2 * * ?
  976. case 3:
  977. if (Number.isInteger(this.radioByCronValH)) {
  978. result = '每#{cron}小时执行一次'
  979. result = result.replace('#{cron}', this.radioByCronValH)
  980. }
  981. break
  982. // 每天定时执行:0 15 10 * * ?
  983. case 4:
  984. if (this.radioByCronValD) {
  985. let times = this.radioByCronValD.split(':')
  986. result = '每天#{cron3}:#{cron2}:#{cron1}执行一次'
  987. result = result.replace('#{cron1}',
  988. (times[2].length < 2 && parseInt(times[2]) < 10) ? ('0' + times[2]) : times[2])
  989. result = result.replace('#{cron2}',
  990. (times[1].length < 2 && parseInt(times[1]) < 10) ? ('0' + times[1]) : times[1])
  991. result = result.replace('#{cron3}',
  992. (times[0].length < 2 && parseInt(times[0]) < 10) ? ('0' + times[0]) : times[0])
  993. // result = result.replace(/00/g, '0')
  994. }
  995. break
  996. // 每月定时执行:0 0 2 1 * ?
  997. case 5:
  998. if (Number.isInteger(this.radioByCronValMo) && this.radioByCronValMoD) {
  999. let times = this.radioByCronValMoD.split(':')
  1000. result = '每月#{cron4}号的#{cron3}:#{cron2}:#{cron1}执行一次'
  1001. result = result.replace('#{cron1}',
  1002. (times[2].length < 2 && parseInt(times[2]) < 10) ? ('0' + times[2]) : times[2])
  1003. result = result.replace('#{cron2}',
  1004. (times[1].length < 2 && parseInt(times[1]) < 10) ? ('0' + times[1]) : times[1])
  1005. result = result.replace('#{cron3}',
  1006. (times[0].length < 2 && parseInt(times[0]) < 10) ? ('0' + times[0]) : times[0])
  1007. result = result.replace('#{cron4}', this.radioByCronValMo)
  1008. // result = result.replace(/00/g, '0')
  1009. }
  1010. break
  1011. default:
  1012. break
  1013. }
  1014. return result
  1015. },
  1016. /** 选择定时任务表达式 */
  1017. chooseCronEvent() {
  1018. if (!this.getCron()) {
  1019. showAlertMsgWin(this, null, '请指定定时任务类型或运行时间!')
  1020. return
  1021. }
  1022. this.reportForm.cron = this.getCron()
  1023. this.reportForm.cronLabel = this.getCronLabel()
  1024. if (!this.validCron(this.reportForm.cron)) {
  1025. showAlertMsgWin(this, null, '定时任务表达式格式不正确!')
  1026. return
  1027. }
  1028. this.dialogAutoReportVisible = false
  1029. },
  1030. resetRadioVal() {
  1031. this.radioByCron = null
  1032. this.radioByCronValS = ''
  1033. this.radioByCronValM = ''
  1034. this.radioByCronValH = ''
  1035. this.radioByCronValD = null
  1036. this.radioByCronValMo = ''
  1037. this.radioByCronValMoD = null
  1038. this.cronVal = ''
  1039. },
  1040. chooseReportTypeEvent() {
  1041. if (!this.reportType) {
  1042. showAlertMsgWin(this, null, '请选择报表类型!')
  1043. return
  1044. }
  1045. // 自动报表
  1046. if (this.reportType == '1') {
  1047. this.resetRadioVal()
  1048. getReportTableById(this.reportId).then(res => {
  1049. this.dialogAutoReportVisible = true
  1050. this.cronVal = res.data.cron
  1051. this.analysisCron(this.cronVal)
  1052. }).catch((e) => {
  1053. showAlertWin(this, null, e)
  1054. })
  1055. return
  1056. }
  1057. const loading = showLoading(this, '请稍候···')
  1058. let params = {
  1059. 'id': this.reportId,
  1060. 'isAutoReport': this.reportType
  1061. }
  1062. tableExchangeTypeById(params).then(res => {
  1063. loading.close()
  1064. this.dialogClose()
  1065. this.loadReport()
  1066. }).catch((e) => {
  1067. loading.close()
  1068. showAlertWin(this, null, e)
  1069. })
  1070. },
  1071. switchChangeEvent(val, data) {
  1072. this.reportId = data.id
  1073. if (val) {
  1074. this.resetRadioVal()
  1075. this.dialogAutoReportVisible = true
  1076. getReportTableById(data.id).then(res => {
  1077. this.cronVal = res.data.cron
  1078. this.analysisCron(this.cronVal)
  1079. }).catch((e) => {
  1080. showAlertWin(this, null, e)
  1081. })
  1082. return
  1083. }
  1084. this.dialogReportTypeVisible = true
  1085. },
  1086. /** 修改自动报表运行状态 */
  1087. setReportStatus(data) {
  1088. let status = data.runState == 0 ? '启动' : '停止'
  1089. let tips = '您确定要' + status + '该报表吗?'
  1090. showConfirmWin(this, null, tips, () => {
  1091. const loading = showLoading(this, status + '中,请稍候···')
  1092. let params = {
  1093. 'id': data.id,
  1094. 'runState': data.runState == 0 ? 1 : 0
  1095. }
  1096. runAutoTableById(params).then(res => {
  1097. loading.close()
  1098. let msg = res.data ? status + '成功!' : status + '失败!'
  1099. showAlertMsgWin(this, null, msg)
  1100. this.reportPage = 1
  1101. this.loadReport()
  1102. }).catch((e) => {
  1103. loading.close()
  1104. showAlertWin(this, null, e)
  1105. })
  1106. })
  1107. },
  1108. /** 初始化报表信息 */
  1109. resetReportFormVal() {
  1110. this.reportForm = {
  1111. id: null,
  1112. reportTableName: '',
  1113. reportTableType: null,
  1114. tableTemplateId: null,
  1115. reportTableData: '',
  1116. cronLabel: '',
  1117. cron: '',
  1118. dateRange: ''
  1119. }
  1120. },
  1121. /** 报表类型更改事件 */
  1122. changeReportType() {
  1123. this.reportForm.tableTemplateId = null
  1124. this.getAllReportTemplate(this.reportForm.reportTableType)
  1125. },
  1126. /** 新增报表 */
  1127. addReportEvent() {
  1128. this.resetReportFormVal()
  1129. this.reportDialogTitle = '新增报表'
  1130. this.dialogReportTemplateVisible = true
  1131. },
  1132. /** 刷新报表 */
  1133. refreshReportEvent() {
  1134. this.reportPage = 1
  1135. this.loadReport()
  1136. },
  1137. /** 设置自动报表运行时间 */
  1138. settingAutoReportTime() {
  1139. if (this.reportForm.cron) {
  1140. this.analysisCron(this.reportForm.cron)
  1141. } else {
  1142. this.resetRadioVal()
  1143. }
  1144. this.dialogAutoReportVisible = true
  1145. },
  1146. /** 模版报表选择 */
  1147. chooseReportEvent() {
  1148. // 判断是否自动报表
  1149. if (this.reportForm.reportTableType == 1 && this.reportForm.dateRange.length == 0) {
  1150. showAlertMsgWin(this, null, '请选择时间范围!')
  1151. return
  1152. }
  1153. if (this.reportForm.reportTableType == 1 && !this.reportForm.cron) {
  1154. showAlertMsgWin(this, null, '请设置自动报表运行时间!')
  1155. return
  1156. }
  1157. this.$refs['reportForm'].validate((valid) => {
  1158. if (valid) {
  1159. const loading = showLoading(this, '数据加载中,请稍候···')
  1160. getTableTemplateById(this.reportForm.tableTemplateId).then(res => {
  1161. if (!res.data) {
  1162. loading.close()
  1163. showAlertMsgWin(this, null, '选择的报表模板不存在!')
  1164. return
  1165. }
  1166. let luckyData = JSON.parse(res.data.templateData)
  1167. if (this.reportForm.id) {
  1168. this.updateReportInfo(loading, luckyData)
  1169. } else {
  1170. this.saveReportInfo(loading, luckyData)
  1171. }
  1172. }).catch((e) => {
  1173. loading.close()
  1174. showAlertWin(this, null, e)
  1175. })
  1176. }
  1177. })
  1178. },
  1179. /** 根据 ID 查询数据模型 */
  1180. getDataModelById(loading, reportData) {
  1181. if (!loading) {
  1182. loading = showLoading(this, '数据加载中,请稍候···')
  1183. }
  1184. getDataModelById(this.reportForm.operationRule).then(res => {
  1185. loading.close()
  1186. if (!res.data) {
  1187. showAlertMsgWin(this, null, '选择的四则运算表达式不存在!')
  1188. return
  1189. }
  1190. let luckyData = JSON.parse(reportData.templateData)
  1191. this.drawLuckyExcel(luckyData)
  1192. this.btnType = 'add'
  1193. this.dialogReportTemplateVisible = false
  1194. }).catch((e) => {
  1195. loading.close()
  1196. showAlertWin(this, null, e)
  1197. })
  1198. },
  1199. /** 绘制 Excel 表 */
  1200. drawLuckyExcel(luckyData, callback) {
  1201. let _this = this
  1202. luckysheet.destroy()
  1203. let option = luckyData.option
  1204. option.data = luckyData.data
  1205. let charts = luckyData.charts
  1206. let tables = luckyData.tables
  1207. option.hook = {
  1208. workbookCreateAfter() {
  1209. console.log(luckyData)
  1210. for (let i in charts) {
  1211. _this.insertEChartInfo(charts[i])
  1212. }
  1213. for (let i in tables) {
  1214. _this.insertTableInfo(tables[i])
  1215. }
  1216. _this.drawBaseInfo()
  1217. if (callback) {
  1218. callback()
  1219. }
  1220. },
  1221. cellUpdated(r, c, newV, oldV) {
  1222. if (!(r === 49 && c === 0)) {
  1223. _this.forceRefreshLuckysheet()
  1224. }
  1225. }
  1226. }
  1227. luckysheet.create(option)
  1228. },
  1229. /** 获取图表数据 */
  1230. getChartData(data, callback) {
  1231. getChartData(data).then(res => {
  1232. if (!res.data) {
  1233. if (callback) callback([])
  1234. return
  1235. }
  1236. if (callback) callback(res.data)
  1237. }).catch((e) => {
  1238. if (callback) callback([])
  1239. showAlertWin(this, null, e)
  1240. })
  1241. },
  1242. /** 获取表格数据 */
  1243. getTableData(data, callback) {
  1244. getTableData(data).then(res => {
  1245. if (!res.data) {
  1246. if (callback) callback([])
  1247. return
  1248. }
  1249. if (callback) callback(res.data)
  1250. }).catch((e) => {
  1251. if (callback) callback([])
  1252. showAlertWin(this, null, e)
  1253. })
  1254. },
  1255. /** 向 Excel 插入表格 */
  1256. insertTableInfo(tableData) {
  1257. let params = []
  1258. let itemList = tableData.item
  1259. for (let i in itemList) {
  1260. let temp = itemList[i]
  1261. params.push({
  1262. 'itemGroupId': temp.itemGroupId,
  1263. 'itemName': temp.itemName
  1264. })
  1265. }
  1266. let p = {
  1267. 'reportValueFormat': this.reportForm.reportValueFormat,
  1268. 'valueCondition': this.reportForm.valueCondition,
  1269. 'tableDataDtoChList': params,
  1270. 'showType': tableData.showType
  1271. }
  1272. if (this.reportForm.reportDate && this.reportForm.reportDate.length > 0) {
  1273. p.startBelongTime = this.reportForm.reportDate[0]
  1274. p.endBelongTime = this.reportForm.reportDate[1]
  1275. } else {
  1276. p.startBelongTime = getNowFormatDate('yyyy-MM-dd') + ' 08:00:00'
  1277. p.endBelongTime = getNowFormatDate('yyyy-MM-dd') + ' 18:00:00'
  1278. }
  1279. this.getTableData(p, (res) => {
  1280. // console.log('option==>', luckysheet.getAllSheets()[0])
  1281. // console.log('table1==>', res)
  1282. // const optionData = packtable(res, luckysheet.getAllSheets()[0])
  1283. // console.log('table2==>', optionData)
  1284. setTimeout(() => {
  1285. // this.drawTableData(res, p.showType, luckysheet.getAllSheets()[0])
  1286. }, 500)
  1287. })
  1288. },
  1289. /** 初始化表格基础数据项值 */
  1290. initBaseInfoData(data) {
  1291. let currDate = getNowFormatDate('yyyy-MM-dd')
  1292. let currDateTime = getNowFormatDate('yyyy-MM-dd HH:mm:ss')
  1293. data.baseItem = {
  1294. 'currDate': currDate,
  1295. 'currDateTime': currDateTime,
  1296. 'userName': getUsername(),
  1297. 'winUserName': process.env.VUE_APP_WINNAME
  1298. }
  1299. return data
  1300. },
  1301. /** 绘制基础数据项布局信息 */
  1302. drawBaseInfo(baseData) {
  1303. if (!baseData) return
  1304. let option = luckysheet.getAllSheets()[0]
  1305. option.celldata.map(item => {
  1306. if (item.v.v) {
  1307. item.v.v = String(item.v.v).trim()
  1308. if (item.v.v.match(/\${([^}]+)}/g)) { // 替换${xxx}内部数据
  1309. if (item.v.v.indexOf('${currDate}') > -1) {
  1310. let val = item.v.v
  1311. val = val.replace('${currDate}', baseData.currDate)
  1312. luckysheet.setCellValue(item.r, item.c, val)
  1313. }
  1314. if (item.v.v.indexOf('${currDateTime}') > -1) {
  1315. let val = item.v.v
  1316. val = val.replace('${currDateTime}', baseData.currDateTime)
  1317. luckysheet.setCellValue(item.r, item.c, val)
  1318. }
  1319. if (item.v.v.indexOf('${userName}') > -1) {
  1320. let val = item.v.v
  1321. val = val.replace('${userName}', baseData.userName)
  1322. luckysheet.setCellValue(item.r, item.c, val)
  1323. }
  1324. if (item.v.v.indexOf('${winUserName}') > -1) {
  1325. let val = item.v.v
  1326. val = val.replace('${winUserName}', baseData.winUserName)
  1327. luckysheet.setCellValue(item.r, item.c, val)
  1328. }
  1329. }
  1330. }
  1331. })
  1332. },
  1333. /** 绘制表格数据 */
  1334. drawTableData(tableItemList, type) {
  1335. if (!tableItemList || tableItemList.length == 0) return
  1336. // 事件驱动报表
  1337. if (type == 2 || type == 4) {
  1338. tableItemList.forEach((tableItem, i) => {
  1339. let valueList = tableItem.valueList ? tableItem.valueList.split(',') : []
  1340. let xAxis = tableItem.xaxis
  1341. let yAxis = tableItem.yaxis
  1342. if (valueList.length == 0) {
  1343. luckysheet.setCellValue(xAxis, yAxis, '')
  1344. } else {
  1345. valueList.forEach((v, j) => {
  1346. luckysheet.setCellValue(xAxis + j, yAxis, v)
  1347. })
  1348. }
  1349. })
  1350. return
  1351. }
  1352. // 其余报表信息
  1353. tableItemList.forEach((tableItem, i) => {
  1354. let standby = tableItem.standby ? JSON.parse(tableItem.standby) : {}
  1355. let dataIndex = standby.index != null ? standby.index : -1
  1356. let valueList = tableItem.valueList ? tableItem.valueList.split(',') : []
  1357. let val = (dataIndex == -1 || (dataIndex + 1) > valueList.length)
  1358. ? cqcyCode['invalidData'] : valueList[dataIndex]
  1359. let xAxis = tableItem.xaxis
  1360. let yAxis = tableItem.yaxis
  1361. try {
  1362. luckysheet.setCellValue(xAxis, yAxis, val)
  1363. } catch (e) {
  1364. console.warn(e)
  1365. }
  1366. })
  1367. },
  1368. /** 向 Excel 插入图表 */
  1369. insertEChartInfo(chart) {
  1370. let _self = this
  1371. let info = JSON.parse(chart.standby)
  1372. let reportChartItemList = chart.reportChartItemList
  1373. let chartType = chart.chartType
  1374. // 系列
  1375. let series = info.option.series
  1376. for (let i in series) {
  1377. let temp = series[i]
  1378. temp.data = []
  1379. for (let j in reportChartItemList) {
  1380. let _name = reportChartItemList[j].describe ? reportChartItemList[j].describe : reportChartItemList[j].itemName
  1381. if (chartType == 'pie') {
  1382. temp.name = _name
  1383. temp.data.push({
  1384. 'name': _name,
  1385. 'value': reportChartItemList[j].valueList
  1386. })
  1387. } else {
  1388. let _t = []
  1389. let t = reportChartItemList[i].valueList ? reportChartItemList[i].valueList.split(',') : []
  1390. t.forEach((temp) => {
  1391. _t.push(parseFloat(temp))
  1392. })
  1393. temp.data = _t
  1394. }
  1395. }
  1396. }
  1397. if (chartType != 'pie') {
  1398. // x 轴
  1399. let xAxis = info.option.xAxis
  1400. let legend = info.option.legend
  1401. // xAxis.data = []
  1402. legend.data = []
  1403. xAxis.data = (reportChartItemList && reportChartItemList.length > 0) ? reportChartItemList[0].dataTimeList : []
  1404. // xAxis.data = xAxis.data.slice(0, 7)
  1405. for (let i in reportChartItemList) {
  1406. let name = reportChartItemList[i].describe ? reportChartItemList[i].describe : reportChartItemList[i].itemName
  1407. // xAxis.data.push(name)
  1408. legend.data.push(name)
  1409. }
  1410. }
  1411. console.log(chartType, info)
  1412. setTimeout(() => {
  1413. const sheet = luckysheet.getLuckysheetfile()[0]
  1414. let optionData = sheet.data
  1415. try {
  1416. let flag = false
  1417. insertLuckysheetEChart({
  1418. selector: '#luckysheet',
  1419. info,
  1420. sheet,
  1421. optionData,
  1422. echarts,
  1423. luckysheet,
  1424. $,
  1425. _self,
  1426. flag
  1427. })
  1428. } catch (e) {
  1429. console.log(999, e == 'echarts is not defined')
  1430. console.error(e)
  1431. }
  1432. }, 200)
  1433. },
  1434. /** 查询所有报表模板信息 */
  1435. getAllReportTemplate(templateType) {
  1436. const loading = showLoading(this, '数据加载中,请稍候···')
  1437. let params = {
  1438. 'page': 1,
  1439. 'limit': 1000
  1440. }
  1441. if (templateType != null) {
  1442. params.templateType = templateType
  1443. }
  1444. getAllTableTemplate(params).then(res => {
  1445. loading.close()
  1446. if (!res.data) {
  1447. return
  1448. }
  1449. this.reportTemplateList = res.data.tableTemplateList
  1450. }).catch((e) => {
  1451. loading.close()
  1452. showAlertWin(this, null, e)
  1453. })
  1454. },
  1455. /** 查询所有数据模型 */
  1456. getAllDataModel() {
  1457. let params = {
  1458. 'page': 1,
  1459. 'limit': 1000
  1460. }
  1461. getAllDataModel(params).then(res => {
  1462. if (!res.data) {
  1463. return
  1464. }
  1465. this.dataModelList = res.data.dataModelList
  1466. }).catch((e) => {
  1467. showAlertWin(this, null, e)
  1468. })
  1469. },
  1470. /** 查询我的报表列表 */
  1471. loadReport() {
  1472. const loading = showLoading(this, '加载中,请稍候···')
  1473. let params = {
  1474. 'page': this.reportPage,
  1475. 'limit': this.reportLimit
  1476. }
  1477. if (this.searchValue != '-1') {
  1478. params.isAutoReport = this.searchValue
  1479. }
  1480. if (this.searchTxt && this.searchTxt.trim()) {
  1481. params.reportTableName = this.searchTxt
  1482. }
  1483. getAllOkReportTable(params).then(res => {
  1484. loading.close()
  1485. if (!res || !res.data) {
  1486. return
  1487. }
  1488. this.reportTotal = res.data.count
  1489. this.reportDataList = res.data.reportTableList
  1490. }).catch((e) => {
  1491. loading.close()
  1492. showAlertWin(this, null, e)
  1493. })
  1494. },
  1495. /** 设置自动打印 */
  1496. setAutoPrint(data) {
  1497. this.resetPrint();
  1498. const loading = showLoading(this, '设置中,请稍候···')
  1499. this.printForm.reportTableId = data.id;
  1500. getPrintByReportId(data.id).then(res => {
  1501. loading.close()
  1502. if (res.data) {
  1503. this.printForm.id = res.data.id;
  1504. this.printForm.cronId = res.data.cronId;
  1505. this.printForm.cron = res.data.cron;
  1506. this.printForm.runState = res.data.runState;
  1507. this.analysisCron(res.data.cron)
  1508. }
  1509. this.dialogAutoPrintVisible = true
  1510. }).catch((e) => {
  1511. loading.close()
  1512. })
  1513. },
  1514. resetPrint() {
  1515. this.printForm.id = null;
  1516. this.printForm.reportTableId = null;
  1517. this.printForm.cronId = '';
  1518. this.printForm.cron = '';
  1519. this.printForm.runState = null;
  1520. },
  1521. /** 选择定时打印 */
  1522. chooseCronPrint() {
  1523. if (!this.getCron()) {
  1524. showAlertMsgWin(this, null, '请指定定时任务类型或运行时间!')
  1525. return
  1526. }
  1527. this.printForm.cron = this.getCron();
  1528. if (!this.validCron(this.printForm.cron)) {
  1529. showAlertMsgWin(this, null, '定时任务表达式格式不正确!')
  1530. return
  1531. }
  1532. addPrint(this.printForm).then(res => {
  1533. let msg = res.data ? '配置成功!' : '配置失败!'
  1534. showAlertMsgWin(this, null, msg)
  1535. this.showMainView = false
  1536. this.dialogAutoPrintVisible = false;
  1537. }).catch(e => {
  1538. showAlertWin(this, null, e)
  1539. })
  1540. },
  1541. /** 停止打印 */
  1542. stopAutoPrint() {
  1543. console.log(this.printForm.reportTableId)
  1544. stopAutoPrintById(this.printForm.reportTableId).then(res => {
  1545. showAlertWin(this, null, res.data)
  1546. if(res.code==200){
  1547. this.dialogAutoPrintVisible = false;
  1548. }
  1549. }).catch(e => {
  1550. showAlertWin(this, null, e)
  1551. })
  1552. },
  1553. /** 设置用户组信息 */
  1554. setUserGroupEvent(data) {
  1555. if (data.userId != this.uid) {
  1556. showAlertMsgWin(this, null, '您没有权限进行设置!')
  1557. return
  1558. }
  1559. this.reportId = data.id
  1560. this.dialogUserGroupVisible = true
  1561. getAllUserGroup().then(res => {
  1562. this.$nextTick(() => {
  1563. this.userGroupList = res.data
  1564. // this.userGroupInfo = data.userGroupList
  1565. this.userGroupInfo = []
  1566. for (let i = 0; i < data.userGroupList.length; i++) {
  1567. this.userGroupInfo.push(data.userGroupList[i].id)
  1568. }
  1569. if (data.userGroupList && data.userGroupList.length > 0) {
  1570. this.hasUserGroup = true
  1571. }
  1572. })
  1573. }).catch((e) => {
  1574. showAlertWin(this, null, e)
  1575. })
  1576. },
  1577. getUserGroupEvent(data) {
  1578. this.groupUserData = []
  1579. if (!data.userGroupList || data.userGroupList.length == 0) {
  1580. showAlertMsgWin(this, null, '该报表还未进行授权操作!')
  1581. return
  1582. }
  1583. let _this = this
  1584. data.userGroupList.forEach((group) => {
  1585. getUserByGroupId(group.id).then(res => {
  1586. let users = res.data
  1587. users.forEach((u) => {
  1588. _this.groupUserData.push({
  1589. 'userGroupName': group.userGroupName,
  1590. 'userName': u.userName
  1591. })
  1592. })
  1593. }).catch((e) => {
  1594. showAlertWin(_this, null, e)
  1595. })
  1596. })
  1597. this.dialogGroupUserVisible = true
  1598. },
  1599. chooseUserGroupEvent() {
  1600. // if (!this.userGroupInfo) {
  1601. // this.$message({
  1602. // message: '请选择用户组!',
  1603. // type: 'warning'
  1604. // })
  1605. // return
  1606. // }
  1607. let params = {
  1608. 'id': this.reportId,
  1609. 'userGroupList': []
  1610. }
  1611. for (let i = 0; i < this.userGroupInfo.length; i++) {
  1612. params.userGroupList.push({
  1613. 'id': this.userGroupInfo[i]
  1614. })
  1615. }
  1616. tableAssignUserById(params).then(res => {
  1617. if (this.hasUserGroup || this.userGroupInfo) {
  1618. showAlertMsgWin(this, null, '保存成功!')
  1619. this.hasUserGroup = false
  1620. }
  1621. this.dialogClose()
  1622. this.loadReport()
  1623. }).catch((e) => {
  1624. showAlertWin(this, null, e)
  1625. })
  1626. },
  1627. /** 处理自动报表数据信息 */
  1628. drawAutoReportData(datas) {
  1629. if (!datas || datas.length == 0) {
  1630. return
  1631. }
  1632. datas.forEach((data) => {
  1633. if (!data || !data.item) {
  1634. return
  1635. }
  1636. let showInfo = data.showType
  1637. let fieldList = data.field
  1638. data.item.forEach((item, i) => {
  1639. if (!item || !item.dataList) {
  1640. return
  1641. }
  1642. let itemName = item.itemName
  1643. itemName = itemName.substring(itemName.lastIndexOf('.') + 1)
  1644. let tempName = '${' + item.itemGroupId + '.' + itemName + '.' + showInfo.dataId + '}'
  1645. let p_r, p_c
  1646. if (fieldList[i] && tempName == fieldList[i].name) {
  1647. p_r = parseInt(fieldList[i].r)
  1648. p_c = parseInt(fieldList[i].c)
  1649. } else {
  1650. for (let n = 0; n < fieldList.length; n++) {
  1651. if (fieldList[n].name == tempName) {
  1652. p_r = parseInt(fieldList[n].r)
  1653. p_c = parseInt(fieldList[n].c)
  1654. break
  1655. }
  1656. }
  1657. }
  1658. // 数据信息
  1659. let dataList = item.dataList
  1660. for (let j = 0; j < showInfo.valLine; j++) {
  1661. let c = p_c
  1662. let r = p_r
  1663. if (showInfo.valType == '2') r += j
  1664. else c += j
  1665. luckysheet.setCellValue(r, c, (dataList[j] != null && dataList[j] != undefined) ? (dataList[j] + '') : cqcyCode['invalidData'])
  1666. }
  1667. })
  1668. })
  1669. },
  1670. /** 报表点击事件 */
  1671. handleReportNodeClick(data, type) {
  1672. if (data.id == -1 || this.delFlag == 1) {
  1673. return
  1674. }
  1675. const loading = showLoading(this, '加载中,请稍候···')
  1676. getReportTableById(data.id).then(res => {
  1677. let _data = res.data
  1678. if (!_data) {
  1679. loading.close()
  1680. showAlertMsgWin(this, null, '选择的报表不存在!')
  1681. return
  1682. }
  1683. this.showMainView = true
  1684. this.breadcrumbList = [_data.reportTableName]
  1685. this.chooseCurrMyReport = _data
  1686. // 判断是否运行记录
  1687. if (type === 'history') {
  1688. this.dialogHistoryReportVisible = false
  1689. this.btnType = 'showChild'
  1690. } else {
  1691. this.chooseMyReport = res.data
  1692. this.btnType = 'showShared'
  1693. }
  1694. this.setLuckysheetStatus(_data, true, type, loading)
  1695. // 手动报表,循环查询数据
  1696. if (_data.reportTableType == 0) {
  1697. this.reportIntervalTag = setInterval(() => {
  1698. this.reloadReportNode()
  1699. }, this.reportInterval)
  1700. } else {
  1701. if (this.reportIntervalTag) clearInterval(this.reportIntervalTag)
  1702. }
  1703. }).catch((e) => {
  1704. loading.close()
  1705. showAlertWin(this, null, e)
  1706. })
  1707. },
  1708. /** 报表reload事件 */
  1709. reloadReportNode() {
  1710. if (!this.chooseMyReport || !this.chooseMyReport.id) {
  1711. if (this.reportIntervalTag) clearInterval(this.reportIntervalTag)
  1712. return
  1713. }
  1714. const loading = showLoading(this, '加载中,请稍候···')
  1715. getReportTableById(this.chooseMyReport.id).then(res => {
  1716. let _data = res.data
  1717. if (!_data) {
  1718. loading.close()
  1719. if (this.reportIntervalTag) clearInterval(this.reportIntervalTag)
  1720. return
  1721. }
  1722. this.chooseCurrMyReport = _data
  1723. this.chooseMyReport = res.data
  1724. this.setLuckysheetStatus(_data, true, '', loading)
  1725. }).catch((e) => {
  1726. if (this.reportIntervalTag) clearInterval(this.reportIntervalTag)
  1727. loading.close()
  1728. showAlertWin(this, null, e)
  1729. })
  1730. },
  1731. /** 设置工作表状态 */
  1732. setLuckysheetStatus(dataInfo, isReadOnly, type, loading) {
  1733. let _this = this
  1734. // 报表数据
  1735. let reportTableData = dataInfo.reportTableData
  1736. let luckyData = JSON.parse(reportTableData)
  1737. // 基础数据项值
  1738. let baseItem = luckyData.baseItem
  1739. // 数据项
  1740. let reportTableItemList = dataInfo.reportTableItemList
  1741. let reportChartList = dataInfo.reportChartList
  1742. // 报表类型
  1743. let reportTableType = dataInfo.reportTableType
  1744. luckysheet.destroy()
  1745. let option = luckyData.option
  1746. if (!option) option = JSON.parse(JSON.stringify(this.luckysheetOption))
  1747. option.data = luckyData.data
  1748. if (isReadOnly) {
  1749. // 设置工作表保护
  1750. option.data[0].config.authority = {
  1751. sheet: 1, // 如果为 1 或 true,则该工作表受到保护;如果为 0 或 false,则该工作表不受保护。
  1752. hintText: '该工作表受到保护,无法操作', // 弹窗提示的文字
  1753. }
  1754. // 关闭右键菜单
  1755. option.cellRightClickConfig.chart = false
  1756. option.cellRightClickConfig.columnWidth = false
  1757. option.cellRightClickConfig.rowHeight = false
  1758. option.cellRightClickConfig.deleteColumn = false
  1759. option.cellRightClickConfig.deleteRow = false
  1760. option.cellRightClickConfig.insertColumn = false
  1761. option.cellRightClickConfig.insertRow = false
  1762. // 关闭工具栏
  1763. option.showtoolbar = false
  1764. option.enableAddRow = false
  1765. option.showtoolbarConfig = {
  1766. bold: false,
  1767. border: false,
  1768. fillColor: false,
  1769. font: false,
  1770. fontSize: false,
  1771. function: false,
  1772. horizontalAlignMode: false,
  1773. italic: false,
  1774. mergeCell: false,
  1775. moreFormats: false,
  1776. paintFormat: false,
  1777. strikethrough: false,
  1778. textColor: false,
  1779. underline: false,
  1780. verticalAlignMode: false
  1781. }
  1782. // 钩子函数
  1783. option.hook = {
  1784. workbookCreateAfter() {
  1785. for (let i in reportChartList) {
  1786. _this.insertEChartInfo(reportChartList[i])
  1787. }
  1788. // 绘制基础数据项
  1789. _this.drawBaseInfo(baseItem)
  1790. // 绘制数据值
  1791. _this.drawTableData(reportTableItemList, reportTableType)
  1792. luckysheet.setRangeShow('BH1')
  1793. if (loading) loading.close()
  1794. }
  1795. }
  1796. } else {
  1797. let charts = luckyData.charts
  1798. // 钩子函数
  1799. option.hook = {
  1800. workbookCreateAfter() {
  1801. for (let i in charts) {
  1802. _this.insertEChartInfo(charts[i])
  1803. }
  1804. // 绘制基础数据项
  1805. _this.drawBaseInfo(baseItem)
  1806. // 绘制数据值
  1807. _this.drawTableData(reportTableItemList, reportTableType)
  1808. luckysheet.setRangeShow('BH1')
  1809. if (loading) loading.close()
  1810. },
  1811. cellUpdated(r, c, newV, oldV) {
  1812. if (!(r === 49 && c === 0)) {
  1813. _this.forceRefreshLuckysheet()
  1814. }
  1815. }
  1816. }
  1817. }
  1818. luckysheet.create(option)
  1819. },
  1820. /** 绘制事件驱动报表信息 */
  1821. drawEventReportData(eventTables) {
  1822. if (!eventTables || eventTables.length == 0) {
  1823. return
  1824. }
  1825. let x = 0, y = 0
  1826. eventTables.forEach((data, i) => {
  1827. x += 1
  1828. y = 0
  1829. let {dataList, dataTimeList, itemName} = data
  1830. itemName = (itemName != null && itemName != undefined) ? itemName : cqcyCode['invalidData']
  1831. luckysheet.setCellValue(x, y, itemName)
  1832. dataList.forEach((val, j) => {
  1833. y = j + 1
  1834. let _date = luckysheet.getCellValue(0, y)
  1835. if (!_date) {
  1836. let text = (dataTimeList[j] != null && dataTimeList[j] != undefined) ? dataTimeList[j] : cqcyCode['invalidData']
  1837. if (text.length > 19) text = text.substring(0, 19)
  1838. luckysheet.setCellValue(0, y, text)
  1839. }
  1840. val = (val != null && val != undefined) ? val : cqcyCode['invalidData']
  1841. luckysheet.setCellValue(x, y, val)
  1842. })
  1843. })
  1844. },
  1845. /** 修改报表信息 */
  1846. editReportItem(data) {
  1847. let _data = JSON.parse(JSON.stringify(data))
  1848. this.$nextTick(() => {
  1849. this.resetRadioVal()
  1850. this.cronVal = _data.cron
  1851. this.analysisCron(this.cronVal)
  1852. this.reportForm = _data
  1853. if (_data.startTime && _data.endTime) {
  1854. this.reportForm.dateRange = [_data.startTime, _data.endTime]
  1855. } else {
  1856. this.reportForm.dateRange = ''
  1857. }
  1858. this.reportForm.cronLabel = this.getCronLabel()
  1859. })
  1860. this.reportDialogTitle = '配置报表'
  1861. this.dialogReportTemplateVisible = true
  1862. // const loading = showLoading(this, '修改中,请稍候···')
  1863. // getReportTableById(data.id).then(res => {
  1864. // loading.close()
  1865. // this.cronVal = res.data.cron
  1866. // this.analysisCron(this.cronVal)
  1867. // this.reportForm = res.data
  1868. // this.reportForm.cronLabel = this.getCronLabel()
  1869. // this.reportDialogTitle = '配置报表'
  1870. // this.dialogReportTemplateVisible = true
  1871. // }).catch((e) => {
  1872. // loading.close()
  1873. // showAlertWin(this, null, e)
  1874. // })
  1875. },
  1876. /** 报表移除 */
  1877. removeReportItem(data, type) {
  1878. showConfirmWin(this, null, '您确定要删除该报表吗?', () => {
  1879. const loading = showLoading(this, '删除中,请稍候···')
  1880. delReportTableById(data.id).then(res => {
  1881. loading.close()
  1882. let msg = res.data ? '删除成功!' : '删除失败!'
  1883. showAlertMsgWin(this, null, msg)
  1884. if (type == 'record') {
  1885. this.reportHistoryPage = 1
  1886. this.historyReport()
  1887. return
  1888. }
  1889. this.reportPage = 1
  1890. this.loadReport()
  1891. this.cancelSaveReport()
  1892. }).catch((e) => {
  1893. loading.close()
  1894. showAlertWin(this, null, e)
  1895. })
  1896. })
  1897. },
  1898. /** 获取单元格大小 */
  1899. getCellSize(celldata, r, c, luckysheet) {
  1900. const {cs, rs} = celldata.data[r][c].mc
  1901. const rowhidden = celldata.config.rowhidden && Object.keys(celldata.config.rowhidden) || ''
  1902. const rowArr = []
  1903. for (let i = 0; i < rs; i++) {
  1904. let rowIndex = r + i
  1905. if (rowhidden.indexOf(String(rowIndex)) < 0) {
  1906. rowArr.push(rowIndex)
  1907. }
  1908. }
  1909. const colArr = []
  1910. for (let j = 0; j < cs; j++) {
  1911. colArr.push(c + j)
  1912. }
  1913. const totalHeight = Object.values(
  1914. luckysheet.getRowHeight(rowArr)
  1915. ).reduce((a, b) => a + b)
  1916. const totalWidth = Object.values(
  1917. luckysheet.getColumnWidth(colArr)
  1918. ).reduce((a, b) => a + b)
  1919. return {
  1920. w: totalWidth,
  1921. h: totalHeight
  1922. }
  1923. },
  1924. /** 获取图片位置 */
  1925. getImagePosition(num, arr) {
  1926. let index = 0
  1927. let minIndex
  1928. let maxIndex
  1929. for (let i = 0; i < arr.length; i++) {
  1930. if (num < arr[i]) {
  1931. index = i
  1932. break
  1933. }
  1934. }
  1935. if (index == 0) {
  1936. minIndex = 0
  1937. maxIndex = 1
  1938. } else if (index == arr.length - 1) {
  1939. minIndex = arr.length - 2
  1940. maxIndex = arr.length - 1
  1941. } else {
  1942. minIndex = index - 1
  1943. maxIndex = index
  1944. }
  1945. let min = arr[minIndex]
  1946. let max = arr[maxIndex]
  1947. let radio = Math.abs((num - min) / (max - min)) + index
  1948. return radio
  1949. },
  1950. /** 图表转换为图片 */
  1951. convertChart(luckyData) {
  1952. const optionData = luckysheet.getLuckysheetfile()[0]
  1953. let {
  1954. visibledatacolumn, // 所有行的位置
  1955. visibledatarow // 所有列的位置
  1956. } = optionData
  1957. // 动态图表
  1958. if (luckyData.charts && luckyData.charts.length > 0) {
  1959. luckyData.charts.forEach((chart, i) => {
  1960. let myChart = echarts.init(
  1961. document.getElementsByClassName(chart.info.className)[0]
  1962. )
  1963. let baseData = myChart.getConnectedDataURL({
  1964. type: 'png',
  1965. pixelRatio: 2,
  1966. backgroundColor: '#ffffff'
  1967. })
  1968. // luckysheet.cancelRangeMerge(chart.info.pos)
  1969. luckysheet.insertImage(baseData, {
  1970. rowIndex: chart.info.pos[0],
  1971. colIndex: chart.info.pos[1],
  1972. cellSize: this.getCellSize(optionData, chart.info.pos[0], chart.info.pos[1], luckysheet),
  1973. success: function () {
  1974. console.log("插入成功")
  1975. }
  1976. })
  1977. })
  1978. }
  1979. // 静态图表
  1980. if (luckyData.data && luckyData.data.length > 0) {
  1981. luckyData.data.forEach((data, i) => {
  1982. if (data.chart && data.chart.length > 0) {
  1983. data.chart.forEach((chart, j) => {
  1984. let myChart = echarts.init(
  1985. document.getElementById(chart.chart_id)
  1986. )
  1987. myChart.setOption(chart.chartOptions);
  1988. let baseData = myChart.getConnectedDataURL({
  1989. type: 'png',
  1990. pixelRatio: 2,
  1991. backgroundColor: '#ffffff'
  1992. })
  1993. let col_st = this.getImagePosition(chart.left, visibledatacolumn)
  1994. let row_st = this.getImagePosition(chart.top, visibledatarow)
  1995. luckysheet.insertImage(baseData, {
  1996. rowIndex: parseInt(row_st),
  1997. colIndex: parseInt(col_st),
  1998. cellSize: {
  1999. w: chart.width,
  2000. h: chart.height,
  2001. },
  2002. success: function () {
  2003. console.log("插入成功")
  2004. }
  2005. })
  2006. })
  2007. }
  2008. })
  2009. }
  2010. },
  2011. /** 处理日期显示数字问题 */
  2012. withDateData(excelData) {
  2013. if (!excelData) {
  2014. return
  2015. }
  2016. try {
  2017. excelData.map((item) => {
  2018. if (item) {
  2019. item.map((ll) => {
  2020. if (ll && ll.ct && ll.ct.t && ll.ct.t === 'd') {
  2021. ll.m = ll.m,
  2022. ll.v = ll.m,
  2023. ll.ct = {
  2024. fa: "@",
  2025. t: "s",
  2026. }
  2027. }
  2028. })
  2029. }
  2030. })
  2031. } catch (error) {
  2032. console.log(error)
  2033. }
  2034. },
  2035. /** 保存报表信息 */
  2036. saveReportInfo(loading, dataInfo) {
  2037. if (!loading) loading = showLoading(this, '保存中,请稍候···')
  2038. let _excelData = this.initBaseInfoData(dataInfo)
  2039. let params = JSON.parse(JSON.stringify(this.reportForm))
  2040. params.reportTableData = JSON.stringify(_excelData)
  2041. if (params.dateRange && params.dateRange.length > 0) {
  2042. params.startTime = params.dateRange[0]
  2043. params.endTime = params.dateRange[1]
  2044. }
  2045. saveReport(params).then(res => {
  2046. loading.close()
  2047. let msg = res.data ? '保存成功!' : '保存失败!'
  2048. showAlertMsgWin(this, null, msg)
  2049. this.showMainView = false
  2050. this.dialogReportTemplateVisible = false
  2051. this.loadReport()
  2052. this.cancelSaveReport()
  2053. }).catch((e) => {
  2054. loading.close()
  2055. showAlertWin(this, null, e)
  2056. })
  2057. },
  2058. /** 修改报表信息 */
  2059. updateReportInfo(loading, dataInfo) {
  2060. if (!loading) loading = showLoading(this, '修改中,请稍候···')
  2061. let params = JSON.parse(JSON.stringify(this.reportForm))
  2062. if (params.dateRange && params.dateRange.length > 0) {
  2063. params.startTime = params.dateRange[0]
  2064. params.endTime = params.dateRange[1]
  2065. }
  2066. setAutoTableTime(params).then(res => {
  2067. loading.close()
  2068. let msg = res.data ? '修改成功!' : '修改失败!'
  2069. showAlertMsgWin(this, null, msg)
  2070. this.showMainView = false
  2071. this.dialogReportTemplateVisible = false
  2072. this.loadReport()
  2073. this.cancelSaveReport()
  2074. }).catch((e) => {
  2075. loading.close()
  2076. showAlertWin(this, null, e)
  2077. })
  2078. },
  2079. /** 更新报表信息 */
  2080. updateReport() {
  2081. if (!this.chooseMyReport || !this.chooseMyReport.id) {
  2082. showAlertMsgWin(this, null, '保存失败,请刷新后重试!')
  2083. return
  2084. }
  2085. showPromptWin(this, '保存', '请输入报表名称', this.chooseMyReport.reportTableName, (val) => {
  2086. if (!val) {
  2087. return '报表名称不能为空'
  2088. }
  2089. if (val.length > 20) {
  2090. return '报表名称必须在20字以内'
  2091. }
  2092. }, (value) => {
  2093. const loading = showLoading(this, '保存中,请稍候···')
  2094. let _data2 = JSON.parse(this.chooseMyReport.reportTableData)
  2095. let excelTable = _data2.tables
  2096. excelTable.forEach(table => {
  2097. table.field.forEach(field => {
  2098. luckysheet.setCellValue(field.r, field.c, field.name)
  2099. })
  2100. })
  2101. let _data = JSON.parse(getLuckysheetConfig())
  2102. let excelData = _data[0].data
  2103. this.withDateData(excelData)
  2104. _data2.data = _data
  2105. // this.convertChart(_data2)
  2106. let data = this.chooseMyReport
  2107. data.reportTableName = value
  2108. data.reportTableData = JSON.stringify(_data2)
  2109. updateReportTable(data).then(res => {
  2110. loading.close()
  2111. let msg = res.data ? '保存成功!' : '保存失败!'
  2112. showAlertMsgWin(this, null, msg)
  2113. this.showMainView = false
  2114. this.loadReport()
  2115. this.cancelSaveReport()
  2116. }).catch((e) => {
  2117. loading.close()
  2118. showAlertWin(this, null, e)
  2119. })
  2120. })
  2121. },
  2122. /** 报表下载 */
  2123. downloadReport() {
  2124. this.dialogDownloadReportTypeVisible = true
  2125. },
  2126. /** 报表下载事件 */
  2127. downloadReportEvent() {
  2128. if (!this.chooseCurrMyReport) {
  2129. showAlertMsgWin(this, null, '请选择报表!')
  2130. return
  2131. }
  2132. let reportName = this.chooseCurrMyReport.reportTableName ? this.chooseCurrMyReport.reportTableName : '统计报表'
  2133. if (this.downloadType == '1') {
  2134. // exportExcel(luckysheet, reportName, ExcelJS).then((res) => {
  2135. // console.log("result==>", res)
  2136. // // this.$message({
  2137. // // message: res,
  2138. // // type: 'success'
  2139. // // })
  2140. // this.dialogDownloadReportTypeVisible = false
  2141. // }).catch((err) => {
  2142. // })
  2143. exportExcel(luckysheet.getAllSheets(), reportName)
  2144. setTimeout(() => {
  2145. this.dialogDownloadReportTypeVisible = false
  2146. }, 500)
  2147. }
  2148. },
  2149. /** 报表记录 */
  2150. historyReport() {
  2151. const loading = showLoading(this, '加载中,请稍候···')
  2152. let params = {
  2153. 'page': this.reportHistoryPage,
  2154. 'limit': this.reportHistoryLimit,
  2155. 'reportTableName': this.searchHistoryTxt,
  2156. 'autoTableId': this.chooseMyReport.id
  2157. }
  2158. getAutoChReportTable(params).then(res => {
  2159. loading.close()
  2160. this.dialogHistoryReportVisible = true
  2161. if (!res.data) return
  2162. this.reportHistoryData = res.data.reportTableList
  2163. this.reportHistoryTotal = res.data.count
  2164. }).catch((e) => {
  2165. loading.close()
  2166. showAlertWin(this, null, e)
  2167. })
  2168. },
  2169. getPrintSheetArea() {
  2170. const sheetData = luckysheet.getSheetData();
  2171. let objRowColumn = {
  2172. row: [0, 0], //行
  2173. column: [0, 0], //列
  2174. };
  2175. // * item是行、index是行索引、it是一行里的一格、itemIndex是这一格在这一行里的列索引
  2176. sheetData.forEach((item, index) => {
  2177. //行数
  2178. item.forEach((it, itemIndex) => {
  2179. if (it !== null && it.v) {
  2180. console.log(index, it)
  2181. if (objRowColumn.row[1] < index) {
  2182. objRowColumn.row[1] = index; //row第二位
  2183. }
  2184. if (objRowColumn.column[1] < itemIndex) {
  2185. objRowColumn.column[1] = itemIndex; //column第二位
  2186. }
  2187. }
  2188. });
  2189. });
  2190. return objRowColumn;
  2191. },
  2192. /** 打印操作 */
  2193. printExcel() {
  2194. const loading = showLoading(this, '请稍候···')
  2195. document.querySelector('#print-area').style = "display:block";
  2196. window.luckysheet.hideGridLines();
  2197. // 获取当前选中区域
  2198. let currentSelected = luckysheet.getRange()
  2199. // 如果当前选中区只是一个单元格,则认为选取无效。
  2200. if (currentSelected[0] != null
  2201. && (currentSelected[0].row[1] - currentSelected[0].row[0] >= 1
  2202. || currentSelected[0].column[1] - currentSelected[0].column[0] >= 1)) {
  2203. // 生成base64图片
  2204. let imgSrc = luckysheet.getScreenshot();
  2205. window.luckysheet.showGridLines();
  2206. // * Lodop中的ADD_PRINT_IMAGE,也可以直接输出base64码图片,不用加img标签(如果加了img标签,会被当做超文本对待,受浏览器引擎解析的影响)
  2207. let $img = `<img src=${imgSrc} style="max-width: 90%;" />`
  2208. this.$nextTick(() => {
  2209. document.querySelector('#print-html').innerHTML = $img;
  2210. setTimeout(() => {
  2211. Print({
  2212. printable: 'print-html',
  2213. type: 'html',
  2214. documentTitle: '文档标题',
  2215. header: '',
  2216. headerStyle: 'font-weight:400;text-align:center;',
  2217. style: '@page {margin: 0 10mm};', // 不打印页眉和页脚
  2218. honorColor: true, // 是否打印彩色文本
  2219. targetStyles: ['*'] // 允许打印所有样式属性
  2220. }) // Print.js插件
  2221. document.querySelector("#print-area").style.display = "none";
  2222. loading.close()
  2223. }, 1000)
  2224. })
  2225. } else {
  2226. // 获取打印区域的行列
  2227. let RowColumn = this.getPrintSheetArea();
  2228. // 因需要打印左边的边框,需重新设置第一列
  2229. RowColumn.column[0] = 0;
  2230. // 进行选区操作
  2231. luckysheet.setRangeShow(RowColumn);
  2232. let imgSrc = luckysheet.getScreenshot(); // 生成base64图片
  2233. window.luckysheet.showGridLines();
  2234. // * Lodop中的ADD_PRINT_IMAGE,也可以直接输出base64码图片,不用加img标签(如果加了img标签,会被当做超文本对待,受浏览器引擎解析的影响)
  2235. let $img = `<img src=${imgSrc} style="max-width: 90%;" />`
  2236. this.$nextTick(() => {
  2237. document.querySelector('#print-html').innerHTML = $img;
  2238. setTimeout(() => {
  2239. Print({
  2240. printable: 'print-html',
  2241. type: 'html',
  2242. documentTitle: '文档标题',
  2243. header: '',
  2244. headerStyle: 'font-weight:400;text-align:center;',
  2245. style: '@page {margin: 0 10mm};', // 不打印页眉和页脚
  2246. honorColor: true, // 是否打印彩色文本
  2247. targetStyles: ['*'] // 允许打印所有样式属性
  2248. }) // Print.js插件
  2249. document.querySelector("#print-area").style.display = "none";
  2250. loading.close()
  2251. }, 1000)
  2252. })
  2253. }
  2254. },
  2255. /** 自定义选中区域 */
  2256. getExcelRowColumn() {
  2257. const sheetData = luckysheet.getSheetData();
  2258. let objRowColumn = {
  2259. row: [null, null], //行
  2260. column: [null, null], //列
  2261. };
  2262. sheetData.forEach((item, index) => {
  2263. //行数
  2264. item.forEach((it, itemIndex) => {
  2265. console.log(it)
  2266. if (it !== null) {
  2267. if (objRowColumn.row[0] == null) objRowColumn.row[0] = index; // row第一位
  2268. objRowColumn.row[1] = index; //row第二位
  2269. if (objRowColumn.column[0] == null)
  2270. objRowColumn.column[0] = itemIndex; //column第一位
  2271. objRowColumn.column[1] = itemIndex; //column第二位
  2272. }
  2273. });
  2274. });
  2275. return objRowColumn;
  2276. },
  2277. cronNodeEvent(obj) {
  2278. this.cronVal = obj.value
  2279. },
  2280. initCronList() {
  2281. this.cronList = []
  2282. this.cronList.push({value: '0/2 * * * * ?', label: '表示每2秒钟执行一次任务'})
  2283. this.cronList.push({value: '0 0/2 * * * ?', label: '表示每2分钟执行一次任务'})
  2284. this.cronList.push({value: '0 0 0/2 * * ?', label: '表示每2小时执行一次任务'})
  2285. this.cronList.push({value: '0 15 10 * * ?', label: '表示在每天上午10点15分执行一次任务'})
  2286. this.cronList.push({value: '0 0 10,14,16 * * ?', label: '表示在每天的上午10点、下午2点、下午4点分别执行一次任务'})
  2287. this.cronList.push({
  2288. value: '0 0/30 9-17 * * ?',
  2289. label: '表示在每天的上午9点到下午5点的范围内每30分钟执行一次任务'
  2290. })
  2291. this.cronList.push({value: '0 0 12 ? * WED', label: '表示在每周星期三中午12点执行一次任务'})
  2292. this.cronList.push({value: '0 0 2 1 * ?', label: '表示在每月的1日的凌晨2点执行一次任务'})
  2293. },
  2294. /** 取消保存报表 */
  2295. cancelSaveReport2() {
  2296. this.handleReportNodeClick(this.chooseMyReport, this.chooseMyReport.userId !== this.uid ? 'deny' : '')
  2297. },
  2298. /** 取消保存报表 */
  2299. cancelSaveReport() {
  2300. luckysheet.destroy()
  2301. this.breadcrumbList = ['运行配置']
  2302. this.showMainView = false
  2303. this.btnType = ''
  2304. this.chooseMyReport = null
  2305. if (this.$refs['reportForm']) this.$refs['reportForm'].resetFields()
  2306. },
  2307. /** 弹出层关闭事件 */
  2308. dialogClose(done) {
  2309. this.cronVal = ''
  2310. this.searchHistoryTxt = ''
  2311. this.reportId = null
  2312. // this.userGroupInfo = null
  2313. if (typeof (done) === 'function') {
  2314. done()
  2315. } else {
  2316. this.dialogReportTemplateVisible = false
  2317. this.dialogDownloadReportTypeVisible = false
  2318. this.dialogAutoReportVisible = false
  2319. this.dialogReportTypeVisible = false
  2320. this.dialogUserGroupVisible = false
  2321. this.dialogAutoPrintVisible = false
  2322. }
  2323. },
  2324. /** 弹出层关闭事件 */
  2325. dialogGroupUserClose(done) {
  2326. if (typeof (done) === 'function') {
  2327. done()
  2328. } else {
  2329. this.dialogGroupUserVisible = false
  2330. }
  2331. }
  2332. }
  2333. }
  2334. </script>
  2335. <style rel="stylesheet/scss" lang="scss">
  2336. .breadcrumb-content {
  2337. padding-bottom: 0;
  2338. }
  2339. .cy-nav-sx {
  2340. float: left !important;
  2341. margin-top: -23px !important;
  2342. margin-left: 120px !important;
  2343. display: flex;
  2344. }
  2345. .cy-nav-btn {
  2346. float: right !important;
  2347. margin-right: 20px !important;
  2348. margin-top: -20px !important;
  2349. }
  2350. .cy-main {
  2351. margin: 10px 20px;
  2352. width: calc(100% - 40px);
  2353. height: calc(100% - 100px);
  2354. .cy-btn {
  2355. margin-bottom: 10px;
  2356. }
  2357. .cy-btn .el-link {
  2358. margin-right: 15px;
  2359. }
  2360. .cy-main-left {
  2361. width: 100%;
  2362. height: 100%;
  2363. overflow: auto;
  2364. //float: left;
  2365. padding: 5px 10px;
  2366. //border-right: 1px solid #d4d4d4;
  2367. .cy-list {
  2368. overflow: auto;
  2369. height: 100%;
  2370. height: calc(100% - 40px);
  2371. ul {
  2372. display: flex;
  2373. flex-wrap: wrap;
  2374. padding: 0;
  2375. margin-top: 0;
  2376. li {
  2377. list-style-type: none;
  2378. background: #41aed7;
  2379. width: 23%;
  2380. margin: 10px 1%;
  2381. border-radius: 8px;
  2382. height: 110px;
  2383. padding: 15px;
  2384. color: #ffffff;
  2385. .cy-item-name {
  2386. font-size: 14px;
  2387. text-overflow: ellipsis;
  2388. white-space: nowrap;
  2389. overflow: hidden;
  2390. margin-bottom: 15px;
  2391. cursor: pointer;
  2392. }
  2393. .cy-item-val {
  2394. font-size: 12px;
  2395. }
  2396. .cy-list-item {
  2397. font-size: 12px;
  2398. color: #f6f6f6;
  2399. width: 100%;
  2400. //display: flex;
  2401. margin-top: 40px;
  2402. }
  2403. }
  2404. }
  2405. }
  2406. }
  2407. .cy-main-right {
  2408. width: 100%;
  2409. height: 100%;
  2410. float: left;
  2411. overflow: hidden;
  2412. }
  2413. }
  2414. .cy-group-tree1 {
  2415. font-size: 14px;
  2416. .custom-tree-node1 {
  2417. height: 28px;
  2418. line-height: 28px;
  2419. }
  2420. }
  2421. .cron-txt {
  2422. color: blue;
  2423. margin-right: 20px;
  2424. cursor: pointer;
  2425. font-weight: bold;
  2426. font-size: 16px;
  2427. }
  2428. .cron-txt-desc {
  2429. }
  2430. .ug-div {
  2431. .el-transfer-panel {
  2432. width: 300px;
  2433. }
  2434. }
  2435. </style>