任务分配

This commit is contained in:
chenjianan
2019-06-21 15:34:08 +08:00
parent 21e994d9d7
commit f97a91849c
3 changed files with 118 additions and 54 deletions

View File

@@ -8,7 +8,7 @@
<el-input v-model="outsourcingSupplier" clearable style="width: 200px" size="small"/> <el-input v-model="outsourcingSupplier" clearable style="width: 200px" size="small"/>
<el-button type="success" size="small" icon="el-icon-search" style="margin-left: 10px;" @click="pageCurrent1=1;pageSize1=10;searchTable1()">查询</el-button> <el-button type="success" size="small" icon="el-icon-search" style="margin-left: 10px;" @click="pageCurrent1=1;pageSize1=10;searchTable1()">查询</el-button>
</div> </div>
<el-table v-loading="" :data="tableData1" border style="width: 100%;max-height: 600px;" height="440px" size="mini" @row-click="searchTable2"> <el-table v-loading="" :data="tableData1" border style="width: 100%;max-height: 600px;" height="400px" size="mini" @row-click="searchTable2">
<el-table-column label="序号" align="center" width="80" type="index"/> <el-table-column label="序号" align="center" width="80" type="index"/>
<el-table-column label="外协到货单号" align="center" min-width="100"> <el-table-column label="外协到货单号" align="center" min-width="100">
<template slot-scope="scope"> <template slot-scope="scope">
@@ -20,7 +20,7 @@
{{ scope.row.外协厂家名称 }} {{ scope.row.外协厂家名称 }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作日期" align="center" min-width="100"> <el-table-column label="创建日期" align="center" min-width="100">
<template slot-scope="scope"> <template slot-scope="scope">
{{ scope.row.操作日期 }} {{ scope.row.操作日期 }}
</template> </template>
@@ -37,7 +37,7 @@
@size-change="handleSizeChange1" @size-change="handleSizeChange1"
@current-change="handleCurrentChange1"/> @current-change="handleCurrentChange1"/>
</div> </div>
<el-table v-loading="" :data="tableData2" :summary-method="getSummaries" show-summary border style="width: 100%" size="mini"> <el-table v-loading="" :data="tableData2" :summary-method="getSummaries" show-summary border style="width: 100%;min-height: 400px" height="400px" size="mini">
<el-table-column label="序号" align="center" width="80" type="index"/> <el-table-column label="序号" align="center" width="80" type="index"/>
<el-table-column label="零件名称" align="center" min-width="120"> <el-table-column label="零件名称" align="center" min-width="120">
<template slot-scope="scope"> <template slot-scope="scope">
@@ -236,7 +236,6 @@ export default {
this.orderNumber ? check1 = 1 : check1 = 0 this.orderNumber ? check1 = 1 : check1 = 0
this.outsourcingSupplier ? check2 = 1 : check2 = 0 this.outsourcingSupplier ? check2 = 1 : check2 = 0
searchTable1(this.pageCurrent1, this.pageSize1, check1, this.orderNumber, check2, this.outsourcingSupplier).then(response => { searchTable1(this.pageCurrent1, this.pageSize1, check1, this.orderNumber, check2, this.outsourcingSupplier).then(response => {
console.log(response.data, 1)
this.tableData1 = response.data.rows this.tableData1 = response.data.rows
this.total1 = response.data.total this.total1 = response.data.total
}) })
@@ -251,7 +250,6 @@ export default {
this.searchTable1() this.searchTable1()
}, },
searchTable2(row) { searchTable2(row) {
console.log(row, 2)
searchTable2(row.外协到货单流水号).then(response => { searchTable2(row.外协到货单流水号).then(response => {
this.tableData2 = response.data this.tableData2 = response.data
}) })
@@ -260,7 +258,6 @@ export default {
searchTableDetail(type, num).then(response => { searchTableDetail(type, num).then(response => {
this.gridData = response.data this.gridData = response.data
}) })
console.log(type)
} }
} }
} }

