好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

springboot+thymeleaf+mybatis实现甘特图的详细过程

首先我们要明白:这个甘特图需要哪些动态数据。

(1)需要:id,tname,number,计划开始时间,开始时间,计划结束时间,结束时间,项目负责人,参与人,知情人id,计划时长(可以计算得出的,不必在数据库中);前置任务;项目进度,该任务属于哪个任务

(2)然后利用easycode插件生成实体类,映射类,服务类,ontcroller等

(3)利用bootstrap框架做出甘特图的样式,写好js。

?

CopyRight:2016-2025好得很程序员自学网 备案ICP:湘ICP备09009000号-16 http://haodehen.cn
本站资讯不构成任何建议,仅限于个人分享,参考须谨慎!
本网站对有关资料所引致的错误、不确或遗漏,概不负任何法律责任。
本网站刊载的所有内容(包括但不仅限文字、图片、LOGO、音频、视频、软件、程序等)版权归原作者所有。任何单位或个人认为本网站中的内容可能涉嫌侵犯其知识产权或存在不实内容时,请及时通知本站,予以删除。

网站内容来源于网络分享,如有侵权发邮箱到:kenbest@126.com,收到邮件我们会即时下线处理。
网站框架支持:HDHCMS   51LA统计 百度统计
Copyright © 2018-2025 「好得很程序员自学网
[ SiteMap ]

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90

91

92

93

94

95

96

97

98

99

100

101

102

103

104

105

106

107

108

109

110

111

112

113

114

115

116

117

118

119

120

121

122

123

124

125

126

127

128

129

130

131

132

133

134

135

136

137

138

139

140

141

142

143

144

145

146

147

148

149

150

151

152

153

154

155

156

157

158

159

160

161

162

163

164

165

166

167

168

169

170

171

172

173

174

175

176

177

178

179

180

181

182

183

184

185

186

187

188

189

190

191

192

193

194

195

196

197

198

199

200

201

202

203

204

205

206

207

208

209

210

211

212

213

214

215

216

217

218

219

220

221

222

223

224

225

226

227

228

229

230

231

232

233

234

235

236

237

238

239

240

241

242

243

244

245

246

247

248

249

250

251

252

253

254

255

256

257

258

259

260

261

262

263

264

265

266

267

268

269

270

271

272

273

274

275

276

277

278

279

280

281

282

283

284

285

286

287

288

289

290

291

292

293

294

295

296

297

298

299

300

301

302

303

304

305

306

307

308

309

310

311

312

313

314

315

316

317

318

319

320

321

322

323

324

325

326

327

328

329

330

331

332

333

334

335

336

337

338

339

340

341

342

343

344

345

346

347

348

349

350

351

352

353

354

355

356

357

358

359

360

361

362

363

364

365

366

367

368

369

370

371

372

373

374

375

376

377

378

379

380

381

382

383

384

385

386

387

388

389

390

391

392

393

394

395

396

397

398

399

400

401

402

403

404

405

406

407

408

409

410

411

412

413

414

415

416

417

418

419

420

421

422

423

424

425

426

427

428

429

430

431

432

433

434

435

436

437

438

439

440

441

442

443

444

445

446

447

448

449

450

451

452

453

454

455

456

457

458

459

460

461

462

463

464

465

466

467

468

469

470

471

472

473

474

475

476

477

478

479

480

481

482

483

484

485

486

487

488

489

490

491

492

493

494

495

496

497

498

499

500

501

502

503

504

505

506

507

508

509

510

511

512

513

514

515

516

517

518

519

520

521

522

523

524

525

526

527

528

529

530

531

532

533

534

535

536

537

538

539

540

541

542

543

544

545

546

547

548

549

550

551

552

553

554

555

556

557

558

559

560

561

562

563

564

565

566

567

568

569

570

571

572

573

574

575

576

577

578

579

580

581

582

583

584

585

586

587

588

589

590

591

592

593

594

595

596

597

598

599

600

601

602

603

604

605

606

607

608

609

610

611

612

613

614

615

616

617

618

619

620

621

622

623

624

625

626

627

628

629

630

631

632

633

634

635

636

637

638

639

640

641

642

643

644

645

646

647

648

649

650

651

652

653

654

655

656

657

658

659

660

661

662

663

664

665

666

667

668

669

670

671

672

673

674

675

676

