|
@@ -2,13 +2,16 @@
|
|
<div class="hc-layout-content">
|
|
<div class="hc-layout-content">
|
|
<div class="hc-content-box">
|
|
<div class="hc-content-box">
|
|
<div class="hc-table-forem-box">
|
|
<div class="hc-table-forem-box">
|
|
- <HcStatus/>
|
|
|
|
|
|
+ <el-scrollbar>
|
|
|
|
+ <div class="hc-excel-table-form-view" :id="`table-form-${excelIdVal}`" v-if="excelIdVal && isTableForm"></div>
|
|
|
|
+ <HcStatus :desc="statusDesc" v-else/>
|
|
|
|
+ </el-scrollbar>
|
|
</div>
|
|
</div>
|
|
<div class="hc-right-pian-box hc-flex-column">
|
|
<div class="hc-right-pian-box hc-flex-column">
|
|
<DateCalendar :dateData="dateData" @choice-date="dateCalendarChoice"/>
|
|
<DateCalendar :dateData="dateData" @choice-date="dateCalendarChoice"/>
|
|
<el-alert title="蓝色代表当天已填写过日志" type="warning" show-icon/>
|
|
<el-alert title="蓝色代表当天已填写过日志" type="warning" show-icon/>
|
|
<div class="my-4">
|
|
<div class="my-4">
|
|
- <el-button type="primary" hc-btn>
|
|
|
|
|
|
+ <el-button type="primary" hc-btn @click="showProcessModal">
|
|
<HcIcon name="add-circle"/>
|
|
<HcIcon name="add-circle"/>
|
|
<span>关联工序</span>
|
|
<span>关联工序</span>
|
|
</el-button>
|
|
</el-button>
|
|
@@ -23,26 +26,6 @@
|
|
<div class="process-item">这是名称这是名称这是名称这是名称这是名称这是名称这是名称</div>
|
|
<div class="process-item">这是名称这是名称这是名称这是名称这是名称这是名称这是名称</div>
|
|
<HcIcon name="close-circle" fill class="process-icon"/>
|
|
<HcIcon name="close-circle" fill class="process-icon"/>
|
|
</div>
|
|
</div>
|
|
- <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>
|
|
|
|
- <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>
|
|
|
|
- <div class="process-item-box">
|
|
|
|
- <div class="process-item">这是名称这是名称这是名称这是名称这是名称这是名称这是名称</div>
|
|
|
|
- <HcIcon name="close-circle" fill class="process-icon"/>
|
|
|
|
- </div>
|
|
|
|
</el-scrollbar>
|
|
</el-scrollbar>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@@ -79,14 +62,25 @@
|
|
</el-button>
|
|
</el-button>
|
|
</HcTooltip>
|
|
</HcTooltip>
|
|
</div>
|
|
</div>
|
|
|
|
+
|
|
|
|
+ <!--关联工序-->
|
|
|
|
+ <HcDialog :show="processNodeModal" title="选择关联工序" widths="62rem" @close="processNodeModal = false" @save="processNodeClick">
|
|
|
|
+ <div class="node-many-tree">
|
|
|
|
+ <el-tree :load="ElTreeLoadNode" lazy class="my-tree" :props="processTreeProps" show-checkbox node-key="primaryKeyId"
|
|
|
|
+ :default-checked-keys="defaultChecked" :default-expanded-keys="defaultExpanded" check-strictly ref="processElTree"/>
|
|
|
|
+ </div>
|
|
|
|
+ </HcDialog>
|
|
|
|
+
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
<script setup>
|
|
-import {ref, watch, onMounted} from "vue";
|
|
|
|
|
|
+import {ref, watch, nextTick} from "vue";
|
|
import queryApi from '~api/ledger/query';
|
|
import queryApi from '~api/ledger/query';
|
|
-import {getArrValue} from "vue-utils-plus"
|
|
|
|
|
|
+import wbsQueryApi from '~api/data-fill/query';
|
|
|
|
+import {HTableForm} from "~src/plugins/HTableForm"
|
|
import DateCalendar from "./dateCalendar/index.vue"
|
|
import DateCalendar from "./dateCalendar/index.vue"
|
|
|
|
+import {getObjValue, getObjNullValue, isString, getArrValue} from "vue-utils-plus"
|
|
|
|
|
|
//参数
|
|
//参数
|
|
const props = defineProps({
|
|
const props = defineProps({
|
|
@@ -97,27 +91,180 @@ const props = defineProps({
|
|
contractId: {
|
|
contractId: {
|
|
type: [String,Number],
|
|
type: [String,Number],
|
|
default: ''
|
|
default: ''
|
|
|
|
+ },
|
|
|
|
+ items: {
|
|
|
|
+ type: Object,
|
|
|
|
+ default: () => ({})
|
|
}
|
|
}
|
|
})
|
|
})
|
|
|
|
|
|
//变量
|
|
//变量
|
|
const projectId = ref(props.projectId);
|
|
const projectId = ref(props.projectId);
|
|
const contractId = ref(props.contractId);
|
|
const contractId = ref(props.contractId);
|
|
|
|
+const menuItem = ref(props.items);
|
|
|
|
+const excelIdVal = ref('');
|
|
|
|
+const statusDesc = ref('');
|
|
|
|
|
|
//监听
|
|
//监听
|
|
watch(() => [
|
|
watch(() => [
|
|
props.projectId,
|
|
props.projectId,
|
|
props.contractId,
|
|
props.contractId,
|
|
-], ([pid, cid]) => {
|
|
|
|
- projectId.value = pid;
|
|
|
|
- contractId.value = cid;
|
|
|
|
|
|
+ props.items,
|
|
|
|
+], ([pid, cid, item]) => {
|
|
|
|
+ projectId.value = pid
|
|
|
|
+ contractId.value = cid
|
|
|
|
+ menuItem.value = item
|
|
|
|
+ getQueryData()
|
|
})
|
|
})
|
|
|
|
|
|
-//日历日期处理
|
|
|
|
-const dateData = ref(['2022-09-10','2022-09-12'])
|
|
|
|
|
|
+//渲染完成
|
|
|
|
+nextTick(() => {
|
|
|
|
+ getQueryData()
|
|
|
|
+})
|
|
|
|
+
|
|
|
|
+//获取相关数据
|
|
|
|
+const getQueryData = () => {
|
|
|
|
+ const item = menuItem.value
|
|
|
|
+ const eid = item?.excelId > 0 ? item?.excelId + '' : ''
|
|
|
|
+ excelIdVal.value = eid
|
|
|
|
+ getExcelHtmlData(eid)
|
|
|
|
+ getSubmitLogDateList(item?.primaryKeyId)
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+//获取日期记录
|
|
|
|
+const dateData = ref([])
|
|
|
|
+const getSubmitLogDateList = async (pid) => {
|
|
|
|
+ if (pid > 0) {
|
|
|
|
+ const { data } = await queryApi.getSubmitLogDateList({
|
|
|
|
+ projectId: projectId.value,
|
|
|
|
+ contractId: contractId.value,
|
|
|
|
+ primaryKeyId: pid
|
|
|
|
+ }, false)
|
|
|
|
+ //处理数据
|
|
|
|
+ dateData.value = getArrValue(data)
|
|
|
|
+ } else {
|
|
|
|
+ dateData.value = []
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+//日期日历回调
|
|
const dateCalendarChoice = ({date, choice, choices}) => {
|
|
const dateCalendarChoice = ({date, choice, choices}) => {
|
|
console.log(date, choice, choices)
|
|
console.log(date, choice, choices)
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+//表格表单渲染
|
|
|
|
+const isTableForm = ref(false)
|
|
|
|
+const getExcelHtmlData = async (excelId) => {
|
|
|
|
+ if (excelId) {
|
|
|
|
+ getBussDataInfo(excelId)
|
|
|
|
+ getExcelHtml(excelId)
|
|
|
|
+ } else {
|
|
|
|
+ statusDesc.value = `excelId: ${excelId || '-1 或 空'}`
|
|
|
|
+ isTableForm.value = false
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+//获取表单初始数据
|
|
|
|
+const tableFormData = ref({})
|
|
|
|
+const getBussDataInfo = async (excelId) => {
|
|
|
|
+ const { data } = await queryApi.getBussDataInfo({
|
|
|
|
+ pkeyId: excelId
|
|
|
|
+ }, false)
|
|
|
|
+ const info = getObjValue(data)
|
|
|
|
+ if (getObjNullValue(info)) {
|
|
|
|
+ const pickerKey = info['pickerKey'] || ''
|
|
|
|
+ const pickerKeys = pickerKey.split(',')
|
|
|
|
+ for (let i = 0; i < pickerKeys.length; i++) {
|
|
|
|
+ const val = info[pickerKeys[i]] || ''
|
|
|
|
+ if (val) {
|
|
|
|
+ const data = val.replace(/'/g,'"');
|
|
|
|
+ info[pickerKeys[i]] = JSON.parse(data)
|
|
|
|
+ } else {
|
|
|
|
+ info[pickerKeys[i]] = []
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ //有数据,关联数据
|
|
|
|
+ tableFormData.value = info
|
|
|
|
+ } else {
|
|
|
|
+ tableFormData.value = {}
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+//获取模板标签数据
|
|
|
|
+const getExcelHtml = async (excelId) => {
|
|
|
|
+ //获取数据
|
|
|
|
+ const { error, code, data } = await queryApi.getExcelHtml({
|
|
|
|
+ pkeyId: excelId
|
|
|
|
+ }, false)
|
|
|
|
+ //处理数据
|
|
|
|
+ const resData = isString(data) ? data || '' : ''
|
|
|
|
+ if (!error && code === 200 && resData) {
|
|
|
|
+ isTableForm.value = true
|
|
|
|
+ //渲染表单
|
|
|
|
+ await nextTick(() => {
|
|
|
|
+ HTableForm({
|
|
|
|
+ template: resData,
|
|
|
|
+ tableForm: tableFormData.value,
|
|
|
|
+ appId: `#table-form-${excelId}`
|
|
|
|
+ })
|
|
|
|
+ })
|
|
|
|
+ } else {
|
|
|
|
+ isTableForm.value = false
|
|
|
|
+ statusDesc.value = '暂无表单'
|
|
|
|
+ window?.$message?.warning('暂无表单')
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+//关联工序
|
|
|
|
+const processNodeModal = ref(false)
|
|
|
|
+const showProcessModal = () => {
|
|
|
|
+ processNodeModal.value = true
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+//树的配置
|
|
|
|
+const processElTree = ref(null)
|
|
|
|
+const processTreeProps = {label: 'title', children: 'children', isLeaf: 'notExsitChild'}
|
|
|
|
+const defaultExpanded = ref([]) //默认展开
|
|
|
|
+const defaultChecked = ref([]) //默认选中
|
|
|
|
+
|
|
|
|
+//树形结构异步加载数据
|
|
|
|
+const ElTreeLoadNode = async (node, resolve) => {
|
|
|
|
+ if (node.level === 0) {
|
|
|
|
+ const {error, code, data} = await wbsQueryApi.queryWbsTreeData({
|
|
|
|
+ contractId: contractId.value ||'',
|
|
|
|
+ contractIdRelation: '',
|
|
|
|
+ primaryKeyId: '',
|
|
|
|
+ parentId: ''
|
|
|
|
+ })
|
|
|
|
+ //处理数据
|
|
|
|
+ if (!error && code === 200) {
|
|
|
|
+ const resData = getArrValue(data)
|
|
|
|
+ resolve(resData)
|
|
|
|
+ defaultExpanded.value = [resData[0]?.primaryKeyId]
|
|
|
|
+ } else {
|
|
|
|
+ resolve([])
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ const {id, contractIdRelation, primaryKeyId} = node.data
|
|
|
|
+ const {error, code, data} = await wbsQueryApi.queryWbsTreeData({
|
|
|
|
+ contractId: contractId.value || '',
|
|
|
|
+ contractIdRelation: contractIdRelation,
|
|
|
|
+ primaryKeyId: id,
|
|
|
|
+ parentId: contractIdRelation ? primaryKeyId : id
|
|
|
|
+ })
|
|
|
|
+ //处理数据
|
|
|
|
+ if (!error && code === 200) {
|
|
|
|
+ resolve(getArrValue(data))
|
|
|
|
+ } else {
|
|
|
|
+ resolve([])
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+//确认关联工序
|
|
|
|
+const processNodeClick = () => {
|
|
|
|
+
|
|
|
|
+}
|
|
</script>
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
<style lang="scss" scoped>
|