{
	"client": "pc",
	"positionType": "absolute",
	"bgColorMode": "light",
	"components": [
		{
			"components": [
				{
					"buttonType": "default",
					"id": "button_cancel",
					"onClick": "onClose()",
					"styles": {
						"cursor": "pointer",
						"float": "right",
						"margin-right": "20px",
						"margin-top": "10px",
						"text-align": "center"
					},
					"theme": "rect",
					"type": "Button",
					"value": "关闭"
				},
				{
					"buttonType": "primary",
					"id": "button_submit",
					"onClick": "importData()",
					"styles": {
						"cursor": "pointer",
						"float": "right",
						"margin-right": "10",
						"margin-top": "10px",
						"text-align": "center"
					},
					"theme": "rect",
					"type": "Button",
					"value": "导入"
				}
			],
			"id": "panel_bottom",
			"styles": {
				"bottom": "0",
				"height": "50px",
				"left": "0",
				"overflow": "auto",
				"position": "absolute",
				"right": "0"
			},
			"type": "Panel"
		},
		{
			"fileType": ".xlsx",
			"id": "fileupload1",
			"size": "1",
			"styles": {
				"left": "20px",
				"overflow": "auto",
				"position": "absolute",
				"top": "15px",
				"z-index": 1
			},
			"type": "FileUpload",
			"allowUpload": true
		},
		{
			"id": "labelHint",
			"styles": {
				"display": "none",
				"left": "25px",
				"line-height": "30px",
				"overflow": "hidden",
				"position": "absolute",
				"text-overflow": "ellipsis",
				"top": "93px",
				"white-space": "nowrap",
				"width": "430px",
				"z-index": 3
			},
			"type": "Label",
			"value": "正在导入，请稍候..."
		},
		{
			"components": [
				{
					"components": [],
					"id": "panelProgressBar",
					"styles": {
						"background-color": "#00CCFF",
						"height": "10px",
						"left": "0",
						"position": "absolute",
						"top": "0",
						"width": "0px",
						"z-index": 1
					},
					"type": "Panel"
				}
			],
			"id": "panelProgress",
			"styles": {
				"border-color": "#999999",
				"border-style": "solid",
				"border-width": "1",
				"display": "none",
				"height": "10px",
				"left": "25px",
				"position": "absolute",
				"top": "130px",
				"width": "200px",
				"z-index": 4
			},
			"type": "Panel"
		},
		{
			"id": "label2",
			"styles": {
				"display": "none",
				"left": "25px",
				"line-height": "30px",
				"position": "absolute",
				"top": "150px",
				"z-index": 5
			},
			"type": "Label",
			"value": "记录总数："
		},
		{
			"id": "labelTotal",
			"styles": {
				"color": "#0099FF",
				"display": "none",
				"left": "156px",
				"line-height": "30px",
				"position": "absolute",
				"text-align": "right",
				"top": "151px",
				"width": "70px",
				"z-index": 6
			},
			"type": "Label",
			"value": "0"
		},
		{
			"id": "label3",
			"styles": {
				"display": "none",
				"left": "25px",
				"line-height": "30px",
				"position": "absolute",
				"top": "180px",
				"z-index": 7
			},
			"type": "Label",
			"value": "已处理记录数："
		},
		{
			"id": "labelFinish",
			"styles": {
				"color": "#33CC00",
				"display": "none",
				"left": "156px",
				"line-height": "30px",
				"position": "absolute",
				"text-align": "right",
				"top": "180px",
				"width": "70px",
				"z-index": 8
			},
			"type": "Label",
			"value": "0"
		},
		{
			"id": "label9",
			"styles": {
				"color": "#FF0000",
				"left": "154px",
				"line-height": "30px",
				"position": "absolute",
				"top": "21px",
				"z-index": 13
			},
			"type": "Label",
			"value": "Excel文件的格式必须为“.xlsx”。"
		},
		{
			"type": "Service",
			"id": "serviceImport",
			"autoShowError": true
		},
		{
			"type": "Service",
			"id": "serviceGetStatus",
			"autoShowError": true,
			"path": "sys/service/bg_service/getTmpBGServiceStatus.js"
		}
	],
	"framework": "tfp",
	"height": "320px",
	"id": "divTFPPage",
	"jsFuncs": [
		{
			"args": [],
			"code": "  if(!importService || importService==\"\") {\n    tfp.showMsg(\"请提供导入服务路径！\");\n    return;\n  }\n  if(isImport) {\n    tfp.showMsg(\"正在导入，请稍候！\");\n    return;\n  }\n  var files = fileupload1.files;\n  if(!files || files.length==0) {\n    tfp.showMsg(\"请选择要导入的文件！\");\n    return;\n  }\n  button_submit.hide();\n  isImport = true;\n  serviceImport.path = importService;\n  serviceImport.request({fileCode: files[0].code}, function(req, res) {\n    if(res.code!=0) {\n      tfp.showMsg(res.message);\n      return;\n    }\n    labelHint.show();\n    panelProgress.show();\n    label2.show();\n    labelTotal.show();\n    label3.show();\n    labelFinish.show();\n    getImportStatus(res.serviceId);\n  });\n",
			"comment": "",
			"editType": "code",
			"name": "importData"
		},
		{
			"args": [
				{
					"name": "serviceId",
					"required": false,
					"type": "string"
				}
			],
			"code": "  setTimeout(function() {\n    serviceGetStatus.request({serviceId: serviceId}, function(req, res) {\n      if(res.code!=0) {\n        tfp.showMsg(res.message);\n        return;\n      }\n      if(!res.serviceInfo) {\n        labelHint.value = \"查询导入服务信息失败！\";\n        return;\n      }\n      labelTotal.value = res.serviceInfo.total;\n      labelFinish.value = res.serviceInfo.finish;\n      let progress = Math.ceil(res.serviceInfo.finish*100/res.serviceInfo.total);\n      panelProgressBar.css(\"width\", progress*2+\"px\");\n      if(res.serviceInfo.status==0 && res.serviceInfo.finish!=res.serviceInfo.total) {\n        getImportStatus(serviceId);\n      } else if(res.serviceInfo.status==1 || res.serviceInfo.finish==res.serviceInfo.total) {\n        isImport = false;\n        importOK = true;\n        labelHint.value = \"导入完毕。\";\n      } else if(res.serviceInfo.status==-1) {\n        isImport = false;\n        labelHint.value = \"导入时发生错误：\"+res.serviceInfo.error.message;\n      }\n    });\n  }, 1000);\n",
			"comment": "",
			"editType": "code",
			"name": "getImportStatus"
		},
		{
			"args": [],
			"code": "  importService = tfp.getUrlArg(\"servicePath\");\n  if(!importService || importService==\"\") {\n    tfp.showMsg(\"请提供导入服务路径！\");\n    return;\n  }\n",
			"comment": "",
			"editType": "code",
			"name": "initPage"
		},
		{
			"args": [],
			"code": "  var dialog = tfp.getCurDialog();\t\t\n  let cbFunc = tfp.getUrlArg(\"cb\");\n  if(cbFunc) {\n    eval(\"dialog.opener.\"+cbFunc+\"(\"+importOK+\")\");\n  }\n  tfp.closeCurDialog();\n",
			"comment": "",
			"editType": "code",
			"name": "onClose"
		}
	],
	"jsGlobalVars": [
		{
			"name": "isImport",
			"type": "bool",
			"value": "false"
		},
		{
			"name": "importService",
			"type": "string",
			"value": ""
		},
		{
			"name": "importOK",
			"type": "bool",
			"value": "false"
		}
	],
	"onLoad": "initPage()",
	"pageType": "dialog",
	"styleSheets": [
		{
			"id": ".textRight",
			"styles": [
				{
					"name": "text-align",
					"value": "right"
				}
			]
		}
	],
	"title": "导入Excel数据",
	"type": "Page",
	"width": "480px",
	"styles": {
		"background-color": "#FFFFFF"
	}
}