Merge pull request 'projects/mescc/zhp' (#107) from projects/mescc/zhp into projects/mescc/develop
All checks were successful
continuous-integration/drone/push Build is passing

Reviewed-on: #107
This commit is contained in:
朱菊兰 2024-07-26 10:52:36 +08:00
commit 52d968fdde
16 changed files with 688 additions and 1096 deletions

View File

@ -1,7 +1,7 @@
###
# @Author: zhp
# @Date: 2024-04-28 13:42:51
# @LastEditTime: 2024-07-25 14:11:43
# @LastEditTime: 2024-07-25 15:43:42
# @LastEditors: zhp
# @Description:
###

View File

@ -1,32 +1,24 @@
/*
* @Author: zhp
* @Date: 2024-04-26 14:53:45
* @LastEditTime: 2024-05-06 14:55:33
* @LastEditTime: 2024-07-26 09:32:26
* @LastEditors: zhp
* @Description:
*/
import request from '@/utils/request'
// 查询部门列表
export function getOrderList(data) {
export function getCostMainPage(data) {
return request({
url: 'ip/prod-order/prodOrderList',
method: 'post',
data: data
})
}
export function getCostPage(data) {
return request({
url: 'ip/cost/costPage',
url: 'ip/cost-main/page',
method: 'post',
data: data
})
}
export function getCostList(data) {
export function exportExcel(data) {
return request({
url: 'ip/cost/costList',
url: 'ip/cost-main/export-excel',
method: 'post',
data: data
data: data,
responseType: 'blob'
})
}

View File

@ -1,15 +1,24 @@
/*
* @Author: zhp
* @Date: 2024-04-28 09:28:12
* @LastEditTime: 2024-04-28 15:52:36
* @LastEditTime: 2024-07-25 15:05:43
* @LastEditors: zhp
* @Description:
*/
import request from '@/utils/request'
export function getStockPage(data) {
export function getStockRealTimePage(data) {
return request({
url: 'ip/stock/page',
url: 'ip/stock-realtime/page',
method: 'post',
data: data
})
}
export function exportExcel(data) {
return request({
url: '/ip/stock-realtime/export-excel',
method: 'get',
data: data,
responseType: 'blob'
})
}

View File

@ -1,12 +1,12 @@
/*
* @Author: zhp
* @Date: 2024-04-12 11:13:06
* @LastEditTime: 2024-04-12 16:20:31
* @LastEditTime: 2024-07-26 09:31:09
* @LastEditors: zhp
* @Description:
*/
import Vue from 'vue'
import Element from 'element-ui'
import Element, { DatePicker } from 'element-ui'
// 修改如下样式文件,覆盖样式,或者新增样式文件
import "./assets/styles/element-variables.scss";
@ -44,7 +44,7 @@ import {
} from "@/utils/dict";
import CodeBrickZj from 'code-brick-zj';
import "./theme/index.css"; // 自定义主题包 - code-brick-zj
// Vue.component(Select.name, Select)
// 全局方法挂载
Vue.prototype.getDicts = getDicts;
Vue.prototype.parseTime = parseTime;
@ -68,7 +68,8 @@ Vue.component("RightToolbar", RightToolbar);
import DictTag from "@/components/DictTag";
// 头部标签插件
import VueMeta from "vue-meta";
// import locale from './views/cost/zh'; // 请根据实际路径修改
// Vue.use(ElementUI, { locale });
Vue.use(directive)
Vue.use(plugins)
Vue.use(VueMeta)

View File

@ -129,7 +129,7 @@ export default {
},
splitLine: {
lineStyle: {
color: "#4561AE",
color: "rgba(69,97,174,.4)",
},
},
},

View File

@ -1,7 +1,7 @@
<!--
* @Author: zhp
* @Date: 2024-05-23 15:49:14
* @LastEditTime: 2024-07-22 14:05:00
* @LastEditTime: 2024-07-25 14:29:40
* @LastEditors: zhp
* @Description:
-->
@ -130,7 +130,7 @@ export default {
},
splitLine: {
lineStyle: {
color: "#4561AE",
color: "rgba(69,97,174,.4)",
},
},
},

View File

@ -1,7 +1,7 @@
<!--
* @Author: zhp
* @Date: 2024-05-07 13:22:43
* @LastEditTime: 2024-07-23 15:52:25
* @LastEditTime: 2024-07-25 14:29:04
* @LastEditors: zhp
* @Description:
-->
@ -135,7 +135,7 @@ export default {
},
splitLine: {
lineStyle: {
color: "#4561AE",
color: "rgba(69,97,174,.4)",
},
},
},

View File

@ -1,7 +1,7 @@
<!--
* @Author: zhp
* @Date: 2024-05-23 15:50:44
* @LastEditTime: 2024-07-23 15:52:09
* @LastEditTime: 2024-07-25 14:29:09
* @LastEditors: zhp
* @Description:
-->
@ -135,7 +135,7 @@ export default {
},
splitLine: {
lineStyle: {
color: "#4561AE",
color: "rgba(69,97,174,.4)",
},
},
},

View File

