alterTask.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. <template>
  2. <div>
  3. <el-dialog
  4. v-dialog-drag
  5. class="dialog"
  6. title="修改任务内容"
  7. :visible.sync="dialogVisible"
  8. width="480px"
  9. height="400px"
  10. left
  11. >
  12. <el-divider></el-divider>
  13. <el-form ref="form" label-position="left" label-width="75px">
  14. <el-form-item label="任务名称:">
  15. <el-input v-model="form.name"></el-input>
  16. </el-form-item>
  17. <el-form-item label="任务组名:">
  18. <el-select v-model="form.groupName" placeholder="请输入任务组名">
  19. <el-option
  20. v-for="item in taskGroupOptions"
  21. :key="item.value"
  22. :value="item.value"
  23. :label="item.label"
  24. ></el-option>
  25. </el-select>
  26. </el-form-item>
  27. <el-form-item label="调用方法:">
  28. <div style="display: flex">
  29. <el-tooltip effect="light" content="提示信息" placement="top-start">
  30. <i class="el-icon-question" style="padding: 13px 5px 0 0"></i>
  31. </el-tooltip>
  32. <el-input class="method" v-model="form.method"></el-input>
  33. </div>
  34. </el-form-item>
  35. <el-form-item label-width="100px" label="cron表达式:">
  36. <el-input
  37. class="cron_xepression"
  38. v-model="form.cron_expression"
  39. ></el-input>
  40. </el-form-item>
  41. <el-button
  42. type="text"
  43. style="margin: 0px 0 0 330px; color: #2ea8e6"
  44. @click="showDialog"
  45. >生成表达式</el-button
  46. >
  47. </el-form>
  48. <div slot="footer">
  49. <el-button style="background: #2ea8e6" @click="resetForm('form')"
  50. >重置</el-button
  51. >
  52. <el-button
  53. style="background: #2ea8e6"
  54. type="primary"
  55. @click="submitForm('form')"
  56. >确认</el-button
  57. >
  58. </div>
  59. <el-dialog
  60. v-dialog-drag
  61. class="innerDialog"
  62. title="cron 表达式生成器"
  63. :visible.sync="showCron"
  64. width="30%"
  65. append-to-body
  66. >
  67. <el-divider></el-divider>
  68. <div style="width: 100%; height: 100%; overflow-y: auto">
  69. <vabCron
  70. @hide="showCron = false"
  71. @fill="crontabFill"
  72. :expression="expression"
  73. ></vabCron>
  74. </div>
  75. </el-dialog>
  76. </el-dialog>
  77. </div>
  78. </template>
  79. <script>
  80. import vabCron from "vab-cron";
  81. export default {
  82. components: { vabCron },
  83. data() {
  84. return {
  85. expression: "",
  86. dialogVisible: false,
  87. showCron: false,
  88. activeName: "min",
  89. radio: 2,
  90. num1: 1,
  91. num2: 1,
  92. form: {
  93. taskID: "",
  94. name: "",
  95. groupName: "",
  96. method: "",
  97. cron_expression: "",
  98. assignValue: "",
  99. minitesValue: 1,
  100. },
  101. innerForm1: {},
  102. innerForm2: {},
  103. innerForm3: {},
  104. minitesOptions: [],
  105. secondsOptions: [],
  106. hoursOptions: [],
  107. taskGroupOptions: [
  108. {
  109. value: "",
  110. label: "全部",
  111. },
  112. {
  113. value: 1,
  114. label: "系统",
  115. },
  116. ],
  117. };
  118. },
  119. mounted() {
  120. this.initData();
  121. },
  122. methods: {
  123. crontabFill(value) {
  124. this.form.cron_expression = value;
  125. this.showCron = false;
  126. },
  127. showDialog() {
  128. this.expression = this.form.cron_expression;
  129. this.showCron = true;
  130. },
  131. initData() {
  132. this.minitesOptions = [];
  133. for (let i = 1; i < 60; i++) {
  134. this.minitesOptions.push({
  135. value: i,
  136. label: i < 10 ? "0" + i : i,
  137. });
  138. }
  139. },
  140. handleNodeClick() {},
  141. cronExpression() {
  142. this.$refs.cron_expression.dialogVisible = true;
  143. },
  144. resetForm() {
  145. this.form.cron_expression = "";
  146. this.form.groupName = "";
  147. },
  148. submitForm() {
  149. this.$emit("submitForm", this.form);
  150. },
  151. },
  152. };
  153. </script>
  154. <style lang="less" scoped>
  155. /deep/.el-dialog {
  156. // height: 480px !important;
  157. }
  158. .el-radio {
  159. margin-top: 20px;
  160. }
  161. .el-input-number {
  162. // width: 100px !important;
  163. // height: 30px !important;
  164. /deep/.el-input__inner {
  165. width: 180px !important;
  166. height: 40px !important;
  167. }
  168. }
  169. /deep/.el-tabs__content {
  170. height: 200px;
  171. padding: 0;
  172. }
  173. .el-form {
  174. .el-form-item {
  175. margin: 20px 0 0 40px;
  176. width: 400px;
  177. /deep/.el-form-item__label {
  178. padding: 0;
  179. font-size: 15px;
  180. }
  181. /deep/.el-input__inner {
  182. width: 300px;
  183. height: 30px;
  184. }
  185. .method {
  186. /deep/.el-input__inner {
  187. width: 281px !important;
  188. }
  189. }
  190. .cron_xepression {
  191. /deep/.el-input__inner {
  192. width: 275px !important;
  193. }
  194. }
  195. }
  196. }
  197. /deep/.el-dialog__header {
  198. padding-bottom: 0;
  199. color: #333333;
  200. text-align: left;
  201. }
  202. // /deep/.el-dialog__title {
  203. // margin-right: 330px;
  204. // }
  205. /deep/.el-dialog__headerbtn {
  206. font-size: 25px;
  207. }
  208. /deep/.el-dialog__body {
  209. padding: 0;
  210. }
  211. /deep/.el-divider--horizontal {
  212. display: block;
  213. height: 1px;
  214. width: 95%;
  215. margin: 0;
  216. margin-left: 2.5%;
  217. }
  218. /deep/.el-dialog__footer {
  219. text-align: center;
  220. }
  221. .el-button {
  222. width: 100px;
  223. height: 30px;
  224. text-align: center;
  225. margin: 30px;
  226. padding: 5px;
  227. &:nth-child(1) {
  228. background: #2ea8e6;
  229. color: #fff;
  230. }
  231. &:nth-child(2) {
  232. color: #fff;
  233. background: #2ea8e6;
  234. }
  235. &:nth-child(3) {
  236. background: #2ea8e6;
  237. color: #fff;
  238. }
  239. }
  240. </style>