wanshenmean
3 天以前 ce1292c9cf37195b6abd2699dfc5d6cb3e143c9b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
<h2>按钮显示与状态控制</h2>
<p class="subtitle">根据库存状态控制操作按钮的显示</p>
 
<div class="section">
  <h3>场景分析</h3>
  <p class="subtitle">不同状态的库存可能允许或禁止某些操作</p>
 
  <div class="mockup">
    <div class="mockup-header">库存状态枚举</div>
    <div class="mockup-body">
      <div class="status-list">
        <div class="status-item">
          <span class="status-badge status-badge-idle">待入库</span>
          <div class="status-desc">托盘已创建但尚未完成入库</div>
        </div>
        <div class="status-item">
          <span class="status-badge status-badge-instock">在库</span>
          <div class="status-desc">托盘正常在库中</div>
        </div>
        <div class="status-item">
          <span class="status-badge status-badge-outbound">出库中</span>
          <div class="status-desc">托盘正在出库流程中</div>
        </div>
        <div class="status-item">
          <span class="status-badge status-badge-lock">锁定</span>
          <div class="status-desc">托盘被锁定,不可操作</div>
        </div>
      </div>
    </div>
  </div>
</div>
 
<div class="section">
  <h3>按钮显示策略选择</h3>
  <p class="subtitle">不同策略的用户体验和实现复杂度</p>
 
  <div class="options">
    <div class="option" data-choice="always" onclick="toggleSelect(this)">
      <div class="letter">A</div>
      <div class="content">
        <h3>始终显示</h3>
        <p>所有操作按钮始终显示,点击后在弹窗中校验状态</p>
        <div class="pros-cons">
          <div class="pros"><h4>优点</h4><ul><li>实现简单</li><li>用户清楚有哪些功能</li></ul></div>
          <div class="cons"><h4>缺点</h4><ul><li>可能产生无效点击</li><li>体验较差</li></ul></div>
        </div>
      </div>
    </div>
    <div class="option" data-choice="dynamic" onclick="toggleSelect(this)">
      <div class="letter">B</div>
      <div class="content">
        <h3>动态显示</h3>
        <p>根据库存状态动态显示/隐藏按钮</p>
        <div class="pros-cons">
          <div class="pros"><h4>优点</h4><ul><li>界面清晰</li><li>减少误操作</li><li>体验更好</li></ul></div>
          <div class="cons"><h4>缺点</h4><ul><li>需要维护状态映射</li></ul></div>
        </div>
      </div>
    </div>
    <div class="option" data-choice="disable" onclick="toggleSelect(this)">
      <div class="letter">C</div>
      <div class="content">
        <h3>显示并禁用</h3>
        <p>所有按钮都显示,但不可用的显示为禁用状态</p>
        <div class="pros-cons">
          <div class="pros"><h4>优点</h4><ul><li>用户知道有此功能</li><li>清楚为何不可用</li></ul></div>
          <div class="cons"><h4>缺点</h4><ul><li>界面可能拥挤</li></ul></div>
        </div>
      </div>
    </div>
  </div>
</div>
 
<div class="section">
  <h3>示例:动态显示效果</h3>
  <p class="subtitle">不同状态下的按钮显示情况</p>
 
  <div class="mockup">
    <div class="mockup-header">预览:不同状态的按钮显示</div>
    <div class="mockup-body">
      <table class="mock-table">
        <thead>
          <tr>
            <th>托盘编号</th>
            <th>库存状态</th>
            <th>操作按钮</th>
          </tr>
        </thead>
        <tbody>
          <tr>
            <td>P001</td>
            <td><span class="status-badge status-badge-idle">待入库</span></td>
            <td>
              <button class="mock-btn-inline mock-btn-primary">进站</button>
              <button class="mock-btn-inline mock-btn-disabled">出站</button>
            </td>
          </tr>
          <tr>
            <td>P002</td>
            <td><span class="status-badge status-badge-instock">在库</span></td>
            <td>
              <button class="mock-btn-inline mock-btn-disabled">进站</button>
              <button class="mock-btn-inline mock-btn-success">出站</button>
            </td>
          </tr>
          <tr>
            <td>P003</td>
            <td><span class="status-badge status-badge-lock">锁定</span></td>
            <td>
              <span class="text-muted">暂无可执行操作</span>
            </td>
          </tr>
        </tbody>
      </table>
    </div>
  </div>
</div>
 
<style>
.status-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.status-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: #fafafa;
  border-radius: 6px;
}
.status-badge {
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}
.status-badge-idle {
  background: #e3f2fd;
  color: #1976d2;
}
.status-badge-instock {
  background: #e8f5e9;
  color: #388e3c;
}
.status-badge-outbound {
  background: #fff3e0;
  color: #f57c00;
}
.status-badge-lock {
  background: #ffebee;
  color: #d32f2f;
}
.status-desc {
  font-size: 13px;
  color: #606266;
}
.mock-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.mock-table th, .mock-table td {
  border: 1px solid #e0e0e0;
  padding: 10px 12px;
  text-align: left;
}
.mock-table th {
  background: #f5f5f5;
  font-weight: 600;
}
.mock-table tbody tr:nth-child(even) {
  background: #fafafa;
}
.mock-btn-inline {
  padding: 6px 14px;
  font-size: 13px;
  border-radius: 4px;
  border: 1px solid #dcdfe6;
  background: white;
  cursor: pointer;
  margin-right: 8px;
}
.mock-btn-primary {
  background: #1f5eff;
  color: white;
  border-color: #1f5eff;
}
.mock-btn-success {
  background: #67c23a;
  color: white;
  border-color: #67c23a;
}
.mock-btn-disabled {
  background: #f5f5f5;
  color: #c0c4cc;
  border-color: #e4e7ed;
  cursor: not-allowed;
}
.text-muted {
  color: #909399;
  font-size: 13px;
}
.pros-cons {
  display: flex;
  gap: 16px;
  margin-top: 12px;
}
.pros, .cons {
  flex: 1;
  font-size: 13px;
}
.pros h4 {
  color: #4caf50;
  margin: 0 0 6px 0;
}
.cons h4 {
  color: #f56c6c;
  margin: 0 0 6px 0;
}
.pros ul, .cons ul {
  margin: 0;
  padding-left: 16px;
}
.pros li, .cons li {
  margin-bottom: 4px;
}
</style>