Rap 原分销系统代码Web
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

fea93507bcded4d8c52f1a4b93cef37c401a6fe0.svn-base 35KB

5 kuukautta sitten
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084
  1. <template>
  2. <div class="app-container">
  3. <div style="margin-bottom:10px">
  4. <el-button type="success" @click="addBtn">新增</el-button>
  5. <el-button type="info" @click="goSearchLogs">日志</el-button>
  6. </div>
  7. <!--搜索-->
  8. <el-form class="mt_15" ref="form" inline size="small">
  9. <el-form-item label="任务名称">
  10. <el-input v-model="searchParm.jobName" clearable placeholder="任务名称"></el-input>
  11. </el-form-item>
  12. <el-date-picker
  13. v-model="searchTime"
  14. type="daterange"
  15. range-separator=":"
  16. start-placeholder="开始日期"
  17. end-placeholder="结束日期"
  18. style="width:270px"
  19. ></el-date-picker>
  20. <el-form-item label="状态">
  21. <el-select v-model="searchParm.isPause" placeholder="请选择">
  22. <el-option
  23. v-for="item in isPauseList"
  24. :key="item.value"
  25. :label="item.label"
  26. :value="item.value"
  27. ></el-option>
  28. </el-select>
  29. </el-form-item>
  30. <el-form-item>
  31. <el-button type="primary" @click="goSearchByCondition">搜索</el-button>
  32. <el-button type="warning" @click="resetForm">重置</el-button>
  33. </el-form-item>
  34. </el-form>
  35. <!--表格渲染-->
  36. <el-table
  37. ref="table"
  38. border
  39. size="small"
  40. :data="list"
  41. :header-cell-style="{textAlign:'center'}"
  42. :cell-style="{textAlign:'center'}"
  43. >
  44. <el-table-column label="序号" type="index" width="50" />
  45. <el-table-column label="任务ID" prop="jobId" />
  46. <el-table-column label="任务名称" prop="jobName" />
  47. <el-table-column label="SpringBean名称" prop="beanName" />
  48. <el-table-column label="方法名称" prop="methodName" />
  49. <el-table-column label="参数" prop="params">
  50. <template slot-scope="scope">
  51. <el-button type="text" @click="showParams(scope.row)">查看参数</el-button>
  52. </template>
  53. </el-table-column>
  54. <el-table-column label="cron表达式" prop="cronExpression" />
  55. <el-table-column label="运行状态" prop="isPause">
  56. <template slot-scope="scope">{{ scope.row.isPause | getStatus}}</template>
  57. </el-table-column>
  58. <el-table-column label="描述" prop="description" />
  59. <el-table-column label="创建时间" prop="createTime" />
  60. <el-table-column label="操作" width="310">
  61. <template slot-scope="scope">
  62. <!-- <el-button type="info" @click="modifyStatus(scope.row.jobId)">恢复</el-button> -->
  63. <el-button
  64. type="info"
  65. @click="modifyStatus(scope.row.jobId)"
  66. >{{scope.row.isPause ?'恢复':'暂停'}}</el-button>
  67. <el-button type="primary" @click="executionById(scope.row.jobId)">执行</el-button>
  68. <el-button type="warning" @click="editById(scope.row)">修改</el-button>
  69. <el-button type="danger" @click="delById(scope.row.jobId)">删除</el-button>
  70. </template>
  71. </el-table-column>
  72. </el-table>
  73. <!--分页-->
  74. <div class="mt_15">
  75. <el-pagination
  76. @size-change="handleSizeChange"
  77. @current-change="handleCurrentChange"
  78. :current-page="searchParm.page"
  79. :page-sizes="[10, 20, 30, 40, 50]"
  80. :page-size="searchParm.pageSize"
  81. layout="total, sizes, prev, pager, next, jumper"
  82. :total="total"
  83. ></el-pagination>
  84. </div>
  85. <!--新增弹窗-->
  86. <el-dialog :visible.sync="dialogAddVisible" :title="dialogAddTitle" center width="45%">
  87. <div class="dialog-content">
  88. <el-form ref="ruleForm" size="small" :model="addParm" :rules="rules" label-width="130px">
  89. <el-form-item label="任务名称" prop="jobName">
  90. <el-input v-model="addParm.jobName" clearable></el-input>
  91. </el-form-item>
  92. <el-form-item label="SpringBean名称" hidden prop="beanName">
  93. <el-input v-model="editParm.beanName" clearable></el-input>
  94. </el-form-item>
  95. <el-form-item label="方法名称" hidden prop="methodName">
  96. <el-input v-model="editParm.methodName" clearable></el-input>
  97. </el-form-item>
  98. <el-form-item label="描述" prop="description">
  99. <el-input v-model="addParm.description" clearable></el-input>
  100. </el-form-item>
  101. <el-form-item label="cron表达式" prop="cronExpression">
  102. <el-input v-model="addParm.cronExpression" clearable></el-input>
  103. </el-form-item>
  104. <el-form-item label="子任务ID" prop="subTask">
  105. <el-input v-model="addParm.subTask" clearable></el-input>
  106. </el-form-item>
  107. <el-form-item label="负责人" prop="personInCharge">
  108. <el-input v-model="addParm.personInCharge" clearable></el-input>
  109. </el-form-item>
  110. <el-form-item label="报警邮箱" prop="email">
  111. <el-input v-model="addParm.email" clearable></el-input>
  112. </el-form-item>
  113. <el-form-item label="失败后暂停" prop="pauseAfterFailure">
  114. <el-select v-model="addParm.pauseAfterFailure" placeholder="请选择">
  115. <el-option
  116. v-for="item in pauseAfterFailureList"
  117. :key="item.value"
  118. :label="item.label"
  119. :value="item.value"
  120. ></el-option>
  121. </el-select>`
  122. </el-form-item>
  123. <el-form-item label="运行状态" prop="isPause">
  124. <el-select v-model="addParm.isPause" placeholder="请选择">
  125. <el-option
  126. v-for="item in isPauseList"
  127. :key="item.value"
  128. :label="item.label"
  129. :value="item.value"
  130. ></el-option>
  131. </el-select>
  132. </el-form-item>
  133. <el-form-item label="设备名称" prop="rebotName">
  134. <el-input v-model="addParm.rebotName" disabled="true" style="width:200px" />
  135. <el-button
  136. type="primary"
  137. icon="el-icon-search"
  138. @click="goSearchRebot"
  139. style="width:130px"
  140. >请选择设备</el-button>
  141. </el-form-item>
  142. <el-form-item label="应用名称" prop="applyId">
  143. <el-select v-model="addParm.applyId" @change="applyClick" placeholder="请选择">
  144. <el-option
  145. v-for="item in applys"
  146. :key="item.name"
  147. :label="item.name"
  148. :value="item.id"
  149. ></el-option>
  150. </el-select>
  151. </el-form-item>
  152. </el-form>
  153. <div id="app">
  154. <el-form class="base-form" ref="baseForm" :model="baseForm">
  155. <el-table
  156. ref="table-input"
  157. class="table"
  158. highlight-current-row
  159. :data="baseForm.demoList"
  160. @row-click="selectItem"
  161. >
  162. <el-table-column label="参数名称">
  163. <template slot-scope="scope">
  164. <el-form-item :prop="'demoList.'+scope.$index+'.name'" class="all">
  165. <el-input v-model="scope.row.name" placeholder="请输入"></el-input>
  166. </el-form-item>
  167. </template>
  168. </el-table-column>
  169. <el-table-column label="参数值">
  170. <template slot-scope="scope">
  171. <el-form-item :prop="'demoList.'+scope.$index+'.value'" class="all">
  172. <el-input v-model="scope.row.value" placeholder="请输入"></el-input>
  173. </el-form-item>
  174. </template>
  175. </el-table-column>
  176. <el-table-column label="参数类型">
  177. <template slot-scope="scope">
  178. <el-form-item :prop="'demoList.'+scope.$index+'.type'" class="all">
  179. <el-input v-model="scope.row.type" placeholder="请输入"></el-input>
  180. </el-form-item>
  181. </template>
  182. </el-table-column>
  183. <el-table-column prop label="操作">
  184. <template>
  185. <div class="flex-c-a">
  186. <el-button type="primary" @click="addLine()">增加</el-button>
  187. <el-button type="danger">删除</el-button>
  188. </div>
  189. </template>
  190. </el-table-column>
  191. </el-table>
  192. </el-form>
  193. </div>
  194. </div>
  195. <span slot="footer">
  196. <el-button type="info" @click="dialogAddVisible=flase">取消</el-button>
  197. <el-button type="primary" @click="sureAdd">确认</el-button>
  198. </span>
  199. </el-dialog>
  200. <!--修改弹窗-->
  201. <el-dialog :visible.sync="dialogEditVisible" :title="dialogEditTitle" center width="45%">
  202. <div class="dialog-content">
  203. <el-form ref="ruleForm" size="small" :model="editParm" :rules="rules" label-width="130px">
  204. <el-form-item label="任务名称" prop="jobName">
  205. <el-input v-model="editParm.jobName" clearable></el-input>
  206. </el-form-item>
  207. <el-form-item label="描述" prop="description">
  208. <el-input v-model="editParm.description" clearable></el-input>
  209. </el-form-item>
  210. <el-form-item label="SpringBean名称" hidden prop="beanName">
  211. <el-input v-model="editParm.beanName" clearable></el-input>
  212. </el-form-item>
  213. <el-form-item label="方法名称" hidden prop="methodName">
  214. <el-input v-model="editParm.methodName" hidden clearable></el-input>
  215. </el-form-item>
  216. <el-form-item label="cron表达式" prop="cronExpression">
  217. <el-input v-model="editParm.cronExpression" clearable></el-input>
  218. </el-form-item>
  219. <el-form-item label="子任务ID" prop="subTask">
  220. <el-input v-model="editParm.subTask" clearable></el-input>
  221. </el-form-item>
  222. <el-form-item label="负责人" prop="personInCharge">
  223. <el-input v-model="editParm.personInCharge" clearable></el-input>
  224. </el-form-item>
  225. <el-form-item label="报警邮箱" prop="email">
  226. <el-input v-model="editParm.email" clearable></el-input>
  227. </el-form-item>
  228. <el-form-item label="失败后暂停" prop="pauseAfterFailure">
  229. <el-select v-model="editParm.pauseAfterFailure" placeholder="请选择">
  230. <el-option
  231. v-for="item in pauseAfterFailureList"
  232. :key="item.value"
  233. :label="item.label"
  234. :value="item.value"
  235. ></el-option>
  236. </el-select>`
  237. </el-form-item>
  238. <el-form-item label="运行状态" prop="isPause">
  239. <el-select v-model="editParm.isPause" placeholder="请选择">
  240. <el-option
  241. v-for="item in isPauseList"
  242. :key="item.value"
  243. :label="item.label"
  244. :value="item.value"
  245. ></el-option>
  246. </el-select>
  247. </el-form-item>
  248. <el-form-item label="设备名称" prop="rebotName">
  249. <el-input v-model="editParm.rebotName" disabled="true" style="width:200px" />
  250. <el-button
  251. type="primary"
  252. icon="el-icon-search"
  253. @click="goSearchRebot"
  254. style="width:130px"
  255. >请选择设备</el-button>
  256. </el-form-item>
  257. <el-form-item label="应用名称" prop="applyId">
  258. <el-select v-model="editParm.applyId" @change="applyClick" placeholder="请选择">
  259. <el-option
  260. v-for="item in applys"
  261. :key="item.name"
  262. :label="item.name"
  263. :value="item.id"
  264. ></el-option>
  265. </el-select>
  266. </el-form-item>
  267. </el-form>
  268. <div id="app">
  269. <el-form class="base-form" ref="baseForm" :model="baseForm">
  270. <el-table
  271. ref="table-input"
  272. class="table"
  273. highlight-current-row
  274. :data="baseForm.demoList"
  275. @row-click="selectItem"
  276. >
  277. <el-table-column label="参数名称">
  278. <template slot-scope="scope">
  279. <el-form-item :prop="'demoList.'+scope.$index+'.name'" class="all">
  280. <el-input v-model="scope.row.name" placeholder="请输入"></el-input>
  281. </el-form-item>
  282. </template>
  283. </el-table-column>
  284. <el-table-column label="参数值">
  285. <template slot-scope="scope">
  286. <el-form-item :prop="'demoList.'+scope.$index+'.value'" class="all">
  287. <el-input v-model="scope.row.value" placeholder="请输入"></el-input>
  288. </el-form-item>
  289. </template>
  290. </el-table-column>
  291. <el-table-column label="参数类型">
  292. <template slot-scope="scope">
  293. <el-form-item :prop="'demoList.'+scope.$index+'.type'" class="all">
  294. <el-input v-model="scope.row.type" placeholder="请输入"></el-input>
  295. </el-form-item>
  296. </template>
  297. </el-table-column>
  298. <el-table-column prop label="操作">
  299. <template>
  300. <div class="flex-c-a">
  301. <el-button type="primary" @click="addLine()">增加</el-button>
  302. <el-button type="danger">删除</el-button>
  303. </div>
  304. </template>
  305. </el-table-column>
  306. </el-table>
  307. </el-form>
  308. </div>
  309. </div>
  310. <span slot="footer">
  311. <el-button type="info" @click="dialogEditVisible=false">取消</el-button>
  312. <el-button type="primary" @click="sureEdit">确认</el-button>
  313. </span>
  314. </el-dialog>
  315. <!--日志弹窗-->
  316. <el-dialog
  317. width="75%"
  318. :visible.sync="dialogLogsListVisible"
  319. :title="dialogLogsListTitle"
  320. center
  321. append-to-body
  322. >
  323. <!-- 搜索日志 -->
  324. <el-form class="mt_15" ref="form" inline size="small">
  325. <el-form-item label="任务名称">
  326. <el-input v-model="searchLogsParm.jobName" clearable placeholder="任务名称"></el-input>
  327. </el-form-item>
  328. <el-date-picker
  329. v-model="searchLogsTime"
  330. type="daterange"
  331. range-separator=":"
  332. start-placeholder="开始日期"
  333. end-placeholder="结束日期"
  334. style="width:270px"
  335. ></el-date-picker>
  336. <el-form-item label="状态">
  337. <el-input v-model="searchLogsParm.isSuccess" clearable placeholder="状态"></el-input>
  338. </el-form-item>
  339. <el-form-item>
  340. <el-button type="primary" @click="goSearchLogsByCondition">搜索</el-button>
  341. <el-button type="warning" @click="resetLogsForm">重置</el-button>
  342. </el-form-item>
  343. </el-form>
  344. <!--表格渲染-->
  345. <el-table
  346. ref="table"
  347. border
  348. size="small"
  349. :data="logsList"
  350. :header-cell-style="{textAlign:'center'}"
  351. :cell-style="{textAlign:'center'}"
  352. >
  353. <el-table-column label="任务名称" prop="jobName" />
  354. <el-table-column label="Bean名称" prop="beanName" />
  355. <el-table-column label="执行方法" prop="methodName" />
  356. <el-table-column label="参数">
  357. <template slot-scope="scope">
  358. <el-button type="text" @click="showParams(scope.row)">查看参数</el-button>
  359. </template>
  360. </el-table-column>
  361. <el-table-column label="cron表达式" prop="cronExpression" />
  362. <el-table-column label="异常详情" prop="exceptionDetail">
  363. <template slot-scope="scope">
  364. <el-button type="text" @click="showDetail(scope.row)">查看异常详情</el-button>
  365. </template>
  366. </el-table-column>
  367. <el-table-column label="耗时(毫秒)" prop="time" />
  368. <el-table-column label="状态" prop="isSuccess">
  369. <template slot-scope="scope">{{ scope.row.isSuccess | getLogIsSuccess}}</template>
  370. </el-table-column>
  371. <el-table-column label="创建日期" prop="createTime" />
  372. </el-table>
  373. <!--分页-->
  374. <div class="mt_15">
  375. <el-pagination
  376. @size-change="handleSizeChange"
  377. @current-change="handleCurrentChange"
  378. :current-page="searchLogsParm.page"
  379. :page-sizes="[10, 20, 30, 40, 50]"
  380. :page-size="searchLogsParm.pageSize"
  381. layout="total, sizes, prev, pager, next, jumper"
  382. :total="logsTotal"
  383. ></el-pagination>
  384. </div>
  385. </el-dialog>
  386. <!--设备选择弹窗-->
  387. <el-dialog
  388. width="75%"
  389. :visible.sync="dialogRebotListVisible"
  390. :title="dialogRebotListTitle"
  391. center
  392. append-to-body
  393. >
  394. <!--搜索-->
  395. <el-form class="mt_15" ref="form" inline size="small">
  396. <el-form-item label="机器人账号">
  397. <el-input v-model="searchRebotParm.accountName" clearable placeholder="机器人账号"></el-input>
  398. </el-form-item>
  399. <el-form-item label="uuid">
  400. <el-input v-model="searchRebotParm.robotClientUuid" clearable placeholder="uuid"></el-input>
  401. </el-form-item>
  402. <el-form-item>
  403. <el-button type="primary" @click="goSearchRebot">搜索</el-button>
  404. <el-button type="warning" @click="resetRebotForm">重置</el-button>
  405. </el-form-item>
  406. </el-form>
  407. <!--表格渲染-->
  408. <el-table
  409. ref="table"
  410. border
  411. size="small"
  412. :data="rebotList"
  413. :header-cell-style="{textAlign:'center'}"
  414. :cell-style="{textAlign:'center'}"
  415. >
  416. <el-table-column label="序号" type="index" width="50" />
  417. <el-table-column label="机器人账号" prop="accountName" />
  418. <el-table-column label="uuid信息" prop="robotClientUuid" />
  419. <el-table-column label="状态" prop="status">
  420. <template slot-scope="scope">{{ scope.row.status | getRebotStatus}}</template>
  421. </el-table-column>
  422. <el-table-column label="创建时间" prop="createdAt" />
  423. <el-table-column label="修改时间" prop="updatedAt" />
  424. <el-table-column label="操作" width="220">
  425. <template slot-scope="scope">
  426. <el-button type="success" @click="pickRebot(scope.row)">选中</el-button>
  427. </template>
  428. </el-table-column>
  429. </el-table>
  430. <!--分页-->
  431. <div class="mt_15">
  432. <el-pagination
  433. @size-change="handleSizeChange"
  434. @current-change="handleCurrentChange"
  435. :current-page="searchRebotParm.page"
  436. :page-sizes="[10, 20, 30, 40, 50]"
  437. :page-size="searchRebotParm.pageSize"
  438. layout="total, sizes, prev, pager, next, jumper"
  439. :total="this.rebotTotal"
  440. ></el-pagination>
  441. </div>
  442. </el-dialog>
  443. <!--參數詳情-->
  444. <el-dialog
  445. :title="dialogParamTitle"
  446. :visible.sync="dialogParamVisible"
  447. width="30%"
  448. style="overflow: hidden"
  449. >
  450. <div style="overflow-y: auto; height: 310px">
  451. <json-viewer :value="paramJsonData" :expand-depth="5" copyable boxed sort></json-viewer>
  452. </div>
  453. <span slot="footer" class="dialog-footer">
  454. <el-button type="primary" @click="dialogParamVisible = false">确定</el-button>
  455. </span>
  456. </el-dialog>
  457. <!--异常详情-->
  458. <el-dialog :title="dialogExceTitle" :visible.sync="dialogExceVisible" width="30%">
  459. <div v-text="this.exceptionDetail" />
  460. </el-dialog>
  461. </div>
  462. </template>
  463. <script>
  464. import {
  465. getList,
  466. add,
  467. editById,
  468. delById,
  469. getById,
  470. modifyStatus,
  471. executionById,
  472. getLogsList
  473. } from "@/api/group/quartzJob";
  474. import { getAll } from "@/api/group/apply";
  475. import { getFreeList } from "@/api/group/rebot";
  476. import Vue from "vue";
  477. import JsonViewer from "vue-json-viewer";
  478. Vue.use(JsonViewer);
  479. export default {
  480. filters: {
  481. getStatus: function(value) {
  482. if (value == 1) {
  483. return "已暂停";
  484. } else if (value == 0) {
  485. return "运行中";
  486. }
  487. },
  488. getLogIsSuccess: function(value) {
  489. if (value == 1) {
  490. return "成功";
  491. } else if (value == 0) {
  492. return "失败";
  493. }
  494. },
  495. getRebotStatus: function(value) {
  496. if (value == 0) {
  497. return "未占用";
  498. } else if (value == 1) {
  499. return "已占用";
  500. }
  501. }
  502. },
  503. // 数据
  504. data() {
  505. return {
  506. searchParm: {
  507. page: 1,
  508. pageSize: 10,
  509. sort: "job_id",
  510. order: "desc",
  511. jobName: null,
  512. isPause: null,
  513. sTime: null,
  514. eTime: null
  515. },
  516. searchLogsParm: {
  517. page: 1,
  518. pageSize: 10,
  519. sort: "log_id",
  520. order: "desc",
  521. jobName: null,
  522. isSuccess: null,
  523. sTime: null,
  524. eTime: null
  525. },
  526. searchRebotParm: {
  527. page: 1,
  528. pageSize: 10,
  529. sort: "id",
  530. order: "desc",
  531. accountName: null,
  532. robotClientUuid: null
  533. },
  534. logsTotal: 0,
  535. rebotTotal: 0,
  536. total: 0,
  537. logsList: [],
  538. list: [],
  539. baseForm: {
  540. demoList: [
  541. {
  542. name: null,
  543. value: null,
  544. type: null
  545. }
  546. ]
  547. },
  548. newParams: {
  549. name: "",
  550. value: "",
  551. type: ""
  552. },
  553. index: 0,
  554. //新增、修改弹窗判断:1新增、2修改
  555. isEdit: 0,
  556. rebotList: [],
  557. applys: [],
  558. searchTime: "",
  559. searchLogsTime: "",
  560. paramJsonData: "",
  561. params: [],
  562. taskParam: {
  563. name: null,
  564. value: null,
  565. type: null
  566. },
  567. requestParams: {
  568. accountName: null,
  569. applyId: null,
  570. params: null
  571. },
  572. exceptionDetail: "",
  573. dialogAddVisible: false,
  574. dialogAddTitle: "新增",
  575. dialogEditVisible: false,
  576. dialogEditTitle: "修改",
  577. dialogImportVisible: false,
  578. dialogLogsListTitle: "操作日志",
  579. dialogLogsListVisible: false,
  580. dialogRebotListTitle: "设备日志",
  581. dialogRebotListVisible: false,
  582. dialogParamVisible: false,
  583. dialogParamTitle: "参数详情",
  584. dialogExceVisible: false,
  585. dialogExceTitle: "异常详情",
  586. pauseAfterFailureList: [
  587. {
  588. value: 1,
  589. label: "是"
  590. },
  591. {
  592. value: 0,
  593. label: "否"
  594. }
  595. ],
  596. isPauseList: [
  597. {
  598. value: 1,
  599. label: "已暂停"
  600. },
  601. {
  602. value: 0,
  603. label: "运行中"
  604. }
  605. ],
  606. logIsSuccess: [
  607. {
  608. value: 0,
  609. label: "失败"
  610. },
  611. {
  612. value: 1,
  613. label: "成功"
  614. }
  615. ],
  616. addListDemo: [],
  617. addParm: {
  618. jobId: null,
  619. jobName: null,
  620. description: null,
  621. beanName: null,
  622. methodName: null,
  623. cronExpression: null,
  624. subTask: null,
  625. personInCharge: null,
  626. email: null,
  627. pauseAfterFailure: null,
  628. isPause: null,
  629. rebotName: null,
  630. applyId: null,
  631. params: null
  632. },
  633. editParm: {
  634. jobId: null,
  635. jobName: null,
  636. description: null,
  637. beanName: null,
  638. methodName: null,
  639. cronExpression: null,
  640. subTask: null,
  641. personInCharge: null,
  642. email: null,
  643. pauseAfterFailure: null,
  644. isPause: null,
  645. params: null,
  646. applyId: null,
  647. rebotName: null
  648. },
  649. testTest: null,
  650. testTestStr: "",
  651. ruleForm: {
  652. contntryShort: null,
  653. ipAddress: null,
  654. parentIpAddress: null,
  655. port: null,
  656. name: null,
  657. pwd: null,
  658. vpsType: null,
  659. dealer: null,
  660. mac: null,
  661. status: null
  662. },
  663. rules: {
  664. jobName: [
  665. { required: true, message: "请输入任务名称", trigger: "blur" }
  666. ],
  667. description: [
  668. { required: true, message: "请输入任务描述", trigger: "blur" }
  669. ],
  670. // beanName: [
  671. // { required: true, message: '请输入SpringBean名称', trigger: 'blur' }
  672. // ],
  673. // methodName: [
  674. // { required: true, message: '请输入方法名称', trigger: 'blur' }
  675. // ],
  676. cronExpression: [
  677. { required: true, message: "请输入cron表达式", trigger: "blur" }
  678. ],
  679. personInCharge: [
  680. { required: true, message: "请输入负责人", trigger: "blur" }
  681. ],
  682. pauseAfterFailure: [
  683. { required: true, message: "请选择失败后是否暂停", trigger: "blur" }
  684. ],
  685. isPause: [
  686. { required: true, message: "请选择运行状态", trigger: "blur" }
  687. ],
  688. rebotName: [{ required: true, message: "请选择设备", trigger: "blur" }],
  689. applyId: [{ required: true, message: "请选择应用", trigger: "blur" }]
  690. },
  691. paramsRules: {
  692. name: [
  693. {
  694. required: true,
  695. message: "请输入参数名称",
  696. trigger: "blur"
  697. }
  698. ],
  699. value: [
  700. {
  701. required: true,
  702. message: "请输入参数值",
  703. trigger: "blur"
  704. }
  705. ],
  706. type: [
  707. {
  708. required: true,
  709. message: "请输入参数类型",
  710. trigger: "blur"
  711. }
  712. ]
  713. }
  714. };
  715. },
  716. // 调用
  717. created() {
  718. this.goSearch();
  719. },
  720. //方法
  721. methods: {
  722. showDetail(data) {
  723. if (data.exceptionDetail == null || data.exceptionDetail == "") {
  724. this.$alert("无异常", "异常详情", {
  725. confirmButtonText: "确定",
  726. closeOnClickModal: true,
  727. closeOnPressEscape: true
  728. });
  729. } else {
  730. this.dialogExceVisible = true;
  731. this.exceptionDetail = data.exceptionDetail;
  732. }
  733. },
  734. showParams(data) {
  735. console.log(data);
  736. if (data.params == null || data.params == "") {
  737. this.$alert("无参数", "参数详情", {
  738. confirmButtonText: "确定",
  739. closeOnClickModal: true,
  740. closeOnPressEscape: true
  741. });
  742. } else {
  743. this.paramJsonData = JSON.parse(data.params);
  744. this.dialogParamVisible = true;
  745. }
  746. },
  747. applyClick(value) {
  748. this.requestParams.applyId = value;
  749. console.log(this.requestParams);
  750. },
  751. //重置
  752. resetForm() {
  753. this.searchParm.jobName = null;
  754. this.searchParm.isPause = null;
  755. this.searchParm.sTime = null;
  756. this.searchParm.eTime = null;
  757. this.searchTime = null;
  758. this.goSearch();
  759. },
  760. resetLogsForm() {
  761. this.searchLogsParm.jobName = null;
  762. this.searchLogsParm.isSuccess = null;
  763. this.searchLogsParm.sTime = null;
  764. this.searchLogsParm.eTime = null;
  765. this.searchLogsTime = null;
  766. this.goSearchLogs();
  767. },
  768. resetRebotForm() {
  769. this.searchRebotParm.accountName = null;
  770. this.searchRebotParm.robotClientUuid = null;
  771. this.goSearchRebot();
  772. },
  773. // 查询
  774. goSearchByCondition() {
  775. this.searchParm.sTime = this.searchTime[0];
  776. this.searchParm.eTime = this.searchTime[1];
  777. console.log(this.searchParm);
  778. this.goSearch();
  779. },
  780. goSearch() {
  781. this.searchParm.page = 1;
  782. this.getAllApply();
  783. this.getDataList();
  784. },
  785. goSearchLogsByCondition() {
  786. this.searchLogsParm.sTime = this.searchLogsTime[0];
  787. this.searchLogsParm.eTime = this.searchLogsTime[1];
  788. this.goSearchLogs();
  789. },
  790. goSearchLogs() {
  791. this.dialogLogsListVisible = true;
  792. this.searchLogsParm.page = 1;
  793. this.getLogsDataList();
  794. },
  795. goSearchRebot() {
  796. this.dialogRebotListVisible = true;
  797. this.searchRebotParm.page = 1;
  798. this.getRebotDataList();
  799. },
  800. // 分页获取表格数据
  801. getDataList() {
  802. getList(this.searchParm)
  803. .then(res => {
  804. if (res.code == 200) {
  805. this.list = res.data.list;
  806. this.total = res.data.total;
  807. }
  808. })
  809. .catch(err => {
  810. console.log(err);
  811. });
  812. },
  813. getLogsDataList() {
  814. getLogsList(this.searchLogsParm)
  815. .then(res => {
  816. console.log(res);
  817. if (res.code == 200) {
  818. this.logsList = res.data.list;
  819. this.logsTotal = res.data.total;
  820. }
  821. })
  822. .catch(err => {
  823. console.log(err);
  824. });
  825. },
  826. getRebotDataList() {
  827. getFreeList(this.searchRebotParm)
  828. .then(res => {
  829. console.log(res);
  830. if (res.code == 200) {
  831. this.rebotList = res.data.list;
  832. this.rebotTotal = res.data.total;
  833. }
  834. })
  835. .catch(err => {
  836. console.log(err);
  837. });
  838. },
  839. getAllApply() {
  840. getAll().then(res => {
  841. if (res.code == 200) {
  842. this.applys = res.data;
  843. }
  844. });
  845. },
  846. // 新增
  847. addBtn() {
  848. this.addParm = {
  849. id: null,
  850. jobId: null,
  851. jobName: null,
  852. description: null,
  853. beanName: null,
  854. methodName: null,
  855. cronExpression: null,
  856. subTask: null,
  857. personInCharge: null,
  858. email: null,
  859. pauseAfterFailure: null,
  860. isPause: null,
  861. params: null,
  862. applyId: null,
  863. rebotName: null
  864. };
  865. this.baseForm.demoList = [
  866. {
  867. name: "",
  868. value: "",
  869. type: ""
  870. }
  871. ];
  872. this.requestParams.applyId = "";
  873. this.requestParams.accountName = "";
  874. this.requestParams.params = "";
  875. this.addParm.params = JSON.stringify(this.requestParams);
  876. this.isEdit = 1;
  877. this.dialogAddVisible = true;
  878. },
  879. // 确认新增
  880. sureAdd() {
  881. this.$refs.baseForm.validate(valid => {
  882. if (valid) {
  883. this.requestParams.params = this.baseForm.demoList;
  884. this.addParm.params = JSON.stringify(this.requestParams);
  885. add(this.addParm)
  886. .then(res => {
  887. if (res.code == 200) {
  888. this.dialogAddVisible = false;
  889. this.$message.success("新增成功!");
  890. this.getDataList();
  891. } else if (res.code == -1) {
  892. this.$message.warning(res.message);
  893. }
  894. })
  895. .catch(err => {
  896. console.log(err);
  897. });
  898. } else {
  899. this.$message.warning("请输入所有必填项");
  900. }
  901. });
  902. },
  903. // 根据id删除
  904. delById(id) {
  905. this.$confirm("确认删除?", "提示", {
  906. confirmButtonText: "确定",
  907. cancelButtonText: "取消",
  908. type: "warning"
  909. })
  910. .then(() => {
  911. delById({ id })
  912. .then(res => {
  913. if (res.code == 200) {
  914. this.$message.success("删除成功!");
  915. this.getDataList();
  916. }
  917. })
  918. .catch(err => {
  919. console.log(err);
  920. });
  921. })
  922. .catch(() => {
  923. this.$message.info("取消删除");
  924. });
  925. },
  926. executionById(id) {
  927. executionById({ id })
  928. .then(res => {
  929. if (res.code == 200) {
  930. this.$message.success("执行成功");
  931. this.getDataList;
  932. } else {
  933. this.$message.error("执行失败");
  934. }
  935. })
  936. .catch(err => {
  937. console.log(err);
  938. });
  939. },
  940. // 修改
  941. editById(data) {
  942. getById({ id: data.jobId })
  943. .then(res => {
  944. if (res.code == 200) {
  945. this.editParm.jobId = res.data.jobId;
  946. this.editParm.jobName = res.data.jobName;
  947. this.editParm.description = res.data.description;
  948. this.editParm.beanName = res.data.beanName;
  949. this.editParm.methodName = res.data.methodName;
  950. this.editParm.cronExpression = res.data.cronExpression;
  951. this.editParm.subTask = res.data.subTask;
  952. this.editParm.personInCharge = res.data.personInCharge;
  953. this.editParm.email = res.data.email;
  954. this.editParm.pauseAfterFailure = res.data.pauseAfterFailure;
  955. this.editParm.isPause = res.data.isPause;
  956. this.editParm.params = res.data.params;
  957. this.requestParams = JSON.parse(this.editParm.params);
  958. this.editParm.rebotName = this.requestParams.accountName;
  959. this.editParm.applyId = this.requestParams.applyId;
  960. console.log(this.requestParams.params);
  961. if (this.requestParams.params.length != 0) {
  962. this.baseForm.demoList = this.requestParams.params;
  963. } else {
  964. this.baseForm.demoList = [
  965. {
  966. name: "",
  967. value: "",
  968. type: ""
  969. }
  970. ];
  971. }
  972. this.isEdit = 2;
  973. this.dialogEditVisible = true;
  974. this.$refs.ruleForm.clearValidate();
  975. }
  976. })
  977. .catch(err => {
  978. console.log(err);
  979. });
  980. },
  981. // 确认修改
  982. sureEdit() {
  983. this.$refs.baseForm.validate(valid => {
  984. if (valid) {
  985. this.requestParams.params = this.baseForm.demoList;
  986. this.editParm.params = JSON.stringify(this.requestParams);
  987. editById(this.editParm)
  988. .then(res => {
  989. if (res.code == 200) {
  990. this.dialogEditVisible = false;
  991. this.$message.success("修改成功!");
  992. this.getDataList();
  993. }
  994. })
  995. .catch(err => {
  996. console.log(err);
  997. });
  998. } else {
  999. this.$message.warning("请输入所有必填项");
  1000. }
  1001. });
  1002. },
  1003. modifyStatus(id) {
  1004. modifyStatus({ id })
  1005. .then(res => {
  1006. if (res.code == 200) {
  1007. this.$message.success("更改成功!");
  1008. this.getDataList();
  1009. }
  1010. })
  1011. .catch(err => {
  1012. console.log(err);
  1013. });
  1014. },
  1015. pickRebot(data) {
  1016. if (this.isEdit == 1) {
  1017. this.addParm.rebotName = data.accountName;
  1018. } else if (this.isEdit == 2) {
  1019. this.editParm.rebotName = data.accountName;
  1020. }
  1021. this.requestParams.accountName = data.accountName;
  1022. this.dialogRebotListVisible = false;
  1023. this.$message.success("选择成功");
  1024. },
  1025. // 分页
  1026. handleSizeChange(val) {
  1027. console.log(`每页 ${val} 条`);
  1028. this.searchParm.pageSize = val;
  1029. this.getDataList();
  1030. },
  1031. handleCurrentChange(val) {
  1032. console.log(`当前页: ${val}`);
  1033. this.searchParm.page = val;
  1034. this.getDataList();
  1035. },
  1036. // 选中某一行修改或移除
  1037. selectItem(row, column, event) {
  1038. this.selectedFundRow = row;
  1039. if (event.target.innerText == "删除") {
  1040. this.removeFundBtn(this.selectedFundRow);
  1041. }
  1042. },
  1043. // 删除指定行
  1044. removeFundBtn(params) {
  1045. this.baseForm.demoList = this.baseForm.demoList.filter(ele => {
  1046. var flag = false;
  1047. // 如果不一致,则保留该行
  1048. for (const key in params) {
  1049. if (ele[key] != params[key]) {
  1050. flag = true;
  1051. break;
  1052. }
  1053. }
  1054. return flag;
  1055. });
  1056. // 如果全部删除后没有可以点击的一行了,需要加一行空行
  1057. if (!this.baseForm.demoList.length) {
  1058. this.addLine();
  1059. }
  1060. },
  1061. // 增加一个空行, 用于录入或显示第一行
  1062. addLine() {
  1063. const newParams = {
  1064. name: "",
  1065. value: "",
  1066. type: ""
  1067. };
  1068. this.index++;
  1069. this.baseForm.demoList.push(newParams);
  1070. }
  1071. }
  1072. };
  1073. </script>
  1074. <style rel="stylesheet/scss" lang="scss" scoped>
  1075. </style>