677

678

679

680

681

682

683

684

685

686

687

688

689

690

691

692

693

694

695

696

697

698

699

700

701

702

703

704

705

706

707

708

709

710

711

712

713

<!doctype html>

<html xmlns:th= "http://HdhCmsTestthymeleleaf.org" >

<head>

     <title>ganttu.html</title>

     <meta name= "keywords" content= "keyword1,keyword2,keyword3" />

     <meta http-equiv= "content-type" content= "text/html; charset=utf-8" />

 

     <meta name= "reason" content= "甘特图的实际进度与计划进度可能不符,为了展示实际进度与计划进度的差异和方便统计,自己写了个甘特图框架" />

 

     <meta name= "mast" content= "使用代码之前请留言,禁止转载..." />

 

     <meta name= "description" content= "liuyuhang    的甘特图,当前版本1.0,2019-02-19" />

     <meta name= "description" content= "时间日期格式:yyyy-mm-dd" />

     <meta name= "description" content= "①计划进度与实际进度双重进度体系" />

     <meta name= "description" content= "②有前置任务连接线" />

     <meta name= "description" content= "③可修改图颜色" />

     <meta name= "description" content= "④可隐藏与展示列" />

     <meta name= "description" content= "⑤可隐藏域展示子项目" />

     <meta name= "description" content= "⑥可跳转时间到当前时间" />

     <meta name= "description" content= "⑦可从当前项目开始时间查看" />

     <meta name= "description" content= "⑦可隐藏某时间之前的内容" />

 

     <meta name= "warning" content= "⑧未做图拖拽,并不打算做..." />

 

     <meta name= "author" content= "liuyuhang 13501043063" />

     <!-- 只引用了这些,其余的并没有引用 -->

     <link href= "https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel= "external nofollow"   rel= "stylesheet" />

     <script src= "https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js" ></script>

     <script src= "https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js" ></script>

 

     <style type= "text/css" >

         #ganttu-head {

             height: 70px;

             background-color: #dddddd;

             padding: 10px 20px;

         }

 

         #ganttu-body {

             min-height: 780px;

             background-color: #eeeeee;

             padding: 10px 20px;

             font-size: 20px;

         }

 

         #ganttu-index-projectname {

             display: inline;

             padding: 5px 15px;

             background-image: linear-gradient(to left, # 222222 0 %, # 222222 75 %, # 000000 100 %);

             color: white;

             border-radius: 18px;

         }

 

         #ganttu-index-projectdesc {

             display: inline;

             padding: 5px 15px;

             background-image: linear-gradient(to left, # 777777 0 %, # 777777 75 %, # 333333 100 %);

             color: white;

             border-radius: 18px;

         }

 

         td {

             white-space: nowrap

         }

     </style>

</head>

<body>

<div id= 'ganttu-head' class = 'col-lg-12 col-md-12 col-sm-12 col-xs-12' style= "height:100px" >

     <div style= 'display: inline;font-size: 30px;font-weight: normal;padding: 5px 15px;' >甘特图面板</div>

     <div id= 'ganttu-index-projectname' >此项目 名称...</div>

     <div id= 'ganttu-index-projectdesc' >此项目描述...</div>

</div>

<div id= 'ganttu-body' class = 'col-lg-12 col-md-12 col-sm-12 col-xs-12' style= ';overflow-x:scroll;font-size:14px;' >

     <!-- 甘特图放到了这个div中 -->

     <div id= "lyh-ganttu" class = 'col-lg-12 col-md-12 col-sm-12 col-xs-12' style= 'position:relative;padding:0px;height:700px;' ></div>

</div>

</body>

