|
@@ -1,28 +1,37 @@
|
|
|
<template>
|
|
|
<div class="data-fill-list-box">
|
|
|
<el-collapse v-model="ActiveKey" accordion @change="CollapseChange">
|
|
|
- <template v-for="(item,index) in listDatas" :key="item?.pkeyId">
|
|
|
- <el-collapse-item :id="`item-${index}-${item?.pkeyId}`" :name="`item-${index}-${item?.pkeyId}`">
|
|
|
+ <template v-for="(item, index) in listDatas" :key="item?.id">
|
|
|
+ <el-collapse-item :id="`item-${index}-${item?.id}`" :name="`item-${index}-${item?.id}`">
|
|
|
<template #title>
|
|
|
<div class="hc-collapse-item-header">
|
|
|
- <div class="text-lg truncate item-title"> {{ item.nodeName }}</div>
|
|
|
+ <div class="text-lg truncate item-title">
|
|
|
+ {{ item.tableName }}
|
|
|
+ </div>
|
|
|
<div class="hc-extra-text-box">
|
|
|
- <el-button :loading="copyClickLoading" plain type="primary" @click.stop="copyClick(item,index)">复制本表</el-button>
|
|
|
+ <el-button :loading="copyClickLoading" plain type="primary" @click.stop="copyClick(item, index)">
|
|
|
+ 复制本表
|
|
|
+ </el-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
<div class="data-fill-list-item-content">
|
|
|
- <TableFormItem v-if="item.isTableRender"
|
|
|
- :ref="(el) => setItemRefs(el, item)"
|
|
|
- :classify="classifys"
|
|
|
- :datas="changeFormDatas(item?.pkeyId, 'collapse')"
|
|
|
- :kid="item?.pkeyId"
|
|
|
- :nodeName="item.nodeName"
|
|
|
- :pid="`table-form-${item?.pkeyId}`"
|
|
|
- :tid="treeId"
|
|
|
- @excelBodyTap="excelTableFormClick($event)"
|
|
|
- @render="tableFormRender($event, item, index)"
|
|
|
- @rightTap="tableFormRightTap($event, index)"
|
|
|
+ <TableFormItem
|
|
|
+ v-if="item.isTableRender"
|
|
|
+ :ref="(el) => setItemRefs(el, item)"
|
|
|
+ :classify="classifys"
|
|
|
+ :datas="changeFormDatas(item?.id, 'collapse')"
|
|
|
+ :kid="item?.id"
|
|
|
+ :node-name="item.nodeName"
|
|
|
+ :node-type="item.nodeType"
|
|
|
+ :pid="`table-form-${item?.id}`"
|
|
|
+ :area-id="areaId"
|
|
|
+ :table-id="item.tableId"
|
|
|
+ :agreement-id="agreementId"
|
|
|
+ style="width: 100%;"
|
|
|
+ @excelBodyTap="excelTableFormClick($event)"
|
|
|
+ @render="tableFormRender($event, item, index)"
|
|
|
+ @rightTap="tableFormRightTap($event, index)"
|
|
|
/>
|
|
|
</div>
|
|
|
</el-collapse-item>
|
|
@@ -32,70 +41,83 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
-import {ref, watch, nextTick, onActivated, onDeactivated, onMounted, onUnmounted} from "vue";
|
|
|
-import HTableForm from "~src/plugins/HTableForm"
|
|
|
-import {useAppStore} from "~src/store";
|
|
|
-import wbsApi from "~api/data-fill/wbs"
|
|
|
-import TableFormItem from "./form-item.vue"
|
|
|
+import { nextTick, onActivated, onDeactivated, onMounted, onUnmounted, ref, watch } from 'vue'
|
|
|
+import HTableForm from '~src/plugins/HTableForm'
|
|
|
+import { useAppStore } from '~src/store'
|
|
|
+import landApi from '~api/agree/land.js'
|
|
|
+import TableFormItem from './form-item.vue'
|
|
|
import {
|
|
|
- getArrValue, getObjValue, getObjVal,
|
|
|
- isNullES, deepClone, arrIndex, setPosRange
|
|
|
-} from "js-fast-way"
|
|
|
-
|
|
|
-//初始变量
|
|
|
-const useAppState = useAppStore()
|
|
|
+ arrIndex, deepClone, getArrValue,
|
|
|
+ getObjVal, getObjValue, isNullES, setPosRange,
|
|
|
+} from 'js-fast-way'
|
|
|
|
|
|
//参数
|
|
|
const props = defineProps({
|
|
|
datas: {
|
|
|
type: Array,
|
|
|
- default: () => ([])
|
|
|
+ default: () => ([]),
|
|
|
},
|
|
|
classify: {
|
|
|
type: [String, Number],
|
|
|
- default: ''
|
|
|
+ default: '',
|
|
|
},
|
|
|
status: {
|
|
|
type: [String, Number],
|
|
|
- default: ''
|
|
|
+ default: '',
|
|
|
},
|
|
|
primaryKeyId: {
|
|
|
type: [String, Number],
|
|
|
- default: ''
|
|
|
+ default: '',
|
|
|
},
|
|
|
contractId: {
|
|
|
type: [String, Number],
|
|
|
- default: ''
|
|
|
+ default: '',
|
|
|
},
|
|
|
drawType: {
|
|
|
type: Boolean,
|
|
|
- default: false
|
|
|
+ default: false,
|
|
|
},
|
|
|
wbsTempId: {
|
|
|
type: [String, Number],
|
|
|
- default: ''
|
|
|
+ default: '',
|
|
|
},
|
|
|
tenantId: {
|
|
|
type: [String, Number],
|
|
|
- default: ''
|
|
|
+ default: '',
|
|
|
},
|
|
|
wbsType: {
|
|
|
type: [String, Number],
|
|
|
- default: ''
|
|
|
+ default: '',
|
|
|
+ },
|
|
|
+ areaId:{
|
|
|
+ type: String,
|
|
|
+ default: '',
|
|
|
+ }, //当前树节点
|
|
|
+ agreementId:{
|
|
|
+ type: [String, Number],
|
|
|
+ default: '',
|
|
|
},
|
|
|
})
|
|
|
|
|
|
+//事件
|
|
|
+const emit = defineEmits(['renew', 'offsetTop'])
|
|
|
+
|
|
|
+//初始变量
|
|
|
+const useAppState = useAppStore()
|
|
|
+
|
|
|
//全局变量
|
|
|
-const projectId = ref(useAppState.projectId);
|
|
|
+const projectId = ref(useAppState.projectId)
|
|
|
const contract_id = ref(props.contractId)
|
|
|
const treeId = ref(props.primaryKeyId)
|
|
|
const classifys = ref(props.classify)
|
|
|
-const wbsTemp_id = ref(props.wbsTempId);
|
|
|
-const tenant_id = ref(props.tenantId);
|
|
|
-const wbs_type = ref(props.wbsType);
|
|
|
+const wbsTemp_id = ref(props.wbsTempId)
|
|
|
+const tenant_id = ref(props.tenantId)
|
|
|
+const wbs_type = ref(props.wbsType)
|
|
|
const isStatus = ref(parseInt(props.status))
|
|
|
const listDatas = ref([])
|
|
|
const draw_type = ref(props.drawType)
|
|
|
+const areaId = ref(props.areaId)
|
|
|
+const agreementId = ref(props.agreementId)
|
|
|
|
|
|
|
|
|
//表单变量
|
|
@@ -105,24 +127,24 @@ const formparentId = ref('')
|
|
|
|
|
|
//处理ref
|
|
|
const itemRefs = ref([])
|
|
|
-const setItemRefs = (el, {pkeyId}) => {
|
|
|
+const setItemRefs = (el, { id }) => {
|
|
|
if (el) {
|
|
|
- let index = arrIndex(itemRefs.value, 'pkeyId', pkeyId)
|
|
|
+ let index = arrIndex(itemRefs.value, 'pKeyId', id)
|
|
|
if (index !== -1) {
|
|
|
itemRefs.value[index].ref = el
|
|
|
} else {
|
|
|
itemRefs.value.push({
|
|
|
- pkeyId: pkeyId,
|
|
|
- ref: el
|
|
|
- });
|
|
|
+ pKeyId: id,
|
|
|
+ ref: el,
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//处理表单的ref
|
|
|
-const setSpliceItemRefs = async ({pkeyId}) => {
|
|
|
+const setSpliceItemRefs = async ({ pKeyId }) => {
|
|
|
const refs = itemRefs.value
|
|
|
- let index = arrIndex(refs, 'pkeyId', pkeyId)
|
|
|
+ let index = arrIndex(refs, 'pKeyId', pKeyId)
|
|
|
if (index !== -1) {
|
|
|
refs.splice(index, 1)
|
|
|
itemRefs.value = refs
|
|
@@ -130,25 +152,22 @@ const setSpliceItemRefs = async ({pkeyId}) => {
|
|
|
}
|
|
|
|
|
|
const closeIconArr = [
|
|
|
- {key: 'reduction', icon: 'picture-in-picture-2', name: '还原到面板内,并自动展开面板'}
|
|
|
+ { key: 'reduction', icon: 'picture-in-picture-2', name: '还原到面板内,并自动展开面板' },
|
|
|
]
|
|
|
|
|
|
-//事件
|
|
|
-const emit = defineEmits(['renew', 'offsetTop'])
|
|
|
-
|
|
|
//组件参数变量
|
|
|
-const apis = ref({
|
|
|
- dataInfo: wbsApi.getBussDataInfo,
|
|
|
- bussCols: wbsApi.getHtmlBussCols,
|
|
|
- excelHtml: wbsApi.getExcelHtml
|
|
|
-})
|
|
|
+// const apis = ref({
|
|
|
+// dataInfo: wbsApi.getBussDataInfo,
|
|
|
+// bussCols: wbsApi.getHtmlBussCols,
|
|
|
+// excelHtml: wbsApi.getExcelHtml,
|
|
|
+// })
|
|
|
|
|
|
//深度监听数据
|
|
|
watch(() => [
|
|
|
props.datas,
|
|
|
], ([datas]) => {
|
|
|
setFormDataNum(datas)
|
|
|
-}, {deep: true})
|
|
|
+}, { deep: true })
|
|
|
|
|
|
//监听变量值
|
|
|
watch(() => [
|
|
@@ -160,7 +179,9 @@ watch(() => [
|
|
|
props.status,
|
|
|
props.classify,
|
|
|
props.primaryKeyId,
|
|
|
-], ([pid, cid, temp_id, tid, type, status, class_id, tree_id]) => {
|
|
|
+ props.areaId,
|
|
|
+ props.agreementId,
|
|
|
+], ([pid, cid, temp_id, tid, type, status, class_id, tree_id, area_id, agreement_id]) => {
|
|
|
projectId.value = pid
|
|
|
contract_id.value = cid
|
|
|
wbsTemp_id.value = temp_id
|
|
@@ -169,25 +190,27 @@ watch(() => [
|
|
|
isStatus.value = parseInt(status)
|
|
|
classifys.value = class_id
|
|
|
treeId.value = tree_id
|
|
|
+ areaId.value = area_id
|
|
|
+ agreementId.value = agreement_id
|
|
|
})
|
|
|
|
|
|
//渲染完成
|
|
|
onMounted(() => {
|
|
|
setFormDataNum(props.datas)
|
|
|
setTableFormMenu(useAppState.projectInfo)
|
|
|
- const {offsetHeight} = document.body
|
|
|
+ const { offsetHeight } = document.body
|
|
|
DragModalHeight.value = offsetHeight - 200
|
|
|
setMountOnEventKey()
|
|
|
})
|
|
|
|
|
|
//处理变动的数据
|
|
|
const changeFormData = ref({
|
|
|
- 'window': [],
|
|
|
- 'collapse': [],
|
|
|
+ window: [],
|
|
|
+ collapse: [],
|
|
|
})
|
|
|
-const changeFormDatas = (pkeyId, type) => {
|
|
|
+const changeFormDatas = (pKeyId, type) => {
|
|
|
const changeData = changeFormData.value[type]
|
|
|
- const index = arrIndex(changeData, 'pkeyId', pkeyId)
|
|
|
+ const index = arrIndex(changeData, 'pKeyId', pKeyId)
|
|
|
if (index !== -1) {
|
|
|
return changeData[index]
|
|
|
} else {
|
|
@@ -196,11 +219,11 @@ const changeFormDatas = (pkeyId, type) => {
|
|
|
}
|
|
|
|
|
|
//设置变动的数据
|
|
|
-const setChangeFormDatas = async (pkeyId, type) => {
|
|
|
- const refs = await getFormRef(pkeyId)
|
|
|
+const setChangeFormDatas = async (pKeyId, type) => {
|
|
|
+ const refs = await getFormRef(pKeyId)
|
|
|
const formData = refs?.getFormData()
|
|
|
const changeData = changeFormData.value[type]
|
|
|
- const index = arrIndex(changeData, 'pkeyId', pkeyId)
|
|
|
+ const index = arrIndex(changeData, 'pKeyId', pKeyId)
|
|
|
if (index !== -1) {
|
|
|
changeData[index] = formData
|
|
|
} else {
|
|
@@ -210,15 +233,17 @@ const setChangeFormDatas = async (pkeyId, type) => {
|
|
|
}
|
|
|
|
|
|
//展开事件
|
|
|
+
|
|
|
const ActiveKey = ref('')
|
|
|
const CollapseChange = (name) => {
|
|
|
ActiveKey.value = name
|
|
|
let index = getCollapseItemIndex(name)
|
|
|
if (index > -1) {
|
|
|
- getOffsetTop(name);
|
|
|
+ getOffsetTop(name)
|
|
|
const item = listDatas.value[index]
|
|
|
- formKeyIds.value = setToString(item.pkeyId)
|
|
|
+ formKeyIds.value = setToString(item.id)
|
|
|
formparentId.value = setToString(item.parentId)
|
|
|
+
|
|
|
nextTick(() => {
|
|
|
if (!item.isTableRender) {
|
|
|
item.isTableRender = true
|
|
@@ -235,9 +260,9 @@ const CollapseChange = (name) => {
|
|
|
const setFormDataNum = (datas) => {
|
|
|
itemRefs.value = []
|
|
|
ActiveKey.value = ''
|
|
|
- let newArr = [];
|
|
|
+ let newArr = []
|
|
|
for (let i = 0; i < datas.length; i++) {
|
|
|
- newArr.push({isCollapseLoad: false})
|
|
|
+ newArr.push({ isCollapseLoad: false })
|
|
|
}
|
|
|
formDataList.value = newArr
|
|
|
listDatas.value = deepClone(datas)
|
|
@@ -262,24 +287,24 @@ const setTableFormMenu = (info) => {
|
|
|
let newArr = [], infos = getObjValue(info)
|
|
|
const isOpen = infos['isOpenRandomNumber'] ?? 0
|
|
|
if (isOpen === 1 && isStatus.value !== 3) {
|
|
|
- newArr.push({label: '插入设计值/频率', key: "design"})
|
|
|
+ newArr.push({ label: '插入设计值/频率', key: 'design' })
|
|
|
}
|
|
|
- newArr.push({label: '插入特殊字符', key: "special"})
|
|
|
- newArr.push({label: '关联试验数据', key: "test"})
|
|
|
- newArr.push({label: '关联试验文件', key: "file"})
|
|
|
- newArr.push({label: '公式参数', key: "formula"})
|
|
|
+ newArr.push({ label: '插入特殊字符', key: 'special' })
|
|
|
+ newArr.push({ label: '关联试验数据', key: 'test' })
|
|
|
+ newArr.push({ label: '关联试验文件', key: 'file' })
|
|
|
+ newArr.push({ label: '公式参数', key: 'formula' })
|
|
|
tableFormMenu.value = newArr
|
|
|
}
|
|
|
|
|
|
//鼠标右键事件
|
|
|
-const tableFormRightTap = ({event, KeyName, startPos, endPos, pkeyId}, index) => {
|
|
|
+const tableFormRightTap = ({ event, KeyName, startPos, endPos, pkeyId }, index) => {
|
|
|
//存储临时信息
|
|
|
- tableFormItemNode.value = {KeyName, index, startPos, endPos, pkeyId}
|
|
|
+ tableFormItemNode.value = { KeyName, index, startPos, endPos, pkeyId }
|
|
|
contextMenuRef.value?.showMenu(event, false) //展开菜单
|
|
|
}
|
|
|
|
|
|
//鼠标右键菜单被点击
|
|
|
-const handleMenuSelect = ({key}) => {
|
|
|
+const handleMenuSelect = ({ key }) => {
|
|
|
if (key === 'design') {
|
|
|
setInitDesignForm()
|
|
|
designModalLoading.value = false
|
|
@@ -291,7 +316,7 @@ const handleMenuSelect = ({key}) => {
|
|
|
testModal.value = true
|
|
|
} else if (key === 'file') {
|
|
|
fileModalLoading.value = false
|
|
|
- fileModal.value = true;
|
|
|
+ fileModal.value = true
|
|
|
} else if (key === 'formula') {
|
|
|
formulaModalLoading.value = false
|
|
|
formulaModal.value = true
|
|
@@ -308,18 +333,18 @@ const setInitDesignForm = () => {
|
|
|
formDesignModel.value = {
|
|
|
type: 1, design: '', size: '',
|
|
|
dev: '', key: '', capacity: '',
|
|
|
- pass: '', pkId: ''
|
|
|
+ pass: '', pkId: '',
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//设计值频率计算
|
|
|
const designModalLoading = ref(false)
|
|
|
const designModalSave = async () => {
|
|
|
- const {pkeyId, KeyName} = tableFormItemNode.value
|
|
|
+ const { pkeyId, KeyName } = tableFormItemNode.value
|
|
|
if (pkeyId) {
|
|
|
designModalLoading.value = true
|
|
|
//const {design, size} = formDesignModel.value
|
|
|
- const {error, code, data} = await wbsApi.queryFormulaRange({
|
|
|
+ const { error, code, data } = await wbsApi.queryFormulaRange({
|
|
|
...formDesignModel.value,
|
|
|
// dev: (!design && !size) ? '±5': '',
|
|
|
key: KeyName,
|
|
@@ -373,11 +398,11 @@ const specialRef = ref(null)
|
|
|
const specialNodeClick = async () => {
|
|
|
specialModalLoading.value = true
|
|
|
const itemNode = tableFormItemNode.value
|
|
|
- const {KeyName, pkeyId} = itemNode
|
|
|
+ const { KeyName, pkeyId } = itemNode
|
|
|
try {
|
|
|
const refs = await getFormRef(pkeyId)
|
|
|
const itemFormData = refs?.getFormData()
|
|
|
- const {code, val, posVal} = await specialRef.value?.getSpecialNode(itemNode, itemFormData[KeyName])
|
|
|
+ const { code, val, posVal } = await specialRef.value?.getSpecialNode(itemNode, itemFormData[KeyName])
|
|
|
if (code === 200 && val) {
|
|
|
itemFormData[KeyName] = val
|
|
|
refs?.setFormData(itemFormData)
|
|
@@ -407,7 +432,7 @@ const testModalLoading = ref(false)
|
|
|
//关联试验数据被点击
|
|
|
const itinsertTableId = ref('')
|
|
|
const itinsertTreeId = ref('')
|
|
|
-const testTableRowName = ({row, treeId}) => {
|
|
|
+const testTableRowName = ({ row, treeId }) => {
|
|
|
itinsertTableId.value = row.id
|
|
|
itinsertTreeId.value = treeId
|
|
|
insertDataLoading.value = false
|
|
@@ -421,19 +446,19 @@ const testModalClose = () => {
|
|
|
}
|
|
|
|
|
|
//选择要插入的实验数据
|
|
|
-const insertDataShow = ref(false);
|
|
|
-const insertDataLoading = ref(false);
|
|
|
+const insertDataShow = ref(false)
|
|
|
+const insertDataLoading = ref(false)
|
|
|
|
|
|
//确定关联试验数据数据
|
|
|
const insertDataRef = ref(null)
|
|
|
const submitinsertData = async () => {
|
|
|
insertDataLoading.value = true
|
|
|
const itemNode = tableFormItemNode.value
|
|
|
- const {KeyName, pkeyId} = itemNode
|
|
|
+ const { KeyName, pkeyId } = itemNode
|
|
|
try {
|
|
|
const refs = await getFormRef(pkeyId)
|
|
|
const itemFormData = refs?.getFormData()
|
|
|
- const {code, val, posVal} = await insertDataRef.value?.submitinsertData(itemNode, itemFormData[KeyName])
|
|
|
+ const { code, val, posVal } = await insertDataRef.value?.submitinsertData(itemNode, itemFormData[KeyName])
|
|
|
if (code === 200 && val) {
|
|
|
itemFormData[KeyName] = val
|
|
|
refs?.setFormData(itemFormData)
|
|
@@ -505,7 +530,7 @@ const windowClick = async (item, indexs) => {
|
|
|
const formSize = getTableFormSize(item?.pkeyId)
|
|
|
const newTableForm = {
|
|
|
...setInitDragModalTableForm(item, indexs),
|
|
|
- ...formSize
|
|
|
+ ...formSize,
|
|
|
}
|
|
|
await setChangeFormDatas(item?.pkeyId, 'window')
|
|
|
item.isWindow = true
|
|
@@ -549,12 +574,12 @@ const setInitDragModalTableForm = (item, index) => {
|
|
|
title: item.nodeName,
|
|
|
isShow: true,
|
|
|
index: index,
|
|
|
- item: item
|
|
|
+ item: item,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//关闭窗口
|
|
|
-const TableFormClose = async ({pkeyId, index}, indexs) => {
|
|
|
+const TableFormClose = async ({ pkeyId, index }, indexs) => {
|
|
|
const list = deepClone(DragModalTableForm.value)
|
|
|
//取表单的数据
|
|
|
await setChangeFormDatas(pkeyId, 'collapse')
|
|
@@ -565,21 +590,21 @@ const TableFormClose = async ({pkeyId, index}, indexs) => {
|
|
|
}
|
|
|
|
|
|
const dragNodeMoreMenu = [
|
|
|
- {key: 'save', icon: 'save-2', name: '保存'},
|
|
|
- {key: 'preview', icon: 'eye', name: '预览'},
|
|
|
+ { key: 'save', icon: 'save-2', name: '保存' },
|
|
|
+ { key: 'preview', icon: 'eye', name: '预览' },
|
|
|
]
|
|
|
|
|
|
//还原窗口
|
|
|
const closeIconTap = async (event, item, indexs) => {
|
|
|
- const {index, pkeyId} = item
|
|
|
+ const { index, pkeyId } = item
|
|
|
let KeyId = `item-${index}-${pkeyId}`
|
|
|
await TableFormClose(item, indexs)
|
|
|
ActiveKey.value = KeyId
|
|
|
}
|
|
|
|
|
|
//菜单被点击
|
|
|
-const dragNodeMoreMenuTap = ({key}, items) => {
|
|
|
- const {item} = items
|
|
|
+const dragNodeMoreMenuTap = ({ key }, items) => {
|
|
|
+ const { item } = items
|
|
|
if (key === 'save') {
|
|
|
if (item?.isTableForm) {
|
|
|
tableFormSaveClick(item, items)
|
|
@@ -597,11 +622,11 @@ const dragNodeMoreMenuTap = ({key}, items) => {
|
|
|
|
|
|
//删除本表
|
|
|
const tableFormDelLoading = ref(false)
|
|
|
-const delClick = async ({pkeyId}) => {
|
|
|
+const delClick = async ({ pkeyId }) => {
|
|
|
if (pkeyId) {
|
|
|
if (isStatus.value !== 3) {
|
|
|
tableFormDelLoading.value = true
|
|
|
- const {error, code} = await wbsApi.removeBussTabInfo({
|
|
|
+ const { error, code } = await wbsApi.removeBussTabInfo({
|
|
|
pkeyid: pkeyId,
|
|
|
classify: classifys.value,
|
|
|
})
|
|
@@ -620,17 +645,17 @@ const delClick = async ({pkeyId}) => {
|
|
|
}
|
|
|
}
|
|
|
//复制本表相关
|
|
|
-const showcopyModal=ref(false)
|
|
|
-const copyRefs=ref(null)
|
|
|
-const copyModalClose=()=>{
|
|
|
+const showcopyModal = ref(false)
|
|
|
+const copyRefs = ref(null)
|
|
|
+const copyModalClose = ()=>{
|
|
|
// copyModal.value=false
|
|
|
}
|
|
|
-const CopyModalType=ref('1')
|
|
|
+const CopyModalType = ref('1')
|
|
|
|
|
|
-const copySaveClick=async()=>{
|
|
|
+const copySaveClick = async ()=>{
|
|
|
//本节点复制
|
|
|
- if(CopyModalType.value==='2'){
|
|
|
- const {pkeyId, isTableRender, isTableForm} = copyItems.value
|
|
|
+ if (CopyModalType.value === '2') {
|
|
|
+ const { pkeyId, isTableRender, isTableForm } = copyItems.value
|
|
|
if (pkeyId) {
|
|
|
if (isStatus.value !== 3) {
|
|
|
if (!isTableRender) {
|
|
@@ -655,7 +680,7 @@ const copySaveClick=async()=>{
|
|
|
} else {
|
|
|
window?.$message?.warning('pkeyId为空')
|
|
|
}
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
window?.$message?.warning('暂无相关接口')
|
|
|
}
|
|
|
}
|
|
@@ -663,24 +688,24 @@ const copySaveClick=async()=>{
|
|
|
const copyClickModalLoading = ref(false)
|
|
|
const copyClickLoading = ref(false)
|
|
|
const copyClick = async (items) => {
|
|
|
- const {pkeyId, isTableRender, isTableForm} = items
|
|
|
- if (pkeyId) {
|
|
|
+ const { id, isTableRender, isTableForm } = items
|
|
|
+ if (id) {
|
|
|
if (isStatus.value !== 3) {
|
|
|
if (!isTableRender) {
|
|
|
- await copeBussTab(pkeyId)
|
|
|
+ await copeBussTab(id)
|
|
|
} else if (!isTableForm) {
|
|
|
window?.$message?.warning('暂无表单数据')
|
|
|
} else if (isTableRender) {
|
|
|
copyClickLoading.value = true
|
|
|
const isSave = await saveExcelBussData(items, null, false)
|
|
|
if (isSave) {
|
|
|
- await copeBussTab(pkeyId)
|
|
|
+ await copeBussTab(id)
|
|
|
} else {
|
|
|
copyClickLoading.value = false
|
|
|
window?.$message?.warning('复制本表操作失败')
|
|
|
}
|
|
|
} else {
|
|
|
- window?.$message?.warning(`数据异常了, isRenderTableForm: ${isTableRender}, isTableForm: ${isTableForm}, pkeyIds:${pkeyId}`)
|
|
|
+ window?.$message?.warning(`数据异常了, isRenderTableForm: ${isTableRender}, isTableForm: ${isTableForm}, pkeyIds:${id}`)
|
|
|
}
|
|
|
} else {
|
|
|
window?.$message?.warning('已上报的资料,不允许复制')
|
|
@@ -689,7 +714,7 @@ const copyClick = async (items) => {
|
|
|
window?.$message?.warning('pkeyId为空')
|
|
|
}
|
|
|
}
|
|
|
-const copyItems=ref([])
|
|
|
+const copyItems = ref([])
|
|
|
//跨节点复制弹窗
|
|
|
// const copyClick = (items) => {
|
|
|
// showcopyModal.value=true
|
|
@@ -700,8 +725,8 @@ const copyItems=ref([])
|
|
|
//复制表的请求
|
|
|
const copeBussTab = async (pkeyId) => {
|
|
|
copyClickLoading.value = true
|
|
|
- const {error, code} = await wbsApi.copeBussTab({
|
|
|
- pkeyId: pkeyId
|
|
|
+ const { error, code } = await landApi.copeTab({
|
|
|
+ id: pkeyId,
|
|
|
})
|
|
|
copyClickLoading.value = false
|
|
|
if (!error && code === 200) {
|
|
@@ -710,33 +735,6 @@ const copeBussTab = async (pkeyId) => {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-//隐藏本表
|
|
|
-const tableFormHideLoading = ref(false)
|
|
|
-const hideClick = async ({pkeyId, isBussShow}) => {
|
|
|
- if (pkeyId) {
|
|
|
- if (isStatus.value !== 3) {
|
|
|
- tableFormHideLoading.value = true
|
|
|
- const bussShow = isBussShow === 2 ? 1 : 2 //状态(1显示 2隐藏)
|
|
|
- const {error, code} = await wbsApi.showBussTab({
|
|
|
- pkeyId: pkeyId,
|
|
|
- status: bussShow
|
|
|
- })
|
|
|
- tableFormHideLoading.value = false
|
|
|
- if (!error && code === 200) {
|
|
|
- window?.$message?.success('操作成功')
|
|
|
- if (bussShow === 2) {
|
|
|
- //判断是否存在窗口,如果存在,就删除窗口
|
|
|
- delWindowRefs(pkeyId)
|
|
|
- }
|
|
|
- renewData()
|
|
|
- }
|
|
|
- } else {
|
|
|
- window?.$message?.warning('已上报的资料,不允许隐藏')
|
|
|
- }
|
|
|
- } else {
|
|
|
- window?.$message?.warning('pkeyId为空')
|
|
|
- }
|
|
|
-}
|
|
|
|
|
|
//预览本表
|
|
|
const tableFormPreviewLoading = ref(false)
|
|
@@ -748,11 +746,11 @@ const previewClick = async (item, dragItem = null) => {
|
|
|
|
|
|
//上传变量
|
|
|
const uploadModal = ref(false)
|
|
|
-const fileListData = ref([]);
|
|
|
+const fileListData = ref([])
|
|
|
const uploadData = ref({})
|
|
|
//上传附件
|
|
|
const uploadClick = (items, index) => {
|
|
|
- const {pkeyId, isTableForm, isTableRender} = items
|
|
|
+ const { pkeyId, isTableForm, isTableRender } = items
|
|
|
const keyName = `item-${index}-${pkeyId}`
|
|
|
if (pkeyId) {
|
|
|
if (isStatus.value !== 3 && isTableForm) {
|
|
@@ -762,7 +760,7 @@ const uploadClick = (items, index) => {
|
|
|
contractId: contract_id.value,
|
|
|
classify: classifys.value,
|
|
|
pkeyId: pkeyId,
|
|
|
- nodeId: treeId.value
|
|
|
+ nodeId: treeId.value,
|
|
|
}
|
|
|
//获取文件列表
|
|
|
getBussFileList(pkeyId)
|
|
@@ -781,8 +779,8 @@ const uploadClick = (items, index) => {
|
|
|
|
|
|
//获取文件列表
|
|
|
const getBussFileList = async (pkeyId) => {
|
|
|
- const {error, code, data} = await wbsApi.getBussFileList({
|
|
|
- pkeyid: pkeyId
|
|
|
+ const { error, code, data } = await wbsApi.getBussFileList({
|
|
|
+ pkeyid: pkeyId,
|
|
|
})
|
|
|
if (!error && code === 200) {
|
|
|
fileListData.value = getArrValue(data)
|
|
@@ -792,7 +790,7 @@ const getBussFileList = async (pkeyId) => {
|
|
|
}
|
|
|
|
|
|
//上传文件
|
|
|
-const uploadChange = async ({type}) => {
|
|
|
+const uploadChange = async ({ type }) => {
|
|
|
if (type === 'success') {
|
|
|
uploadModal.value = false
|
|
|
renewData()
|
|
@@ -825,13 +823,13 @@ const tableFormSaveClick = async (item, dragItem = null) => {
|
|
|
}
|
|
|
|
|
|
//保存表单数据
|
|
|
-const saveExcelBussData = async ({pkeyId}, dragItem = null, showTip = true) => {
|
|
|
+const saveExcelBussData = async ({ id }, dragItem = null, showTip = true) => {
|
|
|
setDragModalLoading(dragItem, '保存中...', true)
|
|
|
- const refs = await getFormRef(pkeyId)
|
|
|
+ const refs = await getFormRef(id)
|
|
|
const isRegExp = await refs?.isFormRegExp()
|
|
|
if (isRegExp) {
|
|
|
const formData = refs?.getFormData()
|
|
|
- const {error, code} = await wbsApi.saveExcelBussData(formData)
|
|
|
+ const { error, code } = await landApi.saveBussData(formData)
|
|
|
setDragModalLoading(dragItem)
|
|
|
if (!error && code === 200) {
|
|
|
if (showTip) {
|
|
@@ -848,10 +846,10 @@ const saveExcelBussData = async ({pkeyId}, dragItem = null, showTip = true) => {
|
|
|
}
|
|
|
|
|
|
//预览PDF
|
|
|
-const getBussPdfInfo = async ({pkeyId}, dragItem = null, showTip = true) => {
|
|
|
+const getBussPdfInfo = async ({ id }, dragItem = null, showTip = true) => {
|
|
|
setDragModalLoading(dragItem, '获取pdf中...', true)
|
|
|
- const {error, code, data} = await wbsApi.getBussPdfInfo({
|
|
|
- pkeyId: pkeyId
|
|
|
+ const { error, code, data } = await landApi.getBussPdfInfo({
|
|
|
+ id: id,
|
|
|
}, false)
|
|
|
setDragModalLoading(dragItem)
|
|
|
if (!error && code === 200) {
|
|
@@ -888,7 +886,7 @@ const setDragModalLoading = (dragItem, text = '保存中...', show = false) => {
|
|
|
//获取表单的ref
|
|
|
const getFormRef = async (pkeyId) => {
|
|
|
const itemRef = itemRefs.value
|
|
|
- const index = arrIndex(itemRef, 'pkeyId', pkeyId)
|
|
|
+ const index = arrIndex(itemRef, 'pKeyId', pkeyId)
|
|
|
return itemRef[index].ref
|
|
|
}
|
|
|
|
|
@@ -940,15 +938,15 @@ const getCollapseItemIndex = (name) => {
|
|
|
const getTableFormSize = (pkeyId) => {
|
|
|
let formId = `table-form-${pkeyId}`
|
|
|
try {
|
|
|
- const {clientWidth, clientHeight} = document.getElementById(formId).children[0]
|
|
|
+ const { clientWidth, clientHeight } = document.getElementById(formId).children[0]
|
|
|
return {
|
|
|
width: (clientWidth + 40) + 'px',
|
|
|
- height: (clientHeight + 80) + 'px'
|
|
|
+ height: (clientHeight + 80) + 'px',
|
|
|
}
|
|
|
} catch {
|
|
|
return {
|
|
|
width: '100%',
|
|
|
- height: '100%'
|
|
|
+ height: '100%',
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1014,51 +1012,51 @@ const setOnFuncFormRef = async () => {
|
|
|
if (!isNullES(pkeyId)) {
|
|
|
return await getFormRef(pkeyId)
|
|
|
} else {
|
|
|
- return;
|
|
|
+ return
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
//获取已渲染的表单
|
|
|
const getFilterFormData = async () => {
|
|
|
- const formArr = formDataList.value;
|
|
|
+ const formArr = formDataList.value
|
|
|
return formArr.filter((item) => {
|
|
|
- return (item.pkeyId ?? '') !== '' && item.isCollapseLoad;
|
|
|
+ return (item.linkId ?? '') !== '' && item.isCollapseLoad
|
|
|
})
|
|
|
}
|
|
|
|
|
|
//获取表单数据
|
|
|
const getFormData = async () => {
|
|
|
- const formArr = await getFilterFormData();
|
|
|
+ const formArr = await getFilterFormData()
|
|
|
//获取表单数据
|
|
|
- let newArr = [];
|
|
|
+ let newArr = []
|
|
|
for (let i = 0; i < formArr.length; i++) {
|
|
|
- const pkeyId = formArr[i].pkeyId
|
|
|
+ const pkeyId = formArr[i].linkId
|
|
|
const refs = await getFormRef(pkeyId)
|
|
|
const form = refs?.getFormData()
|
|
|
- newArr.push({...form})
|
|
|
+ newArr.push({ ...form })
|
|
|
}
|
|
|
- console.log('表单数据', newArr)
|
|
|
+ console.log('表单数据1111', newArr)
|
|
|
return newArr
|
|
|
}
|
|
|
|
|
|
//获取表单效验数据
|
|
|
const getFormRegExpJson = async () => {
|
|
|
- const formArr = await getFilterFormData();
|
|
|
+ const formArr = await getFilterFormData()
|
|
|
const list = listDatas.value
|
|
|
//获取表单数据
|
|
|
- let formRegExpJson = {};
|
|
|
+ let formRegExpJson = {}
|
|
|
for (let i = 0; i < formArr.length; i++) {
|
|
|
- const pkeyId = formArr[i].pkeyId
|
|
|
- const refs = await getFormRef(pkeyId)
|
|
|
+ const pKeyId = formArr[i].linkId
|
|
|
+ const refs = await getFormRef(pKeyId)
|
|
|
const regExp = refs?.getRegExpJson()
|
|
|
const nodeName = refs?.getNodeName()
|
|
|
if (getObjVal(regExp)) {
|
|
|
- const index = arrIndex(list, 'pkeyId', pkeyId)
|
|
|
- formRegExpJson[pkeyId] = {
|
|
|
+ const index = arrIndex(list, 'pKeyId', pKeyId)
|
|
|
+ formRegExpJson[pKeyId] = {
|
|
|
...regExp,
|
|
|
- itemId: `item-${index}-${pkeyId}`,
|
|
|
- nodeName: nodeName
|
|
|
+ itemId: `item-${index}-${pKeyId}`,
|
|
|
+ nodeName: nodeName,
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1067,12 +1065,12 @@ const getFormRegExpJson = async () => {
|
|
|
|
|
|
//获取当前展开项
|
|
|
const getActiveKey = () => {
|
|
|
- return ActiveKey.value;
|
|
|
+ return ActiveKey.value
|
|
|
}
|
|
|
|
|
|
//设置当前展开项
|
|
|
const setActiveKey = (key) => {
|
|
|
- return ActiveKey.value = key;
|
|
|
+ return ActiveKey.value = key
|
|
|
}
|
|
|
|
|
|
// 暴露出去
|
|
@@ -1080,7 +1078,7 @@ defineExpose({
|
|
|
getFormData,
|
|
|
getFormRegExpJson,
|
|
|
getActiveKey,
|
|
|
- setActiveKey
|
|
|
+ setActiveKey,
|
|
|
})
|
|
|
</script>
|
|
|
|