diff --git a/src/views/tag/index.vue b/src/views/tag/index.vue index 4fce25e..ce0fcd5 100644 --- a/src/views/tag/index.vue +++ b/src/views/tag/index.vue @@ -8,24 +8,32 @@
-
+
标签列表 新增标签
- + - + @@ -33,11 +41,12 @@ 查询 @@ -57,7 +66,7 @@ 重置 @@ -75,9 +84,9 @@ - + 编辑新增二级删除 + + + + + + + + + + + + + + 取消 + 确定 + +
@@ -157,9 +211,49 @@ export default { name: "Tag", data() { return { - list: null, - listLoading: false, - daterange: null + // 查询表单 + queryForm: { + remoteData: { + publisher: [] + }, + lastQuery: {}, + data: { + tagName: null, + publisher: null, + timeRange: [] + } + }, + // 表格 + table: { + loadinng: true, + data: [], + page: { + current: 1, + size: 10, + total: 0 + } + }, + // 新增修改弹窗 + modifyDialog: { + visible: false, + type: 0, // 0for新增 1for编辑 2for新增2级 + form: { + rules: { + zhName: [ + { required: true, message: "请输入中文名称", trigger: "blur" } + ], + enName: [ + { required: true, message: "请输入英文名称", trigger: "blur" } + ] + }, + data: { + parent: null, + zhName: null, + enName: null + } + } + }, + dialogVisible: false }; }, filters: {}, @@ -170,31 +264,133 @@ export default { log(e) { this.$message.success(e); }, + // ************************* 数据查询 ************************* + /** + * 查询表格数据 + */ fetchData() { - this.listLoading = true; - this.list = [ - { title: "title1", inUse: true }, - { title: "title2", inUse: false }, - { title: "title2", inUse: false }, - { title: "title2", inUse: false } - ]; - this.listLoading = false; + // 记录上一次查询条件 + this.queryForm.lastQuery = this.queryForm.data; + console.log("formData", this.queryForm.data); + console.log("pageData", this.table.page); + // 加载数据 + this.table.loading = true; + for (let i = 0; i < 10; i++) { + this.table.data.push({ + zhName: "title1", + enName: "enname", + inUse: true + }); + } + // page + this.table.page.total = 20; + this.table.loading = false; + }, + // ************************* 按扭事件 ************************* + /** + * 查询按扭点击事件 + */ + handleQueryClick() { + this.table.page.current = 1; + this.table.page.total = 0; + this.fetchData(); + }, + /** + * 重置点击事件 + */ + handleResetClick() { + this.queryForm.data = { + tagName: null, + publisher: null, + timeRange: [] + }; + }, + /** + * 新建标签点击事件 + */ + handleAddClick() { + this.modifyDialog.type = 0; + this.modifyDialog.visible = true; + }, + /** + * 编辑标签点击事件 + */ + handleModifyClick(row) { + console.log(row); + this.modifyDialog.type = 1; + this.modifyDialog.visible = true; + }, + /** + * 新增二级点击事件 + */ + handleAddSubClick(row) { + console.log(row); + this.modifyDialog.form.data.parent = row["zhName"]; + this.modifyDialog.type = 2; + this.modifyDialog.visible = true; + }, + /** + * 弹窗取消按扭点击事件 + */ + handleDialogCancel() { + this.modifyDialog.visible = false; + }, + /** + * 弹窗确定按扭点击事件 + */ + handleDialogSubmit() { + console.log(this.modifyDialog.form.data); + this.modifyDialog.visible = false; + }, + /** + * 分页组件页数变化事件 + */ + handlePageCurrentChange() { + console.log(this.table.page.size + " " + this.table.page.current); + }, + /** + * 分页组件大小变化事件 + */ + handlePageSizeChange(val) { + this.table.page.size = val; + console.log(this.table.page.size + " " + this.table.page.current); } } };