¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <basic-container> |
| | | <avue-form ref="form" :option="option" v-model="form" :upload-before="uploadBefore" :upload-after="uploadAfter"/> |
| | | </basic-container> |
| | | </template> |
| | | |
| | | <script> |
| | | import {deployUpload} from "@/api/flow/flow"; |
| | | import {flowCategory} from "@/util/flow"; |
| | | |
| | | export default { |
| | | data() { |
| | | return { |
| | | form: { |
| | | flowCategory: '', |
| | | tenantId: '', |
| | | flowFile: [], |
| | | file: {}, |
| | | }, |
| | | option: { |
| | | labelWidth: 120, |
| | | menuBtn: false, |
| | | column: [ |
| | | { |
| | | label: 'æµç¨ç±»å', |
| | | prop: 'flowCategory', |
| | | type: 'select', |
| | | dicUrl: `/api/ubcs-system/dict/dictionary?code=flow`, |
| | | props: { |
| | | label: "dictValue", |
| | | value: "dictKey" |
| | | }, |
| | | row: true, |
| | | span: 12, |
| | | dataType: "number", |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: 'è¯·éæ©æµç¨ç±»å', |
| | | trigger: 'blur' |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | label: "æµç¨æ¨¡å¼", |
| | | prop: "flowMode", |
| | | type: "radio", |
| | | dicData: [ |
| | | { |
| | | label: "éç¨æµç¨", |
| | | value: 1 |
| | | }, |
| | | { |
| | | label: "å®å¶æµç¨", |
| | | value: 2 |
| | | } |
| | | ], |
| | | value: 1, |
| | | row: true, |
| | | span: 12, |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: 'è¯·éæ©æµç¨æ¨¡å¼', |
| | | trigger: 'blur' |
| | | } |
| | | ], |
| | | }, |
| | | { |
| | | label: "æå±ç§æ·", |
| | | prop: "tenantId", |
| | | type: "tree", |
| | | multiple: true, |
| | | dicUrl: "/api/ubcs-system/tenant/select", |
| | | props: { |
| | | label: "tenantName", |
| | | value: "tenantId" |
| | | }, |
| | | display: false, |
| | | row: true, |
| | | span: 12, |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: 'è¯·éæ©æå±ç§æ·', |
| | | trigger: 'blur' |
| | | } |
| | | ], |
| | | }, |
| | | { |
| | | label: 'éä»¶ä¸ä¼ ', |
| | | prop: 'flowFile', |
| | | type: 'upload', |
| | | loadText: 'éä»¶ä¸ä¼ ä¸ï¼è¯·ç¨ç', |
| | | span: 24, |
| | | propsHttp: { |
| | | res: 'data' |
| | | }, |
| | | tip: '请ä¸ä¼ bpmn20.xml æ åæ ¼å¼æä»¶', |
| | | action: '/api/ubcs-flow/manager/check-upload' |
| | | }, |
| | | ] |
| | | } |
| | | } |
| | | }, |
| | | watch: { |
| | | 'form.flowMode'() { |
| | | this.$refs.form.option.column.filter(item => { |
| | | if (item.prop === "tenantId") { |
| | | item.display = this.form.flowMode === 2; |
| | | } |
| | | }); |
| | | } |
| | | }, |
| | | methods: { |
| | | uploadBefore(file, done) { |
| | | this.$message.success('é¨ç½²å¼å§'); |
| | | this.file = file; |
| | | done() |
| | | }, |
| | | uploadAfter(res, done, loading) { |
| | | if (!this.form.flowCategory) { |
| | | this.$message.warning('æ¸
å
éæ©æµç¨ç±»å'); |
| | | loading() |
| | | return false; |
| | | } |
| | | if (this.form.flowMode === 2 && !this.form.tenantId) { |
| | | this.$message.warning('æ¸
å
鿩坹åºç§æ·'); |
| | | loading(); |
| | | return false; |
| | | } |
| | | if (res.success) { |
| | | deployUpload( |
| | | flowCategory(this.form.flowCategory), |
| | | (this.form.tenantId) ? this.form.tenantId.join(",") : "", |
| | | [this.file] |
| | | ).then(res => { |
| | | const data = res.data; |
| | | if (data.success) { |
| | | done() |
| | | } else { |
| | | this.$message.error(data.msg); |
| | | loading() |
| | | } |
| | | }) |
| | | } else { |
| | | this.$message.warning('请ä¸ä¼ bpmn20.xml æ åæ ¼å¼æä»¶'); |
| | | loading() |
| | | return false; |
| | | } |
| | | }, |
| | | } |
| | | } |
| | | </script> |