add
This commit is contained in:
parent
89cdbecb01
commit
01717c590b
|
@ -1,13 +1,14 @@
|
|||
<template>
|
||||
<scrollTable :config="config2" style="width:100%;height:100%" v-if="config2.data.length"></scrollTable>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import qrcode from "qrcode"
|
||||
import scrollTable from "@/components/scrollTable.vue"
|
||||
import { ref, reactive, onMounted } from "vue"
|
||||
import { plantProductCountApi } from "@/api.js"
|
||||
import { areaObj } from "@/store/index.js"
|
||||
const userInfoStore = areaObj()
|
||||
// ...userInfoStore.userInfo
|
||||
const alignFn = (num) => {
|
||||
let arr = []
|
||||
for (let i = 0; i < num; i++) {
|
||||
|
@ -20,13 +21,16 @@ const config2 = reactive({
|
|||
headerBGC: "#092757",
|
||||
oddRowBGC: "#0C2045",
|
||||
headerStyle: "background:#0E316B",
|
||||
|
||||
align: alignFn(4),
|
||||
data: []
|
||||
})
|
||||
|
||||
|
||||
const correctionListFn = (list) => {
|
||||
const correctionListFn = async (list) => {
|
||||
for (let i = 0; i < list.length; i++) {
|
||||
let res = await qrcode.toDataURL(`https://suyuan.lihaink.cn/api/index/suYuan?id=${8}`)
|
||||
list[i].qr_code = res
|
||||
}
|
||||
const originalArray = list;
|
||||
const transformedArray = originalArray.reduce((acc, curr, index) => {
|
||||
if (index % 2 === 0) {
|
||||
|
@ -36,31 +40,23 @@ const correctionListFn = (list) => {
|
|||
}
|
||||
return acc;
|
||||
}, []);
|
||||
|
||||
return transformedArray
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
plantProductCountApi(
|
||||
{
|
||||
...userInfoStore.userInfo
|
||||
|
||||
|
||||
}
|
||||
).then(res => {
|
||||
|
||||
correctionListFn(res.data.list).forEach(item => {
|
||||
|
||||
|
||||
config2.data.push(
|
||||
[item[0].kind, `<img src=${item[0].qr_code} style='width:25px;height:25px;transform: translateY(5PX);'/>`,item[1]? item[1].kind:'', item[1]? `<img src=${item[1].qr_code} style='width:25px;height:25px;transform: translateY(5PX);'/>`:""]
|
||||
)
|
||||
correctionListFn(res.data.list).then(res => {
|
||||
res.forEach(item => {
|
||||
config2.data.push(
|
||||
[item[0].kind, `<img src=${item[0].qr_code} style='width:25px;height:25px;transform: translateY(5PX);'/>`, item[1] ? item[1].kind : '', item[1] ? `<img src=${item[1].qr_code} style='width:25px;height:25px;transform: translateY(5PX);'/>` : ""]
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
})
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
|
Loading…
Reference in New Issue