|
@@ -69,14 +69,15 @@
|
|
|
<el-row>
|
|
|
<el-col :span="12">
|
|
|
<el-form-item label="label" required>
|
|
|
- <upload-file :file-type="system" :on-success="uploadSuccess" />
|
|
|
+ <upload-file file-type="1" show-file-list :on-success="uploadSuccess" :on-error="uploadError" />
|
|
|
+ <el-input v-model="formData.icon" />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
</el-form>
|
|
|
<div slot="footer">
|
|
|
<el-button @click="close">Cancel</el-button>
|
|
|
- <el-button v-if="routeType !== 'VIEW'" type="primary" @click="saveSystem">Confirm</el-button>
|
|
|
+ <el-button v-if="routeType !== 'VIEW'" type="primary" @click="saveSystem('editForm')">Confirm</el-button>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
</div>
|
|
@@ -100,12 +101,22 @@ export default {
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
- dictSysType: 'system_type',
|
|
|
// dialog
|
|
|
visible: false,
|
|
|
routeType: '',
|
|
|
title: 'Edit',
|
|
|
- formData: {},
|
|
|
+ formData: {
|
|
|
+ id: null,
|
|
|
+ appType: null,
|
|
|
+ systemName: '',
|
|
|
+ systemNumber: '',
|
|
|
+ shortName: '',
|
|
|
+ deptName: '',
|
|
|
+ url: '',
|
|
|
+ activeFlag: '',
|
|
|
+ policeCategory: '',
|
|
|
+ icon: ''
|
|
|
+ },
|
|
|
// select:
|
|
|
orgData: [],
|
|
|
policeCategoryData: [],
|
|
@@ -122,10 +133,15 @@ export default {
|
|
|
methods: {
|
|
|
// Upload
|
|
|
uploadSuccess(data) {
|
|
|
- console.log(data)
|
|
|
+ this.formData['icon'] = data.url
|
|
|
},
|
|
|
uploadError(error) {
|
|
|
- console.log(error)
|
|
|
+ this.$message.error({
|
|
|
+ type: 'error',
|
|
|
+ duration: 0,
|
|
|
+ showClose: true,
|
|
|
+ message: error.message
|
|
|
+ })
|
|
|
},
|
|
|
/**
|
|
|
* 加载dialog
|
|
@@ -133,30 +149,34 @@ export default {
|
|
|
open(type, data) {
|
|
|
this.routeType = type
|
|
|
this.title = type === 'ADD' ? 'Add' : type === 'VIEW' ? 'View' : 'Edit'
|
|
|
- this.formData = isObject(data) ? data : {}
|
|
|
+ this.formData = isObject(data) ? data : { 'appType': '', 'systemName': '', 'icon': '' }
|
|
|
this.visible = true
|
|
|
},
|
|
|
close() {
|
|
|
this.visible = false
|
|
|
},
|
|
|
- saveSystem() {
|
|
|
- this.loading = true
|
|
|
- pushSaveSystem().then(res => {
|
|
|
- this.loading = false
|
|
|
- this.visible = false
|
|
|
- this.$message({
|
|
|
- type: 'success',
|
|
|
- message: 'Save Successfully!'
|
|
|
- })
|
|
|
- }).catch(error => {
|
|
|
- console.log(error)
|
|
|
- this.loading = false
|
|
|
- this.$message.error({
|
|
|
- type: 'error',
|
|
|
- duration: 0,
|
|
|
- showClose: true,
|
|
|
- message: error.message
|
|
|
- })
|
|
|
+ saveSystem(formName) {
|
|
|
+ this.$refs[formName].validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ this.loading = true
|
|
|
+ pushSaveSystem(this.formData).then(res => {
|
|
|
+ this.loading = false
|
|
|
+ this.visible = false
|
|
|
+ this.$message({
|
|
|
+ type: 'success',
|
|
|
+ message: 'Save Successfully!'
|
|
|
+ })
|
|
|
+ }).catch(error => {
|
|
|
+ console.log(error)
|
|
|
+ this.loading = false
|
|
|
+ this.$message.error({
|
|
|
+ type: 'error',
|
|
|
+ duration: 0,
|
|
|
+ showClose: true,
|
|
|
+ message: error.message
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }
|
|
|
})
|
|
|
}
|
|
|
}
|