优化
This commit is contained in:
parent
57bab40cc9
commit
61a0644ced
|
@ -8,3 +8,11 @@ export function getReportProdSum(query) {
|
|||
params: query
|
||||
})
|
||||
}
|
||||
// 工序每日产量统计
|
||||
export function getDailyProd(query) {
|
||||
return request({
|
||||
url: '/dashboard/reportProd/dailyProd',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
|
|
@ -8,3 +8,12 @@ export function getReportUserProdSum(query) {
|
|||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 员工工资统计
|
||||
export function getReportUserProdDailySalary(query) {
|
||||
return request({
|
||||
url: '/dashboard/reportUserProd/dailySalary',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
|
|
@ -107,3 +107,21 @@ export function enablePrice(priceId) {
|
|||
method: 'put'
|
||||
})
|
||||
}
|
||||
|
||||
// 查询属性值
|
||||
export function getPriceProperty(query) {
|
||||
return request({
|
||||
url: '/yh/price/property',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询单条单价
|
||||
export function getSinglePrice(query) {
|
||||
return request({
|
||||
url: '/yh/price/single',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ export function delReport(reportId) {
|
|||
})
|
||||
}
|
||||
|
||||
// 审核报表
|
||||
// 主管审核报表
|
||||
export function verifyReport(reportId, pass, verifyRemark) {
|
||||
return request({
|
||||
url: '/yh/report/verify',
|
||||
|
@ -63,6 +63,31 @@ export function verifyReport(reportId, pass, verifyRemark) {
|
|||
})
|
||||
}
|
||||
|
||||
// 财务审核报表
|
||||
export function financeVerifyReport(reportId, pass, verifyRemark) {
|
||||
return request({
|
||||
url: '/yh/report/financeVerify',
|
||||
method: 'put',
|
||||
data: {
|
||||
reportId,
|
||||
pass,
|
||||
verifyRemark
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 反审核报表
|
||||
export function unVerifyReport(reportId) {
|
||||
return request({
|
||||
url: '/yh/report/unVerify',
|
||||
method: 'put',
|
||||
params: {
|
||||
reportId
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// 取消提交
|
||||
export function cancelReport(reportId) {
|
||||
return request({
|
||||
|
|
44
src/api/yh/verify.js
Normal file
44
src/api/yh/verify.js
Normal file
|
@ -0,0 +1,44 @@
|
|||
import request from '@/utils/request'
|
||||
|
||||
// 查询审核记录列表
|
||||
export function listVerify(query) {
|
||||
return request({
|
||||
url: '/yh/verify/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询审核记录详细
|
||||
export function getVerify(id) {
|
||||
return request({
|
||||
url: '/yh/verify/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增审核记录
|
||||
export function addVerify(data) {
|
||||
return request({
|
||||
url: '/yh/verify',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改审核记录
|
||||
export function updateVerify(data) {
|
||||
return request({
|
||||
url: '/yh/verify',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除审核记录
|
||||
export function delVerify(id) {
|
||||
return request({
|
||||
url: '/yh/verify/' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
103
src/components/Business/Price/PricePropertySelect.vue
Normal file
103
src/components/Business/Price/PricePropertySelect.vue
Normal file
|
@ -0,0 +1,103 @@
|
|||
<template>
|
||||
<el-select
|
||||
v-model="selected"
|
||||
placeholder="请选择属性"
|
||||
filterable
|
||||
remote
|
||||
clearable
|
||||
allow-create
|
||||
default-first-option
|
||||
@change="handleChange"
|
||||
:remote-method="remoteMethod" >
|
||||
<el-option v-for="item in propertyList"
|
||||
:key="item"
|
||||
:label="item"
|
||||
:value="item"
|
||||
/>
|
||||
</el-select>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getPriceProperty } from '@/api/yh/price';
|
||||
export default {
|
||||
name: 'PricePropertySelect',
|
||||
props: {
|
||||
prop: {
|
||||
type: String,
|
||||
required: true,
|
||||
default: null,
|
||||
},
|
||||
keywordProp: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
value: {
|
||||
type: [String, Number, Array],
|
||||
default: null,
|
||||
},
|
||||
query: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 100,
|
||||
prop: null,
|
||||
},
|
||||
propertyList: [],
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
selected: {
|
||||
get() {
|
||||
return this.value;
|
||||
},
|
||||
set(val) {
|
||||
this.$emit('input', val);
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
value(val) {
|
||||
if (val) {
|
||||
this.propertyList = [val];
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onVisibleChange(val) {
|
||||
if (val) {
|
||||
this.getList();
|
||||
}
|
||||
},
|
||||
remoteMethod(keyword) {
|
||||
if (this.keywordProp) {
|
||||
this.queryParams[this.keywordProp] = keyword;
|
||||
}
|
||||
let isChange = this.selected != keyword;
|
||||
this.selected = keyword;
|
||||
if (isChange) {
|
||||
this.$emit('change', keyword);
|
||||
}
|
||||
this.getList();
|
||||
},
|
||||
getList() {
|
||||
this.queryParams.prop = this.prop;
|
||||
this.queryParams = {
|
||||
...this.queryParams,
|
||||
...this.query
|
||||
}
|
||||
getPriceProperty(this.queryParams).then(res => {
|
||||
this.propertyList = res.rows;
|
||||
this.total = res.total;
|
||||
})
|
||||
},
|
||||
handleChange(val) {
|
||||
this.$emit('change', val);
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -1,4 +1,4 @@
|
|||
import {isDeepEqual} from "@/utils";
|
||||
import { isDeepEqual } from "@/utils";
|
||||
|
||||
|
||||
export const $businessInput = {
|
||||
|
@ -136,10 +136,11 @@ export const $businessInput = {
|
|||
value = selected[this.prop];
|
||||
}
|
||||
this.$emit('submit', selected);
|
||||
if (!isDeepEqual(this.value, value)) {
|
||||
let hasChange = !isDeepEqual(this.value, value);
|
||||
this.inputValue(value);
|
||||
if (hasChange) {
|
||||
this.$emit('change', selected);
|
||||
}
|
||||
this.inputValue(value);
|
||||
this.closeDialog();
|
||||
},
|
||||
closeDialog() {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// 视图
|
||||
import { getLastDate, getLastDateTimeEnd, getLastDateTimeStart, getLastMonth, getLastMonthTimeEnd } from "@/utils/index";
|
||||
import { getLastDateStr, getLastDateTimeEnd, getLastDateTimeStart, getLastMonthEndStr, getLastMonthStartStr } from "@/utils/index";
|
||||
|
||||
export const views = {
|
||||
}
|
||||
|
@ -52,10 +52,11 @@ export const IncomeMode = {
|
|||
|
||||
// 报表状态
|
||||
export const ReportStatus = {
|
||||
WAIT_SUBMIT: "1", // 未提交
|
||||
WAIT_VERIFY: "2", // 待审核
|
||||
WAIT_SUBMIT: "1", // 待提交
|
||||
WAIT_VERIFY: "2", // 主管审核中
|
||||
PASS: "3", // 已通过
|
||||
REJECT: "4", // 未通过
|
||||
WAIT_FINANCE_VERIFY: "5", // 财务审核中
|
||||
// 允许编辑
|
||||
canEdit(status) {
|
||||
return [this.WAIT_SUBMIT, this.REJECT].includes(status);
|
||||
|
@ -68,17 +69,25 @@ export const ReportStatus = {
|
|||
canCancel(status) {
|
||||
return [this.WAIT_VERIFY].includes(status);
|
||||
},
|
||||
// 允许审核
|
||||
// 允许主管审核
|
||||
canVerify(status) {
|
||||
return [this.WAIT_VERIFY].includes(status);
|
||||
},
|
||||
// 允许财务审核
|
||||
canFinanceVerify(status) {
|
||||
return [this.WAIT_FINANCE_VERIFY].includes(status);
|
||||
},
|
||||
// 允许删除
|
||||
canDel(status) {
|
||||
return [this.WAIT_SUBMIT, this.REJECT].includes(status);
|
||||
},
|
||||
// 是否已审核过的状态
|
||||
isVerified(status) {
|
||||
return [this.PASS, this.REJECT].includes(status);
|
||||
// 允许重置审核员
|
||||
canResetVerify(status) {
|
||||
return [this.REJECT].includes(status);
|
||||
},
|
||||
// 允许反审核
|
||||
canUnVerify(status) {
|
||||
return [this.WAIT_FINANCE_VERIFY, this.PASS].includes(status);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -126,24 +135,24 @@ export const DatePickerOptions = {
|
|||
// 默认
|
||||
DEFAULT: {
|
||||
shortcuts: [{
|
||||
text: '最近一周',
|
||||
text: '最近7天',
|
||||
onClick(picker) {
|
||||
const end = getLastDate(0);
|
||||
const start = getLastDate(6);
|
||||
const end = getLastDateStr(0);
|
||||
const start = getLastDateStr(6);
|
||||
picker.$emit('pick', [start, end]);
|
||||
}
|
||||
}, {
|
||||
text: '最近一个月',
|
||||
text: '本月',
|
||||
onClick(picker) {
|
||||
const end = getLastDate(0);
|
||||
const start = getLastMonth(1);
|
||||
const end = getLastDateStr(0);
|
||||
const start = getLastMonthStartStr(0);
|
||||
picker.$emit('pick', [start, end]);
|
||||
}
|
||||
}, {
|
||||
text: '最近三个月',
|
||||
text: '上月',
|
||||
onClick(picker) {
|
||||
const end = getLastDate(0);
|
||||
const start = getLastMonth(3);
|
||||
const end = getLastMonthEndStr(1);
|
||||
const start = getLastMonthStartStr(1);
|
||||
picker.$emit('pick', [start, end]);
|
||||
}
|
||||
}]
|
||||
|
@ -187,3 +196,8 @@ export const DatePickerOptions = {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 审核业务类型
|
||||
export const VerifyBstType = {
|
||||
REPORT: "1", // 报表
|
||||
}
|
||||
|
|
|
@ -46,3 +46,14 @@ export function calcSecond(start, end) {
|
|||
let endDate = toDate(end);
|
||||
return Math.floor((endDate.getTime() - startDate.getTime()) / 1000);
|
||||
}
|
||||
|
||||
|
||||
// 获取星期几
|
||||
export function getWeekDay(dateStr) {
|
||||
if (!dateStr) {
|
||||
return ''
|
||||
}
|
||||
const date = new Date(dateStr)
|
||||
const weekDays = ['周日', '周一', '周二', '周三', '周四', '周五', '周六']
|
||||
return weekDays[date.getDay()]
|
||||
}
|
|
@ -520,6 +520,58 @@ export function getLastDateTimeEnd(n) {
|
|||
return new Date(getLastDateTimeEndStr(n));
|
||||
}
|
||||
|
||||
// 获取前N个月的开始日期
|
||||
export function getLastMonthStart(n) {
|
||||
const date = new Date();
|
||||
const year = date.getFullYear();
|
||||
const month = date.getMonth();
|
||||
|
||||
// 设置为目标月份的1号
|
||||
date.setMonth(month - n);
|
||||
date.setDate(1);
|
||||
|
||||
// 如果月份不对,说明超出范围需要调整
|
||||
if (date.getMonth() !== (month - n + 12) % 12) {
|
||||
date.setFullYear(year - 1);
|
||||
date.setMonth(month - n + 12);
|
||||
date.setDate(1);
|
||||
}
|
||||
|
||||
return date;
|
||||
}
|
||||
|
||||
// 获取前N个月的开始日期字符串
|
||||
export function getLastMonthStartStr(n) {
|
||||
let date = getLastMonthStart(n);
|
||||
return parseTime(date, "{y}-{m}-{d}");
|
||||
}
|
||||
|
||||
// 获取前N个月的结束日期
|
||||
export function getLastMonthEnd(n) {
|
||||
const date = new Date();
|
||||
const year = date.getFullYear();
|
||||
const month = date.getMonth();
|
||||
|
||||
// 设置为目标月份的下个月1号
|
||||
date.setMonth(month - n + 1);
|
||||
date.setDate(0);
|
||||
|
||||
// 如果月份不对,说明超出范围需要调整
|
||||
if (date.getMonth() !== (month - n + 1 + 12) % 12) {
|
||||
date.setFullYear(year - 1);
|
||||
date.setMonth(month - n + 1 + 12);
|
||||
date.setDate(0);
|
||||
}
|
||||
|
||||
return date;
|
||||
}
|
||||
|
||||
// 获取前N个月的结束日期字符串
|
||||
export function getLastMonthEndStr(n) {
|
||||
let date = getLastMonthEnd(n);
|
||||
return parseTime(date, "{y}-{m}-{d}");
|
||||
}
|
||||
|
||||
// 展示分数
|
||||
export function formatFraction(numerator, denominator) {
|
||||
if (denominator === 1) {
|
||||
|
|
567
src/views/dashboard/tables/ProdDailyNum.vue
Normal file
567
src/views/dashboard/tables/ProdDailyNum.vue
Normal file
|
@ -0,0 +1,567 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" size="small">
|
||||
<el-form-item label="报表日期" prop="reportDateRange">
|
||||
<el-date-picker
|
||||
v-model="queryParams.reportDateRange"
|
||||
type="daterange"
|
||||
range-separator="至"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
value-format="yyyy-MM-dd"
|
||||
:picker-options="DatePickerOptions.DEFAULT"
|
||||
@change="handleQuery"
|
||||
:clearable="false"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="部门" prop="deptId">
|
||||
<dept-select v-model="queryParams.deptId" @change="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="工序" prop="priceName">
|
||||
<el-input v-model="queryParams.eqPriceName" placeholder="请输入工序" clearable @keyup.enter.native="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="类别" prop="priceCategory">
|
||||
<el-input v-model="queryParams.eqPriceCategory" placeholder="请输入类别" clearable @keyup.enter.native="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="大小" prop="priceSize">
|
||||
<el-input v-model="queryParams.eqPriceSize" placeholder="请输入大小" clearable @keyup.enter.native="handleQuery" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="报表状态" prop="reportStatus">
|
||||
<el-select v-model="queryParams.reportStatus" placeholder="请选择报表状态" clearable @change="handleQuery">
|
||||
<el-option v-for="item in dict.type.report_status" :key="item.value" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" @click="handleQuery">查询</el-button>
|
||||
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="12">
|
||||
<div class="custom-merge-container">
|
||||
<span class="custom-merge-label">自定义合并顺序:</span>
|
||||
<el-select v-model="customMergeOrder[0]" placeholder="第一级" size="mini" @change="handleCustomMergeChange">
|
||||
<el-option label="工序" value="priceName" />
|
||||
<el-option label="类别" value="priceCategory" />
|
||||
<el-option label="大小" value="priceSize" />
|
||||
</el-select>
|
||||
<span class="custom-merge-separator">></span>
|
||||
<el-select v-model="customMergeOrder[1]" placeholder="第二级" size="mini" @change="handleCustomMergeChange">
|
||||
<el-option
|
||||
v-for="item in getSecondLevelOptions"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
<span class="custom-merge-separator">></span>
|
||||
<el-select v-model="customMergeOrder[2]" placeholder="第三级" size="mini" @change="handleCustomMergeChange">
|
||||
<el-option
|
||||
v-for="item in getThirdLevelOptions"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</div>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList" @resetQuery="resetQuery"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table
|
||||
v-loading="loading"
|
||||
:data="mergedTableData"
|
||||
:key="'table_' + forceRender"
|
||||
border
|
||||
size="mini"
|
||||
style="width: 100%"
|
||||
:span-method="arraySpanMethod"
|
||||
:summary-method="getSummaries"
|
||||
show-summary
|
||||
max-height="700px"
|
||||
>
|
||||
<!-- 合并字段列(按照合并顺序) -->
|
||||
<el-table-column
|
||||
v-for="(field, index) in mergeOrder"
|
||||
:key="field"
|
||||
:prop="field"
|
||||
:label="fieldLabelMap[field]"
|
||||
:min-width="fieldWidthMap[field]"
|
||||
fixed="left"
|
||||
:align="'left'"
|
||||
:show-overflow-tooltip="true"
|
||||
/>
|
||||
|
||||
<!-- 单位列 -->
|
||||
<el-table-column
|
||||
prop="priceUnit"
|
||||
label="单位"
|
||||
min-width="80"
|
||||
fixed="left"
|
||||
align="center"
|
||||
:show-overflow-tooltip="true"
|
||||
/>
|
||||
|
||||
<!-- 日期列 -->
|
||||
<el-table-column
|
||||
v-for="date in dateColumns"
|
||||
:key="date"
|
||||
:prop="date"
|
||||
min-width="100"
|
||||
align="right"
|
||||
>
|
||||
<template slot="header" slot-scope="scope">
|
||||
<div>{{ date }}</div>
|
||||
<div>{{ getWeekDay(date) }}</div>
|
||||
</template>
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row[date] | dv }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<!-- 合计列 -->
|
||||
<el-table-column
|
||||
prop="totalNum"
|
||||
label="合计"
|
||||
min-width="120"
|
||||
fixed="right"
|
||||
align="right"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.totalNum | dv }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getDailyProd } from '@/api/dashboard/reportProd'
|
||||
import { parseTime } from '@/utils/ruoyi.js'
|
||||
import { DatePickerOptions, ReportStatus } from '@/utils/constants.js'
|
||||
import { getWeekDay } from '@/utils/date.js'
|
||||
import DeptSelect from '@/components/Business/Dept/DeptSelect.vue'
|
||||
|
||||
export default {
|
||||
components: { DeptSelect },
|
||||
dicts: ['report_status'],
|
||||
data() {
|
||||
return {
|
||||
DatePickerOptions,
|
||||
loading: false,
|
||||
tableData: [],
|
||||
dateColumns: [],
|
||||
mergedTableData: [],
|
||||
spanArray: [], // 存储合并信息
|
||||
mergeOrder: ['priceCategory', 'priceSize', 'priceName'], // 默认合并顺序
|
||||
customMergeOrder: ['priceCategory', 'priceSize', 'priceName'], // 自定义合并顺序
|
||||
fieldLabelMap: { // 字段和标签的映射
|
||||
priceName: '工序',
|
||||
priceCategory: '类别',
|
||||
priceSize: '大小',
|
||||
priceUnit: '单位'
|
||||
},
|
||||
fieldWidthMap: { // 字段和宽度的映射
|
||||
priceName: '120',
|
||||
priceCategory: '100',
|
||||
priceSize: '80',
|
||||
priceUnit: '80'
|
||||
},
|
||||
total: 0,
|
||||
showSearch: true,
|
||||
forceRender: 0, // 用于强制重新渲染表格
|
||||
queryParams: {
|
||||
reportDateRange: [],
|
||||
deptId: null,
|
||||
eqPriceName: null,
|
||||
eqPriceCategory: null,
|
||||
eqPriceSize: null,
|
||||
reportStatus: ReportStatus.PASS
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
// 获取第二级选项(排除第一级已选的)
|
||||
getSecondLevelOptions() {
|
||||
const options = [
|
||||
{ label: '工序', value: 'priceName' },
|
||||
{ label: '类别', value: 'priceCategory' },
|
||||
{ label: '大小', value: 'priceSize' }
|
||||
]
|
||||
return options.filter(option => option.value !== this.customMergeOrder[0])
|
||||
},
|
||||
// 获取第三级选项(排除第一级和第二级已选的)
|
||||
getThirdLevelOptions() {
|
||||
const options = [
|
||||
{ label: '工序', value: 'priceName' },
|
||||
{ label: '类别', value: 'priceCategory' },
|
||||
{ label: '大小', value: 'priceSize' }
|
||||
]
|
||||
return options.filter(option =>
|
||||
option.value !== this.customMergeOrder[0] &&
|
||||
option.value !== this.customMergeOrder[1]
|
||||
)
|
||||
}
|
||||
},
|
||||
created() {
|
||||
// 设置默认日期范围为当前月份
|
||||
const now = new Date()
|
||||
const startDate = new Date(now.getFullYear(), now.getMonth(), 1)
|
||||
const endDate = new Date(now.getFullYear(), now.getMonth() + 1, 0)
|
||||
this.queryParams.reportDateRange = [
|
||||
parseTime(startDate, '{y}-{m}-{d}'),
|
||||
parseTime(endDate, '{y}-{m}-{d}')
|
||||
]
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
getWeekDay,
|
||||
getList() {
|
||||
this.loading = true
|
||||
getDailyProd(this.queryParams).then(res => {
|
||||
this.tableData = res.data || []
|
||||
this.processDates()
|
||||
this.processTableData()
|
||||
}).finally(() => {
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
// 处理日期列
|
||||
processDates() {
|
||||
if (this.queryParams.reportDateRange && this.queryParams.reportDateRange.length === 2) {
|
||||
const start = new Date(this.queryParams.reportDateRange[0])
|
||||
const end = new Date(this.queryParams.reportDateRange[1])
|
||||
const dateColumns = []
|
||||
|
||||
// 生成日期范围内的所有日期
|
||||
for (let d = new Date(start); d <= end; d.setDate(d.getDate() + 1)) {
|
||||
dateColumns.push(parseTime(d, '{y}-{m}-{d}'))
|
||||
}
|
||||
|
||||
this.dateColumns = dateColumns
|
||||
} else {
|
||||
// 如果没有设置日期范围,则从数据中提取所有唯一的日期
|
||||
const uniqueDates = [...new Set(this.tableData.map(item => item.reportDate))].sort()
|
||||
this.dateColumns = uniqueDates
|
||||
}
|
||||
},
|
||||
// 处理表格数据
|
||||
processTableData() {
|
||||
// 创建一个映射,用于按照指定的字段组合进行合并
|
||||
const groupMap = new Map()
|
||||
|
||||
// 遍历原始数据
|
||||
this.tableData.forEach(item => {
|
||||
// 创建组合键
|
||||
const key = `${item.priceName || ''}|${item.priceCategory || ''}|${item.priceSize || ''}`
|
||||
|
||||
if (!groupMap.has(key)) {
|
||||
// 如果这个组合不存在,创建一个新记录
|
||||
groupMap.set(key, {
|
||||
priceName: item.priceName,
|
||||
priceCategory: item.priceCategory,
|
||||
priceSize: item.priceSize,
|
||||
priceUnit: item.priceUnit,
|
||||
totalNum: 0
|
||||
})
|
||||
}
|
||||
|
||||
// 获取当前记录
|
||||
const record = groupMap.get(key)
|
||||
|
||||
// 为每个日期设置数量
|
||||
record[item.reportDate] = item.totalNum
|
||||
|
||||
// 更新总数量
|
||||
record.totalNum = (parseFloat(record.totalNum) || 0) + (parseFloat(item.totalNum) || 0)
|
||||
})
|
||||
|
||||
// 将Map转换为数组
|
||||
let mergedData = Array.from(groupMap.values())
|
||||
|
||||
// 根据当前的合并顺序对数据进行排序
|
||||
mergedData = this.sortDataByMergeOrder(mergedData)
|
||||
|
||||
this.mergedTableData = mergedData
|
||||
|
||||
// 计算合并单元格
|
||||
this.calculateSpanArray()
|
||||
},
|
||||
// 按合并顺序排序数据
|
||||
sortDataByMergeOrder(data) {
|
||||
return data.sort((a, b) => {
|
||||
for (const field of this.mergeOrder) {
|
||||
const aValue = a[field] || ''
|
||||
const bValue = b[field] || ''
|
||||
if (aValue !== bValue) {
|
||||
return aValue.localeCompare(bValue)
|
||||
}
|
||||
}
|
||||
return 0
|
||||
})
|
||||
},
|
||||
// 计算合并单元格信息
|
||||
calculateSpanArray() {
|
||||
// 初始化span数组
|
||||
this.spanArray = []
|
||||
for (let i = 0; i < 3; i++) {
|
||||
this.spanArray[i] = []
|
||||
for (let j = 0; j < this.mergedTableData.length; j++) {
|
||||
this.spanArray[i][j] = {
|
||||
rowspan: 1,
|
||||
colspan: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 处理三个层级的合并
|
||||
for (let level = 0; level < 3; level++) {
|
||||
const field = this.mergeOrder[level]
|
||||
let pos = 0
|
||||
|
||||
// 遍历处理每一行
|
||||
for (let i = 0; i < this.mergedTableData.length; i++) {
|
||||
if (i === 0) {
|
||||
// 第一行,初始化
|
||||
this.spanArray[level][i].rowspan = 1
|
||||
this.spanArray[level][i].colspan = 1
|
||||
pos = 0
|
||||
} else {
|
||||
// 根据不同级别的合并规则来判断是否合并
|
||||
let shouldMerge = true
|
||||
|
||||
for (let l = 0; l <= level; l++) {
|
||||
const compareField = this.mergeOrder[l]
|
||||
if (this.mergedTableData[i][compareField] !== this.mergedTableData[i - 1][compareField]) {
|
||||
shouldMerge = false
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if (shouldMerge) {
|
||||
// 当前行需要和前一行合并
|
||||
this.spanArray[level][i].rowspan = 0
|
||||
this.spanArray[level][i].colspan = 0
|
||||
this.spanArray[level][pos].rowspan++
|
||||
} else {
|
||||
// 当前行不需要合并
|
||||
this.spanArray[level][i].rowspan = 1
|
||||
this.spanArray[level][i].colspan = 1
|
||||
pos = i
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
// 单元格合并方法
|
||||
arraySpanMethod({ row, column, rowIndex, columnIndex }) {
|
||||
// 获取当前列对应在mergeOrder中的索引位置
|
||||
const fieldIndex = this.mergeOrder.findIndex(field => field === column.property)
|
||||
|
||||
// 只对前三列应用合并(合并字段列)
|
||||
if (fieldIndex >= 0 && fieldIndex < 3) {
|
||||
return {
|
||||
rowspan: this.spanArray[fieldIndex][rowIndex].rowspan,
|
||||
colspan: this.spanArray[fieldIndex][rowIndex].colspan
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
rowspan: 1,
|
||||
colspan: 1
|
||||
}
|
||||
},
|
||||
// 处理内置合并方式的切换
|
||||
handleMergeCommand(command) {
|
||||
switch (command) {
|
||||
case 'nameFirst':
|
||||
this.customMergeOrder = ['priceName', 'priceCategory', 'priceSize']
|
||||
break
|
||||
case 'categoryFirst':
|
||||
this.customMergeOrder = ['priceCategory', 'priceName', 'priceSize']
|
||||
break
|
||||
case 'sizeFirst':
|
||||
this.customMergeOrder = ['priceSize', 'priceName', 'priceCategory']
|
||||
break
|
||||
}
|
||||
this.handleCustomMergeChange()
|
||||
},
|
||||
// 处理自定义合并方式的变更
|
||||
handleCustomMergeChange() {
|
||||
// 确保没有重复的字段,处理可能的选择冲突
|
||||
const uniqueFields = [...new Set(this.customMergeOrder)]
|
||||
if (uniqueFields.length < 3) {
|
||||
// 如果有重复,找出缺少的字段并补充
|
||||
const allFields = ['priceName', 'priceCategory', 'priceSize']
|
||||
const missingFields = allFields.filter(field => !uniqueFields.includes(field))
|
||||
|
||||
// 对于重复的字段,保留第一次出现的,后面的用缺少的字段替换
|
||||
const newOrder = []
|
||||
const used = new Set()
|
||||
|
||||
for (const field of this.customMergeOrder) {
|
||||
if (!used.has(field)) {
|
||||
newOrder.push(field)
|
||||
used.add(field)
|
||||
} else {
|
||||
// 如果字段重复,使用一个缺少的字段替换
|
||||
if (missingFields.length > 0) {
|
||||
newOrder.push(missingFields.shift())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.customMergeOrder = newOrder
|
||||
}
|
||||
|
||||
// 更新合并顺序并重新处理
|
||||
this.mergeOrder = [...this.customMergeOrder]
|
||||
console.log('当前合并顺序:', this.mergeOrder)
|
||||
|
||||
// 重新排序数据
|
||||
this.mergedTableData = this.sortDataByMergeOrder([...this.mergedTableData])
|
||||
|
||||
// 重新计算合并信息
|
||||
this.calculateSpanArray()
|
||||
|
||||
// 强制表格重新渲染
|
||||
this.forceRender++
|
||||
},
|
||||
// 处理查询
|
||||
handleQuery() {
|
||||
this.getList()
|
||||
},
|
||||
// 重置查询表单
|
||||
resetQuery() {
|
||||
this.$refs.queryForm.resetFields()
|
||||
this.getList()
|
||||
},
|
||||
// 表格合计行
|
||||
getSummaries(param) {
|
||||
const { columns, data } = param
|
||||
const sums = []
|
||||
columns.forEach((column, index) => {
|
||||
if (index === 0) {
|
||||
sums[index] = '合计'
|
||||
return
|
||||
}
|
||||
|
||||
if (index >= 4 && index < columns.length - 1) { // 日期列
|
||||
const values = data.map(item => Number(item[column.property] || 0))
|
||||
if (!values.every(value => isNaN(value))) {
|
||||
const sum = values.reduce((prev, curr) => {
|
||||
const value = Number(curr)
|
||||
if (!isNaN(value)) {
|
||||
return prev + value
|
||||
} else {
|
||||
return prev
|
||||
}
|
||||
}, 0)
|
||||
|
||||
// 应用与表格内容相同的过滤器格式
|
||||
if (this.$options.filters && this.$options.filters.fix2) {
|
||||
const formattedValue = this.$options.filters.fix2(sum)
|
||||
if (this.$options.filters && this.$options.filters.dv) {
|
||||
sums[index] = this.$options.filters.dv(formattedValue)
|
||||
} else {
|
||||
sums[index] = formattedValue
|
||||
}
|
||||
} else {
|
||||
sums[index] = sum
|
||||
}
|
||||
} else {
|
||||
sums[index] = '--'
|
||||
}
|
||||
} else if (index === columns.length - 1) { // 合计列
|
||||
const values = data.map(item => Number(item.totalNum || 0))
|
||||
if (!values.every(value => isNaN(value))) {
|
||||
const sum = values.reduce((prev, curr) => {
|
||||
const value = Number(curr)
|
||||
if (!isNaN(value)) {
|
||||
return prev + value
|
||||
} else {
|
||||
return prev
|
||||
}
|
||||
}, 0)
|
||||
|
||||
// 应用与表格内容相同的过滤器格式
|
||||
if (this.$options.filters && this.$options.filters.fix2) {
|
||||
const formattedValue = this.$options.filters.fix2(sum)
|
||||
if (this.$options.filters && this.$options.filters.dv) {
|
||||
sums[index] = this.$options.filters.dv(formattedValue)
|
||||
} else {
|
||||
sums[index] = formattedValue
|
||||
}
|
||||
} else {
|
||||
sums[index] = sum
|
||||
}
|
||||
} else {
|
||||
sums[index] = '--'
|
||||
}
|
||||
} else {
|
||||
sums[index] = '--'
|
||||
}
|
||||
})
|
||||
|
||||
return sums
|
||||
}
|
||||
},
|
||||
filters: {
|
||||
// 保留两位小数
|
||||
fix2(val) {
|
||||
if (val === null || val === undefined || isNaN(val)) {
|
||||
return '--'
|
||||
}
|
||||
return parseFloat(val)
|
||||
},
|
||||
// 默认值过滤器
|
||||
dv(val) {
|
||||
if (val === null || val === undefined || val === '--') {
|
||||
return '--'
|
||||
}
|
||||
return val
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.app-container {
|
||||
padding: 20px;
|
||||
|
||||
.el-table {
|
||||
margin-top: 15px;
|
||||
|
||||
::v-deep .el-table__header th {
|
||||
.cell {
|
||||
line-height: 20px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.mb8 {
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.custom-merge-container {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.custom-merge-label {
|
||||
margin-right: 10px;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.custom-merge-separator {
|
||||
margin: 0 8px;
|
||||
color: #909399;
|
||||
}
|
||||
|
||||
.el-select {
|
||||
width: 120px;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
246
src/views/dashboard/tables/UserProdDailySalary.vue
Normal file
246
src/views/dashboard/tables/UserProdDailySalary.vue
Normal file
|
@ -0,0 +1,246 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" size="small" >
|
||||
<el-form-item label="报表日期" prop="reportDateRange">
|
||||
<el-date-picker
|
||||
v-model="queryParams.reportDateRange"
|
||||
type="daterange"
|
||||
range-separator="至"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
value-format="yyyy-MM-dd"
|
||||
:picker-options="DatePickerOptions.DEFAULT"
|
||||
@change="handleQuery"
|
||||
:clearable="false"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="部门" prop="deptId">
|
||||
<dept-select v-model="queryParams.deptId" @change="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="员工" prop="userIds">
|
||||
<user-input v-model="queryParams.userIds" multiple @change="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="报表状态" prop="reportStatus">
|
||||
<el-select v-model="queryParams.reportStatus" placeholder="请选择报表状态" clearable @change="handleQuery">
|
||||
<el-option v-for="item in dict.type.report_status" :key="item.value" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" @click="handleQuery">查询</el-button>
|
||||
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList" @resetQuery="resetQuery"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table
|
||||
v-loading="loading"
|
||||
:data="mergedTableData"
|
||||
border
|
||||
size="mini"
|
||||
style="width: 100%"
|
||||
:summary-method="getSummaries"
|
||||
show-summary
|
||||
max-height="700px"
|
||||
>
|
||||
<el-table-column
|
||||
prop="userInfo"
|
||||
label="用户信息"
|
||||
width="150"
|
||||
fixed="left"
|
||||
/>
|
||||
<el-table-column
|
||||
v-for="(date, index) in dateColumns"
|
||||
:key="date"
|
||||
:prop="date"
|
||||
:label="date"
|
||||
min-width="100"
|
||||
align="right"
|
||||
>
|
||||
<template slot="header" slot-scope="scope">
|
||||
<div>{{ date }}</div>
|
||||
<div>{{ getWeekDay(date) }}</div>
|
||||
</template>
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row[date] | fix2 | dv }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="totalAmount"
|
||||
label="合计"
|
||||
width="120"
|
||||
fixed="right"
|
||||
align="right"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.totalAmount | fix2 | dv }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getReportUserProdDailySalary } from '@/api/dashboard/reportUserProd'
|
||||
import { parseTime } from '@/utils/ruoyi.js'
|
||||
import UserInput from '@/components/Business/User/UserInput.vue'
|
||||
import { DatePickerOptions, ReportStatus } from '@/utils/constants.js'
|
||||
import { getWeekDay } from '@/utils/date.js'
|
||||
import DeptSelect from '@/components/Business/Dept/DeptSelect.vue'
|
||||
|
||||
export default {
|
||||
components: { UserInput, DeptSelect },
|
||||
dicts: ['report_status'],
|
||||
data() {
|
||||
return {
|
||||
DatePickerOptions,
|
||||
loading: false,
|
||||
tableData: [],
|
||||
dateColumns: [],
|
||||
mergedTableData: [],
|
||||
total: 0,
|
||||
showSearch: true,
|
||||
queryParams: {
|
||||
reportDateRange: [],
|
||||
userIds: [],
|
||||
reportStatus: ReportStatus.PASS
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
// 设置默认日期范围为当前月份
|
||||
const now = new Date()
|
||||
const startDate = new Date(now.getFullYear(), now.getMonth(), 1)
|
||||
const endDate = new Date(now.getFullYear(), now.getMonth() + 1, 0)
|
||||
this.queryParams.reportDateRange = [
|
||||
parseTime(startDate, '{y}-{m}-{d}'),
|
||||
parseTime(endDate, '{y}-{m}-{d}')
|
||||
]
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
getWeekDay,
|
||||
getList() {
|
||||
this.loading = true
|
||||
getReportUserProdDailySalary(this.queryParams).then(res => {
|
||||
this.tableData = res.data || []
|
||||
this.processDates()
|
||||
this.processTableData()
|
||||
}).finally(() => {
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
// 处理日期列
|
||||
processDates() {
|
||||
if (this.queryParams.reportDateRange && this.queryParams.reportDateRange.length === 2) {
|
||||
const start = new Date(this.queryParams.reportDateRange[0])
|
||||
const end = new Date(this.queryParams.reportDateRange[1])
|
||||
const dateColumns = []
|
||||
|
||||
// 生成日期范围内的所有日期
|
||||
for (let d = new Date(start); d <= end; d.setDate(d.getDate() + 1)) {
|
||||
dateColumns.push(parseTime(d, '{y}-{m}-{d}'))
|
||||
}
|
||||
|
||||
this.dateColumns = dateColumns
|
||||
} else {
|
||||
// 如果没有设置日期范围,则从数据中提取所有唯一的日期
|
||||
const uniqueDates = [...new Set(this.tableData.map(item => item.reportDate))].sort()
|
||||
this.dateColumns = uniqueDates
|
||||
}
|
||||
},
|
||||
// 处理表格数据
|
||||
processTableData() {
|
||||
const userMap = new Map()
|
||||
|
||||
// 按用户分组
|
||||
this.tableData.forEach(item => {
|
||||
const userId = item.userId
|
||||
if (!userMap.has(userId)) {
|
||||
userMap.set(userId, {
|
||||
userId: userId,
|
||||
userInfo: `${item.userName}(${item.userNo})`,
|
||||
userNo: item.userNo,
|
||||
userName: item.userName,
|
||||
totalAmount: 0
|
||||
})
|
||||
}
|
||||
|
||||
// 为每个日期设置工资
|
||||
const userRecord = userMap.get(userId)
|
||||
userRecord[item.reportDate] = item.totalPrice
|
||||
userRecord.totalAmount += Number(item.totalPrice)
|
||||
})
|
||||
|
||||
// 转换为数组
|
||||
this.mergedTableData = Array.from(userMap.values())
|
||||
},
|
||||
// 处理查询
|
||||
handleQuery() {
|
||||
this.getList()
|
||||
},
|
||||
// 重置查询表单
|
||||
resetQuery() {
|
||||
this.$refs.queryForm.resetFields()
|
||||
this.getList()
|
||||
},
|
||||
// 表格合计行
|
||||
getSummaries(param) {
|
||||
const { columns, data } = param
|
||||
const sums = []
|
||||
columns.forEach((column, index) => {
|
||||
if (index === 0) {
|
||||
sums[index] = '合计'
|
||||
return
|
||||
}
|
||||
|
||||
const values = data.map(item => Number(item[column.property] || 0))
|
||||
if (!values.every(value => isNaN(value))) {
|
||||
const sum = values.reduce((prev, curr) => {
|
||||
const value = Number(curr)
|
||||
if (!isNaN(value)) {
|
||||
return prev + value
|
||||
} else {
|
||||
return prev
|
||||
}
|
||||
}, 0)
|
||||
|
||||
// 应用与表格内容相同的过滤器格式
|
||||
if (this.$options.filters && this.$options.filters.fix2) {
|
||||
const formattedValue = this.$options.filters.fix2(sum)
|
||||
if (this.$options.filters && this.$options.filters.dv) {
|
||||
sums[index] = this.$options.filters.dv(formattedValue)
|
||||
} else {
|
||||
sums[index] = formattedValue
|
||||
}
|
||||
} else {
|
||||
sums[index] = sum.toFixed(2)
|
||||
}
|
||||
} else {
|
||||
sums[index] = '--'
|
||||
}
|
||||
})
|
||||
|
||||
return sums
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.app-container {
|
||||
padding: 20px;
|
||||
|
||||
.el-table {
|
||||
margin-top: 15px;
|
||||
|
||||
::v-deep .el-table__header th {
|
||||
.cell {
|
||||
line-height: 20px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -1,11 +1,9 @@
|
|||
<template>
|
||||
<el-progress
|
||||
v-if="percentage != null && !isNaN(percentage)"
|
||||
text-inside
|
||||
:stroke-width="16"
|
||||
text-inside
|
||||
:percentage="percentage"
|
||||
:color="customColors"
|
||||
text-color="#fff"
|
||||
:style="{width: width}"
|
||||
/>
|
||||
</template>
|
||||
|
@ -32,6 +30,14 @@ export default {
|
|||
type: String,
|
||||
default: "80px",
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
formatPercentage() {
|
||||
if (this.percentage == null || !isNaN(this.percentage)) {
|
||||
return 0;
|
||||
}
|
||||
return this.percentage.toFixed(2);
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -40,6 +40,15 @@
|
|||
</el-checkbox-button>
|
||||
</el-checkbox-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="进度" prop="progressRange">
|
||||
<el-input v-model="queryParams.progressRange[0]" placeholder="请输入进度" clearable @keyup.enter.native="handleQuery" style="width: 130px;">
|
||||
<template slot="suffix">%</template>
|
||||
</el-input>
|
||||
-
|
||||
<el-input v-model="queryParams.progressRange[1]" placeholder="请输入进度" clearable @keyup.enter.native="handleQuery" style="width: 130px;">
|
||||
<template slot="suffix">%</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
|
@ -109,22 +118,34 @@
|
|||
<template v-if="column.key === 'id'">
|
||||
{{d.row[column.key]}}
|
||||
</template>
|
||||
<template v-else-if="column.key === 'erpDocumentStatus'">
|
||||
<dict-tag :options="dict.type.prod_order_erp_document_status" :value="d.row[column.key]" size="mini"/>
|
||||
<template v-else-if="column.key === 'orderInfo'">
|
||||
跟踪号:{{d.row.erpMtoNo | dv}}
|
||||
<dict-tag :options="dict.type.prod_order_erp_status" :value="d.row.erpStatus" size="mini" style="margin-left: 4px;"/>
|
||||
<dict-tag :options="dict.type.prod_order_erp_req_src" :value="d.row.erpReqSrc" size="mini" style="margin-left: 4px;"/>
|
||||
<el-tag v-if="d.row.erpIsRework" type="danger" size="mini" style="margin-left: 4px;">返工</el-tag>
|
||||
<br/>
|
||||
订单编号:{{d.row.erpBillNo | dv }} <br/>
|
||||
物料编码:{{d.row.materialNumber | dv }} <br/>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'erpStatus'">
|
||||
<dict-tag :options="dict.type.prod_order_erp_status" :value="d.row[column.key]" size="mini"/>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'erpReqSrc'">
|
||||
<dict-tag :options="dict.type.prod_order_erp_req_src" :value="d.row[column.key]" size="mini"/>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'erpIsRework'">
|
||||
<boolean-tag :value="d.row.erpIsRework" size="mini"/>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'percentage'">
|
||||
<prod-order-progress :percentage="percentage(d.row)" width="100%" />
|
||||
<div>数量:{{d.row.erpQty | dv}} {{d.row.unitName}} </div>
|
||||
<div>未入库:{{d.row.erpNoStockInQty | dv}} {{d.row.unitName}}</div>
|
||||
<template v-else-if="column.key === 'progress'">
|
||||
<prod-order-progress :percentage="d.row.progress" width="100%" />
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<div>数量:{{d.row.erpQty | dv}} {{d.row.unitName}} </div>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<div>未入库:{{d.row.erpNoStockInQty | dv}} {{d.row.unitName}}</div>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<div>基本:{{d.row.erpBaseUnitQty | dv}}</div>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<div>基本未入库:{{d.row.erpBaseNoStockInQty | dv}}</div>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<div>基本已审核:{{d.row.verifiedBaseNum | dv}} </div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</template>
|
||||
<template v-else-if="['erpQty', 'erpNoStockInQty'].includes(column.key)">
|
||||
{{d.row[column.key]}}
|
||||
|
@ -132,8 +153,6 @@
|
|||
</template>
|
||||
<template v-else-if="column.key === 'time'">
|
||||
<template v-if="d.row.erpDate">单据日期:{{d.row.erpDate | dv}}<br/></template>
|
||||
<!-- <template v-if="d.row.erpCreateDate">创建:{{d.row.erpCreateDate | dv}}<br/></template>
|
||||
<template v-if="d.row.erpModifyDate">修改:{{d.row.erpModifyDate | dv}}<br/></template> -->
|
||||
<template v-if="d.row.erpConveyDate">下达:{{d.row.erpConveyDate | dv}}<br/></template>
|
||||
<template v-if="d.row.syncTime">同步:{{d.row.syncTime | dv}}<br/></template>
|
||||
</template>
|
||||
|
@ -223,20 +242,13 @@ export default {
|
|||
columns: [
|
||||
{key: 'id', visible: false, label: '生产订单ID', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
|
||||
{key: 'erpId', visible: false, label: 'ID', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
|
||||
{key: 'erpMtoNo', visible: true, label: '跟踪号', minWidth: null, sortable: true, overflow: false, align: 'center', width: "100"},
|
||||
{key: 'erpBillNo', visible: true, label: '编号', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
|
||||
{key: 'erpStatus', visible: true, label: '状态', minWidth: null, sortable: true, overflow: false, align: 'center', width: "80"},
|
||||
{key: 'erpDocumentStatus', visible: false, label: '单据', minWidth: null, sortable: true, overflow: false, align: 'center', width: "80"},
|
||||
{key: 'erpDescription', visible: false, label: '主备注', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
|
||||
{key: 'materialNumber', visible: true, label: '物料', minWidth: null, sortable: false, overflow: false, align: 'center', width: null},
|
||||
{key: 'orderInfo', visible: true, label: '订单信息', minWidth: "150", sortable: false, overflow: false, align: 'left',width: null},
|
||||
{key: 'progress', visible: true, label: '进度', minWidth: null, sortable: true, overflow: false, align: 'left', width: "300"},
|
||||
{key: 'fauxProp', visible: true, label: '辅助属性', minWidth: null, sortable: true, overflow: true, align: 'center', width: null},
|
||||
{key: 'workShopName', visible: true, label: '车间', minWidth: null, sortable: true, overflow: false, align: 'center', width: "100"},
|
||||
{key: 'erpIsRework', visible: true, label: '返工', minWidth: null, sortable: true, overflow: false, align: 'center', width: "80"},
|
||||
{key: 'percentage', visible: true, label: '进度', minWidth: null, sortable: false, overflow: false, align: 'left', width: "120"},
|
||||
{key: 'erpRowId', visible: false, label: '行标识', minWidth: null, sortable: true, overflow: true, align: 'center', width: null},
|
||||
{key: 'erpMemoItem', visible: true, label: '备注', minWidth: null, sortable: true, overflow: true, align: 'center', width: null},
|
||||
{key: 'time', visible: true, label: '时间', minWidth: null, sortable: false, overflow: false, align: 'left', width: "170"},
|
||||
{key: 'erpReqSrc', visible: false, label: '来源', minWidth: null, sortable: true, overflow: false, align: 'center', width: "80"},
|
||||
{key: 'erpRowId', visible: false, label: '行标识', minWidth: null, sortable: true, overflow: true, align: 'center', width: null},
|
||||
{key: 'time', visible: true, label: '时间', minWidth: null, sortable: false, overflow: false, align: 'left', width: "170"},
|
||||
{key: 'erpBaseUnitQty', visible: false, label: '基本', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
|
||||
{key: 'erpBaseNoStockInQty', visible: false, label: '基本未入库', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
|
||||
{key: 'baseUnitName', visible: false, label: '基本单位', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
|
||||
|
@ -286,6 +298,7 @@ export default {
|
|||
productType: null,
|
||||
materialNo: null,
|
||||
erpStatusList: [],
|
||||
progressRange: [],
|
||||
erpIsRework: null,
|
||||
erpBillNo: null,
|
||||
erpDocumentStatus: null,
|
||||
|
|
|
@ -1,16 +1,3 @@
|
|||
import {notNullDecimal} from "@/utils";
|
||||
|
||||
export const $prodOrder = {
|
||||
computed: {
|
||||
// 生产进度百分比
|
||||
percentage() {
|
||||
return (row) => {
|
||||
return notNullDecimal(
|
||||
notNullDecimal(row.verifiedBaseNum)
|
||||
.div(notNullDecimal(row.erpBaseUnitQty))
|
||||
.toFixed(2)
|
||||
).toNumber();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
<el-descriptions-item label="未入库数量">{{detail.erpNoStockInQty | dv}} {{detail.unitName}}</el-descriptions-item>
|
||||
<el-descriptions-item label="同步时间">{{detail.syncTime | dv}}</el-descriptions-item>
|
||||
<el-descriptions-item label="生产进度">
|
||||
<prod-order-progress :percentage="percentage(detail)" width="80px"/>
|
||||
<prod-order-progress :percentage="detail.progress" width="80px"/>
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</el-card>
|
||||
|
|
|
@ -42,23 +42,20 @@
|
|||
</template>
|
||||
</el-table-column>
|
||||
<table-form-col label="工序名称" :page-size="pageSize" :page-num="pageNum" prop-prefix="productList" prop="priceName" :rules="rules.productList.priceName" header-icon="el-icon-edit" @click-header="handleBatchEdit('priceName')">
|
||||
<el-input slot-scope="d" v-model="d.row.priceName" placeholder="请输入工序名称" @change="selectPrice(d.index)" />
|
||||
<price-property-select slot-scope="d" v-model="d.row.priceName" prop="name" keyword-prop="name" style="width: 100%;" @change="handlePropertyChange(d.row)" :query="propertyQuery"/>
|
||||
</table-form-col>
|
||||
<table-form-col label="类别" :page-size="pageSize" :page-num="pageNum" prop-prefix="productList" prop="priceCategory" width="80" :rules="rules.productList.priceCategory" header-icon="el-icon-edit" @click-header="handleBatchEdit('priceCategory')">
|
||||
<el-input slot-scope="d" v-model="d.row.priceCategory" placeholder="请输入类别" @change="selectPrice(d.index)" />
|
||||
<price-property-select slot-scope="d" v-model="d.row.priceCategory" prop="category" keyword-prop="category" style="width: 100%;" @change="handlePropertyChange(d.row)" :query="propertyQuery"/>
|
||||
</table-form-col>
|
||||
<table-form-col label="大小" :page-size="pageSize" :page-num="pageNum" prop-prefix="productList" prop="priceSize" width="60" :rules="rules.productList.priceSize" header-icon="el-icon-edit" @click-header="handleBatchEdit('priceSize')">
|
||||
<el-input slot-scope="d" v-model="d.row.priceSize" placeholder="请输入大小" @change="selectPrice(d.index)" />
|
||||
<price-property-select slot-scope="d" v-model="d.row.priceSize" prop="size" keyword-prop="size" style="width: 100%;" @change="handlePropertyChange(d.row)" :query="propertyQuery"/>
|
||||
</table-form-col>
|
||||
<table-form-col :label="showPattern ? '图案' : ''" :page-size="pageSize" :page-num="pageNum" prop-prefix="productList" :width="showPattern ? '100' : '0'" prop="pricePattern" :rules="rules.productList.pricePattern" header-icon="el-icon-edit" @click-header="handleBatchEdit('pricePattern')">
|
||||
<el-input slot-scope="d" v-model="d.row.pricePattern" placeholder="请输入图案" @change="selectPrice(d.index)" />
|
||||
<price-property-select slot-scope="d" v-model="d.row.pricePattern" prop="pattern" keyword-prop="pattern" style="width: 100%;" @change="handlePropertyChange(d.row)" :query="propertyQuery"/>
|
||||
</table-form-col>
|
||||
<table-form-col label="成品" :page-size="pageSize" :page-num="pageNum" prop-prefix="productList" prop="isEnd" :rules="rules.productList.isEnd" required width="60">
|
||||
<el-checkbox slot-scope="d" v-model="d.row.isEnd"/>
|
||||
</table-form-col>
|
||||
<!-- <table-form-col label="不良品" prop-prefix="productList" prop="defectNum">
|
||||
<el-input-number slot-scope="d" v-model="d.row.defectNum" placeholder="请输入数量" :min="0" :precision="0" controls-position="right" style="width: 100%"/>
|
||||
</table-form-col> -->
|
||||
<table-form-col label="表面" :page-size="pageSize" :page-num="pageNum" width="76" prop-prefix="productList" prop="surface" :rules="rules.productList.surface" header-icon="el-icon-edit" @click-header="handleBatchEdit('surface')">
|
||||
<el-select slot-scope="d" v-model="d.row.surface" placeholder="请选择表面处理" @change="onChangeSurface(d.row)" filterable clearable allow-create style="width: 100%;">
|
||||
<el-option v-for="item in dict.type.surface" :key="item.value" :label="item.label" :value="item.value"/>
|
||||
|
@ -77,18 +74,10 @@
|
|||
</el-input>
|
||||
</table-form-col>
|
||||
<table-form-col label="单价" :page-size="pageSize" :page-num="pageNum" prop-prefix="productList" width="100" prop="priceId" required :rules="rules.productList.priceId">
|
||||
<price-select
|
||||
slot-scope="d"
|
||||
:value="d.row.priceId"
|
||||
:name="d.row.priceName"
|
||||
:code="d.row.priceCode"
|
||||
:status="d.row.priceStatus"
|
||||
:price="d.row.pricePrice"
|
||||
:query="priceQuery(d.row)"
|
||||
@change="(val) => handlePriceChange(d.row, val)"
|
||||
style="width: 100%;"
|
||||
:ref="`priceSelect${d.index}`"
|
||||
/>
|
||||
<template slot-scope="d">
|
||||
<span v-if="d.row.priceId == null" style="color: red;font-size: 12px;">无单价</span>
|
||||
<span v-else style="font-size: 12px;">{{d.row.pricePrice | fix2 | dv}}</span>
|
||||
</template>
|
||||
</table-form-col>
|
||||
<table-form-col label="备注" :page-size="pageSize" :page-num="pageNum" prop-prefix="productList" prop="remark" align="center" width="60" :rules="rules.productList.remark" header-icon="el-icon-edit" @click-header="handleBatchEdit('remark')">
|
||||
<el-popover
|
||||
|
@ -194,11 +183,13 @@ import { IncomeMode, PriceStatus } from '@/utils/constants'
|
|||
import { notNullDecimal } from '@/utils/index'
|
||||
import Decimal from 'decimal.js'
|
||||
import PriceSelect from '@/components/Business/Price/PriceSelect.vue'
|
||||
import PricePropertySelect from '@/components/Business/Price/PricePropertySelect.vue'
|
||||
import { getSinglePrice } from '@/api/yh/price'
|
||||
|
||||
export default {
|
||||
name: "ReportProductList",
|
||||
dicts: ['price_type', 'surface', 'color_code', 'price_status'],
|
||||
components: { HoverShow, BooleanTag, TableFormCol, ReportProductUserList, ReportProductOrderList, UserProductBatchDialog, PriceSelect},
|
||||
components: { HoverShow, BooleanTag, TableFormCol, ReportProductUserList, ReportProductOrderList, UserProductBatchDialog, PriceSelect, PricePropertySelect},
|
||||
props: {
|
||||
form: {
|
||||
type: Object,
|
||||
|
@ -254,20 +245,11 @@ export default {
|
|||
}
|
||||
},
|
||||
computed: {
|
||||
priceQuery() {
|
||||
return (row) => {
|
||||
// 每次调用该方法时都会使用最新的row数据来构建查询参数
|
||||
console.log("priceQuery with updated row data:", row);
|
||||
return {
|
||||
deptId: this.form.deptId,
|
||||
statusList: PriceStatus.canUse(),
|
||||
disabled: false,
|
||||
eqCategory: row.priceCategory,
|
||||
eqSize: row.priceSize,
|
||||
eqPattern: row.pricePattern,
|
||||
eqName: row.priceName,
|
||||
needAllMatch: true
|
||||
}
|
||||
propertyQuery() {
|
||||
return {
|
||||
deptId: this.form.deptId,
|
||||
statusList: PriceStatus.canUse(),
|
||||
disabled: false,
|
||||
}
|
||||
},
|
||||
totalAmount() {
|
||||
|
@ -284,6 +266,9 @@ export default {
|
|||
this.showPattern = localStorage.getItem("report_show_pattern") === "true";
|
||||
},
|
||||
methods: {
|
||||
handlePropertyChange(row) {
|
||||
this.selectPrice(row);
|
||||
},
|
||||
// 判断良品是公式则计算出结果
|
||||
handleChangeNum(row, val) {
|
||||
if (val != null) {
|
||||
|
@ -375,15 +360,23 @@ export default {
|
|||
localStorage.setItem("report_show_pattern", val);
|
||||
},
|
||||
// 选择工序
|
||||
selectPrice(index) {
|
||||
// 获取当前行对象
|
||||
const row = this.form.productList[index];
|
||||
// 确保PriceSelect组件能获取到最新的参数
|
||||
this.$nextTick(() => {
|
||||
if (this.$refs[`priceSelect${index}`]) {
|
||||
this.$refs[`priceSelect${index}`].getOptionsAndSelectFirst();
|
||||
selectPrice(row) {
|
||||
console.log('selectPrice', row);
|
||||
// 查询并获取单价
|
||||
getSinglePrice( {
|
||||
deptId: this.form.deptId,
|
||||
statusList: PriceStatus.canUse(),
|
||||
disabled: false,
|
||||
eqCategory: row.priceCategory,
|
||||
eqSize: row.priceSize,
|
||||
eqPattern: row.pricePattern,
|
||||
eqName: row.priceName,
|
||||
needAllMatch: true
|
||||
}).then(res => {
|
||||
if (res.code == 200) {
|
||||
this.handlePriceChange(row, res.data);
|
||||
}
|
||||
});
|
||||
})
|
||||
},
|
||||
// 优化展开行处理
|
||||
handleDetail(row) {
|
||||
|
@ -418,10 +411,6 @@ export default {
|
|||
row.priceQuantityDenominator = val.quantityDenominator || null;
|
||||
row.priceCode = val.code || null;
|
||||
row.priceStatus = val.status || null;
|
||||
// row.priceCategory = val.category;
|
||||
// row.priceSize = val.size;
|
||||
// row.priceName = val.name;
|
||||
// row.pricePattern = val.pattern;
|
||||
}
|
||||
},
|
||||
checkPriceChange(ov, nv) {
|
||||
|
@ -545,14 +534,8 @@ export default {
|
|||
|
||||
// 如果是修改价格相关字段,需要重新查询单价
|
||||
if (isEditPrice) {
|
||||
// 使用nextTick确保UI更新后再查询价格
|
||||
this.$nextTick(() => {
|
||||
for (let i = 0; i < this.rows.length; i++) {
|
||||
let index = this.form.productList.indexOf(this.rows[i]);
|
||||
if (index != -1) {
|
||||
this.selectPrice(index);
|
||||
}
|
||||
}
|
||||
this.rows.forEach(row => {
|
||||
this.selectPrice(row);
|
||||
});
|
||||
}
|
||||
this.$message.success(`批量编辑成功,一共修改了${this.rows.length}行数据`);
|
||||
|
|
|
@ -23,6 +23,9 @@
|
|||
</template>
|
||||
</el-input>
|
||||
</table-form-col>
|
||||
<table-form-col label="充公" :prop-prefix="propPrefix" prop="confiscate" width="80">
|
||||
<el-checkbox slot-scope="d" v-model="d.row.confiscate" />
|
||||
</table-form-col>
|
||||
<table-form-col label="工资" :prop-prefix="propPrefix" prop="totalAmount" align="right" width="100">
|
||||
<span slot-scope="d" style="font-size: 12px;">{{totalAmount(d.row) | fix1 | dv}}</span>
|
||||
</table-form-col>
|
||||
|
@ -201,6 +204,7 @@ export default {
|
|||
let list = userList.map(item => ({
|
||||
userId: item.userId,
|
||||
num: null,
|
||||
confiscate: false,
|
||||
// vo
|
||||
userName: item.nickName,
|
||||
userNo: item.userNo,
|
||||
|
|
|
@ -59,9 +59,8 @@ import FormCol from "@/components/FormCol/index.vue";
|
|||
import DeptTreeSelect from "@/components/Business/Dept/DeptTreeSelect.vue";
|
||||
import {addReport, getReport, updateReport} from "@/api/yh/report";
|
||||
import EditHeader from "@/components/EditHeader/index.vue";
|
||||
import {isEmpty, notNullDecimal} from "@/utils";
|
||||
import {notNullDecimal} from "@/utils";
|
||||
import {mapGetters} from "vuex";
|
||||
import Decimal from "decimal.js";
|
||||
import {DatePickerOptions} from "@/utils/constants";
|
||||
import ReportProductList from '@/views/yh/report/edit-v2/components/ReportProductList.vue';
|
||||
import { parseTime } from '@/utils/ruoyi.js';
|
||||
|
|
|
@ -15,28 +15,6 @@
|
|||
</form-col>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column label="单位" align="center">-->
|
||||
<!-- <template slot-scope="d">-->
|
||||
<!-- {{d.row.unitName | dv}}-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-table-column>-->
|
||||
<!-- <el-table-column label="计划数量" align="center">
|
||||
<template slot-scope="d">
|
||||
{{d.row.orderErpQty | dv}}
|
||||
<template v-if="!isEmpty(d.row.unitName)"> {{d.row.unitName}}</template>
|
||||
</template>
|
||||
</el-table-column> -->
|
||||
<!-- <el-table-column label="已审核数量" align="center">-->
|
||||
<!-- <template slot-scope="d">-->
|
||||
<!-- {{d.row.verifyBaseNum | dv}}-->
|
||||
<!-- <template v-if="!isEmpty(d.row.baseUnitName)"> {{d.row.baseUnitName}}</template>-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-table-column>-->
|
||||
<!-- <el-table-column label="进度" align="center">-->
|
||||
<!-- <template slot-scope="d">-->
|
||||
<!-- <el-progress text-inside :stroke-width="16" :percentage="percentage(d.row)" :color="customColors" text-color="#fff"/>-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-table-column>-->
|
||||
<el-table-column align="center" width="100">
|
||||
<template #header>
|
||||
<el-button
|
||||
|
@ -118,18 +96,6 @@ export default {
|
|||
}
|
||||
},
|
||||
computed: {
|
||||
// 百分比
|
||||
percentage() {
|
||||
return (row) => {
|
||||
let plan = notNullDecimal(row.orderErpBaseUnitQty); // 基本计划数量
|
||||
let noStock = notNullDecimal(row.orderErpBaseNoStockInQty); // ERP基本未入库数量
|
||||
let current = notNullDecimal(calcMulDecimal(row.num, this.quantity)); // 当前填入数量 * 倍数
|
||||
console.log(`plan ${plan} noStock ${noStock} current ${current} quantity ${this.quantity}`)
|
||||
return new Decimal(
|
||||
current.add(plan.sub(noStock)).mul(new Decimal(100)).div(plan).toFixed(2)
|
||||
).toNumber();
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 订单查询条件
|
||||
*/
|
||||
|
|
|
@ -141,6 +141,14 @@
|
|||
v-has-permi="['yh:report:submit']"
|
||||
v-show="ReportStatus.canSubmit(scope.row.status)"
|
||||
>提交</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-refresh"
|
||||
@click="handleUnVerify(scope.row)"
|
||||
v-has-permi="['yh:report:unVerify']"
|
||||
v-show="ReportStatus.canUnVerify(scope.row.status)"
|
||||
>反审核</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
|
@ -164,7 +172,7 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import {cancelReport, delReport, listReport, submitReport} from "@/api/yh/report";
|
||||
import {cancelReport, delReport, listReport, submitReport, unVerifyReport} from "@/api/yh/report";
|
||||
import {getReportSum} from "@/api/dashboard/report";
|
||||
import {$showColumns} from '@/utils/mixins';
|
||||
import FormCol from "@/components/FormCol/index.vue";
|
||||
|
@ -261,6 +269,21 @@ export default {
|
|||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
// 反审核
|
||||
handleUnVerify(row) {
|
||||
this.$confirm('确定反审核吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
unVerifyReport(row.reportId).then(res => {
|
||||
if (res.code === 200) {
|
||||
this.$message.success("反审核成功");
|
||||
this.getList();
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
getSum() {
|
||||
getReportSum(this.queryParams).then(res => {
|
||||
this.sum = res.data;
|
||||
|
|
|
@ -16,27 +16,29 @@
|
|||
<el-descriptions-item label="创建时间">{{detail.createTime | dv}}</el-descriptions-item>
|
||||
<el-descriptions-item label="更新人">{{detail.updateBy | dv}}</el-descriptions-item>
|
||||
<el-descriptions-item label="更新时间">{{detail.updateTime | dv}}</el-descriptions-item>
|
||||
<el-descriptions-item label="审核人">{{detail.verifyBy | dv}}</el-descriptions-item>
|
||||
<el-descriptions-item label="审核时间">{{detail.verifyTime | dv}}</el-descriptions-item>
|
||||
<el-descriptions-item label="审核意见" :span="2" v-if="ReportStatus.isVerified(detail.status)">
|
||||
{{detail.verifyRemark | dv}}
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</el-card>
|
||||
|
||||
<el-card header="工序产量" class="card-box">
|
||||
<report-prod
|
||||
v-if="!loading"
|
||||
:remove-search-columns="['reportId', 'reportStatus']"
|
||||
:hide-columns="['reportId', 'id', 'reportStatus']"
|
||||
:query="{reportId: detail.reportId}"
|
||||
:custom-config="{
|
||||
containerClass: null,
|
||||
showTableOpera: false,
|
||||
showSearch: false,
|
||||
showSelection: false
|
||||
}"/>
|
||||
<el-card class="card-box" v-if="detail.reportId">
|
||||
<el-tabs lazy>
|
||||
<el-tab-pane label="工序产量">
|
||||
<report-prod
|
||||
:remove-search-columns="['reportId', 'reportStatus']"
|
||||
:hide-columns="['reportId', 'id', 'reportStatus']"
|
||||
:query="{reportId: detail.reportId}"
|
||||
:custom-config="{
|
||||
containerClass: null,
|
||||
showTableOpera: false,
|
||||
showSearch: false,
|
||||
showSelection: false
|
||||
}"/>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="审核记录">
|
||||
<verify :query="{bstType: VerifyBstType.REPORT, bstId: detail.reportId}" />
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</el-card>
|
||||
|
||||
</el-col>
|
||||
<el-col :lg="6" v-if="showVerify">
|
||||
<el-card header="审核">
|
||||
|
@ -56,17 +58,19 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import {getReport, verifyReport} from "@/api/yh/report";
|
||||
import {getReport, verifyReport, financeVerifyReport} from "@/api/yh/report";
|
||||
import ReportProd from "@/views/yh/reportProd/index.vue";
|
||||
import {ReportStatus} from "@/utils/constants";
|
||||
import {ReportStatus, VerifyBstType} from "@/utils/constants";
|
||||
import {checkPermi} from "@/utils/permission";
|
||||
import Verify from "@/views/yh/verify/index.vue";
|
||||
|
||||
export default {
|
||||
name: "ReportView",
|
||||
components: {ReportProd},
|
||||
components: {ReportProd, Verify},
|
||||
dicts: ['report_status'],
|
||||
data() {
|
||||
return {
|
||||
VerifyBstType,
|
||||
ReportStatus,
|
||||
detail: {},
|
||||
loading: false,
|
||||
|
@ -75,7 +79,11 @@ export default {
|
|||
computed: {
|
||||
// 是否显示审核区域
|
||||
showVerify() {
|
||||
return this.detail != null && checkPermi(['yh:report:verify']) && ReportStatus.canVerify(this.detail.status);
|
||||
return this.detail != null
|
||||
&& (
|
||||
(checkPermi(['yh:report:verify']) && ReportStatus.canVerify(this.detail.status))
|
||||
|| (checkPermi(['yh:report:financeVerify']) && ReportStatus.canFinanceVerify(this.detail.status))
|
||||
);
|
||||
}
|
||||
},
|
||||
created() {
|
||||
|
@ -98,12 +106,21 @@ export default {
|
|||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
verifyReport(this.detail.reportId, pass, this.detail.verifyRemark).then(res => {
|
||||
if (res.code === 200) {
|
||||
this.$message.success("操作成功");
|
||||
this.getDetail();
|
||||
}
|
||||
})
|
||||
if (ReportStatus.canVerify(this.detail.status)) {
|
||||
verifyReport(this.detail.reportId, pass, this.detail.verifyRemark).then(res => {
|
||||
if (res.code === 200) {
|
||||
this.$message.success("操作成功");
|
||||
this.getDetail();
|
||||
}
|
||||
})
|
||||
} else if (ReportStatus.canFinanceVerify(this.detail.status)) {
|
||||
financeVerifyReport(this.detail.reportId, pass, this.detail.verifyRemark).then(res => {
|
||||
if (res.code === 200) {
|
||||
this.$message.success("操作成功");
|
||||
this.getDetail();
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,7 +53,6 @@ export default {
|
|||
let verifiedBaseNum = notNullDecimal(row.verifiedBaseNum); // 已经审核的量
|
||||
let num = notNullDecimal(row.num).mul(notNullDecimal(this.priceQuantity)); // 提交数量 * 倍数
|
||||
let orderErpBaseUnitQty = notNullDecimal(row.orderErpBaseUnitQty); // 基础总需求量
|
||||
console.log("percentage", verifiedBaseNum.toNumber(), num.toNumber(), orderErpBaseUnitQty.toNumber());
|
||||
|
||||
// 结果 = (已审核量 + 本次提交量 * 倍数) / 基础总需求量 * 100
|
||||
return new Decimal(
|
||||
|
|
|
@ -2,7 +2,10 @@
|
|||
<el-descriptions border size="mini">
|
||||
<template v-for="(item, index) of data">
|
||||
<el-descriptions-item :key="item.id" label="员工">{{item.userName | dv}}</el-descriptions-item>
|
||||
<el-descriptions-item :key="item.id" label="产量">{{item.num | dv}} {{priceUnit}}</el-descriptions-item>
|
||||
<el-descriptions-item :key="item.id" label="产量">
|
||||
{{item.num | dv}} {{priceUnit}}
|
||||
<el-tag v-if="item.confiscate" type="danger" size="mini">充公</el-tag>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :key="item.id" label="工资">{{totalPrice(item) | dv}} 元</el-descriptions-item>
|
||||
</template>
|
||||
</el-descriptions>
|
||||
|
|
|
@ -76,6 +76,13 @@
|
|||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="是否充公" prop="confiscate">
|
||||
<el-radio-group v-model="queryParams.confiscate">
|
||||
<el-radio :label="null">全部</el-radio>
|
||||
<el-radio :label="true">是</el-radio>
|
||||
<el-radio :label="false">否</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
|
@ -163,6 +170,7 @@
|
|||
</template>
|
||||
<template v-else-if="column.key === 'num'">
|
||||
{{d.row[column.key] | dv}} {{ d.row.priceUnit | dv}}
|
||||
<el-tag v-if="d.row.confiscate" type="danger" size="mini">充公</el-tag>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'totalPrice'">
|
||||
{{d.row.totalPrice | fix1 | dv}} 元
|
||||
|
@ -317,6 +325,7 @@ export default {
|
|||
id: null,
|
||||
prodId: null,
|
||||
userId: null,
|
||||
confiscate: null,
|
||||
reportDateRange: []
|
||||
},
|
||||
// 表单参数
|
||||
|
|
282
src/views/yh/verify/index.vue
Normal file
282
src/views/yh/verify/index.vue
Normal file
|
@ -0,0 +1,282 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="审核人" prop="userName">
|
||||
<el-input
|
||||
v-model="queryParams.userName"
|
||||
placeholder="请输入审核人"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="审核意见" prop="reason">
|
||||
<el-input
|
||||
v-model="queryParams.reason"
|
||||
placeholder="请输入审核意见"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="verifyList" @selection-change="handleSelectionChange" :default-sort="defaultSort" @sort-change="onSortChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<template v-for="column of showColumns">
|
||||
<el-table-column
|
||||
:key="column.key"
|
||||
:label="column.label"
|
||||
:prop="column.key"
|
||||
:align="column.align"
|
||||
:min-width="column.minWidth"
|
||||
:sort-orders="orderSorts"
|
||||
:sortable="column.sortable"
|
||||
:show-overflow-tooltip="column.overflow"
|
||||
:width="column.width"
|
||||
>
|
||||
<template slot-scope="d">
|
||||
<template v-if="column.key === 'id'">
|
||||
{{d.row[column.key]}}
|
||||
</template>
|
||||
<template v-else-if="column.key === 'bstType'">
|
||||
<dict-tag :options="dict.type.verify_bst_type" :value="d.row[column.key]"/>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'status'">
|
||||
<dict-tag :options="dict.type.verify_status" :value="d.row[column.key]"/>
|
||||
</template>
|
||||
<template v-else>
|
||||
{{d.row[column.key]}}
|
||||
</template>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</template>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listVerify, getVerify, delVerify, addVerify, updateVerify } from "@/api/yh/verify";
|
||||
import { $showColumns } from '@/utils/mixins';
|
||||
import FormCol from "@/components/FormCol/index.vue";
|
||||
|
||||
// 默认排序字段
|
||||
const defaultSort = {
|
||||
prop: "createTime",
|
||||
order: "descending"
|
||||
}
|
||||
|
||||
export default {
|
||||
name: "Verify",
|
||||
mixins: [$showColumns],
|
||||
dicts: ['verify_bst_type', 'verify_status'],
|
||||
components: {FormCol},
|
||||
props: {
|
||||
query: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
span: 24,
|
||||
// 字段列表
|
||||
columns: [
|
||||
{key: 'id', visible: false, label: 'ID', minWidth: null, sortable: true, overflow: false, align: 'center', width: "80"},
|
||||
{key: 'createTime', visible: true, label: '时间', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
|
||||
{key: 'userName', visible: true, label: '审核人', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
|
||||
{key: 'bstType', visible: false, label: '业务类型', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
|
||||
{key: 'bstId', visible: false, label: '业务ID', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
|
||||
{key: 'status', visible: true, label: '状态', minWidth: null, sortable: true, overflow: false, align: 'center', width: "100"},
|
||||
{key: 'reason', visible: true, label: '审核意见', minWidth: "200", sortable: true, overflow: false, align: 'center', width: null},
|
||||
],
|
||||
// 排序方式
|
||||
orderSorts: ['ascending', 'descending', null],
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: false,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 审核记录表格数据
|
||||
verifyList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
defaultSort,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 20,
|
||||
orderByColumn: defaultSort.prop,
|
||||
isAsc: defaultSort.order,
|
||||
id: null,
|
||||
userId: null,
|
||||
bstType: null,
|
||||
bstId: null,
|
||||
status: null,
|
||||
reason: null,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
userId: [
|
||||
{ required: true, message: "审核人ID不能为空", trigger: "blur" }
|
||||
],
|
||||
bstType: [
|
||||
{ required: true, message: "业务类型不能为空", trigger: "change" }
|
||||
],
|
||||
bstId: [
|
||||
{ required: true, message: "业务ID不能为空", trigger: "blur" }
|
||||
],
|
||||
status: [
|
||||
{ required: true, message: "状态不能为空", trigger: "change" }
|
||||
],
|
||||
createTime: [
|
||||
{ required: true, message: "创建时间不能为空", trigger: "blur" }
|
||||
]
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
|
||||
this.queryParams = {
|
||||
...this.queryParams,
|
||||
...this.query,
|
||||
}
|
||||
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 当排序按钮被点击时触发 **/
|
||||
onSortChange(column) {
|
||||
if (column.order == null) {
|
||||
this.queryParams.orderByColumn = defaultSort.prop;
|
||||
this.queryParams.isAsc = defaultSort.order;
|
||||
} else {
|
||||
this.queryParams.orderByColumn = column.prop;
|
||||
this.queryParams.isAsc = column.order;
|
||||
}
|
||||
this.getList();
|
||||
},
|
||||
/** 查询审核记录列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listVerify(this.queryParams).then(response => {
|
||||
this.verifyList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
id: null,
|
||||
userId: null,
|
||||
bstType: null,
|
||||
bstId: null,
|
||||
status: null,
|
||||
reason: null,
|
||||
createTime: null
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.id)
|
||||
this.single = selection.length!==1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加审核记录";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const id = row.id || this.ids
|
||||
getVerify(id).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改审核记录";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.id != null) {
|
||||
updateVerify(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
addVerify(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const ids = row.id || this.ids;
|
||||
this.$modal.confirm('是否确认删除审核记录编号为"' + ids + '"的数据项?').then(function() {
|
||||
return delVerify(ids);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('yh/verify/export', {
|
||||
...this.queryParams
|
||||
}, `verify_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
Loading…
Reference in New Issue
Block a user