counter.vue 6.89 KB
Newer Older
xd's avatar
xd committed
1
<template>
xd's avatar
xd committed
2 3 4 5
  <div class="main">
    <div class="title">全部柜组( 共5个 )</div>
    <div class="searchs">
      <div class="buttons">
xd's avatar
xd committed
6
        <el-button class="button buttonlight" size="small" @click="addCounter">添加柜组</el-button>
xd's avatar
xd committed
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
        <el-button class="button buttondark" size="small">批量删除</el-button>
      </div>

      <!-- 搜索区 -->
      <el-form
        class="searchzone"
        :inline="true"
        :model="data.search"
        label-width="auto"
      >
        <el-form-item label="关键词">
          <el-input
            size="small"
            v-model="data.search.keys"
            style="width:160px"
            placeholder="请输入关键词"
          />
        </el-form-item>
        <el-button class="button buttondark" size="small" style="margin-top:4px;">搜索</el-button>
      </el-form>
    </div>
    <div class="lists">
      <el-table
xd's avatar
xd committed
30
        stripe  
xd's avatar
xd committed
31
        ref="multipleTable"
xd's avatar
xd committed
32
        :data="tableData"
xd's avatar
xd committed
33
        tooltip-effect="dark"
xd's avatar
xd committed
34 35
        style="width: 100%;"
        height="calc(100vh - 360px)"
xd's avatar
xd committed
36 37 38 39
        @selection-change="listPick"
      >
        <el-table-column type="selection" width="60"></el-table-column>
        <el-table-column
xd's avatar
xd committed
40
          prop="name"
xd's avatar
xd committed
41
          label="柜组"
xd's avatar
xd committed
42 43 44
          align="center"
        ></el-table-column>
        <el-table-column
xd's avatar
xd committed
45
          prop="principal"
xd's avatar
xd committed
46 47 48 49
          label="柜组负责人"
          align="center"
        ></el-table-column>
        <el-table-column
xd's avatar
xd committed
50
          prop="num"
xd's avatar
xd committed
51 52 53 54
          label="柜组编号"
          align="center"
        ></el-table-column>
        <el-table-column
xd's avatar
xd committed
55
          prop="area"
xd's avatar
xd committed
56
          label="所在区域"
xd's avatar
xd committed
57 58 59
          align="center"
        ></el-table-column>
         <el-table-column
xd's avatar
xd committed
60
          prop="adminStallList.length"
xd's avatar
xd committed
61 62 63 64
          label="门店数量"
          align="center"
          width="120"
        ></el-table-column>
xd's avatar
xd committed
65
        <el-table-column label="创建时间" width="120" align="center" prop="createDate"/>
xd's avatar
xd committed
66 67
        <el-table-column label="操作" align="center" fixed="right" width="200">
          <template slot-scope="scope">
xd's avatar
xd committed
68
            <el-button type="text" class="btn" @click="handleDetail(scope.row.id)"
xd's avatar
xd committed
69 70
              >详情</el-button
            >
xd's avatar
xd committed
71
            <el-button type="text" class="btn" @click="handleEdit(scope.row.id)"
xd's avatar
xd committed
72 73 74 75
              >编辑</el-button
            >
            <el-button
              type="text"
xd's avatar
xd committed
76
              @click="handleDelete(scope.row.id)"
xd's avatar
xd committed
77 78 79 80 81 82 83 84 85
              class="listButtonRed"
              >删除</el-button
            >
          </template>
        </el-table-column>
      </el-table>
    </div>
    <div class="pages">
      <el-pagination
xd's avatar
xd committed
86 87 88 89 90 91
      @current-change="handleCurrentChange"
      :current-page="page.currentPage"
      :page-size="page.size"
      layout="total, prev, pager, next, jumper"
      :total="page.total">
    </el-pagination>
xd's avatar
xd committed
92
    </div>
xd's avatar
xd committed
93
    <add-counter ref="addCounter"></add-counter>
xd's avatar
xd committed
94 95
    <counter-detail ref="counterDetail" :msgId="msgId" v-if="detailDialog" @handleDetailClose="handleDetailClose"></counter-detail>
    <edit-counter ref="editCounter" :msgId="editId" v-if="editDialog" @handleEditClose="handleEditClose"></edit-counter>
xd's avatar
xd committed
96 97
  </div>
</template>
Z's avatar
Z committed
98 99 100 101 102





