//收费系统打印机功能:收费/退费,需要使用到lodop
var LODOP;//打印机
$(function () {
//初始化
$("body").append('<object id="LODOP_OB" classid="clsid:2105C259-1E0C-4534-8141-A753534CB4CA" width=0 height=0> <embed id="LODOP_EM" type="application/x-print-lodop" width=0 height=0></embed></object>'); LODOP = getLodop();
}); //检测是否安装了打印插件
function CheckLodop()
{
var oOBJECT = document.getElementById('LODOP_OB'), oEMBED = document.getElementById('LODOP_EM');
var LODOP = oEMBED;
try {
var isIE = (navigator.userAgent.indexOf('MSIE') >= 0) || (navigator.userAgent.indexOf('Trident') >= 0);
var is64IE = isIE && (navigator.userAgent.indexOf('x64') >= 0);
if (isIE) LODOP = oOBJECT;
if ((LODOP == null) || (typeof (LODOP.VERSION) == "undefined")) {
return false;
} else
if (LODOP.VERSION < "6.1.6.1") {
return false;
}
return true;
} catch (err) {
return false;
}
} function getLodop() {
var oOBJECT = document.getElementById('LODOP_OB'), oEMBED = document.getElementById('LODOP_EM');
/**************************
本函数根据浏览器类型决定采用哪个对象作为控件实例:
IE系列、IE内核系列的浏览器采用oOBJECT,
其它浏览器(Firefox系列、Chrome系列、Opera系列、Safari系列等)采用oEMBED,
对于64位浏览器指向64位的安装程序install_lodop64.exe。
**************************/
var strHtmInstall = "打印控件未安装!点击这里<a href='/patch/install_lodop32.exe' target='_self'>执行安装</a>,安装后请刷新页面或重新进入。";
var strHtmUpdate = "打印控件需要升级!点击这里<a href='/patch/install_lodop32.exe' target='_self'>执行升级</a>,升级后请重新进入。";
var strHtm64_Install = "打印控件未安装!点击这里<a href='/patch/install_lodop64.exe' target='_self'>执行安装</a>,安装后请刷新页面或重新进入。";
var strHtm64_Update = "打印控件需要升级!点击这里<a href='/patch/install_lodop64.exe' target='_self'>执行升级</a>,升级后请重新进入。";
var strHtmFireFox = "注意:如曾安装过Lodop旧版附件npActiveXPLugin,请在【工具】->【附加组件】->【扩展】中先卸它。";
var LODOP = oEMBED;
try {
var isIE = (navigator.userAgent.indexOf('MSIE') >= 0) || (navigator.userAgent.indexOf('Trident') >= 0);
var is64IE = isIE && (navigator.userAgent.indexOf('x64') >= 0);
var errhtml = '';
if (isIE) LODOP = oOBJECT;
if ((LODOP == null) || (typeof (LODOP.VERSION) == "undefined")) {
if (navigator.userAgent.indexOf('Firefox') >= 0)
{
errhtml = strHtmFireFox
}
if (is64IE) {
errhtml = strHtm64_Install;
}
else if (isIE) {
errhtml = strHtmInstall;
}
else
{
errhtml = strHtmInstall;
}
ShowPrintErr(errhtml);
return LODOP;
} else {
if (LODOP.VERSION < "6.1.6.1") {
if (is64IE) {
errhtml = strHtm64_Update;
}
else if (isIE) {
errhtml = strHtmUpdate;
}
else {
errhtml = strHtmUpdate;
}
ShowPrintErr(errhtml);
return LODOP;
}
}
//=====如下空白位置适合调用统一功能:===== //=======================================
return LODOP;
} catch (err) {
if (is64IE)
{
errhtml = "Error:" + strHtm64_Install;
}
else
{
errhtml = "Error:" + strHtmInstall;
}
ShowPrintErr(errhtml);
return LODOP;
}
return LODOP;
} function ShowPrintErr(h)
{
if (h)
{
h = "<p>" + h;
h += " <span id='az_close' style='cursor:pointer;display:inline-block;position:absolute;right:0;' title='点击关闭'>X</span></p>";
$(".az_remind").html(h).fadeIn(2000);
$("#az_close").click(function () {
$(".az_remind").fadeOut(2000);
});
setTimeout(function () { $(".az_remind").fadeOut(2000); }, 5000);
}
} (function ($) {
function PrintBase(printObj) {
this.nf = { FontName: '宋体', FontSize: 9 };
this.hf = { FontName: '宋体', FontSize: 20 };
this.printObj = printObj;
this.printBegin = function () {
LODOP.PRINT_INIT("票据" + Math.random());
LODOP.SET_PRINTER_INDEXA(printObj.PrintSet.printerName);
LODOP.SET_PRINT_MODE("POS_BASEON_PAPER", true);
};
this.DX = function (num) {
var strOutput = "";
var strUnit = '仟佰拾亿仟佰拾万仟佰拾元角分';
num += "00";
var intPos = num.indexOf('.');
if (intPos >= 0)
num = num.substring(0, intPos) + num.substr(intPos + 1, 2);
strUnit = strUnit.substr(strUnit.length - num.length);
for (var i = 0; i < num.length; i++)
strOutput += '零壹贰叁肆伍陆柒捌玖'.substr(num.substr(i, 1), 1) + strUnit.substr(i, 1);
return strOutput.replace(/零角零分$/, '整').replace(/零[仟佰拾]/g, '零').replace(/零{2,}/g, '零').replace(/零([亿|万])/g, '$1').replace(/零+元/, '元').replace(/亿零{0,3}万/, '亿').replace(/^元/, "零元");
};
this.printEnd = function () {
LODOP.PRINT();
};
this.printFee = function () { };
this.printFeeRefund = function () { };
this.measureString = function (s, f) {
//计算文字宽度
return { width: s.length * f.FontSize, height: f.FontSize };
}
this.printLine = function (x1, y1, x2) {
LODOP.ADD_PRINT_Line(y1, x1,y1, x2, 0, 1);
};
this.printString = function (s, f, x, y) {
LODOP.ADD_PRINT_TEXT(y, x, 1000, 25, s);
LODOP.SET_PRINT_STYLEA(0, "FontName", f.FontName);
LODOP.SET_PRINT_STYLEA(0, "FontSize", f.FontSize);
};
}
function PrinterPinA(printObj, printCopys, printCopysYAdd,y5,y6,y7,y8,y9) {
PrintBase.call(this, printObj);
this.maxCount = 12;
this.currentPage = 1;
this.xTitle = 370;
this.yy = 25;
this.x1 = 70;
this.x2 = 200;
this.x3 = 330;
this.x4 = 460;
this.x5 = 630;
this.x6 = 727;
this.y1 = 65;
this.y2 = 80;
this.y3 = 90;
this.y4 = 115;
this.y5 = y5;
this.y6 = y6;
this.y7 = y7;
this.y8 = y8;
this.y9 = y9;
this.printCopys = printCopys;
this.printCopysYAdd = printCopysYAdd;
this.totalPages = Math.ceil(printObj.listFee.length / this.maxCount);
this.printNormal = function (yAdd) {
if (yAdd > 0) {
this.printLine(0, yAdd, 900);
}
var title = this.printObj.schName + this.printObj.title; //计算文字宽度
var xTemp = (844 - this.measureString(title, this.hf).width) / 2;
this.printString(title, this.hf, xTemp, this.yy + yAdd);
this.printString("班级:" + this.printObj.clsName, this.nf, this.x1, this.y1 + yAdd);
this.printString("姓名:" + this.printObj.userName, this.nf, this.x2, this.y1 + yAdd);
this.printString("日期:" + this.printObj.payTime, this.nf, this.x4, this.y1 + yAdd);
this.printString("单号:" + this.printObj.serialNum, this.nf, this.x5, this.y1 + yAdd);
this.printLine(this.x1, this.y2 + yAdd, this.x6);
this.printLine(this.x1, this.y6 + yAdd, this.x6);
this.printString("合计:", this.nf, this.x1, this.y5 + yAdd);
var printphoneX = this.x1;
var printaddressY = this.y7;
if (printObj.schName) {
printphoneX = this.x2;
printaddressY = this.y8;
this.printString(printObj.schName, this.nf, this.x1, this.y7 + yAdd);
}
if (printObj.tel) {
printaddressY = this.y8;
this.printString("电话:" + printObj.tel, this.nf, printphoneX, this.y7 + yAdd);
}
if (printObj.printSeal) {
printaddressY = this.y8;
this.printString("盖章", this.nf, this.x5, this.y7 + yAdd);
}
if (printObj.schAddress) {
this.printString("地址:" + printObj.schAddress, this.nf, this.x1, printaddressY + yAdd);
}
var fstr = "退款人";
if (printObj.feeType==1) {
fstr = "收款人";
}
fstr += ":" + printObj.payee;
this.printString(fstr, this.nf, this.x5, printaddressY + yAdd);
};
this.printFee = function () {//打印收费
this.printBegin();
for (var i = 0; i < this.printCopys; i++) {
var yAdd = i * this.printCopysYAdd;
this.printNormal(yAdd);
var total = 0, real = 0, qian = 0, discount = 0;
var y = this.y4 + yAdd;
this.printString("项目", this.nf, this.x1, this.y3 + yAdd);
this.printString("应收金额(元)", this.nf, this.x2, this.y3 + yAdd);
this.printString("实收金额(元)", this.nf, this.x3, this.y3 + yAdd);
this.printString("备注", this.nf, this.x4, this.y3 + yAdd); //遍历打印
for (var j = (this.currentPage - 1) * this.maxCount; j < printObj.listFee.length && j < this.currentPage * this.maxCount; j++) {
var temp = printObj.listFee[j];
this.printString(temp.feeName, this.nf, this.x1, y);
this.printString(temp.totalMoney.toFixed(2), this.nf, this.x2, y);
this.printString(temp.realMoney.toFixed(2), this.nf, this.x3, y);
this.printString(temp.payMsg, this.nf, this.x4, y); total += temp.totalMoney;
real += temp.realMoney;
qian += temp.qianOldMoney;
discount += temp.discountMoney;
y += this.yy;
} this.printString("应收:" + total.toFixed(2) + "元", this.nf, this.x2, this.y5 + yAdd);
this.printString("实收:" + real.toFixed(2) + "元", this.nf, this.x3, this.y5 + yAdd);
this.printString("大写:" + this.DX(real), this.nf, this.x4, this.y5 + yAdd);
if (qian) {
this.printString("欠费:" + qian.toFixed(2) + "元", this.nf, this.x3, this.y9 + yAdd);
}
if (discount) {
this.printString("减免:" + discount.toFixed(2) + "元", this.nf, this.x4, this.y9 + yAdd);
}
}
this.printEnd();
if (this.currentPage * this.maxCount < printObj.listFee.length) {
this.currentPage++;
this.printFee();
}
};
this.printFeeRefund = function () {//打印退费
this.printBegin();
for (var i = 0; i < this.printCopys; i++) {
var yAdd = i * this.printCopysYAdd;
this.printNormal(yAdd);
var real = 0;
var y = this.y4 + yAdd;
this.printString("退费项目", this.nf, this.x1, this.y3 + yAdd);
this.printString("退费金额(元)", this.nf, this.x3, this.y3 + yAdd);
this.printString("备注", this.nf, this.x4, this.y3 + yAdd); //遍历打印
for (var j = (this.currentPage - 1) * this.maxCount; j < printObj.listFee.length && j < this.currentPage * this.maxCount; j++) {
var temp = printObj.listFee[j];
this.printString(temp.feeName, this.nf, this.x1, y);
this.printString(temp.realMoney.toFixed(2), this.nf, this.x3, y);
this.printString(temp.payMsg, this.nf, this.x4, y); real += temp.realMoney;
y += this.yy;
} this.printString("退费:" + real.toFixed(2) + "元", this.nf, this.x3, this.y5 + yAdd);
this.printString("大写:" + this.DX(real), this.nf, this.x4, this.y5 + yAdd);
}
this.printEnd();
if (this.currentPage * this.maxCount < printObj.listFee.length) {
this.currentPage++;
this.printFee();
}
}
} function PrinterPin140(printObj) {//a4 2等分
PrinterPinA.call(this, printObj, 1, -1, 415, 455, 465, 490, 440);
} function PrinterPinA4(printObj)//a4 双份
{
PrinterPinA.call(this, printObj, 2, 540, 415, 455, 465, 490, 440);
}
function PrinterPin93(printObj) {
PrinterPinA.call(this, printObj, 1, -1, 265, 305, 310, 335, 290);
}
function PrinterTicket(printObj,x1,x2,x3,x4,totalWidth,hfSize,hf2Size,addrSize)
{
PrintBase.call(this, printObj);
this.y = 5;
this.x1 = x1;
this.x2 = x2;
this.x3 = x3;
this.x4 = x4;
this.yy = 15;
this.yh = 20;
this.yx = 10;
this.totalWidth = totalWidth;
this.addrSize = addrSize;
this.hf = { FontName: '宋体', FontSize: hfSize };
this.hf2 = { FontName: '宋体', FontSize: hf2Size };
this.printFoot = function (total, qian, real, discount) {
this.printLine(this.x1, this.y, this.totalWidth - this.x1);
this.y += this.yx;
this.printString("合计:" + printObj.listFee.length + "项", this.nf, this.x1, this.y);
this.y += this.yy;
if (printObj.feeType) {
this.printString("应收:" + total.toFixed(2) + "元", this.nf, this.x1, this.y);
this.y += this.yy;
if (qian) {
this.printString("欠费:" + qian.toFixed(2) + "元", this.nf, this.x1, this.y);
this.y += this.yy;
}
if (discount) {
this.printString("减免:" + discount.toFixed(2) + "元", this.nf, this.x1, this.y);
this.y += this.yy;
}
this.printString("实收:" + real.toFixed(2) + "元", this.nf, this.x1, this.y);
this.y += this.yy;
} else {
this.printString("退费:" + real.toFixed(2) + "元", this.nf, this.x1, this.y);
this.y += this.yy;
}
this.printString("大写:" + this.DX(real), this.nf, this.x1, this.y);
this.y += this.yy;
var fstr = "退款人";
if (printObj.feeType==1) {
fstr = "收款人";
}
fstr += ":" + printObj.payee;
this.printString(fstr, this.nf, this.x1, this.y);
this.y += this.yy;
if (printObj.tel || printObj.schAddress) {
this.printLine(this.x1, this.y, (this.totalWidth - this.x1));
this.y += this.yx;
}
if (printObj.tel) {
this.printString("电话:" + printObj.tel, this.nf, this.x1, this.y);
this.y += this.yy;
}
if (printObj.schAddress) {
var add1 = printObj.schAddress;
var add2 = '';
//判断要打印的行数
var rows = Math.ceil(add1.length / this.addrSize);
for (var i = 0; i < rows; i++) {
var end=(i+1)*this.addrSize;
if(end>add1.length)end=add1.length;
var temp = add1.substring(i * this.addrSize, end);
if (i == 0) {
this.printString("地址:" + temp, this.nf, this.x1, this.y);
} else {
this.printString(temp, this.nf, this.x1 * 8, this.y);
}
this.y += this.yy;
}
}
};
this.printHead = function () {
if (printObj.schName) {
var fs = this.measureString(printObj.schName, this.hf);
var xtemp1 = (this.totalWidth - fs.width) / 2;
this.printString(printObj.schName, this.hf, xtemp1, this.y);
this.y += this.yh;
}
var f2 = this.measureString(printObj.title, this.hf2);
var xtemp2 = (this.totalWidth - f2.width) / 2;
this.printString(printObj.title, this.hf2, xtemp2, this.y);
this.y += this.yh;
this.printString("日期:" + printObj.payTime, this.nf, this.x1, this.y);
this.printString("单号:" + printObj.serialNum, this.nf, this.x2, this.y);
this.y += this.yy;
this.printString("姓名:" + printObj.userName, this.nf, this.x1, this.y);
this.printString("班级:" + printObj.clsName, this.nf, this.x2, this.y);
this.y += this.yy;
this.printLine(this.x1, this.y, this.totalWidth - this.x1);
this.y += this.yx;
};
this.printFee = function () {//打印收费
this.printBegin();
this.printHead();
var total = 0, real = 0, qian = 0, discount = 0;
this.printString("项目", this.nf, this.x1, this.y);
this.printString("应收(元)", this.nf, this.x3, this.y);
this.printString("实收(元)", this.nf, this.x4, this.y);
this.y += this.yy; //遍历打印
for (var j = 0; j < printObj.listFee.length; j++) {
var temp = printObj.listFee[j];
var name = temp.feeName;
if(temp.payMsg)
{
name+='(' + temp.payMsg + ')';
}
this.printString(name,this.nf, this.x1, this.y);
this.y+=this.yy;
this.printString(temp.totalMoney.toFixed(2), this.nf, this.x3, this.y);
this.printString(temp.realMoney.toFixed(2), this.nf, this.x4, this.y);
total += temp.totalMoney;
real += temp.realMoney;
qian += temp.qianOldMoney;
discount += temp.discountMoney;
this.y += this.yy;
} this.printFoot(total, qian, real, discount);
this.printEnd();
};
this.printFeeRefund = function () {//打印退费
this.printBegin();
this.printHead();
var real = 0;
this.printString("项目", this.nf, this.x1, this.y);
this.printString("退费(元)", this.nf, this.x4, this.y);
this.y += this.yy; //遍历打印
for (var j = 0; j < printObj.listFee.length ; j++) {
var temp = printObj.listFee[j];
var name = temp.feeName;
if (temp.payMsg) {
name += '(' + temp.payMsg + ')';
}
this.printString(name, this.nf, this.x1, this.y);
this.y += this.yy;
this.printString(temp.realMoney.toFixed(2), this.nf, this.x4, this.y);
real += temp.realMoney;
this.y += this.yy;
}
this.printFoot(0, 0, real, 0);
this.printEnd();
};
}
function PrinterTicket80(printObj) {
PrinterTicket.call(this, printObj, 5, 180, 120, 200, 280, 12, 10,20);
}
function PrinterTicket76(printObj) {
PrinterTicket.call(this, printObj, 5, 155, 105, 185, 266, 12, 10,18);
}
function PrinterTicket50(printObj) {
PrinterTicket.call(this, printObj, 5, 180, 60, 120, 192, 10, 8,11);
this.printHead = function () {
if (printObj.schName) {
var fs = this.measureString(printObj.schName, this.hf);
var xtemp1 = (this.totalWidth - fs.width) / 2;
this.printString(printObj.schName, this.hf, xtemp1, this.y);
this.y += this.yh;
}
var f2 = this.measureString(printObj.title, this.hf2);
var xtemp2 = (this.totalWidth - f2.width) / 2;
this.printString(printObj.title, this.hf2, xtemp2, this.y);
this.y += this.yh;
this.printString("日期:" + printObj.payTime, this.nf, this.x1, this.y);
this.y += this.yy;
this.printString("单号:" + printObj.serialNum, this.nf, this.x1, this.y);
this.y += this.yy;
this.printString("班级:" + printObj.clsName, this.nf, this.x1, this.y);
this.y += this.yy;
this.printString("姓名:" + printObj.userName, this.nf, this.x1, this.y);
this.y += this.yy;
this.printLine(this.x1, this.y, this.totalWidth - this.x1);
this.y += this.yx;
};
}
$.extend({
Print: function (printObj) {
if (printObj.PrintSet.printerName) {
var pt;
switch (printObj.PrintSet.printerType) {
case 1:
pt = new PrinterPin140(printObj);
break;
case 2:
pt = new PrinterPin93(printObj);
break;
case 3:
pt = new PrinterTicket80(printObj);
break;
case 4:
pt = new PrinterTicket76(printObj);
break;
case 5:
pt = new PrinterTicket50(printObj);
break;
case 6:
pt = new PrinterPinA4(printObj);
break;
}
if (pt) {
var k = 0;
var si = setInterval(function () {
if (k < printObj.PrintSet.printNumber) {
k++;
if (printObj.feeType == 1) {
pt.printFee(printObj);
} else {
pt.printFeeRefund(printObj);
}
}
else
{
clearInterval(si);
}
}, 200);
}
}
}
});
})(jQuery);

