Commit 97d2e6b8 authored by 旭艳's avatar 旭艳

生产准备检查页面开发

parent a30a1365
<!--
* @Author:fangk
* @Date: 2021-03-23
* @Description: 生产准备检查-生产准备检查
* @setAuthor:fangk 2021-03-22
-->
<template>
<div class="production-preparation-inspection-confirmation">
<el-table
:ref="onlyUuid"
:data="confirmaData"
row-key="id"
default-expand-all
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
>
<el-table-column type="index" align="center" label="序号" :width="65" />
<el-table-column
prop="materNo"
label="装配单元/AO号"
sortable
:min-width="150"
/>
<el-table-column
v-if="conStatus === 'Y'"
prop="planStateCode"
align="center"
label="状态"
sortable
:width="90"
:formatter="planStateCodeFormatter"
/>
<el-table-column
prop="fitRates"
align="center"
label="齐套率"
sortable
:width="90"
:formatter="fitRatesFormatter"
/>
<el-table-column
prop="workHour"
align="center"
label="工期(h)"
:width="70"
/>
<el-table-column
prop="scheduledStart"
align="center"
label="计划开工时间"
sortable
:min-width="170"
/>
<el-table-column
prop="scheduledEnd"
align="center"
label="计划完工时间"
sortable
:min-width="170"
/>
<el-table-column
prop="index"
align="center"
label="前置节点"
:width="100"
:formatter="preposeFormatter"
/>
</el-table>
</div>
</template>
<script>
import { v4 as uuidv4 } from 'uuid'
// import { exportExcel } from '@/api/exportExcel-elementUI.js'
export default {
props: {
confirmaData: {
type: Array,
default: () => []
},
conStatus: {
type: String,
default: 'N'
}
},
data() {
return {
onlyUuid: ''
}
},
mounted() { this.onlyUuid = uuidv4() },
created() {},
methods: {
/**
*格式化齐套率
*/
fitRatesFormatter(row, column, cellValue, index) {
return cellValue === 1 ? '符合' : '不符合'
},
/**
*格式化前置
*/
preposeFormatter(row, column, cellValue, index) {
const that = this
var linkTitle = []
if (row.executorVoList && row.executorVoList.length) {
row.executorVoList.forEach((p) => {
if (row.parenId) {
const data = that.confirmaData.filter(
(t) => t.id === row.parenId
)[0].children
const item = data.filter((t) => t.id === p.prevNodeId)
if (item && item.length) {
linkTitle.push(item[0].index)
}
} else {
const item = that.confirmaData.filter((t) => t.id === p.prevNodeId)
if (item && item.length) {
linkTitle.push(item[0].index)
}
}
})
}
return linkTitle.join(',')
},
/**
* 状态
*/
planStateCodeFormatter(row, column, cellValue, index) {
if (!cellValue) return
var dictValue = this.$parent.joExecutePlanStateData.filter(
(p) => p.dictKey === cellValue
)
if (dictValue && dictValue.length) {
return dictValue[0].dictValue
}
return ''
}
/**
* 导出数据
*/
// exportTable() {
// exportExcel(this.$refs[this.onlyUuid].$el, '总装制造执行系统')
// },
// exportTable2() {
// exportExcel(this.$parent.$refs[this.$parent.onlyUuid].$el, '准备情况')
// }
}
}
</script>
<template>
<div class="production-preparation-inspection-confirmation">
<header>
<div class="left">
<div>
<div class="search">
<div>
<span>架次:</span>
<el-select
v-model="sorties"
placeholder="请选择"
:loading="sortiesLoading"
size="small"
clearable
@change="changeSorties"
>
<el-option
v-for="item in sortiesData"
:key="item.id"
:label="item.label"
:value="item.value"
/>
</el-select>
</div>
<div>
<span>站位:</span>
<el-select
v-model="platformId"
clearable
placeholder="请选择"
:loading="platformLoading"
size="small"
@change="changePlatform"
>
<el-option
v-for="item in platformData"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</div>
<div class="aoname">
<span>AO号:</span>
<el-input
v-model="AOname"
clearable
size="small"
placeholder="AO名称/号"
/>
</div>
</div>
<div>
<div>
计划时间:
<el-date-picker
v-model="date"
clearable
size="small"
type="daterange"
value-format="yyyy-MM-dd"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
/>
</div>
<!-- <div>
<span>表格显示计划状态:</span>
<el-select v-model="tableShow" placeholder="请选择" size="small">
<el-option value="1" label="合并显示" />
<el-option value="2" label="显示准备情况确认表" />
<el-option value="3" label="显示生产准备确认项表" />
</el-select>
</div> -->
</div>
</div>
<div>
<el-button
size="small"
type="primary"
@click="getCheckConfirm"
>查询</el-button>
<el-button
size="small"
type="info"
@click="clearSearch"
>清除</el-button>
</div>
</div>
<div class="right">
<div>
<el-progress
type="dashboard"
:percentage="completeProportion"
:width="90"
:color="colors"
/>
<span>站位作业计划:{{ percentage.completeCount }}/{{
percentage.carryCount
}}</span>
</div>
<div>
<el-progress
type="dashboard"
:width="90"
:percentage="fitRatesProportion"
:color="colors"
/>
<span>生产准备符合项:{{ percentage.fitRatesCount }}/{{
percentage.carryCount
}}</span>
</div>
</div>
</header>
<split-pane
:min-percent="18"
:default-percent="50"
split="vertical"
class="detail-pane"
>
<template slot="paneL">
<header>
<el-tabs v-model="conStatus" type="card" @tab-click="getCheckConfirm">
<el-tab-pane label="待确认" name="Not" />
<el-tab-pane label="已确认" name="Yes" />
</el-tabs>
<div>
<dee-tools :tools="tools" mode="normal" app-name="tf-mom" :collapse="false" />
<!-- <el-button
v-if="conStatus === 'Not'"
class="dee-tools"
size="small"
@click="preparaConfirmation(true)"
>
<img
src="/icons/c-newpart.png"
class="icon"
alt=""
>生产准备确认</el-button>
<el-button
v-else
class="dee-tools"
size="small"
@click="preparaConfirmation(false)"
>
<img
src="/icons/c-newpart.png"
class="icon"
alt=""
>撤销</el-button> -->
<!-- <el-button class="dee-tools" size="small" @click="exportTable">
<img
src="/icons/c-Import.png"
class="icon"
alt=""
>导出</el-button> -->
</div>
</header>
<div v-loading="confirmaLoading" class="table">
<el-table
v-if="!confirmaLoading"
ref="table"
:data="confirmaData"
size="small"
border
style="width: 100%"
height="100%"
row-key="id"
:cell-class-name="setCellStyle"
:row-class-name="rowClassName"
:tree-props="{
children: 'children',
hasChildren: 'hasChildren',
}"
:expand-row-keys="defaultExpand"
@expand-change="expandChange"
@row-click="getReadyConfirm"
@select-all="selectAll"
@cell-dblclick="cellDblclick"
>
<el-table-column type="selection" :width="55" align="center">
<template slot-scope="scope">
<div @click="selectChange($event, scope.row)">
<span
v-if="scope.row.isChecked === true"
class="el-checkbox__input is-checked"
>
<span class="el-checkbox__inner" />
<input
type="checkbox"
aria-hidden="false"
class="el-checkbox__original"
value=""
>
</span>
<span
v-if="scope.row.isChecked === null"
class="el-checkbox__input is-indeterminate"
tabindex="0"
role="checkbox"
aria-checked="mixed"
>
<span class="el-checkbox__inner" />
<input
type="checkbox"
aria-hidden="true"
class="el-checkbox__original"
value=""
>
</span>
<span
v-if="scope.row.isChecked === false"
class="el-checkbox__input"
>
<span class="el-checkbox__inner" />
<input
type="checkbox"
aria-hidden="false"
class="el-checkbox__original"
value=""
>
</span>
</div>
</template>
</el-table-column>
<el-table-column
prop="index"
align="center"
label="序号"
:width="65"
/>
<el-table-column
prop="materNo"
label="装配单元/AO号"
sortable
:min-width="220"
show-overflow-tooltip
/>
<el-table-column
prop="materName"
label="AO名称"
sortable
:min-width="150"
show-overflow-tooltip
/>
<el-table-column
prop="gaceVersion"
align="center"
label="版次"
sortable
:width="90"
/>
<el-table-column
v-if="conStatus === 'Yes'"
prop="planStateCode"
align="center"
label="状态"
sortable
:width="90"
:formatter="planStateCodeFormatter"
/>
<el-table-column
prop="fitRates"
align="center"
label="齐套率"
sortable
:width="120"
:formatter="fitRatesFormatter"
/>
<el-table-column
prop="workHour"
align="center"
label="工期(h)"
:width="70"
/>
<el-table-column
prop="scheduledStart"
align="center"
label="计划开工时间"
sortable
:min-width="170"
/>
<el-table-column
prop="scheduledEnd"
align="center"
label="计划完工时间"
sortable
:min-width="170"
/>
</el-table>
</div>
</template>
<template slot="paneR">
<header>
<el-radio-group
v-model="readyStatus"
size="small"
@change="getRadioGroup"
>
<el-radio-button
v-for="item in tabsData"
:key="item.typeName"
:label="item.typeName"
>{{ item.name }}</el-radio-button>
</el-radio-group>
<div>
<!-- <el-button
class="dee-tools"
size="small"
@click="exportTableSituation"
>
<img
src="/icons/c-Import.png"
class="icon"
alt=""
>导出</el-button> -->
<div v-if="conStatus === 'Yes'" class="legnd">
<div
v-for="item in joExecutePlanStateData"
v-show="item.label !== '未下达'"
:key="item.value"
@click="getCheckConfirmYes(item.value)"
>
<div>
<span />
<span>{{ item.label }}</span>
</div>
<!-- <div>{{ item.dictSeq }}</div> -->
</div>
</div>
</div>
</header>
<div v-loading="preparaLoading" class="table">
<el-table
v-if="!preparaLoading"
:ref="onlyUuid"
:data="preparaData"
size="small"
border
style="width: 100%"
height="100%"
>
<el-table-column
type="index"
align="center"
label="序号"
:width="65"
fixed
/>
<!-- <el-table-column
v-if="readyStatus==='supportingMaterials'||readyStatus==='material'"
prop="isClosure"
label="是否关闭"
align="center"
:min-width="100"
show-overflow-tooltip
fixed
>
<template slot-scope="scope">
<el-tooltip :content="scope.row.isClosure?'已关闭':'未关闭'" placement="top">
<el-switch
v-model="scope.row.isClosure"
:disabled="readyStatus==='material' && !scope.row.isRecord"
active-color="#13ce66"
inactive-color="#ff4949"
@change="isClosure($event,scope.row.tsriId)"
/>
</el-tooltip>
</template>
</el-table-column>
<el-table-column
v-if="readyStatus==='material'"
prop="isRecord"
label="是否记实"
align="center"
:min-width="100"
show-overflow-tooltip
fixed
:formatter="(row, column, cellValue, index)=>{
if(cellValue){
return '是'
}else{
return '否'
}
}"
/> -->
<el-table-column
prop="aoName"
align="center"
label="AO名称"
sortable
:min-width="150"
show-overflow-tooltip
/>
<el-table-column
prop="extMaterial.modelNo"
align="center"
:label="
readyStatus === 'supportingMaterials'
? '型号/件号'
: readyStatus === 'equipmentTooling'
? '规格型号'
: '牌号'
"
sortable
show-overflow-tooltip
:width="120"
/>
<el-table-column
prop="extMaterial.resName"
align="center"
label="名称"
sortable
show-overflow-tooltip
:width="90"
/>
<el-table-column
v-if="readyStatus !== 'material'"
prop="extMaterial.resCode"
align="center"
label="编号"
sortable
:width="90"
/>
<el-table-column
v-if="readyStatus !== 'equipmentTooling'"
prop="extMaterial.resType2.typeName"
align="center"
label="物料类型"
sortable
:width="120"
/>
<el-table-column
v-if="readyStatus === 'material'"
prop="extMaterial.spec"
align="center"
label="规格"
sortable
:width="120"
/>
<el-table-column
v-if="readyStatus === 'material'"
prop="extMaterial.techSpec"
align="center"
label="技术条件"
sortable
show-overflow-tooltip
:width="120"
/>
/>
<el-table-column
v-if="readyStatus === 'material'"
prop="extMaterial.supplyStatus"
align="center"
label="供应状态"
sortable
:width="120"
/>
<el-table-column
v-if="readyStatus === 'supportingMaterials'"
prop="route"
align="center"
label="工艺路线"
:width="120"
show-overflow-tooltip
/>
<el-table-column
prop="needTime"
align="center"
label="需求时间"
sortable
:min-width="130"
:formatter="dateFormater"
/>
<el-table-column
prop="reqAmount"
align="center"
:label="readyStatus === 'equipmentTooling' ? '数量' : '需求数量'"
sortable
:width="120"
/>
<el-table-column
prop="extMaterial.unitName"
align="center"
label="单位"
:width="90"
/>
<el-table-column
v-if="readyStatus === 'supportingMaterials'"
prop="checkOutAmount"
align="center"
label="已配发数"
sortable
:width="120"
/>
<el-table-column
v-if="readyStatus === 'supportingMaterials'"
prop="lostAmount"
align="center"
label="缺件数量"
sortable
:width="120"
/>
<el-table-column
prop="amount"
align="center"
:label="
readyStatus === 'equipmentTooling' ? '可用数量' : '库存数'
"
sortable
:width="120"
/>
<el-table-column
v-if="readyStatus == 'supportingMaterials'"
prop="takeAmount"
align="center"
label="占用数量"
sortable
:width="120"
/>
<el-table-column
v-if="readyStatus === 'supportingMaterials'"
prop="expectStorageTime"
align="center"
label="预计入库时间"
sortable
:min-width="130"
:formatter="dateFormater"
/>
</el-table>
</div>
</template>
</split-pane>
<dee-dialog
v-if="visible"
title="编辑时间"
:dialog-visible.sync="visible"
custom-class="production-preparation-inspection-confirmation-dialog"
width="400px"
>
<div class="from">
<div>
<label>计划开始时间:</label>
<el-date-picker
v-model="editRow.scheduledStart"
type="datetime"
placeholder="选择日期时间"
/>
</div>
<div>
<label>计划结束时间:</label>
<el-date-picker
v-model="editRow.scheduledEnd"
type="datetime"
placeholder="选择日期时间"
/>
</div>
</div>
<div slot="footer" class="dialog-footer">
<el-button size="mini" @click="clearEditRow">取 消</el-button>
<el-button
size="mini"
type="primary"
@click="confirmEditRow"
>确认</el-button>
</div>
</dee-dialog>
<!-- 只做表格导出用途 因为插件不支持树表导出-->
<export-excel-table
v-show="false"
ref="exportExcelTable"
:con-status="conStatus"
:confirma-data="confirmaData"
/>
</div>
</template>
<script>
import { post } from '@/utils/http'
import { v4 as uuidv4 } from 'uuid'
import exportExcelTable from './exportExcelTable.vue'
export default {
name: 'StationPlanDetails',
components: {
exportExcelTable
},
data() {
return {
sorties: null,
sortiesLoading: false,
sortiesData: [],
sortiesName: null,
platformId: null,
platformLoading: false,
platformData: [],
platformName: null,
AOname: null,
conStatus: 'Not',
// 工具栏
tools: [
{
addRowTemplateDataPosition: 'last',
btnStyle: '',
btnValue: 'importFile',
businessType: 'importFile',
downloadParams: 'downloadParams = {}',
downloadRequestMethod: 'get',
editTableShowMode: 'alway',
icon: '/icons/c-Import.png',
importUrl: '/JoExecutePlan/importByExcel',
key: 'importFile',
loadSelfComType: 'privateComponents',
name: '批量更新计划',
notDetectionControl: false,
rowEditSubmitAddress: 'requestURL=""',
rowEditSubmitHttpType: 'post',
rowEditSubmitParams: 'requestParams = row',
rowEditSubmitReturnVal: 'newRow = res.items',
selectNum: 'one',
templateDataFun: 'return {}'
},
{
name: '生产准备确认',
icon: '/icons/c-newpart.png'
}
],
editRow: {
id: null,
parenId: null,
scheduledStart: new Date(),
scheduledEnd: new Date()
},
date: [],
tabsData: [
{
typeName: null,
name: '加载中'
}
],
tableShow: '2',
percentage: {
completeCount: 0,
carryCount: 0,
fitRatesProportion: 0,
fitRatesCount: 0
},
colors: [
{ color: '#f56c6c', percentage: 20 },
{ color: '#e6a23c', percentage: 40 },
{ color: '#5cb87a', percentage: 60 },
{ color: '#1989fa', percentage: 80 },
{ color: '#6f7ad3', percentage: 100 }
],
readyStatus: '',
joExecutePlanStateData: [],
confirmaLoading: false,
confirmaData: [],
onlyUuid: null,
preparaLoading: false,
preparaData: [],
defaultExpand: [],
visible: false,
SoriteTypeOptions: []
}
},
computed: {
fitRatesProportion() {
return this.percentage.fitRatesCount && this.percentage.carryCount ? Math.round((this.percentage.fitRatesCount / this.percentage.carryCount) * 1000) / 10 : 0
},
completeProportion() {
return this.percentage.completeCount && this.percentage.carryCount ? Math.round((this.percentage.completeCount / this.percentage.carryCount) * 1000) / 10 : 0
}
},
created() {
this.sorties = this.$route.query.sorties
this.platformId = this.$route.query.postion
this.sortiesName = this.$route.query.sortiesName
this.platformName = this.$route.query.postionName
this.$utils.getDicListByCode('SoriteType').then(res => {
this.SoriteTypeOptions = res
this.getAddRecursion()
})
this.getStandPosition()
this.getPercentage()
},
mounted() {
this.onlyUuid = uuidv4()
},
methods: {
/**
* 获取架次数据
*/
getAddRecursion() {
this.sortiesLoading = true
const params = { 'searchItems': { 'items': [] }, 'sortItem': [{ 'fieldName': 'modifyTime', 'sortOrder': 'asc' }] }
params.openProps = [{ name: 'target' }, { name: 'source' }]
this.$api.searchApi('SoritesLink', params)
.then((res) => {
this.sortiesData = []
if (res.items && res.items.content && res.items.content.length) {
this.sortiesData = res.items.content.map(row => {
return {
value: `${row.sourceId}:${row.targetId}`,
label: this.getSoritesLabel(row),
sortiesName: row.source.defName
}
})
} else {
this.$message({
showClose: true,
message: res.message,
type: 'error'
})
}
})
.catch((err) => console.error(err))
.finally(() => {
this.sortiesLoading = false
})
},
getSoritesLabel(row) {
const type = (row.target && row.target.type) ? this.SoriteTypeOptions.find(r => r.value === row.target.type) : ''
return `${row.source.defName} ${type && type.label || ''}`
},
changeSorties() {
const sorties = this.sortiesData.find(r => r.value === this.sorties)
this.sortiesName = sorties && sorties.sortiesName || ''
this.getStandPosition()
},
/**
* 获取站位数据
*/
getStandPosition() {
const that = this
that.platformLoading = true
that.platformData = []
const sortiesId = this.sorties.split(':')[0]
const sortiesTypeId = this.sorties.split(':').slice(-1)[0]
const params = {
'searchItems': { 'items': [{ 'fieldName': 'aircraftSortiesId', 'operator': 'EQ', 'value': sortiesId }, { 'fieldName': 'soritesTypeId', 'operator': 'EQ', 'value': sortiesTypeId }] },
'openProps': [{ name: 'aircraftSorties' }],
'sortItem': [{ 'fieldName': 'serialNumber', 'sortOrder': 'asc' }]
}
post(`ExtPosition/search`, params)
.then((res) => {
if (res) {
if (res.items && res.items.content && res.items.content.length) {
that.platformData = res.items.content.map(row => {
return {
value: `${row.id}`,
label: row.serialNumber
}
})
}
} else {
this.$message({
showClose: true,
message: res.message,
type: 'error'
})
}
})
.catch((err) => console.error(err))
.finally(() => {
that.platformLoading = false
})
},
changePlatform() {
this.percentage = {
completeProportion: 0,
completeCount: 0,
carryCount: 0,
fitRatesCount: 0
}
const postion = this.platformData.find(r => r.value === this.platformId)
this.platformName = postion && postion.label || ''
this.getPercentage()
},
getPercentage() {
this.getLeftCount()
this.getRightCount()
this.getJoExecutePlanCount()
this.getJoExecutePlanState()
// this.getCheckConfirm()
},
/**
* 获取生产准备符合项
*/
getLeftCount() {
const params = {
'operator': 'AND',
'items': [
{
'fieldName': 'extProcessPlan.sorties',
'operator': 'EQ',
'value': this.sortiesName
},
{
'fieldName': 'extProcessPlan.positionNumber',
'operator': 'EQ',
'value': this.platformName
},
{
'fieldName': 'extProcessPlan.subTypeName',
'operator': 'IN',
'value': [
'ExtProcessPlanAssembly',
'ExtProcessPlanAOR'
]
},
{
'fieldName': 'fitRates',
'operator': 'EQ',
'value': '1'
}
]
}
post(`/ExtSupporting/count`, params).then(res => {
if (res.items) {
this.$set(this.percentage, 'fitRatesCount', res.items)
// this.missInfo.leftItem = res.items
}
}).finally(() => {
})
},
getRightCount() {
const params = {
'operator': 'AND',
'items': [
{
'fieldName': 'sorties',
'operator': 'EQ',
'value': this.sortiesName
},
{
'fieldName': 'positionNumber',
'operator': 'EQ',
'value': this.platformName
},
{
'fieldName': 'subTypeName',
'operator': 'IN',
'value': [
'ExtProcessPlanAssembly',
'ExtProcessPlanAOR'
]
}
]
}
post(`/ExtProcessPlan/count`, params).then(res => {
if (res.items) {
this.$set(this.percentage, 'carryCount', res.items)
}
}).finally(() => {
})
},
getJoExecutePlanCount() {
const params = {
'operator': 'AND',
'items': [
{
'fieldName': 'extProcessPlan.sorties',
'operator': 'EQ',
'value': this.sortiesName
},
{
'fieldName': 'extProcessPlan.positionNumber',
'operator': 'EQ',
'value': this.platformName
},
{
'fieldName': 'planState',
'operator': 'EQ',
'value': 'Finish'
}
]
}
post(`/JoExecutePlan/count`, params).then(res => {
if (res.items) {
this.$set(this.percentage, 'completeCount', res.items)
}
}).finally(() => {
})
},
/**
* 获取作业计划状态
*/
async getJoExecutePlanState() {
this.$utils.getDicListByCode('PlanState').then(res => {
if (res) {
this.joExecutePlanStateData = res
} else {
this.joExecutePlanStateData = []
}
})
},
/**
* 生产准备确认 or 撤销
*/
preparaConfirmation() {
const list = this.getFindCheck().join()
this.confirmaLoading = true
const that = this
post(`JoExecutePlan/stateToYes?ids=${list}`)
.then((res) => {
if (res) {
that.$message({
showClose: true,
message: '操作' + res.message,
type: 'success'
})
} else {
that.$message({
showClose: true,
message: '操作' + res.message,
type: 'warning'
})
}
})
.catch((err) => console.error(err))
.finally(() => {
that.getCheckConfirm()
})
},
/**
* 撤销
*/
revoke() {
var list = this.getFindCheck().map((p) => {
return {
operator: 'MODIFY',
id: p,
planState: 'Not'
}
})
this.confirmaLoading = true
const that = this
post('/JoExecutePlan/recursions', list)
.then((res) => {
if (res) {
that.$message({
showClose: true,
message: '操作' + res.message,
type: 'success'
})
} else {
that.$message({
showClose: true,
message: '操作' + res.message,
type: 'warning'
})
}
})
.catch((err) => console.error(err))
.finally(() => {
that.getCheckConfirm()
})
},
/**
* 获取检查确认数据
*/
getCheckConfirm() {
if (this.conStatus === 'Yes') {
this.tools.pop()
this.tools.push(
{
name: '撤销',
icon: '/icons/c-newpart.png',
handler: {
click: () => {
this.revoke()
}
}
}
)
} else {
this.tools.pop()
this.tools.push(
{
name: '生产准备确认',
icon: '/icons/c-newpart.png',
handler: {
click: () => {
this.preparaConfirmation()
}
}
}
)
}
this.getCheckConfirmYes()
},
getCheckConfirmYes(status) {
var that = this
that.confirmaLoading = true
post(
'WrProduction/findProductionPrepare',
{
sorties: this.sortiesName,
positionNumber: this.platformName,
serialNumber: this.AOname,
scheduledStart: (this.date.length && this.date[0]) || '',
scheduledEnd: (this.date.length && this.date[1]) || '',
state: this.conStatus
}
)
.then((res) => {
that.confirmaData = []
that.preparaData = []
var index = 0
if (res) {
that.tableShow = '2'
if (res.items && res.items.length) {
res.items.forEach((p) => {
if (
p.aoPlans &&
p.aoPlans.length &&
p.wrProduction &&
p.wrProduction[0].scheduledStart &&
p.wrProduction[0].scheduledEnd
) {
var children = []
index += 1
that.confirmaData.push({
id: p.id,
materNo: p.serialNumber,
workHour: p.workHour,
fitRates: p.fitRates,
scheduledStart: p.wrProduction[0].scheduledStart,
scheduledEnd: p.wrProduction[0].scheduledEnd,
children: children,
index: index,
materName: p.name,
planStateCode: null,
isChecked: false,
gaceVersion: p.gaceVersion
})
if (p.aoPlans && p.aoPlans.length) {
var indexcChildren = 0
p.aoPlans.forEach((q) => {
if (
q.joExecutePlan &&
q.joExecutePlan[0].scheduledStart &&
q.joExecutePlan[0].scheduledEnd
) {
indexcChildren += 1
children.push({
id: q.id,
materNo: q.serialNumber,
workHour: q.workHour,
fitRates: q.fitRates,
parenId: p.id,
scheduledStart: q.joExecutePlan[0].scheduledStart,
scheduledEnd: q.joExecutePlan[0].scheduledEnd,
index: '(' + indexcChildren + ')',
materName: q.name,
planStateCode: q.joExecutePlan[0].planState,
joExecutePlanVoId: q.joExecutePlan[0].id,
isChecked: false,
isRenew: q.joExecutePlan[0].isRenew,
gaceVersion: q.gaceVersion
})
}
})
}
}
})
}
} else {
this.$message({
showClose: true,
message: res.message,
type: 'error'
})
}
})
.catch((err) => console.error(err))
.finally(() => {
that.confirmaLoading = false
that.tabsData = [
{
typeName: 'supportingMaterials',
name: '配套物料'
}, {
typeName: 'material',
name: '材料'
}, {
typeName: 'equipmentTooling',
name: '设备工装工具'
}
]
this.readyStatus = this.tabsData[0].typeName
that.confirmaData.length &&
this.$nextTick(() => {
!this.defaultExpand.length &&
this.defaultExpand.push(that.confirmaData[0].id.toString())
that.$refs.table.setCurrentRow(that.confirmaData[0].children[0])
that.getReadyConfirm(that.confirmaData[0].children[0])
that.tableShow = '1'
})
})
},
expandChange(row, expand) {
if (expand) {
this.defaultExpand.push(row.id.toString())
} else {
this.defaultExpand = this.defaultExpand.filter(
(p) => p !== row.id.toString()
)
}
},
clearEditRow() {
this.editRow.scheduledStart = null
this.editRow.scheduledEnd = null
this.visible = false
},
confirmEditRow() {
if (
new Date(this.editRow.scheduledStart) >
new Date(this.editRow.scheduledEnd)
) {
this.$message({
message: '计划开始时间不能大于计划结束时间!',
type: 'error'
})
return
}
var that = this
var params = {
id: this.editRow.id,
scheduledStart:
new Date(this.editRow.scheduledStart)
.toLocaleDateString()
.split('/')
.join('-') +
' ' +
new Date(this.editRow.scheduledStart).toTimeString().split(' ')[0],
scheduledEnd:
new Date(this.editRow.scheduledEnd)
.toLocaleDateString()
.split('/')
.join('-') +
' ' +
new Date(this.editRow.scheduledEnd).toTimeString().split(' ')[0],
isRenew: true
}
this.HttpRequest(`/JoExecutePlan/modifyingTime`, params, 'post')
.then((res) => {
if (res && res.message.includes('成功')) {
this.$message({
message: '修改成功!',
type: 'success'
})
} else {
this.$message({
showClose: true,
message: res.message,
type: 'error'
})
}
})
.catch((err) => console.error(err))
.finally(() => {
// eslint-disable-next-line eqeqeq
var row = that.confirmaData
.filter((p) => p.id === this.editRow.parenId)[0]
.children.filter((p) => p.joExecutePlanVoId === this.editRow.id)[0]
row.scheduledStart = params.scheduledStart
row.scheduledEnd = params.scheduledEnd
row.isRenew = true
this.clearEditRow()
})
},
/**
* 行编辑
*/
cellDblclick(row, column, cell, event) {
if (
!row.children &&
(column.property === 'scheduledStart' ||
column.property === 'scheduledEnd')
) {
if (row.planStateCode === 'Finish') {
this.$message({
message: '当前状态无法编辑!',
type: 'warning'
})
} else {
this.editRow.id = row.joExecutePlanVoId
this.editRow.scheduledStart = row.scheduledStart
this.editRow.scheduledEnd = row.scheduledEnd
this.editRow.parenId = row.parenId
this.visible = true
}
}
},
/**
* 获取准备确认数据
*/
getReadyConfirm(row, column) {
if (column && !column.property) return
if (row.children && row.children.length) return
if (
(column && column.property === 'scheduledStart') ||
(column && column.property === 'scheduledEnd')
) {
return
}
var that = this
that.$set(row, 'highlight', true)
// row.highlight = true
that.confirmaData.forEach((p) => {
p.children.forEach((q) => {
if (row.id !== q.id) q.highlight = false
})
})
that.preparaLoading = true
post(
`ExtSupportingItem/productionOffside?aoId=${row.id}` +
(that.readyStatus ? `&typeName=${that.readyStatus}` : ''))
.then((res) => {
that.preparaData = []
if (res && res.items) {
res.items.forEach(item => {
item.aoName = row.materName
})
that.preparaData = res.items
} else {
this.$message({
showClose: true,
message: res.message,
type: 'error'
})
}
})
.catch((err) => console.error(err))
.finally(() => {
that.preparaLoading = false
})
},
getRadioGroup() {
let row = {}
this.confirmaData.forEach((p) => {
p.children.forEach((q) => {
if (q.highlight === true) row = q
})
})
this.getReadyConfirm(row)
},
/**
*格式化齐套率
*/
fitRatesFormatter(row, column, cellValue, index) {
if (cellValue) return Math.round(cellValue * 1000) / 10 + '%'
return '0%'
},
/**
* 状态
*/
planStateCodeFormatter(row, column, cellValue, index) {
if (!cellValue) return
var dictValue = this.joExecutePlanStateData.filter(
(p) => p.value === cellValue
)
if (dictValue && dictValue.length) {
return dictValue[0].label
}
return ''
},
/**
* 格式化时间
*/
dateFormater(row, column, cellValue, index) {
if (cellValue) {
return new Date(cellValue)
.toLocaleDateString()
.split('/')
.join('-')
}
return ''
},
/**
* 清空参数
*/
clearSearch() {
this.AOname = null
this.date = []
this.getStandPosition()
},
rowClassName({ row, rowIndex }) {
if (row.children) {
return 'disabled'
} else if (row.highlight) {
return 'row-highlight'
}
},
setCellStyle({ row, column, rowIndex, columnIndex }) {
if (
row.planStateCode &&
column.property &&
column.property === 'planStateCode'
) {
return 'cellcolor ' + row.planStateCode
} else if (
column.property &&
column.property === 'index' &&
row.isRenew
) {
return 'isrenew'
}
},
/**
* 表格全选复选框
* @并修复element树形表格(treeTable)子级与父级不联动
*/
selectAll(selection) {
var isCheckedCheck = selection.length === this.confirmaData.length
this.confirmaData.forEach((p) => {
p.isChecked = isCheckedCheck
p.children.forEach((q) => {
q.isChecked = isCheckedCheck
})
})
},
/**
* 表格复选框
* @并修复element树形表格(treeTable)子级与父级不联动
* @param true 选择
* @param null 不全选
* @param false 不选
*/
selectChange($event, row) {
var isCheck = row.isChecked === null || row.isChecked === false
if (row.children && row.children.length) {
row.isChecked = isCheck
row.children.forEach((p) => {
p.isChecked = isCheck
})
} else {
row.isChecked = isCheck
var item = this.confirmaData.filter((p) => p.id === row.parenId)[0]
const isCheckedTrue = item.children.some((p) => {
return p.isChecked === true
})
const isCheckedFalse = item.children.some((p) => {
return p.isChecked === false
})
if (isCheckedTrue && isCheckedFalse) {
item.isChecked = null
} else {
var isCheckedCheck = item.children.every((p) => {
return p.isChecked
})
if (isCheckedCheck) {
item.isChecked = true
} else {
item.isChecked = false
}
}
}
const isCheckedTrue = this.confirmaData.some((p) => {
return p.isChecked === true
})
const isCheckedFalse = this.confirmaData.some((p) => {
return p.isChecked === false
})
// 存在两种情况
const isCheckedNull = this.confirmaData.some((p) => {
return p.isChecked === null
})
if ((isCheckedTrue && isCheckedFalse) || isCheckedNull) {
this.$refs.table.clearSelection()
this.$refs.table.toggleRowSelection(this.confirmaData[0], true)
} else {
const isCheckedCheck = this.confirmaData.every((p) => {
return p.isChecked
})
if (isCheckedCheck) {
this.confirmaData.forEach((p) => {
this.$refs.table.toggleRowSelection(p, true)
p.children.forEach((t) => {
this.$refs.table.toggleRowSelection(t, true)
})
})
} else {
this.$refs.table.clearSelection()
}
}
},
/**
* 查找已选择元素Id
*/
getFindCheck() {
const data = []
this.confirmaData.forEach((p) => {
p.children.forEach((q) => {
if (q.isChecked) {
data.push(q.joExecutePlanVoId)
}
})
})
return data
},
/**
* 是否关闭
*/
isClosure(bool, id) {
this.HttpRequest(
`/productionOffside/isClosure?id=${id}&isClosure=${bool}`,
{},
'post'
)
.then((res) => {
if (res.message.includes('成功')) {
this.$message({
showClose: true,
message: '修改成功!',
type: 'success'
})
} else {
this.$message({
showClose: true,
message: res.message,
type: 'error'
})
}
})
.catch((err) => console.error(err))
.finally(() => {})
}
/**
* 导出数据
*/
// exportTable() {
// this.$refs.exportExcelTable.exportTable()
// },
// exportTableSituation() {
// var title = ''
// this.confirmaData.forEach((p) => {
// p.children.forEach((q) => {
// if (q.highlight) title = q.materNo
// })
// })
// var label = ''
// this.tabsData.forEach((p) => {
// if (this.readyStatus === p.typeName) label = p.name
// })
// exportExcel(this.$refs[this.onlyUuid].$el, title + '-' + label)
// }
}
}
</script>
<style lang="scss">
.production-preparation-inspection-confirmation {
display: flex;
flex-direction: column;
height: 100%;
> header {
display: flex;
margin-bottom: 15px;
border: 1px solid #ddd;
> .left {
flex-grow: 1;
padding: 20px 0;
display: flex;
> div:first-child {
font-size: 14px;
display: flex;
flex-direction: column;
justify-content: space-between;
> div {
display: flex;
> div {
margin-left: 20px;
> .el-select {
width: 80px;
}
> .el-input {
width: 260px;
}
span {
white-space: nowrap;
}
&.aoname {
display: flex;
align-items: center;
}
}
}
}
> div:last-child {
margin-left: 20px;
width: 120px;
display: flex;
flex-direction: column;
justify-content: space-between;
> button {
margin: 0;
}
}
}
> .right {
border-left: 1px solid #ddd;
width: 340px;
display: flex;
padding: 5px 0px 20px;
> div {
position: relative;
flex: 1;
text-align: center;
> div {
}
> span {
font-size: 12px;
bottom: -7px;
position: absolute;
left: 0;
width: 100%;
}
}
}
}
> .detail-pane {
// flex-grow: 1;
height: 100%;
// display: flex;
> .splitter-pane {
display: flex;
flex-direction: column;
width: 100%;
height: 100%;
width: 20px;
&.left-task {
flex-grow: 2;
> header {
.el-tabs {
width: 100%;
.el-tabs__header {
margin-bottom: 0;
}
.el-tabs__item {
height: 32px;
line-height: 32px;
font-size: 12px;
}
}
> div:last-child button {
height: 32px;
line-height: 32px !important;
padding: 0px 15px;
margin-left: 15px;
span {
display: flex;
align-items: center;
img {
padding: 0;
margin-right: 10px;
}
}
}
> div:last-child .dee-tools {
white-space: nowrap;
border: 1px solid #dcdfe6;
height: 30px;
margin-left: 15px;
padding-left: 10px;
}
}
}
&.right-task {
flex-grow: 3;
margin-left: 5px;
}
> header {
display: flex;
justify-content: space-between;
margin-bottom: 15px;
> div:last-child {
display: flex;
> button {
height: 32px;
padding: 0px 15px;
span {
display: flex;
align-items: center;
img {
padding: 0;
margin-right: 10px;
}
}
}
> .legnd {
display: flex;
> div {
align-items: center;
margin-left: 12px;
display: flex;
cursor: pointer;
flex-direction: column;
> div:first-child {
> span {
&:first-child {
display: inline-block;
width: 11px;
height: 11px;
margin-right: 6px;
&:hover {
opacity: 0.7;
}
}
&:last-child {
font-size: 10px;
}
}
}
> div:last-child {
font-size: 10px;
width: 100%;
text-align: right;
}
&:nth-child(1) > div:first-child > span:first-child {
background: #cccccc;
}
&:nth-child(2) > div:first-child > span:first-child {
background: #59c4e6;
}
&:nth-child(3) > div:first-child > span:first-child {
background: #e87c25;
}
&:nth-child(4) > div:first-child > span:first-child {
background: #fcce10;
}
&:nth-child(5) > div:first-child > span:first-child {
background: #97b552;
}
&:nth-child(6) > div:first-child > span:first-child {
background: #8a7ca8;
}
&:nth-child(7) > div:first-child > span:first-child {
background: #c1232b;
}
&:nth-child(8) > div:first-child > span:first-child {
background: #bd0b9f;
}
}
}
}
}
> .table {
height: 20px;
flex-grow: 1;
.el-table__placeholder {
display: none;
}
.el-table thead th {
color: #2e2e2e;
font-weight: 700;
font-size: 14px;
padding: 0;
background-color: #f3f6f7;
line-height: 46px !important;
}
.isrenew {
color: #409eff;
}
.row-highlight {
background-color: #faebd7;
}
.disabled {
cursor: no-drop;
}
.el-loading-spinner {
width: 100%;
}
.cellcolor.Finish {
background-color: #97b552;
}
.cellcolor.Not {
background-color: #cccccc;
}
.cellcolor.Yes {
background-color: #59c4e6;
}
.cellcolor.Reserved {
background-color: #c1232b;
}
.cellcolor.Delivery {
background-color: #e87c25;
}
.cellcolor.Run {
background-color: #fcce10;
}
.cellcolor.Paused {
background-color: #8a7ca8;
}
.cellcolor.Issued {
background-color: rgb(196, 28, 230);
}
}
}
}
.detail-pane .splitter-pane {
background-color: #fff;
}
.splitter-pane-resizer .vertical {
width: 2px;
margin-top: 20%;
height: 23px;
border-left: 2px solid #dcdee2;
margin-left: 5px;
}
}
.el-dialog__wrapper[custom-class="production-preparation-inspection-confirmation-dialog"]
.el-dialog {
.from > div:not(:last-child) {
margin-bottom: 10px;
}
.dialog-footer {
text-align: right;
}
}
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment