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. 94
      src/views/form/editor/index.vue
  4. 2
      src/views/form/index.vue
  5. 137
      src/views/form/publish/index.vue
  6. 113
      src/views/form/statistics/analysis.vue
  7. 50
      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,

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

@ -4,8 +4,7 @@
<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 }}
@ -16,13 +15,11 @@
: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" <div v-for="(element, index) in item.list"
:key="index" :key="index"
class="components-item" class="components-item"
@click="addComponent(element)" @click="addComponent(element)">
>
<div class="components-body"> <div class="components-body">
<svg-icon :name="element.__config__.tagIcon" /> <svg-icon :name="element.__config__.tagIcon" />
{{ element.__config__.label }} {{ element.__config__.label }}
@ -37,39 +34,33 @@
<el-scrollbar class="center-scrollbar"> <el-scrollbar class="center-scrollbar">
<el-row v-if="formConf" <el-row v-if="formConf"
:gutter="formConf.gutter" :gutter="formConf.gutter"
class="center-board-row" class="center-board-row">
>
<el-row align="middle" <el-row align="middle"
justify="center" justify="center"
type="flex" 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"> <el-col class="form-head-desc">
<Tinymce v-if="editDescription" <Tinymce v-if="editDescription"
v-model="formConf.description" v-model="formConf.description"
placeholder="请输入表单描述" placeholder="请输入表单描述"
@blur="editDescription=false" @blur="editDescription=false"
@input="saveProjectInfo" @input="saveProjectInfo" />
/>
<div v-else <div v-else
class="form-name-text" class="form-name-text"
@click="editDescription=true" @click="editDescription=true"
v-html="formConf.description" v-html="formConf.description" />
/>
<!-- <p class="form-name-text" contenteditable="true"--> <!-- <p class="form-name-text" contenteditable="true"-->
<!-- @blur="(event)=>{--> <!-- @blur="(event)=>{-->
<!-- formConf.description=event.target.innerText;--> <!-- formConf.description=event.target.innerText;-->
@ -82,14 +73,12 @@
<el-form :disabled="formConf.disabled" <el-form :disabled="formConf.disabled"
:label-position="formConf.labelPosition" :label-position="formConf.labelPosition"
:label-width="formConf.labelWidth + 'px'" :label-width="formConf.labelWidth + 'px'"
:size="formConf.size" :size="formConf.size">
>
<draggable :animation="340" <draggable :animation="340"
:list="drawingList" :list="drawingList"
class="drawing-board" class="drawing-board"
group="componentsGroup" group="componentsGroup"
@end="onItemEnd" @end="onItemEnd">
>
<draggable-item v-for="(item, index) in drawingList" <draggable-item v-for="(item, index) in drawingList"
:key="item.renderKey" :key="item.renderKey"
:active-id="activeId" :active-id="activeId"
@ -100,15 +89,12 @@
@activeItem="activeFormItem" @activeItem="activeFormItem"
@changeLabel="changeLabel" @changeLabel="changeLabel"
@copyItem="drawingItemCopy" @copyItem="drawingItemCopy"
@deleteItem="drawingItemDelete" @deleteItem="drawingItemDelete" />
/>
</draggable> </draggable>
<div v-show="!drawingList.length" <div v-show="!drawingList.length"
class="empty-info" class="empty-info">
>
<img style="width: 20%" <img style="width: 20%"
src="@/assets/images/form-bg.png" src="@/assets/images/form-bg.png">
>
<p>从左侧拖入或点选组件进行表单设计</p> <p>从左侧拖入或点选组件进行表单设计</p>
</div> </div>
</el-form> </el-form>
@ -120,8 +106,7 @@
:form-conf="formConf" :form-conf="formConf"
:show-field="!!drawingList.length" :show-field="!!drawingList.length"
@tag-change="tagChange" @tag-change="tagChange"
@data-change="updateProjectItemInfo" @data-change="updateProjectItemInfo" />
/>
</div> </div>
</template> </template>
@ -154,7 +139,7 @@ export default {
RightPanel, RightPanel,
DraggableItem DraggableItem
}, },
data() { data () {
return { return {
idGlobal, idGlobal,
formConf: null, formConf: null,
@ -200,7 +185,7 @@ export default {
computed: {}, computed: {},
watch: { watch: {
// eslint-disable-next-line func-names // eslint-disable-next-line func-names
'activeData.__config__.label': function(val, oldVal) { 'activeData.__config__.label': function (val, oldVal) {
if ( if (
this.activeData.placeholder === undefined this.activeData.placeholder === undefined
|| !this.activeData.__config__.tag || !this.activeData.__config__.tag
@ -211,20 +196,20 @@ export default {
this.activeData.placeholder = this.activeData.placeholder.replace(oldVal, '') + val this.activeData.placeholder = this.activeData.placeholder.replace(oldVal, '') + val
}, },
activeId: { activeId: {
handler(val) { handler (val) {
oldActiveId = val oldActiveId = val
}, },
immediate: true immediate: true
}, },
drawingList: { drawingList: {
handler(val) { handler (val) {
this.saveDrawingListDebounce(val, this.projectKey) this.saveDrawingListDebounce(val, this.projectKey)
if (val.length === 0) this.idGlobal = 100 if (val.length === 0) this.idGlobal = 100
}, },
deep: true deep: true
}, },
idGlobal: { idGlobal: {
handler(val) { handler (val) {
if (val) { if (val) {
this.saveIdGlobalDebounce(val, this.projectKey) this.saveIdGlobalDebounce(val, this.projectKey)
} }
@ -232,7 +217,7 @@ export default {
immediate: true immediate: true
} }
}, },
mounted() { mounted () {
// //
this.formConf = JSON.parse(JSON.stringify(formConf)) this.formConf = JSON.parse(JSON.stringify(formConf))
@ -253,7 +238,7 @@ export default {
}) })
}, },
methods: { methods: {
saveProjectInfo: debounce(430, true, function() { saveProjectInfo: debounce(430, true, function () {
this.$api.post(`${process.env.VUE_APP_API_ROOT_TDUCK}/user/project/update`, { this.$api.post(`${process.env.VUE_APP_API_ROOT_TDUCK}/user/project/update`, {
'key': this.projectKey, 'key': this.projectKey,
'name': this.formConf.title, 'name': this.formConf.title,
@ -262,21 +247,22 @@ export default {
}) })
}), }),
updateProjectItemInfo(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/update`, data).then(() => { this.$api.post(`${process.env.VUE_APP_API_ROOT_TDUCK}/user/project/item/update`, data).then(() => {
}) })
}, },
deleteProjectItemInfo(val) { deleteProjectItemInfo (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/delete`, data).then(() => {
}) })
}, },
async saveProjectItemInfo(item) { async saveProjectItemInfo (item) {
let isSuccess = false let isSuccess = false
let params = formItemConvertData(item, this.projectKey) let params = formItemConvertData(item, this.projectKey)
console.log(params)
let pItem = item let pItem = item
await this.$api.post(`${process.env.VUE_APP_API_ROOT_TDUCK}/user/project/item/create`, params).then(res => { await this.$api.post(`${process.env.VUE_APP_API_ROOT_TDUCK}/user/project/item/create`, params).then(res => {
pItem.sort = res.data.sort pItem.sort = res.data.sort
@ -288,7 +274,7 @@ export default {
} }
return isSuccess return isSuccess
}, },
updatePaginationList() { updatePaginationList () {
// //
const length = this.drawingList.filter(item => item.typeId === 'PAGINATION').length const length = this.drawingList.filter(item => item.typeId === 'PAGINATION').length
let curr = 1 let curr = 1
@ -300,22 +286,22 @@ export default {
} }
}) })
}, },
queryProjectItems() { queryProjectItems () {
this.$api.get(`${process.env.VUE_APP_API_ROOT_TDUCK}/user/project/item/list`, { params: { key: this.projectKey } }).then(res => { this.$api.get(`${process.env.VUE_APP_API_ROOT_TDUCK}/user/project/item/list`, { params: { key: this.projectKey } }).then(res => {
this.drawingList = res.data.map(item => dbDataConvertForItemJson(item)) this.drawingList = res.data.map(item => dbDataConvertForItemJson(item))
// //
this.updatePaginationList() this.updatePaginationList()
}) })
}, },
activeFormItem(currentItem) { activeFormItem (currentItem) {
this.activeData = currentItem this.activeData = currentItem
this.activeId = currentItem.__config__.formId this.activeId = currentItem.__config__.formId
}, },
changeLabel(currentItem, value) { changeLabel (currentItem, value) {
console.log(currentItem) console.log(currentItem)
console.log(value) console.log(value)
}, },
onEnd(obj) { onEnd (obj) {
if (obj.from !== obj.to) { if (obj.from !== obj.to) {
this.activeData = tempActiveData this.activeData = tempActiveData
this.activeId = this.idGlobal this.activeId = this.idGlobal
@ -324,7 +310,7 @@ export default {
}) })
} }
}, },
onItemEnd(obj) { onItemEnd (obj) {
let params = { 'projectKey': this.projectKey } let params = { 'projectKey': this.projectKey }
if (this.drawingList[obj.newIndex - 1]) { if (this.drawingList[obj.newIndex - 1]) {
let sort1 = this.drawingList[obj.newIndex - 1].sort let sort1 = this.drawingList[obj.newIndex - 1].sort
@ -341,13 +327,13 @@ export default {
}) })
} }
}, },
addComponent(item) { addComponent (item) {
const clone = this.cloneComponent(item) const clone = this.cloneComponent(item)
this.saveProjectItemInfo(clone) this.saveProjectItemInfo(clone)
this.drawingList.push(clone) this.drawingList.push(clone)
this.activeFormItem(clone) this.activeFormItem(clone)
}, },
cloneComponent(origin) { cloneComponent (origin) {
const clone = deepClone(origin) const clone = deepClone(origin)
const config = clone.__config__ const config = clone.__config__
config.span = this.formConf.span // span config.span = this.formConf.span // span
@ -356,7 +342,7 @@ export default {
tempActiveData = clone tempActiveData = clone
return tempActiveData return tempActiveData
}, },
createIdAndKey(item) { createIdAndKey (item) {
const config = item.__config__ const config = item.__config__
config.formId = ++this.idGlobal config.formId = ++this.idGlobal
config.renderKey = `${config.formId}${+new Date()}` // renderKey config.renderKey = `${config.formId}${+new Date()}` // renderKey
@ -372,7 +358,7 @@ export default {
} }
return item return item
}, },
empty() { empty () {
this.$confirm('确定要清空所有组件吗?', '提示', { type: 'warning' }) this.$confirm('确定要清空所有组件吗?', '提示', { type: 'warning' })
.then( .then(
() => { () => {
@ -381,14 +367,14 @@ export default {
} }
) )
}, },
drawingItemCopy(item, list) { drawingItemCopy (item, list) {
let clone = deepClone(item) let clone = deepClone(item)
clone = this.createIdAndKey(clone) clone = this.createIdAndKey(clone)
list.push(clone) list.push(clone)
this.activeFormItem(clone) this.activeFormItem(clone)
this.saveProjectItemInfo(clone) this.saveProjectItemInfo(clone)
}, },
drawingItemDelete(index, list) { drawingItemDelete (index, list) {
let item = list[index] let item = list[index]
list.splice(index, 1) list.splice(index, 1)
this.$nextTick(() => { this.$nextTick(() => {
@ -399,7 +385,7 @@ export default {
}) })
this.deleteProjectItemInfo(item) this.deleteProjectItemInfo(item)
}, },
tagChange(newTag) { tagChange (newTag) {
newTag = this.cloneComponent(newTag) newTag = this.cloneComponent(newTag)
const config = newTag.__config__ const config = newTag.__config__
newTag.__vModel__ = this.activeData.__vModel__ newTag.__vModel__ = this.activeData.__vModel__
@ -423,7 +409,7 @@ export default {
this.updateProjectItemInfo(newTag) this.updateProjectItemInfo(newTag)
this.updateDrawingList(newTag, this.drawingList) this.updateDrawingList(newTag, this.drawingList)
}, },
updateDrawingList(newTag, list) { updateDrawingList (newTag, list) {
const index = list.findIndex(item => item.__config__.formId === this.activeId) const index = list.findIndex(item => item.__config__.formId === this.activeId)
if (index > -1) { if (index > -1) {
list.splice(index, 1, newTag) list.splice(index, 1, newTag)

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;

113
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 {

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

@ -4,20 +4,22 @@
<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)">
<el-image class="item-thumbnail-image-preview"
:src="file.url"
:preview-src-list="getItemValue['files'].map( img => img.url)"
lazy />
</span> </span>
</template> </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" :key="file"
:href="file.url" target="_blank" :href="file.url"
type="primary" target="_blank"
> type="primary">
<span> {{ file.fileName }}</span> <span> {{ file.fileName }}</span>
</el-link> </el-link>
</template> </template>
@ -25,8 +27,12 @@
<span v-else>/</span> <span v-else>/</span>
</div> </div>
<div v-else-if="projectItemData.type=='SIGN_PAD'"> <div v-else-if="projectItemData.type=='SIGN_PAD'">
<el-image class="item-thumbnail-image-preview" :src="getItemValue || ''" :preview-src-list="[getItemValue || '']" lazy /> <el-image class="item-thumbnail-image-preview"
:src="getItemValue || ''"
:preview-src-list="[getItemValue || '']"
lazy />
</div> </div>
<div v-else> <div v-else>
{{ getItemValue || '/' }} {{ getItemValue || '/' }}
</div> </div>
@ -39,13 +45,13 @@ export default {
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 {}
} }
}, },
@ -55,21 +61,22 @@ export default {
} }
}, },
computed: { computed: {
processData() { processData () {
console.log('数据', this.projectItemData)
return this.resultData ? this.resultData['processData'] : {} return this.resultData ? this.resultData['processData'] : {}
}, },
getItemValue() { getItemValue () {
if (this.processData[`field${this.fieldItemId}other`]) { if (this.processData[`field${this.fieldItemId}other`]) {
// lable+ // lable+
return this.processData[`field${this.fieldItemId}`] + ':' + this.processData[`field${this.fieldItemId}other`] return this.processData[`field${this.fieldItemId}`] + ':' + this.processData[`field${this.fieldItemId}other`]
} }
if (this.projectItemData.type === 'INPUT_MAP') { if (this.projectItemData.type === 'INPUT_MAP') {
// let _value = this.processData[`field${this.fieldItemId}`][2] // let _value = this.processData[`field${this.fieldItemId}`][2]
return this.processData[`field${this.fieldItemId}`] ? this.processData[`field${this.fieldItemId}`][2] : '' return this.processData[`field${this.fieldItemId}`] ? this.processData[`field${this.fieldItemId}`][2] : ''
} }
if (this.projectItemData.type === 'PROVINCE_CITY') { if (this.projectItemData.type === 'PROVINCE_CITY') {
return this.processData[`field${this.fieldItemId}`] ? this.processData[`field${this.fieldItemId}`].join('-'): '' return this.processData[`field${this.fieldItemId}`] ? this.processData[`field${this.fieldItemId}`].join('-') : ''
} }
if (this.projectItemData.type === 'CASCADER') { if (this.projectItemData.type === 'CASCADER') {
let arr = this.processData[`field${this.fieldItemId}`] ? this.processData[`field${this.fieldItemId}`] : [] let arr = this.processData[`field${this.fieldItemId}`] ? this.processData[`field${this.fieldItemId}`] : []
@ -81,16 +88,18 @@ export default {
return arr.length > 0 ? arr.join(',') : '' return arr.length > 0 ? arr.join(',') : ''
} }
if (this.projectItemData.type === 'DATE_RANGE') { if (this.projectItemData.type === 'DATE_RANGE') {
return this.processData[`field${this.fieldItemId}`] ? this.processData[`field${this.fieldItemId}`].join('至'): '' return this.processData[`field${this.fieldItemId}`] ? this.processData[`field${this.fieldItemId}`].join('至') : ''
} }
if (this.projectItemData.type === 'TIME_RANGE') { 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}`].join('至') : ''
}
if (this.projectItemData.type === 'SWITCH') {
return this.processData[`field${this.fieldItemId}`] ? '开' : '关'
} }
return this.processData[`field${this.fieldItemId}`] ? 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