kz-ui-base 1.0.103 → 1.0.104

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -98,3 +98,14 @@ export function salesContractAntiAudit(data) {
98
98
  data: data
99
99
  })
100
100
  }
101
+
102
+
103
+ export function salesOrderDetails(params) {
104
+ return request({
105
+ url: '/sm/salesOrderDetails/selectAllDetailsAndOrderMES',
106
+ method: 'get',
107
+ params
108
+ })
109
+ }
110
+
111
+
@@ -388,3 +388,60 @@ export function isNumberStr(str) {
388
388
  return /^[+-]?(0|([1-9]\d*))(\.\d+)?$/g.test(str)
389
389
  }
390
390
 
391
+ /**
392
+ * el-table 手动勾选数据行的 Checkbox 时触发的事件
393
+ * @param selection
394
+ * @param row
395
+ * @param tableRef
396
+ */
397
+ export function tableHandleSelect(selection, row, tableRef) {
398
+ if (selection.indexOf(row) >= 0) {
399
+ tableRef?.setCurrentRow?.(row)
400
+ }
401
+ }
402
+
403
+ /**
404
+ * el-table 明细复选框选中事件
405
+ * @param val
406
+ * @param multipleChoice
407
+ * @param tableRef
408
+ */
409
+ export function tableOnSelectionChange(val, multipleChoice, tableRef) {
410
+ if (!multipleChoice && val.length > 1) {
411
+ tableRef.clearSelection()
412
+ tableRef.toggleRowSelection(val.pop())
413
+ }
414
+ }
415
+
416
+ /**
417
+ * el-table 行点击事件
418
+ * @param row
419
+ * @param multipleChoice
420
+ * @param tableRef
421
+ * @param multipleSelection
422
+ */
423
+ export function tableRowClick(row, multipleChoice, tableRef, multipleSelection) {
424
+ const findRow = multipleSelection.find((c) => c.rowIndex === row.rowIndex) // 找到选中的行
425
+ if (findRow) {
426
+ tableRef?.toggleRowSelection?.(row, false) // 如过重复选中,则取消选中
427
+ return
428
+ }
429
+ // 如果是单选模式
430
+ if (!multipleChoice && multipleSelection.length > 0) {
431
+ tableRef?.toggleRowSelection?.(multipleSelection[0], false)
432
+ }
433
+ tableRef?.toggleRowSelection?.(row, true) // 实现选中行中选中事件
434
+ }
435
+
436
+ /**
437
+ * 给每一行添加不可枚举属性rowIndex来标识当前行
438
+ * @param row
439
+ * @param rowIndex
440
+ */
441
+ export function tableRowStyle({ row, rowIndex }) {
442
+ Object.defineProperty(row, 'rowIndex', {
443
+ value: rowIndex,
444
+ writable: true,
445
+ enumerable: false
446
+ })
447
+ }
@@ -0,0 +1,286 @@
1
+ <template>
2
+ <base-dialog :visible.sync="visible" width="1200px" title="物料选择" append-to-body @on-confirm="handleConfirm"
3
+ @on-cancel="cancel">
4
+ <div class="app-container">
5
+ <el-container class="item-panel default-background">
6
+ <el-container class="main-info-panel default-background">
7
+ <el-header class="search-panel white">
8
+ <el-form ref="queryForm" :model="searchParams" label-width="120px" size="small">
9
+ <el-row>
10
+ <el-col :span="6">
11
+ <el-form-item label="订单号" prop="salesOrderNo">
12
+ <el-input clearable v-model="searchParams.salesOrderNo" placeholder="请输入订单号"></el-input>
13
+ </el-form-item>
14
+ </el-col>
15
+ </el-row>
16
+
17
+ <div style="float: right; margin-top: 6px">
18
+ <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索
19
+ </el-button>
20
+ <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置
21
+ </el-button>
22
+ </div>
23
+ </el-form>
24
+ </el-header>
25
+ <el-main class="table-panel white" style="height: 50px">
26
+ <el-row style="height: 100%">
27
+ <el-col :span="24" style="height: 100%">
28
+ <el-table ref="multipleTable"
29
+ height="100%"
30
+ :border="true"
31
+ v-loading="tableLoading"
32
+ :data="listData"
33
+ highlight-current-row
34
+ @row-click="clickRow"
35
+ @selection-change="handleSelectionChange"
36
+ @select="handleSelect"
37
+ :row-style="rowStyle"
38
+ :header-cell-style="{ 'text-align': 'center' }">
39
+ <el-table-column type="selection" width="55" align="center">
40
+ </el-table-column>
41
+ <el-table-column type="index" label="序号" width="50" align="center">
42
+ <template scope="scope">
43
+ <span>{{
44
+ (searchParams.page.current - 1) * searchParams.page.size +
45
+ scope.$index +
46
+ 1
47
+ }}</span>
48
+ </template>
49
+ </el-table-column>
50
+ <el-table-column v-for="col in listColumns" :label="col.text" :property="col.property"
51
+ :align="col.align || 'left'" :prop="col.property" v-if="col.visible != false"
52
+ :width="col.width"
53
+ :min-width="col.width || 100" show-overflow-tooltip>
54
+ <template slot-scope="scope">
55
+ {{
56
+ col.dictType
57
+ ? getDictLabelByValue(
58
+ col.dictType,
59
+ scope.row[col.property]
60
+ )
61
+ : scope.row[col.property]
62
+ }}
63
+ </template>
64
+ </el-table-column>
65
+ </el-table>
66
+ </el-col>
67
+ </el-row>
68
+
69
+ </el-main>
70
+ <el-footer class="white">
71
+ <pagination :total="searchParams.total" :page.sync="searchParams.page.current"
72
+ :limit.sync="searchParams.page.size"
73
+ @pagination="getList"/>
74
+ </el-footer>
75
+ </el-container>
76
+ </el-container>
77
+ </div>
78
+ </base-dialog>
79
+ </template>
80
+
81
+ <script lang="ts">
82
+ import {Component, Prop, Vue, Watch} from "vue-property-decorator";
83
+ import {getDictLabelByValue} from "@api/common/common";
84
+ import EntitySelect from "@srcComponents/selector/EntitySelect.vue";
85
+ import {tableHandleSelect, tableOnSelectionChange, tableRowClick, tableRowStyle} from "@utils/index";
86
+ import {salesOrderDetails} from "@srcApi/sm/cm/salesContract";
87
+
88
+
89
+ @Component({
90
+ components: {
91
+ EntitySelect
92
+ },
93
+ })
94
+ export default class SmOrderSelectModal extends Vue {
95
+ @Prop()
96
+ value;
97
+ @Prop()
98
+ searchObj;
99
+ @Prop({default: false})
100
+ multipleChoice;
101
+ //表格是否自动加载数据
102
+ dialogType = 2;
103
+ visible = false;
104
+ listData = [];
105
+ tableLoading = false;
106
+ loadingParams = false;
107
+ // 点击的选中行
108
+ currentEntity = {};
109
+ // 勾选框的勾选行
110
+ currentEntities = [];
111
+ searchParams = {
112
+ salesOrderNo: undefined,
113
+ materialNo: undefined,
114
+ isFinished: true,
115
+ documentStatusCode: '3',
116
+ total: 0,
117
+ page:{
118
+ current: 1,
119
+ size: 20
120
+ }
121
+ };
122
+ listColumns = [
123
+ {text: "销售订单号", property: "salesOrderNo", width: 150},
124
+ {text: "行号", property: "lineNo", width: 60, align: "right"},
125
+ {text: "物料编号", property: "materialNo"},
126
+ {text: "物料名称", property: "materialName"},
127
+ {text: "规格型号", property: "materialSpec"},
128
+ {text: "交付类型", property: "exportFlagLabel"}
129
+ ];
130
+
131
+ handleSelectionChange(val) {
132
+ this.currentEntities = val;
133
+ tableOnSelectionChange(val, this.multipleChoice, this.$refs.multipleTable)
134
+ }
135
+
136
+ /** 手动勾选数据行的 Checkbox 时触发的事件*/
137
+ handleSelect(selection, row) {
138
+ tableHandleSelect(selection, row, this.$refs.multipleTable)
139
+ }
140
+
141
+ rowStyle({row, rowIndex}) {
142
+ tableRowStyle({row, rowIndex})
143
+ }
144
+
145
+ getDictLabelByValue(dictType, value) {
146
+ return getDictLabelByValue(dictType, value);
147
+ }
148
+
149
+ handleQuery() {
150
+ this.getList();
151
+ }
152
+
153
+ getList() {
154
+ this.tableLoading = true;
155
+ if (this.searchObj != null) {
156
+ for (let prop in this.searchObj) {
157
+ this.searchParams[prop] = this.searchObj[prop];
158
+ }
159
+ }
160
+ salesOrderDetails(this.searchParams).then((res)=>{
161
+ this.listData = (res as any).records;
162
+ this.listData.forEach((item)=>{
163
+ item.exportFlagLabel = item.exportFlag == '0' ? "国内" : "国外";
164
+ })
165
+ this.searchParams.total = (res as any).total;
166
+ }).finally(()=>{
167
+ this.tableLoading = false;
168
+ })
169
+ }
170
+
171
+ handleConfirm() {
172
+ if (this.multipleChoice) {
173
+ (this as any).$closeDialog(true, this.currentEntities);
174
+ } else {
175
+ let res = this.currentEntities?.[0];
176
+ //国内外字段关系映射
177
+ if(res != null && res.exportFlag != null){
178
+ res.deliveryTypeCode = (res.exportFlag == "1" || res.exportFlag == 1 )? "2" : "1"
179
+ }
180
+ (this as any).$closeDialog(true, res);
181
+ }
182
+ }
183
+
184
+ resetQuery(){
185
+ this.$set(this.searchParams,'salesOrderNo', null);
186
+ }
187
+
188
+ clickRow(row) {
189
+ this.$set(this, 'currentEntity', row);
190
+ // this.$set(this,'currentEntities', [row]);
191
+ tableRowClick(row, this.multipleChoice, this.$refs.multipleTable, this.currentEntities)
192
+ }
193
+
194
+ cancel() {
195
+ (this as any).$closeDialog();
196
+ }
197
+
198
+ created() {
199
+ this.getList();
200
+ }
201
+ }
202
+ </script>
203
+
204
+ <style lang="scss" scoped>
205
+ .app-container {
206
+ height: 100%;
207
+ padding: 10px;
208
+ display: flex;
209
+ width: 100%;
210
+ }
211
+
212
+ .search-panel {
213
+ background-color: white;
214
+ height: unset !important;
215
+ padding: 20px 10px 10px;
216
+ }
217
+
218
+ .tree-panel {
219
+ width: 15% !important;
220
+ min-width: 210px;
221
+ padding: 20px 5px 20px 5px;
222
+ }
223
+
224
+ .item-panel {
225
+ height: 100%;
226
+ }
227
+
228
+ .item-panel > * {
229
+ margin: 5px;
230
+ }
231
+
232
+ .white {
233
+ background-color: #ffffff;
234
+ }
235
+
236
+ .main-info-panel {
237
+ }
238
+
239
+ .table-panel {
240
+ margin: 5px 0 0 0;
241
+ padding-bottom: 0px;
242
+ }
243
+
244
+ .default-background {
245
+ background-color: #f1f2f5;
246
+ }
247
+
248
+ .tree-scroll {
249
+ width: 100%;
250
+ overflow: auto;
251
+ }
252
+
253
+ .el-container__header {
254
+ margin-bottom: 10px;
255
+ }
256
+
257
+ .el-form-item--small.el-form-item {
258
+ margin-bottom: 12px;
259
+ }
260
+
261
+ ::v-deep .custom-dialog {
262
+ height: 700px;
263
+ }
264
+
265
+ ::-webkit-scrollbar {
266
+ width: 8px;
267
+ height: 8px;
268
+ }
269
+
270
+ /* 设置滚动条轨道的背景色 */
271
+ ::-webkit-scrollbar-track {
272
+ background-color: #f5f5f5;
273
+ border-radius: 8px;
274
+ }
275
+
276
+ /* 设置滚动条滑块的背景色和圆角 */
277
+ ::-webkit-scrollbar-thumb {
278
+ background-color: #c5c5c5;
279
+ border-radius: 8px;
280
+ }
281
+
282
+ /* 设置滚动条滑块在hover状态下的背景色 */
283
+ ::-webkit-scrollbar-thumb:hover {
284
+ background-color: #a5a5a5;
285
+ }
286
+ </style>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kz-ui-base",
3
- "version": "1.0.103",
3
+ "version": "1.0.104",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {