初始化
This commit is contained in:
356
ruoyi-ui/src/views/demo/demo/index.vue
Normal file
356
ruoyi-ui/src/views/demo/demo/index.vue
Normal file
@ -0,0 +1,356 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="key键" prop="testKey">
|
||||
<el-input
|
||||
v-model="queryParams.testKey"
|
||||
placeholder="请输入key键"
|
||||
clearable
|
||||
size="small"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="值" prop="value">
|
||||
<el-input
|
||||
v-model="queryParams.value"
|
||||
placeholder="请输入值"
|
||||
clearable
|
||||
size="small"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建时间">
|
||||
<el-date-picker
|
||||
v-model="daterangeCreateTime"
|
||||
size="small"
|
||||
style="width: 240px"
|
||||
value-format="yyyy-MM-dd"
|
||||
type="daterange"
|
||||
range-separator="-"
|
||||
start-placeholder="开始日期"
|
||||
end-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-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['demo:demo:add']"
|
||||
>新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="el-icon-edit"
|
||||
size="mini"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
v-hasPermi="['demo:demo:edit']"
|
||||
>修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
v-hasPermi="['demo:demo:remove']"
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="el-icon-download"
|
||||
size="mini"
|
||||
:loading="exportLoading"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['demo:demo:export']"
|
||||
>导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="demoList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="主键" align="center" prop="id" v-if="false"/>
|
||||
<el-table-column label="部门id" align="center" prop="deptId" />
|
||||
<el-table-column label="用户id" align="center" prop="userId" />
|
||||
<el-table-column label="排序号" align="center" prop="orderNum" />
|
||||
<el-table-column label="key键" align="center" prop="testKey" />
|
||||
<el-table-column label="值" align="center" prop="value" />
|
||||
<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="createBy" />
|
||||
<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-column label="更新人" align="center" prop="updateBy" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['demo:demo:edit']"
|
||||
>修改</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['demo:demo:remove']"
|
||||
>删除</el-button>
|
||||
</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-item label="部门id" prop="deptId">
|
||||
<el-input v-model="form.deptId" placeholder="请输入部门id" />
|
||||
</el-form-item>
|
||||
<el-form-item label="用户id" prop="userId">
|
||||
<el-input v-model="form.userId" placeholder="请输入用户id" />
|
||||
</el-form-item>
|
||||
<el-form-item label="排序号" prop="orderNum">
|
||||
<el-input v-model="form.orderNum" placeholder="请输入排序号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="key键" prop="testKey">
|
||||
<el-input v-model="form.testKey" placeholder="请输入key键" />
|
||||
</el-form-item>
|
||||
<el-form-item label="值" prop="value">
|
||||
<el-input v-model="form.value" placeholder="请输入值" />
|
||||
</el-form-item>
|
||||
<el-form-item label="创建时间" prop="createTime">
|
||||
<el-date-picker clearable size="small"
|
||||
v-model="form.createTime"
|
||||
type="datetime"
|
||||
value-format="yyyy-MM-dd HH:mm:ss"
|
||||
placeholder="选择创建时间">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listDemo, getDemo, delDemo, addDemo, updateDemo, exportDemo } from "@/api/demo/demo";
|
||||
|
||||
export default {
|
||||
name: "Demo",
|
||||
components: {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
//按钮loading
|
||||
buttonLoading: false,
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 导出遮罩层
|
||||
exportLoading: false,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 测试单表表格数据
|
||||
demoList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 创建时间时间范围
|
||||
daterangeCreateTime: [],
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
testKey: undefined,
|
||||
value: undefined,
|
||||
createTime: undefined,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
testKey: [
|
||||
{ required: true, message: "key键不能为空", trigger: "blur" }
|
||||
],
|
||||
value: [
|
||||
{ required: true, message: "值不能为空", trigger: "blur" }
|
||||
],
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询测试单表列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
this.queryParams.params = {};
|
||||
if (null != this.daterangeCreateTime && '' != this.daterangeCreateTime) {
|
||||
this.queryParams.params["beginCreateTime"] = this.daterangeCreateTime[0];
|
||||
this.queryParams.params["endCreateTime"] = this.daterangeCreateTime[1];
|
||||
}
|
||||
listDemo(this.queryParams).then(response => {
|
||||
this.demoList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
id: undefined,
|
||||
deptId: undefined,
|
||||
userId: undefined,
|
||||
orderNum: undefined,
|
||||
testKey: undefined,
|
||||
value: undefined,
|
||||
version: undefined,
|
||||
createTime: undefined,
|
||||
createBy: undefined,
|
||||
updateTime: undefined,
|
||||
updateBy: undefined,
|
||||
delFlag: undefined
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.daterangeCreateTime = [];
|
||||
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.loading = true;
|
||||
this.reset();
|
||||
const id = row.id || this.ids
|
||||
getDemo(id).then(response => {
|
||||
this.loading = false;
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改测试单表";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
this.buttonLoading = true;
|
||||
if (this.form.id != null) {
|
||||
updateDemo(this.form).then(response => {
|
||||
this.buttonLoading = false;
|
||||
this.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
addDemo(this.form).then(response => {
|
||||
this.buttonLoading = false;
|
||||
this.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const ids = row.id || this.ids;
|
||||
this.$confirm('是否确认删除测试单表编号为"' + ids + '"的数据项?', "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
}).then(() => {
|
||||
this.loading = true;
|
||||
return delDemo(ids);
|
||||
}).then(() => {
|
||||
this.loading = false;
|
||||
this.getList();
|
||||
this.msgSuccess("删除成功");
|
||||
})
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
const queryParams = this.queryParams;
|
||||
this.$confirm('是否确认导出所有测试单表数据项?', "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
}).then(() => {
|
||||
this.exportLoading = true;
|
||||
return exportDemo(queryParams);
|
||||
}).then(response => {
|
||||
this.download(response.msg);
|
||||
this.exportLoading = false;
|
||||
})
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
291
ruoyi-ui/src/views/demo/tree/index.vue
Normal file
291
ruoyi-ui/src/views/demo/tree/index.vue
Normal file
@ -0,0 +1,291 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="树节点名" prop="treeName">
|
||||
<el-input
|
||||
v-model="queryParams.treeName"
|
||||
placeholder="请输入树节点名"
|
||||
clearable
|
||||
size="small"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建时间">
|
||||
<el-date-picker
|
||||
v-model="daterangeCreateTime"
|
||||
size="small"
|
||||
style="width: 240px"
|
||||
value-format="yyyy-MM-dd"
|
||||
type="daterange"
|
||||
range-separator="-"
|
||||
start-placeholder="开始日期"
|
||||
end-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-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['demo:tree:add']"
|
||||
>新增</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table
|
||||
v-loading="loading"
|
||||
:data="treeList"
|
||||
row-key="id"
|
||||
default-expand-all
|
||||
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
|
||||
>
|
||||
<el-table-column label="父id" prop="parentId" />
|
||||
<el-table-column label="部门id" align="center" prop="deptId" />
|
||||
<el-table-column label="用户id" align="center" prop="userId" />
|
||||
<el-table-column label="树节点名" align="center" prop="treeName" />
|
||||
<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" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['demo:tree:edit']"
|
||||
>修改</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-plus"
|
||||
@click="handleAdd(scope.row)"
|
||||
v-hasPermi="['demo:tree:add']"
|
||||
>新增</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['demo:tree:remove']"
|
||||
>删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<!-- 添加或修改测试树表对话框 -->
|
||||
<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-item label="父id" prop="parentId">
|
||||
<treeselect v-model="form.parentId" :options="treeOptions" :normalizer="normalizer" placeholder="请选择父id" />
|
||||
</el-form-item>
|
||||
<el-form-item label="部门id" prop="deptId">
|
||||
<el-input v-model="form.deptId" placeholder="请输入部门id" />
|
||||
</el-form-item>
|
||||
<el-form-item label="用户id" prop="userId">
|
||||
<el-input v-model="form.userId" placeholder="请输入用户id" />
|
||||
</el-form-item>
|
||||
<el-form-item label="树节点名" prop="treeName">
|
||||
<el-input v-model="form.treeName" placeholder="请输入树节点名" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listTree, getTree, delTree, addTree, updateTree, exportTree } from "@/api/demo/tree";
|
||||
import Treeselect from "@riophae/vue-treeselect";
|
||||
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
||||
|
||||
export default {
|
||||
name: "Tree",
|
||||
components: {
|
||||
Treeselect
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
//按钮loading
|
||||
buttonLoading: false,
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 测试树表表格数据
|
||||
treeList: [],
|
||||
// 测试树表树选项
|
||||
treeOptions: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 创建时间时间范围
|
||||
daterangeCreateTime: [],
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
treeName: null,
|
||||
createTime: null,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
treeName: [
|
||||
{ required: true, message: "树节点名不能为空", trigger: "blur" }
|
||||
],
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询测试树表列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
this.queryParams.params = {};
|
||||
if (null != this.daterangeCreateTime && '' != this.daterangeCreateTime) {
|
||||
this.queryParams.params["beginCreateTime"] = this.daterangeCreateTime[0];
|
||||
this.queryParams.params["endCreateTime"] = this.daterangeCreateTime[1];
|
||||
}
|
||||
listTree(this.queryParams).then(response => {
|
||||
this.treeList = this.handleTree(response.data, "id", "parentId");
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
/** 转换测试树表数据结构 */
|
||||
normalizer(node) {
|
||||
if (node.children && !node.children.length) {
|
||||
delete node.children;
|
||||
}
|
||||
return {
|
||||
id: node.id,
|
||||
label: node.treeName,
|
||||
children: node.children
|
||||
};
|
||||
},
|
||||
/** 查询测试树表下拉树结构 */
|
||||
getTreeselect() {
|
||||
listTree().then(response => {
|
||||
this.treeOptions = [];
|
||||
const data = { id: 0, treeName: '顶级节点', children: [] };
|
||||
data.children = this.handleTree(response.data, "id", "parentId");
|
||||
this.treeOptions.push(data);
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
id: null,
|
||||
parentId: null,
|
||||
deptId: null,
|
||||
userId: null,
|
||||
treeName: null,
|
||||
version: null,
|
||||
createTime: null,
|
||||
createBy: null,
|
||||
updateTime: null,
|
||||
updateBy: null,
|
||||
delFlag: null
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.daterangeCreateTime = [];
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd(row) {
|
||||
this.reset();
|
||||
this.getTreeselect();
|
||||
if (row != null && row.id) {
|
||||
this.form.parentId = row.id;
|
||||
} else {
|
||||
this.form.parentId = 0;
|
||||
}
|
||||
this.open = true;
|
||||
this.title = "添加测试树表";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.loading = true;
|
||||
this.reset();
|
||||
this.getTreeselect();
|
||||
if (row != null) {
|
||||
this.form.parentId = row.id;
|
||||
}
|
||||
getTree(row.id).then(response => {
|
||||
this.loading = false;
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改测试树表";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
this.buttonLoading = true;
|
||||
if (this.form.id != null) {
|
||||
updateTree(this.form).then(response => {
|
||||
this.buttonLoading = false;
|
||||
this.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
addTree(this.form).then(response => {
|
||||
this.buttonLoading = false;
|
||||
this.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
this.$confirm('是否确认删除测试树表编号为"' + row.id + '"的数据项?', "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
}).then(() => {
|
||||
this.loading = true;
|
||||
return delTree(row.id);
|
||||
}).then(() => {
|
||||
this.loading = false;
|
||||
this.getList();
|
||||
this.msgSuccess("删除成功");
|
||||
})
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
209
ruoyi-ui/src/views/demo/tress-map/index.vue
Normal file
209
ruoyi-ui/src/views/demo/tress-map/index.vue
Normal file
@ -0,0 +1,209 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-container>
|
||||
<el-header style="background: #c4c4ea">Header</el-header>
|
||||
<el-container>
|
||||
<el-aside width="500px" style="margin: 0;padding: 0">
|
||||
<el-table
|
||||
:data="tressList"
|
||||
:show-header="false"
|
||||
@cell-click="tableClock"
|
||||
style="width: 100%">
|
||||
<el-table-column
|
||||
type="index"
|
||||
width="15">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="treeName"
|
||||
label="姓名"
|
||||
width="100">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="address"
|
||||
label="地址">
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-aside>
|
||||
<el-main style="padding: 0">
|
||||
<baidu-map
|
||||
id="allmap"
|
||||
:scroll-wheel-zoom="true"
|
||||
@ready="mapReady">
|
||||
<bm-marker v-for="(item,i) in points" :zIndex="item.id" :position="item" :key="i" animation="BMAP_ANIMATION_DROP" @click="markerClick" :icon="icon"/>
|
||||
</baidu-map>
|
||||
</el-main>
|
||||
</el-container>
|
||||
</el-container>
|
||||
<el-dialog
|
||||
title="信息"
|
||||
:visible.sync="open"
|
||||
width="80%">
|
||||
|
||||
<el-row>
|
||||
<el-col :span="18">
|
||||
<el-descriptions :column="2">
|
||||
<el-descriptions-item label="古树标号">
|
||||
{{form.treeNo}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="中文树名">
|
||||
{{form.treeName}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="阿拉丁名">
|
||||
{{form.treeNameE}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="别名">
|
||||
{{form.treeAlias}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="科">
|
||||
{{form.family}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="属">
|
||||
{{form.genus}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="类型">
|
||||
{{form.type}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="年龄">
|
||||
{{form.age}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="地址">
|
||||
{{form.address}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="详细地址">
|
||||
{{form.detailedAddress}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="管护单位">
|
||||
{{form.careUnit}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="古树状态">
|
||||
{{form.treeStatus}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="浏览量">
|
||||
{{form.viewsCount}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="高度">
|
||||
{{form.highly}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="直径(胸围)">
|
||||
{{form.diameter}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="生长势">
|
||||
{{form.growthVigor}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="平均冠幅">
|
||||
{{form.averageCanopy}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="东西冠幅">
|
||||
{{form.dongXiCanopy}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="南北冠幅">
|
||||
{{form.nanBeiCanopy}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="海拔">
|
||||
{{form.altitude}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="坡向">
|
||||
{{form.slopeDirection}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="坡度">
|
||||
{{form.slopeDegree}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="坡位">
|
||||
{{form.slopePosition}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="土壤名称">
|
||||
{{form.soilName}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="土壤紧密度">
|
||||
{{form.soilCompactness}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="生长环境">
|
||||
{{form.growthEnvironment}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="历史/详情">
|
||||
{{form.historyDetails}}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="树木奇特性状">
|
||||
{{form.peculiarCharacter}}
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</el-col>
|
||||
<el-col :span="6"><el-image :src="form.pics"/></el-col>
|
||||
</el-row>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="open = false">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style>
|
||||
#allmap{
|
||||
height: 600px;
|
||||
width: 100%;
|
||||
margin: 0 auto;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
import { listAll,listTress, getTress, delTress, addTress, updateTress, exportTress } from "@/api/demo/tress";
|
||||
import BaiduMap from 'vue-baidu-map'
|
||||
import theme6 from '@/assets/images/old-tress.png'
|
||||
|
||||
export default {
|
||||
name: "TressMap",
|
||||
data() {
|
||||
return {
|
||||
icon:{
|
||||
url: theme6,
|
||||
size: {width: 30, height: 30},
|
||||
opts: {
|
||||
imageSize: {width: 30, height: 30}
|
||||
}
|
||||
},
|
||||
point: "",
|
||||
points: [],
|
||||
tressList: [],
|
||||
map: {},
|
||||
open: false,
|
||||
form: {}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
},
|
||||
methods: {
|
||||
mapReady({ BMap, map }) {
|
||||
this.map = map;
|
||||
// 选择一个经纬度作为中心点
|
||||
this.point = new BMap.Point(113.27, 23.13);
|
||||
map.centerAndZoom(this.point, 12);
|
||||
|
||||
listAll().then(response => {
|
||||
this.tressList = response.data;
|
||||
const points = [];
|
||||
this.tressList.forEach((value, index) => {
|
||||
const point = {lng: value.longitude, lat: value.latitude, id: value.id};
|
||||
points.push(point);
|
||||
})
|
||||
this.points = points;
|
||||
});
|
||||
},
|
||||
markerClick({type,target}) {
|
||||
console.info(type);
|
||||
console.info(target);
|
||||
const a = this.tressList.filter((a) => {
|
||||
return a.id == target.zIndex
|
||||
});
|
||||
console.info(a);
|
||||
if (a.length > 0) {
|
||||
this.form = a[0];
|
||||
}
|
||||
this.open = true;
|
||||
},
|
||||
tableClock(row, column, cell, event) {
|
||||
var point = new BMap.Point(row.longitude, row.latitude);
|
||||
this.map.centerAndZoom(point,12);
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
462
ruoyi-ui/src/views/demo/tress/index.vue
Normal file
462
ruoyi-ui/src/views/demo/tress/index.vue
Normal file
@ -0,0 +1,462 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="中文树名" prop="treeName">
|
||||
<el-input
|
||||
v-model="queryParams.treeName"
|
||||
placeholder="请输入中文树名"
|
||||
clearable
|
||||
size="small"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="别名" prop="treeAlias">
|
||||
<el-input
|
||||
v-model="queryParams.treeAlias"
|
||||
placeholder="请输入别名"
|
||||
clearable
|
||||
size="small"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="年龄" prop="age">
|
||||
<el-input
|
||||
v-model="queryParams.age"
|
||||
placeholder="请输入年龄"
|
||||
clearable
|
||||
size="small"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="地址" prop="address">
|
||||
<el-input
|
||||
v-model="queryParams.address"
|
||||
placeholder="请输入地址"
|
||||
clearable
|
||||
size="small"
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</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-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['demo:tress:add']"
|
||||
>新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="el-icon-edit"
|
||||
size="mini"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
v-hasPermi="['demo:tress:edit']"
|
||||
>修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
v-hasPermi="['demo:tress:remove']"
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="el-icon-download"
|
||||
size="mini"
|
||||
:loading="exportLoading"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['demo:tress:export']"
|
||||
>导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="tressList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="id" align="center" prop="id" v-if="false"/>
|
||||
<el-table-column label="古树标号" align="center" prop="treeNo" />
|
||||
<el-table-column label="图片" align="center" prop="pics">
|
||||
<template slot-scope="scope">
|
||||
<el-image
|
||||
style="width: 100px; height: 100px"
|
||||
:src=scope.row.pics
|
||||
fit="scale-down"></el-image>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="中文树名" align="center" prop="treeName" />
|
||||
<el-table-column label="阿拉丁名" align="center" prop="treeNameE" />
|
||||
<el-table-column label="别名" align="center" prop="treeAlias" />
|
||||
<el-table-column label="年龄" align="center" prop="age" />
|
||||
<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="slopeDirection" />
|
||||
<el-table-column label="土壤名称" align="center" prop="soilName" />
|
||||
<el-table-column label="树木奇特性状" align="center" prop="peculiarCharacter" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['demo:tress:edit']"
|
||||
>修改</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['demo:tress:remove']"
|
||||
>删除</el-button>
|
||||
</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-item label="古树标号" prop="treeNo">
|
||||
<el-input v-model="form.treeNo" placeholder="请输入古树标号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="图片">
|
||||
<imageUpload v-model="form.pics"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="中文树名" prop="treeName">
|
||||
<el-input v-model="form.treeName" placeholder="请输入中文树名" />
|
||||
</el-form-item>
|
||||
<el-form-item label="阿拉丁名" prop="treeNameE">
|
||||
<el-input v-model="form.treeNameE" placeholder="请输入阿拉丁名" />
|
||||
</el-form-item>
|
||||
<el-form-item label="别名" prop="treeAlias">
|
||||
<el-input v-model="form.treeAlias" placeholder="请输入别名" />
|
||||
</el-form-item>
|
||||
<el-form-item label="科" prop="family">
|
||||
<el-input v-model="form.family" placeholder="请输入科" />
|
||||
</el-form-item>
|
||||
<el-form-item label="属" prop="genus">
|
||||
<el-input v-model="form.genus" placeholder="请输入属" />
|
||||
</el-form-item>
|
||||
<el-form-item label="类型" prop="type">
|
||||
<el-input v-model="form.type" placeholder="请输入类型" />
|
||||
</el-form-item>
|
||||
<el-form-item label="年龄" prop="age">
|
||||
<el-input v-model="form.age" placeholder="请输入年龄" />
|
||||
</el-form-item>
|
||||
<el-form-item label="地址" prop="address">
|
||||
<el-input v-model="form.address" placeholder="请输入地址" />
|
||||
</el-form-item>
|
||||
<el-form-item label="详细地址" prop="detailedAddress">
|
||||
<el-input v-model="form.detailedAddress" placeholder="请输入详细地址" />
|
||||
</el-form-item>
|
||||
<el-form-item label="管护单位" prop="careUnit">
|
||||
<el-input v-model="form.careUnit" placeholder="请输入管护单位" />
|
||||
</el-form-item>
|
||||
<el-form-item label="古树状态">
|
||||
<el-radio-group v-model="form.treeStatus">
|
||||
<el-radio
|
||||
v-for="dict in treeStatusOptions"
|
||||
:key="dict.dictValue"
|
||||
:label="dict.dictValue"
|
||||
>{{dict.dictLabel}}</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="浏览量" prop="viewsCount">
|
||||
<el-input v-model="form.viewsCount" placeholder="请输入浏览量" />
|
||||
</el-form-item>
|
||||
<el-form-item label="经度" prop="longitude">
|
||||
<el-input v-model="form.longitude" placeholder="请输入经度" />
|
||||
</el-form-item>
|
||||
<el-form-item label="纬度" prop="latitude">
|
||||
<el-input v-model="form.latitude" placeholder="请输入纬度" />
|
||||
</el-form-item>
|
||||
<el-form-item label="高度" prop="highly">
|
||||
<el-input v-model="form.highly" placeholder="请输入高度" />
|
||||
</el-form-item>
|
||||
<el-form-item label="直径(胸围)" prop="diameter">
|
||||
<el-input v-model="form.diameter" placeholder="请输入直径(胸围)" />
|
||||
</el-form-item>
|
||||
<el-form-item label="生长势" prop="growthVigor">
|
||||
<el-input v-model="form.growthVigor" placeholder="请输入生长势" />
|
||||
</el-form-item>
|
||||
<el-form-item label="平均冠幅" prop="averageCanopy">
|
||||
<el-input v-model="form.averageCanopy" placeholder="请输入平均冠幅" />
|
||||
</el-form-item>
|
||||
<el-form-item label="东西冠幅" prop="dongXiCanopy">
|
||||
<el-input v-model="form.dongXiCanopy" placeholder="请输入东西冠幅" />
|
||||
</el-form-item>
|
||||
<el-form-item label="南北冠幅" prop="nanBeiCanopy">
|
||||
<el-input v-model="form.nanBeiCanopy" placeholder="请输入南北冠幅" />
|
||||
</el-form-item>
|
||||
<el-form-item label="海拔" prop="altitude">
|
||||
<el-input v-model="form.altitude" placeholder="请输入海拔" />
|
||||
</el-form-item>
|
||||
<el-form-item label="坡向" prop="slopeDirection">
|
||||
<el-input v-model="form.slopeDirection" placeholder="请输入坡向" />
|
||||
</el-form-item>
|
||||
<el-form-item label="坡度" prop="slopeDegree">
|
||||
<el-input v-model="form.slopeDegree" placeholder="请输入坡度" />
|
||||
</el-form-item>
|
||||
<el-form-item label="坡位" prop="slopePosition">
|
||||
<el-input v-model="form.slopePosition" placeholder="请输入坡位" />
|
||||
</el-form-item>
|
||||
<el-form-item label="土壤名称" prop="soilName">
|
||||
<el-input v-model="form.soilName" placeholder="请输入土壤名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="土壤紧密度" prop="soilCompactness">
|
||||
<el-input v-model="form.soilCompactness" placeholder="请输入土壤紧密度" />
|
||||
</el-form-item>
|
||||
<el-form-item label="生长环境" prop="growthEnvironment">
|
||||
<el-input v-model="form.growthEnvironment" placeholder="请输入生长环境" />
|
||||
</el-form-item>
|
||||
<el-form-item label="历史/详情" prop="historyDetails">
|
||||
<el-input v-model="form.historyDetails" placeholder="请输入历史/详情" />
|
||||
</el-form-item>
|
||||
<el-form-item label="树木奇特性状" prop="peculiarCharacter">
|
||||
<el-input v-model="form.peculiarCharacter" placeholder="请输入树木奇特性状" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listTress, getTress, delTress, addTress, updateTress, exportTress } from "@/api/demo/tress";
|
||||
import ImageUpload from '@/components/ImageUpload';
|
||||
|
||||
export default {
|
||||
name: "Tress",
|
||||
components: {
|
||||
ImageUpload,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
//按钮loading
|
||||
buttonLoading: false,
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 导出遮罩层
|
||||
exportLoading: false,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 古树信息列表格数据
|
||||
tressList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 古树状态字典
|
||||
treeStatusOptions: [],
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
treeName: undefined,
|
||||
treeAlias: undefined,
|
||||
age: undefined,
|
||||
address: undefined,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
this.getDicts("tree_status").then(response => {
|
||||
this.treeStatusOptions = response.data;
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
/** 查询古树信息列列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listTress(this.queryParams).then(response => {
|
||||
this.tressList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 古树状态字典翻译
|
||||
treeStatusFormat(row, column) {
|
||||
return this.selectDictLabel(this.treeStatusOptions, row.treeStatus);
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
id: undefined,
|
||||
treeNo: undefined,
|
||||
pics: undefined,
|
||||
treeName: undefined,
|
||||
treeNameE: undefined,
|
||||
treeAlias: undefined,
|
||||
family: undefined,
|
||||
genus: undefined,
|
||||
type: undefined,
|
||||
age: undefined,
|
||||
address: undefined,
|
||||
detailedAddress: undefined,
|
||||
careUnit: undefined,
|
||||
treeStatus: "0",
|
||||
viewsCount: undefined,
|
||||
longitude: undefined,
|
||||
latitude: undefined,
|
||||
createTime: undefined,
|
||||
updateTime: undefined,
|
||||
highly: undefined,
|
||||
diameter: undefined,
|
||||
growthVigor: undefined,
|
||||
averageCanopy: undefined,
|
||||
dongXiCanopy: undefined,
|
||||
nanBeiCanopy: undefined,
|
||||
altitude: undefined,
|
||||
slopeDirection: undefined,
|
||||
slopeDegree: undefined,
|
||||
slopePosition: undefined,
|
||||
soilName: undefined,
|
||||
soilCompactness: undefined,
|
||||
growthEnvironment: undefined,
|
||||
historyDetails: undefined,
|
||||
peculiarCharacter: undefined
|
||||
};
|
||||
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.loading = true;
|
||||
this.reset();
|
||||
const id = row.id || this.ids
|
||||
getTress(id).then(response => {
|
||||
this.loading = false;
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改古树信息列";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
this.buttonLoading = true;
|
||||
if (this.form.id != null) {
|
||||
updateTress(this.form).then(response => {
|
||||
this.buttonLoading = false;
|
||||
this.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
addTress(this.form).then(response => {
|
||||
this.buttonLoading = false;
|
||||
this.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const ids = row.id || this.ids;
|
||||
this.$confirm('是否确认删除古树信息列编号为"' + ids + '"的数据项?', "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
}).then(() => {
|
||||
this.loading = true;
|
||||
return delTress(ids);
|
||||
}).then(() => {
|
||||
this.loading = false;
|
||||
this.getList();
|
||||
this.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
const queryParams = this.queryParams;
|
||||
this.$confirm('是否确认导出所有古树信息列数据项?', "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
}).then(() => {
|
||||
this.exportLoading = true;
|
||||
return exportTress(queryParams);
|
||||
}).then(response => {
|
||||
this.download(response.msg);
|
||||
this.exportLoading = false;
|
||||
}).catch(() => {});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
Reference in New Issue
Block a user