Browse Source

价格页面

FEI 3 weeks ago
parent
commit
195b83d757
1 changed files with 483 additions and 0 deletions
  1. 483
    0
      src/views/sto/main/cargo.vue

+ 483
- 0
src/views/sto/main/cargo.vue View File

@@ -0,0 +1,483 @@
1
+<template>
2
+  <div>
3
+    <!-- 查询条件 -->
4
+    <el-card :body-style="cardBodyStyle">
5
+      <el-form :model="query" label-width="auto" label-position="right">
6
+        <el-row :gutter="10">
7
+          <el-col :span="5">
8
+            <el-form-item label="上游客户" style="margin-bottom: 0px;">
9
+              <el-select v-model="query.uperCustomerId" filterable placeholder="请选择上游客户" clearable style="width:100%;" size="small">
10
+                <el-option v-for="item in optionsCustomer" :key="item.id" :label="item.customerNm" :value="item.id" />
11
+              </el-select>
12
+            </el-form-item>
13
+          </el-col>
14
+          <el-col :span="5">
15
+            <el-form-item label="客户" style="margin-bottom: 0px;">
16
+              <el-select v-model="query.customerId" filterable placeholder="请选择客户" clearable style="width:100%;" size="small">
17
+                <el-option v-for="item in optionsCustomer" :key="item.id" :label="item.customerNm" :value="item.id" />
18
+              </el-select>
19
+            </el-form-item>
20
+          </el-col>
21
+          <el-col :span="4">
22
+            <el-form-item label="" style="margin-bottom: 0px; margin-top: 5px;">
23
+              <el-button type="primary" @click="handleSearch">查询</el-button>
24
+              <el-button type="success" @click="handleAdd">新增</el-button>
25
+              <el-button type="info" @click="handleReset">重置</el-button>
26
+            </el-form-item>
27
+          </el-col>
28
+        </el-row>
29
+      </el-form>
30
+    </el-card>
31
+
32
+    <!-- 数据表格 -->
33
+    <el-card :body-style="cardBodyStyle">
34
+      <el-table :data="tableData" border highlight-current-row v-loading="loading">
35
+        <el-table-column type="index" label="序号" align="center" width="60">
36
+          <template #default="scope">
37
+            <span>{{ scope.$index + (currentPage - 1) * pageSize + 1 }}</span>
38
+          </template>
39
+        </el-table-column>
40
+        <el-table-column prop="uperCustomerName" label="上游客户" width="180" show-overflow-tooltip />
41
+        <el-table-column prop="customerName" label="客户" width="180" show-overflow-tooltip />
42
+        <el-table-column prop="sumWeight" label="可使用量(吨)" width="120" show-overflow-tooltip align="right">
43
+          <template #default="scope">
44
+            <span>{{ scope.row.sumWeight ? scope.row.sumWeight.toFixed(3) : '0.000' }}</span>
45
+          </template>
46
+        </el-table-column>
47
+        <el-table-column prop="useWeight" label="已使用量(吨)" width="120" show-overflow-tooltip align="right">
48
+          <template #default="scope">
49
+            <span>{{ scope.row.useWeight ? scope.row.useWeight.toFixed(3) : '0.000' }}</span>
50
+          </template>
51
+        </el-table-column>
52
+        <el-table-column label="操作" width="120" fixed="right">
53
+          <template #default="scope">
54
+            <el-button plain type="warning" size="mini" @click="handleEdit(scope.row)">编辑</el-button>
55
+          </template>
56
+        </el-table-column>
57
+        <el-table-column label="日志记录" width="100" fixed="right">
58
+          <template #default="scope">
59
+            <el-button plain type="primary" size="mini" @click="handleLog(scope.row)">查看</el-button>
60
+          </template>
61
+        </el-table-column>
62
+      </el-table>
63
+    </el-card>
64
+
65
+    <!-- 分页 -->
66
+    <el-card :body-style="cardBodyStyle">
67
+      <el-pagination :current-page="currentPage" :page-size="pageSize" :page-sizes="pageSizes" :total="totalRows"
68
+                     background layout="total, sizes, prev, pager, next, jumper"
69
+                     @size-change="handleSizeChange"
70
+                     @current-change="handleCurrentChange" />
71
+    </el-card>
72
+
73
+    <!-- 新增/编辑对话框 -->
74
+    <el-dialog title="转移数量修改" v-model="dialogVisible" width="500px" :close-on-click-modal="false">
75
+      <el-form :model="form" label-width="120px" label-position="right" :rules="rules" ref="ruleFormRef">
76
+        <el-form-item label="上游客户" prop="uperCustomerId">
77
+          <el-select v-model="form.uperCustomerId" filterable placeholder="请选择上游客户" clearable style="width: 100%;">
78
+            <el-option v-for="item in optionsCustomer" :key="item.id" :label="item.customerNm" :value="item.id" />
79
+          </el-select>
80
+        </el-form-item>
81
+        <el-form-item label="客户" prop="customerId">
82
+          <el-select v-model="form.customerId" filterable placeholder="请选择客户" clearable style="width: 100%;">
83
+            <el-option v-for="item in optionsCustomer" :key="item.id" :label="item.customerNm" :value="item.id" />
84
+          </el-select>
85
+        </el-form-item>
86
+        <el-form-item label="修改内容" prop="subStr">
87
+          <el-select v-model="form.subStr" placeholder="请选择修改内容" clearable style="width: 100%;">
88
+            <el-option label="增加" value="增加" />
89
+            <el-option label="减少" value="减少" />
90
+          </el-select>
91
+        </el-form-item>
92
+        <el-form-item label="重量" prop="weight">
93
+          <el-input v-model="form.weight" type="number" placeholder="请输入重量" style="width: 100%;">
94
+            <template slot="append">吨</template>
95
+          </el-input>
96
+        </el-form-item>
97
+        <el-form-item label="单号" prop="ordNo">
98
+          <el-input v-model="form.ordNo" placeholder="请输入单号" style="width: 100%;" />
99
+        </el-form-item>
100
+        <el-form-item label="备注" prop="remark">
101
+          <el-input v-model="form.remark" type="textarea" placeholder="请输入备注" style="width: 100%;" />
102
+        </el-form-item>
103
+      </el-form>
104
+      <template #footer>
105
+        <div class="dialog-footer">
106
+          <el-button type="success" plain @click="handleSave">保存</el-button>
107
+          <el-button type="danger" plain @click="handleCancelSave">取消</el-button>
108
+        </div>
109
+      </template>
110
+    </el-dialog>
111
+
112
+    <!-- 日志记录对话框 -->
113
+    <el-dialog title="转移数量变动日志" v-model="logDialogVisible" width="900px" :close-on-click-modal="false">
114
+      <!-- 日志查询条件 -->
115
+      <el-form :model="logQuery" label-width="auto" label-position="right">
116
+        <el-row :gutter="10">
117
+          <el-col :span="10">
118
+            <el-form-item label="修改时间" style="margin-bottom: 0px;">
119
+              <el-date-picker
120
+                  v-model="logQuery.dateRange"
121
+                  type="daterange"
122
+                  range-separator="至"
123
+                  start-placeholder="开始日期"
124
+                  end-placeholder="结束日期"
125
+                  value-format="yyyy-MM-dd"
126
+                  style="width:100%;"
127
+                  size="small"
128
+              />
129
+            </el-form-item>
130
+          </el-col>
131
+          <el-col :span="4">
132
+            <el-form-item label="修改类型" style="margin-bottom: 0px;">
133
+              <el-select v-model="logQuery.subStr" placeholder="请选择" clearable style="width:100%;" size="small">
134
+                <el-option label="增加" value="增加" />
135
+                <el-option label="减少" value="减少" />
136
+              </el-select>
137
+            </el-form-item>
138
+          </el-col>
139
+          <el-col :span="4">
140
+            <el-form-item label="修改来源" style="margin-bottom: 0px;">
141
+              <el-select v-model="logQuery.changeFrom" placeholder="请选择" clearable style="width:100%;" size="small">
142
+                <el-option label="手动调整" value="手动调整" />
143
+                <el-option label="货权转移" value="货权转移" />
144
+              </el-select>
145
+            </el-form-item>
146
+          </el-col>
147
+          <el-col :span="3">
148
+            <el-form-item label="" style="margin-bottom: 0px; margin-top: 5px;">
149
+              <el-button type="primary" @click="handleLogSearch">查询</el-button>
150
+            </el-form-item>
151
+          </el-col>
152
+        </el-row>
153
+      </el-form>
154
+
155
+      <!-- 日志表格 -->
156
+      <el-table :data="logTableData" border highlight-current-row v-loading="logLoading">
157
+        <el-table-column type="index" label="序号" align="center" width="60">
158
+          <template #default="scope">
159
+            <span>{{ scope.$index + (logCurrentPage - 1) * logPageSize + 1 }}</span>
160
+          </template>
161
+        </el-table-column>
162
+        <el-table-column prop="modifyTime" label="修改时间" width="180" show-overflow-tooltip>
163
+          <template #default="scope">
164
+            <span>{{ formatDate(scope.row.modifyTime) }}</span>
165
+          </template>
166
+        </el-table-column>
167
+        <el-table-column prop="modifyName" label="修改人员" width="120" show-overflow-tooltip />
168
+        <el-table-column prop="weight" label="修改重量(吨)" width="120" show-overflow-tooltip align="right">
169
+          <template #default="scope">
170
+            <span>{{ scope.row.weight ? scope.row.weight.toFixed(3) : '0.000' }}</span>
171
+          </template>
172
+        </el-table-column>
173
+        <el-table-column prop="subStr" label="修改类型" width="100" show-overflow-tooltip />
174
+        <el-table-column prop="changeFrom" label="修改来源" width="120" show-overflow-tooltip />
175
+        <el-table-column prop="ordNo" label="单号" width="150" show-overflow-tooltip />
176
+        <el-table-column prop="remark" label="备注" show-overflow-tooltip />
177
+      </el-table>
178
+
179
+      <!-- 日志分页 -->
180
+      <div style="margin-top: 15px;">
181
+        <el-pagination :current-page="logCurrentPage" :page-size="logPageSize" :page-sizes="logPageSizes" :total="logTotalRows"
182
+                       background layout="total, sizes, prev, pager, next, jumper"
183
+                       @size-change="handleLogSizeChange"
184
+                       @current-change="handleLogCurrentChange" />
185
+      </div>
186
+    </el-dialog>
187
+  </div>
188
+</template>
189
+
190
+<script>
191
+import axios from '@/axios'
192
+
193
+export default {
194
+  data() {
195
+    return {
196
+      cardBodyStyle: { padding: '10px' },
197
+      // 查询条件
198
+      query: {
199
+        uperCustomerId: '',
200
+        customerId: ''
201
+      },
202
+      // 表格数据
203
+      tableData: [],
204
+      loading: false,
205
+      // 对话框控制
206
+      dialogVisible: false,
207
+      logDialogVisible: false,
208
+      // 客户选项
209
+      optionsCustomer: [],
210
+      // 表单数据
211
+      form: {
212
+        id: '',
213
+        uperCustomerId: '',
214
+        customerId: '',
215
+        subStr: '',
216
+        weight: '',
217
+        ordNo: '',
218
+        remark: ''
219
+      },
220
+      // 分页相关
221
+      currentPage: 1,
222
+      totalRows: 0,
223
+      pageSizes: [10, 20, 50, 100],
224
+      pageSize: 10,
225
+      // 日志查询条件
226
+      logQuery: {
227
+        dateRange: [],
228
+        subStr: '',
229
+        changeFrom: ''
230
+      },
231
+      // 日志表格数据
232
+      logTableData: [],
233
+      logLoading: false,
234
+      // 日志分页相关
235
+      logCurrentPage: 1,
236
+      logTotalRows: 0,
237
+      logPageSizes: [10, 20, 50, 100],
238
+      logPageSize: 10,
239
+      // 当前选中的货权记录(用于日志查询)
240
+      currentCargoRecord: null,
241
+      // 表单验证规则
242
+      rules: {
243
+        uperCustomerId: [
244
+          { required: true, message: '请选择上游客户', trigger: 'change' }
245
+        ],
246
+        customerId: [
247
+          { required: true, message: '请选择客户', trigger: 'change' }
248
+        ],
249
+        subStr: [
250
+          { required: true, message: '请选择修改内容', trigger: 'change' }
251
+        ],
252
+        weight: [
253
+          { required: true, message: '请输入重量', trigger: 'blur' }
254
+        ]
255
+      }
256
+    }
257
+  },
258
+  mounted() {
259
+    this.getTableData()
260
+    this.getAllCustomer()
261
+  },
262
+  methods: {
263
+    // 查询
264
+    handleSearch() {
265
+      this.currentPage = 1
266
+      this.getTableData()
267
+    },
268
+
269
+    // 重置查询条件
270
+    handleReset() {
271
+      this.query = {
272
+        uperCustomerId: '',
273
+        customerId: ''
274
+      }
275
+      this.currentPage = 1
276
+      this.getTableData()
277
+    },
278
+
279
+    // 新增按钮
280
+    handleAdd() {
281
+      this.form = {
282
+        id: '',
283
+        uperCustomerId: '',
284
+        customerId: '',
285
+        subStr: '',
286
+        weight: '',
287
+        ordNo: '',
288
+        remark: ''
289
+      }
290
+      this.dialogVisible = true
291
+      // 清除表单验证
292
+      if (this.$refs.ruleFormRef) {
293
+        this.$refs.ruleFormRef.clearValidate()
294
+      }
295
+    },
296
+
297
+    // 编辑按钮
298
+    handleEdit(row) {
299
+      this.form = {
300
+        id: row.id,
301
+        uperCustomerId: row.uperCustomerId,
302
+        customerId: row.customerId,
303
+        subStr: '',
304
+        weight: '',
305
+        ordNo: '',
306
+        remark: ''
307
+      }
308
+      this.dialogVisible = true
309
+      // 清除表单验证
310
+      if (this.$refs.ruleFormRef) {
311
+        this.$refs.ruleFormRef.clearValidate()
312
+      }
313
+    },
314
+
315
+    // 查看日志
316
+    handleLog(row) {
317
+      this.currentCargoRecord = row
318
+      this.logQuery = {
319
+        dateRange: [],
320
+        subStr: '',
321
+        changeFrom: ''
322
+      }
323
+      this.logCurrentPage = 1
324
+      this.getLogTableData()
325
+      this.logDialogVisible = true
326
+    },
327
+
328
+    // 日志查询
329
+    handleLogSearch() {
330
+      this.logCurrentPage = 1
331
+      this.getLogTableData()
332
+    },
333
+
334
+    // 保存
335
+    handleSave() {
336
+      this.$refs.ruleFormRef.validate((valid) => {
337
+        if (valid) {
338
+          const url = 'sto/Cargo/save'
339
+          const param = {
340
+            json: JSON.stringify(this.form)
341
+          }
342
+          axios.post(url, param).then(response => {
343
+            if (response.data.code == 0) {
344
+              this.$message({
345
+                message: '保存成功',
346
+                type: 'success',
347
+              })
348
+              this.dialogVisible = false
349
+              this.getTableData()
350
+            } else {
351
+              this.$message({
352
+                type: 'error',
353
+                message: '保存失败:' + response.data.msg
354
+              })
355
+            }
356
+          }).catch(error => {
357
+            this.$message({
358
+              type: 'error',
359
+              message: '请求失败:' + error
360
+            })
361
+          })
362
+        } else {
363
+          this.$message({
364
+            type: 'warning',
365
+            message: '请完善表单信息'
366
+          })
367
+          return false
368
+        }
369
+      })
370
+    },
371
+
372
+    // 取消保存
373
+    handleCancelSave() {
374
+      this.dialogVisible = false
375
+    },
376
+
377
+    // 分页大小改变
378
+    handleSizeChange(val) {
379
+      this.pageSize = val
380
+      this.getTableData()
381
+    },
382
+
383
+    // 当前页改变
384
+    handleCurrentChange(val) {
385
+      this.currentPage = val
386
+      this.getTableData()
387
+    },
388
+
389
+    // 日志分页大小改变
390
+    handleLogSizeChange(val) {
391
+      this.logPageSize = val
392
+      this.getLogTableData()
393
+    },
394
+
395
+    // 日志当前页改变
396
+    handleLogCurrentChange(val) {
397
+      this.logCurrentPage = val
398
+      this.getLogTableData()
399
+    },
400
+
401
+    // 格式化日期
402
+    formatDate(dateString) {
403
+      if (!dateString) return ''
404
+      const date = new Date(dateString)
405
+      return date.toLocaleString()
406
+    },
407
+
408
+    // 获取表格数据
409
+    getTableData() {
410
+      this.loading = true
411
+      const url = 'sto/Cargo/query'
412
+      const param = {
413
+        page: this.currentPage,
414
+        rows: this.pageSize,
415
+        uperCustomerId: this.query.uperCustomerId,
416
+        customerId: this.query.customerId
417
+      }
418
+      axios.get(url, param).then(response => {
419
+        if (response.data.code == 0) {
420
+          this.tableData = response.data.data.records || response.data.data.list
421
+          this.totalRows = response.data.data.total
422
+        } else {
423
+          this.$message.error('操作失败!' + response.data.msg)
424
+        }
425
+        this.loading = false
426
+      }).catch(error => {
427
+        this.loading = false
428
+        this.$message.error('请求失败:' + error)
429
+      })
430
+    },
431
+
432
+    // 获取日志表格数据
433
+    getLogTableData() {
434
+      this.logLoading = true
435
+      const url = 'sto/CargoChangeRecord/query'
436
+      const param = {
437
+        page: this.logCurrentPage,
438
+        rows: this.logPageSize,
439
+        uperCustomerId: this.currentCargoRecord ? this.currentCargoRecord.uperCustomerId : '',
440
+        customerId: this.currentCargoRecord ? this.currentCargoRecord.customerId : '',
441
+        startDate: this.logQuery.dateRange && this.logQuery.dateRange[0] ? this.logQuery.dateRange[0] : '',
442
+        endDate: this.logQuery.dateRange && this.logQuery.dateRange[1] ? this.logQuery.dateRange[1] : '',
443
+        subStr: this.logQuery.subStr,
444
+        changeFrom: this.logQuery.changeFrom
445
+      }
446
+      axios.get(url, param).then(response => {
447
+        if (response.data.code == 0) {
448
+          this.logTableData = response.data.data.records || response.data.data.list
449
+          this.logTotalRows = response.data.data.total
450
+        } else {
451
+          this.$message.error('操作失败!' + response.data.msg)
452
+        }
453
+        this.logLoading = false
454
+      }).catch(error => {
455
+        this.logLoading = false
456
+        this.$message.error('请求失败:' + error)
457
+      })
458
+    },
459
+
460
+    // 获取所有客户
461
+    getAllCustomer() {
462
+      const url = 'sto/Customer/query'
463
+      const param = {
464
+        page: 1,
465
+        rows: 1000
466
+      }
467
+      axios.get(url, param).then(response => {
468
+        if (response.data.code == 0) {
469
+          this.optionsCustomer = response.data.data.records || response.data.data.list
470
+        }
471
+      }).catch(error => {
472
+        this.$message.error('获取客户列表失败:' + error)
473
+      })
474
+    }
475
+  }
476
+}
477
+</script>
478
+
479
+<style scoped>
480
+::v-deep .el-dialog__body {
481
+  background-color: #F2F6FC;
482
+}
483
+</style>

Loading…
Cancel
Save