修改用户数据添加表单
parent
8d9b3a7e34
commit
d2ac7f5686
@ -1,44 +1,52 @@
|
|||||||
import request from '@/utils/request'
|
import request from '@/utils/request'
|
||||||
|
|
||||||
// 查询用户数据列表
|
// 查询用户数据列表
|
||||||
export function listUserdatasource(query) {
|
export function listUserdatasource(query) {
|
||||||
return request({
|
return request({
|
||||||
url: '/system/userdatasource/list',
|
url: '/system/userdatasource/list',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params: query
|
params: query
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 查询用户数据详细
|
// 查询用户数据详细
|
||||||
export function getUserdatasource(datasourceId) {
|
export function getUserdatasource(datasourceId) {
|
||||||
return request({
|
return request({
|
||||||
url: '/system/userdatasource/' + datasourceId,
|
url: '/system/userdatasource/' + datasourceId,
|
||||||
method: 'get'
|
method: 'get'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 新增用户数据
|
// 新增用户数据
|
||||||
export function addUserdatasource(data) {
|
export function addUserdatasource(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/system/userdatasource',
|
url: '/system/userdatasource',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: data
|
data: data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 修改用户数据
|
// 修改用户数据
|
||||||
export function updateUserdatasource(data) {
|
export function updateUserdatasource(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/system/userdatasource',
|
url: '/system/userdatasource',
|
||||||
method: 'put',
|
method: 'put',
|
||||||
data: data
|
data: data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 删除用户数据
|
// 删除用户数据
|
||||||
export function delUserdatasource(datasourceId) {
|
export function delUserdatasource(datasourceId) {
|
||||||
return request({
|
return request({
|
||||||
url: '/system/userdatasource/' + datasourceId,
|
url: '/system/userdatasource/' + datasourceId,
|
||||||
method: 'delete'
|
method: 'delete'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 删除用户数据
|
||||||
|
export function getDatasourceIdList() {
|
||||||
|
return request({
|
||||||
|
url: '/system/datasource/list' ,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
@ -1,257 +1,304 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
<el-form v-show="showSearch" ref="queryForm" :inline="true" :model="queryParams" label-width="68px" size="small">
|
||||||
<el-form-item label="数据ID" prop="datasourceId">
|
<el-form-item label="数据ID" prop="datasourceId">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="queryParams.datasourceId"
|
v-model="queryParams.datasourceId"
|
||||||
placeholder="请输入数据ID"
|
clearable
|
||||||
clearable
|
placeholder="请输入数据ID"
|
||||||
@keyup.enter.native="handleQuery"
|
@keyup.enter.native="handleQuery"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="用户ID" prop="userId">
|
<el-form-item label="用户ID" prop="userId">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="queryParams.userId"
|
v-model="queryParams.userId"
|
||||||
placeholder="请输入用户ID"
|
clearable
|
||||||
clearable
|
placeholder="请输入用户ID"
|
||||||
@keyup.enter.native="handleQuery"
|
@keyup.enter.native="handleQuery"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<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-search" size="mini" type="primary" @click="handleQuery">搜索</el-button>
|
||||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
|
|
||||||
<el-row :gutter="10" class="mb8">
|
<el-row :gutter="10" class="mb8">
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
type="primary"
|
v-hasPermi="['system:userdatasource:add']"
|
||||||
plain
|
icon="el-icon-plus"
|
||||||
icon="el-icon-plus"
|
plain
|
||||||
size="mini"
|
size="mini"
|
||||||
@click="handleAdd"
|
type="primary"
|
||||||
v-hasPermi="['system:userdatasource:add']"
|
@click="handleAdd"
|
||||||
>新增</el-button>
|
>新增
|
||||||
</el-col>
|
</el-button>
|
||||||
<el-col :span="1.5">
|
</el-col>
|
||||||
<el-button
|
<el-col :span="1.5">
|
||||||
type="success"
|
<el-button
|
||||||
plain
|
v-hasPermi="['system:userdatasource:edit']"
|
||||||
icon="el-icon-edit"
|
:disabled="single"
|
||||||
size="mini"
|
icon="el-icon-edit"
|
||||||
:disabled="single"
|
plain
|
||||||
@click="handleUpdate"
|
size="mini"
|
||||||
v-hasPermi="['system:userdatasource:edit']"
|
type="success"
|
||||||
>修改</el-button>
|
@click="handleUpdate"
|
||||||
</el-col>
|
>修改
|
||||||
<el-col :span="1.5">
|
</el-button>
|
||||||
<el-button
|
</el-col>
|
||||||
type="danger"
|
<el-col :span="1.5">
|
||||||
plain
|
<el-button
|
||||||
icon="el-icon-delete"
|
v-hasPermi="['system:userdatasource:remove']"
|
||||||
size="mini"
|
:disabled="multiple"
|
||||||
:disabled="multiple"
|
icon="el-icon-delete"
|
||||||
@click="handleDelete"
|
plain
|
||||||
v-hasPermi="['system:userdatasource:remove']"
|
size="mini"
|
||||||
>删除</el-button>
|
type="danger"
|
||||||
</el-col>
|
@click="handleDelete"
|
||||||
<el-col :span="1.5">
|
>删除
|
||||||
<el-button
|
</el-button>
|
||||||
type="warning"
|
</el-col>
|
||||||
plain
|
<el-col :span="1.5">
|
||||||
icon="el-icon-download"
|
<el-button
|
||||||
size="mini"
|
v-hasPermi="['system:userdatasource:export']"
|
||||||
@click="handleExport"
|
icon="el-icon-download"
|
||||||
v-hasPermi="['system:userdatasource:export']"
|
plain
|
||||||
>导出</el-button>
|
size="mini"
|
||||||
</el-col>
|
type="warning"
|
||||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
@click="handleExport"
|
||||||
</el-row>
|
>导出
|
||||||
|
</el-button>
|
||||||
<el-table v-loading="loading" :data="userdatasourceList" @selection-change="handleSelectionChange">
|
</el-col>
|
||||||
<el-table-column type="selection" width="55" align="center" />
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
<el-table-column label="数据ID" align="center" prop="datasourceId" />
|
</el-row>
|
||||||
<el-table-column label="用户ID" align="center" prop="userId" />
|
|
||||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
<el-table v-loading="loading" :data="userdatasourceList" @selection-change="handleSelectionChange">
|
||||||
<template slot-scope="scope">
|
<el-table-column align="center" type="selection" width="55"/>
|
||||||
<el-button
|
<el-table-column align="center" label="数据ID" prop="datasourceId"/>
|
||||||
size="mini"
|
<el-table-column align="center" label="用户ID" prop="userId"/>
|
||||||
type="text"
|
<el-table-column align="center" class-name="small-padding fixed-width" label="操作">
|
||||||
icon="el-icon-edit"
|
<template slot-scope="scope">
|
||||||
@click="handleUpdate(scope.row)"
|
<el-button
|
||||||
v-hasPermi="['system:userdatasource:edit']"
|
v-hasPermi="['system:userdatasource:edit']"
|
||||||
>修改</el-button>
|
icon="el-icon-edit"
|
||||||
<el-button
|
size="mini"
|
||||||
size="mini"
|
type="text"
|
||||||
type="text"
|
@click="handleUpdate(scope.row)"
|
||||||
icon="el-icon-delete"
|
>修改
|
||||||
@click="handleDelete(scope.row)"
|
</el-button>
|
||||||
v-hasPermi="['system:userdatasource:remove']"
|
<el-button
|
||||||
>删除</el-button>
|
v-hasPermi="['system:userdatasource:remove']"
|
||||||
</template>
|
icon="el-icon-delete"
|
||||||
</el-table-column>
|
size="mini"
|
||||||
</el-table>
|
type="text"
|
||||||
|
@click="handleDelete(scope.row)"
|
||||||
<pagination
|
>删除
|
||||||
v-show="total>0"
|
</el-button>
|
||||||
:total="total"
|
</template>
|
||||||
:page.sync="queryParams.pageNum"
|
</el-table-column>
|
||||||
:limit.sync="queryParams.pageSize"
|
</el-table>
|
||||||
@pagination="getList"
|
|
||||||
/>
|
<pagination
|
||||||
|
v-show="total>0"
|
||||||
<!-- 添加或修改用户数据对话框 -->
|
:limit.sync="queryParams.pageSize"
|
||||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
:page.sync="queryParams.pageNum"
|
||||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
:total="total"
|
||||||
</el-form>
|
@pagination="getList"
|
||||||
<div slot="footer" class="dialog-footer">
|
/>
|
||||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
|
||||||
<el-button @click="cancel">取 消</el-button>
|
<!-- 添加或修改用户数据对话框 -->
|
||||||
</div>
|
<el-dialog :title="title" :visible.sync="open" append-to-body width="500px">
|
||||||
</el-dialog>
|
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||||
</div>
|
<el-form-item label="数据ID" prop="datasourceId">
|
||||||
</template>
|
<el-select
|
||||||
|
v-model="queryParams.datasourceId"
|
||||||
<script>
|
clearable
|
||||||
import { listUserdatasource, getUserdatasource, delUserdatasource, addUserdatasource, updateUserdatasource } from "@/api/system/userdatasource";
|
placeholder="数据ID"
|
||||||
|
style="width: 240px"
|
||||||
export default {
|
>
|
||||||
name: "Userdatasource",
|
<el-option
|
||||||
data() {
|
v-for="item in datasourceIdList"
|
||||||
return {
|
:key="item.value"
|
||||||
// 遮罩层
|
:label="item.label"
|
||||||
loading: true,
|
:value="item.value"
|
||||||
// 选中数组
|
/>
|
||||||
ids: [],
|
</el-select>
|
||||||
// 非单个禁用
|
</el-form-item>
|
||||||
single: true,
|
<el-form-item label="用户ID" prop="userId">
|
||||||
// 非多个禁用
|
<el-input
|
||||||
multiple: true,
|
v-model="queryParams.userId"
|
||||||
// 显示搜索条件
|
clearable
|
||||||
showSearch: true,
|
placeholder="请输入用户ID"
|
||||||
// 总条数
|
@keyup.enter.native="handleQuery"
|
||||||
total: 0,
|
/>
|
||||||
// 用户数据表格数据
|
</el-form-item>
|
||||||
userdatasourceList: [],
|
</el-form>
|
||||||
// 弹出层标题
|
<div slot="footer" class="dialog-footer">
|
||||||
title: "",
|
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||||
// 是否显示弹出层
|
<el-button @click="cancel">取 消</el-button>
|
||||||
open: false,
|
</div>
|
||||||
// 查询参数
|
</el-dialog>
|
||||||
queryParams: {
|
</div>
|
||||||
pageNum: 1,
|
</template>
|
||||||
pageSize: 10,
|
|
||||||
datasourceId: null,
|
<script>
|
||||||
userId: null
|
import {
|
||||||
},
|
listUserdatasource,
|
||||||
// 表单参数
|
getUserdatasource,
|
||||||
form: {},
|
delUserdatasource,
|
||||||
// 表单校验
|
addUserdatasource,
|
||||||
rules: {
|
updateUserdatasource,
|
||||||
datasourceId: [
|
getDatasourceIdList
|
||||||
{ required: true, message: "数据ID不能为空", trigger: "blur" }
|
} from "@/api/system/userdatasource";
|
||||||
],
|
|
||||||
userId: [
|
export default {
|
||||||
{ required: true, message: "用户ID不能为空", trigger: "blur" }
|
name: "Userdatasource",
|
||||||
]
|
data() {
|
||||||
}
|
return {
|
||||||
};
|
// 遮罩层
|
||||||
},
|
loading: true,
|
||||||
created() {
|
// 选中数组
|
||||||
this.getList();
|
ids: [],
|
||||||
},
|
// 非单个禁用
|
||||||
methods: {
|
single: true,
|
||||||
/** 查询用户数据列表 */
|
// 非多个禁用
|
||||||
getList() {
|
multiple: true,
|
||||||
this.loading = true;
|
// 显示搜索条件
|
||||||
listUserdatasource(this.queryParams).then(response => {
|
showSearch: true,
|
||||||
this.userdatasourceList = response.rows;
|
// 总条数
|
||||||
this.total = response.total;
|
total: 0,
|
||||||
this.loading = false;
|
// 用户数据表格数据
|
||||||
});
|
userdatasourceList: [],
|
||||||
},
|
// 弹出层标题
|
||||||
// 取消按钮
|
title: "",
|
||||||
cancel() {
|
// 是否显示弹出层
|
||||||
this.open = false;
|
open: false,
|
||||||
this.reset();
|
// 查询参数
|
||||||
},
|
queryParams: {
|
||||||
// 表单重置
|
pageNum: 1,
|
||||||
reset() {
|
pageSize: 10,
|
||||||
this.form = {
|
datasourceId: null,
|
||||||
datasourceId: null,
|
userId: null
|
||||||
userId: null
|
},
|
||||||
};
|
// 表单参数
|
||||||
this.resetForm("form");
|
form: {},
|
||||||
},
|
// 表单校验
|
||||||
/** 搜索按钮操作 */
|
rules: {
|
||||||
handleQuery() {
|
datasourceId: [
|
||||||
this.queryParams.pageNum = 1;
|
{required: true, message: "数据ID不能为空", trigger: "blur"}
|
||||||
this.getList();
|
],
|
||||||
},
|
userId: [
|
||||||
/** 重置按钮操作 */
|
{required: true, message: "用户ID不能为空", trigger: "blur"}
|
||||||
resetQuery() {
|
]
|
||||||
this.resetForm("queryForm");
|
},
|
||||||
this.handleQuery();
|
datasourceIdList: []
|
||||||
},
|
};
|
||||||
// 多选框选中数据
|
},
|
||||||
handleSelectionChange(selection) {
|
created() {
|
||||||
this.ids = selection.map(item => item.datasourceId)
|
this.getList();
|
||||||
this.single = selection.length!==1
|
getDatasourceIdList().then(e => {
|
||||||
this.multiple = !selection.length
|
console.log(e)
|
||||||
},
|
this.datasourceIdList = e.rows.map(val => {
|
||||||
/** 新增按钮操作 */
|
return {
|
||||||
handleAdd() {
|
label: val.parkName,
|
||||||
this.reset();
|
value: val.id
|
||||||
this.open = true;
|
}
|
||||||
this.title = "添加用户数据";
|
})
|
||||||
},
|
})
|
||||||
/** 修改按钮操作 */
|
},
|
||||||
handleUpdate(row) {
|
methods: {
|
||||||
this.reset();
|
/** 查询用户数据列表 */
|
||||||
const datasourceId = row.datasourceId || this.ids
|
getList() {
|
||||||
getUserdatasource(datasourceId).then(response => {
|
this.loading = true;
|
||||||
this.form = response.data;
|
listUserdatasource(this.queryParams).then(response => {
|
||||||
this.open = true;
|
this.userdatasourceList = response.rows;
|
||||||
this.title = "修改用户数据";
|
this.total = response.total;
|
||||||
});
|
this.loading = false;
|
||||||
},
|
});
|
||||||
/** 提交按钮 */
|
},
|
||||||
submitForm() {
|
// 取消按钮
|
||||||
this.$refs["form"].validate(valid => {
|
cancel() {
|
||||||
if (valid) {
|
this.open = false;
|
||||||
if (this.form.datasourceId != null) {
|
this.reset();
|
||||||
updateUserdatasource(this.form).then(response => {
|
},
|
||||||
this.$modal.msgSuccess("修改成功");
|
// 表单重置
|
||||||
this.open = false;
|
reset() {
|
||||||
this.getList();
|
this.form = {
|
||||||
});
|
datasourceId: null,
|
||||||
} else {
|
userId: null
|
||||||
addUserdatasource(this.form).then(response => {
|
};
|
||||||
this.$modal.msgSuccess("新增成功");
|
this.resetForm("form");
|
||||||
this.open = false;
|
},
|
||||||
this.getList();
|
/** 搜索按钮操作 */
|
||||||
});
|
handleQuery() {
|
||||||
}
|
this.queryParams.pageNum = 1;
|
||||||
}
|
this.getList();
|
||||||
});
|
},
|
||||||
},
|
/** 重置按钮操作 */
|
||||||
/** 删除按钮操作 */
|
resetQuery() {
|
||||||
handleDelete(row) {
|
this.resetForm("queryForm");
|
||||||
const datasourceIds = row.datasourceId || this.ids;
|
this.handleQuery();
|
||||||
this.$modal.confirm('是否确认删除用户数据编号为"' + datasourceIds + '"的数据项?').then(function() {
|
},
|
||||||
return delUserdatasource(datasourceIds);
|
// 多选框选中数据
|
||||||
}).then(() => {
|
handleSelectionChange(selection) {
|
||||||
this.getList();
|
this.ids = selection.map(item => item.datasourceId)
|
||||||
this.$modal.msgSuccess("删除成功");
|
this.single = selection.length !== 1
|
||||||
}).catch(() => {});
|
this.multiple = !selection.length
|
||||||
},
|
},
|
||||||
/** 导出按钮操作 */
|
/** 新增按钮操作 */
|
||||||
handleExport() {
|
handleAdd() {
|
||||||
this.download('system/userdatasource/export', {
|
this.reset();
|
||||||
...this.queryParams
|
this.open = true;
|
||||||
}, `userdatasource_${new Date().getTime()}.xlsx`)
|
this.title = "添加用户数据";
|
||||||
}
|
},
|
||||||
}
|
/** 修改按钮操作 */
|
||||||
};
|
handleUpdate(row) {
|
||||||
</script>
|
this.reset();
|
||||||
|
const datasourceId = row.datasourceId || this.ids
|
||||||
|
getUserdatasource(datasourceId).then(response => {
|
||||||
|
this.form = response.data;
|
||||||
|
this.open = true;
|
||||||
|
this.title = "修改用户数据";
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 提交按钮 */
|
||||||
|
submitForm() {
|
||||||
|
this.$refs["form"].validate(valid => {
|
||||||
|
if (valid) {
|
||||||
|
if (this.form.datasourceId != null) {
|
||||||
|
updateUserdatasource(this.form).then(response => {
|
||||||
|
this.$modal.msgSuccess("修改成功");
|
||||||
|
this.open = false;
|
||||||
|
this.getList();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
addUserdatasource(this.form).then(response => {
|
||||||
|
this.$modal.msgSuccess("新增成功");
|
||||||
|
this.open = false;
|
||||||
|
this.getList();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 删除按钮操作 */
|
||||||
|
handleDelete(row) {
|
||||||
|
const datasourceIds = row.datasourceId || this.ids;
|
||||||
|
this.$modal.confirm('是否确认删除用户数据编号为"' + datasourceIds + '"的数据项?').then(function () {
|
||||||
|
return delUserdatasource(datasourceIds);
|
||||||
|
}).then(() => {
|
||||||
|
this.getList();
|
||||||
|
this.$modal.msgSuccess("删除成功");
|
||||||
|
}).catch(() => {
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 导出按钮操作 */
|
||||||
|
handleExport() {
|
||||||
|
this.download('system/userdatasource/export', {
|
||||||
|
...this.queryParams
|
||||||
|
}, `userdatasource_${new Date().getTime()}.xlsx`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
Loading…
Reference in New Issue