This commit is contained in:
磷叶 2024-11-06 16:41:05 +08:00
parent edcddcb61b
commit d6325266b8
25 changed files with 1484 additions and 191 deletions

View File

@ -53,6 +53,7 @@
"quill": "2.0.2",
"screenfull": "5.0.2",
"sortablejs": "1.10.2",
"vant": "^2.13.2",
"vue": "2.6.12",
"vue-count-to": "1.0.13",
"vue-cropper": "0.5.5",

View File

@ -118,7 +118,7 @@
top: 0;
width: 51%;
height: 100%;
background: #6F2023;
background: #409EFF;
z-index: 1000;
-webkit-transform: translateX(0);
-ms-transform: translateX(0);

View File

@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询员工产量列表
export function listReportUserProd(query) {
return request({
url: '/yh/reportUserProd/list',
method: 'get',
params: query
})
}
// 查询员工产量详细
export function getReportUserProd(id) {
return request({
url: '/yh/reportUserProd/' + id,
method: 'get'
})
}
// 新增员工产量
export function addReportUserProd(data) {
return request({
url: '/yh/reportUserProd',
method: 'post',
data: data
})
}
// 修改员工产量
export function updateReportUserProd(data) {
return request({
url: '/yh/reportUserProd',
method: 'put',
data: data
})
}
// 删除员工产量
export function delReportUserProd(id) {
return request({
url: '/yh/reportUserProd/' + id,
method: 'delete'
})
}

View File

@ -181,7 +181,7 @@ aside {
}
}
.edit-title {
border-left:3px solid #6F2023;
border-left:3px solid #409EFF;
padding: 0 0.5em;
margin: 1em 0;
}
@ -234,3 +234,23 @@ aside {
height:32px;
}
}
.card-header {
display: flex;
justify-content: space-between;
align-items: center;
.card-operator {
display: flex;
justify-content: flex-end;
// 卡片上的按钮
.card-btn {
padding-top: 0 !important;
padding-bottom: 0 !important;
}
}
}
.fixed {
position: fixed;
}

View File

@ -0,0 +1,27 @@
.ipad-container {
position: relative;
padding-top: 64px;
height: calc(100vh - 86px);
display: flex;
flex-direction: column;
.top-bar {
position: absolute;
top: 0;
left: 0;
width: 100%;
padding: 20px 20px 0;
}
.content {
flex: 1;
width: 100%;
overflow-y: auto;
overflow-x: hidden;
padding: 8px 20px;
}
}
.form-container {
padding: 20px;
background-color: #f9f9f9;
min-height: calc(100vh - 180px);
}

View File

@ -201,8 +201,6 @@
}
.card-box {
padding-right: 15px;
padding-left: 15px;
margin-bottom: 10px;
}

View File

@ -16,6 +16,7 @@
:index="index"
:type="item.raw.listClass == 'primary' ? '' : item.raw.listClass"
:class="item.raw.cssClass"
:size="size"
>
{{ item.label + ' ' }}
</el-tag>
@ -44,6 +45,10 @@ export default {
separator: {
type: String,
default: ","
},
size: {
type: String,
default: null
}
},
data() {

View File

@ -0,0 +1,56 @@
<template>
<div class="hover-show">
<div class="show">
<slot name="show">
{{showValue | dv}}
</slot>
<i v-if="showIcon" class="el-icon-edit" style="font-size: 12px; color: #ccc;"/>
</div>
<div class="hide">
<slot></slot>
</div>
</div>
</template>
<script>
export default {
name: "HoverShow",
props: {
showValue: {
type: String,
default: '--'
},
showIcon: {
type: Boolean,
default: true
}
},
data() {
return {
}
},
}
</script>
<style scoped lang="scss">
.hover-show {
.hide {
display: none;
}
.show {
display: flex;
justify-content: center;
align-items: center;
}
&:hover {
.hide {
display: block;
}
.show {
display: none;
}
}
}
</style>

View File

@ -0,0 +1 @@
<

View File

@ -6,6 +6,7 @@ import Element from 'element-ui'
import './assets/styles/element-variables.scss'
import '@/assets/styles/index.scss' // global css
import '@/assets/styles/ipad.scss' // ipad global css
import '@/assets/styles/ruoyi.scss' // ruoyi css
import App from './App'
import store from './store'

View File

@ -81,13 +81,13 @@ export const constantRoutes = [
children: [
{
path: 'report/add',
component: () => import('@/views/yh/report/edit.vue'),
component: () => import('@/views/yh/report/edit/edit.vue'),
name: 'ReportEdit',
meta: { title: '新增报表', noCache: false}
},
{
path: 'report/:reportId/update',
component: () => import('@/views/yh/report/edit.vue'),
component: () => import('@/views/yh/report/edit/edit.vue'),
name: 'ReportEdit',
meta: { title: '编辑报表', noCache: false}
},
@ -107,19 +107,6 @@ export const constantRoutes = [
}
]
},
{
path: '/util',
component: Layout,
redirect: 'noredirect',
children: [
{
path: 'k3',
component: () => import('@/views/tool/k3/index.vue'),
name: 'K3',
meta: { title: '金蝶工具', icon: 'tool' }
}
]
}
]
// 动态路由,基于用户权限动态去加载

View File

@ -5,7 +5,7 @@ const { sideTheme, showSettings, topNav, tagsView, fixedHeader, sidebarLogo, dyn
const storageSetting = JSON.parse(localStorage.getItem('layout-setting')) || ''
const state = {
title: '',
theme: storageSetting.theme || '#6F2023',
theme: storageSetting.theme || '#409EFF',
sideTheme: storageSetting.sideTheme || sideTheme,
showSettings: showSettings,
topNav: storageSetting.topNav === undefined ? topNav : storageSetting.topNav,

9
src/utils/money.js Normal file
View File

@ -0,0 +1,9 @@
import {notNullDecimal} from "@/utils/index";
// 计算总价
export function calcMulDecimal(a, b) {
if (a == null || b == null) {
return 0;
}
return notNullDecimal(a).mul(notNullDecimal(b)).toNumber();
}

View File

@ -1,7 +1,7 @@
<template>
<div class="login">
<el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form">
<h3 class="title">盈浩生产管理系统</h3>
<h3 class="title">登录</h3>
<el-form-item prop="username">
<el-input
v-model="loginForm.username"
@ -65,9 +65,11 @@
import { getCodeImg } from "@/api/login";
import Cookies from "js-cookie";
import { encrypt, decrypt } from '@/utils/jsencrypt'
import Logo from "@/layout/components/Sidebar/Logo.vue";
export default {
name: "Login",
components: {Logo},
data() {
return {
codeUrl: "",
@ -169,12 +171,14 @@ export default {
text-align: center;
color: #707070;
}
.login-form {
border-radius: 6px;
background: #ffffff;
width: 400px;
padding: 25px 25px 5px 25px;
padding: 200px 25px 5px 25px;
position: absolute;
top: 0;
right: 0;
height: 100vh;
.el-input {
height: 38px;
input {

View File

@ -330,6 +330,7 @@ import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import FormCol from "@/components/FormCol/index.vue";
import {$showColumns} from "@/utils/mixins";
import {calcBirthDay, calcFullYear} from "@/utils/date";
import {parseTime} from "@/utils/ruoyi";
export default {
name: "User",
@ -522,7 +523,7 @@ export default {
employStatus: '1',
remark: undefined,
birthday: null,
employDate: new Date(),
employDate: parseTime(new Date(),"{y}-{m}-{d}"),
postIds: [],
roleIds: []
};

View File

@ -0,0 +1,226 @@
<template>
<div class="ipad-container" v-loading="loading">
<div class="top-bar">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-has-permi="['yh:report:add']"
>新增</el-button>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
</div>
<div class="content" v-infinite-scroll="loadList" :infinite-scroll-disabled="loading || noMore">
<el-row :gutter="8" >
<el-col :md="12" :sm="24" v-for="report of reportList" :key="report.reportId">
<el-card class="card-box">
<template #header>
<el-row class="card-header">
<el-col>
{{report.deptName}} {{report.reportDate}} 日报表
</el-col>
<el-col class="card-operator">
<el-button type="text" icon="el-icon-edit" class="card-btn" @click="handleUpdate(report)">编辑</el-button>
<el-button type="text" icon="el-icon-delete" class="card-btn" @click="handleDelete(report)">删除</el-button>
</el-col>
</el-row>
</template>
<el-descriptions :column="2">
<el-descriptions-item v-for="column of columns" v-if="column.visible" :key="column.key" :label="column.label">
<template v-if="column.key === 'status'">
<dict-tag :options="dict.type.report_status" :value="report[column.key]" size="small"/>
</template>
<template v-else-if="column.key === 'totalAmount'">
{{report.totalAmount | dv}}
</template>
<template v-else>
{{report[column.key] | dv}}
</template>
</el-descriptions-item>
</el-descriptions>
</el-card>
</el-col>
</el-row>
<el-divider v-if="noMore">没有更多了</el-divider>
</div>
<el-backtop target=".ipad-container .content"/>
</div>
</template>
<script>
import {$showColumns} from "@/utils/mixins";
import {delReport, listReport} from "@/api/yh/report";
//
const defaultSort = {
prop: "createTime",
order: "descending"
}
export default {
name: "IpadReport",
mixins: [$showColumns],
dicts: ['report_status'],
data() {
return {
//
columns: [
{key: 'reportId', visible: false, label: 'ID', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
{key: 'deptName', visible: true, label: '部门', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
{key: 'reportDate', visible: true, label: '报表日期', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
{key: 'totalAmount', visible: true, label: '总金额', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
{key: 'status', visible: true, label: '状态', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
{key: 'createBy', visible: true, label: '创建人', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
{key: 'createTime', visible: true, label: '创建时间', minWidth: null, sortable: true, overflow: false, align: 'center', width: "180"},
{key: 'updateBy', visible: true, label: '更新人', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
{key: 'updateTime', visible: true, label: '更新时间', minWidth: null, sortable: true, overflow: false, align: 'center', width: "180"},
{key: 'verifyBy', visible: true, label: '审核人', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
{key: 'verifyTime', visible: true, label: '审核时间', minWidth: null, sortable: false, overflow: false, align: 'center', width: "180"},
{key: 'remark', visible: true, label: '备注', minWidth: null, sortable: false, overflow: false, align: 'center', width: "180"},
],
//
orderSorts: ['ascending', 'descending', null],
//
loading: false,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
reportList: [],
//
title: "",
//
open: false,
defaultSort,
//
queryParams: {
pageNum: 0,
pageSize: 10,
orderByColumn: defaultSort.prop,
isAsc: defaultSort.order,
reportId: null,
deptId: null,
status: null,
createId: null,
createBy: null,
verifyTime: null,
verifyId: null,
verifyBy: null,
updateId: null,
updateBy: null
},
//
form: {},
//
rules: {
deptId: [
{ required: true, message: "部门ID不能为空", trigger: "blur" }
],
status: [
{ required: true, message: "状态不能为空", trigger: "change" }
],
createTime: [
{ required: true, message: "创建时间不能为空", trigger: "blur" }
],
createBy: [
{ required: true, message: "创建人名称不能为空", trigger: "blur" }
],
},
noMore: false,
};
},
created() {
this.getList();
},
methods: {
//
loadList() {
if (this.noMore || this.loading) {
return;
}
this.loading = true;
this.queryParams.pageNum ++;
listReport(this.queryParams).then(response => {
this.reportList.push(...response.rows) ;
this.total = response.total;
if (this.total <= this.reportList.length) {
this.noMore = true;
}
}).finally(() => {
this.loading = false;
})
},
/** 当排序按钮被点击时触发 **/
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.queryParams.pageNum = 0;
this.reportList = [];
this.total = 0;
this.noMore = false;
this.loadList();
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.reportId)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.$router.push("/edit/report/add")
},
/** 修改按钮操作 */
handleUpdate(row) {
this.$router.push(`/edit/report/${row.reportId}/update`)
},
/** 删除按钮操作 */
handleDelete(row) {
const reportIds = row.reportId || this.ids;
this.$modal.confirm('是否确认删除报表编号为"' + reportIds + '"的数据项?').then(function() {
return delReport(reportIds);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('yh/report/export', {
...this.queryParams
}, `report_${new Date().getTime()}.xlsx`)
}
}
}
</script>

View File

@ -255,10 +255,10 @@
<!-- 添加或修改单价对话框 -->
<el-dialog :title="title" :visible.sync="open" width="900px" append-to-body :close-on-click-modal="false">
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form ref="form" :model="form" :rules="rules" label-width="80px" size="small">
<el-row :gutter="gutter">
<form-col :span="span" label="部门" prop="deptId">
<dept-tree-select v-model="form.deptId" />
<dept-tree-select v-model="form.deptId" class="small-tree-select"/>
</form-col>
<form-col :span="span" label="类别" prop="category">
<el-input v-model="form.category" placeholder="请输入类别" />

View File

@ -0,0 +1,369 @@
<template>
<div>
<el-row class="edit-table-operate">
<el-button size="small" plain icon="el-icon-plus" type="success" @click="showPriceDialog = true" >选择工序</el-button>
<el-button size="small" plain icon="el-icon-edit" @click="handleBatchUserProduct">批量编辑员工产量</el-button>
<el-row class="edit-table-operate-right">
</el-row>
</el-row>
<el-table
:data="value"
size="mini"
stripe
:header-cell-style="headerCellStyle"
@selection-change="onSelectionChange"
class="mini-table"
>
<el-table-column type="selection" align="center"/>
<!-- <el-table-column type="index" width="60" label="序号" align="center"/>-->
<el-table-column label="工序" align="center" prop="priceName">
<template #header>
<span class="required-label">工序</span>
</template>
<template scope="d">
<form-col table label-width="0" :prop="getProp(d.$index, 'priceId')" :rules="rules.priceId">
<hover-show :show-value="d.row.priceName">
<price-input v-model="d.row.priceId" @change="(val) => {onChangePrice(d.row, val)}" placeholder="点击选择工序" title="选择工序"/>
</hover-show>
</form-col>
</template>
</el-table-column>
<el-table-column label="工序类型" align="center" >
<template scope="d">
<form-col table label-width="0" :prop="getProp(d.$index, 'priceType')" :rules="rules.priceType">
<hover-show>
<template #show>
<dict-tag :options="dict.type.price_type" :value="d.row.priceType" size="small"/>
</template>
<el-select v-model="d.row.priceType">
<el-option v-for="(item, index) in dict.type.price_type" :key="index" :label="item.label" :value="item.value"/>
</el-select>
</hover-show>
</form-col>
</template>
</el-table-column>
<el-table-column align="center" prop="num">
<template #header>
<span class="required-label">良品数</span>
</template>
<template scope="d">
<form-col table label-width="0" :prop="getProp(d.$index, 'num')" :rules="rules.num">
<hover-show>
<template #show>
{{d.row.num | dv}} {{d.row.priceUnit}}
</template>
<el-input v-model="d.row.num" type="number" :min="0" placeholder="请输入良品数量">
<template #suffix>
{{d.row.priceUnit}}
</template>
</el-input>
</hover-show>
</form-col>
</template>
</el-table-column>
<el-table-column align="center" prop="defectNum">
<template #header>
<span class="required-label">不良品数</span>
</template>
<template scope="d">
<form-col table label-width="0" :prop="getProp(d.$index, 'defectNum')" :rules="rules.defectNum">
<hover-show>
<template #show>
{{d.row.defectNum | dv}} {{d.row.priceUnit}}
</template>
<el-input v-model="d.row.defectNum" type="number" :min="0" placeholder="请输入不良品数量">
<template #suffix>
{{d.row.priceUnit}}
</template>
</el-input>
</hover-show>
</form-col>
</template>
</el-table-column>
<el-table-column label="单价" align="center" prop="pricePrice" width="100">
<template scope="d">
<form-col table label-width="0">
{{d.row.pricePrice | dv}}
</form-col>
</template>
</el-table-column>
<el-table-column label="总价" align="center" width="100">
<template scope="d">
<form-col table label-width="0">
{{ totalPrice(d.row) | dv }}
</form-col>
</template>
</el-table-column>
<el-table-column label="更多" align="center" width="160">
<template scope="d">
<div class="more-row" v-for="(userProd, index) of d.row.userProdList" @click="handleShowMore(d.row)">
{{index + 1}}{{userProd.userName | dv}} {{userProd.num | dv}} {{d.row.priceUnit}}
</div>
<div class="more-row" v-for="(order, index) of d.row.orderList" @click="handleShowMore(d.row)">
{{index + 1}}{{order.billNo}} {{order.num}}}
</div>
</template>
</el-table-column>
<el-table-column width="160" align="center" label="操作">
<template slot-scope="d">
<el-button type="text" size="mini" @click="handleShowMore(d.row)" icon="el-icon-edit">编辑</el-button>
<el-button
type="text"
icon="el-icon-delete"
size="mini"
plain
@click="handleDel(d.$index)">
删除
</el-button>
</template>
</el-table-column>
</el-table>
<!--编辑明细-->
<report-product-row-edit :row="row" :visible.sync="showMore"/>
<!--工序选择-->
<price-dialog
multiple
:show.sync="showPriceDialog"
@select="onSelectPrices"
/>
<!--批量修改用户产量-->
<user-product-batch-dialog
:show.sync="showUserProductBatchDialog"
@submit="onSubmitUserProductBatch"
/>
</div>
</template>
<script>
import UserInput from "@/components/Business/User/UserInput.vue";
import PriceDialog from "@/components/Business/Price/PriceDialog.vue";
import PriceInput from "@/components/Business/Price/PriceInput.vue";
import {isEmpty, notNullDecimal} from "@/utils";
import FormCol from "@/components/FormCol/index.vue";
import UserProductBatchDialog from "@/views/yh/report/edit/components/UserProductBatchDialog.vue";
import {IncomeMode} from "@/utils/constants";
import Decimal from "decimal.js";
import ReportProductOrderListEdit from "@/views/yh/report/edit/components/ReportProductOrderListEdit.vue";
import ReportProductUserListEdit from "@/views/yh/report/edit/components/ReportProductUserListEdit.vue";
import Dict from "@/views/system/dict/index.vue";
import HoverShow from "@/components/HoverShow/index.vue";
import ReportProductRowEdit from "@/views/yh/report/edit/components/ReportProductRowEdit.vue";
export default {
name: "ReportProductEdit",
dicts: ['price_type'],
components: {
ReportProductRowEdit,
HoverShow,
Dict,
ReportProductUserListEdit,
ReportProductOrderListEdit,
UserProductBatchDialog, FormCol, PriceInput, PriceDialog, UserInput},
props: {
value: {
type: Array,
default: () => {
return []
}
},
listProp: {
type: String,
default: 'productList',
},
rules: {
type: Object,
default: () => {
return {
userProdList: {}
}
}
},
headerCellStyle: {
type: Object,
default: () => {
return {}
}
},
},
computed: {
//
getProp() {
return (index, prop) => {
return `${this.listProp}[${index}].${prop}`
}
},
//
totalPrice() {
return (row ) => {
if (row == null) {
return 0;
}
return notNullDecimal(row.pricePrice).mul(notNullDecimal(row.num));
}
}
},
data() {
return {
row: {}, //
selection: [], //
showPriceDialog: false,
showUserProductBatchDialog: false,
showMore: false,
}
},
created() {
},
methods: {
handleShowMore(row) {
this.row = row;
this.showMore = true;
},
//
addRow(data) {
let row = {
id: null,
reportId: null,
priceId: null,
pricePrice: null,
priceType: '1',
num: null,
orderList: [],
userProdList: [],
...data
}
this.value.push(row)
return row;
},
//
onSelectPrices(list) {
list.forEach(item => {
let row = this.convertPriceToRow(item);
this.addRow(row)
})
this.showPriceDialog = false;
},
//
convertPriceToRow(price) {
return {
priceId: price.priceId,
priceCategory: price.category,
priceSize: price.size,
priceName: price.name,
priceSubName: price.subName,
pricePattern: price.pattern,
priceSpec: price.spec,
pricePrice: price.price,
priceUnit: price.unit,
priceClassify: price.classify,
priceQuantity: price.quantity
}
},
//
onChangePrice(row, price) {
row.priceId = price.priceId;
row.priceCategory = price.category;
row.priceSize = price.size;
row.priceName = price.name;
row.priceSubName = price.subName;
row.pricePattern = price.pattern;
row.priceSpec = price.spec;
row.pricePrice = price.price;
row.priceUnit = price.unit;
row.priceClassify = price.classify;
row.priceQuantity = price.quantity;
},
//
onSelectionChange(selection) {
this.selection = selection;
},
//
handleDel(index) {
if (this.value != null) {
this.value.splice(index, 1);
}
},
//
handleBatchUserProduct(){
if (isEmpty(this.selection)) {
this.$message.warning("请先至少选中一行");
return;
}
this.showUserProductBatchDialog = true;
},
//
onSubmitUserProductBatch(data) {
if (data == null || isEmpty(data.list)) {
return;
}
//
if (IncomeMode.SCORE === data.mode) {
//
let totalScore = new Decimal(0);
data.list.forEach(item => {
totalScore = totalScore.plus(notNullDecimal(item.score));
})
//
this.selection.forEach(row => {
let rowNum = notNullDecimal(row.num); //
row.userProdList = data.list.map(item => {
return {
userId: item.userId,
userName: item.userName,
num: rowNum.mul(notNullDecimal(item.score)).div(totalScore).toNumber().toFixed(2)
}
})
//
let totalNum = notNullDecimal(0);
if (row.userProdList != null && !isEmpty(row.userProdList)) {
row.userProdList.forEach(item => {
totalNum = notNullDecimal(item.num).add(totalNum);
})
if (totalNum.toNumber() !== rowNum.toNumber()) {
if (isEmpty(row.userProdList[0].num)) {
row.userProdList[0].num = totalNum.toNumber();
} else {
row.userProdList[0].num = notNullDecimal(row.userProdList[0].num).add(totalNum.sub(rowNum)).toNumber();
}
}
}
})
}
//
else if (IncomeMode.COUNT === data.mode) {
this.selection.forEach(row => {
//
row.userProdList = data.list.map(item => {
return {
userId: item.userId,
userName: item.userName,
num: item.num
}
})
//
let totalCount = notNullDecimal(0);
row.userProdList.forEach(item => {
totalCount = notNullDecimal(item.num).add(totalCount);
})
row.num = totalCount.toNumber();
})
this.$message.success("批量编辑成功");
}
this.showUserProductBatchDialog = false;
}
}
}
</script>
<style lang="scss" scoped>
.mini-table {
font-size: 12px !important;
}
</style>

View File

@ -1,165 +1,66 @@
<template>
<div>
<el-row class="edit-table-operate">
<el-button type="primary" icon="el-icon-plus" size="mini" @click="addRow" plain>添加一行</el-button>
<el-button type="success" icon="el-icon-plus" size="mini" @click="showPriceDialog = true" plain>批量选择工序</el-button>
<!-- <el-button type="primary" icon="el-icon-plus" size="mini" @click="addRow" plain>添加一行</el-button>-->
<el-button size="small" plain icon="el-icon-plus" type="success" @click="showPriceDialog = true" >选择工序</el-button>
<el-button size="small" plain icon="el-icon-edit" @click="handleBatchUserProduct">批量编辑员工产量</el-button>
<el-row class="edit-table-operate-right">
</el-row>
</el-row>
<el-table
border
:data="data"
:data="value"
size="mini"
stripe
:header-cell-style="headerCellStyle"
@selection-change="onSelectionChange"
>
<el-table-column type="selection" align="center"/>
<el-table-column type="index" width="60" label="序号" align="center"/>
<el-table-column label="工序" align="center">
<template #header>
<span class="required-label">工序</span>
</template>
<el-table-column type="selection" align="center" fixed="left"/>
<el-table-column type="index" width="60" label="序号" align="center" fixed="left"/>
<el-table-column label="内容" align="left">
<template scope="d">
<form-col table label-width="0" :prop="getProp(d.$index, 'priceId')" :rules="rules.priceId">
<form-col :span="12" table label="工序" :prop="getProp(d.$index, 'priceId')" :rules="rules.priceId">
<price-input v-model="d.row.priceId" @change="(val) => {onChangePrice(d.row, val)}" placeholder="点击选择工序" title="选择工序"/>
</form-col>
</template>
</el-table-column>
<el-table-column label="总产量" align="center" prop="num">
<template #header>
<span class="required-label">总产量</span>
</template>
<template scope="d">
<form-col table label-width="0" :prop="getProp(d.$index, 'num')" :rules="rules.num">
<form-col :span="12" table label="总产量" :prop="getProp(d.$index, 'num')" :rules="rules.num">
<el-input v-model="d.row.num" type="number" :min="0" placeholder="请输入产量">
<template #suffix>
{{d.row.priceUnit}}
</template>
</el-input>
</form-col>
</template>
</el-table-column>
<el-table-column label="单价" align="center" prop="pricePrice" width="100">
<template scope="d">
<form-col table label-width="0">
<form-col :span="12" table label="工序类型" :prop="getProp(d.$index, 'priceType')" :rules="rules.priceType">
<el-select v-model="d.row.priceType" style="width: 100%">
<el-option v-for="(item, index) in dict.type.price_type" :key="index" :label="item.label" :value="item.value"/>
</el-select>
</form-col>
<form-col :span="6" table label="单价">
{{d.row.pricePrice | dv}}
</form-col>
</template>
</el-table-column>
<el-table-column label="总价" align="center" width="100">
<template scope="d">
<form-col table label-width="0">
<form-col :span="6" table label="总价">
{{ totalPrice(d.row) | dv }}
</form-col>
</template>
</el-table-column>
<!-- <el-table-column label="工序类型" align="center" >-->
<!-- <template scope="d">-->
<!-- <form-col table label-width="0" :prop="getProp(d.$index, 'priceType')" :rules="rules.priceType">-->
<!-- <el-select v-model="d.row.priceType">-->
<!-- <el-option v-for="(item, index) in dict.type.price_type" :key="index" :label="item.label" :value="item.value"/>-->
<!-- </el-select>-->
<!-- </form-col>-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column label="员工产量" align="center" prop="userProduct" width="500">
<template #header>
<span class="required-label">员工产量</span>
<el-tooltip placement="top" content="批量编辑">
<el-button type="text" icon="el-icon-edit" @click="handleBatchUserProduct"/>
</el-tooltip>
</template>
<el-table-column label="员工产量" align="center" prop="userProduct" width="100">
<template scope="d">
<el-row >
<template v-for="(item, itemIndex) of d.row.userProductList">
<form-col
table
:span="8"
label-width="0"
:prop="getSubProp(d.$index, 'userProductList', itemIndex, 'userId')"
:rules="rules.userProductList.userId"
>
<user-input v-model="item.userId"/>
</form-col >
<form-col
table
:span="8"
label-width="0"
:prop="getSubProp(d.$index, 'userProductList', itemIndex, 'num')"
:rules="rules.userProductList.num"
>
<el-input v-model="item.num" type="number" placeholder="请输入员工产量" :min="0">
<template #suffix>{{d.row.priceUnit}}</template>
</el-input>
</form-col >
<form-col table :span="5" label-width="0">
¥ {{calcIncome(item.num, d.row.pricePrice) | dv }}
</form-col>
<form-col table :span="1" label-width="0">
<el-button circle icon="el-icon-delete" type="danger" plain size="mini" @click="handleDelUserProduct(d.row, itemIndex)"/>
</form-col>
</template>
<el-col :span="24">
<el-button size="mini" icon="el-icon-plus" type="text" @click="handleAddUserProduct(d.row)">添加</el-button>
</el-col>
</el-row>
<div @click="handleAddUserProduct(d.row)">
当前 {{d.row.userProdList.length}}
<el-button size="mini" icon="el-icon-arrow-right" type="text"/>
</div>
</template>
</el-table-column>
<el-table-column label="关联生产订单" align="center" type="expand" width="100">
<template scope="d">
<el-table :data="d.row.orderList" style="margin-left: 16px; width: calc(100% - 16px)" border>
<el-table-column label="序号" align="center" type="index" width="100"/>
<el-table-column label="订单" align="center">
<template slot-scope="dd">
<form-col table label-width="0">
<el-input v-model="dd.row.orderId"/>
</form-col>
</template>
</el-table-column>
<el-table-column label="生产数量" align="center">
<template slot-scope="dd">
<form-col table label-width="0">
<el-input v-model="dd.row.num"/>
</form-col>
</template>
</el-table-column>
<el-table-column label="计划数量" align="center">
<template slot-scope="dd">
1000
</template>
</el-table-column>
<el-table-column label="已生产数量" align="center">
<template slot-scope="dd">
300
</template>
</el-table-column>
<el-table-column label="生产进度" align="center">
<template slot-scope="dd">
<el-progress :text-inside="true" :stroke-width="20" :percentage="50" status="exception"/>
</template>
</el-table-column>
<el-table-column align="center" width="200">
<template #header>
<el-button
type="success"
icon="el-icon-plus"
size="mini"
plain>
添加关联
</el-button>
</template>
</el-table-column>
</el-table>
<report-product-order-list-edit v-model="d.row.orderList"/>
</template>
</el-table-column>
<el-table-column width="200" align="center" label="操作">
<el-table-column width="100" align="center" label="操作">
<template slot-scope="d">
<el-button
type="danger"
type="text"
icon="el-icon-delete"
size="mini"
plain
@ -198,19 +99,22 @@
import UserInput from "@/components/Business/User/UserInput.vue";
import PriceDialog from "@/components/Business/Price/PriceDialog.vue";
import PriceInput from "@/components/Business/Price/PriceInput.vue";
import {isEmpty, notNullDecimal, notNullNum} from "@/utils";
import {isEmpty, notNullDecimal} from "@/utils";
import FormCol from "@/components/FormCol/index.vue";
import UserDialog from "@/components/Business/User/UserDialog.vue";
import UserProductBatchDialog from "@/views/yh/report/components/UserProductBatchDialog.vue";
import UserProductBatchDialog from "@/views/yh/report/edit/components/UserProductBatchDialog.vue";
import {IncomeMode} from "@/utils/constants";
import Decimal from "decimal.js";
import ReportProductOrderListEdit from "@/views/yh/report/edit/components/ReportProductOrderListEdit.vue";
export default {
name: "ReportProductEdit",
dicts: ['price_type'],
components: {UserProductBatchDialog, UserDialog, FormCol, PriceInput, PriceDialog, UserInput},
components: {
ReportProductOrderListEdit,
UserProductBatchDialog, UserDialog, FormCol, PriceInput, PriceDialog, UserInput},
props: {
data: {
value: {
type: Array,
default: () => {
return []
@ -224,7 +128,7 @@ export default {
type: Object,
default: () => {
return {
userProductList: {}
userProdList: {}
}
}
},
@ -287,18 +191,18 @@ export default {
priceType: '1',
num: null,
orderList: [],
userProductList: [],
userProdList: [],
...data
}
this.data.push(row)
this.value.push(row)
return row;
},
//
addUserProduct(row, data) {
if (row.userProductList == null) {
row.userProductList = [];
if (row.userProdList == null) {
row.userProdList = [];
}
row.userProductList.push({
row.userProdList.push({
userId: null,
num: null,
...data
@ -311,7 +215,7 @@ export default {
},
//
handleDelUserProduct(row, index) {
row.userProductList.splice(index, 1);
row.userProdList.splice(index, 1);
},
//
onSelectPrices(list) {
@ -349,10 +253,17 @@ export default {
},
//
onChangePrice(row, price) {
row = {
...row,
...this.convertPriceToRow(price)
}
row.priceId = price.priceId;
row.priceCategory = price.category;
row.priceSize = price.size;
row.priceName = price.name;
row.priceSubName = price.subName;
row.pricePattern = price.pattern;
row.priceSpec = price.spec;
row.pricePrice = price.price;
row.priceUnit = price.unit;
row.priceClassify = price.classify;
row.priceQuantity = price.quantity;
},
//
onSelectionChange(selection) {
@ -360,8 +271,8 @@ export default {
},
//
handleDel(index) {
if (this.data != null) {
this.data.splice(index, 1);
if (this.value != null) {
this.value.splice(index, 1);
}
},
//
@ -387,7 +298,7 @@ export default {
//
this.selection.forEach(row => {
let rowNum = notNullDecimal(row.num); //
row.userProductList = data.list.map(item => {
row.userProdList = data.list.map(item => {
return {
userId: item.userId,
num: rowNum.mul(notNullDecimal(item.score)).div(totalScore).toNumber().toFixed(2)
@ -395,15 +306,15 @@ export default {
})
//
let totalNum = notNullDecimal(0);
if (row.userProductList != null && !isEmpty(row.userProductList)) {
row.userProductList.forEach(item => {
if (row.userProdList != null && !isEmpty(row.userProdList)) {
row.userProdList.forEach(item => {
totalNum = notNullDecimal(item.num).add(totalNum);
})
if (totalNum.toNumber() !== rowNum.toNumber()) {
if (isEmpty(row.userProductList[0].num)) {
row.userProductList[0].num = totalNum.toNumber();
if (isEmpty(row.userProdList[0].num)) {
row.userProdList[0].num = totalNum.toNumber();
} else {
row.userProductList[0].num = notNullDecimal(row.userProductList[0].num).add(totalNum.sub(rowNum)).toNumber();
row.userProdList[0].num = notNullDecimal(row.userProdList[0].num).add(totalNum.sub(rowNum)).toNumber();
}
}
}
@ -413,7 +324,7 @@ export default {
else if (IncomeMode.COUNT === data.mode) {
this.selection.forEach(row => {
//
row.userProductList = data.list.map(item => {
row.userProdList = data.list.map(item => {
return {
userId: item.userId,
num: item.num
@ -421,7 +332,7 @@ export default {
})
//
let totalCount = notNullDecimal(0);
row.userProductList.forEach(item => {
row.userProdList.forEach(item => {
totalCount = notNullDecimal(item.num).add(totalCount);
})
row.num = totalCount.toNumber();

View File

@ -0,0 +1,61 @@
<template>
<el-table :data="value" style="margin-left: 16px; width: calc(100% - 16px)" border>
<el-table-column label="序号" align="center" type="index" width="100"/>
<el-table-column label="订单" align="center">
<template slot-scope="dd">
<form-col table label-width="0">
<el-input v-model="dd.row.orderId"/>
</form-col>
</template>
</el-table-column>
<el-table-column label="生产数量" align="center">
<template slot-scope="dd">
<form-col table label-width="0">
<el-input v-model="dd.row.num"/>
</form-col>
</template>
</el-table-column>
<el-table-column label="计划数量" align="center">
<template slot-scope="dd">
1000
</template>
</el-table-column>
<el-table-column label="已生产数量" align="center">
<template slot-scope="dd">
300
</template>
</el-table-column>
<el-table-column label="生产进度" align="center">
<template slot-scope="dd">
<el-progress :text-inside="true" :stroke-width="20" :percentage="50" status="exception"/>
</template>
</el-table-column>
<el-table-column align="center" width="200">
<template #header>
<el-button
type="success"
icon="el-icon-plus"
size="mini"
plain>
添加关联
</el-button>
</template>
</el-table-column>
</el-table>
</template>
<script>
import FormCol from "@/components/FormCol/index.vue";
export default {
name: "ReportProductOrderListEdit",
components: {FormCol},
props: {
value: {
type: Array,
default: () => {
return []
}
}
}
}
</script>

View File

@ -0,0 +1,95 @@
<template>
<el-dialog :visible.sync="showMore" title="查看详情" width="800px" :close-on-click-modal="false">
<el-row>
<form-col :span="span" label="工序" :rules="rules.priceId">
<price-input v-model="row.priceId" @change="(val) => {onChangePrice(d.row, val)}" placeholder="点击选择工序" title="选择工序"/>
</form-col>
<form-col :span="span" label="工序类型" :rules="rules.priceType">
<el-select v-model="row.priceType" style="width: 100%">
<el-option v-for="(item, index) in dict.type.price_type" :key="index" :label="item.label" :value="item.value"/>
</el-select>
</form-col>
<form-col :span="span" label="良品数" :rules="rules.num">
<el-input v-model="row.num" type="number" :min="0" placeholder="请输入良品数">
<template #suffix>
{{row.priceUnit}}
</template>
</el-input>
</form-col>
<form-col :span="span" label="不良品数" :rules="rules.defectNum">
<el-input v-model="row.defectNum" type="number" :min="0" placeholder="请输入不良品数">
<template #suffix>
{{row.priceUnit}}
</template>
</el-input>
</form-col>
<form-col :span="span" label="单价">
{{row.pricePrice | dv}}
</form-col>
<form-col :span="span" label="总价">
{{ calcMulDecimal(row.pricePrice, row.num) | dv }}
</form-col>
</el-row>
<div class="edit-title">员工产量</div>
<report-product-user-list-edit v-model="row.userProdList" :price="row.pricePrice"/>
<div class="edit-title">关联订单</div>
<report-product-order-list-edit v-model="row.orderList"/>
<template #footer>
<el-button type="primary" @click="showMore = false"> </el-button>
</template>
</el-dialog>
</template>
<script>
import ReportProductOrderListEdit from "@/views/yh/report/edit/components/ReportProductOrderListEdit.vue";
import ReportProductUserListEdit from "@/views/yh/report/edit/components/ReportProductUserListEdit.vue";
import FormCol from "@/components/FormCol/index.vue";
import PriceInput from "@/components/Business/Price/PriceInput.vue";
import {calcMulDecimal} from "@/utils/money";
export default {
name: "ReportProductRowEdit",
dicts: ['price_type'],
components: {PriceInput, FormCol, ReportProductUserListEdit, ReportProductOrderListEdit},
props: {
row: {
type: Object,
default: () => {
return {
userProdList: [],
orderList: []
}
}
},
rules: {
type: Object,
default: () => {
return {
}
}
},
visible: {
type: Boolean,
default: false,
}
},
data() {
return {
span: 12,
}
},
computed: {
showMore: {
set(val) {
this.$emit('update:visible', val);
},
get() {
return this.visible;
}
}
},
methods: {calcMulDecimal},
}
</script>

View File

@ -0,0 +1,130 @@
<template>
<div>
<el-table :data="value" style="margin-left: 16px; width: calc(100% - 16px)" size="mini">
<el-table-column label="序号" align="center" type="index" width="80"/>
<el-table-column label="员工" align="center">
<template slot-scope="d">
<form-col table label-width="0">
<user-input v-model="d.row.userId"/>
</form-col>
</template>
</el-table-column>
<el-table-column label="员工产量" align="center">
<template slot-scope="d">
<form-col table label-width="0">
<el-input v-model="d.row.num" type="number" placeholder="请输入员工产量"/>
</form-col>
</template>
</el-table-column>
<el-table-column label="工资" align="center" width="100">
<template slot-scope="d">
{{ userIncome(d.row.num)}}
</template>
</el-table-column>
<el-table-column align="center" width="100">
<template #header>
<el-button
type="success"
icon="el-icon-plus"
size="mini"
@click="handleAddUserProduct"
plain
>添加
</el-button>
</template>
<template slot-scope="d">
<el-button
type="text"
icon="el-icon-delete"
size="mini"
@click="handleDelUserProduct(d.$index)"
>删除
</el-button>
</template>
</el-table-column>
</el-table>
<!--用户选择-->
<user-dialog
multiple
:show.sync="showUserDialog"
@select="onSelectUsers"
/>
</div>
</template>
<script>
import FormCol from "@/components/FormCol/index.vue";
import PriceDialog from "@/components/Business/Price/PriceDialog.vue";
import UserDialog from "@/components/Business/User/UserDialog.vue";
import UserInput from "@/components/Business/User/UserInput.vue";
import {calcMulDecimal} from "@/utils/money";
export default {
name: "ReportProductUserListEdit",
components: {UserInput, UserDialog, PriceDialog, FormCol},
props: {
value: {
type: Array,
default: () => {
return []
}
},
//
price: {
type: Number,
default: 0,
}
},
data() {
return {
showUserDialog: false,
}
},
computed: {
userIncome() {
return (num) => {
return calcMulDecimal(num, this.price);
}
}
},
methods: {
//
handleAddUserProduct() {
this.showUserDialog = true;
},
//
handleDelUserProduct(index) {
this.value.splice(index, 1);
},
//
onSelectUsers(list) {
list.forEach(item => {
this.addUserProduct({
userId: item.userId,
userName: item.nickName,
num: null,
})
})
this.showUserDialog = false;
},
//
addUserProduct(data) {
let rowData = {
userId: null,
num: null,
...data
}
if (this.value == null) {
this.$emit('input', [rowData])
} else {
this.value.push(rowData)
}
},
}
}
</script>
<style scoped lang="scss">
</style>

View File

@ -1,5 +1,5 @@
<template>
<el-dialog :visible.sync="visible" title="批量编辑员工产量" close-on-click-modal>
<el-dialog :visible.sync="visible" title="批量编辑员工产量" close-on-click-modal width="800px">
<el-form :model="form" label-width="6em" size="mini">
<el-row>
<form-col :span="24" label="工资模式">
@ -122,6 +122,7 @@ export default {
list.forEach(item => {
this.form.list.push({
userId: item.userId,
userName: item.nickName,
num: 0,
score: 10,
})

View File

@ -1,15 +1,16 @@
<template>
<div>
<edit-header :title="title">
<el-button type="primary" @click="submitForm" icon="el-icon-check">保存并提交</el-button>
<el-button type="primary" @click="submitForm" icon="el-icon-check" size="small">保存并提交</el-button>
</edit-header>
<div class="app-container" v-loading="loading">
<el-form ref="form" :model="form" :rules="rules" label-width="80px" size="mini">
<div class="app-container">
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="6em">
<div class="edit-title">基础信息</div>
<el-row>
<el-row :gutter="gutter">
<form-col :span="span" label="部门" prop="deptId">
<dept-tree-select v-model="form.deptId" class="mini-tree-select"/>
<dept-tree-select v-model="form.deptId" class="small-tree-select" width="100%" disabled/>
</form-col>
<form-col :span="span" label="报表日期" prop="reportDate">
<el-date-picker v-model="form.reportDate" type="date" value-format="yyyy-MM-dd" placeholder="选择日期" style="width: 100%;" :clearable="false"/>
@ -17,21 +18,26 @@
<form-col :span="span" label="总金额">
{{totalPrice.toNumber() | dv}}
</form-col>
</el-row>
<el-row>
<form-col :span="24" label="备注">
<el-input v-model="form.remark" placeholder="请输入备注" type="textarea" maxlength="200" show-word-limit :autosize="{minRows: 2, maxRows: 10}"/>
</form-col>
</el-row>
<div class="edit-title">工序产量</div>
<report-product-edit
:data="form.productList"
v-model="form.productList"
:rules="productRules"
:header-cell-style="headerCellStyle"
/>
<!-- <report-product-edit-card-->
<!-- v-model="form.productList"-->
<!-- :rules="productRules"-->
<!-- :header-cell-style="headerCellStyle"-->
<!-- />-->
</el-form>
</div>
</div>
</template>
<script>
@ -43,19 +49,20 @@ import EditHeader from "@/components/EditHeader/index.vue";
import {isEmpty, notNullDecimal} from "@/utils";
import {mapGetters} from "vuex";
import Decimal from "decimal.js";
import ReportProductEdit from "@/views/yh/report/components/ReportProductEdit.vue";
import ReportProductEdit from "@/views/yh/report/edit/components/ReportProductEdit.vue";
import {parseTime} from "@/utils/ruoyi";
import ReportProductEditCard from "@/views/yh/report/edit/components/ReportProductEditCard.vue";
export default {
name: "ReportEdit",
dicts: ['income_mode'],
components: {ReportProductEdit, EditHeader, DeptTreeSelect, PriceInput, FormCol},
components: {ReportProductEditCard, ReportProductEdit, EditHeader, DeptTreeSelect, PriceInput, FormCol},
data() {
return {
title: null,
loading: false,
gutter: 16,
span: 6,
gutter: 8,
span: 8,
//
form: {},
//
@ -80,7 +87,7 @@ export default {
priceType: [
{ required: true, message: "工序类型不能为空", trigger: "change" }
],
userProductList: {
userProdList: {
userId: [
{ required: true, message: "用户不能为空", trigger: "change" }
],
@ -101,7 +108,7 @@ export default {
let total = new Decimal(0);
if (this.form != null && !isEmpty(this.form.productList)) {
this.form.productList.forEach(item => {
total = total.plus(notNullDecimal(item.price).mul(notNullDecimal(item.num)))
total = total.plus(notNullDecimal(item.pricePrice).mul(notNullDecimal(item.num)))
})
}
return total;
@ -128,6 +135,7 @@ export default {
},
/** 提交按钮 */
submitForm() {
this.form.totalAmount = this.totalPrice;
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.reportId != null) {

View File

@ -0,0 +1,338 @@
<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>
<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">
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="primary"-->
<!-- plain-->
<!-- icon="el-icon-plus"-->
<!-- size="mini"-->
<!-- @click="handleAdd"-->
<!-- v-has-permi="['yh:reportUserProd:add']"-->
<!-- >新增</el-button>-->
<!-- </el-col>-->
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="danger"-->
<!-- plain-->
<!-- icon="el-icon-delete"-->
<!-- size="mini"-->
<!-- :disabled="multiple"-->
<!-- @click="handleDelete"-->
<!-- v-has-permi="['yh:reportUserProd:remove']"-->
<!-- >删除</el-button>-->
<!-- </el-col>-->
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-has-permi="['yh:reportUserProd:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="reportUserProdList" @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 === 'pricePrice'">
{{d.row[column.key] | dv}} / {{ d.row.priceUnit | dv}}
</template>
<template v-else-if="column.key === 'num'">
{{d.row[column.key] | dv}} {{ d.row.priceUnit | dv}}
</template>
<template v-else-if="column.key === 'totalPrice'">
{{ totalPrice(d.row) | dv}}
</template>
<template v-else-if="column.key === 'reportStatus'">
<dict-tag :value="d.row.reportStatus" :options="dict.type.report_status"/>
</template>
<template v-else>
{{d.row[column.key]}}
</template>
</template>
</el-table-column>
</template>
<!-- <el-table-column label="操作" align="center" class-name="small-padding fixed-width">-->
<!-- <template slot-scope="scope">-->
<!-- <el-button-->
<!-- size="mini"-->
<!-- type="text"-->
<!-- icon="el-icon-edit"-->
<!-- @click="handleUpdate(scope.row)"-->
<!-- v-has-permi="['yh:reportUserProd:edit']"-->
<!-- >修改</el-button>-->
<!-- <el-button-->
<!-- size="mini"-->
<!-- type="text"-->
<!-- icon="el-icon-delete"-->
<!-- @click="handleDelete(scope.row)"-->
<!-- v-has-permi="['yh:reportUserProd:remove']"-->
<!-- >删除</el-button>-->
<!-- </template>-->
<!-- </el-table-column>-->
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改员工产量对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body :close-on-click-modal="false">
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-row>
<form-col :span="span" label="总产量ID" prop="prodId">
<el-input v-model="form.prodId" placeholder="请输入总产量ID" />
</form-col>
<form-col :span="span" label="员工ID" prop="userId">
<el-input v-model="form.userId" placeholder="请输入员工ID" />
</form-col>
<form-col :span="span" label="产量" prop="num">
<el-input v-model="form.num" placeholder="请输入产量" />
</form-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listReportUserProd, getReportUserProd, delReportUserProd, addReportUserProd, updateReportUserProd } from "@/api/yh/reportUserProd";
import { $showColumns } from '@/utils/mixins';
import FormCol from "@/components/FormCol/index.vue";
import {notNullDecimal} from "@/utils";
//
const defaultSort = {
prop: "id",
order: "descending"
}
export default {
name: "ReportUserProd",
mixins: [$showColumns],
dicts: ['report_status'],
components: {FormCol},
data() {
return {
span: 24,
//
columns: [
{key: 'id', visible: false, label: '明细ID', minWidth: null, sortable: true, overflow: false, align: 'center', width: "100"},
{key: 'reportDate', visible: true, label: '报表日期', minWidth: null, sortable: true, overflow: false, align: 'center', width: "180"},
{key: 'reportStatus', 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: 'priceName', visible: true, label: '工序名称', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
{key: 'pricePrice', visible: true, label: '单价', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
{key: 'num', visible: true, label: '产量', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
{key: 'totalPrice', visible: true, label: '总价', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
],
//
orderSorts: ['ascending', 'descending', null],
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
reportUserProdList: [],
//
title: "",
//
open: false,
defaultSort,
//
queryParams: {
pageNum: 1,
pageSize: 20,
orderByColumn: defaultSort.prop,
isAsc: defaultSort.order,
id: null,
prodId: null,
userId: null,
},
//
form: {},
//
rules: {
prodId: [
{ required: true, message: "总产量ID不能为空", trigger: "blur" }
],
userId: [
{ required: true, message: "员工ID不能为空", trigger: "blur" }
],
num: [
{ required: true, message: "产量不能为空", trigger: "blur" }
]
}
};
},
computed: {
//
totalPrice() {
return (row ) => {
if (row == null) {
return 0;
}
return notNullDecimal(row.pricePrice).mul(notNullDecimal(row.num));
}
}
},
created() {
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;
listReportUserProd(this.queryParams).then(response => {
this.reportUserProdList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
prodId: null,
userId: null,
num: 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
getReportUserProd(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) {
updateReportUserProd(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addReportUserProd(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 delReportUserProd(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('yh/reportUserProd/export', {
...this.queryParams
}, `reportUserProd_${new Date().getTime()}.xlsx`)
}
}
};
</script>