|
@@ -1,6 +1,13 @@
|
|
|
<template>
|
|
|
<div class="app-container">
|
|
|
- <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
|
|
+ <el-form
|
|
|
+ :model="queryParams"
|
|
|
+ ref="queryForm"
|
|
|
+ size="small"
|
|
|
+ :inline="true"
|
|
|
+ v-show="showSearch"
|
|
|
+ label-width="68px"
|
|
|
+ >
|
|
|
<!-- <el-form-item label="设备ID" prop="deviceId">
|
|
|
<el-input
|
|
|
v-model="queryParams.deviceId"
|
|
@@ -39,15 +46,23 @@
|
|
|
style="width: 240px"
|
|
|
value-format="yyyy-MM-dd HH:mm:ss"
|
|
|
type="daterange"
|
|
|
- :default-time="['00:00:00', '23:59:59']"
|
|
|
+ :default-time="['00:00:00', '23:59:59']"
|
|
|
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-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>
|
|
|
|
|
@@ -97,20 +112,34 @@
|
|
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
|
|
</el-row> -->
|
|
|
|
|
|
- <el-table v-loading="loading" :data="deviceInfoList" @selection-change="handleSelectionChange" :sort-default-order="['registerTime', 'desc']">
|
|
|
+ <el-table
|
|
|
+ v-loading="loading"
|
|
|
+ :data="deviceInfoList"
|
|
|
+ @selection-change="handleSelectionChange"
|
|
|
+ @sort-change="handleSortChange"
|
|
|
+ >
|
|
|
<el-table-column type="selection" width="55" align="center" />
|
|
|
<!-- <el-table-column label="租户号" align="center" prop="autoId" /> -->
|
|
|
<el-table-column label="设备ID" align="center" prop="deviceId" />
|
|
|
<el-table-column label="设备品牌" align="center" prop="deviceBrand" />
|
|
|
<el-table-column label="设备型号" align="center" prop="deviceModel" />
|
|
|
<el-table-column label="备注" align="center" prop="deviceDesc" />
|
|
|
- <el-table-column label="注册时间" align="center" prop="registerTime" width="180" sortable>
|
|
|
+ <el-table-column
|
|
|
+ label="注册时间"
|
|
|
+ align="center"
|
|
|
+ prop="registerTime"
|
|
|
+ width="180"
|
|
|
+ >
|
|
|
<template slot-scope="scope">
|
|
|
<!-- <span>{{ parseTime(scope.row.registerTime, '{y}-{m}-{d}') }}</span> -->
|
|
|
- <span>{{ parseTime(scope.row.registerTime)}}</span>
|
|
|
+ <span>{{ parseTime(scope.row.registerTime) }}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
|
|
+ <el-table-column
|
|
|
+ label="操作"
|
|
|
+ align="center"
|
|
|
+ class-name="small-padding fixed-width"
|
|
|
+ >
|
|
|
<template slot-scope="scope">
|
|
|
<el-button
|
|
|
size="mini"
|
|
@@ -118,20 +147,22 @@
|
|
|
icon="el-icon-edit"
|
|
|
@click="handleUpdate(scope.row)"
|
|
|
v-hasPermi="['biz:deviceInfo:edit']"
|
|
|
- >修改</el-button>
|
|
|
+ >修改</el-button
|
|
|
+ >
|
|
|
<el-button
|
|
|
size="mini"
|
|
|
type="text"
|
|
|
icon="el-icon-delete"
|
|
|
@click="handleDelete(scope.row)"
|
|
|
v-hasPermi="['biz:deviceInfo:remove']"
|
|
|
- >删除</el-button>
|
|
|
+ >删除</el-button
|
|
|
+ >
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
-
|
|
|
+
|
|
|
<pagination
|
|
|
- v-show="total>0"
|
|
|
+ v-show="total > 0"
|
|
|
:total="total"
|
|
|
:page.sync="queryParams.pageNum"
|
|
|
:limit.sync="queryParams.pageSize"
|
|
@@ -154,11 +185,13 @@
|
|
|
<el-input v-model="form.deviceDesc" placeholder="请输入备注" />
|
|
|
</el-form-item>
|
|
|
<el-form-item label="注册时间" prop="registerTime">
|
|
|
- <el-date-picker clearable
|
|
|
+ <el-date-picker
|
|
|
+ clearable
|
|
|
v-model="form.registerTime"
|
|
|
type="datetime"
|
|
|
value-format="yyyy-MM-dd HH:mm:ss"
|
|
|
- placeholder="请选择注册时间">
|
|
|
+ placeholder="请选择注册时间"
|
|
|
+ >
|
|
|
</el-date-picker>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
@@ -171,7 +204,13 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { listDeviceInfo, getDeviceInfo, delDeviceInfo, addDeviceInfo, updateDeviceInfo } from "@/api/biz/deviceInfo";
|
|
|
+import {
|
|
|
+ listDeviceInfo,
|
|
|
+ getDeviceInfo,
|
|
|
+ delDeviceInfo,
|
|
|
+ addDeviceInfo,
|
|
|
+ updateDeviceInfo,
|
|
|
+} from "@/api/biz/deviceInfo";
|
|
|
|
|
|
export default {
|
|
|
name: "DeviceInfo",
|
|
@@ -205,28 +244,41 @@ export default {
|
|
|
deviceBrand: null,
|
|
|
deviceModel: null,
|
|
|
deviceDesc: null,
|
|
|
- registerTime: null
|
|
|
+ registerTime: null,
|
|
|
+ orderByColumn:null,
|
|
|
+ isAsc:null
|
|
|
},
|
|
|
// 表单参数
|
|
|
form: {},
|
|
|
// 表单校验
|
|
|
- rules: {
|
|
|
- }
|
|
|
+ rules: {},
|
|
|
};
|
|
|
},
|
|
|
created() {
|
|
|
- this.getList();
|
|
|
+ // this.getList();
|
|
|
+ this.handleSortChange()
|
|
|
},
|
|
|
methods: {
|
|
|
+ /** 排序触发事件 */
|
|
|
+ handleSortChange(column, prop, order) {
|
|
|
+ this.queryParams.orderByColumn ='registerTime';
|
|
|
+ this.queryParams.isAsc ='desc';
|
|
|
+ this.getList();
|
|
|
+ },
|
|
|
/** 查询设备信息列表 */
|
|
|
getList() {
|
|
|
this.loading = true;
|
|
|
this.queryParams.params = {};
|
|
|
- if (null != this.daterangeRegisterTime && '' != this.daterangeRegisterTime) {
|
|
|
- this.queryParams.params["beginRegisterTime"] = this.daterangeRegisterTime[0];
|
|
|
- this.queryParams.params["endRegisterTime"] = this.daterangeRegisterTime[1];
|
|
|
+ if (
|
|
|
+ null != this.daterangeRegisterTime &&
|
|
|
+ "" != this.daterangeRegisterTime
|
|
|
+ ) {
|
|
|
+ this.queryParams.params["beginRegisterTime"] =
|
|
|
+ this.daterangeRegisterTime[0];
|
|
|
+ this.queryParams.params["endRegisterTime"] =
|
|
|
+ this.daterangeRegisterTime[1];
|
|
|
}
|
|
|
- listDeviceInfo(this.queryParams).then(response => {
|
|
|
+ listDeviceInfo(this.queryParams).then((response) => {
|
|
|
this.deviceInfoList = response.rows;
|
|
|
this.total = response.total;
|
|
|
this.loading = false;
|
|
@@ -245,7 +297,7 @@ export default {
|
|
|
deviceBrand: null,
|
|
|
deviceModel: null,
|
|
|
deviceDesc: null,
|
|
|
- registerTime: null
|
|
|
+ registerTime: null,
|
|
|
};
|
|
|
this.resetForm("form");
|
|
|
},
|
|
@@ -262,9 +314,9 @@ export default {
|
|
|
},
|
|
|
// 多选框选中数据
|
|
|
handleSelectionChange(selection) {
|
|
|
- this.ids = selection.map(item => item.autoId)
|
|
|
- this.single = selection.length!==1
|
|
|
- this.multiple = !selection.length
|
|
|
+ this.ids = selection.map((item) => item.autoId);
|
|
|
+ this.single = selection.length !== 1;
|
|
|
+ this.multiple = !selection.length;
|
|
|
},
|
|
|
/** 新增按钮操作 */
|
|
|
handleAdd() {
|
|
@@ -275,8 +327,8 @@ export default {
|
|
|
/** 修改按钮操作 */
|
|
|
handleUpdate(row) {
|
|
|
this.reset();
|
|
|
- const autoId = row.autoId || this.ids
|
|
|
- getDeviceInfo(autoId).then(response => {
|
|
|
+ const autoId = row.autoId || this.ids;
|
|
|
+ getDeviceInfo(autoId).then((response) => {
|
|
|
this.form = response.data;
|
|
|
this.open = true;
|
|
|
this.title = "修改设备信息";
|
|
@@ -284,16 +336,16 @@ export default {
|
|
|
},
|
|
|
/** 提交按钮 */
|
|
|
submitForm() {
|
|
|
- this.$refs["form"].validate(valid => {
|
|
|
+ this.$refs["form"].validate((valid) => {
|
|
|
if (valid) {
|
|
|
if (this.form.autoId != null) {
|
|
|
- updateDeviceInfo(this.form).then(response => {
|
|
|
+ updateDeviceInfo(this.form).then((response) => {
|
|
|
this.$modal.msgSuccess("修改成功");
|
|
|
this.open = false;
|
|
|
this.getList();
|
|
|
});
|
|
|
} else {
|
|
|
- addDeviceInfo(this.form).then(response => {
|
|
|
+ addDeviceInfo(this.form).then((response) => {
|
|
|
this.$modal.msgSuccess("新增成功");
|
|
|
this.open = false;
|
|
|
this.getList();
|
|
@@ -305,19 +357,27 @@ export default {
|
|
|
/** 删除按钮操作 */
|
|
|
handleDelete(row) {
|
|
|
const autoIds = row.autoId || this.ids;
|
|
|
- this.$modal.confirm('是否确认删除设备信息编号为"' + autoIds + '"的数据项?').then(function() {
|
|
|
- return delDeviceInfo(autoIds);
|
|
|
- }).then(() => {
|
|
|
- this.getList();
|
|
|
- this.$modal.msgSuccess("删除成功");
|
|
|
- }).catch(() => {});
|
|
|
+ this.$modal
|
|
|
+ .confirm('是否确认删除设备信息编号为"' + autoIds + '"的数据项?')
|
|
|
+ .then(function () {
|
|
|
+ return delDeviceInfo(autoIds);
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ this.getList();
|
|
|
+ this.$modal.msgSuccess("删除成功");
|
|
|
+ })
|
|
|
+ .catch(() => {});
|
|
|
},
|
|
|
/** 导出按钮操作 */
|
|
|
handleExport() {
|
|
|
- this.download('biz/deviceInfo/export', {
|
|
|
- ...this.queryParams
|
|
|
- }, `deviceInfo_${new Date().getTime()}.xlsx`)
|
|
|
- }
|
|
|
- }
|
|
|
+ this.download(
|
|
|
+ "biz/deviceInfo/export",
|
|
|
+ {
|
|
|
+ ...this.queryParams,
|
|
|
+ },
|
|
|
+ `deviceInfo_${new Date().getTime()}.xlsx`
|
|
|
+ );
|
|
|
+ },
|
|
|
+ },
|
|
|
};
|
|
|
</script>
|