ZaiZai 8 months ago
parent
commit
e33433cd62

+ 8 - 0
src/api/modules/exctab/exceltab.js

@@ -152,6 +152,14 @@ export default {
             params: form,
         })
     },
+    //清表生成html
+    async getExcelHtml(form) {
+        return HcApi({
+            url: '/api/blade-manager/exceltab/get-excel-html',
+            method: 'get',
+            params: form,
+        })
+    },
     //获取字段信息
     async getColByTabId(form) {
         return HcApi({

+ 3 - 10
src/plugins/HTableForm.js

@@ -7,7 +7,7 @@ export default class HTableForm {
     static tableFormApp = null
     static tableFormVM = null
 
-    static createForm({ template, tableForm, appId, onRight, onBlur, onFormDataChange }) {
+    static createForm({ template, tableForm, appId, onRight, onFormDataChange }) {
         const app = createApp({
             //自定义组件,需要把饿了么的组件,或者自定义组件手动传递进来绑定,否则渲染时,自定义组件不会生效
             components,
@@ -52,16 +52,9 @@ export default class HTableForm {
                     }, 100)
                 },
                 //焦点事件
-                getInformation() {
-                    console.log('getInformation')
-                },
+                getInformation() {},
                 //失去焦点事件
-                getRegularExpression(event, reg, msg, a, b, leng, type, c, d) {
-                    const KeyName = event?.target?.getAttribute('keyname') || ''
-                    if (onBlur) {
-                        onBlur(event, KeyName, reg, this.formData[KeyName], msg, leng, type, c, d)
-                    }
-                },
+                getRegularExpression() {},
                 //日期选择事件
                 datePickerChange() {},
                 //上传完成

+ 42 - 5
src/views/project/list/adjust-excel.vue

@@ -2,11 +2,14 @@
     <hc-drawer v-model="isShow" ui="hc-project-list-adjust-excel-drawer" to-id="hc-layout-box" is-close @close="drawerClose">
         <hc-page-split :fold="false" :options="splitOptions">
             <template #left>
-                <hc-card>
-                    自定义左边的区域
+                <hc-card :title="`【调整表单】${dataInfo.tableName}`">
+                    <hc-table-form ref="excelRef" :html="excelHtml" @tap="excelClick" />
                 </hc-card>
             </template>
             <hc-card>
+                <template #header>
+                    <el-segmented v-model="tabsKey" :options="tabsProps" @change="tabsChange" />
+                </template>
                 其它内容
             </hc-card>
         </hc-page-split>
@@ -16,8 +19,9 @@
 <script setup>
 import { ref, watch } from 'vue'
 import { HcDelMsg } from 'hc-vue3-ui'
-import { getArrValue, isNullES, isString } from 'js-fast-way'
+import { getArrValue, getObjValue, isNullES, isString } from 'js-fast-way'
 import { getDictionaryData } from '~uti/tools'
+import excelApi from '~api/exctab/exceltab'
 import wbsTreeApi from '~api/wbs/tree'
 import mainApi from '~api/wbs/private'
 
@@ -39,7 +43,7 @@ const isShow = defineModel('modelValue', {
 //监听数据
 const dataInfo = ref(props.info)
 watch(() => props.info, (data) => {
-    dataInfo.value = data
+    dataInfo.value = getObjValue(data)
 }, { immediate: true, deep: true })
 
 //监听显示
@@ -54,9 +58,36 @@ const splitOptions = {
     minSize: [300, 300],
 }
 
+//选项卡
+const tabsKey = ref('tab1')
+const tabsProps = [
+    { label: '输入框', value: 'tab1' },
+    { label: '电签位置', value: 'tab2' },
+    { label: '公式条件', value: 'tab3' },
+    { label: '默认信息', value: 'tab4' },
+    { label: '提示信息', value: 'tab5' },
+]
+const tabsChange = (val) => {
+    console.log(val)
+}
+
 //处理相关数据
-const getDataApi = () => {
+const excelRef = ref(null)
+const excelHtml = ref('')
+const getDataApi = async () => {
+    const { pkeyId, excelId } = getObjValue(dataInfo.value)
+    if (isNullES(pkeyId) || isNullES(excelId)) {
+        window?.$message.warning('表单值异常,请联系管理员')
+        return
+    }
+    const { data } = await excelApi.getExcelHtml({ pkeyId })
+    excelHtml.value = data || ''
+}
 
+//框框被点击
+const excelClick = async (item) => {
+    //let key = item.target.getAttribute('data-index')
+    console.log(item)
 }
 
 //关闭抽屉
@@ -73,5 +104,11 @@ const drawerClose = () => {
 <style lang="scss">
 .el-overlay .el-drawer.hc-project-list-adjust-excel-drawer {
     background-color: #F1F5F8;
+    .hc-table-form-data-item {
+        padding: 0;
+    }
+    .hc-table-form-data-item .hc-excel-table-form {
+        background: #e4e7eb;
+    }
 }
 </style>

+ 18 - 3
src/views/project/list/wbs-tree.vue

@@ -84,7 +84,7 @@
                                 <template #action="{ row }">
                                     <el-link type="success">关联清表</el-link>
                                     <el-link type="primary" :disabled="row.excelId === -1 || isNullES(row.excelId)">编辑元素</el-link>
-                                    <el-link type="warning" :disabled="row.excelId === -1 || isNullES(row.excelId)" @click="adjustExcelClick(row)">调整表单</el-link>
+                                    <el-link v-loading="adjustExcelLoading" type="warning" :disabled="row.excelId === -1 || isNullES(row.excelId)" @click="adjustExcelClick(row)">调整表单</el-link>
                                     <el-link type="primary">编辑元素公式</el-link>
                                     <el-link type="warning">表单同步</el-link>
                                     <el-link type="primary">关联节点</el-link>
@@ -131,6 +131,7 @@ import { deepClone, getArrValue, getObjValue, isNullES } from 'js-fast-way'
 import { getDictionaryData, reloadPage } from '~uti/tools'
 import TreeNodeEditDialog from './tree-node-edit.vue'
 import HcAdjustExcel from './adjust-excel.vue'
+import excelApi from '~api/exctab/exceltab'
 import wbsTreeApi from '~api/wbs/tree'
 import mainApi from '~api/wbs/private'
 
@@ -596,9 +597,23 @@ const dataSyncMenuClick = (item) => {
 
 //调整表单
 const isAdjustExcelShow = ref(false)
+const adjustExcelLoading = ref(false)
 const adjustExcelInfo = ref({})
-const adjustExcelClick = (row) => {
-    adjustExcelInfo.value = row
+const adjustExcelClick = async (row) => {
+    const { pkeyId, excelId } = row
+    if (isNullES(pkeyId) || isNullES(excelId)) {
+        window?.$message.warning('表单值异常,请联系管理员')
+        return
+    }
+    adjustExcelLoading.value = true
+    const { code, data } = await excelApi.getExcelHtml({ pkeyId })
+    if (code !== 200 || isNullES(data)) {
+        adjustExcelLoading.value = false
+        window?.$message.warning('表单异常,请联系管理员')
+        return
+    }
+    adjustExcelInfo.value = deepClone(row)
+    adjustExcelLoading.value = false
     isAdjustExcelShow.value = true
 }