index.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
  4. <el-form-item label="空间ID" prop="spaceId">
  5. <el-input
  6. v-model="queryParams.spaceId"
  7. placeholder="请输入空间ID"
  8. clearable
  9. @keyup.enter.native="handleQuery"
  10. />
  11. </el-form-item>
  12. <el-form-item label="当前容量" prop="currentCap">
  13. <el-input
  14. v-model="queryParams.currentCap"
  15. placeholder="请输入当前容量"
  16. clearable
  17. @keyup.enter.native="handleQuery"
  18. />
  19. </el-form-item>
  20. <el-form-item label="扩充容量" prop="expandCap">
  21. <el-input
  22. v-model="queryParams.expandCap"
  23. placeholder="请输入扩充容量"
  24. clearable
  25. @keyup.enter.native="handleQuery"
  26. />
  27. </el-form-item>
  28. <el-form-item>
  29. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  30. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  31. </el-form-item>
  32. </el-form>
  33. <el-row :gutter="10" class="mb8">
  34. <el-col :span="1.5">
  35. <el-button
  36. type="primary"
  37. plain
  38. icon="el-icon-plus"
  39. size="mini"
  40. @click="handleAdd"
  41. v-hasPermi="['doc:expand:add']"
  42. >新增</el-button>
  43. </el-col>
  44. <el-col :span="1.5">
  45. <el-button
  46. type="success"
  47. plain
  48. icon="el-icon-edit"
  49. size="mini"
  50. :disabled="single"
  51. @click="handleUpdate"
  52. v-hasPermi="['doc:expand:edit']"
  53. >修改</el-button>
  54. </el-col>
  55. <el-col :span="1.5">
  56. <el-button
  57. type="danger"
  58. plain
  59. icon="el-icon-delete"
  60. size="mini"
  61. :disabled="multiple"
  62. @click="handleDelete"
  63. v-hasPermi="['doc:expand:remove']"
  64. >删除</el-button>
  65. </el-col>
  66. <el-col :span="1.5">
  67. <el-button
  68. type="warning"
  69. plain
  70. icon="el-icon-download"
  71. size="mini"
  72. @click="handleExport"
  73. v-hasPermi="['doc:expand:export']"
  74. >导出</el-button>
  75. </el-col>
  76. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  77. </el-row>
  78. <el-table v-loading="loading" :data="expandList" @selection-change="handleSelectionChange">
  79. <el-table-column type="selection" width="55" align="center" />
  80. <el-table-column label="容量信息ID" align="center" prop="expandId" />
  81. <el-table-column label="空间ID" align="center" prop="spaceId" />
  82. <el-table-column label="当前容量" align="center" prop="currentCap" />
  83. <el-table-column label="扩充容量" align="center" prop="expandCap" />
  84. <el-table-column label="扩容状态" align="center" prop="expandStatus" />
  85. <el-table-column label="备注" align="center" prop="remark" />
  86. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  87. <template slot-scope="scope">
  88. <el-button
  89. size="mini"
  90. type="text"
  91. icon="el-icon-edit"
  92. @click="handleUpdate(scope.row)"
  93. v-hasPermi="['doc:expand:edit']"
  94. >修改</el-button>
  95. <el-button
  96. size="mini"
  97. type="text"
  98. icon="el-icon-delete"
  99. @click="handleDelete(scope.row)"
  100. v-hasPermi="['doc:expand:remove']"
  101. >删除</el-button>
  102. </template>
  103. </el-table-column>
  104. </el-table>
  105. <pagination
  106. v-show="total>0"
  107. :total="total"
  108. :page.sync="queryParams.pageNum"
  109. :limit.sync="queryParams.pageSize"
  110. @pagination="getList"
  111. />
  112. <!-- 添加或修改扩容申请对话框 -->
  113. <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
  114. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  115. <el-form-item label="当前容量" prop="currentCap">
  116. <el-input v-model="form.currentCap" placeholder="请输入当前容量" />
  117. </el-form-item>
  118. <el-form-item label="扩充容量" prop="expandCap">
  119. <el-input v-model="form.expandCap" placeholder="请输入扩充容量" />
  120. </el-form-item>
  121. <el-form-item label="备注" prop="remark">
  122. <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
  123. </el-form-item>
  124. </el-form>
  125. <div slot="footer" class="dialog-footer">
  126. <el-button type="primary" @click="submitForm">确 定</el-button>
  127. <el-button @click="cancel">取 消</el-button>
  128. </div>
  129. </el-dialog>
  130. </div>
  131. </template>
  132. <script>
  133. import { listExpand, getExpand, delExpand, addExpand, updateExpand } from "@/api/doc/expand";
  134. export default {
  135. name: "Expand",
  136. data() {
  137. return {
  138. // 遮罩层
  139. loading: true,
  140. // 选中数组
  141. ids: [],
  142. // 非单个禁用
  143. single: true,
  144. // 非多个禁用
  145. multiple: true,
  146. // 显示搜索条件
  147. showSearch: true,
  148. // 总条数
  149. total: 0,
  150. // 扩容申请表格数据
  151. expandList: [],
  152. // 弹出层标题
  153. title: "",
  154. // 是否显示弹出层
  155. open: false,
  156. // 查询参数
  157. queryParams: {
  158. pageNum: 1,
  159. pageSize: 10,
  160. spaceId: null,
  161. currentCap: null,
  162. expandCap: null,
  163. },
  164. // 表单参数
  165. form: {},
  166. // 表单校验
  167. rules: {
  168. expandCap: [
  169. { required: true, message: "扩充容量不能为空", trigger: "blur" }
  170. ],
  171. remark: [
  172. { required: true, message: "备注不能为空", trigger: "blur" }
  173. ],
  174. }
  175. };
  176. },
  177. created() {
  178. this.getList();
  179. },
  180. methods: {
  181. /** 查询扩容申请列表 */
  182. getList() {
  183. this.loading = true;
  184. listExpand(this.queryParams).then(response => {
  185. this.expandList = response.rows;
  186. this.total = response.total;
  187. this.loading = false;
  188. });
  189. },
  190. // 取消按钮
  191. cancel() {
  192. this.open = false;
  193. this.reset();
  194. },
  195. // 表单重置
  196. reset() {
  197. this.form = {
  198. expandId: null,
  199. spaceId: null,
  200. currentCap: null,
  201. expandCap: null,
  202. expandStatus: null,
  203. createBy: null,
  204. createTime: null,
  205. updateBy: null,
  206. updateTime: null,
  207. remark: null,
  208. isDel: null
  209. };
  210. this.resetForm("form");
  211. },
  212. /** 搜索按钮操作 */
  213. handleQuery() {
  214. this.queryParams.pageNum = 1;
  215. this.getList();
  216. },
  217. /** 重置按钮操作 */
  218. resetQuery() {
  219. this.resetForm("queryForm");
  220. this.handleQuery();
  221. },
  222. // 多选框选中数据
  223. handleSelectionChange(selection) {
  224. this.ids = selection.map(item => item.expandId)
  225. this.single = selection.length!==1
  226. this.multiple = !selection.length
  227. },
  228. /** 新增按钮操作 */
  229. handleAdd() {
  230. this.reset();
  231. this.open = true;
  232. this.title = "添加扩容申请";
  233. },
  234. /** 修改按钮操作 */
  235. handleUpdate(row) {
  236. this.reset();
  237. const expandId = row.expandId || this.ids
  238. getExpand(expandId).then(response => {
  239. this.form = response.data;
  240. this.open = true;
  241. this.title = "修改扩容申请";
  242. });
  243. },
  244. /** 提交按钮 */
  245. submitForm() {
  246. this.$refs["form"].validate(valid => {
  247. if (valid) {
  248. if (this.form.expandId != null) {
  249. updateExpand(this.form).then(response => {
  250. this.$modal.msgSuccess("修改成功");
  251. this.open = false;
  252. this.getList();
  253. });
  254. } else {
  255. addExpand(this.form).then(response => {
  256. this.$modal.msgSuccess("新增成功");
  257. this.open = false;
  258. this.getList();
  259. });
  260. }
  261. }
  262. });
  263. },
  264. /** 删除按钮操作 */
  265. handleDelete(row) {
  266. const expandIds = row.expandId || this.ids;
  267. this.$modal.confirm('是否确认删除扩容申请编号为"' + expandIds + '"的数据项?').then(function() {
  268. return delExpand(expandIds);
  269. }).then(() => {
  270. this.getList();
  271. this.$modal.msgSuccess("删除成功");
  272. }).catch(() => {});
  273. },
  274. /** 导出按钮操作 */
  275. handleExport() {
  276. this.download('doc/expand/export', {
  277. ...this.queryParams
  278. }, `expand_${new Date().getTime()}.xlsx`)
  279. }
  280. }
  281. };
  282. </script>