|
@@ -3,7 +3,7 @@
|
|
|
<div class="left-cont minHeight" id="left">
|
|
|
<div class="left-top">
|
|
|
<el-button
|
|
|
- v-permission="permissionBtn.dataSourcePermission.bcyfData_export"
|
|
|
+ v-permission="permissionBtn.dataSourcePermission.yyzxData_export"
|
|
|
style="width: 100%"
|
|
|
type="primary"
|
|
|
plain
|
|
@@ -36,16 +36,17 @@
|
|
|
<div class="scroll-wrap">
|
|
|
<el-tree
|
|
|
ref="treeRef"
|
|
|
- class="target_tree custom-tree"
|
|
|
+ class="target_tree"
|
|
|
:data="classifyList"
|
|
|
- node-key="UniqueCode"
|
|
|
+ node-key="ClassifyId"
|
|
|
:props="{
|
|
|
label: 'ClassifyName',
|
|
|
children: 'Children',
|
|
|
}"
|
|
|
- :current-node-key="select_node"
|
|
|
+ :current-node-key="select_classify"
|
|
|
:expand-on-click-node="false"
|
|
|
check-strictly
|
|
|
+ highlight-current
|
|
|
empty-text="暂无分类"
|
|
|
@current-change="nodeChangeHandle"
|
|
|
>
|
|
@@ -72,7 +73,7 @@
|
|
|
:tableOption="tableOption"
|
|
|
tableType="header"
|
|
|
ref="table"
|
|
|
- source="baiinfo"
|
|
|
+ source="yyzx"
|
|
|
@editTarget="editTargetByTable"
|
|
|
/>
|
|
|
</div>
|
|
@@ -81,7 +82,7 @@
|
|
|
:tableOption="tableOption"
|
|
|
tableType="data"
|
|
|
:dateArr="dateArr"
|
|
|
- source="baiinfo"
|
|
|
+ source="yyzx"
|
|
|
/>
|
|
|
</div>
|
|
|
<div v-else class="nodata"></div>
|
|
@@ -96,13 +97,13 @@
|
|
|
|
|
|
<script>
|
|
|
import lzTable from "@/components/lzTable.vue";
|
|
|
-import { baiinfoInterface } from "@/api/api.js";
|
|
|
+import { yongyiInterface } from "@/api/api.js";
|
|
|
export default {
|
|
|
name: "Yyzx",
|
|
|
components: { lzTable },
|
|
|
data() {
|
|
|
return {
|
|
|
- exportBase:process.env.VUE_APP_API_ROOT + "/datamanage/export/baiinfoList", //ssm数据导出接口
|
|
|
+ exportBase:process.env.VUE_APP_API_ROOT + "/datamanage/yongyi/export", //ssm数据导出接口
|
|
|
dataloading: false,
|
|
|
rightShow: false,
|
|
|
select_classify: 0,
|
|
@@ -116,98 +117,24 @@ export default {
|
|
|
|
|
|
leftSearchVal: "", //左侧搜索值
|
|
|
leftSearchTradeCode: "", //如果是搜索选择的 则有此code
|
|
|
- select_quota: "", // 选择的指标名
|
|
|
- select_Unit: "", // 选择的单位
|
|
|
- select_ModifyTime: "", //选中的更新时间
|
|
|
- select_breed: "", // 选中的分类名称
|
|
|
isShowSingleData: false, //右侧是否展示的是单个指标数据
|
|
|
- singleDataCode: "",
|
|
|
};
|
|
|
},
|
|
|
methods: {
|
|
|
/* 获取分类 */
|
|
|
getClassify() {
|
|
|
- baiinfoInterface.classifyList().then((res) => {
|
|
|
+ yongyiInterface.classifyList().then((res) => {
|
|
|
if (res.Ret !== 200) return;
|
|
|
- let Data = res.Data.List || [];
|
|
|
- //对分类数据做处理:
|
|
|
- this.classifyList = this.formatClassifyData(Data, 1, 0);
|
|
|
+ this.classifyList = res.Data.List || [];
|
|
|
});
|
|
|
},
|
|
|
- formatClassifyData(arr, level, topParentNodeId) {
|
|
|
- arr.forEach((item) => {
|
|
|
- const { ClassifyId, BaseFromBaiinfoIndexId, BaseFromBaiinfoIndexCode } =
|
|
|
- item;
|
|
|
- //每条数据添加UniqueCode属性,由ClassifyId BaseFromBaiinfoIndexId BaseFromBaiinfoIndexCode拼接
|
|
|
- item.UniqueCode = `${ClassifyId}_${BaseFromBaiinfoIndexId}_${BaseFromBaiinfoIndexCode}`;
|
|
|
- //添加Button属性,用于控制操作栏
|
|
|
- item.Button = {
|
|
|
- AddButton: true,
|
|
|
- OpButton: true,
|
|
|
- DeleteButton: true,
|
|
|
- MoveButton: true,
|
|
|
- cleanButton: false,
|
|
|
- targetDelButton: false,
|
|
|
- };
|
|
|
- //未分类禁用所有操作栏
|
|
|
- if (item.ClassifyId === 0) {
|
|
|
- item.Button = {
|
|
|
- AddButton: false,
|
|
|
- OpButton: false,
|
|
|
- DeleteButton: false,
|
|
|
- MoveButton: false,
|
|
|
- cleanButton: false,
|
|
|
- targetDelButton: false,
|
|
|
- };
|
|
|
- }
|
|
|
- //二级分类禁用添加按钮
|
|
|
- if (item.Level === 2) {
|
|
|
- item.Button = {
|
|
|
- AddButton: false,
|
|
|
- OpButton: true,
|
|
|
- DeleteButton: true,
|
|
|
- MoveButton: true,
|
|
|
- cleanButton: false,
|
|
|
- targetDelButton: false,
|
|
|
- };
|
|
|
- }
|
|
|
- //指标禁用删除按钮
|
|
|
- if (item.BaseFromBaiinfoIndexCode) {
|
|
|
- item.Button = {
|
|
|
- AddButton: false,
|
|
|
- OpButton: true,
|
|
|
- DeleteButton: false,
|
|
|
- MoveButton: true,
|
|
|
- cleanButton: true,
|
|
|
- targetDelButton: true,
|
|
|
- };
|
|
|
- //未分类下的指标,禁用清除按钮
|
|
|
- if (topParentNodeId === 0) {
|
|
|
- item.Button["cleanButton"] = false;
|
|
|
- }
|
|
|
- }
|
|
|
- //非一级分类添加一级父节点id
|
|
|
- if (level !== 1) {
|
|
|
- item.topParentNodeId = topParentNodeId;
|
|
|
- }
|
|
|
- if (item.Children && item.Children.length) {
|
|
|
- this.formatClassifyData(
|
|
|
- item.Children,
|
|
|
- level + 1,
|
|
|
- level === 1 ? item.ClassifyId : item.ParentId
|
|
|
- );
|
|
|
- }
|
|
|
- });
|
|
|
- return arr;
|
|
|
- },
|
|
|
/* 获取数据 */
|
|
|
getDataList: _.throttle(function () {
|
|
|
this.isShowSingleData = false;
|
|
|
this.dataloading = true;
|
|
|
- baiinfoInterface
|
|
|
+ yongyiInterface
|
|
|
.dataList({
|
|
|
ClassifyId: this.select_classify,
|
|
|
- Frequency: this.select_frequency,
|
|
|
PageSize: this.page_size,
|
|
|
CurrentIndex: this.page_no,
|
|
|
})
|
|
@@ -278,7 +205,7 @@ export default {
|
|
|
this.isShowSingleData = true;
|
|
|
this.dataloading = true;
|
|
|
try {
|
|
|
- const res = await baiinfoInterface.getTargetDataList({
|
|
|
+ const res = await yongyiInterface.getTargetDataList({
|
|
|
IndexCode: code,
|
|
|
});
|
|
|
this.rightShow = true;
|
|
@@ -357,21 +284,9 @@ export default {
|
|
|
exportClick() {
|
|
|
this.btnload = true;
|
|
|
const link = document.createElement("a");
|
|
|
- link.href = this.exportSmmapi;
|
|
|
+ link.href = this.exportDataUrl;
|
|
|
link.download = "";
|
|
|
link.click();
|
|
|
- console.log({
|
|
|
- IndexName: this.select_quota,
|
|
|
- IndexCode: this.leftSearchTradeCode,
|
|
|
- sendIndexCode: this.escapeStr(this.leftSearchTradeCode),
|
|
|
- TypeName: this.select_breed,
|
|
|
- sendTypeName: this.escapeStr(this.select_breed),
|
|
|
- Frequency: this.select_frequency,
|
|
|
- UnitName: this.select_Unit,
|
|
|
- ModifyTime: this.select_ModifyTime,
|
|
|
- sendToken: this.escapeStr(localStorage.getItem("auth") || ""),
|
|
|
- url: this.exportSmmapi,
|
|
|
- });
|
|
|
setTimeout(() => {
|
|
|
this.btnload = false;
|
|
|
}, 5000);
|
|
@@ -380,7 +295,7 @@ export default {
|
|
|
async handleLeftSearch(query, cb) {
|
|
|
cb([]);
|
|
|
if (!query) return;
|
|
|
- const res = await baiinfoInterface.getTargetListByName({
|
|
|
+ const res = await yongyiInterface.getTargetListByName({
|
|
|
Keyword: query,
|
|
|
});
|
|
|
if (res.Ret === 200) {
|
|
@@ -395,53 +310,13 @@ export default {
|
|
|
// 选中左侧搜索值
|
|
|
handleSelectLeftSearchval(e) {
|
|
|
if (!e.IndexCode) return;
|
|
|
- //this.select_frequency=e.Frequency
|
|
|
- //this.select_classify=e.Type2+'#'+e.Type3
|
|
|
this.leftSearchTradeCode = e.IndexCode;
|
|
|
this.leftSearchVal = e.IndexName;
|
|
|
- this.select_quota = e.IndexName;
|
|
|
- this.select_Unit = e.Unit;
|
|
|
- this.select_ModifyTime = e.ModifyTime;
|
|
|
- this.select_breed = "";
|
|
|
- // 关闭watcher
|
|
|
- this.isAuto = false;
|
|
|
|
|
|
// 获取单独指标数据
|
|
|
this.getTargetDataList(e.IndexCode);
|
|
|
-
|
|
|
- this.$nextTick(() => {
|
|
|
- //找到父节点并展开
|
|
|
- const targetData = this.getTargetData(e.IndexCode, this.classifyList);
|
|
|
- if (targetData) {
|
|
|
- //一级节点
|
|
|
- const { topParentNodeId, UniqueCode } = targetData;
|
|
|
- this.handleNodeExpand({ UniqueCode: `${topParentNodeId}_0_` });
|
|
|
- //二级节点
|
|
|
- if (topParentNodeId !== 0) {
|
|
|
- const secondNodeId = UniqueCode.split("_")[0];
|
|
|
- this.handleNodeExpand({ UniqueCode: `${secondNodeId}_0_` });
|
|
|
- }
|
|
|
- //节点样式变化
|
|
|
- const tree = $(".target_tree")[0];
|
|
|
- let width = tree.offsetWidth;
|
|
|
- let label_width =
|
|
|
- width > 500 ? "auto" : width <= 500 ? 90 : 0.7 * width;
|
|
|
- targetData.NodeWidth = label_width;
|
|
|
- this.select_node = UniqueCode;
|
|
|
- this.$refs.treeRef.setCurrentNode(targetData);
|
|
|
- const node = this.$refs.treeRef.getCurrentNode();
|
|
|
- this.resetNodeStyle(node);
|
|
|
- }
|
|
|
- //this.handleScrollLeftWrap()
|
|
|
- });
|
|
|
- },
|
|
|
- // 左侧滚动
|
|
|
- handleScrollLeftWrap() {
|
|
|
- let top = $(".act")[0].offsetTop;
|
|
|
- $(".classify-list").animate({
|
|
|
- scrollTop: top - 200,
|
|
|
- });
|
|
|
},
|
|
|
+
|
|
|
getTargetData(code, arr) {
|
|
|
for (const item of arr) {
|
|
|
if (item.BaseFromBaiinfoIndexCode === code) return item;
|
|
@@ -455,72 +330,29 @@ export default {
|
|
|
escapeStr(str) {
|
|
|
return str.replace(/#/g, escape("#")).replace(/;/g, escape(";"));
|
|
|
},
|
|
|
- checkNode(data, node) {
|
|
|
- const { level, parent } = node;
|
|
|
- const parentNodeId = parent.data.ClassifyId;
|
|
|
- const Children = data.Children || [];
|
|
|
- //如果是二级分类 或是一级分类的未分类
|
|
|
- if (
|
|
|
- (level === 2 && parentNodeId !== 0 && Children.length) ||
|
|
|
- (level === 1 && data.ClassifyId === 0 && Children.length)
|
|
|
- ) {
|
|
|
- this.getClassifyData(data.ClassifyId);
|
|
|
- //如果是指标
|
|
|
- } else if (level === 3 || (level === 2 && parentNodeId === 0)) {
|
|
|
- this.getBaiinfoData(data.BaseFromBaiinfoIndexCode);
|
|
|
- //如果是一级分类或空的二级指标
|
|
|
- } else if (level === 1 || (level === 2 && !Children.length)) {
|
|
|
- this.rightShow = false;
|
|
|
- this.isShowSingleData = false;
|
|
|
- }
|
|
|
- },
|
|
|
+
|
|
|
//改变选中节点
|
|
|
nodeChangeHandle(data, node) {
|
|
|
- if (data.UniqueCode === this.select_node) return;
|
|
|
- this.dynamicNode = node;
|
|
|
- this.select_node = data.UniqueCode;
|
|
|
+ if (data.ClassifyId === this.select_classify) return;
|
|
|
+ this.select_classify = data.ClassifyId;
|
|
|
+ this.leftSearchVal=''
|
|
|
this.page_no = 1;
|
|
|
this.page_size = 20;
|
|
|
- this.resetNodeStyle(node);
|
|
|
- this.checkNode(data, node);
|
|
|
- },
|
|
|
- //获取二级分类的表格数据
|
|
|
- async getClassifyData(id) {
|
|
|
- this.select_classify = id;
|
|
|
- this.select_frequency = "";
|
|
|
- await this.getFrequency();
|
|
|
- this.getDataList();
|
|
|
- },
|
|
|
- //获取指标数据
|
|
|
- getBaiinfoData(code) {
|
|
|
- this.singleDataCode = code;
|
|
|
- this.getTargetDataList(code);
|
|
|
+ this.getDataList()
|
|
|
},
|
|
|
|
|
|
},
|
|
|
computed: {
|
|
|
- exportSmmapi() {
|
|
|
- // smm数据导出接口
|
|
|
+ exportDataUrl() {
|
|
|
+ // 数据导出接口
|
|
|
let urlStr = this.exportBase;
|
|
|
// token
|
|
|
urlStr += `?${localStorage.getItem("auth") || ""}`;
|
|
|
if (this.isShowSingleData) {
|
|
|
// 指标id
|
|
|
urlStr += `&IndexCode=${
|
|
|
- this.isShowSingleData ? this.singleDataCode : ""
|
|
|
+ this.isShowSingleData ? this.leftSearchTradeCode : ""
|
|
|
}`;
|
|
|
- // 指标名称参数
|
|
|
- urlStr += `&IndexName=${this.select_quota}`;
|
|
|
- /* // 指标id
|
|
|
- urlStr+=`&IndexCode=${this.leftSearchTradeCode}` */
|
|
|
- // 分类名称
|
|
|
- urlStr += `&TypeName=${this.select_breed}`;
|
|
|
- // 频度
|
|
|
- urlStr += `&Frequency=${this.select_frequency}`;
|
|
|
- // 单位
|
|
|
- urlStr += `&UnitName=${this.select_Unit}`;
|
|
|
- // 修改时间
|
|
|
- urlStr += `&ModifyTime=${this.select_ModifyTime}`;
|
|
|
} else {
|
|
|
// 目录id
|
|
|
urlStr += `&ClassifyId=${
|