|
@@ -7,8 +7,8 @@
|
|
@search-reset="resetChange"
|
|
@search-reset="resetChange"
|
|
/>
|
|
/>
|
|
<div class="btns">
|
|
<div class="btns">
|
|
- <el-button type="params" @click="exportToPNG">导出PNG图片</el-button>
|
|
|
|
- <el-button type="params" @click="exportToPDF">导出PDF文件</el-button>
|
|
|
|
|
|
+ <el-button type="primary" @click="exportToPNG">导出PNG图片</el-button>
|
|
|
|
+ <el-button type="primary" @click="exportToPDF">导出PDF文件</el-button>
|
|
<!-- <el-button type="params" v-print="printObj" @click="toPrint"
|
|
<!-- <el-button type="params" v-print="printObj" @click="toPrint"
|
|
>打印</el-button
|
|
>打印</el-button
|
|
> -->
|
|
> -->
|
|
@@ -188,9 +188,10 @@ const initGantt = (type) => {
|
|
critical_path: true,
|
|
critical_path: true,
|
|
export_api: true,
|
|
export_api: true,
|
|
});
|
|
});
|
|
|
|
+
|
|
gantt.templates.task_text = function (start, end, task) {
|
|
gantt.templates.task_text = function (start, end, task) {
|
|
return (
|
|
return (
|
|
- "<span style='padding:0 5px;color: #000; display: inline-block;width: 100%; white-space: nowrap;overflow: hidden; text-overflow: ellipsis; '>" +
|
|
|
|
|
|
+ "<span style='padding:0 5px;font-size:15px;color: #000; display: inline-block;width: 100%; white-space: nowrap;overflow: hidden; text-overflow: ellipsis; '>" +
|
|
task.text +
|
|
task.text +
|
|
"</span>"
|
|
"</span>"
|
|
);
|
|
);
|
|
@@ -212,7 +213,7 @@ const initGantt = (type) => {
|
|
gantt.config.grid_width = 350;
|
|
gantt.config.grid_width = 350;
|
|
gantt.config.add_column = false;
|
|
gantt.config.add_column = false;
|
|
gantt.config.duration_step = 1;
|
|
gantt.config.duration_step = 1;
|
|
- gantt.config.drag_resize = true;
|
|
|
|
|
|
+ gantt.config.resize_rows = true;
|
|
gantt.config.columns = [
|
|
gantt.config.columns = [
|
|
{
|
|
{
|
|
tree: true,
|
|
tree: true,
|
|
@@ -241,8 +242,8 @@ const initGantt = (type) => {
|
|
];
|
|
];
|
|
gantt.config.autofit = true;
|
|
gantt.config.autofit = true;
|
|
gantt.config.resize_rows = true;
|
|
gantt.config.resize_rows = true;
|
|
- gantt.config.row_height = 40;
|
|
|
|
- gantt.config.bar_height = 30;
|
|
|
|
|
|
+ gantt.config.row_height = 60;
|
|
|
|
+ gantt.config.bar_height = 40;
|
|
gantt.config.min_column_width = 60;
|
|
gantt.config.min_column_width = 60;
|
|
gantt.config.xml_date = "%Y-%m-%d %H:%i:%s"; //甘特图时间格式
|
|
gantt.config.xml_date = "%Y-%m-%d %H:%i:%s"; //甘特图时间格式
|
|
gantt.config.readonly = true; //是否只读
|
|
gantt.config.readonly = true; //是否只读
|
|
@@ -312,17 +313,37 @@ const setGantt = () => {
|
|
gantt.config.duration_unit = "hour";
|
|
gantt.config.duration_unit = "hour";
|
|
gantt.config.scale_height = 28 * 4;
|
|
gantt.config.scale_height = 28 * 4;
|
|
gantt.config.scales = [
|
|
gantt.config.scales = [
|
|
- { unit: "year", step: 1, format: "%Y年" },
|
|
|
|
- { unit: "month", step: 1, format: "%m月" },
|
|
|
|
|
|
+ {
|
|
|
|
+ unit: "year",
|
|
|
|
+ step: 1,
|
|
|
|
+ format: "%Y年",
|
|
|
|
+ css: function (date) {
|
|
|
|
+ return "year";
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ unit: "month",
|
|
|
|
+ step: 1,
|
|
|
|
+ format: "%m月",
|
|
|
|
+ css: function (date) {
|
|
|
|
+ return "month";
|
|
|
|
+ },
|
|
|
|
+ },
|
|
{
|
|
{
|
|
unit: "day",
|
|
unit: "day",
|
|
step: 1,
|
|
step: 1,
|
|
format: "%d日",
|
|
format: "%d日",
|
|
|
|
+ css: function (date) {
|
|
|
|
+ return "day";
|
|
|
|
+ },
|
|
},
|
|
},
|
|
{
|
|
{
|
|
unit: "hour",
|
|
unit: "hour",
|
|
step: 1,
|
|
step: 1,
|
|
format: "%H时",
|
|
format: "%H时",
|
|
|
|
+ css: function (date) {
|
|
|
|
+ return "hour";
|
|
|
|
+ },
|
|
},
|
|
},
|
|
];
|
|
];
|
|
gantt.init("gantt_here");
|
|
gantt.init("gantt_here");
|
|
@@ -332,16 +353,32 @@ const setGantt = () => {
|
|
case "1":
|
|
case "1":
|
|
gantt.config.scale_height = 28 * 4;
|
|
gantt.config.scale_height = 28 * 4;
|
|
gantt.config.scales = [
|
|
gantt.config.scales = [
|
|
- { unit: "year", step: 1, format: "%Y年" },
|
|
|
|
- { unit: "month", step: 1, format: "%m月" },
|
|
|
|
|
|
+ {
|
|
|
|
+ unit: "year",
|
|
|
|
+ step: 1,
|
|
|
|
+ format: "%Y年",
|
|
|
|
+ css: function (date) {
|
|
|
|
+ return "year";
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ unit: "month",
|
|
|
|
+ step: 1,
|
|
|
|
+ format: "%m月",
|
|
|
|
+ css: function (date) {
|
|
|
|
+ return "month";
|
|
|
|
+ },
|
|
|
|
+ },
|
|
{
|
|
{
|
|
unit: "day",
|
|
unit: "day",
|
|
step: 1,
|
|
step: 1,
|
|
format: "%d日",
|
|
format: "%d日",
|
|
|
|
+ css: function (date) {
|
|
|
|
+ return "day";
|
|
|
|
+ },
|
|
},
|
|
},
|
|
];
|
|
];
|
|
gantt.config.duration_unit = "day";
|
|
gantt.config.duration_unit = "day";
|
|
-
|
|
|
|
gantt.init("gantt_here");
|
|
gantt.init("gantt_here");
|
|
gantt.render();
|
|
gantt.render();
|
|
gantt.parse({ data: useData.value });
|
|
gantt.parse({ data: useData.value });
|
|
@@ -350,8 +387,22 @@ const setGantt = () => {
|
|
// initGantt("month");
|
|
// initGantt("month");
|
|
gantt.config.scale_height = 28 * 4;
|
|
gantt.config.scale_height = 28 * 4;
|
|
gantt.config.scales = [
|
|
gantt.config.scales = [
|
|
- { unit: "year", step: 1, format: "%Y年" },
|
|
|
|
- { unit: "month", step: 1, format: "%m月" },
|
|
|
|
|
|
+ {
|
|
|
|
+ unit: "year",
|
|
|
|
+ step: 1,
|
|
|
|
+ format: "%Y年",
|
|
|
|
+ css: function (date) {
|
|
|
|
+ return "year";
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ unit: "month",
|
|
|
|
+ step: 1,
|
|
|
|
+ format: "%m月",
|
|
|
|
+ css: function (date) {
|
|
|
|
+ return "month";
|
|
|
|
+ },
|
|
|
|
+ },
|
|
];
|
|
];
|
|
gantt.config.duration_unit = "month";
|
|
gantt.config.duration_unit = "month";
|
|
gantt.init("gantt_here");
|
|
gantt.init("gantt_here");
|
|
@@ -374,7 +425,6 @@ const setUseData = (data) => {
|
|
});
|
|
});
|
|
const data2 = JSON.parse(JSON.stringify(data1));
|
|
const data2 = JSON.parse(JSON.stringify(data1));
|
|
useData.value = data2;
|
|
useData.value = data2;
|
|
- console.log(useData.value, "useData2222");
|
|
|
|
};
|
|
};
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
setTime();
|
|
setTime();
|