wangqing 5 years ago
parent
commit
439ed118d4
  1. 2
      src/components/parser/Parser.vue
  2. 11
      src/utils/db.js
  3. 2
      src/views/form/ProjectForm.vue
  4. 2
      src/views/form/index.vue
  5. 156
      src/views/form/statistics.vue

2
src/components/parser/Parser.vue

@ -230,7 +230,7 @@ export default {
let tagOptionKey = processType[temConfig.tag] let tagOptionKey = processType[temConfig.tag]
let defaultValue = temConfig.defaultValue let defaultValue = temConfig.defaultValue
let labelStr = '' let labelStr = ''
if (tagOptionKey) { if (tagOptionKey&&defaultValue) {
if (defaultValue instanceof Array) { if (defaultValue instanceof Array) {
defaultValue.forEach(item => { defaultValue.forEach(item => {
let {label} = getObject(_.get(cur, tagOptionKey), 'value', item) let {label} = getObject(_.get(cur, tagOptionKey), 'value', item)

11
src/utils/db.js

@ -4,6 +4,7 @@ const DRAWING_ITEMS_VERSION_KEY = 'DRAWING_ITEMS_VERSION'
const DRAWING_ID = 'idGlobal' const DRAWING_ID = 'idGlobal'
const TREE_NODE_ID = 'treeNodeId' const TREE_NODE_ID = 'treeNodeId'
const FORM_CONF = 'formConf' const FORM_CONF = 'formConf'
const CHECKED_COLUMNS = 'checkedColumns'
export function getDrawingList(key) { export function getDrawingList(key) {
// 加入缓存版本的概念,保证缓存数据与程序匹配 // 加入缓存版本的概念,保证缓存数据与程序匹配
@ -53,3 +54,13 @@ export function getFormConf(key) {
export function saveFormConf(obj, key) { export function saveFormConf(obj, key) {
if (key) localStorage.setItem(`${FORM_CONF}:${key}`, JSON.stringify(obj)) if (key) localStorage.setItem(`${FORM_CONF}:${key}`, JSON.stringify(obj))
} }
export function saveCheckedColumn(key, obj) {
if (key) localStorage.setItem(`${CHECKED_COLUMNS}:${key}`, JSON.stringify(obj))
}
export function getCheckedColumn(key, obj) {
const str = localStorage.getItem(`${CHECKED_COLUMNS}:${key}`)
if (str) return JSON.parse(str)
return null
}

2
src/views/form/ProjectForm.vue

@ -103,7 +103,7 @@ export default {
this.formConf.size = window.innerWidth < 480 ? 'medium' : 'small' this.formConf.size = window.innerWidth < 480 ? 'medium' : 'small'
}, },
mounted() { mounted() {
this.$api.get(`/user/project/query/details/${this.projectKey}`).then(res => { this.$api.get(`/user/project/details/query/${this.projectKey}`).then(res => {
if (res.data) { if (res.data) {
let fields = res.data.projectItems.map(item => { let fields = res.data.projectItems.map(item => {
return dbDataConvertForItemJson(item) return dbDataConvertForItemJson(item)

2
src/views/form/index.vue

@ -22,7 +22,7 @@
<theme :projectKey="projectKey" v-if="activeIndex==2"/> <theme :projectKey="projectKey" v-if="activeIndex==2"/>
<setting :projectKey="projectKey" v-if="activeIndex==3"/> <setting :projectKey="projectKey" v-if="activeIndex==3"/>
<publish :projectKey="projectKey" v-if="activeIndex==4"/> <publish :projectKey="projectKey" v-if="activeIndex==4"/>
<statistics :projectKey="projectKey" v-if="activeIndex==5"/> <statistics :projectKey="projectKey" v-if="activeIndex==5&&projectKey"/>
</div> </div>
</template> </template>

156
src/views/form/statistics.vue

@ -1,75 +1,185 @@
<template> <template>
<div class="statistics-container"> <div class="statistics-container">
<template> <div class="filter-table-view">
<el-form :inline="true" class="demo-form-inline">
<el-form-item label="审批人">
<el-input placeholder="审批人"></el-input>
</el-form-item>
<el-form-item label="活动区域">
</el-form-item>
<el-form-item>
<el-button type="primary">查询</el-button>
</el-form-item>
</el-form>
</div>
<div class="result-table-view">
<el-table <el-table
:data="projectResultList" stripe :header-cell-style="{background:'#184F7D'}"
style="width: 100%"> :data="projectResultList">
<el-table-column <el-table-column
type="selection" type="selection"
width="55"> width="55">
</el-table-column> </el-table-column>
<el-table-column <el-table-column v-for="col in fixedCustomColumns" :key="col"
prop="serialNumber" :label="fixedDefaultLabelFormColumn[col]">
label="提交序号" <template slot-scope="scope">
width="180"> {{ scope.row[col] }}
</template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column v-for="col in otherCustomColumns" :key="col"
prop="submitAddress" :label="projectItemColumns[col]">
label="提交地址" <template slot-scope="scope">
width="180"> {{ scope.row['processData'][col] }}
</template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="address" width="50"
label="地址"> fixed="right"
:render-header="renderHeader">
</el-table-column> </el-table-column>
</el-table> </el-table>
</template> </div>
<div class="">
<el-dialog center title="自定义显示列" :visible.sync="customColumnDialogVisible">
<el-row>
<el-col :span="3">
<span>显示列</span>
</el-col>
</el-row>
<el-divider></el-divider>
<el-checkbox-group v-model="checkFixedCustomColumns">
<el-row>
<el-col :span="4" v-for="(val, key, index) in fixedDefaultLabelFormColumn">
<el-checkbox :label="key">{{ val }}</el-checkbox>
</el-col>
</el-row>
</el-checkbox-group>
<el-divider></el-divider>
<el-checkbox-group v-model="checkOtherCustomColumns">
<el-row>
<el-col :span="8" v-for="(val, key, index) in projectItemColumns">
<el-checkbox :label="key">{{ val }}</el-checkbox>
</el-col>
</el-row>
</el-checkbox-group>
<span slot="footer" class="dialog-footer">
<el-button @click="customColumnDialogVisible = false"> </el-button>
<el-button type="primary" @click="saveStatisticsCheckedColumns"> </el-button>
</span>
</el-dialog>
</div>
</div> </div>
</template> </template>
<script> <script>
import _ from 'lodash'
import {getCheckedColumn, saveCheckedColumn} from '@/utils/db'
const fixedDefaultFormColumn = ['serialNumber', 'submitAddress', 'createTime']
const fixedDefaultLabelFormColumn = {serialNumber: '提交序号', submitAddress: '提交地址', createTime: '提交时间'}
export default { export default {
name: 'projectStatistics', name: 'projectStatistics',
components: {}, components: {},
props: { props: {
projectKey: '', projectKey: ''
projectResultList: []
}, },
mounted() { mounted() {
this.queryConditions.projectKey = this.projectKey this.queryConditions.projectKey = this.projectKey
this.queryProjectResult() this.queryProjectResult()
this.queryProjectItems()
}, },
data() { data() {
return { return {
customColumnDialogVisible: false,
//
fixedCustomColumns: fixedDefaultFormColumn,
//
checkFixedCustomColumns: fixedDefaultFormColumn,
fixedDefaultLabelFormColumn: fixedDefaultLabelFormColumn,
//
checkOtherCustomColumns: [],
otherCustomColumns: [],
projectResultList: [],
projectItemList: [],
projectItemColumns: {},
// //
queryConditions: { queryConditions: {
projectKey: '' projectKey: ''
} }
} }
}, methods: { }, methods: {
renderHeader(h) {
return (
<i class="el-icon-setting" onClick={() => this.customColumnDialogVisible = true}></i>
)
},
queryProjectResult() { queryProjectResult() {
this.$api.post(`/user/project/result/query`, this.queryConditions).then(res => { this.$api.post(`/user/project/result/query`, this.queryConditions).then(res => {
this.projectResultList = res.data this.projectResultList = res.data
}) })
},
saveStatisticsCheckedColumns() {
this.customColumnDialogVisible = false
this.fixedCustomColumns = this.checkFixedCustomColumns
this.otherCustomColumns = this.checkOtherCustomColumns
saveCheckedColumn(this.projectKey, {
fixedCustomColumns: this.fixedCustomColumns,
otherCustomColumns: this.otherCustomColumns
})
},
getDbCheckedColumns() {
let {fixedCustomColumns, otherCustomColumns} = getCheckedColumn(this.projectKey)
if (fixedCustomColumns) {
this.fixedCustomColumns = fixedCustomColumns
this.checkFixedCustomColumns = fixedCustomColumns
}
if (otherCustomColumns) {
this.otherCustomColumns = otherCustomColumns
this.checkOtherCustomColumns = otherCustomColumns
}
},
queryProjectItems() {
this.$api.get(`/user/project/item/query/${this.projectKey}`).then(res => {
if (res.data) {
res.data.map((item) => {
_.set(this.projectItemColumns, `field${item.formItemId}`, item.label)
})
}
this.projectItemList = res.data
this.getDbCheckedColumns()
})
} }
} }
} }
</script> </script>
<style lang="scss" scoped> <style scoped>
.statistics-container { .statistics-container {
width: 100%; width: 100%;
height: 100%; height: 100%;
padding: 0px; padding: 0px;
margin: 0; min-height: 85vh;
background-color: #F7F7F7; background-color: #F7F7F7;
font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "微软雅黑", Arial, sans-serif; font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
display: flex;
align-items: center;
justify-content: center;
} }
.result-table-view {
width: 80%;
margin: 0px auto;
}
.filter-table-view {
width: 80%;
margin: 0px auto;
}
/deep/ .el-icon-setting {
font-size: 24px;
line-height: 25px;
color: white;
}
</style>

Loading…
Cancel
Save