Skip to content

Instantly share code, notes, and snippets.

@jhxxs
Last active November 16, 2022 08:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jhxxs/b5b59645993c6111bbc5e7e1cdf4047b to your computer and use it in GitHub Desktop.
Save jhxxs/b5b59645993c6111bbc5e7e1cdf4047b to your computer and use it in GitHub Desktop.
spanMethod
interface NetConfigStep {
/* 配网引导内容 */
content: {
[key: string]: string
}
/* 文件地址URL */
file_url: string
id?: number
/* 配网类型,支持 BLE、AP、EZ、ZB、ZBN */
paring_type: string
/* 展示类型:支持1.image,2.gif,3.视频 */
show_type: number
/* 配网引导步骤 */
step: number
isuploading?: boolean
}
export interface PNetConfigStep extends NetConfigStep {
/* 产品key */
product_key?: string
// create_time?: number
// deleted?: number
// update_time?: number
}
export interface CNetConfigStep extends NetConfigStep {
/* 产品模版key */
product_template_key?: string
}
const calculateRow = computed(() =>
unref(data).reduce(
(prev, cur) =>
Object.assign(prev, {
[cur.paring_type]: cur.step
}),
{}
)
)
function spanMethod(data: {
row: PNetConfigStep | CNetConfigStep
column: any
rowIndex: number
columnIndex: number
}) {
const maxStep = unref(calculateRow)[data.row.paring_type]
if (data.columnIndex == 0) {
if (maxStep > 1) {
if (data.row.step == 1) {
return [maxStep, 1]
} else {
return [0, 0]
}
} else {
return [1, 1]
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment