ソースを参照

优化代码规范

ZaiZai 2 年 前
コミット
fd5adb1d48

+ 19 - 23
src/views/data-fill/collapse-form/formula.vue

@@ -1,14 +1,14 @@
 <template>
-    <div v-if="componentDetail['type']==='radio'">
+    <div v-if="componentDetail.type === 'radio'">
         <el-form ref="formIDVFRef" :model="formulaModalinfo" label-width="auto" size="large">
-            <el-form-item :label="componentDetail['info']['label']">
+            <el-form-item :label="componentDetail.info.label">
                 <!-- onkeyup="value = value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g,'$1')" -->
                 <el-radio-group v-model="formulaModalinfo.type" size="large">
-                    <el-radio :label="componentDetail['info']['value'][0]['value']">
-                        {{ componentDetail['info']['value'][0]['label'] }}
+                    <el-radio :label="componentDetail.info.value[0].value">
+                        {{ componentDetail.info.value[0].label }}
                     </el-radio>
-                    <el-radio :label="componentDetail['info']['value'][1]['value']" class="ml-4">
-                        {{ componentDetail['info']['value'][1]['label'] }}
+                    <el-radio :label="componentDetail.info.value[1].value" class="ml-4">
+                        {{ componentDetail.info.value[1].label }}
                     </el-radio>
                 </el-radio-group>
             </el-form-item>
@@ -17,9 +17,9 @@
 </template>
 
 <script setup>
