uranum/yii2-excel-exchange 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

uranum/yii2-excel-exchange

Composer 安装命令:

composer require uranum/yii2-excel-exchange

包简介

Yii2 extension for exchanging a data from DB to excel and back again for Yii2 Framework.

README 文档

README

After installing this package you will be able to export data from DB to an excel2007 file and upload the data back again. The package is a module that you need to register in the config file in the module section. The module has a widget that you can use with different AR models in the usual way (for widgets). In the widget's config you need to specify the model name you want to import/export. Other optional properties are listed below.

If the exporting model has a related table the file will have an additional sheet for every table even the ones which don’t have a model. The data in these additional sheets helps to handle related columns. This sheets will be ignored in importing.

Required fields are highlighted in the excel file.

Note! One file is used for all models! The new exporting will overwrite existing file.

Required fields

There is a feature to backup the table before importing.

Export

Export

Import

Import

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist uranum/yii2-excel-exchange

or add

"uranum/yii2-excel-exchange": "*"

to the require section of your composer.json file.

###In config, modules section

	'modules' => [
//      ...
		'excel' => [
			'class'  => 'uranum\excel\Module',
			'params' => [
				'uploadPath' => 'uploads', // the path relative to the root
				'fileName'   => 'export',
				'extensions' => 'xls, xlsx',
			],
		],
	],

How to use

###In view (for example, index.php)

use uranum\excel\ExcelExchanger;

//...

echo ExcelExchanger::widget([
	'mainModelName' => $searchModel::className(), // here place model class name
 ]);

Widget's properties

string $mainModelName - the name of the model for export/import. It's mandatory property.

string $fileNameFrom - path to a file for export/import. Default is 'uploads/export.xlsx'. The folder must be exist!

string $notNullColumnColor - a value of the color for required columns. Default is 'FFDECC'

string $nameOfReserveTable - prefix for the copied table. Default is 'archive_'

string $backupUrl - url for backup action. Default is 'excel/default/backup'. You can create your own controller with it's actions and change the urls here.

string $uploadUrl - url for upload action. Default is 'excel/default/upload'

string $importUrl - url for import action. Default is 'excel/default/import'

string $exportUrl - url for export action. Default is 'excel/default/export'

integer $columnWidthOfStringType - a value of the column's width that has string type. Default is 35

integer $columnWidthOfTextType - a value of the column's width that has text type. Default is 50

integer $columnWidthDefault - a value of the other column's width. Default is 15

string $modalId - a value of the Modal id. Default is 'excelImportModal'

string $fileInputId - a value of the fileInput field id. Default is 'uploadFile'

string $exportBtnClass is the part of css bootstrap class. Default is 'ExcelExchanger::COLOR_SUCCESS'

string $uploadBtnClass is the part of css bootstrap class. Default is 'ExcelExchanger::COLOR_SUCCESS'

string $uploadDataBtnClass is the part of css bootstrap class. Default is 'ExcelExchanger::COLOR_SUCCESS'

string $importPopupBtnClass is the part of css bootstrap class. Default is 'ExcelExchanger::COLOR_DANGER'

string $panelColorClass is the part of css bootstrap class. Default is 'ExcelExchanger::COLOR_DEFAULT'

string $fileInputColorClass is the part of css bootstrap class. Default is 'ExcelExchanger::COLOR_WARNING'

uranum/yii2-excel-exchange 适用场景与选型建议

uranum/yii2-excel-exchange 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.86k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2016 年 09 月 19 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「yii2」 「yii 2」 「yii excel」 「exchange data」 「export excel」 「import excel」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 uranum/yii2-excel-exchange 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 uranum/yii2-excel-exchange 我们能提供哪些服务?
定制开发 / 二次开发

基于 uranum/yii2-excel-exchange 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 1.86k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 23
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-09-19