123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- <template>
- <div>
- <div class="operation">
- <el-button type="primary" @click="goEdit({id:0})" size="mini">添加</el-button>
- </div>
- <el-table :data="items">
- <el-table-column label="名称" prop="name"></el-table-column>
- <el-table-column label="图片" width="110px">
- <template slot-scope="scope">
- <img :src="scope.row.icon" style="width:100px;" />
- </template>
- </el-table-column>
- <el-table-column label="标题" prop="title"></el-table-column>
- <el-table-column label="状态">
- <template slot-scope="scope">
- <template v-if="scope.row.status === 1">
- <p class="online">启用</p>
- </template>
- <template v-else>
- <p class="offline">禁用</p>
- </template>
- </template>
- </el-table-column>
- <el-table-column label="操作">
- <template slot-scope="scope">
- <template v-if="scope.row.status == 0">
- <el-button type="success" @click="setStatus(scope.row)" size="mini">启用</el-button>
- </template>
- <template v-else>
- <el-button type="danger" @click="setStatus(scope.row)" size="mini">禁用</el-button>
- </template>
- <el-button type="text" size="small" @click="goEdit(scope.row)">编辑</el-button>
- </template>
- </el-table-column>
- </el-table>
- </div>
- </template>
- <script>
- export default {
- data() {
- return {
- items: []
- };
- },
- methods: {
- getItems: function() {
- this.$http.equipmentList({}, this).then(res => {
- if (res.code === 0) {
- this.items = res.obj;
- }
- });
- },
- setStatus: function(row) {
- var status = row.status === 1 ? 0 : 1;
- var msg = status === 1 ? "启用" : "禁用";
- this.$confirm(
- '您确定要将此医生设置为 "' + msg + '" , 是否继续?',
- "提示",
- {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }
- ).then(() => {
- this.$http
- .equipmentSetStatus({ id: row.id, status: status }, this)
- .then(res => {
- if (res.code === 0) {
- this.$message({
- message: "操作成功",
- type: "success"
- });
- row.status = status;
- }
- });
- });
- },
- goEdit: function(row) {
- this.$router.push({ path: "/editEquipment", query: { id: row.id } });
- }
- },
- mounted: function() {
- this.getItems();
- }
- };
- </script>
- <style scoped>
- .online {
- color: #67c23a;
- }
- .offline {
- color: #f56c6c;
- }
- .operation {
- height: 50px;
- border-bottom: 1px solid #e6e6e6;
- margin-bottom: 10px;
- }
- </style>
|