|
@@ -2,12 +2,12 @@
|
|
|
<div class="hc-table-form-content">
|
|
|
<div class="hc-content-box">
|
|
|
<div class="hc-table-forem-box">
|
|
|
- <!--HcTableForm :ref="tableFormRef" scroll @render="tableFormRender"
|
|
|
- @rightTap="tableFormRightTap"/-->
|
|
|
- <el-scrollbar v-if="excelIdVal && isTableForm">
|
|
|
- <div :id="`table-form-${excelIdVal}`" class="hc-excel-table-form-view"></div>
|
|
|
- </el-scrollbar>
|
|
|
- <HcStatus v-else :desc="statusDesc"/>
|
|
|
+ <HcTableForm ref="tableFormRef"
|
|
|
+ :form="tableFormData"
|
|
|
+ :html="excelHtmlData"
|
|
|
+ :loading="loading"
|
|
|
+ :pkey="excelIdVal"
|
|
|
+ @render="tableFormRender"/>
|
|
|
</div>
|
|
|
<div v-if="formLogDataList.length > 1" class="hc-fixed-page">
|
|
|
<el-scrollbar>
|
|
@@ -144,12 +144,13 @@
|
|
|
import {ref, watch, nextTick} from "vue";
|
|
|
import queryApi from '~api/ledger/query';
|
|
|
import wbsQueryApi from '~api/data-fill/query';
|
|
|
-import HTableForm from "~src/plugins/HTableForm"
|
|
|
+//import HTableForm from "~src/plugins/HTableForm"
|
|
|
import DateCalendar from "./dateCalendar/index.vue"
|
|
|
import {getObjValue, getObjNullValue, isString, getArrValue, isValueNull} from "vue-utils-plus"
|
|
|
import HcTableForm from "~com/table-form/index.vue";
|
|
|
import {useAppStore} from "~src/store";
|
|
|
|
|
|
+const useAppState = useAppStore()
|
|
|
//参数
|
|
|
const props = defineProps({
|
|
|
projectId: {
|
|
@@ -176,12 +177,13 @@ const contractId = ref(props.contractId);
|
|
|
const menuItem = ref(props.items);
|
|
|
const userName = ref(props.userName);
|
|
|
const excelIdVal = ref('');
|
|
|
-const statusDesc = ref('');
|
|
|
const tableFormRef = ref(null);
|
|
|
-const useAppState = useAppStore()
|
|
|
+
|
|
|
+
|
|
|
const contractInfo = ref(useAppState.getContractInfo);
|
|
|
-const { contractType } = contractInfo.value;
|
|
|
-const classifyType = ref(contractType === 2 ? '2' : '1')
|
|
|
+const {contractType} = contractInfo.value;
|
|
|
+const classifyType = ref(contractType === 2 ? '2' : '1')
|
|
|
+
|
|
|
//监听
|
|
|
watch(() => [
|
|
|
props.projectId,
|
|
@@ -199,7 +201,6 @@ watch(() => [
|
|
|
//渲染完成
|
|
|
nextTick(() => {
|
|
|
setQueryDataDate()
|
|
|
- //getQueryData()
|
|
|
})
|
|
|
|
|
|
//获取相关数据
|
|
@@ -226,12 +227,15 @@ const dateCalendarChoice = ({date, choices, dates}) => {
|
|
|
}
|
|
|
|
|
|
//获取数据
|
|
|
-const getExcelBusinessData = (date, choices) => {
|
|
|
+const loading = ref(false)
|
|
|
+const getExcelBusinessData = async (date, choices) => {
|
|
|
const {primaryKeyId} = menuItem.value
|
|
|
- getExcelHtml(excelIdVal.value)
|
|
|
- getTheLogBusinessData(excelIdVal.value, choices)
|
|
|
- getSubmitLogDateList(date, primaryKeyId)
|
|
|
- checkTheLogTaskStatus(choices, primaryKeyId)
|
|
|
+ loading.value = true
|
|
|
+ await getTheLogBusinessData(excelIdVal.value, choices)
|
|
|
+ await getExcelHtml(excelIdVal.value)
|
|
|
+ loading.value = false
|
|
|
+ await getSubmitLogDateList(date, primaryKeyId)
|
|
|
+ await checkTheLogTaskStatus(choices, primaryKeyId)
|
|
|
}
|
|
|
|
|
|
//获取模板标签数据
|
|
@@ -246,43 +250,25 @@ const getExcelHtml = async (excelId) => {
|
|
|
}, false)
|
|
|
//处理数据
|
|
|
const resData = isString(data) ? data || '' : ''
|
|
|
- excelHtmlData.value = resData
|
|
|
if (!error && code === 200 && resData) {
|
|
|
- setHTableForm(resData, excelId)
|
|
|
+ excelHtmlData.value = resData
|
|
|
} else {
|
|
|
+ excelHtmlData.value = ''
|
|
|
isTableForm.value = false
|
|
|
- statusDesc.value = '暂无表单'
|
|
|
window?.$message?.warning('暂无表单')
|
|
|
}
|
|
|
} else {
|
|
|
- statusDesc.value = `excelId: ${excelId || '-1 或 空'}`
|
|
|
isTableForm.value = false
|
|
|
+ window?.$message?.error(`excelId: ${excelId || '-1 或 空'}`)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-//渲染表单
|
|
|
-const tableFormApp = ref(null)
|
|
|
-const setHTableForm = (resData, excelId) => {
|
|
|
- //先卸载
|
|
|
- if (tableFormApp.value) {
|
|
|
- tableFormApp.value?.unmount()
|
|
|
- }
|
|
|
- if (resData) {
|
|
|
- isTableForm.value = true
|
|
|
- nextTick(() => {
|
|
|
- tableFormApp.value = HTableForm.createForm({
|
|
|
- template: resData,
|
|
|
- tableForm: tableFormData.value,
|
|
|
- appId: `#table-form-${excelId}`
|
|
|
- })
|
|
|
- })
|
|
|
- } else {
|
|
|
- isTableForm.value = false
|
|
|
- statusDesc.value = '暂无表单'
|
|
|
- window?.$message?.warning('暂无表单')
|
|
|
- }
|
|
|
+//渲染表单完成
|
|
|
+const tableFormRender = (form) => {
|
|
|
+ isTableForm.value = form.isRenderForm
|
|
|
}
|
|
|
|
|
|
+
|
|
|
//表单数据
|
|
|
const formLogDataList = ref([])
|
|
|
const getTheLogBusinessData = async (excelId, recordDate) => {
|
|
@@ -315,14 +301,11 @@ const getBussDataInfo = (index = 0) => {
|
|
|
const info = getObjValue(formLog[index])
|
|
|
formLogIndex.value = index
|
|
|
if (getObjNullValue(info)) {
|
|
|
- HTableForm.setPickerKey(info)
|
|
|
tableFormData.value = info
|
|
|
} else {
|
|
|
tableFormData.value = {}
|
|
|
}
|
|
|
- if (excelHtmlData.value) {
|
|
|
- setHTableForm(excelHtmlData.value, excelIdVal.value)
|
|
|
- }
|
|
|
+ tableFormRef.value?.setExcelHtml()
|
|
|
queryCurrentLogSelectProcessList(info?.id ?? '')
|
|
|
}
|
|
|
|
|
@@ -387,7 +370,7 @@ const ElTreeLoadNode = async (node, resolve) => {
|
|
|
contractIdRelation: '',
|
|
|
primaryKeyId: '',
|
|
|
parentId: '',
|
|
|
- classifyType:classifyType.value,
|
|
|
+ classifyType: classifyType.value,
|
|
|
})
|
|
|
//处理数据
|
|
|
if (!error && code === 200) {
|
|
@@ -404,8 +387,7 @@ const ElTreeLoadNode = async (node, resolve) => {
|
|
|
contractIdRelation: contractIdRelation,
|
|
|
primaryKeyId: id,
|
|
|
parentId: contractIdRelation ? primaryKeyId : id,
|
|
|
- classifyType:classifyType,
|
|
|
-
|
|
|
+ classifyType: classifyType,
|
|
|
})
|
|
|
//处理数据
|
|
|
if (!error && code === 200) {
|
|
@@ -472,15 +454,13 @@ const tableFormSaveClick = async () => {
|
|
|
//保存
|
|
|
const saveExcelBussData = async () => {
|
|
|
let isLinkTabIds = getLinkTabIds(); //处理工序ID
|
|
|
- console.log(isLinkTabIds, 'isLinkTabIds');
|
|
|
+ console.log('orderList:', formLogDataList.value)
|
|
|
if (isLinkTabIds) {
|
|
|
tableFormSaveLoading.value = true
|
|
|
const {error, code, msg} = await queryApi.saveExcelBussData({
|
|
|
dataInfo: {orderList: formLogDataList.value}
|
|
|
}, false)
|
|
|
-
|
|
|
if (!error && code === 200) {
|
|
|
-
|
|
|
window?.$message?.success(msg)
|
|
|
return true
|
|
|
} else {
|
|
@@ -505,7 +485,6 @@ const getLinkTabIds = () => {
|
|
|
window?.$message?.warning('请先关联工序')
|
|
|
return false
|
|
|
}
|
|
|
-
|
|
|
} else {
|
|
|
return true
|
|
|
}
|