<script type= "text/javascript" th:inline= "javascript" >

     $(function() {

         lyhganttuinit( 'lyh-ganttu' ); //甘特图初始化

     })

     var lyhganttudata=[[${lyhganttudata}]];

    

 

     /**

      * 甘特图设置,变量名固定

      */

     var lyhganttuconfig = {

         start : '1900/01/01' , //初始化开始时间配置    - 别在意

         end : '1900/01/10' , //初始化结束时间配置    - 别在意

         planborder : '#1a8cff' , //计划进度的border颜色

         planbackground : '#80bfff' , //计划进度的back颜色

         border : '#ffaa00' , //实际进度的border染颜色

         background : '#ffcc66' , //实际进度的back颜色

         linecolor : 'green' , //前置任务线颜色

         //表格中的thead的题头设置,可按照格式任意添加或减少

         labels : {

             'projectname' : {

                 'name' : '         任务名         ' ,

                 'show' : true ,

             }, //任务名

             'projectcode' : {

                 'name' : '编号' ,

                 'show' : true ,

             }, //编号

             'planstartat' : {

                 'name' : '计划开始' ,

                 'show' : true ,

             }, //计划开始时间

             'planendat' : {

                 'name' : '计划结束' ,

                 'show' : false ,

             }, //计划结束时间

             'startat' : {

                 'name' : '实际开始' ,

                 'show' : false ,

             }, //实际开始时间

             'endat' : {

                 'name' : '实际结束' ,

                 'show' : false ,

             }, //实际结束时间

             'persent' : {

                 'name' : '完成比例' ,

                 'show' : true ,

             }, //完工百分比

             'dur' : {

                 'name' : '时长' ,

                 'show' : true ,

             }, //持续时间

             'resps' : {

                 'name' : '负责人' ,

                 'show' : true ,

             }, //负责人

             'actors' : {

                 'name' : '参与人' ,

                 'show' : true ,

             }, //参与人

             'insiders' : {

                 'name' : '知情人' ,

                 'show' : false ,

             }, //知情人

             'before' : {

                 'name' : '前置任务' ,

                 'show' : false ,

             }, //前置任务

             'operate' : {

                 'name' : "<button java" id="highlighter_469129">

?

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

@requestmapping (value = "/gantee" ,method = requestmethod.get)

     public string gantee(model model) throws jsonexception {

         renwu renwu = renwuservice.querybyid( new integer( "1" ));

         map jsondata = new hashmap();

         list<map> jsonarray = new arraylist<>();

         map jsonobject = new hashmap();

         integer id = renwu.getprojectid();

         integer  pid = renwu.getpid();

         string projectname = renwu.getprojectname();

         string projectcode = renwu.getprojectcode();

         simpledateformat dateformat = new simpledateformat( "yyyy/mm/dd" );

         date planstartdate = renwu.getplanstartat();

         date planenddate = renwu.getplanendat();

         date startdate = renwu.getstartat();

         date enddate = renwu.getendat();

         string planstartstr = dateformat.format(planstartdate);

         string planendstr = dateformat.format(planenddate);

         string startstr = dateformat.format(startdate);

         string endstr = dateformat.format(enddate);

         string persent = renwu.getpersent();

         string resps = renwu.getresps();

         string actors = renwu.getactors();

         string insiders = renwu.getinsiders();

         integer dur = renwu.getdur();

         integer before = renwu.getbefore();

         jsonobject.put( "id" ,id);

         jsonobject.put( "pid" ,pid);

         jsonobject.put( "projectname" ,projectname);

         jsonobject.put( "projectcode" ,projectcode);

         jsonobject.put( "planstartat" ,planstartstr);

         jsonobject.put( "planendat" ,planendstr);

         jsonobject.put( "startat" ,startstr);

         jsonobject.put( "endat" ,endstr);

         jsonobject.put( "persent" ,persent);

         jsonobject.put( "resps" ,resps);

         jsonobject.put( "actors" ,actors);

         jsonobject.put( "insiders" ,insiders);

         jsonobject.put( "dur" ,dur);

         jsonobject.put( "before" , new object[]{before});

         jsonarray.add(jsonobject);

         jsondata.put( "data" ,jsonarray);

         model.addattribute( "lyhganttudata" ,jsondata);

         return "ganttu" ;

     }

(5)直接启动springboot项目即可。

这个是springboot项目,自然也是可以转到springcloud的子项目中。

  注意:html并不是我原创没我只是在其基础上改了一下js。在这个开放的时代,我觉得大家应该把学到的东西开放出来,不管多好或是很差。

到此这篇关于springboot+thymeleaf+mybatis实现甘特图的详细过程的文章就介绍到这了,更多相关springboot+thymeleaf+mybatis实现甘特图内容请搜索以前的文章或继续浏览下面的相关文章希望大家以后多多支持!

原文链接:https://HdhCmsTestcnblogs测试数据/leleChang/p/12884498.html

查看更多关于springboot+thymeleaf+mybatis实现甘特图的详细过程的详细内容...

  阅读:28次