data-set.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <template>
  2. <div>
  3. <!-- 搜索栏 -->
  4. <search-bar :conditionForm="conditionForm" @submitSearch="receiveSearch"></search-bar>
  5. <!-- 操作栏 -->
  6. <operate-bar v-if="false" :pageOptList="pageOptList" @submitPageOpt="receviceOpt"></operate-bar>
  7. <!-- 表格 -->
  8. <new-table
  9. ref="table"
  10. :tableHeader="dataSetTable"
  11. :tableUrl="dataSetlTableUrl"
  12. :condition="condition"
  13. :tableOptList="tableOptList"
  14. @submitTableOpt="receviceOpt"
  15. >
  16. </new-table>
  17. </div>
  18. </template>
  19. <script>
  20. import { dataSetlTableUrl, delDataSet, getDataSetDetail } from "@/api/data-auth.js"
  21. import { dataSetlImportUrl } from "@/api/import"
  22. import searchBar from "@/components/search-bar"
  23. import operateBar from "@/components/operate-bar"
  24. import newTable from "@/components/new-table"
  25. import { searchOpt, importOpt, detailOpt } from "@/mixins/page-opt"
  26. import { dataSetTable, tableOptList, pageOptList } from "./DataConfig.js"
  27. const area = ["1200px", "600px"]
  28. const labelWidth = "180px"
  29. export default {
  30. components: { searchBar, operateBar, newTable },
  31. mixins: [searchOpt, importOpt, detailOpt],
  32. data() {
  33. return {
  34. dataSetlTableUrl,
  35. dataSetTable,
  36. tableOptList: ["详情", "删除"],
  37. pageOptList: ["导入"],
  38. conditionForm: [
  39. {
  40. label: "数据资源名称",
  41. name: "resourceName",
  42. op: "like",
  43. value: "",
  44. component: "ElInput"
  45. }
  46. ],
  47. details: {}
  48. }
  49. },
  50. computed: {},
  51. methods: {
  52. async receviceOpt(opt, row) {
  53. const otherParams = {
  54. config: dataSetTable,
  55. labelWidth,
  56. area
  57. }
  58. if (opt == "详情") {
  59. this.details = row
  60. this.handleViewDetail(row.id, otherParams)
  61. } else if (opt == "删除") {
  62. this.handleDelete(row)
  63. } else if (opt == "导入") {
  64. this.handleImport(dataSetlImportUrl, "appData", "数据集导入")
  65. }
  66. },
  67. /**
  68. * 删除
  69. */
  70. handleDelete(row) {
  71. this.$dgConfirm(`是否确定删除这条数据!`, "提示", {}).then(() => {
  72. delDataSet(row.id).then(res => {
  73. this.$message.success("删除成功!")
  74. this.handleSearch()
  75. })
  76. })
  77. },
  78. /**
  79. * 获取详情
  80. */
  81. // getDetail(id) {
  82. // return new Promise((resolve) => {
  83. // getDataSetDetail(id).then((res) => {
  84. // resolve(res.data.content);
  85. // });
  86. // });
  87. // },
  88. getDetail() {
  89. return new Promise(resolve => {
  90. resolve(this.details)
  91. })
  92. }
  93. },
  94. created() {},
  95. mounted() {}
  96. }
  97. </script>
  98. <style lang="scss" scoped>
  99. @import url("./index.scss");
  100. </style>