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
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
| <template>
| <!--支持全屏缩放-->
| <j-modal
| :visible="visible"
| :width="1200"
| :title="title"
| switchFullscreen
| @ok="handleSubmit"
| @cancel="close"
| style="top: 50px"
| cancelText="关闭"
| >
| <a-card :bordered="false">
| <div class="table-page-search-wrapper">
| <a-form layout="inline" @keyup.enter.native="searchQuery">
| <a-row :gutter="24">
| <a-col :xl="6" :lg="7" :md="8" :sm="24">
| <a-form-item label="工装名称">
| <j-input placeholder="请输入工装名称,支持模糊查询" v-model="queryParam.toolName"></j-input>
| </a-form-item>
| </a-col>
| <a-col :xl="6" :lg="7" :md="8" :sm="24">
| <a-form-item label="工装编码">
| <j-input placeholder="请输入工具编码,支持模糊查询" v-model="queryParam.toolCode"></j-input>
| </a-form-item>
| </a-col>
| <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
| <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
| </a-row>
| </a-form>
| </div>
| <!--出库单列表-->
| <a-table
| ref="table"
| size="middle"
| :columns="columns"
| :dataSource="dataSource"
| :pagination="ipagination"
| :rowSelection="rowSelection"
| :loading="loading"
| @change="handleTableChange"
| :rowClassName="getRowClassName"
| >
| </a-table>
| </a-card>
| </j-modal>
| </template>
|
| <script>
| import { filterObj } from '@/utils/util'
| import { getAction } from '@api/manage'
|
| export default {
| name: 'JSelectSharpenOutboundToolModal',
| components: {},
| props: {},
| data() {
| return {
| title: '选择入库工装',
| queryParam: {},
| columns: [
| {
| title: '#',
| dataIndex: '',
| key:'rowIndex',
| width:60,
| align:"center",
| customRender:function (t,r,index) {
| return parseInt(index)+1;
| }
| },
| {
| title:'工装名称',
| align:"center",
| dataIndex: 'toolName'
| },
| {
| title:'工装编码',
| align:"center",
| dataIndex: 'toolCode'
| },
| {
| title:'工装分类',
| align:"center",
| dataIndex: 'toolCategory'
| },
| {
| title:'型号',
| align:"center",
| dataIndex: 'toolModel'
| },
| {
| title:'规格',
| align:"center",
| dataIndex: 'toolSpecification'
| },
| {
| title:'单位',
| align:"center",
| dataIndex: 'toolUnit'
| },
| {
| title:'存放位置',
| align:"center",
| dataIndex: 'storeLocation'
| },
| {
| title:'供应商',
| align:"center",
| dataIndex: 'supplierId'
| },
| {
| title:'备注',
| align:"center",
| dataIndex: 'remark'
| }
| ],
| selectedRowKeys: [],
| oldSelectRow: [],
| scrollTrigger: { x: 1500, y: 500 },
| dataSource: [],
| selectionRows: [],
| ipagination: {
| current: 1,
| pageSize: 10,
| pageSizeOptions: ['5', '10', '20'],
| showTotal: (total, range) => {
| return range[0] + '-' + range[1] + ' 共' + total + '条'
| },
| showQuickJumper: true,
| showSizeChanger: true,
| total: 0,
| },
| isorter: {
| column: 'toolCode',
| order: 'asc',
| },
| departTree: [],
| visible: false,
| loading: false,
| prepareKnifeDetailList:[],
| url: {
| list: "/tms/tmsTools/list"
| },
| }
| },
| computed: {
| rowSelection() {
| return {
| type: 'checkbox',
| onChange: (selectedRowKeys, selectedRows) => {
| this.selectedRowKeys = selectedRowKeys
| this.onSelectChange(selectedRows)
| },
| getCheckboxProps: (record) => ({
| props: {
| disabled: record.alreadySelected,
| },
| }),
| }
| },
| },
| watch: {
| },
| created() {
| },
| methods: {
| getRowClassName(record, index) {
| return record.alreadySelected ? 'disabled-row' : '';
| },
| async loadData(arg) {
| if (arg === 1) {
| this.ipagination.current = 1
| }
| this.loading = true
| let params = this.getQueryParams() //查询条件
| console.log(params)
| await getAction(this.url.list, params).then((res) => {
| if (res.success) {
| // 处理数据,标记已选择的记录
| this.dataSource = res.result.records.map(item => {
| // 检查当前记录是否在已选择列表中
| if (this.oldSelectRow && this.oldSelectRow.includes(item.id)) {
| return { ...item, alreadySelected: true }
| }
| return { ...item, alreadySelected: false }; // 明确设置为 false
| })
| this.ipagination.total = res.result.total
| }
| if (res.code === 510) {
| this.$message.warning(res.message)
| }
| this.loading = false
| })
| },
| showOrderModal(oldSelectRow) {
| this.oldSelectRow = oldSelectRow ? oldSelectRow.split(',') : []
| this.visible = true
| this.loadData(1)
| },
| getQueryParams() {
| let param = Object.assign({}, this.queryParam, this.isorter)
| param.field = this.getQueryField()
| param.pageNo = this.ipagination.current
| param.pageSize = this.ipagination.pageSize
| return filterObj(param)
| },
| //查询条件处理
| getQueryField() {
| let fields = ['id'];
| for (let a = 0; a < this.columns.length; a++) {
| fields.push(this.columns[a].dataIndex);
| }
| return fields.join(',');
| },
| searchReset() {
| this.queryParam = {}
| this.loadData(1)
| },
| close() {
| this.queryParam = {}
| this.selectedRowKeys = []
| this.selectionRows = []
| this.visible = false
| },
| handleTableChange(pagination, filters, sorter) {
| if (Object.keys(sorter).length > 0) {
| this.isorter.column = sorter.field
| this.isorter.order = 'ascend' === sorter.order ? 'asc' : 'desc'
| }
| this.ipagination = pagination
| this.loadData()
| },
| handleSubmit() {
| if (this.selectionRows.length > 0) {
| this.$bus.$emit('selectionRows', this.selectionRows)
| // this.searchReset(0)
| this.close()
| } else {
| this.$message.warning('请至少选择一条数据')
| }
| },
| onSelectChange(selectionRows) {
| this.selectionRows = selectionRows
| },
| searchQuery() {
| this.loadData(1)
| },
| },
| }
| </script>
|
| <style scoped>
| .ant-table-tbody .ant-table-row td {
| padding-top: 10px;
| padding-bottom: 10px;
| }
|
| #components-layout-demo-custom-trigger .trigger {
| font-size: 18px;
| line-height: 64px;
| padding: 0 24px;
| cursor: pointer;
| transition: color 0.3s;
| }
|
| /* 禁用行的样式 */
| .disabled-row {
| color: #999 !important; /* 灰色文字 */
| background-color: #f5f5f5 !important; /* 灰色背景 */
| }
|
| /* 确保禁用行的复选框也显示为禁用状态 */
| .disabled-row .ant-checkbox-wrapper {
| color: #999;
| }
|
| /* 禁用行中的所有元素 */
| .disabled-row * {
| color: #999 !important;
| cursor: not-allowed !important;
| }
| </style>
|
|