项目管理工具dhtmlxGantt教程(十五):MS项目导入导出(上)
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">这篇<span style="color: black;">文案</span>给<span style="color: black;">大众</span>讲解利用DHTMLX Gantt从MS项目导出。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><strong style="color: blue;"><span style="color: black;"><a style="color: black;">DHTMLX Gantt官方最新版免费下载试用,历史版本下载,在线文档和<span style="color: black;">帮忙</span>文件下载-慧都网</a></span></strong></span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">导出MS项目</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">甘特图组件<span style="color: black;">准许</span>将链接、任务和资源导出到 MS Project 中。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">要将数据从甘特图导出到 MS Project,请执行以下操作:</span></p><span style="color: black;">在页面中<span style="color: black;">包括</span> “https://export.dhtmlx.com/gantt/api.js” 文件已启用在线导出服务:</span><span style="color: black;"><<span style="color: black;">script</span> <span style="color: black;">src</span>=<span style="color: black;">"codebase/dhtmlxgantt.js"</span>></span><span style="color: black;"></<span style="color: black;">script</span>></span>
<span style="color: black;"><<span style="color: black;">script</span> <span style="color: black;">src</span>=<span style="color: black;">"https://export.dhtmlx.com/gantt/api.js"</span>></span><span style="color: black;"></<span style="color: black;">script</span>></span>
<span style="color: black;"><<span style="color: black;">link</span> <span style="color: black;">rel</span>=<span style="color: black;">"stylesheet"</span> <span style="color: black;">href</span>=<span style="color: black;">"codebase/dhtmlxgantt.css"</span> <span style="color: black;">type</span>=<span style="color: black;">"text/css"</span>></span>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">调用exportToMSProject<span style="color: black;">办法</span>从甘特图中导出数据。</span></p><span style="color: black;">gantt</span><span style="color: black;">.exportToMSProject</span>();<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">该<span style="color: black;">办法</span>将向远程服务发送一个请求,该服务将输出一个XML项目文件或返回一个url以下载生成的文件。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">响应将<span style="color: black;">包括</span>以下结构的JSON:</span></p>{
<span style="color: black;">data</span>: {},
<span style="color: black;">config</span>: {},
<span style="color: black;">resources</span>: <span style="color: black;">[]</span>,
<span style="color: black;">worktime</span>: {}
}<span style="color: black;">数据 - 甘特图 数据对象 。 <span style="color: black;">每一个</span>任务都有以下属性: id 、 open 、 parent 、 progress 、 start_date 、 text 、 resource 。 日期以“%Y-%m-%d %H:%i”格式进行字符串化。</span><span style="color: black;">config - <span style="color: black;">拥有</span>从项目文件中检索的设置的甘特图 配置 对象。</span><span style="color: black;">resources - 一个对象数组(<span style="color: black;">每一个</span>对象都<span style="color: black;">拥有</span>以下属性:{ id: string, name:string, type:string }),<span style="color: black;">表率</span>项目文件中的资源列表。</span><span style="color: black;">worktime - <span style="color: black;">包括</span>项目日历中的工作时间设置的对象。</span>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">导出设置</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">exportToMSProject () <span style="color: black;">办法</span>将<span style="color: black;">拥有</span>多个属性的对象<span style="color: black;">做为</span>参数(所有属性都是可选的):</span></p><span style="color: black;">name - (字符串)获取文件的名<span style="color: black;">叫作</span>(默认为“gantt.xml”)。</span><span style="color: black;">gantt</span><span style="color: black;">.exportToMSProject</span>({
<span style="color: black;">name</span>:<span style="color: black;">custom.xml</span>
});<span style="color: black;">auto_scheduling - (boolean) <span style="color: black;">暗示</span>导出项目中任务的调度模式。 true 会将任务标记为自动计划, false 会将任务标记为手动计划(默认状态)。</span><span style="color: black;">gantt</span><span style="color: black;">.exportToMSProject</span>({
<span style="color: black;">auto_scheduling</span>: false
});<span style="color: black;">skip_circular_links - (boolean) <span style="color: black;">暗示</span><span style="color: black;">是不是</span>删除循环链接(true - 将被删除(默认模式),false - 不会被删除)。</span><span style="color: black;">gantt</span><span style="color: black;">.exportToMSProject</span>({
<span style="color: black;">skip_circular_links</span>: false
});<span style="color: black;">项目 -(对象)<span style="color: black;">准许</span>为导出的项目实体设置自定义属性</span><span style="color: black;">gantt</span><span style="color: black;">.exportToMSProject</span>({
<span style="color: black;">project</span>: {
<span style="color: black;">Author</span>: <span style="color: black;">I am!</span>,
<span style="color: black;">MinutesPerDay</span>: function () {
return gantt.config.hours_per_day *<span style="color: black;">60</span>;
}
}
});<span style="color: black;">任务 -(对象)<span style="color: black;">准许</span>为导出的任务项设置自定义属性</span>gantt.exportToMSProject({
<span style="color: black;">tasks</span>: {
<span style="color: black;">StartVariance</span>: <span style="color: black;"><span style="color: black;">function</span> (<span style="color: black;">task</span>) </span>{
<span style="color: black;">if</span>(task.startVariance)<span style="color: black;">return</span> task.startVariance;
<span style="color: black;">else</span>
<span style="color: black;">return</span> <span style="color: black;">0</span>;
},
<span style="color: black;">PercentWorkComplete</span>: <span style="color: black;"><span style="color: black;">function</span> (<span style="color: black;">task</span>) </span>{
<span style="color: black;">return</span> (task.progress + <span style="color: black;">0.1</span>);
},
<span style="color: black;">Custom</span>: <span style="color: black;"><span style="color: black;">function</span> (<span style="color: black;">task</span>) </span>{
<span style="color: black;">return</span> <span style="color: black;">Custom value</span>;
},
<span style="color: black;">Custom 2</span>: <span style="color: black;">My Custom value</span>
}
});<span style="color: black;">callback - (function) <span style="color: black;">倘若</span>你想接收一个 url 来下载生成的 XML, callback <span style="color: black;">能够</span><span style="color: black;">运用</span> 属性。 它接收一个带有 url 属性的 JSON 对象:</span><span style="color: black;">gantt</span><span style="color: black;">.exportToMSProject</span>({
<span style="color: black;">project</span>: {
<span style="color: black;">Author</span>: <span style="color: black;">I am!</span>,
<span style="color: black;">MinutesPerDay</span>: function () {
return gantt.config.hours_per_day * <span style="color: black;">60</span>;
}
}
});<span style="color: black;">resources - (array) <span style="color: black;">准许</span>将资源列表导出到 MS Project 文件中</span>gantt<span style="color: black;">.exportToMSProject</span>({
resources: [
{<span style="color: black;">"id"</span>:<span style="color: black;">"1"</span>,<span style="color: black;">"name"</span>:<span style="color: black;">"John"</span>,<span style="color: black;">"type"</span>:<span style="color: black;">"work"</span>},
{<span style="color: black;">"id"</span>:<span style="color: black;">"2"</span>,<span style="color: black;">"name"</span>:<span style="color: black;">"Mike"</span>,<span style="color: black;">"type"</span>:<span style="color: black;">"work"</span>},
{<span style="color: black;">"id"</span>:<span style="color: black;">"3"</span>,<span style="color: black;">"name"</span>:<span style="color: black;">"Anna"</span>,<span style="color: black;">"type"</span>:<span style="color: black;">"work"</span>}
]
});<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">可能的资源类型是“工作”、“成本”、“材料”。 资源分配是<span style="color: black;">运用</span>任务配置的 ResourceAssignments 属性指定的:</span></p><span style="color: black;">var</span> users = [<span style="color: black;">// resources</span>
{<span style="color: black;">key</span>:<span style="color: black;">0</span>, <span style="color: black;">label</span>: <span style="color: black;">"N/A"</span>},
{<span style="color: black;">key</span>:<span style="color: black;">1</span>, <span style="color: black;">label</span>: <span style="color: black;">"John"</span>},
{<span style="color: black;">key</span>:<span style="color: black;">2</span>, <span style="color: black;">label</span>: <span style="color: black;">"Mike"</span>},
{<span style="color: black;">key</span>:<span style="color: black;">3</span>, <span style="color: black;">label</span>: <span style="color: black;">"Anna"</span>}
];
gantt.exportToMSProject({
<span style="color: black;">resources</span>: users
.filter(<span style="color: black;"><span style="color: black;">function</span>(<span style="color: black;">u</span>)</span>{
<span style="color: black;">if</span>(u.key === <span style="color: black;">0</span>)<span style="color: black;">//skip the default option </span>
<span style="color: black;">return</span> <span style="color: black;">false</span>;
<span style="color: black;">return</span> <span style="color: black;">true</span>;
})
.map(<span style="color: black;"><span style="color: black;">function</span>(<span style="color: black;">u</span>)</span>{
<span style="color: black;">return</span> {
<span style="color: black;">id</span>: u.key,
<span style="color: black;">name</span>: u.label,
<span style="color: black;">type</span>: <span style="color: black;">"work"</span>
};
}),
<span style="color: black;">tasks</span>: {
<span style="color: black;">ResourceAssignments</span>: <span style="color: black;"><span style="color: black;">function</span>(<span style="color: black;">task</span>)</span>{ <span style="color: black;">return</span> task.user; } }
});<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">属性设置为将 ResourceAssignments 任务对象<span style="color: black;">做为</span>参数并返回字符串/数字值或字符串/数字值数组的函数:</span></p>gantt<span style="color: black;">.exportToMSProject</span>({
resources: [
{<span style="color: black;">"id"</span>:<span style="color: black;">"1"</span>,<span style="color: black;">"name"</span>:<span style="color: black;">"John"</span>,<span style="color: black;">"type"</span>:<span style="color: black;">"work"</span>},
{<span style="color: black;">"id"</span>:<span style="color: black;">"2"</span>,<span style="color: black;">"name"</span>:<span style="color: black;">"Mike"</span>,<span style="color: black;">"type"</span>:<span style="color: black;">"work"</span>},
{<span style="color: black;">"id"</span>:<span style="color: black;">"3"</span>,<span style="color: black;">"name"</span>:<span style="color: black;">"Anna"</span>,<span style="color: black;">"type"</span>:<span style="color: black;">"work"</span>}
]
});<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">可能的资源类型是“工作”、“成本”、“材料”。 资源分配是<span style="color: black;">运用</span>任务配置的 ResourceAssignments 属性指定的:</span></p><span style="color: black;">tasks</span>: {
<span style="color: black;">ResourceAssignments</span>: <span style="color: black;">function</span>(task){
return ;
}
}<span style="color: black;">server - (字符串)请求的 API 端点。 可与导出服务的本地安装<span style="color: black;">一块</span><span style="color: black;">运用</span>。 默认值为 https://export.dhtmlx.com/gantt 。</span><span style="color: black;">gantt</span><span style="color: black;">.exportToMSProject</span>({
<span style="color: black;">server</span>:<span style="color: black;">"https://myapp.com/myexport/gantt"</span>
});<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">dhtmlxGantt是用于跨浏览器和跨平台应用程序的功能齐全的Gantt图表,可满足<strong style="color: blue;">项目管理控件</strong>应用程序的所有<span style="color: black;">需要</span>,是最完善的甘特图图表库。<span style="color: black;">认识</span><span style="color: black;">更加多</span>DhtmlxGantt<span style="color: black;">关联</span>内容和<span style="color: black;">新闻</span>,欢迎在线咨询<span style="color: black;">或</span>私信我获取正版试用版及报价。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><strong style="color: blue;"><span style="color: black;">甘特图控件交流群:764148812 欢迎进群交流讨论</span></strong></span></p>
你的见解真是独到,让我受益匪浅。 可以发布外链的网站 http://www.fok120.com/
页:
[1]