Blame view

src/views/prod/list.vue 6.58 KB
5cb375940   Adam   auto commit the c...
1
2
  <template>
    <div class="app-container">
a86b16bba   Adam   auto commit the c...
3
4
5
6
7
8
9
10
11
12
13
14
15
16
      <!-- <el-header>
  
      </el-header> -->
      <template>
        <router-link :to="'/prod/create/1111'">
          <el-button
            type="primary"
            size="small"
            icon="el-icon-edit"
          >
            create
          </el-button>
        </router-link>
      </template>
398cda401   Adam   auto commit the c...
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
      <el-dialog
        title="提示"
        :visible.sync="dialogVisible"
        width="30%"
        :before-close="handleClose"
      >
        <span>这是一段信息</span>
        <span>这是一段信息</span>
        <span>这是一段信息</span>
        <span>这是一段信息</span>
        <span>这是一段信息</span>
        <span>这是一段信息</span>
        <span>这是一段信息</span>
        <span>这是一段信息</span>
        <span>这是一段信息</span>
        <span>这是一段信息</span>
        <span>这是一段信息</span>
        <span>这是一段信息</span>
        <span>这是一段信息</span>
        <span>这是一段信息</span>
        <span>这是一段信息</span>
        <span>这是一段信息</span>
        <span>这是一段信息</span>
        <span>这是一段信息</span>
        <span>这是一段信息</span>
        <span>这是一段信息</span>
        <span>这是一段信息</span>
        <span>这是一段信息</span>
        <span>这是一段信息</span>
        <span>这是一段信息</span>
        <span>这是一段信息</span>
        <span>这是一段信息</span>
        <span>这是一段信息</span>
        <span>这是一段信息</span>
        <span>这是一段信息</span>
        <span>这是一段信息</span>
        <span>这是一段信息</span>
        <span>这是一段信息</span>
        <span>这是一段信息</span>
        <span>这是一段信息</span>
        <span
          slot="footer"
          class="dialog-footer"
        >
          <el-button @click="dialogVisible = false">取 消</el-button>
          <el-button
            type="primary"
            @click="dialogVisible = false"
          >确 定</el-button>
        </span>
      </el-dialog>
5cb375940   Adam   auto commit the c...
68
      <el-table
5cb375940   Adam   auto commit the c...
69
70
        v-loading="listLoading"
        :data="list"
5cb375940   Adam   auto commit the c...
71
72
73
74
75
76
77
        border
        fit
        highlight-current-row
        style="width: 100%"
      >
        <el-table-column
          align="center"
a86b16bba   Adam   auto commit the c...
78
          label="pid"
5cb375940   Adam   auto commit the c...
79
        >
04e55fcfe   Adam   auto commit the c...
80
          <template slot-scope="scope">
398cda401   Adam   auto commit the c...
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
            <el-button
              type="primary"
              size="small"
              icon="el-icon-more"
              @click="dialogVisible = true"
            >SKU管理</el-button>
            <el-button
              type="primary"
              size="small"
              icon="el-icon-chat-round"
              @click="dialogVisible = true"
            >评论管理</el-button>
            <el-button
              type="primary"
              size="small"
              icon="el-icon-setting"
              @click="dialogVisible = true"
            >产品定义</el-button>
            <br>
a86b16bba   Adam   auto commit the c...
100
            <span>{{ scope.row.pid }}</span>
5cb375940   Adam   auto commit the c...
101
102
          </template>
        </el-table-column>
5cb375940   Adam   auto commit the c...
103
        <el-table-column
5cb375940   Adam   auto commit the c...
104
          align="center"
a86b16bba   Adam   auto commit the c...
105
          label="pname"
5cb375940   Adam   auto commit the c...
106
        >
04e55fcfe   Adam   auto commit the c...
107
          <template slot-scope="scope">
a86b16bba   Adam   auto commit the c...
108
            <span>{{ scope.row.pname }}</span>
5cb375940   Adam   auto commit the c...
109
110
          </template>
        </el-table-column>
5cb375940   Adam   auto commit the c...
111
        <el-table-column
5cb375940   Adam   auto commit the c...
112
          align="center"
a86b16bba   Adam   auto commit the c...
113
          label="参数信息"
5cb375940   Adam   auto commit the c...
114
        >
04e55fcfe   Adam   auto commit the c...
115
          <template slot-scope="scope">
a86b16bba   Adam   auto commit the c...
116
117
118
119
120
121
            <span>框宽{{ scope.row.prod_info_frame_width }}mm</span><br>
            <span>腿长{{ scope.row.prod_info_leg_long }}mm</span><br>
            <span>镜宽{{ scope.row.prod_info_glass_width }}mm</span><br>
            <span>镜高{{ scope.row.prod_info_glass_height }}mm</span><br>
            <span>鼻宽{{ scope.row.prod_info_norse_width }}mm</span><br>
            <span>重量{{ scope.row.prod_info_weight }}g</span>
5cb375940   Adam   auto commit the c...
122
123
124
125
          </template>
        </el-table-column>
  
        <el-table-column
a86b16bba   Adam   auto commit the c...
126
127
          align="center"
          label="Date"
5cb375940   Adam   auto commit the c...
128
        >
04e55fcfe   Adam   auto commit the c...
129
          <template slot-scope="scope">
