|
@@ -10,21 +10,17 @@
|
|
|
<div class="hc-right-pian-box hc-flex-column">
|
|
|
<DateCalendar :dateData="dateData" @choice-date="dateCalendarChoice"/>
|
|
|
<el-alert title="蓝色代表当天已填写过日志" type="warning" show-icon/>
|
|
|
- <div class="my-4">
|
|
|
+ <div class="my-4" v-if="menuItem?.nodeType === 7 || menuItem?.nodeType === 11">
|
|
|
<el-button type="primary" hc-btn @click="showProcessModal">
|
|
|
<HcIcon name="add-circle"/>
|
|
|
<span>关联工序</span>
|
|
|
</el-button>
|
|
|
</div>
|
|
|
- <div class="hc-process-box">
|
|
|
+ <div class="hc-process-box" v-if="menuItem?.nodeType === 7 || menuItem?.nodeType === 11">
|
|
|
<el-scrollbar>
|
|
|
- <div class="process-item-box">
|
|
|
- <div class="process-item">这是名称这是名称这是名称这是名称这是名称这是名称这是名称</div>
|
|
|
- <HcIcon name="close-circle" fill class="process-icon"/>
|
|
|
- </div>
|
|
|
- <div class="process-item-box">
|
|
|
- <div class="process-item">这是名称这是名称这是名称这是名称这是名称这是名称这是名称</div>
|
|
|
- <HcIcon name="close-circle" fill class="process-icon"/>
|
|
|
+ <div class="process-item-box" v-for="(item,index) in processDataList">
|
|
|
+ <div class="process-item">{{item.pathName}}</div>
|
|
|
+ <HcIcon name="close-circle" fill class="process-icon" @click="deleProcess(index)"/>
|
|
|
</div>
|
|
|
</el-scrollbar>
|
|
|
</div>
|
|
@@ -32,31 +28,37 @@
|
|
|
</div>
|
|
|
<div class="hc-footer-box">
|
|
|
<HcTooltip keys="ledger_query_save_form">
|
|
|
- <el-button type="primary" hc-btn>
|
|
|
+ <el-button type="primary" hc-btn :disabled="!isTableForm" :loading="tableFormSaveLoading" @click="tableFormSaveClick">
|
|
|
<HcIcon name="save"/>
|
|
|
<span>保存</span>
|
|
|
</el-button>
|
|
|
</HcTooltip>
|
|
|
<HcTooltip keys="ledger_query_report_form">
|
|
|
- <el-button hc-btn>
|
|
|
+ <el-button hc-btn :disabled="!isTableForm">
|
|
|
<HcIcon name="send-plane-2"/>
|
|
|
<span>上报</span>
|
|
|
</el-button>
|
|
|
</HcTooltip>
|
|
|
<HcTooltip keys="ledger_query_preview_form">
|
|
|
- <el-button hc-btn>
|
|
|
+ <el-button hc-btn :disabled="!isTableForm" :loading="previewLoading" @click="previewBussPdf">
|
|
|
<HcIcon name="eye"/>
|
|
|
<span>预览</span>
|
|
|
</el-button>
|
|
|
</HcTooltip>
|
|
|
<HcTooltip keys="ledger_query_copy_form">
|
|
|
- <el-button hc-btn>
|
|
|
+ <el-button hc-btn :disabled="!isTableForm">
|
|
|
<HcIcon name="file-copy-2"/>
|
|
|
<span>复制当前表格及内容</span>
|
|
|
</el-button>
|
|
|
</HcTooltip>
|
|
|
+ <HcTooltip keys="ledger_query_time_form">
|
|
|
+ <el-button hc-btn :disabled="!isTableForm">
|
|
|
+ <HcIcon name="file-copy-2"/>
|
|
|
+ <span>复制任意时间</span>
|
|
|
+ </el-button>
|
|
|
+ </HcTooltip>
|
|
|
<HcTooltip keys="ledger_query_add_form">
|
|
|
- <el-button hc-btn>
|
|
|
+ <el-button hc-btn :disabled="!isTableForm">
|
|
|
<HcIcon name="add-circle"/>
|
|
|
<span>新增表格</span>
|
|
|
</el-button>
|
|
@@ -147,8 +149,9 @@ const getSubmitLogDateList = async (pid) => {
|
|
|
}
|
|
|
}
|
|
|
//日期日历回调
|
|
|
-const dateCalendarChoice = ({date, choice, choices}) => {
|
|
|
- console.log(date, choice, choices)
|
|
|
+const recordTime = ref('')
|
|
|
+const dateCalendarChoice = ({choices}) => {
|
|
|
+ recordTime.value = choices
|
|
|
}
|
|
|
|
|
|
//表格表单渲染
|
|
@@ -220,7 +223,6 @@ const showProcessModal = () => {
|
|
|
processNodeModal.value = true
|
|
|
}
|
|
|
|
|
|
-
|
|
|
//树的配置
|
|
|
const processElTree = ref(null)
|
|
|
const processTreeProps = {label: 'title', children: 'children', isLeaf: 'notExsitChild'}
|
|
@@ -262,9 +264,119 @@ const ElTreeLoadNode = async (node, resolve) => {
|
|
|
}
|
|
|
|
|
|
//确认关联工序
|
|
|
+const processDataList = ref([])
|
|
|
const processNodeClick = () => {
|
|
|
+ const keys = processElTree.value.getCheckedKeys();
|
|
|
+ let NodesArr = []
|
|
|
+ for (let index = 0; index < keys.length; index++) {
|
|
|
+ let pathArr = [];
|
|
|
+ let node = processElTree.value.getNode(keys[index]);
|
|
|
+ getPathName(node, pathArr);
|
|
|
+ NodesArr.push({
|
|
|
+ primaryKeyId: keys[index],
|
|
|
+ pathName: pathArr.join('/')
|
|
|
+ })
|
|
|
+ }
|
|
|
+ processDataList.value = NodesArr
|
|
|
+ processNodeModal.value = false
|
|
|
+}
|
|
|
+
|
|
|
+//获取节点的路径名字
|
|
|
+const getPathName = (node, pathArr) => {
|
|
|
+ if (node.parent?.parent) {
|
|
|
+ pathArr.unshift(node.data?.title.replace(/(^\s*)|(\s*$)/g, "")); //去掉头尾空格
|
|
|
+ getPathName(node.parent, pathArr);
|
|
|
+ } else {
|
|
|
+ return; //根节点结束
|
|
|
+ }
|
|
|
+}
|
|
|
|
|
|
+//移除工序
|
|
|
+const deleProcess = (index) => {
|
|
|
+ processDataList.value.splice(index, 1);
|
|
|
}
|
|
|
+
|
|
|
+//保存数据
|
|
|
+const tableFormSaveLoading = ref(false)
|
|
|
+const tableFormSaveClick = async () => {
|
|
|
+ const res = await saveExcelBussData()
|
|
|
+ if (res) {
|
|
|
+ await getBussPdfInfo()
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+//保存
|
|
|
+const saveExcelBussData = async () => {
|
|
|
+ let linkTabIds = setProcessData(); //处理工序ID
|
|
|
+ if (linkTabIds) {
|
|
|
+ tableFormSaveLoading.value = true
|
|
|
+ const { error, code } = await queryApi.saveExcelBussData({
|
|
|
+ ...tableFormData.value,
|
|
|
+ classify: 1,
|
|
|
+ projectId: projectId.value,
|
|
|
+ contractId: contractId.value,
|
|
|
+ pkeyId: excelIdVal.value,
|
|
|
+ linkTabIds: linkTabIds,
|
|
|
+ isTheLog: "1",
|
|
|
+ theLogId: "",
|
|
|
+ recordTime: recordTime.value
|
|
|
+ },false)
|
|
|
+ tableFormSaveLoading.value = false
|
|
|
+ if (!error && code === 200) {
|
|
|
+ window?.$message?.success('保存成功')
|
|
|
+ return true
|
|
|
+ } else {
|
|
|
+ window?.$message?.warning('保存失败')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+//处理工序数据
|
|
|
+const setProcessData = () => {
|
|
|
+ let linkTabIds = [], {nodeType} = menuItem.value;
|
|
|
+ if (nodeType === 7 || nodeType === 11) {
|
|
|
+ const nodes = processDataList.value || [];
|
|
|
+ if (nodes.length > 0) {
|
|
|
+ for (let i = 0; i < nodes.length; i++) {
|
|
|
+ let item = nodes[i];
|
|
|
+ linkTabIds.push({
|
|
|
+ path: item['pathName'],
|
|
|
+ primaryKeyId: item['primaryKeyId']
|
|
|
+ })
|
|
|
+ }
|
|
|
+ return linkTabIds
|
|
|
+ } else {
|
|
|
+ window?.$message?.warning('请先关联工序')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ return true
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+//预览
|
|
|
+const previewLoading = ref(false)
|
|
|
+const previewBussPdf = () => {
|
|
|
+ getBussPdfInfo()
|
|
|
+}
|
|
|
+
|
|
|
+//预览PDF
|
|
|
+const getBussPdfInfo = async () => {
|
|
|
+ previewLoading.value = true
|
|
|
+ const { error, code, data } = await queryApi.getBussPdfInfo({
|
|
|
+ pkeyId: excelIdVal.value
|
|
|
+ }, false)
|
|
|
+ //处理数据
|
|
|
+ previewLoading.value = false
|
|
|
+ const resData = isString(data) ? data || '' : ''
|
|
|
+ if (!error && code === 200 && resData) {
|
|
|
+ window.open(resData,'_blank')
|
|
|
+ } else {
|
|
|
+ window?.$message?.warning('暂无PDF')
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
@@ -344,3 +456,15 @@ const processNodeClick = () => {
|
|
|
}
|
|
|
}
|
|
|
</style>
|
|
|
+
|
|
|
+<style lang="scss">
|
|
|
+.node-many-tree {
|
|
|
+ position: relative;
|
|
|
+ .my-tree .el-tree-node .el-checkbox .el-checkbox__inner {
|
|
|
+ display: none;
|
|
|
+ }
|
|
|
+ .my-tree .el-tree-node .is-leaf + .el-checkbox .el-checkbox__inner {
|
|
|
+ display: inline-block;
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|