Commit bd32955e10941a2d26f15a6d88921350c9a1f530
1 parent
72876144
盘点代码提交
Showing
13 changed files
with
833 additions
and
56 deletions
ant-design-vue-jeecg/src/api/api.js
... | ... | @@ -155,6 +155,8 @@ export const createCheckOutTask = (params) => postAction('/task/taskHeader/creat |
155 | 155 | export const selectPort = (params) => postAction('/task/taskHeader/selectPort', params); |
156 | 156 | //创建跨站任务 |
157 | 157 | export const createOverStationTask = (params) => postAction('/task/taskHeader/createOverStationTask', params); |
158 | +//盘点任务生成 | |
159 | +export const stockTakeTask = (params) => postAction('/cycleCountDetail/cycleCountDetail/stockTakeTask?ids='+params, params); | |
158 | 160 | //创建空托盘组入库任务 |
159 | 161 | export const createManyEmptyIn = (params) => postAction('/task/taskHeader/createManyEmptyIn', params); |
160 | 162 | //创建空托盘组出库任务 |
... | ... |
ant-design-vue-jeecg/src/components/jeecg/index.js
... | ... | @@ -30,6 +30,7 @@ import JEasyCron from '@/components/jeecg/JEasyCron' |
30 | 30 | //jeecgbiz |
31 | 31 | import JSelectDepart from '../jeecgbiz/JSelectDepart.vue' |
32 | 32 | import JSelectMultiUser from '../jeecgbiz/JSelectMultiUser.vue' |
33 | +import JSelectMultiCycleCount from '../jeecgbiz/JSelectMultiCycleCount.vue' | |
33 | 34 | import JSelectPosition from '../jeecgbiz/JSelectPosition.vue' |
34 | 35 | import JSelectRole from '../jeecgbiz/JSelectRole.vue' |
35 | 36 | import JSelectUserByDep from '../jeecgbiz/JSelectUserByDep.vue' |
... | ... | @@ -74,6 +75,7 @@ export default { |
74 | 75 | //jeecgbiz |
75 | 76 | Vue.component('JSelectDepart', JSelectDepart) |
76 | 77 | Vue.component('JSelectMultiUser', JSelectMultiUser) |
78 | + Vue.component('JSelectMultiCycleCount', JSelectMultiCycleCount) | |
77 | 79 | Vue.component('JSelectPosition', JSelectPosition) |
78 | 80 | Vue.component('JSelectRole', JSelectRole) |
79 | 81 | Vue.component('JSelectUserByDep', JSelectUserByDep) |
... | ... |
ant-design-vue-jeecg/src/components/jeecgbiz/JButtonBizComponent/JSelectBizComponentModal.vue
0 → 100644
1 | +<template> | |
2 | + <j-modal | |
3 | + centered | |
4 | + :title="name + '选择'" | |
5 | + :width="width" | |
6 | + :visible="visible" | |
7 | + switchFullscreen | |
8 | + @ok="handleOk" | |
9 | + @cancel="close" | |
10 | + cancelText="关闭"> | |
11 | + | |
12 | + <a-row :gutter="18"> | |
13 | + <a-col :span="16"> | |
14 | + <!-- 查询区域 --> | |
15 | + <a-form layout="inline" class="j-inline-form"> | |
16 | + <!-- 固定条件 --> | |
17 | + <a-form-item :label="(queryParamText||name)"> | |
18 | + <a-input v-model="queryParam[queryParamCode||valueKey]" :placeholder="'请输入' + (queryParamText||name)" | |
19 | + @pressEnter="searchQuery"/> | |
20 | + </a-form-item> | |
21 | + <!-- 动态生成的查询条件 --> | |
22 | + <j-select-biz-query-item v-if="queryConfig.length>0" v-show="showMoreQueryItems" :queryParam="queryParam" | |
23 | + :queryConfig="queryConfig" @pressEnter="searchQuery"/> | |
24 | + <!-- 按钮 --> | |
25 | + <a-button type="primary" @click="searchQuery" icon="search">查询</a-button> | |
26 | + <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button> | |
27 | + <a v-if="queryConfig.length>0" @click="showMoreQueryItems=!showMoreQueryItems" style="margin-left: 8px"> | |
28 | + {{ showMoreQueryItems ? '收起' : '展开' }} | |
29 | + <a-icon :type="showMoreQueryItems ? 'up' : 'down'"/> | |
30 | + </a> | |
31 | + </a-form> | |
32 | + | |
33 | + <a-table | |
34 | + size="middle" | |
35 | + bordered | |
36 | + :rowKey="rowKey" | |
37 | + :columns="innerColumns" | |
38 | + :dataSource="dataSource" | |
39 | + :pagination="ipagination" | |
40 | + :loading="loading" | |
41 | + :scroll="{ y: 240 }" | |
42 | + :rowSelection="{selectedRowKeys, onChange: onSelectChange, type: multiple ? 'checkbox':'radio'}" | |
43 | + :customRow="customRowFn" | |
44 | + @change="handleTableChange"> | |
45 | + </a-table> | |
46 | + | |
47 | + </a-col> | |
48 | + <a-col :span="8"> | |
49 | + <a-card :title="'已选' + name" :bordered="false" :head-style="{padding:0}" :body-style="{padding:0}"> | |
50 | + | |
51 | + <a-table size="middle" :rowKey="rowKey" bordered v-bind="selectedTable"> | |
52 | + <span slot="action" slot-scope="text, record, index"> | |
53 | + <a @click="handleDeleteSelected(record, index)">删除</a> | |
54 | + </span> | |
55 | + </a-table> | |
56 | + | |
57 | + </a-card> | |
58 | + </a-col> | |
59 | + </a-row> | |
60 | + </j-modal> | |
61 | +</template> | |
62 | + | |
63 | +<script> | |
64 | +import {getAction} from '@/api/manage' | |
65 | +import Ellipsis from '@/components/Ellipsis' | |
66 | +import {JeecgListMixin} from '@/mixins/JeecgListMixin' | |
67 | +import {pushIfNotExist} from '@/utils/util' | |
68 | +import JSelectBizQueryItem from './JSelectBizQueryItem' | |
69 | +import {cloneDeep} from 'lodash' | |
70 | +import {stockTakeTask} from "../../../api/api"; | |
71 | + | |
72 | +export default { | |
73 | + name: 'JSelectBizComponentModal', | |
74 | + mixins: [JeecgListMixin], | |
75 | + components: {Ellipsis, JSelectBizQueryItem}, | |
76 | + props: { | |
77 | + value: { | |
78 | + type: Array, | |
79 | + default: () => [] | |
80 | + }, | |
81 | + visible: { | |
82 | + type: Boolean, | |
83 | + default: false | |
84 | + }, | |
85 | + valueKey: { | |
86 | + type: String, | |
87 | + required: true | |
88 | + }, | |
89 | + multiple: { | |
90 | + type: Boolean, | |
91 | + default: true | |
92 | + }, | |
93 | + width: { | |
94 | + type: Number, | |
95 | + default: 900 | |
96 | + }, | |
97 | + | |
98 | + name: { | |
99 | + type: String, | |
100 | + default: '' | |
101 | + }, | |
102 | + listUrl: { | |
103 | + type: String, | |
104 | + required: true, | |
105 | + default: '' | |
106 | + }, | |
107 | + // 根据 value 获取显示文本的地址,例如存的是 username,可以通过该地址获取到 realname | |
108 | + valueUrl: { | |
109 | + type: String, | |
110 | + default: '' | |
111 | + }, | |
112 | + displayKey: { | |
113 | + type: String, | |
114 | + default: null | |
115 | + }, | |
116 | + columns: { | |
117 | + type: Array, | |
118 | + required: true, | |
119 | + default: () => [] | |
120 | + }, | |
121 | + // 查询条件Code | |
122 | + queryParamCode: { | |
123 | + type: String, | |
124 | + default: null | |
125 | + }, | |
126 | + // 查询条件文字 | |
127 | + queryParamText: { | |
128 | + type: String, | |
129 | + default: null | |
130 | + }, | |
131 | + // 查询配置 | |
132 | + queryConfig: { | |
133 | + type: Array, | |
134 | + default: () => [] | |
135 | + }, | |
136 | + rowKey: { | |
137 | + type: String, | |
138 | + default: 'id' | |
139 | + }, | |
140 | + // 过长裁剪长度,设置为 -1 代表不裁剪 | |
141 | + ellipsisLength: { | |
142 | + type: Number, | |
143 | + default: 12 | |
144 | + }, | |
145 | + }, | |
146 | + data() { | |
147 | + return { | |
148 | + innerValue: [], | |
149 | + // 已选择列表 | |
150 | + selectedTable: { | |
151 | + pagination: false, | |
152 | + scroll: {y: 240}, | |
153 | + columns: [ | |
154 | + { | |
155 | + ...this.columns[0], | |
156 | + width: this.columns[0].widthRight || this.columns[0].width, | |
157 | + }, | |
158 | + {title: '操作', dataIndex: 'action', align: 'center', width: 60, scopedSlots: {customRender: 'action'},} | |
159 | + ], | |
160 | + dataSource: [], | |
161 | + }, | |
162 | + renderEllipsis: (value) => (<ellipsis length={this.ellipsisLength}>{value}</ellipsis>), | |
163 | + url: {list: this.listUrl}, | |
164 | + /* 分页参数 */ | |
165 | + ipagination: { | |
166 | + current: 1, | |
167 | + pageSize: 5, | |
168 | + pageSizeOptions: ['5', '10', '20', '30'], | |
169 | + showTotal: (total, range) => { | |
170 | + return range[0] + '-' + range[1] + ' 共' + total + '条' | |
171 | + }, | |
172 | + showQuickJumper: true, | |
173 | + showSizeChanger: true, | |
174 | + total: 0 | |
175 | + }, | |
176 | + options: [], | |
177 | + dataSourceMap: {}, | |
178 | + showMoreQueryItems: false, | |
179 | + } | |
180 | + }, | |
181 | + computed: { | |
182 | + // 表头 | |
183 | + innerColumns() { | |
184 | + let columns = cloneDeep(this.columns) | |
185 | + columns.forEach(column => { | |
186 | + // 给所有的列加上过长裁剪 | |
187 | + if (this.ellipsisLength !== -1) { | |
188 | + // JSelectBizComponent columns 建议开放customRender等方法类配置 | |
189 | + // https://github.com/jeecgboot/jeecg-boot/issues/3203 | |
190 | + let myCustomRender = column.customRender | |
191 | + column.customRender = (text, record, index) => { | |
192 | + let value = text | |
193 | + if (typeof myCustomRender === 'function') { | |
194 | + // noinspection JSVoidFunctionReturnValueUsed | |
195 | + value = myCustomRender(text, record, index) | |
196 | + } | |
197 | + if (typeof value === 'string') { | |
198 | + return this.renderEllipsis(value) | |
199 | + } | |
200 | + return value | |
201 | + } | |
202 | + } | |
203 | + }) | |
204 | + return columns | |
205 | + }, | |
206 | + }, | |
207 | + watch: { | |
208 | + value: { | |
209 | + deep: true, | |
210 | + immediate: true, | |
211 | + handler(val) { | |
212 | + this.innerValue = cloneDeep(val) | |
213 | + this.selectedRowKeys = [] | |
214 | + this.valueWatchHandler(val) | |
215 | + this.queryOptionsByValue(val) | |
216 | + } | |
217 | + }, | |
218 | + dataSource: { | |
219 | + deep: true, | |
220 | + handler(val) { | |
221 | + this.emitOptions(val) | |
222 | + this.valueWatchHandler(this.innerValue) | |
223 | + } | |
224 | + }, | |
225 | + selectedRowKeys: { | |
226 | + immediate: true, | |
227 | + deep: true, | |
228 | + handler(val) { | |
229 | + //update--begin--autor:scott-----date:20200927------for:选取职务名称出现全选 #1753----- | |
230 | + if (this.innerValue) { | |
231 | + this.innerValue.length = 0; | |
232 | + } | |
233 | + //update--end--autor:scott-----date:20200927------for:选取职务名称出现全选 #1753----- | |
234 | + this.selectedTable.dataSource = val.map(key => { | |
235 | + for (let data of this.dataSource) { | |
236 | + if (data[this.rowKey] === key) { | |
237 | + pushIfNotExist(this.innerValue, data[this.valueKey]) | |
238 | + return data | |
239 | + } | |
240 | + } | |
241 | + for (let data of this.selectedTable.dataSource) { | |
242 | + if (data[this.rowKey] === key) { | |
243 | + pushIfNotExist(this.innerValue, data[this.valueKey]) | |
244 | + return data | |
245 | + } | |
246 | + } | |
247 | + console.warn('未找到选择的行信息,key:' + key) | |
248 | + return {} | |
249 | + }) | |
250 | + }, | |
251 | + } | |
252 | + }, | |
253 | + | |
254 | + methods: { | |
255 | + | |
256 | + /** 关闭弹窗 */ | |
257 | + close() { | |
258 | + this.$emit('update:visible', false) | |
259 | + }, | |
260 | + | |
261 | + valueWatchHandler(val) { | |
262 | + val.forEach(item => { | |
263 | + this.dataSource.concat(this.selectedTable.dataSource).forEach(data => { | |
264 | + if (data[this.valueKey] === item) { | |
265 | + pushIfNotExist(this.selectedRowKeys, data[this.rowKey]) | |
266 | + } | |
267 | + }) | |
268 | + }) | |
269 | + }, | |
270 | + | |
271 | + queryOptionsByValue(value) { | |
272 | + if (!value || value.length === 0) { | |
273 | + return | |
274 | + } | |
275 | + // 判断options是否存在value,如果已存在数据就不再请求后台了 | |
276 | + let notExist = false | |
277 | + for (let val of value) { | |
278 | + let find = false | |
279 | + for (let option of this.options) { | |
280 | + if (val === option.value) { | |
281 | + find = true | |
282 | + break | |
283 | + } | |
284 | + } | |
285 | + if (!find) { | |
286 | + notExist = true | |
287 | + break | |
288 | + } | |
289 | + } | |
290 | + if (!notExist) return | |
291 | + getAction(this.valueUrl || this.listUrl, { | |
292 | + // 这里最后加一个 , 的原因是因为无论如何都要使用 in 查询,防止后台进行了模糊匹配,导致查询结果不准确 | |
293 | + [this.valueKey]: value.join(',') + ',', | |
294 | + pageNo: 1, | |
295 | + pageSize: value.length | |
296 | + }).then((res) => { | |
297 | + if (res.success) { | |
298 | + let dataSource = res.result | |
299 | + if (!(dataSource instanceof Array)) { | |
300 | + dataSource = res.result.records | |
301 | + } | |
302 | + this.emitOptions(dataSource, (data) => { | |
303 | + pushIfNotExist(this.innerValue, data[this.valueKey]) | |
304 | + pushIfNotExist(this.selectedRowKeys, data[this.rowKey]) | |
305 | + pushIfNotExist(this.selectedTable.dataSource, data, this.rowKey) | |
306 | + }) | |
307 | + } | |
308 | + }) | |
309 | + }, | |
310 | + | |
311 | + emitOptions(dataSource, callback) { | |
312 | + dataSource.forEach(data => { | |
313 | + let key = data[this.valueKey] | |
314 | + this.dataSourceMap[key] = data | |
315 | + pushIfNotExist(this.options, {label: data[this.displayKey || this.valueKey], value: key}, 'value') | |
316 | + typeof callback === 'function' ? callback(data) : '' | |
317 | + }) | |
318 | + this.$emit('options', this.options, this.dataSourceMap) | |
319 | + }, | |
320 | + | |
321 | + /** 完成选择 */ | |
322 | + handleOk() { | |
323 | + let value = this.selectedTable.dataSource.map(data => data[this.valueKey]) | |
324 | + // this.$emit('input', value) | |
325 | + | |
326 | + if (value.length>=1) | |
327 | + { | |
328 | + stockTakeTask(value).then((res) => { | |
329 | + if (res.success) { | |
330 | + that.$message.success(res.message); | |
331 | + that.$emit('ok'); | |
332 | + that.model.containerCode = ''; | |
333 | + that.model.toPortCode = ''; | |
334 | + } else { | |
335 | + that.$message.warning(res.message); | |
336 | + } | |
337 | + }).finally(() => { | |
338 | + that.confirmLoading = false; | |
339 | + that.close(); | |
340 | + }) | |
341 | + }else | |
342 | + { | |
343 | + alert("至少选择一项") | |
344 | + } | |
345 | + | |
346 | + // | |
347 | + // this.close() | |
348 | + }, | |
349 | + /** 删除已选择的 */ | |
350 | + handleDeleteSelected(record, index) { | |
351 | + this.selectedRowKeys.splice(this.selectedRowKeys.indexOf(record[this.rowKey]), 1) | |
352 | + //update--begin--autor:wangshuai-----date:20200722------for:JSelectBizComponent组件切换页数值问题------ | |
353 | + this.selectedTable.dataSource.splice(this.selectedTable.dataSource.indexOf(record), 1) | |
354 | + this.innerValue.splice(this.innerValue.indexOf(record[this.valueKey]), 1) | |
355 | + console.log("this.selectedRowKeys:", this.selectedRowKeys) | |
356 | + console.log("this.selectedTable.dataSource:", this.selectedTable.dataSource) | |
357 | + //update--begin--autor:wangshuai-----date:20200722------for:JSelectBizComponent组件切换页数值问题------ | |
358 | + }, | |
359 | + | |
360 | + customRowFn(record) { | |
361 | + return { | |
362 | + on: { | |
363 | + click: () => { | |
364 | + let key = record[this.rowKey] | |
365 | + if (!this.multiple) { | |
366 | + this.selectedRowKeys = [key] | |
367 | + this.selectedTable.dataSource = [record] | |
368 | + } else { | |
369 | + let index = this.selectedRowKeys.indexOf(key) | |
370 | + if (index === -1) { | |
371 | + this.selectedRowKeys.push(key) | |
372 | + this.selectedTable.dataSource.push(record) | |
373 | + } else { | |
374 | + this.handleDeleteSelected(record, index) | |
375 | + } | |
376 | + } | |
377 | + } | |
378 | + } | |
379 | + } | |
380 | + }, | |
381 | + | |
382 | + } | |
383 | +} | |
384 | +</script> | |
385 | +<style lang="less" scoped> | |
386 | +.full-form-item { | |
387 | + display: flex; | |
388 | + margin-right: 0; | |
389 | + | |
390 | + /deep/ .ant-form-item-control-wrapper { | |
391 | + flex: 1 1; | |
392 | + display: inline-block; | |
393 | + } | |
394 | +} | |
395 | + | |
396 | +.j-inline-form { | |
397 | + /deep/ .ant-form-item { | |
398 | + margin-bottom: 12px; | |
399 | + } | |
400 | + | |
401 | + /deep/ .ant-form-item-label { | |
402 | + line-height: 32px; | |
403 | + width: auto; | |
404 | + } | |
405 | + | |
406 | + /deep/ .ant-form-item-control { | |
407 | + height: 32px; | |
408 | + line-height: 32px; | |
409 | + } | |
410 | +} | |
411 | +</style> | |
0 | 412 | \ No newline at end of file |
... | ... |
ant-design-vue-jeecg/src/components/jeecgbiz/JButtonBizComponent/JSelectBizQueryItem.js
0 → 100644
1 | +export default { | |
2 | + name: 'JSelectBizQueryItem', | |
3 | + props: { | |
4 | + queryParam: Object, | |
5 | + queryConfig: Array, | |
6 | + }, | |
7 | + data() { | |
8 | + return {} | |
9 | + }, | |
10 | + methods: { | |
11 | + renderQueryItem() { | |
12 | + return this.queryConfig.map(queryItem => { | |
13 | + const {key, label, placeholder, dictCode, props, customRender} = queryItem | |
14 | + const options = { | |
15 | + props: {}, | |
16 | + on: { | |
17 | + pressEnter: () => this.$emit('pressEnter'), | |
18 | + } | |
19 | + } | |
20 | + if (props != null) { | |
21 | + Object.assign(options.props, props) | |
22 | + } | |
23 | + if (placeholder === undefined) { | |
24 | + if (dictCode) { | |
25 | + options.props['placeholder'] = `请选择${label}` | |
26 | + } else { | |
27 | + options.props['placeholder'] = `请输入${label}` | |
28 | + } | |
29 | + } else { | |
30 | + options.props['placeholder'] = placeholder | |
31 | + } | |
32 | + | |
33 | + let input | |
34 | + if (typeof customRender === 'function') { | |
35 | + input = customRender.call(this, {key, options, queryParam: this.queryParam}) | |
36 | + } else if (dictCode) { | |
37 | + input = | |
38 | + <j-dict-select-tag {...options} vModel={this.queryParam[key]} dictCode={dictCode} style="width:180px;"/> | |
39 | + } else { | |
40 | + input = <a-input {...options} vModel={this.queryParam[key]}/> | |
41 | + } | |
42 | + return <a-form-item key={key} label={label}>{input}</a-form-item> | |
43 | + }) | |
44 | + }, | |
45 | + }, | |
46 | + render() { | |
47 | + return <span>{this.renderQueryItem()}</span> | |
48 | + }, | |
49 | +} | |
0 | 50 | \ No newline at end of file |
... | ... |
ant-design-vue-jeecg/src/components/jeecgbiz/JButtonBizComponent/README.md
0 → 100644
1 | +# JSelectBizComponent | |
2 | + | |
3 | +Jeecg 选择组件的公共可复用组件 | |
4 | + | |
5 | +## 引用方式 | |
6 | + | |
7 | +```js | |
8 | +import JSelectBizComponent from '@/src/components/jeecgbiz/JSelectBizComponent' | |
9 | + | |
10 | +export default { | |
11 | + components: { JSelectBizComponent } | |
12 | +} | |
13 | +``` | |
14 | + | |
15 | +## 参数 | |
16 | + | |
17 | +### 配置参数 | |
18 | + | |
19 | +| 参数名 | 类型 | 必填 | 默认值 | 备注 | | |
20 | +|-----------------------|---------|------|--------------|--------------------------------------------------------------------------------------| | |
21 | +| rowKey | String | | "id" | 唯一标识的字段名 | | |
22 | +| value(v-model) | String | | "" | 默认选择的数据,多个用半角逗号分割 | | |
23 | +| name | String | | "" | 显示名字,例如选择用户就填写"用户" | | |
24 | +| listUrl | String | 是 | | 数据请求地址,必须是封装了分页的地址 | | |
25 | +| valueUrl | String | | "" | 获取显示文本的地址,例如存的是 username,可以通过该地址获取到 realname | | |
26 | +| displayKey | String | | null | 显示在标签上的字段 key ,不传则直接显示数据 | | |
27 | +| returnKeys | Array | | ['id', 'id'] | v-model 绑定的 keys,是个数组,默认使用第二项,当配置了 `returnId=true` 就返回第一项 | | |
28 | +| returnId | Boolean | | false | 返回ID,设为true后将返回配置的 `returnKeys` 中的第一项 | | |
29 | +| selectButtonText | String | | "选择" | 选择按钮的文字 | | |
30 | +| queryParamText | String | | null | 查询条件显示文字,不传则使用 `name` | | |
31 | +| columns | Array | 是 | | 列配置项,与antd的table的配置完全一致。列的第一项会被配置成右侧已选择的列表上 | | |
32 | +| columns[0].widthRight | String | | null | 仅列的第一项可以应用此配置,表示右侧已选择列表的宽度,建议 `70%`,不传则应用`width` | | |
33 | +| placeholder | String | | "请选择" | 占位符 | | |
34 | +| disabled | Boolean | | false | 是否禁用 | | |
35 | +| multiple | Boolean | | false | 是否可多选 | | |
36 | +| buttons | Boolean | | true | 是否显示"选择"按钮,如果不显示,可以直接点击文本框打开选择界面 | | |
... | ... |
ant-design-vue-jeecg/src/components/jeecgbiz/JButtonBizComponent/index.vue
0 → 100644
1 | +<template> | |
2 | + <a class="j-select-biz-component-box" type="flex" :gutter="8"> | |
3 | + <a-button type="primary" icon="plus" :disabled="disabled" @click="visible=true">{{ selectButtonText }} | |
4 | + </a-button> | |
5 | + <j-select-biz-component-modal | |
6 | + v-model="selectValue" | |
7 | + :visible.sync="visible" | |
8 | + v-bind="modalProps" | |
9 | + @options="handleOptions" | |
10 | + /> | |
11 | + </a> | |
12 | +</template> | |
13 | + | |
14 | +<script> | |
15 | +import JSelectBizComponentModal from './JSelectBizComponentModal' | |
16 | + | |
17 | +export default { | |
18 | + name: 'JSelectBizComponent', | |
19 | + components: {JSelectBizComponentModal}, | |
20 | + props: { | |
21 | + value: { | |
22 | + type: String, | |
23 | + default: '' | |
24 | + }, | |
25 | + /** 是否返回 id,默认 false,返回 code */ | |
26 | + returnId: { | |
27 | + type: Boolean, | |
28 | + default: false | |
29 | + }, | |
30 | + | |
31 | + disabled: { | |
32 | + type: Boolean, | |
33 | + default: false | |
34 | + }, | |
35 | + // 是否支持多选,默认 true | |
36 | + multiple: { | |
37 | + type: Boolean, | |
38 | + default: true | |
39 | + }, | |
40 | + // 是否显示按钮,默认 true | |
41 | + buttons: { | |
42 | + type: Boolean, | |
43 | + default: true | |
44 | + }, | |
45 | + // 显示的 Key | |
46 | + displayKey: { | |
47 | + type: String, | |
48 | + default: null | |
49 | + }, | |
50 | + // 返回的 key | |
51 | + returnKeys: { | |
52 | + type: Array, | |
53 | + default: () => ['id', 'id'] | |
54 | + }, | |
55 | + // 选择按钮文字 | |
56 | + selectButtonText: { | |
57 | + type: String, | |
58 | + default: '新增' | |
59 | + }, | |
60 | + | |
61 | + }, | |
62 | + data() { | |
63 | + return { | |
64 | + selectValue: [], | |
65 | + selectOptions: [], | |
66 | + dataSourceMap: {}, | |
67 | + visible: false, | |
68 | + selectOpen: false, | |
69 | + } | |
70 | + }, | |
71 | + computed: { | |
72 | + valueKey() { | |
73 | + return this.returnId ? this.returnKeys[0] : this.returnKeys[1] | |
74 | + }, | |
75 | + modalProps() { | |
76 | + return Object.assign({ | |
77 | + valueKey: this.valueKey, | |
78 | + multiple: this.multiple, | |
79 | + returnKeys: this.returnKeys, | |
80 | + displayKey: this.displayKey || this.valueKey | |
81 | + }, this.$attrs) | |
82 | + }, | |
83 | + }, | |
84 | + watch: { | |
85 | + value: { | |
86 | + immediate: true, | |
87 | + handler(val) { | |
88 | + if (val) { | |
89 | + this.selectValue = val.split(',') | |
90 | + } else { | |
91 | + this.selectValue = [] | |
92 | + } | |
93 | + } | |
94 | + }, | |
95 | + selectValue: { | |
96 | + deep: true, | |
97 | + handler(val) { | |
98 | + let rows = val.map(key => this.dataSourceMap[key]) | |
99 | + let data = val.join(',') | |
100 | + if (data !== this.value) { | |
101 | + this.$emit('select', rows) | |
102 | + this.$emit('input', data) | |
103 | + this.$emit('change', data) | |
104 | + } | |
105 | + } | |
106 | + } | |
107 | + }, | |
108 | + methods: { | |
109 | + handleOptions(options, dataSourceMap) { | |
110 | + this.selectOptions = options | |
111 | + this.dataSourceMap = dataSourceMap | |
112 | + }, | |
113 | + handleDropdownVisibleChange() { | |
114 | + // 解决antdv自己的bug —— open 设置为 false 了,点击后还是添加了 open 样式,导致点击事件失效 | |
115 | + this.selectOpen = true | |
116 | + this.$nextTick(() => { | |
117 | + this.selectOpen = false | |
118 | + }) | |
119 | + }, | |
120 | + } | |
121 | +} | |
122 | +</script> | |
123 | + | |
124 | +<style lang="less" scoped> | |
125 | +.j-select-biz-component-box { | |
126 | + | |
127 | + @width: 82px; | |
128 | + | |
129 | + .left { | |
130 | + width: calc(100% - @width - 8px); | |
131 | + } | |
132 | + | |
133 | + .right { | |
134 | + width: @width; | |
135 | + } | |
136 | + | |
137 | + .full { | |
138 | + width: 100%; | |
139 | + } | |
140 | + | |
141 | + /deep/ .ant-select-search__field { | |
142 | + display: none !important; | |
143 | + } | |
144 | +} | |
145 | +</style> | |
0 | 146 | \ No newline at end of file |
... | ... |
ant-design-vue-jeecg/src/components/jeecgbiz/JSelectMultiCycleCount.vue
0 → 100644
1 | +<template> | |
2 | + <!-- 定义在这里的参数都是不可在外部覆盖的,防止出现问题 --> | |
3 | + <j-select-biz-component | |
4 | + :value="value" | |
5 | + :ellipsisLength="25" | |
6 | + :listUrl="url.list" | |
7 | + :columns="columns" | |
8 | + v-on="$listeners" | |
9 | + v-bind="attrs" | |
10 | + /> | |
11 | +</template> | |
12 | + | |
13 | +<script> | |
14 | +import JDate from '@comp/jeecg/JDate' | |
15 | +import JSelectBizComponent from './JButtonBizComponent' | |
16 | + | |
17 | +export default { | |
18 | + name: 'JSelectMultiCycleCount', | |
19 | + components: {JDate, JSelectBizComponent}, | |
20 | + props: { | |
21 | + value: null, // any type | |
22 | + queryConfig: { | |
23 | + type: Array, | |
24 | + default: () => [] | |
25 | + }, | |
26 | + }, | |
27 | + data() { | |
28 | + return { | |
29 | + url: {list: '/inventory/inventoryHeader/list'}, | |
30 | + columns: [ | |
31 | + {title: '容器号', align: 'center', width: '25%',widthRight: '70%', dataIndex: 'containerCode'}, | |
32 | + {title: '容器状态', align: 'center', width: '20%', dataIndex: 'containerStatus'}, | |
33 | + {title: '库位号', align: 'center', width: '20%', dataIndex: 'locationCode'}, | |
34 | + {title: '总数量', align: 'center', width: '20%', dataIndex: 'totalQty'}, | |
35 | + {title: '库区', align: 'center', width: '20%', widthRight: '70%', dataIndex: 'zoneCode'}, | |
36 | + {title: '状态', align: 'center', width: '20%', dataIndex: 'enable'}, | |
37 | + {title: 'ID', align: 'center', width: '20%', dataIndex: 'id'}, | |
38 | + ], | |
39 | + // 定义在这里的参数都是可以在外部传递覆盖的,可以更灵活的定制化使用的组件 | |
40 | + default: { | |
41 | + name: '库存', | |
42 | + width: 1200, | |
43 | + displayKey: 'id', | |
44 | + returnKeys: ['id','id'], | |
45 | + queryParamText: 'ID', | |
46 | + }, | |
47 | + // 多条件查询配置queryConfigDefault | |
48 | + queryConfigDefault: [ | |
49 | + // { | |
50 | + // key: 'containerCode', | |
51 | + // label: '容器号', | |
52 | + // // 如果包含 dictCode,那么就会显示成下拉框 | |
53 | + // dictCode: 'sex', | |
54 | + // }, | |
55 | + ], | |
56 | + } | |
57 | + }, | |
58 | + computed: { | |
59 | + attrs() { | |
60 | + return Object.assign(this.default, this.$attrs, { | |
61 | + queryConfig: this.queryConfigDefault.concat(this.queryConfig) | |
62 | + }) | |
63 | + } | |
64 | + } | |
65 | +} | |
66 | +</script> | |
67 | + | |
68 | +<style lang="less" scoped></style> | |
0 | 69 | \ No newline at end of file |
... | ... |
ant-design-vue-jeecg/src/views/system/stocktaking/CycleCountDetailList.vue
... | ... | @@ -12,7 +12,7 @@ |
12 | 12 | |
13 | 13 | <!-- 操作按钮区域 begin --> |
14 | 14 | <div class="table-operator"> |
15 | - <a-button type="primary" icon="plus" @click="handleAdd">新增</a-button> | |
15 | + <j-select-multi-cycle-count :query-config="selectUserQueryConfig"/> | |
16 | 16 | <a-button type="primary" icon="download" @click="handleExportXls('盘点明细表')">导出</a-button> |
17 | 17 | <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel"> |
18 | 18 | <a-button type="primary" icon="import">导入</a-button> |
... | ... | @@ -141,51 +141,55 @@ |
141 | 141 | }, |
142 | 142 | data() { |
143 | 143 | return { |
144 | + // 选择用户查询条件配置 | |
145 | + selectUserQueryConfig: [ | |
146 | + {key: 'locationCode', label: '库位'}, | |
147 | + ], | |
144 | 148 | description: '盘点明细表列表管理页面', |
145 | 149 | // 表头 |
146 | 150 | columns: [ |
147 | 151 | { |
148 | - title: '#', | |
152 | + title: 'ID', | |
149 | 153 | key: 'rowIndex', |
150 | 154 | width: 60, |
151 | 155 | align: 'center', |
152 | 156 | customRender: (t, r, index) => parseInt(index) + 1 |
153 | 157 | }, |
158 | + // { | |
159 | + // title: '盘点主单id', | |
160 | + // align: 'center', | |
161 | + // dataIndex: 'cycleCountHeadId', | |
162 | + // }, | |
154 | 163 | { |
155 | - title: '盘点主单id', | |
156 | - align: 'center', | |
157 | - dataIndex: 'cycleCountHeadId', | |
158 | - }, | |
159 | - { | |
160 | - title: '盘点主单code', | |
164 | + title: '盘点主单编码', | |
161 | 165 | align: 'center', |
162 | 166 | dataIndex: 'cycleCountHeadCode', |
163 | 167 | }, |
164 | - { | |
165 | - title: '任务表头', | |
166 | - align: 'center', | |
167 | - dataIndex: 'taskHeaderId', | |
168 | - }, | |
169 | - { | |
170 | - title: '任务明细头', | |
171 | - align: 'center', | |
172 | - dataIndex: 'taskDetailId', | |
173 | - }, | |
174 | - { | |
175 | - title: '仓库', | |
176 | - align: 'center', | |
177 | - dataIndex: 'warehouseCode', | |
178 | - }, | |
179 | - { | |
180 | - title: '货主', | |
181 | - align: 'center', | |
182 | - dataIndex: 'companyCode', | |
183 | - }, | |
184 | - { | |
185 | - title: '库存明细头', | |
186 | - align: 'center', | |
187 | - dataIndex: 'inventoryDetailId', | |
188 | - }, | |
168 | + // { | |
169 | + // title: '任务表头', | |
170 | + // align: 'center', | |
171 | + // dataIndex: 'taskHeaderId', | |
172 | + // }, | |
173 | + // { | |
174 | + // title: '任务明细头', | |
175 | + // align: 'center', | |
176 | + // dataIndex: 'taskDetailId', | |
177 | + // }, | |
178 | + // { | |
179 | + // title: '仓库', | |
180 | + // align: 'center', | |
181 | + // dataIndex: 'warehouseCode', | |
182 | + // }, | |
183 | + // { | |
184 | + // title: '货主', | |
185 | + // align: 'center', | |
186 | + // dataIndex: 'companyCode', | |
187 | + // }, | |
188 | + // { | |
189 | + // title: '库存明细头', | |
190 | + // align: 'center', | |
191 | + // dataIndex: 'inventoryDetailId', | |
192 | + // }, | |
189 | 193 | { |
190 | 194 | title: '库位', |
191 | 195 | align: 'center', |
... | ... | @@ -232,7 +236,7 @@ |
232 | 236 | dataIndex: 'completedAt', |
233 | 237 | }, |
234 | 238 | { |
235 | - title: '盘点明细状态', | |
239 | + title: '状态', | |
236 | 240 | align: 'center', |
237 | 241 | dataIndex: 'enableStatus', |
238 | 242 | }, |
... | ... |
ant-design-vue-jeecg/src/views/system/stocktaking/modules/CycleCountHeaderForm.vue
... | ... | @@ -43,7 +43,7 @@ |
43 | 43 | </a-col> |
44 | 44 | <a-col :span="24"> |
45 | 45 | <a-form-model-item label="备注" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="remark"> |
46 | - <a-input v-model="model.remark" placeholder="请输入备注" ></a-input> | |
46 | + <a-input type="textarea" v-model="model.remark" placeholder="请输入备注" ></a-input> | |
47 | 47 | </a-form-model-item> |
48 | 48 | </a-col> |
49 | 49 | </a-row> |
... | ... | @@ -75,7 +75,7 @@ |
75 | 75 | return { |
76 | 76 | // 选择用户查询条件配置 |
77 | 77 | selectUserQueryConfig: [ |
78 | - {key: 'phone', label: '电话'}, | |
78 | + {key: 'locationCode', label: '库位'}, | |
79 | 79 | ], |
80 | 80 | companyList: [], |
81 | 81 | CountTypeList:[], |
... | ... |
ant-design-vue-jeecg/src/views/system/stocktaking/subTables/CycleCountDetailChildSubTable.vue
... | ... | @@ -58,20 +58,15 @@ |
58 | 58 | dataSource: [], |
59 | 59 | columns: [ |
60 | 60 | { |
61 | - title: '盘点主单code', | |
61 | + title: '盘点主单编码', | |
62 | 62 | align: 'center', |
63 | 63 | dataIndex: 'cyclecountheadcode', |
64 | 64 | }, |
65 | - { | |
66 | - title: '盘点明细ID主id', | |
67 | - align: 'center', | |
68 | - dataIndex: 'cycleCountDetailid', | |
69 | - }, | |
70 | - { | |
71 | - title: '盘点明细子单状态', | |
72 | - align: 'center', | |
73 | - dataIndex: 'childStatus', | |
74 | - }, | |
65 | + // { | |
66 | + // title: '盘点明细ID主id', | |
67 | + // align: 'center', | |
68 | + // dataIndex: 'cycleCountDetailid', | |
69 | + // }, | |
75 | 70 | { |
76 | 71 | title: '库位', |
77 | 72 | align: 'center', |
... | ... | @@ -118,7 +113,12 @@ |
118 | 113 | dataIndex: 'gapQty', |
119 | 114 | }, |
120 | 115 | { |
121 | - title: '库存明细id', | |
116 | + title: '明细状态', | |
117 | + align: 'center', | |
118 | + dataIndex: 'childStatus', | |
119 | + }, | |
120 | + { | |
121 | + title: '库存明细ID', | |
122 | 122 | align: 'center', |
123 | 123 | dataIndex: 'inventoryDetaiId', |
124 | 124 | }, |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/controller/CycleCountDetailController.java
... | ... | @@ -9,11 +9,18 @@ import java.util.List; |
9 | 9 | import java.util.Map; |
10 | 10 | import java.util.stream.Collectors; |
11 | 11 | |
12 | +import javax.annotation.Resource; | |
12 | 13 | import javax.servlet.http.HttpServletRequest; |
14 | +import org.jeecg.modules.wms.framework.controller.HuahengBaseController; | |
13 | 15 | import javax.servlet.http.HttpServletResponse; |
14 | 16 | |
15 | 17 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
16 | 18 | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
19 | +import org.jeecg.modules.wms.framework.Convert; | |
20 | +import org.jeecg.modules.wms.framework.controller.HuahengBaseController; | |
21 | +import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryDetail; | |
22 | +import org.jeecg.modules.wms.inventory.inventoryHeader.service.IInventoryDetailService; | |
23 | +import org.jeecg.utils.StringUtils; | |
17 | 24 | import org.jeecgframework.poi.excel.ExcelImportUtil; |
18 | 25 | import org.jeecgframework.poi.excel.def.NormalExcelConstants; |
19 | 26 | import org.jeecgframework.poi.excel.entity.ExportParams; |
... | ... | @@ -54,12 +61,13 @@ import org.jeecg.common.aspect.annotation.AutoLog; |
54 | 61 | @RestController |
55 | 62 | @RequestMapping("/cycleCountDetail/cycleCountDetail") |
56 | 63 | @Slf4j |
57 | -public class CycleCountDetailController { | |
64 | +public class CycleCountDetailController extends HuahengBaseController { | |
58 | 65 | @Autowired |
59 | 66 | private ICycleCountDetailService cycleCountDetailService; |
60 | 67 | @Autowired |
61 | 68 | private ICycleCountDetailChildService cycleCountDetailChildService; |
62 | - | |
69 | + @Autowired | |
70 | + private IInventoryDetailService inventoryDetailService; | |
63 | 71 | /** |
64 | 72 | * 分页列表查询 |
65 | 73 | * |
... | ... | @@ -164,6 +172,32 @@ public class CycleCountDetailController { |
164 | 172 | |
165 | 173 | } |
166 | 174 | |
175 | + /** | |
176 | + * 添加盘点 | |
177 | + * | |
178 | + */ | |
179 | + @AutoLog(value = "盘点添加") | |
180 | + @ApiOperation(value="盘点添加", notes="盘点添加") | |
181 | + @PostMapping(value = "/stockTakeTask") | |
182 | + public Result<String> stockTakeTask(@RequestParam(name = "ids", required = true) String ids) { | |
183 | + if (StringUtils.isEmpty(ids)) { | |
184 | + return Result.error("taskId不能为空"); | |
185 | + } | |
186 | + Result result = null; | |
187 | + Integer[] idList = Convert.toIntArray(ids); | |
188 | + for (int taskId : idList) { | |
189 | + result = handleMultiProcess("cancelTask", new HuahengBaseController.MultiProcessListener() { | |
190 | + @Override | |
191 | + public Result doProcess() { | |
192 | + Result result = cycleCountDetailService.stockDetailAdd(taskId); | |
193 | + return result; | |
194 | + } | |
195 | + }); | |
196 | + } | |
197 | + return result; | |
198 | + | |
199 | + } | |
200 | + | |
167 | 201 | /** |
168 | 202 | * 通过id查询 |
169 | 203 | * |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/service/ICycleCountDetailService.java
1 | 1 | package org.jeecg.modules.wms.stocktaking.cycleCountDetail.service; |
2 | 2 | |
3 | +import org.jeecg.common.api.vo.Result; | |
3 | 4 | import org.jeecg.modules.wms.stocktaking.cycleCountDetail.entity.CycleCountDetailChild; |
4 | 5 | import org.jeecg.modules.wms.stocktaking.cycleCountDetail.entity.CycleCountDetail; |
5 | 6 | import com.baomidou.mybatisplus.extension.service.IService; |
... | ... | @@ -17,24 +18,25 @@ public interface ICycleCountDetailService extends IService<CycleCountDetail> { |
17 | 18 | |
18 | 19 | /** |
19 | 20 | * 添加一对多 |
20 | - * | |
21 | + * | |
21 | 22 | */ |
22 | 23 | public void saveMain(CycleCountDetail cycleCountDetail,List<CycleCountDetailChild> cycleCountDetailChildList) ; |
23 | - | |
24 | + | |
24 | 25 | /** |
25 | 26 | * 修改一对多 |
26 | - * | |
27 | + * | |
27 | 28 | */ |
28 | 29 | public void updateMain(CycleCountDetail cycleCountDetail,List<CycleCountDetailChild> cycleCountDetailChildList); |
29 | - | |
30 | + | |
30 | 31 | /** |
31 | 32 | * 删除一对多 |
32 | 33 | */ |
33 | 34 | public void delMain (String id); |
34 | - | |
35 | + | |
35 | 36 | /** |
36 | 37 | * 批量删除一对多 |
37 | 38 | */ |
38 | 39 | public void delBatchMain (Collection<? extends Serializable> idList); |
39 | - | |
40 | + | |
41 | + Result stockDetailAdd(int taskId); | |
40 | 42 | } |
... | ... |
huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/service/impl/CycleCountDetailServiceImpl.java
... | ... | @@ -2,6 +2,9 @@ package org.jeecg.modules.wms.stocktaking.cycleCountDetail.service.impl; |
2 | 2 | |
3 | 3 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
4 | 4 | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
5 | +import org.jeecg.common.api.vo.Result; | |
6 | +import org.jeecg.modules.wms.inventory.inventoryHeader.entity.InventoryDetail; | |
7 | +import org.jeecg.modules.wms.inventory.inventoryHeader.service.IInventoryDetailService; | |
5 | 8 | import org.jeecg.modules.wms.stocktaking.cycleCountDetail.entity.CycleCountDetail; |
6 | 9 | import org.jeecg.modules.wms.stocktaking.cycleCountDetail.entity.CycleCountDetailChild; |
7 | 10 | import org.jeecg.modules.wms.stocktaking.cycleCountDetail.mapper.CycleCountDetailChildMapper; |
... | ... | @@ -28,6 +31,8 @@ public class CycleCountDetailServiceImpl extends ServiceImpl<CycleCountDetailMap |
28 | 31 | private CycleCountDetailMapper cycleCountDetailMapper; |
29 | 32 | @Autowired |
30 | 33 | private CycleCountDetailChildMapper cycleCountDetailChildMapper; |
34 | + @Autowired | |
35 | + private IInventoryDetailService inventoryDetailService; | |
31 | 36 | |
32 | 37 | @Override |
33 | 38 | @Transactional |
... | ... | @@ -82,4 +87,23 @@ public class CycleCountDetailServiceImpl extends ServiceImpl<CycleCountDetailMap |
82 | 87 | } |
83 | 88 | } |
84 | 89 | |
90 | + @Override | |
91 | + public Result stockDetailAdd(int taskId) { | |
92 | + LambdaQueryWrapper<InventoryDetail> inventoryDetailLambdaQueryWrapper = Wrappers.lambdaQuery(); | |
93 | + inventoryDetailLambdaQueryWrapper.eq(InventoryDetail::getInventoryHeaderId,taskId); | |
94 | + List<InventoryDetail> inventoryDetails = inventoryDetailService.list(inventoryDetailLambdaQueryWrapper); | |
95 | + | |
96 | + CycleCountDetail cycleCountDetailChild = new CycleCountDetail(); | |
97 | + cycleCountDetailChild.setCompanyCode(inventoryDetails.get(0).getCompanyCode()); | |
98 | + cycleCountDetailChild.setContainerCode(inventoryDetails.get(0).getContainerCode()); | |
99 | + | |
100 | + | |
101 | + for(InventoryDetail inventoryDetail:inventoryDetails) | |
102 | + { | |
103 | + | |
104 | + } | |
105 | + | |
106 | + return Result.ok("添加成功"); | |
107 | + } | |
108 | + | |
85 | 109 | } |
... | ... |