|
|
@ -1,226 +1,296 @@ |
|
|
|
<template> |
|
|
|
<div class="predict-wrapper"> |
|
|
|
<queryComponent |
|
|
|
:customerId="customerId" |
|
|
|
:CreateModel="CreateModel" |
|
|
|
:isShowComponent="isShowComponent" |
|
|
|
:isShowAddButton="true" |
|
|
|
:isDropdown="true" |
|
|
|
:batchImport="batchImport" |
|
|
|
@searchEmit="searchEmitHandle" |
|
|
|
@resetEmit="resetEmitHandle" |
|
|
|
@batchReleaseEmit="batchReleaseEmit" |
|
|
|
/> |
|
|
|
<div class="content-table-wrap" ref="topTableRef"> |
|
|
|
<el-table |
|
|
|
class="predict-table" |
|
|
|
v-if="tableHeight" |
|
|
|
:height="tableHeight" |
|
|
|
:data="tableData" |
|
|
|
v-loading="loading" |
|
|
|
size="mini" |
|
|
|
@selection-change="handleSelectionChange" |
|
|
|
border> |
|
|
|
<el-table-column type="selection" width="55" align="center" /> |
|
|
|
<el-table-column v-for="(item, index) in headers" :key="index" :label="getColumnName(item)" width="170" :show-overflow-tooltip="true"> |
|
|
|
<template #default="scope"> |
|
|
|
<span v-if="item === 'AP_CustDemandVerHead-PlantNr'">{{ getWorkshopName(scope.row['AP_CustDemandVerHead-PlantNr']) }}</span> |
|
|
|
<span v-else-if="item === 'AP_CustDemandVerHead-Status'">{{ scope.row['AP_CustDemandVerHead-Status'] == '1' ? '已发布':'未发布' }}</span> |
|
|
|
<span v-else-if="item === 'AP_CustDemandVerHead-GlobalPublish'">{{ scope.row['AP_CustDemandVerHead-GlobalPublish'] == 1 ? '是':'否' }}</span> |
|
|
|
<span v-else-if="item === 'AP_CustDemandVerHead-Valid'">{{ scope.row['AP_CustDemandVerHead-Valid'] == true ? '当前使用':'' }}</span> |
|
|
|
<span v-else>{{ scope.row[item] }}</span> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column align="center" label="操作" width="350" fixed="right"> |
|
|
|
<template #default="scope"> |
|
|
|
<el-button class="edit-button-style" :disabled="!customerId" @click="handleRing(scope.row)" icon="el-icon-pie-chart" size="small">环比</el-button> |
|
|
|
<el-button class="edit-button-style" :disabled="!customerId" @click="handleWith(scope.row)" icon="el-icon-s-data" size="small">同比</el-button> |
|
|
|
<el-button class="edit-button-style" @click="handleEdit(scope.row)" icon="el-icon-edit" size="small">修改</el-button> |
|
|
|
<el-button class="edit-button-style" @click="handleCopy(scope.row)" icon="el-icon-document-copy" size="small">复制</el-button> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
</el-table> |
|
|
|
<Pagination v-show="pagination.total>0" v-model:pagination="pagination" @change="getPredictList" /> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="predict-wrapper"> |
|
|
|
<queryComponent |
|
|
|
:customerId="customerId" |
|
|
|
:CreateModel="CreateModel" |
|
|
|
:isShowComponent="isShowComponent" |
|
|
|
:isShowAddButton="true" |
|
|
|
:isDropdown="true" |
|
|
|
:batchImport="batchImport" |
|
|
|
@searchEmit="searchEmitHandle" |
|
|
|
@resetEmit="resetEmitHandle" |
|
|
|
@batchReleaseEmit="batchReleaseEmit" |
|
|
|
/> |
|
|
|
<div class="content-table-wrap" ref="topTableRef"> |
|
|
|
<el-table |
|
|
|
class="predict-table" |
|
|
|
v-if="tableHeight" |
|
|
|
:height="tableHeight" |
|
|
|
:data="tableData" |
|
|
|
v-loading="loading" |
|
|
|
size="mini" |
|
|
|
@selection-change="handleSelectionChange" |
|
|
|
border |
|
|
|
> |
|
|
|
<el-table-column type="selection" width="55" align="center" /> |
|
|
|
<el-table-column |
|
|
|
v-for="(item, index) in headers" |
|
|
|
:key="index" |
|
|
|
:label="getColumnName(item)" |
|
|
|
width="170" |
|
|
|
:show-overflow-tooltip="true" |
|
|
|
> |
|
|
|
<template #default="scope"> |
|
|
|
<span v-if="item === 'AP_CustDemandVerHead-PlantNr'">{{ |
|
|
|
getWorkshopName(scope.row["AP_CustDemandVerHead-PlantNr"]) |
|
|
|
}}</span> |
|
|
|
<span v-else-if="item === 'AP_CustDemandVerHead-Status'">{{ |
|
|
|
scope.row["AP_CustDemandVerHead-Status"] == "1" ? "已发布" : "未发布" |
|
|
|
}}</span> |
|
|
|
<span v-else-if="item === 'AP_CustDemandVerHead-GlobalPublish'">{{ |
|
|
|
scope.row["AP_CustDemandVerHead-GlobalPublish"] == 1 ? "是" : "否" |
|
|
|
}}</span> |
|
|
|
<span v-else-if="item === 'AP_CustDemandVerHead-Valid'">{{ |
|
|
|
scope.row["AP_CustDemandVerHead-Valid"] == true ? "当前使用" : "" |
|
|
|
}}</span> |
|
|
|
<span v-else>{{ scope.row[item] }}</span> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column align="center" label="操作" width="350" fixed="right"> |
|
|
|
<template #default="scope"> |
|
|
|
<el-button |
|
|
|
class="edit-button-style" |
|
|
|
:disabled="!customerId" |
|
|
|
@click="handleRing(scope.row)" |
|
|
|
icon="el-icon-pie-chart" |
|
|
|
size="small" |
|
|
|
>环比</el-button |
|
|
|
> |
|
|
|
<el-button |
|
|
|
class="edit-button-style" |
|
|
|
:disabled="!customerId" |
|
|
|
@click="handleWith(scope.row)" |
|
|
|
icon="el-icon-s-data" |
|
|
|
size="small" |
|
|
|
>同比</el-button |
|
|
|
> |
|
|
|
<el-button |
|
|
|
class="edit-button-style" |
|
|
|
@click="handleEdit(scope.row)" |
|
|
|
icon="el-icon-edit" |
|
|
|
size="small" |
|
|
|
>修改</el-button |
|
|
|
> |
|
|
|
<el-button |
|
|
|
class="edit-button-style" |
|
|
|
@click="handleCopy(scope.row)" |
|
|
|
icon="el-icon-document-copy" |
|
|
|
size="small" |
|
|
|
>复制</el-button |
|
|
|
> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
</el-table> |
|
|
|
<Pagination |
|
|
|
v-show="pagination.total > 0" |
|
|
|
v-model:pagination="pagination" |
|
|
|
@change="getPredictList" |
|
|
|
/> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
<script> |
|
|
|
import { get } from "@/server/api.js"; |
|
|
|
import { mapMutations } from "vuex"; |
|
|
|
import queryComponent from '@/components/queryComponent' |
|
|
|
import queryComponent from "@/components/queryComponent"; |
|
|
|
export default { |
|
|
|
components: { |
|
|
|
queryComponent |
|
|
|
}, |
|
|
|
props: ["customerId", "CreateModel", "isShowComponent","tableHeight"], |
|
|
|
data() { |
|
|
|
return { |
|
|
|
tableData: [], |
|
|
|
headers: [ |
|
|
|
"AP_CustDemandVerHead-PlantNr", |
|
|
|
"AP_CustDemandVerHead-CustomerId", |
|
|
|
"AP_CustDemandVerHead-VersionId", |
|
|
|
"AP_CustDemandVerHead-Descr", |
|
|
|
"AP_CustDemandVerHead-Valid", |
|
|
|
"AP_CustDemandVerHead-Status", |
|
|
|
"AP_CustDemandVerHead-GlobalPublish", |
|
|
|
"AP_CustDemandVerHead-PlanReleaseTime", |
|
|
|
"AP_CustDemandVerHead-ActualReleaseTime", |
|
|
|
// "AP_CustDemandVerHead-CreateMode", |
|
|
|
"AP_CustDemandVerHead-CreateUser", |
|
|
|
"AP_CustDemandVerHead-LastModify", |
|
|
|
"AP_CustDemandVerHead-LastUser", |
|
|
|
"AP_CustDemandVerHead-CreateTime", |
|
|
|
], |
|
|
|
loading: false, |
|
|
|
artId: undefined, |
|
|
|
valid: undefined, |
|
|
|
versionId: undefined, |
|
|
|
status: undefined, |
|
|
|
pagination: { |
|
|
|
// 分页参数 |
|
|
|
pageNumber: 1, |
|
|
|
pageSize: 10, |
|
|
|
total: 0, |
|
|
|
pageSizes:[10,50,100,200] |
|
|
|
}, |
|
|
|
batchImport: [], |
|
|
|
// isRefreshList: false, |
|
|
|
} |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
// 批量发布组件回显 |
|
|
|
batchReleaseEmit(value) { |
|
|
|
// this.isRefreshList = value |
|
|
|
if (value) { |
|
|
|
this.getPredictList() |
|
|
|
} |
|
|
|
}, |
|
|
|
// 批量发布 |
|
|
|
handleSelectionChange(val) { |
|
|
|
this.batchImport = [] |
|
|
|
val.forEach(el => { |
|
|
|
this.batchImport.push({ |
|
|
|
"AP_CustDemandVerHead-CustomerId": el['AP_CustDemandVerHead-CustomerId'], |
|
|
|
"AP_CustDemandVerHead-VersionId": el['AP_CustDemandVerHead-VersionId'] |
|
|
|
}) |
|
|
|
}) |
|
|
|
components: { |
|
|
|
queryComponent, |
|
|
|
}, |
|
|
|
props: ["customerId", "CreateModel", "isShowComponent", "tableHeight"], |
|
|
|
data() { |
|
|
|
return { |
|
|
|
tableData: [], |
|
|
|
headers: [ |
|
|
|
"AP_CustDemandVerHead-PlantNr", |
|
|
|
"AP_CustDemandVerHead-CustomerId", |
|
|
|
"AP_CustDemandVerHead-CustomerName", |
|
|
|
"AP_CustDemandVerHead-VersionId", |
|
|
|
"AP_CustDemandVerHead-Descr", |
|
|
|
"AP_CustDemandVerHead-Valid", |
|
|
|
"AP_CustDemandVerHead-Status", |
|
|
|
"AP_CustDemandVerHead-GlobalPublish", |
|
|
|
"AP_CustDemandVerHead-PlanReleaseTime", |
|
|
|
"AP_CustDemandVerHead-ActualReleaseTime", |
|
|
|
// "AP_CustDemandVerHead-CreateMode", |
|
|
|
"AP_CustDemandVerHead-CreateUser", |
|
|
|
"AP_CustDemandVerHead-LastModify", |
|
|
|
"AP_CustDemandVerHead-LastUser", |
|
|
|
"AP_CustDemandVerHead-CreateTime", |
|
|
|
], |
|
|
|
loading: false, |
|
|
|
artId: undefined, |
|
|
|
valid: undefined, |
|
|
|
versionId: undefined, |
|
|
|
status: undefined, |
|
|
|
pagination: { |
|
|
|
// 分页参数 |
|
|
|
pageNumber: 1, |
|
|
|
pageSize: 10, |
|
|
|
total: 0, |
|
|
|
pageSizes: [10, 50, 100, 200], |
|
|
|
}, |
|
|
|
batchImport: [], |
|
|
|
// isRefreshList: false, |
|
|
|
}; |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
// 批量发布组件回显 |
|
|
|
batchReleaseEmit(value) { |
|
|
|
// this.isRefreshList = value |
|
|
|
if (value) { |
|
|
|
this.getPredictList(); |
|
|
|
} |
|
|
|
}, |
|
|
|
...mapMutations("homePageStore", ["getWithRingStatus"]), |
|
|
|
handleRing(row) { // 环比 |
|
|
|
let newData = {} |
|
|
|
newData.activeName = 'second' |
|
|
|
newData.withTheRing = '2' |
|
|
|
newData.versonId = row['AP_CustDemandVerHead-VersionId'] |
|
|
|
this.getWithRingStatus(newData) |
|
|
|
}, |
|
|
|
handleWith(row) { // 同比 |
|
|
|
let newData = {} |
|
|
|
newData.activeName = 'second' |
|
|
|
newData.withTheRing = '1' |
|
|
|
newData.versonId = row['AP_CustDemandVerHead-VersionId'] |
|
|
|
this.getWithRingStatus(newData) |
|
|
|
}, |
|
|
|
// 获取预测版本列表 |
|
|
|
getPredictList(id, artId, valid, versionId, status) { |
|
|
|
this.loading = true |
|
|
|
let customerId = undefined |
|
|
|
let grouptype = undefined |
|
|
|
if (id === 'MAIN' || this.customerId === 'MAIN') { // 瑞玛工业 |
|
|
|
customerId = undefined |
|
|
|
grouptype = undefined |
|
|
|
} else if (id === 'CUST' || id === 'GRP' || this.customerId === 'CUST' || this.customerId === 'GRP') { // 单客户、集团 |
|
|
|
customerId = undefined |
|
|
|
grouptype = id |
|
|
|
} else { // 普通客户 |
|
|
|
customerId = id || this.customerId |
|
|
|
grouptype = undefined |
|
|
|
} |
|
|
|
get(`/admin/ap/custdemandverhead/selectdata`, { |
|
|
|
...this.pagination, |
|
|
|
customerId: customerId, |
|
|
|
artId: artId || this.artId, |
|
|
|
valid: valid || this.valid, |
|
|
|
versionId: versionId || this.versionId, |
|
|
|
status: status || this.status, |
|
|
|
grouptype: grouptype |
|
|
|
}).then(({ code, data: { count = 0, records = [] } }) => { |
|
|
|
if (code === 200) { |
|
|
|
this.loading = false |
|
|
|
this.tableData = records || [] |
|
|
|
this.pagination.total = count |
|
|
|
} else { |
|
|
|
this.loading = false |
|
|
|
} |
|
|
|
}).catch(() => { |
|
|
|
this.loading = false |
|
|
|
}) |
|
|
|
}, |
|
|
|
searchEmitHandle(data) { |
|
|
|
this.getPredictList(this.customerId, data.artId, data.valid, data.versionId, data.status) |
|
|
|
}, |
|
|
|
resetEmitHandle() { |
|
|
|
this.getPredictList(this.customerId) |
|
|
|
}, |
|
|
|
// 新增按钮操作 |
|
|
|
// 批量发布 |
|
|
|
handleSelectionChange(val) { |
|
|
|
this.batchImport = []; |
|
|
|
val.forEach((el) => { |
|
|
|
this.batchImport.push({ |
|
|
|
"AP_CustDemandVerHead-CustomerId": el["AP_CustDemandVerHead-CustomerId"], |
|
|
|
"AP_CustDemandVerHead-VersionId": el["AP_CustDemandVerHead-VersionId"], |
|
|
|
}); |
|
|
|
}); |
|
|
|
}, |
|
|
|
...mapMutations("homePageStore", ["getWithRingStatus"]), |
|
|
|
handleRing(row) { |
|
|
|
// 环比 |
|
|
|
let newData = {}; |
|
|
|
newData.activeName = "second"; |
|
|
|
newData.withTheRing = "2"; |
|
|
|
newData.versonId = row["AP_CustDemandVerHead-VersionId"]; |
|
|
|
this.getWithRingStatus(newData); |
|
|
|
}, |
|
|
|
handleWith(row) { |
|
|
|
// 同比 |
|
|
|
let newData = {}; |
|
|
|
newData.activeName = "second"; |
|
|
|
newData.withTheRing = "1"; |
|
|
|
newData.versonId = row["AP_CustDemandVerHead-VersionId"]; |
|
|
|
this.getWithRingStatus(newData); |
|
|
|
}, |
|
|
|
// 获取预测版本列表 |
|
|
|
getPredictList(id, artId, valid, versionId, status) { |
|
|
|
this.loading = true; |
|
|
|
let customerId = undefined; |
|
|
|
let grouptype = undefined; |
|
|
|
if (id === "MAIN" || this.customerId === "MAIN") { |
|
|
|
// 瑞玛工业 |
|
|
|
customerId = undefined; |
|
|
|
grouptype = undefined; |
|
|
|
} else if ( |
|
|
|
id === "CUST" || |
|
|
|
id === "GRP" || |
|
|
|
this.customerId === "CUST" || |
|
|
|
this.customerId === "GRP" |
|
|
|
) { |
|
|
|
// 单客户、集团 |
|
|
|
customerId = undefined; |
|
|
|
grouptype = id; |
|
|
|
} else { |
|
|
|
// 普通客户 |
|
|
|
customerId = id || this.customerId; |
|
|
|
grouptype = undefined; |
|
|
|
} |
|
|
|
get(`/admin/ap/custdemandverhead/selectdata`, { |
|
|
|
...this.pagination, |
|
|
|
customerId: customerId, |
|
|
|
artId: artId || this.artId, |
|
|
|
valid: valid || this.valid, |
|
|
|
versionId: versionId || this.versionId, |
|
|
|
status: status || this.status, |
|
|
|
grouptype: grouptype, |
|
|
|
}) |
|
|
|
.then(({ code, data: { count = 0, records = [] } }) => { |
|
|
|
if (code === 200) { |
|
|
|
this.loading = false; |
|
|
|
this.tableData = records || []; |
|
|
|
this.pagination.total = count; |
|
|
|
} else { |
|
|
|
this.loading = false; |
|
|
|
} |
|
|
|
}) |
|
|
|
.catch(() => { |
|
|
|
this.loading = false; |
|
|
|
}); |
|
|
|
}, |
|
|
|
searchEmitHandle(data) { |
|
|
|
this.getPredictList( |
|
|
|
this.customerId, |
|
|
|
data.artId, |
|
|
|
data.valid, |
|
|
|
data.versionId, |
|
|
|
data.status |
|
|
|
); |
|
|
|
}, |
|
|
|
resetEmitHandle() { |
|
|
|
this.getPredictList(this.customerId); |
|
|
|
}, |
|
|
|
// 新增按钮操作 |
|
|
|
handleNew() { |
|
|
|
if (!this.customerId) { |
|
|
|
this.msgError('请先选择客户') |
|
|
|
return |
|
|
|
} |
|
|
|
this.$router.push({path:'/plan/workbench/homePage/beta/predict/predictEdit', query: { |
|
|
|
CustomerId: this.customerId, |
|
|
|
CreateModel: this.CreateModel, |
|
|
|
}}) |
|
|
|
if (!this.customerId) { |
|
|
|
this.msgError("请先选择客户"); |
|
|
|
return; |
|
|
|
} |
|
|
|
this.$router.push({ |
|
|
|
path: "/plan/workbench/homePage/beta/predict/predictEdit", |
|
|
|
query: { |
|
|
|
CustomerId: this.customerId, |
|
|
|
CreateModel: this.CreateModel, |
|
|
|
}, |
|
|
|
}); |
|
|
|
}, |
|
|
|
// 编辑 |
|
|
|
handleEdit(row) { |
|
|
|
this.$router.push({path:'/plan/workbench/homePage/beta/predict/predictEdit',query: { |
|
|
|
CustomerId: row['AP_CustDemandVerHead-CustomerId'], |
|
|
|
VersionId: row['AP_CustDemandVerHead-VersionId'], |
|
|
|
title: '修改' |
|
|
|
}}) |
|
|
|
}, |
|
|
|
// 复制 |
|
|
|
handleCopy(row) { |
|
|
|
this.$router.push({path:'/plan/workbench/homePage/beta/predict/predictEdit',query: { |
|
|
|
CustomerId: row['AP_CustDemandVerHead-CustomerId'], |
|
|
|
VersionId: row['AP_CustDemandVerHead-VersionId'], |
|
|
|
CreateModel: row['AP_CustDemandVerHead-CreateMode'], |
|
|
|
title: '复制' |
|
|
|
}}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
mounted() { |
|
|
|
this.$nextTick(()=>{ |
|
|
|
let tableHeight = this.calculationTableHeight( |
|
|
|
this.$refs.topTableRef, |
|
|
|
40 |
|
|
|
); |
|
|
|
this.$emit('calculateTableHeight', tableHeight) |
|
|
|
}) |
|
|
|
}, |
|
|
|
watch: { |
|
|
|
// 监听客户ID的变化 |
|
|
|
customerId: { |
|
|
|
handler (data) { |
|
|
|
this.getPredictList(data) |
|
|
|
}, |
|
|
|
deep: true |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
// 编辑 |
|
|
|
handleEdit(row) { |
|
|
|
this.$router.push({ |
|
|
|
path: "/plan/workbench/homePage/beta/predict/predictEdit", |
|
|
|
query: { |
|
|
|
CustomerId: row["AP_CustDemandVerHead-CustomerId"], |
|
|
|
VersionId: row["AP_CustDemandVerHead-VersionId"], |
|
|
|
title: "修改", |
|
|
|
}, |
|
|
|
}); |
|
|
|
}, |
|
|
|
// 复制 |
|
|
|
handleCopy(row) { |
|
|
|
this.$router.push({ |
|
|
|
path: "/plan/workbench/homePage/beta/predict/predictEdit", |
|
|
|
query: { |
|
|
|
CustomerId: row["AP_CustDemandVerHead-CustomerId"], |
|
|
|
VersionId: row["AP_CustDemandVerHead-VersionId"], |
|
|
|
CreateModel: row["AP_CustDemandVerHead-CreateMode"], |
|
|
|
title: "复制", |
|
|
|
}, |
|
|
|
}); |
|
|
|
}, |
|
|
|
}, |
|
|
|
mounted() { |
|
|
|
this.$nextTick(() => { |
|
|
|
let tableHeight = this.calculationTableHeight(this.$refs.topTableRef, 40); |
|
|
|
this.$emit("calculateTableHeight", tableHeight); |
|
|
|
}); |
|
|
|
}, |
|
|
|
watch: { |
|
|
|
// 监听客户ID的变化 |
|
|
|
customerId: { |
|
|
|
handler(data) { |
|
|
|
this.getPredictList(data); |
|
|
|
}, |
|
|
|
deep: true, |
|
|
|
}, |
|
|
|
}, |
|
|
|
}; |
|
|
|
</script> |
|
|
|
<style lang="less" scoped> |
|
|
|
.predict-wrapper { |
|
|
|
height: 100%; |
|
|
|
.content-table-wrap { |
|
|
|
width: 100%; |
|
|
|
height: 100%; |
|
|
|
} |
|
|
|
.predict-table { |
|
|
|
margin-top: 10px; |
|
|
|
width: 100%; |
|
|
|
} |
|
|
|
height: 100%; |
|
|
|
.content-table-wrap { |
|
|
|
width: 100%; |
|
|
|
height: 100%; |
|
|
|
} |
|
|
|
.predict-table { |
|
|
|
margin-top: 10px; |
|
|
|
width: 100%; |
|
|
|
} |
|
|
|
} |
|
|
|
</style> |
|
|
|
</style> |