|
@@ -20,10 +20,11 @@ |
|
@@ -20,10 +20,11 @@ |
|
20
|
</template>
|
20
|
</template>
|
|
21
|
|
21
|
|
|
22
|
<script>
|
22
|
<script>
|
|
23
|
-import { httpAction, getAction,yanshouList } from '@/api/manage'
|
23
|
+import { httpAction, getAction, yanshouList } from '@/api/manage'
|
|
24
|
import { validateDuplicateValue } from '@/utils/util'
|
24
|
import { validateDuplicateValue } from '@/utils/util'
|
|
25
|
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
|
25
|
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
|
|
26
|
-import { yanshou } from '../../../api/manage'
|
26
|
+import { updateYan, yanshou } from '../../../api/manage'
|
|
|
|
27
|
+import { mapGetters } from 'vuex'
|
|
27
|
export default {
|
28
|
export default {
|
|
28
|
name: 'TblProductionYansForm',
|
29
|
name: 'TblProductionYansForm',
|
|
29
|
mixins: [JeecgListMixin],
|
30
|
mixins: [JeecgListMixin],
|
|
@@ -44,13 +45,13 @@ export default { |
|
@@ -44,13 +45,13 @@ export default { |
|
44
|
{
|
45
|
{
|
|
45
|
title: '工序',
|
46
|
title: '工序',
|
|
46
|
align: 'center',
|
47
|
align: 'center',
|
|
47
|
- width:220,
|
48
|
+ width: 220,
|
|
48
|
dataIndex: 'workingProcedure',
|
49
|
dataIndex: 'workingProcedure',
|
|
49
|
},
|
50
|
},
|
|
50
|
{
|
51
|
{
|
|
51
|
title: '承接人',
|
52
|
title: '承接人',
|
|
52
|
align: 'center',
|
53
|
align: 'center',
|
|
53
|
- width:150,
|
54
|
+ width: 150,
|
|
54
|
dataIndex: 'undertaker',
|
55
|
dataIndex: 'undertaker',
|
|
55
|
},
|
56
|
},
|
|
56
|
{
|
57
|
{
|
|
@@ -61,14 +62,31 @@ export default { |
|
@@ -61,14 +62,31 @@ export default { |
|
61
|
{
|
62
|
{
|
|
62
|
title: '验收结果',
|
63
|
title: '验收结果',
|
|
63
|
align: 'center',
|
64
|
align: 'center',
|
|
64
|
- width:100,
|
65
|
+ width: 100,
|
|
|
|
66
|
+ modified: false,
|
|
65
|
dataIndex: 'yanResult',
|
67
|
dataIndex: 'yanResult',
|
|
|
|
68
|
+ customRender: (text, record, index) => {
|
|
|
|
69
|
+ return (
|
|
|
|
70
|
+ <a-select
|
|
|
|
71
|
+ v-model={record.yanResult}
|
|
|
|
72
|
+ style="width: 100%;"
|
|
|
|
73
|
+ onChange={() => this.handleYanResultChange(record)}
|
|
|
|
74
|
+ >
|
|
|
|
75
|
+ <a-select-option value="合格入库">合格入库</a-select-option>
|
|
|
|
76
|
+ <a-select-option value="不合格">不合格</a-select-option>
|
|
|
|
77
|
+ </a-select>
|
|
|
|
78
|
+ )
|
|
|
|
79
|
+ },
|
|
66
|
},
|
80
|
},
|
|
67
|
{
|
81
|
{
|
|
68
|
title: '备注',
|
82
|
title: '备注',
|
|
69
|
align: 'center',
|
83
|
align: 'center',
|
|
70
|
- width:150,
|
84
|
+ width: 150,
|
|
|
|
85
|
+ modified2: false,
|
|
71
|
dataIndex: 'notes',
|
86
|
dataIndex: 'notes',
|
|
|
|
87
|
+ customRender: (text, record, index) => {
|
|
|
|
88
|
+ return <a-input v-model={record.notes} style="text-align: center" v-on:input={() => this.handleInputChange(record)} />
|
|
|
|
89
|
+ },
|
|
72
|
},
|
90
|
},
|
|
73
|
],
|
91
|
],
|
|
74
|
labelCol: {
|
92
|
labelCol: {
|
|
@@ -88,9 +106,10 @@ export default { |
|
@@ -88,9 +106,10 @@ export default { |
|
88
|
zongPrice: [{ required: true, message: '请输入总工资算法!' }],
|
106
|
zongPrice: [{ required: true, message: '请输入总工资算法!' }],
|
|
89
|
},
|
107
|
},
|
|
90
|
url: {
|
108
|
url: {
|
|
91
|
- list:'/production/tblProductionGongxu/list',
|
109
|
+ list: '/production/tblProductionGongxu/list',
|
|
92
|
edit: '/production/tblProductionGongxu/edit',
|
110
|
edit: '/production/tblProductionGongxu/edit',
|
|
93
|
- queryByNumber:'/production/tblProductionGongxu/queryByNumber'
|
111
|
+ queryByNumber: '/production/tblProductionGongxu/queryByNumber',
|
|
|
|
112
|
+ updateYan: '/production/tblProductionGongxu/updateYan',
|
|
94
|
},
|
113
|
},
|
|
95
|
}
|
114
|
}
|
|
96
|
},
|
115
|
},
|
|
@@ -104,11 +123,53 @@ export default { |
|
@@ -104,11 +123,53 @@ export default { |
|
104
|
this.modelDefault = JSON.parse(JSON.stringify(this.model))
|
123
|
this.modelDefault = JSON.parse(JSON.stringify(this.model))
|
|
105
|
},
|
124
|
},
|
|
106
|
methods: {
|
125
|
methods: {
|
|
107
|
- yanshouList(record){
|
126
|
+ handleInputChange(record){
|
|
|
|
127
|
+ // 找到当前更改行的索引
|
|
|
|
128
|
+ const index = this.res.findIndex((item) => item.id === record.id)
|
|
|
|
129
|
+ console.log("index:",index)
|
|
|
|
130
|
+ // 如果找到了该行
|
|
|
|
131
|
+ if (index !== -1) {
|
|
|
|
132
|
+ this.res[index].modified2 = true
|
|
|
|
133
|
+ }
|
|
|
|
134
|
+ console.log("modified2:",this.res[index].modified2)
|
|
|
|
135
|
+ },
|
|
|
|
136
|
+ handleYanResultChange(record) {
|
|
|
|
137
|
+ console.log('当前更改的行的ID:', record.id)
|
|
|
|
138
|
+ console.log('当前选中的值:', record.yanResult)
|
|
|
|
139
|
+
|
|
|
|
140
|
+ // 找到当前更改行的索引
|
|
|
|
141
|
+ const index = this.res.findIndex((item) => item.id === record.id)
|
|
|
|
142
|
+
|
|
|
|
143
|
+ // 如果找到了该行
|
|
|
|
144
|
+ if (index !== -1) {
|
|
|
|
145
|
+ console.log('页面加载时显示的值:', this.res[index].originalYanResult)
|
|
|
|
146
|
+
|
|
|
|
147
|
+ // 比较当前选中的值和页面加载时显示的值
|
|
|
|
148
|
+ if (record.yanResult !== this.res[index].originalYanResult) {
|
|
|
|
149
|
+ // 如果不相同,则将 modified 属性设置为 true
|
|
|
|
150
|
+ this.res[index].modified = true
|
|
|
|
151
|
+ } else {
|
|
|
|
152
|
+ // 如果相同,则将 modified 属性设置为 false
|
|
|
|
153
|
+ this.res[index].modified = false
|
|
|
|
154
|
+ }
|
|
|
|
155
|
+ }
|
|
|
|
156
|
+ },
|
|
|
|
157
|
+ ...mapGetters(['nickname', 'avatar', 'userInfo']),
|
|
|
|
158
|
+ yanshouList(record) {
|
|
108
|
console.log(record.orderId)
|
159
|
console.log(record.orderId)
|
|
109
|
- yanshouList(this.url.queryByNumber,{orderId:record.orderId}).then((res) =>{
|
|
|
|
110
|
- if(res){
|
|
|
|
111
|
- this.res=res.result
|
160
|
+ yanshouList(this.url.queryByNumber, { orderId: record.orderId }).then((ress) => {
|
|
|
|
161
|
+ if (ress) {
|
|
|
|
162
|
+ this.res = ress.result.map((item) => ({
|
|
|
|
163
|
+ id: item.id,
|
|
|
|
164
|
+ workingProcedure: item.workingProcedure,
|
|
|
|
165
|
+ undertaker: item.undertaker,
|
|
|
|
166
|
+ workHours: item.workHours,
|
|
|
|
167
|
+ yanResult: item.yanResult,
|
|
|
|
168
|
+ notes: item.notes,
|
|
|
|
169
|
+ yanRen: this.userInfo().realname,
|
|
|
|
170
|
+ yanTime: new Date(),
|
|
|
|
171
|
+ originalYanResult: item.yanResult, // 添加一个 originalYanResult 属性保存页面加载时的值
|
|
|
|
172
|
+ }))
|
|
112
|
}
|
173
|
}
|
|
113
|
})
|
174
|
})
|
|
114
|
},
|
175
|
},
|
|
@@ -122,10 +183,26 @@ export default { |
|
@@ -122,10 +183,26 @@ export default { |
|
122
|
this.$refs.form.validate((valid) => {
|
183
|
this.$refs.form.validate((valid) => {
|
|
123
|
if (valid) {
|
184
|
if (valid) {
|
|
124
|
that.confirmLoading = true
|
185
|
that.confirmLoading = true
|
|
125
|
- let httpurl = ''
|
|
|
|
126
|
- let method = ''
|
|
|
|
127
|
|
186
|
|
|
128
|
- httpAction(this.url, this.model, method)
|
187
|
+ // 对记录进行分组,根据不同字段的修改情况进行更新
|
|
|
|
188
|
+ const recordsToUpdate = this.res.reduce((acc, record) => {
|
|
|
|
189
|
+ console.log("是否修改2:",record.modified2)
|
|
|
|
190
|
+ console.log("是否修改:",record.modified)
|
|
|
|
191
|
+ // 判断是否有字段被修改
|
|
|
|
192
|
+ if (record.modified) {
|
|
|
|
193
|
+ // 若 yanResult 字段被修改,则整条记录更新
|
|
|
|
194
|
+ if (record.yanResult !== record.originalYanResult) {
|
|
|
|
195
|
+ acc.push(record)
|
|
|
|
196
|
+ }
|
|
|
|
197
|
+ }else if(record.modified2){
|
|
|
|
198
|
+ // 若只有 notes 字段被修改,则只更新 notes 字段
|
|
|
|
199
|
+ const updatedRecord = Object.assign({}, record, { notes: record.notes })
|
|
|
|
200
|
+ console.log("备注:",updatedRecord)
|
|
|
|
201
|
+ acc.push(updatedRecord)
|
|
|
|
202
|
+ }
|
|
|
|
203
|
+ return acc
|
|
|
|
204
|
+ }, [])
|
|
|
|
205
|
+ updateYan(this.url.updateYan, recordsToUpdate)
|
|
129
|
.then((res) => {
|
206
|
.then((res) => {
|
|
130
|
if (res.success) {
|
207
|
if (res.success) {
|
|
131
|
that.$message.success(res.message)
|
208
|
that.$message.success(res.message)
|