Browse Source

Merge branch 'release'

master
jiangyy 4 years ago
parent
commit
6a71f717eb
  1. 5
      src/api/index.js
  2. 1
      src/utils/convert.js
  3. 786
      src/views/form/editor/index.vue
  4. 2
      src/views/form/index.vue
  5. 137
      src/views/form/publish/index.vue
  6. 119
      src/views/form/statistics/analysis.vue
  7. 174
      src/views/form/statistics/item.vue
  8. 35
      src/views/form/statistics/list.vue
  9. 4
      src/views/form/statistics/public.vue

5
src/api/index.js

@ -69,6 +69,7 @@ api.interceptors.response.use(
*/ */
let errCodes = [500, 405, 403] let errCodes = [500, 405, 403]
const res = response.data const res = response.data
if (res.code === 0) { if (res.code === 0) {
return Promise.resolve(res) return Promise.resolve(res)
} else if (errCodes.includes(res.code)) { } else if (errCodes.includes(res.code)) {
@ -112,7 +113,7 @@ api.interceptors.response.use(
result = await api.request(response.config) result = await api.request(response.config)
}) })
return Promise.resolve(result) return Promise.resolve(result)
}else { } else if (res.code ===8000||res.code>8000) {
Message({ Message({
message: res.msg || 'Error', message: res.msg || 'Error',
type: 'error', type: 'error',
@ -120,7 +121,7 @@ api.interceptors.response.use(
}) })
return Promise.reject(res) return Promise.reject(res)
} }
// return Promise.resolve(res) return Promise.resolve(res)
}, },
error => { error => {
Message({ Message({

1
src/utils/convert.js

@ -16,6 +16,7 @@ import {
* @param item * @param item
*/ */
export function formItemConvertData(item, projectKey) { export function formItemConvertData(item, projectKey) {
let data = { let data = {
'itemKey': item.__config__.name, 'itemKey': item.__config__.name,
'moduleType': item.__config__.moduleType, 'moduleType': item.__config__.moduleType,

786
src/views/form/editor/index.vue

@ -1,128 +1,113 @@
<template> <template>
<div class="form-edit-container"> <div class="form-edit-container">
<div class="left-board"> <div class="left-board">
<el-scrollbar class="left-scrollbar"> <el-scrollbar class="left-scrollbar">
<div class="components-list"> <div class="components-list">
<div v-for="(item, listIndex) in leftComponents" <div v-for="(item, listIndex) in leftComponents"
:key="listIndex" :key="listIndex">
> <div class="components-title">
<div class="components-title"> <svg-icon name="component" />
<svg-icon name="component" /> {{ item.title }}
{{ item.title }} </div>
</div> <draggable :clone="cloneComponent"
<draggable :clone="cloneComponent" :group="{ name: 'componentsGroup', pull: 'clone', put: false }"
:group="{ name: 'componentsGroup', pull: 'clone', put: false }" :list="item.list"
:list="item.list" :sort="false"
:sort="false" class="components-draggable"
class="components-draggable" draggable=".components-item"
draggable=".components-item" @end="onEnd">
@end="onEnd" <div v-for="(element, index) in item.list"
> :key="index"
<div v-for="(element, index) in item.list" class="components-item"
:key="index" @click="addComponent(element)">
class="components-item" <div class="components-body">
@click="addComponent(element)" <svg-icon :name="element.__config__.tagIcon" />
> {{ element.__config__.label }}
<div class="components-body">
<svg-icon :name="element.__config__.tagIcon" />
{{ element.__config__.label }}
</div>
</div>
</draggable>
</div>
</div> </div>
</el-scrollbar> </div>
</draggable>
</div>
</div> </div>
<div class="center-board"> </el-scrollbar>
<el-scrollbar class="center-scrollbar"> </div>
<el-row v-if="formConf" <div class="center-board">
:gutter="formConf.gutter" <el-scrollbar class="center-scrollbar">
class="center-board-row" <el-row v-if="formConf"
> :gutter="formConf.gutter"
<el-row align="middle" class="center-board-row">
justify="center" <el-row align="middle"
type="flex" justify="center"
> type="flex">
<el-col class="form-head-title"> <el-col class="form-head-title">
<h4 class="form-name-text" <h4 class="form-name-text"
contenteditable="true" contenteditable="true"
@blur="(event)=>{ @blur="(event)=>{
this.formConf.title=event.target.innerText; this.formConf.title=event.target.innerText;
this.saveProjectInfo()}" this.saveProjectInfo()}">
> {{ formConf.title }}
{{ formConf.title }} </h4>
</h4> </el-col>
</el-col> </el-row>
</el-row> <el-row align="middle"
<el-row align="middle" justify="center"
justify="center" type="flex">
type="flex" <el-col class="form-head-desc">
> <Tinymce v-if="editDescription"
<el-col class="form-head-desc"> v-model="formConf.description"
<Tinymce v-if="editDescription" placeholder="请输入表单描述"
v-model="formConf.description" @blur="editDescription=false"
placeholder="请输入表单描述" @input="saveProjectInfo" />
@blur="editDescription=false" <div v-else
@input="saveProjectInfo" class="form-name-text"
/> @click="editDescription=true"
<div v-else v-html="formConf.description" />
class="form-name-text" <!-- <p class="form-name-text" contenteditable="true"-->
@click="editDescription=true" <!-- @blur="(event)=>{-->
v-html="formConf.description" <!-- formConf.description=event.target.innerText;-->
/> <!-- this.saveProjectInfo()}">-->
<!-- <p class="form-name-text" contenteditable="true"--> <!-- {{ formConf.description }}-->
<!-- @blur="(event)=>{--> <!-- </p>-->
<!-- formConf.description=event.target.innerText;--> </el-col>
<!-- this.saveProjectInfo()}">--> </el-row>
<!-- {{ formConf.description }}--> <el-divider class="form-head-divider" />
<!-- </p>--> <el-form :disabled="formConf.disabled"
</el-col> :label-position="formConf.labelPosition"
</el-row> :label-width="formConf.labelWidth + 'px'"
<el-divider class="form-head-divider" /> :size="formConf.size">
<el-form :disabled="formConf.disabled" <draggable :animation="340"
:label-position="formConf.labelPosition" :list="drawingList"
:label-width="formConf.labelWidth + 'px'" class="drawing-board"
:size="formConf.size" group="componentsGroup"
> @end="onItemEnd">
<draggable :animation="340" <draggable-item v-for="(item, index) in drawingList"
:list="drawingList" :key="item.renderKey"
class="drawing-board" :active-id="activeId"
group="componentsGroup" :current-item="item"
@end="onItemEnd" :drawing-list="drawingList"
> :form-conf="formConf"
<draggable-item v-for="(item, index) in drawingList" :index="index"
:key="item.renderKey" @activeItem="activeFormItem"
:active-id="activeId" @changeLabel="changeLabel"
:current-item="item" @copyItem="drawingItemCopy"
:drawing-list="drawingList" @deleteItem="drawingItemDelete" />
:form-conf="formConf" </draggable>
:index="index" <div v-show="!drawingList.length"
@activeItem="activeFormItem" class="empty-info">
@changeLabel="changeLabel" <img style="width: 20%"
@copyItem="drawingItemCopy" src="@/assets/images/form-bg.png">
@deleteItem="drawingItemDelete" <p>从左侧拖入或点选组件进行表单设计</p>
/> </div>
</draggable> </el-form>
<div v-show="!drawingList.length" </el-row>
class="empty-info" </el-scrollbar>
>
<img style="width: 20%"
src="@/assets/images/form-bg.png"
>
<p>从左侧拖入或点选组件进行表单设计</p>
</div>
</el-form>
</el-row>
</el-scrollbar>
</div>
<right-panel v-if="activeData"
:active-data="activeData"
:form-conf="formConf"
:show-field="!!drawingList.length"
@tag-change="tagChange"
@data-change="updateProjectItemInfo"
/>
</div> </div>
<right-panel v-if="activeData"
:active-data="activeData"
:form-conf="formConf"
:show-field="!!drawingList.length"
@tag-change="tagChange"
@data-change="updateProjectItemInfo" />
</div>
</template> </template>
<script> <script>
@ -131,12 +116,12 @@ import { debounce } from 'throttle-debounce'
import RightPanel from './RightPanel' import RightPanel from './RightPanel'
import { import {
assistComponents, assistComponents,
formConf, formConf,
imageComponents, imageComponents,
inputComponents, inputComponents,
personalInfoComponents, personalInfoComponents,
selectComponents selectComponents
} from '@/components/generator/config' } from '@/components/generator/config'
import { deepClone } from '@/utils' import { deepClone } from '@/utils'
import { dbDataConvertForItemJson, formItemConvertData } from '@/utils/convert' import { dbDataConvertForItemJson, formItemConvertData } from '@/utils/convert'
@ -149,291 +134,292 @@ let tempActiveData
let idGlobal let idGlobal
export default { export default {
components: { components: {
draggable, draggable,
RightPanel, RightPanel,
DraggableItem DraggableItem
}, },
data() { data () {
return { return {
idGlobal, idGlobal,
formConf: null, formConf: null,
editDescription: true, editDescription: true,
inputComponents, inputComponents,
selectComponents, selectComponents,
labelWidth: 100, labelWidth: 100,
drawingList: drawingDefalut, drawingList: drawingDefalut,
drawingData: {}, drawingData: {},
activeId: drawingDefalut.length != 0 ? drawingDefalut[0].formId : 0, activeId: drawingDefalut.length != 0 ? drawingDefalut[0].formId : 0,
formData: {}, formData: {},
dialogVisible: false, dialogVisible: false,
generateConf: null, generateConf: null,
showFileName: false, showFileName: false,
activeData: drawingDefalut ? drawingDefalut[0] : null, activeData: drawingDefalut ? drawingDefalut[0] : null,
saveDrawingListDebounce: debounce(340, saveDrawingList), saveDrawingListDebounce: debounce(340, saveDrawingList),
saveIdGlobalDebounce: debounce(340, saveIdGlobal), saveIdGlobalDebounce: debounce(340, saveIdGlobal),
projectKey: null, projectKey: null,
leftComponents: [ leftComponents: [
{ {
title: '联系人组件', title: '联系人组件',
list: personalInfoComponents list: personalInfoComponents
}, },
{ {
title: '输入型组件', title: '输入型组件',
list: inputComponents list: inputComponents
},
{
title: '图片型组件',
list: imageComponents
},
{
title: '辅助型组件',
list: assistComponents
},
{
title: '选择型组件',
list: selectComponents
}
]
}
},
computed: {},
watch: {
// eslint-disable-next-line func-names
'activeData.__config__.label': function(val, oldVal) {
if (
this.activeData.placeholder === undefined
|| !this.activeData.__config__.tag
|| oldActiveId !== this.activeId
) {
return
}
this.activeData.placeholder = this.activeData.placeholder.replace(oldVal, '') + val
}, },
activeId: { {
handler(val) { title: '图片型组件',
oldActiveId = val list: imageComponents
},
immediate: true
}, },
drawingList: { {
handler(val) { title: '辅助型组件',
this.saveDrawingListDebounce(val, this.projectKey) list: assistComponents
if (val.length === 0) this.idGlobal = 100
},
deep: true
}, },
idGlobal: { {
handler(val) { title: '选择型组件',
if (val) { list: selectComponents
this.saveIdGlobalDebounce(val, this.projectKey)
}
},
immediate: true
} }
]
}
},
computed: {},
watch: {
// eslint-disable-next-line func-names
'activeData.__config__.label': function (val, oldVal) {
if (
this.activeData.placeholder === undefined
|| !this.activeData.__config__.tag
|| oldActiveId !== this.activeId
) {
return
}
this.activeData.placeholder = this.activeData.placeholder.replace(oldVal, '') + val
}, },
mounted() { activeId: {
handler (val) {
// oldActiveId = val
this.formConf = JSON.parse(JSON.stringify(formConf)) },
// key immediate: true
this.projectKey = this.$route.query.key
console.log('编辑')
console.log(this.projectKey)
//
this.queryProjectItems()
//
this.$api.get(`${process.env.VUE_APP_API_ROOT_TDUCK}/user/project/${this.projectKey}`).then(res => {
this.formConf.title = res.data.name
this.formConf.description = res.data.describe
})
// Id
this.$api.get(`${process.env.VUE_APP_API_ROOT_TDUCK}/user/project/item/max-form-id`, { params: { key: this.projectKey } }).then(res => {
this.idGlobal = res.data ? res.data : 100
})
}, },
methods: { drawingList: {
saveProjectInfo: debounce(430, true, function() { handler (val) {
this.$api.post(`${process.env.VUE_APP_API_ROOT_TDUCK}/user/project/update`, { this.saveDrawingListDebounce(val, this.projectKey)
'key': this.projectKey, if (val.length === 0) this.idGlobal = 100
'name': this.formConf.title, },
'describe': this.formConf.description deep: true
}).then(() => { },
idGlobal: {
handler (val) {
if (val) {
this.saveIdGlobalDebounce(val, this.projectKey)
}
},
immediate: true
}
},
mounted () {
}) //
}), this.formConf = JSON.parse(JSON.stringify(formConf))
updateProjectItemInfo(val) { // key
let data = formItemConvertData(val, this.projectKey) this.projectKey = this.$route.query.key
this.$api.post(`${process.env.VUE_APP_API_ROOT_TDUCK}/user/project/item/update`, data).then(() => { console.log('编辑')
console.log(this.projectKey)
//
this.queryProjectItems()
//
this.$api.get(`${process.env.VUE_APP_API_ROOT_TDUCK}/user/project/${this.projectKey}`).then(res => {
this.formConf.title = res.data.name
this.formConf.description = res.data.describe
})
// Id
this.$api.get(`${process.env.VUE_APP_API_ROOT_TDUCK}/user/project/item/max-form-id`, { params: { key: this.projectKey } }).then(res => {
this.idGlobal = res.data ? res.data : 100
})
},
methods: {
saveProjectInfo: debounce(430, true, function () {
this.$api.post(`${process.env.VUE_APP_API_ROOT_TDUCK}/user/project/update`, {
'key': this.projectKey,
'name': this.formConf.title,
'describe': this.formConf.description
}).then(() => {
}) })
}, }),
deleteProjectItemInfo(val) { updateProjectItemInfo (val) {
let data = formItemConvertData(val, this.projectKey) let data = formItemConvertData(val, this.projectKey)
this.$api.post(`${process.env.VUE_APP_API_ROOT_TDUCK}/user/project/item/delete`, data).then(() => { this.$api.post(`${process.env.VUE_APP_API_ROOT_TDUCK}/user/project/item/update`, data).then(() => {
}) })
}, },
async saveProjectItemInfo(item) { deleteProjectItemInfo (val) {
let isSuccess = false let data = formItemConvertData(val, this.projectKey)
let params = formItemConvertData(item, this.projectKey) this.$api.post(`${process.env.VUE_APP_API_ROOT_TDUCK}/user/project/item/delete`, data).then(() => {
let pItem = item
await this.$api.post(`${process.env.VUE_APP_API_ROOT_TDUCK}/user/project/item/create`, params).then(res => { })
pItem.sort = res.data.sort },
isSuccess = true async saveProjectItemInfo (item) {
}) let isSuccess = false
// let params = formItemConvertData(item, this.projectKey)
if (item.typeId === 'PAGINATION') { console.log(params)
this.updatePaginationList() let pItem = item
} await this.$api.post(`${process.env.VUE_APP_API_ROOT_TDUCK}/user/project/item/create`, params).then(res => {
return isSuccess pItem.sort = res.data.sort
}, isSuccess = true
updatePaginationList() { })
// //
const length = this.drawingList.filter(item => item.typeId === 'PAGINATION').length if (item.typeId === 'PAGINATION') {
let curr = 1 this.updatePaginationList()
this.drawingList.forEach((item, index) => { }
if (item.typeId === 'PAGINATION') { return isSuccess
item.totalPageNum = length },
item.currPageNum = curr++ updatePaginationList () {
this.$set(this.drawingList, index, item) //
} const length = this.drawingList.filter(item => item.typeId === 'PAGINATION').length
}) let curr = 1
}, this.drawingList.forEach((item, index) => {
queryProjectItems() { if (item.typeId === 'PAGINATION') {
this.$api.get(`${process.env.VUE_APP_API_ROOT_TDUCK}/user/project/item/list`, { params: { key: this.projectKey } }).then(res => { item.totalPageNum = length
this.drawingList = res.data.map(item => dbDataConvertForItemJson(item)) item.currPageNum = curr++
// this.$set(this.drawingList, index, item)
this.updatePaginationList() }
}) })
}, },
activeFormItem(currentItem) { queryProjectItems () {
this.activeData = currentItem this.$api.get(`${process.env.VUE_APP_API_ROOT_TDUCK}/user/project/item/list`, { params: { key: this.projectKey } }).then(res => {
this.activeId = currentItem.__config__.formId this.drawingList = res.data.map(item => dbDataConvertForItemJson(item))
}, //
changeLabel(currentItem, value) { this.updatePaginationList()
console.log(currentItem) })
console.log(value) },
}, activeFormItem (currentItem) {
onEnd(obj) { this.activeData = currentItem
if (obj.from !== obj.to) { this.activeId = currentItem.__config__.formId
this.activeData = tempActiveData },
this.activeId = this.idGlobal changeLabel (currentItem, value) {
this.saveProjectItemInfo(tempActiveData).then(() => { console.log(currentItem)
this.onItemEnd(obj) console.log(value)
}) },
} onEnd (obj) {
}, if (obj.from !== obj.to) {
onItemEnd(obj) { this.activeData = tempActiveData
let params = { 'projectKey': this.projectKey } this.activeId = this.idGlobal
if (this.drawingList[obj.newIndex - 1]) { this.saveProjectItemInfo(tempActiveData).then(() => {
let sort1 = this.drawingList[obj.newIndex - 1].sort this.onItemEnd(obj)
params.beforePosition = sort1 })
} }
if (this.drawingList[obj.newIndex + 1]) { },
let sort2 = this.drawingList[obj.newIndex + 1].sort onItemEnd (obj) {
params.afterPosition = sort2 let params = { 'projectKey': this.projectKey }
} if (this.drawingList[obj.newIndex - 1]) {
params.formItemId = this.drawingList[obj.newIndex].__config__.formId let sort1 = this.drawingList[obj.newIndex - 1].sort
if (params.beforePosition || params.afterPosition) { params.beforePosition = sort1
this.$api.post(`${process.env.VUE_APP_API_ROOT_TDUCK}/user/project/item/sort`, params).then(res => { }
this.drawingList[obj.newIndex].sort = res.data.sort if (this.drawingList[obj.newIndex + 1]) {
}) let sort2 = this.drawingList[obj.newIndex + 1].sort
} params.afterPosition = sort2
}, }
addComponent(item) { params.formItemId = this.drawingList[obj.newIndex].__config__.formId
const clone = this.cloneComponent(item) if (params.beforePosition || params.afterPosition) {
this.saveProjectItemInfo(clone) this.$api.post(`${process.env.VUE_APP_API_ROOT_TDUCK}/user/project/item/sort`, params).then(res => {
this.drawingList.push(clone) this.drawingList[obj.newIndex].sort = res.data.sort
this.activeFormItem(clone) })
}, }
cloneComponent(origin) { },
const clone = deepClone(origin) addComponent (item) {
const config = clone.__config__ const clone = this.cloneComponent(item)
config.span = this.formConf.span // span this.saveProjectItemInfo(clone)
this.createIdAndKey(clone) this.drawingList.push(clone)
clone.placeholder !== undefined && (clone.placeholder += config.label) this.activeFormItem(clone)
tempActiveData = clone },
return tempActiveData cloneComponent (origin) {
}, const clone = deepClone(origin)
createIdAndKey(item) { const config = clone.__config__
const config = item.__config__ config.span = this.formConf.span // span
config.formId = ++this.idGlobal this.createIdAndKey(clone)
config.renderKey = `${config.formId}${+new Date()}` // renderKey clone.placeholder !== undefined && (clone.placeholder += config.label)
if (config.layout === 'colFormItem') { tempActiveData = clone
item.__vModel__ = `field${this.idGlobal}` return tempActiveData
} else if (config.layout === 'rowFormItem') { },
config.componentName = `row${this.idGlobal}` createIdAndKey (item) {
!Array.isArray(config.children) && (config.children = []) const config = item.__config__
delete config.label // rowFormItemlabel config.formId = ++this.idGlobal
} config.renderKey = `${config.formId}${+new Date()}` // renderKey
if (Array.isArray(config.children)) { if (config.layout === 'colFormItem') {
config.children = config.children.map(childItem => this.createIdAndKey(childItem)) item.__vModel__ = `field${this.idGlobal}`
} } else if (config.layout === 'rowFormItem') {
return item config.componentName = `row${this.idGlobal}`
}, !Array.isArray(config.children) && (config.children = [])
empty() { delete config.label // rowFormItemlabel
this.$confirm('确定要清空所有组件吗?', '提示', { type: 'warning' }) }
.then( if (Array.isArray(config.children)) {
() => { config.children = config.children.map(childItem => this.createIdAndKey(childItem))
this.drawingList = [] }
this.idGlobal = 100 return item
} },
) empty () {
}, this.$confirm('确定要清空所有组件吗?', '提示', { type: 'warning' })
drawingItemCopy(item, list) { .then(
let clone = deepClone(item) () => {
clone = this.createIdAndKey(clone) this.drawingList = []
list.push(clone) this.idGlobal = 100
this.activeFormItem(clone) }
this.saveProjectItemInfo(clone) )
}, },
drawingItemDelete(index, list) { drawingItemCopy (item, list) {
let item = list[index] let clone = deepClone(item)
list.splice(index, 1) clone = this.createIdAndKey(clone)
this.$nextTick(() => { list.push(clone)
const len = this.drawingList.length this.activeFormItem(clone)
if (len) { this.saveProjectItemInfo(clone)
this.activeFormItem(this.drawingList[len - 1]) },
} drawingItemDelete (index, list) {
}) let item = list[index]
this.deleteProjectItemInfo(item) list.splice(index, 1)
}, this.$nextTick(() => {
tagChange(newTag) { const len = this.drawingList.length
newTag = this.cloneComponent(newTag) if (len) {
const config = newTag.__config__ this.activeFormItem(this.drawingList[len - 1])
newTag.__vModel__ = this.activeData.__vModel__
newTag.sort = this.activeData.sort
config.formId = this.activeId
config.span = this.activeData.__config__.span
this.activeData.__config__.tag = config.tag
this.activeData.__config__.tagIcon = config.tagIcon
this.activeData.__config__.document = config.document
this.activeData.typeId = newTag.typeId
if (typeof this.activeData.__config__.defaultValue === typeof config.defaultValue) {
config.defaultValue = this.activeData.__config__.defaultValue
}
Object.keys(newTag)
.forEach(key => {
if (this.activeData[key] !== undefined) {
newTag[key] = this.activeData[key]
}
})
this.activeData = newTag
this.updateProjectItemInfo(newTag)
this.updateDrawingList(newTag, this.drawingList)
},
updateDrawingList(newTag, list) {
const index = list.findIndex(item => item.__config__.formId === this.activeId)
if (index > -1) {
list.splice(index, 1, newTag)
} else {
list.forEach(item => {
if (Array.isArray(item.__config__.children)) this.updateDrawingList(newTag, item.__config__.children)
})
}
} }
})
this.deleteProjectItemInfo(item)
},
tagChange (newTag) {
newTag = this.cloneComponent(newTag)
const config = newTag.__config__
newTag.__vModel__ = this.activeData.__vModel__
newTag.sort = this.activeData.sort
config.formId = this.activeId
config.span = this.activeData.__config__.span
this.activeData.__config__.tag = config.tag
this.activeData.__config__.tagIcon = config.tagIcon
this.activeData.__config__.document = config.document
this.activeData.typeId = newTag.typeId
if (typeof this.activeData.__config__.defaultValue === typeof config.defaultValue) {
config.defaultValue = this.activeData.__config__.defaultValue
}
Object.keys(newTag)
.forEach(key => {
if (this.activeData[key] !== undefined) {
newTag[key] = this.activeData[key]
}
})
this.activeData = newTag
this.updateProjectItemInfo(newTag)
this.updateDrawingList(newTag, this.drawingList)
},
updateDrawingList (newTag, list) {
const index = list.findIndex(item => item.__config__.formId === this.activeId)
if (index > -1) {
list.splice(index, 1, newTag)
} else {
list.forEach(item => {
if (Array.isArray(item.__config__.children)) this.updateDrawingList(newTag, item.__config__.children)
})
}
} }
}
} }
</script> </script>

2
src/views/form/index.vue

@ -304,6 +304,8 @@ export default {
min-height: 400px; min-height: 400px;
} }
.el-menu-item-per { .el-menu-item-per {
width: 130px;
text-align: left;
// display: flex; // display: flex;
// line-height: 20px; // line-height: 20px;
} }

137
src/views/form/publish/index.vue

@ -17,9 +17,10 @@
<el-form-item label="发布范围"> <el-form-item label="发布范围">
<el-tree class="form_item" <el-tree class="form_item"
ref="tree" ref="tree"
node-key="orgId"
style="background-color:#f7f7f7" style="background-color:#f7f7f7"
:props="props" :props="props"
:data="data" :data="treeData"
show-checkbox show-checkbox
:default-expand-all="false" /> :default-expand-all="false" />
</el-form-item> </el-form-item>
@ -32,12 +33,11 @@
@click="publishProject"> @click="publishProject">
<i class="el-icon-document-checked el-icon--right">发布</i> <i class="el-icon-document-checked el-icon--right">发布</i>
</el-button> </el-button>
<!-- <el-button class="publish-btn" <!-- <el-button type="danger"
size="medium"
type="primary"
@click="resolveAgency"> @click="resolveAgency">
<i class="el-icon-document-checked el-icon--right">获取组织</i> 禁用
</el-button> --> </el-button> -->
</div> </div>
</div> </div>
<div v-if="publishStatus" <div v-if="publishStatus"
@ -70,9 +70,28 @@
<div> <div>
<p class="success-title">恭喜您发布成功</p> <p class="success-title">恭喜您发布成功</p>
</div> </div>
<div>
<el-form label-width="150px">
<el-form-item label="小程序端">
<span style="margin-left:30px;float:left">{{publishClient}}</span>
</el-form-item>
<el-form-item label="发布范围">
<el-tree style="background-color:#f7f7f7"
class="form_item"
ref="selTree"
node-key="orgId"
:default-checked-keys="publishAgency"
:props="props"
:data="selTreeData"
show-checkbox
:default-expand-all="false" />
</el-form-item>
</el-form>
<!-- <div>
<p class="link-text"> {{ writeLink }}</p> <p class="link-text"> {{ writeLink }}</p>
</div> </div> -->
<el-row> <el-row>
<el-col :offset="2" <el-col :offset="2"
:span="6"> :span="6">
@ -88,6 +107,7 @@
@click="stopPublishProject"> @click="stopPublishProject">
停止发布 停止发布
</el-button> </el-button>
</el-col> </el-col>
<!-- <el-col :span="12"> <!-- <el-col :span="12">
<el-button type="warning" <el-button type="warning"
@ -125,20 +145,26 @@ export default {
children: 'subOrgList' children: 'subOrgList'
}, },
count: 1, count: 1,
data: [], treeData: [],
selTreeData: [],//
selAgencyList: [], selAgencyList: [],
agencyArrayCopy: [] agencyArrayCopy: [],
publishClient: '',
publishAgency: []//
} }
}, },
mounted () { async mounted () {
this.projectKey = this.$route.query.key this.projectKey = this.$route.query.key
let url = window.location.protocol + '//' + window.location.host let url = window.location.protocol + '//' + window.location.host
this.writeLink = `${url}/${process.env.VUE_APP_PUBLIC_PATH}/s/${this.projectKey}` this.writeLink = `${url}/${process.env.VUE_APP_PUBLIC_PATH}/s/${this.projectKey}`
this.getProjectStatus() await this.loadAgencyList()
}, },
methods: { methods: {
clientChange (label) { clientChange (label) {
this.clientType = label this.clientType = label
this.loadAgencyList() this.loadAgencyList()
@ -151,17 +177,69 @@ export default {
agencyId: customerId agencyId: customerId
} }
this.$api.post(`/data/aggregator/org/agencytree`, params).then((res) => { this.$api.post(`/data/aggregator/org/agencytree`, params).then((res) => {
this.data = res.data || [] this.treeData = res.data || []
this.selTreeData = JSON.parse(JSON.stringify(this.treeData))
this.getProjectStatus()
})
},
//
getPublishAgency () {
let params = {
projectKey: this.projectKey,
}
this.$api.post(`/data/aggregator/questionnaire/getrange`, params).then((res) => {
if (res.data.client) {
if (res.data.client === 'resi') {
this.publishClient = '居民端'
} else if (res.data.client === 'gov') {
this.publishClient = '工作端'
} else {
this.publishClient = '未知'
}
} else {
this.publishClient = '未知'
}
// this.processSelTreeData(this.selTreeData)
this.publishAgency = res.data.orgList || []
// this.processSelTreeData(this.selTreeData)
this.$refs.selTree.setCheckedKeys(this.publishAgency)
this.processSelTreeData(this.selTreeData)
// this.$refs.selTree.setCheckedNodes(this.publishAgency)
}) })
}, },
disableditem () {
this.processSelTreeData(this.selTreeData)
},
processSelTreeData (array) {
array.forEach(element => {
element.disabled = true
if (element.subOrgList && element.subOrgList.length > 0) {
this.processSelTreeData(element.subOrgList)
}
});
console.log(this.selTreeData)
},
// //
resolveAgency () { resolveAgency () {
let selAll = this.$refs.tree.getCheckedNodes(false, false) let selAll = this.$refs.tree.getCheckedNodes(false, false)
// console.log(selAll) console.log(selAll)
this.selAgencyList = [] this.selAgencyList = []
this.agencyArrayCopy = JSON.parse(JSON.stringify(this.data)) this.agencyArrayCopy = JSON.parse(JSON.stringify(this.treeData))
selAll.forEach(element => { selAll.forEach(element => {
// debugger // debugger
@ -169,27 +247,28 @@ export default {
this.resursionTree(this.agencyArrayCopy, orgId) this.resursionTree(this.agencyArrayCopy, orgId)
}); });
console.log(this.selAgencyList)
}, },
// //
resursionTree (orgArray, orgId) { resursionTree (orgArray, orgId) {
for (let i = 0; i < orgArray.length; i++) { for (let i = 0; i < orgArray.length; i++) {
let item = orgArray[i] let item = orgArray[i]
// debugger
if (item && item.orgId === orgId) { if (item && item.orgId === orgId) {
// debugger orgArray[i].orgIds = orgArray[i].orgPids
orgArray[i].subOrgList = []
this.selAgencyList.push(orgArray[i]) this.selAgencyList.push(orgArray[i])
orgArray[i] = {} orgArray[i] = {}
break break
} else if (item.subOrgList && item.subOrgList.length > 0) { } else if (item.subOrgList && item.subOrgList.length > 0) {
// debugger
this.resursionTree(item.subOrgList, orgId) this.resursionTree(item.subOrgList, orgId)
} }
} }
// console.log(this.agencyArrayCopy) console.log(this.selAgencyList)
}, },
@ -198,15 +277,16 @@ export default {
this.$api.get(`${process.env.VUE_APP_API_ROOT_TDUCK}/user/project/${this.projectKey}`).then(res => { this.$api.get(`${process.env.VUE_APP_API_ROOT_TDUCK}/user/project/${this.projectKey}`).then(res => {
if (res.data.status == 2) { if (res.data.status == 2) {
this.publishStatus = true this.publishStatus = true
this.getPublishAgency()
} else { } else {
this.publishStatus = false this.publishStatus = false
this.loadAgencyList()
} }
}) })
}, },
publishProject () { publishProject () {
this.resolveAgency() this.resolveAgency()
if (this.data.length > 0 && this.selAgencyList.length === 0) { if (this.treeData.length > 0 && this.selAgencyList.length === 0) {
this.$message( this.$message(
{ {
message: "请选择发布范围", message: "请选择发布范围",
@ -225,6 +305,7 @@ export default {
this.$api.post(`${process.env.VUE_APP_API_ROOT_TDUCK}/user/project/publish`, this.$api.post(`${process.env.VUE_APP_API_ROOT_TDUCK}/user/project/publish`,
params).then(() => { params).then(() => {
this.publishStatus = true this.publishStatus = true
this.getPublishAgency()
this.$parent.getProjectStatus() this.$parent.getProjectStatus()
this.msgSuccess('发布成功') this.msgSuccess('发布成功')
}) })
@ -274,16 +355,22 @@ export default {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.age_title {
width: 100px;
align-items: left;
}
.publish-container { .publish-container {
width: 100%; width: 100vw;
height: 100%; height: 100%;
padding: 0; padding: 0;
margin: 0; margin: 0;
background-color: #f7f7f7; background-color: #f7f7f7;
min-height: 84vh; min-height: 84vh;
display: flex; display: flex;
align-items: center; padding-top: 150px;
justify-content: center; padding-left: 350px;
// align-items: center;
// justify-content: center;
} }
.publish-btn-view { .publish-btn-view {
width: 800px; width: 800px;

119
src/views/form/statistics/analysis.vue

@ -1,12 +1,11 @@
<template> <template>
<div class="analysis"> <div class="analysis">
<div v-if="list.length && list.length !== 0"> <div v-if="list.length && list.length !== 0">
<div v-for="(item, index) in list" :key="index"> <div v-for="(item, index) in list"
:key="index">
<div class="content"> <div class="content">
<div class="title"> <div class="title">
<span style="font-size: 16px; font-weight: bold" <span style="font-size: 16px; font-weight: bold">Q{{ index + 1 }} {{ item.label }}{{ item.type }}</span>
>Q{{ index + 1 }} {{ item.label }}{{ item.type }}</span
>
<!-- <div> <!-- <div>
<span>图表类型</span> <span>图表类型</span>
@ -25,31 +24,31 @@
:chart-option="getCharData(item)" :chart-option="getCharData(item)"
:width="'90vw'" :width="'90vw'"
/> --> /> -->
<div v-if="computedCount(item.type)" class="cell-type" @click="handleOpen(item)"> <div v-if="computedCount(item.type)"
class="cell-type"
@click="handleOpen(item)">
<span>共收集 {{ item.detail.collectionTotal }} </span> <span>共收集 {{ item.detail.collectionTotal }} </span>
<span>有效 {{ item.detail.validTotal }} </span> <span>有效 {{ item.detail.validTotal }} </span>
<span v-if="item.type === 'NUMBER_INPUT'" <span v-if="item.type === 'NUMBER_INPUT'">总计 {{ item.detail.sumTotal }}
>总计 {{ item.detail.sumTotal }}
</span> </span>
<span v-if="item.type === 'SWITCH'" <span v-if="item.type === 'SWITCH'"> {{ item.detail.openTotal }}
> {{ item.detail.openTotal }} {{ item.detail.closedTotal }} </span>
{{ item.detail.closedTotal }} </span
>
</div> </div>
<div v-else-if="item.type === 'RATE'" class="cell-rate"> <div v-else-if="item.type === 'RATE'"
<div class="cell-rate">
v-for="(n, i) in item.detail.maxStarNum" <div v-for="(n, i) in item.detail.maxStarNum"
:key="i" :key="i"
class="rate-item" class="rate-item">
>
<div class="rate-item-icon"> <div class="rate-item-icon">
<el-rate :value="n" disabled text-color="#ff9900"> </el-rate> <el-rate :value="n"
disabled
text-color="#ff9900"> </el-rate>
</div> </div>
<div class="rate-item-num"> <div class="rate-item-num">
{{ item.detail.starProfile[n] || 0 }} {{ item.detail.starProfile[n] || 0 }}
</div> </div>
</div> </div>
<div class="rate-item"> <!-- <div class="rate-item">
<div class="rate-item-avg">平均星数</div> <div class="rate-item-avg">平均星数</div>
<div class="rate-item-icon"> <div class="rate-item-icon">
<el-rate <el-rate
@ -59,20 +58,26 @@
> >
</el-rate> </el-rate>
</div> </div>
</div> -->
<div class="rate-item">
<div class="rate-item-avg">平均星数</div>
<div class="rate-item-icon">
<span>{{item.detail.avgStarNum}}</span>
</div>
</div> </div>
</div> </div>
<div v-else-if="item.type === 'RADIO' || item.type === 'CHECKBOX' || item.type === 'SELECT'" <div v-else-if="item.type === 'RADIO' || item.type === 'CHECKBOX' || item.type === 'SELECT'"
class="cell-wrapper" class="cell-wrapper">
> <div v-for="(n, i) in item.detail.options"
<div v-for="(n, i) in item.detail.options" :key="i" class="cell"> :key="i"
class="cell">
<div class="cell-label">{{ n.label }}</div> <div class="cell-label">{{ n.label }}</div>
<div class="cell-value"> <div class="cell-value">
<div class="cell-progress"> <div class="cell-progress">
<el-progress <el-progress :stroke-width="20"
:stroke-width="20" :show-text="false"
:show-text="false" :percentage="computedPercent(n.currentCount, item.detail.totalCount)" />
:percentage="computedPercent(n.currentCount, item.detail.totalCount)"
/>
</div> </div>
<div class="cell-percent"> <div class="cell-percent">
{{ computedPercent(n.currentCount, item.detail.totalCount).toFixed(2) }}% {{ computedPercent(n.currentCount, item.detail.totalCount).toFixed(2) }}%
@ -81,16 +86,17 @@
</div> </div>
</div> </div>
</div> </div>
<div v-else-if="item.type === 'CASCADER'" class="cell-wrapper"> <div v-else-if="item.type === 'CASCADER'"
<div v-for="(n, i) in item.detail.profile" :key="i" class="cell"> class="cell-wrapper">
<div v-for="(n, i) in item.detail.profile"
:key="i"
class="cell">
<div class="cell-label">{{ i }}</div> <div class="cell-label">{{ i }}</div>
<div class="cell-value"> <div class="cell-value">
<div class="cell-progress"> <div class="cell-progress">
<el-progress <el-progress :stroke-width="20"
:stroke-width="20" :show-text="false"
:show-text="false" :percentage="computedPercent(n, item.detail.totalCount)" />
:percentage="computedPercent(n, item.detail.totalCount)"
/>
</div> </div>
<div class="cell-percent"> <div class="cell-percent">
{{ computedPercent(n, item.detail.totalCount).toFixed(2) }}% {{ computedPercent(n, item.detail.totalCount).toFixed(2) }}%
@ -103,16 +109,29 @@
<el-divider /> <el-divider />
</div> </div>
</div> </div>
<data-empty v-else style="padding: 20px" desc="暂无数据分析" /> <data-empty v-else
style="padding: 20px"
desc="暂无数据分析" />
<el-dialog :title="dialogTitle" :visible.sync="dialogTableVisible" :close-on-click-modal="false" @close="handleClose"> <el-dialog :title="dialogTitle"
<el-table :data="dialogData" max-height="400" border> :visible.sync="dialogTableVisible"
<el-table-column type="index" label="序号" width="50" align="center"> :close-on-click-modal="false"
@close="handleClose">
<el-table :data="dialogData"
max-height="400"
border>
<el-table-column type="index"
label="序号"
width="50"
align="center">
<!-- <template slot-scope="scope"> <!-- <template slot-scope="scope">
{{ scope.row.index }} {{ scope.row.index }}
</template> --> </template> -->
</el-table-column> </el-table-column>
<el-table-column v-for="item in dialogHeader" :key="item.formItemId" :prop="item.formItemId" :label="item.label" /> <el-table-column v-for="item in dialogHeader"
:key="item.formItemId"
:prop="item.formItemId"
:label="item.label" />
<!-- <el-table-column property="name" label="姓名" width="200"></el-table-column> <!-- <el-table-column property="name" label="姓名" width="200"></el-table-column>
<el-table-column property="address" label="地址"></el-table-column> --> <el-table-column property="address" label="地址"></el-table-column> -->
</el-table> </el-table>
@ -127,7 +146,7 @@ export default {
components: { components: {
LineChart LineChart
}, },
data() { data () {
return { return {
dialogTableVisible: false, dialogTableVisible: false,
dialogTitle: '', dialogTitle: '',
@ -197,11 +216,11 @@ export default {
] ]
} }
}, },
mounted() { mounted () {
this.getData() this.getData()
}, },
methods: { methods: {
getData() { getData () {
// `${process.env.VUE_APP_API_ROOT_TDUCK}/user/project/report/analysis` // `${process.env.VUE_APP_API_ROOT_TDUCK}/user/project/report/analysis`
// params: { projectKey: this.$route.query.key } // params: { projectKey: this.$route.query.key }
this.$api this.$api
@ -212,7 +231,7 @@ export default {
this.list = res.data this.list = res.data
}) })
}, },
getCharData(data) { getCharData (data) {
const config = { const config = {
tooltip: { tooltip: {
backgroundColor: 'rgba(255,255,255,0.8)', // rgba backgroundColor: 'rgba(255,255,255,0.8)', // rgba
@ -282,7 +301,7 @@ export default {
} }
return config return config
}, },
getInputList(id, type) { getInputList (id, type) {
this.$api this.$api
.post('/data/aggregator/questionnaire/itemresdetail-list', { .post('/data/aggregator/questionnaire/itemresdetail-list', {
@ -302,7 +321,7 @@ export default {
}) })
}) })
}, },
getConcatList() { getConcatList () {
this.$api this.$api
.post('/data/aggregator/questionnaire/itemresdetail-concat', { .post('/data/aggregator/questionnaire/itemresdetail-concat', {
@ -313,7 +332,7 @@ export default {
this.dialogHeader = res.data.tableHeaderList this.dialogHeader = res.data.tableHeaderList
}) })
}, },
async handleOpen(item) { async handleOpen (item) {
if (item.type === 'SWITCH' || item.type === 'NUMBER_INPUT') return false if (item.type === 'SWITCH' || item.type === 'NUMBER_INPUT') return false
@ -328,13 +347,13 @@ export default {
this.dialogTableVisible = true this.dialogTableVisible = true
}, },
handleClose() { handleClose () {
this.dialogHeader = [] this.dialogHeader = []
this.dialogTitle = '' this.dialogTitle = ''
this.dialogData = [] this.dialogData = []
this.dialogTableVisible = false this.dialogTableVisible = false
}, },
computedCount(type) { computedCount (type) {
const arr = [ const arr = [
'PROVINCE_CITY', 'PROVINCE_CITY',
'NUMBER_INPUT', 'NUMBER_INPUT',
@ -349,7 +368,7 @@ export default {
] ]
return arr.includes(type) return arr.includes(type)
}, },
computedPercent(num, count) { computedPercent (num, count) {
return (num * 100) / count return (num * 100) / count
} }
} }
@ -383,7 +402,7 @@ export default {
.cell-type { .cell-type {
padding-left: 10px; padding-left: 10px;
font-size: 14px; font-size: 14px;
color: #409EFF; color: #409eff;
cursor: pointer; cursor: pointer;
} }
.cell-wrapper { .cell-wrapper {

174
src/views/form/statistics/item.vue

@ -1,96 +1,105 @@
<template> <template>
<div> <div>
<div v-if="projectItemData.type=='UPLOAD'"> <div v-if="projectItemData.type=='UPLOAD'">
<div v-if="getItemValue['files']"> <div v-if="getItemValue['files']">
<!-- 图片文件渲染图片栏 --> <!-- 图片文件渲染图片栏 -->
<template v-if="getItemValue['type'] == 'image'"> <template v-if="getItemValue['type'] == 'image'">
<span v-for="file in getItemValue['files']" :key="JSON.stringify(file)"> <span v-for="file in getItemValue['files']"
<el-image class="item-thumbnail-image-preview" :src="file.url" :preview-src-list="getItemValue['files'].map( img => img.url)" lazy /> :key="JSON.stringify(file)">
</span> <el-image class="item-thumbnail-image-preview"
</template> :src="file.url"
:preview-src-list="getItemValue['files'].map( img => img.url)"
lazy />
</span>
</template>
<!-- 其他文件渲染文件下载链接 --> <!-- 其他文件渲染文件下载链接 -->
<template v-else> <template v-else>
<el-link <el-link v-for="file in getItemValue['files']"
v-for="file in getItemValue['files']" :key="file"
:href="file.url"
target="_blank"
type="primary">
<span> {{ file.fileName }}</span>
</el-link>
</template>
</div>
<span v-else>/</span>
</div>
<div v-else-if="projectItemData.type=='SIGN_PAD'">
<el-image class="item-thumbnail-image-preview"
:src="getItemValue || ''"
:preview-src-list="[getItemValue || '']"
lazy />
</div>
:key="file" <div v-else>
:href="file.url" target="_blank" {{ getItemValue || '/' }}
type="primary"
>
<span> {{ file.fileName }}</span>
</el-link>
</template>
</div>
<span v-else>/</span>
</div>
<div v-else-if="projectItemData.type=='SIGN_PAD'">
<el-image class="item-thumbnail-image-preview" :src="getItemValue || ''" :preview-src-list="[getItemValue || '']" lazy />
</div>
<div v-else>
{{ getItemValue || '/' }}
</div>
</div> </div>
</div>
</template> </template>
<script> <script>
export default { export default {
name: 'ResultItem', name: 'ResultItem',
props: { props: {
projectItemData: { projectItemData: {
type: Object, type: Object,
default: function() { default: function () {
return {} return {}
} }
}, },
resultData: { resultData: {
type: Object, type: Object,
default: function() { default: function () {
return {} return {}
} }
}, },
fieldItemId: { fieldItemId: {
type: Number, type: Number,
default: 0 default: 0
} }
},
computed: {
processData () {
return this.resultData ? this.resultData['processData'] : {}
}, },
computed: { getItemValue () {
processData() { if (this.processData[`field${this.fieldItemId}other`]) {
console.log('数据', this.projectItemData) // lable+
return this.resultData ? this.resultData['processData'] : {} return this.processData[`field${this.fieldItemId}`] + ':' + this.processData[`field${this.fieldItemId}other`]
}, }
getItemValue() {
if (this.processData[`field${this.fieldItemId}other`]) {
// lable+
return this.processData[`field${this.fieldItemId}`] + ':' + this.processData[`field${this.fieldItemId}other`]
}
if (this.projectItemData.type === 'INPUT_MAP') {
// let _value = this.processData[`field${this.fieldItemId}`][2]
return this.processData[`field${this.fieldItemId}`] ? this.processData[`field${this.fieldItemId}`][2] : ''
}
if (this.projectItemData.type === 'PROVINCE_CITY') {
return this.processData[`field${this.fieldItemId}`] ? this.processData[`field${this.fieldItemId}`].join('-'): ''
}
if (this.projectItemData.type === 'CASCADER') {
let arr = this.processData[`field${this.fieldItemId}`] ? this.processData[`field${this.fieldItemId}`] : []
if (arr && arr.length > 0) {
arr = arr.map(item => {
return item.pathName.split('/').join('-')
})
}
return arr.length > 0 ? arr.join(',') : ''
}
if (this.projectItemData.type === 'DATE_RANGE') {
return this.processData[`field${this.fieldItemId}`] ? this.processData[`field${this.fieldItemId}`].join('至'): ''
}
if (this.projectItemData.type === 'TIME_RANGE') {
return this.processData[`field${this.fieldItemId}`] ? this.processData[`field${this.fieldItemId}`].join('至'): ''
}
return this.processData[`field${this.fieldItemId}`] ? this.processData[`field${this.fieldItemId}`] : '' if (this.projectItemData.type === 'INPUT_MAP') {
// let _value = this.processData[`field${this.fieldItemId}`][2]
return this.processData[`field${this.fieldItemId}`] ? this.processData[`field${this.fieldItemId}`][2] : ''
}
if (this.projectItemData.type === 'PROVINCE_CITY') {
return this.processData[`field${this.fieldItemId}`] ? this.processData[`field${this.fieldItemId}`].join('-') : ''
}
if (this.projectItemData.type === 'CASCADER') {
let arr = this.processData[`field${this.fieldItemId}`] ? this.processData[`field${this.fieldItemId}`] : []
if (arr && arr.length > 0) {
arr = arr.map(item => {
return item.pathName.split('/').join('-')
})
} }
} return arr.length > 0 ? arr.join(',') : ''
}
if (this.projectItemData.type === 'DATE_RANGE') {
return this.processData[`field${this.fieldItemId}`] ? this.processData[`field${this.fieldItemId}`].join('至') : ''
}
if (this.projectItemData.type === 'TIME_RANGE') {
return this.processData[`field${this.fieldItemId}`] ? this.processData[`field${this.fieldItemId}`].join('至') : ''
}
if (this.projectItemData.type === 'SWITCH') {
return this.processData[`field${this.fieldItemId}`] ? '开' : '关'
}
return this.processData[`field${this.fieldItemId}`] ? this.processData[`field${this.fieldItemId}`] : ''
}
},
} }
</script> </script>
@ -100,8 +109,7 @@ export default {
height: 106px; height: 106px;
margin-right: 15px; margin-right: 15px;
margin-bottom: 15px; margin-bottom: 15px;
border: 1px solid #EBEEF5; border: 1px solid #ebeef5;
background: #0001; background: #0001;
} }
</style> </style>

35
src/views/form/statistics/list.vue

@ -50,7 +50,7 @@
<el-table-column label="组织/部门/网格" <el-table-column label="组织/部门/网格"
prop="orgName" /> prop="orgName" />
<el-table-column label="来源" <el-table-column label="来源"
prop="clientType" /> prop="clientTypeShow" />
<!-- <el-table-column label="填写时间" prop="createdTime" /> --> <!-- <el-table-column label="填写时间" prop="createdTime" /> -->
<el-table-column v-for="col in otherCustomColumns" <el-table-column v-for="col in otherCustomColumns"
@ -174,8 +174,10 @@ import { getCheckedColumn, saveCheckedColumn } from '@/utils/db'
const fixedDefaultFormColumn = ['serialNumber'] const fixedDefaultFormColumn = ['serialNumber']
const fixedDefaultLabelFormColumn = { serialNumber: '提交序号' } const fixedDefaultLabelFormColumn = { serialNumber: '提交序号' }
// //
const fixedDefaultFormTailColumn = ['submitAddress', 'createdTime'] // const fixedDefaultFormTailColumn = ['submitAddress', 'createdTime']
const fixedDefaultLabelFormTailColumn = { submitAddress: '提交地址', createdTime: '提交时间' } const fixedDefaultFormTailColumn = ['createdTime']
// const fixedDefaultLabelFormTailColumn = { submitAddress: '', createdTime: '' }
const fixedDefaultLabelFormTailColumn = { createdTime: '提交时间' }
export default { export default {
name: 'ProjectStatisticsList', name: 'ProjectStatisticsList',
@ -234,6 +236,7 @@ export default {
) )
}, },
openDetailDrawerHandle (row) { openDetailDrawerHandle (row) {
this.activeResultRow = row this.activeResultRow = row
this.detailDrawer = true this.detailDrawer = true
}, },
@ -254,6 +257,18 @@ export default {
this.$api.get(`${process.env.VUE_APP_API_ROOT_TDUCK}/user/project/result/page`, { params: this.queryConditions }).then(res => { this.$api.get(`${process.env.VUE_APP_API_ROOT_TDUCK}/user/project/result/page`, { params: this.queryConditions }).then(res => {
let { records, total, size } = res.data let { records, total, size } = res.data
this.projectResultList = records this.projectResultList = records
this.projectResultList.forEach(element => {
if (element.clientType === 'gov') {
element.clientTypeShow = '工作端'
} else if (element.clientType === 'resi') {
element.clientTypeShow = '居民端'
} else {
element.clientTypeShow = '未知'
}
});
this.total = total this.total = total
this.queryConditions.size = size this.queryConditions.size = size
}) })
@ -310,10 +325,24 @@ export default {
this.$message.error('无表单有效反馈结果,无法导出') this.$message.error('无表单有效反馈结果,无法导出')
return return
} }
// ajax.exportFilePost(
// url,
// this.tableParams,
// (data, rspMsg) => {
// this.download(data, title + '.xls')
// },
// (rspMsg, data) => {
// this.$message.error(rspMsg);
// }
// );
this.$api.get(`${process.env.VUE_APP_API_ROOT_TDUCK}/user/project/result/export`, { this.$api.get(`${process.env.VUE_APP_API_ROOT_TDUCK}/user/project/result/export`, {
params: this.queryConditions, params: this.queryConditions,
responseType: 'blob' responseType: 'blob'
}).then(res => { }).then(res => {
let blob = res let blob = res
let downloadElement = document.createElement('a') let downloadElement = document.createElement('a')
let href = window.URL.createObjectURL(blob) // let href = window.URL.createObjectURL(blob) //

4
src/views/form/statistics/public.vue

@ -24,8 +24,8 @@
</el-table-column> </el-table-column>
<el-table-column label="提交序号" <el-table-column label="提交序号"
prop="serialNumber" /> prop="serialNumber" />
<el-table-column label="提交地址" <!-- <el-table-column label="提交地址"
prop="submitAddress" /> prop="submitAddress" /> -->
<el-table-column label="提交时间" <el-table-column label="提交时间"
prop="createdTime" /> prop="createdTime" />
</el-table> </el-table>

Loading…
Cancel
Save