This commit is contained in:
zzs 2025-02-19 11:20:31 +08:00
commit 790fc1b217
9 changed files with 494 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
*.zip

273
css/allWebPlugin.LeftUI.css Normal file
View File

@ -0,0 +1,273 @@
html { height: 100%;margin:0px;padding:0px}
body {height:99.5%;margin:0px;padding:0px}
table{height: 100%;width: 100%;}
body,td,th,input,option {font-family: ;}
a:link
{
COLOR: #62196A;
CURSOR: hand;
FONT-FAMILY: "微软雅黑";
FONT-SIZE: 11pt;
TEXT-DECORATION: none;
font-weight: normal;
}
A:visited
{
COLOR: #62196A;
CURSOR: hand;
FONT-FAMILY: "微软雅黑";
FONT-SIZE: 11pt;
TEXT-DECORATION: none;
font-weight: normal;
}
A:hover
{
COLOR: #ff8000;
CURSOR: hand;
FONT-FAMILY: "微软雅黑";
// FONT-SIZE: 11pt;
TEXT-DECORATION: none;
font-weight: normal;
}
#header{
border:none;
background-image: url("bg.jpg");
font-size: 20px;
font-weight: 800;
color: #191970;
}
#header td:first-child{
padding-left: 35px;
border-right: 1px solid #D6D6D6;
width:180px;
}
#header span:first-child{
font-size: 28px;
}
.title{
background-color: #5b916a;
color: #FFFFFF;
font-size: 15px;
}
.title span{
padding-left: 35px;
}
.title div{
float: right;
margin-right: 40px;
}
.title a:link{
COLOR: #FFFFFF;
TEXT-DECORATION: none;
}
.title A:hover{
COLOR:#FF8000;
}
.title A:visited
{
COLOR:#FFFFFF;
CURSOR: hand;
FONT-FAMILY: "宋体";
FONT-SIZE: 11pt;
TEXT-DECORATION: none;
}
.footer{
height: 30px;
background-image: url("bg.jpg");
FONT-FAMILY:'微软雅黑';
font-size:12px;
color:#191970;
padding-right:20px;
}
#showtable td{
border: 1px solid #C3ADC3;
}
#innerTable td{
padding-left:20px;
color: #876D84;
font-size: 15px;
border: 0px solid #000000;
}
.mhead{
height: 61px;
background-image: url('../css/bg.jpg');
}
.InputLine
{
BORDER-BOTTOM: #c0c0c0 1px solid;
BORDER-LEFT: #000000 0px solid;
BORDER-RIGHT: #000000 0px solid;
BORDER-TOP: #000000 0px solid;
FONT-SIZE: 11pt;
color:#876D84;
width:250px;
text-align:center;
}
.InputLine2
{
BORDER-BOTTOM: #FFFFFF 1px solid;
BORDER-LEFT: #000000 0px solid;
BORDER-RIGHT: #000000 0px solid;
BORDER-TOP: #000000 0px solid;
background-color:#5E3B59;
FONT-SIZE: 11pt;
color:#FFFFFF;
width:250px;
text-align:center;
}
#titleTable{
width:98%;
}
#titleTable td{
BACKGROUND-COLOR: #9B81A8;
BORDER-BOTTOM: #5B1D82 1px solid;
BORDER-LEFT: #000000 0px solid;
BORDER-RIGHT: #000000 0px solid;
BORDER-TOP: #5B1D82 1px solid;
FONT-FAMILY: "微软雅黑";
FONT-SIZE: 11pt;
text-align:center;
TEXT-DECORATION: none;
}
#showlist{
width:98%;
overflow-y:auto;
height: 0px;
overflow-x:hidden;
text-align: center;
}
#showlist2{
overflow-y:hidden;
height: 0px;
overflow-x:hidden;
text-align: center;
}
#showlist td{
BORDER-BOTTOM: #5B1D82 1px dashed;
BORDER-LEFT: #000000 0px solid;
BORDER-RIGHT: #000000 0px solid;
BORDER-TOP: #000000 0px solid;
FONT-FAMILY: "微软雅黑";
FONT-SIZE: 11pt;
color:#000000;
TEXT-DECORATION: none;
height:38px;
text-align: center;
}
#showlist a{
FONT-FAMILY: "微软雅黑";
}
.TD0
{
BACKGROUND-COLOR: #F7F7F7;
}
.TD1
{
BACKGROUND-COLOR: #ffffff;
}
#activeBox{
border: 1px solid #C3ADC3;
}
#activeTable{
height: 99%;
color: #654461;
font-size: 13px;
}
.statue{
TEXT-DECORATION:none;
padding-left: 10px;
}
.time{
TEXT-DECORATION: none;
border-right: 2px dotted #E5E5E5;
padding-right: 20px;
}
.tableFather{
background-color: #E6DBEC;
height: 30px;
border: 1px solid #D1C2D6;
}
#functionTable{
FONT-FAMILY: "微软雅黑";
font-size:11pt;
color:#62196A;
cursor:pointer;
text-align:center;
}
.dot-size{
border-bottom: 1px solid #D1C2D6;
text-align:left;
padding-left:40px;
background-color: #FFFFFF;
height: 30px;
}
.titleStyle{
border-bottom:1px solid #D1C2D6;
}
.hideDiv{
width:100%;
overflow-y:auto;
height: 200px;
overflow-x:hidden;
display: none;
}
#loaded{
margin: 16px;
border: 1px solid #C3ADC3;
}
.TableTextStyle
{
BORDER-BOTTOM: #15A4FA 0px solid;
BORDER-LEFT: #000000 0px solid;
BORDER-RIGHT: #000000 0px solid;
BORDER-TOP: #15A4FA 0px solid;
FONT-FAMILY: "微软雅黑";
FONT-SIZE: 11pt;
TEXT-DECORATION: none;
color:#666666;
}
#mfooter{
position: absolute;height:30px;left:0;bottom:0;width: 100%;background-color: #726078;
}