View File

@@ -611,6 +611,25 @@
</div> </div>
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
<el-card>
<div v-if="Number(token)===2" style="width:100%">
<el-divider content-position="right">
<el-button type="text" @click="searchUnallocatePartNumber">刷新</el-button> | 待分配零件数
</el-divider>
<el-row>
<el-col v-for="(machine,index) in machines" :key="index" style="width: 200px">
<el-card shadow="hover" class="sudoku_item" style="height:80px;width: 90%" @click.native="clickCard(machine.项目流水号, machine.机床流水号)">
<el-badge :value="machine.未分配零件数">
<div style="width: 100px;height:50px;margin:0" class="sudoku_item">
{{ machine.机床图号 }}
</div>
</el-badge>
</el-card>
</el-col>
</el-row>
<el-divider content-position="right"/>
</div>
</el-card>
</div> </div>
</template> </template>
@@ -618,11 +637,14 @@
import { initMaterialCategory, initMaterialVariety, initProject, initBuyer, searchMachine, searchGroup, searchTable1, searchTable2, allocateTask1, import { initMaterialCategory, initMaterialVariety, initProject, initBuyer, searchMachine, searchGroup, searchTable1, searchTable2, allocateTask1,
allocateTask2, executeReturn1, executeReturn2, retract1, retract2 } from '@/api/PurchasingCenter/PurchaseTaskAllocate' allocateTask2, executeReturn1, executeReturn2, retract1, retract2 } from '@/api/PurchasingCenter/PurchaseTaskAllocate'
import { mapGetters } from 'vuex' import { mapGetters } from 'vuex'
import request from '@/utils/request'
export default { export default {
name: '', // 采购任务分配 name: '', // 采购任务分配
data() { data() {
return { return {
timer2: '',
machines: [],
source: [ source: [
{ {
text: 'BZ', text: 'BZ',
@@ -707,14 +729,42 @@ export default {
computed: { computed: {
...mapGetters([ ...mapGetters([
'name', 'name',
'token',
'id' 'id'
]) ])
}, },
created() { created() {
this.searchTable0() // 查表1 this.searchTable0() // 查表1
this.fetchData() // 初始化数据 this.fetchData() // 初始化数据
this.searchUnallocatePartNumber()
this.timer2 = setInterval(this.searchUnallocatePartNumber, 20 * 60 * 1000) // 20 分钟一刷新
},
beforeDestroy() {
clearInterval(this.timer2)
}, },
methods: { methods: {
// 选择机床
clickCard(project, machine) {
this.projectValue = project
this.machine = []
this.machineValue = ''
this.group = []
this.groupValue = ''
searchMachine(this.projectValue).then(response => {
for (let i = 0; i < response.data.length; i++) {
this.machine.push({
value: response.data[i].机床流水号,
label: response.data[i].机床图号,
name: response.data[i].机床名称
})
}
this.machineValue = machine
this.materialStatusValue = [1]
this.searchTable0()
this.searchTable1()
this.searchTable2()
})
},
filterSource(value, row) { filterSource(value, row) {
return Number(row['零件类型']) === Number(value) return Number(row['零件类型']) === Number(value)
}, },
@@ -994,6 +1044,28 @@ export default {
}) })
}) })
} }
},
async searchUnallocatePartNumber() {
this.machines = []
await request({
url: '',
method: 'post',
data: {
type: '3',
name: ` select 项目流水号,机床流水号,机床图号,sum(未分配零件数) as 未分配零件数 from (
select 项目流水号,机床流水号,机床图号,COUNT(*) as 未分配零件数 from MRP_计划订单_组件零件清单_标准件和外购件_视图
where 人员编号 is null
group by 项目流水号,机床流水号,机床图号
union all
select 项目流水号,机床流水号,机床图号,COUNT(*) as 未分配零件数 from MRP_计划订单_组件零件清单_基本件_视图
where 人员编号 is null
group by 项目流水号,机床流水号,机床图号
) as tb1
group by 项目流水号,机床流水号,机床图号`
}
}).then(res => {
this.machines = res.data
})
} }
} }
} }
@@ -1016,3 +1088,45 @@ export default {
margin: 10px 0 10px 10px; margin: 10px 0 10px 10px;
} }
</style> </style>
<style rel="stylesheet/scss" lang="scss" scoped>
.item {
margin-top: 10px;
margin-right: 40px;
}
.sudoku_row{
display: flex;
align-items: center;
width:100%;
flex-wrap: wrap;
}
.sudoku_item{
margin-bottom: 20px;
margin-left: 20px;
/*border: 1px solid red;*/
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
width:15%;
height: 200px;
padding-top: 10px;
padding-bottom: 10px;
}
.opacity{
opacity: 0.4;
background: #e5e5e5;
}
.sudoku_item img{
margin-bottom: 3px;
display: block;
}
.dashboard {
&-container {
margin: 30px;
}
&-text {
font-size: 30px;
line-height: 46px;
}
}
</style>

