Browse Source

新增元数据查看功能

master
long 3 years ago
parent
commit
39209bb3e3
  1. 44
      src/api/system/Nftdata.js
  2. 243
      src/views/nftData/index.vue

44
src/api/system/Nftdata.js

@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询区块链元数据元数据列表
export function listNftdata(query) {
return request({
url: '/system/Nftdata/list',
method: 'get',
params: query
})
}
// 查询区块链元数据元数据详细
export function getNftdata(id) {
return request({
url: '/system/Nftdata/' + id,
method: 'get'
})
}
// 新增区块链元数据元数据
export function addNftdata(data) {
return request({
url: '/system/Nftdata',
method: 'post',
data: data
})
}
// 修改区块链元数据元数据
export function updateNftdata(data) {
return request({
url: '/system/Nftdata',
method: 'put',
data: data
})
}
// 删除区块链元数据元数据
export function delNftdata(id) {
return request({
url: '/system/Nftdata/' + id,
method: 'delete'
})
}

243
src/views/nftData/index.vue

@ -0,0 +1,243 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="150px">
<el-form-item label="域名地址" prop="domainName">
<el-input
v-model="queryParams.domainName"
placeholder="请输入域名地址"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="一级文件夹名称" prop="folderName">
<el-input
v-model="queryParams.folderName"
placeholder="请输入一级文件夹名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="二级文件夹名称" prop="yearName">
<el-input
v-model="queryParams.yearName"
placeholder="请输入二级文件夹名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="元数据内容" prop="metadata">
<el-input
v-model="queryParams.metadata"
placeholder="请输入元数据内容"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="元数据创建时间" prop="createTime">
<el-date-picker clearable
v-model="queryParams.createTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择元数据创建时间">
</el-date-picker>
</el-form-item>
<el-form-item label="修改时间" prop="updateTime">
<el-date-picker clearable
v-model="queryParams.updateTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="修改时间">
</el-date-picker>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-table v-loading="loading" :data="NftdataList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="id" align="center" prop="id" />
<el-table-column label="域名地址" align="center" prop="domainName" />
<el-table-column label="一级文件夹名称" align="center" prop="folderName" />
<el-table-column label="二级文件夹名称" align="center" prop="yearName" />
<el-table-column label="元数据内容" align="center" prop="metadata" />
<el-table-column label="元数据创建时间" align="center" prop="createTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="如果链上地址访问不到时会被触发" align="center" prop="updateTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.updateTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改区块链元数据元数据对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listNftdata, getNftdata, delNftdata, addNftdata, updateNftdata } from "@/api/system/Nftdata";
export default {
name: "Nftdata",
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
NftdataList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
domainName: null,
folderName: null,
yearName: null,
metadata: null,
createTime: null,
updateTime: null
},
//
form: {},
//
rules: {
}
};
},
created() {
this.getList();
},
methods: {
/** 查询区块链元数据元数据列表 */
getList() {
this.loading = true;
listNftdata(this.queryParams).then(response => {
this.NftdataList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
domainName: null,
folderName: null,
yearName: null,
metadata: null,
createTime: null,
updateTime: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加区块链元数据元数据";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getNftdata(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改区块链元数据元数据";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateNftdata(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addNftdata(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除区块链元数据元数据编号为"' + ids + '"的数据项?').then(function() {
return delNftdata(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('system/Nftdata/export', {
...this.queryParams
}, `Nftdata_${new Date().getTime()}.xlsx`)
}
}
};
</script>
Loading…
Cancel
Save