index.vue 11 KB

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