|
@@ -19,10 +19,13 @@
|
|
</template>
|
|
</template>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item :label='$t("resource.table.area.layoutMap")+":"' prop="layoutMap">
|
|
<el-form-item :label='$t("resource.table.area.layoutMap")+":"' prop="layoutMap">
|
|
- <fileUpload :acceptSize="5*1024*1024" :auto-upload="false" :limit="1" @fileLengthVaild="fileLengthVaild" @setId="setIdAndSubmit" ref="fileRef">
|
|
|
|
- <el-button size="small" slot="trigger" type="primary">选取文件</el-button>
|
|
|
|
|
|
+ <fileUpload :acceptSize="5*1024*1024" :auto-upload="false" :limit="1" :fileOtherData="this.fileData" @fileLengthVaild="fileLengthVaild" @setId="setIdAndSubmit" ref="fileRef">
|
|
|
|
+ <el-button size="small" slot="trigger" type="primary" >选取文件</el-button>
|
|
<div class="el-upload__tip" slot="tip">文件不超过5MB</div>
|
|
<div class="el-upload__tip" slot="tip">文件不超过5MB</div>
|
|
</fileUpload>
|
|
</fileUpload>
|
|
|
|
+ <div class="img-wrapper" v-if="tenant.imgUrl" style="margin:5px;">
|
|
|
|
+ <el-image :src="tenant.imgUrl" fit="cover" />
|
|
|
|
+ </div>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item :label='$t("resource.table.area.remark")+":"' prop="remark">
|
|
<el-form-item :label='$t("resource.table.area.remark")+":"' prop="remark">
|
|
<el-input v-model="tenant.remark" type="textarea" :rows="3" style="width: 100%;"/>
|
|
<el-input v-model="tenant.remark" type="textarea" :rows="3" style="width: 100%;"/>
|
|
@@ -30,7 +33,7 @@
|
|
</el-form>
|
|
</el-form>
|
|
<div slot="footer" class="dialog-footer">
|
|
<div slot="footer" class="dialog-footer">
|
|
<el-button plain type="warning" @click="isVisible = false">{{ $t('common.cancel') }}</el-button>
|
|
<el-button plain type="warning" @click="isVisible = false">{{ $t('common.cancel') }}</el-button>
|
|
- <el-button plain type="primary" :disabled="confirmDisabled" @click="submitForm">{{ $t('common.confirm') }}</el-button>
|
|
|
|
|
|
+ <el-button plain type="primary" :disabled="confirmDisabled" @click="submitForm" v-loading.fullscreen.lock="loading">{{ $t('common.confirm') }}</el-button>
|
|
</div>
|
|
</div>
|
|
</el-dialog>
|
|
</el-dialog>
|
|
</template>
|
|
</template>
|
|
@@ -57,12 +60,15 @@ export default {
|
|
data () {
|
|
data () {
|
|
return {
|
|
return {
|
|
type: 'add',
|
|
type: 'add',
|
|
|
|
+ loading: false,
|
|
tenant: this.initTenant(),
|
|
tenant: this.initTenant(),
|
|
screenWidth: 0,
|
|
screenWidth: 0,
|
|
width: this.initWidth(),
|
|
width: this.initWidth(),
|
|
accept: "image/jpeg, image/gif, image/png",
|
|
accept: "image/jpeg, image/gif, image/png",
|
|
fileLength: 0,
|
|
fileLength: 0,
|
|
fileId: "",
|
|
fileId: "",
|
|
|
|
+ fileData: {},
|
|
|
|
+ formData: {},
|
|
confirmDisabled: false,
|
|
confirmDisabled: false,
|
|
dicts:{
|
|
dicts:{
|
|
NATION: {}
|
|
NATION: {}
|
|
@@ -105,14 +111,16 @@ export default {
|
|
return (() => {
|
|
return (() => {
|
|
this.width = this.initWidth()
|
|
this.width = this.initWidth()
|
|
})()
|
|
})()
|
|
- }
|
|
|
|
|
|
+ }
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
initTenant () {
|
|
initTenant () {
|
|
return {
|
|
return {
|
|
id: '',
|
|
id: '',
|
|
name: '',
|
|
name: '',
|
|
- status: '1'
|
|
|
|
|
|
+ layoutMap: '',
|
|
|
|
+ status: '1',
|
|
|
|
+ remark:'',
|
|
}
|
|
}
|
|
},
|
|
},
|
|
initWidth () {
|
|
initWidth () {
|
|
@@ -131,11 +139,18 @@ export default {
|
|
vm.fileLength = data || 0;
|
|
vm.fileLength = data || 0;
|
|
},
|
|
},
|
|
setTenant (val, dicts) {
|
|
setTenant (val, dicts) {
|
|
- if(val){
|
|
|
|
- this.tenant = { ...val }
|
|
|
|
|
|
+ if(val){
|
|
|
|
+ this.tenant = { ...val }
|
|
}
|
|
}
|
|
// 字典表
|
|
// 字典表
|
|
- this.dicts = dicts
|
|
|
|
|
|
+ this.dicts = dicts
|
|
|
|
+ },
|
|
|
|
+ setFileData (val) {
|
|
|
|
+ if(val){
|
|
|
|
+ this.fileData = { ...val }
|
|
|
|
+ }
|
|
|
|
+ this.fileData.bizType = "TRAY"
|
|
|
|
+ this.fileData.isSingle = true
|
|
},
|
|
},
|
|
close () {
|
|
close () {
|
|
this.$emit('close')
|
|
this.$emit('close')
|
|
@@ -152,43 +167,47 @@ export default {
|
|
})
|
|
})
|
|
},
|
|
},
|
|
setIdAndSubmit (isUploadCompleted, res) {
|
|
setIdAndSubmit (isUploadCompleted, res) {
|
|
- const vm = this
|
|
|
|
- console.log(res)
|
|
|
|
if (isUploadCompleted) {
|
|
if (isUploadCompleted) {
|
|
- vm.disabled = false
|
|
|
|
- vm.isVisible = false
|
|
|
|
- vm.$message({
|
|
|
|
- message: vm.$t('tips.createSuccess'),
|
|
|
|
|
|
+ this.loading = false
|
|
|
|
+ this.confirmDisabled = false
|
|
|
|
+ this.isVisible = false
|
|
|
|
+ this.$message({
|
|
|
|
+ message: this.$t('tips.createSuccess'),
|
|
type: 'success'
|
|
type: 'success'
|
|
})
|
|
})
|
|
- vm.$emit('success')
|
|
|
|
|
|
+ this.$emit('success')
|
|
this.tenant.layoutMap = res.data.id
|
|
this.tenant.layoutMap = res.data.id
|
|
- // 后续提交处理
|
|
|
|
- if (this.type === 'add') {
|
|
|
|
- this.save()
|
|
|
|
- } else {
|
|
|
|
- this.update()
|
|
|
|
- }
|
|
|
|
|
|
+ this.formData = JSON.parse(localStorage.getItem("formData"))
|
|
|
|
+ this.formData.layoutMap = res.data.id
|
|
|
|
+ if (this.type === 'add') {
|
|
|
|
+ this.save(this.formData)
|
|
|
|
+ } else {
|
|
|
|
+ this.update(this.formData)
|
|
|
|
+ }
|
|
|
|
+ localStorage.removeItem("formData");
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- editSubmit () {
|
|
|
|
- const vm = this
|
|
|
|
- vm.disabled = true
|
|
|
|
|
|
+ editSubmit () {
|
|
|
|
+ this.disabled = true
|
|
|
|
+ this.loading = true
|
|
let id = this.tenant.layoutMap!=null? this.tenant.layoutMap: ""
|
|
let id = this.tenant.layoutMap!=null? this.tenant.layoutMap: ""
|
|
- vm.$refs.fileRef.submitFile(id, this.tenant.id, 'TRAY')
|
|
|
|
|
|
+ this.$refs.fileRef.submitFile(id, this.tenant.id, 'TRAY')
|
|
},
|
|
},
|
|
submitForm () {
|
|
submitForm () {
|
|
this.$refs.form.validate((valid) => {
|
|
this.$refs.form.validate((valid) => {
|
|
- if (valid) {
|
|
|
|
|
|
+ if (valid) {
|
|
|
|
+ this.formData = this.tenant
|
|
|
|
+ localStorage.setItem("formData", JSON.stringify(this.formData));
|
|
this.confirmDisabled = true
|
|
this.confirmDisabled = true
|
|
this.editSubmit()
|
|
this.editSubmit()
|
|
|
|
+ // 后续提交处理
|
|
} else {
|
|
} else {
|
|
return false
|
|
return false
|
|
}
|
|
}
|
|
})
|
|
})
|
|
},
|
|
},
|
|
- save () {
|
|
|
|
- areaMgrApi.save(this.tenant)
|
|
|
|
|
|
+ save (formData) {
|
|
|
|
+ areaMgrApi.save(formData)
|
|
.then((response) => {
|
|
.then((response) => {
|
|
const res = response.data
|
|
const res = response.data
|
|
if (res.isSuccess) {
|
|
if (res.isSuccess) {
|
|
@@ -207,8 +226,8 @@ export default {
|
|
return true
|
|
return true
|
|
})
|
|
})
|
|
},
|
|
},
|
|
- update () {
|
|
|
|
- areaMgrApi.update(this.tenant)
|
|
|
|
|
|
+ update (formData) {
|
|
|
|
+ areaMgrApi.update(formData)
|
|
.then((response) => {
|
|
.then((response) => {
|
|
const res = response.data
|
|
const res = response.data
|
|
if (res.isSuccess) {
|
|
if (res.isSuccess) {
|
|
@@ -218,9 +237,9 @@ export default {
|
|
type: 'success'
|
|
type: 'success'
|
|
})
|
|
})
|
|
// 通知列表
|
|
// 通知列表
|
|
- this.$emit("success");
|
|
|
|
|
|
+ this.$emit("success")
|
|
// 通知列表-并关闭弹出框
|
|
// 通知列表-并关闭弹出框
|
|
- this.$emit("close");
|
|
|
|
|
|
+ this.$emit("close")
|
|
}
|
|
}
|
|
}).finally(() => {
|
|
}).finally(() => {
|
|
this.confirmDisabled = false
|
|
this.confirmDisabled = false
|