Vue.component("ssl-certs-box", { props: ["v-certs", "v-protocol"], data: function () { let certs = this.vCerts if (certs == null) { certs = [] } return { certs: certs } }, methods: { certIds: function () { return this.certs.map(function (v) { return v.id }) }, // 删除证书 removeCert: function (index) { let that = this teaweb.confirm("确定删除此证书吗?证书数据仍然保留,只是当前服务不再使用此证书。", function () { that.certs.$remove(index) }) }, // 选择证书 selectCert: function () { let that = this teaweb.popup("/servers/components/ssl/selectPopup", { width: "50em", height: "30em", callback: function (resp) { that.certs.push(resp.data.cert) } }) }, // 上传证书 uploadCert: function () { let that = this teaweb.popup("/servers/components/ssl/uploadPopup", { height: "28em", callback: function (resp) { teaweb.success("上传成功", function () { that.certs.push(resp.data.cert) }) } }) }, // 格式化时间 formatTime: function (timestamp) { return new Date(timestamp * 1000).format("Y-m-d") } }, template: `
` })