| | |
| | | <main> |
| | | <div class="main-content"> |
| | | <div class="main-title"> |
| | | <el-button |
| | | class="el-icon-plus" |
| | | type="primary" |
| | | @click="dialogCreate = true" |
| | | <el-button class="el-icon-plus button-addition" type="primary" @click="handleAdd" |
| | | >添加</el-button |
| | | > |
| | | </div> |
| | |
| | | </el-table-column> |
| | | <el-table-column prop="operation" label="操作" min-width="20"> |
| | | <template slot-scope="scope"> |
| | | <div class="btn"> |
| | | <div class="operation"> |
| | | <span @click="handleEdit(scope.row)">编辑</span> |
| | | <span class="line">|</span> |
| | | <span @click="handleDelete(scope.row)">删除</span> |
| | |
| | | title="添加音柱" |
| | | :visible.sync="dialogCreate" |
| | | width="60%" |
| | | v-if="dialogCreate" |
| | | :before-close="handleClose" |
| | | > |
| | | <MyForm :info="loudspeakerInfo" :closeDialog="null"></MyForm> |
| | | <MyForm :info="loudspeakerInfo" @closeDialog="handleCallBack"></MyForm> |
| | | </el-dialog> |
| | | </footer> |
| | | </div> |
| | |
| | | pageSize: 10, |
| | | currentPage: 1, |
| | | renderFlag: false, |
| | | loudspeakerInfo: { |
| | | id: 0, |
| | | name: "", |
| | | code: "", |
| | | power: "", |
| | | frequencyResponse: "", |
| | | fullRangeSpeaker: "", |
| | | }, |
| | | loudspeakerInfo: {}, |
| | | }; |
| | | }, |
| | | created() { |
| | |
| | | "getLoudspeakerList", |
| | | "saveLoudspeaker", |
| | | "updateLoudspeaker", |
| | | "deleteLoudspeaker", |
| | | ]), |
| | | handleAdd() { |
| | | this.loudspeakerInfo = { |
| | | id: 0, |
| | | name: "", |
| | | code: "", |
| | | power: "", |
| | | frequencyResponse: "", |
| | | fullRangeSpeaker: "", |
| | | }; |
| | | this.dialogCreate = true; |
| | | }, |
| | | handleEdit(row) { |
| | | this.loudspeakerInfo = row; |
| | | this.dialogCreate = true; |
| | | }, |
| | | handleDelete(row) {}, |
| | | handleDelete(row) { |
| | | this.$confirm("确认删除?").then((_) => { |
| | | this.deleteLoudspeaker(row.id).then((res) => { |
| | | this.$message({ |
| | | type: "success", |
| | | message: "删除成功!", |
| | | }); |
| | | this.setTableData(); |
| | | }); |
| | | }); |
| | | }, |
| | | formatSate(row, column) { |
| | | return row.state == 1 ? "在线" : "离线"; |
| | | }, |
| | | |
| | | handleCallBack(e) { |
| | | this.currentPage = 1; |
| | | this.dialogCreate = false; |
| | | this.setTableData(); |
| | | }, |
| | | // 设置表格斑马纹 |
| | | tableRowClassName({ row, rowIndex }) { |
| | | if ((rowIndex + 1) % 2 == 0) { |
| | |
| | | pageSize, |
| | | state: context, |
| | | }).then((res) => { |
| | | if (res.data.code == 200) { |
| | | this.list = res.data.data.records; |
| | | this.totalNum = res.data.data.total; |
| | | } |
| | | this.list = res.records; |
| | | this.totalNum = res.total; |
| | | }); |
| | | }, |
| | | handleStateChange(e) { |
| | | this.currentPage = 1; |
| | | this.setTableData(); |
| | | }, |
| | | // 当前页改变触发事件 |