|
@@ -1,143 +1,144 @@
|
|
-<!--
|
|
|
|
-数据资源分类表码列表
|
|
|
|
-@Author: linqian
|
|
|
|
-@Date: 2021-03-31 15:30:11
|
|
|
|
--->
|
|
|
|
<template>
|
|
<template>
|
|
- <div>
|
|
|
|
- <!-- 搜索栏 -->
|
|
|
|
- <search-bar :conditionForm="sourceSortConditionForm" @submitSearch="receiveSearch"></search-bar>
|
|
|
|
- <!-- 操作栏 -->
|
|
|
|
- <operate-bar :pageOptList="pageOptList" @submitPageOpt="receviceOpt"></operate-bar>
|
|
|
|
- <!-- 列表 -->
|
|
|
|
- <new-table
|
|
|
|
- ref="table"
|
|
|
|
- :tableUrl="dataSourceClaTableUrl"
|
|
|
|
- :tableHeader="tableHeader"
|
|
|
|
- :condition="condition"
|
|
|
|
- :tableOptList="tableOptList"
|
|
|
|
- @submitTableOpt="receviceOpt"
|
|
|
|
- >
|
|
|
|
- </new-table>
|
|
|
|
- </div>
|
|
|
|
|
|
+ <div>
|
|
|
|
+ <!-- 搜索栏 -->
|
|
|
|
+ <search-bar :conditionForm="sourceSortConditionForm" @submitSearch="receiveSearch"></search-bar>
|
|
|
|
+ <!-- 操作栏 -->
|
|
|
|
+ <operate-bar :pageOptList="pageOptList" @submitPageOpt="receviceOpt"></operate-bar>
|
|
|
|
+ <!-- 列表 -->
|
|
|
|
+ <new-table
|
|
|
|
+ ref="table"
|
|
|
|
+ :tableUrl="dataSourceClaTableUrl"
|
|
|
|
+ :tableHeader="tableHeader"
|
|
|
|
+ :condition="condition"
|
|
|
|
+ :tableOptList="tableOptList"
|
|
|
|
+ @submitTableOpt="receviceOpt"
|
|
|
|
+ >
|
|
|
|
+ </new-table>
|
|
|
|
+ </div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
import {
|
|
import {
|
|
- dataSourceClaTableUrl,
|
|
|
|
- delDataSourceCla,
|
|
|
|
- getDataSourceClaDetail,
|
|
|
|
- saveDataSourceCla,
|
|
|
|
- updateDataSourceCla
|
|
|
|
-} from '@/api/data-auth';
|
|
|
|
-import { dataSourceSyncUrl, tableColumnSyncUrl } from '@/api/sync';
|
|
|
|
-import searchBar from '@/components/search-bar';
|
|
|
|
-import operateBar from '@/components/operate-bar';
|
|
|
|
-import newTable from '@/components/new-table';
|
|
|
|
-import { sourceSortConfig, pageOptList, tableOptList, sourceSortConditionForm } from './DataConfig';
|
|
|
|
-import { searchOpt, importOpt, syncOpt, addEditOpt, detailOpt } from '@/mixins/page-opt';
|
|
|
|
-const area = ['900px', '600px'];
|
|
|
|
-const labelWidth = '160px';
|
|
|
|
|
|
+ dataSourceClaTableUrl,
|
|
|
|
+ delDataSourceCla,
|
|
|
|
+ getDataSourceClaDetail,
|
|
|
|
+ saveDataSourceCla,
|
|
|
|
+ updateDataSourceCla
|
|
|
|
+} from "@/api/data-auth"
|
|
|
|
+import { dataSourceSyncUrl, tableColumnSyncUrl } from "@/api/sync"
|
|
|
|
+import searchBar from "@/components/search-bar"
|
|
|
|
+import operateBar from "@/components/operate-bar"
|
|
|
|
+import newTable from "@/components/new-table"
|
|
|
|
+import { sourceSortConfig, pageOptList, tableOptList, sourceSortConditionForm } from "./DataConfig"
|
|
|
|
+import { searchOpt, importOpt, syncOpt, addEditOpt, detailOpt } from "@/mixins/page-opt"
|
|
|
|
+const area = ["900px", "600px"]
|
|
|
|
+const labelWidth = "160px"
|
|
export default {
|
|
export default {
|
|
- components: { searchBar, operateBar, newTable },
|
|
|
|
- mixins: [searchOpt, importOpt, syncOpt, addEditOpt, detailOpt],
|
|
|
|
- data() {
|
|
|
|
- return {
|
|
|
|
- dataSourceClaTableUrl,
|
|
|
|
- sourceSortConditionForm,
|
|
|
|
- tableHeader: sourceSortConfig.slice(0, -1),
|
|
|
|
- pageOptList: ["新增", "同步", "同步数据资源"],
|
|
|
|
- tableOptList,
|
|
|
|
- optList: [
|
|
|
|
- { icon: 'el-icon-edit', tooltip: '修改', on: this.handleEdit },
|
|
|
|
- { icon: 'el-icon-document', tooltip: '详情', on: this.handleViewDetail },
|
|
|
|
- { icon: 'el-icon-delete', tooltip: '删除', on: this.handleDelete }
|
|
|
|
- ]
|
|
|
|
- };
|
|
|
|
- },
|
|
|
|
- computed: {},
|
|
|
|
- methods: {
|
|
|
|
- async receviceOpt(opt, row) {
|
|
|
|
- const otherParams = {
|
|
|
|
- config: sourceSortConfig,
|
|
|
|
- labelWidth,
|
|
|
|
- area
|
|
|
|
- };
|
|
|
|
- if (opt == '新增') {
|
|
|
|
- this.handleOpenEditForm('新增', 'add', otherParams);
|
|
|
|
- } else if (opt == '修改') {
|
|
|
|
- const detailInfo = await this.getDetail(row.labId);
|
|
|
|
- this.handleOpenEditForm('编辑', 'update', { ...otherParams, detailInfo });
|
|
|
|
- } else if (opt == '详情') {
|
|
|
|
- this.handleViewDetail(row.labId, otherParams);
|
|
|
|
- } else if (opt == '删除') {
|
|
|
|
- this.handleDelete(row);
|
|
|
|
- } else if (opt == '同步') {
|
|
|
|
- this.handleSync(dataSourceSyncUrl);
|
|
|
|
- } else if (opt == '导入') {
|
|
|
|
- // this.handleImport(dataLevelImportUrl, 'dataLevel', '数据资源分类表码导入');
|
|
|
|
- } else if (opt == '同步数据资源') {
|
|
|
|
- this.handleSync(tableColumnSyncUrl);
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- /**
|
|
|
|
- * 获取详情
|
|
|
|
- */
|
|
|
|
- getDetail(id) {
|
|
|
|
- return new Promise((resolve) => {
|
|
|
|
- getDataSourceClaDetail(id).then((res) => {
|
|
|
|
- resolve(res.data.content);
|
|
|
|
- });
|
|
|
|
- });
|
|
|
|
|
|
+ components: { searchBar, operateBar, newTable },
|
|
|
|
+ mixins: [searchOpt, importOpt, syncOpt, addEditOpt, detailOpt],
|
|
|
|
+ data() {
|
|
|
|
+ return {
|
|
|
|
+ dataSourceClaTableUrl,
|
|
|
|
+ sourceSortConditionForm,
|
|
|
|
+ tableHeader: sourceSortConfig.slice(0, -1),
|
|
|
|
+ pageOptList: ["新增", "同步"],
|
|
|
|
+ tableOptList,
|
|
|
|
+ optList: [
|
|
|
|
+ { icon: "el-icon-edit", tooltip: "修改", on: this.handleEdit },
|
|
|
|
+ { icon: "el-icon-document", tooltip: "详情", on: this.handleViewDetail },
|
|
|
|
+ { icon: "el-icon-delete", tooltip: "删除", on: this.handleDelete }
|
|
|
|
+ ]
|
|
|
|
+ }
|
|
},
|
|
},
|
|
|
|
+ computed: {},
|
|
|
|
+ methods: {
|
|
|
|
+ async receviceOpt(opt, row) {
|
|
|
|
+ const otherParams = {
|
|
|
|
+ config: sourceSortConfig,
|
|
|
|
+ labelWidth,
|
|
|
|
+ area
|
|
|
|
+ }
|
|
|
|
+ if (opt == "新增") {
|
|
|
|
+ this.handleOpenEditForm("新增", "add", otherParams)
|
|
|
|
+ }
|
|
|
|
+ if (opt == "修改") {
|
|
|
|
+ const detailInfo = await this.getDetail(row.labId)
|
|
|
|
+ this.handleOpenEditForm("编辑", "update", { ...otherParams, detailInfo })
|
|
|
|
+ }
|
|
|
|
+ if (opt == "详情") {
|
|
|
|
+ this.handleViewDetail(row.labId, otherParams)
|
|
|
|
+ }
|
|
|
|
+ if (opt == "删除") {
|
|
|
|
+ this.handleDelete(row)
|
|
|
|
+ }
|
|
|
|
+ if (opt == "同步") {
|
|
|
|
+ this.handleSync(dataSourceSyncUrl)
|
|
|
|
+ }
|
|
|
|
+ if (opt == "导入") {
|
|
|
|
+ // this.handleImport(dataLevelImportUrl, 'dataLevel', '数据资源分类表码导入');
|
|
|
|
+ }
|
|
|
|
+ if (opt == "同步数据资源") {
|
|
|
|
+ this.handleSync(tableColumnSyncUrl)
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ /**
|
|
|
|
+ * 获取详情
|
|
|
|
+ */
|
|
|
|
+ getDetail(id) {
|
|
|
|
+ return new Promise(resolve => {
|
|
|
|
+ getDataSourceClaDetail(id).then(res => {
|
|
|
|
+ resolve(res.data.content)
|
|
|
|
+ })
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
|
|
- /**
|
|
|
|
- * 删除
|
|
|
|
- */
|
|
|
|
- handleDelete(row, e) {
|
|
|
|
- this.$dgConfirm(`是否确定删除这条数据!`, '提示', {}).then(() => {
|
|
|
|
- delDataSourceCla(row.labId).then((res) => {
|
|
|
|
- this.$message.success('删除成功!');
|
|
|
|
- this.handleSearch();
|
|
|
|
- });
|
|
|
|
- });
|
|
|
|
- },
|
|
|
|
- /**
|
|
|
|
- * @description: 保存表单
|
|
|
|
- * @param { 表单数据 } form
|
|
|
|
- * @param { 新增还是编辑 } type
|
|
|
|
- * @param { 弹框 } layer
|
|
|
|
- */
|
|
|
|
- async saveForm(form, type, layer) {
|
|
|
|
- const res = type == 'update' ? await this.update(form) : await this.add(form);
|
|
|
|
- if (res.data.result == '200') {
|
|
|
|
- this.$message.success('保存成功');
|
|
|
|
- layer.close(layer.dialogIndex);
|
|
|
|
- this.handleSearch();
|
|
|
|
- } else {
|
|
|
|
- this.$message.warning(res.data.msg);
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- add(form) {
|
|
|
|
- return new Promise((resolve) => {
|
|
|
|
- saveDataSourceCla(form).then((res) => {
|
|
|
|
- resolve(res);
|
|
|
|
- });
|
|
|
|
- });
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 删除
|
|
|
|
+ */
|
|
|
|
+ handleDelete(row, e) {
|
|
|
|
+ this.$dgConfirm(`是否确定删除这条数据!`, "提示", {}).then(() => {
|
|
|
|
+ delDataSourceCla(row.labId).then(res => {
|
|
|
|
+ this.$message.success("删除成功!")
|
|
|
|
+ this.handleSearch()
|
|
|
|
+ })
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ /**
|
|
|
|
+ * @description: 保存表单
|
|
|
|
+ * @param { 表单数据 } form
|
|
|
|
+ * @param { 新增还是编辑 } type
|
|
|
|
+ * @param { 弹框 } layer
|
|
|
|
+ */
|
|
|
|
+ async saveForm(form, type, layer) {
|
|
|
|
+ const res = type == "update" ? await this.update(form) : await this.add(form)
|
|
|
|
+ if (res.data.result == "200") {
|
|
|
|
+ this.$message.success("保存成功")
|
|
|
|
+ layer.close(layer.dialogIndex)
|
|
|
|
+ this.handleSearch()
|
|
|
|
+ } else {
|
|
|
|
+ this.$message.warning(res.data.msg)
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ add(form) {
|
|
|
|
+ return new Promise(resolve => {
|
|
|
|
+ saveDataSourceCla(form).then(res => {
|
|
|
|
+ resolve(res)
|
|
|
|
+ })
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ update(form) {
|
|
|
|
+ return new Promise(resolve => {
|
|
|
|
+ updateDataSourceCla(form).then(res => {
|
|
|
|
+ resolve(res)
|
|
|
|
+ })
|
|
|
|
+ })
|
|
|
|
+ }
|
|
},
|
|
},
|
|
- update(form) {
|
|
|
|
- return new Promise((resolve) => {
|
|
|
|
- updateDataSourceCla(form).then((res) => {
|
|
|
|
- resolve(res);
|
|
|
|
- });
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- created() {},
|
|
|
|
- mounted() {}
|
|
|
|
-};
|
|
|
|
|
|
+ created() {},
|
|
|
|
+ mounted() {}
|
|
|
|
+}
|
|
</script>
|
|
</script>
|
|
|
|
|
|
-<style lang='scss'>
|
|
|
|
-@import url('./index.scss');
|
|
|
|
-</style>
|
|
|
|
|
|
+<style lang="scss">
|
|
|
|
+@import url("./index.scss");
|
|
|
|
+</style>
|