mirror of
https://shylinux.com/x/operation
synced 2025-07-01 13:14:43 +08:00
add some
This commit is contained in:
parent
b1c7d0a18a
commit
b0f6f5ac82
@ -1,24 +1,34 @@
|
||||
Volcanos(chat.ONIMPORT, {
|
||||
_init: function(can, msg) { var width = can.onimport.width(can, 80, msg.Length())
|
||||
_init: function(can, msg) {
|
||||
var width = can.onimport.width(can, 80, msg.Length())
|
||||
can.page.Append(can, can._output, msg.Table(function(value) {
|
||||
var cb = can.onimport[value.unit]||can.onimport.unit
|
||||
return {view: html.ITEM, style: {width: width}, list: [
|
||||
{view: html.VALUE, list: cb(can, value.value, value.unit||"")},
|
||||
{view: html.TITLE, list: [{text: value.title||value.index.split(".").pop()}]},
|
||||
]}
|
||||
}))
|
||||
},
|
||||
money: function(can, value) { return can.onimport.unit(can, value, "元") },
|
||||
order: function(can, value) { return can.onimport.unit(can, value, "单") },
|
||||
stock: function(can, value) { return can.onimport.unit(can, value, "件") },
|
||||
size: function(can, value) { return [{text: can.base.Size(value)}] },
|
||||
unit: function(can, value, unit) { var v = parseFloat(value)
|
||||
if (v > 100000000) { return [{text: (v/100000000).toFixed(2)}, {text: ["亿"+unit, "", "unit"]}] }
|
||||
if (v > 10000) { return [{text: (v/10000).toFixed(2)}, {text: ["万"+unit, "", "unit"]}] }
|
||||
return [{text: value}, {text: [unit, "", "unit"]}]
|
||||
},
|
||||
width: function(can, min, length) {
|
||||
var count = (parseInt(can.ConfWidth()/min)); if (length < count) { count = length }
|
||||
return can.ConfWidth()/(count||1)
|
||||
},
|
||||
})
|
||||
// return {view: html.ITEM, style: {width: width}, list: [
|
||||
return {view: html.ITEM, list: [
|
||||
{view: html.VALUE, list: cb(can, value.value, value.unit||"")},
|
||||
{view: html.TITLE, list: [{text: value.title||value.index.split(".").pop()}]},
|
||||
]}
|
||||
}))
|
||||
},
|
||||
money: function(can, value) { return can.onimport.unit(can, value, "元") },
|
||||
order: function(can, value) { return can.onimport.unit(can, value, "单") },
|
||||
stock: function(can, value) { return can.onimport.unit(can, value, "件") },
|
||||
size: function(can, value) { return [{text: can.base.Size(value)}] },
|
||||
unit: function(can, value, unit) { var v = parseFloat(value)
|
||||
if (v > 100000000) { return [{text: (v/100000000).toFixed(2)}, {text: ["亿"+unit, "", "unit"]}] }
|
||||
if (v > 10000) { return [{text: (v/10000).toFixed(2)}, {text: ["万"+unit, "", "unit"]}] }
|
||||
return [{text: value}, {text: [unit, "", "unit"]}]
|
||||
},
|
||||
width: function(can, min, length) {
|
||||
var count = (parseInt(can.ConfWidth()/min)); if (length < count) { count = length }
|
||||
return can.ConfWidth()/(count||1)
|
||||
},
|
||||
/*
|
||||
layout: function(can) {
|
||||
var width = can.onimport.width(can, 80, msg.Length())
|
||||
can.page.Select(can, can._output, html.DIV_ITEM, function(target) {
|
||||
target.width
|
||||
})
|
||||
},
|
||||
*/
|
||||
})
|
Loading…
x
Reference in New Issue
Block a user