|
|
@@ -11,16 +11,16 @@
|
|
|
</el-row>
|
|
|
<el-row>
|
|
|
<el-col :span="24" class="second-row">
|
|
|
- <el-form :inline="true" :model="formInline" class="demo-form-inline">
|
|
|
+ <el-form :inline="true" :model="form_select" class="demo-form-inline">
|
|
|
<el-form-item label="水表ID:" class="shuibiaoId">
|
|
|
- <el-input v-model="formInline.user" placeholder="请输入水表ID"></el-input>
|
|
|
+ <el-input placeholder="请输入水表ID"></el-input>
|
|
|
</el-form-item>
|
|
|
<el-form-item>
|
|
|
<el-button type="primary" @click="onSubmit">查找</el-button>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="楼栋号:" class="loudonghao">
|
|
|
- <el-select v-model="formInline.value">
|
|
|
- <el-option v-for="item in formInline.options" :key="item.value" :label="item.label"
|
|
|
+ <el-select v-model="form_select.value" @change="selectGet(form_select.value)">
|
|
|
+ <el-option v-for="item in form_select.builds" :key="item.value" :label="item.label"
|
|
|
:value="item.value">
|
|
|
</el-option>
|
|
|
</el-select>
|
|
|
@@ -36,12 +36,12 @@
|
|
|
<el-col :span="24" class="third-row">
|
|
|
<el-table ref="multipleTable" :data="tableData" tooltip-effect="dark" style="width: 100%"
|
|
|
@selection-change="handleSelectionChange" highlight-current-row>
|
|
|
- <el-table-column type="selection" label="全选" align="center" width="55"></el-table-column>
|
|
|
+ <el-table-column type="selection" align="center" width="105"></el-table-column>
|
|
|
<el-table-column label="水表ID" width="260">
|
|
|
- <template slot-scope="scope">{{ scope.row.id }}</template>
|
|
|
+ <template slot-scope="scope">{{ scope.row.user_id }}</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="drom" label="楼栋号" align="center" width="400"></el-table-column>
|
|
|
- <el-table-column prop="room" label="宿舍号" show-overflow-tooltip></el-table-column>
|
|
|
+ <el-table-column prop="build" label="楼栋号" align="center" width="400"></el-table-column>
|
|
|
+ <el-table-column prop="dom" label="宿舍号" show-overflow-tooltip></el-table-column>
|
|
|
<el-table-column label="操作" align="center" width="80">
|
|
|
<el-button type="text" class="del-btn" slot-scope="scope"
|
|
|
@click="handleDelete(scope.$index, scope.row)">删除
|
|
|
@@ -54,10 +54,10 @@
|
|
|
</el-table>
|
|
|
<div style="margin-top: 20px" class="table-footer">
|
|
|
<div class="pages">
|
|
|
- <el-pagination layout="prev, pager, next" :total="9000"></el-pagination>
|
|
|
+ <el-pagination layout="prev, pager, next" :total="rows_total"></el-pagination>
|
|
|
</div>
|
|
|
<div class="export-table">
|
|
|
- <el-button type="primary" size="small" @click="toggleSelection()">表格导出</el-button>
|
|
|
+ <el-button type="primary" size="small" @click="toggleSelection">表格导出</el-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
</el-col>
|
|
|
@@ -66,16 +66,17 @@
|
|
|
<el-col :span="24" class="forth-row">
|
|
|
<!-- 编辑对话框 -->
|
|
|
<el-dialog title="编辑" :visible.sync="editdialogFormVisible" width="500px" top="0vh" class="my-dialog">
|
|
|
- <hr style="width: 100%; position: absolute; top: 60px; left: 0px;background-color: #CCCCCC;height: 1px;border: 0;">
|
|
|
+ <hr
|
|
|
+ style="width: 100%; position: absolute; top: 60px; left: 0px;background-color: #CCCCCC;height: 1px;border: 0;">
|
|
|
<el-form :model="form">
|
|
|
<el-form-item label="水表ID:" :label-width="formLabelWidth">
|
|
|
- <el-input v-model="form.id" autocomplete="off"></el-input>
|
|
|
+ <el-input v-model="form.user_id" autocomplete="off"></el-input>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="楼栋号:" :label-width="formLabelWidth">
|
|
|
- <el-input v-model="form.drom" autocomplete="off"></el-input>
|
|
|
+ <el-input v-model="form.build" autocomplete="off"></el-input>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="宿舍号:" :label-width="formLabelWidth">
|
|
|
- <el-input v-model="form.room" autocomplete="off"></el-input>
|
|
|
+ <el-input v-model="form.dom" autocomplete="off"></el-input>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
@@ -86,7 +87,7 @@
|
|
|
<!-- 删除对话框 -->
|
|
|
<el-dialog :visible.sync="delDialogVisible" width="500px" center top="0vh" class="my-dialog">
|
|
|
<div class="box-icon"></div>
|
|
|
- <span class="del-msg">确定删除该学生信息吗?</span>
|
|
|
+ <span class="del-msg">确定删除该水表信息吗?</span>
|
|
|
<span slot="footer" class="dialog-footer">
|
|
|
<el-button @click="delDialogVisible = false">取 消</el-button>
|
|
|
<el-button type="primary" @click="delDialogVisible = false">确 定</el-button>
|
|
|
@@ -109,54 +110,86 @@
|
|
|
room: '118'
|
|
|
},
|
|
|
formLabelWidth: '120px',
|
|
|
- formInline: {
|
|
|
- user: '',
|
|
|
- options: [{
|
|
|
- value: '选项1',
|
|
|
+ form_select: {
|
|
|
+ builds: [{
|
|
|
+ value: 0,
|
|
|
label: '全部'
|
|
|
- }, {
|
|
|
- value: '选项2',
|
|
|
- label: '黄金糕'
|
|
|
}],
|
|
|
- value: '选项1'
|
|
|
+ value: 0
|
|
|
},
|
|
|
- tableData: [{
|
|
|
- id: 'KB580002652',
|
|
|
- drom: '18',
|
|
|
- room: '118'
|
|
|
- }, {
|
|
|
- id: 'KB580002652',
|
|
|
- drom: '18',
|
|
|
- room: '118'
|
|
|
- }, {
|
|
|
- id: 'KB580002652',
|
|
|
- drom: '18',
|
|
|
- room: '118'
|
|
|
- }, {
|
|
|
- id: 'KB580002652',
|
|
|
- drom: '18',
|
|
|
- room: '118'
|
|
|
- }, {
|
|
|
- id: 'KB580002652',
|
|
|
- drom: '18',
|
|
|
- room: '118'
|
|
|
- }, {
|
|
|
- id: 'KB580002652',
|
|
|
- drom: '18',
|
|
|
- room: '118'
|
|
|
- }, {
|
|
|
- id: 'KB580002652',
|
|
|
- drom: '18',
|
|
|
- room: '118'
|
|
|
- }, {
|
|
|
- id: 'KB580002652',
|
|
|
- drom: '18',
|
|
|
- room: '118'
|
|
|
- }],
|
|
|
+ tableData: [],
|
|
|
+ rows_total: 100,
|
|
|
multipleSelection: []
|
|
|
}
|
|
|
},
|
|
|
+ created() {
|
|
|
+ this.getTableData()
|
|
|
+ },
|
|
|
methods: {
|
|
|
+ /**
|
|
|
+ * 获取下拉列表选择的id
|
|
|
+ * @param {Object} vId
|
|
|
+ */
|
|
|
+ selectGet(vId) {
|
|
|
+ console.log(vId);
|
|
|
+ let obj = {};
|
|
|
+ obj = this.form_select.builds.find((item) => {
|
|
|
+ return item.value === vId; //筛选出匹配数据
|
|
|
+ });
|
|
|
+ console.log(obj);
|
|
|
+ // 查询该栋的信息
|
|
|
+ this.$axios.get('/api/HotWaters/waterlist.action?page=1&rows=8')
|
|
|
+ .then(res => {
|
|
|
+ // console.log(res.data);
|
|
|
+ this.$message.success('获取数据成功!');
|
|
|
+ this.tableData = res.data.rows
|
|
|
+ this.rows_total = res.data.total
|
|
|
+ this.form_select.builds = [{
|
|
|
+ value: 0,
|
|
|
+ label: '全部'
|
|
|
+ }]
|
|
|
+ for (var i = 0; i < res.data.rows.length; i++) {
|
|
|
+ this.form_select.builds.push({
|
|
|
+ value: res.data.rows[i].id,
|
|
|
+ label: res.data.rows[i].build
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(err => {
|
|
|
+ console.log(err);
|
|
|
+ this.$message.error('请求异常');
|
|
|
+ })
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 获取数据,填充表格变量
|
|
|
+ */
|
|
|
+ getTableData() {
|
|
|
+ let param = {
|
|
|
+ page: 1,
|
|
|
+ rows: 8
|
|
|
+ }
|
|
|
+ this.$axios.get('/api/HotWaters/waterlist.action?page=1&rows=8')
|
|
|
+ .then(res => {
|
|
|
+ // console.log(res.data);
|
|
|
+ this.$message.success('获取数据成功!');
|
|
|
+ this.tableData = res.data.rows
|
|
|
+ this.rows_total = res.data.total
|
|
|
+ this.form_select.builds = [{
|
|
|
+ value: 0,
|
|
|
+ label: '全部'
|
|
|
+ }]
|
|
|
+ for (var i = 0; i < res.data.rows.length; i++) {
|
|
|
+ this.form_select.builds.push({
|
|
|
+ value: res.data.rows[i].id,
|
|
|
+ label: res.data.rows[i].build
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(err => {
|
|
|
+ console.log(err);
|
|
|
+ this.$message.error('请求异常');
|
|
|
+ })
|
|
|
+ },
|
|
|
onSubmit() {
|
|
|
console.log('submit!');
|
|
|
},
|
|
|
@@ -166,14 +199,8 @@
|
|
|
handleClose(key, keyPath) {
|
|
|
console.log(key, keyPath);
|
|
|
},
|
|
|
- toggleSelection(rows) {
|
|
|
- if (rows) {
|
|
|
- rows.forEach(row => {
|
|
|
- this.$refs.multipleTable.toggleRowSelection(row);
|
|
|
- });
|
|
|
- } else {
|
|
|
- this.$refs.multipleTable.clearSelection();
|
|
|
- }
|
|
|
+ toggleSelection() {
|
|
|
+ console.log();
|
|
|
},
|
|
|
handleSelectionChange(val) {
|
|
|
this.multipleSelection = val;
|