xd's avatar
xd committed
103
<script>
xd's avatar
xd committed
104
import CounterDetail from "./components/counterDetail"
xd's avatar
xd committed
105
import AddCounter from "./components/addCounter"
xd's avatar
xd committed
106 107
import EditCounter from "./components/editCounter"
import { getList } from "@/api/in/counter"
xd's avatar
xd committed
108
export default {
xd's avatar
xd committed
109
  components: {
xd's avatar
xd committed
110
    CounterDetail,
xd's avatar
xd committed
111 112
    AddCounter,
    EditCounter
xd's avatar
xd committed
113
  },
xd's avatar
xd committed
114 115
  data() {
    return {
xd's avatar
xd committed
116
      tableData: [],
xd's avatar
xd committed
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150
      list: {
        search: {
          bar: [
            {
              id: "1",
              name: "全部"
            },
            {
              id: "2",
              name: "测试"
            }
          ],
          taskType: [
            {
              id: "1",
              name: "全部"
            },
            {
              id: "2",
              name: "测试"
            }
          ]
        }
      },
      data: {
        search: {
          bar: "",
          taskType: "",
          date: "",
          keys: ""
        },
        page: {
          nowPageNum: 4
        }
xd's avatar
xd committed
151
      },
xd's avatar
xd committed
152 153
      detailDialog: false,
      counterDialog: false,
xd's avatar
xd committed
154
      editDialog: false,
xd's avatar
xd committed
155
      tableHeight: window.innerHeight * 0.5 ,
xd's avatar
xd committed
156 157 158 159
      page:{
          currentPage:1,
          size:20,
          total:100
xd's avatar
xd committed
160 161 162
      },
      msgId: "",
      editId: ""
xd's avatar
xd committed
163 164
    };
  },
xd's avatar
xd committed
165 166 167
  mounted() {
    this.getList()
  },
xd's avatar
xd committed
168
  methods: {
xd's avatar
xd committed
169 170 171 172 173
    getList() {
      getList().then(res => {        
        this.tableData = res.data.adminShops
      })
    },
xd's avatar
xd committed
174
    listPick() {},
xd's avatar
xd committed
175 176 177 178 179 180
    handleEdit(id) {
      this.editId = id 
      this.editDialog = true
      this.$refs.editCounter.counterDialog = true 
    },
    handleDelete(id) {
xd's avatar
xd committed
181 182 183 184 185 186
      this.$confirm('确定删除该柜组吗?', {
        }).then(() => {
          this.$message.success("删除成功")
        }).catch(() => {
          this.$message.info("取消删除")         
        }); 
xd's avatar
xd committed
187 188 189 190
    },
    handleEditClose() {
      this.editDialog = false
    },
xd's avatar
xd committed
191 192
    pagesSizeChange() {},
    pagesNowPageChange() {},
xd's avatar
xd committed
193
    handleDetail(id) {     
Z's avatar
Z committed
194
      this.msgId = id
xd's avatar
xd committed
195 196 197 198 199
      this.detailDialog = true
      this.$refs.counterDetail.detailDialog = true      
    },
    handleDetailClose() {
      this.detailDialog = false
xd's avatar
xd committed
200 201
    },
    addCounter() {
xd's avatar
xd committed
202
      this.$refs.addCounter.counterDialog= true
xd's avatar
xd committed
203
    },
xd's avatar
xd committed
204 205
    addCounterFinish() {
      this.counterDialog = false
xd's avatar
xd committed
206 207 208 209
    },
    handleCurrentChange(val) {
      console.log(`当前页: ${val}`);
    },
xd's avatar
xd committed
210 211 212 213 214 215 216
  },
 /*  mounted() {
     this.$nextTick(() => {
         this.tableHeight = window.innerHeight - 120;
     })        
  } */
}
xd's avatar
xd committed
217
</script>
xd's avatar
xd committed
218 219
<style lang="scss" scoped>
.main {
xd's avatar
xd committed
220 221 222 223
  position: relative;
  background-color: #fff;
  box-sizing: border-box;
  height: 100%;
xd's avatar
xd committed
224 225 226 227
  padding: 0px 16px 16px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
xd's avatar
xd committed
228
  width: 100%;
xd's avatar
xd committed
229
  box-shadow: 0px 2px 4px 0px #ddd;
xd's avatar
xd committed
230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250
}
.searchs {
  height: 40px;
  width: 100%;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
}
.buttons {
  width: 266px;
  display: flex;
  flex-direction: row;
  justify-content: flex-start;
}
.buttonlight {
  background-color: #e8e9fe;
  color: #4e59c7;
  border: 1px solid #4e59c7;
  box-sizing: border-box;
}
xd's avatar
xd committed
251

xd's avatar
xd committed
252 253
.btn {
  font-size:14px;
xd's avatar
xd committed
254
  // font-weight:bold;
xd's avatar
xd committed
255 256 257 258 259 260 261 262 263 264
  color:rgba(102,102,102,1);
}
.buttondark {
  width: 88px;
  height: 32px;
  background-color: #4e59c7;
  color: #ffffff;
  border: 1px solid #4e59c7;
  box-sizing: border-box;
}
xd's avatar
xd committed
265

xd's avatar
xd committed
266 267 268 269 270 271 272 273 274 275 276 277 278
.searchzone {
  height: 40px;
  width: auto;
  min-width: 654px;
  text-align: right;
}
.lists {
  height: auto;
  min-height: 70%;
  width: 100%;
  margin-top: 20px;
}
.listButtonRed {
xd's avatar
xd committed
279 280
  color: #D0021B;
  // font-weight: bold;
xd's avatar
xd committed
281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297
}
.pages {
  height: 40px;
  width: 100%;
  display: flex;
  flex-direction: row;
  justify-content: flex-end;
  align-items: center;
}
.title {
  height: 48px;
  line-height: 48px;
  color:rgba(56,56,56,1);
  border-bottom: 1px solid #f8f8f8;
  margin-bottom: 16px;
}
</style>