Commit 5318c6f2 authored by jingnan's avatar jingnan 👀

Merge branch 'dev' of http://94.191.100.41/tfmom/tf-mom-web into dev

parents ee5963cd e1081fe0
......@@ -43,7 +43,6 @@ export default {
computed: {},
created() {
// 初始化数据
console.log('this.basicData', this.basicData)
},
methods: {
searchEvent(val) {
......@@ -51,7 +50,7 @@ export default {
val.items.push({ fieldName: 'subTypeName', operator: 'EQ', value: 'Inventory' }/*, { fieldName: 'inventory.materialType', operator: 'EQ', value: materialType }*/)
val.items.push({ fieldName: 'status', operator: 'EQ', value: 'disposed' })
val.items.push({ fieldName: 'usableAmount', operator: 'GT', value: 0 })
val.items.push({ fieldName: 'disposeDes', operator: 'LIKE', value: '返厂' })
val.items.push({ fieldName: 'disposeDes', operator: 'IN', value: ['返厂', '不合格'] })
const extWorkCenterName = this.basicData.extWorkCenteName || (this.basicData.extWorkCeter && this.basicData.extWorkCeter.extname)
if (extWorkCenterName) {
val.items.push({ fieldName: 'workcenter', operator: 'EQ', value: extWorkCenterName })
......
<template>
<div class="WorkAllocationEditList">
<div class="dee-table dee-table-dis-border">
<el-table
ref="table"
:data="tableData"
@cell-click="cellClick"
>
<el-table-column prop="opertor" label="操作者">
<template slot-scope="scope">
<span v-if="scope.row.isMasterOperator">{{ scope.row.extProcessSkillUser.dxUserInfo.name }}(主)</span>
<span v-else>{{ scope.row.extProcessSkillUser.dxUserInfo.name }}</span>
</template>
</el-table-column>
<el-table-column prop="workHour" label="工时分配(min)">
<template slot-scope="scope">
<span>{{ scope.row.workHour }}
</span>
</template>
</el-table-column>
<el-table-column v-if="basicData.joExecutePlan.state==='Pending_Review'" prop="workHourOPercent" label="工时占比(%)">
<template slot-scope="scope">
<el-input-number
v-if="scope.row.id === tabClickIndex"
ref="inputNumber"
v-model="scope.row.workHourOPercent"
oninput="value=value.replace(/[^0-9.]/g,'')"
type="number"
:min="0"
controls-position="right"
@blur="inputBlur(scope.row)"
@change="changeHandle(scope.row)"
/>
<span v-else>{{ scope.row.workHourOPercent }}</span>
<!-- <el-input v-model="scope.row.workHourOPercent" /> -->
</template>
</el-table-column>
</el-table>
</div>
</div>
</template>
<script>
import { post } from '@/utils/http'
export default {
name: 'WorkAllocationEditList',
componentName: '工时分配编辑列表',
props: {
basicData: {
type: Object,
default: () => {}
}
},
data() {
return {
loading: false,
tableData: [],
tabClickIndex: ''
}
},
computed: {
contentTypeOptions() {
return this.basicData.joExecutePlan.prodTask
}
},
watch: {
'basicData.id': {
immediate: true,
deep: true,
handler(val) {
if (val) {
this.$nextTick(() => {
this.getTableData()
})
}
}
}
},
created() {
},
mounted() {
},
methods: {
getTableData() {
const params = {
'searchItems': {
'children': [
{
'items': [
{
'fieldName': 'joExecutePlanId',
'operator': 'EQ',
'value': this.basicData.joExecutePlanId
}
],
'operator': 'AND'
}
],
'items': [],
'operator': 'AND'
},
'sortItem': [
{
'fieldName': 'modifyTime',
'sortOrder': 'desc'
}
],
'openProps': [
{
'name': 'extProcessSkillUser'
}
]
}
this.loading = true
this.$api.searchApi('ProdTask', params).then(res => {
this.tableData = []
if (res.items && res.items.content) {
res.items.content.forEach(element => {
element.allWorkHour = this.basicData.joExecutePlan.allWorkHour
if (element.workHour !== null) {
element.workHourOPercent = this.oPercent(element.workHour, element.allWorkHour)
} else {
element.workHourOPercent = null
}
})
const index = res.items.content.findIndex(item => {
return item.isMasterOperator
})
const masterRow = res.items.content.splice(index, 1)
res.items.content.unshift(masterRow[0])
this.tableData = res.items.content
}
this.loading = false
}).catch(() => {
this.loading = false
})
},
oPercent(num, total) {
return (Math.round(num / total * 10000) / 100.00)// 小数点后两位百分比
},
cellClick(row, column, event, cell) {
if (column.label === '工时占比(%)') {
this.tabClickIndex = row.id
} else {
this.tabClickIndex = null
}
},
inputBlur(row) {
this.tabClickIndex = null
this.edit(row)
},
edit(row) {
let sum = 0
this.tableData.map(item => {
if (item.id !== row.id) {
sum += item.workHourOPercent - 0
}
return sum
})
const maxSum = this.accSubtr(100, sum) < 0 ? 0 : this.accSubtr(100, sum)
if (Number(row.workHourOPercent) > maxSum) {
row.workHourOPercent = null
row.workHour = null
this.$utils.showMessageWarning(`工时总和超出额定工时,工时占比最多${maxSum}`)
return
} else {
const params = {
'id': row.id,
'operator': 'MODIFY',
'workHour': row.workHour
}
post(`/ProdTask/recursion`, params).then(res => {
this.$utils.showMessageSuccess('编辑成功')
}).catch(err => {
console.log(err)
}).finally(() => {
})
}
},
changeHandle(row) {
if (row.workHourOPercent === null) {
row.workHour = null
} else {
row.workHour = (row.workHourOPercent * row.allWorkHour / 100).toFixed(2)
}
},
accSubtr(arg1, arg2) {
var r1, r2, m, n
try { r1 = arg1.toString().split('.')[1].length } catch (e) { r1 = 0 }
try { r2 = arg2.toString().split('.')[1].length } catch (e) { r2 = 0 }
m = Math.pow(10, Math.max(r1, r2))
// 动态控制精度长度
n = (r1 >= r2) ? r1 : r2
return ((arg1 * m - arg2 * m) / m).toFixed(n)
}
}
}
</script>
<style lang="scss">
.WorkAllocationEditList{
.btns{
margin-top: 20px;
display: flex;
justify-content: center;
}
}
</style>
<template>
<el-form ref="form" :inline="true" :model="form" class="demo-form-inline working-hours-summary" label-width="90px">
<el-form-item v-if="activeName==='product'" label="关键字: ">
<el-input v-model="form.aoName" placeholder="AO号/AO名称模糊检索" class="el-input--small" clearable="clearable" />
</el-form-item>
<el-form-item v-if="activeName==='temp'" label="关键字: ">
<el-input v-model="form.keyWord" placeholder="任务编号/内容模糊查询" class="el-input--small" clearable="clearable" />
</el-form-item>
<el-form-item label="完成时间: ">
<el-date-picker
v-model="form.actualEnd"
type="daterange"
size="small"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
format="yyyy-MM-dd"
value-format="yyyy-MM-dd 00:00:00"
/>
</el-form-item>
<el-form-item label="工时状态: ">
<el-select v-model="form.state" clearable placeholder="请选择工时状态" class="input-with-select el-input--small">
<el-option
v-for="item in workStatusOptions"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item label="是否确认: ">
<el-select v-model="form.isConfirmCode" clearable placeholder="请选择确认状态" class="input-with-select el-input--small">
<el-option
label="全部"
value=""
/>
<el-option
label="已确认"
value="Y"
/>
<el-option
label="未确认"
value="N"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" class="el-button--small" @click="onSubmit">查询</el-button>
<el-button type="default " class="el-button--small" @click="resetForm">重置</el-button>
</el-form-item>
</el-form>
</template>
<script>
export default {
props: {
activeName: {
type: String,
default: 'product'
}
},
data() {
return {
workStatusOptions: [
{ label: '己审核', value: 'Audited' },
{ label: '待审核', value: 'Pending_Review' },
{ label: '审核中', value: 'TF_Reviewing' }
],
form: {
keyWord: '',
state: 'Audited', // 工时状态
aoName: '', // 关键字
actualEnd: '', // 结束时间,
isConfirmCode: 'N'
}
}
},
mounted() {
this.$emit('init', this.form)
},
methods: {
// 重置
resetForm() {
this.form = {
keyWord: '',
state: '', // 工时状态
aoName: '', // 关键字
actualEnd: '', // 结束时间
isConfirmCode: ''
}
this.$emit('init')
},
// 查询
onSubmit() {
this.$emit('init', this.form)
}
}
}
</script>
<style lang='scss'>
.working-hours-summary{
.el-form-item{
margin-bottom: 10px!important;
}
}
</style>
<template>
<section class="pro-table">
<!-- 表格 -->
<dee-table
v-if="sumRowShow"
ref="table"
:loading="loading"
:index-row="indexRow"
:columns="tableColums"
:data="tableData"
:highlight-current-row="true"
:options="tableOptions"
:pagination="tablePagination"
:selection-row="selectionRow"
@selection-change="selectionChange"
@pagination-size-change="paginationSizeChange"
@pagination-current-change="paginationCurrentChange"
/>
</section>
</template>
<script>
import { post } from '@/utils/http'
export default {
components: {
},
data() {
return {
// 加载中
loading: false,
// 搜索条件
form: [],
// 分页
tablePagination: {
currentPage: 1,
pageSize: 20,
total: 0,
pageSizes: [5, 10, 20, 50]
},
// 序号
indexRow: { title: '序号', align: 'center', width: '70' },
// 选中表格列
selectionRow: [],
// 所有可动态配置的表格列
colums: [
{ minWidth: '80', title: '机型', show: true, key: 'joExecutePlan.extProcessPlan.planeType', sortable: true },
{ minWidth: '80', title: '架次', show: true, key: 'joExecutePlan.extProcessPlan.sorties', sortable: true },
{ minWidth: '100', title: 'AO号', show: true, key: 'joExecutePlan.extProcessPlan.serialNumber', sortable: true },
{ minWidth: '100', title: 'AO名称', show: true, key: 'joExecutePlan.extProcessPlan.materName', sortable: true },
{ minWidth: '140', title: '总工时(min)', show: true, key: 'allWorkHour', sortable: true },
{ minWidth: '140', title: '分配工时(min)', show: true, key: 'workHour', sortable: true },
{ minWidth: '130', title: '完成时间', show: true, key: 'joExecutePlan.jrExecutePlans[0].actualEnd', sortable: true },
{ minWidth: '100', title: '工时状态', show: true, key: 'joExecutePlan.state', sortable: true, formatter(row, column) {
if (row.joExecutePlan.state === 'Audited') {
return '己审核'
} else if (row.joExecutePlan.state === 'Pending_Review') {
return '待审核'
} else if (row.joExecutePlan.state === 'TF_Reviewing') {
return '审核中'
}
}
},
{ minWidth: '100', title: '是否确认', show: true, key: 'isConfirm', sortable: true, formatter(row, column) {
if (row.isConfirm === 'Y') {
return '已确认'
} else if (row.isConfirm === 'N') {
return '未确认'
}
}
}
],
// 默认展示的表格列
tableColums: [],
// 表格数据
tableData: [],
// 表格样式配置
tableOptions: {
stripe: true,
border: true,
height: '400',
showSummary: true,
summaryMethod: this.getSummaries
},
// 表格选中行
selection: [],
sumRowShow: false
}
},
created() {
this.setDefaultColums()
},
mounted() {
// this.init()
},
methods: {
// 合计
getSummaries(param) {
const { columns, data } = param
const sums = []
columns.forEach((column, index) => {
if (index === 1) {
sums[index] = '合计'
return
}
const values = data.map(item => Number(item[column.property]))
if (!values.every(value => isNaN(value))) {
sums[index] = values.reduce((prev, curr) => {
const value = Number(curr)
if (!isNaN(value)) {
return prev + curr
} else {
return prev
}
}, 0)
sums[index]
}
})
return sums
},
// 设置默认展示列
setDefaultColums() {
this.tableColums = this.colums.filter(item => item.show)
},
// 初始化数据
init(form) {
this.tableData = []
// 设置数据
this.form = form
this.loading = true
const params = {
'pageFrom': this.tablePagination.currentPage,
'pageSize': this.tablePagination.pageSize,
'searchItems': {
'children': [
{
'items': [
{
'fieldName': 'extProcessSkillUser.dxUserInfoId',
'operator': 'EQ',
'value': localStorage.getItem('userId')
// 'value': 1626782148600
},
{
'fieldName': 'joExecutePlan.extProcessPlan.serialNumber',
'operator': 'LIKE',
'value': form.aoName
// 'value': 'AOR-CAS-CA-53-D2701001-0500-001'
},
{
'fieldName': 'joExecutePlan.state',
'operator': 'EQ',
'value': form.state
},
{
'fieldName': 'isConfirm',
'operator': 'EQ',
'value': form.isConfirmCode
}
],
'operator': 'AND'
}
],
'items': [],
'operator': 'AND'
},
'openProps': [
{
'name': 'joExecutePlan',
'openProps': [
{
'name': 'extProcessPlan'
},
{
'name': 'jrExecutePlans'
}
]
}
],
'sortItem': [
{
'fieldName': 'modifyTime',
'sortOrder': 'desc'
}
],
'toValidateKeys': ''
}
if (form.actualEnd && form.actualEnd.length > 0) {
params.searchItems.children[0].items.push(
{
'fieldName': 'joExecutePlan.jrExecutePlans.actualEnd',
'operator': 'BTWN',
'value': form.actualEnd[0],
'value1': form.actualEnd[1]
}
)
}
// 发送请求
post(`/ProdTask/listCustomQuery`, params).then(res => {
this.tableData = []
res.items.content.map(item => {
this.tableData.push({
...item,
allWorkHour: item.joExecutePlan.allWorkHour,
workHour: item.workHour
})
})
this.tablePagination.total = res.items.totalElements
}).catch(err => console.log(err)).finally(() => {
this.loading = false
this.$nextTick(() => {
this.sumRowShow = true
})
})
},
// 确认
confirmHandle() {
if (!this.selectionRow.length) return this.$utils.showMessageWarning('请选择需要操作的数据')
const confirmFlag = this.selectionRow.find(row => (row.isConfirm === 'Y' || row.isConfirm === '已确认'))
if (confirmFlag) return this.$utils.showMessageWarning('已确认的数据无法再次进行确认,请重新选择')
this.$confirm('是否对选中的数据进行确认?', '提示', {
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.loading = true
const params = []
this.selectionRow.map(row => {
params.push({
id: row.id,
operator: 'MODIFY',
isConfirm: 'Y'
})
})
post(`/ProdTask/recursions`, params).then(res => {
this.$utils.showMessageSuccess('确认成功')
this.tablePagination.currentPage = 1
this.init(this.form)
}).catch(err => {
console.log(err)
}).finally(() => {
this.loading = false
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消确认'
})
})
},
// 选择项发生改变
selectionChange(val) {
this.selectionRow = val
},
// 分页每页条数切换
paginationSizeChange(size) {
this.tablePagination.pageSize = size
this.init(this.form)
},
// 分页当前页切换
paginationCurrentChange(page) {
this.tablePagination.currentPage = page
this.init(this.form)
}
}
}
</script>
<template>
<section class="pro-table">
<!-- 表格 -->
<dee-table
v-if="sumRowShow"
ref="table"
:loading="loading"
:index-row="indexRow"
:columns="tableColums"
:data="tableData"
:highlight-current-row="true"
:options="tableOptions"
:pagination="tablePagination"
:summary-method="getSummaries"
:selection-row="selectionRow"
@selection-change="selectionChange"
@row-click="rowClick"
@pagination-size-change="paginationSizeChange"
@pagination-current-change="paginationCurrentChange"
>
<!-- 操作按钮 -->
<section slot="header" style="display: flex; align-items: center;">
<dee-tools style="justify-content: flex-end;" :tools="tools" mode="normal" :collapse="false" />
</section>
</dee-table>
</section>
</template>
<script>
// import { post } from '@/utils/http'
// import { getTemp, confirmTempWorkHour } from '@/api/programExecutionManagement.js'
export default {
components: {
},
data() {
return {
// 加载中
loading: false,
// 搜索条件
form: [],
// 分页
tablePagination: {
currentPage: 1,
pageSize: 20,
total: 0,
pageSizes: [5, 10, 20, 50]
},
// 序号
indexRow: { title: '序号', align: 'center', width: '70' },
// 选中表格列
selectionRow: [],
// 所有可动态配置的表格列
colums: [
{ minWidth: '100', title: '任务编号', show: true, key: 'tempWorkHour.billNo', sortable: true },
{ minWidth: '100', title: '工时类型', show: true, key: 'tempWorkHour.workType', sortable: true },
{ minWidth: '70', title: '站位', show: true, key: 'tempWorkHour.name', sortable: true },
{ minWidth: '100', title: '工作内容', show: true, key: 'tempWorkHour.workContent', sortable: true },
{ minWidth: '100', title: '开始时间', show: true, key: 'tempWorkHour.startTime', sortable: true },
{ minWidth: '100', title: '结束时间', show: true, key: 'tempWorkHour.endTime', sortable: true },
{ minWidth: '110', title: '本人工时(min)', show: true, key: 'workHour', sortable: true },
{ minWidth: '110', title: '完成工时(min)', show: true, key: 'workHours', sortable: true },
{ minWidth: '120', title: '工时状态', show: true, key: 'tempWorkHour.stateName', sortable: true },
{ minWidth: '120', title: '是否确认', show: true, key: 'tempWorkHour.isConfirmName', sortable: true }
],
// 默认展示的表格列
tableColums: [],
// 表格数据
tableData: [],
// 表格样式配置
tableOptions: {
stripe: true,
border: true,
height: '400',
showSummary: true,
summaryMethod: this.getSummaries
},
// 表格选中行
selection: [],
// 工具栏
tools: [
// {
// name: '新增',
// icon: '/icons/c-add.png',
// handler: {
// click: () => this.$emit('open')
// }
// }
],
sumRowShow: false
}
},
created() {
this.setDefaultColums()
},
mounted() {
this.init()
},
methods: {
getSummaries(param) {
// this.$nextTick(() => {
// this.$refs.table.$refs.deeTable.doLayout()
// })
this.showSummary = true
const { columns, data } = param
const sums = []
columns.forEach((column, index) => {
if (index === 1) {
sums[index] = '合计'
return
}
const values = data.map(item => Number(item[column.property]))
if (!values.every(value => isNaN(value))) {
sums[index] = values.reduce((prev, curr) => {
const value = Number(curr)
if (!isNaN(value)) {
return prev + curr
} else {
return prev
}
}, 0)
sums[index]
}
})
return sums
},
// 设置默认展示列
setDefaultColums() {
this.tableColums = this.colums.filter(item => item.show)
},
// 初始化数据
init(form, page) {
page && (this.tablePagination.currentPage = 1)
// 设置数据
this.loading = true
this.tableData = []
form && form.length
? this.form = form
: this.form = [{
fieldName: 'state',
operator: 'LIKE',
value: 'Audited'
},
{
fieldName: 'isConfirmCode',
operator: 'LIKE',
value: 'N'
}]
// const params = {
// 'indices': [
// 'TempWorkHourAssign'
// ],
// 'pageFrom': page || this.tablePagination.currentPage,
// 'pageSize': this.tablePagination.pageSize,
// 'searchItems': {
// 'items': [
// ...this.form,
// {
// fieldName: 'dxUserId',
// operator: 'EQ',
// value: localStorage.getItem('userId')
// }
// ],
// 'operator': 'AND'
// },
// 'sortItem': [
// {
// 'fieldName': 'modifyTime',
// 'sortOrder': 'desc'
// }
// ]
// }
// // 发送请求
// getTemp(params).then(res => {
// this.tableData = []
// res.items.content.map(item => {
// item.tempWorkHour.isConfirmName = item.isConfirmName
// this.tableData.push({
// ...item,
// workHours: item.tempWorkHour.workHours
// })
// })
// this.tablePagination.total = res.items.totalElements
// // 清空子表数据
// // this.$emit('clear')
// }).catch(err => console.log(err)).finally(() => {
// this.loading = false
// this.$nextTick(() => {
// this.sumRowShow = true
// })
// })
},
// 确认
confirmHandle() {
if (!this.selectionRow.length) return this.$utils.showMessageWarning('请选择需要操作的数据')
const confirmFlag = this.selectionRow.find(row => (row.isConfirmName === 'Y' || row.isConfirmName === '已确认'))
if (confirmFlag) return this.$utils.showMessageWarning('已确认的数据无法再次进行确认,请重新选择')
this.$confirm('是否对选中的数据进行确认?', '提示', {
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.loading = true
// const ids = this.selectionRow.map(row => row.id)
// confirmTempWorkHour(ids).then(res => {
// this.$utils.showMessageSuccess('确认成功')
// this.init('', 1)
// }).catch(err => {
// console.log(err)
// }).finally(() => {
// this.loading = false
// })
}).catch(() => {
this.$message({
type: 'info',
message: '已取消确认'
})
})
},
// 选择项发生改变
selectionChange(val) {
this.selectionRow = val
},
// 分页每页条数切换
paginationSizeChange(size) {
this.tablePagination.pageSize = size
this.init(this.form)
},
// 分页当前页切换
paginationCurrentChange(page) {
this.tablePagination.currentPage = page
this.init(this.form)
},
// 行点击
rowClick(row) {
this.$emit('rowClick', row)
}
}
}
</script>
<template>
<section class="time-to-see">
<Search :active-name="activeName" @init="(form)=>tableInit(form) " />
<dee-tools :tools="tools" mode="normal" :collapse="false" />
<el-tabs v-model="activeName" type="card" @tab-click="tableInit(false)">
<el-tab-pane label="生产工时" name="product">
<ProductionTable ref="productTable" />
</el-tab-pane>
<el-tab-pane label="临时工时" name="temp">
<TemporaryTable ref="tempTable" />
</el-tab-pane>
</el-tabs>
</section>
</template>
<script>
import ProductionTable from './components/productionTable'
import TemporaryTable from './components/temporaryTable'
import Search from './components/Search'
export default {
name: 'StatisticalSummaryWorkingHours',
components: {
ProductionTable,
TemporaryTable,
Search
},
data() {
return {
activeName: 'product',
// 工具栏
tools: [{
name: '确认',
icon: '/icons/check.png ',
handler: {
click: () => this.confirmHandle()
}
}]
}
},
methods: {
tableInit(form) {
if (this.activeName === 'product') {
this.$refs.productTable.init(form, 1)
} else {
this.$refs.tempTable.init(form, 1)
}
},
confirmHandle(section) {
if (this.activeName === 'product') {
this.$refs.productTable.confirmHandle()
} else {
this.$refs.tempTable.confirmHandle()
}
}
}
}
</script>
<style lang="scss">
.time-to-see{
padding-top: 10px;
background: #fff;
.dee-tools{
float: right;
position: relative;
top: 10px;
z-index: 99999;
}
}
</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