|
@@ -190,7 +190,7 @@ import {
|
|
|
deepClone,
|
|
|
setPosInsert,
|
|
|
setPosRange,
|
|
|
- getObjValue
|
|
|
+ getObjValue, arrIndex
|
|
|
} from "js-fast-way"
|
|
|
|
|
|
const router = useRouter()
|
|
@@ -384,6 +384,9 @@ const getExcelHtml = async (item, index) => {
|
|
|
template: resData,
|
|
|
tableForm: formData.value[index],
|
|
|
appId: `#table-form-${pkeyIds}`,
|
|
|
+ onChartRefs: (el, pKeyId, key) => {
|
|
|
+ setChartRefs(el, pKeyId, key)
|
|
|
+ },
|
|
|
onRight: (event, KeyName) => {
|
|
|
onRightClick(event, KeyName, index)
|
|
|
},
|
|
@@ -393,7 +396,7 @@ const getExcelHtml = async (item, index) => {
|
|
|
if (type === 'chart') {
|
|
|
getChartConfig(formData.value[index], index)
|
|
|
}
|
|
|
- }
|
|
|
+ },
|
|
|
})
|
|
|
item.isTableFormRender = true
|
|
|
item.isRenderTableForm = true
|
|
@@ -409,6 +412,31 @@ const getExcelHtml = async (item, index) => {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+//图表ref
|
|
|
+const chartRefs = ref([])
|
|
|
+const setChartRefs = (el, pKeyId, key) => {
|
|
|
+ if (el) {
|
|
|
+ const {index} = getChartRef(pKeyId, key)
|
|
|
+ if (index !== -1) {
|
|
|
+ chartRefs.value[index].ref = el
|
|
|
+ } else {
|
|
|
+ chartRefs.value.push({pKeyId: pKeyId, key: key, ref: el});
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+//获取图表的ref
|
|
|
+const getChartRef = (pKeyId, key) => {
|
|
|
+ let refs = chartRefs.value, refVal, index = -1;
|
|
|
+ for (let i = 0; i < refs.length; i++) {
|
|
|
+ if (refs[i].pKeyId === pKeyId && refs[i].key === key) {
|
|
|
+ refVal = refs[i].ref
|
|
|
+ index = i
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return {ref: refVal, index: index}
|
|
|
+}
|
|
|
+
|
|
|
//图表信息
|
|
|
const chartKey = ref('key_41__27_0')
|
|
|
const getChartConfig = async (form = {}, index) => {
|
|
@@ -431,7 +459,6 @@ const getChartConfig = async (form = {}, index) => {
|
|
|
form[chart_key] = getObjValue(data)
|
|
|
}
|
|
|
console.log(formData.value[index])
|
|
|
-
|
|
|
}
|
|
|
|
|
|
//正则效验
|