Files
JY1.0/src/views/ManufacturingCenter/ProjectPlanningManagementNew/index.vue
2020-03-24 17:34:36 +08:00

750 lines
34 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<div class="app-container bold-font">
<el-card>
<el-row>
<!-- <h3 style="display: inline-block;margin: 0">项目名称:</h3> -->
<el-select v-model="projectValue" filterable clearable size="small" style="margin-top:10px;width: 180px" placeholder="项目名称" @change="typeChange()">
<el-option
v-for="item in project"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<!-- <h3 style="display: inline-block;margin: 0 0 0 20px">机床名称:</h3> -->
<el-select v-model="toolNumValue" clearable filterable size="small" style="margin-bottom:10px;width: 180px" placeholder="机床名称">
<el-option
v-for="item in toolNum"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
<!-- <h3 style="display: inline-block;margin: 0 0 0 20px">客户名称:</h3> -->
<el-input v-model="CustomerNameValue" placeholder="客户名称" size="small" clearable style="width:200px"/>
<el-button size="small" icon="el-icon-search" type="primary" plain style="margin-left: 10px" @click="pageSize=10; pageCurrent=1;searchTable()">查询</el-button>
<el-button size="small" style="margin: 0px 0px 3px 750px" type="warning" icon="el-icon-edit-outline" plain @click="editPro()">保存</el-button>
</el-row>
<el-row v-if="false">
<h3 style="display: inline-block;margin: 0">签订日期:</h3>
<el-date-picker v-model="time_SignStart" size="small" value-format="yyyy-MM-dd" type="date" style="margin-top:10px;width: 180px" placeholder="签订日期" class="time"/> ~
<el-date-picker v-model="time_SignFinish" size="small" value-format="yyyy-MM-dd" type="date" style="margin-top:10px;width: 180px" placeholder="签订日期" class="time"/>
<h3 style="display: inline-block;margin: 0 0 0 20px">交货期:</h3>
<el-date-picker v-model="time_deliveryStart" size="small" value-format="yyyy-MM-dd" type="date" style="margin-top:10px;width: 180px" placeholder="交货期" class="time"/> ~
<el-date-picker v-model="time_deliveryFinish" size="small" value-format="yyyy-MM-dd" type="date" style="margin-top:10px;width: 180px" placeholder="交货期" class="time"/>
</el-row>
</el-card>
<el-row>
<el-col style="width: 1325px;">
<el-card>
<!--<h2 style="display: inline-block;margin: 0 0 10px 0">总计划:</h2>-->
<el-table v-loading="loading" :data="tableData" height="320" highlight-current-row style="margin-top: 5px;width: 100%;" border element-loading-text="拼命加载中" @row-click="rowClick">
<el-table-column label="项目编号" align="center" width="170px" fixed="left">
<template slot-scope="scope">
<template v-if="scope.row.edit">
<el-input v-model="scope.row.项目编号" size="mini"/>
</template>
<template v-else>
{{ scope.row.项目编号 }}
</template>
</template>
</el-table-column>
<el-table-column label="项目名称" align="center" min-width="120px" fixed="left">
<template slot-scope="scope">
{{ scope.row.项目名称 }}
</template>
</el-table-column>
<el-table-column label="机床图号" align="center" width="140px" fixed="left">
<template slot-scope="scope">
{{ scope.row.机床图号 }}
</template>
</el-table-column>
<el-table-column label="机床名称" align="center" width="280px" fixed="left">
<template slot-scope="scope">
{{ scope.row.机床名称 }}
</template>
</el-table-column>
<el-table-column label="机床数量" align="center" width="80px">
<template slot-scope="scope">
{{ scope.row.机床数量 }}
</template>
</el-table-column>
<el-table-column label="签订日期" align="center" width="100px">
<template slot-scope="scope">
{{ scope.row.合同签订日期 !== '1900-01-01' ? scope.row.合同签订日期 : '' }}
</template>
</el-table-column>
<el-table-column label="交货期" align="center" width="100px">
<template slot-scope="scope">
{{ scope.row.发货节点 !== '1900-01-01' ? scope.row.发货节点 : '' }}
</template>
</el-table-column>
<el-table-column label="设备预验" align="center" width="100px">
<template slot-scope="scope">
{{ scope.row.设备预验收节点 !== '1900/1/1' ? scope.row.设备预验收节点 : '' }}
</template>
</el-table-column>
<el-table-column label="安装调试" align="center" width="100px">
<template slot-scope="scope">
{{ scope.row.安装调试节点 !== '1900/1/1' ? scope.row.安装调试节点 : '' }}
</template>
</el-table-column>
<el-table-column v-if="false" label="操作" width="150px" align="center">
<template slot-scope="scope">
<el-button v-if="scope.row.edit" type="success" size="small" @click="confirmEdit(scope.row)">确定</el-button>
<el-button v-else type="primary" size="small" @click="scope.row.edit=!scope.row.edit">编辑</el-button>
<el-button v-if="scope.row.edit" type="primary" size="small" @click="scope.row.edit=!scope.row.edit">取消</el-button>
</template>
</el-table-column>
</el-table>
<div class="block" style="margin-top: 15px;">
<el-pagination
v-if="!loading"
:current-page="pageCurrent"
:page-sizes="[10, 20, 30, 40, 100]"
:page-size="pageSize"
:total="total"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"/>
</div>
</el-card>
</el-col>
<el-col style="width: 370px;margin-left: 10px">
<el-card>
<el-form label-position="left" label-width="80px" class="ProjectPlanningManagement">
<el-row>
<el-col style="width: 20px">
<!--<el-radio v-model="radio" label="1">{{ empty }}</el-radio>-->
</el-col>
<el-col style="width: 180px;margin-left: 20px">
<el-form-item label="设计者" prop="设计者" >
<el-input v-model="设计者" placeholder="设计者" clearable size="small" style="width: 180px"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col style="width: 20px">
<!--<el-radio v-model="radio" label="2">{{ empty }}</el-radio>-->
</el-col>
<el-col style="width: 180px;margin-left: 20px">
<el-form-item label="审图开始" prop="审图开始">
<el-date-picker v-model="审图开始" size="small" value-format="yyyy-MM-dd" type="date" style="width: 180px" placeholder="审图开始" class="time"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col style="width: 20px">
<!--<el-radio v-model="radio" label="3">{{ empty }}</el-radio>-->
</el-col>
<el-col style="width: 180px;margin-left: 20px">
<el-form-item label="审图结束" prop="审图结束">
<el-date-picker v-model="审图结束" size="small" value-format="yyyy-MM-dd" type="date" style="width: 180px" placeholder="审图结束" class="time"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col style="width: 20px">
<el-radio v-model="radio" label="1">{{ empty }}</el-radio>
</el-col>
<el-col style="width: 180px">
<el-form-item label="发图完成" prop="发图完成">
<el-date-picker v-model="发图完成" size="small" value-format="yyyy-MM-dd" type="date" style="width: 180px" placeholder="发图完成" class="time"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col style="width: 20px">
<el-radio v-model="radio" label="2">{{ empty }}</el-radio>
</el-col>
<el-col style="width: 180px">
<el-form-item label="采购完成" prop="采购完成">
<el-date-picker v-model="采购完成" size="small" value-format="yyyy-MM-dd" type="date" style="width: 180px" placeholder="采购完成" class="time"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col style="width: 20px">
<el-radio v-model="radio" label="3">{{ empty }}</el-radio>
</el-col>
<el-col style="width: 180px">
<el-form-item label="备料完成" prop="备料完成">
<el-date-picker v-model="备料完成" size="small" value-format="yyyy-MM-dd" type="date" style="width: 180px" placeholder="备料完成" class="time"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col style="width: 20px">
<el-radio v-model="radio" label="4">{{ empty }}</el-radio>
</el-col>
<el-col style="width: 180px">
<el-form-item label="制造完成" prop="制造完成">
<el-date-picker v-model="制造完成" size="small" value-format="yyyy-MM-dd" type="date" style="width: 180px" placeholder="制造完成" class="time"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col style="width: 20px">
<el-radio v-model="radio" label="5">{{ empty }}</el-radio>
</el-col>
<el-col style="width: 180px">
<el-form-item label="装配完成" prop="装配完成">
<el-date-picker v-model="装配完成" size="small" value-format="yyyy-MM-dd" type="date" style="width: 180px" placeholder="装配完成" class="time"/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col style="width: 20px">
<!--<el-radio v-model="radio" label="9">{{ empty }}</el-radio>-->
</el-col>
<el-col style="width: 180px;margin-left: 20px">
<el-form-item label="更新时间" prop="更新时间">
<el-input v-model="更新时间" placeholder="更新时间" clearable size="small" style="width: 180px"/>
<!--<el-date-picker v-model="更新时间" size="small" value-format="yyyy-MM-dd" type="date" style="width: 150px" placeholder="更新时间" class="time"/>-->
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-card>
</el-col>
</el-row>
<el-row>
<el-card>
<span v-if="radio==='1'" style="float:left;margin: 10px 0 10px 0">子计划{{ machineNum }} 发图</span>
<span v-if="radio==='2'" style="float:left;margin: 10px 0 10px 0">子计划{{ machineNum }} 采购</span>
<span v-if="radio==='3'" style="float:left;margin: 10px 0 10px 0">子计划{{ machineNum }} 备料</span>
<span v-if="radio==='4'" style="float:left;margin: 10px 0 10px 0">子计划{{ machineNum }} 制造</span>
<span v-if="radio==='5'" style="float:left;margin: 10px 0 10px 0">子计划{{ machineNum }} 装配</span>
<el-button size="small" icon="el-icon-circle-plus" type="warning" style="float:left;margin: 5px 0 3px 10px" plain @click="addTable()">增加</el-button>
<el-table v-loading="loading2" :data="tableData2" style="margin-top: 10px;width: 100%;" stripe border element-loading-text="拼命加载中">
<el-table-column min-width="100px" label="组号" align="center">
<template slot-scope="scope">
<template v-if="scope.row.edit">
<el-select v-model="scope.row.组件流水号" filterable clearable size="small" style="width: 100px" @change="groupChange(scope.row, scope.$index)">
<el-option
v-for="item in groupNum"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</template>
<template v-else>
{{ scope.row.组号 }}
</template>
</template>
</el-table-column>
<el-table-column min-width="200px" label="任务名称" align="center">
<template slot-scope="scope">
<template v-if="scope.row.edit">
<el-input v-model="scope.row.任务名称" size="mini" style="width: 100%"/>
</template>
<template v-else>
{{ scope.row.任务名称 }}
</template>
</template>
</el-table-column>
<el-table-column min-width="100px" label="负责人" align="center">
<template slot-scope="scope">
<template v-if="scope.row.edit">
<el-input v-model="scope.row.负责人" size="mini" style="width: 100%"/>
</template>
<template v-else>
{{ scope.row.负责人 }}
</template>
</template>
</el-table-column>
<el-table-column label="接收任务时间" align="center" width="150px">
<template slot-scope="scope">
<template v-if="scope.row.edit">
<el-date-picker v-model="scope.row.接收任务时间" value-format="yyyy-MM-dd" size="mini" type="date" style="width: 100%"/>
</template>
<template v-else>
{{ scope.row.接收任务时间 }}
</template>
</template>
</el-table-column>
<el-table-column label="任务开始时间" align="center" width="150px">
<template slot-scope="scope">
<template v-if="scope.row.edit">
<el-date-picker v-model="scope.row.任务开始时间" value-format="yyyy-MM-dd" size="mini" type="date" style="width: 100%"/>
</template>
<template v-else>
{{ scope.row.任务开始时间 }}
</template>
</template>
</el-table-column>
<el-table-column label="计划完成时间" align="center" width="150px">
<template slot-scope="scope">
<template v-if="scope.row.edit">
<el-date-picker v-model="scope.row.计划完成时间" value-format="yyyy-MM-dd" size="mini" type="date" style="width: 100%"/>
</template>
<template v-else>
{{ scope.row.计划完成时间 }}
</template>
</template>
</el-table-column>
<el-table-column min-width="100px" label="货期" align="center">
<template slot-scope="scope">
<template v-if="scope.row.edit">
<el-input v-model="scope.row.货期" size="mini" style="width: 100%"/>
</template>
<template v-else>
{{ scope.row.货期 }}
</template>
</template>
</el-table-column>
<el-table-column label="实际完成时间" align="center" width="150px">
<template slot-scope="scope">
<template v-if="scope.row.edit && !scope.row.组件流水号">
<el-date-picker v-model="scope.row.实际完成时间" value-format="yyyy-MM-dd" size="mini" type="date" style="width: 100%"/>
</template>
<template v-else>
{{ scope.row.实际完成时间 }}
</template>
</template>
</el-table-column>
<el-table-column min-width="300px" label="备注" align="center" width="240px">
<template slot-scope="scope">
<template v-if="scope.row.edit">
<el-input v-model="scope.row.备注" size="mini" style="width: 100%"/>
</template>
<template v-else>
{{ scope.row.备注 }}
</template>
</template>
</el-table-column>
<el-table-column label="操作" width="180px" align="center" fixed="right">
<template slot-scope="scope">
<el-button v-if="scope.row.edit" type="text" size="small" @click="confirmEdit2(scope.row)">确定</el-button>
<el-button v-else type="text" size="small" icon="el-icon-edit-outline" @click="scope.row.edit=!scope.row.edit">编辑</el-button>
<el-button v-if="scope.row.edit" type="text" size="small" @click="scope.row.edit=!scope.row.edit">取消</el-button>
<el-button v-else type="text" size="small" icon="el-icon-delete" @click="Delete(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
</el-card>
</el-row>
</div>
</template>
<script>
import { getProject, getCustomerName, searchgroupName, getToolNum, searchtable, editTable, searchTable2, searchgroup, addTable, editTable2, Delete } from '@/api/ManufacturingCenter/ProjectPlanningManagement'
export default {
data() {
return {
empty: '',
radio: '',
项目流水号: '',
机床流水号: '',
项目编号: '',
设计者: '',
审图开始: '',
审图结束: '',
发图完成: '',
采购完成: '',
备料完成: '',
制造完成: '',
装配完成: '',
更新时间: '',
machineNum: '',
jichuang: '',
title: '',
tableData2: [],
loading2: false,
code: '',
time_SignStart: '', // 签订开始
time_SignFinish: '', // 签订结束
time_deliveryStart: '', // 交货开始
time_deliveryFinish: '', // 交货结束
projectValue: '',
project: [], // 项目名称
CustomerNameValue: '',
CustomerName: [], // 客户名称
toolNumValue: '',
toolNum: [], // 机床
groupNum: [],
loading: false,
tableData: [], // 表格数据
total: null, // 总条数
pageSize: 10, // 每页显示条数
pageCurrent: 1 // 后台获取页
}
},
watch: {
radio(val) {
if (this.项目流水号) {
this.openDialog()
} else {
this.radio = ''
}
}
},
created() {
this.fetchData()
this.getCustomerName()
this.searchTable()
},
methods: {
fetchData() {
this.projectValue = ''
this.project = []
getProject().then(response => {
for (let i = 0; i < response.data.length; i++) {
this.project.push({
label: response.data[i].项目名称,
value: response.data[i].项目流水号
})
}
})
},
typeChange() {
this.toolNumValue = ''
this.toolNum = []
getToolNum(1, this.projectValue).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.toolNum.push({
label: response.data[i].机床图号,
value: response.data[i].机床流水号
})
}
})
},
groupChange(row, index) {
if (row.组件流水号 !== '') {
searchgroupName(row.组件流水号).then(response => {
this.tableData2[index].任务名称 = response.data[0].组件名称
})
}
},
getCustomerName() {
this.CustomerNameValue = ''
this.CustomerName = []
getCustomerName().then(response => {
for (let i = 0; i < response.data.length; i++) {
this.CustomerName.push({
label: response.data[i].客户名称,
value: response.data[i].客户流水号
})
}
})
},
// 查询表格数据
searchTable() {
this.loading = true
this.tableData = []
this.tableData2 = []
this.radio = ''
this.项目流水号 = ''
this.机床流水号 = ''
this.项目编号 = ''
this.设计者 = ''
this.审图开始 = ''
this.审图结束 = ''
this.发图完成 = ''
this.采购完成 = ''
this.备料完成 = ''
this.制造完成 = ''
this.装配完成 = ''
this.更新时间 = ''
this.jichuang = ''
this.code = ''
if (this.projectValue !== '' && this.projectValue !== null) { this.projectValuecheck = 1 } else { this.projectValuecheck = 0 }
if (this.CustomerNameValue !== '' && this.CustomerNameValue !== null) { this.CustomerNameValuecheck = 1 } else { this.CustomerNameValuecheck = 0 }
if (this.toolNumValue !== '' && this.toolNumValue !== null) { this.toolNumValuecheck = 1 } else { this.toolNumValuecheck = 0 }
if (this.time_SignStart !== '' && this.time_SignStart !== null && this.time_SignFinish !== '' && this.time_SignFinish) { this.time_Signcheck = 1 } else { this.time_Signcheck = 0 }
if (this.time_deliveryStart !== '' && this.time_deliveryStart !== null && this.time_deliveryFinish !== '' && this.time_deliveryFinish) { this.time_deliverycheck = 1 } else { this.time_deliverycheck = 0 }
searchtable(this.projectValuecheck, this.projectValue, this.toolNumValuecheck, this.toolNumValue, this.CustomerNameValuecheck, this.CustomerNameValue, this.time_Signcheck, this.time_SignStart, this.time_SignFinish, this.time_deliverycheck, this.time_deliveryStart, this.time_deliveryFinish, this.pageCurrent, this.pageSize).then(response => {
if (response.data.total === 0) {
this.loading = false
} else {
for (let i = 0; i < response.data.rows.length; i++) {
this.tableData.push({
edit: false,
项目编号: response.data.rows[i].项目编号,
项目名称: response.data.rows[i].项目名称,
机床图号: response.data.rows[i].机床图号,
机床名称: response.data.rows[i].机床名称,
机床数量: response.data.rows[i].机床数量,
合同签订日期: response.data.rows[i].合同签订日期,
发货节点: response.data.rows[i].发货节点,
设备预验收节点: response.data.rows[i].设备预验收节点,
安装调试节点: response.data.rows[i].安装调试节点,
客户名称: response.data.rows[i].客户名称,
机床设计者: response.data.rows[i].机床设计者,
机床设计完成时间: response.data.rows[i].机床设计完成时间,
采购完成时间: response.data.rows[i].采购完成时间,
备料完成时间: response.data.rows[i].备料完成时间,
机床生产完成时间: response.data.rows[i].机床生产完成时间,
机床装配完成时间: response.data.rows[i].机床装配完成时间,
机床设计实际完成时间: response.data.rows[i].机床设计实际完成时间,
采购实际完成时间: response.data.rows[i].采购实际完成时间,
备料实际完成时间: response.data.rows[i].备料实际完成时间,
机床生产实际完成时间: response.data.rows[i].机床生产实际完成时间,
机床装配实际完成时间: response.data.rows[i].机床装配实际完成时间,
审图计划开始时间: response.data.rows[i].审图计划开始时间,
审图计划完成时间: response.data.rows[i].审图计划完成时间,
审图实际完成时间: response.data.rows[i].审图实际完成时间,
完成顺序: response.data.rows[i].完成顺序,
更新: response.data.rows[i].更新,
项目流水号: response.data.rows[i].项目流水号,
机床流水号: response.data.rows[i].机床流水号
})
}
this.total = response.data.total
}
}).then(() => {
this.loading = false
})
},
rowClick(row) {
searchtable(1, row.项目流水号, 1, row.机床流水号, 0, 0, 0, '', '', 0, '', '', 1, 100).then(response => {
if (response.data.total !== 0) {
this.machineNum = row.机床图号
this.项目流水号 = row.项目流水号
this.机床流水号 = row.机床流水号
this.项目编号 = row.项目编号
this.设计者 = response.data.rows[0].机床设计者
this.审图开始 = response.data.rows[0].审图计划开始时间
this.审图结束 = response.data.rows[0].审图计划完成时间
this.发图完成 = response.data.rows[0].机床设计完成时间
this.采购完成 = response.data.rows[0].采购完成时间
this.备料完成 = response.data.rows[0].备料完成时间
this.制造完成 = response.data.rows[0].机床生产完成时间
this.装配完成 = response.data.rows[0].机床装配完成时间
this.更新时间 = response.data.rows[0].更新
}
})
},
// 表格1保存
editPro() {
if (this.项目流水号) {
this.审图开始 ? this.审图开始 : this.审图开始 = null
this.审图结束 ? this.审图结束 : this.审图结束 = null
this.发图完成 ? this.发图完成 : this.发图完成 = null
this.采购完成 ? this.采购完成 : this.采购完成 = null
this.备料完成 ? this.备料完成 : this.备料完成 = null
this.制造完成 ? this.制造完成 : this.制造完成 = null
this.装配完成 ? this.装配完成 : this.装配完成 = null
editTable(this.项目流水号, this.机床流水号, this.项目编号, this.设计者, this.审图开始, this.审图结束, '', this.发图完成, this.采购完成, this.备料完成, this.制造完成, this.装配完成, '', this.更新时间).then(response => {
if (response.data[0].result === '1') {
console.log(response.data)
this.$message.success('保存成功')
} else {
this.$message.error('信息修改失败')
}
})
} else {
this.$message.error('请先选择项目')
}
},
// 查询表格2数据
openDialog() {
this.loading2 = true
this.tableData2 = []
if (this.radio === '1') {
this.title = '发图'
} else if (this.radio === '2') {
this.title = '采购'
} else if (this.radio === '3') {
this.title = '备料'
} else if (this.radio === '4') {
this.title = '制造'
} else if (this.radio === '5') {
this.title = '装配'
}
this.groupNum = []
searchgroup(this.机床流水号).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.groupNum.push({
label: response.data[i].组号,
value: response.data[i].组件流水号
})
}
})
searchTable2(this.机床流水号, this.radio).then(response => {
console.log('')
if (response.data.length === 0) {
this.loading2 = false
} else {
for (let i = 0; i < response.data.length; i++) {
if (response.data[i].接收任务时间 !== '' && response.data[i].接收任务时间 !== null) {
response.data[i].接收任务时间 = response.data[i].接收任务时间.split(' ')[0]
}
if (response.data[i].任务开始时间 !== '' && response.data[i].任务开始时间 !== null) {
response.data[i].任务开始时间 = response.data[i].任务开始时间.split(' ')[0]
}
if (response.data[i].接收任务时间 !== '' && response.data[i].接收任务时间 !== null) {
response.data[i].接收任务时间 = response.data[i].接收任务时间.split(' ')[0]
}
if (response.data[i].计划完成时间 !== '' && response.data[i].计划完成时间 !== null) {
response.data[i].计划完成时间 = response.data[i].计划完成时间.split(' ')[0]
}
if (response.data[i].实际完成时间 !== '' && response.data[i].实际完成时间 !== null) {
response.data[i].实际完成时间 = response.data[i].实际完成时间.split(' ')[0]
}
this.tableData2.push({
edit: false,
组件计划流水号: response.data[i].组件计划流水号,
机床流水号: response.data[i].机床流水号,
组件流水号: response.data[i].组件流水号,
组号: response.data[i].组号,
任务名称: response.data[i].任务名称,
负责人: response.data[i].负责人,
接收任务时间: response.data[i].接收任务时间,
任务开始时间: response.data[i].任务开始时间,
计划完成时间: response.data[i].计划完成时间,
货期: response.data[i].货期,
实际完成时间: response.data[i].实际完成时间,
备注: response.data[i].备注
})
}
}
}).then(() => {
this.loading2 = false
})
},
// 表格2增加
addTable() {
if (this.radio === '') {
this.$message.error('请先选择一个类别')
} else {
addTable(this.机床流水号, this.radio).then(response => {
if (response.data[0].result === '1') {
this.$message({
type: 'success',
message: '添加成功!'
})
this.searchTable2()
} else {
this.$message.error('添加失败')
}
})
}
},
searchTable2() {
this.loading2 = true
this.tableData2 = []
searchTable2(this.机床流水号, this.radio).then(response => {
if (response.data.length === 0) {
this.loading2 = false
} else {
for (let i = 0; i < response.data.length; i++) {
if (response.data[i].接收任务时间 !== '' && response.data[i].接收任务时间 !== null) {
response.data[i].接收任务时间 = response.data[i].接收任务时间.split(' ')[0]
}
if (response.data[i].任务开始时间 !== '' && response.data[i].任务开始时间 !== null) {
response.data[i].任务开始时间 = response.data[i].任务开始时间.split(' ')[0]
}
if (response.data[i].接收任务时间 !== '' && response.data[i].接收任务时间 !== null) {
response.data[i].接收任务时间 = response.data[i].接收任务时间.split(' ')[0]
}
if (response.data[i].计划完成时间 !== '' && response.data[i].计划完成时间 !== null) {
response.data[i].计划完成时间 = response.data[i].计划完成时间.split(' ')[0]
}
if (response.data[i].实际完成时间 !== '' && response.data[i].实际完成时间 !== null) {
response.data[i].实际完成时间 = response.data[i].实际完成时间.split(' ')[0]
}
this.tableData2.push({
edit: false,
组件计划流水号: response.data[i].组件计划流水号,
机床流水号: response.data[i].机床流水号,
组件流水号: response.data[i].组件流水号,
组号: response.data[i].组号,
任务名称: response.data[i].任务名称,
负责人: response.data[i].负责人,
接收任务时间: response.data[i].接收任务时间,
任务开始时间: response.data[i].任务开始时间,
计划完成时间: response.data[i].计划完成时间,
货期: response.data[i].货期,
实际完成时间: response.data[i].实际完成时间,
备注: response.data[i].备注
})
}
}
}).then(() => {
this.loading2 = false
})
},
// 表格2保存
confirmEdit2(row) {
editTable2(row.组件计划流水号, row.组件流水号, row.任务名称, row.负责人, row.接收任务时间, row.任务开始时间, row.计划完成时间, row.货期, row.实际完成时间, row.备注).then(response => {
if (response.data[0].result === '1') {
row.edit = false
this.$notify({
title: '成功',
message: '信息修改成功',
type: 'success'
})
this.searchTable2()
} else {
this.$message.error('信息修改失败')
}
})
},
// 表格2删除
Delete(row) {
this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
Delete(row.组件计划流水号).then(response => {
if (response.data[0].result === '1') {
row.edit = false
this.$notify({
title: '成功',
message: '信息修改成功',
type: 'success'
})
this.searchTable2()
} else {
this.$message.error('信息修改失败')
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
})
})
},
// 分页
handleSizeChange(val) {
this.pageCurrent = 1
this.pageSize = val
this.searchTable()
},
handleCurrentChange(val) {
this.pageCurrent = val
this.searchTable()
}
}
}
</script>
<style scoped>
span{
margin: 10px 0 10px 10px;
}
.el-pagination{
background-color: white;
}
</style>
<style>
.el-radio {
margin-top: 12px !important;
}
.ProjectPlanningManagement .el-form-item {
margin-bottom: 0px
}
.ProjectPlanningManagement .el-form-item__label {
text-align: right;
float: left;
font-size: 14px;
color: #606266;
line-height: 40px;
padding: 0 12px 0 0;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
</style>