|
@@ -164,7 +164,7 @@
|
|
|
|
|
|
<!-- 数据组选择 -->
|
|
|
<el-dialog
|
|
|
- :title="itemDataStep == 1 ? '选择数据项' : '选择四则运算表达式'"
|
|
|
+ title="选择数据项"
|
|
|
width="80%"
|
|
|
top="10vh"
|
|
|
center
|
|
@@ -172,7 +172,7 @@
|
|
|
:visible.sync="dialogDataItemVisible"
|
|
|
:close-on-click-modal="false"
|
|
|
:append-to-body="true">
|
|
|
- <div v-if="itemDataStep == 1">
|
|
|
+ <div>
|
|
|
<el-input placeholder="请输入关键字进行过滤" v-model="filterItemData"></el-input>
|
|
|
<div style="height: 50vh; margin-top: 10px; overflow: auto;">
|
|
|
<el-tree class="cy-item-tree"
|
|
@@ -198,48 +198,9 @@
|
|
|
</el-tree>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <div v-if="itemDataStep == 2">
|
|
|
- <el-table
|
|
|
- :data="itemDataListByCalc"
|
|
|
- :key="bomCheckKey"
|
|
|
- style="width: 100%">
|
|
|
- <el-table-column
|
|
|
- label="数据项名称"
|
|
|
- prop="itemName"
|
|
|
- width="300">
|
|
|
- </el-table-column>
|
|
|
- <el-table-column
|
|
|
- label="描述"
|
|
|
- prop="describe"
|
|
|
- width="150">
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-tag
|
|
|
- :type="'primary'"
|
|
|
- disable-transitions>{{ scope.row.describe }}</el-tag>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column
|
|
|
- label="四则运算表达式"
|
|
|
- prop="rule.operationRule"
|
|
|
- width="300">
|
|
|
- </el-table-column>
|
|
|
- <el-table-column label="操作">
|
|
|
- <template slot-scope="scope">
|
|
|
- <el-button
|
|
|
- size="mini"
|
|
|
- @click="handleChoose(scope.$index, scope.row)">选择表达式</el-button>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- </el-table>
|
|
|
- </div>
|
|
|
<div style="width: 100%;text-align: center;">
|
|
|
<el-button type="primary"
|
|
|
- v-if="itemDataStep == 1"
|
|
|
@click="chooseItemTreeEvent"
|
|
|
- style="margin-top: 20px;">下一步</el-button>
|
|
|
- <el-button type="primary"
|
|
|
- v-if="itemDataStep == 2"
|
|
|
- @click="chooseItemTreeEvent2"
|
|
|
style="margin-top: 20px;">确定</el-button>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
@@ -292,6 +253,65 @@
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
|
|
|
+ <!-- 选择数据组数据 -->
|
|
|
+ <el-dialog
|
|
|
+ title="选择数据项"
|
|
|
+ width="80%"
|
|
|
+ top="10vh"
|
|
|
+ center
|
|
|
+ :before-close="dialogClose"
|
|
|
+ :visible.sync="dialogGroupItemVisible"
|
|
|
+ :close-on-click-modal="false"
|
|
|
+ :append-to-body="true">
|
|
|
+ <div>
|
|
|
+ <div>
|
|
|
+ <el-select filterable
|
|
|
+ v-model="chooseDataGroup"
|
|
|
+ placeholder="请选择数据组"
|
|
|
+ style="width: calc(100% - 110px);">
|
|
|
+ <el-option
|
|
|
+ v-for="dict in dataGroupList"
|
|
|
+ :key="dict.id"
|
|
|
+ :label="dict.groupName"
|
|
|
+ :value="dict.id"
|
|
|
+ ></el-option>
|
|
|
+ </el-select>
|
|
|
+ <el-button size="mini" @click="addDataItem" style="float: right;width: 100px;margin-top: 4px;">选择数据项</el-button>
|
|
|
+ </div>
|
|
|
+ <div style="height: 50vh; margin-top: 10px; overflow: auto;">
|
|
|
+ <el-tree class="cy-item-tree"
|
|
|
+ ref="itemTree"
|
|
|
+ :data="chooseGroupItemList"
|
|
|
+ :indent="10"
|
|
|
+ node-key="id"
|
|
|
+ show-checkbox
|
|
|
+ :check-on-click-node="true"
|
|
|
+ :filter-node-method="filterItemDataNode"
|
|
|
+ :highlight-current="true"
|
|
|
+ :default-expand-all="true">
|
|
|
+ <span class="custom-tree-node" slot-scope="{ node, data }">
|
|
|
+ <svg-icon v-if="!data.children || data.children.length == 0" icon-class="file"/>
|
|
|
+ <svg-icon v-else-if="node.expanded" icon-class="folder-open"/>
|
|
|
+ <svg-icon v-else icon-class="folder"/>
|
|
|
+ <span v-if="!data.children || data.children.length == 0" :title='data.itemName || "-"' style="margin-left: 2px;">
|
|
|
+<!-- {{ data.describe-->
|
|
|
+<!-- ? ((data.itemName ? data.itemName : '') + '【' + data.describe + '】')-->
|
|
|
+<!-- : data.itemName ? data.itemName : '' }}-->
|
|
|
+ {{ '【' + data.groupName + '】' + data.itemName + (data.describe ? ('(' + data.describe + ')') : '') }}
|
|
|
+ </span>
|
|
|
+ <span v-else :title='data.groupName || "-"' style="margin-left: 2px;">
|
|
|
+ {{ data.groupName }}
|
|
|
+ </span>
|
|
|
+ </span>
|
|
|
+ </el-tree>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div style="width: 100%;text-align: center;">
|
|
|
+ <el-button type="primary" style="margin-top: 20px;" @click="itemEvent">确定</el-button>
|
|
|
+ <el-button style="margin-top: 20px;" @click="dialogClose">取消</el-button>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
</div>
|
|
|
<div v-else></div>
|
|
|
</template>
|
|
@@ -301,7 +321,7 @@ import RulerView from '@/components/RulerView'
|
|
|
import { insertEChart } from 'luckytool'
|
|
|
import {
|
|
|
getAllDataModel,
|
|
|
- getAllItemGroup, getAllTableTemplate,
|
|
|
+ getAllItemGroup, getAllTableTemplate, getItemGroupById,
|
|
|
getTableItemGroupById,
|
|
|
getTableTemplateById,
|
|
|
saveReportTemplate,
|
|
@@ -322,6 +342,7 @@ export default {
|
|
|
dialogDataItemVisible: false,
|
|
|
dialogDataModelVisible: false,
|
|
|
dialogCommReportVisible: false,
|
|
|
+ dialogGroupItemVisible: false,
|
|
|
menuLeft: 0,
|
|
|
menuTop: 0,
|
|
|
visibleChartMenu: false,
|
|
@@ -342,11 +363,11 @@ export default {
|
|
|
dataGroupList: [],
|
|
|
itemDataListByTree: [],
|
|
|
itemDataListByCalc: [],
|
|
|
+ chooseGroupItemList: [],
|
|
|
dataModelList: [],
|
|
|
chooseDataModel: null,
|
|
|
chooseDataItemIndex: null,
|
|
|
bomCheckKey: 0,
|
|
|
- itemDataStep: 1,
|
|
|
chooseDataGroup: null,
|
|
|
chooseItemData: [],
|
|
|
filterItemData: '',
|
|
@@ -668,7 +689,6 @@ export default {
|
|
|
})
|
|
|
return
|
|
|
}
|
|
|
- this.itemDataStep = 1
|
|
|
const loading = showLoading(this, '加载中,请稍候···')
|
|
|
getTableItemGroupById(id).then(res => {
|
|
|
loading.close()
|
|
@@ -708,14 +728,34 @@ export default {
|
|
|
}
|
|
|
chooseList.push(checkedNode)
|
|
|
}
|
|
|
- // this.chooseItemData = chooseList
|
|
|
- this.getAllDataModel(chooseList)
|
|
|
- },
|
|
|
- /** 选择的数据项:第二步 */
|
|
|
- chooseItemTreeEvent2() {
|
|
|
- this.chooseItemData = JSON.parse(JSON.stringify(this.itemDataListByCalc))
|
|
|
- this.itemDataStep = 1
|
|
|
+ this.chooseItemData = chooseList
|
|
|
this.dialogDataItemVisible = false
|
|
|
+ if (this.dialogGroupItemVisible) {
|
|
|
+ this.initGroupItem()
|
|
|
+ }
|
|
|
+ // this.getAllDataModel(chooseList)
|
|
|
+ },
|
|
|
+ initGroupItem() {
|
|
|
+ let group = null
|
|
|
+ for (let i = 0; i < this.dataGroupList.length; i ++) {
|
|
|
+ if (this.dataGroupList[i].id == this.chooseDataGroup) {
|
|
|
+ group = this.dataGroupList[i]
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.chooseGroupItemList = this.chooseGroupItemList.filter(function (item, index) {
|
|
|
+ return item.itemGroupId != group.id;
|
|
|
+ })
|
|
|
+
|
|
|
+ for (let j = 0; j < this.chooseItemData.length; j ++) {
|
|
|
+ this.chooseItemData[j].groupName = group.groupName
|
|
|
+ this.chooseGroupItemList.push(this.chooseItemData[j])
|
|
|
+ }
|
|
|
+ let obj = {};
|
|
|
+ this.chooseGroupItemList = this.chooseGroupItemList.reduce(function(item, next) {
|
|
|
+ obj[next.id] ? '' : obj[next.id] = true && item.push(next)
|
|
|
+ return item;
|
|
|
+ }, [])
|
|
|
},
|
|
|
/** 查询所有数据模型 */
|
|
|
getAllDataModel(itemList) {
|
|
@@ -726,7 +766,6 @@ export default {
|
|
|
}
|
|
|
getAllDataModel(params).then(res => {
|
|
|
loading.close()
|
|
|
- this.itemDataStep = 2
|
|
|
if (!res.data) {
|
|
|
this.chooseItemData = itemList
|
|
|
return
|
|
@@ -798,6 +837,17 @@ export default {
|
|
|
},
|
|
|
/** 数据项 */
|
|
|
dataEvent() {
|
|
|
+ let rangeWithFlatten = luckysheet.getRangeWithFlatten()
|
|
|
+ if (!rangeWithFlatten || rangeWithFlatten.length != 1) {
|
|
|
+ this.$message({
|
|
|
+ message: '请在 Excel 中选择图表需要存放的位置!',
|
|
|
+ type: 'warning'
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.chooseDataGroup = null
|
|
|
+ this.getDataGroupList()
|
|
|
+ this.dialogGroupItemVisible = true
|
|
|
},
|
|
|
/** 数据表 */
|
|
|
dataEvent1() {
|
|
@@ -813,6 +863,41 @@ export default {
|
|
|
this.getDataGroupList()
|
|
|
this.dialogDataVisible = true
|
|
|
},
|
|
|
+ itemEvent() {
|
|
|
+ if (this.chooseGroupItemList.length == 0) {
|
|
|
+ this.$message({
|
|
|
+ message: '请选择数据组项!',
|
|
|
+ type: 'warning'
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ let rangeWithFlatten = luckysheet.getRangeWithFlatten()
|
|
|
+ let c = rangeWithFlatten[0].c
|
|
|
+ let r = rangeWithFlatten[0].r
|
|
|
+ let fieldList = []
|
|
|
+ for (let i in this.chooseGroupItemList) {
|
|
|
+ let groupId = this.chooseGroupItemList[i].itemGroupId
|
|
|
+ let name = this.chooseGroupItemList[i].itemName
|
|
|
+ name = name.substring(name.lastIndexOf('.') + 1)
|
|
|
+ let v = '${' + groupId + '.' + name + '}'
|
|
|
+ let p_c = parseInt(c) + parseInt(i)
|
|
|
+ fieldList.push({
|
|
|
+ 'name': v,
|
|
|
+ 'r': r,
|
|
|
+ 'c': p_c
|
|
|
+ })
|
|
|
+ luckysheet.setCellValue(r, p_c, v)
|
|
|
+ }
|
|
|
+ let tableTem = {
|
|
|
+ 'item': this.chooseGroupItemList,
|
|
|
+ 'field': fieldList
|
|
|
+ }
|
|
|
+ this.toolTable.push(tableTem)
|
|
|
+ this.chooseGroupItemList = []
|
|
|
+ this.chooseDataGroup = null
|
|
|
+ this.chooseItemData = []
|
|
|
+ this.dialogGroupItemVisible = false
|
|
|
+ },
|
|
|
/** 数据字段添加 */
|
|
|
transferEvent() {
|
|
|
if (this.transferValue.length == 0) {
|
|
@@ -1105,6 +1190,7 @@ export default {
|
|
|
this.dialogDataItemVisible = false
|
|
|
this.dialogDataModelVisible = false
|
|
|
this.dialogCommReportVisible = false
|
|
|
+ this.dialogGroupItemVisible = false
|
|
|
}
|
|
|
},
|
|
|
/** 弹出层关闭事件 */
|