Browse Source

代码整洁度 调整

feature/syp_points
zhangyongzhangyong 6 years ago
parent
commit
911c15b9dd
  1. 268
      src/views/modules/case/typicalcase-add-or-update.vue
  2. 16
      src/views/modules/case/typicalcase-detail.vue
  3. 2
      src/views/modules/heart/actbanner.vue
  4. 2
      src/views/modules/heart/actinfo-list.vue
  5. 4
      src/views/modules/heart/address-check.vue

268
src/views/modules/case/typicalcase-add-or-update.vue

@ -124,11 +124,6 @@ export default {
// //
this.hideUpload = false this.hideUpload = false
this.uploadUrl = `${window.SITE_CONFIG['apiURL']}/oss/file/upload?token=${Cookies.get('token')}` this.uploadUrl = `${window.SITE_CONFIG['apiURL']}/oss/file/upload?token=${Cookies.get('token')}`
// if (this.quillEditor) {
// this.quillEditor.deleteText(0, this.quillEditor.getLength())
// } else {
// this.quillEditorHandle()
// }
// end // end
}) })
}, },
@ -145,36 +140,36 @@ export default {
loading: false, loading: false,
isAble: false, isAble: false,
editorOption: { editorOption: {
placeholder: 'Please enter it here...', placeholder: 'Please enter it here...',
modules:{ modules: {
toolbar:{ toolbar: {
container: [ container: [
['bold', 'italic', 'underline', 'strike'],// 线线 ['bold', 'italic', 'underline', 'strike'], // 线线
['blockquote'],// ['blockquote'], //
[{ 'header': 1 }, { 'header': 2 }],// 12 [{ 'header': 1 }, { 'header': 2 }], // 12
[{ 'list': 'ordered'}, { 'list': 'bullet' }],// [{ 'list': 'ordered' }, { 'list': 'bullet' }], //
[{ 'indent': '-1'}, { 'indent': '+1' }],// [{ 'indent': '-1' }, { 'indent': '+1' }], //
[{ 'direction': 'rtl' }],// [{ 'direction': 'rtl' }], //
[{ 'size': ['small', false, 'large', 'huge'] }],// [{ 'size': ['small', false, 'large', 'huge'] }], //
[{ 'header': [1, 2, 3, 4, 5, 6, false] }],// [{ 'header': [1, 2, 3, 4, 5, 6, false] }], //
[{ 'color': [] }, { 'background': [] }],// [{ 'color': [] }, { 'background': [] }], //
[{ 'font': [] }],// [{ 'font': [] }], //
[{ 'align': [] }],// [{ 'align': [] }], //
['clean'],// ['clean'], //
['image']// ['image'] //
], ],
handlers: { handlers: {
'image': function (value) { 'image': function (value) {
if (value) { if (value) {
// Element-uiinput // Element-uiinput
document.querySelector('#quill-upload input').click() document.querySelector('#quill-upload input').click()
} else { } else {
this.quill.format('image', false); this.quill.format('image', false)
} }
}
}
} }
}
} }
}
}, },
uploadUrl: '', uploadUrl: '',
dataForm: { dataForm: {
@ -186,7 +181,7 @@ export default {
typicalAbstract: '', typicalAbstract: '',
dynamicItem: [] dynamicItem: []
}, },
imgIndex: 0, imgIndex: 0,
requiredFlag: false requiredFlag: false
} }
}, },
@ -206,95 +201,92 @@ export default {
typicalAbstract: [ typicalAbstract: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } { required: true, message: this.$t('validate.required'), trigger: 'blur' }
], ],
associatedId: [ associatedId: [
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } { required: true, message: this.$t('validate.required'), trigger: 'blur' }
] ]
} }
} }
}, },
methods: { methods: {
onEditorFocus(index) { onEditorFocus (index) {
this.imgIndex = index this.imgIndex = index
}, },
handleChange (file) { handleChange (file) {
this.beforeAvatarUpload(file) this.beforeAvatarUpload(file)
}, },
back () { back () {
this.$parent.selectComponent = 'CaseInfoList' this.$parent.selectComponent = 'CaseInfoList'
this.$router.push({ path: '/case-typicalcase'}) this.$router.push({ path: '/case-typicalcase' })
}, },
connectResponse (connectResponse) { connectResponse (connectResponse) {
// //
this.dataForm.dynamicItem[connectResponse.caseIndex].caseSource = connectResponse.allDeptNames this.dataForm.dynamicItem[connectResponse.caseIndex].caseSource = connectResponse.allDeptNames
// //
this.dataForm.dynamicItem[connectResponse.caseIndex].associatedType = connectResponse.associatedType this.dataForm.dynamicItem[connectResponse.caseIndex].associatedType = connectResponse.associatedType
// //
if (connectResponse.associatedType == 0) { if (connectResponse.associatedType == 0) {
this.dataForm.dynamicItem[connectResponse.caseIndex].contentDescription = connectResponse.issueContent this.dataForm.dynamicItem[connectResponse.caseIndex].contentDescription = connectResponse.issueContent
} else if (connectResponse.associatedType == 1) { } else if (connectResponse.associatedType == 1) {
this.dataForm.dynamicItem[connectResponse.caseIndex].contentDescription = connectResponse.itemContent this.dataForm.dynamicItem[connectResponse.caseIndex].contentDescription = connectResponse.itemContent
} else if (connectResponse.associatedType == 2) { } else if (connectResponse.associatedType == 2) {
this.dataForm.dynamicItem[connectResponse.caseIndex].contentDescription = connectResponse.topicContent this.dataForm.dynamicItem[connectResponse.caseIndex].contentDescription = connectResponse.topicContent
} }
// //
this.dataForm.dynamicItem[connectResponse.caseIndex].category = connectResponse.categoryName this.dataForm.dynamicItem[connectResponse.caseIndex].category = connectResponse.categoryName
// ID // ID
this.dataForm.dynamicItem[connectResponse.caseIndex].associatedId = connectResponse.id this.dataForm.dynamicItem[connectResponse.caseIndex].associatedId = connectResponse.id
// Id // Id
this.dataForm.dynamicItem[connectResponse.caseIndex].sourceGridId = connectResponse.gridId this.dataForm.dynamicItem[connectResponse.caseIndex].sourceGridId = connectResponse.gridId
// //
if (connectResponse.associatedType == 0) { if (connectResponse.associatedType == 0) {
this.dataForm.dynamicItem[connectResponse.caseIndex].publisherName = connectResponse.nickName this.dataForm.dynamicItem[connectResponse.caseIndex].publisherName = connectResponse.nickName
} else if (connectResponse.associatedType == 1) { } else if (connectResponse.associatedType == 1) {
this.dataForm.dynamicItem[connectResponse.caseIndex].publisherName = connectResponse.nickName this.dataForm.dynamicItem[connectResponse.caseIndex].publisherName = connectResponse.nickName
} else if (connectResponse.associatedType == 2) { } else if (connectResponse.associatedType == 2) {
this.dataForm.dynamicItem[connectResponse.caseIndex].publisherName = connectResponse.nickname this.dataForm.dynamicItem[connectResponse.caseIndex].publisherName = connectResponse.nickname
} }
// //
this.dataForm.dynamicItem[connectResponse.caseIndex].publisherHeader = connectResponse.userFace this.dataForm.dynamicItem[connectResponse.caseIndex].publisherHeader = connectResponse.userFace
// //
if (connectResponse.associatedType == 0) { if (connectResponse.associatedType == 0) {
this.dataForm.dynamicItem[connectResponse.caseIndex].content = connectResponse.issueContent this.dataForm.dynamicItem[connectResponse.caseIndex].content = connectResponse.issueContent
} else if (connectResponse.associatedType == 1) { } else if (connectResponse.associatedType == 1) {
this.dataForm.dynamicItem[connectResponse.caseIndex].content = connectResponse.itemContent this.dataForm.dynamicItem[connectResponse.caseIndex].content = connectResponse.itemContent
} else if (connectResponse.associatedType == 2) { } else if (connectResponse.associatedType == 2) {
this.dataForm.dynamicItem[connectResponse.caseIndex].content = connectResponse.topicContent this.dataForm.dynamicItem[connectResponse.caseIndex].content = connectResponse.topicContent
} }
if (connectResponse.associatedType == 0) { if (connectResponse.associatedType == 0) {
this.dataForm.dynamicItem[connectResponse.caseIndex].releaseTime = connectResponse.distributeTime this.dataForm.dynamicItem[connectResponse.caseIndex].releaseTime = connectResponse.distributeTime
} else if (connectResponse.associatedType == 1) { } else if (connectResponse.associatedType == 1) {
this.dataForm.dynamicItem[connectResponse.caseIndex].releaseTime = connectResponse.distributeTime this.dataForm.dynamicItem[connectResponse.caseIndex].releaseTime = connectResponse.distributeTime
} else if (connectResponse.associatedType == 2) { } else if (connectResponse.associatedType == 2) {
this.dataForm.dynamicItem[connectResponse.caseIndex].releaseTime = connectResponse.createdTime this.dataForm.dynamicItem[connectResponse.caseIndex].releaseTime = connectResponse.createdTime
} }
this.dataForm.dynamicItem[connectResponse.caseIndex].expressingAttitude = connectResponse.participantsNum this.dataForm.dynamicItem[connectResponse.caseIndex].expressingAttitude = connectResponse.participantsNum
this.requiredFlag = true
this.requiredFlag = true
}, },
addConnect(index){ addConnect (index) {
this.connectListVisible = true this.connectListVisible = true
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.connectList.init(index) this.$refs.connectList.init(index)
}) })
}, },
// //
addItem () { addItem () {
this.dataForm.dynamicItem.push({ this.dataForm.dynamicItem.push({
caseSource: '', caseSource: '',
associatedType: '', associatedType: '',
contentDescription: '', contentDescription: '',
category: '', category: '',
associatedId: '', associatedId: '',
sourceGridId: '', sourceGridId: '',
publisherName: '', publisherName: '',
publisherHeader: '', publisherHeader: '',
releaseTime: '', releaseTime: '',
content: '', content: '',
expressingAttitude: '' expressingAttitude: ''
}) })
}, },
// //
quillEditorHandle () { quillEditorHandle () {
this.quillEditor = new Quill('#J_quillEditor', { this.quillEditor = new Quill('#J_quillEditor', {
@ -323,11 +315,9 @@ export default {
return false return false
} }
}, },
// () // ()
uploadSuccessHandle (res) { uploadSuccessHandle (res) {
let quill = this.$refs.myQuillEditor[this.imgIndex].quill; let quill = this.$refs.myQuillEditor[this.imgIndex].quill
console.log(quill)
if (res.code !== 0) { if (res.code !== 0) {
return this.$message.error(res.msg) return this.$message.error(res.msg)
} }
@ -340,22 +330,22 @@ export default {
this.$nextTick(() => { this.$nextTick(() => {
this.$refs['dataForm'].resetFields() this.$refs['dataForm'].resetFields()
if (this.dataForm.id) { if (this.dataForm.id) {
this.getInfo() this.getInfo()
} }
}) })
}, },
// //
getInfo () { getInfo () {
this.$http.get(`/cloudAnalysis/typicalcase/${this.dataForm.id}`).then(({ data: res }) => { this.$http.get(`/cloudAnalysis/typicalcase/${this.dataForm.id}`).then(({ data: res }) => {
if (res.code !== 0) { if (res.code !== 0) {
return this.$message.error(res.msg) return this.$message.error(res.msg)
} }
this.dataForm = { this.dataForm = {
...this.dataForm, ...this.dataForm,
...res.data ...res.data
} }
}).catch(() => {}) }).catch(() => {})
this.requiredFlag = true this.requiredFlag = true
}, },
// //
dataFormSubmitHandle: debounce(function () { dataFormSubmitHandle: debounce(function () {
@ -363,19 +353,19 @@ export default {
if (!valid) { if (!valid) {
return false return false
} }
if(!this.requiredFlag){ if (!this.requiredFlag) {
alert("请关联案例!") alert('请关联案例!')
return false return false
} }
for(let item of this.dataForm.dynamicItem) { for (let item of this.dataForm.dynamicItem) {
if(item.associatedId != '') { if (item.associatedId != '') {
this.dataForm.caseNumber = this.dataForm.caseNumber + 1 this.dataForm.caseNumber = this.dataForm.caseNumber + 1
}
} }
this.isAble = true; }
this.isAble = true
this.$http[!this.dataForm.id ? 'post' : 'put']('/cloudAnalysis/typicalcase', this.dataForm).then(({ data: res }) => { this.$http[!this.dataForm.id ? 'post' : 'put']('/cloudAnalysis/typicalcase', this.dataForm).then(({ data: res }) => {
if (res.code !== 0) { if (res.code !== 0) {
this.isAble = false; this.isAble = false
return this.$message.error(res.msg) return this.$message.error(res.msg)
} }
this.$message({ this.$message({
@ -383,23 +373,23 @@ export default {
type: 'success', type: 'success',
duration: 500, duration: 500,
onClose: () => { onClose: () => {
this.isAble = false; this.isAble = false
this.back() this.back()
} }
}) })
}).catch(() => {}) }).catch(() => {})
}) })
}, 1000, { 'leading': true, 'trailing': false }), }, 1000, { 'leading': true, 'trailing': false }),
handleAvatarActSuccess (res, file) { handleAvatarActSuccess (res, file) {
this.loading = false this.loading = false
this.dataForm.mainPicture = res.data.url this.dataForm.mainPicture = res.data.url
}, },
beforeAvatarUpload (file) { beforeAvatarUpload (file) {
this.loading = true this.loading = true
}, },
handelError () { handelError () {
this.loading = false this.loading = false
}, }
} }
} }
</script> </script>

