Browse Source

2024-04-30 工艺路线配置优化,增加分页,联动,提示

master_hella_20240701
zhousq 7 months ago
parent
commit
3198cf8d08
  1. 146
      src/views/mes/processroute/components/configDialog.vue
  2. 6
      src/views/mes/processroute/components/graphbase.data.ts
  3. 295
      src/views/mes/workScheduling/components/Detail.vue
  4. 6
      src/views/mes/workScheduling/index.vue
  5. 18
      src/views/mes/workScheduling/workScheduling.data.ts

146
src/views/mes/processroute/components/configDialog.vue

@ -12,8 +12,8 @@
<div class="font-size-18px"> <div class="font-size-18px">
<el-row :gutter="10"> <el-row :gutter="10">
<el-col :span="22"> <el-col :span="22">
{{ titleValueRef }} {{ titleNameRef }}
<el-tag type="info">[{{ titleNameRef }}]</el-tag> <el-tag type="primary">[{{ titleValueRef }}]</el-tag>
</el-col> </el-col>
<el-col :span="2"> <el-col :span="2">
<el-button size="primary" @click="saveResult()" style="width: 100%"> <el-button size="primary" @click="saveResult()" style="width: 100%">
@ -37,7 +37,7 @@
>添加工序</el-button> >添加工序</el-button>
</div> </div>
</template> </template>
<el-table :data="processData" ref="tableProcess" style="width: 100%; height: 80%;border: 1px;" @cell-dblclick="userAddNode"> <el-table :data="showProcessNodeData" ref="tableProcess" style="width: 100%; height: 80%;border: 1px;" @cell-dblclick="userAddNode">
<el-table-column prop="code" label="工序编码" /> <el-table-column prop="code" label="工序编码" />
<el-table-column prop="name" label="工序名称" /> <el-table-column prop="name" label="工序名称" />
<el-table-column prop="oper" label="操作" width="60"> <el-table-column prop="oper" label="操作" width="60">
@ -48,6 +48,17 @@
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<el-pagination
small
hide-on-single-page="true"
layout="prev, pager, next"
:total="page.total"
:page-size="page.size"
:current-page="page.current"
@current-change="handleCurrentChange"
@prev-click="handlePrevClick"
@next-click="handleNextClick"
/>
</el-card> </el-card>
</el-col> </el-col>
<el-col :span="12"><div ref="graphContainer" style="width: 90%; height: 90%"></div> <el-col :span="12"><div ref="graphContainer" style="width: 90%; height: 90%"></div>
@ -81,8 +92,9 @@
<span>工艺路线基本信息</span> <span>工艺路线基本信息</span>
</div> </div>
</template> </template>
<p >工艺路线名称<span v-if="productData!=null">{{ productData.name }}</span></p>
<p >工艺路线编码<span v-if="productData!=null">{{ productData.name }}</span></p> <p >工艺路线名称<span >{{titleNameRef}}</span></p>
<p >工艺路线编码<span >{{titleValueRef}}</span></p>
<p >产品名称<span v-if="productData!=null">{{ productData.name }}</span></p> <p >产品名称<span v-if="productData!=null">{{ productData.name }}</span></p>
<p>产品编码<span v-if="productData!=null">{{ productData.code }}</span></p> <p>产品编码<span v-if="productData!=null">{{ productData.code }}</span></p>
<p>产品描述<span v-if="productData!=null">{{ productData.desc1 }}</span></p> <p>产品描述<span v-if="productData!=null">{{ productData.desc1 }}</span></p>
@ -92,23 +104,34 @@
><el-card class="footer-card"> ><el-card class="footer-card">
<template #header> <template #header>
<div class="card-header"> <div class="card-header">
<span>物料信息</span> <span>物料信息</span><el-tag type="primary">[{{ currentNode.name }}]</el-tag>
</div> </div>
</template> </template>
<el-table :data="materialData" ref="tableMaterial" style="width: 100%; height: 80%;overflow-y: auto;"> <el-table :data="showMaterialsData" ref="tableMaterial" style="width: 100%; height: 80%;overflow-y: auto;">
<!-- <el-table-column prop="name" label="物料名称"/> --> <!-- <el-table-column prop="name" label="物料名称"/> -->
<el-table-column prop="componentItemCode" label="物料编码"/> <el-table-column prop="componentItemCode" label="物料编码"/>
<el-table-column prop="version" label="版本号"/> <el-table-column prop="version" label="版本号"/>
<el-table-column prop="componentQty" label="物料数量"/> <el-table-column prop="componentQty" label="物料数量"/>
</el-table> </el-table>
<el-pagination
small
hide-on-single-page="true"
layout="prev, pager, next"
:total="pageM.total"
:page-size="pageM.size"
:current-page="pageM.current"
@current-change="handleCurrentChangeM"
@prev-click="handlePrevClickM"
@next-click="handleNextClickM"
/>
</el-card></el-col </el-card></el-col
> >
<el-col :span="6" <el-col :span="6"
><el-card class="footer-card"> ><el-card class="footer-card">
<template #header> <template #header>
<div class="card-header"> <div class="card-header">
<span>模具信息</span> <span>模具信息</span><el-tag type="primary">[{{ currentNode.name }}]</el-tag>
</div> </div>
</template> </template>
<el-table :data="mouldData" ref="tableMould" style="width: 100%; height: 80%;overflow-y: auto;"> <el-table :data="mouldData" ref="tableMould" style="width: 100%; height: 80%;overflow-y: auto;">
@ -121,7 +144,7 @@
><el-card class="footer-card"> ><el-card class="footer-card">
<template #header> <template #header>
<div class="card-header"> <div class="card-header">
<span>工位信息</span> <span>工位信息</span><el-tag type="primary">[{{ currentNode.name }}]</el-tag>
</div> </div>
</template> </template>
<el-table :data="workStationList" ref="tableWorkstation" style="width: 100%; height: 80%;overflow-y: auto;"> <el-table :data="workStationList" ref="tableWorkstation" style="width: 100%; height: 80%;overflow-y: auto;">
@ -154,6 +177,7 @@ const message = useMessage() // 消息弹窗
//const { t } = useI18n() // //const { t } = useI18n() //
const route = useRoute() // const route = useRoute() //
const routeName = ref() const routeName = ref()
const currentNode=ref({code:'',name:''})
routeName.value = route.name routeName.value = route.name
routeName.value = routeName.value.substring(0, routeName.value.length - 4) + 'ProcessRouteConfig' routeName.value = routeName.value.substring(0, routeName.value.length - 4) + 'ProcessRouteConfig'
//const updateKey = ref(0) //const updateKey = ref(0)
@ -165,6 +189,22 @@ const tableProcess = ref()
const productData = ref({ name: '', code: '', desc1: '--' }) // const productData = ref({ name: '', code: '', desc1: '--' }) //
const materialData=ref() const materialData=ref()
const mouldData = ref() const mouldData = ref()
const page=ref({
total:0,
current:1,
size:5
})
const pageM=ref({
total:0,
current:1,
size:5
})
const showProcessNodeData=ref() //
const showMaterialsData=ref() //
const productCode=ref()
//
const graph = ref<Graph>()
const rowData = ref()
const workStationList = ref() // const workStationList = ref() //
// //
const annexData = reactive({ const annexData = reactive({
@ -203,23 +243,25 @@ const searchTableSuccess = (formField, searchField, val, type, row) => {
if(val.length>0){ if(val.length>0){
val.forEach(item=>{ val.forEach(item=>{
if(processData.value.find(obj=>obj.code==item.code)==undefined){ if(processData.value.find(obj=>obj.code==item.code)==undefined){
processData.value.push({code:item.code,name:item.name})} processData.value.push({code:item.code,name:item.name})
page.value.total=processData.value.length
showProcessNodeData.value=processData.value.slice((page.value.current-1)*page.value.size,page.value.size)
}
}) })
} }
} }
const deleteNode=(row)=>{ const deleteNode=(row)=>{
processData.value.splice(processData.value.indexOf(row),1) processData.value.splice(processData.value.indexOf(row),1)
page.value.total=processData.value.length
page.value.current=1
graph.value.removeNode(row.code) graph.value.removeNode(row.code)
} }
const productCode=ref()
//
const graph = ref<Graph>()
const rowData = ref()
const openDetail = (row: any) => { const openDetail = (row: any) => {
rowData.value = row rowData.value = row
console.log('rowData',rowData.value) console.log('rowData',rowData.value)
titleNameRef.value = rowData.value.processrouteCode titleNameRef.value = rowData.value.processName
titleValueRef.value = rowData.value.processName titleValueRef.value =rowData.value.processrouteCode
processRouteId.value = rowData.value.id processRouteId.value = rowData.value.id
productCode.value=rowData.value.productCode productCode.value=rowData.value.productCode
routeVersion.value=rowData.value.routeVersion routeVersion.value=rowData.value.routeVersion
@ -264,7 +306,7 @@ const getProcessInfo = async (id: any) => {
/** 获取产品信息 */ /** 获取产品信息 */
const getItembasicInfo = async (code: String) => { const getItembasicInfo = async (code: String) => {
const res = await ProcessrouteApi.getProductInfo(code) const res = await ProcessrouteApi.getProductInfo(code)
console.log('productData',res) //console.log('productData',res)
productData.value = res productData.value = res
} }
/** 获取物料列表 */ /** 获取物料列表 */
@ -302,28 +344,37 @@ const getProcessList = async (code) => {
//console.log('code',code) //console.log('code',code)
const res = await ProcessrouteApi.getProcessrouteNodeList(code) const res = await ProcessrouteApi.getProcessrouteNodeList(code)
processData.value = res processData.value = res
showProcessNodeData.value=processData.value.slice((page.value.current-1)*page.value.size,page.value.size)
//return res //return res
} }
// //
const nodeClick = (e, x, y, node, view) => { const nodeClick = (e, x, y, node, view) => {
currentNode.value.code=node.id
currentNode.value.name=node.attrs.title.text
Promise.all([ Promise.all([
getProcessInfo(node.id), getProcessInfo(node.id),
getProcessBomList(productCode.value,node.id), getProcessBomList(productCode.value,node.id),
getPatternPage(node.id), getPatternPage(node.id),
getWorkstationPage(node.id) getWorkstationPage(node.id)
]).then(([processIndoList,basicBom, patternPage,workstationInfoList]) => { ]).then(([processInfoList,basicBom, patternPage,workstationInfoList]) => {
// //
//message.info(JSON.stringify(processIndoList)) //message.info(JSON.stringify(processIndoList))
console.log('basicBom',basicBom) //console.log('basicBom',basicBom)
// //
materialData.value = basicBom materialData.value = basicBom
pageM.value.total=materialData.value.length
pageM.value.current=1
showMaterialsData.value=materialData.value.slice((pageM.value.current-1)*pageM.value.size,pageM.value.size)
// //
mouldData.value = patternPage.list mouldData.value = patternPage.list
// //
workStationList.value = workstationInfoList.list workStationList.value = workstationInfoList.list
}).catch(error => { }).catch(error => {
console.error("Error:", error); //console.error("Error:", error);
materialData.value = [] materialData.value = []
showMaterialsData.value=[]
pageM.value.total=materialData.value.length
pageM.value.current=1
mouldData.value = [] mouldData.value = []
workStationList.value = [] workStationList.value = []
}); });
@ -362,6 +413,7 @@ const userAddNode = (row) => {
// ] // ]
}) })
} }
nodeClick(undefined,undefined, undefined, node_template, graph.value)
} }
} }
//------- //-------
@ -382,7 +434,7 @@ const saveResult = async () => {
return return
} }
let gdata = { let gdata = {
processrouteCode: titleNameRef.value, processrouteCode: titleValueRef.value,
routeVersion:routeVersion.value, routeVersion:routeVersion.value,
graphJson: graph.value.toJSON(), graphJson: graph.value.toJSON(),
processrouteId: processRouteId.value processrouteId: processRouteId.value
@ -442,6 +494,58 @@ const deleteAnnexSuccess = async () => {
getFileList() getFileList()
getChangeRecordList() getChangeRecordList()
} }
const handleCurrentChange=(value: number)=>{
let index=(value-1)*page.value.size
page.value.current=value
//console.log('index',index)
showProcessNodeData.value=processData.value.slice(index,index+page.value.size)
//console.log('processData.value-472',processData.value)
//console.log('showProcessNodeData.value-472',showProcessNodeData.value)
}
const handlePrevClick=(value: number)=>{
page.value.current=value-1
if(page.value.current==0) {
page.value.current=1
}
// let index=(value-1)*page.value.size
// showProcessNodeData.value=processData.value.slice(index,page.value.size)
// console.log('showProcessNodeData.value-472',showProcessNodeData.value)
}
const handleNextClick=(value: number)=>{
page.value.current=value+1
if(page.value.current>page.value.total/page.value.size) {
page.value.current=page.value.total/page.value.size -1
}
// let index=(value+1)*page.value.size
// showProcessNodeData.value=processData.value.slice(index,page.value.size)
// console.log('showProcessNodeData.value-472',showProcessNodeData.value)
}
const handleCurrentChangeM=(value: number)=>{
let index=(value-1)*pageM.value.size
pageM.value.current=value
//console.log('index',index)
showMaterialsData.value=materialData.value.slice(index,index+pageM.value.size)
}
const handlePrevClickM=(value: number)=>{
pageM.value.current=value-1
if(pageM.value.current==0) {
pageM.value.current=1
}
// let index=(value-1)*page.value.size
// showProcessNodeData.value=processData.value.slice(index,page.value.size)
// console.log('showProcessNodeData.value-472',showProcessNodeData.value)
}
const handleNextClickM=(value: number)=>{
pageM.value.current=value+1
if(pageM.value.current>pageM.value.total/page.value.size) {
pageM.value.current=page.value.total/pageM.value.size -1
}
// let index=(value+1)*page.value.size
// showProcessNodeData.value=processData.value.slice(index,page.value.size)
// console.log('showProcessNodeData.value-472',showProcessNodeData.value)
}
// //
onUnmounted?.(() => {}) onUnmounted?.(() => {})
const emit = defineEmits(['close']) const emit = defineEmits(['close'])

6
src/views/mes/processroute/components/graphbase.data.ts

@ -138,7 +138,7 @@ export const start_node = ref({
id: 'startNode', id: 'startNode',
label: '开始', label: '开始',
x: 50, x: 50,
y: 200, y: 100,
attrs: { attrs: {
body: { body: {
rx: 20, rx: 20,
@ -151,8 +151,8 @@ export const start_node = ref({
//结束节点的定义 //结束节点的定义
export const end_node = ref({ export const end_node = ref({
id: 'endNode', id: 'endNode',
x: 200, x: 400,
y: 200, y: 100,
label: '结束', label: '结束',
attrs: { attrs: {
body: { body: {

295
src/views/mes/workScheduling/components/Detail.vue

@ -28,7 +28,16 @@
<Tabs ref="tabRef" :tabsList="tabsList" :current="current" @change="change" /> <Tabs ref="tabRef" :tabsList="tabsList" :current="current" @change="change" />
<div class="flex"> <div class="flex">
<!-- 详情 --> <!-- 详情 -->
<ContentWrap class="w-[100%]" v-show="tabsList[current].label!=annexAliasLabel&&tabsList[current].label!='备注'&&tabsList[current].label!='变更记录'&&!annexTableData.some(item=>item.label==tabsList[current].label)"> <!-- 列表头部 --> <ContentWrap
class="w-[100%]"
v-show="
tabsList[current].label != annexAliasLabel &&
tabsList[current].label != '备注' &&
tabsList[current].label != '变更记录' &&
!annexTableData.some((item) => item.label == tabsList[current].label)
"
>
<!-- 列表头部 -->
<TableHead <TableHead
v-if="!isBasic" v-if="!isBasic"
:HeadButttondata="HeadButttondata" :HeadButttondata="HeadButttondata"
@ -71,8 +80,15 @@
v-model:pageSize="tableObjectRef.pageSize" v-model:pageSize="tableObjectRef.pageSize"
v-model:currentPage="tableObjectRef.currentPage" v-model:currentPage="tableObjectRef.currentPage"
> >
<template #photos="{ row }"> <template #photos="{ row }">
<div v-for="(item,index) in row.photos.split(',')" :key="index" style="color:#409eff ; cursor: pointer;" @click="openImage(item)">{{ item }}</div> </template> <div
v-for="(item, index) in row.photos.split(',')"
:key="index"
style="color: #409eff; cursor: pointer"
@click="openImage(item)"
>{{ item }}</div
>
</template>
<template #action="{ row }"> <template #action="{ row }">
<ButtonBase <ButtonBase
:Butttondata="buttondata" :Butttondata="buttondata"
@ -97,21 +113,31 @@
</DetailTable> </DetailTable>
</ContentWrap> </ContentWrap>
<!-- other附件组件:如质检明细 --> <!-- other附件组件:如质检明细 -->
<div v-for="(annexItem ,index) in annexTableData" :key="index" v-show="annexItem.label==tabsList[current].label" class="w-[100%]" :style="{height:annexItem.hasSubDetail?'100%':remarkHeight+'px'}"> <div
<ContentWrap class="w-[100%]"> v-for="(annexItem, index) in annexTableData"
<ElScrollbar ref="scrollbar" :style="{height:annexItem.hasSubDetail?'100%':(remarkHeight-40)+'px'}"> :key="index"
<Annex v-show="tabsList[current].label==annexItem.label" v-show="annexItem.label == tabsList[current].label"
:annexData="annexItem" class="w-[100%]"
@handleAnnexSuccess="updateAnnexTableHandle" :style="{ height: annexItem.hasSubDetail ? '100%' : remarkHeight + 'px' }"
@deleteAnnexSuccess="updateAnnexTableHandle" >
:upData="{...remarksData.data,tableName:annexItem.tableName}" <ContentWrap class="w-[100%]">
/> <ElScrollbar
ref="scrollbar"
:style="{ height: annexItem.hasSubDetail ? '100%' : remarkHeight - 40 + 'px' }"
>
<Annex
v-show="tabsList[current].label == annexItem.label"
:annexData="annexItem"
@handleAnnexSuccess="updateAnnexTableHandle"
@deleteAnnexSuccess="updateAnnexTableHandle"
:upData="{ ...remarksData.data, tableName: annexItem.tableName }"
/>
</ElScrollbar> </ElScrollbar>
</ContentWrap> </ContentWrap>
<ContentWrap class="w-[100%]" v-if="annexItem.subDetailTableData"> <ContentWrap class="w-[100%]" v-if="annexItem.subDetailTableData">
<Table <Table
v-if="!isBasic && fromeWhere != 'countPlan'" v-if="!isBasic && fromeWhere != 'countPlan'"
:align="annexItem.align?annexItem.align:'center'" :align="annexItem.align ? annexItem.align : 'center'"
:columns="annexItem.subDetailTableData.tableColumns" :columns="annexItem.subDetailTableData.tableColumns"
:data="annexItem.subDetailTableData.tableList" :data="annexItem.subDetailTableData.tableList"
:loading="annexItem.subDetailTableData.loading" :loading="annexItem.subDetailTableData.loading"
@ -119,30 +145,44 @@
v-model:pageSize="tableObjectRef.pageSize" v-model:pageSize="tableObjectRef.pageSize"
v-model:currentPage="tableObjectRef.currentPage" v-model:currentPage="tableObjectRef.currentPage"
/> />
</ContentWrap> </ContentWrap>
</div> </div>
<!-- 附件/备注/变更记录 --> <!-- 附件/备注/变更记录 -->
<ContentWrap class="w-[100%]" v-show="tabsList[current].label==annexAliasLabel||tabsList[current].label=='备注'||tabsList[current].label=='变更记录'" :style="{height:remarkHeight+'px'}"> <ContentWrap
class="w-[100%]"
v-show="
tabsList[current].label == annexAliasLabel ||
tabsList[current].label == '备注' ||
tabsList[current].label == '变更记录'
"
:style="{ height: remarkHeight + 'px' }"
>
<!-- 附件组件 --> <!-- 附件组件 -->
<ElScrollbar ref="scrollbar" :style="{height:(remarkHeight-40)+'px'}"> <ElScrollbar ref="scrollbar" :style="{ height: remarkHeight - 40 + 'px' }">
<Annex v-show="tabsList[current].label==annexAliasLabel" <Annex
:annexData="annexData" v-show="tabsList[current].label == annexAliasLabel"
@handleAnnexSuccess="handleAnnexSuccess" :annexData="annexData"
@deleteAnnexSuccess="deleteAnnexSuccess" @handleAnnexSuccess="handleAnnexSuccess"
:upData="remarksData.data" @deleteAnnexSuccess="deleteAnnexSuccess"
:key="count" :upData="remarksData.data"
/> :key="count"
/>
<!-- 备注组件 --> <!-- 备注组件 -->
<Remarks v-show="tabsList[current].label=='备注'" <Remarks
v-show="tabsList[current].label == '备注'"
:remarksData="remarksData" :remarksData="remarksData"
class="mt-20px" class="mt-20px"
@remarksSubmitScuess="remarksSubmitScuess" @remarksSubmitScuess="remarksSubmitScuess"
:key="count" :key="count"
/> />
<!-- 变更记录组件 --> <!-- 变更记录组件 -->
<ChangeRecord v-show="tabsList[current].label=='变更记录'" :changeRecordData="changeRecordData" class="mt-20px" :key="count"/> <ChangeRecord
</ElScrollbar> v-show="tabsList[current].label == '变更记录'"
:changeRecordData="changeRecordData"
class="mt-20px"
:key="count"
/>
</ElScrollbar>
</ContentWrap> </ContentWrap>
</div> </div>
</el-drawer> </el-drawer>
@ -173,7 +213,6 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import Annex from '@/components/Annex/src/Annex.vue' import Annex from '@/components/Annex/src/Annex.vue'
import Remarks from '@/components/Remarks/src/Remarks.vue' import Remarks from '@/components/Remarks/src/Remarks.vue'
import ChangeRecord from '@/components/ChangeRecord/src/ChangeRecord.vue' import ChangeRecord from '@/components/ChangeRecord/src/ChangeRecord.vue'
@ -185,7 +224,7 @@ import BasicForm from '@/components/BasicForm/src/BasicForm.vue'
import TableHead from '@/components/TableHead/src/TableHead.vue' import TableHead from '@/components/TableHead/src/TableHead.vue'
import DetailTable from '@/components/DetailTable/src/DetailTable.vue' import DetailTable from '@/components/DetailTable/src/DetailTable.vue'
import { SearchTable } from '@/components/SearchTable' import { SearchTable } from '@/components/SearchTable'
import {defaultFreshBtn} from "@/utils/disposition/defaultButtons"; import { defaultFreshBtn } from '@/utils/disposition/defaultButtons'
defineOptions({ name: 'Detail' }) defineOptions({ name: 'Detail' })
@ -209,7 +248,7 @@ const props = defineProps({
annexTable: { annexTable: {
type: Array, type: Array,
required: false, required: false,
default: ()=>[] default: () => []
}, },
//tab //tab
annexAliasLabel: { annexAliasLabel: {
@ -305,7 +344,7 @@ const props = defineProps({
buttondataTable: { buttondataTable: {
type: Array, type: Array,
required: false, required: false,
default: ()=>{ default: () => {
return [] return []
} }
}, },
@ -322,38 +361,38 @@ const props = defineProps({
default: null default: null
}, },
// //
detailButtonIsShowFilter:{ detailButtonIsShowFilter: {
type: Boolean, type: Boolean,
required: false, required: false,
default: true default: true
}, },
// //
detailButtonIsShowAdd:{ detailButtonIsShowAdd: {
type: Boolean, type: Boolean,
required: false, required: false,
default: true default: false
}, },
// //
detailButtonIsShowEdit:{ detailButtonIsShowEdit: {
type: Boolean, type: Boolean,
required: false, required: false,
default: true default: false
}, },
// //
detailButtonIsShowDelete:{ detailButtonIsShowDelete: {
type: Boolean, type: Boolean,
required: false, required: false,
default: true default: false
}, },
// //
isOpenSearchTable:{ isOpenSearchTable: {
type: Boolean, type: Boolean,
required: false, required: false,
default: false default: false
}, },
// //
otherHeadButttonData:{ otherHeadButttonData: {
type:Array, type: Array,
required: false, required: false,
default: () => [] default: () => []
} }
@ -381,39 +420,43 @@ if (props.isBasic == true) {
} }
} }
const otherList = [...props.annexTable,{ const otherList = [
label:props.annexAliasLabel, ...props.annexTable,
prop:'Annex' {
},{ label: props.annexAliasLabel,
label:'备注', prop: 'Annex'
prop:'Remarks' },
},{ {
label:'变更记录', label: '备注',
prop:'ChangeRecord' prop: 'Remarks'
}] },
tabsList.value = [...tabsList?.value,...otherList] {
label: '变更记录',
if (!tabsList.value || tabsList.value && tabsList.value.length == otherList.length) { prop: 'ChangeRecord'
}
]
tabsList.value = [...tabsList?.value, ...otherList]
if (!tabsList.value || (tabsList.value && tabsList.value.length == otherList.length)) {
tabsList.value.unshift({ tabsList.value.unshift({
label: '明细', label: '明细',
prop: 'Detail' prop: 'Detail'
}) })
} }
// Tabs // Tabs
const tabRef = ref() const tabRef = ref()
// //
const scrollbar = ref() const scrollbar = ref()
// //
const remarkHeight = computed(() => { const remarkHeight = computed(() => {
const tab = unref(tabRef) const tab = unref(tabRef)
const tabTop = tab?.$el.getBoundingClientRect().top const tabTop = tab?.$el.getBoundingClientRect().top
const tabHeight = tab?.$el.getBoundingClientRect().height const tabHeight = tab?.$el.getBoundingClientRect().height
const height = window.innerHeight - (tabTop) - (tabHeight) - 60 const height = window.innerHeight - tabTop - tabHeight - 60
return height return height
}) })
// //
const annexData = reactive({ const annexData = reactive({
annexList: [] annexList: []
@ -442,31 +485,31 @@ const getFileList = async () => {
} }
} }
// //
const getAnnexFileList = async (row:id) => { const getAnnexFileList = async (row: id) => {
props.annexTable?.forEach(async (item) => { props.annexTable?.forEach(async (item) => {
let requstData = {...remarksData.data,tableName: item?.tableName} let requstData = { ...remarksData.data, tableName: item?.tableName }
const annexList = await FileApi.getFileList(requstData) const annexList = await FileApi.getFileList(requstData)
const annexData = annexTableData.value.find(annex=>annex.label === item.label) const annexData = annexTableData.value.find((annex) => annex.label === item.label)
if(annexData){ if (annexData) {
annexData.annexList = annexList annexData.annexList = annexList
}else{ } else {
annexTableData.value.push({ annexTableData.value.push({
align:item.align, align: item.align,
label: item.label, label: item.label,
tableName: item?.tableName || '', tableName: item?.tableName || '',
annexList, annexList,
hasSubDetail:item.hasSubDetail||false, hasSubDetail: item.hasSubDetail || false,
subDetailTableData:item.subDetailTableData subDetailTableData: item.subDetailTableData
}) })
if(item?.subDetailTableData){ if (item?.subDetailTableData) {
const { tableObject:subTableObject, tableMethods:subTableMethods } = useTable({ const { tableObject: subTableObject, tableMethods: subTableMethods } = useTable({
getListApi: item.subDetailTableData.getSubList // getListApi: item.subDetailTableData.getSubList //
}) })
const {getList:getSubList} = subTableMethods const { getList: getSubList } = subTableMethods
subTableObject.params= {} subTableObject.params = {}
item.subDetailTableData.queryParams.forEach(queryItem => { item.subDetailTableData.queryParams.forEach((queryItem) => {
subTableObject.params[queryItem.queryField] = row[queryItem.rowField] subTableObject.params[queryItem.queryField] = row[queryItem.rowField]
}); })
await getSubList() await getSubList()
item.subDetailTableData.tableList = subTableObject.tableList item.subDetailTableData.tableList = subTableObject.tableList
annexItem.subDetailTableData.tableList annexItem.subDetailTableData.tableList
@ -485,7 +528,7 @@ const deleteAnnexSuccess = async () => {
getChangeRecordList() getChangeRecordList()
} }
/** 追加的附件 */ /** 追加的附件 */
const updateAnnexTableHandle = () => { const updateAnnexTableHandle = () => {
getAnnexFileList(detailData.value) getAnnexFileList(detailData.value)
getChangeRecordList() getChangeRecordList()
} }
@ -495,11 +538,10 @@ const current = ref(0)
const change = (item, index) => { const change = (item, index) => {
current.value = index current.value = index
emit('changeTabs', item) emit('changeTabs', item)
if(otherList.find(other=>other.label==item.label)){ if (otherList.find((other) => other.label == item.label)) {
// // -- // // --
scrollbar.value.scrollTo({ top: 0}); scrollbar.value.scrollTo({ top: 0 })
} }
} }
// //
@ -532,8 +574,11 @@ const initModel = (schema: FormSchema[], formModel: Recordable) => {
const searchTableRef = ref() const searchTableRef = ref()
// //
const searchTableFormModel = ref<Recordable>({}) const searchTableFormModel = ref<Recordable>({})
if(props.isOpenSearchTable){ if (props.isOpenSearchTable) {
searchTableFormModel.value = initModel(props.detailAllSchemas.formSchema, unref(searchTableFormModel)) searchTableFormModel.value = initModel(
props.detailAllSchemas.formSchema,
unref(searchTableFormModel)
)
} }
const searchTableFormType = ref('') // create - update - const searchTableFormType = ref('') // create - update -
@ -541,7 +586,7 @@ const searchTableFormType = ref('') // 表单的类型:create - 新增;updat
const formRef = ref() const formRef = ref()
const titleNameRef = ref() const titleNameRef = ref()
const titleValueRef = ref() const titleValueRef = ref()
const count =ref(0) const count = ref(0)
const openDetail = async (row: any, titleName: any, titleValue: any, tableName: any) => { const openDetail = async (row: any, titleName: any, titleValue: any, tableName: any) => {
titleNameRef.value = titleName titleNameRef.value = titleName
titleValueRef.value = titleValue titleValueRef.value = titleValue
@ -576,9 +621,7 @@ const openDetail = async (row: any, titleName: any, titleValue: any, tableName:
let detailButtonAdd: any = [] let detailButtonAdd: any = []
if (props.detailButtonIsShowFilter) { if (props.detailButtonIsShowFilter) {
// //
detailButtonFilter = [ detailButtonFilter = [defaultButtons.defaultFilterBtn(null)]
defaultButtons.defaultFilterBtn(null)
]
} }
if (props.detailButtonIsShowAdd) { if (props.detailButtonIsShowAdd) {
// //
@ -588,10 +631,8 @@ const openDetail = async (row: any, titleName: any, titleValue: any, tableName:
}) })
] ]
} }
let detailButtonRefresh = [ let detailButtonRefresh = [defaultButtons.defaultFreshBtn(null)]
defaultButtons.defaultFreshBtn(null) HeadButttondata.value = [...detailButtonFilter, ...detailButtonAdd, ...detailButtonRefresh]
]
HeadButttondata.value = [...detailButtonFilter,...detailButtonAdd,...detailButtonRefresh]
// //
if (routeName.value.indexOf('Job') > -1) { if (routeName.value.indexOf('Job') > -1) {
@ -599,7 +640,7 @@ const openDetail = async (row: any, titleName: any, titleValue: any, tableName:
defaultButtons.defaultFilterBtn(null) // defaultButtons.defaultFilterBtn(null) //
] ]
} }
HeadButttondata.value = [...HeadButttondata.value,...props.otherHeadButttonData] HeadButttondata.value = [...HeadButttondata.value, ...props.otherHeadButttonData]
let detailButtonEdit: any = [] let detailButtonEdit: any = []
let detailButtonDelete: any = [] let detailButtonDelete: any = []
if (props.detailButtonIsShowEdit) { if (props.detailButtonIsShowEdit) {
@ -618,8 +659,7 @@ const openDetail = async (row: any, titleName: any, titleValue: any, tableName:
}) })
] ]
} }
buttondata.value = [...detailButtonEdit,...detailButtonDelete,...props.buttondataTable] buttondata.value = [...detailButtonEdit, ...detailButtonDelete, ...props.buttondataTable]
} finally { } finally {
detailLoading.value = false detailLoading.value = false
} }
@ -675,7 +715,7 @@ const { getList } = tableMethodsRef.value
const buttonBaseClick = (val, item) => { const buttonBaseClick = (val, item) => {
if (val == 'add') { if (val == 'add') {
// //
if(props.isOpenSearchTable){ if (props.isOpenSearchTable) {
searchTableFormType.value = 'create' searchTableFormType.value = 'create'
// //
searchTableFormModel.value = Object.assign(unref(searchTableFormModel), { searchTableFormModel.value = Object.assign(unref(searchTableFormModel), {
@ -684,15 +724,17 @@ const buttonBaseClick = (val, item) => {
}) })
const item = props.detailAllSchemas.formSchema[0] const item = props.detailAllSchemas.formSchema[0]
opensearchTable( opensearchTable(
item.field, item?.componentProps?.searchField, item.field,
item?.componentProps?.searchTitle, item?.componentProps?.searchField,
item?.componentProps?.searchAllSchemas, item?.componentProps?.searchTitle,
item?.componentProps?.searchPage, item?.componentProps?.searchAllSchemas,
item?.componentProps?.searchCondition, item?.componentProps?.searchPage,
item?.componentProps?.multiple, item?.componentProps?.searchCondition,
undefined,undefined item?.componentProps?.multiple,
undefined,
undefined
) )
}else{ } else {
openForm('create') openForm('create')
} }
} else if (val == 'import') { } else if (val == 'import') {
@ -709,7 +751,7 @@ const buttonBaseClick = (val, item) => {
} else { } else {
// //
console.log('其他按钮', item) console.log('其他按钮', item)
emit('buttonBaseClick',val, item) emit('buttonBaseClick', val, item)
} }
} }
@ -729,13 +771,13 @@ const opensearchTable = (
// //
if (searchCondition && searchCondition.length > 0) { if (searchCondition && searchCondition.length > 0) {
// //
for (var i=0; i< searchCondition.length; i++ ) { for (var i = 0; i < searchCondition.length; i++) {
// row // row
if (searchCondition[i].isMainValue) { if (searchCondition[i].isMainValue) {
_searchCondition[searchCondition[i].key] = detailData _searchCondition[searchCondition[i].key] = detailData
? detailData.value[searchCondition[i].value] ? detailData.value[searchCondition[i].value]
: '' : ''
}else{ } else {
_searchCondition[searchCondition[i].key] = searchCondition[i].value _searchCondition[searchCondition[i].key] = searchCondition[i].value
} }
} }
@ -762,29 +804,31 @@ const opensearchTable = (
const buttonTableClick = async (val, row) => { const buttonTableClick = async (val, row) => {
if (val == 'edit') { if (val == 'edit') {
// //
if(props.isOpenSearchTable){ if (props.isOpenSearchTable) {
searchTableFormType.value = 'update' searchTableFormType.value = 'update'
if (row?.id || row?.masterId) { if (row?.id || row?.masterId) {
searchTableFormModel.value = Object.assign(unref(searchTableFormModel), row) searchTableFormModel.value = Object.assign(unref(searchTableFormModel), row)
} }
const item = props.detailAllSchemas.formSchema[0] const item = props.detailAllSchemas.formSchema[0]
opensearchTable( opensearchTable(
item.field, item?.componentProps?.searchField, item.field,
item?.componentProps?.searchTitle, item?.componentProps?.searchField,
item?.componentProps?.searchAllSchemas, item?.componentProps?.searchTitle,
item?.componentProps?.searchPage, item?.componentProps?.searchAllSchemas,
item?.componentProps?.searchCondition, item?.componentProps?.searchPage,
item?.componentProps?.multiple, item?.componentProps?.searchCondition,
undefined,undefined item?.componentProps?.multiple,
undefined,
undefined
) )
}else{ } else {
openForm('update', row) openForm('update', row)
} }
} else if (val == 'delete') { } else if (val == 'delete') {
// //
handleDelete(row.id) handleDelete(row.id)
} else { } else {
emit('tableFormButton',val, row) emit('tableFormButton', val, row)
} }
} }
/** 添加/修改操作 */ /** 添加/修改操作 */
@ -815,10 +859,9 @@ const submitForm = async (formType, data) => {
} }
} }
const searchTableSuccess1 = (formField, searchField, val, formRef) => { const searchTableSuccess1 = (formField, searchField, val, formRef) => {
searchTableFormModel.value[formField] = val.map(item=>item[searchField]).join(',') searchTableFormModel.value[formField] = val.map((item) => item[searchField]).join(',')
submitForm(searchTableFormType.value,searchTableFormModel.value) submitForm(searchTableFormType.value, searchTableFormModel.value)
emit('searchTableSuccessDetail', formField, searchField, val, formRef) emit('searchTableSuccessDetail', formField, searchField, val, formRef)
} }
// //
@ -885,7 +928,7 @@ const selectChangeDetail = (field, val) => {
emit('selectChangeDetail', field, val) emit('selectChangeDetail', field, val)
} }
// //
const openImage=(item)=>{ const openImage = (item) => {
emit('openImage', item) emit('openImage', item)
} }
/** /**
@ -893,22 +936,22 @@ const openImage=(item)=>{
* @param field 当前操作字段 * @param field 当前操作字段
* @param cur 改变后值 * @param cur 改变后值
*/ */
const detailBasicFormOnChange = (field, cur) => { const detailBasicFormOnChange = (field, cur) => {
emit('detailBasicFormOnChange', field, cur) emit('detailBasicFormOnChange', field, cur)
} }
/** /**
* 监听失焦事件 * 监听失焦事件
* @param field 当前操作字段 * @param field 当前操作字段
* @param e * @param e
*/ */
const onBlur = (field, e) => { const onBlur = (field, e) => {
emit('onBlur', field, e) emit('onBlur', field, e)
} }
// //
const formFormDateChange = (field, val,row, index) => { const formFormDateChange = (field, val, row, index) => {
emit('formFormDateChange', field, val,row, index) emit('formFormDateChange', field, val, row, index)
} }
// //
watch( watch(
@ -920,7 +963,7 @@ watch(
tableObject.params.schedulingCode = masterParmas.value.schedulingCode tableObject.params.schedulingCode = masterParmas.value.schedulingCode
detailAllSchemasRef.value = props.detailAllSchemas detailAllSchemasRef.value = props.detailAllSchemas
if (props.tableObjectExtend) { if (props.tableObjectExtend) {
props.tableObjectExtend.forEach(item => { props.tableObjectExtend.forEach((item) => {
tableObject.params[item.key] = item.value tableObject.params[item.key] = item.value
}) })
} }

6
src/views/mes/workScheduling/index.vue

@ -60,9 +60,9 @@
:apiCreate="WorkSchedulingDetailApi.createWorkSchedulingDetail" :apiCreate="WorkSchedulingDetailApi.createWorkSchedulingDetail"
:apiUpdate="WorkSchedulingDetailApi.updateWorkSchedulingDetail" :apiUpdate="WorkSchedulingDetailApi.updateWorkSchedulingDetail"
:apiDelete="WorkSchedulingDetailApi.deleteWorkSchedulingDetail" :apiDelete="WorkSchedulingDetailApi.deleteWorkSchedulingDetail"
:detailButtonIsShowAdd="true" :detailButtonIsShowAdd="false"
:detailButtonIsShowEdit="true" :detailButtonIsShowEdit="false"
:detailButtonIsShowDelete="true" :detailButtonIsShowDelete="false"
@handleMainFefresh="handleMainFefresh" @handleMainFefresh="handleMainFefresh"
@searchTableSuccessDetail="searchTableSuccessDetail" @searchTableSuccessDetail="searchTableSuccessDetail"
:key="count" :key="count"

18
src/views/mes/workScheduling/workScheduling.data.ts

@ -380,13 +380,13 @@ export const WorkSchedulingDetail = useCrudSchemas(reactive<CrudSchema[]>([
isForm:false, isForm:false,
isDetail:false, isDetail:false,
}, },
{ // {
label: '操作', // label: '操作',
field: 'action', // field: 'action',
isForm: false, // isForm: false,
table: { // table: {
width: 150, // width: 150,
fixed: 'right' // fixed: 'right'
} // }
} // }
])) ]))

Loading…
Cancel
Save