lodop打印收费小票的更多相关文章

  1. [原创]Lodop打印, 以及Lodop引用css文件控制打印样式的问题.

    最近在做Lodop打印功能: 思路是:  用MasterPage搭个打印页面的框架, 然后在具体的页面中填入数据, 打印的样式由母版页和CSS来控制. 困扰了一天的问题是:  在打印的JS文件中, 引 ...

  2. chrome升级后LODOP打印插件无法使用

    今天帮朋友使用LODOP实现一个套打程序时,发现LODOP打印插件在chrome下始终无法使用.分析后发现是自己才升级了chrome,chrome新版默认是禁用npapi的,因此需要手动启用一下,启用 ...

  3. LODOP打印控件示例

    一.lodop打印预览效果图 LODOP.PRINT_SETUP();打印维护效果图 LODOP.PREVIEW();打印预览图 二.写在前面 最近项目用到了LODOP的套打,主要用到两个地方,一是物 ...

  4. LODOP打印当前日期时间的方法

    JS方法直接获取.之前有个详细介绍的博文:LODOP打印用JS获取的当前日期本文也再演示一下,详细介绍见上面链接的博文,该方法此文不做详细介绍. 本文有三段:1.JS获取日期,2,.LODOP的FOR ...

  5. LODOP打印用JS获取的当前日期

    该文详细一步步解释JS获取当前时间的方法,新手小白也看到懂,最后是实际的获取当前年月份的方法.JS中的Date()对象,包含很多当前系统时间的方法,首先建立一个Date()对象,这里取名为date,然 ...

  6. Lodop打印控件在页面如何使用

    Lodop打印控件部署到web服务器简单,在页面的使用方法也简单,是非常容易和方便使用的打印控件.客户端本地打印角色(即用户访问网站后 用自己链接的打印机进行客户端本地打印),步骤很少,部署简单:Lo ...

  7. Lodop打印表格带页头页尾 自动分页每页显示头尾

    Lodop中有两种专门给超文本表格的方式,ADD_PRINT_TABLE和ADD_PRINT_TBURL,该方式只能用于单个表格,表格外的内容不显示,是专门用于打印html超文本表格的.使用这两个语句 ...

  8. Lodop打印表格带页头页尾 高度是否包含页头页尾

    通过设置TableHeightScope,可以实现对ADD_PRINT_TABLE,表格带页头页尾,查看本博客另一篇博文:Lodop打印表格带页头页尾 自动分页每页显示头尾 超文本超过打印项高度,会自 ...

  9. Lodop打印控件传入css样式、看是否传入正确样式

    Lodop中可以传入页面存在的css样式,也可以是拼接后的新样式,例如本博客的其他博文:Lodop打印如何隐藏table某一列 需要打印的页面,样式不一定都是行内样式,style样式单独写在页面上,或 ...

