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.

125 lines
2.9 KiB

12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
  1. <template>
  2. <view class="main batchExecution">
  3. <view class="pad">
  4. <u--form labelPosition="left" :model="FormData" ref="uForm" labelWidth="160rpx">
  5. <u-form-item label="执行机器" :required="true" @click="$goPage('/pages/sub/batchExecution/selectMachine')">
  6. <!-- <u--input v-model="FormData.sex" placeholder="请选择" disabledColor="#ffffff" style="pointer-events: none;"
  7. border="none"></u--input> -->
  8. <view class="blueTxt">忆选择{{FormData.machineIdList.length}}台机器</view>
  9. <u-icon slot="right" name="arrow-right"></u-icon>
  10. </u-form-item>
  11. <u-form-item label="执行命令" :required="true">
  12. <view class="blueTxt" @click="$goPage('/pages/sub/batchExecution/selectTemplate')">选择模版</view>
  13. <u-icon slot="right" name="arrow-right"></u-icon>
  14. </u-form-item>
  15. <view class="modalBox">
  16. <view class="modalCon">
  17. {{FormData.command}}
  18. </view>
  19. <!-- <Editor ref="editor" :value="FormData.command" /> -->
  20. </view>
  21. <u-form-item label="执行描述" :required="true">
  22. <u--input v-model="FormData.name" border="none" placeholder="请输入"></u--input>
  23. </u-form-item>
  24. </u--form>
  25. </view>
  26. <view class="btn_row">
  27. <view class="btnBg" @click="batchExecFn"> </view>
  28. </view>
  29. </view>
  30. </template>
  31. <script>
  32. import {
  33. batchExec
  34. } from '@/config/api.js'
  35. // import Editor from './aceEditor.vue'
  36. export default {
  37. components: {
  38. // Editor
  39. },
  40. data() {
  41. return {
  42. FormData: {
  43. command: '',
  44. description: '',
  45. sendLf: true, //这不知道什么参数
  46. machineIdList: []
  47. },
  48. }
  49. },
  50. onLoad() {
  51. uni.$on('chooseMachine', (listId) => {
  52. this.FormData.machineIdList = listId
  53. })
  54. uni.$on('pickTemplate', (temp) => {
  55. this.FormData.command = temp.value
  56. })
  57. },
  58. methods: {
  59. async batchExecFn() {
  60. // this.FormData.command = this.$refs.editor.getValue()
  61. if (!this.FormData.machineIdList.length) {
  62. this.$u.toast('请选择执行机器')
  63. return
  64. }
  65. const command = this.FormData.command
  66. if (!command.trim().length) {
  67. this.$u.toast('请输入执行命令')
  68. return
  69. }
  70. if (command.length > 2048) {
  71. this.$u.toast(`执行命令不能超过2048位 当前${command.length}`)
  72. return
  73. }
  74. const {
  75. data: res
  76. } = await batchExec(this.FormData)
  77. this.$goPage('/pages/sub/batchExecution/executionDetails?relId=' + res[0].execId)
  78. }
  79. }
  80. }
  81. </script>
  82. <style>
  83. .batchExecution .u-form-item {
  84. background-color: #ffff;
  85. border-radius: 6rpx;
  86. padding: 0 34rpx;
  87. margin-bottom: 30rpx;
  88. }
  89. </style>
  90. <style lang="scss" scoped>
  91. .btn_row {
  92. padding: 40rpx;
  93. .btnBg {
  94. width: 100%;
  95. }
  96. }
  97. .blueTxt {
  98. color: $themC;
  99. text-align: right;
  100. width: 100%;
  101. }
  102. .pad {
  103. padding: 32rpx;
  104. }
  105. .modalBox {
  106. background-color: #fff;
  107. padding: 0 30rpx 20rpx 30rpx;
  108. transform: translateY(-30rpx);
  109. .modalCon {
  110. width: 100%;
  111. background-color: #f5f5f5;
  112. padding: 20px;
  113. }
  114. }
  115. </style>