/**
 * 添加风险控制表格数据 - 选中的数据
 * @date 2021-06-02
 * @param {number} index
 * @param {string} self
 * @param {string} userid
 * @returns {any}
 */
export const  riskCheckData = (index, self, userid) => {
    var userid = userid || jq(self).attr('data-id');
    // 	if(/CONTROL/.test(basFlow.curId)){
    // 		checkedData = basFlow.controls[basFlow.curId].leaders
    // 	}else{
    // 		checkedData = basFlow.swimlanes[basFlow.curId].leaders
    // 	}
    // var checkedData = basFlow.controls[basFlow.curId].leaders;
    console.log(userid, jq(self).attr('data-id'), jq(self).is(':checked'))
    if (jq(self).is(':checked')) {
        jq(self).attr('checked', 'checked')
        checkedRiskData.push(respDataPro[index]);
    } else {
        for (var i = 0; i < checkedRiskData.length; i++) {
            if (checkedRiskData[i].id == userid) {
                checkedRiskData.splice(i, 1);
                break;
            }
        }
    }
    console.log(checkedRiskData)
}


/**
 * 风险控制删除
 * @date 2021-06-02
 * @param {string} element 删除的对象
 * @returns {any}
 */
export const riskDelete = (element) => {
    var temStore = {};
    if (/CONTROL/.test(basFlow.curId)) {
        temStore = basFlow.controls[basFlow.curId[0]]
    } else {
        temStore = basFlow.swimlanes[basFlow.curId[0]]
    }
    console.log(temStore)
    console.log(jq(element).attr("docId"), jq(element).attr("index-id"))
    let riskList = JSON.parse('{"process":' + JSON.stringify(temStore.keyControl || []) + '}').process;
    riskList.splice(jq(element).attr("index-id"), 1)
    var doTData = doT.template(jq('#attr_templ').text())
    temStore.keyControl = riskList;
    const dataList = jq('#keyControlForm').data('optionalValueDTOs')

    const keyControlFormData = doT.template(jq('#keyControlFormTemp').text())
    jq("#keyControlForm").html(keyControlFormData({
        attrList: temStore,
        dataList
    }))
    // jq(".content_wrapper .content_item").eq(1).html(doTData({
    //     attrList: temStore
    // }))
    // jq("#" + basFlow.curId[0]).remove()
    // basFlow.addControl(basFlow.controls[basFlow.curId[0]], true)
    // for (var i = 0; i < jq("#pointAttr li").length; i++) {
    //     if (jq("#pointAttr li").eq(i).text() === jq.i18n.prop("KRCP")) {
    //         jq("#pointAttr li").eq(i).siblings().removeClass("active");
    //         jq("#pointAttr li").eq(i).addClass("active");
    //         jq(".attr1Box").children().siblings().css("display", "none");
    //         jq(".attr1Box").children().eq(i).css("display", "block");
    //         break;
    //     }
    // }
}