a86b16bba   Adam   auto commit the c...
130
131
132
133
134
135
            <span>{{ scope.row.timestamp | parseTime('{y}-{m}-{d} {h}:{i}') }}</span>
          </template>
        </el-table-column>
  
        <el-table-column label="Importance">
          <template slot-scope="scope">
5cb375940   Adam   auto commit the c...
136
            <svg-icon
04e55fcfe   Adam   auto commit the c...
137
              v-for="n in +scope.row.importance"
5cb375940   Adam   auto commit the c...
138
139
              :key="n"
              icon-class="star"
04e55fcfe   Adam   auto commit the c...
140
              class="meta-item__icon"
5cb375940   Adam   auto commit the c...
141
142
143
144
145
            />
          </template>
        </el-table-column>
  
        <el-table-column
5cb375940   Adam   auto commit the c...
146
          class-name="status-col"
a86b16bba   Adam   auto commit the c...
147
          label="prod_status"
5cb375940   Adam   auto commit the c...
148
149
        >
          <template slot-scope="{row}">
a86b16bba   Adam   auto commit the c...
150
151
            <el-tag :type="row.prod_status | statusFilter">
              {{ row.prod_status }}
5cb375940   Adam   auto commit the c...
152
153
154
155
156
157
            </el-tag>
          </template>
        </el-table-column>
  
        <el-table-column
          align="center"
04e55fcfe   Adam   auto commit the c...
158
          label="Actions"
5cb375940   Adam   auto commit the c...
159
        >
a86b16bba   Adam   auto commit the c...
160
161
162
163
164
165
166
167
168
169
170
          <template slot-scope="{row}">
            <router-link :to="'/prod/edit/'+row.pid">
              <el-button
                type="primary"
                size="small"
                icon="el-icon-edit"
              >
                Edit1
              </el-button>
            </router-link>
            <router-link :to="'/prod/del/'+row.pid">
04e55fcfe   Adam   auto commit the c...
171
172
173
174
175
              <el-button
                type="primary"
                size="small"
                icon="el-icon-edit"
              >
a86b16bba   Adam   auto commit the c...
176
                Edit2
04e55fcfe   Adam   auto commit the c...
177
178
              </el-button>
            </router-link>
5cb375940   Adam   auto commit the c...
179
180
181
          </template>
        </el-table-column>
      </el-table>
04e55fcfe   Adam   auto commit the c...
182
183
184
185
186
187
188
189
  
      <pagination
        v-show="total>0"
        :total="total"
        :page.sync="listQuery.page"
        :limit.sync="listQuery.limit"
        @pagination="getList"
      />
5cb375940   Adam   auto commit the c...
190
191
192
193
    </div>
  </template>
  
  <script>
a86b16bba   Adam   auto commit the c...
194
195
  import { fetchList } from '@/api/prod'
  // import { Pagination } from "@/components/Pagination"; // Secondary package based on el-pagination
04e55fcfe   Adam   auto commit the c...
196
  import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
5cb375940   Adam   auto commit the c...
197
  export default {
a86b16bba   Adam   auto commit the c...
198
    name: 'ProdList',
04e55fcfe   Adam   auto commit the c...
199
    components: { Pagination },
5cb375940   Adam   auto commit the c...
200
    filters: {
a86b16bba   Adam   auto commit the c...
201
      statusFilter(prod_status) {
5cb375940   Adam   auto commit the c...
202
203
204
205
206
        const statusMap = {
          published: 'success',
          draft: 'info',
          deleted: 'danger'
        }
a86b16bba   Adam   auto commit the c...
207
        return statusMap[prod_status]
5cb375940   Adam   auto commit the c...
208
209
210
211
      }
    },
    data() {
      return {
398cda401   Adam   auto commit the c...
212
        dialogVisible: false,
5cb375940   Adam   auto commit the c...
213
        list: null,
04e55fcfe   Adam   auto commit the c...
214
        total: 0,
5cb375940   Adam   auto commit the c...
215
216
217
        listLoading: true,
        listQuery: {
          page: 1,
04e55fcfe   Adam   auto commit the c...
218
219
          limit: 20
        }
5cb375940   Adam   auto commit the c...
220
221
222
223
224
225
      }
    },
    created() {
      this.getList()
    },
    methods: {
398cda401   Adam   auto commit the c...
226
227
228
229
230
231
232
      handleClose(done) {
        this.$confirm('确认关闭?')
          .then(_ => {
            done()
          })
          .catch(_ => {})
      },
04e55fcfe   Adam   auto commit the c...
233
      getList() {
5cb375940   Adam   auto commit the c...
234
        this.listLoading = true
a86b16bba   Adam   auto commit the c...
235
        console.log('getList', 'dddddd')
04e55fcfe   Adam   auto commit the c...
236
237
238
239
        fetchList(this.listQuery).then(response => {
          this.list = response.data.items
          this.total = response.data.total
          this.listLoading = false
5cb375940   Adam   auto commit the c...
240
241
242
243
244
        })
      }
    }
  }
  </script>
5cb375940   Adam   auto commit the c...
245
  <style scoped>
04e55fcfe   Adam   auto commit the c...
246
247
  .edit-input {
    padding-right: 100px;
5cb375940   Adam   auto commit the c...
248
  }
04e55fcfe   Adam   auto commit the c...
249
250
251
252
  .cancel-btn {
    position: absolute;
    right: 15px;
    top: 10px;
5cb375940   Adam   auto commit the c...
253
254
  }
  </style>