ZaiZai 1 an în urmă
părinte
comite
9fd7e0b479

+ 1 - 1
src/components/table-form/modules/components.vue

@@ -2,7 +2,7 @@
     <div
         :id="id" class="hc-table-form-components-box" :data-key="keyname" :data-index="`${trindex || ''}_${tdindex || ''}`"
         :data-x1="x1" :data-x2="x2" :data-y1="y1" :data-y2="y2" :data-tr="trindex" :data-td="tdindex" :data-name="name"
-        :data-text="placeholder" :data-type="type" :data-rows="rows" :data-format="valueFormat" :data-weighing="weighing"
+        :data-text="placeholder" :data-type="typeName" :data-rows="rows" :data-format="valueFormat" :data-weighing="weighing"
         :data-label="label" :data-value="value" :data-src="src" :data-val="val" :data-contractid="contractid" :data-pkeyid="pkeyid"
         :data-objs="objsData" :data-multiple="multiple"
     >

+ 29 - 2
src/views/project/list/set-input.vue

@@ -77,7 +77,7 @@
 
 <script setup>
 import { onMounted, ref, watch } from 'vue'
-import { formValidate, getObjValue } from 'js-fast-way'
+import { formValidate, getObjValue, isNullES } from 'js-fast-way'
 import { getDictionaryData } from '~uti/tools'
 
 const props = defineProps({
@@ -183,8 +183,35 @@ const typeObj = {
     echart: 'echart',
 }
 const setDomData = (item) => {
-    //formModel.value.name = key
     console.log(item)
+    const type = typeObj[item.type]
+    formModel.value = {
+        name: item.text,
+        key: item.key,
+        type: type,
+    }
+    let newArr = []
+    if (type === 'selectBox' || type === 'select' || type === 'radio') {
+        //获取多选相关的数据
+        const dom = item?.zdom?.target
+        const child = dom.querySelectorAll('.hc-table-form-components-box')
+        for (let i = 0; i < child.length; i++) {
+            const val = child[i]?.getAttribute('data-label')
+            newArr.push({ dictValue: val })
+        }
+    } else if (type === 'checkbox') {
+        //获取多选框数据
+        const objs = isNullES(item.objs) ? [] : JSON.parse(item.objs)
+        for (let i = 0; i < objs.length; i++) {
+            newArr.push({ dictValue: objs[i].name })
+        }
+    }
+    tableData.value = newArr
+    if (type === 'date') {
+        //日期类型 YYYY年MM月DD日 YYYY-MM-DD  HH:mm:ss
+        const format = item.format
+        console.log(format)
+    }
 }
 
 //导出函数