const text = {

    //图片类型
    picType: (instance, td, row, col, prop, value, cellProperties) => {
        td.style.color = "#409EFF";
        td.style.cursor = "pointer";
        if (value instanceof Array && value.length > 0) {
            let i = 0
            value.map(item => {
                if (item.type == "image" || item.type == "video") {
                    i++
                }
            })
            td.innerHTML = "已上传：" + i;
        } else {
            td.innerHTML = "点击上传"
        }
        return td;
    },
    // 文件类型
    fileType: (instance, td, row, col, prop, value, cellProperties) => {
        td.style.color = "#409EFF";
        td.style.cursor = "pointer";
        if (value instanceof Array && value.length > 0) {
            td.innerHTML = "已上传：" + value.length;
        } else {
            td.innerHTML = "点击上传"
        }
        return td;
    },
    //系统类型
    systemList: (instance, td, row, col, prop, value, cellProperties) => {
        td.style.color = "#409EFF";
        td.style.cursor = "pointer";
        if (value instanceof Array && value.length > 0) {
            if (value.length == 1) {
                td.innerHTML = !!value[0].infos ? (value[0].infos.SysLocalName || value[0].infos.SysName) : (value[0].SysLocalName || value[0].SysName)
            } else {
                let text = ""
                for (let i = 0; i < value.length; i++) {
                    if (!!value[i].SysLocalName || !!value[i].SysName) {
                        if (i == value.length) {
                            text += value[i].SysLocalName || value[i].SysName
                        } else {
                            text = value[i].SysLocalName || value[i].SysName + "、" + text
                        }
                    } else {
                        if (i == value.length) {
                            text += value[i].infos.SysLocalName || value[i].infos.SysName
                        } else {
                            text = value[i].infos.SysLocalName || value[i].infos.SysName + "、" + text
                        }
                    }
                }
                td.innerHTML = text.substring(0, 40) + "..."
            }
        } else {
            td.innerHTML = "无关联系统"
        }
        return td;
    },
    //四大厂商
    idType: (instance, td, row, col, prop, value, cellProperties) => {
        td.style.color = "#409EFF";
        td.style.cursor = "pointer";
        if (!!value) {
            let data = value.split("-")[1] || "空名"
            td.innerHTML = data
        } else {
            td.innerHTML = "点击选择"
        }
        return td
    },

    //查看二维码
    lookQRCode: (instance, td, row, col, prop, value, cellProperties) => {
        td.style.color = "#409EFF";
        td.style.cursor = "pointer";
        td.innerHTML = "查看二维码"
        return td
    }
}

export default text