# app_script_history

id: 609d45045db2b0a331d6bda8
scriptid: 609d3f3f5db2b0a331d6bced
tablename: app_script
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.13 23:27:55.000
script:
function main(arg)
{

    println(  JSON.parse(art).message);
    
    var userid= currentUserId();
    println(userid);
    return 1;
}


id: 609d4cb95db2b0a331d6bf6f
scriptid: 609d4b105db2b0a331d6bf04
tablename: app_script
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.13 23:58:50.000
script:
function main(arg)
{
    var ds=newDataStor("", "select * from dzpz_imgpool ");
    ds.setUpdateProperty("dzpz_imgpool","id","*","id");
    ds.retrieve(" userid='"+currentUserId()+"'");
    if( ds.getRowCount()==1) return ds.getString(0,"id");
    ds.insertRow(0);
    var newid= newGUID();
    ds.setValue(0,"id",newid);
    ds.setValue(0,"gguid",newid);
    ds.setValue(0,"billno",newid);
    ds.setValue(0,"billdate",newDate());
    ds.setValue(0,"billtype",'');
    ds.setValue(0,"userid", currentUserId());
    ds.setValue(0,"username",currentUserShowName());
    ds.setValue(0,"deleteflag",0);
    ds.setValue(0,"id",newid);
    ds.setValue(0,"id",newid);
    ds.setValue(0,"id",newid);
    if( ds.update(true)) return newid;
    println( ds.getError().getMessage());
    return "error";
    


}


id: 609d4cb95db2b0a331d6bf79
scriptid: 609d4b105db2b0a331d6bf04
tablename: app_script
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.13 23:59:28.000
script:
//为每个操作员创建一个待归档图片单据 ， 所有单据都先上传到这个单据中做附件
function main(arg)
{
    var ds=newDataStor("", "select * from dzpz_imgpool ");
    ds.setUpdateProperty("dzpz_imgpool","id","*","id");
    ds.retrieve(" userid='"+currentUserId()+"'");
    if( ds.getRowCount()==1) return ds.getString(0,"id");
    ds.insertRow(0);
    var newid= newGUID();
    ds.setValue(0,"id",newid);
    ds.setValue(0,"gguid",newid);
    ds.setValue(0,"billno",newid);
    ds.setValue(0,"billdate",newDate());
    ds.setValue(0,"billtype",'');
    ds.setValue(0,"userid", currentUserId());
    ds.setValue(0,"username",currentUserShowName());
    ds.setValue(0,"deleteflag",0);
    ds.setValue(0,"id",newid);
    ds.setValue(0,"id",newid);
    ds.setValue(0,"id",newid);
    if( ds.update(true)) return newid;
    println( ds.getError().getMessage());
    return "error";
    


}


id: 609dd2d85db2b0a331d6c034
scriptid: 609d4b105db2b0a331d6bf04
tablename: app_script
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.14 09:31:04.000
script:
//为每个操作员创建一个待归档图片单据 ， 所有单据都先上传到这个单据中做附件
function main(arg) {
    var gguid = '';
    var ds = newDataStor("", "select * from dzpz_imgpool ");
    ds.setUpdateProperty("dzpz_imgpool", "id", "*", "id");
    ds.retrieve(" userid='" + currentUserId() + "'");
    if (ds.getRowCount() == 1) {
        gguid = ds.getString(0, "gguid");
    } else {

        ds.insertRow(0);
        gguid = newGUID();
        ds.setValue(0, "id", gguid);
        ds.setValue(0, "gguid", gguid);
        ds.setValue(0, "billno", gguid);
        ds.setValue(0, "billdate", newDate());
        ds.setValue(0, "billtype", '');
        ds.setValue(0, "userid", currentUserId());
        ds.setValue(0, "username", currentUserShowName());
        ds.setValue(0, "deleteflag", 0);

        if (ds.update(true)) {
            error = ds.getError().getMessage();
            println(error);
            return { success: false, message: error };
        }
    }

    //提供图片上传的必要的参数
    var config = { "serverIndex": "1", 
                    "dbpool": "default", 
                    "logTable": "dzpz_imgpool_fileupload", 
                    "blockSize": 128, "imgMaxSize": 1920, 
                    "groupName": "附件",
                     "tableName": "dzpz_imgpool", 
                     "gguid": gguid, 
                     "path": "dzpz_imgpool", 
                     "maxThumbnailSize": 256 
             }

    println(JSON.stringify(config));
    return config; 


}


id: 609deddb5db2696039463c7f
scriptid: 609d4b105db2b0a331d6bf04
tablename: app_script
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.14 11:47:00.000
script:
//为每个操作员创建一个待归档图片单据 ， 所有单据都先上传到这个单据中做附件
function main(arg) {
    var gguid = '';
    var ds = newDataStor("", "select * from dzpz_imgpool ");
    ds.setUpdateProperty("dzpz_imgpool", "id", "*", "id");
    ds.retrieve(" userid='" + currentUserId() + "'");
    println( ds.getSelectLastRetrieved());
    if (ds.getRowCount() == 1) {
        gguid = ds.getString(0, "gguid");
    } else {

        ds.insertRow(0);
        gguid = newGUID();
        ds.setValue(0, "id", gguid);
        ds.setValue(0, "gguid", gguid);
        ds.setValue(0, "billno", gguid);
        ds.setValue(0, "billdate", newDate());
        ds.setValue(0, "billtype", '');
        ds.setValue(0, "userid", currentUserId());
        ds.setValue(0, "username", currentUserShowName());
        ds.setValue(0, "deleteflag", 0);

        if (ds.update(true)) {
            error = ds.getError().getMessage();
            println(error);
            return { success: false, message: error };
        }
    }

    //提供图片上传的必要的参数
    var config = { "serverIndex": "1", 
                    "dbpool": "default", 
                    "logTable": "dzpz_imgpool_fileupload", 
                    "blockSize": 128, "imgMaxSize": 1920, 
                    "groupName": "附件",
                     "tableName": "dzpz_imgpool", 
                     "gguid": gguid, 
                     "path": "dzpz_imgpool", 
                     "maxThumbnailSize": 256 
             }

    println(JSON.stringify(config));
    return config; 


}


id: 609deddb5db2696039463c93
scriptid: 609d4b105db2b0a331d6bf04
tablename: app_script
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.14 11:48:41.000
script:
//为每个操作员创建一个待归档图片单据 ， 所有单据都先上传到这个单据中做附件
function main(arg) {
    var gguid = '';
    var ds = newDataStore("", "select * from dzpz_imgpool ");
    ds.setUpdateProperty("dzpz_imgpool", "id", "*", "id");
    ds.retrieve(" userid='" + currentUserId() + "'");
    println( ds.getSelectLastRetrieved());
    if (ds.getRowCount() == 1) {
        gguid = ds.getString(0, "gguid");
    } else {

        ds.insertRow(0);
        gguid = newGUID();
        ds.setValue(0, "id", gguid);
        ds.setValue(0, "gguid", gguid);
        ds.setValue(0, "billno", gguid);
        ds.setValue(0, "billdate", newDate());
        ds.setValue(0, "billtype", '');
        ds.setValue(0, "userid", currentUserId());
        ds.setValue(0, "username", currentUserShowName());
        ds.setValue(0, "deleteflag", 0);

        if (ds.update(true)) {
            error = ds.getError().getMessage();
            println(error);
            return { success: false, message: error };
        }
    }

    //提供图片上传的必要的参数
    var config = { "serverIndex": "1", 
                    "dbpool": "default", 
                    "logTable": "dzpz_imgpool_fileupload", 
                    "blockSize": 128, "imgMaxSize": 1920, 
                    "groupName": "附件",
                     "tableName": "dzpz_imgpool", 
                     "gguid": gguid, 
                     "path": "dzpz_imgpool", 
                     "maxThumbnailSize": 256 
             }

    println(JSON.stringify(config));
    return config; 


}


id: 609deddb5db2696039463c9b
scriptid: 609d4b105db2b0a331d6bf04
tablename: app_script
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.14 13:09:41.000
script:
//为每个操作员创建一个待归档图片单据 ， 所有单据都先上传到这个单据中做附件
function main(arg) {
    var gguid = '';
    var ds = newDataStore("", "select * from dzpz_imgpool ");
    ds.setUpdateProperty("dzpz_imgpool", "id", "*", "id");
    ds.retrieve(" userid='" + currentUserId() + "'");
    println( ds.getSelectLastRetrieved());
    if (ds.getRowCount() == 1) {
        gguid = ds.getString(0, "gguid");
    } else {

        ds.insertRow(0);
        gguid = newGUID();
        ds.setValue(0, "id", gguid);
        ds.setValue(0, "gguid", gguid);
        ds.setValue(0, "billno", gguid);
        ds.setValue(0, "billdate", newDate());
        ds.setValue(0, "billtype", '');
        ds.setValue(0, "userid", currentUserId());
        ds.setValue(0, "username", currentUserShowName());
        ds.setValue(0, "deleteflag", 0);

        if (ds.update(true)) {
            error = ds.getError().getMessage();
            println(error);
            return { success: false, message: error };
        }
    }

    //提供图片上传的必要的参数
    var config = { "serverIndex": "1", 
                    "dbpool": "default", 
                    "logTable": "dzpz_imgpool_fileupload", 
                    "blockSize": 128, "imgMaxSize": 1920, 
                    "groupName": "附件",
                     "tableName": "dzpz_imgpool", 
                     "gguid": gguid, 
                     "path": "dzpz_imgpool", 
                     "maxThumbnailSize": 256 ,
                     "responseType":"JSON"  //表示上传成功捂返回 JSON格式的结果
             }

    println(JSON.stringify(config));
    return config; 


}


id: 609e79b45db2696039463d28
scriptid: 609deddb5db2696039463ca0
tablename: app_script
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.14 21:45:33.000
script:
function main(arg)
{
    var p=JSON.parse(arg);
    println("user:"+currentUserShowName()+" file: " + p.file+"  result:" + p.result );
}


id: 60a3505f5db27838e0c0155f
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.18 13:34:31.000
script:
function  getImagePoolGGUID()
{
    var ret= runTask("get_dzpz_imgpool_id_of_current_user");
    return ret.gguid; 
    
}


id: 60a3505f5db27838e0c01565
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.18 13:36:30.000
script:
function  getImagePoolGGUID()
{
    var ret= runTask("get_dzpz_imgpool_id_of_current_user",{});
    return ret.gguid; 
    
}


id: 60a3505f5db27838e0c0156b
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.18 13:37:39.000
script:
function  getImagePoolGGUID()
{
    var ret= runTask("get_dzpz_imgpool_id_of_current_user",{});
    return JSON.parse(ret).gguid; 
    
}


id: 60a3505f5db27838e0c0159e
scriptid: 60a321f05db27838e0c014bf
tablename: app_script
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.18 16:22:20.000
script:
function  getImagePoolGGUID()
{
    var ret= runTask("get_dzpz_imgpool_id_of_current_user",{});
    return JSON.parse(ret).gguid; 
    
}


function loadImagePoolData()
{
    var config= JSON.parse(runTask("get_dzpz_imgpool_id_of_current_user",{}));
    var 
    var ds=newDataStore( config.dbpool ,"select * from "+ config.logTable+"  where  gguid='"+config.gguid+"'  order by info1 ") ; // info1 是客户端文件创建的时间，以它排序
    var n=ds.retrieve();
    var ret=[];
    for( var i=0;i<n;i++)
    {
        ret.push(  JSON.parse( ds.getJSONRow(i,true)));
    }

    return ret; 

}


id: 60a37a225db27838e0c015c9
scriptid: 60a321f05db27838e0c014bf
tablename: app_script
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.18 16:27:20.000
script:
function  getImagePoolGGUID()
{
    var ret= runTask("get_dzpz_imgpool_id_of_current_user",{});
    return JSON.parse(ret).gguid; 
    
}




function loadImagePoolData()
{
    var config= JSON.parse(runTask("get_dzpz_imgpool_id_of_current_user",{}));
    var 
    var ds=newDataStore( config.dbpool ,"select * from "+ config.logTable+"  where  gguid='"+config.gguid+"'  order by info1 ") ; // info1 是客户端文件创建的时间，以它排序
    var n=ds.retrieve();
    var ret=[];
    for( var i=0;i<n;i++)
    {
        ret.push(  JSON.parse( ds.getJSONRow(i,true)));
    }

    return ret; 

}


id: 60a37a225db27838e0c015f1
scriptid: 60a321f05db27838e0c014bf
tablename: app_script
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.18 16:42:33.000
script:
//@comment (group=,caption=得到当前操作员待归档图片对应的GGUID,needRightControl=false)
function  getImagePoolGGUID()
{
    var ret= runTask("get_dzpz_imgpool_id_of_current_user",{});
    return JSON.parse(ret).gguid; 
    
}


//@comment (group=,caption=得到待归档的图片清单,needRightControl=true)
function loadImagePoolData()
{
    var config= JSON.parse(runTask("get_dzpz_imgpool_id_of_current_user",{}));
    var 
    var ds=newDataStore( config.dbpool ,"select * from "+ config.logTable+"  where  gguid='"+config.gguid+"'  order by info1 ") ; // info1 是客户端文件创建的时间，以它排序
    var n=ds.retrieve();
    var ret=[];
    for( var i=0;i<n;i++)
    {
        ret.push(  JSON.parse( ds.getJSONRow(i,true)));
    }

    return ret; 

}


id: 60a37a225db27838e0c015ff
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.18 23:18:27.000
script:
function formOpen()
{


 
  $('.gridly1').gridly({
    base: 60, // px 
    gutter: 20, // px
    columns: 12
  });
 


  //  let data= loadImagePoolData();
  //  console.dir(data);

}


id: 60a4de8b5db22f67e8f93e66
scriptid: 60a321f05db27838e0c014bf
tablename: app_script
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.19 22:40:47.000
script:
//@comment (group=,caption=得到当前操作员待归档图片对应的GGUID,needRightControl=false)
function  getImagePoolGGUID()
{
    var ret= runTask("get_dzpz_imgpool_id_of_current_user",{});
    return JSON.parse(ret).gguid; 
    
}




//@comment (group=,caption=得到待归档的图片清单,needRightControl=true)
function loadImagePoolData()
{
    var config= JSON.parse(runTask("get_dzpz_imgpool_id_of_current_user",{}));
    var 
    var ds=newDataStore( config.dbpool ,"select * from "+ config.logTable+"  where  gguid='"+config.gguid+"'  order by info1 ") ; // info1 是客户端文件创建的时间，以它排序
    var n=ds.retrieve();
    var ret=[];
    for( var i=0;i<n;i++)
    {
        ret.push(  JSON.parse( ds.getJSONRow(i,true)));
    }

    return ret; 

}


id: 60a4de8b5db22f67e8f93e6e
scriptid: 60a321f05db27838e0c014bf
tablename: app_script
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.19 22:43:04.000
script:
//@comment (group=,caption=得到当前操作员待归档图片对应的GGUID,needRightControl=false)
function  getImagePoolGGUID()
{
    var ret= runTask("get_dzpz_imgpool_id_of_current_user",{});
    return JSON.parse(ret).gguid; 
    
}




//@comment (group=,caption=得到待归档的图片清单,needRightControl=true)
function loadImagePoolData()
{
    var config= JSON.parse(runTask("get_dzpz_imgpool_id_of_current_user",{}));
    
    var ds=newDataStore( config.dbpool ,"select * from "+ config.logTable+"  where  gguid='"+config.gguid+"'  order by info1 ") ; // info1 是客户端文件创建的时间，以它排序
    var n=ds.retrieve();
    var ret=[];
    for( var i=0;i<n;i++)
    {
        ret.push(  JSON.parse( ds.getJSONRow(i,true)));
    }

    return ret; 

}


id: 60a4de8b5db22f67e8f93e76
scriptid: 60a321f05db27838e0c014bf
tablename: app_script
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.19 22:45:09.000
script:
//@comment (group=,caption=得到当前操作员待归档图片对应的GGUID,needRightControl=false)
function  getImagePoolGGUID()
{
    var ret= runTask("get_dzpz_imgpool_id_of_current_user",{});
    return JSON.parse(ret).gguid; 
    
}





//@comment (group=,caption=得到待归档的图片清单,needRightControl=true)
function loadImagePoolData()
{
    var config= JSON.parse(runTask("get_dzpz_imgpool_id_of_current_user",{}));
var     
    var ds=newDataStore( config.dbpool ,"select * from "+ config.logTable+"  where  gguid='"+config.gguid+"'  order by info1 ") ; // info1 是客户端文件创建的时间，以它排序
    var n=ds.retrieve();
    var ret=[];
    for( var i=0;i<n;i++)
    {
        ret.push(  JSON.parse( ds.getJSONRow(i,true)));
    }

    return ret; 

}


id: 60a528405db2f6898f0c9c7d
scriptid: 60a321f05db27838e0c014bf
tablename: app_script
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.19 23:11:12.000
script:
//@comment (group=,caption=得到当前操作员待归档图片对应的GGUID,needRightControl=false)
function  getImagePoolGGUID()
{
    var ret= runTask("get_dzpz_imgpool_id_of_current_user",{});
    return JSON.parse(ret).gguid; 
    
}





//@comment (group=,caption=得到待归档的图片清单,needRightControl=true)
function loadImagePoolData()
{
    var config= JSON.parse(runTask("get_dzpz_imgpool_id_of_current_user",{}));
     
    var ds=newDataStore( config.dbpool ,"select * from "+ config.logTable+"  where  gguid='"+config.gguid+"'  order by info1 ") ; // info1 是客户端文件创建的时间，以它排序
    var n=ds.retrieve();
    var ret=[];
    for( var i=0;i<n;i++)
    {
        ret.push(  JSON.parse( ds.getJSONRow(i,true)));
    }

    return ret; 

}


id: 60a67c6b5db22d6e34006eb9
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.20 23:26:35.000
script:
function formOpen()
{
    book.sheet1.getBrick('imgPool').selectionMode='multi'; //图片设置成多选模式
 


  //  let data= loadImagePoolData();
  //  console.dir(data);

}


id: 60a67c6b5db22d6e34006ec3
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.21 10:36:12.000
script:
function formOpen()
{
    book.sheet1.getBrick('imgPool').selectionMode='multi'; //图片设置成多选模式
 


  //  let data= loadImagePoolData();
  //  console.dir(data);

}


/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet , name, data ) {
    console.dir(data);
}


id: 60a67c6b5db22d6e34006ecc
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.21 10:43:15.000
script:
function formOpen()
{
    book.sheet1.getBrick('imgPool').selectionMode='multi'; //图片设置成多选模式
 


  //  let data= loadImagePoolData();
  //  console.dir(data);

}


/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet , name, data ) {
    //console.dir(data);
    var url= data.url_img; 
    book.sheet0.cells("imgPreview").setValue(url);
}


id: 60a67c6b5db22d6e34006ed5
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.21 11:01:14.000
script:
function formOpen()
{
    book.sheet1.getBrick('imgPool').selectionMode='multi'; //图片设置成多选模式
 


  //  let data= loadImagePoolData();
  //  console.dir(data);

}


/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet , name, data ) {
    //console.dir(data);
    var url= data.url_img; 
    book.sheet0.cells("imgPreview").setValue(url);
}
 

/**
 * 图片控件中某个图片被双击了
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片被双击)
function imageOnDBLClick(sheet , name, data ) {
    $prompt("请输入凭证号码：","", function(){
            
    });
}


id: 60a722b95db22d6e34006edb
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.21 11:02:18.000
script:
function formOpen()
{
    book.sheet1.getBrick('imgPool').selectionMode='multi'; //图片设置成多选模式
 


  //  let data= loadImagePoolData();
  //  console.dir(data);

}


/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet , name, data ) {
    //console.dir(data);
    var url= data.url_img; 
    book.sheet0.cells("imgPreview").setValue(url);
}
 

/**
 * 图片控件中某个图片被双击了
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片被双击)
function imageOnDBLClick(sheet , name, data ) {
    $prompt("标记为凭证","请输入凭证号码：","", function(){

    });
}


id: 60a722b95db22d6e34006ee1
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.21 11:02:47.000
script:
function formOpen()
{
    book.sheet1.getBrick('imgPool').selectionMode='multi'; //图片设置成多选模式
 


  //  let data= loadImagePoolData();
  //  console.dir(data);

}


/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet , name, data ) {
    //console.dir(data);
    var url= data.url_img; 
    book.sheet0.cells("imgPreview").setValue(url);
}
 

/**
 * 图片控件中某个图片被双击了
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片被双击)
function imageOnDBLClick(sheet , name, data ) {
    $prompt("标记为凭证","请输入凭证号码：","", function(val){
        alert( val);

    });
}


id: 60a722b95db22d6e34006ee7
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.21 11:04:56.000
script:
function formOpen()
{
    book.sheet1.getBrick('imgPool').selectionMode='multi'; //图片设置成多选模式
 


  //  let data= loadImagePoolData();
  //  console.dir(data);

}


/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet , name, data ) {
    //console.dir(data);
    var url= data.url_img; 
    book.sheet0.cells("imgPreview").setValue(url);
}
 

/**
 * 图片控件中某个图片被双击了
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片被双击)
function imageOnDBLClick(sheet , name, data ) {
    $prompt("标记为凭证","","","输入凭证号码", function(val){
        alert( val);

    });
}


id: 60a722b95db22d6e34006eed
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.21 11:13:28.000
script:
function formOpen()
{
    book.sheet1.getBrick('imgPool').selectionMode='multi'; //图片设置成多选模式
 


  //  let data= loadImagePoolData();
  //  console.dir(data);

}


/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet , name, data ) {
    //console.dir(data);
    var url= data.url_img; 
    book.sheet0.cells("imgPreview").setValue(url);
}
 

/**
 * 图片控件中某个图片被双击了
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片被双击)
function imageOnDBLClick(sheet , name, data ) {
    inputBox("标记为凭证","","","输入凭证号码", function(val){
        alert( val);

    });
}


id: 60a722b95db22d6e34006ef6
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.21 12:19:49.000
script:
function formOpen()
{
    book.sheet1.getBrick('imgPool').selectionMode='multi'; //图片设置成多选模式
 


  //  let data= loadImagePoolData();
  //  console.dir(data);

}


/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet , name, data ) {
    //console.dir(data);
    var url= data.url_img; 
    book.sheet0.cells("imgPreview").setValue(url);
}
function imageOnMouseOut(sheet , name, data ) {
    
    book.sheet0.cells("imgPreview").setValue("");
}
 

/**
 * 图片控件中某个图片被双击了
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片被双击)
function imageOnDBLClick(sheet , name, data ) {
    inputBox("标记为凭证","","","输入凭证号码", function(val){
        alert( val);

    } , true /*允许为空*/);
}


id: 60a722b95db22d6e34006f00
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.21 22:09:40.000
script:
function formOpen()
{
    book.sheet1.getBrick('imgPool').selectionMode='multi'; //图片设置成多选模式
 
 $(document.body).append(`<style
      .pzh {position:absolute;left:0;bottom:0px; height:24px; line-height:24px;width:100%; background-color:#40af40a0; color:white;font-weight:bold;font-size:16px;text-align:center;}
 </style>
 `);


  //  let data= loadImagePoolData();
  //  console.dir(data);

}


/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet , name, data ) {
    //console.dir(data);
    var url= data.url_img; 
    book.sheet0.cells("imgPreview").setValue(url);
}
function imageOnMouseOut(sheet , name, data ) {
    
    book.sheet0.cells("imgPreview").setValue("");
}
 

/**
 * 图片控件中某个图片被双击了
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片被双击)
function imageOnDBLClick(sheet , name, data ) {
    inputBox("标记为凭证","","","输入凭证号码", function(val){
        if( val=='')
        {
            var p= find_pzh(data.id , false );
            if( p)  p.remove();    
        }else{
            find_pzh(dta.id,true).text( val); 
        }

    } , true /*允许为空*/);
}


function find_pzh( id , create_if_not_exists)
{
    var d= $('#'+id);
    if( !d)
    {
        $.alert(id+"不存在");
        return null; 
    }  

    var ret= d.find('.pzh');
    if( ret==null)
    {
        if( create_if_not_exists)
        {
            d.append(`<div class="pzh" ></div>`);
        }
        ret=d.find('.pzh');
    }
    return ret; 

}


id: 60a722b95db22d6e34006f06
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.21 22:10:36.000
script:
function formOpen()
{
    book.sheet1.getBrick('imgPool').selectionMode='multi'; //图片设置成多选模式
 
 $(document.body).append(`<style
      .pzh {position:absolute;left:0;bottom:0px; height:24px; line-height:24px;width:100%; background-color:#40af40a0; color:white;font-weight:bold;font-size:16px;text-align:center;}
 </style>
 `);


  //  let data= loadImagePoolData();
  //  console.dir(data);

}


/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet , name, data ) {
    //console.dir(data);
    var url= data.url_img; 
    book.sheet0.cells("imgPreview").setValue(url);
}
function imageOnMouseOut(sheet , name, data ) {
    
    book.sheet0.cells("imgPreview").setValue("");
}
 

/**
 * 图片控件中某个图片被双击了
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片被双击)
function imageOnDBLClick(sheet , name, data ) {
    inputBox("标记为凭证","","","输入凭证号码", function(val){
        if( val=='')
        {
            var p= find_pzh(data.id , false );
            if( p)  p.remove();    
        }else{
            find_pzh(dta.id,true).text( val); 
        }

    } , true /*允许为空*/);
}


//@comment (group=,caption=查找或创建凭证号标记对象,needRightControl=false)
function find_pzh( id , create_if_not_exists)
{
    var d= $('#'+id);
    if( !d)
    {
        $.alert(id+"不存在");
        return null; 
    }  

    var ret= d.find('.pzh');
    if( ret==null)
    {
        if( create_if_not_exists) //如果需要创建，则创建它
        {
            d.append(`<div class="pzh" ></div>`);
        }
        ret=d.find('.pzh');
    }
    return ret; 

}


id: 60a722b95db22d6e34006f0c
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.21 22:11:15.000
script:
function formOpen()
{
    book.sheet1.getBrick('imgPool').selectionMode='multi'; //图片设置成多选模式
 
 $(document.body).append(`<style
      .pzh {position:absolute;left:0;bottom:0px; height:24px; line-height:24px;width:100%; background-color:#40af40a0; color:white;font-weight:bold;font-size:16px;text-align:center;}
 </style>
 `);


  //  let data= loadImagePoolData();
  //  console.dir(data);

}


/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet , name, data ) {
    //console.dir(data);
    var url= data.url_img; 
    book.sheet0.cells("imgPreview").setValue(url);
}
function imageOnMouseOut(sheet , name, data ) {
    
    book.sheet0.cells("imgPreview").setValue("");
}
 

/**
 * 图片控件中某个图片被双击了
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片被双击)
function imageOnDBLClick(sheet , name, data ) {
    inputBox("标记为凭证","","","输入凭证号码", function(val){
        if( val=='')
        {
            var p= find_pzh(data.id , false );
            if( p)  p.remove();    
        }else{
            find_pzh(data.id,true).text( val); 
        }

    } , true /*允许为空*/);
}


//@comment (group=,caption=查找或创建凭证号标记对象,needRightControl=false)
function find_pzh( id , create_if_not_exists)
{
    var d= $('#'+id);
    if( !d)
    {
        $.alert(id+"不存在");
        return null; 
    }  

    var ret= d.find('.pzh');
    if( ret==null)
    {
        if( create_if_not_exists) //如果需要创建，则创建它
        {
            d.append(`<div class="pzh" ></div>`);
        }
        ret=d.find('.pzh');
    }
    return ret; 

}


id: 60a722b95db22d6e34006f12
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.21 22:12:56.000
script:
function formOpen() {
    book.sheet1.getBrick('imgPool').selectionMode = 'multi'; //图片设置成多选模式

    $(document.body).append(`<style>
                        .pzh {position:absolute;left:0;bottom:0px; 
                                height:24px; line-height:24px;width:100%; 
                                background-color:#40af40a0; 
                                color:white;font-weight:bold;font-size:16px;text-align:center;}
                        </style>
 `);


    //  let data= loadImagePoolData();
    //  console.dir(data);

}


/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet, name, data) {
    //console.dir(data);
    var url = data.url_img;
    book.sheet0.cells("imgPreview").setValue(url);
}
function imageOnMouseOut(sheet, name, data) {

    book.sheet0.cells("imgPreview").setValue("");
}


/**
 * 图片控件中某个图片被双击了
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片被双击)
function imageOnDBLClick(sheet, name, data) {
    inputBox("标记为凭证", "", "", "输入凭证号码", function (val) {
        if (val == '') {
            var p = find_pzh(data.id, false);
            if (p) p.remove();
        } else {
            find_pzh(data.id, true).text(val);
        }

    }, true /*允许为空*/);
}


//@comment (group=,caption=查找或创建凭证号标记对象,needRightControl=false)
function find_pzh(id, create_if_not_exists) {
    var d = $('#' + id);
    if (!d) {
        $.alert(id + "不存在");
        return null;
    }

    var ret = d.find('.pzh');
    if (ret == null) {
        if (create_if_not_exists) //如果需要创建，则创建它
        {
            d.append(`<div class="pzh" ></div>`);
        }
        ret = d.find('.pzh');
    }
    return ret;

}


id: 60a722b95db22d6e34006f18
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.21 22:17:53.000
script:
function formOpen() {
    book.sheet1.getBrick('imgPool').selectionMode = 'multi'; //图片设置成多选模式

    $(document.body).append(`<style>
                        .pzh {position:absolute;left:0;bottom:0px; 
                                height:24px; line-height:24px;width:100%; 
                                background-color:#40af40a0; 
                                color:white;font-weight:bold;font-size:16px;text-align:center;}
                        </style>
 `);


    //  let data= loadImagePoolData();
    //  console.dir(data);

}


/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet, name, data) {
    //console.dir(data);
    var url = data.url_img;
    book.sheet0.cells("imgPreview").setValue(url);
}
function imageOnMouseOut(sheet, name, data) {

    book.sheet0.cells("imgPreview").setValue("");
}


/**
 * 图片控件中某个图片被双击了
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片被双击)
function imageOnDBLClick(sheet, name, data) {
    inputBox("标记为凭证", "", "", "输入凭证号码", function (val) {
        if (val == '') {
            var p = find_pzh(data.id, false);
            if (p) p.remove();
        } else {
            find_pzh(data.id, true).text(val);
        }

    }, true /*允许为空*/);
}


//@comment (group=,caption=查找或创建凭证号标记对象,needRightControl=false)
function find_pzh(id, create_if_not_exists) {
    var d = $('#' + id);
    if (!d) {
        $.alert(id + "不存在");
        return null;
    }

    var ret = d.find('.pzh');
    if (ret.length == 0) {
        if (create_if_not_exists) //如果需要创建，则创建它
        {
            d.append(`<div class="pzh" ></div>`);
        }
        ret = d.find('.pzh');
    }
    return ret;

}


id: 60a722b95db22d6e34006f1e
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.21 22:36:49.000
script:
function formOpen() {
    book.sheet1.getBrick('imgPool').selectionMode = 'multi'; //图片设置成多选模式

    $(document.body).append(`<style>
                        .pzh {position:absolute;left:0;bottom:0px; 
                                height:24px; line-height:24px;width:100%; 
                                background-color:#40af40a0; 
                                color:white;font-weight:bold;font-size:16px;text-align:center;}
                        </style>
 `);


    //  let data= loadImagePoolData();
    //  console.dir(data);

}


/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet, name, data) {
    //console.dir(data);
    var url = data.url_img;
    book.sheet0.cells("imgPreview").setValue(url);
}
function imageOnMouseOut(sheet, name, data) {

    book.sheet0.cells("imgPreview").setValue("");
}


/**
 * 图片控件中某个图片被双击了
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片被双击)
function imageOnDBLClick(sheet, name, data) {
    var pzh= find_pzh(data.id,false).val();

    inputBox("标记为凭证", "", pzh , "输入凭证号码", function (val) {
        if (val == '') {
            var p = find_pzh(data.id, false);
            if (p) p.remove();
        } else {
            find_pzh(data.id, true).text(val);
        }

    }, true /*允许为空*/);
}


//@comment (group=,caption=查找或创建凭证号标记对象,needRightControl=false)
function find_pzh(id, create_if_not_exists) {
    var d = $('#' + id);
    if (!d) {
        $.alert(id + "不存在");
        return null;
    }

    var ret = d.find('.pzh');
    if (ret.length == 0) {
        if (create_if_not_exists) //如果需要创建，则创建它
        {
            d.append(`<div class="pzh" ></div>`);
        }
        ret = d.find('.pzh');
    }
    return ret;

}


id: 60a722b95db22d6e34006f24
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.21 22:37:16.000
script:
function formOpen() {
    book.sheet1.getBrick('imgPool').selectionMode = 'multi'; //图片设置成多选模式

    $(document.body).append(`<style>
                        .pzh {position:absolute;left:0;bottom:0px; 
                                height:24px; line-height:24px;width:100%; 
                                background-color:#40af40a0; 
                                color:white;font-weight:bold;font-size:16px;text-align:center;}
                        </style>
 `);


    //  let data= loadImagePoolData();
    //  console.dir(data);

}


/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet, name, data) {
    //console.dir(data);
    var url = data.url_img;
    book.sheet0.cells("imgPreview").setValue(url);
}
function imageOnMouseOut(sheet, name, data) {

    book.sheet0.cells("imgPreview").setValue("");
}


/**
 * 图片控件中某个图片被双击了
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片被双击)
function imageOnDBLClick(sheet, name, data) {
    var pzh= find_pzh(data.id,false).val();
    if( pzh==undefined) pzh='';

    inputBox("标记为凭证", "", pzh , "输入凭证号码", function (val) {
        if (val == '') {
            var p = find_pzh(data.id, false);
            if (p) p.remove();
        } else {
            find_pzh(data.id, true).text(val);
        }

    }, true /*允许为空*/);
}


//@comment (group=,caption=查找或创建凭证号标记对象,needRightControl=false)
function find_pzh(id, create_if_not_exists) {
    var d = $('#' + id);
    if (!d) {
        $.alert(id + "不存在");
        return null;
    }

    var ret = d.find('.pzh');
    if (ret.length == 0) {
        if (create_if_not_exists) //如果需要创建，则创建它
        {
            d.append(`<div class="pzh" ></div>`);
        }
        ret = d.find('.pzh');
    }
    return ret;

}


id: 60a722b95db22d6e34006f2a
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.21 22:38:13.000
script:
function formOpen() {
    book.sheet1.getBrick('imgPool').selectionMode = 'multi'; //图片设置成多选模式

    $(document.body).append(`<style>
                        .pzh {position:absolute;left:0;bottom:0px; 
                                height:24px; line-height:24px;width:100%; 
                                background-color:#40af40a0; 
                                color:white;font-weight:bold;font-size:16px;text-align:center;}
                        </style>
 `);


    //  let data= loadImagePoolData();
    //  console.dir(data);

}


/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet, name, data) {
    //console.dir(data);
    var url = data.url_img;
    book.sheet0.cells("imgPreview").setValue(url);
}
function imageOnMouseOut(sheet, name, data) {

    book.sheet0.cells("imgPreview").setValue("");
}


/**
 * 图片控件中某个图片被双击了
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片被双击)
function imageOnDBLClick(sheet, name, data) {
    var pzh= find_pzh(data.id,false).text();
    if( pzh==undefined) pzh='';

    inputBox("标记为凭证", "", pzh , "输入凭证号码", function (val) {
        if (val == '') {
            var p = find_pzh(data.id, false);
            if (p) p.remove();
        } else {
            find_pzh(data.id, true).text(val);
        }

    }, true /*允许为空*/);
}


//@comment (group=,caption=查找或创建凭证号标记对象,needRightControl=false)
function find_pzh(id, create_if_not_exists) {
    var d = $('#' + id);
    if (!d) {
        $.alert(id + "不存在");
        return null;
    }

    var ret = d.find('.pzh');
    if (ret.length == 0) {
        if (create_if_not_exists) //如果需要创建，则创建它
        {
            d.append(`<div class="pzh" ></div>`);
        }
        ret = d.find('.pzh');
    }
    return ret;

}


id: 60a722b95db22d6e34006f30
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.21 22:42:56.000
script:
function formOpen() {
    book.sheet1.getBrick('imgPool').selectionMode = 'multi'; //图片设置成多选模式

    $(document.body).append(`<style>
                        .pzh {position:absolute;left:0;bottom:0px; 
                                height:24px; line-height:24px;width:100%; 
                                background-color:#40af40a0; 
                                color:white;font-weight:bold;font-size:16px;text-align:center;}

                        .pzh .delete_pzh {float:right; }        
                        </style>
 `);


    //  let data= loadImagePoolData();
    //  console.dir(data);

}


/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet, name, data) {
    //console.dir(data);
    var url = data.url_img;
    book.sheet0.cells("imgPreview").setValue(url);
}
function imageOnMouseOut(sheet, name, data) {

    book.sheet0.cells("imgPreview").setValue("");
}


/**
 * 图片控件中某个图片被双击了
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片被双击)
function imageOnDBLClick(sheet, name, data) {
    var pzh= find_pzh(data.id,false).text();
    if( pzh==undefined) pzh='';

    inputBox("标记为凭证", "", pzh , "输入凭证号码", function (val) {
        if (val == '') {
            var p = find_pzh(data.id, false);
            if (p) p.remove();
        } else {
            find_pzh(data.id, true).text(val);
        }

    }, true /*允许为空*/);
}


//@comment (group=,caption=查找或创建凭证号标记对象,needRightControl=false)
function find_pzh(id, create_if_not_exists) {
    var d = $('#' + id);
    if (!d) {
        $.alert(id + "不存在");
        return null;
    }

    var ret = d.find('.pzh');
    if (ret.length == 0) {
        if (create_if_not_exists) //如果需要创建，则创建它
        {
            d.append(`<div class="pzh" ><div class=".delete_pzh">X</div></div>`);
        }
        ret = d.find('.pzh');
    }
    return ret;

}


id: 60a722b95db22d6e34006f36
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.21 22:45:30.000
script:
function formOpen() {
    book.sheet1.getBrick('imgPool').selectionMode = 'multi'; //图片设置成多选模式

    $(document.body).append(`<style>
                        .pzh {position:absolute;left:0;bottom:0px; 
                                height:24px; line-height:24px;width:100%; 
                                background-color:#40af40a0; 
                                color:white;font-weight:bold;font-size:16px;text-align:center;}

                        .pzh .delete_pzh {float:right; }        
                        </style>
 `);


    //  let data= loadImagePoolData();
    //  console.dir(data);

}


/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet, name, data) {
    //console.dir(data);
    var url = data.url_img;
    book.sheet0.cells("imgPreview").setValue(url);
}
function imageOnMouseOut(sheet, name, data) {

    book.sheet0.cells("imgPreview").setValue("");
}


/**
 * 图片控件中某个图片被双击了
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片被双击)
function imageOnDBLClick(sheet, name, data) {
    var pzh='';
    try{

        pzh = find_pzh(data.id,false).find('.no').text();
    }catch(err)
    {

    }

    if( pzh==undefined) pzh='';

    inputBox("标记为凭证", "", pzh , "输入凭证号码", function (val) {
        if (val == '') {
            var p = find_pzh(data.id, false);
            if (p) p.remove();
        } else {
            find_pzh(data.id, true).find('.no')text(val);
        }

    }, true /*允许为空*/);
}


//@comment (group=,caption=查找或创建凭证号标记对象,needRightControl=false)
function find_pzh(id, create_if_not_exists) {
    var d = $('#' + id);
    if (!d) {
        $.alert(id + "不存在");
        return null;
    }

    var ret = d.find('.pzh');
    if (ret.length == 0) {
        if (create_if_not_exists) //如果需要创建，则创建它
        {
            d.append(`<div class="pzh" ><div class="no"></div><div class=".delete_pzh">X</div></div>`);
        }
        ret = d.find('.pzh');
    }
    return ret;

}


id: 60a722b95db22d6e34006f3c
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.21 22:45:38.000
script:
function formOpen() {
    book.sheet1.getBrick('imgPool').selectionMode = 'multi'; //图片设置成多选模式

    $(document.body).append(`<style>
                        .pzh {position:absolute;left:0;bottom:0px; 
                                height:24px; line-height:24px;width:100%; 
                                background-color:#40af40a0; 
                                color:white;font-weight:bold;font-size:16px;text-align:center;}

                        .pzh .delete_pzh {float:right; }        
                        </style>
 `);


    //  let data= loadImagePoolData();
    //  console.dir(data);

}


/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet, name, data) {
    //console.dir(data);
    var url = data.url_img;
    book.sheet0.cells("imgPreview").setValue(url);
}
function imageOnMouseOut(sheet, name, data) {

    book.sheet0.cells("imgPreview").setValue("");
}


/**
 * 图片控件中某个图片被双击了
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片被双击)
function imageOnDBLClick(sheet, name, data) {
    var pzh='';
    try{

        pzh = find_pzh(data.id,false).find('.no').text();
    }catch(err)
    {

    }

    if( pzh==undefined) pzh='';

    inputBox("标记为凭证", "", pzh , "输入凭证号码", function (val) {
        if (val == '') {
            var p = find_pzh(data.id, false);
            if (p) p.remove();
        } else {
            find_pzh(data.id, true).find('.no').text(val);
        }

    }, true /*允许为空*/);
}


//@comment (group=,caption=查找或创建凭证号标记对象,needRightControl=false)
function find_pzh(id, create_if_not_exists) {
    var d = $('#' + id);
    if (!d) {
        $.alert(id + "不存在");
        return null;
    }

    var ret = d.find('.pzh');
    if (ret.length == 0) {
        if (create_if_not_exists) //如果需要创建，则创建它
        {
            d.append(`<div class="pzh" ><div class="no"></div><div class=".delete_pzh">X</div></div>`);
        }
        ret = d.find('.pzh');
    }
    return ret;

}


id: 60a7c7a85db22d6e34006f42
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.21 22:46:01.000
script:
function formOpen() {
    book.sheet1.getBrick('imgPool').selectionMode = 'multi'; //图片设置成多选模式

    $(document.body).append(`<style>
                        .pzh {position:absolute;left:0;bottom:0px; 
                                height:24px; line-height:24px;width:100%; 
                                background-color:#40af40a0; 
                                color:white;font-weight:bold;font-size:16px;text-align:center;}

                        .pzh .delete_pzh { float:right; }        
                        </style>
 `);


    //  let data= loadImagePoolData();
    //  console.dir(data);

}


/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet, name, data) {
    //console.dir(data);
    var url = data.url_img;
    book.sheet0.cells("imgPreview").setValue(url);
}
function imageOnMouseOut(sheet, name, data) {

    book.sheet0.cells("imgPreview").setValue("");
}


/**
 * 图片控件中某个图片被双击了
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片被双击)
function imageOnDBLClick(sheet, name, data) {
    var pzh='';
    try{

        pzh = find_pzh(data.id,false).find('.no').text();
    }catch(err)
    {

    }

    if( pzh==undefined) pzh='';

    inputBox("标记为凭证", "", pzh , "输入凭证号码", function (val) {
        if (val == '') {
            var p = find_pzh(data.id, false);
            if (p) p.remove();
        } else {
            find_pzh(data.id, true).find('.no').text(val);
        }

    }, true /*允许为空*/);
}


//@comment (group=,caption=查找或创建凭证号标记对象,needRightControl=false)
function find_pzh(id, create_if_not_exists) {
    var d = $('#' + id);
    if (!d) {
        $.alert(id + "不存在");
        return null;
    }

    var ret = d.find('.pzh');
    if (ret.length == 0) {
        if (create_if_not_exists) //如果需要创建，则创建它
        {
            d.append(`<div class="pzh" ><div class="no"></div><div class=".delete_pzh">X</div></div>`);
        }
        ret = d.find('.pzh');
    }
    return ret;

}


id: 60a7c7a85db22d6e34006f48
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.21 22:47:04.000
script:
function formOpen() {
    book.sheet1.getBrick('imgPool').selectionMode = 'multi'; //图片设置成多选模式

    $(document.body).append(`<style>
                        .pzh {position:absolute;left:0;bottom:0px; 
                                height:24px; line-height:24px;width:100%; 
                                background-color:#40af40a0; 
                                color:white;font-weight:bold;font-size:16px;text-align:center;}

                        .pzh .delete_pzh { position:absolute; right:0; width:40px; height:20px; top:0; }        
                        </style>
 `);


    //  let data= loadImagePoolData();
    //  console.dir(data);

}


/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet, name, data) {
    //console.dir(data);
    var url = data.url_img;
    book.sheet0.cells("imgPreview").setValue(url);
}
function imageOnMouseOut(sheet, name, data) {

    book.sheet0.cells("imgPreview").setValue("");
}


/**
 * 图片控件中某个图片被双击了
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片被双击)
function imageOnDBLClick(sheet, name, data) {
    var pzh='';
    try{

        pzh = find_pzh(data.id,false).find('.no').text();
    }catch(err)
    {

    }

    if( pzh==undefined) pzh='';

    inputBox("标记为凭证", "", pzh , "输入凭证号码", function (val) {
        if (val == '') {
            var p = find_pzh(data.id, false);
            if (p) p.remove();
        } else {
            find_pzh(data.id, true).find('.no').text(val);
        }

    }, true /*允许为空*/);
}


//@comment (group=,caption=查找或创建凭证号标记对象,needRightControl=false)
function find_pzh(id, create_if_not_exists) {
    var d = $('#' + id);
    if (!d) {
        $.alert(id + "不存在");
        return null;
    }

    var ret = d.find('.pzh');
    if (ret.length == 0) {
        if (create_if_not_exists) //如果需要创建，则创建它
        {
            d.append(`<div class="pzh" ><div class="no"></div><div class=".delete_pzh">X</div></div>`);
        }
        ret = d.find('.pzh');
    }
    return ret;

}


id: 60a7c7a85db22d6e34006f4e
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.21 22:47:53.000
script:
function formOpen() {
    book.sheet1.getBrick('imgPool').selectionMode = 'multi'; //图片设置成多选模式

    $(document.body).append(`<style>
                        .pzh {position:absolute;left:0;bottom:0px; 
                                height:24px; line-height:24px;width:100%; 
                                background-color:#40af40a0; 
                                color:white;font-weight:bold;font-size:16px;text-align:center;}

                        .delete_pzh { position:absolute; right:0; width:40px; height:20px; top:0; }        
                        </style>
 `);


    //  let data= loadImagePoolData();
    //  console.dir(data);

}


/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet, name, data) {
    //console.dir(data);
    var url = data.url_img;
    book.sheet0.cells("imgPreview").setValue(url);
}
function imageOnMouseOut(sheet, name, data) {

    book.sheet0.cells("imgPreview").setValue("");
}


/**
 * 图片控件中某个图片被双击了
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片被双击)
function imageOnDBLClick(sheet, name, data) {
    var pzh='';
    try{

        pzh = find_pzh(data.id,false).find('.no').text();
    }catch(err)
    {

    }

    if( pzh==undefined) pzh='';

    inputBox("标记为凭证", "", pzh , "输入凭证号码", function (val) {
        if (val == '') {
            var p = find_pzh(data.id, false);
            if (p) p.remove();
        } else {
            find_pzh(data.id, true).find('.no').text(val);
        }

    }, true /*允许为空*/);
}


//@comment (group=,caption=查找或创建凭证号标记对象,needRightControl=false)
function find_pzh(id, create_if_not_exists) {
    var d = $('#' + id);
    if (!d) {
        $.alert(id + "不存在");
        return null;
    }

    var ret = d.find('.pzh');
    if (ret.length == 0) {
        if (create_if_not_exists) //如果需要创建，则创建它
        {
            d.append(`<div class="pzh" ><div class="no"></div><div class=".delete_pzh">X</div></div>`);
        }
        ret = d.find('.pzh');
    }
    return ret;

}


id: 60a7c7a85db22d6e34006f54
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.21 22:48:22.000
script:
function formOpen() {
    book.sheet1.getBrick('imgPool').selectionMode = 'multi'; //图片设置成多选模式

    $(document.body).append(`<style>
                        .pzh {position:absolute;left:0;bottom:0px; 
                                height:24px; line-height:24px;width:100%; 
                                background-color:#40af40a0; 
                                color:white;font-weight:bold;font-size:16px;text-align:center;}

                        .delete_pzh { position:absolute; right:0; width:40px; height:20px; top:0; }        
                        </style>
 `);


    //  let data= loadImagePoolData();
    //  console.dir(data);

}


/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet, name, data) {
    //console.dir(data);
    var url = data.url_img;
    book.sheet0.cells("imgPreview").setValue(url);
}
function imageOnMouseOut(sheet, name, data) {

    book.sheet0.cells("imgPreview").setValue("");
}


/**
 * 图片控件中某个图片被双击了
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片被双击)
function imageOnDBLClick(sheet, name, data) {
    var pzh='';
    try{

        pzh = find_pzh(data.id,false).find('.no').text();
    }catch(err)
    {

    }

    if( pzh==undefined) pzh='';

    inputBox("标记为凭证", "", pzh , "输入凭证号码", function (val) {
        if (val == '') {
            var p = find_pzh(data.id, false);
            if (p) p.remove();
        } else {
            find_pzh(data.id, true).find('.no').text(val);
        }

    }, true /*允许为空*/);
}


//@comment (group=,caption=查找或创建凭证号标记对象,needRightControl=false)
function find_pzh(id, create_if_not_exists) {
    var d = $('#' + id);
    if (!d) {
        $.alert(id + "不存在");
        return null;
    }

    var ret = d.find('.pzh');
    if (ret.length == 0) {
        if (create_if_not_exists) //如果需要创建，则创建它
        {
            d.append(`<div class="pzh" ><div class="no"></div><div class="delete_pzh">X</div></div>`);
        }
        ret = d.find('.pzh');
    }
    return ret;

}


id: 60a7c7a85db22d6e34006f5a
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.21 22:49:04.000
script:
function formOpen() {
    book.sheet1.getBrick('imgPool').selectionMode = 'multi'; //图片设置成多选模式

    $(document.body).append(`<style>
                        .pzh {position:absolute;left:0;bottom:0px; 
                                height:24px; line-height:24px;width:100%; 
                                background-color:#40af40a0; 
                                color:white;font-weight:bold;font-size:16px;text-align:center;}

                        .delete_pzh { float:right; }        
                        </style>
 `);


    //  let data= loadImagePoolData();
    //  console.dir(data);

}


/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet, name, data) {
    //console.dir(data);
    var url = data.url_img;
    book.sheet0.cells("imgPreview").setValue(url);
}
function imageOnMouseOut(sheet, name, data) {

    book.sheet0.cells("imgPreview").setValue("");
}


/**
 * 图片控件中某个图片被双击了
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片被双击)
function imageOnDBLClick(sheet, name, data) {
    var pzh='';
    try{

        pzh = find_pzh(data.id,false).find('.no').text();
    }catch(err)
    {

    }

    if( pzh==undefined) pzh='';

    inputBox("标记为凭证", "", pzh , "输入凭证号码", function (val) {
        if (val == '') {
            var p = find_pzh(data.id, false);
            if (p) p.remove();
        } else {
            find_pzh(data.id, true).find('.no').text(val);
        }

    }, true /*允许为空*/);
}


//@comment (group=,caption=查找或创建凭证号标记对象,needRightControl=false)
function find_pzh(id, create_if_not_exists) {
    var d = $('#' + id);
    if (!d) {
        $.alert(id + "不存在");
        return null;
    }

    var ret = d.find('.pzh');
    if (ret.length == 0) {
        if (create_if_not_exists) //如果需要创建，则创建它
        {
            d.append(`<div class="pzh" ><div class="no"></div><div class="delete_pzh">X</div></div>`);
        }
        ret = d.find('.pzh');
    }
    return ret;

}


id: 60a7c7a85db22d6e34006f60
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.21 22:49:43.000
script:
function formOpen() {
    book.sheet1.getBrick('imgPool').selectionMode = 'multi'; //图片设置成多选模式

    $(document.body).append(`<style>
                        .pzh {position:absolute;left:0;bottom:0px; 
                                height:24px; line-height:24px;width:100%; 
                                background-color:#40af40a0; 
                                color:white;font-weight:bold;font-size:16px;text-align:center;}

                        .delete_pzh { position:absolute; right:0; width:40px; height:20px; top:0; text-align:right; }        
                        </style>
 `);


    //  let data= loadImagePoolData();
    //  console.dir(data);

}


/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet, name, data) {
    //console.dir(data);
    var url = data.url_img;
    book.sheet0.cells("imgPreview").setValue(url);
}
function imageOnMouseOut(sheet, name, data) {

    book.sheet0.cells("imgPreview").setValue("");
}


/**
 * 图片控件中某个图片被双击了
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片被双击)
function imageOnDBLClick(sheet, name, data) {
    var pzh='';
    try{

        pzh = find_pzh(data.id,false).find('.no').text();
    }catch(err)
    {

    }

    if( pzh==undefined) pzh='';

    inputBox("标记为凭证", "", pzh , "输入凭证号码", function (val) {
        if (val == '') {
            var p = find_pzh(data.id, false);
            if (p) p.remove();
        } else {
            find_pzh(data.id, true).find('.no').text(val);
        }

    }, true /*允许为空*/);
}


//@comment (group=,caption=查找或创建凭证号标记对象,needRightControl=false)
function find_pzh(id, create_if_not_exists) {
    var d = $('#' + id);
    if (!d) {
        $.alert(id + "不存在");
        return null;
    }

    var ret = d.find('.pzh');
    if (ret.length == 0) {
        if (create_if_not_exists) //如果需要创建，则创建它
        {
            d.append(`<div class="pzh" ><div class="no"></div><div class="delete_pzh">X</div></div>`);
        }
        ret = d.find('.pzh');
    }
    return ret;

}


id: 60a7c7a85db22d6e34006f66
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.21 22:50:26.000
script:
function formOpen() {
    book.sheet1.getBrick('imgPool').selectionMode = 'multi'; //图片设置成多选模式

    $(document.body).append(`<style>
                        .pzh {position:absolute;left:0;bottom:0px; 
                                height:24px; line-height:24px;width:100%; 
                                background-color:#40af40a0; 
                                color:white;font-weight:bold;font-size:16px;text-align:center;}

                        .delete_pzh { position:absolute; right:0; width:40px; height:20px; top:0; text-align:right; }        
                        </style>
 `);


    //  let data= loadImagePoolData();
    //  console.dir(data);

}


/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet, name, data) {
    //console.dir(data);
    var url = data.url_img;
    book.sheet0.cells("imgPreview").setValue(url);
}
function imageOnMouseOut(sheet, name, data) {

    book.sheet0.cells("imgPreview").setValue("");
}


/**
 * 图片控件中某个图片被双击了
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片被双击)
function imageOnDBLClick(sheet, name, data) {
    var pzh='';
    try{

        pzh = find_pzh(data.id,false).find('.no').text();
    }catch(err)
    {

    }

    if( pzh==undefined) pzh='';

    inputBox("标记为凭证", "", pzh , "输入凭证号码", function (val) {
        if (val == '') {
            var p = find_pzh(data.id, false);
            if (p) p.remove();
        } else {
            find_pzh(data.id, true).find('.no').text(val);
        }

    }, true /*允许为空*/);
}


//@comment (group=,caption=查找或创建凭证号标记对象,needRightControl=false)
function find_pzh(id, create_if_not_exists) {
    var d = $('#' + id);
    if (!d) {
        $.alert(id + "不存在");
        return null;
    }

    var ret = d.find('.pzh');
    if (ret.length == 0) {
        if (create_if_not_exists) //如果需要创建，则创建它
        {
            d.append(`<div class="pzh" ><div class="no"></div><div class="delete_pzh"><i class="fa fa-close"></i></div></div>`);
        }
        ret = d.find('.pzh');
    }
    return ret;

}


id: 60a7c7a85db22d6e34006f6c
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.21 22:51:32.000
script:
function formOpen() {
    book.sheet1.getBrick('imgPool').selectionMode = 'multi'; //图片设置成多选模式

    $(document.body).append(`<style>
                        .pzh {position:absolute;left:0;bottom:0px; 
                                height:24px; line-height:24px;width:100%; 
                                background-color:#40af40a0; 
                                color:white;font-weight:bold;font-size:16px;text-align:center;}

                        .delete_pzh { position:absolute; right:0; width:40px; height:20px; top:0; text-align:right; vertical-align:top; font-size:12px; }        
                        </style>
 `);


    //  let data= loadImagePoolData();
    //  console.dir(data);

}


/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet, name, data) {
    //console.dir(data);
    var url = data.url_img;
    book.sheet0.cells("imgPreview").setValue(url);
}
function imageOnMouseOut(sheet, name, data) {

    book.sheet0.cells("imgPreview").setValue("");
}


/**
 * 图片控件中某个图片被双击了
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片被双击)
function imageOnDBLClick(sheet, name, data) {
    var pzh='';
    try{

        pzh = find_pzh(data.id,false).find('.no').text();
    }catch(err)
    {

    }

    if( pzh==undefined) pzh='';

    inputBox("标记为凭证", "", pzh , "输入凭证号码", function (val) {
        if (val == '') {
            var p = find_pzh(data.id, false);
            if (p) p.remove();
        } else {
            find_pzh(data.id, true).find('.no').text(val);
        }

    }, true /*允许为空*/);
}


//@comment (group=,caption=查找或创建凭证号标记对象,needRightControl=false)
function find_pzh(id, create_if_not_exists) {
    var d = $('#' + id);
    if (!d) {
        $.alert(id + "不存在");
        return null;
    }

    var ret = d.find('.pzh');
    if (ret.length == 0) {
        if (create_if_not_exists) //如果需要创建，则创建它
        {
            d.append(`<div class="pzh" ><div class="no"></div><div class="delete_pzh"><i class="fa fa-close"></i></div></div>`);
        }
        ret = d.find('.pzh');
    }
    return ret;

}


id: 60a7c7a85db22d6e34006f72
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.21 22:51:59.000
script:
function formOpen() {
    book.sheet1.getBrick('imgPool').selectionMode = 'multi'; //图片设置成多选模式

    $(document.body).append(`<style>
                        .pzh {position:absolute;left:0;bottom:0px; 
                                height:24px; line-height:24px;width:100%; 
                                background-color:#40af40a0; 
                                color:white;font-weight:bold;font-size:16px;text-align:center;}

                        .delete_pzh { position:absolute; right:0; width:40px; height:14px; top:0; text-align:right; vertical-align:top; font-size:12px; }        
                        </style>
 `);


    //  let data= loadImagePoolData();
    //  console.dir(data);

}


/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet, name, data) {
    //console.dir(data);
    var url = data.url_img;
    book.sheet0.cells("imgPreview").setValue(url);
}
function imageOnMouseOut(sheet, name, data) {

    book.sheet0.cells("imgPreview").setValue("");
}


/**
 * 图片控件中某个图片被双击了
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片被双击)
function imageOnDBLClick(sheet, name, data) {
    var pzh='';
    try{

        pzh = find_pzh(data.id,false).find('.no').text();
    }catch(err)
    {

    }

    if( pzh==undefined) pzh='';

    inputBox("标记为凭证", "", pzh , "输入凭证号码", function (val) {
        if (val == '') {
            var p = find_pzh(data.id, false);
            if (p) p.remove();
        } else {
            find_pzh(data.id, true).find('.no').text(val);
        }

    }, true /*允许为空*/);
}


//@comment (group=,caption=查找或创建凭证号标记对象,needRightControl=false)
function find_pzh(id, create_if_not_exists) {
    var d = $('#' + id);
    if (!d) {
        $.alert(id + "不存在");
        return null;
    }

    var ret = d.find('.pzh');
    if (ret.length == 0) {
        if (create_if_not_exists) //如果需要创建，则创建它
        {
            d.append(`<div class="pzh" ><div class="no"></div><div class="delete_pzh"><i class="fa fa-close"></i></div></div>`);
        }
        ret = d.find('.pzh');
    }
    return ret;

}


id: 60a7c7a85db22d6e34006f78
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.21 22:52:23.000
script:
function formOpen() {
    book.sheet1.getBrick('imgPool').selectionMode = 'multi'; //图片设置成多选模式

    $(document.body).append(`<style>
                        .pzh {position:absolute;left:0;bottom:0px; 
                                height:24px; line-height:24px;width:100%; 
                                background-color:#40af40a0; 
                                color:white;font-weight:bold;font-size:16px;text-align:center;}

                        .delete_pzh { position:absolute; right:0; width:40px; height:14px; top:0; text-align:right; vertical-align:top; font-size:12px; color:gray;}        
                        </style>
 `);


    //  let data= loadImagePoolData();
    //  console.dir(data);

}


/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet, name, data) {
    //console.dir(data);
    var url = data.url_img;
    book.sheet0.cells("imgPreview").setValue(url);
}
function imageOnMouseOut(sheet, name, data) {

    book.sheet0.cells("imgPreview").setValue("");
}


/**
 * 图片控件中某个图片被双击了
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片被双击)
function imageOnDBLClick(sheet, name, data) {
    var pzh='';
    try{

        pzh = find_pzh(data.id,false).find('.no').text();
    }catch(err)
    {

    }

    if( pzh==undefined) pzh='';

    inputBox("标记为凭证", "", pzh , "输入凭证号码", function (val) {
        if (val == '') {
            var p = find_pzh(data.id, false);
            if (p) p.remove();
        } else {
            find_pzh(data.id, true).find('.no').text(val);
        }

    }, true /*允许为空*/);
}


//@comment (group=,caption=查找或创建凭证号标记对象,needRightControl=false)
function find_pzh(id, create_if_not_exists) {
    var d = $('#' + id);
    if (!d) {
        $.alert(id + "不存在");
        return null;
    }

    var ret = d.find('.pzh');
    if (ret.length == 0) {
        if (create_if_not_exists) //如果需要创建，则创建它
        {
            d.append(`<div class="pzh" ><div class="no"></div><div class="delete_pzh"><i class="fa fa-close"></i></div></div>`);
        }
        ret = d.find('.pzh');
    }
    return ret;

}


id: 60a7c7a85db22d6e34006f7e
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.21 22:52:57.000
script:
function formOpen() {
    book.sheet1.getBrick('imgPool').selectionMode = 'multi'; //图片设置成多选模式

    $(document.body).append(`<style>
                        .pzh {position:absolute;left:0;bottom:0px; 
                                height:24px; line-height:24px;width:100%; 
                                background-color:#40af40a0; 
                                color:white;font-weight:bold;font-size:16px;text-align:center;}

                        .delete_pzh { position:absolute; right:0; width:40px; height:14px; top:0; text-align:right; vertical-align:top; font-size:12px; color:gray;}      
                        .delete_pzh:hover { color:white;}      
                          
                        </style>
 `);


    //  let data= loadImagePoolData();
    //  console.dir(data);

}


/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet, name, data) {
    //console.dir(data);
    var url = data.url_img;
    book.sheet0.cells("imgPreview").setValue(url);
}
function imageOnMouseOut(sheet, name, data) {

    book.sheet0.cells("imgPreview").setValue("");
}


/**
 * 图片控件中某个图片被双击了
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片被双击)
function imageOnDBLClick(sheet, name, data) {
    var pzh='';
    try{

        pzh = find_pzh(data.id,false).find('.no').text();
    }catch(err)
    {

    }

    if( pzh==undefined) pzh='';

    inputBox("标记为凭证", "", pzh , "输入凭证号码", function (val) {
        if (val == '') {
            var p = find_pzh(data.id, false);
            if (p) p.remove();
        } else {
            find_pzh(data.id, true).find('.no').text(val);
        }

    }, true /*允许为空*/);
}


//@comment (group=,caption=查找或创建凭证号标记对象,needRightControl=false)
function find_pzh(id, create_if_not_exists) {
    var d = $('#' + id);
    if (!d) {
        $.alert(id + "不存在");
        return null;
    }

    var ret = d.find('.pzh');
    if (ret.length == 0) {
        if (create_if_not_exists) //如果需要创建，则创建它
        {
            d.append(`<div class="pzh" ><div class="no"></div><div class="delete_pzh"><i class="fa fa-close"></i></div></div>`);
        }
        ret = d.find('.pzh');
    }
    return ret;

}


id: 60a7c7a85db22d6e34006f84
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.21 22:53:31.000
script:
function formOpen() {
    book.sheet1.getBrick('imgPool').selectionMode = 'multi'; //图片设置成多选模式

    $(document.body).append(`<style>
                        .pzh {position:absolute;left:0;bottom:0px; 
                                height:24px; line-height:24px;width:100%; 
                                background-color:#40af40a0; 
                                color:white;font-weight:bold;font-size:16px;text-align:center;}

                        .delete_pzh { position:absolute; right:0; width:40px; height:14px; top:0; text-align:right; vertical-align:top; font-size:12px; color:gray;}      
                        .delete_pzh:hover { color:white;}      
                          
                        </style>
 `);


    //  let data= loadImagePoolData();
    //  console.dir(data);

}


/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet, name, data) {
    //console.dir(data);
    var url = data.url_img;
    book.sheet0.cells("imgPreview").setValue(url);
}
function imageOnMouseOut(sheet, name, data) {

    book.sheet0.cells("imgPreview").setValue("");
}


/**
 * 图片控件中某个图片被双击了
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片被双击)
function imageOnDBLClick(sheet, name, data) {
    var pzh='';
    try{

        pzh = find_pzh(data.id,false).find('.no').text();
    }catch(err)
    {

    }

    if( pzh==undefined) pzh='';

    inputBox("标记为凭证", "", pzh , "输入凭证号码", function (val) {
        if (val == '') {
            var p = find_pzh(data.id, false);
            if (p) p.remove();
        } else {
            find_pzh(data.id, true).find('.no').text(val);
        }

    }, true /*允许为空*/);
}


//@comment (group=,caption=查找或创建凭证号标记对象,needRightControl=false)
function find_pzh(id, create_if_not_exists) {
    var d = $('#' + id);
    if (!d) {
        $.alert(id + "不存在");
        return null;
    }

    var ret = d.find('.pzh');
    if (ret.length == 0) {
        if (create_if_not_exists) //如果需要创建，则创建它
        {
            d.append(`<div class="pzh" ><div class="no"></div><div class="delete_pzh"><i class="fa fa-close"> </i></div></div>`);
        }
        ret = d.find('.pzh');
    }
    return ret;

}


id: 60a7c7a85db22d6e34006f8a
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.21 22:54:35.000
script:
function formOpen() {
    book.sheet1.getBrick('imgPool').selectionMode = 'multi'; //图片设置成多选模式

    $(document.body).append(`<style>
                        .pzh {position:absolute;left:0;bottom:0px; 
                                height:24px; line-height:24px;width:100%; 
                                background-color:#40af40a0; 
                                color:white;font-weight:bold;font-size:16px;text-align:center;}

                        .delete_pzh { position:absolute; right:0; width:40px; height:14px; top:0; text-align:right; vertical-align:top; font-size:12px; color:gray;}      
                        .delete_pzh:hover { color:white;}      
                          
                        </style>
 `);


    //  let data= loadImagePoolData();
    //  console.dir(data);

}


/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet, name, data) {
    //console.dir(data);
    var url = data.url_img;
    book.sheet0.cells("imgPreview").setValue(url);
}
function imageOnMouseOut(sheet, name, data) {

    book.sheet0.cells("imgPreview").setValue("");
}


/**
 * 图片控件中某个图片被双击了
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片被双击)
function imageOnDBLClick(sheet, name, data) {
    var pzh='';
    try{

        pzh = find_pzh(data.id,false).find('.no').text();
    }catch(err)
    {

    }

    if( pzh==undefined) pzh='';

    inputBox("标记为凭证", "", pzh , "输入凭证号码", function (val) {
        if (val == '') {
            var p = find_pzh(data.id, false);
            if (p) p.remove();
        } else {
            find_pzh(data.id, true).find('.no').text(val);
        }

    }, true /*允许为空*/);
}


//@comment (group=,caption=查找或创建凭证号标记对象,needRightControl=false)
function find_pzh(id, create_if_not_exists) {
    var d = $('#' + id);
    if (!d) {
        $.alert(id + "不存在");
        return null;
    }

    var ret = d.find('.pzh');
    if (ret.length == 0) {
        if (create_if_not_exists) //如果需要创建，则创建它
        {
            d.append(`<div class="pzh" ><div class="no"></div><div class="delete_pzh"><i class="fa fa-close" onclick="removePZH('${id}');"> </i></div></div>`);
        }
        ret = d.find('.pzh');
    }
    return ret;

}


id: 60a7c7a85db22d6e34006f90
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.21 22:55:02.000
script:
function formOpen() {
    book.sheet1.getBrick('imgPool').selectionMode = 'multi'; //图片设置成多选模式

    $(document.body).append(`<style>
                        .pzh {position:absolute;left:0;bottom:0px; 
                                height:24px; line-height:24px;width:100%; 
                                background-color:#40af40a0; 
                                color:white;font-weight:bold;font-size:16px;text-align:center;}

                        .delete_pzh { position:absolute; right:0; width:40px; height:14px; top:0; text-align:right; vertical-align:top; font-size:12px; color:gray;}      
                        .delete_pzh:hover { color:white;}      
                          
                        </style>
 `);


    //  let data= loadImagePoolData();
    //  console.dir(data);

}


/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet, name, data) {
    //console.dir(data);
    var url = data.url_img;
    book.sheet0.cells("imgPreview").setValue(url);
}
function imageOnMouseOut(sheet, name, data) {

    book.sheet0.cells("imgPreview").setValue("");
}


/**
 * 图片控件中某个图片被双击了
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片被双击)
function imageOnDBLClick(sheet, name, data) {
    var pzh='';
    try{

        pzh = find_pzh(data.id,false).find('.no').text();
    }catch(err)
    {

    }

    if( pzh==undefined) pzh='';

    inputBox("标记为凭证", "", pzh , "输入凭证号码", function (val) {
        if (val == '') {
            var p = find_pzh(data.id, false);
            if (p) p.remove();
        } else {
            find_pzh(data.id, true).find('.no').text(val);
        }

    }, true /*允许为空*/);
}


//@comment (group=,caption=查找或创建凭证号标记对象,needRightControl=false)
function find_pzh(id, create_if_not_exists) {
    var d = $('#' + id);
    if (!d) {
        $.alert(id + "不存在");
        return null;
    }

    var ret = d.find('.pzh');
    if (ret.length == 0) {
        if (create_if_not_exists) //如果需要创建，则创建它
        {
            d.append(`<div class="pzh" ><div class="no"></div><div class="delete_pzh"><i class="fa fa-close" onclick="removePZH('${id}');"> </i></div></div>`);
        }
        ret = d.find('.pzh');
    }
    return ret;

}

function removePZH(id)
{
     var p = find_pzh(id, false);
     if (p) p.remove();
}


id: 60a7c7a85db22d6e34006f96
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.21 22:55:47.000
script:
function formOpen() {
    book.sheet1.getBrick('imgPool').selectionMode = 'multi'; //图片设置成多选模式

    $(document.body).append(`<style>
                        .pzh {position:absolute;left:0;bottom:0px; 
                                height:24px; line-height:24px;width:100%; 
                                background-color:#40af40a0; 
                                color:white;font-weight:bold;font-size:16px;text-align:center;}

                        .delete_pzh { position:absolute; right:0; width:40px; height:14px; top:0; text-align:right; vertical-align:top; font-size:12px; color:gray;}      
                        .delete_pzh:hover { color:white;}      
                          
                        </style>
 `);


    //  let data= loadImagePoolData();
    //  console.dir(data);

}


/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet, name, data) {
    //console.dir(data);
    var url = data.url_img;
    book.sheet0.cells("imgPreview").setValue(url);
}
function imageOnMouseOut(sheet, name, data) {

    book.sheet0.cells("imgPreview").setValue("");
}


/**
 * 图片控件中某个图片被双击了
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片被双击)
function imageOnDBLClick(sheet, name, data) {
    var pzh='';
    try{

        pzh = find_pzh(data.id,false).find('.no').text();
    }catch(err)
    {

    }

    if( pzh==undefined) pzh='';

    inputBox("标记为凭证", "", pzh , "输入凭证号码", function (val) {
        if (val == '') {
            var p = find_pzh(data.id, false);
            if (p) p.remove();
        } else {
            find_pzh(data.id, true).find('.no').text(val);
        }

    }, true /*允许为空*/);
}


//@comment (group=,caption=查找或创建凭证号标记对象,needRightControl=false)
function find_pzh(id, create_if_not_exists) {
    var d = $('#' + id);
    if (!d) {
        $.alert(id + "不存在");
        return null;
    }

    var ret = d.find('.pzh');
    if (ret.length == 0) {
        if (create_if_not_exists) //如果需要创建，则创建它
        {
            d.append(`<div class="pzh" ><div class="no"></div><div class="delete_pzh"><i class="fa fa-close" onclick="removePZH('${id}');event.preventDefault();"> </i></div></div>`);
        }
        ret = d.find('.pzh');
    }
    return ret;

}

function removePZH(id)
{
     var p = find_pzh(id, false);
     if (p) p.remove();
}


id: 60a7c7a85db22d6e34006f9c
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.21 22:57:21.000
script:
function formOpen() {
    book.sheet1.getBrick('imgPool').selectionMode = 'multi'; //图片设置成多选模式

    $(document.body).append(`<style>
                        .pzh {position:absolute;left:0;bottom:0px; 
                                height:24px; line-height:24px;width:100%; 
                                background-color:#40af40a0; 
                                color:white;font-weight:bold;font-size:16px;text-align:center;}

                        .delete_pzh { position:absolute; right:0; width:40px; height:14px; top:0; text-align:right; vertical-align:top; font-size:12px; color:gray;}      
                        .delete_pzh:hover { color:white;}      
                          
                        </style>
 `);


    //  let data= loadImagePoolData();
    //  console.dir(data);

}


/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet, name, data) {
    //console.dir(data);
    var url = data.url_img;
    book.sheet0.cells("imgPreview").setValue(url);
}
function imageOnMouseOut(sheet, name, data) {

    book.sheet0.cells("imgPreview").setValue("");
}


/**
 * 图片控件中某个图片被双击了
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片被双击)
function imageOnDBLClick(sheet, name, data) {
    var pzh='';
    try{

        pzh = find_pzh(data.id,false).find('.no').text();
    }catch(err)
    {

    }

    if( pzh==undefined) pzh='';

    inputBox("标记为凭证", "", pzh , "输入凭证号码", function (val) {
        if (val == '') {
            var p = find_pzh(data.id, false);
            if (p) p.remove();
        } else {
            find_pzh(data.id, true).find('.no').text(val);
        }

    }, true /*允许为空*/);
}


//@comment (group=,caption=查找或创建凭证号标记对象,needRightControl=false)
function find_pzh(id, create_if_not_exists) {
    var d = $('#' + id);
    if (!d) {
        $.alert(id + "不存在");
        return null;
    }

    var ret = d.find('.pzh');
    if (ret.length == 0) {
        if (create_if_not_exists) //如果需要创建，则创建它
        {
            d.append(`<div class="pzh" ><div class="no"></div><div class="delete_pzh"><i class="fa fa-close" onclick="removePZH('${id}');  event.preventDefault(); event.stopPropagation();"> </i></div></div>`);
        }
        ret = d.find('.pzh');
    }
    return ret;

}

function removePZH(id)
{
     var p = find_pzh(id, false);
     if (p) p.remove();
}


id: 60a7cab45db22d6e34006fa2
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.21 22:59:00.000
script:
function formOpen() {
    book.sheet1.getBrick('imgPool').selectionMode = 'multi'; //图片设置成多选模式

    $(document.body).append(`<style>
                        .pzh {position:absolute;left:0;bottom:0px; 
                                height:24px; line-height:24px;width:100%; 
                                background-color:#40af40a0; 
                                color:white;font-weight:bold;font-size:16px;text-align:center;}

                        .delete_pzh { position:absolute; right:0; width:40px; height:14px; top:0; text-align:right; vertical-align:top; font-size:12px; color:gray;padding-right:5px;}      
                        .delete_pzh:hover { color:white;}      
                          
                        </style>
 `);


    //  let data= loadImagePoolData();
    //  console.dir(data);

}


/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet, name, data) {
    //console.dir(data);
    var url = data.url_img;
    book.sheet0.cells("imgPreview").setValue(url);
}
function imageOnMouseOut(sheet, name, data) {

    book.sheet0.cells("imgPreview").setValue("");
}


/**
 * 图片控件中某个图片被双击了
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片被双击)
function imageOnDBLClick(sheet, name, data) {
    var pzh='';
    try{

        pzh = find_pzh(data.id,false).find('.no').text();
    }catch(err)
    {

    }

    if( pzh==undefined) pzh='';

    inputBox("标记为凭证", "", pzh , "输入凭证号码", function (val) {
        if (val == '') {
            var p = find_pzh(data.id, false);
            if (p) p.remove();
        } else {
            find_pzh(data.id, true).find('.no').text(val);
        }

    }, true /*允许为空*/);
}


//@comment (group=,caption=查找或创建凭证号标记对象,needRightControl=false)
function find_pzh(id, create_if_not_exists) {
    var d = $('#' + id);
    if (!d) {
        $.alert(id + "不存在");
        return null;
    }

    var ret = d.find('.pzh');
    if (ret.length == 0) {
        if (create_if_not_exists) //如果需要创建，则创建它
        {
            d.append(`<div class="pzh" ><div class="no"></div><div class="delete_pzh"><i class="fa fa-close" onclick="removePZH('${id}');  event.preventDefault(); event.stopPropagation();"> </i></div></div>`);
        }
        ret = d.find('.pzh');
    }
    return ret;

}

function removePZH(id)
{
     var p = find_pzh(id, false);
     if (p) p.remove();
}


id: 60a7cab45db22d6e34006fa8
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.22 00:46:41.000
script:
function formOpen() {
    book.sheet1.getBrick('imgPool').selectionMode = 'multi'; //图片设置成多选模式

    $(document.body).append(`<style>
                        .pzh {position:absolute;left:0;bottom:0px; 
                                height:24px; line-height:24px;width:100%; 
                                background-color:#40af40a0; 
                                color:white;font-weight:bold;font-size:16px;text-align:center;}

                        .delete_pzh { position:absolute; right:0; width:40px; height:14px; top:0; text-align:right; vertical-align:top; font-size:12px; color:gray;padding-right:5px;}      
                        .delete_pzh:hover { color:white;}      
                          
                        </style>
 `);


    //  let data= loadImagePoolData();
    //  console.dir(data);

}


/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet, name, data) {
    //console.dir(data);
    var url = data.url_img;
    book.sheet0.cells("imgPreview").setValue(url);
}
function imageOnMouseOut(sheet, name, data) {

    book.sheet0.cells("imgPreview").setValue("");
}


/**
 * 图片控件中某个图片被双击了
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片被双击)
function imageOnDBLClick(sheet, name, data) {
    var pzh='';
    try{

        pzh = find_pzh(data.id,false).find('.no').text();
    }catch(err)
    {

    }

    if( pzh==undefined) pzh='';

    inputBox("标记为凭证", "", pzh , "输入凭证号码", function (val) {
        if (val == '') {
            var p = find_pzh(data.id, false);
            if (p) p.remove();
        } else {
            find_pzh(data.id, true).find('.no').text(val);
        }

    }, true /*允许为空*/);
}


//@comment (group=,caption=查找或创建凭证号标记对象,needRightControl=false)
function find_pzh(id, create_if_not_exists) {
    var d = $('#' + id);
    if (!d) {
        $.alert(id + "不存在");
        return null;
    }

    var ret = d.find('.pzh');
    if (ret.length == 0) {
        if (create_if_not_exists) //如果需要创建，则创建它
        {
            d.append(`<div class="pzh" ><div class="no"></div><div class="delete_pzh"><i class="fa fa-close" onclick="removePZH('${id}');  event.preventDefault(); event.stopPropagation();"> </i></div></div>`);
        }
        ret = d.find('.pzh');
    }
    return ret;

}

function removePZH(id)
{
     var p = find_pzh(id, false);
     if (p) p.remove();
}

function cb_selectAll_onClick()
{
    book.sheet1.getBrick('imgPool').selectAll();
}


function cb_selectnull_onClick()
{
    book.sheet1.getBrick('imgPool').unSelectAll();
}


id: 60a7cab45db22d6e34006fae
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.22 00:49:58.000
script:
function formOpen() {
    book.sheet1.getBrick('imgPool').selectionMode = 'multi'; //图片设置成多选模式

    $(document.body).append(`<style>
                        .pzh {position:absolute;left:0;bottom:0px; 
                                height:24px; line-height:24px;width:100%; 
                                background-color:#40af40a0; 
                                color:white;font-weight:bold;font-size:16px;text-align:center;}

                        .delete_pzh { position:absolute; right:0; width:40px; height:14px; top:0; text-align:right; vertical-align:top; font-size:12px; color:gray;padding-right:5px;}      
                        .delete_pzh:hover { color:white;}      
                          
                        </style>
 `);


    //  let data= loadImagePoolData();
    //  console.dir(data);

}


/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet, name, data) {
    //console.dir(data);
    var url = data.url_img;
    book.sheet0.cells("imgPreview").setValue(url);
}
function imageOnMouseOut(sheet, name, data) {

    book.sheet0.cells("imgPreview").setValue("");
}


/**
 * 图片控件中某个图片被双击了
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片被双击)
function imageOnDBLClick(sheet, name, data) {
    var pzh='';
    try{

        pzh = find_pzh(data.id,false).find('.no').text();
    }catch(err)
    {

    }

    if( pzh==undefined) pzh='';

    inputBox("标记为凭证", "", pzh , "输入凭证号码", function (val) {
        if (val == '') {
            var p = find_pzh(data.id, false);
            if (p) p.remove();
        } else {
            find_pzh(data.id, true).find('.no').text(val);
        }

    }, true /*允许为空*/);
}


//@comment (group=,caption=查找或创建凭证号标记对象,needRightControl=false)
function find_pzh(id, create_if_not_exists) {
    var d = $('#' + id);
    if (!d) {
        $.alert(id + "不存在");
        return null;
    }

    var ret = d.find('.pzh');
    if (ret.length == 0) {
        if (create_if_not_exists) //如果需要创建，则创建它
        {
            d.append(`<div class="pzh" ><div class="no"></div><div class="delete_pzh"><i class="fa fa-close" onclick="removePZH('${id}');  event.preventDefault(); event.stopPropagation();"> </i></div></div>`);
        }
        ret = d.find('.pzh');
    }
    return ret;

}

function removePZH(id)
{
     var p = find_pzh(id, false);
     if (p) p.remove();
}

function cb_selectall_onClick()
{
    book.sheet1.getBrick('imgPool').selectAll();
}


function cb_selectnull_onClick()
{
    book.sheet1.getBrick('imgPool').unSelectAll();
}


id: 60a867ecefb25942c0f22047
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.22 10:40:17.000
script:
function formOpen() {
    book.sheet1.getBrick('imgPool').selectionMode = 'multi'; //图片设置成多选模式

    $(document.body).append(`<style>
                        .pzh {position:absolute;left:0;bottom:0px; 
                                height:24px; line-height:24px;width:100%; 
                                background-color:#40af40a0; 
                                color:white;font-weight:bold;font-size:16px;text-align:center;}

                        .delete_pzh { position:absolute; right:0; width:40px; height:14px; top:0; text-align:right; vertical-align:top; font-size:12px; color:gray;padding-right:5px;}      
                        .delete_pzh:hover { color:white;}      
                          
                        </style>
 `);


    //  let data= loadImagePoolData();
    //  console.dir(data);

}


/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet, name, data) {
    //console.dir(data);
    var url = data.url_img;
    book.sheet0.cells("imgPreview").setValue(url);
}
function imageOnMouseOut(sheet, name, data) {

    book.sheet0.cells("imgPreview").setValue("");
}


/**
 * 图片控件中某个图片被双击了
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片被双击)
function imageOnDBLClick(sheet, name, data) {

    setTimeout( function(){
    var url = data.url_img;
    book.sheet0.cells("imgPreview").setValue(url);
    },200);
    
    var pzh='';
    try{

        pzh = find_pzh(data.id,false).find('.no').text();
    }catch(err)
    {

    }

    if( pzh==undefined) pzh='';

    inputBox("标记为凭证", "", pzh , "输入凭证号码", function (val) {
        if (val == '') {
            var p = find_pzh(data.id, false);
            if (p) p.remove();
        } else {
            find_pzh(data.id, true).find('.no').text(val);
        }

    }, true /*允许为空*/);
}


//@comment (group=,caption=查找或创建凭证号标记对象,needRightControl=false)
function find_pzh(id, create_if_not_exists) {
    var d = $('#' + id);
    if (!d) {
        $.alert(id + "不存在");
        return null;
    }

    var ret = d.find('.pzh');
    if (ret.length == 0) {
        if (create_if_not_exists) //如果需要创建，则创建它
        {
            d.append(`<div class="pzh" ><div class="no"></div><div class="delete_pzh"><i class="fa fa-close" onclick="removePZH('${id}');  event.preventDefault(); event.stopPropagation();"> </i></div></div>`);
        }
        ret = d.find('.pzh');
    }
    return ret;

}

function removePZH(id)
{
     var p = find_pzh(id, false);
     if (p) p.remove();
}

function cb_selectall_onClick()
{
    book.sheet1.getBrick('imgPool').selectAll();
}


function cb_selectnull_onClick()
{
    book.sheet1.getBrick('imgPool').unSelectAll();
}


id: 60a867ecefb25942c0f2204d
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.22 10:40:56.000
script:
function formOpen() {
    book.sheet1.getBrick('imgPool').selectionMode = 'multi'; //图片设置成多选模式

    $(document.body).append(`<style>
                        .pzh {position:absolute;left:0;bottom:0px; 
                                height:24px; line-height:24px;width:100%; 
                                background-color:#40af40a0; 
                                color:white;font-weight:bold;font-size:16px;text-align:center;}

                        .delete_pzh { position:absolute; right:0; width:40px; height:14px; top:0; text-align:right; vertical-align:top; font-size:12px; color:gray;padding-right:5px;}      
                        .delete_pzh:hover { color:white;}      
                          
                        </style>
 `);


    //  let data= loadImagePoolData();
    //  console.dir(data);

}


/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet, name, data) {
    //console.dir(data);
    var url = data.url_img;
    book.sheet0.cells("imgPreview").setValue(url);
}
function imageOnMouseOut(sheet, name, data) {

    book.sheet0.cells("imgPreview").setValue("");
}


/**
 * 图片控件中某个图片被双击了
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片被双击)
function imageOnDBLClick(sheet, name, data) {

    //因为 mouseOut 会把大图清除掉，所以这里重新再设置上
    setTimeout( function(){
    var url = data.url_img;
    book.sheet0.cells("imgPreview").setValue(url);
    },200);

    var pzh='';
    try{

        pzh = find_pzh(data.id,false).find('.no').text();
    }catch(err)
    {

    }

    if( pzh==undefined) pzh='';

    inputBox("标记为凭证", "", pzh , "输入凭证号码", function (val) {
        if (val == '') {
            var p = find_pzh(data.id, false);
            if (p) p.remove();
        } else {
            find_pzh(data.id, true).find('.no').text(val);
        }

    }, true /*允许为空*/);
}


//@comment (group=,caption=查找或创建凭证号标记对象,needRightControl=false)
function find_pzh(id, create_if_not_exists) {
    var d = $('#' + id);
    if (!d) {
        $.alert(id + "不存在");
        return null;
    }

    var ret = d.find('.pzh');
    if (ret.length == 0) {
        if (create_if_not_exists) //如果需要创建，则创建它
        {
            d.append(`<div class="pzh" ><div class="no"></div><div class="delete_pzh"><i class="fa fa-close" onclick="removePZH('${id}');  event.preventDefault(); event.stopPropagation();"> </i></div></div>`);
        }
        ret = d.find('.pzh');
    }
    return ret;

}

function removePZH(id)
{
     var p = find_pzh(id, false);
     if (p) p.remove();
}

function cb_selectall_onClick()
{
    book.sheet1.getBrick('imgPool').selectAll();
}


function cb_selectnull_onClick()
{
    book.sheet1.getBrick('imgPool').unSelectAll();
}


id: 60a867ecefb25942c0f22053
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.22 10:47:07.000
script:
function formOpen() {
    book.sheet1.getBrick('imgPool').selectionMode = 'multi'; //图片设置成多选模式

    $(document.body).append(`<style>
                        .pzh {position:absolute;left:0;bottom:0px; 
                                height:24px; line-height:24px;width:100%; 
                                background-color:#40af40a0; 
                                color:white;font-weight:bold;font-size:16px;text-align:center;}

                        .delete_pzh { position:absolute; right:0; width:40px; height:14px; top:0; text-align:right; vertical-align:top; font-size:12px; color:gray;padding-right:5px;}      
                        .delete_pzh:hover { color:white;}      
                          
                        </style>
 `);


    //  let data= loadImagePoolData();
    //  console.dir(data);

}


/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet, name, data) {
    //console.dir(data);
    var url = data.url_img;
    book.sheet0.cells("imgPreview").setValue(url);
}
function imageOnMouseOut(sheet, name, data) {

    book.sheet0.cells("imgPreview").setValue("");
}


/**
 * 图片控件中某个图片被双击了
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片被双击)
function imageOnDBLClick(sheet, name, data) {

    //因为 mouseOut 会把大图清除掉，所以这里重新再设置上
    setTimeout( function(){
    var url = data.url_img;
    book.sheet0.cells("imgPreview").setValue(url);
    book.sheet1.getBrick("imgPool").setImageSelected( data.id , true); 
    },200);

    var pzh='';
    try{

        pzh = find_pzh(data.id,false).find('.no').text();
    }catch(err)
    {

    }

    if( pzh==undefined) pzh='';

    inputBox("标记为凭证", "", pzh , "输入凭证号码", function (val) {
        if (val == '') {
            var p = find_pzh(data.id, false);
            if (p) p.remove();
        } else {
            find_pzh(data.id, true).find('.no').text(val);
        }

    }, true /*允许为空*/);
}


//@comment (group=,caption=查找或创建凭证号标记对象,needRightControl=false)
function find_pzh(id, create_if_not_exists) {
    var d = $('#' + id);
    if (!d) {
        $.alert(id + "不存在");
        return null;
    }

    var ret = d.find('.pzh');
    if (ret.length == 0) {
        if (create_if_not_exists) //如果需要创建，则创建它
        {
            d.append(`<div class="pzh" ><div class="no"></div><div class="delete_pzh"><i class="fa fa-close" onclick="removePZH('${id}');  event.preventDefault(); event.stopPropagation();"> </i></div></div>`);
        }
        ret = d.find('.pzh');
    }
    return ret;

}

function removePZH(id)
{
     var p = find_pzh(id, false);
     if (p) p.remove();
}

function cb_selectall_onClick()
{
    book.sheet1.getBrick('imgPool').selectAll();
}


function cb_selectnull_onClick()
{
    book.sheet1.getBrick('imgPool').unSelectAll();
}


id: 60a867ecefb25942c0f22059
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.22 10:47:56.000
script:
function formOpen() {
    book.sheet1.getBrick('imgPool').selectionMode = 'multi'; //图片设置成多选模式

    $(document.body).append(`<style>
                        .pzh {position:absolute;left:0;bottom:0px; 
                                height:24px; line-height:24px;width:100%; 
                                background-color:#40af40a0; 
                                color:white;font-weight:bold;font-size:16px;text-align:center;}

                        .delete_pzh { position:absolute; right:0; width:40px; height:14px; top:0; text-align:right; vertical-align:top; font-size:12px; color:gray;padding-right:5px;}      
                        .delete_pzh:hover { color:white;}      
                          
                        </style>
 `);


    //  let data= loadImagePoolData();
    //  console.dir(data);

}


/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet, name, data) {
    //console.dir(data);
    var url = data.url_img;
    book.sheet0.cells("imgPreview").setValue(url);
}
function imageOnMouseOut(sheet, name, data) {

    book.sheet0.cells("imgPreview").setValue("");
}


/**
 * 图片控件中某个图片被双击了
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片被双击)
function imageOnDBLClick(sheet, name, data) {

    //因为 mouseOut 会把大图清除掉，所以这里重新再设置上
    setTimeout( function(){
    var url = data.url_img;
    book.sheet0.cells("imgPreview").setValue(url);
   
    },200);

    var pzh='';
    try{

        pzh = find_pzh(data.id,false).find('.no').text();
    }catch(err)
    {

    }

    if( pzh==undefined) pzh='';

    inputBox("标记为凭证", "", pzh , "输入凭证号码", function (val) {
        if (val == '') {
            var p = find_pzh(data.id, false);
            if (p) p.remove();
             book.sheet1.getBrick("imgPool").setImageSelected( data.id , false); 
        } else {
            find_pzh(data.id, true).find('.no').text(val);
             book.sheet1.getBrick("imgPool").setImageSelected( data.id , true); 
        }

    }, true /*允许为空*/);
}


//@comment (group=,caption=查找或创建凭证号标记对象,needRightControl=false)
function find_pzh(id, create_if_not_exists) {
    var d = $('#' + id);
    if (!d) {
        $.alert(id + "不存在");
        return null;
    }

    var ret = d.find('.pzh');
    if (ret.length == 0) {
        if (create_if_not_exists) //如果需要创建，则创建它
        {
            d.append(`<div class="pzh" ><div class="no"></div><div class="delete_pzh"><i class="fa fa-close" onclick="removePZH('${id}');  event.preventDefault(); event.stopPropagation();"> </i></div></div>`);
        }
        ret = d.find('.pzh');
    }
    return ret;

}

function removePZH(id)
{
     var p = find_pzh(id, false);
     if (p) p.remove();
}

function cb_selectall_onClick()
{
    book.sheet1.getBrick('imgPool').selectAll();
}


function cb_selectnull_onClick()
{
    book.sheet1.getBrick('imgPool').unSelectAll();
}


id: 60a867ecefb25942c0f2205f
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.22 10:52:17.000
script:
function formOpen() {
    book.sheet1.getBrick('imgPool').selectionMode = 'multi'; //图片设置成多选模式

    $(document.body).append(`<style>
                        .pzh {position:absolute;left:0;bottom:0px; 
                                height:24px; line-height:24px;width:100%; 
                                background-color:#40af40a0; 
                                color:white;font-weight:bold;font-size:16px;text-align:center;}

                        .delete_pzh { position:absolute; right:0; width:40px; height:14px; top:0; text-align:right; vertical-align:top; font-size:12px; color:gray;padding-right:5px;}      
                        .delete_pzh:hover { color:white;}      
                          
                        </style>
 `);


    //  let data= loadImagePoolData();
    //  console.dir(data);

}


/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet, name, data) {
    //console.dir(data);
    var url = data.url_img;
    book.sheet0.cells("imgPreview").setValue(url);
}
function imageOnMouseOut(sheet, name, data) {

    book.sheet0.cells("imgPreview").setValue("");
}


/**
 * 图片控件中某个图片被双击了
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片被双击)
function imageOnDBLClick(sheet, name, data) {

    //因为 mouseOut 会把大图清除掉，所以这里重新再设置上
    setTimeout( function(){
    var url = data.url_img;
    book.sheet0.cells("imgPreview").setValue(url);
   
    },200);

    var pzh='';
    try{

        pzh = find_pzh(data.id,false).find('.no').text();
    }catch(err)
    {

    }

    if( pzh==undefined) pzh='';

    inputBox("标记为凭证", "", pzh , "输入凭证号码", function (val) {
        if (val == '') {
            var p = find_pzh(data.id, false);
            if (p) p.remove();
             book.sheet1.getBrick("imgPool").setImageSelected( data.id , false); 
        } else {
            find_pzh(data.id, true).find('.no').text(val);
             book.sheet1.getBrick("imgPool").setImageSelected( data.id , true); 
        }

    }, true /*允许为空*/);
}


//@comment (group=,caption=查找或创建凭证号标记对象,needRightControl=false)
function find_pzh(id, create_if_not_exists) {
    var d = $('#' + id);
    if (!d) {
        $.alert(id + "不存在");
        return null;
    }

    var ret = d.find('.pzh');
    if (ret.length == 0) {
        if (create_if_not_exists) //如果需要创建，则创建它
        {
            d.append(`<div class="pzh" ><div class="no"></div><div class="delete_pzh"><i class="fa fa-close" onclick="removePZH('${id}');  event.preventDefault(); event.stopPropagation();"> </i></div></div>`);
        }
        ret = d.find('.pzh');
    }
    return ret;

}

function removePZH(id)
{
     var p = find_pzh(id, false);
     if (p) p.remove();
}

function cb_selectall_onClick()
{
    var imgPool=  book.sheet1.getBrick('imgPool');
    if( imgPool.getSelectedImageList().length==0)
    {
        imgPool.selectAll();
    }else{
        imgPool.unSelectAll();
    }
}


id: 60a867ecefb25942c0f22065
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.22 12:50:24.000
script:
function formOpen() {
    book.sheet1.getBrick('imgPool').selectionMode = 'multi'; //图片设置成多选模式

    $(document.body).append(`<style>
                        .pzh {position:absolute;left:0;bottom:0px; 
                                height:24px; line-height:24px;width:100%; 
                                background-color:#40af40a0; 
                                color:white;font-weight:bold;font-size:16px;text-align:center;}

                        .delete_pzh { position:absolute; right:0; width:40px; height:14px; top:0; text-align:right; vertical-align:top; font-size:12px; color:gray;padding-right:5px;}      
                        .delete_pzh:hover { color:white;}      
                          
                        </style>
 `);


    //  let data= loadImagePoolData();
    //  console.dir(data);

    $('#blockSize').on('change', function()
    {
        let v= $('#blockSize').val();
        var imgPool=  book.sheet1.getBrick('imgPool');
        imgPool.blockSize= v; 
        imgPool.rebuildGridly();
    });

}


/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet, name, data) {
    //console.dir(data);
    var url = data.url_img;
    book.sheet0.cells("imgPreview").setValue(url);
}
function imageOnMouseOut(sheet, name, data) {

    book.sheet0.cells("imgPreview").setValue("");
}


/**
 * 图片控件中某个图片被双击了
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片被双击)
function imageOnDBLClick(sheet, name, data) {

    //因为 mouseOut 会把大图清除掉，所以这里重新再设置上
    setTimeout( function(){
    var url = data.url_img;
    book.sheet0.cells("imgPreview").setValue(url);
   
    },200);

    var pzh='';
    try{

        pzh = find_pzh(data.id,false).find('.no').text();
    }catch(err)
    {

    }

    if( pzh==undefined) pzh='';

    inputBox("标记为凭证", "", pzh , "输入凭证号码", function (val) {
        if (val == '') {
            var p = find_pzh(data.id, false);
            if (p) p.remove();
             book.sheet1.getBrick("imgPool").setImageSelected( data.id , false); 
        } else {
            find_pzh(data.id, true).find('.no').text(val);
             book.sheet1.getBrick("imgPool").setImageSelected( data.id , true); 
        }

    }, true /*允许为空*/);
}


//@comment (group=,caption=查找或创建凭证号标记对象,needRightControl=false)
function find_pzh(id, create_if_not_exists) {
    var d = $('#' + id);
    if (!d) {
        $.alert(id + "不存在");
        return null;
    }

    var ret = d.find('.pzh');
    if (ret.length == 0) {
        if (create_if_not_exists) //如果需要创建，则创建它
        {
            d.append(`<div class="pzh" ><div class="no"></div><div class="delete_pzh"><i class="fa fa-close" onclick="removePZH('${id}');  event.preventDefault(); event.stopPropagation();"> </i></div></div>`);
        }
        ret = d.find('.pzh');
    }
    return ret;

}

function removePZH(id)
{
     var p = find_pzh(id, false);
     if (p) p.remove();
}

function cb_selectall_onClick()
{
    var imgPool=  book.sheet1.getBrick('imgPool');
    if( imgPool.getSelectedImageList().length==0)
    {
        imgPool.selectAll();
    }else{
        imgPool.unSelectAll();
    }
}


id: 60a867ecefb25942c0f2206b
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.22 12:52:07.000
script:
function formOpen() {
    book.sheet1.getBrick('imgPool').selectionMode = 'multi'; //图片设置成多选模式

    $(document.body).append(`<style>
                        .pzh {position:absolute;left:0;bottom:0px; 
                                height:24px; line-height:24px;width:100%; 
                                background-color:#40af40a0; 
                                color:white;font-weight:bold;font-size:16px;text-align:center;}

                        .delete_pzh { position:absolute; right:0; width:40px; height:14px; top:0; text-align:right; vertical-align:top; font-size:12px; color:gray;padding-right:5px;}      
                        .delete_pzh:hover { color:white;}      
                          
                        </style>
 `);


    //  let data= loadImagePoolData();
    //  console.dir(data);

    $('#blockSize').on('change', function()
    {
        let v= $('#blockSize').val();
        var imgPool=  book.sheet1.getBrick('imgPool');
        imgPool.config.blockSize= v; 
        imgPool.rebuildGridly();
    });

}


/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet, name, data) {
    //console.dir(data);
    var url = data.url_img;
    book.sheet0.cells("imgPreview").setValue(url);
}
function imageOnMouseOut(sheet, name, data) {

    book.sheet0.cells("imgPreview").setValue("");
}


/**
 * 图片控件中某个图片被双击了
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片被双击)
function imageOnDBLClick(sheet, name, data) {

    //因为 mouseOut 会把大图清除掉，所以这里重新再设置上
    setTimeout( function(){
    var url = data.url_img;
    book.sheet0.cells("imgPreview").setValue(url);
   
    },200);

    var pzh='';
    try{

        pzh = find_pzh(data.id,false).find('.no').text();
    }catch(err)
    {

    }

    if( pzh==undefined) pzh='';

    inputBox("标记为凭证", "", pzh , "输入凭证号码", function (val) {
        if (val == '') {
            var p = find_pzh(data.id, false);
            if (p) p.remove();
             book.sheet1.getBrick("imgPool").setImageSelected( data.id , false); 
        } else {
            find_pzh(data.id, true).find('.no').text(val);
             book.sheet1.getBrick("imgPool").setImageSelected( data.id , true); 
        }

    }, true /*允许为空*/);
}


//@comment (group=,caption=查找或创建凭证号标记对象,needRightControl=false)
function find_pzh(id, create_if_not_exists) {
    var d = $('#' + id);
    if (!d) {
        $.alert(id + "不存在");
        return null;
    }

    var ret = d.find('.pzh');
    if (ret.length == 0) {
        if (create_if_not_exists) //如果需要创建，则创建它
        {
            d.append(`<div class="pzh" ><div class="no"></div><div class="delete_pzh"><i class="fa fa-close" onclick="removePZH('${id}');  event.preventDefault(); event.stopPropagation();"> </i></div></div>`);
        }
        ret = d.find('.pzh');
    }
    return ret;

}

function removePZH(id)
{
     var p = find_pzh(id, false);
     if (p) p.remove();
}

function cb_selectall_onClick()
{
    var imgPool=  book.sheet1.getBrick('imgPool');
    if( imgPool.getSelectedImageList().length==0)
    {
        imgPool.selectAll();
    }else{
        imgPool.unSelectAll();
    }
}


id: 60a867ecefb25942c0f22071
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.22 12:56:56.000
script:
function formOpen() {
    book.sheet1.getBrick('imgPool').selectionMode = 'multi'; //图片设置成多选模式

    $(document.body).append(`<style>
                        .pzh {position:absolute;left:0;bottom:0px; 
                                height:24px; line-height:24px;width:100%; 
                                background-color:#40af40a0; 
                                color:white;font-weight:bold;font-size:16px;text-align:center;}

                        .delete_pzh { position:absolute; right:0; width:40px; height:14px; top:0; text-align:right; vertical-align:top; font-size:12px; color:gray;padding-right:5px;}      
                        .delete_pzh:hover { color:white;}      
                          
                        </style>
 `);


    //  let data= loadImagePoolData();
    //  console.dir(data);

    $('#blockSize').on('change', function()
    {
        let v= $('#blockSize').val();
        var imgPool=  book.sheet1.getBrick('imgPool');
        imgPool.config.blockSize= parseInt(v); 
        imgPool.rebuildGridly();
    });

}


/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet, name, data) {
    //console.dir(data);
    var url = data.url_img;
    book.sheet0.cells("imgPreview").setValue(url);
}
function imageOnMouseOut(sheet, name, data) {

    book.sheet0.cells("imgPreview").setValue("");
}


/**
 * 图片控件中某个图片被双击了
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片被双击)
function imageOnDBLClick(sheet, name, data) {

    //因为 mouseOut 会把大图清除掉，所以这里重新再设置上
    setTimeout( function(){
    var url = data.url_img;
    book.sheet0.cells("imgPreview").setValue(url);
   
    },200);

    var pzh='';
    try{

        pzh = find_pzh(data.id,false).find('.no').text();
    }catch(err)
    {

    }

    if( pzh==undefined) pzh='';

    inputBox("标记为凭证", "", pzh , "输入凭证号码", function (val) {
        if (val == '') {
            var p = find_pzh(data.id, false);
            if (p) p.remove();
             book.sheet1.getBrick("imgPool").setImageSelected( data.id , false); 
        } else {
            find_pzh(data.id, true).find('.no').text(val);
             book.sheet1.getBrick("imgPool").setImageSelected( data.id , true); 
        }

    }, true /*允许为空*/);
}


//@comment (group=,caption=查找或创建凭证号标记对象,needRightControl=false)
function find_pzh(id, create_if_not_exists) {
    var d = $('#' + id);
    if (!d) {
        $.alert(id + "不存在");
        return null;
    }

    var ret = d.find('.pzh');
    if (ret.length == 0) {
        if (create_if_not_exists) //如果需要创建，则创建它
        {
            d.append(`<div class="pzh" ><div class="no"></div><div class="delete_pzh"><i class="fa fa-close" onclick="removePZH('${id}');  event.preventDefault(); event.stopPropagation();"> </i></div></div>`);
        }
        ret = d.find('.pzh');
    }
    return ret;

}

function removePZH(id)
{
     var p = find_pzh(id, false);
     if (p) p.remove();
}

function cb_selectall_onClick()
{
    var imgPool=  book.sheet1.getBrick('imgPool');
    if( imgPool.getSelectedImageList().length==0)
    {
        imgPool.selectAll();
    }else{
        imgPool.unSelectAll();
    }
}


id: 60a867ecefb25942c0f22077
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.22 12:59:00.000
script:
function formOpen() {
    book.sheet1.getBrick('imgPool').selectionMode = 'multi'; //图片设置成多选模式

    $(document.body).append(`<style>
                        .pzh {position:absolute;left:0;bottom:0px; 
                                height:24px; line-height:24px;width:100%; 
                                background-color:#40af40a0; 
                                color:white;font-weight:bold;font-size:16px;text-align:center;}

                        .delete_pzh { position:absolute; right:0; width:40px; height:14px; top:0; text-align:right; vertical-align:top; font-size:12px; color:gray;padding-right:5px;}      
                        .delete_pzh:hover { color:white;}      
                          
                        </style>
 `);


    //  let data= loadImagePoolData();
    //  console.dir(data);

    $('#blockSize').on('input', function()
    {
        let v= $('#blockSize').val();
        var imgPool=  book.sheet1.getBrick('imgPool');
        imgPool.config.blockSize= parseInt(v); 
        imgPool.rebuildGridly();
    });

}


/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet, name, data) {
    //console.dir(data);
    var url = data.url_img;
    book.sheet0.cells("imgPreview").setValue(url);
}
function imageOnMouseOut(sheet, name, data) {

    book.sheet0.cells("imgPreview").setValue("");
}


/**
 * 图片控件中某个图片被双击了
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片被双击)
function imageOnDBLClick(sheet, name, data) {

    //因为 mouseOut 会把大图清除掉，所以这里重新再设置上
    setTimeout( function(){
    var url = data.url_img;
    book.sheet0.cells("imgPreview").setValue(url);
   
    },200);

    var pzh='';
    try{

        pzh = find_pzh(data.id,false).find('.no').text();
    }catch(err)
    {

    }

    if( pzh==undefined) pzh='';

    inputBox("标记为凭证", "", pzh , "输入凭证号码", function (val) {
        if (val == '') {
            var p = find_pzh(data.id, false);
            if (p) p.remove();
             book.sheet1.getBrick("imgPool").setImageSelected( data.id , false); 
        } else {
            find_pzh(data.id, true).find('.no').text(val);
             book.sheet1.getBrick("imgPool").setImageSelected( data.id , true); 
        }

    }, true /*允许为空*/);
}


//@comment (group=,caption=查找或创建凭证号标记对象,needRightControl=false)
function find_pzh(id, create_if_not_exists) {
    var d = $('#' + id);
    if (!d) {
        $.alert(id + "不存在");
        return null;
    }

    var ret = d.find('.pzh');
    if (ret.length == 0) {
        if (create_if_not_exists) //如果需要创建，则创建它
        {
            d.append(`<div class="pzh" ><div class="no"></div><div class="delete_pzh"><i class="fa fa-close" onclick="removePZH('${id}');  event.preventDefault(); event.stopPropagation();"> </i></div></div>`);
        }
        ret = d.find('.pzh');
    }
    return ret;

}

function removePZH(id)
{
     var p = find_pzh(id, false);
     if (p) p.remove();
}

function cb_selectall_onClick()
{
    var imgPool=  book.sheet1.getBrick('imgPool');
    if( imgPool.getSelectedImageList().length==0)
    {
        imgPool.selectAll();
    }else{
        imgPool.unSelectAll();
    }
}


id: 60a8932defb25942c0f22081
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.22 13:15:53.000
script:
function formOpen() {
    book.sheet1.getBrick('imgPool').selectionMode = 'multi'; //图片设置成多选模式

    $(document.body).append(`<style>
                        .pzh {position:absolute;left:0;bottom:0px; 
                                height:24px; line-height:24px;width:100%; 
                                background-color:#40af40a0; 
                                color:white;font-weight:bold;font-size:16px;text-align:center;}

                        .delete_pzh { position:absolute; right:0; width:40px; height:14px; top:0; text-align:right; vertical-align:top; font-size:12px; color:gray;padding-right:5px;}      
                        .delete_pzh:hover { color:white;}      
                          
                        </style>
 `);


    //  let data= loadImagePoolData();
    //  console.dir(data);

    let blockSizeChangedTimeID = 0;
    $('#blockSize').on('input', function () {
        clearTimeout(blockSizeChangedTimeID);
        blockSizeChangedTimeID = setTimeout(function () {
            let v = $('#blockSize').val();
            var imgPool = book.sheet1.getBrick('imgPool');
            imgPool.config.blockSize = parseInt(v);
            imgPool.rebuildGridly();
        }, 200);
    });

}


/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet, name, data) {
    //console.dir(data);
    var url = data.url_img;
    book.sheet0.cells("imgPreview").setValue(url);
}
function imageOnMouseOut(sheet, name, data) {

    book.sheet0.cells("imgPreview").setValue("");
}


/**
 * 图片控件中某个图片被双击了
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片被双击)
function imageOnDBLClick(sheet, name, data) {

    //因为 mouseOut 会把大图清除掉，所以这里重新再设置上
    setTimeout(function () {
        var url = data.url_img;
        book.sheet0.cells("imgPreview").setValue(url);

    }, 200);

    var pzh = '';
    try {

        pzh = find_pzh(data.id, false).find('.no').text();
    } catch (err) {

    }

    if (pzh == undefined) pzh = '';

    inputBox("标记为凭证", "", pzh, "输入凭证号码", function (val) {
        if (val == '') {
            var p = find_pzh(data.id, false);
            if (p) p.remove();
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, false);
        } else {
            find_pzh(data.id, true).find('.no').text(val);
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, true);
        }

    }, true /*允许为空*/);
}


//@comment (group=,caption=查找或创建凭证号标记对象,needRightControl=false)
function find_pzh(id, create_if_not_exists) {
    var d = $('#' + id);
    if (!d) {
        $.alert(id + "不存在");
        return null;
    }

    var ret = d.find('.pzh');
    if (ret.length == 0) {
        if (create_if_not_exists) //如果需要创建，则创建它
        {
            d.append(`<div class="pzh" ><div class="no"></div><div class="delete_pzh"><i class="fa fa-close" onclick="removePZH('${id}');  event.preventDefault(); event.stopPropagation();"> </i></div></div>`);
        }
        ret = d.find('.pzh');
    }
    return ret;

}

function removePZH(id) {
    var p = find_pzh(id, false);
    if (p) p.remove();
}

function cb_selectall_onClick() {
    var imgPool = book.sheet1.getBrick('imgPool');
    if (imgPool.getSelectedImageList().length == 0) {
        imgPool.selectAll();
    } else {
        imgPool.unSelectAll();
    }
}


id: 60a8932defb25942c0f22087
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.22 13:16:40.000
script:
function formOpen() {
    book.sheet1.getBrick('imgPool').selectionMode = 'multi'; //图片设置成多选模式

    $(document.body).append(`<style>
                        .pzh {position:absolute;left:0;bottom:0px; 
                                height:24px; line-height:24px;width:100%; 
                                background-color:#40af40a0; 
                                color:white;font-weight:bold;font-size:16px;text-align:center;}

                        .delete_pzh { position:absolute; right:0; width:40px; height:14px; top:0; text-align:right; vertical-align:top; font-size:12px; color:gray;padding-right:5px;}      
                        .delete_pzh:hover { color:white;}      
                          
                        </style>
 `);


    //  let data= loadImagePoolData();
    //  console.dir(data);

    
    $('#blockSize').on('change', function () {
       
            let v = $('#blockSize').val();
            var imgPool = book.sheet1.getBrick('imgPool');
            imgPool.config.blockSize = parseInt(v);
            imgPool.rebuildGridly();
        
    });

}


/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet, name, data) {
    //console.dir(data);
    var url = data.url_img;
    book.sheet0.cells("imgPreview").setValue(url);
}
function imageOnMouseOut(sheet, name, data) {

    book.sheet0.cells("imgPreview").setValue("");
}


/**
 * 图片控件中某个图片被双击了
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片被双击)
function imageOnDBLClick(sheet, name, data) {

    //因为 mouseOut 会把大图清除掉，所以这里重新再设置上
    setTimeout(function () {
        var url = data.url_img;
        book.sheet0.cells("imgPreview").setValue(url);

    }, 200);

    var pzh = '';
    try {

        pzh = find_pzh(data.id, false).find('.no').text();
    } catch (err) {

    }

    if (pzh == undefined) pzh = '';

    inputBox("标记为凭证", "", pzh, "输入凭证号码", function (val) {
        if (val == '') {
            var p = find_pzh(data.id, false);
            if (p) p.remove();
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, false);
        } else {
            find_pzh(data.id, true).find('.no').text(val);
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, true);
        }

    }, true /*允许为空*/);
}


//@comment (group=,caption=查找或创建凭证号标记对象,needRightControl=false)
function find_pzh(id, create_if_not_exists) {
    var d = $('#' + id);
    if (!d) {
        $.alert(id + "不存在");
        return null;
    }

    var ret = d.find('.pzh');
    if (ret.length == 0) {
        if (create_if_not_exists) //如果需要创建，则创建它
        {
            d.append(`<div class="pzh" ><div class="no"></div><div class="delete_pzh"><i class="fa fa-close" onclick="removePZH('${id}');  event.preventDefault(); event.stopPropagation();"> </i></div></div>`);
        }
        ret = d.find('.pzh');
    }
    return ret;

}

function removePZH(id) {
    var p = find_pzh(id, false);
    if (p) p.remove();
}

function cb_selectall_onClick() {
    var imgPool = book.sheet1.getBrick('imgPool');
    if (imgPool.getSelectedImageList().length == 0) {
        imgPool.selectAll();
    } else {
        imgPool.unSelectAll();
    }
}


id: 60a8932defb25942c0f2208d
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.22 13:25:18.000
script:
function formOpen() {
    book.sheet1.getBrick('imgPool').selectionMode = 'multi'; //图片设置成多选模式

    $(document.body).append(`<style>
                        .pzh {position:absolute;left:0;bottom:0px; 
                                height:24px; line-height:24px;width:100%; 
                                background-color:#40af40a0; 
                                color:white;font-weight:bold;font-size:16px;text-align:center;}

                        .delete_pzh { position:absolute; right:0; width:40px; height:14px; top:0; text-align:right; vertical-align:top; font-size:12px; color:gray;padding-right:5px;}      
                        .delete_pzh:hover { color:white;}      
                          
                        </style>
 `);


    //  let data= loadImagePoolData();
    //  console.dir(data);

    
    $('#blockSize').on('input', function () {
       
            let v = $('#blockSize').val();
            var imgPool = book.sheet1.getBrick('imgPool');
            imgPool.config.blockSize = parseInt(v);
            imgPool.rebuildGridly();
        
    });

}


/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet, name, data) {
    //console.dir(data);
    var url = data.url_img;
    book.sheet0.cells("imgPreview").setValue(url);
}
function imageOnMouseOut(sheet, name, data) {

    book.sheet0.cells("imgPreview").setValue("");
}


/**
 * 图片控件中某个图片被双击了
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片被双击)
function imageOnDBLClick(sheet, name, data) {

    //因为 mouseOut 会把大图清除掉，所以这里重新再设置上
    setTimeout(function () {
        var url = data.url_img;
        book.sheet0.cells("imgPreview").setValue(url);

    }, 200);

    var pzh = '';
    try {

        pzh = find_pzh(data.id, false).find('.no').text();
    } catch (err) {

    }

    if (pzh == undefined) pzh = '';

    inputBox("标记为凭证", "", pzh, "输入凭证号码", function (val) {
        if (val == '') {
            var p = find_pzh(data.id, false);
            if (p) p.remove();
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, false);
        } else {
            find_pzh(data.id, true).find('.no').text(val);
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, true);
        }

    }, true /*允许为空*/);
}


//@comment (group=,caption=查找或创建凭证号标记对象,needRightControl=false)
function find_pzh(id, create_if_not_exists) {
    var d = $('#' + id);
    if (!d) {
        $.alert(id + "不存在");
        return null;
    }

    var ret = d.find('.pzh');
    if (ret.length == 0) {
        if (create_if_not_exists) //如果需要创建，则创建它
        {
            d.append(`<div class="pzh" ><div class="no"></div><div class="delete_pzh"><i class="fa fa-close" onclick="removePZH('${id}');  event.preventDefault(); event.stopPropagation();"> </i></div></div>`);
        }
        ret = d.find('.pzh');
    }
    return ret;

}

function removePZH(id) {
    var p = find_pzh(id, false);
    if (p) p.remove();
}

function cb_selectall_onClick() {
    var imgPool = book.sheet1.getBrick('imgPool');
    if (imgPool.getSelectedImageList().length == 0) {
        imgPool.selectAll();
    } else {
        imgPool.unSelectAll();
    }
}


id: 60a8932defb25942c0f22093
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.22 13:34:48.000
script:
function formOpen() {
    book.sheet1.getBrick('imgPool').selectionMode = 'multi'; //图片设置成多选模式

    $(document.body).append(`<style>
                        .pzh {position:absolute;left:0;bottom:0px; 
                                height:24px; line-height:24px;width:100%; 
                                background-color:#40af40a0; 
                                color:white;font-weight:bold;font-size:16px;text-align:center;}

                        .delete_pzh { position:absolute; right:0; width:40px; height:14px; top:0; text-align:right; vertical-align:top; font-size:12px; color:gray;padding-right:5px;}      
                        .delete_pzh:hover { color:white;}      
                          
                        </style>
 `);


    //  let data= loadImagePoolData();
    //  console.dir(data);

    
    $('#blockSize').on('input',  resetImgPoolBlockSize);
     
}


function  resetImgPoolBlockSize()
{
            var imgPool = book.sheet1.getBrick('imgPool');

                // 先保存当前选中状态及设置的凭证号信息
            var selection=  imgPool.getSelectedImageList();
            var pzhMap={};
            var pzhs= imgPool.dom.find('.pzh');
            for( let i=0;i<pzhs.length; i++)
            {
                let id=$(pzhs[i]).parent().attr('id');
                let pzh=  $(pzhs[i]).find('.no').text()  ;
                pzhMap[id] = pzh; 

            }


            let v = $('#blockSize').val();

            imgPool.config.blockSize = parseInt(v);
            imgPool.rebuildGridly();
            //恢复选中状态
            for( let i=0;i<selection.length;i++)
            {
                imgPool.setImageSelected(selection[i].id , true);
            }
            //恢复凭证号
            for( let id in pzhMap)
            {
                var pzh= pzhMap[id];
                 find_pzh(id, true).find('.no').text(pzh);
            }


    
}

/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet, name, data) {
    //console.dir(data);
    var url = data.url_img;
    book.sheet0.cells("imgPreview").setValue(url);
}
function imageOnMouseOut(sheet, name, data) {

    book.sheet0.cells("imgPreview").setValue("");
}


/**
 * 图片控件中某个图片被双击了
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片被双击)
function imageOnDBLClick(sheet, name, data) {

    //因为 mouseOut 会把大图清除掉，所以这里重新再设置上
    setTimeout(function () {
        var url = data.url_img;
        book.sheet0.cells("imgPreview").setValue(url);

    }, 200);

    var pzh = '';
    try {

        pzh = find_pzh(data.id, false).find('.no').text();
    } catch (err) {

    }

    if (pzh == undefined) pzh = '';

    inputBox("标记为凭证", "", pzh, "输入凭证号码", function (val) {
        if (val == '') {
            var p = find_pzh(data.id, false);
            if (p) p.remove();
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, false);
        } else {
            find_pzh(data.id, true).find('.no').text(val);
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, true);
        }

    }, true /*允许为空*/);
}


//@comment (group=,caption=查找或创建凭证号标记对象,needRightControl=false)
function find_pzh(id, create_if_not_exists) {
    var d = $('#' + id);
    if (!d) {
        $.alert(id + "不存在");
        return null;
    }

    var ret = d.find('.pzh');
    if (ret.length == 0) {
        if (create_if_not_exists) //如果需要创建，则创建它
        {
            d.append(`<div class="pzh" ><div class="no"></div><div class="delete_pzh"><i class="fa fa-close" onclick="removePZH('${id}');  event.preventDefault(); event.stopPropagation();"> </i></div></div>`);
        }
        ret = d.find('.pzh');
    }
    return ret;

}

function removePZH(id) {
    var p = find_pzh(id, false);
    if (p) p.remove();
}

function cb_selectall_onClick() {
    var imgPool = book.sheet1.getBrick('imgPool');
    if (imgPool.getSelectedImageList().length == 0) {
        imgPool.selectAll();
    } else {
        imgPool.unSelectAll();
    }
}


id: 60a8a280efb25942c0f2234c
scriptid: 609d4b105db2b0a331d6bf04
tablename: app_script
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.22 14:24:12.000
script:
//为每个操作员创建一个待归档图片单据 ， 所有单据都先上传到这个单据中做附件
function main(arg) {
    var gguid = '';
    var ds = newDataStore("", "select * from dzpz_imgpool ");
    ds.setUpdateProperty("dzpz_imgpool", "id", "*", "id");
    ds.retrieve(" userid='" + currentUserId() + "'");
    println( ds.getSelectLastRetrieved());
    if (ds.getRowCount() == 1) {
        gguid = ds.getString(0, "gguid");
    } else {

        ds.insertRow(0);
        gguid = newGUID();
        ds.setValue(0, "id", gguid);
        ds.setValue(0, "gguid", gguid);
        ds.setValue(0, "billno", gguid);
        ds.setValue(0, "billdate", newDate());
        ds.setValue(0, "billtype", '');
        ds.setValue(0, "userid", currentUserId());
        ds.setValue(0, "username", currentUserShowName());
        ds.setValue(0, "deleteflag", 0);
        ds.setValue(0, "blocksize", 128);
        

        if (ds.update(true)) {
            error = ds.getError().getMessage();
            println(error);
            return { success: false, message: error };
        }
    }

    var blockSize=  ds.getInt(0,"blocksize");
    if( blockSize==0) blockSize=128; 

    //提供图片上传的必要的参数
    var config = { "serverIndex": "1", 
                    "dbpool": "default", 
                    "logTable": "dzpz_imgpool_fileupload", 
                    "blockSize": blockSize, 
                    "imgMaxSize": 1920, 
                    "groupName": "附件",
                     "tableName": "dzpz_imgpool", 
                     "gguid": gguid, 
                     "path": "dzpz_imgpool", 
                     "maxThumbnailSize": 256 ,
                     "responseType":"JSON"  //表示上传成功捂返回 JSON格式的结果
             }

    println(JSON.stringify(config));
    return config; 


}


id: 60a8a280efb25942c0f22356
scriptid: 60a321f05db27838e0c014bf
tablename: app_script
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.22 14:25:00.000
script:
//@comment (group=,caption=得到当前操作员待归档图片对应的GGUID,needRightControl=false)
function  getImagePoolGGUID()
{
    var ret= runTask("get_dzpz_imgpool_id_of_current_user",{});
    return JSON.parse(ret).gguid; 
    
}

function  getImagePoolBlockSize()
{
    var ret= runTask("get_dzpz_imgpool_id_of_current_user",{});
    return JSON.parse(ret).blockSize; 
    
}



//@comment (group=,caption=得到待归档的图片清单,needRightControl=true)
function loadImagePoolData()
{
    var config= JSON.parse(runTask("get_dzpz_imgpool_id_of_current_user",{}));
     
    var ds=newDataStore( config.dbpool ,"select * from "+ config.logTable+"  where  gguid='"+config.gguid+"'  order by info1 ") ; // info1 是客户端文件创建的时间，以它排序
    var n=ds.retrieve();
    var ret=[];
    for( var i=0;i<n;i++)
    {
        ret.push(  JSON.parse( ds.getJSONRow(i,true)));
    }

    return ret; 

}


id: 60a8a280efb25942c0f22362
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.22 14:26:42.000
script:
function formOpen() {
    book.sheet1.getBrick('imgPool').selectionMode = 'multi'; //图片设置成多选模式

    $(document.body).append(`<style>
                        .pzh {position:absolute;left:0;bottom:0px; 
                                height:24px; line-height:24px;width:100%; 
                                background-color:#40af40a0; 
                                color:white;font-weight:bold;font-size:16px;text-align:center;}

                        .delete_pzh { position:absolute; right:0; width:40px; height:14px; top:0; text-align:right; vertical-align:top; font-size:12px; color:gray;padding-right:5px;}      
                        .delete_pzh:hover { color:white;}      
                          
                        </style>
 `);


    //  let data= loadImagePoolData();
    //  console.dir(data);

    
    $('#blockSize').on('input',  resetImgPoolBlockSize);
}


function afterOpen()
{
    //调取缩略图大小
    let blockSize= getImagePoolBlockSize();
    if( blockSize!=128)
    {
        $('#blockSize').val(blockSize);
        resetImgPoolBlockSize();
    }
     
}



function  resetImgPoolBlockSize()
{
            var imgPool = book.sheet1.getBrick('imgPool');

                // 先保存当前选中状态及设置的凭证号信息
            var selection=  imgPool.getSelectedImageList();
            var pzhMap={};
            var pzhs= imgPool.dom.find('.pzh');
            for( let i=0;i<pzhs.length; i++)
            {
                let id=$(pzhs[i]).parent().attr('id');
                let pzh=  $(pzhs[i]).find('.no').text()  ;
                pzhMap[id] = pzh; 

            }


            let v = $('#blockSize').val();

            imgPool.config.blockSize = parseInt(v);
            imgPool.rebuildGridly();
            //恢复选中状态
            for( let i=0;i<selection.length;i++)
            {
                imgPool.setImageSelected(selection[i].id , true);
            }
            //恢复凭证号
            for( let id in pzhMap)
            {
                var pzh= pzhMap[id];
                 find_pzh(id, true).find('.no').text(pzh);
            }


    
}

/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet, name, data) {
    //console.dir(data);
    var url = data.url_img;
    book.sheet0.cells("imgPreview").setValue(url);
}
function imageOnMouseOut(sheet, name, data) {

    book.sheet0.cells("imgPreview").setValue("");
}


/**
 * 图片控件中某个图片被双击了
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片被双击)
function imageOnDBLClick(sheet, name, data) {

    //因为 mouseOut 会把大图清除掉，所以这里重新再设置上
    setTimeout(function () {
        var url = data.url_img;
        book.sheet0.cells("imgPreview").setValue(url);

    }, 200);

    var pzh = '';
    try {

        pzh = find_pzh(data.id, false).find('.no').text();
    } catch (err) {

    }

    if (pzh == undefined) pzh = '';

    inputBox("标记为凭证", "", pzh, "输入凭证号码", function (val) {
        if (val == '') {
            var p = find_pzh(data.id, false);
            if (p) p.remove();
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, false);
        } else {
            find_pzh(data.id, true).find('.no').text(val);
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, true);
        }

    }, true /*允许为空*/);
}


//@comment (group=,caption=查找或创建凭证号标记对象,needRightControl=false)
function find_pzh(id, create_if_not_exists) {
    var d = $('#' + id);
    if (!d) {
        $.alert(id + "不存在");
        return null;
    }

    var ret = d.find('.pzh');
    if (ret.length == 0) {
        if (create_if_not_exists) //如果需要创建，则创建它
        {
            d.append(`<div class="pzh" ><div class="no"></div><div class="delete_pzh"><i class="fa fa-close" onclick="removePZH('${id}');  event.preventDefault(); event.stopPropagation();"> </i></div></div>`);
        }
        ret = d.find('.pzh');
    }
    return ret;

}

function removePZH(id) {
    var p = find_pzh(id, false);
    if (p) p.remove();
}

function cb_selectall_onClick() {
    var imgPool = book.sheet1.getBrick('imgPool');
    if (imgPool.getSelectedImageList().length == 0) {
        imgPool.selectAll();
    } else {
        imgPool.unSelectAll();
    }
}


id: 60a8a280efb25942c0f22368
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.22 14:28:09.000
script:
function formOpen() {
    book.sheet1.getBrick('imgPool').selectionMode = 'multi'; //图片设置成多选模式

    $(document.body).append(`<style>
                        .pzh {position:absolute;left:0;bottom:0px; 
                                height:24px; line-height:24px;width:100%; 
                                background-color:#40af40a0; 
                                color:white;font-weight:bold;font-size:16px;text-align:center;}

                        .delete_pzh { position:absolute; right:0; width:40px; height:14px; top:0; text-align:right; vertical-align:top; font-size:12px; color:gray;padding-right:5px;}      
                        .delete_pzh:hover { color:white;}      
                          
                        </style>
 `);


    //  let data= loadImagePoolData();
    //  console.dir(data);

    
    $('#blockSize').on('input',  resetImgPoolBlockSize);
}


function afterOpen()
{
    //调取缩略图大小
    let blockSize= getImagePoolBlockSize();
    if( blockSize!=128)
    {
        $('#blockSize').val(blockSize);
        resetImgPoolBlockSize( false);
    }
     
}



function  resetImgPoolBlockSize( needSaveSetting)
{
            var imgPool = book.sheet1.getBrick('imgPool');

                // 先保存当前选中状态及设置的凭证号信息
            var selection=  imgPool.getSelectedImageList();
            var pzhMap={};
            var pzhs= imgPool.dom.find('.pzh');
            for( let i=0;i<pzhs.length; i++)
            {
                let id=$(pzhs[i]).parent().attr('id');
                let pzh=  $(pzhs[i]).find('.no').text()  ;
                pzhMap[id] = pzh; 

            }


            let v = $('#blockSize').val();

            imgPool.config.blockSize = parseInt(v);
            imgPool.rebuildGridly();
            //恢复选中状态
            for( let i=0;i<selection.length;i++)
            {
                imgPool.setImageSelected(selection[i].id , true);
            }
            //恢复凭证号
            for( let id in pzhMap)
            {
                var pzh= pzhMap[id];
                 find_pzh(id, true).find('.no').text(pzh);
            }

            if( needSaveSetting )
            {
                setImagePoolBlockSize(v);
            }


    
}

/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet, name, data) {
    //console.dir(data);
    var url = data.url_img;
    book.sheet0.cells("imgPreview").setValue(url);
}
function imageOnMouseOut(sheet, name, data) {

    book.sheet0.cells("imgPreview").setValue("");
}


/**
 * 图片控件中某个图片被双击了
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片被双击)
function imageOnDBLClick(sheet, name, data) {

    //因为 mouseOut 会把大图清除掉，所以这里重新再设置上
    setTimeout(function () {
        var url = data.url_img;
        book.sheet0.cells("imgPreview").setValue(url);

    }, 200);

    var pzh = '';
    try {

        pzh = find_pzh(data.id, false).find('.no').text();
    } catch (err) {

    }

    if (pzh == undefined) pzh = '';

    inputBox("标记为凭证", "", pzh, "输入凭证号码", function (val) {
        if (val == '') {
            var p = find_pzh(data.id, false);
            if (p) p.remove();
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, false);
        } else {
            find_pzh(data.id, true).find('.no').text(val);
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, true);
        }

    }, true /*允许为空*/);
}


//@comment (group=,caption=查找或创建凭证号标记对象,needRightControl=false)
function find_pzh(id, create_if_not_exists) {
    var d = $('#' + id);
    if (!d) {
        $.alert(id + "不存在");
        return null;
    }

    var ret = d.find('.pzh');
    if (ret.length == 0) {
        if (create_if_not_exists) //如果需要创建，则创建它
        {
            d.append(`<div class="pzh" ><div class="no"></div><div class="delete_pzh"><i class="fa fa-close" onclick="removePZH('${id}');  event.preventDefault(); event.stopPropagation();"> </i></div></div>`);
        }
        ret = d.find('.pzh');
    }
    return ret;

}

function removePZH(id) {
    var p = find_pzh(id, false);
    if (p) p.remove();
}

function cb_selectall_onClick() {
    var imgPool = book.sheet1.getBrick('imgPool');
    if (imgPool.getSelectedImageList().length == 0) {
        imgPool.selectAll();
    } else {
        imgPool.unSelectAll();
    }
}


id: 60a8a280efb25942c0f2236e
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.22 14:28:40.000
script:
function formOpen() {
    book.sheet1.getBrick('imgPool').selectionMode = 'multi'; //图片设置成多选模式

    $(document.body).append(`<style>
                        .pzh {position:absolute;left:0;bottom:0px; 
                                height:24px; line-height:24px;width:100%; 
                                background-color:#40af40a0; 
                                color:white;font-weight:bold;font-size:16px;text-align:center;}

                        .delete_pzh { position:absolute; right:0; width:40px; height:14px; top:0; text-align:right; vertical-align:top; font-size:12px; color:gray;padding-right:5px;}      
                        .delete_pzh:hover { color:white;}      
                          
                        </style>
 `);


    //  let data= loadImagePoolData();
    //  console.dir(data);

    
    $('#blockSize').on('input',  resetImgPoolBlockSize);
}


function afterOpen()
{
    //调取缩略图大小
    let blockSize= getImagePoolBlockSize();
    if( blockSize!=128)
    {
        $('#blockSize').val(blockSize);
        resetImgPoolBlockSize( false);
    }
     
}



function  resetImgPoolBlockSize( needSaveSetting)
{
            var imgPool = book.sheet1.getBrick('imgPool');

                // 先保存当前选中状态及设置的凭证号信息
            var selection=  imgPool.getSelectedImageList();
            var pzhMap={};
            var pzhs= imgPool.dom.find('.pzh');
            for( let i=0;i<pzhs.length; i++)
            {
                let id=$(pzhs[i]).parent().attr('id');
                let pzh=  $(pzhs[i]).find('.no').text()  ;
                pzhMap[id] = pzh; 

            }


            let v = $('#blockSize').val();

            imgPool.config.blockSize = parseInt(v);
            imgPool.rebuildGridly();
            //恢复选中状态
            for( let i=0;i<selection.length;i++)
            {
                imgPool.setImageSelected(selection[i].id , true);
            }
            //恢复凭证号
            for( let id in pzhMap)
            {
                var pzh= pzhMap[id];
                 find_pzh(id, true).find('.no').text(pzh);
            }

            if( needSaveSetting )
            {
                setImagePoolBlockSize( imgPool.config.gguid, v);
            }


    
}

/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet, name, data) {
    //console.dir(data);
    var url = data.url_img;
    book.sheet0.cells("imgPreview").setValue(url);
}
function imageOnMouseOut(sheet, name, data) {

    book.sheet0.cells("imgPreview").setValue("");
}


/**
 * 图片控件中某个图片被双击了
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片被双击)
function imageOnDBLClick(sheet, name, data) {

    //因为 mouseOut 会把大图清除掉，所以这里重新再设置上
    setTimeout(function () {
        var url = data.url_img;
        book.sheet0.cells("imgPreview").setValue(url);

    }, 200);

    var pzh = '';
    try {

        pzh = find_pzh(data.id, false).find('.no').text();
    } catch (err) {

    }

    if (pzh == undefined) pzh = '';

    inputBox("标记为凭证", "", pzh, "输入凭证号码", function (val) {
        if (val == '') {
            var p = find_pzh(data.id, false);
            if (p) p.remove();
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, false);
        } else {
            find_pzh(data.id, true).find('.no').text(val);
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, true);
        }

    }, true /*允许为空*/);
}


//@comment (group=,caption=查找或创建凭证号标记对象,needRightControl=false)
function find_pzh(id, create_if_not_exists) {
    var d = $('#' + id);
    if (!d) {
        $.alert(id + "不存在");
        return null;
    }

    var ret = d.find('.pzh');
    if (ret.length == 0) {
        if (create_if_not_exists) //如果需要创建，则创建它
        {
            d.append(`<div class="pzh" ><div class="no"></div><div class="delete_pzh"><i class="fa fa-close" onclick="removePZH('${id}');  event.preventDefault(); event.stopPropagation();"> </i></div></div>`);
        }
        ret = d.find('.pzh');
    }
    return ret;

}

function removePZH(id) {
    var p = find_pzh(id, false);
    if (p) p.remove();
}

function cb_selectall_onClick() {
    var imgPool = book.sheet1.getBrick('imgPool');
    if (imgPool.getSelectedImageList().length == 0) {
        imgPool.selectAll();
    } else {
        imgPool.unSelectAll();
    }
}


id: 60a8a280efb25942c0f22376
scriptid: 60a321f05db27838e0c014bf
tablename: app_script
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.22 14:29:30.000
script:
//@comment (group=,caption=得到当前操作员待归档图片对应的GGUID,needRightControl=false)
function  getImagePoolGGUID()
{
    var ret= runTask("get_dzpz_imgpool_id_of_current_user",{});
    return JSON.parse(ret).gguid; 
    
}

function  getImagePoolBlockSize()
{
    var ret= runTask("get_dzpz_imgpool_id_of_current_user",{});
    return JSON.parse(ret).blockSize; 
    
}


function setImagePoolBlockSize(id, blockSize)
{
    runSQL(""," update  dzpz_imgpool set blocksize="+blockSize+" where gguid='"+ id+"'  ");
}


//@comment (group=,caption=得到待归档的图片清单,needRightControl=true)
function loadImagePoolData()
{
    var config= JSON.parse(runTask("get_dzpz_imgpool_id_of_current_user",{}));
     
    var ds=newDataStore( config.dbpool ,"select * from "+ config.logTable+"  where  gguid='"+config.gguid+"'  order by info1 ") ; // info1 是客户端文件创建的时间，以它排序
    var n=ds.retrieve();
    var ret=[];
    for( var i=0;i<n;i++)
    {
        ret.push(  JSON.parse( ds.getJSONRow(i,true)));
    }

    return ret; 

}


id: 60a8a280efb25942c0f2237e
scriptid: 60a321f05db27838e0c014bf
tablename: app_script
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.22 14:29:53.000
script:
//@comment (group=,caption=得到当前操作员待归档图片对应的GGUID,needRightControl=false)
function  getImagePoolGGUID()
{
    var ret= runTask("get_dzpz_imgpool_id_of_current_user",{});
    return JSON.parse(ret).gguid; 
    
}

function  getImagePoolBlockSize()
{
    var ret= runTask("get_dzpz_imgpool_id_of_current_user",{});
    return JSON.parse(ret).blockSize; 
    
}


//@comment (group=,caption=保存当前的缩略图大小,needRightControl=false)
function setImagePoolBlockSize(id, blockSize)
{
    runSQL(""," update  dzpz_imgpool set blocksize="+blockSize+" where gguid='"+ id+"'  ");
}


//@comment (group=,caption=得到待归档的图片清单,needRightControl=true)
function loadImagePoolData()
{
    var config= JSON.parse(runTask("get_dzpz_imgpool_id_of_current_user",{}));
     
    var ds=newDataStore( config.dbpool ,"select * from "+ config.logTable+"  where  gguid='"+config.gguid+"'  order by info1 ") ; // info1 是客户端文件创建的时间，以它排序
    var n=ds.retrieve();
    var ret=[];
    for( var i=0;i<n;i++)
    {
        ret.push(  JSON.parse( ds.getJSONRow(i,true)));
    }

    return ret; 

}


id: 60a8a280efb25942c0f22384
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.22 14:30:31.000
script:
function formOpen() {
    book.sheet1.getBrick('imgPool').selectionMode = 'multi'; //图片设置成多选模式

    $(document.body).append(`<style>
                        .pzh {position:absolute;left:0;bottom:0px; 
                                height:24px; line-height:24px;width:100%; 
                                background-color:#40af40a0; 
                                color:white;font-weight:bold;font-size:16px;text-align:center;}

                        .delete_pzh { position:absolute; right:0; width:40px; height:14px; top:0; text-align:right; vertical-align:top; font-size:12px; color:gray;padding-right:5px;}      
                        .delete_pzh:hover { color:white;}      
                          
                        </style>
 `);


    //  let data= loadImagePoolData();
    //  console.dir(data);

    
    $('#blockSize').on('input',  resetImgPoolBlockSize);
}


function afterOpen()
{
    //调取缩略图大小
    let blockSize= getImagePoolBlockSize();
    if( blockSize!=128)
    {
        $('#blockSize').val(blockSize);
        resetImgPoolBlockSize( false);
    }
     
}



function  resetImgPoolBlockSize( needSaveSetting)
{
        if( needSaveSetting==null) needSaveSetting=true; 
            var imgPool = book.sheet1.getBrick('imgPool');

                // 先保存当前选中状态及设置的凭证号信息
            var selection=  imgPool.getSelectedImageList();
            var pzhMap={};
            var pzhs= imgPool.dom.find('.pzh');
            for( let i=0;i<pzhs.length; i++)
            {
                let id=$(pzhs[i]).parent().attr('id');
                let pzh=  $(pzhs[i]).find('.no').text()  ;
                pzhMap[id] = pzh; 

            }


            let v = $('#blockSize').val();

            imgPool.config.blockSize = parseInt(v);
            imgPool.rebuildGridly();
            //恢复选中状态
            for( let i=0;i<selection.length;i++)
            {
                imgPool.setImageSelected(selection[i].id , true);
            }
            //恢复凭证号
            for( let id in pzhMap)
            {
                var pzh= pzhMap[id];
                 find_pzh(id, true).find('.no').text(pzh);
            }

            if( needSaveSetting )
            {
                setImagePoolBlockSize( imgPool.config.gguid, v);
            }


    
}

/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet, name, data) {
    //console.dir(data);
    var url = data.url_img;
    book.sheet0.cells("imgPreview").setValue(url);
}
function imageOnMouseOut(sheet, name, data) {

    book.sheet0.cells("imgPreview").setValue("");
}


/**
 * 图片控件中某个图片被双击了
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片被双击)
function imageOnDBLClick(sheet, name, data) {

    //因为 mouseOut 会把大图清除掉，所以这里重新再设置上
    setTimeout(function () {
        var url = data.url_img;
        book.sheet0.cells("imgPreview").setValue(url);

    }, 200);

    var pzh = '';
    try {

        pzh = find_pzh(data.id, false).find('.no').text();
    } catch (err) {

    }

    if (pzh == undefined) pzh = '';

    inputBox("标记为凭证", "", pzh, "输入凭证号码", function (val) {
        if (val == '') {
            var p = find_pzh(data.id, false);
            if (p) p.remove();
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, false);
        } else {
            find_pzh(data.id, true).find('.no').text(val);
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, true);
        }

    }, true /*允许为空*/);
}


//@comment (group=,caption=查找或创建凭证号标记对象,needRightControl=false)
function find_pzh(id, create_if_not_exists) {
    var d = $('#' + id);
    if (!d) {
        $.alert(id + "不存在");
        return null;
    }

    var ret = d.find('.pzh');
    if (ret.length == 0) {
        if (create_if_not_exists) //如果需要创建，则创建它
        {
            d.append(`<div class="pzh" ><div class="no"></div><div class="delete_pzh"><i class="fa fa-close" onclick="removePZH('${id}');  event.preventDefault(); event.stopPropagation();"> </i></div></div>`);
        }
        ret = d.find('.pzh');
    }
    return ret;

}

function removePZH(id) {
    var p = find_pzh(id, false);
    if (p) p.remove();
}

function cb_selectall_onClick() {
    var imgPool = book.sheet1.getBrick('imgPool');
    if (imgPool.getSelectedImageList().length == 0) {
        imgPool.selectAll();
    } else {
        imgPool.unSelectAll();
    }
}


id: 60a8a280efb25942c0f2238a
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.22 14:30:46.000
script:
function formOpen() {
    book.sheet1.getBrick('imgPool').selectionMode = 'multi'; //图片设置成多选模式

    $(document.body).append(`<style>
                        .pzh {position:absolute;left:0;bottom:0px; 
                                height:24px; line-height:24px;width:100%; 
                                background-color:#40af40a0; 
                                color:white;font-weight:bold;font-size:16px;text-align:center;}

                        .delete_pzh { position:absolute; right:0; width:40px; height:14px; top:0; text-align:right; vertical-align:top; font-size:12px; color:gray;padding-right:5px;}      
                        .delete_pzh:hover { color:white;}      
                          
                        </style>
 `);


    //  let data= loadImagePoolData();
    //  console.dir(data);


    $('#blockSize').on('input', resetImgPoolBlockSize);
}


function afterOpen() {
    //调取缩略图大小
    let blockSize = getImagePoolBlockSize();
    if (blockSize != 128) {
        $('#blockSize').val(blockSize);
        resetImgPoolBlockSize(false);
    }

}



function resetImgPoolBlockSize(needSaveSetting) {
    if (needSaveSetting == null) needSaveSetting = true;
    var imgPool = book.sheet1.getBrick('imgPool');

    // 先保存当前选中状态及设置的凭证号信息
    var selection = imgPool.getSelectedImageList();
    var pzhMap = {};
    var pzhs = imgPool.dom.find('.pzh');
    for (let i = 0; i < pzhs.length; i++) {
        let id = $(pzhs[i]).parent().attr('id');
        let pzh = $(pzhs[i]).find('.no').text();
        pzhMap[id] = pzh;

    }


    let v = $('#blockSize').val();

    imgPool.config.blockSize = parseInt(v);
    imgPool.rebuildGridly();
    //恢复选中状态
    for (let i = 0; i < selection.length; i++) {
        imgPool.setImageSelected(selection[i].id, true);
    }
    //恢复凭证号
    for (let id in pzhMap) {
        var pzh = pzhMap[id];
        find_pzh(id, true).find('.no').text(pzh);
    }

    if (needSaveSetting) {
        setImagePoolBlockSize(imgPool.config.gguid, v);
    }



}

/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet, name, data) {
    //console.dir(data);
    var url = data.url_img;
    book.sheet0.cells("imgPreview").setValue(url);
}
function imageOnMouseOut(sheet, name, data) {

    book.sheet0.cells("imgPreview").setValue("");
}


/**
 * 图片控件中某个图片被双击了
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片被双击)
function imageOnDBLClick(sheet, name, data) {

    //因为 mouseOut 会把大图清除掉，所以这里重新再设置上
    setTimeout(function () {
        var url = data.url_img;
        book.sheet0.cells("imgPreview").setValue(url);

    }, 200);

    var pzh = '';
    try {

        pzh = find_pzh(data.id, false).find('.no').text();
    } catch (err) {

    }

    if (pzh == undefined) pzh = '';

    inputBox("标记为凭证", "", pzh, "输入凭证号码", function (val) {
        if (val == '') {
            var p = find_pzh(data.id, false);
            if (p) p.remove();
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, false);
        } else {
            find_pzh(data.id, true).find('.no').text(val);
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, true);
        }

    }, true /*允许为空*/);
}


//@comment (group=,caption=查找或创建凭证号标记对象,needRightControl=false)
function find_pzh(id, create_if_not_exists) {
    var d = $('#' + id);
    if (!d) {
        $.alert(id + "不存在");
        return null;
    }

    var ret = d.find('.pzh');
    if (ret.length == 0) {
        if (create_if_not_exists) //如果需要创建，则创建它
        {
            d.append(`<div class="pzh" ><div class="no"></div><div class="delete_pzh"><i class="fa fa-close" onclick="removePZH('${id}');  event.preventDefault(); event.stopPropagation();"> </i></div></div>`);
        }
        ret = d.find('.pzh');
    }
    return ret;

}

function removePZH(id) {
    var p = find_pzh(id, false);
    if (p) p.remove();
}

function cb_selectall_onClick() {
    var imgPool = book.sheet1.getBrick('imgPool');
    if (imgPool.getSelectedImageList().length == 0) {
        imgPool.selectAll();
    } else {
        imgPool.unSelectAll();
    }
}


id: 60a8a280efb25942c0f22390
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.22 14:33:03.000
script:
function formOpen() {
    book.sheet1.getBrick('imgPool').selectionMode = 'multi'; //图片设置成多选模式

    $(document.body).append(`<style>
                        .pzh {position:absolute;left:0;bottom:0px; 
                                height:24px; line-height:24px;width:100%; 
                                background-color:#40af40a0; 
                                color:white;font-weight:bold;font-size:16px;text-align:center;}

                        .delete_pzh { position:absolute; right:0; width:40px; height:14px; top:0; text-align:right; vertical-align:top; font-size:12px; color:gray;padding-right:5px;}      
                        .delete_pzh:hover { color:white;}      
                          
                        </style>
 `);


    //  let data= loadImagePoolData();
    //  console.dir(data);


    $('#blockSize').on('input', resetImgPoolBlockSize);
}


function afterOpen() {
    //调取缩略图大小
    let blockSize = getImagePoolBlockSize();
    if (blockSize != 128) {
        $('#blockSize').val(blockSize);
        resetImgPoolBlockSize(false);
    }

}



function resetImgPoolBlockSize(needSaveSetting) {
    if (needSaveSetting == null) needSaveSetting = true;
    var imgPool = book.sheet1.getBrick('imgPool');

    // 先保存当前选中状态及设置的凭证号信息
    var selection = imgPool.getSelectedImageList();
    var pzhMap = {};
    var pzhs = imgPool.dom.find('.pzh');
    for (let i = 0; i < pzhs.length; i++) {
        let id = $(pzhs[i]).parent().attr('id');
        let pzh = $(pzhs[i]).find('.no').text();
        pzhMap[id] = pzh;

    }


    let v = $('#blockSize').val();

    imgPool.config.blockSize = parseInt(v);
    imgPool.rebuildGridly();
    //恢复选中状态
    for (let i = 0; i < selection.length; i++) {
        imgPool.setImageSelected(selection[i].id, true);
    }
    //恢复凭证号
    for (let id in pzhMap) {
        var pzh = pzhMap[id];
        find_pzh(id, true).find('.no').text(pzh);
    }

    if (needSaveSetting) {
        setImagePoolBlockSize(imgPool.getConfig("gguid"), v);
    }



}

/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet, name, data) {
    //console.dir(data);
    var url = data.url_img;
    book.sheet0.cells("imgPreview").setValue(url);
}
function imageOnMouseOut(sheet, name, data) {

    book.sheet0.cells("imgPreview").setValue("");
}


/**
 * 图片控件中某个图片被双击了
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片被双击)
function imageOnDBLClick(sheet, name, data) {

    //因为 mouseOut 会把大图清除掉，所以这里重新再设置上
    setTimeout(function () {
        var url = data.url_img;
        book.sheet0.cells("imgPreview").setValue(url);

    }, 200);

    var pzh = '';
    try {

        pzh = find_pzh(data.id, false).find('.no').text();
    } catch (err) {

    }

    if (pzh == undefined) pzh = '';

    inputBox("标记为凭证", "", pzh, "输入凭证号码", function (val) {
        if (val == '') {
            var p = find_pzh(data.id, false);
            if (p) p.remove();
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, false);
        } else {
            find_pzh(data.id, true).find('.no').text(val);
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, true);
        }

    }, true /*允许为空*/);
}


//@comment (group=,caption=查找或创建凭证号标记对象,needRightControl=false)
function find_pzh(id, create_if_not_exists) {
    var d = $('#' + id);
    if (!d) {
        $.alert(id + "不存在");
        return null;
    }

    var ret = d.find('.pzh');
    if (ret.length == 0) {
        if (create_if_not_exists) //如果需要创建，则创建它
        {
            d.append(`<div class="pzh" ><div class="no"></div><div class="delete_pzh"><i class="fa fa-close" onclick="removePZH('${id}');  event.preventDefault(); event.stopPropagation();"> </i></div></div>`);
        }
        ret = d.find('.pzh');
    }
    return ret;

}

function removePZH(id) {
    var p = find_pzh(id, false);
    if (p) p.remove();
}

function cb_selectall_onClick() {
    var imgPool = book.sheet1.getBrick('imgPool');
    if (imgPool.getSelectedImageList().length == 0) {
        imgPool.selectAll();
    } else {
        imgPool.unSelectAll();
    }
}


id: 60a8a280efb25942c0f22396
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.22 14:33:23.000
script:
function formOpen() {
    book.sheet1.getBrick('imgPool').selectionMode = 'multi'; //图片设置成多选模式

    $(document.body).append(`<style>
                        .pzh {position:absolute;left:0;bottom:0px; 
                                height:24px; line-height:24px;width:100%; 
                                background-color:#40af40a0; 
                                color:white;font-weight:bold;font-size:16px;text-align:center;}

                        .delete_pzh { position:absolute; right:0; width:40px; height:14px; top:0; text-align:right; vertical-align:top; font-size:12px; color:gray;padding-right:5px;}      
                        .delete_pzh:hover { color:white;}      
                          
                        </style>
 `);


    //  let data= loadImagePoolData();
    //  console.dir(data);


    $('#blockSize').on('input', resetImgPoolBlockSize);
}


function afterOpen() {
    //调取缩略图大小
    let blockSize = getImagePoolBlockSize();
    if (blockSize != 128) {
        $('#blockSize').val(blockSize);
        resetImgPoolBlockSize(false);
    }

}



function resetImgPoolBlockSize(needSaveSetting) {
    if (needSaveSetting == null) needSaveSetting = true;
    var imgPool = book.sheet1.getBrick('imgPool');

    // 先保存当前选中状态及设置的凭证号信息
    var selection = imgPool.getSelectedImageList();
    var pzhMap = {};
    var pzhs = imgPool.dom.find('.pzh');
    for (let i = 0; i < pzhs.length; i++) {
        let id = $(pzhs[i]).parent().attr('id');
        let pzh = $(pzhs[i]).find('.no').text();
        pzhMap[id] = pzh;

    }


    let v = $('#blockSize').val();

    imgPool.config.blockSize = parseInt(v);
    imgPool.rebuildGridly();
    //恢复选中状态
    for (let i = 0; i < selection.length; i++) {
        imgPool.setImageSelected(selection[i].id, true);
    }
    //恢复凭证号
    for (let id in pzhMap) {
        var pzh = pzhMap[id];
        find_pzh(id, true).find('.no').text(pzh);
    }

    if (needSaveSetting) {
        setTimeout( function()
        {
        setImagePoolBlockSize(imgPool.getConfig("gguid"), v);
        },1000);
    }



}

/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet, name, data) {
    //console.dir(data);
    var url = data.url_img;
    book.sheet0.cells("imgPreview").setValue(url);
}
function imageOnMouseOut(sheet, name, data) {

    book.sheet0.cells("imgPreview").setValue("");
}


/**
 * 图片控件中某个图片被双击了
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片被双击)
function imageOnDBLClick(sheet, name, data) {

    //因为 mouseOut 会把大图清除掉，所以这里重新再设置上
    setTimeout(function () {
        var url = data.url_img;
        book.sheet0.cells("imgPreview").setValue(url);

    }, 200);

    var pzh = '';
    try {

        pzh = find_pzh(data.id, false).find('.no').text();
    } catch (err) {

    }

    if (pzh == undefined) pzh = '';

    inputBox("标记为凭证", "", pzh, "输入凭证号码", function (val) {
        if (val == '') {
            var p = find_pzh(data.id, false);
            if (p) p.remove();
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, false);
        } else {
            find_pzh(data.id, true).find('.no').text(val);
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, true);
        }

    }, true /*允许为空*/);
}


//@comment (group=,caption=查找或创建凭证号标记对象,needRightControl=false)
function find_pzh(id, create_if_not_exists) {
    var d = $('#' + id);
    if (!d) {
        $.alert(id + "不存在");
        return null;
    }

    var ret = d.find('.pzh');
    if (ret.length == 0) {
        if (create_if_not_exists) //如果需要创建，则创建它
        {
            d.append(`<div class="pzh" ><div class="no"></div><div class="delete_pzh"><i class="fa fa-close" onclick="removePZH('${id}');  event.preventDefault(); event.stopPropagation();"> </i></div></div>`);
        }
        ret = d.find('.pzh');
    }
    return ret;

}

function removePZH(id) {
    var p = find_pzh(id, false);
    if (p) p.remove();
}

function cb_selectall_onClick() {
    var imgPool = book.sheet1.getBrick('imgPool');
    if (imgPool.getSelectedImageList().length == 0) {
        imgPool.selectAll();
    } else {
        imgPool.unSelectAll();
    }
}


id: 60a8a653efb25942c0f2239c
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.22 14:36:04.000
script:
function formOpen() {
    book.sheet1.getBrick('imgPool').selectionMode = 'multi'; //图片设置成多选模式

    $(document.body).append(`<style>
                        .pzh {position:absolute;left:0;bottom:0px; 
                                height:24px; line-height:24px;width:100%; 
                                background-color:#40af40a0; 
                                color:white;font-weight:bold;font-size:16px;text-align:center;}

                        .delete_pzh { position:absolute; right:0; width:40px; height:14px; top:0; text-align:right; vertical-align:top; font-size:12px; color:gray;padding-right:5px;}      
                        .delete_pzh:hover { color:white;}      
                          
                        </style>
 `);


    //  let data= loadImagePoolData();
    //  console.dir(data);


    $('#blockSize').on('input', resetImgPoolBlockSize);
    setTimeout(function () {
        //调取缩略图大小
        let blockSize = getImagePoolBlockSize();
        if (blockSize != 128) {
            $('#blockSize').val(blockSize);
            resetImgPoolBlockSize(false);
        }
    }, 2000);

}



function resetImgPoolBlockSize(needSaveSetting) {
    if (needSaveSetting == null) needSaveSetting = true;
    var imgPool = book.sheet1.getBrick('imgPool');

    // 先保存当前选中状态及设置的凭证号信息
    var selection = imgPool.getSelectedImageList();
    var pzhMap = {};
    var pzhs = imgPool.dom.find('.pzh');
    for (let i = 0; i < pzhs.length; i++) {
        let id = $(pzhs[i]).parent().attr('id');
        let pzh = $(pzhs[i]).find('.no').text();
        pzhMap[id] = pzh;

    }


    let v = $('#blockSize').val();

    imgPool.config.blockSize = parseInt(v);
    imgPool.rebuildGridly();
    //恢复选中状态
    for (let i = 0; i < selection.length; i++) {
        imgPool.setImageSelected(selection[i].id, true);
    }
    //恢复凭证号
    for (let id in pzhMap) {
        var pzh = pzhMap[id];
        find_pzh(id, true).find('.no').text(pzh);
    }

    if (needSaveSetting) {
        setTimeout(function () {
            setImagePoolBlockSize(imgPool.getConfig("gguid"), v);
        }, 1000);
    }



}

/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet, name, data) {
    //console.dir(data);
    var url = data.url_img;
    book.sheet0.cells("imgPreview").setValue(url);
}
function imageOnMouseOut(sheet, name, data) {

    book.sheet0.cells("imgPreview").setValue("");
}


/**
 * 图片控件中某个图片被双击了
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片被双击)
function imageOnDBLClick(sheet, name, data) {

    //因为 mouseOut 会把大图清除掉，所以这里重新再设置上
    setTimeout(function () {
        var url = data.url_img;
        book.sheet0.cells("imgPreview").setValue(url);

    }, 200);

    var pzh = '';
    try {

        pzh = find_pzh(data.id, false).find('.no').text();
    } catch (err) {

    }

    if (pzh == undefined) pzh = '';

    inputBox("标记为凭证", "", pzh, "输入凭证号码", function (val) {
        if (val == '') {
            var p = find_pzh(data.id, false);
            if (p) p.remove();
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, false);
        } else {
            find_pzh(data.id, true).find('.no').text(val);
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, true);
        }

    }, true /*允许为空*/);
}


//@comment (group=,caption=查找或创建凭证号标记对象,needRightControl=false)
function find_pzh(id, create_if_not_exists) {
    var d = $('#' + id);
    if (!d) {
        $.alert(id + "不存在");
        return null;
    }

    var ret = d.find('.pzh');
    if (ret.length == 0) {
        if (create_if_not_exists) //如果需要创建，则创建它
        {
            d.append(`<div class="pzh" ><div class="no"></div><div class="delete_pzh"><i class="fa fa-close" onclick="removePZH('${id}');  event.preventDefault(); event.stopPropagation();"> </i></div></div>`);
        }
        ret = d.find('.pzh');
    }
    return ret;

}

function removePZH(id) {
    var p = find_pzh(id, false);
    if (p) p.remove();
}

function cb_selectall_onClick() {
    var imgPool = book.sheet1.getBrick('imgPool');
    if (imgPool.getSelectedImageList().length == 0) {
        imgPool.selectAll();
    } else {
        imgPool.unSelectAll();
    }
}


id: 60a8a653efb25942c0f223a2
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.22 14:36:40.000
script:
function formOpen() {
    book.sheet1.getBrick('imgPool').selectionMode = 'multi'; //图片设置成多选模式

    $(document.body).append(`<style>
                        .pzh {position:absolute;left:0;bottom:0px; 
                                height:24px; line-height:24px;width:100%; 
                                background-color:#40af40a0; 
                                color:white;font-weight:bold;font-size:16px;text-align:center;}

                        .delete_pzh { position:absolute; right:0; width:40px; height:14px; top:0; text-align:right; vertical-align:top; font-size:12px; color:gray;padding-right:5px;}      
                        .delete_pzh:hover { color:white;}      
                          
                        </style>
 `);


    //  let data= loadImagePoolData();
    //  console.dir(data);


    $('#blockSize').on('input', resetImgPoolBlockSize);
    setTimeout(function () {
        //调取缩略图大小
        let blockSize = getImagePoolBlockSize();
        if (blockSize != 128) {
            $('#blockSize').val(blockSize);
            resetImgPoolBlockSize(false);
        }
    }, 1000);

}



function resetImgPoolBlockSize(needSaveSetting) {
    if (needSaveSetting == null) needSaveSetting = true;
    var imgPool = book.sheet1.getBrick('imgPool');

    // 先保存当前选中状态及设置的凭证号信息
    var selection = imgPool.getSelectedImageList();
    var pzhMap = {};
    var pzhs = imgPool.dom.find('.pzh');
    for (let i = 0; i < pzhs.length; i++) {
        let id = $(pzhs[i]).parent().attr('id');
        let pzh = $(pzhs[i]).find('.no').text();
        pzhMap[id] = pzh;

    }


    let v = $('#blockSize').val();

    imgPool.config.blockSize = parseInt(v);
    imgPool.rebuildGridly();
    //恢复选中状态
    for (let i = 0; i < selection.length; i++) {
        imgPool.setImageSelected(selection[i].id, true);
    }
    //恢复凭证号
    for (let id in pzhMap) {
        var pzh = pzhMap[id];
        find_pzh(id, true).find('.no').text(pzh);
    }

    if (needSaveSetting) {
        setTimeout(function () {
            setImagePoolBlockSize(imgPool.getConfig("gguid"), v);
        }, 1000);
    }



}

/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet, name, data) {
    //console.dir(data);
    var url = data.url_img;
    book.sheet0.cells("imgPreview").setValue(url);
}
function imageOnMouseOut(sheet, name, data) {

    book.sheet0.cells("imgPreview").setValue("");
}


/**
 * 图片控件中某个图片被双击了
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片被双击)
function imageOnDBLClick(sheet, name, data) {

    //因为 mouseOut 会把大图清除掉，所以这里重新再设置上
    setTimeout(function () {
        var url = data.url_img;
        book.sheet0.cells("imgPreview").setValue(url);

    }, 200);

    var pzh = '';
    try {

        pzh = find_pzh(data.id, false).find('.no').text();
    } catch (err) {

    }

    if (pzh == undefined) pzh = '';

    inputBox("标记为凭证", "", pzh, "输入凭证号码", function (val) {
        if (val == '') {
            var p = find_pzh(data.id, false);
            if (p) p.remove();
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, false);
        } else {
            find_pzh(data.id, true).find('.no').text(val);
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, true);
        }

    }, true /*允许为空*/);
}


//@comment (group=,caption=查找或创建凭证号标记对象,needRightControl=false)
function find_pzh(id, create_if_not_exists) {
    var d = $('#' + id);
    if (!d) {
        $.alert(id + "不存在");
        return null;
    }

    var ret = d.find('.pzh');
    if (ret.length == 0) {
        if (create_if_not_exists) //如果需要创建，则创建它
        {
            d.append(`<div class="pzh" ><div class="no"></div><div class="delete_pzh"><i class="fa fa-close" onclick="removePZH('${id}');  event.preventDefault(); event.stopPropagation();"> </i></div></div>`);
        }
        ret = d.find('.pzh');
    }
    return ret;

}

function removePZH(id) {
    var p = find_pzh(id, false);
    if (p) p.remove();
}

function cb_selectall_onClick() {
    var imgPool = book.sheet1.getBrick('imgPool');
    if (imgPool.getSelectedImageList().length == 0) {
        imgPool.selectAll();
    } else {
        imgPool.unSelectAll();
    }
}


id: 60a8a653efb25942c0f223a8
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.22 14:44:25.000
script:
function formOpen() {
    book.sheet1.getBrick('imgPool').selectionMode = 'multi'; //图片设置成多选模式

    $(document.body).append(`<style>
                        .pzh {position:absolute;left:0;bottom:0px; 
                                height:24px; line-height:24px;width:100%; 
                                background-color:#40af40a0; 
                                color:white;font-weight:bold;font-size:16px;text-align:center;}

                        .delete_pzh { position:absolute; right:0; width:40px; height:14px; top:0; text-align:right; vertical-align:top; font-size:12px; color:gray;padding-right:5px;}      
                        .delete_pzh:hover { color:white;}      
                          
                        </style>
 `);


    //  let data= loadImagePoolData();
    //  console.dir(data);


    $('#blockSize').on('input', resetImgPoolBlockSize);
    setTimeout(function () {
        //调取缩略图大小
        return; 
        let blockSize = getImagePoolBlockSize();
        if (blockSize != 128) {
            $('#blockSize').val(blockSize);
            resetImgPoolBlockSize(false);
        }
    }, 1000);

}



function resetImgPoolBlockSize(needSaveSetting) {
    if (needSaveSetting == null) needSaveSetting = true;
    var imgPool = book.sheet1.getBrick('imgPool');

    // 先保存当前选中状态及设置的凭证号信息
    var selection = imgPool.getSelectedImageList();
    var pzhMap = {};
    var pzhs = imgPool.dom.find('.pzh');
    for (let i = 0; i < pzhs.length; i++) {
        let id = $(pzhs[i]).parent().attr('id');
        let pzh = $(pzhs[i]).find('.no').text();
        pzhMap[id] = pzh;

    }


    let v = $('#blockSize').val();

    imgPool.config.blockSize = parseInt(v);
    imgPool.rebuildGridly();
    //恢复选中状态
    for (let i = 0; i < selection.length; i++) {
        imgPool.setImageSelected(selection[i].id, true);
    }
    //恢复凭证号
    for (let id in pzhMap) {
        var pzh = pzhMap[id];
        find_pzh(id, true).find('.no').text(pzh);
    }

    if (needSaveSetting) {
        setTimeout(function () {
            setImagePoolBlockSize(imgPool.getConfig("gguid"), v);
        }, 1000);
    }



}

/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet, name, data) {
    //console.dir(data);
    var url = data.url_img;
    book.sheet0.cells("imgPreview").setValue(url);
}
function imageOnMouseOut(sheet, name, data) {

    book.sheet0.cells("imgPreview").setValue("");
}


/**
 * 图片控件中某个图片被双击了
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片被双击)
function imageOnDBLClick(sheet, name, data) {

    //因为 mouseOut 会把大图清除掉，所以这里重新再设置上
    setTimeout(function () {
        var url = data.url_img;
        book.sheet0.cells("imgPreview").setValue(url);

    }, 200);

    var pzh = '';
    try {

        pzh = find_pzh(data.id, false).find('.no').text();
    } catch (err) {

    }

    if (pzh == undefined) pzh = '';

    inputBox("标记为凭证", "", pzh, "输入凭证号码", function (val) {
        if (val == '') {
            var p = find_pzh(data.id, false);
            if (p) p.remove();
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, false);
        } else {
            find_pzh(data.id, true).find('.no').text(val);
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, true);
        }

    }, true /*允许为空*/);
}


//@comment (group=,caption=查找或创建凭证号标记对象,needRightControl=false)
function find_pzh(id, create_if_not_exists) {
    var d = $('#' + id);
    if (!d) {
        $.alert(id + "不存在");
        return null;
    }

    var ret = d.find('.pzh');
    if (ret.length == 0) {
        if (create_if_not_exists) //如果需要创建，则创建它
        {
            d.append(`<div class="pzh" ><div class="no"></div><div class="delete_pzh"><i class="fa fa-close" onclick="removePZH('${id}');  event.preventDefault(); event.stopPropagation();"> </i></div></div>`);
        }
        ret = d.find('.pzh');
    }
    return ret;

}

function removePZH(id) {
    var p = find_pzh(id, false);
    if (p) p.remove();
}

function cb_selectall_onClick() {
    var imgPool = book.sheet1.getBrick('imgPool');
    if (imgPool.getSelectedImageList().length == 0) {
        imgPool.selectAll();
    } else {
        imgPool.unSelectAll();
    }
}


id: 60a8a653efb25942c0f223b4
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.22 15:00:01.000
script:
function formOpen() {
    book.sheet1.getBrick('imgPool').selectionMode = 'multi'; //图片设置成多选模式

    $(document.body).append(`<style>
                        .pzh {position:absolute;left:0;bottom:0px; 
                                height:24px; line-height:24px;width:100%; 
                                background-color:#40af40a0; 
                                color:white;font-weight:bold;font-size:16px;text-align:center;}

                        .delete_pzh { position:absolute; right:0; width:40px; height:14px; top:0; text-align:right; vertical-align:top; font-size:12px; color:gray;padding-right:5px;}      
                        .delete_pzh:hover { color:white;}      
                          
                        </style>
 `);


    //  let data= loadImagePoolData();
    //  console.dir(data);


    $('#blockSize').on('input', resetImgPoolBlockSize);
    setTimeout(function () {
        //调取缩略图大小
       
        let blockSize = getImagePoolBlockSize();
        if (blockSize != 128) {
            $('#blockSize').val(blockSize);
            resetImgPoolBlockSize(false);
        }
    }, 1000);

}



function resetImgPoolBlockSize(needSaveSetting) {
    if (needSaveSetting == null) needSaveSetting = true;
    var imgPool = book.sheet1.getBrick('imgPool');

    // 先保存当前选中状态及设置的凭证号信息
    var selection = imgPool.getSelectedImageList();
    var pzhMap = {};
    var pzhs = imgPool.dom.find('.pzh');
    for (let i = 0; i < pzhs.length; i++) {
        let id = $(pzhs[i]).parent().attr('id');
        let pzh = $(pzhs[i]).find('.no').text();
        pzhMap[id] = pzh;

    }


    let v = $('#blockSize').val();

    imgPool.config.blockSize = parseInt(v);
    imgPool.rebuildGridly();
    //恢复选中状态
    for (let i = 0; i < selection.length; i++) {
        imgPool.setImageSelected(selection[i].id, true);
    }
    //恢复凭证号
    for (let id in pzhMap) {
        var pzh = pzhMap[id];
        find_pzh(id, true).find('.no').text(pzh);
    }

    if (needSaveSetting) {
        setTimeout(function () {
            setImagePoolBlockSize(imgPool.getConfig("gguid"), v);
        }, 1000);
    }



}

/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet, name, data) {
    //console.dir(data);
    var url = data.url_img;
    book.sheet0.cells("imgPreview").setValue(url);
}
function imageOnMouseOut(sheet, name, data) {

    book.sheet0.cells("imgPreview").setValue("");
}


/**
 * 图片控件中某个图片被双击了
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片被双击)
function imageOnDBLClick(sheet, name, data) {

    //因为 mouseOut 会把大图清除掉，所以这里重新再设置上
    setTimeout(function () {
        var url = data.url_img;
        book.sheet0.cells("imgPreview").setValue(url);

    }, 200);

    var pzh = '';
    try {

        pzh = find_pzh(data.id, false).find('.no').text();
    } catch (err) {

    }

    if (pzh == undefined) pzh = '';

    inputBox("标记为凭证", "", pzh, "输入凭证号码", function (val) {
        if (val == '') {
            var p = find_pzh(data.id, false);
            if (p) p.remove();
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, false);
        } else {
            find_pzh(data.id, true).find('.no').text(val);
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, true);
        }

    }, true /*允许为空*/);
}


//@comment (group=,caption=查找或创建凭证号标记对象,needRightControl=false)
function find_pzh(id, create_if_not_exists) {
    var d = $('#' + id);
    if (!d) {
        $.alert(id + "不存在");
        return null;
    }

    var ret = d.find('.pzh');
    if (ret.length == 0) {
        if (create_if_not_exists) //如果需要创建，则创建它
        {
            d.append(`<div class="pzh" ><div class="no"></div><div class="delete_pzh"><i class="fa fa-close" onclick="removePZH('${id}');  event.preventDefault(); event.stopPropagation();"> </i></div></div>`);
        }
        ret = d.find('.pzh');
    }
    return ret;

}

function removePZH(id) {
    var p = find_pzh(id, false);
    if (p) p.remove();
}

function cb_selectall_onClick() {
    var imgPool = book.sheet1.getBrick('imgPool');
    if (imgPool.getSelectedImageList().length == 0) {
        imgPool.selectAll();
    } else {
        imgPool.unSelectAll();
    }
}


id: 60a8a653efb25942c0f223bf
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.22 15:04:29.000
script:
function formOpen() {
    book.sheet1.getBrick('imgPool').selectionMode = 'multi'; //图片设置成多选模式

    $(document.body).append(`<style>
                        .pzh {position:absolute;left:0;bottom:0px; 
                                height:24px; line-height:24px;width:100%; 
                                background-color:#40af40a0; 
                                color:white;font-weight:bold;font-size:16px;text-align:center;}

                        .delete_pzh { position:absolute; right:0; width:40px; height:14px; top:0; text-align:right; vertical-align:top; font-size:12px; color:gray;padding-right:5px;}      
                        .delete_pzh:hover { color:white;}      
                          
                        </style>
 `);


    //  let data= loadImagePoolData();
    //  console.dir(data);


    $('#blockSize').on('input', resetImgPoolBlockSize);
    

}

/**
 * 图片控件初始化完成
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片控件初始化完成)
function imageGridlyInited(sheet , name, data ) {
  //调取缩略图大小
       
        let blockSize = getImagePoolBlockSize();
        if (blockSize != 128) {
            $('#blockSize').val(blockSize);
            resetImgPoolBlockSize(false);
        }
}


function resetImgPoolBlockSize(needSaveSetting) {
    if (needSaveSetting == null) needSaveSetting = true;
    var imgPool = book.sheet1.getBrick('imgPool');

    // 先保存当前选中状态及设置的凭证号信息
    var selection = imgPool.getSelectedImageList();
    var pzhMap = {};
    var pzhs = imgPool.dom.find('.pzh');
    for (let i = 0; i < pzhs.length; i++) {
        let id = $(pzhs[i]).parent().attr('id');
        let pzh = $(pzhs[i]).find('.no').text();
        pzhMap[id] = pzh;

    }


    let v = $('#blockSize').val();

    imgPool.config.blockSize = parseInt(v);
    imgPool.rebuildGridly();
    //恢复选中状态
    for (let i = 0; i < selection.length; i++) {
        imgPool.setImageSelected(selection[i].id, true);
    }
    //恢复凭证号
    for (let id in pzhMap) {
        var pzh = pzhMap[id];
        find_pzh(id, true).find('.no').text(pzh);
    }

    if (needSaveSetting) {
        setTimeout(function () {
            setImagePoolBlockSize(imgPool.getConfig("gguid"), v);
        }, 1000);
    }



}

/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet, name, data) {
    //console.dir(data);
    var url = data.url_img;
    book.sheet0.cells("imgPreview").setValue(url);
}
function imageOnMouseOut(sheet, name, data) {

    book.sheet0.cells("imgPreview").setValue("");
}


/**
 * 图片控件中某个图片被双击了
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片被双击)
function imageOnDBLClick(sheet, name, data) {

    //因为 mouseOut 会把大图清除掉，所以这里重新再设置上
    setTimeout(function () {
        var url = data.url_img;
        book.sheet0.cells("imgPreview").setValue(url);

    }, 200);

    var pzh = '';
    try {

        pzh = find_pzh(data.id, false).find('.no').text();
    } catch (err) {

    }

    if (pzh == undefined) pzh = '';

    inputBox("标记为凭证", "", pzh, "输入凭证号码", function (val) {
        if (val == '') {
            var p = find_pzh(data.id, false);
            if (p) p.remove();
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, false);
        } else {
            find_pzh(data.id, true).find('.no').text(val);
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, true);
        }

    }, true /*允许为空*/);
}


//@comment (group=,caption=查找或创建凭证号标记对象,needRightControl=false)
function find_pzh(id, create_if_not_exists) {
    var d = $('#' + id);
    if (!d) {
        $.alert(id + "不存在");
        return null;
    }

    var ret = d.find('.pzh');
    if (ret.length == 0) {
        if (create_if_not_exists) //如果需要创建，则创建它
        {
            d.append(`<div class="pzh" ><div class="no"></div><div class="delete_pzh"><i class="fa fa-close" onclick="removePZH('${id}');  event.preventDefault(); event.stopPropagation();"> </i></div></div>`);
        }
        ret = d.find('.pzh');
    }
    return ret;

}

function removePZH(id) {
    var p = find_pzh(id, false);
    if (p) p.remove();
}

function cb_selectall_onClick() {
    var imgPool = book.sheet1.getBrick('imgPool');
    if (imgPool.getSelectedImageList().length == 0) {
        imgPool.selectAll();
    } else {
        imgPool.unSelectAll();
    }
}


id: 60a8a653efb25942c0f223c5
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.22 15:05:34.000
script:
function formOpen() {
    book.sheet1.getBrick('imgPool').selectionMode = 'multi'; //图片设置成多选模式

    $(document.body).append(`<style>
                        .pzh {position:absolute;left:0;bottom:0px; 
                                height:24px; line-height:24px;width:100%; 
                                background-color:#40af40a0; 
                                color:white;font-weight:bold;font-size:16px;text-align:center;}

                        .delete_pzh { position:absolute; right:0; width:40px; height:14px; top:0; text-align:right; vertical-align:top; font-size:12px; color:gray;padding-right:5px;}      
                        .delete_pzh:hover { color:white;}      
                          
                        </style>
 `);


    //  let data= loadImagePoolData();
    //  console.dir(data);


    $('#blockSize').on('input', resetImgPoolBlockSize);
    

}

/**
 * 图片控件初始化完成
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片控件初始化完成)
function imageGridlyInited(sheet , name, data ) {
  //调取缩略图大小
       var imgPool = book.sheet1.getBrick('imgPool');

        let blockSize = getImagePoolBlockSize();
        if (blockSize != imgPool.config.blockSize) {
            $('#blockSize').val(blockSize);
            resetImgPoolBlockSize(false);
        }
}


function resetImgPoolBlockSize(needSaveSetting) {
    if (needSaveSetting == null) needSaveSetting = true;
    var imgPool = book.sheet1.getBrick('imgPool');

    // 先保存当前选中状态及设置的凭证号信息
    var selection = imgPool.getSelectedImageList();
    var pzhMap = {};
    var pzhs = imgPool.dom.find('.pzh');
    for (let i = 0; i < pzhs.length; i++) {
        let id = $(pzhs[i]).parent().attr('id');
        let pzh = $(pzhs[i]).find('.no').text();
        pzhMap[id] = pzh;

    }


    let v = $('#blockSize').val();

    imgPool.config.blockSize = parseInt(v);
    imgPool.rebuildGridly();
    //恢复选中状态
    for (let i = 0; i < selection.length; i++) {
        imgPool.setImageSelected(selection[i].id, true);
    }
    //恢复凭证号
    for (let id in pzhMap) {
        var pzh = pzhMap[id];
        find_pzh(id, true).find('.no').text(pzh);
    }

    if (needSaveSetting) {
        setTimeout(function () {
            setImagePoolBlockSize(imgPool.getConfig("gguid"), v);
        }, 1000);
    }



}

/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet, name, data) {
    //console.dir(data);
    var url = data.url_img;
    book.sheet0.cells("imgPreview").setValue(url);
}
function imageOnMouseOut(sheet, name, data) {

    book.sheet0.cells("imgPreview").setValue("");
}


/**
 * 图片控件中某个图片被双击了
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片被双击)
function imageOnDBLClick(sheet, name, data) {

    //因为 mouseOut 会把大图清除掉，所以这里重新再设置上
    setTimeout(function () {
        var url = data.url_img;
        book.sheet0.cells("imgPreview").setValue(url);

    }, 200);

    var pzh = '';
    try {

        pzh = find_pzh(data.id, false).find('.no').text();
    } catch (err) {

    }

    if (pzh == undefined) pzh = '';

    inputBox("标记为凭证", "", pzh, "输入凭证号码", function (val) {
        if (val == '') {
            var p = find_pzh(data.id, false);
            if (p) p.remove();
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, false);
        } else {
            find_pzh(data.id, true).find('.no').text(val);
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, true);
        }

    }, true /*允许为空*/);
}


//@comment (group=,caption=查找或创建凭证号标记对象,needRightControl=false)
function find_pzh(id, create_if_not_exists) {
    var d = $('#' + id);
    if (!d) {
        $.alert(id + "不存在");
        return null;
    }

    var ret = d.find('.pzh');
    if (ret.length == 0) {
        if (create_if_not_exists) //如果需要创建，则创建它
        {
            d.append(`<div class="pzh" ><div class="no"></div><div class="delete_pzh"><i class="fa fa-close" onclick="removePZH('${id}');  event.preventDefault(); event.stopPropagation();"> </i></div></div>`);
        }
        ret = d.find('.pzh');
    }
    return ret;

}

function removePZH(id) {
    var p = find_pzh(id, false);
    if (p) p.remove();
}

function cb_selectall_onClick() {
    var imgPool = book.sheet1.getBrick('imgPool');
    if (imgPool.getSelectedImageList().length == 0) {
        imgPool.selectAll();
    } else {
        imgPool.unSelectAll();
    }
}


id: 60a8a653efb25942c0f223cb
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.22 15:07:19.000
script:
function formOpen() {
    book.sheet1.getBrick('imgPool').selectionMode = 'multi'; //图片设置成多选模式

    $(document.body).append(`<style>
                        .pzh {position:absolute;left:0;bottom:0px; 
                                height:24px; line-height:24px;width:100%; 
                                background-color:#40af40a0; 
                                color:white;font-weight:bold;font-size:16px;text-align:center;}

                        .delete_pzh { position:absolute; right:0; width:40px; height:14px; top:0; text-align:right; vertical-align:top; font-size:12px; color:gray;padding-right:5px;}      
                        .delete_pzh:hover { color:white;}      
                          
                        </style>
 `);


    //  let data= loadImagePoolData();
    //  console.dir(data);


    $('#blockSize').on('input', resetImgPoolBlockSize);
    
    setTimeout( function()
    {
        //调取缩略图大小
       var imgPool = book.sheet1.getBrick('imgPool');

        let blockSize = getImagePoolBlockSize();
        if (blockSize != imgPool.config.blockSize) {
            $('#blockSize').val(blockSize);
            resetImgPoolBlockSize(false);
        }
    },1000);

}

 

function resetImgPoolBlockSize(needSaveSetting) {
    if (needSaveSetting == null) needSaveSetting = true;
    var imgPool = book.sheet1.getBrick('imgPool');

    // 先保存当前选中状态及设置的凭证号信息
    var selection = imgPool.getSelectedImageList();
    var pzhMap = {};
    var pzhs = imgPool.dom.find('.pzh');
    for (let i = 0; i < pzhs.length; i++) {
        let id = $(pzhs[i]).parent().attr('id');
        let pzh = $(pzhs[i]).find('.no').text();
        pzhMap[id] = pzh;

    }


    let v = $('#blockSize').val();

    imgPool.config.blockSize = parseInt(v);
    imgPool.rebuildGridly();
    //恢复选中状态
    for (let i = 0; i < selection.length; i++) {
        imgPool.setImageSelected(selection[i].id, true);
    }
    //恢复凭证号
    for (let id in pzhMap) {
        var pzh = pzhMap[id];
        find_pzh(id, true).find('.no').text(pzh);
    }

    if (needSaveSetting) {
        setTimeout(function () {
            setImagePoolBlockSize(imgPool.getConfig("gguid"), v);
        }, 1000);
    }



}

/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet, name, data) {
    //console.dir(data);
    var url = data.url_img;
    book.sheet0.cells("imgPreview").setValue(url);
}
function imageOnMouseOut(sheet, name, data) {

    book.sheet0.cells("imgPreview").setValue("");
}


/**
 * 图片控件中某个图片被双击了
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片被双击)
function imageOnDBLClick(sheet, name, data) {

    //因为 mouseOut 会把大图清除掉，所以这里重新再设置上
    setTimeout(function () {
        var url = data.url_img;
        book.sheet0.cells("imgPreview").setValue(url);

    }, 200);

    var pzh = '';
    try {

        pzh = find_pzh(data.id, false).find('.no').text();
    } catch (err) {

    }

    if (pzh == undefined) pzh = '';

    inputBox("标记为凭证", "", pzh, "输入凭证号码", function (val) {
        if (val == '') {
            var p = find_pzh(data.id, false);
            if (p) p.remove();
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, false);
        } else {
            find_pzh(data.id, true).find('.no').text(val);
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, true);
        }

    }, true /*允许为空*/);
}


//@comment (group=,caption=查找或创建凭证号标记对象,needRightControl=false)
function find_pzh(id, create_if_not_exists) {
    var d = $('#' + id);
    if (!d) {
        $.alert(id + "不存在");
        return null;
    }

    var ret = d.find('.pzh');
    if (ret.length == 0) {
        if (create_if_not_exists) //如果需要创建，则创建它
        {
            d.append(`<div class="pzh" ><div class="no"></div><div class="delete_pzh"><i class="fa fa-close" onclick="removePZH('${id}');  event.preventDefault(); event.stopPropagation();"> </i></div></div>`);
        }
        ret = d.find('.pzh');
    }
    return ret;

}

function removePZH(id) {
    var p = find_pzh(id, false);
    if (p) p.remove();
}

function cb_selectall_onClick() {
    var imgPool = book.sheet1.getBrick('imgPool');
    if (imgPool.getSelectedImageList().length == 0) {
        imgPool.selectAll();
    } else {
        imgPool.unSelectAll();
    }
}


id: 60a903715db21e3d0fbaadd1
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.22 21:20:36.000
script:
function formOpen() {
    book.sheet1.getBrick('imgPool').selectionMode = 'multi'; //图片设置成多选模式

    $(document.body).append(`<style>
                        .pzh {position:absolute;left:0;bottom:0px; 
                                height:24px; line-height:24px;width:100%; 
                                background-color:#40af40a0; 
                                color:white;font-weight:bold;font-size:16px;text-align:center;}

                        .delete_pzh { position:absolute; right:0; width:40px; height:14px; top:0; text-align:right; vertical-align:top; font-size:12px; color:gray;padding-right:5px;}      
                        .delete_pzh:hover { color:white;}      
                          
                        </style>
 `);


    //  let data= loadImagePoolData();
    //  console.dir(data);


    $('#blockSize').on('input', resetImgPoolBlockSize);
    
    setTimeout( function()
    {
        //调取缩略图大小
       var imgPool = book.sheet1.getBrick('imgPool');

        let blockSize = getImagePoolBlockSize();
        if (blockSize != imgPool.config.blockSize) {
            $('#blockSize').val(blockSize);
            resetImgPoolBlockSize(false);
        }
    },1000);

}

 

function resetImgPoolBlockSize(needSaveSetting) {
    if (needSaveSetting == null) needSaveSetting = true;
    var imgPool = book.sheet1.getBrick('imgPool');

    // 先保存当前选中状态及设置的凭证号信息
    var selection = imgPool.getSelectedImageList();
    var pzhMap = {};
    var pzhs = imgPool.dom.find('.pzh');
    for (let i = 0; i < pzhs.length; i++) {
        let id = $(pzhs[i]).parent().attr('id');
        let pzh = $(pzhs[i]).find('.no').text();
        pzhMap[id] = pzh;

    }


    let v = $('#blockSize').val();

    imgPool.config.blockSize = parseInt(v);
    imgPool.rebuildGridly();
    //恢复选中状态
    for (let i = 0; i < selection.length; i++) {
        imgPool.setImageSelected(selection[i].id, true);
    }
    //恢复凭证号
    for (let id in pzhMap) {
        var pzh = pzhMap[id];
        find_pzh(id, true).find('.no').text(pzh);
    }

    if (needSaveSetting) {
        setTimeout(function () {
            setImagePoolBlockSize(imgPool.getConfig("gguid"), v);
        }, 1000);
    }



}

/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet, name, data) {
    //console.dir(data);
    var url = data.url_img;
    book.sheet0.cells("imgPreview").setValue(url);
}
function imageOnMouseOut(sheet, name, data) {

    book.sheet0.cells("imgPreview").setValue("");
}


/**
 * 图片控件中某个图片被双击了
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片被双击)
function imageOnDBLClick(sheet, name, data) {

    //因为 mouseOut 会把大图清除掉，所以这里重新再设置上
    setTimeout(function () {
        var url = data.url_img;
        book.sheet0.cells("imgPreview").setValue(url);

    }, 200);

    var pzh = '';
    try {

        pzh = find_pzh(data.id, false).find('.no').text();
    } catch (err) {

    }

    if (pzh == undefined) pzh = '';

    inputBox("标记为凭证", "", pzh, "输入凭证号码", function (val) {
        if (val == '') {
            var p = find_pzh(data.id, false);
            if (p) p.remove();
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, false);
        } else {
            find_pzh(data.id, true).find('.no').text(val);
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, true);
        }

    }, true /*允许为空*/);
}


//@comment (group=,caption=查找或创建凭证号标记对象,needRightControl=false)
function find_pzh(id, create_if_not_exists) {
    var d = $('#' + id);
    if (!d) {
        $.alert(id + "不存在");
        return null;
    }

    var ret = d.find('.pzh');
    if (ret.length == 0) {
        if (create_if_not_exists) //如果需要创建，则创建它
        {
            d.append(`<div class="pzh" ><div class="no"></div><div class="delete_pzh"><i class="fa fa-close" onclick="removePZH('${id}');  event.preventDefault(); event.stopPropagation();"> </i></div></div>`);
        }
        ret = d.find('.pzh');
    }
    return ret;

}

function removePZH(id) {
    var p = find_pzh(id, false);
    if (p) p.remove();
}

function cb_selectall_onClick() {
    var imgPool = book.sheet1.getBrick('imgPool');
    if (imgPool.getSelectedImageList().length == 0) {
        imgPool.selectAll();
    } else {
        imgPool.unSelectAll();
    }
}


function cb_path_onClick()
{
    if( window.electron==null)
    {
        toastr.error("此功能仅能在客户端APP中执行");
        return;
    }

    electron.ipcSendMessage(JSON.stringify({actipn:"selectClientPathToMonite"}));
}


id: 60a903715db21e3d0fbaadd7
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.22 21:35:21.000
script:
function formOpen() {
    book.sheet1.getBrick('imgPool').selectionMode = 'multi'; //图片设置成多选模式

    $(document.body).append(`<style>
                        .pzh {position:absolute;left:0;bottom:0px; 
                                height:24px; line-height:24px;width:100%; 
                                background-color:#40af40a0; 
                                color:white;font-weight:bold;font-size:16px;text-align:center;}

                        .delete_pzh { position:absolute; right:0; width:40px; height:14px; top:0; text-align:right; vertical-align:top; font-size:12px; color:gray;padding-right:5px;}      
                        .delete_pzh:hover { color:white;}      
                          
                        </style>
 `);


    //  let data= loadImagePoolData();
    //  console.dir(data);


    $('#blockSize').on('input', resetImgPoolBlockSize);
    
    setTimeout( function()
    {
        //调取缩略图大小
       var imgPool = book.sheet1.getBrick('imgPool');

        let blockSize = getImagePoolBlockSize();
        if (blockSize != imgPool.config.blockSize) {
            $('#blockSize').val(blockSize);
            resetImgPoolBlockSize(false);
        }
    },1000);

}

 

function resetImgPoolBlockSize(needSaveSetting) {
    if (needSaveSetting == null) needSaveSetting = true;
    var imgPool = book.sheet1.getBrick('imgPool');

    // 先保存当前选中状态及设置的凭证号信息
    var selection = imgPool.getSelectedImageList();
    var pzhMap = {};
    var pzhs = imgPool.dom.find('.pzh');
    for (let i = 0; i < pzhs.length; i++) {
        let id = $(pzhs[i]).parent().attr('id');
        let pzh = $(pzhs[i]).find('.no').text();
        pzhMap[id] = pzh;

    }


    let v = $('#blockSize').val();

    imgPool.config.blockSize = parseInt(v);
    imgPool.rebuildGridly();
    //恢复选中状态
    for (let i = 0; i < selection.length; i++) {
        imgPool.setImageSelected(selection[i].id, true);
    }
    //恢复凭证号
    for (let id in pzhMap) {
        var pzh = pzhMap[id];
        find_pzh(id, true).find('.no').text(pzh);
    }

    if (needSaveSetting) {
        setTimeout(function () {
            setImagePoolBlockSize(imgPool.getConfig("gguid"), v);
        }, 1000);
    }



}

/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet, name, data) {
    //console.dir(data);
    var url = data.url_img;
    book.sheet0.cells("imgPreview").setValue(url);
}
function imageOnMouseOut(sheet, name, data) {

    book.sheet0.cells("imgPreview").setValue("");
}


/**
 * 图片控件中某个图片被双击了
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片被双击)
function imageOnDBLClick(sheet, name, data) {

    //因为 mouseOut 会把大图清除掉，所以这里重新再设置上
    setTimeout(function () {
        var url = data.url_img;
        book.sheet0.cells("imgPreview").setValue(url);

    }, 200);

    var pzh = '';
    try {

        pzh = find_pzh(data.id, false).find('.no').text();
    } catch (err) {

    }

    if (pzh == undefined) pzh = '';

    inputBox("标记为凭证", "", pzh, "输入凭证号码", function (val) {
        if (val == '') {
            var p = find_pzh(data.id, false);
            if (p) p.remove();
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, false);
        } else {
            find_pzh(data.id, true).find('.no').text(val);
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, true);
        }

    }, true /*允许为空*/);
}


//@comment (group=,caption=查找或创建凭证号标记对象,needRightControl=false)
function find_pzh(id, create_if_not_exists) {
    var d = $('#' + id);
    if (!d) {
        $.alert(id + "不存在");
        return null;
    }

    var ret = d.find('.pzh');
    if (ret.length == 0) {
        if (create_if_not_exists) //如果需要创建，则创建它
        {
            d.append(`<div class="pzh" ><div class="no"></div><div class="delete_pzh"><i class="fa fa-close" onclick="removePZH('${id}');  event.preventDefault(); event.stopPropagation();"> </i></div></div>`);
        }
        ret = d.find('.pzh');
    }
    return ret;

}

function removePZH(id) {
    var p = find_pzh(id, false);
    if (p) p.remove();
}

function cb_selectall_onClick() {
    var imgPool = book.sheet1.getBrick('imgPool');
    if (imgPool.getSelectedImageList().length == 0) {
        imgPool.selectAll();
    } else {
        imgPool.unSelectAll();
    }
}


function cb_path_onClick()
{
    if( window.electron==null)
    {
        toastr.error("此功能仅能在客户端APP中执行");
        return;
    }

    var path=electron.showOpenDialogSync(''); 
    alert( path);
}


id: 60a903715db21e3d0fbaadde
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.22 21:43:42.000
script:
function formOpen() {
    book.showTabOnWhere="none";
    
    book.sheet1.getBrick('imgPool').selectionMode = 'multi'; //图片设置成多选模式

    $(document.body).append(`<style>
                        .pzh {position:absolute;left:0;bottom:0px; 
                                height:24px; line-height:24px;width:100%; 
                                background-color:#40af40a0; 
                                color:white;font-weight:bold;font-size:16px;text-align:center;}

                        .delete_pzh { position:absolute; right:0; width:40px; height:14px; top:0; text-align:right; vertical-align:top; font-size:12px; color:gray;padding-right:5px;}      
                        .delete_pzh:hover { color:white;}      
                          
                        </style>
 `);


    //  let data= loadImagePoolData();
    //  console.dir(data);


    $('#blockSize').on('input', resetImgPoolBlockSize);
    
    setTimeout( function()
    {
        //调取缩略图大小
       var imgPool = book.sheet1.getBrick('imgPool');

        let blockSize = getImagePoolBlockSize();
        if (blockSize != imgPool.config.blockSize) {
            $('#blockSize').val(blockSize);
            resetImgPoolBlockSize(false);
        }
    },1000);

}

 

function resetImgPoolBlockSize(needSaveSetting) {
    if (needSaveSetting == null) needSaveSetting = true;
    var imgPool = book.sheet1.getBrick('imgPool');

    // 先保存当前选中状态及设置的凭证号信息
    var selection = imgPool.getSelectedImageList();
    var pzhMap = {};
    var pzhs = imgPool.dom.find('.pzh');
    for (let i = 0; i < pzhs.length; i++) {
        let id = $(pzhs[i]).parent().attr('id');
        let pzh = $(pzhs[i]).find('.no').text();
        pzhMap[id] = pzh;

    }


    let v = $('#blockSize').val();

    imgPool.config.blockSize = parseInt(v);
    imgPool.rebuildGridly();
    //恢复选中状态
    for (let i = 0; i < selection.length; i++) {
        imgPool.setImageSelected(selection[i].id, true);
    }
    //恢复凭证号
    for (let id in pzhMap) {
        var pzh = pzhMap[id];
        find_pzh(id, true).find('.no').text(pzh);
    }

    if (needSaveSetting) {
        setTimeout(function () {
            setImagePoolBlockSize(imgPool.getConfig("gguid"), v);
        }, 1000);
    }



}

/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet, name, data) {
    //console.dir(data);
    var url = data.url_img;
    book.sheet0.cells("imgPreview").setValue(url);
}
function imageOnMouseOut(sheet, name, data) {

    book.sheet0.cells("imgPreview").setValue("");
}


/**
 * 图片控件中某个图片被双击了
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片被双击)
function imageOnDBLClick(sheet, name, data) {

    //因为 mouseOut 会把大图清除掉，所以这里重新再设置上
    setTimeout(function () {
        var url = data.url_img;
        book.sheet0.cells("imgPreview").setValue(url);

    }, 200);

    var pzh = '';
    try {

        pzh = find_pzh(data.id, false).find('.no').text();
    } catch (err) {

    }

    if (pzh == undefined) pzh = '';

    inputBox("标记为凭证", "", pzh, "输入凭证号码", function (val) {
        if (val == '') {
            var p = find_pzh(data.id, false);
            if (p) p.remove();
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, false);
        } else {
            find_pzh(data.id, true).find('.no').text(val);
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, true);
        }

    }, true /*允许为空*/);
}


//@comment (group=,caption=查找或创建凭证号标记对象,needRightControl=false)
function find_pzh(id, create_if_not_exists) {
    var d = $('#' + id);
    if (!d) {
        $.alert(id + "不存在");
        return null;
    }

    var ret = d.find('.pzh');
    if (ret.length == 0) {
        if (create_if_not_exists) //如果需要创建，则创建它
        {
            d.append(`<div class="pzh" ><div class="no"></div><div class="delete_pzh"><i class="fa fa-close" onclick="removePZH('${id}');  event.preventDefault(); event.stopPropagation();"> </i></div></div>`);
        }
        ret = d.find('.pzh');
    }
    return ret;

}

function removePZH(id) {
    var p = find_pzh(id, false);
    if (p) p.remove();
}

function cb_selectall_onClick() {
    var imgPool = book.sheet1.getBrick('imgPool');
    if (imgPool.getSelectedImageList().length == 0) {
        imgPool.selectAll();
    } else {
        imgPool.unSelectAll();
    }
}


function cb_path_onClick()
{
    if( window.electron==null)
    {
        toastr.error("此功能仅能在客户端APP中执行");
        return;
    }

    var path=electron.showOpenDialogSync(''); 
    alert( path);
}


id: 60a903715db21e3d0fbaade4
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.22 21:48:45.000
script:
function formOpen() {
    book.showTabOnWhere="none";

    book.sheet1.getBrick('imgPool').selectionMode = 'multi'; //图片设置成多选模式

    $(document.body).append(`<style>
                        .pzh {position:absolute;left:0;bottom:0px; 
                                height:24px; line-height:24px;width:100%; 
                                background-color:#40af40a0; 
                                color:white;font-weight:bold;font-size:16px;text-align:center;}

                        .delete_pzh { position:absolute; right:0; width:40px; height:14px; top:0; text-align:right; vertical-align:top; font-size:12px; color:gray;padding-right:5px;}      
                        .delete_pzh:hover { color:white;}      
                          
                        </style>
 `);


    //  let data= loadImagePoolData();
    //  console.dir(data);


    $('#blockSize').on('input', resetImgPoolBlockSize);
    
    setTimeout( function()
    {
        //调取缩略图大小
       var imgPool = book.sheet1.getBrick('imgPool');

        let blockSize = getImagePoolBlockSize();
        if (blockSize != imgPool.config.blockSize) {
            $('#blockSize').val(blockSize);
            resetImgPoolBlockSize(false);
        }
    },1000);

}

 

function resetImgPoolBlockSize(needSaveSetting) {
    if (needSaveSetting == null) needSaveSetting = true;
    var imgPool = book.sheet1.getBrick('imgPool');

    // 先保存当前选中状态及设置的凭证号信息
    var selection = imgPool.getSelectedImageList();
    var pzhMap = {};
    var pzhs = imgPool.dom.find('.pzh');
    for (let i = 0; i < pzhs.length; i++) {
        let id = $(pzhs[i]).parent().attr('id');
        let pzh = $(pzhs[i]).find('.no').text();
        pzhMap[id] = pzh;

    }


    let v = $('#blockSize').val();

    imgPool.config.blockSize = parseInt(v);
    imgPool.rebuildGridly();
    //恢复选中状态
    for (let i = 0; i < selection.length; i++) {
        imgPool.setImageSelected(selection[i].id, true);
    }
    //恢复凭证号
    for (let id in pzhMap) {
        var pzh = pzhMap[id];
        find_pzh(id, true).find('.no').text(pzh);
    }

    if (needSaveSetting) {
        setTimeout(function () {
            setImagePoolBlockSize(imgPool.getConfig("gguid"), v);
        }, 1000);
    }



}

/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet, name, data) {
    //console.dir(data);
    var url = data.url_img;
    book.sheet0.cells("imgPreview").setValue(url);
}
function imageOnMouseOut(sheet, name, data) {

    book.sheet0.cells("imgPreview").setValue("");
}


/**
 * 图片控件中某个图片被双击了
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片被双击)
function imageOnDBLClick(sheet, name, data) {

    //因为 mouseOut 会把大图清除掉，所以这里重新再设置上
    setTimeout(function () {
        var url = data.url_img;
        book.sheet0.cells("imgPreview").setValue(url);

    }, 200);

    var pzh = '';
    try {

        pzh = find_pzh(data.id, false).find('.no').text();
    } catch (err) {

    }

    if (pzh == undefined) pzh = '';

    inputBox("标记为凭证", "", pzh, "输入凭证号码", function (val) {
        if (val == '') {
            var p = find_pzh(data.id, false);
            if (p) p.remove();
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, false);
        } else {
            find_pzh(data.id, true).find('.no').text(val);
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, true);
        }

    }, true /*允许为空*/);
}


//@comment (group=,caption=查找或创建凭证号标记对象,needRightControl=false)
function find_pzh(id, create_if_not_exists) {
    var d = $('#' + id);
    if (!d) {
        $.alert(id + "不存在");
        return null;
    }

    var ret = d.find('.pzh');
    if (ret.length == 0) {
        if (create_if_not_exists) //如果需要创建，则创建它
        {
            d.append(`<div class="pzh" ><div class="no"></div><div class="delete_pzh"><i class="fa fa-close" onclick="removePZH('${id}');  event.preventDefault(); event.stopPropagation();"> </i></div></div>`);
        }
        ret = d.find('.pzh');
    }
    return ret;

}

function removePZH(id) {
    var p = find_pzh(id, false);
    if (p) p.remove();
}

function cb_selectall_onClick() {
    var imgPool = book.sheet1.getBrick('imgPool');
    if (imgPool.getSelectedImageList().length == 0) {
        imgPool.selectAll();
    } else {
        imgPool.unSelectAll();
    }
}


function cb_path_onClick()
{
    if( window.electron==null)
    {
        toastr.error("此功能仅能在客户端APP中执行");
        return;
    }

    var path=electron.showOpenDialogSync(''); 
    if( path=='') return; 
    var hostName=  electron.getHostName();
    setMonitePath( hostName, path);
    

}


id: 60a90cf15db21e3d0fbaae04
scriptid: 60a321f05db27838e0c014bf
tablename: app_script
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.22 21:53:54.000
script:
//@comment (group=,caption=得到当前操作员待归档图片对应的GGUID,needRightControl=false)
function getImagePoolGGUID() {
    var ret = runTask("get_dzpz_imgpool_id_of_current_user", {});
    return JSON.parse(ret).gguid;

}

function getImagePoolBlockSize() {
    var ret = runTask("get_dzpz_imgpool_id_of_current_user", {});
    return JSON.parse(ret).blockSize;

}


//@comment (group=,caption=保存当前的缩略图大小,needRightControl=false)
function setImagePoolBlockSize(id, blockSize) {
    runSQL("", " update  dzpz_imgpool set blocksize=" + blockSize + " where gguid='" + id + "'  ");
}


//@comment (group=,caption=得到待归档的图片清单,needRightControl=true)
function loadImagePoolData() {
    var config = JSON.parse(runTask("get_dzpz_imgpool_id_of_current_user", {}));

    var ds = newDataStore(config.dbpool, "select * from " + config.logTable + "  where  gguid='" + config.gguid + "'  order by info1 "); // info1 是客户端文件创建的时间，以它排序
    var n = ds.retrieve();
    var ret = [];
    for (var i = 0; i < n; i++) {
        ret.push(JSON.parse(ds.getJSONRow(i, true)));
    }

    return ret;

}


function setMonitePath(hostName, path) {
    var ds = newDataStore("", "select * from dzpz_client");
    ds.retrieve(" hostname='" + hostName + "'");
    if (ds.getRowCount() == 0) {
        var newid = newGUID();
        ds.insertRow(0);
        ds.setValue(0, "id", newid);
        ds.setValue(0, "gguid", newid);
        ds.setValue(0, "billno", newid);
        ds.setValue(0, "userid", 1);
        ds.setValue(0, "username", '管理员');
        ds.setValue(0, "billtype", '');
        ds.setValue(0, "hostname", hostName);
    }
    ds.setValue(0, "path", path);
    ds.update(true);


}


id: 60a90cf15db21e3d0fbaae0c
scriptid: 60a321f05db27838e0c014bf
tablename: app_script
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.22 21:54:53.000
script:
//@comment (group=,caption=得到当前操作员待归档图片对应的GGUID,needRightControl=false)
function getImagePoolGGUID() {
    var ret = runTask("get_dzpz_imgpool_id_of_current_user", {});
    return JSON.parse(ret).gguid;

}

function getImagePoolBlockSize() {
    var ret = runTask("get_dzpz_imgpool_id_of_current_user", {});
    return JSON.parse(ret).blockSize;

}


//@comment (group=,caption=保存当前的缩略图大小,needRightControl=false)
function setImagePoolBlockSize(id, blockSize) {
    runSQL("", " update  dzpz_imgpool set blocksize=" + blockSize + " where gguid='" + id + "'  ");
}


//@comment (group=,caption=得到待归档的图片清单,needRightControl=true)
function loadImagePoolData() {
    var config = JSON.parse(runTask("get_dzpz_imgpool_id_of_current_user", {}));

    var ds = newDataStore(config.dbpool, "select * from " + config.logTable + "  where  gguid='" + config.gguid + "'  order by info1 "); // info1 是客户端文件创建的时间，以它排序
    var n = ds.retrieve();
    var ret = [];
    for (var i = 0; i < n; i++) {
        ret.push(JSON.parse(ds.getJSONRow(i, true)));
    }

    return ret;

}


function setMonitePath(hostName, path) {
    var ds = newDataStore("", "select * from dzpz_client");
    ds.retrieve(" hostname='" + hostName + "'");
    if (ds.getRowCount() == 0) {
        var newid = newGUID();
        ds.insertRow(0);
        ds.setValue(0, "id", newid);
        ds.setValue(0, "gguid", newid);
        ds.setValue(0, "billno", newid);
        ds.setValue(0, "userid", 1);
        ds.setValue(0, "username", '管理员');
        ds.setValue(0, "billtype", '');
        ds.setValue(0, "hostname", hostName);
    }
    ds.setValue(0, "path", path);
    ds.update(true);


}

function  getMonitePath(hostName)
{
    return   getStringFromSQL("select path from dzpz_client where  hostname='" + hostName + "'");
}


id: 60a90cf15db21e3d0fbaae12
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.22 21:57:43.000
script:
var pathToMonit = "";

function formOpen() {
    book.showTabOnWhere = "none";

    book.sheet1.getBrick('imgPool').selectionMode = 'multi'; //图片设置成多选模式

    $(document.body).append(`<style>
                        .pzh {position:absolute;left:0;bottom:0px; 
                                height:24px; line-height:24px;width:100%; 
                                background-color:#40af40a0; 
                                color:white;font-weight:bold;font-size:16px;text-align:center;}

                        .delete_pzh { position:absolute; right:0; width:40px; height:14px; top:0; text-align:right; vertical-align:top; font-size:12px; color:gray;padding-right:5px;}      
                        .delete_pzh:hover { color:white;}      
                          
                        </style>
 `);


    //  let data= loadImagePoolData();
    //  console.dir(data);


    $('#blockSize').on('input', resetImgPoolBlockSize);

    setTimeout(function () {
        //调取缩略图大小
        var imgPool = book.sheet1.getBrick('imgPool');

        let blockSize = getImagePoolBlockSize();
        if (blockSize != imgPool.config.blockSize) {
            $('#blockSize').val(blockSize);
            resetImgPoolBlockSize(false);
        }
    }, 1000);

//调取图片目录
    if (window.electron != null) {
        var hostName = electron.getHostName();
        pathToMonit = getMonitePath(hostName);
        book.sheet0.cells('stateBar').setValue("图片目录 " + pathToMonit);
    }

}



function resetImgPoolBlockSize(needSaveSetting) {
    if (needSaveSetting == null) needSaveSetting = true;
    var imgPool = book.sheet1.getBrick('imgPool');

    // 先保存当前选中状态及设置的凭证号信息
    var selection = imgPool.getSelectedImageList();
    var pzhMap = {};
    var pzhs = imgPool.dom.find('.pzh');
    for (let i = 0; i < pzhs.length; i++) {
        let id = $(pzhs[i]).parent().attr('id');
        let pzh = $(pzhs[i]).find('.no').text();
        pzhMap[id] = pzh;

    }


    let v = $('#blockSize').val();

    imgPool.config.blockSize = parseInt(v);
    imgPool.rebuildGridly();
    //恢复选中状态
    for (let i = 0; i < selection.length; i++) {
        imgPool.setImageSelected(selection[i].id, true);
    }
    //恢复凭证号
    for (let id in pzhMap) {
        var pzh = pzhMap[id];
        find_pzh(id, true).find('.no').text(pzh);
    }

    if (needSaveSetting) {
        setTimeout(function () {
            setImagePoolBlockSize(imgPool.getConfig("gguid"), v);
        }, 1000);
    }



}

/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet, name, data) {
    //console.dir(data);
    var url = data.url_img;
    book.sheet0.cells("imgPreview").setValue(url);
}
function imageOnMouseOut(sheet, name, data) {

    book.sheet0.cells("imgPreview").setValue("");
}


/**
 * 图片控件中某个图片被双击了
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片被双击)
function imageOnDBLClick(sheet, name, data) {

    //因为 mouseOut 会把大图清除掉，所以这里重新再设置上
    setTimeout(function () {
        var url = data.url_img;
        book.sheet0.cells("imgPreview").setValue(url);

    }, 200);

    var pzh = '';
    try {

        pzh = find_pzh(data.id, false).find('.no').text();
    } catch (err) {

    }

    if (pzh == undefined) pzh = '';

    inputBox("标记为凭证", "", pzh, "输入凭证号码", function (val) {
        if (val == '') {
            var p = find_pzh(data.id, false);
            if (p) p.remove();
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, false);
        } else {
            find_pzh(data.id, true).find('.no').text(val);
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, true);
        }

    }, true /*允许为空*/);
}


//@comment (group=,caption=查找或创建凭证号标记对象,needRightControl=false)
function find_pzh(id, create_if_not_exists) {
    var d = $('#' + id);
    if (!d) {
        $.alert(id + "不存在");
        return null;
    }

    var ret = d.find('.pzh');
    if (ret.length == 0) {
        if (create_if_not_exists) //如果需要创建，则创建它
        {
            d.append(`<div class="pzh" ><div class="no"></div><div class="delete_pzh"><i class="fa fa-close" onclick="removePZH('${id}');  event.preventDefault(); event.stopPropagation();"> </i></div></div>`);
        }
        ret = d.find('.pzh');
    }
    return ret;

}

function removePZH(id) {
    var p = find_pzh(id, false);
    if (p) p.remove();
}

function cb_selectall_onClick() {
    var imgPool = book.sheet1.getBrick('imgPool');
    if (imgPool.getSelectedImageList().length == 0) {
        imgPool.selectAll();
    } else {
        imgPool.unSelectAll();
    }
}


function cb_path_onClick() {
    if (window.electron == null) {
        toastr.error("此功能仅能在客户端APP中执行");
        return;
    }

    var path = electron.showOpenDialogSync('');
    if (path == '') return;
    var hostName = electron.getHostName();
    setMonitePath(hostName, path);


}


id: 60a90cf15db21e3d0fbaae18
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.22 21:57:52.000
script:
var pathToMonit = "";

function formOpen() {
    book.showTabOnWhere = "none";

    book.sheet1.getBrick('imgPool').selectionMode = 'multi'; //图片设置成多选模式

    $(document.body).append(`<style>
                        .pzh {position:absolute;left:0;bottom:0px; 
                                height:24px; line-height:24px;width:100%; 
                                background-color:#40af40a0; 
                                color:white;font-weight:bold;font-size:16px;text-align:center;}

                        .delete_pzh { position:absolute; right:0; width:40px; height:14px; top:0; text-align:right; vertical-align:top; font-size:12px; color:gray;padding-right:5px;}      
                        .delete_pzh:hover { color:white;}      
                          
                        </style>
 `);


    //  let data= loadImagePoolData();
    //  console.dir(data);


    $('#blockSize').on('input', resetImgPoolBlockSize);

    setTimeout(function () {
        //调取缩略图大小
        var imgPool = book.sheet1.getBrick('imgPool');

        let blockSize = getImagePoolBlockSize();
        if (blockSize != imgPool.config.blockSize) {
            $('#blockSize').val(blockSize);
            resetImgPoolBlockSize(false);
        }
    }, 1000);

    //调取图片目录
    if (window.electron != null) {
        var hostName = electron.getHostName();
        pathToMonit = getMonitePath(hostName);
        book.sheet0.cells('stateBar').setValue("图片目录 " + pathToMonit);
    }

}



function resetImgPoolBlockSize(needSaveSetting) {
    if (needSaveSetting == null) needSaveSetting = true;
    var imgPool = book.sheet1.getBrick('imgPool');

    // 先保存当前选中状态及设置的凭证号信息
    var selection = imgPool.getSelectedImageList();
    var pzhMap = {};
    var pzhs = imgPool.dom.find('.pzh');
    for (let i = 0; i < pzhs.length; i++) {
        let id = $(pzhs[i]).parent().attr('id');
        let pzh = $(pzhs[i]).find('.no').text();
        pzhMap[id] = pzh;

    }


    let v = $('#blockSize').val();

    imgPool.config.blockSize = parseInt(v);
    imgPool.rebuildGridly();
    //恢复选中状态
    for (let i = 0; i < selection.length; i++) {
        imgPool.setImageSelected(selection[i].id, true);
    }
    //恢复凭证号
    for (let id in pzhMap) {
        var pzh = pzhMap[id];
        find_pzh(id, true).find('.no').text(pzh);
    }

    if (needSaveSetting) {
        setTimeout(function () {
            setImagePoolBlockSize(imgPool.getConfig("gguid"), v);
        }, 1000);
    }



}

/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet, name, data) {
    //console.dir(data);
    var url = data.url_img;
    book.sheet0.cells("imgPreview").setValue(url);
}
function imageOnMouseOut(sheet, name, data) {

    book.sheet0.cells("imgPreview").setValue("");
}


/**
 * 图片控件中某个图片被双击了
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片被双击)
function imageOnDBLClick(sheet, name, data) {

    //因为 mouseOut 会把大图清除掉，所以这里重新再设置上
    setTimeout(function () {
        var url = data.url_img;
        book.sheet0.cells("imgPreview").setValue(url);

    }, 200);

    var pzh = '';
    try {

        pzh = find_pzh(data.id, false).find('.no').text();
    } catch (err) {

    }

    if (pzh == undefined) pzh = '';

    inputBox("标记为凭证", "", pzh, "输入凭证号码", function (val) {
        if (val == '') {
            var p = find_pzh(data.id, false);
            if (p) p.remove();
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, false);
        } else {
            find_pzh(data.id, true).find('.no').text(val);
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, true);
        }

    }, true /*允许为空*/);
}


//@comment (group=,caption=查找或创建凭证号标记对象,needRightControl=false)
function find_pzh(id, create_if_not_exists) {
    var d = $('#' + id);
    if (!d) {
        $.alert(id + "不存在");
        return null;
    }

    var ret = d.find('.pzh');
    if (ret.length == 0) {
        if (create_if_not_exists) //如果需要创建，则创建它
        {
            d.append(`<div class="pzh" ><div class="no"></div><div class="delete_pzh"><i class="fa fa-close" onclick="removePZH('${id}');  event.preventDefault(); event.stopPropagation();"> </i></div></div>`);
        }
        ret = d.find('.pzh');
    }
    return ret;

}

function removePZH(id) {
    var p = find_pzh(id, false);
    if (p) p.remove();
}

function cb_selectall_onClick() {
    var imgPool = book.sheet1.getBrick('imgPool');
    if (imgPool.getSelectedImageList().length == 0) {
        imgPool.selectAll();
    } else {
        imgPool.unSelectAll();
    }
}


function cb_path_onClick() {
    if (window.electron == null) {
        toastr.error("此功能仅能在客户端APP中执行");
        return;
    }

    var path = electron.showOpenDialogSync('');
    if (path == '') return;
    var hostName = electron.getHostName();
    setMonitePath(hostName, path);


}


id: 60a90e745db21e3d0fbaae9b
scriptid: 60a321f05db27838e0c014bf
tablename: app_script
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.22 22:49:05.000
script:
//@comment (group=,caption=得到当前操作员待归档图片对应的GGUID,needRightControl=false)
function getImagePoolGGUID() {
    var ret = runTask("get_dzpz_imgpool_id_of_current_user", {});
    return JSON.parse(ret).gguid;

}

function getImagePoolBlockSize() {
    var ret = runTask("get_dzpz_imgpool_id_of_current_user", {});
    return JSON.parse(ret).blockSize;

}


//@comment (group=,caption=保存当前的缩略图大小,needRightControl=false)
function setImagePoolBlockSize(id, blockSize) {
    runSQL("", " update  dzpz_imgpool set blocksize=" + blockSize + " where gguid='" + id + "'  ");
}


//@comment (group=,caption=得到待归档的图片清单,needRightControl=true)
function loadImagePoolData() {
    var config = JSON.parse(runTask("get_dzpz_imgpool_id_of_current_user", {}));

    var ds = newDataStore(config.dbpool, "select * from " + config.logTable + "  where  gguid='" + config.gguid + "'  order by info1 "); // info1 是客户端文件创建的时间，以它排序
    var n = ds.retrieve();
    var ret = [];
    for (var i = 0; i < n; i++) {
        ret.push(JSON.parse(ds.getJSONRow(i, true)));
    }

    return ret;

}


function setMonitePath(hostName, path) {
    var ds = newDataStore("", "select * from dzpz_client");
    ds.retrieve(" hostname='" + hostName + "'");
    if (ds.getRowCount() == 0) {
        var newid = newGUID();
        ds.insertRow(0);
        ds.setValue(0, "id", newid);
        ds.setValue(0, "gguid", newid);
        ds.setValue(0, "billno", newid);
        ds.setValue(0, "userid", 1);
        ds.setValue(0, "username", '管理员');
        ds.setValue(0, "billtype", '');
        ds.setValue(0, "hostname", hostName);
    }
    ds.setValue(0, "path", path);
    ds.update(true);
    println( ds.getError().getMessage());

}

function  getMonitePath(hostName)
{
    return   getStringFromSQL("select path from dzpz_client where  hostname='" + hostName + "'");
}


id: 60a90e745db21e3d0fbaaeb1
scriptid: 60a321f05db27838e0c014bf
tablename: app_script
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.22 22:51:01.000
script:
//@comment (group=,caption=得到当前操作员待归档图片对应的GGUID,needRightControl=false)
function getImagePoolGGUID() {
    var ret = runTask("get_dzpz_imgpool_id_of_current_user", {});
    return JSON.parse(ret).gguid;

}

function getImagePoolBlockSize() {
    var ret = runTask("get_dzpz_imgpool_id_of_current_user", {});
    return JSON.parse(ret).blockSize;

}


//@comment (group=,caption=保存当前的缩略图大小,needRightControl=false)
function setImagePoolBlockSize(id, blockSize) {
    runSQL("", " update  dzpz_imgpool set blocksize=" + blockSize + " where gguid='" + id + "'  ");
}


//@comment (group=,caption=得到待归档的图片清单,needRightControl=true)
function loadImagePoolData() {
    var config = JSON.parse(runTask("get_dzpz_imgpool_id_of_current_user", {}));

    var ds = newDataStore(config.dbpool, "select * from " + config.logTable + "  where  gguid='" + config.gguid + "'  order by info1 "); // info1 是客户端文件创建的时间，以它排序
    var n = ds.retrieve();
    var ret = [];
    for (var i = 0; i < n; i++) {
        ret.push(JSON.parse(ds.getJSONRow(i, true)));
    }

    return ret;

}


function setMonitePath(hostName, path) {
    var ds = newDataStore("", "select * from dzpz_client");
    ds.setUpdateProperty("dzpz_client","id","*","id");
    ds.retrieve(" hostname='" + hostName + "'");
    if (ds.getRowCount() == 0) {
        var newid = newGUID();
        ds.insertRow(0);
        ds.setValue(0, "id", newid);
        ds.setValue(0, "gguid", newid);
        ds.setValue(0, "billno", newid);
        ds.setValue(0, "userid", 1);
        ds.setValue(0, "username", '管理员');
        ds.setValue(0, "billtype", '');
        ds.setValue(0, "hostname", hostName);
    }
    ds.setValue(0, "path", path);
    ds.update(true);
    println( ds.getError().getMessage());

}

function  getMonitePath(hostName)
{
    return   getStringFromSQL("select path from dzpz_client where  hostname='" + hostName + "'");
}


id: 60a90e745db21e3d0fbaaeb7
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.22 23:26:27.000
script:
var pathToMonit = "";

function formOpen() {
    book.showTabOnWhere = "none";

    book.sheet1.getBrick('imgPool').selectionMode = 'multi'; //图片设置成多选模式

    $(document.body).append(`<style>
                        .pzh {position:absolute;left:0;bottom:0px; 
                                height:24px; line-height:24px;width:100%; 
                                background-color:#40af40a0; 
                                color:white;font-weight:bold;font-size:16px;text-align:center;}

                        .delete_pzh { position:absolute; right:0; width:40px; height:14px; top:0; text-align:right; vertical-align:top; font-size:12px; color:gray;padding-right:5px;}      
                        .delete_pzh:hover { color:white;}      
                          
                        </style>
 `);


    //  let data= loadImagePoolData();
    //  console.dir(data);


    $('#blockSize').on('input', resetImgPoolBlockSize);

    setTimeout(function () {
        //调取缩略图大小
        var imgPool = book.sheet1.getBrick('imgPool');

        let blockSize = getImagePoolBlockSize();
        if (blockSize != imgPool.config.blockSize) {
            $('#blockSize').val(blockSize);
            resetImgPoolBlockSize(false);
        }
    }, 1000);

    //调取图片目录
    if (window.electron != null) {
        var hostName = electron.getHostName();
        pathToMonit = getMonitePath(hostName);
        book.sheet0.cells('stateBar').setValue("图片目录 " + pathToMonit);
        //开启监控
        if( pathToMonit!='') moniteStart(pathToMonit);
    }

}



function resetImgPoolBlockSize(needSaveSetting) {
    if (needSaveSetting == null) needSaveSetting = true;
    var imgPool = book.sheet1.getBrick('imgPool');

    // 先保存当前选中状态及设置的凭证号信息
    var selection = imgPool.getSelectedImageList();
    var pzhMap = {};
    var pzhs = imgPool.dom.find('.pzh');
    for (let i = 0; i < pzhs.length; i++) {
        let id = $(pzhs[i]).parent().attr('id');
        let pzh = $(pzhs[i]).find('.no').text();
        pzhMap[id] = pzh;

    }


    let v = $('#blockSize').val();

    imgPool.config.blockSize = parseInt(v);
    imgPool.rebuildGridly();
    //恢复选中状态
    for (let i = 0; i < selection.length; i++) {
        imgPool.setImageSelected(selection[i].id, true);
    }
    //恢复凭证号
    for (let id in pzhMap) {
        var pzh = pzhMap[id];
        find_pzh(id, true).find('.no').text(pzh);
    }

    if (needSaveSetting) {
        setTimeout(function () {
            setImagePoolBlockSize(imgPool.getConfig("gguid"), v);
        }, 1000);
    }



}

/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet, name, data) {
    //console.dir(data);
    var url = data.url_img;
    book.sheet0.cells("imgPreview").setValue(url);
}
function imageOnMouseOut(sheet, name, data) {

    book.sheet0.cells("imgPreview").setValue("");
}


/**
 * 图片控件中某个图片被双击了
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片被双击)
function imageOnDBLClick(sheet, name, data) {

    //因为 mouseOut 会把大图清除掉，所以这里重新再设置上
    setTimeout(function () {
        var url = data.url_img;
        book.sheet0.cells("imgPreview").setValue(url);

    }, 200);

    var pzh = '';
    try {

        pzh = find_pzh(data.id, false).find('.no').text();
    } catch (err) {

    }

    if (pzh == undefined) pzh = '';

    inputBox("标记为凭证", "", pzh, "输入凭证号码", function (val) {
        if (val == '') {
            var p = find_pzh(data.id, false);
            if (p) p.remove();
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, false);
        } else {
            find_pzh(data.id, true).find('.no').text(val);
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, true);
        }

    }, true /*允许为空*/);
}


//@comment (group=,caption=查找或创建凭证号标记对象,needRightControl=false)
function find_pzh(id, create_if_not_exists) {
    var d = $('#' + id);
    if (!d) {
        $.alert(id + "不存在");
        return null;
    }

    var ret = d.find('.pzh');
    if (ret.length == 0) {
        if (create_if_not_exists) //如果需要创建，则创建它
        {
            d.append(`<div class="pzh" ><div class="no"></div><div class="delete_pzh"><i class="fa fa-close" onclick="removePZH('${id}');  event.preventDefault(); event.stopPropagation();"> </i></div></div>`);
        }
        ret = d.find('.pzh');
    }
    return ret;

}

function removePZH(id) {
    var p = find_pzh(id, false);
    if (p) p.remove();
}

function cb_selectall_onClick() {
    var imgPool = book.sheet1.getBrick('imgPool');
    if (imgPool.getSelectedImageList().length == 0) {
        imgPool.selectAll();
    } else {
        imgPool.unSelectAll();
    }
}


function cb_path_onClick() {
    if (window.electron == null) {
        toastr.error("此功能仅能在客户端APP中执行");
        return;
    }

    var path = electron.showOpenDialogSync('');
    if (path == '') return;
    var hostName = electron.getHostName();
    setMonitePath(hostName, path);

    moniteStart(path);


}

function moniteStart(path)
{
     if (window.electron == null) {
        toastr.error("此功能仅能在客户端APP中执行");
        return;
    }
    electron.ipcSendMessage( {action:"moniteStart" , path:path});
}


id: 60a90e745db21e3d0fbaaebd
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.22 23:32:53.000
script:
var pathToMonit = "";

function formOpen() {
    book.showTabOnWhere = "none";

    book.sheet1.getBrick('imgPool').selectionMode = 'multi'; //图片设置成多选模式

    $(document.body).append(`<style>
                        .pzh {position:absolute;left:0;bottom:0px; 
                                height:24px; line-height:24px;width:100%; 
                                background-color:#40af40a0; 
                                color:white;font-weight:bold;font-size:16px;text-align:center;}

                        .delete_pzh { position:absolute; right:0; width:40px; height:14px; top:0; text-align:right; vertical-align:top; font-size:12px; color:gray;padding-right:5px;}      
                        .delete_pzh:hover { color:white;}      
                          
                        </style>
 `);


    //  let data= loadImagePoolData();
    //  console.dir(data);


    $('#blockSize').on('input', resetImgPoolBlockSize);

    setTimeout(function () {
        //调取缩略图大小
        var imgPool = book.sheet1.getBrick('imgPool');

        let blockSize = getImagePoolBlockSize();
        if (blockSize != imgPool.config.blockSize) {
            $('#blockSize').val(blockSize);
            resetImgPoolBlockSize(false);
        }
    }, 1000);


    //调取图片目录
    setTimeout( function(){
    if (window.electron != null) {
        var hostName = electron.getHostName();
        pathToMonit = getMonitePath(hostName);
        book.sheet0.cells('stateBar').setValue("图片目录 " + pathToMonit);
        //开启监控
        if( pathToMonit!='') moniteStart(pathToMonit);
    }
    },2000);
}



function resetImgPoolBlockSize(needSaveSetting) {
    if (needSaveSetting == null) needSaveSetting = true;
    var imgPool = book.sheet1.getBrick('imgPool');

    // 先保存当前选中状态及设置的凭证号信息
    var selection = imgPool.getSelectedImageList();
    var pzhMap = {};
    var pzhs = imgPool.dom.find('.pzh');
    for (let i = 0; i < pzhs.length; i++) {
        let id = $(pzhs[i]).parent().attr('id');
        let pzh = $(pzhs[i]).find('.no').text();
        pzhMap[id] = pzh;

    }


    let v = $('#blockSize').val();

    imgPool.config.blockSize = parseInt(v);
    imgPool.rebuildGridly();
    //恢复选中状态
    for (let i = 0; i < selection.length; i++) {
        imgPool.setImageSelected(selection[i].id, true);
    }
    //恢复凭证号
    for (let id in pzhMap) {
        var pzh = pzhMap[id];
        find_pzh(id, true).find('.no').text(pzh);
    }

    if (needSaveSetting) {
        setTimeout(function () {
            setImagePoolBlockSize(imgPool.getConfig("gguid"), v);
        }, 1000);
    }



}

/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet, name, data) {
    //console.dir(data);
    var url = data.url_img;
    book.sheet0.cells("imgPreview").setValue(url);
}
function imageOnMouseOut(sheet, name, data) {

    book.sheet0.cells("imgPreview").setValue("");
}


/**
 * 图片控件中某个图片被双击了
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片被双击)
function imageOnDBLClick(sheet, name, data) {

    //因为 mouseOut 会把大图清除掉，所以这里重新再设置上
    setTimeout(function () {
        var url = data.url_img;
        book.sheet0.cells("imgPreview").setValue(url);

    }, 200);

    var pzh = '';
    try {

        pzh = find_pzh(data.id, false).find('.no').text();
    } catch (err) {

    }

    if (pzh == undefined) pzh = '';

    inputBox("标记为凭证", "", pzh, "输入凭证号码", function (val) {
        if (val == '') {
            var p = find_pzh(data.id, false);
            if (p) p.remove();
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, false);
        } else {
            find_pzh(data.id, true).find('.no').text(val);
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, true);
        }

    }, true /*允许为空*/);
}


//@comment (group=,caption=查找或创建凭证号标记对象,needRightControl=false)
function find_pzh(id, create_if_not_exists) {
    var d = $('#' + id);
    if (!d) {
        $.alert(id + "不存在");
        return null;
    }

    var ret = d.find('.pzh');
    if (ret.length == 0) {
        if (create_if_not_exists) //如果需要创建，则创建它
        {
            d.append(`<div class="pzh" ><div class="no"></div><div class="delete_pzh"><i class="fa fa-close" onclick="removePZH('${id}');  event.preventDefault(); event.stopPropagation();"> </i></div></div>`);
        }
        ret = d.find('.pzh');
    }
    return ret;

}

function removePZH(id) {
    var p = find_pzh(id, false);
    if (p) p.remove();
}

function cb_selectall_onClick() {
    var imgPool = book.sheet1.getBrick('imgPool');
    if (imgPool.getSelectedImageList().length == 0) {
        imgPool.selectAll();
    } else {
        imgPool.unSelectAll();
    }
}


function cb_path_onClick() {
    if (window.electron == null) {
        toastr.error("此功能仅能在客户端APP中执行");
        return;
    }

    var path = electron.showOpenDialogSync('');
    if (path == '') return;
    var hostName = electron.getHostName();
    setMonitePath(hostName, path);

    moniteStart(path);


}

function moniteStart(path)
{
     if (window.electron == null) {
        toastr.error("此功能仅能在客户端APP中执行");
        return;
    }
    electron.ipcSendMessage( {action:"moniteStart" , path:path});
}


id: 60a90e745db21e3d0fbaaec3
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.22 23:34:23.000
script:
var pathToMonit = "";

function formOpen() {
    book.showTabOnWhere = "none";

    book.sheet1.getBrick('imgPool').selectionMode = 'multi'; //图片设置成多选模式

    $(document.body).append(`<style>
                        .pzh {position:absolute;left:0;bottom:0px; 
                                height:24px; line-height:24px;width:100%; 
                                background-color:#40af40a0; 
                                color:white;font-weight:bold;font-size:16px;text-align:center;}

                        .delete_pzh { position:absolute; right:0; width:40px; height:14px; top:0; text-align:right; vertical-align:top; font-size:12px; color:gray;padding-right:5px;}      
                        .delete_pzh:hover { color:white;}      
                          
                        </style>
 `);


    //  let data= loadImagePoolData();
    //  console.dir(data);


    $('#blockSize').on('input', resetImgPoolBlockSize);

    setTimeout(function () {
        //调取缩略图大小
        var imgPool = book.sheet1.getBrick('imgPool');

        let blockSize = getImagePoolBlockSize();
        if (blockSize != imgPool.config.blockSize) {
            $('#blockSize').val(blockSize);
            resetImgPoolBlockSize(false);
        }
    }, 1000);


    //调取图片目录
    setTimeout( function(){
    if (window.electron != null) {
        var hostName = electron.getHostName();
        pathToMonit = getMonitePath(hostName);
        book.sheet0.cells('stateBar').setValue("图片目录 " + pathToMonit);
        //开启监控
        if( pathToMonit!='') moniteStart(pathToMonit);
    }
    },2000);
}



function resetImgPoolBlockSize(needSaveSetting) {
    if (needSaveSetting == null) needSaveSetting = true;
    var imgPool = book.sheet1.getBrick('imgPool');

    // 先保存当前选中状态及设置的凭证号信息
    var selection = imgPool.getSelectedImageList();
    var pzhMap = {};
    var pzhs = imgPool.dom.find('.pzh');
    for (let i = 0; i < pzhs.length; i++) {
        let id = $(pzhs[i]).parent().attr('id');
        let pzh = $(pzhs[i]).find('.no').text();
        pzhMap[id] = pzh;

    }


    let v = $('#blockSize').val();

    imgPool.config.blockSize = parseInt(v);
    imgPool.rebuildGridly();
    //恢复选中状态
    for (let i = 0; i < selection.length; i++) {
        imgPool.setImageSelected(selection[i].id, true);
    }
    //恢复凭证号
    for (let id in pzhMap) {
        var pzh = pzhMap[id];
        find_pzh(id, true).find('.no').text(pzh);
    }

    if (needSaveSetting) {
        setTimeout(function () {
            setImagePoolBlockSize(imgPool.getConfig("gguid"), v);
        }, 1000);
    }



}

/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet, name, data) {
    //console.dir(data);
    var url = data.url_img;
    book.sheet0.cells("imgPreview").setValue(url);
}
function imageOnMouseOut(sheet, name, data) {

    book.sheet0.cells("imgPreview").setValue("");
}


/**
 * 图片控件中某个图片被双击了
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片被双击)
function imageOnDBLClick(sheet, name, data) {

    //因为 mouseOut 会把大图清除掉，所以这里重新再设置上
    setTimeout(function () {
        var url = data.url_img;
        book.sheet0.cells("imgPreview").setValue(url);

    }, 200);

    var pzh = '';
    try {

        pzh = find_pzh(data.id, false).find('.no').text();
    } catch (err) {

    }

    if (pzh == undefined) pzh = '';

    inputBox("标记为凭证", "", pzh, "输入凭证号码", function (val) {
        if (val == '') {
            var p = find_pzh(data.id, false);
            if (p) p.remove();
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, false);
        } else {
            find_pzh(data.id, true).find('.no').text(val);
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, true);
        }

    }, true /*允许为空*/);
}


//@comment (group=,caption=查找或创建凭证号标记对象,needRightControl=false)
function find_pzh(id, create_if_not_exists) {
    var d = $('#' + id);
    if (!d) {
        $.alert(id + "不存在");
        return null;
    }

    var ret = d.find('.pzh');
    if (ret.length == 0) {
        if (create_if_not_exists) //如果需要创建，则创建它
        {
            d.append(`<div class="pzh" ><div class="no"></div><div class="delete_pzh"><i class="fa fa-close" onclick="removePZH('${id}');  event.preventDefault(); event.stopPropagation();"> </i></div></div>`);
        }
        ret = d.find('.pzh');
    }
    return ret;

}

function removePZH(id) {
    var p = find_pzh(id, false);
    if (p) p.remove();
}

function cb_selectall_onClick() {
    var imgPool = book.sheet1.getBrick('imgPool');
    if (imgPool.getSelectedImageList().length == 0) {
        imgPool.selectAll();
    } else {
        imgPool.unSelectAll();
    }
}


function cb_path_onClick() {
    if (window.electron == null) {
        toastr.error("此功能仅能在客户端APP中执行");
        return;
    }

    var path = electron.showOpenDialogSync('');
    if (path == '') return;
    var hostName = electron.getHostName();
    setMonitePath(hostName, path);

    moniteStart(path);


}

function moniteStart(path)
{
     if (window.electron == null) {
        toastr.error("此功能仅能在客户端APP中执行");
        return;
    }
    electron.ipcSendMessage( {cmd:"moniteStart" , path:path});
}


id: 60a90e745db21e3d0fbaaec9
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.22 23:44:10.000
script:
var pathToMonit = "";

function formOpen() {
    book.showTabOnWhere = "none";

    book.sheet1.getBrick('imgPool').selectionMode = 'multi'; //图片设置成多选模式

    $(document.body).append(`<style>
                        .pzh {position:absolute;left:0;bottom:0px; 
                                height:24px; line-height:24px;width:100%; 
                                background-color:#40af40a0; 
                                color:white;font-weight:bold;font-size:16px;text-align:center;}

                        .delete_pzh { position:absolute; right:0; width:40px; height:14px; top:0; text-align:right; vertical-align:top; font-size:12px; color:gray;padding-right:5px;}      
                        .delete_pzh:hover { color:white;}      
                          
                        </style>
 `);


    //  let data= loadImagePoolData();
    //  console.dir(data);


    $('#blockSize').on('input', resetImgPoolBlockSize);

    setTimeout(function () {
        //调取缩略图大小
        var imgPool = book.sheet1.getBrick('imgPool');

        let blockSize = getImagePoolBlockSize();
        if (blockSize != imgPool.config.blockSize) {
            $('#blockSize').val(blockSize);
            resetImgPoolBlockSize(false);
        }
    }, 1000);


    //调取图片目录
    setTimeout( function(){
    if (window.electron != null) {
        var hostName = electron.getHostName();
        pathToMonit = getMonitePath(hostName);
        
        //开启监控
        if( pathToMonit!='') moniteStart(pathToMonit);
    }
    },2000);
}



function resetImgPoolBlockSize(needSaveSetting) {
    if (needSaveSetting == null) needSaveSetting = true;
    var imgPool = book.sheet1.getBrick('imgPool');

    // 先保存当前选中状态及设置的凭证号信息
    var selection = imgPool.getSelectedImageList();
    var pzhMap = {};
    var pzhs = imgPool.dom.find('.pzh');
    for (let i = 0; i < pzhs.length; i++) {
        let id = $(pzhs[i]).parent().attr('id');
        let pzh = $(pzhs[i]).find('.no').text();
        pzhMap[id] = pzh;

    }


    let v = $('#blockSize').val();

    imgPool.config.blockSize = parseInt(v);
    imgPool.rebuildGridly();
    //恢复选中状态
    for (let i = 0; i < selection.length; i++) {
        imgPool.setImageSelected(selection[i].id, true);
    }
    //恢复凭证号
    for (let id in pzhMap) {
        var pzh = pzhMap[id];
        find_pzh(id, true).find('.no').text(pzh);
    }

    if (needSaveSetting) {
        setTimeout(function () {
            setImagePoolBlockSize(imgPool.getConfig("gguid"), v);
        }, 1000);
    }



}

/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet, name, data) {
    //console.dir(data);
    var url = data.url_img;
    book.sheet0.cells("imgPreview").setValue(url);
}
function imageOnMouseOut(sheet, name, data) {

    book.sheet0.cells("imgPreview").setValue("");
}


/**
 * 图片控件中某个图片被双击了
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片被双击)
function imageOnDBLClick(sheet, name, data) {

    //因为 mouseOut 会把大图清除掉，所以这里重新再设置上
    setTimeout(function () {
        var url = data.url_img;
        book.sheet0.cells("imgPreview").setValue(url);

    }, 200);

    var pzh = '';
    try {

        pzh = find_pzh(data.id, false).find('.no').text();
    } catch (err) {

    }

    if (pzh == undefined) pzh = '';

    inputBox("标记为凭证", "", pzh, "输入凭证号码", function (val) {
        if (val == '') {
            var p = find_pzh(data.id, false);
            if (p) p.remove();
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, false);
        } else {
            find_pzh(data.id, true).find('.no').text(val);
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, true);
        }

    }, true /*允许为空*/);
}


//@comment (group=,caption=查找或创建凭证号标记对象,needRightControl=false)
function find_pzh(id, create_if_not_exists) {
    var d = $('#' + id);
    if (!d) {
        $.alert(id + "不存在");
        return null;
    }

    var ret = d.find('.pzh');
    if (ret.length == 0) {
        if (create_if_not_exists) //如果需要创建，则创建它
        {
            d.append(`<div class="pzh" ><div class="no"></div><div class="delete_pzh"><i class="fa fa-close" onclick="removePZH('${id}');  event.preventDefault(); event.stopPropagation();"> </i></div></div>`);
        }
        ret = d.find('.pzh');
    }
    return ret;

}

function removePZH(id) {
    var p = find_pzh(id, false);
    if (p) p.remove();
}

function cb_selectall_onClick() {
    var imgPool = book.sheet1.getBrick('imgPool');
    if (imgPool.getSelectedImageList().length == 0) {
        imgPool.selectAll();
    } else {
        imgPool.unSelectAll();
    }
}


function cb_path_onClick() {
    if (window.electron == null) {
        toastr.error("此功能仅能在客户端APP中执行");
        return;
    }

    var path = electron.showOpenDialogSync('');
    if (path == '') return;
    var hostName = electron.getHostName();
    setMonitePath(hostName, path);

    moniteStart(path);


}

function moniteStart(path)
{
    book.sheet0.cells('stateBar').setValue("图片目录 " + pathToMonit);

     if (window.electron == null) {
        toastr.error("此功能仅能在客户端APP中执行");
        return;
    }

    book.sheet0.cells('stateBar').setValue("图片目录 " + pathToMonit+ " 监控中...");
    electron.ipcSendMessage( {cmd:"moniteStart" , path:path});
}


id: 60a926da5db21e3d0fbaaecf
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.22 23:44:26.000
script:
var pathToMonit = "";

function formOpen() {
    book.showTabOnWhere = "none";

    book.sheet1.getBrick('imgPool').selectionMode = 'multi'; //图片设置成多选模式

    $(document.body).append(`<style>
                        .pzh {position:absolute;left:0;bottom:0px; 
                                height:24px; line-height:24px;width:100%; 
                                background-color:#40af40a0; 
                                color:white;font-weight:bold;font-size:16px;text-align:center;}

                        .delete_pzh { position:absolute; right:0; width:40px; height:14px; top:0; text-align:right; vertical-align:top; font-size:12px; color:gray;padding-right:5px;}      
                        .delete_pzh:hover { color:white;}      
                          
                        </style>
 `);


    //  let data= loadImagePoolData();
    //  console.dir(data);


    $('#blockSize').on('input', resetImgPoolBlockSize);

    setTimeout(function () {
        //调取缩略图大小
        var imgPool = book.sheet1.getBrick('imgPool');

        let blockSize = getImagePoolBlockSize();
        if (blockSize != imgPool.config.blockSize) {
            $('#blockSize').val(blockSize);
            resetImgPoolBlockSize(false);
        }
    }, 1000);


    //调取图片目录
    setTimeout( function(){
    if (window.electron != null) {
        var hostName = electron.getHostName();
        pathToMonit = getMonitePath(hostName);
        
        //开启监控
        if( pathToMonit!='') moniteStart(pathToMonit);
    }
    },500);
}



function resetImgPoolBlockSize(needSaveSetting) {
    if (needSaveSetting == null) needSaveSetting = true;
    var imgPool = book.sheet1.getBrick('imgPool');

    // 先保存当前选中状态及设置的凭证号信息
    var selection = imgPool.getSelectedImageList();
    var pzhMap = {};
    var pzhs = imgPool.dom.find('.pzh');
    for (let i = 0; i < pzhs.length; i++) {
        let id = $(pzhs[i]).parent().attr('id');
        let pzh = $(pzhs[i]).find('.no').text();
        pzhMap[id] = pzh;

    }


    let v = $('#blockSize').val();

    imgPool.config.blockSize = parseInt(v);
    imgPool.rebuildGridly();
    //恢复选中状态
    for (let i = 0; i < selection.length; i++) {
        imgPool.setImageSelected(selection[i].id, true);
    }
    //恢复凭证号
    for (let id in pzhMap) {
        var pzh = pzhMap[id];
        find_pzh(id, true).find('.no').text(pzh);
    }

    if (needSaveSetting) {
        setTimeout(function () {
            setImagePoolBlockSize(imgPool.getConfig("gguid"), v);
        }, 1000);
    }



}

/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet, name, data) {
    //console.dir(data);
    var url = data.url_img;
    book.sheet0.cells("imgPreview").setValue(url);
}
function imageOnMouseOut(sheet, name, data) {

    book.sheet0.cells("imgPreview").setValue("");
}


/**
 * 图片控件中某个图片被双击了
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片被双击)
function imageOnDBLClick(sheet, name, data) {

    //因为 mouseOut 会把大图清除掉，所以这里重新再设置上
    setTimeout(function () {
        var url = data.url_img;
        book.sheet0.cells("imgPreview").setValue(url);

    }, 200);

    var pzh = '';
    try {

        pzh = find_pzh(data.id, false).find('.no').text();
    } catch (err) {

    }

    if (pzh == undefined) pzh = '';

    inputBox("标记为凭证", "", pzh, "输入凭证号码", function (val) {
        if (val == '') {
            var p = find_pzh(data.id, false);
            if (p) p.remove();
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, false);
        } else {
            find_pzh(data.id, true).find('.no').text(val);
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, true);
        }

    }, true /*允许为空*/);
}


//@comment (group=,caption=查找或创建凭证号标记对象,needRightControl=false)
function find_pzh(id, create_if_not_exists) {
    var d = $('#' + id);
    if (!d) {
        $.alert(id + "不存在");
        return null;
    }

    var ret = d.find('.pzh');
    if (ret.length == 0) {
        if (create_if_not_exists) //如果需要创建，则创建它
        {
            d.append(`<div class="pzh" ><div class="no"></div><div class="delete_pzh"><i class="fa fa-close" onclick="removePZH('${id}');  event.preventDefault(); event.stopPropagation();"> </i></div></div>`);
        }
        ret = d.find('.pzh');
    }
    return ret;

}

function removePZH(id) {
    var p = find_pzh(id, false);
    if (p) p.remove();
}

function cb_selectall_onClick() {
    var imgPool = book.sheet1.getBrick('imgPool');
    if (imgPool.getSelectedImageList().length == 0) {
        imgPool.selectAll();
    } else {
        imgPool.unSelectAll();
    }
}


function cb_path_onClick() {
    if (window.electron == null) {
        toastr.error("此功能仅能在客户端APP中执行");
        return;
    }

    var path = electron.showOpenDialogSync('');
    if (path == '') return;
    var hostName = electron.getHostName();
    setMonitePath(hostName, path);

    moniteStart(path);


}

function moniteStart(path)
{
    book.sheet0.cells('stateBar').setValue("图片目录 " + pathToMonit);

     if (window.electron == null) {
        toastr.error("此功能仅能在客户端APP中执行");
        return;
    }

    book.sheet0.cells('stateBar').setValue("图片目录 " + pathToMonit+ " 监控中...");
    electron.ipcSendMessage( {cmd:"moniteStart" , path:path});
}


id: 60a926da5db21e3d0fbaaee8
scriptid: 609deddb5db2696039463ca0
tablename: app_script
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.23 00:19:17.000
script:
function main(arg)
{
    var p=JSON.parse(arg);
    println("user:"+currentUserShowName()+" file: " + p.file+"  result:" + p.result );

    pushMessage()
}


id: 60a926da5db21e3d0fbaaef0
scriptid: 609deddb5db2696039463ca0
tablename: app_script
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.23 00:20:33.000
script:
function main(arg)
{
    var p=JSON.parse(arg);
    println("user:"+currentUserShowName()+" file: " + p.file+"  result:" + p.result );

     pushMessage("newFileUploaded", { file : p.file } , currentUserId() );  //向当前用户推送消息 

}


id: 60a926da5db21e3d0fbaaef6
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.23 00:21:26.000
script:
var pathToMonit = "";

function formOpen() {
    book.showTabOnWhere = "none";

    onPushMessage("newFileUploaded", msg)
    {
            
    }

    book.sheet1.getBrick('imgPool').selectionMode = 'multi'; //图片设置成多选模式

    $(document.body).append(`<style>
                        .pzh {position:absolute;left:0;bottom:0px; 
                                height:24px; line-height:24px;width:100%; 
                                background-color:#40af40a0; 
                                color:white;font-weight:bold;font-size:16px;text-align:center;}

                        .delete_pzh { position:absolute; right:0; width:40px; height:14px; top:0; text-align:right; 
                                    vertical-align:top; font-size:12px; color:gray;padding-right:5px;}      
                        .delete_pzh:hover { color:white;}      
                          
                        </style>
                    `);


    //  let data= loadImagePoolData();
    //  console.dir(data);


    $('#blockSize').on('input', resetImgPoolBlockSize);

    setTimeout(function () {
        //调取缩略图大小
        var imgPool = book.sheet1.getBrick('imgPool');

        let blockSize = getImagePoolBlockSize();
        if (blockSize != imgPool.config.blockSize) {
            $('#blockSize').val(blockSize);
            resetImgPoolBlockSize(false);
        }
    }, 1000);


    //调取图片目录
    setTimeout( function(){
    if (window.electron != null) {
        var hostName = electron.getHostName();
        pathToMonit = getMonitePath(hostName);
        
        //开启监控
        if( pathToMonit!='') moniteStart(pathToMonit);
    }
    },500);
}



function resetImgPoolBlockSize(needSaveSetting) {
    if (needSaveSetting == null) needSaveSetting = true;
    var imgPool = book.sheet1.getBrick('imgPool');

    // 先保存当前选中状态及设置的凭证号信息
    var selection = imgPool.getSelectedImageList();
    var pzhMap = {};
    var pzhs = imgPool.dom.find('.pzh');
    for (let i = 0; i < pzhs.length; i++) {
        let id = $(pzhs[i]).parent().attr('id');
        let pzh = $(pzhs[i]).find('.no').text();
        pzhMap[id] = pzh;

    }


    let v = $('#blockSize').val();

    imgPool.config.blockSize = parseInt(v);
    imgPool.rebuildGridly();
    //恢复选中状态
    for (let i = 0; i < selection.length; i++) {
        imgPool.setImageSelected(selection[i].id, true);
    }
    //恢复凭证号
    for (let id in pzhMap) {
        var pzh = pzhMap[id];
        find_pzh(id, true).find('.no').text(pzh);
    }

    if (needSaveSetting) {
        setTimeout(function () {
            setImagePoolBlockSize(imgPool.getConfig("gguid"), v);
        }, 1000);
    }



}

/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet, name, data) {
    //console.dir(data);
    var url = data.url_img;
    book.sheet0.cells("imgPreview").setValue(url);
}
function imageOnMouseOut(sheet, name, data) {

    book.sheet0.cells("imgPreview").setValue("");
}


/**
 * 图片控件中某个图片被双击了
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片被双击)
function imageOnDBLClick(sheet, name, data) {

    //因为 mouseOut 会把大图清除掉，所以这里重新再设置上
    setTimeout(function () {
        var url = data.url_img;
        book.sheet0.cells("imgPreview").setValue(url);

    }, 200);

    var pzh = '';
    try {

        pzh = find_pzh(data.id, false).find('.no').text();
    } catch (err) {

    }

    if (pzh == undefined) pzh = '';

    inputBox("标记为凭证", "", pzh, "输入凭证号码", function (val) {
        if (val == '') {
            var p = find_pzh(data.id, false);
            if (p) p.remove();
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, false);
        } else {
            find_pzh(data.id, true).find('.no').text(val);
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, true);
        }

    }, true /*允许为空*/);
}


//@comment (group=,caption=查找或创建凭证号标记对象,needRightControl=false)
function find_pzh(id, create_if_not_exists) {
    var d = $('#' + id);
    if (!d) {
        $.alert(id + "不存在");
        return null;
    }

    var ret = d.find('.pzh');
    if (ret.length == 0) {
        if (create_if_not_exists) //如果需要创建，则创建它
        {
            d.append(`<div class="pzh" ><div class="no"></div><div class="delete_pzh"><i class="fa fa-close" onclick="removePZH('${id}');  event.preventDefault(); event.stopPropagation();"> </i></div></div>`);
        }
        ret = d.find('.pzh');
    }
    return ret;

}

function removePZH(id) {
    var p = find_pzh(id, false);
    if (p) p.remove();
}

function cb_selectall_onClick() {
    var imgPool = book.sheet1.getBrick('imgPool');
    if (imgPool.getSelectedImageList().length == 0) {
        imgPool.selectAll();
    } else {
        imgPool.unSelectAll();
    }
}


function cb_path_onClick() {
    if (window.electron == null) {
        toastr.error("此功能仅能在客户端APP中执行");
        return;
    }

    var path = electron.showOpenDialogSync('');
    if (path == '') return;
    var hostName = electron.getHostName();
    setMonitePath(hostName, path);

    moniteStart(path);


}

function moniteStart(path)
{
    book.sheet0.cells('stateBar').setValue("图片目录 " + pathToMonit);

     if (window.electron == null) {
        toastr.error("此功能仅能在客户端APP中执行");
        return;
    }

    book.sheet0.cells('stateBar').setValue("图片目录 " + pathToMonit+ " 监控中...");
    electron.ipcSendMessage( {cmd:"moniteStart" , path:path});
}


id: 60a926da5db21e3d0fbaaefd
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.23 00:26:45.000
script:
var pathToMonit = "";

function formOpen() {
    book.showTabOnWhere = "none";

    onPushMessage("newFileUploaded", msg)
    {
        book.sheet0.cells("stateInfo2").setValue( "有新图片");    
    }

    book.sheet1.getBrick('imgPool').selectionMode = 'multi'; //图片设置成多选模式

    $(document.body).append(`<style>
                        .pzh {position:absolute;left:0;bottom:0px; 
                                height:24px; line-height:24px;width:100%; 
                                background-color:#40af40a0; 
                                color:white;font-weight:bold;font-size:16px;text-align:center;}

                        .delete_pzh { position:absolute; right:0; width:40px; height:14px; top:0; text-align:right; 
                                    vertical-align:top; font-size:12px; color:gray;padding-right:5px;}      
                        .delete_pzh:hover { color:white;}      
                          
                        </style>
                    `);


    //  let data= loadImagePoolData();
    //  console.dir(data);


    $('#blockSize').on('input', resetImgPoolBlockSize);

    setTimeout(function () {
        //调取缩略图大小
        var imgPool = book.sheet1.getBrick('imgPool');

        let blockSize = getImagePoolBlockSize();
        if (blockSize != imgPool.config.blockSize) {
            $('#blockSize').val(blockSize);
            resetImgPoolBlockSize(false);
        }
    }, 1000);


    //调取图片目录
    setTimeout( function(){
    if (window.electron != null) {
        var hostName = electron.getHostName();
        pathToMonit = getMonitePath(hostName);
        
        //开启监控
        if( pathToMonit!='') moniteStart(pathToMonit);
    }
    },500);
}



function resetImgPoolBlockSize(needSaveSetting) {
    if (needSaveSetting == null) needSaveSetting = true;
    var imgPool = book.sheet1.getBrick('imgPool');

    // 先保存当前选中状态及设置的凭证号信息
    var selection = imgPool.getSelectedImageList();
    var pzhMap = {};
    var pzhs = imgPool.dom.find('.pzh');
    for (let i = 0; i < pzhs.length; i++) {
        let id = $(pzhs[i]).parent().attr('id');
        let pzh = $(pzhs[i]).find('.no').text();
        pzhMap[id] = pzh;

    }


    let v = $('#blockSize').val();

    imgPool.config.blockSize = parseInt(v);
    imgPool.rebuildGridly();
    //恢复选中状态
    for (let i = 0; i < selection.length; i++) {
        imgPool.setImageSelected(selection[i].id, true);
    }
    //恢复凭证号
    for (let id in pzhMap) {
        var pzh = pzhMap[id];
        find_pzh(id, true).find('.no').text(pzh);
    }

    if (needSaveSetting) {
        setTimeout(function () {
            setImagePoolBlockSize(imgPool.getConfig("gguid"), v);
        }, 1000);
    }



}

/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet, name, data) {
    //console.dir(data);
    var url = data.url_img;
    book.sheet0.cells("imgPreview").setValue(url);
}
function imageOnMouseOut(sheet, name, data) {

    book.sheet0.cells("imgPreview").setValue("");
}


/**
 * 图片控件中某个图片被双击了
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片被双击)
function imageOnDBLClick(sheet, name, data) {

    //因为 mouseOut 会把大图清除掉，所以这里重新再设置上
    setTimeout(function () {
        var url = data.url_img;
        book.sheet0.cells("imgPreview").setValue(url);

    }, 200);

    var pzh = '';
    try {

        pzh = find_pzh(data.id, false).find('.no').text();
    } catch (err) {

    }

    if (pzh == undefined) pzh = '';

    inputBox("标记为凭证", "", pzh, "输入凭证号码", function (val) {
        if (val == '') {
            var p = find_pzh(data.id, false);
            if (p) p.remove();
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, false);
        } else {
            find_pzh(data.id, true).find('.no').text(val);
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, true);
        }

    }, true /*允许为空*/);
}


//@comment (group=,caption=查找或创建凭证号标记对象,needRightControl=false)
function find_pzh(id, create_if_not_exists) {
    var d = $('#' + id);
    if (!d) {
        $.alert(id + "不存在");
        return null;
    }

    var ret = d.find('.pzh');
    if (ret.length == 0) {
        if (create_if_not_exists) //如果需要创建，则创建它
        {
            d.append(`<div class="pzh" ><div class="no"></div><div class="delete_pzh"><i class="fa fa-close" onclick="removePZH('${id}');  event.preventDefault(); event.stopPropagation();"> </i></div></div>`);
        }
        ret = d.find('.pzh');
    }
    return ret;

}

function removePZH(id) {
    var p = find_pzh(id, false);
    if (p) p.remove();
}

function cb_selectall_onClick() {
    var imgPool = book.sheet1.getBrick('imgPool');
    if (imgPool.getSelectedImageList().length == 0) {
        imgPool.selectAll();
    } else {
        imgPool.unSelectAll();
    }
}


function cb_path_onClick() {
    if (window.electron == null) {
        toastr.error("此功能仅能在客户端APP中执行");
        return;
    }

    var path = electron.showOpenDialogSync('');
    if (path == '') return;
    var hostName = electron.getHostName();
    setMonitePath(hostName, path);

    moniteStart(path);


}

function moniteStart(path)
{
    book.sheet0.cells('stateBar').setValue("图片目录 " + pathToMonit);

     if (window.electron == null) {
        toastr.error("此功能仅能在客户端APP中执行");
        return;
    }

    book.sheet0.cells('stateBar').setValue("图片目录 " + pathToMonit+ " 监控中...");
    electron.ipcSendMessage( {cmd:"moniteStart" , path:path});
}


id: 60a926da5db21e3d0fbaaf03
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.23 00:26:55.000
script:
var pathToMonit = "";

function formOpen() {
    book.showTabOnWhere = "none";

    onPushMessage("newFileUploaded", msg)
    {
        book.sheet0.cells("stateInfo2").setValue( "有新图片，请刷新");    
    }

    book.sheet1.getBrick('imgPool').selectionMode = 'multi'; //图片设置成多选模式

    $(document.body).append(`<style>
                        .pzh {position:absolute;left:0;bottom:0px; 
                                height:24px; line-height:24px;width:100%; 
                                background-color:#40af40a0; 
                                color:white;font-weight:bold;font-size:16px;text-align:center;}

                        .delete_pzh { position:absolute; right:0; width:40px; height:14px; top:0; text-align:right; 
                                    vertical-align:top; font-size:12px; color:gray;padding-right:5px;}      
                        .delete_pzh:hover { color:white;}      
                          
                        </style>
                    `);


    //  let data= loadImagePoolData();
    //  console.dir(data);


    $('#blockSize').on('input', resetImgPoolBlockSize);

    setTimeout(function () {
        //调取缩略图大小
        var imgPool = book.sheet1.getBrick('imgPool');

        let blockSize = getImagePoolBlockSize();
        if (blockSize != imgPool.config.blockSize) {
            $('#blockSize').val(blockSize);
            resetImgPoolBlockSize(false);
        }
    }, 1000);


    //调取图片目录
    setTimeout( function(){
    if (window.electron != null) {
        var hostName = electron.getHostName();
        pathToMonit = getMonitePath(hostName);
        
        //开启监控
        if( pathToMonit!='') moniteStart(pathToMonit);
    }
    },500);
}



function resetImgPoolBlockSize(needSaveSetting) {
    if (needSaveSetting == null) needSaveSetting = true;
    var imgPool = book.sheet1.getBrick('imgPool');

    // 先保存当前选中状态及设置的凭证号信息
    var selection = imgPool.getSelectedImageList();
    var pzhMap = {};
    var pzhs = imgPool.dom.find('.pzh');
    for (let i = 0; i < pzhs.length; i++) {
        let id = $(pzhs[i]).parent().attr('id');
        let pzh = $(pzhs[i]).find('.no').text();
        pzhMap[id] = pzh;

    }


    let v = $('#blockSize').val();

    imgPool.config.blockSize = parseInt(v);
    imgPool.rebuildGridly();
    //恢复选中状态
    for (let i = 0; i < selection.length; i++) {
        imgPool.setImageSelected(selection[i].id, true);
    }
    //恢复凭证号
    for (let id in pzhMap) {
        var pzh = pzhMap[id];
        find_pzh(id, true).find('.no').text(pzh);
    }

    if (needSaveSetting) {
        setTimeout(function () {
            setImagePoolBlockSize(imgPool.getConfig("gguid"), v);
        }, 1000);
    }



}

/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet, name, data) {
    //console.dir(data);
    var url = data.url_img;
    book.sheet0.cells("imgPreview").setValue(url);
}
function imageOnMouseOut(sheet, name, data) {

    book.sheet0.cells("imgPreview").setValue("");
}


/**
 * 图片控件中某个图片被双击了
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片被双击)
function imageOnDBLClick(sheet, name, data) {

    //因为 mouseOut 会把大图清除掉，所以这里重新再设置上
    setTimeout(function () {
        var url = data.url_img;
        book.sheet0.cells("imgPreview").setValue(url);

    }, 200);

    var pzh = '';
    try {

        pzh = find_pzh(data.id, false).find('.no').text();
    } catch (err) {

    }

    if (pzh == undefined) pzh = '';

    inputBox("标记为凭证", "", pzh, "输入凭证号码", function (val) {
        if (val == '') {
            var p = find_pzh(data.id, false);
            if (p) p.remove();
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, false);
        } else {
            find_pzh(data.id, true).find('.no').text(val);
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, true);
        }

    }, true /*允许为空*/);
}


//@comment (group=,caption=查找或创建凭证号标记对象,needRightControl=false)
function find_pzh(id, create_if_not_exists) {
    var d = $('#' + id);
    if (!d) {
        $.alert(id + "不存在");
        return null;
    }

    var ret = d.find('.pzh');
    if (ret.length == 0) {
        if (create_if_not_exists) //如果需要创建，则创建它
        {
            d.append(`<div class="pzh" ><div class="no"></div><div class="delete_pzh"><i class="fa fa-close" onclick="removePZH('${id}');  event.preventDefault(); event.stopPropagation();"> </i></div></div>`);
        }
        ret = d.find('.pzh');
    }
    return ret;

}

function removePZH(id) {
    var p = find_pzh(id, false);
    if (p) p.remove();
}

function cb_selectall_onClick() {
    var imgPool = book.sheet1.getBrick('imgPool');
    if (imgPool.getSelectedImageList().length == 0) {
        imgPool.selectAll();
    } else {
        imgPool.unSelectAll();
    }
}


function cb_path_onClick() {
    if (window.electron == null) {
        toastr.error("此功能仅能在客户端APP中执行");
        return;
    }

    var path = electron.showOpenDialogSync('');
    if (path == '') return;
    var hostName = electron.getHostName();
    setMonitePath(hostName, path);

    moniteStart(path);


}

function moniteStart(path)
{
    book.sheet0.cells('stateBar').setValue("图片目录 " + pathToMonit);

     if (window.electron == null) {
        toastr.error("此功能仅能在客户端APP中执行");
        return;
    }

    book.sheet0.cells('stateBar').setValue("图片目录 " + pathToMonit+ " 监控中...");
    electron.ipcSendMessage( {cmd:"moniteStart" , path:path});
}


id: 60a926da5db21e3d0fbaaf09
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.23 00:27:43.000
script:
var pathToMonit = "";

function formOpen() {
    book.showTabOnWhere = "none";

    onPushMessage("newFileUploaded", msg)
    {
        book.sheet0.cells("stateInfo2").setValue( "有新图片，请刷新");    
    }

    book.sheet1.getBrick('imgPool').selectionMode = 'multi'; //图片设置成多选模式

    $(document.body).append(`<style>
                        .pzh {position:absolute;left:0;bottom:0px; 
                                height:24px; line-height:24px;width:100%; 
                                background-color:#40af40a0; 
                                color:white;font-weight:bold;font-size:16px;text-align:center;}

                        .delete_pzh { position:absolute; right:0; width:40px; height:14px; top:0; text-align:right; 
                                    vertical-align:top; font-size:12px; color:gray;padding-right:5px;}      
                        .delete_pzh:hover { color:white;}      
                          
                        </style>
                    `);


    //  let data= loadImagePoolData();
    //  console.dir(data);


    $('#blockSize').on('input', resetImgPoolBlockSize);

    setTimeout(function () {
        //调取缩略图大小
        var imgPool = book.sheet1.getBrick('imgPool');

        let blockSize = getImagePoolBlockSize();
        if (blockSize != imgPool.config.blockSize) {
            $('#blockSize').val(blockSize);
            resetImgPoolBlockSize(false);
        }
    }, 1000);


    //调取图片目录
    setTimeout( function(){
    if (window.electron != null) {
        var hostName = electron.getHostName();
        pathToMonit = getMonitePath(hostName);
        
        //开启监控
        if( pathToMonit!='') moniteStart(pathToMonit);
    }
    },500);
}



function resetImgPoolBlockSize(needSaveSetting) {
    if (needSaveSetting == null) needSaveSetting = true;
    var imgPool = book.sheet1.getBrick('imgPool');

    // 先保存当前选中状态及设置的凭证号信息
    var selection = imgPool.getSelectedImageList();
    var pzhMap = {};
    var pzhs = imgPool.dom.find('.pzh');
    for (let i = 0; i < pzhs.length; i++) {
        let id = $(pzhs[i]).parent().attr('id');
        let pzh = $(pzhs[i]).find('.no').text();
        pzhMap[id] = pzh;

    }


    let v = $('#blockSize').val();

    imgPool.config.blockSize = parseInt(v);
    imgPool.rebuildGridly();
    //恢复选中状态
    for (let i = 0; i < selection.length; i++) {
        imgPool.setImageSelected(selection[i].id, true);
    }
    //恢复凭证号
    for (let id in pzhMap) {
        var pzh = pzhMap[id];
        find_pzh(id, true).find('.no').text(pzh);
    }

    if (needSaveSetting) {
        setTimeout(function () {
            setImagePoolBlockSize(imgPool.getConfig("gguid"), v);
        }, 1000);
    }



}

/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet, name, data) {
    //console.dir(data);
    var url = data.url_img;
    book.sheet0.cells("imgPreview").setValue(url);
}
function imageOnMouseOut(sheet, name, data) {

    book.sheet0.cells("imgPreview").setValue("");
}


/**
 * 图片控件中某个图片被双击了
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片被双击)
function imageOnDBLClick(sheet, name, data) {

    //因为 mouseOut 会把大图清除掉，所以这里重新再设置上
    setTimeout(function () {
        var url = data.url_img;
        book.sheet0.cells("imgPreview").setValue(url);

    }, 200);

    var pzh = '';
    try {

        pzh = find_pzh(data.id, false).find('.no').text();
    } catch (err) {

    }

    if (pzh == undefined) pzh = '';

    inputBox("标记为凭证", "", pzh, "输入凭证号码", function (val) {
        if (val == '') {
            var p = find_pzh(data.id, false);
            if (p) p.remove();
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, false);
        } else {
            find_pzh(data.id, true).find('.no').text(val);
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, true);
        }

    }, true /*允许为空*/);
}


//@comment (group=,caption=查找或创建凭证号标记对象,needRightControl=false)
function find_pzh(id, create_if_not_exists) {
    var d = $('#' + id);
    if (!d) {
        $.alert(id + "不存在");
        return null;
    }

    var ret = d.find('.pzh');
    if (ret.length == 0) {
        if (create_if_not_exists) //如果需要创建，则创建它
        {
            d.append(`<div class="pzh" ><div class="no"></div><div class="delete_pzh"><i class="fa fa-close" onclick="removePZH('${id}');  event.preventDefault(); event.stopPropagation();"> </i></div></div>`);
        }
        ret = d.find('.pzh');
    }
    return ret;

}

function removePZH(id) {
    var p = find_pzh(id, false);
    if (p) p.remove();
}

function cb_selectall_onClick() {
    var imgPool = book.sheet1.getBrick('imgPool');
    if (imgPool.getSelectedImageList().length == 0) {
        imgPool.selectAll();
    } else {
        imgPool.unSelectAll();
    }
}


function cb_path_onClick() {
    if (window.electron == null) {
        toastr.error("此功能仅能在客户端APP中执行");
        return;
    }

    var path = electron.showOpenDialogSync('');
    if (path == '') return;
    var hostName = electron.getHostName();
    setMonitePath(hostName, path);

    moniteStart(path);


}

function moniteStart(path)
{
    book.sheet0.cells('stateBar').setValue("图片目录 " + pathToMonit);

     if (window.electron == null) {
        toastr.error("此功能仅能在客户端APP中执行");
        return;
    }

    book.sheet0.cells('stateBar').setValue("图片目录 " + pathToMonit+ " 监控中...");
    electron.ipcSendMessage( {cmd:"moniteStart" , path:path});
}

function cb_refresh_onClick()
{
    book.sheet0.cells("stateInfo2").setValue( "");    
}


id: 60a926da5db21e3d0fbaaf0f
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.23 00:28:34.000
script:
var pathToMonit = "";

function formOpen() {
    book.showTabOnWhere = "none";

    onPushMessage("newFileUploaded", function(msg){
    
        book.sheet0.cells("stateInfo2").setValue( "有新图片，请刷新");    
    });

    book.sheet1.getBrick('imgPool').selectionMode = 'multi'; //图片设置成多选模式

    $(document.body).append(`<style>
                        .pzh {position:absolute;left:0;bottom:0px; 
                                height:24px; line-height:24px;width:100%; 
                                background-color:#40af40a0; 
                                color:white;font-weight:bold;font-size:16px;text-align:center;}

                        .delete_pzh { position:absolute; right:0; width:40px; height:14px; top:0; text-align:right; 
                                    vertical-align:top; font-size:12px; color:gray;padding-right:5px;}      
                        .delete_pzh:hover { color:white;}      
                          
                        </style>
                    `);


    //  let data= loadImagePoolData();
    //  console.dir(data);


    $('#blockSize').on('input', resetImgPoolBlockSize);

    setTimeout(function () {
        //调取缩略图大小
        var imgPool = book.sheet1.getBrick('imgPool');

        let blockSize = getImagePoolBlockSize();
        if (blockSize != imgPool.config.blockSize) {
            $('#blockSize').val(blockSize);
            resetImgPoolBlockSize(false);
        }
    }, 1000);


    //调取图片目录
    setTimeout( function(){
    if (window.electron != null) {
        var hostName = electron.getHostName();
        pathToMonit = getMonitePath(hostName);
        
        //开启监控
        if( pathToMonit!='') moniteStart(pathToMonit);
    }
    },500);
}



function resetImgPoolBlockSize(needSaveSetting) {
    if (needSaveSetting == null) needSaveSetting = true;
    var imgPool = book.sheet1.getBrick('imgPool');

    // 先保存当前选中状态及设置的凭证号信息
    var selection = imgPool.getSelectedImageList();
    var pzhMap = {};
    var pzhs = imgPool.dom.find('.pzh');
    for (let i = 0; i < pzhs.length; i++) {
        let id = $(pzhs[i]).parent().attr('id');
        let pzh = $(pzhs[i]).find('.no').text();
        pzhMap[id] = pzh;

    }


    let v = $('#blockSize').val();

    imgPool.config.blockSize = parseInt(v);
    imgPool.rebuildGridly();
    //恢复选中状态
    for (let i = 0; i < selection.length; i++) {
        imgPool.setImageSelected(selection[i].id, true);
    }
    //恢复凭证号
    for (let id in pzhMap) {
        var pzh = pzhMap[id];
        find_pzh(id, true).find('.no').text(pzh);
    }

    if (needSaveSetting) {
        setTimeout(function () {
            setImagePoolBlockSize(imgPool.getConfig("gguid"), v);
        }, 1000);
    }



}

/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet, name, data) {
    //console.dir(data);
    var url = data.url_img;
    book.sheet0.cells("imgPreview").setValue(url);
}
function imageOnMouseOut(sheet, name, data) {

    book.sheet0.cells("imgPreview").setValue("");
}


/**
 * 图片控件中某个图片被双击了
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片被双击)
function imageOnDBLClick(sheet, name, data) {

    //因为 mouseOut 会把大图清除掉，所以这里重新再设置上
    setTimeout(function () {
        var url = data.url_img;
        book.sheet0.cells("imgPreview").setValue(url);

    }, 200);

    var pzh = '';
    try {

        pzh = find_pzh(data.id, false).find('.no').text();
    } catch (err) {

    }

    if (pzh == undefined) pzh = '';

    inputBox("标记为凭证", "", pzh, "输入凭证号码", function (val) {
        if (val == '') {
            var p = find_pzh(data.id, false);
            if (p) p.remove();
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, false);
        } else {
            find_pzh(data.id, true).find('.no').text(val);
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, true);
        }

    }, true /*允许为空*/);
}


//@comment (group=,caption=查找或创建凭证号标记对象,needRightControl=false)
function find_pzh(id, create_if_not_exists) {
    var d = $('#' + id);
    if (!d) {
        $.alert(id + "不存在");
        return null;
    }

    var ret = d.find('.pzh');
    if (ret.length == 0) {
        if (create_if_not_exists) //如果需要创建，则创建它
        {
            d.append(`<div class="pzh" ><div class="no"></div><div class="delete_pzh"><i class="fa fa-close" onclick="removePZH('${id}');  event.preventDefault(); event.stopPropagation();"> </i></div></div>`);
        }
        ret = d.find('.pzh');
    }
    return ret;

}

function removePZH(id) {
    var p = find_pzh(id, false);
    if (p) p.remove();
}

function cb_selectall_onClick() {
    var imgPool = book.sheet1.getBrick('imgPool');
    if (imgPool.getSelectedImageList().length == 0) {
        imgPool.selectAll();
    } else {
        imgPool.unSelectAll();
    }
}


function cb_path_onClick() {
    if (window.electron == null) {
        toastr.error("此功能仅能在客户端APP中执行");
        return;
    }

    var path = electron.showOpenDialogSync('');
    if (path == '') return;
    var hostName = electron.getHostName();
    setMonitePath(hostName, path);

    moniteStart(path);


}

function moniteStart(path)
{
    book.sheet0.cells('stateBar').setValue("图片目录 " + pathToMonit);

     if (window.electron == null) {
        toastr.error("此功能仅能在客户端APP中执行");
        return;
    }

    book.sheet0.cells('stateBar').setValue("图片目录 " + pathToMonit+ " 监控中...");
    electron.ipcSendMessage( {cmd:"moniteStart" , path:path});
}

function cb_refresh_onClick()
{
    book.sheet0.cells("stateInfo2").setValue( "");    
}


id: 60a926da5db21e3d0fbaaf15
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.23 00:34:42.000
script:
var pathToMonit = "";

function formOpen() {
    book.showTabOnWhere = "none";

    onPushMessage("newFileUploaded", function(msg){
    
        book.sheet0.cells("stateInfo2").setValue( "有新图片，请刷新");    
    });

    book.sheet1.getBrick('imgPool').selectionMode = 'multi'; //图片设置成多选模式

    $(document.body).append(`<style>
                        .pzh {position:absolute;left:0;bottom:0px; 
                                height:24px; line-height:24px;width:100%; 
                                background-color:#40af40a0; 
                                color:white;font-weight:bold;font-size:16px;text-align:center;}

                        .delete_pzh { position:absolute; right:0; width:40px; height:14px; top:0; text-align:right; 
                                    vertical-align:top; font-size:12px; color:gray;padding-right:5px;}      
                        .delete_pzh:hover { color:white;}      
                          
                        </style>
                    `);


    //  let data= loadImagePoolData();
    //  console.dir(data);


    $('#blockSize').on('input', resetImgPoolBlockSize);

    setTimeout(function () {
        //调取缩略图大小
        var imgPool = book.sheet1.getBrick('imgPool');

        let blockSize = getImagePoolBlockSize();
        if (blockSize != imgPool.config.blockSize) {
            $('#blockSize').val(blockSize);
            resetImgPoolBlockSize(false);
        }
    }, 1000);


    //调取图片目录
    setTimeout( function(){
    if (window.electron != null) {
        var hostName = electron.getHostName();
        pathToMonit = getMonitePath(hostName);
        
        //开启监控
        if( pathToMonit!='') moniteStart(pathToMonit);
    }
    },500);
}



function resetImgPoolBlockSize(needSaveSetting) {
    if (needSaveSetting == null) needSaveSetting = true;
    var imgPool = book.sheet1.getBrick('imgPool');

    // 先保存当前选中状态及设置的凭证号信息
    var selection = imgPool.getSelectedImageList();
    var pzhMap = {};
    var pzhs = imgPool.dom.find('.pzh');
    for (let i = 0; i < pzhs.length; i++) {
        let id = $(pzhs[i]).parent().attr('id');
        let pzh = $(pzhs[i]).find('.no').text();
        pzhMap[id] = pzh;

    }


    let v = $('#blockSize').val();

    imgPool.config.blockSize = parseInt(v);
    imgPool.rebuildGridly();
    //恢复选中状态
    for (let i = 0; i < selection.length; i++) {
        imgPool.setImageSelected(selection[i].id, true);
    }
    //恢复凭证号
    for (let id in pzhMap) {
        var pzh = pzhMap[id];
        find_pzh(id, true).find('.no').text(pzh);
    }

    if (needSaveSetting) {
        setTimeout(function () {
            setImagePoolBlockSize(imgPool.getConfig("gguid"), v);
        }, 1000);
    }



}

/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet, name, data) {
    //console.dir(data);
    var url = data.url_img;
    book.sheet0.cells("imgPreview").setValue(url);
}
function imageOnMouseOut(sheet, name, data) {

    book.sheet0.cells("imgPreview").setValue("");
}


/**
 * 图片控件中某个图片被双击了
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片被双击)
function imageOnDBLClick(sheet, name, data) {

    //因为 mouseOut 会把大图清除掉，所以这里重新再设置上
    setTimeout(function () {
        var url = data.url_img;
        book.sheet0.cells("imgPreview").setValue(url);

    }, 200);

    var pzh = '';
    try {

        pzh = find_pzh(data.id, false).find('.no').text();
    } catch (err) {

    }

    if (pzh == undefined) pzh = '';

    inputBox("标记为凭证", "", pzh, "输入凭证号码", function (val) {
        if (val == '') {
            var p = find_pzh(data.id, false);
            if (p) p.remove();
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, false);
        } else {
            find_pzh(data.id, true).find('.no').text(val);
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, true);
        }

    }, true /*允许为空*/);
}


//@comment (group=,caption=查找或创建凭证号标记对象,needRightControl=false)
function find_pzh(id, create_if_not_exists) {
    var d = $('#' + id);
    if (!d) {
        $.alert(id + "不存在");
        return null;
    }

    var ret = d.find('.pzh');
    if (ret.length == 0) {
        if (create_if_not_exists) //如果需要创建，则创建它
        {
            d.append(`<div class="pzh" ><div class="no"></div><div class="delete_pzh"><i class="fa fa-close" onclick="removePZH('${id}');  event.preventDefault(); event.stopPropagation();"> </i></div></div>`);
        }
        ret = d.find('.pzh');
    }
    return ret;

}

function removePZH(id) {
    var p = find_pzh(id, false);
    if (p) p.remove();
}

function cb_selectall_onClick() {
    var imgPool = book.sheet1.getBrick('imgPool');
    if (imgPool.getSelectedImageList().length == 0) {
        imgPool.selectAll();
    } else {
        imgPool.unSelectAll();
    }
}


function cb_path_onClick() {
    if (window.electron == null) {
        toastr.error("此功能仅能在客户端APP中执行");
        return;
    }

    var path = electron.showOpenDialogSync('');
    if (path == '') return;
    var hostName = electron.getHostName();
    setMonitePath(hostName, path);

    moniteStart(path);


}

function moniteStart(path)
{
    book.sheet0.cells('stateBar').setValue("图片目录 " + pathToMonit);

     if (window.electron == null) {
        toastr.error("此功能仅能在客户端APP中执行");
        return;
    }

    book.sheet0.cells('stateBar').setValue("图片目录 " + pathToMonit+ " 监控中...");
    electron.ipcSendMessage( {cmd:"moniteStart" , path:path});
}

function cb_refresh_onClick()
{
    book.sheet0.cells("stateInfo2").setValue( "");    
    var imgPool = book.sheet1.getBrick('imgPool');
    imgPool.reInit(); //重新初始化
}


id: 60a926da5db21e3d0fbaaf1b
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.23 00:43:45.000
script:
var pathToMonit = "";

function formOpen() {
    book.showTabOnWhere = "none";

    onPushMessage("newFileUploaded", function(msg){
    
        book.sheet0.cells("stateInfo2").setValue( "有新图片，请刷新");    
    });

    book.sheet1.getBrick('imgPool').selectionMode = 'multi'; //图片设置成多选模式

    $(document.body).append(`<style>
                        .pzh {position:absolute;left:0;bottom:0px; 
                                height:24px; line-height:24px;width:100%; 
                                background-color:#40af40a0; 
                                color:white;font-weight:bold;font-size:16px;text-align:center;}

                        .delete_pzh { position:absolute; right:0; width:40px; height:14px; top:0; text-align:right; 
                                    vertical-align:top; font-size:12px; color:gray;padding-right:5px;}      
                        .delete_pzh:hover { color:white;}      
                          
                        </style>
                    `);


    //  let data= loadImagePoolData();
    //  console.dir(data);


    $('#blockSize').on('input', resetImgPoolBlockSize);

    setTimeout(function () {
        //调取缩略图大小
        var imgPool = book.sheet1.getBrick('imgPool');

        let blockSize = getImagePoolBlockSize();
        if (blockSize != imgPool.config.blockSize) {
            $('#blockSize').val(blockSize);
            resetImgPoolBlockSize(false);
        }
    }, 1000);


    //调取图片目录
    setTimeout( function(){
    if (window.electron != null) {
        var hostName = electron.getHostName();
        pathToMonit = getMonitePath(hostName);
        
        //开启监控
        if( pathToMonit!='') moniteStart(pathToMonit);
    }
    },500);
}

// 先保存当前选中状态及设置的凭证号信息

var g_selection;
var g_pzMap;
function  saveSelectionAndPZInfo( )
{
     
    var imgPool = book.sheet1.getBrick('imgPool');

    // 保存当前选中状态及设置的凭证号信息
    var selection = imgPool.getSelectedImageList();
    // 保存设置的凭证号信息
    var pzhMap = {};
    var pzhs = imgPool.dom.find('.pzh');
    for (let i = 0; i < pzhs.length; i++) {
        let id = $(pzhs[i]).parent().attr('id');
        let pzh = $(pzhs[i]).find('.no').text();
        pzhMap[id] = pzh;

    }
    g_selection=selection;
    g_pzMap=pzhMap;
}

function  restoreSelectionAndPZInfo()
{
     var selection= g_selection;
     var pzhMap= g_pzMap;
    var imgPool = book.sheet1.getBrick('imgPool');

     //恢复选中状态
    for (let i = 0; i < selection.length; i++) {
        imgPool.setImageSelected(selection[i].id, true);
    }
    //恢复凭证号
    for (let id in pzhMap) {
        var pzh = pzhMap[id];
        find_pzh(id, true).find('.no').text(pzh);
    }

}

function resetImgPoolBlockSize(needSaveSetting) {
    if (needSaveSetting == null) needSaveSetting = true;
    var imgPool = book.sheet1.getBrick('imgPool');


    // 先保存当前选中状态及设置的凭证号信息
    saveSelectionAndPZInfo();

    let v = $('#blockSize').val();

    imgPool.config.blockSize = parseInt(v);
    imgPool.rebuildGridly();
   
    //恢复选中状态
    restoreSelectionAndPZInfo();

    if (needSaveSetting) {
        setTimeout(function () {
            setImagePoolBlockSize(imgPool.getConfig("gguid"), v);
        }, 1000);
    }



}

/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet, name, data) {
    //console.dir(data);
    var url = data.url_img;
    book.sheet0.cells("imgPreview").setValue(url);
}
function imageOnMouseOut(sheet, name, data) {

    book.sheet0.cells("imgPreview").setValue("");
}


/**
 * 图片控件中某个图片被双击了
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片被双击)
function imageOnDBLClick(sheet, name, data) {

    //因为 mouseOut 会把大图清除掉，所以这里重新再设置上
    setTimeout(function () {
        var url = data.url_img;
        book.sheet0.cells("imgPreview").setValue(url);

    }, 200);

    var pzh = '';
    try {

        pzh = find_pzh(data.id, false).find('.no').text();
    } catch (err) {

    }

    if (pzh == undefined) pzh = '';

    inputBox("标记为凭证", "", pzh, "输入凭证号码", function (val) {
        if (val == '') {
            var p = find_pzh(data.id, false);
            if (p) p.remove();
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, false);
        } else {
            find_pzh(data.id, true).find('.no').text(val);
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, true);
        }

    }, true /*允许为空*/);
}


//@comment (group=,caption=查找或创建凭证号标记对象,needRightControl=false)
function find_pzh(id, create_if_not_exists) {
    var d = $('#' + id);
    if (!d) {
        $.alert(id + "不存在");
        return null;
    }

    var ret = d.find('.pzh');
    if (ret.length == 0) {
        if (create_if_not_exists) //如果需要创建，则创建它
        {
            d.append(`<div class="pzh" ><div class="no"></div><div class="delete_pzh"><i class="fa fa-close" onclick="removePZH('${id}');  event.preventDefault(); event.stopPropagation();"> </i></div></div>`);
        }
        ret = d.find('.pzh');
    }
    return ret;

}

function removePZH(id) {
    var p = find_pzh(id, false);
    if (p) p.remove();
}

function cb_selectall_onClick() {
    var imgPool = book.sheet1.getBrick('imgPool');
    if (imgPool.getSelectedImageList().length == 0) {
        imgPool.selectAll();
    } else {
        imgPool.unSelectAll();
    }
}


function cb_path_onClick() {
    if (window.electron == null) {
        toastr.error("此功能仅能在客户端APP中执行");
        return;
    }

    var path = electron.showOpenDialogSync('');
    if (path == '') return;
    var hostName = electron.getHostName();
    setMonitePath(hostName, path);

    moniteStart(path);


}

function moniteStart(path)
{
    book.sheet0.cells('stateBar').setValue("图片目录 " + pathToMonit);

     if (window.electron == null) {
        toastr.error("此功能仅能在客户端APP中执行");
        return;
    }

    book.sheet0.cells('stateBar').setValue("图片目录 " + pathToMonit+ " 监控中...");
    electron.ipcSendMessage( {cmd:"moniteStart" , path:path});
}

function cb_refresh_onClick()
{
    book.sheet0.cells("stateInfo2").setValue( "");    

     // 先保存当前选中状态及设置的凭证号信息
    saveSelectionAndPZInfo();

    var imgPool = book.sheet1.getBrick('imgPool');
    imgPool.reInit(); //重新初始化

   
    //恢复选中状态
    restoreSelectionAndPZInfo();

    
}


id: 60a926da5db21e3d0fbaaf21
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.23 00:53:02.000
script:
var pathToMonit = "";

function formOpen() {
    book.showTabOnWhere = "none";

    onPushMessage("newFileUploaded", function(msg){
    
        book.sheet0.cells("stateInfo2").setValue( "有新图片，请刷新");    
    });

    book.sheet1.getBrick('imgPool').selectionMode = 'multi'; //图片设置成多选模式

    $(document.body).append(`<style>
                        .pzh {position:absolute;left:0;bottom:0px; 
                                height:24px; line-height:24px;width:100%; 
                                background-color:#40af40a0; 
                                color:white;font-weight:bold;font-size:16px;text-align:center;}

                        .delete_pzh { position:absolute; right:0; width:40px; height:14px; top:0; text-align:right; 
                                    vertical-align:top; font-size:12px; color:gray;padding-right:5px;}      
                        .delete_pzh:hover { color:white;}      
                          
                        </style>
                    `);


    //  let data= loadImagePoolData();
    //  console.dir(data);


    $('#blockSize').on('input', resetImgPoolBlockSize);

    setTimeout(function () {
        //调取缩略图大小
        var imgPool = book.sheet1.getBrick('imgPool');

        let blockSize = getImagePoolBlockSize();
        if (blockSize != imgPool.config.blockSize) {
            $('#blockSize').val(blockSize);
            resetImgPoolBlockSize(false);
        }
    }, 1000);


    //调取图片目录
    setTimeout( function(){
    if (window.electron != null) {
        var hostName = electron.getHostName();
        pathToMonit = getMonitePath(hostName);
        
        //开启监控
        if( pathToMonit!='') moniteStart(pathToMonit);
    }
    },500);
}

// 先保存当前选中状态及设置的凭证号信息

var g_selection;
var g_pzMap;
function  saveSelectionAndPZInfo( )
{
     
    var imgPool = book.sheet1.getBrick('imgPool');

    // 保存当前选中状态及设置的凭证号信息
    var selection = imgPool.getSelectedImageList();
    // 保存设置的凭证号信息
    var pzhMap = {};
    var pzhs = imgPool.dom.find('.pzh');
    for (let i = 0; i < pzhs.length; i++) {
        let id = $(pzhs[i]).parent().attr('id');
        let pzh = $(pzhs[i]).find('.no').text();
        pzhMap[id] = pzh;

    }
    g_selection=selection;
    g_pzMap=pzhMap;
}

function  restoreSelectionAndPZInfo()
{
     var selection= g_selection;
     var pzhMap= g_pzMap;
    var imgPool = book.sheet1.getBrick('imgPool');

     //恢复选中状态
    for (let i = 0; i < selection.length; i++) {
        imgPool.setImageSelected(selection[i].id, true);
    }
    //恢复凭证号
    for (let id in pzhMap) {
        var pzh = pzhMap[id];
        find_pzh(id, true).find('.no').text(pzh);
    }

}

function resetImgPoolBlockSize(needSaveSetting) {
    if (needSaveSetting == null) needSaveSetting = true;
    var imgPool = book.sheet1.getBrick('imgPool');


    // 先保存当前选中状态及设置的凭证号信息
    saveSelectionAndPZInfo();

    let v = $('#blockSize').val();

    imgPool.config.blockSize = parseInt(v);
    imgPool.rebuildGridly();
   
    //恢复选中状态
    restoreSelectionAndPZInfo();

    if (needSaveSetting) {
        setTimeout(function () {
            setImagePoolBlockSize(imgPool.getConfig("gguid"), v);
        }, 1000);
    }



}

/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet, name, data) {
    //console.dir(data);
    var url = data.url_img;
    book.sheet0.cells("imgPreview").setValue(url);
}
function imageOnMouseOut(sheet, name, data) {

    book.sheet0.cells("imgPreview").setValue("");
}


/**
 * 图片控件中某个图片被双击了
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片被双击)
function imageOnDBLClick(sheet, name, data) {

    //因为 mouseOut 会把大图清除掉，所以这里重新再设置上
    setTimeout(function () {
        var url = data.url_img;
        book.sheet0.cells("imgPreview").setValue(url);

    }, 200);

    var pzh = '';
    try {

        pzh = find_pzh(data.id, false).find('.no').text();
    } catch (err) {

    }

    if (pzh == undefined) pzh = '';

    inputBox("标记为凭证", "", pzh, "输入凭证号码", function (val) {
        if (val == '') {
            var p = find_pzh(data.id, false);
            if (p) p.remove();
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, false);
        } else {
            find_pzh(data.id, true).find('.no').text(val);
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, true);
        }

    }, true /*允许为空*/);
}


//@comment (group=,caption=查找或创建凭证号标记对象,needRightControl=false)
function find_pzh(id, create_if_not_exists) {
    var d = $('#' + id);
    if (!d) {
        $.alert(id + "不存在");
        return null;
    }

    var ret = d.find('.pzh');
    if (ret.length == 0) {
        if (create_if_not_exists) //如果需要创建，则创建它
        {
            d.append(`<div class="pzh" ><div class="no"></div><div class="delete_pzh"><i class="fa fa-close" onclick="removePZH('${id}');  event.preventDefault(); event.stopPropagation();"> </i></div></div>`);
        }
        ret = d.find('.pzh');
    }
    return ret;

}

function removePZH(id) {
    var p = find_pzh(id, false);
    if (p) p.remove();
}

function cb_selectall_onClick() {
    var imgPool = book.sheet1.getBrick('imgPool');
    if (imgPool.getSelectedImageList().length == 0) {
        imgPool.selectAll();
    } else {
        imgPool.unSelectAll();
    }
}


function cb_path_onClick() {
    if (window.electron == null) {
        toastr.error("此功能仅能在客户端APP中执行");
        return;
    }

    var path = electron.showOpenDialogSync('');
    if (path == '') return;
    var hostName = electron.getHostName();
    setMonitePath(hostName, path);

    moniteStart(path);


}

function moniteStart(path)
{
    book.sheet0.cells('stateBar').setValue("图片目录 " + pathToMonit);

     if (window.electron == null) {
        toastr.error("此功能仅能在客户端APP中执行");
        return;
    }

    book.sheet0.cells('stateBar').setValue("图片目录 " + pathToMonit+ " 监控中...");
    electron.ipcSendMessage( {cmd:"moniteStart" , path:path});
}

function cb_refresh_onClick()
{
    book.sheet0.cells("stateInfo2").setValue( "");    

     // 先保存当前选中状态及设置的凭证号信息
    saveSelectionAndPZInfo();

    var imgPool = book.sheet1.getBrick('imgPool');
    imgPool.reInit( restoreSelectionAndPZInfo); //重新初始化 ,并在初始化完成后， 恢复选中状态

   
     
    
}


id: 60a939f85db21e3d0fbaaf3e
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.23 01:09:09.000
script:
var pathToMonit = "";

function formOpen() {
    book.showTabOnWhere = "none";

    onPushMessage("newFileUploaded", function(msg){
    
        book.sheet0.cells("stateInfo2").setValue( "有新图片，请刷新");    
    });

    book.sheet1.getBrick('imgPool').selectionMode = 'multi'; //图片设置成多选模式

    $(document.body).append(`<style>
                        .pzh {position:absolute;left:0;bottom:0px; 
                                height:24px; line-height:24px;width:100%; 
                                background-color:#40af40a0; 
                                color:white;font-weight:bold;font-size:16px;text-align:center;}

                        .delete_pzh { position:absolute; right:0; width:40px; height:14px; top:0; text-align:right; 
                                    vertical-align:top; font-size:12px; color:gray;padding-right:5px;}      
                        .delete_pzh:hover { color:white;}      
                          
                        </style>
                    `);


    //  let data= loadImagePoolData();
    //  console.dir(data);


    $('#blockSize').on('input', resetImgPoolBlockSize);

    setTimeout(function () {
        //调取缩略图大小
        var imgPool = book.sheet1.getBrick('imgPool');

        let blockSize = getImagePoolBlockSize();
        if (blockSize != imgPool.config.blockSize) {
            $('#blockSize').val(blockSize);
            resetImgPoolBlockSize(false);
        }
    }, 1000);


    //调取图片目录
    setTimeout( function(){
    if (window.electron != null) {
        var hostName = electron.getHostName();
        pathToMonit = getMonitePath(hostName);
        
        //开启监控
        if( pathToMonit!='') moniteStart(pathToMonit);
    }
    },500);
}

// 先保存当前选中状态及设置的凭证号信息

var g_selection;
var g_pzMap;
function  saveSelectionAndPZInfo( )
{
     
    var imgPool = book.sheet1.getBrick('imgPool');

    // 保存当前选中状态及设置的凭证号信息
    var selection = imgPool.getSelectedImageList();
    // 保存设置的凭证号信息
    var pzhMap = {};
    var pzhs = imgPool.dom.find('.pzh');
    for (let i = 0; i < pzhs.length; i++) {
        let id = $(pzhs[i]).parent().attr('id');
        let pzh = $(pzhs[i]).find('.no').text();
        pzhMap[id] = pzh;

    }
    g_selection=selection;
    g_pzMap=pzhMap;
}

function  restoreSelectionAndPZInfo()
{
     var selection= g_selection;
     var pzhMap= g_pzMap;
    var imgPool = book.sheet1.getBrick('imgPool');

     //恢复选中状态
    for (let i = 0; i < selection.length; i++) {
        imgPool.setImageSelected(selection[i].id, true);
    }
    //恢复凭证号
    for (let id in pzhMap) {
        var pzh = pzhMap[id];
        find_pzh(id, true).find('.no').text(pzh);
    }

}

function resetImgPoolBlockSize(needSaveSetting) {
    if (needSaveSetting == null) needSaveSetting = true;
    var imgPool = book.sheet1.getBrick('imgPool');


    // 先保存当前选中状态及设置的凭证号信息
    saveSelectionAndPZInfo();

    let v = $('#blockSize').val();

    imgPool.config.blockSize = parseInt(v);
    imgPool.rebuildGridly();
   
    //恢复选中状态
    restoreSelectionAndPZInfo();

    if (needSaveSetting) {
        setTimeout(function () {
            setImagePoolBlockSize(imgPool.getConfig("gguid"), v);
        }, 1000);
    }



}

/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet, name, data) {
    //console.dir(data);
    var url = data.url_img;
    book.sheet0.cells("imgPreview").setValue(url);
}
function imageOnMouseOut(sheet, name, data) {

    book.sheet0.cells("imgPreview").setValue("");
}


/**
 * 图片控件中某个图片被双击了
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片被双击)
function imageOnDBLClick(sheet, name, data) {

    //因为 mouseOut 会把大图清除掉，所以这里重新再设置上
    setTimeout(function () {
        var url = data.url_img;
        book.sheet0.cells("imgPreview").setValue(url);

    }, 200);

    var pzh = '';
    try {

        pzh = find_pzh(data.id, false).find('.no').text();
    } catch (err) {

    }

    if (pzh == undefined) pzh = '';

    inputBox("标记为凭证", "", pzh, "输入凭证号码", function (val) {
        if (val == '') {
            var p = find_pzh(data.id, false);
            if (p) p.remove();
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, false);
        } else {
            find_pzh(data.id, true).find('.no').text(val);
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, true);
        }

    }, true /*允许为空*/);
}


//@comment (group=,caption=查找或创建凭证号标记对象,needRightControl=false)
function find_pzh(id, create_if_not_exists) {
    var d = $('#' + id);
    if (!d) {
        $.alert(id + "不存在");
        return null;
    }

    var ret = d.find('.pzh');
    if (ret.length == 0) {
        if (create_if_not_exists) //如果需要创建，则创建它
        {
            d.append(`<div class="pzh" ><div class="no"></div><div class="delete_pzh"><i class="fa fa-close" onclick="removePZH('${id}');  event.preventDefault(); event.stopPropagation();"> </i></div></div>`);
        }
        ret = d.find('.pzh');
    }
    return ret;

}

function removePZH(id) {
    var p = find_pzh(id, false);
    if (p) p.remove();
}

function cb_selectall_onClick() {
    var imgPool = book.sheet1.getBrick('imgPool');
    if (imgPool.getSelectedImageList().length == 0) {
        imgPool.selectAll();
    } else {
        imgPool.unSelectAll();
    }
}


function cb_path_onClick() {
    if (window.electron == null) {
        toastr.error("此功能仅能在客户端APP中执行");
        return;
    }

    var path = electron.showOpenDialogSync('');
    if (path == '') return;
    var hostName = electron.getHostName();
    setMonitePath(hostName, path);
 
    moniteStart(path);


}

function moniteStart(path)
{
    pathToMonit=path;
    book.sheet0.cells('stateBar').setValue("图片目录 " + pathToMonit);

     if (window.electron == null) {
        toastr.error("此功能仅能在客户端APP中执行");
        return;
    }

    book.sheet0.cells('stateBar').setValue("图片目录 " + pathToMonit+ " 监控中...");
    electron.ipcSendMessage( {cmd:"moniteStart" , path:path});
}

function cb_refresh_onClick()
{
    book.sheet0.cells("stateInfo2").setValue( "");    

     // 先保存当前选中状态及设置的凭证号信息
    saveSelectionAndPZInfo();

    var imgPool = book.sheet1.getBrick('imgPool');
    imgPool.reInit( restoreSelectionAndPZInfo); //重新初始化 ,并在初始化完成后， 恢复选中状态

   
     
    
}


id: 60a939f85db21e3d0fbaaf49
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.23 09:05:17.000
script:
var pathToMonit = "";

function formOpen() {
    book.showTabOnWhere = "none";
    hideNewImgCommingTip();
    onPushMessage("newFileUploaded", function(msg){
    
        book.sheet0.cells("stateInfo2").setValue( "有新图片，请刷新");    
    });

    book.sheet1.getBrick('imgPool').selectionMode = 'multi'; //图片设置成多选模式

    $(document.body).append(`<style>
                        .pzh {position:absolute;left:0;bottom:0px; 
                                height:24px; line-height:24px;width:100%; 
                                background-color:#40af40a0; 
                                color:white;font-weight:bold;font-size:16px;text-align:center;}

                        .delete_pzh { position:absolute; right:0; width:40px; height:14px; top:0; text-align:right; 
                                    vertical-align:top; font-size:12px; color:gray;padding-right:5px;}      
                        .delete_pzh:hover { color:white;}      
                          
                        </style>
                    `);


    //  let data= loadImagePoolData();
    //  console.dir(data);


    $('#blockSize').on('input', resetImgPoolBlockSize);

    setTimeout(function () {
        //调取缩略图大小
        var imgPool = book.sheet1.getBrick('imgPool');

        let blockSize = getImagePoolBlockSize();
        if (blockSize != imgPool.config.blockSize) {
            $('#blockSize').val(blockSize);
            resetImgPoolBlockSize(false);
        }
    }, 1000);


    //调取图片目录
    setTimeout( function(){
    if (window.electron != null) {
        var hostName = electron.getHostName();
        pathToMonit = getMonitePath(hostName);
        
        //开启监控
        if( pathToMonit!='') moniteStart(pathToMonit);
    }
    },500);
}

// 先保存当前选中状态及设置的凭证号信息

var g_selection;
var g_pzMap;
function  saveSelectionAndPZInfo( )
{
     
    var imgPool = book.sheet1.getBrick('imgPool');

    // 保存当前选中状态及设置的凭证号信息
    var selection = imgPool.getSelectedImageList();
    // 保存设置的凭证号信息
    var pzhMap = {};
    var pzhs = imgPool.dom.find('.pzh');
    for (let i = 0; i < pzhs.length; i++) {
        let id = $(pzhs[i]).parent().attr('id');
        let pzh = $(pzhs[i]).find('.no').text();
        pzhMap[id] = pzh;

    }
    g_selection=selection;
    g_pzMap=pzhMap;
}

function  restoreSelectionAndPZInfo()
{
     var selection= g_selection;
     var pzhMap= g_pzMap;
    var imgPool = book.sheet1.getBrick('imgPool');

     //恢复选中状态
    for (let i = 0; i < selection.length; i++) {
        imgPool.setImageSelected(selection[i].id, true);
    }
    //恢复凭证号
    for (let id in pzhMap) {
        var pzh = pzhMap[id];
        find_pzh(id, true).find('.no').text(pzh);
    }

}

function resetImgPoolBlockSize(needSaveSetting) {
    if (needSaveSetting == null) needSaveSetting = true;
    var imgPool = book.sheet1.getBrick('imgPool');


    // 先保存当前选中状态及设置的凭证号信息
    saveSelectionAndPZInfo();

    let v = $('#blockSize').val();

    imgPool.config.blockSize = parseInt(v);
    imgPool.rebuildGridly();
   
    //恢复选中状态
    restoreSelectionAndPZInfo();

    if (needSaveSetting) {
        setTimeout(function () {
            setImagePoolBlockSize(imgPool.getConfig("gguid"), v);
        }, 1000);
    }



}

/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet, name, data) {
    //console.dir(data);
    var url = data.url_img;
    book.sheet0.cells("imgPreview").setValue(url);
}
function imageOnMouseOut(sheet, name, data) {

    book.sheet0.cells("imgPreview").setValue("");
}


/**
 * 图片控件中某个图片被双击了
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片被双击)
function imageOnDBLClick(sheet, name, data) {

    //因为 mouseOut 会把大图清除掉，所以这里重新再设置上
    setTimeout(function () {
        var url = data.url_img;
        book.sheet0.cells("imgPreview").setValue(url);

    }, 200);

    var pzh = '';
    try {

        pzh = find_pzh(data.id, false).find('.no').text();
    } catch (err) {

    }

    if (pzh == undefined) pzh = '';

    inputBox("标记为凭证", "", pzh, "输入凭证号码", function (val) {
        if (val == '') {
            var p = find_pzh(data.id, false);
            if (p) p.remove();
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, false);
        } else {
            find_pzh(data.id, true).find('.no').text(val);
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, true);
        }

    }, true /*允许为空*/);
}


//@comment (group=,caption=查找或创建凭证号标记对象,needRightControl=false)
function find_pzh(id, create_if_not_exists) {
    var d = $('#' + id);
    if (!d) {
        $.alert(id + "不存在");
        return null;
    }

    var ret = d.find('.pzh');
    if (ret.length == 0) {
        if (create_if_not_exists) //如果需要创建，则创建它
        {
            d.append(`<div class="pzh" ><div class="no"></div><div class="delete_pzh"><i class="fa fa-close" onclick="removePZH('${id}');  event.preventDefault(); event.stopPropagation();"> </i></div></div>`);
        }
        ret = d.find('.pzh');
    }
    return ret;

}

function removePZH(id) {
    var p = find_pzh(id, false);
    if (p) p.remove();
}

function cb_selectall_onClick() {
    var imgPool = book.sheet1.getBrick('imgPool');
    if (imgPool.getSelectedImageList().length == 0) {
        imgPool.selectAll();
    } else {
        imgPool.unSelectAll();
    }
}


function cb_path_onClick() {
    if (window.electron == null) {
        toastr.error("此功能仅能在客户端APP中执行");
        return;
    }

    var path = electron.showOpenDialogSync('');
    if (path == '') return;
    var hostName = electron.getHostName();
    setMonitePath(hostName, path);
 
    moniteStart(path);


}

function moniteStart(path)
{
    pathToMonit=path;
    book.sheet0.cells('stateBar').setValue("图片目录 " + pathToMonit);

     if (window.electron == null) {
        toastr.error("此功能仅能在客户端APP中执行");
        return;
    }

    book.sheet0.cells('stateBar').setValue("图片目录 " + pathToMonit+ " 监控中...");
    electron.ipcSendMessage( {cmd:"moniteStart" , path:path});
}

function cb_refresh_onClick()
{
    book.sheet0.cells("stateInfo2").setValue( "");    

     // 先保存当前选中状态及设置的凭证号信息
    saveSelectionAndPZInfo();

    var imgPool = book.sheet1.getBrick('imgPool');
    imgPool.reInit( restoreSelectionAndPZInfo); //重新初始化 ,并在初始化完成后， 恢复选中状态

   
     
    
}

function newImgCommingTipVisible(v)
{
    $('.shineText').css("display",v?"":"none");
}


id: 60a939f85db21e3d0fbaaf4f
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.23 09:06:06.000
script:
var pathToMonit = "";

function formOpen() {
    book.showTabOnWhere = "none";
    newImgCommingTipVisible(false);
    onPushMessage("newFileUploaded", function(msg){
    
        newImgCommingTipVisible(true);
    });

    book.sheet1.getBrick('imgPool').selectionMode = 'multi'; //图片设置成多选模式

    $(document.body).append(`<style>
                        .pzh {position:absolute;left:0;bottom:0px; 
                                height:24px; line-height:24px;width:100%; 
                                background-color:#40af40a0; 
                                color:white;font-weight:bold;font-size:16px;text-align:center;}

                        .delete_pzh { position:absolute; right:0; width:40px; height:14px; top:0; text-align:right; 
                                    vertical-align:top; font-size:12px; color:gray;padding-right:5px;}      
                        .delete_pzh:hover { color:white;}      
                          
                        </style>
                    `);


    //  let data= loadImagePoolData();
    //  console.dir(data);


    $('#blockSize').on('input', resetImgPoolBlockSize);

    setTimeout(function () {
        //调取缩略图大小
        var imgPool = book.sheet1.getBrick('imgPool');

        let blockSize = getImagePoolBlockSize();
        if (blockSize != imgPool.config.blockSize) {
            $('#blockSize').val(blockSize);
            resetImgPoolBlockSize(false);
        }
    }, 1000);


    //调取图片目录
    setTimeout( function(){
    if (window.electron != null) {
        var hostName = electron.getHostName();
        pathToMonit = getMonitePath(hostName);
        
        //开启监控
        if( pathToMonit!='') moniteStart(pathToMonit);
    }
    },500);
}

// 先保存当前选中状态及设置的凭证号信息

var g_selection;
var g_pzMap;
function  saveSelectionAndPZInfo( )
{
     
    var imgPool = book.sheet1.getBrick('imgPool');

    // 保存当前选中状态及设置的凭证号信息
    var selection = imgPool.getSelectedImageList();
    // 保存设置的凭证号信息
    var pzhMap = {};
    var pzhs = imgPool.dom.find('.pzh');
    for (let i = 0; i < pzhs.length; i++) {
        let id = $(pzhs[i]).parent().attr('id');
        let pzh = $(pzhs[i]).find('.no').text();
        pzhMap[id] = pzh;

    }
    g_selection=selection;
    g_pzMap=pzhMap;
}

function  restoreSelectionAndPZInfo()
{
     var selection= g_selection;
     var pzhMap= g_pzMap;
    var imgPool = book.sheet1.getBrick('imgPool');

     //恢复选中状态
    for (let i = 0; i < selection.length; i++) {
        imgPool.setImageSelected(selection[i].id, true);
    }
    //恢复凭证号
    for (let id in pzhMap) {
        var pzh = pzhMap[id];
        find_pzh(id, true).find('.no').text(pzh);
    }

}

function resetImgPoolBlockSize(needSaveSetting) {
    if (needSaveSetting == null) needSaveSetting = true;
    var imgPool = book.sheet1.getBrick('imgPool');


    // 先保存当前选中状态及设置的凭证号信息
    saveSelectionAndPZInfo();

    let v = $('#blockSize').val();

    imgPool.config.blockSize = parseInt(v);
    imgPool.rebuildGridly();
   
    //恢复选中状态
    restoreSelectionAndPZInfo();

    if (needSaveSetting) {
        setTimeout(function () {
            setImagePoolBlockSize(imgPool.getConfig("gguid"), v);
        }, 1000);
    }



}

/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet, name, data) {
    //console.dir(data);
    var url = data.url_img;
    book.sheet0.cells("imgPreview").setValue(url);
}
function imageOnMouseOut(sheet, name, data) {

    book.sheet0.cells("imgPreview").setValue("");
}


/**
 * 图片控件中某个图片被双击了
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片被双击)
function imageOnDBLClick(sheet, name, data) {

    //因为 mouseOut 会把大图清除掉，所以这里重新再设置上
    setTimeout(function () {
        var url = data.url_img;
        book.sheet0.cells("imgPreview").setValue(url);

    }, 200);

    var pzh = '';
    try {

        pzh = find_pzh(data.id, false).find('.no').text();
    } catch (err) {

    }

    if (pzh == undefined) pzh = '';

    inputBox("标记为凭证", "", pzh, "输入凭证号码", function (val) {
        if (val == '') {
            var p = find_pzh(data.id, false);
            if (p) p.remove();
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, false);
        } else {
            find_pzh(data.id, true).find('.no').text(val);
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, true);
        }

    }, true /*允许为空*/);
}


//@comment (group=,caption=查找或创建凭证号标记对象,needRightControl=false)
function find_pzh(id, create_if_not_exists) {
    var d = $('#' + id);
    if (!d) {
        $.alert(id + "不存在");
        return null;
    }

    var ret = d.find('.pzh');
    if (ret.length == 0) {
        if (create_if_not_exists) //如果需要创建，则创建它
        {
            d.append(`<div class="pzh" ><div class="no"></div><div class="delete_pzh"><i class="fa fa-close" onclick="removePZH('${id}');  event.preventDefault(); event.stopPropagation();"> </i></div></div>`);
        }
        ret = d.find('.pzh');
    }
    return ret;

}

function removePZH(id) {
    var p = find_pzh(id, false);
    if (p) p.remove();
}

function cb_selectall_onClick() {
    var imgPool = book.sheet1.getBrick('imgPool');
    if (imgPool.getSelectedImageList().length == 0) {
        imgPool.selectAll();
    } else {
        imgPool.unSelectAll();
    }
}


function cb_path_onClick() {
    if (window.electron == null) {
        toastr.error("此功能仅能在客户端APP中执行");
        return;
    }

    var path = electron.showOpenDialogSync('');
    if (path == '') return;
    var hostName = electron.getHostName();
    setMonitePath(hostName, path);
 
    moniteStart(path);


}

function moniteStart(path)
{
    pathToMonit=path;
    book.sheet0.cells('stateBar').setValue("图片目录 " + pathToMonit);

     if (window.electron == null) {
        toastr.error("此功能仅能在客户端APP中执行");
        return;
    }

    book.sheet0.cells('stateBar').setValue("图片目录 " + pathToMonit+ " 监控中...");
    electron.ipcSendMessage( {cmd:"moniteStart" , path:path});
}

function cb_refresh_onClick()
{
    newImgCommingTipVisible(false);

     // 先保存当前选中状态及设置的凭证号信息
    saveSelectionAndPZInfo();

    var imgPool = book.sheet1.getBrick('imgPool');
    imgPool.reInit( restoreSelectionAndPZInfo); //重新初始化 ,并在初始化完成后， 恢复选中状态

   
     
    
}

function newImgCommingTipVisible(v)
{
    $('.shineText').css("display",v?"":"none");
}


id: 60a939f85db21e3d0fbaaf55
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.23 09:10:02.000
script:
var pathToMonit = "";

function formOpen() {
    book.showTabOnWhere = "none";
    newImgCommingTipVisible(false);
    onPushMessage("newFileUploaded", function(msg){
    
        newImgCommingTipVisible(true);
    });

    book.sheet1.getBrick('imgPool').selectionMode = 'multi'; //图片设置成多选模式

    $(document.body).append(`<style>
                        .pzh {position:absolute;left:0;bottom:0px; 
                                height:24px; line-height:24px;width:100%; 
                                background-color:#40af40a0; 
                                color:white;font-weight:bold;font-size:16px;text-align:center;}

                        .delete_pzh { position:absolute; right:0; width:40px; height:14px; top:0; text-align:right; 
                                    vertical-align:top; font-size:12px; color:gray;padding-right:5px;}      
                        .delete_pzh:hover { color:white;}      
                          
                        </style>
                    `);


    //  let data= loadImagePoolData();
    //  console.dir(data);


    $('#blockSize').on('input', resetImgPoolBlockSize);

    setTimeout(function () {
        //调取缩略图大小
        var imgPool = book.sheet1.getBrick('imgPool');

        let blockSize = getImagePoolBlockSize();
        if (blockSize != imgPool.config.blockSize) {
            $('#blockSize').val(blockSize);
            resetImgPoolBlockSize(false);
        }
    }, 1000);


    //调取图片目录
    setTimeout( function(){
    if (window.electron != null) {
        var hostName = electron.getHostName();
        pathToMonit = getMonitePath(hostName);
        
        //开启监控
        if( pathToMonit!='') moniteStart(pathToMonit);
    }
    },500);
}

// 先保存当前选中状态及设置的凭证号信息

var g_selection;
var g_pzMap;
function  saveSelectionAndPZInfo( )
{
     
    var imgPool = book.sheet1.getBrick('imgPool');

    // 保存当前选中状态及设置的凭证号信息
    var selection = imgPool.getSelectedImageList();
    // 保存设置的凭证号信息
    var pzhMap = {};
    var pzhs = imgPool.dom.find('.pzh');
    for (let i = 0; i < pzhs.length; i++) {
        let id = $(pzhs[i]).parent().attr('id');
        let pzh = $(pzhs[i]).find('.no').text();
        pzhMap[id] = pzh;

    }
    g_selection=selection;
    g_pzMap=pzhMap;
}

function  restoreSelectionAndPZInfo()
{
     var selection= g_selection;
     var pzhMap= g_pzMap;
    var imgPool = book.sheet1.getBrick('imgPool');

     //恢复选中状态
    for (let i = 0; i < selection.length; i++) {
        imgPool.setImageSelected(selection[i].id, true);
    }
    //恢复凭证号
    for (let id in pzhMap) {
        var pzh = pzhMap[id];
        find_pzh(id, true).find('.no').text(pzh);
    }

}

function resetImgPoolBlockSize(needSaveSetting) {
    if (needSaveSetting == null) needSaveSetting = true;
    var imgPool = book.sheet1.getBrick('imgPool');


    // 先保存当前选中状态及设置的凭证号信息
    saveSelectionAndPZInfo();

    let v = $('#blockSize').val();

    imgPool.config.blockSize = parseInt(v);
    imgPool.rebuildGridly();
   
    //恢复选中状态
    restoreSelectionAndPZInfo();

    if (needSaveSetting) {
        setTimeout(function () {
            setImagePoolBlockSize(imgPool.getConfig("gguid"), v);
        }, 1000);
    }



}

/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet, name, data) {
    //console.dir(data);
    var url = data.url_img;
    book.sheet0.cells("imgPreview").setValue(url);
}
function imageOnMouseOut(sheet, name, data) {

    book.sheet0.cells("imgPreview").setValue("");
}


/**
 * 图片控件中某个图片被双击了
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片被双击)
function imageOnDBLClick(sheet, name, data) {

    //因为 mouseOut 会把大图清除掉，所以这里重新再设置上
    setTimeout(function () {
        var url = data.url_img;
        book.sheet0.cells("imgPreview").setValue(url);

    }, 200);

    var pzh = '';
    try {

        pzh = find_pzh(data.id, false).find('.no').text();
    } catch (err) {

    }

    if (pzh == undefined) pzh = '';

    inputBox("标记为凭证", "", pzh, "输入凭证号码", function (val) {
        if (val == '') {
            var p = find_pzh(data.id, false);
            if (p) p.remove();
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, false);
        } else {
            find_pzh(data.id, true).find('.no').text(val);
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, true);
        }

    }, true /*允许为空*/);
}


//@comment (group=,caption=查找或创建凭证号标记对象,needRightControl=false)
function find_pzh(id, create_if_not_exists) {
    var d = $('#' + id);
    if (!d) {
        $.alert(id + "不存在");
        return null;
    }

    var ret = d.find('.pzh');
    if (ret.length == 0) {
        if (create_if_not_exists) //如果需要创建，则创建它
        {
            d.append(`<div class="pzh" ><div class="no"></div><div class="delete_pzh"><i class="fa fa-close" onclick="removePZH('${id}');  event.preventDefault(); event.stopPropagation();"> </i></div></div>`);
        }
        ret = d.find('.pzh');
    }
    return ret;

}

function removePZH(id) {
    var p = find_pzh(id, false);
    if (p) p.remove();
}

function cb_selectall_onClick() {
    var imgPool = book.sheet1.getBrick('imgPool');
    if (imgPool.getSelectedImageList().length == 0) {
        imgPool.selectAll();
    } else {
        imgPool.unSelectAll();
    }
}


function cb_path_onClick() {
    if (window.electron == null) {
        toastr.error("此功能仅能在客户端APP中执行");
        return;
    }

    var path = electron.showOpenDialogSync('');
    if (path == '') return;
    var hostName = electron.getHostName();
    setMonitePath(hostName, path);
 
    moniteStart(path);


}

function moniteStart(path)
{
    pathToMonit=path;
    book.sheet0.cells('stateBar').setValue("图片目录 " + pathToMonit);

     if (window.electron == null) {
        toastr.error("此功能仅能在客户端APP中执行");
        return;
    }

    book.sheet0.cells('stateBar').setValue("图片目录 " + pathToMonit+ " 监控中...");
    electron.ipcSendMessage( {cmd:"moniteStart" , path:path});
}

function cb_refresh_onClick()
{
    newImgCommingTipVisible(false);

     // 先保存当前选中状态及设置的凭证号信息
    saveSelectionAndPZInfo();

    var imgPool = book.sheet1.getBrick('imgPool');
    imgPool.reInit( restoreSelectionAndPZInfo); //重新初始化 ,并在初始化完成后， 恢复选中状态

   
     
    
}

function newImgCommingTipVisible(v)
{
    book.sheet0.getBrick('shineText').visible=v;
 
}


id: 60a939f85db21e3d0fbaaf5d
scriptid: 60a321f05db27838e0c014bf
tablename: app_script
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.23 09:21:28.000
script:
//@comment (group=,caption=得到当前操作员待归档图片对应的GGUID,needRightControl=false)
function getImagePoolGGUID() {
    var ret = runTask("get_dzpz_imgpool_id_of_current_user", {});
    return JSON.parse(ret).gguid;

}

function getImagePoolBlockSize() {
    var ret = runTask("get_dzpz_imgpool_id_of_current_user", {});
    return JSON.parse(ret).blockSize;

}


//@comment (group=,caption=保存当前的缩略图大小,needRightControl=false)
function setImagePoolBlockSize(id, blockSize) {
    runSQL("", " update  dzpz_imgpool set blocksize=" + blockSize + " where gguid='" + id + "'  ");
}


//@comment (group=,caption=得到待归档的图片清单,needRightControl=true)
function loadImagePoolData() {
    var config = JSON.parse(runTask("get_dzpz_imgpool_id_of_current_user", {}));

    var ds = newDataStore(config.dbpool, "select * from " + config.logTable + "  where  gguid='" + config.gguid + "'  order by info1 "); // info1 是客户端文件创建的时间，以它排序
    var n = ds.retrieve();
    var ret = [];
    for (var i = 0; i < n; i++) {
        ret.push(JSON.parse(ds.getJSONRow(i, true)));
    }

    return ret;

}


//@comment (group=,caption=保存监控目录设置,needRightControl=false)
function setMonitePath(hostName, path) {
    var ds = newDataStore("", "select * from dzpz_client");
    ds.setUpdateProperty("dzpz_client","id","*","id");
    ds.retrieve(" hostname='" + hostName + "'");
    if (ds.getRowCount() == 0) {
        var newid = newGUID();
        ds.insertRow(0);
        ds.setValue(0, "id", newid);
        ds.setValue(0, "gguid", newid);
        ds.setValue(0, "billno", newid);
        ds.setValue(0, "userid", 1);
        ds.setValue(0, "username", '管理员');
        ds.setValue(0, "billtype", '');
        ds.setValue(0, "hostname", hostName);
    }
    ds.setValue(0, "path", path);
    ds.update(true);
    println( ds.getError().getMessage());

}


//@comment (group=,caption=获取指定机器的监控目录,needRightControl=false)
function  getMonitePath(hostName)
{
    return   getStringFromSQL("select path from dzpz_client where  hostname='" + hostName + "'");
}


id: 60a939f85db21e3d0fbaaf65
scriptid: 609deddb5db2696039463ca0
tablename: app_script
clientip: 0:0:0:0:0:0:0:1
username: sa
createdate: 2021.05.23 09:22:30.000
script:
//客户端在上传好文件后，把文件删除，并调用本任务记录下日志， 同时通知客户端，有新文件了，注意刷新
function main(arg) {

    var p = JSON.parse(arg);
    println("user:" + currentUserShowName() + " file: " + p.file + "  result:" + p.result);
    pushMessage("newFileUploaded", { file: p.file }, currentUserId());  //向当前用户推送消息 

}


id: 60a9e42d5db2172e3066fbdd
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 192.168.3.2
username: sa
createdate: 2021.05.23 15:45:55.000
script:
var pathToMonit = "";
var electron=null; 

function formOpen() {
    book.showTabOnWhere = "none";
    newImgCommingTipVisible(false);
    onPushMessage("newFileUploaded", function(msg){
    
        newImgCommingTipVisible(true);
    });

    electron= getElectron();

    book.sheet1.getBrick('imgPool').selectionMode = 'multi'; //图片设置成多选模式

    $(document.body).append(`<style>
                        .pzh {position:absolute;left:0;bottom:0px; 
                                height:24px; line-height:24px;width:100%; 
                                background-color:#40af40a0; 
                                color:white;font-weight:bold;font-size:16px;text-align:center;}

                        .delete_pzh { position:absolute; right:0; width:40px; height:14px; top:0; text-align:right; 
                                    vertical-align:top; font-size:12px; color:gray;padding-right:5px;}      
                        .delete_pzh:hover { color:white;}      
                          
                        </style>
                    `);


    //  let data= loadImagePoolData();
    //  console.dir(data);


    $('#blockSize').on('input', resetImgPoolBlockSize);

    setTimeout(function () {
        //调取缩略图大小
        var imgPool = book.sheet1.getBrick('imgPool');

        let blockSize = getImagePoolBlockSize();
        if (blockSize != imgPool.config.blockSize) {
            $('#blockSize').val(blockSize);
            resetImgPoolBlockSize(false);
        }
    }, 1000);


    //调取图片目录
    setTimeout( function(){
    if (electron != null) {
        var hostName = electron.getHostName();
        pathToMonit = getMonitePath(hostName);
        
        //开启监控
        if( pathToMonit!='') moniteStart(pathToMonit);
    }
    },500);
}

// 先保存当前选中状态及设置的凭证号信息

var g_selection;
var g_pzMap;
function  saveSelectionAndPZInfo( )
{
     
    var imgPool = book.sheet1.getBrick('imgPool');

    // 保存当前选中状态及设置的凭证号信息
    var selection = imgPool.getSelectedImageList();
    // 保存设置的凭证号信息
    var pzhMap = {};
    var pzhs = imgPool.dom.find('.pzh');
    for (let i = 0; i < pzhs.length; i++) {
        let id = $(pzhs[i]).parent().attr('id');
        let pzh = $(pzhs[i]).find('.no').text();
        pzhMap[id] = pzh;

    }
    g_selection=selection;
    g_pzMap=pzhMap;
}

function  restoreSelectionAndPZInfo()
{
     var selection= g_selection;
     var pzhMap= g_pzMap;
    var imgPool = book.sheet1.getBrick('imgPool');

     //恢复选中状态
    for (let i = 0; i < selection.length; i++) {
        imgPool.setImageSelected(selection[i].id, true);
    }
    //恢复凭证号
    for (let id in pzhMap) {
        var pzh = pzhMap[id];
        find_pzh(id, true).find('.no').text(pzh);
    }

}

function resetImgPoolBlockSize(needSaveSetting) {
    if (needSaveSetting == null) needSaveSetting = true;
    var imgPool = book.sheet1.getBrick('imgPool');


    // 先保存当前选中状态及设置的凭证号信息
    saveSelectionAndPZInfo();

    let v = $('#blockSize').val();

    imgPool.config.blockSize = parseInt(v);
    imgPool.rebuildGridly();
   
    //恢复选中状态
    restoreSelectionAndPZInfo();

    if (needSaveSetting) {
        setTimeout(function () {
            setImagePoolBlockSize(imgPool.getConfig("gguid"), v);
        }, 1000);
    }



}

/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet, name, data) {
    //console.dir(data);
    var url = data.url_img;
    book.sheet0.cells("imgPreview").setValue(url);
}
function imageOnMouseOut(sheet, name, data) {

    book.sheet0.cells("imgPreview").setValue("");
}


/**
 * 图片控件中某个图片被双击了
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片被双击)
function imageOnDBLClick(sheet, name, data) {

    //因为 mouseOut 会把大图清除掉，所以这里重新再设置上
    setTimeout(function () {
        var url = data.url_img;
        book.sheet0.cells("imgPreview").setValue(url);

    }, 200);

    var pzh = '';
    try {

        pzh = find_pzh(data.id, false).find('.no').text();
    } catch (err) {

    }

    if (pzh == undefined) pzh = '';

    inputBox("标记为凭证", "", pzh, "输入凭证号码", function (val) {
        if (val == '') {
            var p = find_pzh(data.id, false);
            if (p) p.remove();
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, false);
        } else {
            find_pzh(data.id, true).find('.no').text(val);
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, true);
        }

    }, true /*允许为空*/);
}


//@comment (group=,caption=查找或创建凭证号标记对象,needRightControl=false)
function find_pzh(id, create_if_not_exists) {
    var d = $('#' + id);
    if (!d) {
        $.alert(id + "不存在");
        return null;
    }

    var ret = d.find('.pzh');
    if (ret.length == 0) {
        if (create_if_not_exists) //如果需要创建，则创建它
        {
            d.append(`<div class="pzh" ><div class="no"></div><div class="delete_pzh"><i class="fa fa-close" onclick="removePZH('${id}');  event.preventDefault(); event.stopPropagation();"> </i></div></div>`);
        }
        ret = d.find('.pzh');
    }
    return ret;

}

function removePZH(id) {
    var p = find_pzh(id, false);
    if (p) p.remove();
}

function cb_selectall_onClick() {
    var imgPool = book.sheet1.getBrick('imgPool');
    if (imgPool.getSelectedImageList().length == 0) {
        imgPool.selectAll();
    } else {
        imgPool.unSelectAll();
    }
}


function cb_path_onClick() {
    if (electron == null) {
        toastr.error("此功能仅能在客户端APP中执行");
        return;
    }

    var path = electron.showOpenDialogSync('');
    if (path == '') return;
    var hostName = electron.getHostName();
    setMonitePath(hostName, path);
 
    moniteStart(path);


}

function moniteStart(path)
{
    pathToMonit=path;
    book.sheet0.cells('stateBar').setValue("图片目录 " + pathToMonit);

     if (electron == null) {
        toastr.error("此功能仅能在客户端APP中执行");
        return;
    }

    book.sheet0.cells('stateBar').setValue("图片目录 " + pathToMonit+ " 监控中...");
    electron.ipcSendMessage( {cmd:"moniteStart" , path:path});
}

function cb_refresh_onClick()
{
    newImgCommingTipVisible(false);

     // 先保存当前选中状态及设置的凭证号信息
    saveSelectionAndPZInfo();

    var imgPool = book.sheet1.getBrick('imgPool');
    imgPool.reInit( restoreSelectionAndPZInfo); //重新初始化 ,并在初始化完成后， 恢复选中状态

   
     
    
}

function newImgCommingTipVisible(v)
{
    book.sheet0.getBrick('shineText').visible=v;
 
}


id: 60a9e42d5db2172e3066fbe3
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 192.168.3.2
username: sa
createdate: 2021.05.23 15:48:34.000
script:
var pathToMonit = "";
//var electron=null; 

function formOpen() {
    book.showTabOnWhere = "none";
    newImgCommingTipVisible(false);
    onPushMessage("newFileUploaded", function(msg){
    
        newImgCommingTipVisible(true);
    });

    //electron= getElectron();

    book.sheet1.getBrick('imgPool').selectionMode = 'multi'; //图片设置成多选模式

    $(document.body).append(`<style>
                        .pzh {position:absolute;left:0;bottom:0px; 
                                height:24px; line-height:24px;width:100%; 
                                background-color:#40af40a0; 
                                color:white;font-weight:bold;font-size:16px;text-align:center;}

                        .delete_pzh { position:absolute; right:0; width:40px; height:14px; top:0; text-align:right; 
                                    vertical-align:top; font-size:12px; color:gray;padding-right:5px;}      
                        .delete_pzh:hover { color:white;}      
                          
                        </style>
                    `);


    //  let data= loadImagePoolData();
    //  console.dir(data);


    $('#blockSize').on('input', resetImgPoolBlockSize);

    setTimeout(function () {
        //调取缩略图大小
        var imgPool = book.sheet1.getBrick('imgPool');

        let blockSize = getImagePoolBlockSize();
        if (blockSize != imgPool.config.blockSize) {
            $('#blockSize').val(blockSize);
            resetImgPoolBlockSize(false);
        }
    }, 1000);


    //调取图片目录
    setTimeout( function(){
    if (electron != null) {
        var hostName = electron.getHostName();
        pathToMonit = getMonitePath(hostName);
        
        //开启监控
        if( pathToMonit!='') moniteStart(pathToMonit);
    }
    },500);
}

// 先保存当前选中状态及设置的凭证号信息

var g_selection;
var g_pzMap;
function  saveSelectionAndPZInfo( )
{
     
    var imgPool = book.sheet1.getBrick('imgPool');

    // 保存当前选中状态及设置的凭证号信息
    var selection = imgPool.getSelectedImageList();
    // 保存设置的凭证号信息
    var pzhMap = {};
    var pzhs = imgPool.dom.find('.pzh');
    for (let i = 0; i < pzhs.length; i++) {
        let id = $(pzhs[i]).parent().attr('id');
        let pzh = $(pzhs[i]).find('.no').text();
        pzhMap[id] = pzh;

    }
    g_selection=selection;
    g_pzMap=pzhMap;
}

function  restoreSelectionAndPZInfo()
{
     var selection= g_selection;
     var pzhMap= g_pzMap;
    var imgPool = book.sheet1.getBrick('imgPool');

     //恢复选中状态
    for (let i = 0; i < selection.length; i++) {
        imgPool.setImageSelected(selection[i].id, true);
    }
    //恢复凭证号
    for (let id in pzhMap) {
        var pzh = pzhMap[id];
        find_pzh(id, true).find('.no').text(pzh);
    }

}

function resetImgPoolBlockSize(needSaveSetting) {
    if (needSaveSetting == null) needSaveSetting = true;
    var imgPool = book.sheet1.getBrick('imgPool');


    // 先保存当前选中状态及设置的凭证号信息
    saveSelectionAndPZInfo();

    let v = $('#blockSize').val();

    imgPool.config.blockSize = parseInt(v);
    imgPool.rebuildGridly();
   
    //恢复选中状态
    restoreSelectionAndPZInfo();

    if (needSaveSetting) {
        setTimeout(function () {
            setImagePoolBlockSize(imgPool.getConfig("gguid"), v);
        }, 1000);
    }



}

/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet, name, data) {
    //console.dir(data);
    var url = data.url_img;
    book.sheet0.cells("imgPreview").setValue(url);
}
function imageOnMouseOut(sheet, name, data) {

    book.sheet0.cells("imgPreview").setValue("");
}


/**
 * 图片控件中某个图片被双击了
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片被双击)
function imageOnDBLClick(sheet, name, data) {

    //因为 mouseOut 会把大图清除掉，所以这里重新再设置上
    setTimeout(function () {
        var url = data.url_img;
        book.sheet0.cells("imgPreview").setValue(url);

    }, 200);

    var pzh = '';
    try {

        pzh = find_pzh(data.id, false).find('.no').text();
    } catch (err) {

    }

    if (pzh == undefined) pzh = '';

    inputBox("标记为凭证", "", pzh, "输入凭证号码", function (val) {
        if (val == '') {
            var p = find_pzh(data.id, false);
            if (p) p.remove();
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, false);
        } else {
            find_pzh(data.id, true).find('.no').text(val);
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, true);
        }

    }, true /*允许为空*/);
}


//@comment (group=,caption=查找或创建凭证号标记对象,needRightControl=false)
function find_pzh(id, create_if_not_exists) {
    var d = $('#' + id);
    if (!d) {
        $.alert(id + "不存在");
        return null;
    }

    var ret = d.find('.pzh');
    if (ret.length == 0) {
        if (create_if_not_exists) //如果需要创建，则创建它
        {
            d.append(`<div class="pzh" ><div class="no"></div><div class="delete_pzh"><i class="fa fa-close" onclick="removePZH('${id}');  event.preventDefault(); event.stopPropagation();"> </i></div></div>`);
        }
        ret = d.find('.pzh');
    }
    return ret;

}

function removePZH(id) {
    var p = find_pzh(id, false);
    if (p) p.remove();
}

function cb_selectall_onClick() {
    var imgPool = book.sheet1.getBrick('imgPool');
    if (imgPool.getSelectedImageList().length == 0) {
        imgPool.selectAll();
    } else {
        imgPool.unSelectAll();
    }
}


function cb_path_onClick() {
    if (electron == null) {
        toastr.error("此功能仅能在客户端APP中执行");
        return;
    }

    var path = electron.showOpenDialogSync('');
    if (path == '') return;
    var hostName = electron.getHostName();
    setMonitePath(hostName, path);
 
    moniteStart(path);


}

function moniteStart(path)
{
    pathToMonit=path;
    book.sheet0.cells('stateBar').setValue("图片目录 " + pathToMonit);

     if (electron == null) {
        toastr.error("此功能仅能在客户端APP中执行");
        return;
    }

    book.sheet0.cells('stateBar').setValue("图片目录 " + pathToMonit+ " 监控中...");
    electron.ipcSendMessage( {cmd:"moniteStart" , path:path});
}

function cb_refresh_onClick()
{
    newImgCommingTipVisible(false);

     // 先保存当前选中状态及设置的凭证号信息
    saveSelectionAndPZInfo();

    var imgPool = book.sheet1.getBrick('imgPool');
    imgPool.reInit( restoreSelectionAndPZInfo); //重新初始化 ,并在初始化完成后， 恢复选中状态

   
     
    
}

function newImgCommingTipVisible(v)
{
    book.sheet0.getBrick('shineText').visible=v;
 
}


id: 60aa79be5db2172e3066fc7c
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 192.168.3.2
username: sa
createdate: 2021.05.23 23:52:04.000
script:
var pathToMonit = "";
var electron=null; 

function formOpen() {
    book.showTabOnWhere = "none";
    newImgCommingTipVisible(false);
    onPushMessage("electronPushMessage" , function(msg){

        msg= JSON.parse(msg);
        if( msg.cmd=="newFileUploaded")   newImgCommingTipVisible(true);
        if( msg.cmd=="notifyNeedUploadFileCount")  notifyNeedUploadFileCount( msg.fileCount);
    });

    electron= getElectron();

    book.sheet1.getBrick('imgPool').selectionMode = 'multi'; //图片设置成多选模式

    $(document.body).append(`<style>
                        .pzh {position:absolute;left:0;bottom:0px; 
                                height:24px; line-height:24px;width:100%; 
                                background-color:#40af40a0; 
                                color:white;font-weight:bold;font-size:16px;text-align:center;}

                        .delete_pzh { position:absolute; right:0; width:40px; height:14px; top:0; text-align:right; 
                                    vertical-align:top; font-size:12px; color:gray;padding-right:5px;}      
                        .delete_pzh:hover { color:white;}      
                          
                        </style>
                    `);


    //  let data= loadImagePoolData();
    //  console.dir(data);


    $('#blockSize').on('input', resetImgPoolBlockSize);

    setTimeout(function () {
        //调取缩略图大小
        var imgPool = book.sheet1.getBrick('imgPool');

        let blockSize = getImagePoolBlockSize();
        if (blockSize != imgPool.config.blockSize) {
            $('#blockSize').val(blockSize);
            resetImgPoolBlockSize(false);
        }
    }, 1000);


    //调取图片目录
    setTimeout( function(){
    if (electron != null) {
        var hostName = electron.getHostName();
        pathToMonit = getMonitePath(hostName);
        
        //开启监控
        if( pathToMonit!='') moniteStart(pathToMonit);
    }
    },500);
}

// 先保存当前选中状态及设置的凭证号信息

var g_selection;
var g_pzMap;
function  saveSelectionAndPZInfo( )
{
     
    var imgPool = book.sheet1.getBrick('imgPool');

    // 保存当前选中状态及设置的凭证号信息
    var selection = imgPool.getSelectedImageList();
    // 保存设置的凭证号信息
    var pzhMap = {};
    var pzhs = imgPool.dom.find('.pzh');
    for (let i = 0; i < pzhs.length; i++) {
        let id = $(pzhs[i]).parent().attr('id');
        let pzh = $(pzhs[i]).find('.no').text();
        pzhMap[id] = pzh;

    }
    g_selection=selection;
    g_pzMap=pzhMap;
}

function  restoreSelectionAndPZInfo()
{
     var selection= g_selection;
     var pzhMap= g_pzMap;
    var imgPool = book.sheet1.getBrick('imgPool');

     //恢复选中状态
    for (let i = 0; i < selection.length; i++) {
        imgPool.setImageSelected(selection[i].id, true);
    }
    //恢复凭证号
    for (let id in pzhMap) {
        var pzh = pzhMap[id];
        find_pzh(id, true).find('.no').text(pzh);
    }

}

function resetImgPoolBlockSize(needSaveSetting) {
    if (needSaveSetting == null) needSaveSetting = true;
    var imgPool = book.sheet1.getBrick('imgPool');


    // 先保存当前选中状态及设置的凭证号信息
    saveSelectionAndPZInfo();

    let v = $('#blockSize').val();

    imgPool.config.blockSize = parseInt(v);
    imgPool.rebuildGridly();
   
    //恢复选中状态
    restoreSelectionAndPZInfo();

    if (needSaveSetting) {
        setTimeout(function () {
            setImagePoolBlockSize(imgPool.getConfig("gguid"), v);
        }, 1000);
    }



}

/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet, name, data) {
    //console.dir(data);
    var url = data.url_img;
    book.sheet0.cells("imgPreview").setValue(url);
}
function imageOnMouseOut(sheet, name, data) {

    book.sheet0.cells("imgPreview").setValue("");
}


/**
 * 图片控件中某个图片被双击了
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片被双击)
function imageOnDBLClick(sheet, name, data) {

    //因为 mouseOut 会把大图清除掉，所以这里重新再设置上
    setTimeout(function () {
        var url = data.url_img;
        book.sheet0.cells("imgPreview").setValue(url);

    }, 200);

    var pzh = '';
    try {

        pzh = find_pzh(data.id, false).find('.no').text();
    } catch (err) {

    }

    if (pzh == undefined) pzh = '';

    inputBox("标记为凭证", "", pzh, "输入凭证号码", function (val) {
        if (val == '') {
            var p = find_pzh(data.id, false);
            if (p) p.remove();
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, false);
        } else {
            find_pzh(data.id, true).find('.no').text(val);
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, true);
        }

    }, true /*允许为空*/);
}


//@comment (group=,caption=查找或创建凭证号标记对象,needRightControl=false)
function find_pzh(id, create_if_not_exists) {
    var d = $('#' + id);
    if (!d) {
        $.alert(id + "不存在");
        return null;
    }

    var ret = d.find('.pzh');
    if (ret.length == 0) {
        if (create_if_not_exists) //如果需要创建，则创建它
        {
            d.append(`<div class="pzh" ><div class="no"></div><div class="delete_pzh"><i class="fa fa-close" onclick="removePZH('${id}');  event.preventDefault(); event.stopPropagation();"> </i></div></div>`);
        }
        ret = d.find('.pzh');
    }
    return ret;

}

function removePZH(id) {
    var p = find_pzh(id, false);
    if (p) p.remove();
}

function cb_selectall_onClick() {
    var imgPool = book.sheet1.getBrick('imgPool');
    if (imgPool.getSelectedImageList().length == 0) {
        imgPool.selectAll();
    } else {
        imgPool.unSelectAll();
    }
}


function cb_path_onClick() {
    if (electron == null) {
        toastr.error("此功能仅能在客户端APP中执行");
        return;
    }

    var path = electron.showOpenDialogSync('');
    if (path == '') return;
    var hostName = electron.getHostName();
    setMonitePath(hostName, path);
 
    moniteStart(path);


}

function moniteStart(path)
{
    pathToMonit=path;
    book.sheet0.cells('stateBar').setValue("图片目录 " + pathToMonit);

     if (electron == null) {
        toastr.error("此功能仅能在客户端APP中执行");
        return;
    }

    book.sheet0.cells('stateBar').setValue("图片目录 " + pathToMonit+ " 监控中...");
    electron.ipcSendMessage( {cmd:"moniteStart" , path:path});
}

function cb_refresh_onClick()
{
    newImgCommingTipVisible(false);

     // 先保存当前选中状态及设置的凭证号信息
    saveSelectionAndPZInfo();

    var imgPool = book.sheet1.getBrick('imgPool');
    imgPool.reInit( restoreSelectionAndPZInfo); //重新初始化 ,并在初始化完成后， 恢复选中状态

   
     
    
}

function newImgCommingTipVisible(v)
{
    book.sheet0.getBrick('shineText').visible=v;
 
}


id: 60aa79be5db2172e3066fc82
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 192.168.3.2
username: sa
createdate: 2021.05.23 23:53:52.000
script:
var pathToMonit = "";
var electron=null; 

function formOpen() {
    book.showTabOnWhere = "none";
    newImgCommingTipVisible(false);
    onPushMessage("electronPushMessage" , function(msg){

        msg= JSON.parse(msg);
        if( msg.cmd=="newFileUploaded")   newImgCommingTipVisible(true);
        if( msg.cmd=="notifyNeedUploadFileCount")  notifyNeedUploadFileCount( msg.fileCount);
    });

    electron= getElectron();

    book.sheet1.getBrick('imgPool').selectionMode = 'multi'; //图片设置成多选模式

    $(document.body).append(`<style>
                        .pzh {position:absolute;left:0;bottom:0px; 
                                height:24px; line-height:24px;width:100%; 
                                background-color:#40af40a0; 
                                color:white;font-weight:bold;font-size:16px;text-align:center;}

                        .delete_pzh { position:absolute; right:0; width:40px; height:14px; top:0; text-align:right; 
                                    vertical-align:top; font-size:12px; color:gray;padding-right:5px;}      
                        .delete_pzh:hover { color:white;}      
                          
                        </style>
                    `);


    //  let data= loadImagePoolData();
    //  console.dir(data);


    $('#blockSize').on('input', resetImgPoolBlockSize);

    setTimeout(function () {
        //调取缩略图大小
        var imgPool = book.sheet1.getBrick('imgPool');

        let blockSize = getImagePoolBlockSize();
        if (blockSize != imgPool.config.blockSize) {
            $('#blockSize').val(blockSize);
            resetImgPoolBlockSize(false);
        }
    }, 1000);


    //调取图片目录
    setTimeout( function(){
    if (electron != null) {
        var hostName = electron.getHostName();
        pathToMonit = getMonitePath(hostName);
        
        //开启监控
        if( pathToMonit!='') moniteStart(pathToMonit);
    }
    },500);
}

// 先保存当前选中状态及设置的凭证号信息

var g_selection;
var g_pzMap;
function  saveSelectionAndPZInfo( )
{
     
    var imgPool = book.sheet1.getBrick('imgPool');

    // 保存当前选中状态及设置的凭证号信息
    var selection = imgPool.getSelectedImageList();
    // 保存设置的凭证号信息
    var pzhMap = {};
    var pzhs = imgPool.dom.find('.pzh');
    for (let i = 0; i < pzhs.length; i++) {
        let id = $(pzhs[i]).parent().attr('id');
        let pzh = $(pzhs[i]).find('.no').text();
        pzhMap[id] = pzh;

    }
    g_selection=selection;
    g_pzMap=pzhMap;
}

function  restoreSelectionAndPZInfo()
{
     var selection= g_selection;
     var pzhMap= g_pzMap;
    var imgPool = book.sheet1.getBrick('imgPool');

     //恢复选中状态
    for (let i = 0; i < selection.length; i++) {
        imgPool.setImageSelected(selection[i].id, true);
    }
    //恢复凭证号
    for (let id in pzhMap) {
        var pzh = pzhMap[id];
        find_pzh(id, true).find('.no').text(pzh);
    }

}

function resetImgPoolBlockSize(needSaveSetting) {
    if (needSaveSetting == null) needSaveSetting = true;
    var imgPool = book.sheet1.getBrick('imgPool');


    // 先保存当前选中状态及设置的凭证号信息
    saveSelectionAndPZInfo();

    let v = $('#blockSize').val();

    imgPool.config.blockSize = parseInt(v);
    imgPool.rebuildGridly();
   
    //恢复选中状态
    restoreSelectionAndPZInfo();

    if (needSaveSetting) {
        setTimeout(function () {
            setImagePoolBlockSize(imgPool.getConfig("gguid"), v);
        }, 1000);
    }



}

/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet, name, data) {
    //console.dir(data);
    var url = data.url_img;
    book.sheet0.cells("imgPreview").setValue(url);
}
function imageOnMouseOut(sheet, name, data) {

    book.sheet0.cells("imgPreview").setValue("");
}


/**
 * 图片控件中某个图片被双击了
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片被双击)
function imageOnDBLClick(sheet, name, data) {

    //因为 mouseOut 会把大图清除掉，所以这里重新再设置上
    setTimeout(function () {
        var url = data.url_img;
        book.sheet0.cells("imgPreview").setValue(url);

    }, 200);

    var pzh = '';
    try {

        pzh = find_pzh(data.id, false).find('.no').text();
    } catch (err) {

    }

    if (pzh == undefined) pzh = '';

    inputBox("标记为凭证", "", pzh, "输入凭证号码", function (val) {
        if (val == '') {
            var p = find_pzh(data.id, false);
            if (p) p.remove();
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, false);
        } else {
            find_pzh(data.id, true).find('.no').text(val);
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, true);
        }

    }, true /*允许为空*/);
}


//@comment (group=,caption=查找或创建凭证号标记对象,needRightControl=false)
function find_pzh(id, create_if_not_exists) {
    var d = $('#' + id);
    if (!d) {
        $.alert(id + "不存在");
        return null;
    }

    var ret = d.find('.pzh');
    if (ret.length == 0) {
        if (create_if_not_exists) //如果需要创建，则创建它
        {
            d.append(`<div class="pzh" ><div class="no"></div><div class="delete_pzh"><i class="fa fa-close" onclick="removePZH('${id}');  event.preventDefault(); event.stopPropagation();"> </i></div></div>`);
        }
        ret = d.find('.pzh');
    }
    return ret;

}

function removePZH(id) {
    var p = find_pzh(id, false);
    if (p) p.remove();
}

function cb_selectall_onClick() {
    var imgPool = book.sheet1.getBrick('imgPool');
    if (imgPool.getSelectedImageList().length == 0) {
        imgPool.selectAll();
    } else {
        imgPool.unSelectAll();
    }
}


function cb_path_onClick() {
    if (electron == null) {
        toastr.error("此功能仅能在客户端APP中执行");
        return;
    }

    var path = electron.showOpenDialogSync('');
    if (path == '') return;
    var hostName = electron.getHostName();
    setMonitePath(hostName, path);
 
    moniteStart(path);


}

function moniteStart(path)
{
    pathToMonit=path;
    book.sheet0.cells('stateBar').setValue("图片目录 " + pathToMonit);

     if (electron == null) {
        toastr.error("此功能仅能在客户端APP中执行");
        return;
    }

    book.sheet0.cells('stateBar').setValue("图片目录 " + pathToMonit+ " 监控中...");
    electron.ipcSendMessage( {cmd:"moniteStart" , path:path});
}

function cb_refresh_onClick()
{
    newImgCommingTipVisible(false);

     // 先保存当前选中状态及设置的凭证号信息
    saveSelectionAndPZInfo();

    var imgPool = book.sheet1.getBrick('imgPool');
    imgPool.reInit( restoreSelectionAndPZInfo); //重新初始化 ,并在初始化完成后， 恢复选中状态

   
     
    
}

function newImgCommingTipVisible(v)
{
    book.sheet0.getBrick('shineText').visible=v;
 
}

function notifyNeedUploadFileCount( fc)
{
    var info=  fc==0?"":"个文件正准备上传";
    book.sheet0.cells("stateInfo2").setValue(info);
}


id: 60aa79be5db2172e3066fc88
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 192.168.3.2
username: sa
createdate: 2021.05.24 00:00:52.000
script:
var pathToMonit = "";
var electron=null; 

var timeHandle=0; 

function formOpen() {
    book.showTabOnWhere = "none";
    newImgCommingTipVisible(false);

    //收到来自服务器推送的消息
    onPushMessage("electronPushMessage" , function(msg){
        msg= JSON.parse(msg);
        if( msg.cmd=="newFileUploaded")   newImgCommingTipVisible(true); //通知有新文件上传了
        if( msg.cmd=="notifyNeedUploadFileCount")  notifyNeedUploadFileCount( msg.fileCount); //通知还有多少个文件等待上传
    });

    electron= getElectron();

    book.sheet1.getBrick('imgPool').selectionMode = 'multi'; //图片设置成多选模式

    $(document.body).append(`<style>
                        .pzh {position:absolute;left:0;bottom:0px; 
                                height:24px; line-height:24px;width:100%; 
                                background-color:#40af40a0; 
                                color:white;font-weight:bold;font-size:16px;text-align:center;}

                        .delete_pzh { position:absolute; right:0; width:40px; height:14px; top:0; text-align:right; 
                                    vertical-align:top; font-size:12px; color:gray;padding-right:5px;}      
                        .delete_pzh:hover { color:white;}      
                          
                        </style>
                    `);


    //  let data= loadImagePoolData();
    //  console.dir(data);


    $('#blockSize').on('input', resetImgPoolBlockSize);

    setTimeout(function () {
        //调取缩略图大小
        var imgPool = book.sheet1.getBrick('imgPool');

        let blockSize = getImagePoolBlockSize();
        if (blockSize != imgPool.config.blockSize) {
            $('#blockSize').val(blockSize);
            resetImgPoolBlockSize(false);
        }
    }, 1000);


    //调取图片目录
    setTimeout( function(){
    if (electron != null) {
        var hostName = electron.getHostName();
        pathToMonit = getMonitePath(hostName);
        
        //开启监控
        if( pathToMonit!='') moniteStart(pathToMonit);
    }
    },500);
}

// 先保存当前选中状态及设置的凭证号信息

var g_selection;
var g_pzMap;
function  saveSelectionAndPZInfo( )
{
     
    var imgPool = book.sheet1.getBrick('imgPool');

    // 保存当前选中状态及设置的凭证号信息
    var selection = imgPool.getSelectedImageList();
    // 保存设置的凭证号信息
    var pzhMap = {};
    var pzhs = imgPool.dom.find('.pzh');
    for (let i = 0; i < pzhs.length; i++) {
        let id = $(pzhs[i]).parent().attr('id');
        let pzh = $(pzhs[i]).find('.no').text();
        pzhMap[id] = pzh;

    }
    g_selection=selection;
    g_pzMap=pzhMap;
}

function  restoreSelectionAndPZInfo()
{
     var selection= g_selection;
     var pzhMap= g_pzMap;
    var imgPool = book.sheet1.getBrick('imgPool');

     //恢复选中状态
    for (let i = 0; i < selection.length; i++) {
        imgPool.setImageSelected(selection[i].id, true);
    }
    //恢复凭证号
    for (let id in pzhMap) {
        var pzh = pzhMap[id];
        find_pzh(id, true).find('.no').text(pzh);
    }

}

function resetImgPoolBlockSize(needSaveSetting) {
    if (needSaveSetting == null) needSaveSetting = true;
    var imgPool = book.sheet1.getBrick('imgPool');


    // 先保存当前选中状态及设置的凭证号信息
    saveSelectionAndPZInfo();

    let v = $('#blockSize').val();

    imgPool.config.blockSize = parseInt(v);
    imgPool.rebuildGridly();
   
    //恢复选中状态
    restoreSelectionAndPZInfo();

    if (needSaveSetting) {
        setTimeout(function () {
            setImagePoolBlockSize(imgPool.getConfig("gguid"), v);
        }, 1000);
    }



}

/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet, name, data) {
    //console.dir(data);
    var url = data.url_img;
    book.sheet0.cells("imgPreview").setValue(url);
}
function imageOnMouseOut(sheet, name, data) {

    book.sheet0.cells("imgPreview").setValue("");
}


/**
 * 图片控件中某个图片被双击了
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片被双击)
function imageOnDBLClick(sheet, name, data) {

    //因为 mouseOut 会把大图清除掉，所以这里重新再设置上
    setTimeout(function () {
        var url = data.url_img;
        book.sheet0.cells("imgPreview").setValue(url);

    }, 200);

    var pzh = '';
    try {

        pzh = find_pzh(data.id, false).find('.no').text();
    } catch (err) {

    }

    if (pzh == undefined) pzh = '';

    inputBox("标记为凭证", "", pzh, "输入凭证号码", function (val) {
        if (val == '') {
            var p = find_pzh(data.id, false);
            if (p) p.remove();
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, false);
        } else {
            find_pzh(data.id, true).find('.no').text(val);
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, true);
        }

    }, true /*允许为空*/);
}


//@comment (group=,caption=查找或创建凭证号标记对象,needRightControl=false)
function find_pzh(id, create_if_not_exists) {
    var d = $('#' + id);
    if (!d) {
        $.alert(id + "不存在");
        return null;
    }

    var ret = d.find('.pzh');
    if (ret.length == 0) {
        if (create_if_not_exists) //如果需要创建，则创建它
        {
            d.append(`<div class="pzh" ><div class="no"></div><div class="delete_pzh"><i class="fa fa-close" onclick="removePZH('${id}');  event.preventDefault(); event.stopPropagation();"> </i></div></div>`);
        }
        ret = d.find('.pzh');
    }
    return ret;

}

function removePZH(id) {
    var p = find_pzh(id, false);
    if (p) p.remove();
}

function cb_selectall_onClick() {
    var imgPool = book.sheet1.getBrick('imgPool');
    if (imgPool.getSelectedImageList().length == 0) {
        imgPool.selectAll();
    } else {
        imgPool.unSelectAll();
    }
}


function cb_path_onClick() {
    if (electron == null) {
        toastr.error("此功能仅能在客户端APP中执行");
        return;
    }

    var path = electron.showOpenDialogSync('');
    if (path == '') return;
    var hostName = electron.getHostName();
    setMonitePath(hostName, path);
 
    moniteStart(path);


}

function moniteStart(path)
{
    pathToMonit=path;
    book.sheet0.cells('stateBar').setValue("图片目录 " + pathToMonit);

     if (electron == null) {
        toastr.error("此功能仅能在客户端APP中执行");
        return;
    }

    book.sheet0.cells('stateBar').setValue("图片目录 " + pathToMonit+ " 监控中...");
    electron.ipcSendMessage( {cmd:"moniteStart" , path:path});
}

function cb_refresh_onClick()
{
    newImgCommingTipVisible(false);

     // 先保存当前选中状态及设置的凭证号信息
    saveSelectionAndPZInfo();

    var imgPool = book.sheet1.getBrick('imgPool');
    imgPool.reInit( restoreSelectionAndPZInfo); //重新初始化 ,并在初始化完成后， 恢复选中状态

   
     
    
}

function newImgCommingTipVisible(v)
{
    book.sheet0.getBrick('shineText').visible=v;
 
}

function notifyNeedUploadFileCount( fc)
{
    var info=  fc==0?"":"个文件正准备上传";
    book.sheet0.cells("stateInfo2").setValue(info);
}


id: 60aa79be5db2172e3066fca7
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 192.168.3.2
username: sa
createdate: 2021.05.24 00:09:40.000
script:
var pathToMonit = "";
var electron=null; 

var timeHandle=0; 

function formOpen() {
    book.showTabOnWhere = "none";
    newImgCommingTipVisible(false);

    //收到来自服务器推送的消息
    onPushMessage("electronPushMessage" , function(msg){
        msg= JSON.parse(msg);
        if( msg.cmd=="newFileUploaded")   newImgCommingTipVisible(true); //通知有新文件上传了
        if( msg.cmd=="notifyNeedUploadFileCount")  notifyNeedUploadFileCount( msg.fileCount); //通知还有多少个文件等待上传
    });

    electron= getElectron();

    book.sheet1.getBrick('imgPool').selectionMode = 'multi'; //图片设置成多选模式

    $(document.body).append(`<style>
                        .pzh {position:absolute;left:0;bottom:0px; 
                                height:24px; line-height:24px;width:100%; 
                                background-color:#40af40a0; 
                                color:white;font-weight:bold;font-size:16px;text-align:center;}

                        .delete_pzh { position:absolute; right:0; width:40px; height:14px; top:0; text-align:right; 
                                    vertical-align:top; font-size:12px; color:gray;padding-right:5px;}      
                        .delete_pzh:hover { color:white;}      
                          
                        </style>
                    `);


    //  let data= loadImagePoolData();
    //  console.dir(data);


    $('#blockSize').on('input', resetImgPoolBlockSize);

    setTimeout(function () {
        //调取缩略图大小
        var imgPool = book.sheet1.getBrick('imgPool');

        let blockSize = getImagePoolBlockSize();
        if (blockSize != imgPool.config.blockSize) {
            $('#blockSize').val(blockSize);
            resetImgPoolBlockSize(false);
        }
    }, 1000);


    //调取图片目录
    setTimeout( function(){
    if (electron != null) {
        var hostName = electron.getHostName();
        pathToMonit = getMonitePath(hostName);
        
        //开启监控
        if( pathToMonit!='') moniteStart(pathToMonit);
    }
    },500);
}

// 先保存当前选中状态及设置的凭证号信息

var g_selection;
var g_pzMap;
function  saveSelectionAndPZInfo( )
{
     
    var imgPool = book.sheet1.getBrick('imgPool');

    // 保存当前选中状态及设置的凭证号信息
    var selection = imgPool.getSelectedImageList();
    // 保存设置的凭证号信息
    var pzhMap = {};
    var pzhs = imgPool.dom.find('.pzh');
    for (let i = 0; i < pzhs.length; i++) {
        let id = $(pzhs[i]).parent().attr('id');
        let pzh = $(pzhs[i]).find('.no').text();
        pzhMap[id] = pzh;

    }
    g_selection=selection;
    g_pzMap=pzhMap;
}

function  restoreSelectionAndPZInfo()
{
     var selection= g_selection;
     var pzhMap= g_pzMap;
    var imgPool = book.sheet1.getBrick('imgPool');

     //恢复选中状态
    for (let i = 0; i < selection.length; i++) {
        imgPool.setImageSelected(selection[i].id, true);
    }
    //恢复凭证号
    for (let id in pzhMap) {
        var pzh = pzhMap[id];
        find_pzh(id, true).find('.no').text(pzh);
    }

}

function resetImgPoolBlockSize(needSaveSetting) {
    if (needSaveSetting == null) needSaveSetting = true;
    var imgPool = book.sheet1.getBrick('imgPool');


    // 先保存当前选中状态及设置的凭证号信息
    saveSelectionAndPZInfo();

    let v = $('#blockSize').val();

    imgPool.config.blockSize = parseInt(v);
    imgPool.rebuildGridly();
   
    //恢复选中状态
    restoreSelectionAndPZInfo();

    if (needSaveSetting) {
        setTimeout(function () {
            setImagePoolBlockSize(imgPool.getConfig("gguid"), v);
        }, 1000);
    }



}

/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet, name, data) {
    //console.dir(data);
    var url = data.url_img;
    book.sheet0.cells("imgPreview").setValue(url);
}
function imageOnMouseOut(sheet, name, data) {

    book.sheet0.cells("imgPreview").setValue("");
}


/**
 * 图片控件中某个图片被双击了
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片被双击)
function imageOnDBLClick(sheet, name, data) {

    //因为 mouseOut 会把大图清除掉，所以这里重新再设置上
    setTimeout(function () {
        var url = data.url_img;
        book.sheet0.cells("imgPreview").setValue(url);

    }, 200);

    var pzh = '';
    try {

        pzh = find_pzh(data.id, false).find('.no').text();
    } catch (err) {

    }

    if (pzh == undefined) pzh = '';

    inputBox("标记为凭证", "", pzh, "输入凭证号码", function (val) {
        if (val == '') {
            var p = find_pzh(data.id, false);
            if (p) p.remove();
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, false);
        } else {
            find_pzh(data.id, true).find('.no').text(val);
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, true);
        }

    }, true /*允许为空*/);
}


//@comment (group=,caption=查找或创建凭证号标记对象,needRightControl=false)
function find_pzh(id, create_if_not_exists) {
    var d = $('#' + id);
    if (!d) {
        $.alert(id + "不存在");
        return null;
    }

    var ret = d.find('.pzh');
    if (ret.length == 0) {
        if (create_if_not_exists) //如果需要创建，则创建它
        {
            d.append(`<div class="pzh" ><div class="no"></div><div class="delete_pzh"><i class="fa fa-close" onclick="removePZH('${id}');  event.preventDefault(); event.stopPropagation();"> </i></div></div>`);
        }
        ret = d.find('.pzh');
    }
    return ret;

}

function removePZH(id) {
    var p = find_pzh(id, false);
    if (p) p.remove();
}

function cb_selectall_onClick() {
    var imgPool = book.sheet1.getBrick('imgPool');
    if (imgPool.getSelectedImageList().length == 0) {
        imgPool.selectAll();
    } else {
        imgPool.unSelectAll();
    }
}


function cb_path_onClick() {
    if (electron == null) {
        toastr.error("此功能仅能在客户端APP中执行");
        return;
    }

    var path = electron.showOpenDialogSync('');
    if (path == '') return;
    var hostName = electron.getHostName();
    setMonitePath(hostName, path);
 
    moniteStart(path);


}

function moniteStart(path)
{
    pathToMonit=path;
    book.sheet0.cells('stateBar').setValue("图片目录 " + pathToMonit);

     if (electron == null) {
        toastr.error("此功能仅能在客户端APP中执行");
        return;
    }

    book.sheet0.cells('stateBar').setValue("图片目录 " + pathToMonit+ " 监控中...");
    electron.ipcSendMessage( {cmd:"moniteStart" , path:path});
}

function cb_refresh_onClick()
{
    newImgCommingTipVisible(false);

     // 先保存当前选中状态及设置的凭证号信息
    saveSelectionAndPZInfo();

    var imgPool = book.sheet1.getBrick('imgPool');
    imgPool.reInit( restoreSelectionAndPZInfo); //重新初始化 ,并在初始化完成后， 恢复选中状态

   
     
    
}

function newImgCommingTipVisible(v)
{
    book.sheet0.getBrick('shineText').visible=v;
 
}

function notifyNeedUploadFileCount( fc)
{
    var info=  fc==0?"": "【"+fc+"】个文件正准备上传";
    book.sheet0.cells("stateInfo2").setValue(info);
}


id: 60aa79be5db2172e3066fcad
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 192.168.3.2
username: sa
createdate: 2021.05.24 00:41:11.000
script:
var pathToMonit = "";
var electron=null; 

var timeHandle=0; 

function formOpen() {
    book.showTabOnWhere = "none";
    newImgCommingTipVisible(false);

    //收到来自服务器推送的消息
    onPushMessage("electronPushMessage" , function(msg){
        msg= JSON.parse(msg);
        if( msg.cmd=="newFileUploaded")   newImgCommingTipVisible(true); //通知有新文件上传了
        if( msg.cmd=="notifyNeedUploadFileCount")  notifyNeedUploadFileCount( msg.fileCount); //通知还有多少个文件等待上传
    });

    electron= getElectron();

    book.sheet1.getBrick('imgPool').selectionMode = 'multi'; //图片设置成多选模式

    $(document.body).append(`<style>
                        .pzh {position:absolute;left:0;bottom:0px; 
                                height:24px; line-height:24px;width:100%; 
                                background-color:#40af40a0; 
                                color:white;font-weight:bold;font-size:16px;text-align:center;}

                        .delete_pzh { position:absolute; right:0; width:40px; height:14px; top:0; text-align:right; 
                                    vertical-align:top; font-size:12px; color:gray;padding-right:5px;}      
                        .delete_pzh:hover { color:white;}      
                          
                        </style>
                    `);


    //  let data= loadImagePoolData();
    //  console.dir(data);


    $('#blockSize').on('input', resetImgPoolBlockSize);

    setTimeout(function () {
        //调取缩略图大小
        var imgPool = book.sheet1.getBrick('imgPool');

        let blockSize = getImagePoolBlockSize();
        if (blockSize != imgPool.config.blockSize) {
            $('#blockSize').val(blockSize);
            resetImgPoolBlockSize(false);
        }
    }, 1000);


    //调取图片目录
    setTimeout( function(){
    if (electron != null) {
        var hostName = electron.getHostName();
        pathToMonit = getMonitePath(hostName);
        
        //开启监控
        if( pathToMonit!='') moniteStart(pathToMonit);
    }
    },500);
}

// 先保存当前选中状态及设置的凭证号信息

var g_selection;
var g_pzMap;
function  saveSelectionAndPZInfo( )
{
     
    var imgPool = book.sheet1.getBrick('imgPool');

    // 保存当前选中状态及设置的凭证号信息
    var selection = imgPool.getSelectedImageList();
    // 保存设置的凭证号信息
    var pzhMap = {};
    var pzhs = imgPool.dom.find('.pzh');
    for (let i = 0; i < pzhs.length; i++) {
        let id = $(pzhs[i]).parent().attr('id');
        let pzh = $(pzhs[i]).find('.no').text();
        pzhMap[id] = pzh;

    }
    g_selection=selection;
    g_pzMap=pzhMap;
}

function  restoreSelectionAndPZInfo()
{
     var selection= g_selection;
     var pzhMap= g_pzMap;
    var imgPool = book.sheet1.getBrick('imgPool');

     //恢复选中状态
    for (let i = 0; i < selection.length; i++) {
        imgPool.setImageSelected(selection[i].id, true);
    }
    //恢复凭证号
    for (let id in pzhMap) {
        var pzh = pzhMap[id];
        find_pzh(id, true).find('.no').text(pzh);
    }

}

function resetImgPoolBlockSize(needSaveSetting) {
    if (needSaveSetting == null) needSaveSetting = true;
    var imgPool = book.sheet1.getBrick('imgPool');


    // 先保存当前选中状态及设置的凭证号信息
    saveSelectionAndPZInfo();

    let v = $('#blockSize').val();

    imgPool.config.blockSize = parseInt(v);
    imgPool.rebuildGridly();
   
    //恢复选中状态
    restoreSelectionAndPZInfo();

    if (needSaveSetting) {
        setTimeout(function () {
            setImagePoolBlockSize(imgPool.getConfig("gguid"), v);
        }, 1000);
    }



}

/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet, name, data) {
    //console.dir(data);
    var url = data.url_img;
    book.sheet0.cells("imgPreview").setValue(url);
}
function imageOnMouseOut(sheet, name, data) {

    book.sheet0.cells("imgPreview").setValue("");
}


/**
 * 图片控件中某个图片被双击了
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片被双击)
function imageOnDBLClick(sheet, name, data) {

    //因为 mouseOut 会把大图清除掉，所以这里重新再设置上
    setTimeout(function () {
        var url = data.url_img;
        book.sheet0.cells("imgPreview").setValue(url);

    }, 200);

    var pzh = '';
    try {

        pzh = find_pzh(data.id, false).find('.no').text();
    } catch (err) {

    }

    if (pzh == undefined) pzh = '';

    inputBox("标记为凭证", "", pzh, "输入凭证号码", function (val) {
        if (val == '') {
            var p = find_pzh(data.id, false);
            if (p) p.remove();
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, false);
        } else {
            find_pzh(data.id, true).find('.no').text(val);
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, true);
        }

    }, true /*允许为空*/);
}


//@comment (group=,caption=查找或创建凭证号标记对象,needRightControl=false)
function find_pzh(id, create_if_not_exists) {
    var d = $('#' + id);
    if (!d) {
        $.alert(id + "不存在");
        return null;
    }

    var ret = d.find('.pzh');
    if (ret.length == 0) {
        if (create_if_not_exists) //如果需要创建，则创建它
        {
            d.append(`<div class="pzh" ><div class="no"></div><div class="delete_pzh"><i class="fa fa-close" onclick="removePZH('${id}');  event.preventDefault(); event.stopPropagation();"> </i></div></div>`);
        }
        ret = d.find('.pzh');
    }
    return ret;

}

function removePZH(id) {
    var p = find_pzh(id, false);
    if (p) p.remove();
}

function cb_selectall_onClick() {
    var imgPool = book.sheet1.getBrick('imgPool');
    if (imgPool.getSelectedImageList().length == 0) {
        imgPool.selectAll();
    } else {
        imgPool.unSelectAll();
    }
}


function cb_path_onClick() {
    if (electron == null) {
        toastr.error("此功能仅能在客户端APP中执行");
        return;
    }

    var path = electron.showOpenDialogSync('');
    if (path == '') return;
    var hostName = electron.getHostName();
    setMonitePath(hostName, path);
 
    moniteStart(path);


}

function moniteStart(path)
{
    pathToMonit=path;
    book.sheet0.cells('stateBar').setValue("图片目录 " + pathToMonit);

     if (electron == null) {
        toastr.error("此功能仅能在客户端APP中执行");
        return;
    }

    book.sheet0.cells('stateBar').setValue("图片目录 " + pathToMonit+ " 监控中...");
    electron.ipcSendMessage( {cmd:"moniteStart" , path:path});
}

function cb_refresh_onClick()
{
    newImgCommingTipVisible(false);

     // 先保存当前选中状态及设置的凭证号信息
    saveSelectionAndPZInfo();

    var imgPool = book.sheet1.getBrick('imgPool');
    imgPool.reInit( restoreSelectionAndPZInfo); //重新初始化 ,并在初始化完成后， 恢复选中状态

    toastr.info("重新加载完成");
   
     
    
}

function newImgCommingTipVisible(v)
{
    book.sheet0.getBrick('shineText').visible=v;
 
}

function notifyNeedUploadFileCount( fc)
{
    var info=  fc==0?"": "【"+fc+"】个文件正准备上传";
    book.sheet0.cells("stateInfo2").setValue(info);
}


id: 60aae1b35db2f37491f98fb2
scriptid: 60a321f05db27838e0c014c3
tablename: app_template
clientip: 192.168.3.2
username: sa
createdate: 2021.05.24 08:33:30.000
script:
var pathToMonit = "";//当前监控的目录
var electron=null; 


function formOpen() {
    book.showTabOnWhere = "none";
    newImgCommingTipVisible(false);

    //收到来自服务器推送的消息
    onPushMessage("electronPushMessage" , function(msg){
        msg= JSON.parse(msg);
        if( msg.cmd=="newFileUploaded")   newImgCommingTipVisible(true); //通知有新文件上传了
        if( msg.cmd=="notifyNeedUploadFileCount")  notifyNeedUploadFileCount( msg.fileCount); //通知还有多少个文件等待上传
    });

    //获取当前的electron接口对象
    electron= getElectron(); //getElectron是系统全局功能函数

    book.sheet1.getBrick('imgPool').selectionMode = 'multi'; //图片设置成多选模式

    // 追加一些CSS类 ，用于凭证号标记
    $(document.body).append(`<style>
                        .pzh {position:absolute;left:0;bottom:0px; 
                                height:24px; line-height:24px;width:100%; 
                                background-color:#40af40a0; 
                                color:white;font-weight:bold;font-size:16px;text-align:center;}
                        .delete_pzh { position:absolute; right:0; width:40px; height:14px; top:0; text-align:right; 
                                    vertical-align:top; font-size:12px; color:gray;padding-right:5px;}      
                        .delete_pzh:hover { color:white;}      
                          
                        </style>
                    `);

 
    //注册调整缩略图大小的事件
    $('#blockSize').on('input', resetImgPoolBlockSize);

    setTimeout(function () {
        //调取缩略图大小
        var imgPool = book.sheet1.getBrick('imgPool');

        let blockSize = getImagePoolBlockSize();
        if (blockSize != imgPool.config.blockSize) {
            $('#blockSize').val(blockSize);
            resetImgPoolBlockSize(false);
        }
    }, 1000);

    //调取图片目录设置，注意适当延时
    setTimeout( function(){
    if (electron != null) {
        var hostName = electron.getHostName();
        pathToMonit = getMonitePath(hostName);
        
        //开启监控
        if( pathToMonit!='') moniteStart(pathToMonit);
    }
    },500);
}

// 先保存当前选中状态及设置的凭证号信息

var g_selection;
var g_pzMap;
//@comment (group=图片清单刷新,caption=保存选中状态及凭证标记信息,needRightControl=false)
function  saveSelectionAndPZInfo( )
{
     
    var imgPool = book.sheet1.getBrick('imgPool');

    // 保存当前选中状态及设置的凭证号信息
    var selection = imgPool.getSelectedImageList();
    // 保存设置的凭证号信息
    var pzhMap = {};
    var pzhs = imgPool.dom.find('.pzh');
    for (let i = 0; i < pzhs.length; i++) {
        let id = $(pzhs[i]).parent().attr('id');
        let pzh = $(pzhs[i]).find('.no').text();
        pzhMap[id] = pzh;

    }
    g_selection=selection;
    g_pzMap=pzhMap;
}

//@comment (group=图片控件,caption=还原选中及凭证标记,needRightControl=false)
function  restoreSelectionAndPZInfo()
{
     var selection= g_selection;
     var pzhMap= g_pzMap;
    var imgPool = book.sheet1.getBrick('imgPool');

     //恢复选中状态
    for (let i = 0; i < selection.length; i++) {
        imgPool.setImageSelected(selection[i].id, true);
    }
    //恢复凭证号
    for (let id in pzhMap) {
        var pzh = pzhMap[id];
        find_pzh(id, true).find('.no').text(pzh);
    }

}

//@comment (group=图片控件,caption=重设小图大小,needRightControl=false)
function resetImgPoolBlockSize(needSaveSetting) {
    if (needSaveSetting == null) needSaveSetting = true;
    var imgPool = book.sheet1.getBrick('imgPool');

    // 先保存当前选中状态及设置的凭证号信息
    saveSelectionAndPZInfo();

    let v = $('#blockSize').val();

    imgPool.config.blockSize = parseInt(v);
    imgPool.rebuildGridly();
   
    //恢复选中状态
    restoreSelectionAndPZInfo();

    if (needSaveSetting) {
        setTimeout(function () {
            setImagePoolBlockSize(imgPool.getConfig("gguid"), v);
        }, 1000);
    }



}

/**
 * 图片控件中鼠标进入某个图片区域
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=鼠标进入图片区域)
function imageOnMouseEnter(sheet, name, data) {
    //console.dir(data);
    var url = data.url_img;
    book.sheet0.cells("imgPreview").setValue(url);
}
//@comment (group=图片控件,caption=鼠标从图片移开,needRightControl=false)
function imageOnMouseOut(sheet, name, data) {

    book.sheet0.cells("imgPreview").setValue("");
}


/**
 * 图片控件中某个图片被双击了
 * @param sheet   所在Sheet
 * @param config  图片控件的名称
 *@param data  该图片的详细信息
 *
 */
//@comment (group=图片控件,caption=图片被双击)
function imageOnDBLClick(sheet, name, data) {

    //因为 mouseOut 会把大图清除掉，所以这里重新再设置上
    setTimeout(function () {
        var url = data.url_img;
        book.sheet0.cells("imgPreview").setValue(url);

    }, 200);

    var pzh = '';
    try {

        pzh = find_pzh(data.id, false).find('.no').text();
    } catch (err) {

    }

    if (pzh == undefined) pzh = '';

    inputBox("标记为凭证", "", pzh, "输入凭证号码", function (val) {
        if (val == '') {
            var p = find_pzh(data.id, false);
            if (p) p.remove();
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, false);
        } else {
            find_pzh(data.id, true).find('.no').text(val);
            book.sheet1.getBrick("imgPool").setImageSelected(data.id, true);
        }

    }, true /*允许为空*/);
}


//@comment (group=图片清单刷新,caption=查找或创建凭证号标记对象,needRightControl=false)
function find_pzh(id, create_if_not_exists) {
    var d = $('#' + id);
    if (!d) {
        $.alert(id + "不存在");
        return null;
    }

    var ret = d.find('.pzh');
    if (ret.length == 0) {
        if (create_if_not_exists) //如果需要创建，则创建它
        {
            d.append(`<div class="pzh" ><div class="no"></div><div class="delete_pzh"><i class="fa fa-close" onclick="removePZH('${id}');  event.preventDefault(); event.stopPropagation();"> </i></div></div>`);
        }
        ret = d.find('.pzh');
    }
    return ret;

}

//@comment (group=图片控件,caption=移除图片看的凭证号标记,needRightControl=false)
function removePZH(id) {
    var p = find_pzh(id, false);
    if (p) p.remove();
}

function cb_selectall_onClick() {
    var imgPool = book.sheet1.getBrick('imgPool');
    if (imgPool.getSelectedImageList().length == 0) {
        imgPool.selectAll();
    } else {
        imgPool.unSelectAll();
    }
}


function cb_path_onClick() {
    if (electron == null) {
        toastr.error("此功能仅能在客户端APP中执行");
        return;
    }

    var path = electron.showOpenDialogSync('');
    if (path == '') return;
    var hostName = electron.getHostName();
    setMonitePath(hostName, path);
 
    moniteStart(path);


}

//@comment (group=上传相关,caption=开始文件变化监控,needRightControl=false)
function moniteStart(path)
{
    pathToMonit=path;
    book.sheet0.cells('stateBar').setValue("图片目录 " + pathToMonit);

     if (electron == null) {
        toastr.error("此功能仅能在客户端APP中执行");
        return;
    }

    book.sheet0.cells('stateBar').setValue("图片目录 " + pathToMonit+ " 监控中...");
    electron.ipcSendMessage( {cmd:"moniteStart" , path:path});
}

function cb_refresh_onClick()
{
    newImgCommingTipVisible(false);

     // 先保存当前选中状态及设置的凭证号信息
    saveSelectionAndPZInfo();

    var imgPool = book.sheet1.getBrick('imgPool');
    imgPool.reInit( restoreSelectionAndPZInfo); //重新初始化 ,并在初始化完成后， 恢复选中状态

    toastr.info("重新加载完成");
   
     
    
}

//@comment (group=上传相关,caption=上传好一个文件后，通知有新文件,needRightControl=false)
//@comment (group=上传相关,caption=上传好一个文件后通知有新文件,needRightControl=false)
function newImgCommingTipVisible(v)
{
    book.sheet0.getBrick('shineText').visible=v;
 
}

//@comment (group=上传相关,caption=刷新当前还有多少文件要上传的提示,needRightControl=false)
function notifyNeedUploadFileCount( fc)
{
    var info=  fc==0?"": "【"+fc+"】个文件正准备上传";
    book.sheet0.cells("stateInfo2").setValue(info);
}


