define({ template: `
电费充值
开启 关闭
首次发布商品,先点击发布商品,再重新编辑商品,设置电费充值规格!
建议尺寸: 640 * 640 ,或正方型图片
`, style: ` .moreCol .el-table thead{ display:none } .moreCol .el-table--border, .el-table--group{ border: none; } .el-table .cell{ padding-right:0 !important; } .el-table th > .cell { text-align: center; } .el-table .cell { text-align: center; } `, props: { form: { default() { return {}; }, }, formKey: { type: String, }, }, delimiters: ['[[', ']]'], data() { return { showSelectMaterialPopup: false, materialType: "1", formFieldName: "", list: [], typeList:[], } }, created() { if(this.form.options.length == 0){ this.list = [] return } this.list = this.form.options; this.objectSpanMethod = this.getRowspanMethod(this.list, ['charge_type']); for(let item of this.form.options){ this.typeList.push(item.spec); } }, methods: { validate() { return { desc:this.form.electricity_bill_pro_goods.desc, status:this.form.electricity_bill_pro_goods.is_open, banner:this.form.electricity_bill_pro_goods.banner, options:this.form.options } }, displaySelectMaterialPopup(fieldName = "thumb", type = 1) { this.formFieldName = fieldName; this.showSelectMaterialPopup = !this.showSelectMaterialPopup; this.materialType = String(type); }, selectedMaterial(name, image, imageUrl) { this.form.electricity_bill_pro_goods.banner = imageUrl[0].url }, btnDelete(){ this.form.electricity_bill_pro_goods.banner = "" }, getRowspanMethod(data, rowspanArray) { // 要合并列的数据 const rowspanNumObject = {}; //初始化 rowspanNumObject rowspanArray.map(item => { rowspanNumObject[item] = new Array(data.length).fill(1, 0, 1).fill(0, 1); rowspanNumObject[`${item}-index`] = 0; }); //计算相关的合并信息 for (let i = 1; i < data.length; i++) { rowspanArray.map(key => { const index = rowspanNumObject[`${key}-index`]; if (data[i][key] === data[i - 1][key]) { rowspanNumObject[key][index]++; } else { rowspanNumObject[`${key}-index`] = i; rowspanNumObject[key][i] = 1; } }); } //提供合并的方法并导出 const spanMethod = function({ row, column, rowIndex, columnIndex }) { if (rowspanArray.includes(column['property'])) { const rowspan = rowspanNumObject[column['property']][rowIndex]; if (rowspan > 0) { return { rowspan: rowspan, colspan: 1 } } return { rowspan: 0, colspan: 0 } } return { rowspan: 1, colspan: 1 } }; return spanMethod; }, }, });