-import {ref, watch, onMounted} from "vue";
-import wbsApi from "~api/data-fill/wbs";
-import {getObjVal} from "js-fast-way"
+import { onMounted, ref, watch } from 'vue'
+import wbsApi from '~api/data-fill/wbs'
+import { getObjVal } from 'js-fast-way'
 
 const props = defineProps({
     projectId: [String, Number],
@@ -30,8 +30,8 @@ const props = defineProps({
 })
 
 
-const projectId = ref(props.projectId);
-const contractId = ref(props.contractId);
+const projectId = ref(props.projectId)
+const contractId = ref(props.contractId)
 const pkey_id = ref(props.pkeyId)
 const key_name = ref(props.KeyName)
 const formparent_id = ref(props.formparentId)
@@ -62,21 +62,21 @@ const componentDetail = ref({
     info: {
         label: '是否引用公式数据',
         value: [
-            {label: '是', value: 1},
-            {label: '否', value: 0},
-        ]
-    }
+            { label: '是', value: 1 },
+            { label: '否', value: 0 },
+        ],
+    },
 })
 
 const formulaModalinfo = ref({
-    type: ''
+    type: '',
 })
 
 //获取公式面板数据
 const getPanel = async () => {
     const pkeyIds = pkey_id.value
     if (pkeyIds) {
-        const {error, code, data} = await wbsApi.queryPanel({
+        const { error, code, data } = await wbsApi.queryPanel({
             key: key_name.value,
             contractId: contractId.value,
             parentId: formparent_id.value,
@@ -94,7 +94,7 @@ const getPanel = async () => {
 }
 
 const panelSave = async () => {
-    const {res, error, code} = await wbsApi.savePanel({
+    const { res, error, code } = await wbsApi.savePanel({
         parentId: formparent_id.value,
         key: key_name.value,
         contractId: contractId.value,
@@ -110,10 +110,6 @@ const panelSave = async () => {
 
 // 暴露出去
 defineExpose({
-    panelSave
+    panelSave,
 })
 </script>
-
-<style lang="scss">
-
-</style>

ファイルの差分が大きいため隠しています
+ 334 - 244
src/views/data-fill/collapse-form/index.vue


+ 31 - 29
src/views/data-fill/collapse-form/special-diaolg.vue

@@ -1,68 +1,70 @@
 <template>
-    <el-form ref="specialFormRef" :model="specialFormModel" :rules="specialFormRules" class="mb-6" label-width="0px"
-             size="large">
+    <el-form
+        ref="specialFormRef" :model="specialFormModel" :rules="specialFormRules" class="mb-6" label-width="0px"
+        size="large"
+    >
         <el-form-item class="special-form-item" prop="val">
-            <el-input id="specialId" ref="specialRef" v-model="specialFormModel.val"
-                      clearable placeholder="请选择特殊字符代码" @blur="specialInputBlur" @input="specialInputInput"/>
+            <el-input
+                id="specialId" ref="specialRef" v-model="specialFormModel.val"
+                clearable placeholder="请选择特殊字符代码" @blur="specialInputBlur" @input="specialInputInput"
+            />
         </el-form-item>
     </el-form>
     <el-row :gutter="20" style="margin: -10px;">
         <el-col v-for="item in specialCharacters" :span="3" style="padding: 10px;">
             <div class="special-box" @click="specialClick">
-                <span :title="`字符代码(C):${item !== 'K̅'?item.slice(2,7):'K̅'}`" class="font-EUDC" v-html="item"/>
+                <span :title="`字符代码(C):${item !== 'K̅' ? item.slice(2, 7) : 'K̅'}`" class="font-EUDC" v-html="item" />
             </div>
         </el-col>
     </el-row>
 </template>
 
 <script setup>
-import {ref, nextTick} from "vue";
-import {formValidate, setPosInsert, setPosRange} from "js-fast-way"
+import { nextTick, ref } from 'vue'
+import { formValidate, setPosInsert, setPosRange } from 'js-fast-way'
 
+//事件
+const emit = defineEmits(['change'])
 const specialRef = ref(null)
 const specialCharacters = [
-    '&#57344;', "&#57345;", "&#57346;", "&#57347;", '&#8804;', '&#8805;', '&#8451;',
+    '&#57344;', '&#57345;', '&#57346;', '&#57347;', '&#8804;', '&#8805;', '&#8451;',
     '&#9312;', '&#9313;', '&#9314;', '&#9315;', '&#9316;', '&#9317;', '&#9318;', '&#9319;', '&#9320;', '&#9321;', '&#9322;', '&#9323;',
     '&#9324;', '&#9325;', '&#9326;', '&#9327;', '&#9328;', '&#9329;', '&#9330;', '&#9331;',
-    "&#8544;", "&#8545;", "&#8546;", "&#8547;", "&#8548;", "&#8549;", "&#8550;", "&#8551;", "&#8552;", "&#8553;", "&#8554;", "&#8555;", "K̅"
+    '&#8544;', '&#8545;', '&#8546;', '&#8547;', '&#8548;', '&#8549;', '&#8550;', '&#8551;', '&#8552;', '&#8553;', '&#8554;', '&#8555;', 'K̅',
 ]
 
 nextTick(() => {
-    specialRef.value?.focus();
+    specialRef.value?.focus()
 })
 
 //输入框验证
 const specialFormRef = ref(null)
-const specialFormModel = ref({val: ''})
+const specialFormModel = ref({ val: '' })
 const specialFormRules = {
     val: {
         required: true,
-        trigger: "blur",
-        message: "请选择特殊字符代码"
-    }
+        trigger: 'blur',
+        message: '请选择特殊字符代码',
+    },
 }
 
-//事件
-const emit = defineEmits(['change'])
-
-
 //失去焦点
-const specialPos = ref({start: 0, end: 0})
+const specialPos = ref({ start: 0, end: 0 })
 const specialInputBlur = (e) => {
     specialPos.value = {
         start: e?.target?.selectionStart || 0,
-        end: e?.target?.selectionEnd || 0
+        end: e?.target?.selectionEnd || 0,
     }
 }
 
 //点击符号
 const specialClick = (event) => {
     const text = event?.target?.innerText ?? ''
-    const {start, end} = specialPos.value
+    const { start, end } = specialPos.value
     const form = specialFormModel.value.val
     specialFormModel.value.val = setPosInsert(start, end, form, text)
-    specialRef.value?.focus();
-    let posVal = start + text.length;
+    specialRef.value?.focus()
+    let posVal = start + text.length
     nextTick(() => {
         setPosRange('specialId', posVal)
     })
@@ -75,25 +77,25 @@ const specialInputInput = () => {
 }
 
 //插入特殊符号的处理
-const getSpecialNode = async ({KeyName, startPos, endPos, pkeyId}, itemForm) => {
+const getSpecialNode = async ({ KeyName, startPos, endPos, pkeyId }, itemForm) => {
     const res = await formValidate(specialFormRef.value)
     if (res) {
         const val = specialFormModel.value.val ?? ''
         try {
             const formValue = setPosInsert(startPos, endPos, itemForm, val)
-            let posVal = startPos + val.length;
-            return {code: 200, val: formValue, posVal}
+            let posVal = startPos + val.length
+            return { code: 200, val: formValue, posVal }
         } catch (e) {
-            return {code: 300, val: '', posVal: ''}
+            return { code: 300, val: '', posVal: '' }
         }
     } else {
-        return {code: 300, val: '', posVal: ''}
+        return { code: 300, val: '', posVal: '' }
     }
 }
 
 // 暴露出去
 defineExpose({
-    getSpecialNode
+    getSpecialNode,
 })
 </script>
 

+ 45 - 45
src/views/data-fill/collapse-form/table-form-item.vue

@@ -1,66 +1,69 @@
 <template>
-    <HcTableForm ref="tableFormRef"
-                 :cols="colsKeys"
-                 :form="tableFormInfo"
-                 :height="heights"
-                 :html="excelHtml"
-                 :loading="loading"
-                 :pid="activeKey"
-                 :pkey="keyId"
-                 :scroll="scroll"
-                 :width="widths"
-                 @excelBodyTap="excelTableFormClick"
-                 @render="tableFormRender"
-                 @rightTap="tableFormRightTap"
+    <HcTableForm
+        ref="tableFormRef"
+        :cols="colsKeys"
+        :form="tableFormInfo"
+        :height="heights"
+        :html="excelHtml"
+        :loading="loading"
+        :pid="activeKey"
+        :pkey="keyId"
+        :scroll="scroll"
+        :width="widths"
+        @excelBodyTap="excelTableFormClick"
+        @render="tableFormRender"
+        @rightTap="tableFormRightTap"
     />
 </template>
 
 <script setup>
-import {ref, watch, onMounted} from "vue"
-import {useAppStore} from "~src/store";
-import wbsApi from "~api/data-fill/wbs";
-import {deepClone, getArrValue, getObjVal, isString} from "js-fast-way"
+import { onMounted, ref, watch } from 'vue'
+import { useAppStore } from '~src/store'
+import wbsApi from '~api/data-fill/wbs'
+import { deepClone, getArrValue, getObjVal, isString } from 'js-fast-way'
 
 //初始
 const props = defineProps({
     tid: { // 树节点
         type: [String, Number],
-        default: ''
+        default: '',
     },
     kid: { // pkeyId
         type: [String, Number],
-        default: ''
+        default: '',
     },
     classify: { // 类型
         type: [String, Number],
-        default: ''
+        default: '',
     },
     scroll: {
         type: Boolean,
-        default: true
+        default: true,
     },
     height: {
         type: String,
-        default: '100%'
+        default: '100%',
     },
     width: {
         type: String,
-        default: 'auto'
+        default: 'auto',
     },
     datas: {
         type: Object,
-        default: () => ({})
+        default: () => ({}),
     },
     nodeName: { // 表单名称
         type: String,
-        default: ''
+        default: '',
     },
     pid: { // 折叠ID
         type: String,
-        default: ''
+        default: '',
     },
 })
 
+//事件
+const emit = defineEmits(['rightTap', 'render', 'excelBodyTap'])
 //初始变量
 const useAppState = useAppStore()
 const projectId = ref(useAppState.getProjectId)
@@ -90,7 +93,7 @@ watch(() => [
     props.width,
     props.pid,
 ], (
-    [project_id, contract_id, tree_id, key_id, cid, nodeName, height, width, pid]
+    [project_id, contract_id, tree_id, key_id, cid, nodeName, height, width, pid],
 ) => {
     projectId.value = project_id
     contractId.value = contract_id
@@ -105,11 +108,11 @@ watch(() => [
 
 //深度监听变动的对象数据
 watch(() => [
-    props.datas
+    props.datas,
 ], ([data]) => {
     changeData.value = data
     setFormChangeData(data)
-}, {deep: true})
+}, { deep: true })
 
 
 //渲染完成
@@ -124,9 +127,6 @@ onMounted(async () => {
     loading.value = false
 })
 
-//事件
-const emit = defineEmits(['rightTap', 'render', 'excelBodyTap'])
-
 //表单被点击
 const excelTableFormClick = (item) => {
     emit('excelBodyTap', item)
@@ -148,20 +148,20 @@ const getFormDataInit = () => {
 const tableFormInfo = ref({})
 const getTableFormInfo = async (pkeyId) => {
     if (pkeyId) {
-        const {error, code, data} = await wbsApi.getBussDataInfo({
-            pkeyId: pkeyId
+        const { error, code, data } = await wbsApi.getBussDataInfo({
+            pkeyId: pkeyId,
         }, false)
         const resData = getObjVal(data)
         if (!error && code === 200 && resData) {
             tableFormInfo.value = {
                 ...resData,
                 ...getFormDataInit(),
-                ...changeData.value
+                ...changeData.value,
             }
         } else {
             tableFormInfo.value = {
                 ...getFormDataInit(),
-                ...changeData.value
+                ...changeData.value,
             }
         }
     } else {
@@ -174,19 +174,19 @@ const getTableFormInfo = async (pkeyId) => {
 const colsKeys = ref([])
 const getHtmlBussColsApi = async (pkeyId) => {
     if (pkeyId) {
-        const {error, code, data} = await wbsApi.getHtmlBussCols({
-            pkeyId: pkeyId
+        const { error, code, data } = await wbsApi.getHtmlBussCols({
+            pkeyId: pkeyId,
         }, false)
         if (!error && code === 200) {
-            let keys = getArrValue(data);
+            let keys = getArrValue(data)
             for (let i = 0; i < keys.length; i++) {
                 if (keys[i].length <= 0) {
                     keys.splice(i, 1)
                 }
             }
-            colsKeys.value = keys;
+            colsKeys.value = keys
         } else {
-            colsKeys.value = [];
+            colsKeys.value = []
         }
     } else {
         colsKeys.value = []
@@ -197,8 +197,8 @@ const getHtmlBussColsApi = async (pkeyId) => {
 const excelHtml = ref('')
 const getExcelHtml = async (pkeyId) => {
     if (pkeyId) {
-        const {error, code, data} = await wbsApi.getExcelHtml({
-            pkeyId: pkeyId
+        const { error, code, data } = await wbsApi.getExcelHtml({
+            pkeyId: pkeyId,
         }, false)
         const resData = isString(data) ? data || '' : ''
         if (!error && code === 200 && resData) {
@@ -229,7 +229,7 @@ const tableFormRightTap = (item) => {
 //设置数据
 const setFormChangeData = (data) => {
     const form = deepClone(tableFormInfo.value)
-    tableFormInfo.value = {...form, ...data}
+    tableFormInfo.value = { ...form, ...data }
     //console.log('设置数据', {...form, ...data})
 }
 
@@ -280,6 +280,6 @@ defineExpose({
     getNodeName,
     setIsCtrlKey,
     setCopyKeyList,
-    setPasteKeyList
+    setPasteKeyList,
 })
 </script>

+ 61 - 65
src/views/data-fill/collapse-form/test-copy.vue

@@ -1,18 +1,18 @@
 <template>
-  <div>
-    <el-alert :closable="false" title="复跨节点复制: 把当前表格已形成的数据复制到其他工程部位的相同表格里面" type="warning" v-if="CopyModalType==='1'"/>
-    <el-alert :closable="false"  title="本节点复制:在当前节点内复制本表及数据" type="warning" v-else/>
-    <div class="copy-node-many-box" v-if="CopyModalType==='1'">
-        <div class="copy-node-many-tree">
-            <el-scrollbar>
-                <HcLazyTree
-                    ref="copywbstree" isType
-                    :autoExpandKeys="treeautokeys"
-                    @load="treeLoadNode"
-                    @nodeLoading="ElTreeNodeLoading"
-                    @nodeTap="wbsElTreeClick"
-                />
-                <!--WbsTree
+    <div>
+        <el-alert v-if="CopyModalType === '1'" :closable="false" title="复跨节点复制: 把当前表格已形成的数据复制到其他工程部位的相同表格里面" type="warning" />
+        <el-alert v-else :closable="false" title="本节点复制:在当前节点内复制本表及数据" type="warning" />
+        <div v-if="CopyModalType === '1'" class="copy-node-many-box">
+            <div class="copy-node-many-tree">
+                <el-scrollbar>
+                    <HcLazyTree
+                        ref="copywbstree" is-type
+                        :auto-expand-keys="treeautokeys"
+                        @load="treeLoadNode"
+                        @nodeLoading="ElTreeNodeLoading"
+                        @nodeTap="wbsElTreeClick"
+                    />
+                <!-- WbsTree
                     :treeKey="wbstreeKey"
                     :classifyType="classify"
                     :contractId="contractId"
@@ -21,57 +21,57 @@
                     @nodeTap="wbsElTreeClick"
                     ref="copywbstree"
                     :autoExpandKeys="treeautokeys"
-                /-->
-            </el-scrollbar>
-        </div>
-        <div class="copy-node-many-table">
-            <el-scrollbar v-loading="tableLoading">
-                <el-table :data="copyModalTable" border stripe>
-                    <el-table-column label="表格名称" prop="fullName"/>
-                    <el-table-column align="center" label="操作" prop="action" width="120">
-                        <template #default="{row}">
-                            <el-checkbox v-model="row.isCheck" size="large" @change="copyModalTableCheck(row)"/>
-                        </template>
-                    </el-table-column>
-                </el-table>
-            </el-scrollbar>
+                / -->
+                </el-scrollbar>
+            </div>
+            <div class="copy-node-many-table">
+                <el-scrollbar v-loading="tableLoading">
+                    <el-table :data="copyModalTable" border stripe>
+                        <el-table-column label="表格名称" prop="fullName" />
+                        <el-table-column align="center" label="操作" prop="action" width="120">
+                            <template #default="{ row }">
+                                <el-checkbox v-model="row.isCheck" size="large" @change="copyModalTableCheck(row)" />
+                            </template>
+                        </el-table-column>
+                    </el-table>
+                </el-scrollbar>
+            </div>
         </div>
     </div>
-  </div>
 </template>
 
 <script setup>
-import {ref, watch, onMounted, nextTick} from "vue";
-import {getArrValue, getObjValue, setPosInsert} from "js-fast-way"
-import queryApi from '~api/data-fill/query';
-import wbsApi from "~api/data-fill/wbs"
+import { nextTick, onMounted, ref, watch } from 'vue'
+import { getArrValue, getObjValue, setPosInsert } from 'js-fast-way'
+import queryApi from '~api/data-fill/query'
+import wbsApi from '~api/data-fill/wbs'
 
 const props = defineProps({
     projectId: [String, Number],
     contractId: [String, Number],
     classify:[String, Number],
     tree_AutoExpandKeys:[Array],
-    treenodeDataInfo:[Object],//外层选中的树
-    copyItems:[Object],//复制本表的数据
+    treenodeDataInfo:[Object], //外层选中的树
+    copyItems:[Object], //复制本表的数据
     CopyModalType:[String, Number],
 })
 //参数变量
-const projectId = ref(props.projectId);
-const contractId = ref(props.contractId);
-const classify = ref(props.classify);
-const tree_AutoExpandKeys = ref(props.tree_AutoExpandKeys);
-const treenodeDataInfo = ref(props.treenodeDataInfo);
-const copyItems = ref(props.copyItems);
-const CopyModalType=ref(props.CopyModalType)
-const copyModalTable=ref([]);
-const tableLoading=ref(false)
-const treeLoading=ref(false)
-const copywbstree=ref(null)
+const projectId = ref(props.projectId)
+const contractId = ref(props.contractId)
+const classify = ref(props.classify)
+const tree_AutoExpandKeys = ref(props.tree_AutoExpandKeys)
+const treenodeDataInfo = ref(props.treenodeDataInfo)
+const copyItems = ref(props.copyItems)
+const CopyModalType = ref(props.CopyModalType)
+const copyModalTable = ref([])
+const tableLoading = ref(false)
+const treeLoading = ref(false)
+const copywbstree = ref(null)
 //监听
 watch(() => [
     props.projectId,
     props.contractId,
-    props.CopyModalType
+    props.CopyModalType,
 
 ], ([pid, cid, CopyModaltype]) => {
     projectId.value = pid
@@ -82,48 +82,48 @@ watch(() => [
 //树加载完成
 const ElTreeNodeLoading = () => {
     treeLoading.value = false
-    console.log(tree_AutoExpandKeys.value,'tree_AutoExpandKeys');
+    console.log(tree_AutoExpandKeys.value, 'tree_AutoExpandKeys')
 }
 const wbstreeKey = ref(Math.random())
-const nodeItemInfo=ref({})
-const nodeDataInfo=ref({})
+const nodeItemInfo = ref({})
+const nodeDataInfo = ref({})
 
 //懒加载的数据
-const treeLoadNode = async ({node, item, level},resolve) => {
-    let contractIdRelation = '', parentId = '', primaryKeyId = '';
+const treeLoadNode = async ({ node, item, level }, resolve) => {
+    let contractIdRelation = '', parentId = '', primaryKeyId = ''
     if (level !== 0) {
-        const nodeData = getObjValue(item);
+        const nodeData = getObjValue(item)
         contractIdRelation = nodeData?.contractIdRelation || ''
         parentId = contractIdRelation ? nodeData?.primaryKeyId : nodeData?.id
         primaryKeyId = nodeData?.id || ''
     }
     //获取数据
-    const {data} = await queryApi.queryWbsTreeData({
+    const { data } = await queryApi.queryWbsTreeData({
         contractId: contractId.value || '',
         contractIdRelation,
         primaryKeyId,
         parentId,
-        classifyType: classify.value
+        classifyType: classify.value,
     })
     resolve(getArrValue(data))
 }
 
 
 //树被点击
-const wbsElTreeClick = ({node, data, keys}) => {
+const wbsElTreeClick = ({ node, data, keys }) => {
     nodeItemInfo.value = node
     nodeDataInfo.value = data
     searchTabledata()
 }
 const searchTabledata = async () => {
     copyModalTable.value = []
-    const info = nodeDataInfo.value;
+    const info = nodeDataInfo.value
     tableLoading.value = true
-    const {error, code, data} = await wbsApi.searchNodeAllTable({
+    const { error, code, data } = await wbsApi.searchNodeAllTable({
         projectId: projectId.value,
         contractId: contractId.value,
         primaryKeyId: info['primaryKeyId'],
-        type: classify.value
+        type: classify.value,
     })
     //处理数据
     tableLoading.value = false
@@ -135,13 +135,9 @@ const searchTabledata = async () => {
 }
 //勾选复制本表
 const copyModalTableCheck = async (item) => {
-    console.log('复制本表', item);
-}
-const treeautokeys=ref([])
-
-const changeCopyModalType=(val)=>{
-
+    console.log('复制本表', item)
 }
+const treeautokeys = ref([])
 </script>
 
 <style>

+ 38 - 33
src/views/data-fill/collapse-form/test-data.vue

@@ -1,22 +1,28 @@
 <template>
     <div>
         <div class="flex-1" style="padding-left:20px">
-            <HcNewSwitch :datas="tabTypeTab" :keys="tabTypeKey" :round="false" size="default"
-                         @change="tabTypeChange"/>
-            <el-select v-model="testReportId" :loading="insertDataSelectoading" :placeholder="placeholderType"
-                       class="ml-2 w-80"
-                       clearable @change="testReportIdchange">
-                <el-option v-for="item in testReportData" :key="item.pKeyId" :label="item['nodeName']"
-                           :value="item['pKeyId']"/>
+            <HcNewSwitch
+                :datas="tabTypeTab" :keys="tabTypeKey" :round="false" size="default"
+                @change="tabTypeChange"
+            />
+            <el-select
+                v-model="testReportId" :loading="insertDataSelectoading" :placeholder="placeholderType"
+                class="ml-2 w-80"
+                clearable @change="testReportIdchange"
+            >
+                <el-option
+                    v-for="item in testReportData" :key="item.pKeyId" :label="item.nodeName"
+                    :value="item.pKeyId"
+                />
             </el-select>
         </div>
         <div class="dialog-table-box">
             <div class="copy-node-many-table">
                 <el-scrollbar v-loading="insertDataTableLoading">
                     <el-table :data="insertDataTable" border stripe @selection-change="insertDataTableCheck">
-                        <el-table-column type="selection" width="55"/>
-                        <el-table-column label="字段名称" prop="key"/>
-                        <el-table-column label="数值" prop="value"/>
+                        <el-table-column type="selection" width="55" />
+                        <el-table-column label="字段名称" prop="key" />
+                        <el-table-column label="数值" prop="value" />
                     </el-table>
                 </el-scrollbar>
             </div>
@@ -25,9 +31,9 @@
 </template>
 
 <script setup>
-import {ref, watch, onMounted} from "vue";
-import {getArrValue, getObjValue, setPosInsert} from "js-fast-way"
-import dataApi from "~api/tentative/detect/test";
+import { onMounted, ref, watch } from 'vue'
+import { getArrValue, getObjValue, setPosInsert } from 'js-fast-way'
+import dataApi from '~api/tentative/detect/test'
 
 const props = defineProps({
     projectId: [String, Number],
@@ -36,9 +42,11 @@ const props = defineProps({
     treeId: [String, Number],
 })
 
+//事件
+const emit = defineEmits(['change'])
 //参数变量
-const projectId = ref(props.projectId);
-const contractId = ref(props.contractId);
+const projectId = ref(props.projectId)
+const contractId = ref(props.contractId)
 const table_id = ref(props.tableId)
 const tree_id = ref(props.treeId)
 
@@ -60,17 +68,14 @@ onMounted(() => {
     getSearchNodeTables()
 })
 
-//事件
-const emit = defineEmits(['change'])
-
 //类型tab数据和相关处理
 const tabTypeKey = ref('2')
 const tabTypeTab = ref([
-    {key: '1', name: '试验记录表'},
-    {key: '2', name: '试验报告单'},
-]);
+    { key: '1', name: '试验记录表' },
+    { key: '2', name: '试验报告单' },
+])
 const placeholderType = ref('试验报告单')
-const tabTypeChange = ({key}) => {
+const tabTypeChange = ({ key }) => {
     tabTypeKey.value = key
     if (tabTypeKey.value === '1') {
         placeholderType.value = '试验记录表'
@@ -85,13 +90,13 @@ const testReportData = ref([])
 
 const getSearchNodeTables = async () => {
     insertDataSelectoading.value = true
-    const {error, code, data} = await dataApi.searchNodeTables({
+    const { error, code, data } = await dataApi.searchNodeTables({
         id: table_id.value,
         projectId: projectId.value,
         contractId: contractId.value,
         primaryKeyId: tree_id.value,
         // type: authBtnTabKey.value,
-        tableType: tabTypeKey.value
+        tableType: tabTypeKey.value,
     })
     //处理数据
     insertDataSelectoading.value = false
@@ -106,7 +111,7 @@ const getSearchNodeTables = async () => {
     }
 }
 
-const testReportId = ref('');
+const testReportId = ref('')
 const checPkd = ref('')
 const testReportIdchange = (key) => {
     testReportData.value.forEach((item) => {
@@ -126,8 +131,8 @@ const insertDataTableCheck = (val) => {
 
 //获取试验表中的data数据接口:
 const getBussddataInfotrialData = async () => {
-    insertDataTableLoading.value = true;
-    const {error, code, data} = await dataApi.getBussddataInfotrialList({
+    insertDataTableLoading.value = true
+    const { error, code, data } = await dataApi.getBussddataInfotrialList({
         // id:testReportId.value,
         id: table_id.value,
         pkeyId: testReportId.value,
@@ -139,7 +144,7 @@ const getBussddataInfotrialData = async () => {
         for (let key of Object.keys(arrobj)) {
             arr.push({
                 key: key,
-                value: arrobj[key]
+                value: arrobj[key],
             })
         }
         insertDataTable.value = arr
@@ -149,7 +154,7 @@ const getBussddataInfotrialData = async () => {
 }
 
 //确定关联试验数据数据
-const submitinsertData = ({KeyName, startPos, endPos, pkeyId}, itemForm) => {
+const submitinsertData = ({ KeyName, startPos, endPos, pkeyId }, itemForm) => {
     if (multipleSelection.value.length > 0) {
         const val = []
         multipleSelection.value.forEach((item) => {
@@ -157,16 +162,16 @@ const submitinsertData = ({KeyName, startPos, endPos, pkeyId}, itemForm) => {
         })
         const newval = val.join('、')
         const formValue = setPosInsert(startPos, endPos, itemForm, newval)
-        let posVal = startPos + newval.length;
-        return {code: 200, val: formValue, posVal}
+        let posVal = startPos + newval.length
+        return { code: 200, val: formValue, posVal }
     } else {
         window?.$message?.warning('请选择你要关联的数据')
-        return {code: 300, val: '', posVal: ''}
+        return { code: 300, val: '', posVal: '' }
     }
 }
 
 // 暴露出去
 defineExpose({
-    submitinsertData
+    submitinsertData,
 })
 </script>

+ 1 - 1
src/views/data-fill/query.vue

@@ -332,7 +332,7 @@ const searchTreeClick = async () => {
         searchTreeHeight.value = document.getElementById('hc-tree-scrollbar').offsetHeight
         isSearchTree.value = true
         //treeLoading.value = true
-        getSearchTreeData()
+        getSearchTreeData().then()
     } else {
         isSearchTree.value = false
     }

この差分においてかなりの量のファイルが変更されているため、一部のファイルを表示していません