Compare commits
No commits in common. "b05d9067d33e31f52367c6c4e71caa94d50c1c08" and "f5f472854b1fe755ffabed440dccceef54e81686" have entirely different histories.
b05d9067d3
...
f5f472854b
2
.env.dev
2
.env.dev
@ -1,7 +1,7 @@
|
||||
###
|
||||
# @Author: zhp
|
||||
# @Date: 2024-04-28 13:42:51
|
||||
# @LastEditTime: 2024-07-25 15:43:42
|
||||
# @LastEditTime: 2024-07-25 14:11:43
|
||||
# @LastEditors: zhp
|
||||
# @Description:
|
||||
###
|
||||
|
@ -1,24 +1,32 @@
|
||||
/*
|
||||
* @Author: zhp
|
||||
* @Date: 2024-04-26 14:53:45
|
||||
* @LastEditTime: 2024-07-26 09:32:26
|
||||
* @LastEditTime: 2024-05-06 14:55:33
|
||||
* @LastEditors: zhp
|
||||
* @Description:
|
||||
*/
|
||||
import request from '@/utils/request'
|
||||
export function getCostMainPage(data) {
|
||||
|
||||
// 查询部门列表
|
||||
export function getOrderList(data) {
|
||||
return request({
|
||||
url: 'ip/cost-main/page',
|
||||
url: 'ip/prod-order/prodOrderList',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
export function getCostPage(data) {
|
||||
return request({
|
||||
url: 'ip/cost/costPage',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
export function exportExcel(data) {
|
||||
export function getCostList(data) {
|
||||
return request({
|
||||
url: 'ip/cost-main/export-excel',
|
||||
url: 'ip/cost/costList',
|
||||
method: 'post',
|
||||
data: data,
|
||||
responseType: 'blob'
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
@ -1,24 +1,15 @@
|
||||
/*
|
||||
* @Author: zhp
|
||||
* @Date: 2024-04-28 09:28:12
|
||||
* @LastEditTime: 2024-07-25 15:05:43
|
||||
* @LastEditTime: 2024-04-28 15:52:36
|
||||
* @LastEditors: zhp
|
||||
* @Description:
|
||||
*/
|
||||
import request from '@/utils/request'
|
||||
export function getStockRealTimePage(data) {
|
||||
export function getStockPage(data) {
|
||||
return request({
|
||||
url: 'ip/stock-realtime/page',
|
||||
url: 'ip/stock/page',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
export function exportExcel(data) {
|
||||
return request({
|
||||
url: '/ip/stock-realtime/export-excel',
|
||||
method: 'get',
|
||||
data: data,
|
||||
responseType: 'blob'
|
||||
})
|
||||
}
|
||||
|
@ -1,12 +1,12 @@
|
||||
/*
|
||||
* @Author: zhp
|
||||
* @Date: 2024-04-12 11:13:06
|
||||
* @LastEditTime: 2024-07-26 09:31:09
|
||||
* @LastEditTime: 2024-04-12 16:20:31
|
||||
* @LastEditors: zhp
|
||||
* @Description:
|
||||
*/
|
||||
import Vue from 'vue'
|
||||
import Element, { DatePicker } from 'element-ui'
|
||||
import Element 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,8 +68,7 @@ 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)
|
||||
|
@ -129,7 +129,7 @@ export default {
|
||||
},
|
||||
splitLine: {
|
||||
lineStyle: {
|
||||
color: "rgba(69,97,174,.4)",
|
||||
color: "#4561AE",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -1,7 +1,7 @@
|
||||
<!--
|
||||
* @Author: zhp
|
||||
* @Date: 2024-05-23 15:49:14
|
||||
* @LastEditTime: 2024-07-25 14:29:40
|
||||
* @LastEditTime: 2024-07-22 14:05:00
|
||||
* @LastEditors: zhp
|
||||
* @Description:
|
||||
-->
|
||||
@ -130,7 +130,7 @@ export default {
|
||||
},
|
||||
splitLine: {
|
||||
lineStyle: {
|
||||
color: "rgba(69,97,174,.4)",
|
||||
color: "#4561AE",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -1,7 +1,7 @@
|
||||
<!--
|
||||
* @Author: zhp
|
||||
* @Date: 2024-05-07 13:22:43
|
||||
* @LastEditTime: 2024-07-25 14:29:04
|
||||
* @LastEditTime: 2024-07-23 15:52:25
|
||||
* @LastEditors: zhp
|
||||
* @Description:
|
||||
-->
|
||||
@ -135,7 +135,7 @@ export default {
|
||||
},
|
||||
splitLine: {
|
||||
lineStyle: {
|
||||
color: "rgba(69,97,174,.4)",
|
||||
color: "#4561AE",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -1,7 +1,7 @@
|
||||
<!--
|
||||
* @Author: zhp
|
||||
* @Date: 2024-05-23 15:50:44
|
||||
* @LastEditTime: 2024-07-25 14:29:09
|
||||
* @LastEditTime: 2024-07-23 15:52:09
|
||||
* @LastEditors: zhp
|
||||
* @Description:
|
||||
-->
|
||||
@ -135,7 +135,7 @@ export default {
|
||||
},
|
||||
splitLine: {
|
||||
lineStyle: {
|
||||
color: "rgba(69,97,174,.4)",
|
||||
color: "#4561AE",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -1,7 +1,7 @@
|
||||
<!--
|
||||
* @Author: zhp
|
||||
* @Date: 2024-05-30 08:58:39
|
||||
* @LastEditTime: 2024-07-25 15:42:47
|
||||
* @LastEditTime: 2024-07-25 09:54:21
|
||||
* @LastEditors: zhp
|
||||
* @Description:
|
||||
-->
|
||||
@ -59,7 +59,7 @@ export default {
|
||||
left: "10%",
|
||||
right: "3%",
|
||||
bottom: "10%",
|
||||
top: "20%",
|
||||
top: "15%",
|
||||
// containLabel: true,
|
||||
},
|
||||
// tooltip: {
|
||||
@ -158,7 +158,7 @@ export default {
|
||||
},
|
||||
splitLine: {
|
||||
lineStyle: {
|
||||
color: "rgba(69,97,174,.4)",
|
||||
color: "#4561AE",
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -349,7 +349,7 @@ export default {
|
||||
|
||||
.legend {
|
||||
position: absolute;
|
||||
top: 6vh;
|
||||
top: 3vh;
|
||||
right: 13vw;
|
||||
}
|
||||
|
||||
|
@ -118,7 +118,7 @@
|
||||
<div class="chart">
|
||||
<div class="chart-title">
|
||||
<span class="title">生产情况</span>
|
||||
<div class="button-than" style="position: absolute;right: 0%;">
|
||||
<div class="button-than" style="position: absolute;right: 3%;">
|
||||
<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: 20px;
|
||||
margin-top: 5px;
|
||||
// flex: 1;
|
||||
// gap: 6px;
|
||||
height: 1.5vw;
|
||||
|
@ -1,576 +0,0 @@
|
||||
<!--
|
||||
* @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>
|
421
src/views/cost/index.vue
Normal file
421
src/views/cost/index.vue
Normal file
@ -0,0 +1,421 @@
|
||||
<!--
|
||||
* @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) {
|
||||
//shijianchuo是整数,否则要parseInt转换
|
||||
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>
|
233
src/views/cost/lineChart.vue
Normal file
233
src/views/cost/lineChart.vue
Normal file
@ -0,0 +1,233 @@
|
||||
<!--
|
||||
* @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>
|
@ -129,7 +129,7 @@ export default {
|
||||
},
|
||||
splitLine: {
|
||||
lineStyle: {
|
||||
color: "rgba(69,97,174,.4)",
|
||||
color: "#4561AE",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -131,7 +131,7 @@ export default {
|
||||
},
|
||||
splitLine: {
|
||||
lineStyle: {
|
||||
color: "rgba(69,97,174,.4)",
|
||||
color: "#4561AE",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -1,37 +1,64 @@
|
||||
<!--
|
||||
* @Author: zhp
|
||||
* @Date: 2024-04-15 10:49:13
|
||||
* @LastEditTime: 2024-07-26 10:28:53
|
||||
* @LastEditTime: 2024-07-25 14:07:51
|
||||
* @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 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-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-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<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-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-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<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 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>
|
||||
<!-- <el-form-item label="玻璃类型" prop="type">
|
||||
<el-select v-model="listQuery.type" placeholder="请选择玻璃类型">
|
||||
@ -48,19 +75,23 @@
|
||||
<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"
|
||||
:max-height="tableH">
|
||||
<!-- <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">
|
||||
<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>
|
||||
|
||||
<!-- 用户导入对话框 -->
|
||||
@ -77,39 +108,92 @@
|
||||
|
||||
<script>
|
||||
import { parseTime } from '@/utils/ruoyi';
|
||||
import { getStockRealTimePage, exportExcel } from '@/api/wareHouse';
|
||||
import { prodTargetDiPage, prodTargetToPage, exportDiTargetExcel, exportToTargetExcel, delTarget, importToTarget, importDiTarget } from '@/api/produceData';
|
||||
// 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, tableHeightMixin],
|
||||
mixins: [basicPage],
|
||||
data() {
|
||||
return {
|
||||
factoryList,
|
||||
dhgfactoryList,
|
||||
tyjxfactoryList,
|
||||
currentMenu: '碲化镉工厂',
|
||||
fileList: [],
|
||||
start: undefined,
|
||||
end: undefined,
|
||||
listQuery: {
|
||||
size: 10,
|
||||
current: 1,
|
||||
factorys: null,
|
||||
total: 0,
|
||||
mDType:0,
|
||||
wDType: 0,
|
||||
materialCode:null,
|
||||
materialName: null,
|
||||
warehouse: null,
|
||||
date: 3,
|
||||
beginTime: undefined,
|
||||
endTime: undefined,
|
||||
reportTime: []
|
||||
},
|
||||
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',
|
||||
@ -194,72 +278,105 @@ export default {
|
||||
label: '成本管理',
|
||||
},
|
||||
],
|
||||
mDTypeList: [
|
||||
{
|
||||
value: 0,
|
||||
label: '物料编码'
|
||||
},
|
||||
timeList: [
|
||||
{
|
||||
value: 1,
|
||||
label: '物料名称'
|
||||
}
|
||||
],
|
||||
wDTypeList: [
|
||||
label: '日'
|
||||
},
|
||||
{
|
||||
value: 0,
|
||||
label: '仓库名称'
|
||||
value: 2,
|
||||
label: '周'
|
||||
},
|
||||
{
|
||||
value: 3,
|
||||
label: '月'
|
||||
},
|
||||
{
|
||||
value: 4,
|
||||
label: '年'
|
||||
}
|
||||
],
|
||||
tableProps: [
|
||||
{
|
||||
prop: 'materialCode',
|
||||
label: '物料编码',
|
||||
prop: 'factory',
|
||||
label: '工厂名称',
|
||||
filter: (val) => factoryList[val],
|
||||
minWidth: 200,
|
||||
showOverflowtooltip: true
|
||||
},
|
||||
{
|
||||
prop: 'materialName',
|
||||
label: '物料名称',
|
||||
prop: 'targetTime',
|
||||
label: '目标时间',
|
||||
minWidth: 150,
|
||||
showOverflowtooltip: true
|
||||
},
|
||||
{
|
||||
prop: 'spec',
|
||||
label: '规格型号',
|
||||
prop: 'updateTime',
|
||||
label: '提交时间',
|
||||
filter: parseTime,
|
||||
minWidth: 150,
|
||||
showOverflowtooltip: true
|
||||
},
|
||||
{
|
||||
prop: 'warehouse',
|
||||
label: '仓库名称',
|
||||
prop: 'ftoInput',
|
||||
label: 'FTO投入量(片)',
|
||||
minWidth: 150,
|
||||
showOverflowtooltip: true
|
||||
},
|
||||
{
|
||||
prop: 'batchCode',
|
||||
label: '批号',
|
||||
prop: 'chipYield',
|
||||
label: '芯片产量(片)',
|
||||
minWidth: 150,
|
||||
showOverflowtooltip: true
|
||||
},
|
||||
{
|
||||
prop: 'unit',
|
||||
label: '库存主单位',
|
||||
prop: 'chipAveragePower',
|
||||
label: '芯片平均功率(W)',
|
||||
minWidth: 150,
|
||||
showOverflowtooltip: true
|
||||
},
|
||||
{
|
||||
prop: 'num',
|
||||
label: '库存量',
|
||||
prop: 'chipYieldRate',
|
||||
label: '芯片良率(%)',
|
||||
minWidth: 150,
|
||||
showOverflowtooltip: true
|
||||
},
|
||||
{
|
||||
prop: 'factory',
|
||||
label: '库存组织',
|
||||
prop: 'chipTotalPower',
|
||||
label: '芯片总功率(KW)',
|
||||
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, //开始时间
|
||||
@ -269,27 +386,234 @@ 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() {
|
||||
await getStockRealTimePage(this.listQuery).then(res => {
|
||||
if (this.currentMenu === '碲化镉工厂') {
|
||||
await prodTargetDiPage(this.listQuery).then(res => {
|
||||
if (res.code === 0) {
|
||||
this.tableData = res.data.list
|
||||
this.tableData = res.data.records
|
||||
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;
|
||||
@ -311,15 +635,23 @@ 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 exportExcel(queryParams);
|
||||
return exportDiTargetExcel(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(() => { });
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user