随机推荐

  1. SpringCloud的配置管理:Spring Cloud Config

    演示如何使用ConfigServer提供统一的参数配置服务 ###################################################################一.概 ...

  2. keepalive配置支持ipv6、ipv4双棧支持

    因公司业务需要,keepalived需要同时支持ipv6和ipv4 keepalived版本1.2.23. keepalived 配置: 重点:ipv6的虚IP配置在 virtual_ipaddres ...

  3. 改变textField的placeholder的颜色和位置

    重写UItextField的这个方法,用其他的textField继承自这个父类 - (void) drawPlaceholderInRect:(CGRect)rect { [[UIColor blue ...

  4. Spring-cloud (一):Eureka注册中心搭建

    前提 系统安装jdk1.8及以上,配置好maven的ide(这里用idea进行演示,maven版本3.5,配置阿里云源) 项目搭建 新建一个maven项目,创建最简单的那种就好,项目名这里为Eurek ...

  5. java.lang.Class类

    第一次接触Class类是在学习 jdbc中.Class.forName()是Class类的一个静态方法,用于手动加载一个类,例如数据库驱动. 其实每一个java类都拥有或者说对应一个Class的实例对 ...

  6. JavaScript数据结构与算法(一) 栈的实现

    TypeScript版本源码 class Stack { items = []; public push(element) { this.items.push(element); } public p ...

  7. 【swift】ios中生成二维码

    ios开发中可以自己代码生成二维码,需要使用到一个框架 CoreImage CoreImage框架可以做滤镜,Gif动图,二维码等 先看效果图 下面直接贴上代码(OC也是下面一样的流程) func c ...

  8. NPM实用指北

    npm作为下载node附送的大礼包,大家一定不会陌生. 然而关于npm,估计大量的只是用到npm install XXX以及npm run XXX. 其实这里边还有很多有意思的命令&参数.关于 ...

  9. [SDOI 2014]数表

    Description 有一张N×m的数表,其第i行第j列(1 < =i < =N,1 < =j < =m)的数值为 能同时整除i和j的所有自然数之和.给定a,计算数表中不大于 ...

  10. remove、erase

    remove: remove不是真正的删除,删除后数量并没有变化. 它接收一对迭代器,而不是一个容器,所以不知道它作用于哪个容器. 而且没有办法从一个迭代器获取对应于它的容器 实现 remove会用需 ...