16
src/views/modules/case/typicalcase-detail.vue

@ -77,18 +77,18 @@ export default {
getDataListURL: '/cloudAnalysis/typicalcase/detail' + '/' + this.$route.query.id getDataListURL: '/cloudAnalysis/typicalcase/detail' + '/' + this.$route.query.id
}, },
dataForm: { dataForm: {
id: '', id: '',
caseTitle: '', caseTitle: '',
caseNumber: 0, caseNumber: 0,
mainPicture: '', mainPicture: '',
typicalAbstract: '', typicalAbstract: '',
dynamicItem: [] dynamicItem: []
} }
} }
}, },
mounted () { mounted () {
this.dataForm.id = this.$route.query.id this.dataForm.id = this.$route.query.id
this.init() this.init()
}, },
methods: { methods: {
back () { back () {

2
src/views/modules/heart/actbanner.vue

@ -63,7 +63,7 @@
<script> <script>
import mixinViewModule from '@/mixins/view-module' import mixinViewModule from '@/mixins/view-module'
import AddOrUpdate from './actbanner-add-or-update' import AddOrUpdate from './actbanner-add-or-update'
import {debounce} from 'lodash' import { debounce } from 'lodash'
export default { export default {
mixins: [mixinViewModule], mixins: [mixinViewModule],
data () { data () {

2
src/views/modules/heart/actinfo-list.vue

@ -144,7 +144,7 @@ export default {
addAction () { addAction () {
this.$parent.selectComponent = 'ActInfoAdd' this.$parent.selectComponent = 'ActInfoAdd'
this.$router.push( this.$router.push(
{ path: '/heart-actinfo'} { path: '/heart-actinfo' }
) )
}, },
joinManage (id) { joinManage (id) {

4
src/views/modules/heart/address-check.vue

@ -30,8 +30,8 @@ export default {
visible: false, visible: false,
dataForm: { dataForm: {
address: '', address: '',
longitude: 0,// longitude: 0, //
latitude: 0,// latitude: 0, //
city: '' city: ''
} }
} }

Loading…
Cancel
Save