index.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. <!--
  2. 服务资源管理
  3. @Author: linqian
  4. @Date: 2021-05-17 13:53
  5. -->
  6. <template>
  7. <div>
  8. <!-- 搜索栏 -->
  9. <search-bar :conditionForm="conditionForm" @submitSearch="receiveSearch"></search-bar>
  10. <!-- 操作栏 -->
  11. <operate-bar :pageOptList="pageOptList" @submitPageOpt="receviceOpt"></operate-bar>
  12. <!-- 表格 -->
  13. <new-table
  14. ref="table"
  15. :tableHeader="tableHeader"
  16. :tableUrl="tableUrl"
  17. :condition="condition"
  18. :tableOptList="tableOptList"
  19. @submitTableOpt="receviceOpt"
  20. >
  21. </new-table>
  22. </div>
  23. </template>
  24. <script>
  25. import searchBar from '@/components/search-bar';
  26. import operateBar from '@/components/operate-bar';
  27. import newTable from '@/components/new-table';
  28. import { conditionForm, pageOptList, tableOptList, tableHeader } from './DataConfig';
  29. import { searchOpt, importOpt, syncOpt } from '@/mixins/page-opt';
  30. import * as Api from '@/api/ser-resource-manage';
  31. import { serviceImportUrl } from '@/api/import';
  32. import { authSerSyncUrl } from '@/api/sync';
  33. import addForm from './add-form';
  34. export default {
  35. components: {
  36. searchBar,
  37. operateBar,
  38. newTable
  39. },
  40. mixins: [searchOpt, importOpt, syncOpt],
  41. data() {
  42. return {
  43. conditionForm,
  44. pageOptList,
  45. tableOptList,
  46. tableHeader,
  47. tableUrl: Api.tableUrl
  48. };
  49. },
  50. computed: {},
  51. methods: {
  52. /**
  53. * 接收操作事件
  54. */
  55. receviceOpt(type, row) {
  56. if (type == '修改') {
  57. this.handleEdit(row);
  58. } else if (type == '新增') {
  59. this.handleAdd();
  60. } else if (type == '详情') {
  61. this.handleViewDetail(row);
  62. } else if (type == '删除') {
  63. this.handleDelete(row);
  64. } else if (type == '导入') {
  65. this.handleImport(serviceImportUrl, 'serviceResource');
  66. } else if (type == '同步') {
  67. this.handleSync(authSerSyncUrl);
  68. }
  69. },
  70. /**
  71. * 编辑
  72. */
  73. handleEdit(row) {
  74. this.handleOpenForm(row.id, '修改');
  75. },
  76. /**
  77. * 查看详情
  78. */
  79. handleViewDetail(row) {
  80. this.handleOpenForm(row.id, '详情', true);
  81. },
  82. /**
  83. * 新增
  84. */
  85. handleAdd() {
  86. this.handleOpenForm(void 0, '新增');
  87. },
  88. handleOpenForm(id, title, isDetail = false) {
  89. const vm = this;
  90. const layer = this.$dgLayer({
  91. title,
  92. content: addForm,
  93. props: {
  94. id,
  95. isDetail
  96. },
  97. on: {
  98. success() {
  99. vm.handleSearch();
  100. layer.close(layer.dialogIndex);
  101. }
  102. },
  103. area: ['800px', '550px']
  104. });
  105. },
  106. /**
  107. * 删除
  108. */
  109. handleDelete(row) {
  110. this.$dgConfirm(`是否确定删除这条数据!`, '提示', {}).then(() => {
  111. Api.del(row.id).then((res) => {
  112. this.$message.success(res);
  113. this.handleSearch();
  114. });
  115. });
  116. }
  117. },
  118. created() {},
  119. mounted() {}
  120. };
  121. </script>
  122. <style lang='scss'>
  123. </style>