Commit bb5e297440e1ef0a4bd52d09993419311a7cbaa5
1 parent
7bf4bb66
完成生产计划表单添加校验规则
Showing
5 changed files
with
187 additions
and
110 deletions
src/views/scheduler/SchedulerDetailList.vue
... | ... | @@ -38,25 +38,6 @@ |
38 | 38 | :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}" |
39 | 39 | @change="handleTableChange"> |
40 | 40 | |
41 | - <template slot="htmlSlot" slot-scope="text"> | |
42 | - <div v-html="text"></div> | |
43 | - </template> | |
44 | - <template slot="imgSlot" slot-scope="text"> | |
45 | - <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span> | |
46 | - <img v-else :src="getImgView(text)" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/> | |
47 | - </template> | |
48 | - <template slot="fileSlot" slot-scope="text"> | |
49 | - <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span> | |
50 | - <a-button | |
51 | - v-else | |
52 | - :ghost="true" | |
53 | - type="primary" | |
54 | - icon="download" | |
55 | - size="small" | |
56 | - @click="downloadFile(text)"> | |
57 | - 下载 | |
58 | - </a-button> | |
59 | - </template> | |
60 | 41 | |
61 | 42 | <span slot="action" slot-scope="text, record"> |
62 | 43 | <a @click="handleEdit(record)">编辑</a> |
... | ... | @@ -81,6 +62,8 @@ |
81 | 62 | import { JeecgListMixin } from '@/mixins/JeecgListMixin' |
82 | 63 | import SchedulerDetailModal from './modules/SchedulerDetailModal' |
83 | 64 | import SchedulerCompleteModal from '@views/scheduler/modules/SchedulerCompleteModal' |
65 | + import { getTechnology, getTechnologyType } from '@api/api' | |
66 | + import { JVXETypes } from '@comp/jeecg/JVxeTable' | |
84 | 67 | |
85 | 68 | export default { |
86 | 69 | name: "SchedulerDetailList", |
... | ... | @@ -145,7 +128,8 @@ |
145 | 128 | { |
146 | 129 | title: '工艺类型', |
147 | 130 | align: 'center', |
148 | - dataIndex: 'technologyType' | |
131 | + dataIndex: 'technologyType', | |
132 | + scopedSlots: {customRender: 'esContent'} | |
149 | 133 | }, |
150 | 134 | { |
151 | 135 | title: '工艺', |
... | ... | @@ -201,6 +185,32 @@ |
201 | 185 | dataIndex: 'delayReason' |
202 | 186 | }, |
203 | 187 | { |
188 | + title:'创建人', | |
189 | + align:"center", | |
190 | + dataIndex: 'createBy' | |
191 | + }, | |
192 | + { | |
193 | + title:'创建日期', | |
194 | + align:"center", | |
195 | + dataIndex: 'createTime', | |
196 | + customRender:function (text) { | |
197 | + return !text?"":(text.length>10?text.substr(0,10):text) | |
198 | + } | |
199 | + }, | |
200 | + { | |
201 | + title:'更新人', | |
202 | + align:"center", | |
203 | + dataIndex: 'updateBy' | |
204 | + }, | |
205 | + { | |
206 | + title:'更新日期', | |
207 | + align:"center", | |
208 | + dataIndex: 'updateTime', | |
209 | + customRender:function (text) { | |
210 | + return !text?"":(text.length>10?text.substr(0,10):text) | |
211 | + } | |
212 | + }, | |
213 | + { | |
204 | 214 | title: '操作', |
205 | 215 | dataIndex: 'action', |
206 | 216 | align:"center", |
... | ... | @@ -219,10 +229,14 @@ |
219 | 229 | dictOptions:{ |
220 | 230 | }, |
221 | 231 | superFieldList:[], |
232 | + technologyList: {}, | |
233 | + technologyTypeList: {} | |
222 | 234 | } |
223 | 235 | }, |
224 | 236 | created() { |
225 | 237 | this.getSuperFieldList(); |
238 | + this.getTechnologyTypeList(); | |
239 | + this.getTechnologyList(); | |
226 | 240 | }, |
227 | 241 | computed: { |
228 | 242 | importExcelUrl(){ |
... | ... | @@ -249,6 +263,35 @@ |
249 | 263 | this.$refs.completeForm.edit(record); |
250 | 264 | this.$refs.completeForm.title = "完成"; |
251 | 265 | this.$refs.completeForm.disableSubmit = false; |
266 | + }, | |
267 | + getTechnologyTypeList() { | |
268 | + const that = this; | |
269 | + let obj = getTechnologyType(); | |
270 | + obj.then((res) => { | |
271 | + if (res.success) { | |
272 | + that.technologyTypeList = res.result; | |
273 | + } else { | |
274 | + that.$message.warning(res.message); | |
275 | + } | |
276 | + }) | |
277 | + }, | |
278 | + getTechnologyList() { | |
279 | + const that = this; | |
280 | + let obj = getTechnology(); | |
281 | + obj.then((res) => { | |
282 | + if (res.success) { | |
283 | + that.technologyList = res.result; | |
284 | + } else { | |
285 | + that.$message.warning(res.message); | |
286 | + } | |
287 | + }) | |
288 | + }, | |
289 | + rewriteTechnologyType(val) { | |
290 | + this.technologyTypeList.forEach(item=>{ | |
291 | + if (item.typeId == val) { | |
292 | + return item.name | |
293 | + } | |
294 | + }) | |
252 | 295 | } |
253 | 296 | } |
254 | 297 | } |
... | ... |
src/views/scheduler/SchedulerHeaderList.vue
... | ... | @@ -145,30 +145,43 @@ |
145 | 145 | } |
146 | 146 | }, |
147 | 147 | { |
148 | - title:'创建人', | |
148 | + title:'计划完成时间', | |
149 | 149 | align:"center", |
150 | - dataIndex: 'createBy' | |
150 | + dataIndex: 'completionTime', | |
151 | + customRender:function (text) { | |
152 | + return !text?"":(text.length>10?text.substr(0,10):text) | |
153 | + } | |
151 | 154 | }, |
152 | 155 | { |
153 | - title:'创建时间', | |
156 | + title:'实际完成时间', | |
154 | 157 | align:"center", |
155 | - dataIndex: 'created', | |
158 | + dataIndex: 'actualCompletionTime', | |
156 | 159 | customRender:function (text) { |
157 | 160 | return !text?"":(text.length>10?text.substr(0,10):text) |
158 | 161 | } |
159 | 162 | }, |
160 | 163 | { |
161 | - title:'计划完成时间', | |
164 | + title:'创建人', | |
162 | 165 | align:"center", |
163 | - dataIndex: 'completionTime', | |
166 | + dataIndex: 'createBy' | |
167 | + }, | |
168 | + { | |
169 | + title:'创建日期', | |
170 | + align:"center", | |
171 | + dataIndex: 'createTime', | |
164 | 172 | customRender:function (text) { |
165 | 173 | return !text?"":(text.length>10?text.substr(0,10):text) |
166 | 174 | } |
167 | 175 | }, |
168 | 176 | { |
169 | - title:'实际完成时间', | |
177 | + title:'更新人', | |
170 | 178 | align:"center", |
171 | - dataIndex: 'actualCompletionTime', | |
179 | + dataIndex: 'updateBy' | |
180 | + }, | |
181 | + { | |
182 | + title:'更新日期', | |
183 | + align:"center", | |
184 | + dataIndex: 'updateTime', | |
172 | 185 | customRender:function (text) { |
173 | 186 | return !text?"":(text.length>10?text.substr(0,10):text) |
174 | 187 | } |
... | ... |
src/views/scheduler/SchedulerTransactionList.vue
... | ... | @@ -140,7 +140,32 @@ export default { |
140 | 140 | title: '完成时间', |
141 | 141 | align: "left", |
142 | 142 | dataIndex: 'completeDate', |
143 | - } | |
143 | + }, { | |
144 | + title:'创建人', | |
145 | + align:"center", | |
146 | + dataIndex: 'createBy' | |
147 | + }, | |
148 | + { | |
149 | + title:'创建日期', | |
150 | + align:"center", | |
151 | + dataIndex: 'createTime', | |
152 | + customRender:function (text) { | |
153 | + return !text?"":(text.length>10?text.substr(0,10):text) | |
154 | + } | |
155 | + }, | |
156 | + { | |
157 | + title:'更新人', | |
158 | + align:"center", | |
159 | + dataIndex: 'updateBy' | |
160 | + }, | |
161 | + { | |
162 | + title:'更新日期', | |
163 | + align:"center", | |
164 | + dataIndex: 'updateTime', | |
165 | + customRender:function (text) { | |
166 | + return !text?"":(text.length>10?text.substr(0,10):text) | |
167 | + } | |
168 | + }, | |
144 | 169 | ], |
145 | 170 | labelCol: { |
146 | 171 | xs: {span: 8}, |
... | ... |
src/views/scheduler/modules/SchedulerCompleteModal.vue
... | ... | @@ -28,12 +28,13 @@ |
28 | 28 | </a-col> |
29 | 29 | <a-col :span="24"> |
30 | 30 | <a-form-item label="数量" :labelCol="labelCol" :wrapperCol="wrapperCol"> |
31 | - <a-input-number v-decorator="['qty']" placeholder="请输入数量" style="width: 100%" /> | |
31 | + <a-input-number v-decorator="['qty', { rules: [{ required: true}]}]" placeholder="请输入数量" style="width: 100%" /> | |
32 | 32 | </a-form-item> |
33 | 33 | </a-col> |
34 | 34 | <a-col :span="24"> |
35 | 35 | <a-form-item label="工艺" :labelCol="labelCol" :wrapperCol="wrapperCol"> |
36 | - <a-select :disabled="true" v-model="technologyTypeModal" :defaultActiveFirstOption="true" style="width: 250px" | |
36 | + <a-select :disabled="true" v-model="technologyTypeModal" :defaultActiveFirstOption="true" | |
37 | + style="width: 250px" | |
37 | 38 | @change="handleProvinceChange"> |
38 | 39 | <a-select-option v-for="technologyType in technologyTypeList" :key="technologyType.type"> |
39 | 40 | {{ technologyType.name }} |
... | ... | @@ -49,7 +50,8 @@ |
49 | 50 | |
50 | 51 | <a-col :span="24"> |
51 | 52 | <a-form-item label="排序" :labelCol="labelCol" :wrapperCol="wrapperCol"> |
52 | - <a-input-number v-decorator="['sequence']" :disabled="true" placeholder="请输入排序" style="width: 500px"></a-input-number> | |
53 | + <a-input-number v-decorator="['sequence']" :disabled="true" placeholder="请输入排序" | |
54 | + style="width: 500px"></a-input-number> | |
53 | 55 | </a-form-item> |
54 | 56 | </a-col> |
55 | 57 | <a-col :span="24"> |
... | ... | @@ -59,19 +61,22 @@ |
59 | 61 | </a-form-item> |
60 | 62 | </a-col> |
61 | 63 | <a-col :span="24"> |
62 | - <a-form-item label="完成人":labelCol="labelCol" :wrapperCol="wrapperCol"> | |
64 | + <a-form-item label="完成人" :labelCol="labelCol" :wrapperCol="wrapperCol"> | |
63 | 65 | <j-select-user-by-dep v-model="completeBy" :multi="false"></j-select-user-by-dep> |
64 | 66 | </a-form-item> |
65 | 67 | </a-col> |
66 | 68 | <a-col :span="24"> |
67 | 69 | <a-form-item label="实际完成时间" :labelCol="labelCol" :wrapperCol="wrapperCol"> |
68 | - <j-date placeholder="请选择实际完成时间" v-decorator="['completeDate']" :trigger-change="true" | |
70 | + <j-date placeholder="请选择实际完成时间" v-decorator="['completeDate', { rules: [{ required: true}]}]" | |
71 | + :trigger-change="true" | |
69 | 72 | style="width: 100%" /> |
70 | 73 | </a-form-item> |
71 | 74 | </a-col> |
72 | 75 | <a-col :span="24"> |
73 | 76 | <a-form-item label="工时" :labelCol="labelCol" :wrapperCol="wrapperCol"> |
74 | - <a-input v-decorator="['completetime', { rules: [{ required: true, message: '请输入正数!', pattern: '[1-9]\\d*|[1-9]\\d*.\\d*|0.\\d*[1-9]\\d*' }] }]" placeholder="请输入工时"></a-input> | |
77 | + <a-input | |
78 | + v-decorator="['completetime', { rules: [{ required: true, message: '请输入正数!', pattern: '[1-9]\\d*|[1-9]\\d*.\\d*|0.\\d*[1-9]\\d*' }] }]" | |
79 | + placeholder="请输入工时"></a-input> | |
75 | 80 | </a-form-item> |
76 | 81 | </a-col> |
77 | 82 | <a-col :span="24"> |
... | ... | @@ -100,25 +105,25 @@ export default { |
100 | 105 | default: '' |
101 | 106 | } |
102 | 107 | }, |
103 | - data () { | |
108 | + data() { | |
104 | 109 | let technologyTypeList |
105 | 110 | let technologyList |
106 | 111 | let technologyTypeModal |
107 | 112 | let technologyModal |
108 | 113 | return { |
109 | 114 | form: this.$form.createForm(this), |
110 | - title:"操作", | |
111 | - width:800, | |
115 | + title: '操作', | |
116 | + width: 800, | |
112 | 117 | visible: false, |
113 | 118 | model: {}, |
114 | 119 | labelCol: { |
115 | 120 | xs: { span: 24 }, |
116 | - sm: { span: 5 }, | |
121 | + sm: { span: 5 } | |
117 | 122 | }, |
118 | 123 | completeBy: '', |
119 | 124 | wrapperCol: { |
120 | 125 | xs: { span: 24 }, |
121 | - sm: { span: 16 }, | |
126 | + sm: { span: 16 } | |
122 | 127 | }, |
123 | 128 | confirmLoading: false, |
124 | 129 | detailId: 0, |
... | ... | @@ -128,7 +133,7 @@ export default { |
128 | 133 | technologyModal |
129 | 134 | } |
130 | 135 | }, |
131 | - created () { | |
136 | + created() { | |
132 | 137 | this.getTechnologyType() |
133 | 138 | this.getTechnologyList() |
134 | 139 | }, |
... | ... | @@ -136,82 +141,88 @@ export default { |
136 | 141 | handleProvinceChange(value) { |
137 | 142 | this.getTechnologyList(value) |
138 | 143 | }, |
139 | - add () { | |
140 | - this.edit({}); | |
144 | + add() { | |
145 | + this.edit({}) | |
141 | 146 | }, |
142 | - edit (record) { | |
143 | - this.form.resetFields(); | |
144 | - this.model = Object.assign({}, record); | |
145 | - this.visible = true; | |
146 | - this.technologyModal = record.technology; | |
147 | - this.technologyTypeModal = record.technologyType; | |
148 | - this.detailId = record.id; | |
147 | + edit(record) { | |
148 | + this.form.resetFields() | |
149 | + this.model = Object.assign({}, record) | |
150 | + this.visible = true | |
151 | + this.technologyModal = record.technology | |
152 | + this.technologyTypeModal = record.technologyType | |
153 | + this.detailId = record.id | |
149 | 154 | this.getTechnologyList(record.technologyType) |
150 | 155 | this.$nextTick(() => { |
151 | - this.form.setFieldsValue(pick(this.model, 'drawingNo', 'parentDrawingNo', 'name', 'qty', 'preDate','sequence','completeDate','delayReason', 'completeBy')) | |
156 | + this.form.setFieldsValue(pick(this.model, 'drawingNo', 'parentDrawingNo', 'name', 'qty', 'preDate', 'sequence', 'completeDate', 'delayReason', 'completeBy')) | |
152 | 157 | }) |
153 | 158 | }, |
154 | - close () { | |
155 | - this.$emit('close'); | |
156 | - this.visible = false; | |
159 | + close() { | |
160 | + this.$emit('close') | |
161 | + this.visible = false | |
157 | 162 | }, |
158 | - handleOk () { | |
159 | - const that = this; | |
160 | - // 触发表单验证 | |
161 | - this.form.validateFields((err, values) => { | |
162 | - if (!err) { | |
163 | - that.confirmLoading = true; | |
164 | - values.drawingNo = (values.drawingNo || '').trim() | |
165 | - values.name = (values.name || '').trim() | |
166 | - values.parentDrawingNo = (values.parentDrawingNo || '').trim() | |
167 | - let formData = { | |
168 | - "detailId": that.detailId, | |
169 | - "completeBy": that.completeBy, | |
170 | - "completeDate": values.completeDate, | |
171 | - "qty": that.model.qty, | |
172 | - "delayReason": values.delayReason, | |
173 | - "completetime": values.completetime | |
174 | - } | |
175 | - let obj = addTransaction(formData) | |
176 | - obj.then((res) => { | |
177 | - if (res.success) { | |
178 | - that.$message.success(res.message) | |
179 | - that.$emit('ok') | |
180 | - } else { | |
181 | - that.$message.warning(res.message) | |
163 | + handleOk() { | |
164 | + const that = this | |
165 | + if (this.completeBy === '') { | |
166 | + this.$message.warning("请选择完成用户"); | |
167 | + } else { | |
168 | + // 触发表单验证 | |
169 | + this.form.validateFields((err, values) => { | |
170 | + if (!err) { | |
171 | + that.confirmLoading = true | |
172 | + values.drawingNo = (values.drawingNo || '').trim() | |
173 | + values.name = (values.name || '').trim() | |
174 | + values.parentDrawingNo = (values.parentDrawingNo || '').trim() | |
175 | + | |
176 | + let formData = { | |
177 | + 'detailId': that.detailId, | |
178 | + 'completeBy': that.completeBy, | |
179 | + 'completeDate': values.completeDate, | |
180 | + 'qty': that.model.qty, | |
181 | + 'delayReason': values.delayReason, | |
182 | + 'completetime': values.completetime | |
182 | 183 | } |
183 | - }).finally(() => { | |
184 | - that.confirmLoading = false | |
185 | - that.close() | |
186 | - }) | |
187 | - } | |
188 | - }) | |
184 | + let obj = addTransaction(formData) | |
185 | + obj.then((res) => { | |
186 | + if (res.success) { | |
187 | + that.$message.success(res.message) | |
188 | + that.$emit('ok') | |
189 | + } else { | |
190 | + that.$message.warning(res.message) | |
191 | + } | |
192 | + }).finally(() => { | |
193 | + that.confirmLoading = false | |
194 | + that.close() | |
195 | + }) | |
196 | + } | |
197 | + }) | |
198 | + } | |
199 | + | |
189 | 200 | }, |
190 | - handleCancel () { | |
201 | + handleCancel() { | |
191 | 202 | this.close() |
192 | 203 | }, |
193 | - popupCallback(row){ | |
194 | - this.form.setFieldsValue(pick(row,'headerId','drawingNo','name','qty','technology','preDate','weldTechnology','weldBy','weldDate','machiningTechnology','machiningBy','machiningDate','paintTechnology','paintBy','paintDate','completedDate','delayReason')) | |
204 | + popupCallback(row) { | |
205 | + this.form.setFieldsValue(pick(row, 'headerId', 'drawingNo', 'name', 'qty', 'technology', 'preDate', 'weldTechnology', 'weldBy', 'weldDate', 'machiningTechnology', 'machiningBy', 'machiningDate', 'paintTechnology', 'paintBy', 'paintDate', 'completedDate', 'delayReason')) | |
195 | 206 | }, |
196 | 207 | getTechnologyType() { |
197 | - const that = this; | |
198 | - let obj = getTechnologyType(); | |
208 | + const that = this | |
209 | + let obj = getTechnologyType() | |
199 | 210 | obj.then((res) => { |
200 | 211 | if (res.success) { |
201 | - that.technologyTypeList = res.result; | |
212 | + that.technologyTypeList = res.result | |
202 | 213 | } else { |
203 | - that.$message.warning(res.message); | |
214 | + that.$message.warning(res.message) | |
204 | 215 | } |
205 | 216 | }) |
206 | 217 | }, |
207 | 218 | getTechnologyList(val) { |
208 | - const that = this; | |
209 | - let obj = getTechnology({val}); | |
219 | + const that = this | |
220 | + let obj = getTechnology({ val }) | |
210 | 221 | obj.then((res) => { |
211 | 222 | if (res.success) { |
212 | - that.technologyList = res.result; | |
223 | + that.technologyList = res.result | |
213 | 224 | } else { |
214 | - that.$message.warning(res.message); | |
225 | + that.$message.warning(res.message) | |
215 | 226 | } |
216 | 227 | }) |
217 | 228 | } |
... | ... |
src/views/scheduler/modules/SchedulerDetailModal.vue
... | ... | @@ -56,21 +56,6 @@ |
56 | 56 | <j-date placeholder="请选择下图日期/预期完成日期" v-decorator="['preDate']" :trigger-change="true" style="width: 100%" /> |
57 | 57 | </a-form-item> |
58 | 58 | </a-col> |
59 | - <a-col :span="24"> | |
60 | - <a-form-item label="完成人" :labelCol="labelCol" :wrapperCol="wrapperCol"> | |
61 | - <a-input v-decorator="['completeBy']" placeholder="请输入完成人" ></a-input> | |
62 | - </a-form-item> | |
63 | - </a-col> | |
64 | - <a-col :span="24"> | |
65 | - <a-form-item label="实际完成时间" :labelCol="labelCol" :wrapperCol="wrapperCol"> | |
66 | - <j-date placeholder="请选择实际完成时间" v-decorator="['completeDate']" :trigger-change="true" style="width: 100%" /> | |
67 | - </a-form-item> | |
68 | - </a-col> | |
69 | - <a-col :span="24"> | |
70 | - <a-form-item label="延误原因" :labelCol="labelCol" :wrapperCol="wrapperCol"> | |
71 | - <a-input v-decorator="['delayReason']" placeholder="请输入延误原因" ></a-input> | |
72 | - </a-form-item> | |
73 | - </a-col> | |
74 | 59 | </a-row> |
75 | 60 | </a-form> |
76 | 61 | </a-spin> |
... | ... |