Browse Source

格式化代码

pull/127/head
xuxiaoming 3 years ago
parent
commit
53d4ed3e94
2 changed files with 309 additions and 307 deletions
  1. +1
    -1
      deploy.sh
  2. +308
    -306
      src/views/productionPlanning/customerForecastDemandReview/index.vue

+ 1
- 1
deploy.sh View File

@ -19,7 +19,7 @@ git checkout develop
git pull
git checkout xuxiaoming
git merge develop
GIT_MERGE_URL=$(git push origin xuxiaoming)
GIT_MERGE_URL=`git push origin xuxiaoming`
echo "\033[32m 当前分支为 ${GIT_MERGE_URL} \033[0m"


+ 308
- 306
src/views/productionPlanning/customerForecastDemandReview/index.vue View File

@ -1,7 +1,10 @@
<template>
<ContentContainer id="box" class="customer-wrapper">
<ContentContainer id="box"
class="customer-wrapper">
<!-- 上面模块 -->
<div id="top" :style="{height:topWrapHeight}" class="customer-top-wrap clearfix">
<div id="top"
:style="{height:topWrapHeight}"
class="customer-top-wrap clearfix">
<!-- 左侧客户树 -->
<!-- <div class="customer-top-left-wrap fl">
<div class="customer-tree-wrapper">
@ -29,21 +32,21 @@
</div>
<!-- 下面模块 -->
<DragBar />
<div id="bottom" :style="{height:bottomWrapHeight}" class="customer-bottom-wrap clearfix">
<div id="bottom"
:style="{height:bottomWrapHeight}"
class="customer-bottom-wrap clearfix">
<!-- 左侧 资源树 -->
<div class="customer-bottom-left-wrap fl">
<div class="resource-tree-wrapper">
<div class="resource-tree-wrapper-tree">
<!-- 资源树 -->
<el-tree
ref="resourceTree"
v-loading="resourceTreeLoading"
:data="resourceTreeData"
:props="defaultProps"
class="resource-filter-tree"
@node-click="resourceNodeClick"
>
<el-tree ref="resourceTree"
v-loading="resourceTreeLoading"
:data="resourceTreeData"
:props="defaultProps"
class="resource-filter-tree"
@node-click="resourceNodeClick">
</el-tree>
</div>
</div>
@ -56,365 +59,364 @@
</ContentContainer>
</template>
<script>
import axios from "axios";
//
import DemandPlanning from "./demandPlanning";
//
import ResourceContent from "./resourceContent";
import { mapMutations, mapState } from "vuex";
// api
import {
customertree,
getMainResourceList,
getSecondaryResourceList
} from "@/server/productionPlanning/customerForecastDemandReview";
import axios from "axios";
//
import DemandPlanning from "./demandPlanning";
//
import ResourceContent from "./resourceContent";
import { mapMutations, mapState } from "vuex";
// api
import {
customertree,
getMainResourceList,
getSecondaryResourceList
} from "@/server/productionPlanning/customerForecastDemandReview";
export default {
components: {
//
DemandPlanning,
//
ResourceContent
},
data() {
return {
// Tree
customerTreeLoading: true,
// Tree
resourceTreeLoading: true,
//
customerTreeData: [],
//
resourceTreeData: [],
//
defaultProps: {
children: "Children",
label: "Label",
isLeaf: "Leaf"
},
//
filterCustomer: "",
topWrapHeight: "calc(50% - 15px)",
bottomWrapHeight: "calc(50% - 5px)",
showBottomWrap: true
};
},
created() {
// Tree
// this.getCustomerTreeData();
// Tree
this.getResourceTreeData();
},
mounted() {
this.dragChangeSize((moveLen,bottomHeight) => {
this.SET_articleDemandHeight((moveLen - 145) + "px");
this.SET_calculateTableHeight((bottomHeight - 60) + "px");
});
},
watch: {
$route() {
this.INIT_all();
export default {
components: {
//
DemandPlanning,
//
ResourceContent
},
//
filterCustomer(val) {
this.$refs.customerTree.filter(val);
data() {
return {
// Tree
customerTreeLoading: true,
// Tree
resourceTreeLoading: true,
//
customerTreeData: [],
//
resourceTreeData: [],
//
defaultProps: {
children: "Children",
label: "Label",
isLeaf: "Leaf"
},
//
filterCustomer: "",
topWrapHeight: "calc(50% - 15px)",
bottomWrapHeight: "calc(50% - 5px)",
showBottomWrap: true
};
},
isSelectResource(val) {
this.changeTreeNodeStatus(this.$refs.resourceTree.store.root, val);
}
},
computed: {
...mapState("customerForecastDemandReview", [
"resourceId",
"resourceType",
"isSelectResource"
])
},
methods: {
...mapMutations("customerForecastDemandReview", ["SET_customerId",
"SET_artId",
"SET_resourceId",
"SET_resourceType",
"SET_articleDemandHeight",
"SET_articleCharHeight",
"SET_calculateTableHeight",
"RESET_articleChar",
"INIT_all"
]),
//
// toggleBottom(){
// if(this.showBottomWrap = !this.showBottomWrap) {
// this.topWrapHeight = "calc(50% - 15px)",
// this.bottomWrapHeight = "calc(50% - 5px)"
// this.SET_articleCharHeight("100%")
// } else {
// this.topWrapHeight = "calc(100% - 19px)",
// this.bottomWrapHeight = "1px"
// this.SET_articleCharHeight("calc(50% - 31px)")
// }
// this.RESET_articleChar()
// // this.SET_articleDemandHeight("calc(100% - 42px)")
// },
// Tree
getCustomerTreeData() {
customertree().then(({ data = [] }) => {
this.customerTreeLoading = false;
this.customerTreeData = data;
}).catch(() => {
this.customerTreeLoading = false;
created() {
// Tree
// this.getCustomerTreeData();
// Tree
this.getResourceTreeData();
},
mounted() {
this.dragChangeSize((moveLen, bottomHeight) => {
this.SET_articleDemandHeight((moveLen - 145) + "px");
this.SET_calculateTableHeight((bottomHeight - 60) + "px");
});
},
//
customerNodeClick(data) {
if (data.Leaf === true) {
//
this.SET_customerId(data.CustomerId);
watch: {
$route() {
this.INIT_all();
},
//
filterCustomer(val) {
this.$refs.customerTree.filter(val);
},
isSelectResource(val) {
this.changeTreeNodeStatus(this.$refs.resourceTree.store.root, val);
}
},
//
changeTreeNodeStatus(node, treeStatus) {
//
node.expanded = treeStatus;
for (let i = 0; i < node.childNodes.length; i++) {
//expanded
node.childNodes[i].expanded = treeStatus;
//
if (node.childNodes[i].childNodes.length > 0) {
this.changeTreeNodeStatus(node.childNodes[i]);
}
}
computed: {
...mapState("customerForecastDemandReview", [
"resourceId",
"resourceType",
"isSelectResource"
])
},
methods: {
...mapMutations("customerForecastDemandReview", ["SET_customerId",
"SET_artId",
"SET_resourceId",
"SET_resourceType",
"SET_articleDemandHeight",
"SET_articleCharHeight",
"SET_calculateTableHeight",
"RESET_articleChar",
"INIT_all"
]),
//
// toggleBottom(){
// if(this.showBottomWrap = !this.showBottomWrap) {
// this.topWrapHeight = "calc(50% - 15px)",
// this.bottomWrapHeight = "calc(50% - 5px)"
// this.SET_articleCharHeight("100%")
// } else {
// this.topWrapHeight = "calc(100% - 19px)",
// this.bottomWrapHeight = "1px"
// this.SET_articleCharHeight("calc(50% - 31px)")
// }
// this.RESET_articleChar()
// // this.SET_articleDemandHeight("calc(100% - 42px)")
// },
// Tree
getCustomerTreeData() {
customertree().then(({ data = [] }) => {
this.customerTreeLoading = false;
this.customerTreeData = data;
}).catch(() => {
this.customerTreeLoading = false;
});
},
//
customerNodeClick(data) {
if (data.Leaf === true) {
//
this.SET_customerId(data.CustomerId);
}
},
//
changeTreeNodeStatus(node, treeStatus) {
//
node.expanded = treeStatus;
for (let i = 0; i < node.childNodes.length; i++) {
//expanded
node.childNodes[i].expanded = treeStatus;
//
if (node.childNodes[i].childNodes.length > 0) {
this.changeTreeNodeStatus(node.childNodes[i]);
}
}
},
//
initResourceTreeData() {
//
this.resourceTreeData = [
//
initResourceTreeData() {
//
this.resourceTreeData = [
{
Label: eval("(" + localStorage.getItem("workshop") + ")")[0][
"Plant-Abrevname"
],
],
Children: [
{ Label: "主要资源", Children: [] },
{ Label: "次要资源", Children: [] }
]
}
];
},
// Tree
getResourceTreeData() {
axios.all([getMainResourceList(), getSecondaryResourceList()]).then(
axios.spread((mainData, secondaryData) => {
this.resourceTreeLoading = false;
//
this.initResourceTreeData();
//
if (mainData.code == 200) {
mainData.data.forEach((item) => {
this.resourceTreeData[0]["Children"][0]["Children"].push({
Label: item["AP_Resource-Descr"],
Children: null,
Type: 1,
ResourceId: item["AP_Resource-ResourceId"]
}];
},
// Tree
getResourceTreeData() {
axios.all([getMainResourceList(), getSecondaryResourceList()]).then(
axios.spread((mainData, secondaryData) => {
this.resourceTreeLoading = false;
//
this.initResourceTreeData();
//
if (mainData.code == 200) {
mainData.data.forEach((item) => {
this.resourceTreeData[0]["Children"][0]["Children"].push({
Label: item["AP_Resource-Descr"],
Children: null,
Type: 1,
ResourceId: item["AP_Resource-ResourceId"]
});
});
});
}
//
if (secondaryData.code == 200) {
secondaryData.data.forEach((item) => {
this.resourceTreeData[0]["Children"][1]["Children"].push({
Label: item["AP_SecondaryResource-Descr"],
Children: null,
Type: 2,
ResourceId: item["AP_SecondaryResource-SecondaryResourceId"]
}
//
if (secondaryData.code == 200) {
secondaryData.data.forEach((item) => {
this.resourceTreeData[0]["Children"][1]["Children"].push({
Label: item["AP_SecondaryResource-Descr"],
Children: null,
Type: 2,
ResourceId: item["AP_SecondaryResource-SecondaryResourceId"]
});
});
});
}
})
).catch(() => {
this.resourceTreeLoading = false;
});
},
//
filterCustomerTree(value, data, node) {
if (!value) {
return true;
}
return this.checkBelongToChooseNode(value, data, node);
},
//
checkBelongToChooseNode(value, data, node) {
if (data.Label.indexOf(value) !== -1) {
return true;
}
const level = node.level;
//
if (level === 1) {
return false;
}
//
let parentData = node.parent;
//
let index = 0;
while (index < level - 1) {
//
if (parentData.data.Label.indexOf(value) != -1) {
return true;
}
})
).catch(() => {
this.resourceTreeLoading = false;
});
},
//
filterCustomerTree(value, data, node) {
if (!value) {
return true;
}
return this.checkBelongToChooseNode(value, data, node);
},
//
checkBelongToChooseNode(value, data, node) {
if (data.Label.indexOf(value) !== -1) {
return true;
}
const level = node.level;
//
if (level === 1) {
//
parentData = parentData.parent;
index++;
}
// false
return false;
}
//
let parentData = node.parent;
//
let index = 0;
while (index < level - 1) {
//
if (parentData.data.Label.indexOf(value) != -1) {
return true;
},
//
resourceNodeClick(data, node) {
if (!node.data.children) {
//
this.SET_resourceId(data.ResourceId);
this.SET_resourceType(data.Type + "");
}
//
parentData = parentData.parent;
index++;
}
// false
return false;
},
//
resourceNodeClick(data, node) {
if (!node.data.children) {
//
this.SET_resourceId(data.ResourceId);
this.SET_resourceType(data.Type + "");
}
}
}
};
};
</script>
<style lang="less">
.customer-wrapper {
height: 100%;
.customer-wrapper {
height: 100%;
.customer-top-wrap {
width: 100%;
margin-bottom: 8px;
.customer-top-wrap {
width: 100%;
margin-bottom: 8px;
.customer-top-left-wrap {
width: 300px;
background: #f1f1f1;
height: 100%;
border: 2px solid #919191;
border-right: none;
.customer-top-left-wrap {
width: 300px;
background: #f1f1f1;
height: 100%;
border: 2px solid #919191;
border-right: none;
.customer-tree-wrapper {
height: calc(100% - 50px);
.customer-tree-wrapper {
height: calc(100% - 50px);
.customer-tree-wrapper-tree {
padding-left: 10px;
height: 100%;
.customer-tree-wrapper-tree {
padding-left: 10px;
height: 100%;
.customer-filter-tree {
background: #f1f1f1;
height: calc(100% - 10px);
overflow-y: auto;
}
.customer-filter-tree {
background: #f1f1f1;
height: calc(100% - 10px);
overflow-y: auto;
}
.el-tree-node__content {
border-bottom: 1px solid #fff;
}
.el-tree-node__content {
border-bottom: 1px solid #fff;
}
.el-tree-node.is-current > .el-tree-node__content {
background: linear-gradient(360deg, #1f534e 0%, #2b978e 57%, #3cbdb2 100%) !important;
color: #fff;
.el-tree-node.is-current>.el-tree-node__content {
background: linear-gradient(360deg, #1f534e 0%, #2b978e 57%, #3cbdb2 100%) !important;
color: #fff;
}
}
}
.customer-tree-wrapper-input {
height: 50px;
width: 100%;
border-bottom: 4px solid #c9c9c9;
.customer-tree-wrapper-input {
height: 50px;
width: 100%;
border-bottom: 4px solid #c9c9c9;
.el-input {
margin-left: 18px;
line-height: 53px;
width: calc(100% - 40px);
.el-input {
margin-left: 18px;
line-height: 53px;
width: calc(100% - 40px);
.el-input__inner {
height: 32px;
line-height: 32px;
.el-input__inner {
height: 32px;
line-height: 32px;
}
}
}
}
}
}
.customer-top-right-wrap {
margin-left: 0;
background: linear-gradient(180deg,
#eaeded 0%,
#ffffff 55%,
#f1f1f1 100%);
height: 100%;
border: 2px solid #919191;
.el-tabs {
height: calc(100% - 25px);
.customer-top-right-wrap {
margin-left: 0;
background: linear-gradient(180deg,
#eaeded 0%,
#ffffff 55%,
#f1f1f1 100%);
height: 100%;
border: 2px solid #919191;
.el-tabs__content {
.el-tabs {
height: calc(100% - 25px);
.el-tab-pane {
height: 100%;
.el-tabs__content {
height: calc(100% - 25px);
.el-tab-pane {
height: 100%;
}
}
}
}
}
}
.customer-bottom-wrap {
width: 100%;
margin-bottom: 5px;
.customer-bottom-wrap {
width: 100%;
margin-bottom: 5px;
.customer-bottom-left-wrap {
width: 300px;
background: #f1f1f1;
height: 100%;
border: 2px solid #919191;
border-right: none;
.customer-bottom-left-wrap {
width: 300px;
background: #f1f1f1;
height: 100%;
border: 2px solid #919191;
border-right: none;
.resource-tree-wrapper {
height: calc(100% - 10px);
.resource-tree-wrapper {
height: calc(100% - 10px);
.resource-tree-wrapper-tree {
padding-left: 10px;
height: 100%;
.resource-tree-wrapper-tree {
padding-left: 10px;
height: 100%;
.resource-filter-tree {
background: #f1f1f1;
height: calc(100% - 10px);
overflow-y: auto;
}
.resource-filter-tree {
background: #f1f1f1;
height: calc(100% - 10px);
overflow-y: auto;
}
.el-tree-node__content {
border-bottom: 1px solid #fff;
}
.el-tree-node__content {
border-bottom: 1px solid #fff;
}
.el-tree-node.is-current > .el-tree-node__content {
background: linear-gradient(360deg, #1f534e 0%, #2b978e 57%, #3cbdb2 100%) !important;
color: #fff;
.el-tree-node.is-current>.el-tree-node__content {
background: linear-gradient(360deg, #1f534e 0%, #2b978e 57%, #3cbdb2 100%) !important;
color: #fff;
}
}
}
}
}
.customer-bottom-right-wrap {
background: linear-gradient(180deg,
#eaeded 0%,
#ffffff 55%,
#f1f1f1 100%);
height: 100%;
width: 100%;
border: 2px solid #919191;
.el-tabs {
.customer-bottom-right-wrap {
background: linear-gradient(180deg,
#eaeded 0%,
#ffffff 55%,
#f1f1f1 100%);
height: 100%;
width: 100%;
border: 2px solid #919191;
.el-tabs__content {
height: calc(100% - 50px);
.el-tabs {
height: 100%;
.el-tab-pane {
height: 100%;
.el-tabs__content {
height: calc(100% - 50px);
.el-tab-pane {
height: 100%;
}
}
}
}
}
}
}
</style>
</style>

Loading…
Cancel
Save