123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133 |
- <!--
- 字段分类表码列表
- @Author: linqian
- @Date: 2021-03-31 15:30:11
- -->
- <template>
- <div>
- <!-- 搜索栏 -->
- <search-bar :conditionForm="fieldSortConditionForm" @submitSearch="receiveSearch"></search-bar>
- <!-- 操作栏 -->
- <operate-bar :pageOptList="pageOptList" @submitPageOpt="receviceOpt"></operate-bar>
- <!-- 列表 -->
- <new-table
- ref="table"
- :tableUrl="fieldClassifyTableUrl"
- :tableHeader="tableHeader"
- :condition="condition"
- :tableOptList="tableOptList"
- @submitTableOpt="receviceOpt"
- >
- </new-table>
- </div>
- </template>
- <script>
- import searchBar from '@/components/search-bar';
- import operateBar from '@/components/operate-bar';
- import newTable from '@/components/new-table';
- import { fieldSortConfig, pageOptList, tableOptList, fieldSortConditionForm } from './DataConfig';
- import { fieldClassifyTableUrl, delFieldClassify, getFieldClassifyDetail, saveFieldClassify, updateFieldClassify } from '@/api/data-auth';
- import { fieldSortSyncUrl } from '@/api/sync';
- import { searchOpt, importOpt, syncOpt, addEditOpt } from '@/mixins/page-opt';
- const area = ['900px', '400px'];
- const labelWidth = '160px';
- export default {
- components: { searchBar, operateBar, newTable },
- mixins: [searchOpt, importOpt, syncOpt, addEditOpt],
- data() {
- return {
- fieldClassifyTableUrl,
- tableHeader: fieldSortConfig,
- fieldSortConditionForm,
- tableOptList: tableOptList.slice(1, 3),
- pageOptList: ["新增", "同步", "同步数据资源"],
- };
- },
- computed: {},
- methods: {
- async receviceOpt(opt, row) {
- const otherParams = {
- config: fieldSortConfig,
- labelWidth,
- area
- };
- if (opt == '新增') {
- this.handleOpenEditForm('新增', 'add', otherParams);
- } else if (opt == '修改') {
- const detailInfo = await this.getDetail(row.secId);
- this.handleOpenEditForm('编辑', 'update', { ...otherParams, detailInfo });
- this.handleEdit(row);
- } else if (opt == '详情') {
- this.handleViewDetail(row);
- } else if (opt == '删除') {
- this.handleDelete(row);
- } else if (opt == '同步') {
- this.handleSync(fieldSortSyncUrl);
- } else if (opt == '导入') {
- // this.handleImport(dataLevelImportUrl, 'dataLevel', '数据资源分类表码导入');
- } else if (opt == '同步数据资源') {
-
- }
- },
- /**
- * 获取详情
- */
- getDetail(id) {
- return new Promise((resolve) => {
- getFieldClassifyDetail(id).then((res) => {
- resolve(res.data.content);
- });
- });
- },
- /**
- * 删除
- */
- handleDelete(row, e) {
- this.$dgConfirm(`是否确定删除这条数据!`, '提示', {}).then(() => {
- delFieldClassify(row.secId).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) => {
- saveFieldClassify(form).then((res) => {
- resolve(res);
- });
- });
- },
- update(form) {
- return new Promise((resolve) => {
- updateFieldClassify(form).then((res) => {
- resolve(res);
- });
- });
- }
- },
- created() {},
- mounted() {}
- };
- </script>
- <style lang='scss'>
- @import url('./index.scss');
- </style>
|