View File

@@ -13,22 +13,6 @@
</div> </div>
</el-card> </el-card>
<el-divider content-position="right"/> <el-divider content-position="right"/>
<div v-if="Number(token)===2" style="width:100%">
<el-divider content-position="right">待分配零件数</el-divider>
<el-row>
<el-col v-for="(machine,index) in machines" :key="index" style="width: 200px">
<el-card shadow="hover" class="sudoku_item" style="height:80px;width: 90%" @click.native="clickCard()">
<el-badge :value="machine.未分配零件数">
<div style="width: 100px;height:50px;margin:0" class="sudoku_item">
{{ machine.机床图号 }}
</div>
</el-badge>
</el-card>
</el-col>
</el-row>
<el-divider content-position="right"/>
</div>
</div> </div>
</div> </div>
</el-card> </el-card>
@@ -45,9 +29,7 @@ export default {
sudokus: [], sudokus: [],
curSelect: null, curSelect: null,
number: '', number: '',
timer: '', timer: ''
timer2: '',
machines: []
} }
}, },
computed: { computed: {
@@ -59,18 +41,11 @@ export default {
mounted() { mounted() {
this.getFileList() this.getFileList()
this.timer = setInterval(this.getFileList, 60 * 60 * 1000) // 60 分钟一刷新 this.timer = setInterval(this.getFileList, 60 * 60 * 1000) // 60 分钟一刷新
this.searchUnallocatePartNumber()
this.timer2 = setInterval(this.searchUnallocatePartNumber, 20 * 60 * 1000) // 20 分钟一刷新
}, },
beforeDestroy() { beforeDestroy() {
clearInterval(this.timer) clearInterval(this.timer)
clearInterval(this.timer2)
}, },
methods: { methods: {
// 选择机床
clickCard() {
this.$router.push({ path: '/PurchaseTaskAllocate/index' })
},
async getFileList() { async getFileList() {
await request({ await request({
url: '', url: '',
@@ -104,28 +79,6 @@ export default {
value: res.data[0].Column1 value: res.data[0].Column1
}) })
}) })
},
async searchUnallocatePartNumber() {
this.machines = []
await request({
url: '',
method: 'post',
data: {
type: '3',
name: ` select 项目流水号,机床流水号,机床图号,sum(未分配零件数) as 未分配零件数 from (
select 项目流水号,机床流水号,机床图号,COUNT(*) as 未分配零件数 from MRP_计划订单_组件零件清单_标准件和外购件_视图
where 人员编号 is null
group by 项目流水号,机床流水号,机床图号
union all
select 项目流水号,机床流水号,机床图号,COUNT(*) as 未分配零件数 from MRP_计划订单_组件零件清单_基本件_视图
where 人员编号 is null
group by 项目流水号,机床流水号,机床图号
) as tb1
group by 项目流水号,机床流水号,机床图号`
}
}).then(res => {
this.machines = res.data
})
} }
} }
} }