@ -1,7 +1,7 @@
<!--
* @Author: zhp
* @Date: 2024-05-30 08:58:39
* @LastEditTime: 2024-07-25 09:54:21
* @LastEditTime: 2024-07-25 15:42:47
* @LastEditors: zhp
* @Description:
-->
@ -59,7 +59,7 @@ export default {
left: "10%",
right: "3%",
bottom: "10%",
top: "15%",
top: "20%",
// containLabel: true,
},
// tooltip: {
@ -158,7 +158,7 @@ export default {
},
splitLine: {
lineStyle: {
color: "#4561AE",
color: "rgba(69,97,174,.4)",
},
},
},
@ -349,7 +349,7 @@ export default {
.legend {
position: absolute;
top: 3vh;
top: 6vh;
right: 13vw;
}

View File

@ -118,7 +118,7 @@
<div class="chart">
<div class="chart-title">
<span class="title">生产情况</span>
<div class="button-than" style="position: absolute;right: 3%;">
<div class="button-than" style="position: absolute;right: 0%;">
<CopilotButton v-for="i in ['同比', '环比']" :key="i" :label="i" :active="i === than"
@click="() => $emit('update:than', i)" />
</div>
@ -228,7 +228,7 @@ export default {
position: relative;
// gap: 6px;
.chart-title{
margin-top: 5px;
margin-top: 20px;
// flex: 1;
// gap: 6px;
height: 1.5vw;

View File

@ -0,0 +1,576 @@
<!--
* @Author: zhp
* @Date: 2024-04-15 10:49:13
* @LastEditTime: 2024-07-26 10:32:14
* @LastEditors: zhp
* @Description:
-->
<template>
<div style="display: flex; flex-direction: column; min-height: calc(100vh - 96px - 32px)">
<div class="app-container" style="height: auto; flex-grow: 1;">
<el-form :model="listQuery" :inline="true" ref="dataForm" class="blueTip">
<el-form-item label="时间维度" prop="start">
<el-cascader clearable :options="options" v-model="listQuery.start"
:props="{ multiple: false, emitPath: false }" @change="handleChange" placeholder="选择开始年份和期数" />
</el-form-item>
<el-form-item label-width="0" prop="end">
<el-cascader clearable :options="options" v-model="listQuery.end"
:props="{ multiple: false, emitPath: false }" @change="handleChange" placeholder="选择结束年份和期数" />
</el-form-item>
<el-form-item label="成本中心名称" prop="center">
<el-input v-model="listQuery.center" placeholder="请填写成本中心名称" clearable>
</el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" size="small" @click="getDataList">查询</el-button>
<el-divider direction="vertical"></el-divider>
<!-- <el-button type="primary" size="small" plain @click="handleImport">导入</el-button> -->
<el-button type="primary" size="small" plain @click="handleExport">导出</el-button>
<!-- <el-button type="success" size="small" plain @click="addFactory">新增</el-button> -->
</el-form-item>
</el-form>
<!-- <search-bar :formConfigs="formConfig" ref="searchBarForm" @headBtnClick="buttonClick" /> -->
<base-table :table-props="tableProps" :page="listQuery.current" :limit="listQuery.size" :table-data="tableData"
:max-height="tableH">
<!-- <method-btn v-if="tableBtn.length" slot="handleBtn" label="操作" :width="120" fixed="right"
:method-list="tableBtn" @clickBtn="handleClick" /> -->
</base-table>
<pagination :limit.sync="listQuery.size" :page.sync="listQuery.current" :total="listQuery.total"
@pagination="getDataList" />
</div>
<!-- 用户导入对话框 -->
<!-- <inputTable :date="date" :data="tableData" :time="[startTimeStamp, endTimeStamp]" :sum="all"
:type="listQuery.reportType" @refreshDataList="getDataList" /> -->
<!-- <pagination
:limit.sync="listQuery.pageSize"
:page.sync="listQuery.pageNo"
:total="listQuery.total"
@pagination="getDataList" /> -->
</div>
</template>
<script>
import { parseTime } from '@/utils/ruoyi';
import { getCostMainPage, exportExcel } from '@/api/cost';
// import inputTable from './inputTable.vue';
import moment from 'moment'
//
//
// Vue.component(DatePicker.months, DatePicker)
// Vue.component(Select.name, Select)
// import ButtonNav from '@/components/ButtonNav'
import basicPage from '@/mixins/basic-page'
// import detailOrUpdate from './detail-or-updata';
// import addOrUpdate from './add-or-updata';
// import { factoryList, dhgfactoryList, tyjxfactoryList } from "@/utils/constants";
import { getBaseHeader } from "@/utils/request";
import { factoryList } from "@/utils/constants";
import tableHeightMixin from "@/mixins/tableHeightMixin";
// import FileSaver from 'file-saver'
// import * as XLSX from 'xlsx'
export default {
// components: { ButtonNav, detailOrUpdate, addOrUpdate },
mixins: [basicPage, tableHeightMixin],
data() {
const currentYear = new Date().getFullYear();
const startYear = currentYear - 10;
const endYear = currentYear + 10;
const options = [];
for (let year = startYear; year <= endYear; year++) {
const yearOptions = [];
for (let period = 1; period <= 12; period++) {
yearOptions.push({
value: `${year}${('0' + period + '期').slice(-3)}`,
label: `${year}${('0' + period + '期').slice(-3)}`
});
}
options.push({
value: year,
label: year,
children: yearOptions
});
}
return {
start: undefined,
end: undefined,
// selectedValues: [],
options,
listQuery: {
// size: 10,
// current: 1,
total: 0,
center: undefined,
start: undefined,
end: undefined,
yearPhaseStart:undefined,
yearPhaseEnd:undefined,
},
//
mainFormConfig: [
{
type: 'select',
label: '工单',
placeholder: '请选择工单',
param: 'workOrderId',
selectOptions: [],
},
// {
// type: 'select',
// label: '线',
// placeholder: '线',
// param: 'lineId',
// selectOptions: [],
// },
//
// {
// type: 'select',
// label: '',
// param: 'dateFilterType',
// defaultSelect: 0,
// selectOptions: [
// { id: 0, name: '' },
// { id: 1, name: '' },
// ],
// index: 2,
// extraOptions: [
{
// parent: 'dateFilterType',
//
type: 'datePicker',
label: '时间段',
// dateType: 'datetimerange',
dateType: 'datetimerange',
format: 'yyyy-MM-dd HH:mm:ss',
valueFormat: 'yyyy-MM-ddTHH:mm:ss',
rangeSeparator: '-',
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
param: 'recordTime',
},
// {
// parent: 'dateFilterType',
// //
// type: 'datePicker',
// // label: '',
// dateType: 'date',
// placeholder: '',
// format: 'yyyy-MM-dd',
// valueFormat: 'yyyy-MM-dd',
// param: 'timeday',
// },
// ],
// },
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type: 'separate'
},
// {
// type: this.$auth.hasPermi(
// 'analysis:equipment:export'
// )
// ? 'separate'
// : '',
// },
{
type: 'button',
btnName: '导出',
name: 'export',
color: 'warning',
},
],
formConfig: [
{
type: 'title',
label: '成本管理',
},
],
mDTypeList: [
{
value: 0,
label: '物料编码'
},
{
value: 1,
label: '物料名称'
}
],
wDTypeList: [
{
value: 0,
label: '仓库名称'
}
],
tableProps: [
{
prop: 'yearPhaseName',
label: '年期',
minWidth: 200,
showOverflowtooltip: true
},
{
prop: 'center',
label: '成本中心名称',
minWidth: 150,
showOverflowtooltip: true
},
{
prop: 'product',
label: '产品名称',
minWidth: 150,
showOverflowtooltip: true
},
{
prop: 'spec',
label: '规格型号',
minWidth: 150,
showOverflowtooltip: true
},
{
prop: 'workorderCode',
label: '工单编号',
minWidth: 150,
showOverflowtooltip: true
},
{
prop: 'workorderLineNum',
label: '工单行号',
minWidth: 150,
showOverflowtooltip: true
},
{
prop: 'supplierCode',
label: '供应商编码',
minWidth: 150,
showOverflowtooltip: true
},
{
prop: 'supplier',
label: '供应商名称',
minWidth: 150,
showOverflowtooltip: true
},
{
prop: 'unit',
label: '基本单位',
minWidth: 150,
// filter: (val) => factoryList[val],
showOverflowtooltip: true
},
{
prop: 'planNum',
label: '计划产量',
minWidth: 150,
// filter: (val) => factoryList[val],
showOverflowtooltip: true
},
{
prop: 'project',
label: '成本项目名称',
minWidth: 150,
// filter: (val) => factoryList[val],
showOverflowtooltip: true
},
{
prop: 'CMaterial',
label: '子项物料名称',
minWidth: 150,
// filter: (val) => factoryList[val],
showOverflowtooltip: true
},
{
prop: 'currentTime',
label: '本期完工',
minWidth: 150,
// filter: (val) => factoryList[val],
showOverflowtooltip: true,
children: [
{
prop: 'finishNum',
label: '数量',
minWidth: 150,
// filter: (val) => factoryList[val],
showOverflowtooltip: true
},
{
prop: 'unitConsume',
label: '单耗',
minWidth: 150,
// filter: (val) => factoryList[val],
showOverflowtooltip: true
},
{
prop: 'unitCost',
label: '单位成本',
minWidth: 150,
// filter: (val) => factoryList[val],
showOverflowtooltip: true
},
{
prop: 'cost',
label: '金额',
minWidth: 150,
// filter: (val) => factoryList[val],
showOverflowtooltip: true
},
]
},
{
prop: 'totalTime',
label: '累计完工',
minWidth: 150,
// filter: (val) => factoryList[val],
showOverflowtooltip: true,
children: [
{
prop: 'totalFinishNum',
label: '数量',
minWidth: 150,
// filter: (val) => factoryList[val],
showOverflowtooltip: true
},
{
prop: 'totalUnitConsume',
label: '单耗',
minWidth: 150,
// filter: (val) => factoryList[val],
showOverflowtooltip: true
},
{
prop: 'totalUnitCost',
label: '单位成本',
minWidth: 150,
// filter: (val) => factoryList[val],
showOverflowtooltip: true
},
{
prop: 'totalCost',
label: '金额',
minWidth: 150,
// filter: (val) => factoryList[val],
showOverflowtooltip: true
},
]
},
],
// timeSelect:'month',
// startTimeStamp:null, //
// endTimeStamp:null, //
// date:'2024',
// reportTime: '',
// startTimeStamp: '',
// endTimeStamp: '',
tableData: [],
// proLineList: [],
// all: {}
};
},
computed: {
},
watch: {
},
created() {
const currentYear = new Date().getFullYear();
this.listQuery.start = `${currentYear}01期`;
this.listQuery.end = `${currentYear}12期`;
},
methods: {
handleChange(value) {
// console.log(':', this.selectedValues);
},
async getDataList() {
this.tableData = []
this.listQuery.yearPhaseStart = this.listQuery.start ? this.listQuery.start.slice(0,6) :undefined
this.listQuery.yearPhaseEnd = this.listQuery.end ? this.listQuery.end.slice(0, 6) : undefined
if (this.listQuery.end && this.listQuery.start) {
if (this.listQuery.end.slice(0, 4) - this.listQuery.start.slice(0, 4) > 10) {
return this.$message({
message: '起止年份不能超过十年',
type: 'warning'
});
}
await getCostMainPage(this.listQuery).then(res => {
if (res.code === 0) {
// this.tableData = res.data.list
res.data.list.forEach(item => {
let obj = {
yearPhase: item.yearPhase,
center: item.center,
product: item.product,
spec: item.spec,
workorderCode: item.workorderCode,
workorderLineNum: item.workorderLineNum,
supplierCode: item.supplierCode,
supplier: item.supplier,
unit: item.unit,
planNum: item.planNum,
finishNum: item.finishNum,
unitConsume: item.unitConsume,
unitCost: item.unitCost,
cost: item.cost,
totalFinishNum: item.totalFinishNum,
totalUnitConsume: item.totalUnitConsume,
totalUnitCost: item.totalUnitCost,
totalCost: item.totalCost,
createTime: item.createTime,
yearPhaseName: item.yearPhaseName,
project: item.project,
CMaterial: item.material,
}
this.tableData.push(obj)
item.children.forEach(ele => {
// for (let i in item.projs) {
let obj = {
yearPhase: ele.yearPhase,
center: ele.center,
product: ele.product,
spec: ele.spec,
workorderCode: ele.workorderCode,
workorderLineNum: ele.workorderLineNum,
supplierCode: ele.supplierCode,
supplier: ele.supplier,
unit: ele.unit,
planNum: ele.planNum,
finishNum: ele.finishNum,
unitConsume: ele.unitConsume,
unitCost: ele.unitCost,
cost: ele.cost,
totalFinishNum: ele.totalFinishNum,
totalUnitConsume: ele.totalUnitConsume,
totalUnitCost: ele.totalUnitCost,
totalCost: ele.totalCost,
createTime: ele.createTime,
yearPhaseName: ele.yearPhaseName,
project: ele.project,
CMaterial: ele.material,
}
this.tableData.push(obj)
ele.children?.forEach(i => {
// for (let i in item.projs) {
let obj = {
yearPhase: i.yearPhase,
center: i.center,
product: i.product,
spec: i.spec,
workorderCode: i.workorderCode,
workorderLineNum: i.workorderLineNum,
supplierCode: i.supplierCode,
supplier: i.supplier,
unit: i.unit,
planNum: i.planNum,
finishNum: i.finishNum,
unitConsume: i.unitConsume,
unitCost: i.unitCost,
cost: i.cost,
totalFinishNum: i.totalFinishNum,
totalUnitConsume: i.totalUnitConsume,
totalUnitCost: i.totalUnitCost,
totalCost: i.totalCost,
createTime: i.createTime,
yearPhaseName: i.yearPhaseName,
project: i.project,
CMaterial: i.material,
}
this.tableData.push(obj)
// });
// }
});
// });
// }
});
});
this.listQuery.total = res.data.total
}
})
} else {
return this.$message({
message: '请选择起止年份和期数',
type: 'warning'
});
}
},
buttonClick(val) {
this.listQuery.reportTime = val.reportTime ? val.reportTime : undefined;
switch (val.btnName) {
case 'search':
this.listQuery.current = 1;
this.listQuery.size = 10;
this.getDataList();
break;
case 'export':
this.handleExport();
break;
default:
console.log(val);
}
},
/** 导出按钮操作 */
handleExport() {
const queryParams = this.listQuery;
queryParams.current = 1
queryParams.size = 999
// if (this.facType === 0) {
this.$modal.confirm('是否确认导出所有数据项?').then(() => {
this.exportLoading = true;
return exportExcel(queryParams);
}).then(response => {
this.$download.excel(response, '成本核算数据.xls');
this.exportLoading = false;
}).catch(() => { });
// }
}
},
};
</script>
<style>
/* .blueTip { */
/* padding-bottom: 10px; */
/* } */
.blueTip .el-date-editor .el-range__icon {
font-size: 16px;
color: #0b58ff;
}
.blueTip .el-input__prefix .el-icon-date {
font-size: 16px;
color: #0b58ff;
}
.blueTip .el-input__prefix .el-icon-time {
font-size: 16px;
color: #0b58ff;
}
.blueTip::before {
display: inline-block;
content: '';
width: 4px;
height: 18px;
background: #0B58FF;
border-radius: 1px;
margin-right: 8PX;
margin-top: 8px;
}
.app-container {
margin: 0;
background-color: #fff;
border-radius: 4px;
padding: 16px 16px 0;
height: calc(100vh - 134px);
overflow: auto;
}
</style>

View File

@ -1,421 +0,0 @@
<!--
* @Author: zhp
* @Date: 2024-04-15 10:49:13
* @LastEditTime: 2024-05-06 14:55:56
* @LastEditors: zhp
* @Description:
-->
<template>
<div style="display: flex; flex-direction: column; min-height: calc(100vh - 96px - 31px)">
<div class="app-container" style="padding: 16px 24px 0;height: auto; flex-grow: 1;">
<search-bar :formConfigs="mainFormConfig" ref="searchBarForm" @headBtnClick="buttonClick" />
<el-row :gutter="24">
<el-col :span="12" v-for="item in dataList" :key="item.id">
<line-chart :id="item.id" class="yearChart" ref="lineChart" style="height: 40vh;width: 100%"></line-chart>
</el-col>
<!-- <el-col :span="12">
<line-chart :id=" 'second' " class="yearChart" ref="lineChart" style="height: 40vh;width: 100%"></line-chart>
</el-col> -->
</el-row>
</div>
<div class="app-container" style="margin-top: 18px;flex-grow: 1; height: auto; padding: 16px;">
<search-bar :formConfigs="formConfig" ref="searchBarForm" @headBtnClick="buttonClick" />
<base-table :table-props="tableProps" :page="listQuery.pageNo" :limit="listQuery.pageSize"
:table-data="tableData">
</base-table>
</div>
<!-- <inputTable :date="date" :data="tableData" :time="[startTimeStamp, endTimeStamp]" :sum="all"
:type="listQuery.reportType" @refreshDataList="getDataList" /> -->
<!-- <pagination
:limit.sync="listQuery.pageSize"
:page.sync="listQuery.pageNo"
:total="listQuery.total"
@pagination="getDataList" /> -->
</div>
</template>
<script>
// import { parseTime } from '../../core/mixins/code-filter';
import { getOrderList, getCostPage } from '@/api/cost/index';
// import inputTable from './inputTable.vue';
import lineChart from './lineChart';
import moment from 'moment'
// import FileSaver from 'file-saver'
// import * as XLSX from 'xlsx'
export default {
components: { lineChart },
data() {
return {
listQuery: {
current: 1,
size: 10,
// factoryId: null,
// total: 0,
// type: null,
// reportType: 2,
reportTime: []
},
dataList: [
{
id:'first',
},
{
id: 'second',
},
{
id: 'third',
},
{
id: 'fourth',
},
{
id: 'fifth',
},
{
id: 'sixth',
},
],
urlOptions: {
// getDataListURL: getGlassPage,
// exportURL: exportGlasscExcel
},
mainFormConfig: [
{
type: 'select',
label: '工单',
placeholder: '请选择工单',
param: 'workOrderId',
selectOptions: [],
clearable: true,
},
// {
// type: 'select',
// label: '线',
// placeholder: '线',
// param: 'lineId',
// selectOptions: [],
// },
//
// {
// type: 'select',
// label: '',
// param: 'dateFilterType',
// defaultSelect: 0,
// selectOptions: [
// { id: 0, name: '' },
// { id: 1, name: '' },
// ],
// index: 2,
// extraOptions: [
{
// parent: 'dateFilterType',
//
type: 'datePicker',
label: '时间段',
// dateType: 'datetimerange',
dateType: 'datetimerange',
format: 'yyyy-MM-dd HH:mm:ss',
valueFormat: 'yyyy-MM-ddTHH:mm:ss',
rangeSeparator: '-',
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
param: 'recordTime',
clearable:true,
},
// {
// parent: 'dateFilterType',
// //
// type: 'datePicker',
// // label: '',
// dateType: 'date',
// placeholder: '',
// format: 'yyyy-MM-dd',
// valueFormat: 'yyyy-MM-dd',
// param: 'timeday',
// },
// ],
// },
{
type:'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type:'separate'
},
// {
// type: this.$auth.hasPermi(
// 'analysis:equipment:export'
// )
// ? 'separate'
// : '',
// },
{
type:'button',
btnName: '导出',
name: 'export',
color: 'warning',
},
],
formConfig: [
{
type: 'title',
label: '成本管理',
},
],
timeList: [
{
value: 'month',
label:'月'
},
{
value: 'year',
label: '年'
}
],
factoryList: [
{
name: '测试',
id:1
}
],
tableProps: [
// {
// prop: 'createTime',
// label: '',
// fixed: true,
// width: 180,
// filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'),
// },
{
prop: 'userName',
label: '日期',
},
{
prop: 'nickName',
label: '工厂名称',
}
],
timeSelect:'month',
startTimeStamp:null, //
endTimeStamp:null, //
// date:'2024',
// reportTime: '',
startTimeStamp: '',
endTimeStamp: '',
tableData: [
{
userName: 'userName',
nickName: '用户名',
datas:'111111'
},
{
userName: 'userName',
nickName: '用户名',
datas: '111111'
},
{
userName: 'userName',
nickName: '用户名',
datas: '111111'
// subcomponent: row
}
],
// proLineList: [],
// all: {}
};
},
mounted() {
this.getDict()
// this.getCurrentYearFirst()
this.getDataList()
},
methods: {
buttonClick() {
},
// handleTime() {
// this.$forceUpdate()
// // this.$nextTick(() => [
// // ])
// },
// getCurrentYearFirst() {
// let date = new Date();
// date.setDate(1);
// date.setMonth(0);
// this.reportTime = date;
// this.startTimeStamp = this.timeFun(new Date(new Date().getFullYear(), 0, 1, 7, 0, 1).getTime()); //
// this.endTimeStamp = this.timeFun(new Date(new Date().getFullYear(), 11, 31, 7, 0, 0).getTime()); //
// this.listQuery.reportTime[0] = parseTime(new Date(new Date().getFullYear(), 0, 1, 7, 0, 1).getTime()) //+ ' 00:00:00' //new Date(this.startTimeStamp + ' 00:00:00').getTime() / 1000
// this.listQuery.reportTime[1] = parseTime(new Date(new Date().getFullYear(), 11, 31, 7, 0, 0).getTime()) //+ ' 23:59:59' //new Date(this.endTimeStamp + ' 23:59:59').getTime() / 100
// },
changeTime(val) {
if (val) {
// let timeStamp = val.getTime(); //
// this.endTimeStamp = this.timeFun(new Date(val.getFullYear(), 11, 31, 7, 0, 0).getTime()); //
// this.startTimeStamp = this.timeFun(new Date(val.getFullYear(), 0, 1, 7, 0, 1).getTime()); //
// this.listQuery.reportTime[0] = parseTime(new Date(val.getFullYear(), 0, 1, 7, 0, 1).getTime()) //+ ' 00:00:00' //new Date(this.startTimeStamp + ' 00:00:00').getTime() / 1000
// this.listQuery.reportTime[1] = parseTime(new Date(val.getFullYear(), 11, 31, 7, 0, 0).getTime()) //+ ' 23:59:59' //new Date(this.endTimeStamp + ' 23:59:59').getTime() / 1000
} else {
this.listQuery.reportTime = []
}
},
async getDict() {
// this.$refs.lineChart.initChart()
// 线
const res = await getOrderList({
current:1,
size:999,
});
console.log(res)
this.mainFormConfig[0].selectOptions = res.data;
},
//
multipliedByHundred(str) {
console.log(str);
// console.log(str)
if ( str != 0) {
let floatVal = parseFloat(str);
if (isNaN(floatVal)) {
return 0;
}
floatVal = Math.round(str * 10000) / 100;
let strVal = floatVal.toString();
let searchVal = strVal.indexOf('.');
if (searchVal < 0) {
searchVal = strVal.length;
strVal += '.';
}
while (strVal.length <= searchVal + 2) {
strVal += '0';
}
return parseFloat(strVal);
}
},
async getDataList() {
const res = await getCostPage({
current: 1,
size: 999,
});
},
add0(m) {
return m < 10 ? '0' + m : m
},
format(shijianchuo) {
//shijianchuoparseInt
var time = moment(new Date(shijianchuo)).format('YYYY-MM-DD HH:mm:ss')
// console.log(time)
// var y = time.getFullYear();
// var m = time.getMonth() + 1;
// var d = time.getDate();
// var h = time.getHours();
// var mm = time.getMinutes();
// var s = time.getSeconds();
return time
},
changeTime(val) {
if (val) {
// console.log(val)
// console.log(val.setHours(7, 0, 0))
// console.log(val.setHours(7, 0, 0) + 24 * 60 * 60 * 1000)
// let time = this.format(val.setHours(7, 0, 0))
this.endTimeStamp = this.format(val.setHours(7, 0, 0)) //+ ' 00:00:00' //new Date(this.startTimeStamp + ' 00:00:00').getTime() / 1000
this.startTimeStamp = this.format(val.setHours(7, 0, 1) - 24 * 60 * 60 * 1000) //+ ' 23:59:59' //new Date(this.endTimeStamp + ' 23:59:59').getTime() / 1000
// console.log(this.listQuery.reportTime);
this.listQuery.reportTime[0] = this.format(val.setHours(7, 0, 1)) //+ ' 00:00:00' //new Date(this.startTimeStamp + ' 00:00:00').getTime() / 1000
this.listQuery.reportTime[1] = this.format(val.setHours(7, 0, 0) + 24 * 60 * 60 * 1000) //+ ' 23:59:59' //new Date(this.endTimeStamp + ' 23:59:59').getTime() / 1000
console.log(this.listQuery.reportTime);
} else {
this.listQuery.reportTime = []
}
},
//yy-mm-dd hh:mm:ss
timeFun(unixtimestamp) {
var unixtimestamp = new Date(unixtimestamp);
var year = 1900 + unixtimestamp.getYear();
var month = "0" + (unixtimestamp.getMonth() + 1);
var date = "0" + unixtimestamp.getDate();
return year + "-" + month.substring(month.length - 2, month.length) + "-" + date.substring(date.length - 2, date.length)
},
buttonClick(val) {
this.listQuery.reportTime = val.reportTime ? val.reportTime : undefined;
switch (val.btnName) {
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.getDataList();
break;
case 'export':
this.handleExport();
break;
default:
console.log(val);
}
},
/** 导出按钮操作 */
handleExport() {
//
// var xlsxParam = { raw: true };
// /* 簿 */
// import('xlsx').then(excel => {
// var wb = excel.utils.table_to_book(
// document.querySelector("#exportTable"),
// xlsxParam
// );
// /* */
// var wbout = excel.write(wb, {
// bookType: "xlsx",
// bookSST: true,
// type: "array",
// });
// try {
// FileSaver.saveAs(
// //Blob
// //Blob JavaScript
// //File Blob blob 使
// // Blob
// new Blob([wbout], { type: "application/octet-stream" }),
// //
// ".xlsx"
// );
// } catch (e) {
// if (typeof console !== "undefined") console.log(e, wbout);
// }
// return wbout;
// //do something......
// })
},
},
};
</script>
<style scoped>
/* .blueTip { */
/* padding-bottom: 10px; */
/* } */
/* .blueTi */
.blueTip::before{
display: inline-block;
content: '';
width: 4px;
height: 18px;
background: #0B58FF;
border-radius: 1px;
margin-right: 8PX;
margin-top: 8px;
}
.app-container {
margin: 0 16px 0;
background-color: #fff;
border-radius: 4px;
padding: 16px 16px 0;
height: calc(100vh - 134px);
overflow: auto;
}
</style>

View File

@ -1,233 +0,0 @@
<!--
* @Author: zwq
* @Date: 2022-01-21 14:43:06
* @LastEditors: zhp
* @LastEditTime: 2024-04-16 14:16:17
* @Description:
-->
<template>
<!-- <div> -->
<!-- <div :id="id" :class="className" :style="{ height: '65%', width:width}" /> -->
<div :id="id" class="costChart" :style="{ height: height, width: width }" />
<!-- </div> -->
</template>
<script>
import * as echarts from 'echarts'
import 'echarts/theme/macarons' // echarts theme
// import resize from './mixins/resize'
export default {
name: 'OverviewBar',
// mixins: [resize],
props: {
id: {
type: String,
default: 'OverviewLine'
},
// className: {
// type: String,
// default: 'epChart'
// },
width: {
type: String,
default: '100%'
},
beilv: {
type: Number,
default: 1
},
height: {
type: String,
default: '35vh'
},
legendPosition: {
type: String,
default: 'center'
},
showLegend: {
type: Boolean,
default: false
},
legendData: {
type: Array,
default: () => []
}
},
data() {
return {
chartData: [
{
name: '产品1',
num: 1112,
yield: 0.97,
},
{
name: '产品2',
num: 1112,
yield: 0.97,
},
{
name: '产品3',
num: 1112,
yield: 0.97,
},
{
name: '产品4',
num: 1112,
yield: 0.97,
},
{
name: '产品5',
num: 1112,
yield: 0.97,
}
],
chart: null,
colors: ['rgba(113, 99, 254, 1)', 'rgba(39, 139, 255, 1)', 'rgba(100, 189, 255, 1)', 'rgba(143, 240, 170, 1)', 'rgba(246, 189, 22, 0.85)'],
}
},
mounted() {
this.initChart()
},
beforeDestroy() {
if (!this.chart) {
return
}
this.chart.dispose()
this.chart = null
},
methods: {
getEqualNewlineString(params, length) {
let text = ''
let count = Math.ceil(params.length / length) //
// length
if (count > 1) {
for (let z = 1; z <= count; z++) {
text += params.substr((z - 1) * length, length)
if (z < count) {
text += '\n'
}
}
} else {
text += params.substr(0, length)
}
return text
},
initChart() {
console.log(1111)
let num = 0
this.chartData && this.chartData.length > 0 && this.chartData.map(i => {
num += i.num
})
if (
this.chart !== null &&
this.chart !== '' &&
this.chart !== undefined
) {
this.chart.dispose()
}
this.chart = echarts.init(document.getElementById(this.id))
this.chart.setOption({
color: this.colors,
title: {
text: num,
subtext: '总数/片',
top: '32%',
left: '49%',
textAlign: 'center',
textStyle: {
fontSize: 32,
color: 'rgba(140, 140, 140, 1)',
},
subtextStyle: {
fontSize: 20,
color: '#fff00',
},
},
legend: {
bottom: '2%',
left: 'center',
itemWidth: 12,
itemHeight: 12,
icon: 'roundRect',
textStyle: {
color: 'rgba(140, 140, 140, 1)'
},
data: this.chartData && this.chartData.length > 0 && this.chartData.map((item, index) => ({
name: item.name,
itemStyle: {
color: this.colors[index % 4]
}
}))
},
series: [{
name: 'ISRA缺陷检测',
type: 'pie',
// position:outerHeight,
center: ['50%', '40%'],
radius: ['45%', '70%'],
avoidLabelOverlap: true,
label: {
show: true,
normal: {
alignTo: 'labelLine',
margin: 10,
edgeDistance: 10,
lineHeight: 16,
//
// params: data,
formatter: function (params) {
console.log(params);
return;
},
formatter: (params) => {
//
return this.getEqualNewlineString(params.value + " | " + params.percent.toFixed(0) + "%" + "\n" + params.name, 10);
},
textStyle: { //
// color: 'rgba(0, 0, 0, 0.65)',
fontSize: 18
}
}
},
labelLine: {
show: true,
length: 25,
length2: 100,
},
data: this.chartData && this.chartData.length > 0 && this.chartData.map((item, index) => ({
name: item.name,
value: item.num,
label: {
color: this.colors[index % 4]
},
itemStyle: {
// color: {
// type: 'linear',
// x: 0,
// y: 0,
// x2: 0,
// y2: 1,
// global: false,
// colorStops: [
// { offset: 0, color: this.colors[index % 4] },
// { offset: 1, color: this.colors[index % 4] + '33' }
// ]
// }
}
}))
}],
tooltip: {
trigger: 'item',
className: "isra-chart-tooltip"
},
})
}
}
}
</script>
<style scoped>
</style>

View File

@ -129,7 +129,7 @@ export default {
},
splitLine: {
lineStyle: {
color: "#4561AE",
color: "rgba(69,97,174,.4)",
},
},
},

View File

@ -131,7 +131,7 @@ export default {
},
splitLine: {
lineStyle: {
color: "#4561AE",
color: "rgba(69,97,174,.4)",
},
},
},