10
css/style.css Normal file
View File

@ -0,0 +1,10 @@
.violet-some-btn {
background-color: #4caf50; /* Green */
border: none;
color: white;
padding: 15px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
}

7
html/violet-test.html Normal file
View File

@ -0,0 +1,7 @@
<button id="violet-pra-btn" class="violet-pra-btn" >cus event</button>
<button id="violet-close-btn" class="violet-close-btn" >close</button>
<canvas id="allWebOfficeAx" style="width:100%;height:90vh">
<p class="error">Sorry, It looks as though your browser does not support the canvas tag.</p>
</canvas>

148
index.js Normal file
View File

@ -0,0 +1,148 @@
/**
* 自定义控件书写模板
*/
(function (KDApi, $) {
// 构造函数变量名随意与最后一句代码的KDApi.register的第二个参数一致即可
function HelloWorld(model) {
this._setModel(model)
}
// 原型中封装生命周期函数,固定格式
HelloWorld.prototype = {
_setModel: function (model) {
this.model = model
},
init: function (props) {
initFunc(this.model, props)
},
update: function (props) {
updateFunc(this.model, props)
},
destoryed: function () {
close()
}
}
var initFunc = function (model, props) {
console.warn(props)
console.warn('init')
// KDApi.loadFile可以通过路径加载js或css文件并且在html文件头生成script或者link标签第一个参数是路径第二个参数是model第三个参数是加载完成后执行的回调函数
KDApi.loadFile('./css/style.css', model, function () {
// 通过路径去获取html字符串第一个参数是路径第二个参数是model第三个参数是HTML模板中变量的值
KDApi.getTemplateStringByFilePath('./html/violet-test.html', model, {
//text: ''
}).then(function (result) {
model.dom.innerHTML = result
})
})
KDApi.loadFile('./js/allWebPlugin.Common.v2.0.0.30.js', model, function () {
// 通过路径去获取html字符串第一个参数是路径第二个参数是model第三个参数是HTML模板中变量的值
KDApi.getTemplateStringByFilePath('./html/violet-test.html', model, {
//text: ''
}).then(function (result) {
model.dom.innerHTML = result
KDApi.loadFile('./js/allWebPlugin.UI.v2.0.0.30.js', model, function () {
// 通过路径去获取html字符串第一个参数是路径第二个参数是model第三个参数是HTML模板中变量的值
KDApi.getTemplateStringByFilePath('./html/violet-test.html', model, {
//text: ''
}).then(function (result) {
model.dom.innerHTML = result
KDApi.loadFile('./js/allWebPlugin.Main.v2.0.0.30.js', model, function () {
// 通过路径去获取html字符串第一个参数是路径第二个参数是model第三个参数是HTML模板中变量的值
KDApi.getTemplateStringByFilePath('./html/violet-test.html', model, {
//text: ''
}).then(function (result) {
model.dom.innerHTML = result
initOffice()
openFile(model, props)
initEvent(model, props)
})
})
})
})
})
})
}
var initEvent = function (model, props) {
const ele = document.getElementById('violet-pra-btn')
ele.onclick = function () {
model.invoke('click', 0)
}
const closeEle = document.getElementById('violet-close-btn')
closeEle.onclick = function () {
close()
model.invoke('click', 2)
}
}
var updateFunc = function (model, props) {
textFromProps = props.data.textKey001 + ''
const ele = document.getElementById('violet-pra-btn')
ele.innerText = textFromProps
}
var initOffice = function (model, props) {
var installPackageUrl = "http://127.0.0.1:6651/install/allwebPlugin_x86_v2.0.1.16_20240806.exe";
var installPackageVersion = "2.0.0.30";
console.warn('initOffice')
console.warn(awp_IsInstall(installPackageVersion, installPackageUrl))
if (awp_IsInstall(installPackageVersion, installPackageUrl)) {
awp_CreatePlugin("allWebOfficeAx", "{6888ECA8-57D0-6E0E-9B9B-F1FF9B2DBD86}");
allWebOfficeAx.GetDisplayStyle().ShowOpenProgress = true;
}
}
var openFile = function (model, props) {
var pluginUtilityObj = awp_getPluginUtility();
var httpclientObj = awp_getHttpClient();
httpclientObj.Clear();
//https://www.gov.cn/gzdt/att/att/site1/20100917/0019b90463ff0dfd641102.pdf
//https://local.zsignyun.com:6652/test2.docx
console.warn(props)
var url = "https://srm-dev.cmoc.cloud:8022/ierp/attachment/download.do?path=/1d969f1a75006800&kd_cs_ticket=KKFDWRkv8aTFjgbz574ddO5Jj0gudMX3&access_token=2117884374501299200_v7LFmgmezCNo6qxtuNS2xYPo7W1fquIeRE7ODdVLkez3YFMfplpgNEdBxjW6MOIwKLXxocwBt7GNH2qlsDPt4STblUEpoavI6A9E09";
if (props?.data?.fileurl) {
url = props.data.fileurl
}
if (httpclientObj.Open(0, url, false)) {
httpclientObj.Send().then(function (data) {
if (httpclientObj.GetStatus() == 200) {
var varTempPath = pluginUtilityObj.GetTempPath();
var varFile = pluginUtilityObj.GetTempFileName(varTempPath, "zso") + ".docx";
httpclientObj.ResponseSaveToFile(varFile);
allWebOfficeAx.Open(varFile);
allWebOfficeAx.DeleteAfterClose = true;
}
else {
var httpStatus = httpclientObj.GetStatus();
if (httpclientObj.GetStatus() == 0) {
alert("LoadFile test2.docx Error:" + httpclientObj.GetErrorText());
} else {
alert("LoadFile test2.docx Status:" + httpStatus + ",请确保安装目录下web/doc目录存在test2.docx");
}
}
httpclientObj.Close();
});
}
}
var close = function () {
allWebOfficeAx.Close_Asyn(0).then(function (data) {
});
}
// 你只需知道第一个参数是你接下来要新增控件方案时填的方案id第二个参数是上面声明的构造函数
KDApi.register('violet-test', HelloWorld)
})(window.KDApi, jQuery) // 这里的jQuery不是必须要传进去的可移除要用到的时候才传PC端系统默认会有jQuery对象版本是1.12.4

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,51 @@
$(
function(){
/**公共方法**/
var nClick = 1;//鼠标点击次数
var ToolBarId;
var MenuId;
//下拉
var isNotLoad = true;
$(".tableAll").click(function(){
if(isNotLoad){
isNotLoad = false;
var noneY = $(this).next().css("display");
$(".tableAll").next().css("display","none");
$(".tableAll").find('td:eq(0)').css({'background-color':'#E6DBEC'});
$(".tableAll").find('span:eq(0)').html('+');
if( noneY== 'none'){
var s = $(this).find('td:eq(0)').html();
$(this).find('td:eq(0)').html(s.replace("+", "-")) ;
$(this).find('td:eq(0)').css({'background-color':'#FFFFFF'});
$(this).next().slideToggle(function(){isNotLoad = true;});
}else{
isNotLoad = true;
}
}
if(g_allWebPlugin.ActivateContainer)
{
g_allWebPlugin.ActivateContainer.UI.onUpdatePosition(1);
}
});
//下拉
var hide = false;
$("#disPlayNone").click(function(){
if(hide){
$('#showTD').width('204px');
$(this).siblings().css("display", "")
hide = false;
}else{
$('#showTD').width('25px');
$(this).siblings().css("display", "none")
hide = true;
}
if(g_allWebPlugin.ActivateContainer)
{
g_allWebPlugin.ActivateContainer.UI.onUpdatePosition(1);
}
});
})