Commit 30622fe2 authored by 周远喜's avatar 周远喜

Merge branch 'master' of http://git.mes123.com/zhouyx/mes-ui

parents d710bf8b 85bff081
......@@ -39,7 +39,7 @@
<Table :border="true" :columns="columnsImport" :data="excelData" :height="tdHeightExcel" :no-data-text="noDataText" ref="table" class="tableCommon" v-if="tableImport"></Table>
<component :is="detailExcel" ref="comExcel" @on-datalength="datalength" />
</div>
<FooterToolbar v-if="sheetNames.length>1&&tableImport">
<FooterToolbar v-if="sheetNames.length>1&&tableImport" class="footer">
<Form inline>
<FormItem>
<Tabs :animated="false" :value="0" @on-click="sheetClick">
......@@ -79,7 +79,7 @@ export default {
tableImport: true,
tdHeightExcel: "",
excelData: [],
excelDataBack: [], //临时存储原始数据
excelDataBack: [], //临时存储原始数据,
formatList: ["xlsx"],
columnsImport: [],
departArr: [], //部门list
......@@ -105,7 +105,7 @@ export default {
props: {
eid: Number,
data: {
// 当作table使用,直接显示数据
// 当作table使用,直接显示数据,数据里不能用英文逗号',',因为将excel转为数据后是用','分解的
type: Array,
default: function () {
return [];
......@@ -289,10 +289,14 @@ export default {
//多个名称转换为数组
arrUseNames.forEach((eusers) => {
if (eles[eusers.key] && eles[eusers.key] != "" && eles[eusers.key] != null) {
let arruserstemp = this.$u.clone(eles[eusers.key].split(',') || eles[eusers.key].split(','))
var arruserstemp = []
if (eles[eusers.key].indexOf(',') > -1) {
arruserstemp = eles[eusers.key].split(',')
} else {
arruserstemp = [eles[eusers.key]]
}
let tempUserIds = []
arruserstemp.forEach(eltempUsers => {
this.usersArr.forEach(elusers => {
if (eltempUsers == elusers.name) {
tempUserIds.push(elusers.id)
......@@ -567,5 +571,17 @@ export default {
text-align: right;
}
}
.footer {
.ivu-tabs-tab {
color: #aaa;
}
.ivu-tabs-tab-active,
.ivu-tabs-tab-focused {
color: #fff;
}
}
}
</style>
import XLSX from 'xlsx';
import Api from '@/plugins/request'
let henq = {};
let pdfInfo = ''
henq.clone = (data)=> {
......@@ -337,18 +336,19 @@ henq.readXLSX = (file) => {
}
//得到根据value得到对应数据字典的name
henq.dirName = (code, v) => {
var items = ""
let i = 0
code.forEach(ele => {
if (ele.code == v) {
items = ele.name
i++
var items = ""
let i = 0
code.forEach(ele => {
if (ele.code == v) {
items = ele.name
i++
}
});
if (i == 0) { //如果没查到对应的name,则返回默认name
items = code[0].name
}
});
if (i == 0) { //如果没查到对应的name,则返回默认name
items = code[0].name
}
return items
return items
}
//得到根据name得到对应数据字典的code
henq.dirCode = (code, v) => {
......@@ -628,6 +628,122 @@ henq.getCurMonth = (val) => {
}
return m_year + '-' + m_month
}
//获取当天、明天、昨天、本周、上周、本月、上月的日期 end
//导出excel
henq.export2excel=(exTitle,columns,datalist,store)=>{
//当前显示数据
let list = henq.clone(datalist);
const tHeader = []; // 设置Excel的表格第一行的标题
const filterVal = []; //list里对象的属性
var tempCol = [];
var tempColUser = []; //存放type=user的表头
var tempColUsers = []; //存放type=users的表头
var columnsCur = henq.clone(columns); //导出列标题信息griddata this.$refs.grid.columnsCur
columnsCur.forEach((el) => {
if (el.export) {
if (el.code) {
tempCol.push({
key: el.key,
code: el.code,
}); //临时存放code数据字典的字段及对应的数据字典code
}
if (el.type && el.type == "user") {
tempColUser.push({
key: el.key,
code: el.type,
}); //临时存放user列
}
if (el.type && el.type == "users") {
tempColUsers.push({
key: el.key,
code: el.type,
}); //临时存放user列
}
tHeader.push(el.title);
filterVal.push(el.key);
}
});
list.forEach((e) => {
tempCol.forEach((elem) => {
if (
(e[elem.key] && e[elem.key] != "" && e[elem.key] != null) ||
e[elem.key] == 0
) {
//如果数据字典项对应的DirName字段存在,通过name查询到对应的code,然后赋值。
let codeArr = [];
let keyValue = e[elem.key];
if (
keyValue.length > 0 &&
(keyValue.indexOf(",") > -1 || keyValue.indexOf(",") > -1)
) {
//如果对应的数据包含多个数据字典项,比如包含“,”或“,”
if (keyValue.indexOf(",") > -1) {
codeArr = keyValue.split(",");
}
if (keyValue.indexOf > -1) {
codeArr = keyValue.split(",");
}
}
if (codeArr.length <= 1) {
//对应的数据包含一个数据字典项
e[elem.key] = henq.dirName(store.getters.dictionaryByKey(elem.code),e[elem.key]);
} else {
//对应的数据包含多个数据字典项
let codeInfo = "";
codeArr.forEach((el) => {
codeInfo =
codeInfo +
henq.dirName(
store.getters.dictionaryByKey(elem.code),
el
) +
",";
});
e[elem.key] = codeInfo.substr(0, codeInfo.length - 1);
}
}
});
//导出username相关信息
tempColUser.forEach((eluser) => {
if (Array.isArray(e[eluser.key]) && e[eluser.key].length > 0) {
let temUsers = henq.clone(e[eluser.key]);
let temUserName = "";
temUsers.forEach((u) => {
temUserName = temUserName + store.getters.getUser(u).name;
});
e[eluser.key] = temUserName;
}
if (
e[eluser.key] &&
typeof e[eluser.key] == "string" &&
e[eluser.key] != "" &&
e[eluser.key] != null
) {
e[eluser.key] = store.getters.getUser(e[eluser.key]).name;
}
});
tempColUsers.forEach((elusers) => {
if (e[elusers.key].length > 0) {
let temUsers = henq.clone(e[elusers.key]);
let temUserName = "";
temUsers.forEach((u) => {
temUserName = temUserName + store.getters.getUser(u).name + ",";
});
e[elusers.key] = temUserName.substr(0, temUserName.length - 1);
}
});
});
let nowDate = henq.getNowTime(); //年月日时分秒yyyyMMddhhmmss
//获取导出数据结束
henq.outExcel(
exTitle + "(" + nowDate + ")",
tHeader,
filterVal,
list
);
}
export default henq;
......@@ -167,7 +167,15 @@ export default {
},
{
title: "版本",
key: "version",
key: "versionid",
render: (h, params) => {
return h("state", {
attrs: {
value: params.row.versionid,
code: "Process.Routing.version",
},
});
},
},
],
};
......
......@@ -15,7 +15,7 @@
</div>
<div class="down-screen">
<div>1</div>
<div>2</div>
<div><Suspend></Suspend></div>
<div>3</div>
<div>4</div>
</div>
......@@ -25,12 +25,14 @@
import MonthlyPlan from "./monthlyPlan.vue";
import Consume from "./consume.vue";
import Workshop from "./workshop.vue";
import Suspend from "./suspend.vue";
export default {
components: {
MonthlyPlan,
Consume,
Workshop,
Suspend,
},
data() {
return {};
......
<template>
<div>
<v-chart :options="braking" style="width:'100%',height:'100%'" />
</div>
</template>
<script>
import ECharts from "vue-echarts";
import echarts from "echarts/lib/echarts";
//import "echarts/lib/chart/pie";
import "echarts/lib/chart/bar";
import "echarts/lib/component/tooltip";
import "echarts/lib/component/title";
import "echarts/lib/component/legend";
import "echarts/lib/component/grid";
export default {
name: "MonthlyPlan",
components: {
"v-chart": ECharts,
},
data() {
return {
braking: {},
};
},
mounted() {
this.statistics();
},
methods: {
statistics() {
this.braking = {
backgroundColor: "#2c343c",
// color: ["#3398DB"],
title: {
text: "暂停任务类型分布",
left: "center",
top: 20,
textStyle: {
color: "#ccc",
},
},
tooltip: {
trigger: "axis",
axisPointer: {
// 坐标轴指示器,坐标轴触发有效
type: "shadow", // 默认为直线,可选为:'line' | 'shadow'
},
},
grid: {
left: "3%",
right: "4%",
bottom: "3%",
containLabel: true,
},
xAxis: {
type: "category",
data: ["计划数量", "已完成", "执行中", "暂停中", "未开工"],
axisTick: {
show: false,
},
axisLine: {
show: false,
},
axisLabel: {
textStyle: {
color: "#fff",
},
},
},
yAxis: {
splitLine: {
show: false,
// lineStyle: {
// color: "#eee",
// type: "solid",
// },
},
axisTick: {
show: false,
},
// axisLine: {
// show: false,
// },
axisLabel: {
textStyle: {
color: "#fff",
},
},
},
series: [
{
name: "任务分类",
type: "bar",
barWidth: 10,
label: {
show: true,
position: "top",
},
itemStyle: {
normal: {
barBorderRadius: [30, 30, 30, 30],
color: new echarts.graphic.LinearGradient(
0,
1,
0,
0,
[
{
offset: 0,
color: "#1268f3", // 0% 处的颜色
},
{
offset: 0.6,
color: "#08a4fa", // 60% 处的颜色
},
{
offset: 1,
color: "#01ccfe", // 100% 处的颜色
},
],
false
),
},
},
data: [10, 52, 200, 334, 390, 330, 220],
},
],
};
},
},
};
</script>
\ No newline at end of file
......@@ -87,6 +87,7 @@ export default {
detail: null,
curId: null,
list: [],
rootList: [],
columns: [{
key: "drag",
type: "drag",
......@@ -290,6 +291,7 @@ export default {
};
Api.list(params).then((r) => {
let res = r.result;
this.rootList = this.$u.clone(r.result)
var data = this.$u.toTree(
res,
null,
......@@ -401,7 +403,8 @@ export default {
//导出excel
if (name == 'down') {
this.exportTl = '项目目录-' + this.data.title;
this.$refs.grid.export2Excel()
// this.$refs.grid.export2Excel()
this.$u.export2excel(this.exportTl, this.columns, this.list)
}
if (name == 'importExcel') {
this.openModalIm()
......@@ -427,7 +430,8 @@ export default {
},
down() {
this.exportTl = '项目目录-' + this.data.title;
this.$refs.grid.export2Excel()
this.$u.export2excel(this.exportTl, this.columns, this.rootList, this.$store)
//this.$refs.grid.export2Excel()
},
importExcel() {
this.openModalIm()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment