Rap 原分销系统代码Web
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

145 líneas
5.8KB

  1. <template>
  2. <div class="app-container">
  3. <!--工具栏-->
  4. <div class="head-container">
  5. <div v-if="crud.props.searchToggle">
  6. <!-- 搜索 -->
  7. <el-input v-model="query.name" clearable placeholder="输入名称搜索" style="width: 200px" class="filter-item" @keyup.enter.native="crud.toQuery" />
  8. <date-range-picker v-model="query.createTime" class="date-item" />
  9. <rrOperation />
  10. </div>
  11. <crudOperation :permission="permission">
  12. <el-button
  13. slot="left"
  14. v-permission="['admin','app:add']"
  15. :disabled="!currentRow"
  16. class="filter-item"
  17. size="mini"
  18. type="primary"
  19. icon="el-icon-plus"
  20. @click="copy"
  21. >复制</el-button>
  22. </crudOperation>
  23. </div>
  24. <!--表单组件-->
  25. <el-dialog append-to-body :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="800px">
  26. <el-form ref="form" :model="form" :rules="rules" size="small" label-width="100px">
  27. <el-form-item label="应用名称" prop="name">
  28. <el-input v-model="form.name" style="width: 670px" placeholder="部署后的文件或者目录名称,用于备份" />
  29. </el-form-item>
  30. <el-form-item label="应用端口" prop="port">
  31. <el-input-number v-model.number="form.port" placeholder="例如:8080" />
  32. </el-form-item>
  33. <el-form-item label="上传目录" prop="uploadPath">
  34. <el-input v-model="form.uploadPath" style="width: 670px" placeholder="例如: /opt/upload" />
  35. </el-form-item>
  36. <el-form-item label="部署目录" prop="deployPath">
  37. <el-input v-model="form.deployPath" style="width: 670px" placeholder="例如: /opt/app" />
  38. </el-form-item>
  39. <el-form-item label="备份目录" prop="backupPath">
  40. <el-input v-model="form.backupPath" style="width: 670px" placeholder="例如: /opt/backup" />
  41. </el-form-item>
  42. <el-form-item label="部署脚本" prop="deployScript">
  43. <el-input v-model="form.deployScript" :rows="3" type="textarea" autosize style="width: 670px" placeholder="" />
  44. </el-form-item>
  45. <el-form-item label="启动脚本" prop="startScript">
  46. <el-input v-model="form.startScript" :rows="3" type="textarea" autosize style="width: 670px" placeholder="" />
  47. </el-form-item>
  48. </el-form>
  49. <div slot="footer" class="dialog-footer">
  50. <el-button type="text" @click="crud.cancelCU">取消</el-button>
  51. <el-button :loading="crud.status.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
  52. </div>
  53. </el-dialog>
  54. <!--表格渲染-->
  55. <el-table ref="table" v-loading="crud.loading" :data="crud.data" highlight-current-row style="width: 100%" @selection-change="crud.selectionChangeHandler" @current-change="handleCurrentChange">
  56. <el-table-column type="selection" width="55" />
  57. <el-table-column prop="name" label="应用名称" />
  58. <el-table-column prop="port" label="端口号" />
  59. <el-table-column prop="uploadPath" label="上传目录" />
  60. <el-table-column prop="deployPath" label="部署目录" />
  61. <el-table-column prop="backupPath" label="备份目录" />
  62. <el-table-column prop="createTime" label="创建日期" />
  63. <el-table-column v-if="checkPer(['admin','app:edit','app:del'])" label="操作" width="150px" align="center">
  64. <template slot-scope="scope">
  65. <udOperation
  66. :data="scope.row"
  67. :permission="permission"
  68. />
  69. </template>
  70. </el-table-column>
  71. </el-table>
  72. <!--分页组件-->
  73. <pagination />
  74. </div>
  75. </template>
  76. <script>
  77. import crudApp from '@/api/mnt/app'
  78. import CRUD, { presenter, header, form, crud } from '@crud/crud'
  79. import rrOperation from '@crud/RR.operation'
  80. import crudOperation from '@crud/CRUD.operation'
  81. import udOperation from '@crud/UD.operation'
  82. import pagination from '@crud/Pagination'
  83. import DateRangePicker from '@/components/DateRangePicker'
  84. const defaultForm = { id: null, name: null, port: 8080, uploadPath: '/opt/upload', deployPath: '/opt/app', backupPath: '/opt/backup', startScript: null, deployScript: null }
  85. export default {
  86. name: 'App',
  87. components: { pagination, crudOperation, rrOperation, udOperation, DateRangePicker },
  88. cruds() {
  89. return CRUD({ title: '应用', url: 'api/app', crudMethod: { ...crudApp }})
  90. },
  91. mixins: [presenter(), header(), form(defaultForm), crud()],
  92. data() {
  93. return {
  94. currentRow: null,
  95. permission: {
  96. add: ['admin', 'app:add'],
  97. edit: ['admin', 'app:edit'],
  98. del: ['admin', 'app:del']
  99. },
  100. rules: {
  101. name: [
  102. { required: true, message: '请输入应用名称', trigger: 'blur' }
  103. ],
  104. port: [
  105. { required: true, message: '请输入应用端口', trigger: 'blur', type: 'number' }
  106. ],
  107. uploadPath: [
  108. { required: true, message: '请输入上传目录', trigger: 'blur' }
  109. ],
  110. deployPath: [
  111. { required: true, message: '请输入部署目录', trigger: 'blur' }
  112. ],
  113. backupPath: [
  114. { required: true, message: '请输入备份目录', trigger: 'blur' }
  115. ],
  116. startScript: [
  117. { required: true, message: '请输入启动脚本', trigger: 'blur' }
  118. ],
  119. deployScript: [
  120. { required: true, message: '请输入部署脚本', trigger: 'blur' }
  121. ]
  122. }
  123. }
  124. },
  125. methods: {
  126. copy() {
  127. for (const key in this.currentRow) {
  128. this.form[key] = this.currentRow[key]
  129. }
  130. this.form.id = null
  131. this.form.createTime = null
  132. this.crud.toAdd()
  133. },
  134. handleCurrentChange(row) {
  135. this.currentRow = JSON.parse(JSON.stringify(row))
  136. }
  137. }
  138. }
  139. </script>
  140. <style scoped>
  141. </style>