|
@@ -7,6 +7,12 @@
|
|
|
@search-change="searchChange"
|
|
|
@current-change="currentChange"
|
|
|
@size-change="sizeChange"
|
|
|
+ :table-loading="loading"
|
|
|
+ @on-load="onLoad"
|
|
|
+ @search-reset="searchReset"
|
|
|
+ @row-update="rowUpdate"
|
|
|
+ @row-save="rowSave"
|
|
|
+ @row-del="rowDel"
|
|
|
>
|
|
|
<template
|
|
|
slot-scope="scope"
|
|
@@ -26,53 +32,17 @@
|
|
|
|
|
|
|
|
|
<script>
|
|
|
-
|
|
|
+import { getListPage,update,remove } from "@/api/measure/template.js";
|
|
|
export default {
|
|
|
data () {
|
|
|
return {
|
|
|
- data: [
|
|
|
- {
|
|
|
- name: '广西二级路公路计量单元划分模板',
|
|
|
- tips: '备注111'
|
|
|
- }, {
|
|
|
- name: '计量测试',
|
|
|
- tips: '备注222'
|
|
|
- },
|
|
|
- {
|
|
|
- name: '广西二级路公路计量单元划分模板',
|
|
|
- tips: '备注111'
|
|
|
- }, {
|
|
|
- name: '计量测试',
|
|
|
- tips: '备注222'
|
|
|
- },
|
|
|
- {
|
|
|
- name: '广西二级路公路计量单元划分模板',
|
|
|
- tips: '备注111'
|
|
|
- }, {
|
|
|
- name: '计量测试',
|
|
|
- tips: '备注222'
|
|
|
- },
|
|
|
- {
|
|
|
- name: '广西二级路公路计量单元划分模板',
|
|
|
- tips: '备注111'
|
|
|
- }, {
|
|
|
- name: '计量测试',
|
|
|
- tips: '备注222'
|
|
|
- },
|
|
|
- {
|
|
|
- name: '广西二级路公路计量单元划分模板',
|
|
|
- tips: '备注111'
|
|
|
- }, {
|
|
|
- name: '计量测试',
|
|
|
- tips: '备注222'
|
|
|
- },
|
|
|
-
|
|
|
- ],
|
|
|
+ data: [],
|
|
|
page: {
|
|
|
pageSize: 10,
|
|
|
currentPage: 1,
|
|
|
total: 16
|
|
|
},
|
|
|
+ loading:true,
|
|
|
option: {
|
|
|
height: 'auto',
|
|
|
calcHeight: 30,
|
|
@@ -98,7 +68,7 @@ export default {
|
|
|
|
|
|
{
|
|
|
label: "备注",
|
|
|
- prop: "tips",
|
|
|
+ prop: "remarks",
|
|
|
editDisplay: true,
|
|
|
addDisplay: true,
|
|
|
rules: [{
|
|
@@ -108,13 +78,30 @@ export default {
|
|
|
}
|
|
|
]
|
|
|
},
|
|
|
+ query: {},
|
|
|
};
|
|
|
},
|
|
|
methods: {
|
|
|
+ onLoad (page, params = {}) {
|
|
|
+ this.loading = true;
|
|
|
+ getListPage(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
|
|
|
+ const data = res.data.data;
|
|
|
+ this.page.total = data.total;
|
|
|
+ this.data = data.records;
|
|
|
+ this.loading = false;
|
|
|
+
|
|
|
+ });
|
|
|
+ },
|
|
|
searchChange (params, done) {
|
|
|
console.log(params,'params');
|
|
|
+ this.query = params;
|
|
|
+ this.onLoad(this.page);
|
|
|
done();
|
|
|
},
|
|
|
+ searchReset () {
|
|
|
+ this.query = {};
|
|
|
+ this.onLoad(this.page);
|
|
|
+ },
|
|
|
editUnit(row){
|
|
|
console.log(row);
|
|
|
this.$router.push({
|
|
@@ -130,7 +117,51 @@ export default {
|
|
|
sizeChange (pageSize) {
|
|
|
this.page.pageSize = pageSize;
|
|
|
},
|
|
|
- }
|
|
|
+ rowUpdate (row, index, done, loading) {
|
|
|
+ update(row).then(() => {
|
|
|
+ this.onLoad(this.page);
|
|
|
+ this.$message({
|
|
|
+ type: "success",
|
|
|
+ message: "操作成功!"
|
|
|
+ });
|
|
|
+ done();
|
|
|
+ }, error => {
|
|
|
+ loading();
|
|
|
+ console.log(error);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ rowSave (row, done, loading) {
|
|
|
+ update(row).then(() => {
|
|
|
+ this.onLoad(this.page);
|
|
|
+ this.$message({
|
|
|
+ type: "success",
|
|
|
+ message: "操作成功!"
|
|
|
+ });
|
|
|
+ done();
|
|
|
+ }, error => {
|
|
|
+ loading();
|
|
|
+ window.console.log(error);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ rowDel (row) {
|
|
|
+ this.$confirm("确定将选择数据删除?", {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning"
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ return remove(row.id);
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ this.onLoad(this.page);
|
|
|
+ this.$message({
|
|
|
+ type: "success",
|
|
|
+ message: "操作成功!"
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
+ },
|
|
|
+
|
|
|
}
|
|
|
|
|
|
</script>
|