View File

@ -1,64 +1,37 @@
<!--
* @Author: zhp
* @Date: 2024-04-15 10:49:13
* @LastEditTime: 2024-07-25 14:07:51
* @LastEditTime: 2024-07-26 10:28:53
* @LastEditors: zhp
* @Description:
-->
<template>
<div style="display: flex; flex-direction: column; min-height: calc(100vh - 96px - 32px)">
<ButtonNav v-show="false" :menus="['碲化镉工厂', '铜铟镓硒工厂']" :button-mode="true" @change="changeFactory"
style="margin-top: -10px">
</ButtonNav>
<div class="app-container" style="height: auto; flex-grow: 1;">
<el-form :model="listQuery" :inline="true" ref="dataForm" class="blueTip">
<el-form-item v-if="facType === 0" label="工厂名称" prop="factorys">
<el-select size="small" v-model="listQuery.factorys" placeholder="请选择工厂名称" multiple clearable>
<el-option v-for="item in dhgfactoryList" :key="item.id" :label="item.name" :value="item.id">
<el-form-item label="快捷查询" prop="mDType">
<el-select size="small" v-model="listQuery.mDType" clearable>
<el-option v-for="item in mDTypeList" :key="item.value" :label="item.label" :value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item v-else label="工厂名称" prop="factorys">
<el-select size="small" v-model="listQuery.factorys" placeholder="请选择工厂名称" multiple clearable>
<el-option v-for="item in tyjxfactoryList" :key="item.id" :label="item.name" :value="item.id">
<el-form-item v-if="listQuery.mDType === 0" prop="materialCode">
<el-input @keyup.enter.native="getDataList" v-model="listQuery.materialCode" placeholder="请填写物料编码" clearable>
</el-input>
</el-form-item>
<el-form-item v-else prop="materialName">
<el-input @keyup.enter.native="getDataList" v-model="listQuery.materialName" placeholder="请填写物料名称" clearable>
</el-input>
</el-form-item>
<el-form-item prop="wDType">
<el-select size="small" v-model="listQuery.wDType" clearable>
<el-option v-for="item in wDTypeList" :key="item.value" :label="item.label" :value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="时间维度" prop="date">
<el-select size="small" clearable v-model="listQuery.date" placeholder="请选择" @change="clearTime">
<el-option v-for="item in timeList" :key="item.value" :label="item.label" :value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item v-show="listQuery.date === 1 || listQuery.date === ''" label="时间范围" prop="reportTime">
<el-date-picker size="small" clearable v-model="listQuery.reportTime" type="daterange" range-separator=""
start-placeholder="开始日期" value-format="yyyyMMdd" @change="changeDayTime" end-placeholder="结束日期">
</el-date-picker>
</el-form-item>
<el-form-item v-show="listQuery.date === 2" label="时间范围" prop="reportTime">
<el-date-picker size="small" clearable v-model="start" type="week" format="yyyy 第 WW 周" placeholder="选择周"
style="width: 180px" @change="onValueChange">
</el-date-picker>
<el-date-picker size="small" clearable v-model="end" type="week" format="yyyy 第 WW 周" placeholder="选择周"
style="width: 180px" @change="onValueChange">
</el-date-picker>
<!-- <span v-if="start && end" style="margin-left: 10px">
{{ date1 }} {{ date2 }} {{ weekNum }}
</span> -->
</el-form-item>
<el-form-item v-show="listQuery.date === 3" label="时间值" prop="reportTime">
<el-date-picker size="small" v-model="listQuery.reportTime" type="monthrange" value-format="yyyyMM"
range-separator="至" start-placeholder="开始月份" end-placeholder="结束月份" @change="changeTime">
</el-date-picker>
</el-form-item>
<el-form-item v-show="listQuery.date === 4" label="时间值" prop="reportTime">
<el-date-picker size="small" clearable v-model="start" value-format="yyyy" type="year" placeholder="开始时间">
</el-date-picker>
~
<el-date-picker size="small" clearable v-model="end" value-format="yyyy" type="year" placeholder="结束时间"
@change="getYear">
</el-date-picker>
<el-form-item v-if="listQuery.wDType === 0" prop="warehouse">
<el-input @keyup.enter.native="getDataList" v-model="listQuery.warehouse" placeholder="请填写仓库名称" clearable>
</el-input>
</el-form-item>
<!-- <el-form-item label="玻璃类型" prop="type">
<el-select v-model="listQuery.type" placeholder="请选择玻璃类型">
@ -75,23 +48,19 @@
<el-form-item>
<el-button type="primary" size="small" @click="getDataList">查询</el-button>
<el-divider direction="vertical"></el-divider>
<el-button type="primary" size="small" plain @click="handleImport">导入</el-button>
<!-- <el-button type="primary" size="small" plain @click="handleImport">导入</el-button> -->
<el-button type="primary" size="small" plain @click="handleExport">导出</el-button>
<el-button type="success" size="small" plain @click="addFactory">新增</el-button>
<!-- <el-button type="success" size="small" plain @click="addFactory">新增</el-button> -->
</el-form-item>
</el-form>
<!-- <search-bar :formConfigs="formConfig" ref="searchBarForm" @headBtnClick="buttonClick" /> -->
<base-table :table-props="tableProps" :page="listQuery.current" :limit="listQuery.size" :table-data="tableData">
<method-btn v-if="tableBtn.length" slot="handleBtn" label="操作" :width="120" fixed="right"
:method-list="tableBtn" @clickBtn="handleClick" />
<base-table :table-props="tableProps" :page="listQuery.current" :limit="listQuery.size" :table-data="tableData"
:max-height="tableH">
<!-- <method-btn v-if="tableBtn.length" slot="handleBtn" label="操作" :width="120" fixed="right"
:method-list="tableBtn" @clickBtn="handleClick" /> -->
</base-table>
<pagination :limit.sync="listQuery.size" :page.sync="listQuery.current" :total="listQuery.total"
@pagination="getDataList" />
<detail-or-update v-if="detailOrUpdateVisible" ref="detailOrUpdate" :ftype="facType"
@destroy="detailOrUpdateVisible = false" />
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" :ftype="facType" @refreshDataList="getDataList"
@destroy="addOrUpdateVisible = false" />
</div>
<!-- 用户导入对话框 -->
@ -108,92 +77,39 @@
<script>
import { parseTime } from '@/utils/ruoyi';
import { prodTargetDiPage, prodTargetToPage, exportDiTargetExcel, exportToTargetExcel, delTarget, importToTarget, importDiTarget } from '@/api/produceData';
import { getStockRealTimePage, exportExcel } from '@/api/wareHouse';
// import inputTable from './inputTable.vue';
import moment from 'moment'
// import ButtonNav from '@/components/ButtonNav'
import basicPage from '@/mixins/basic-page'
// import detailOrUpdate from './detail-or-updata';
// import addOrUpdate from './add-or-updata';
import { factoryList, dhgfactoryList, tyjxfactoryList } from "@/utils/constants";
// import { factoryList, dhgfactoryList, tyjxfactoryList } from "@/utils/constants";
import { getBaseHeader } from "@/utils/request";
import tableHeightMixin from "@/mixins/tableHeightMixin";
import { factoryList } from "@/utils/constants";
// import FileSaver from 'file-saver'
// import * as XLSX from 'xlsx'
export default {
// components: { ButtonNav, detailOrUpdate, addOrUpdate },
mixins: [basicPage],
mixins: [basicPage, tableHeightMixin],
data() {
return {
factoryList,
dhgfactoryList,
tyjxfactoryList,
currentMenu: '碲化镉工厂',
fileList: [],
start: undefined,
end: undefined,
listQuery: {
size: 10,
current: 1,
factorys: null,
total: 0,
date: 3,
beginTime: undefined,
endTime: undefined,
reportTime: []
mDType:0,
wDType: 0,
materialCode:null,
materialName: null,
warehouse: null,
},
detailOrUpdateVisible: false,
addOrUpdateVisible: false,
date1: undefined,
date2: undefined,
//
upload: {
//
open: false,
//
title: "导入",
//
isUploading: false,
//
// updateSupport: 0,
//
headers: getBaseHeader(),
//
url: process.env.VUE_APP_BASE_API + '/admin-api/ip/prod-target/di-target-import-excel'
},
tableBtn: [
{
type: 'detail',
btnName: '详情',
},
{
type: 'edit',
btnName: '修改',
},
{
type: 'delete',
btnName: '删除',
}
].filter((v) => v),
typeList: [
{
name: '芯片',
id: 0,
},
{
name: '标准组件',
id: 1,
},
{
name: 'BIPV产品',
id: 2,
},
],
urlOptions: {
// getDataListURL: getGlassPage,
// exportURL: exportGlasscExcel
},
mainFormConfig: [
{
type: 'select',
@ -278,105 +194,72 @@ export default {
label: '成本管理',
},
],
timeList: [
mDTypeList: [
{
value: 0,
label: '物料编码'
},
{
value: 1,
label: '日'
},
label: '物料名称'
}
],
wDTypeList: [
{
value: 2,
label: '周'
},
{
value: 3,
label: '月'
},
{
value: 4,
label: '年'
value: 0,
label: '仓库名称'
}
],
tableProps: [
{
prop: 'factory',
label: '工厂名称',
filter: (val) => factoryList[val],
prop: 'materialCode',
label: '物料编码',
minWidth: 200,
showOverflowtooltip: true
},
{
prop: 'targetTime',
label: '目标时间',
prop: 'materialName',
label: '物料名称',
minWidth: 150,
showOverflowtooltip: true
},
{
prop: 'updateTime',
label: '提交时间',
filter: parseTime,
prop: 'spec',
label: '规格型号',
minWidth: 150,
showOverflowtooltip: true
},
{
prop: 'ftoInput',
label: 'FTO投入量(片)',
prop: 'warehouse',
label: '仓库名称',
minWidth: 150,
showOverflowtooltip: true
},
{
prop: 'chipYield',
label: '芯片产量(片)',
prop: 'batchCode',
label: '批号',
minWidth: 150,
showOverflowtooltip: true
},
{
prop: 'chipAveragePower',
label: '芯片平均功率(W)',
prop: 'unit',
label: '库存主单位',
minWidth: 150,
showOverflowtooltip: true
},
{
prop: 'chipYieldRate',
label: '芯片良率(%)',
prop: 'num',
label: '库存量',
minWidth: 150,
showOverflowtooltip: true
},
{
prop: 'chipTotalPower',
label: '芯片总功率(KW)',
prop: 'factory',
label: '库存组织',
minWidth: 150,
filter: (val) => factoryList[val],
showOverflowtooltip: true
},
{
prop: 'chipCssMarriageRate',
label: 'CSS稼动率(%)',
minWidth: 150,
showOverflowtooltip: true
},
{
prop: 'chipOee',
label: '芯片段OEE(%)',
minWidth: 150,
showOverflowtooltip: true
},
{
prop: 'chipCapacityUtilizationRate',
label: '芯片产能利用率(%)',
minWidth: 150,
showOverflowtooltip: true
},
{
prop: 'chipAnnualAverageProduction',
label: '芯片人均产量(片/人)',
minWidth: 180,
showOverflowtooltip: true
},
{
prop: 'chipBom',
label: '芯片BOM',
minWidth: 150,
showOverflowtooltip: true
},
}
],
// timeSelect:'month',
// startTimeStamp:null, //
@ -386,234 +269,27 @@ export default {
// startTimeStamp: '',
// endTimeStamp: '',
tableData: [],
facType: 0
// proLineList: [],
// all: {}
};
},
computed: {
weekNum() {
return Math.round((this.end - this.start) / (24 * 60 * 60 * 1000 * 7)) + 1
},
},
watch: {
facType(value) {
if (value === 0) {
this.$set(this.tableProps, 3, {
prop: 'ftoInput',
label: 'FTO投入量(片)',
minWidth: 150,
showOverflowtooltip: true
})
this.upload.url = process.env.VUE_APP_BASE_API + '/admin-api/ip/prod-target/di-target-import-excel'
} else {
this.$set(this.tableProps, 3, {
prop: 'molybdenumElectrodeInput',
label: '钼电极投入量(片)',
minWidth: 150,
showOverflowtooltip: true
})
this.upload.url = process.env.VUE_APP_BASE_API + '/admin-api/ip/prod-target/to-target-import-excel'
}
}
},
created() {
const currentMonth = new Date()
this.listQuery.reportTime = [moment(currentMonth).format('yyyyMM'), moment(currentMonth).format('yyyyMM')]
this.changeTime()
// const currentMonth = new Date()
// this.listQuery.reportTime = [moment(currentMonth).format('yyyyMM'), moment(currentMonth).format('yyyyMM')]
// this.changeTime()
},
methods: {
clearTime() {
this.listQuery.beginTime = undefined
this.listQuery.endTime = undefined
this.listQuery.reportTime = []
this.start = undefined
this.end = undefined
},
handleImport() {
this.upload.title = "生产目标导入";
this.upload.open = true;
this.fileList = []
},
//
handleFileUploadProgress(event, file, fileList) {
this.upload.isUploading = true;
},
//
handleFileSuccess(response, file, fileList) {
if (response.code !== 0) {
this.$modal.msgError(response.msg)
return;
}
this.upload.open = false;
this.upload.isUploading = false;
this.$refs.upload.clearFiles();
this.$message.success('导入成功!')
this.getDataList()
},
//
submitFileForm() {
this.$refs.upload.submit();
},
addFactory() {
this.addOrUpdateVisible = true;
this.$nextTick(() => {
this.$refs.addOrUpdate.init();
});
},
changeFactory($event) {
this.currentMenu = $event
this.facType = this.currentMenu === '碲化镉工厂' ? 0 : 1
this.getDataList()
},
handleClick(val) {
if (val.type === "edit") {
this.addOrUpdateVisible = true;
// this.addOrEditTitle = "";
this.$nextTick(() => {
this.$refs.addOrUpdate.init(val.data.id);
});
} else if (val.type === "delete") {
this.deleteHandle(val.data.id, val.data.factory, val.data._pageIndex)
} else {
this.otherMethods(val)
}
},
//
deleteHandle(id, name, index) {
this.$confirm('是否确认删除工厂名称为' + factoryList[name] + '的数据项?', "系统提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
delTarget(id).then(({ data }) => {
this.$message({
message: "操作成功",
type: "success",
duration: 1500,
onClose: () => {
this.getDataList();
},
});
});
})
.catch(() => { });
},
otherMethods(val) {
this.detailOrUpdateVisible = true;
this.addOrEditTitle = "详情";
this.$nextTick(() => {
this.$refs.detailOrUpdate.init(val.data.id);
});
},
getYear(e) {
if (this.end && Number(this.end) - Number(this.start) > 10) {
this.$message({
message: '年份起止时间不能超过十年',
type: 'warning'
});
this.start = undefined
this.end = undefined
// console.log();
} else {
if (Number(this.end) < Number(this.start)) {
this.$message({
message: '结束年份不能小于开始年份',
type: 'warning'
});
this.start = undefined
this.end = undefined
} else {
this.listQuery.beginTime = Number(this.start)
this.listQuery.endTime = Number(this.end)
}
}
if (!this.start && !this.end) {
this.listQuery.beginTime = undefined
this.listQuery.endTime = undefined
}
// console.log(e);
},
changeTime() {
if (this.listQuery.reportTime) {
const years = Number(this.listQuery.reportTime[1].slice(0, 4)) - Number(this.listQuery.reportTime[0].slice(0, 4))
const months = Number(this.listQuery.reportTime[1].slice(4)) - Number(this.listQuery.reportTime[0].slice(4))
if (years * 12 + months > 24) {
this.$message({
message: '时间范围不能超过24个月',
type: 'warning'
});
this.listQuery.reportTime = [];
} else {
this.listQuery.beginTime = Number(this.listQuery.reportTime[0])
this.listQuery.endTime = Number(this.listQuery.reportTime[1])
}
} else {
this.listQuery.beginTime = undefined
this.listQuery.endTime = undefined
}
},
onValueChange(picker, k) { // k
if (this.start && this.end) {
this.date1 = moment(this.start.getTime() - 24 * 60 * 60 * 1000).format('YYYY-MM-DD HH:mm:ss')
this.date2 = moment(this.end.getTime() + 5 * 24 * 60 * 60 * 1000).format('YYYY-MM-DD HH:mm:ss')
const numDays = (new Date(this.date2).getTime() - new Date(this.date1).getTime()) / (24 * 3600 * 1000);
if (numDays > 168) {
console.log(numDays)
this.$message({
message: '周范围不能超过24周',
type: 'warning'
});
} else {
this.listQuery.beginTime = Number(moment(this.start.getTime()).format('YYYYWW'))
this.listQuery.endTime = Number(moment(this.end.getTime()).format('YYYYWW'))
}
}
if (!this.start && !this.end) {
this.listQuery.beginTime = undefined
this.listQuery.endTime = undefined
}
},
changeDayTime() {
if (this.listQuery.reportTime) {
const numDays = Number(this.listQuery.reportTime[1]) - Number(this.listQuery.reportTime[0])
if (numDays > 30) {
this.$message({
message: '时间范围不能超过30天',
type: 'warning'
});
this.listQuery.reportTime = [];
} else {
this.listQuery.beginTime = Number(this.listQuery.reportTime[0])
this.listQuery.endTime = Number(this.listQuery.reportTime[1])
}
} else {
this.listQuery.beginTime = undefined
this.listQuery.endTime = undefined
}
},
async getDataList() {
if (this.currentMenu === '碲化镉工厂') {
await prodTargetDiPage(this.listQuery).then(res => {
await getStockRealTimePage(this.listQuery).then(res => {
if (res.code === 0) {
this.tableData = res.data.records
this.tableData = res.data.list
this.listQuery.total = res.data.total
}
})
} else {
await prodTargetToPage(this.listQuery).then(res => {
if (res.code === 0) {
this.tableData = res.data.records
this.tableData.forEach(item => {
const year = item.targetYear ? item.targetYear + '年' : ''
const month = item.targetMonth ? item.targetMonth + '月' : ''
item.tagertTime = year + month
})
this.listQuery.total = res.data.total
}
})
}
},
buttonClick(val) {
this.listQuery.reportTime = val.reportTime ? val.reportTime : undefined;
@ -635,23 +311,15 @@ export default {
const queryParams = this.listQuery;
queryParams.current = 1
queryParams.size = 999
if (this.facType === 0) {
// if (this.facType === 0) {
this.$modal.confirm('是否确认导出所有数据项?').then(() => {
this.exportLoading = true;
return exportDiTargetExcel(queryParams);
return exportExcel(queryParams);
}).then(response => {
this.$download.excel(response, '碲化镉工厂生产目标数据.xls');
this.$download.excel(response, '即时仓库数据.xls');
this.exportLoading = false;
}).catch(() => { });
} else {
this.$modal.confirm('是否确认导出所有数据项?').then(() => {
this.exportLoading = true;
return exportToTargetExcel(queryParams);
}).then(response => {
this.$download.excel(response, '铜铟镓硒工厂生产目标数据.xls');
this.exportLoading = false;
}).catch(() => { });
}
// }
}
},
};