feat(cost&wms): 新增成本模块与考勤优化功能
1. 新增成本相关业务模块:成本项目配置、成本单价历史、生产月报、生产指标明细、生产成本明细的CRUD接口与页面 2. 为生产月报实体增加列配置字段及数据库映射 3. 优化考勤查询接口,将get请求改为post并使用body传参 4. 考勤页面增加部门筛选、员工多选筛选和打卡记录展示功能
This commit is contained in:
44
klp-ui/src/api/cost/item.js
Normal file
44
klp-ui/src/api/cost/item.js
Normal file
@@ -0,0 +1,44 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询成本项目配置列表
|
||||
export function listItem(query) {
|
||||
return request({
|
||||
url: '/cost/item/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询成本项目配置详细
|
||||
export function getItem(itemId) {
|
||||
return request({
|
||||
url: '/cost/item/' + itemId,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增成本项目配置
|
||||
export function addItem(data) {
|
||||
return request({
|
||||
url: '/cost/item',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改成本项目配置
|
||||
export function updateItem(data) {
|
||||
return request({
|
||||
url: '/cost/item',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除成本项目配置
|
||||
export function delItem(itemId) {
|
||||
return request({
|
||||
url: '/cost/item/' + itemId,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
44
klp-ui/src/api/cost/price.js
Normal file
44
klp-ui/src/api/cost/price.js
Normal file
@@ -0,0 +1,44 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询成本单价历史列表
|
||||
export function listPrice(query) {
|
||||
return request({
|
||||
url: '/cost/price/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询成本单价历史详细
|
||||
export function getPrice(priceId) {
|
||||
return request({
|
||||
url: '/cost/price/' + priceId,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增成本单价历史
|
||||
export function addPrice(data) {
|
||||
return request({
|
||||
url: '/cost/price',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改成本单价历史
|
||||
export function updatePrice(data) {
|
||||
return request({
|
||||
url: '/cost/price',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除成本单价历史
|
||||
export function delPrice(priceId) {
|
||||
return request({
|
||||
url: '/cost/price/' + priceId,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
53
klp-ui/src/api/cost/prodDetail.js
Normal file
53
klp-ui/src/api/cost/prodDetail.js
Normal file
@@ -0,0 +1,53 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询生产成本明细列表
|
||||
export function listProdDetail(query) {
|
||||
return request({
|
||||
url: '/cost/prodDetail/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询生产成本明细详细
|
||||
export function getProdDetail(detailId) {
|
||||
return request({
|
||||
url: '/cost/prodDetail/' + detailId,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增生产成本明细
|
||||
export function addProdDetail(data) {
|
||||
return request({
|
||||
url: '/cost/prodDetail',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改生产成本明细
|
||||
export function updateProdDetail(data) {
|
||||
return request({
|
||||
url: '/cost/prodDetail',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除生产成本明细
|
||||
export function delProdDetail(detailId) {
|
||||
return request({
|
||||
url: '/cost/prodDetail/' + detailId,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
// 批量保存生产成本明细(先删除再插入)
|
||||
export function batchSaveProdDetail(data) {
|
||||
return request({
|
||||
url: '/cost/prodDetail/batch',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
44
klp-ui/src/api/cost/prodMetric.js
Normal file
44
klp-ui/src/api/cost/prodMetric.js
Normal file
@@ -0,0 +1,44 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询生产指标明细列表
|
||||
export function listProdMetric(query) {
|
||||
return request({
|
||||
url: '/cost/prodMetric/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询生产指标明细详细
|
||||
export function getProdMetric(metricId) {
|
||||
return request({
|
||||
url: '/cost/prodMetric/' + metricId,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增生产指标明细
|
||||
export function addProdMetric(data) {
|
||||
return request({
|
||||
url: '/cost/prodMetric',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改生产指标明细
|
||||
export function updateProdMetric(data) {
|
||||
return request({
|
||||
url: '/cost/prodMetric',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除生产指标明细
|
||||
export function delProdMetric(metricId) {
|
||||
return request({
|
||||
url: '/cost/prodMetric/' + metricId,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
44
klp-ui/src/api/cost/prodReport.js
Normal file
44
klp-ui/src/api/cost/prodReport.js
Normal file
@@ -0,0 +1,44 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询生产月报列表
|
||||
export function listProdReport(query) {
|
||||
return request({
|
||||
url: '/cost/prodReport/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询生产月报详细
|
||||
export function getProdReport(reportId) {
|
||||
return request({
|
||||
url: '/cost/prodReport/' + reportId,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增生产月报
|
||||
export function addProdReport(data) {
|
||||
return request({
|
||||
url: '/cost/prodReport',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改生产月报
|
||||
export function updateProdReport(data) {
|
||||
return request({
|
||||
url: '/cost/prodReport',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除生产月报
|
||||
export function delProdReport(reportId) {
|
||||
return request({
|
||||
url: '/cost/prodReport/' + reportId,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
@@ -4,8 +4,8 @@ import request from '@/utils/request'
|
||||
export function listAttendanceCheck(query) {
|
||||
return request({
|
||||
url: '/wms/attendanceCheck/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
method: 'post',
|
||||
data: query
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
536
klp-ui/src/views/cost/comprehensive.vue
Normal file
536
klp-ui/src/views/cost/comprehensive.vue
Normal file
@@ -0,0 +1,536 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<div class="report-tab-bar">
|
||||
<div class="report-tabs">
|
||||
<span v-for="r in tabs" :key="r.reportId"
|
||||
:class="['report-tab', { active: activeReport && activeReport.reportId === r.reportId }]"
|
||||
@click="enter(r)">{{ r.reportTitle }}</span>
|
||||
</div>
|
||||
<el-button size="mini" icon="el-icon-setting" @click="openConfig">配置</el-button>
|
||||
</div>
|
||||
|
||||
<div v-if="!activeReport" class="empty-hint">请在上方选择报表,或点击"配置"管理报表</div>
|
||||
|
||||
<template v-if="activeReport">
|
||||
<el-card class="mb8">
|
||||
<div slot="header" class="entry-header">
|
||||
<span class="entry-title">{{ activeReport.reportTitle }}</span>
|
||||
<el-tag size="mini" style="margin-left:6px">{{ activeReport.lineType==='acid'?'酸轧':'镀锌' }}</el-tag>
|
||||
<span class="entry-meta">{{ parseTime(activeReport.reportDate,'{y}-{m}-{d}') }} 投入{{ activeReport.inputWeight }}t 产出{{ activeReport.outputWeight }}t</span>
|
||||
<el-button type="primary" size="mini" style="float:right;margin-left:8px" @click="saveGrid" :loading="saving">保存</el-button>
|
||||
<el-button size="mini" style="float:right" @click="openColCfg">列配置</el-button>
|
||||
</div>
|
||||
<el-alert :title="'已配置'+allCols.length+'个列'" type="info" :closable="false" show-icon style="margin-bottom:8px" />
|
||||
<el-table v-loading="gridLoading" :data="gridRows" border stripe size="mini" style="width:100%" :header-cell-style="headerStyle">
|
||||
<el-table-column label="日期" width="135" fixed>
|
||||
<template slot-scope="s"><el-date-picker v-model="s.row.detailDate" type="date" value-format="yyyy-MM-dd" size="mini" style="width:124px" @change="sortGrid" /></template>
|
||||
</el-table-column>
|
||||
<template v-for="col in allCols">
|
||||
<el-table-column v-if="col.$type==='detail' && !col.isShift" :key="'d'+col.itemId" :label="col.itemName+(col.unit?'('+col.unit+')':'')" width="105" align="center">
|
||||
<template slot-scope="s">
|
||||
<el-input v-model="s.row['q'+col.itemId]" size="mini" @input="recalcAll" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column v-else-if="col.$type==='detail' && col.isShift" :key="'ds'+col.itemId" :label="col.itemName+(col.unit?'('+col.unit+')':'')" width="120" align="center">
|
||||
<template slot-scope="s">
|
||||
<div class="shift-cell"><span class="shift-tag">甲</span><el-input v-model="s.row['q'+col.itemId+'_1']" size="mini" class="shift-input" @input="recalcAll" /></div>
|
||||
<div class="shift-cell"><span class="shift-tag">乙</span><el-input v-model="s.row['q'+col.itemId+'_2']" size="mini" class="shift-input" @input="recalcAll" /></div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column v-else-if="col.$type==='metric' && !col.isShift" :key="'m'+col.mIdx" :label="col.metricName+(col.unit?'('+col.unit+')':'')" width="85" align="center">
|
||||
<template slot-scope="s">{{ s.row['mv'+col.mIdx]!=null ? s.row['mv'+col.mIdx] : '-' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column v-else-if="col.$type==='metric' && col.isShift" :key="'ms'+col.mIdx" :label="col.metricName+(col.unit?'('+col.unit+')':'')" width="95" align="center">
|
||||
<template slot-scope="s">
|
||||
<div class="shift-metric">甲 {{ s.row['mv'+col.mIdx+'_1']!=null ? s.row['mv'+col.mIdx+'_1'] : '-' }}</div>
|
||||
<div class="shift-metric">乙 {{ s.row['mv'+col.mIdx+'_2']!=null ? s.row['mv'+col.mIdx+'_2'] : '-' }}</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</template>
|
||||
<el-table-column label="操作" width="55" fixed="right" align="center">
|
||||
<template slot-scope="s"><el-button size="mini" type="text" style="padding:0" @click="gridRows.splice(s.$index,1)">删除</el-button></template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div style="margin-top:8px;text-align:center"><el-button type="default" icon="el-icon-plus" size="mini" @click="gridRows.push({detailDate:''})">添加日期行</el-button></div>
|
||||
</el-card>
|
||||
|
||||
<!-- Column config -->
|
||||
<el-dialog title="列配置" :visible.sync="colOpen" width="880px" append-to-body top="5vh">
|
||||
<div style="margin-bottom:8px;display:flex;justify-content:space-between;align-items:center">
|
||||
<span style="color:#999;font-size:12px">共 {{ allCols.length }} 列</span>
|
||||
<div>
|
||||
<el-button size="mini" type="danger" :disabled="!selCol.length" @click="batchDelCol">删除</el-button>
|
||||
<el-button type="primary" size="mini" @click="showAddDetail=true">+ 明细列</el-button>
|
||||
<el-button size="mini" type="success" @click="openMetricPicker">+ 指标列</el-button>
|
||||
<el-button size="mini" plain @click="openMetricMgr">指标管理</el-button>
|
||||
<el-button size="mini" plain @click="openCopyCfg">复制配置</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<el-table :data="allCols" border stripe size="mini" highlight-current-row @current-change="curIdx = allCols.indexOf($event)" @selection-change="selCol=$event">
|
||||
<el-table-column type="selection" width="40" />
|
||||
<el-table-column label="序号" type="index" width="50" align="center" />
|
||||
<el-table-column label="类型" width="60" align="center">
|
||||
<template slot-scope="s">
|
||||
<el-tag v-if="s.row.$type==='detail'" type="primary" size="mini">明细</el-tag>
|
||||
<el-tag v-else type="success" size="mini">指标</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="名称" width="140">
|
||||
<template slot-scope="s">{{ s.row.$type==='detail' ? (s.row.itemName||s.row.itemCode) : (s.row.metricName||'(空)') }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="公式" min-width="180">
|
||||
<template slot-scope="s"><span v-if="s.row.$type==='metric'" style="font-size:11px;color:#666">{{ s.row.metricFormula }}</span></template>
|
||||
</el-table-column>
|
||||
<el-table-column label="单位" width="55" align="center">
|
||||
<template slot-scope="s">{{ s.row.unit }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="表头色" width="70" align="center">
|
||||
<template slot-scope="s"><el-color-picker v-model="s.row.color" size="mini" :predefine="['#409eff','#67c23a','#e6a23c','#f56c6c','#909399']" /></template>
|
||||
</el-table-column>
|
||||
<el-table-column label="分班次" width="70" align="center">
|
||||
<template slot-scope="s"><el-checkbox v-model="s.row.isShift" /></template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="110" align="center">
|
||||
<template slot-scope="s">
|
||||
<el-button size="mini" type="text" icon="el-icon-top" :disabled="s.$index===0" @click="moveCol(s.$index,-1)" />
|
||||
<el-button size="mini" type="text" icon="el-icon-bottom" :disabled="s.$index===allCols.length-1" @click="moveCol(s.$index,1)" />
|
||||
<el-button size="mini" type="text" icon="el-icon-delete" @click="allCols.splice(s.$index,1)" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div slot="footer"><el-button type="primary" @click="saveColCfg" :loading="colSaving">保存配置</el-button><el-button @click="colOpen=false">取消</el-button></div>
|
||||
</el-dialog>
|
||||
|
||||
<!-- Add detail -->
|
||||
<el-dialog title="添加明细列" :visible.sync="showAddDetail" width="550px" append-to-body>
|
||||
<el-table :data="availableItems" border stripe size="mini" @selection-change="selAdd=$event">
|
||||
<el-table-column type="selection" width="45" />
|
||||
<el-table-column label="编码" prop="itemCode" width="120" />
|
||||
<el-table-column label="名称" prop="itemName" />
|
||||
<el-table-column label="单位" prop="unit" width="70" />
|
||||
</el-table>
|
||||
<div slot="footer">
|
||||
<el-button type="primary" :disabled="!selAdd.length" @click="batchAddDetailCols">确 定</el-button>
|
||||
<el-button @click="showAddDetail=false">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<!-- Pick metric -->
|
||||
<el-dialog title="选择指标列" :visible.sync="metricPickOpen" width="600px" append-to-body>
|
||||
<el-table :data="metricPickList" border stripe size="mini" @selection-change="selMp=$event">
|
||||
<el-table-column type="selection" width="45" />
|
||||
<el-table-column label="名称" prop="metricName" width="150" />
|
||||
<el-table-column label="公式" prop="metricFormula" min-width="200" />
|
||||
<el-table-column label="单位" prop="unit" width="70" />
|
||||
</el-table>
|
||||
<div slot="footer">
|
||||
<el-button type="primary" :disabled="!selMp.length" @click="doPickMetric">确 定</el-button>
|
||||
<el-button @click="metricPickOpen=false">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<!-- Metric management -->
|
||||
<el-dialog title="指标管理" :visible.sync="mgrOpen" width="750px" top="5vh" append-to-body>
|
||||
<div style="margin-bottom:8px">
|
||||
<el-button type="primary" size="mini" @click="addMetricDef">新增指标</el-button>
|
||||
</div>
|
||||
<el-table :data="mgrList" border stripe size="mini">
|
||||
<el-table-column label="名称" prop="metricName" width="150" />
|
||||
<el-table-column label="公式" prop="metricFormula" min-width="200" />
|
||||
<el-table-column label="单位" prop="remark" width="70" />
|
||||
<el-table-column label="操作" width="100">
|
||||
<template slot-scope="s">
|
||||
<el-button size="mini" type="text" @click="editMetricDef(s.row)">编辑</el-button>
|
||||
<el-button size="mini" type="text" style="color:#f56c6c" @click="delMetricDef(s.row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<el-dialog :title="defTitle" :visible.sync="defOpen" width="480px" append-to-body>
|
||||
<el-form :model="defForm" label-width="80px" size="small">
|
||||
<el-form-item label="指标名称"><el-input v-model="defForm.metricName" /></el-form-item>
|
||||
<el-form-item label="公式"><el-input v-model="defForm.metricFormula" type="textarea" :rows="3" /></el-form-item>
|
||||
<div class="formula-vars" v-if="allCols.length">
|
||||
<span class="vars-label">变量:</span>
|
||||
<template v-for="c in allCols.filter(x=>x.$type==='detail')">
|
||||
<el-tag :key="'v'+c.itemId" size="mini" class="vars-tag" @click="defForm.metricFormula=(defForm.metricFormula||'')+'@{'+c.itemCode+'}'">{{ c.itemCode }}</el-tag>
|
||||
</template>
|
||||
<el-tag size="mini" class="vars-tag var-sys" @click="defForm.metricFormula=(defForm.metricFormula||'')+'input_weight'">input_weight</el-tag>
|
||||
<el-tag size="mini" class="vars-tag var-sys" @click="defForm.metricFormula=(defForm.metricFormula||'')+'output_weight'">output_weight</el-tag>
|
||||
<template v-for="c in allCols.filter(x=>x.$type==='metric'&&x.metricName)">
|
||||
<el-tag :key="'v'+c.metricName" size="mini" class="vars-tag var-mtr" @click="defForm.metricFormula=(defForm.metricFormula||'')+'@{'+c.metricName+'}'">{{ c.metricName }}</el-tag>
|
||||
</template>
|
||||
</div>
|
||||
<el-form-item label="单位"><el-input v-model="defForm.unit" placeholder="如 %" /></el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer">
|
||||
<el-button type="primary" @click="submitMetricDef">确 定</el-button>
|
||||
<el-button @click="defOpen=false">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</el-dialog>
|
||||
|
||||
<!-- Copy config -->
|
||||
<el-dialog title="从已有报表复制配置" :visible.sync="copyCfgOpen" width="550px" append-to-body>
|
||||
<el-table :data="copyReports" border stripe size="mini" highlight-current-row @current-change="copySrc=$event">
|
||||
<el-table-column label="报表标题" prop="reportTitle" />
|
||||
<el-table-column label="日期" width="110"><template slot-scope="s">{{ parseTime(s.row.reportDate,'{y}-{m}-{d}') }}</template></el-table-column>
|
||||
<el-table-column label="产线" prop="lineType" width="70" />
|
||||
</el-table>
|
||||
<div slot="footer">
|
||||
<el-button type="primary" :disabled="!copySrc" @click="doCopyCfg">确认复制</el-button>
|
||||
<el-button @click="copyCfgOpen=false">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<!-- Report management -->
|
||||
<el-dialog title="报表管理" :visible.sync="configOpen" width="900px" top="5vh" append-to-body>
|
||||
<el-form :model="q" ref="qf" size="small" :inline="true" v-show="showSearch" label-width="80px">
|
||||
<el-form-item label="报表标题" prop="reportTitle"><el-input v-model="q.reportTitle" placeholder="请输入" clearable @keyup.enter.native="search" /></el-form-item>
|
||||
<el-form-item label="报表日期" prop="reportDate"><el-date-picker v-model="q.reportDate" type="date" value-format="yyyy-MM-dd" placeholder="选择日期" clearable /></el-form-item>
|
||||
<el-form-item><el-button type="primary" icon="el-icon-search" size="mini" @click="search">搜索</el-button><el-button icon="el-icon-refresh" size="mini" @click="resetQ">重置</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="addRp">新增</el-button></el-col>
|
||||
<el-col :span="1.5"><el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="sel!==1" @click="editRp">修改</el-button></el-col>
|
||||
<el-col :span="1.5"><el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="sel<1" @click="delRp">删除</el-button></el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList" />
|
||||
</el-row>
|
||||
<el-table v-loading="loading" :data="list" @selection-change="s=>{sel=s.length;selIds=s.map(r=>r.reportId)}" ref="rt">
|
||||
<el-table-column type="selection" width="50" align="center" />
|
||||
<el-table-column label="报表标题" prop="reportTitle" />
|
||||
<el-table-column label="日期" width="120"><template slot-scope="s">{{ parseTime(s.row.reportDate,'{y}-{m}-{d}') }}</template></el-table-column>
|
||||
<el-table-column label="产线" prop="lineType" width="70" />
|
||||
<el-table-column label="投入(t)" prop="inputWeight" width="80" />
|
||||
<el-table-column label="产出(t)" prop="outputWeight" width="80" />
|
||||
</el-table>
|
||||
<pagination v-show="total>0" :total="total" :page.sync="q.pageNum" :limit.sync="q.pageSize" @pagination="getList" />
|
||||
|
||||
<el-dialog :title="rpTitle" :visible.sync="rpOpen" width="500px" append-to-body>
|
||||
<el-form ref="rpf" :model="rpForm" :rules="{reportTitle:[{required:true,message:'请输入',trigger:'blur'}]}" label-width="100px">
|
||||
<el-form-item label="报表标题" prop="reportTitle"><el-input v-model="rpForm.reportTitle" /></el-form-item>
|
||||
<el-form-item label="报表日期" prop="reportDate"><el-date-picker v-model="rpForm.reportDate" type="date" value-format="yyyy-MM-dd" style="width:100%" /></el-form-item>
|
||||
<el-form-item label="产线类型" prop="lineType"><el-select v-model="rpForm.lineType" style="width:100%"><el-option label="酸轧" value="acid" /><el-option label="镀锌" value="galvanized" /></el-select></el-form-item>
|
||||
<el-form-item label="投入量(吨)" prop="inputWeight"><el-input-number v-model="rpForm.inputWeight" :precision="2" :min="0" style="width:100%" /></el-form-item>
|
||||
<el-form-item label="产出量(吨)" prop="outputWeight"><el-input-number v-model="rpForm.outputWeight" :precision="2" :min="0" style="width:100%" /></el-form-item>
|
||||
<el-form-item label="备注" prop="remark"><el-input v-model="rpForm.remark" type="textarea" /></el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer"><el-button :loading="rpBtnLoading" type="primary" @click="submitRp">确 定</el-button><el-button @click="rpOpen=false">取 消</el-button></div>
|
||||
</el-dialog>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listProdReport, getProdReport, addProdReport, updateProdReport, delProdReport } from "@/api/cost/prodReport"
|
||||
import { listProdDetail, batchSaveProdDetail } from "@/api/cost/prodDetail"
|
||||
import { listProdMetric, addProdMetric, updateProdMetric, delProdMetric } from "@/api/cost/prodMetric"
|
||||
import { listItem } from "@/api/cost/item"
|
||||
|
||||
export default {
|
||||
name: "CostComprehensive",
|
||||
data() {
|
||||
return {
|
||||
loading: false, list: [], tabs: [], total: 0, sel: 0, selIds: [], showSearch: true,
|
||||
q: { pageNum: 1, pageSize: 10, reportTitle: undefined, reportDate: undefined },
|
||||
rpOpen: false, rpTitle: "", rpBtnLoading: false, rpForm: {},
|
||||
activeReport: null, gridLoading: false, gridRows: [], saving: false,
|
||||
allItems: [], allCols: [],
|
||||
colOpen: false, colSaving: false,
|
||||
showAddDetail: false, selAdd: [], selCol: [], curIdx: -1,
|
||||
metricPickOpen: false, metricPickList: [], selMp: [],
|
||||
mgrOpen: false, mgrList: [], defOpen: false, defTitle: '', defForm: {},
|
||||
copyCfgOpen: false, copyReports: [], copySrc: null,
|
||||
configOpen: false
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
availableItems() {
|
||||
const used = new Set(this.allCols.filter(c => c.$type === 'detail').map(c => c.itemId))
|
||||
return this.allItems.filter(i => !used.has(i.itemId))
|
||||
},
|
||||
headerStyle() {
|
||||
return ({ column }) => {
|
||||
if (!column || !column.label) return {}
|
||||
const col = this.allCols.find(c => {
|
||||
if (c.$type === 'detail') return column.label.startsWith(c.itemName || c.itemCode)
|
||||
if (c.$type === 'metric') return column.label.startsWith(c.metricName)
|
||||
return false
|
||||
})
|
||||
return col && col.color ? { background: col.color, color: '#fff' } : {}
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: { configOpen(v) { if (!v) this.rpOpen = false } },
|
||||
created() { this.getTabList(); this.loadItems() },
|
||||
methods: {
|
||||
/* report */
|
||||
getList() { this.loading = true; listProdReport(this.q).then(r=>{this.list=r.rows;this.total=r.total}).finally(()=>this.loading=false) },
|
||||
getTabList() { listProdReport({ pageNum: 1, pageSize: 9999 }).then(r => { this.tabs = r.rows || [] }) },
|
||||
search() { this.q.pageNum = 1; this.getList() },
|
||||
resetQ() { this.resetForm("qf"); this.search() },
|
||||
addRp() { this.rpForm = {}; this.rpTitle = "新增"; this.rpOpen = true },
|
||||
editRp(row) { const id = (row&&row.reportId)||this.selIds[0]; if(!id)return; getProdReport(id).then(r=>{this.rpForm=r.data;this.rpTitle="修改";this.rpOpen=true}) },
|
||||
submitRp() {
|
||||
this.$refs.rpf.validate(v=>{if(!v)return;this.rpBtnLoading=true;const fn=this.rpForm.reportId?updateProdReport:addProdReport;fn(this.rpForm).then(()=>{
|
||||
this.$modal.msgSuccess("成功"); this.rpOpen = false
|
||||
if (this.activeReport && this.activeReport.reportId === this.rpForm.reportId) {
|
||||
Object.assign(this.activeReport, { reportTitle: this.rpForm.reportTitle, reportDate: this.rpForm.reportDate, lineType: this.rpForm.lineType, inputWeight: this.rpForm.inputWeight, outputWeight: this.rpForm.outputWeight })
|
||||
}
|
||||
this.getTabList(); this.getList()
|
||||
}).finally(()=>this.rpBtnLoading=false)})
|
||||
},
|
||||
delRp(row) {
|
||||
const ids=(row&&row.reportId)?[row.reportId]:this.selIds;if(!ids.length)return
|
||||
this.$modal.confirm("确认删除?").then(()=>delProdReport(ids.join(','))).then(()=>{
|
||||
if (this.activeReport && ids.includes(this.activeReport.reportId)) { this.activeReport = null; this.gridRows = []; this.allCols = [] }
|
||||
this.getTabList(); this.getList(); this.$modal.msgSuccess("已删除")
|
||||
})
|
||||
},
|
||||
openConfig() { this.configOpen = true; this.getList() },
|
||||
|
||||
/* column config */
|
||||
async openColCfg() { await this.loadItems(); await this.restoreAllCols(); this.colOpen = true },
|
||||
moveCol(idx, dir) { const arr = this.allCols; const t = idx + dir; if (t >= 0 && t < arr.length) { const item = arr.splice(idx, 1)[0]; arr.splice(t, 0, item) } },
|
||||
batchAddDetailCols() {
|
||||
this.selAdd.forEach(item => {
|
||||
if (!this.allCols.find(c => c.$type === 'detail' && c.itemId === item.itemId))
|
||||
this.allCols.push({ $type: 'detail', itemId: item.itemId, itemCode: item.itemCode, itemName: item.itemName, unit: item.unit, isShift: false, color: null })
|
||||
})
|
||||
this.showAddDetail = false; this.selAdd = []
|
||||
},
|
||||
batchDelCol() {
|
||||
const set = new Set(this.selCol.map(r => r))
|
||||
this.allCols = this.allCols.filter(c => !set.has(c))
|
||||
this.selCol = []; this.curIdx = -1
|
||||
},
|
||||
/* metric picker */
|
||||
async openMetricPicker() {
|
||||
await this.loadAllMetrics()
|
||||
const used = new Set(this.allCols.filter(c => c.$type === 'metric' && c.metricId).map(c => c.metricId))
|
||||
this.metricPickList = (this._allMetricDefs || []).filter(m => !used.has(m.metricId))
|
||||
this.selMp = []; this.metricPickOpen = true
|
||||
},
|
||||
doPickMetric() {
|
||||
this.selMp.forEach(m => {
|
||||
this.allCols.push({ $type: 'metric', metricId: m.metricId, metricName: m.metricName, metricFormula: m.metricFormula, unit: m.remark||'', isShift: false, color: null })
|
||||
})
|
||||
this.metricPickOpen = false
|
||||
},
|
||||
/* metric management */
|
||||
async openMetricMgr() {
|
||||
await this.loadAllMetrics(); this.mgrList = this._allMetricDefs || []; this.mgrOpen = true
|
||||
},
|
||||
addMetricDef() { this.defForm = { metricId: null, metricName: '', metricFormula: '', unit: '' }; this.defTitle = '新增指标'; this.defOpen = true },
|
||||
editMetricDef(row) { this.defForm = { metricId: row.metricId, metricName: row.metricName, metricFormula: row.metricFormula, unit: row.remark||'' }; this.defTitle = '编辑指标'; this.defOpen = true },
|
||||
async submitMetricDef() {
|
||||
const f = this.defForm
|
||||
if (!f.metricName) { this.$modal.msgWarning('请输入指标名称'); return }
|
||||
if (f.metricId) {
|
||||
await updateProdMetric({ metricId: f.metricId, metricName: f.metricName, metricFormula: f.metricFormula, remark: f.unit })
|
||||
} else {
|
||||
await addProdMetric({ reportId: this.activeReport.reportId, metricCode: f.metricName, metricName: f.metricName, metricFormula: f.metricFormula, metricValue: 0, remark: f.unit || '' })
|
||||
}
|
||||
this.defOpen = false; this.$modal.msgSuccess('保存成功')
|
||||
await this.openMetricMgr()
|
||||
},
|
||||
async delMetricDef(row) {
|
||||
this.$modal.confirm('确认删除指标 "' + row.metricName + '"?').then(async () => {
|
||||
await delProdMetric(row.metricId)
|
||||
await this.openMetricMgr()
|
||||
this.$modal.msgSuccess('已删除')
|
||||
})
|
||||
},
|
||||
|
||||
async saveColCfg() {
|
||||
const rid = this.activeReport.reportId; this.colSaving = true
|
||||
try {
|
||||
const metricCols = this.allCols.filter(c => c.$type === 'metric')
|
||||
for (const m of metricCols) {
|
||||
if (!m.metricName) { this.$modal.msgWarning('存在空指标列'); return }
|
||||
if (m.metricFormula) {
|
||||
const testF = m.metricFormula.replace(/@\{[^}]+\}/g, '1').replace(/input_weight|output_weight/g, '1')
|
||||
if (this.evalF(testF) === null) { this.$modal.msgError('指标 "' + m.metricName + '" 公式无效'); return }
|
||||
}
|
||||
}
|
||||
const columns = this.allCols.map(c => {
|
||||
const o = { t: c.$type === 'detail' ? 'd' : 'm', s: c.isShift }
|
||||
if (c.$type === 'detail') o.id = c.itemId
|
||||
else { if (c.metricId) o.id = c.metricId; else o.n = c.metricName }
|
||||
if (c.color) o.c = c.color
|
||||
return o
|
||||
})
|
||||
this.activeReport.colConfig = JSON.stringify({ columns })
|
||||
await updateProdReport({ reportId: rid, colConfig: this.activeReport.colConfig })
|
||||
this.$modal.msgSuccess("列配置已保存"); this.colOpen = false
|
||||
await this.loadGrid()
|
||||
} finally { this.colSaving = false }
|
||||
},
|
||||
|
||||
/* grid */
|
||||
async loadGrid() {
|
||||
const rid = this.activeReport.reportId; this.gridLoading = true
|
||||
try {
|
||||
const dr = await listProdDetail({ reportId: rid, pageNum: 1, pageSize: 9999 })
|
||||
await this.restoreAllCols()
|
||||
this.buildGrid(dr.rows || [])
|
||||
this.recalcAll()
|
||||
} finally { this.gridLoading = false }
|
||||
},
|
||||
async restoreAllCols() {
|
||||
await this.loadItems(); await this.loadAllMetrics()
|
||||
const cfg = JSON.parse(this.activeReport.colConfig || 'null')
|
||||
if (!cfg || !cfg.columns || !cfg.columns.length) { this.allCols = []; return }
|
||||
|
||||
this.allCols = cfg.columns.map(c => {
|
||||
if (c.t === 'd') {
|
||||
const item = this.allItems.find(i => i.itemId === c.id)
|
||||
return item ? { $type: 'detail', itemId: item.itemId, itemCode: item.itemCode, itemName: item.itemName, unit: item.unit, isShift: !!c.s, color: c.c || null } : null
|
||||
}
|
||||
if (c.t === 'm') {
|
||||
let def
|
||||
if (c.id) def = (this._allMetricDefs || []).find(m => m.metricId === c.id)
|
||||
else def = (this._allMetricDefs || []).find(m => m.metricName === c.n)
|
||||
return def ? { $type: 'metric', metricId: def.metricId, metricName: def.metricName, metricFormula: def.metricFormula, unit: def.remark||'', isShift: !!c.s, color: c.c || null } : null
|
||||
}
|
||||
return null
|
||||
}).filter(Boolean)
|
||||
let mi = 0; this.allCols.forEach(c => { if (c.$type === 'metric') c.mIdx = mi++ })
|
||||
},
|
||||
buildGrid(details) {
|
||||
const map = {}; details.forEach(d => {
|
||||
if (!d.detailDate) return
|
||||
if (!map[d.detailDate]) map[d.detailDate] = { detailDate: d.detailDate }
|
||||
const sfx = d.shift && d.shift !== '0' ? '_' + d.shift : ''
|
||||
map[d.detailDate]['q' + d.itemId + sfx] = d.quantity
|
||||
})
|
||||
this.gridRows = Object.values(map).sort((a,b) => a.detailDate.localeCompare(b.detailDate))
|
||||
},
|
||||
recalcAll() {
|
||||
const rp = this.activeReport || {}; const esc = s => s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
|
||||
const detailCols = this.allCols.filter(c => c.$type === 'detail')
|
||||
const metricCols = this.allCols.filter(c => c.$type === 'metric')
|
||||
this.gridRows.forEach(row => {
|
||||
metricCols.forEach((m, mi) => {
|
||||
if (!m.metricFormula) return
|
||||
const ef = (shiftId) => {
|
||||
let f = m.metricFormula
|
||||
for (let pmi = 0; pmi < mi; pmi++) {
|
||||
const pm = metricCols[pmi]; if (!pm.metricName) continue
|
||||
const pn = esc(pm.metricName)
|
||||
if (pm.isShift) {
|
||||
const pv1 = row['mv'+pm.mIdx+'_1']; const pv2 = row['mv'+pm.mIdx+'_2']
|
||||
if (pv1 != null) f = f.replace(new RegExp('@\\{'+pn+'\\}\\.甲班','g'), pv1)
|
||||
if (pv2 != null) f = f.replace(new RegExp('@\\{'+pn+'\\}\\.乙班','g'), pv2)
|
||||
}
|
||||
const pv = pm.isShift ? (shiftId ? row['mv'+pm.mIdx+'_'+shiftId] : null) : row['mv'+pm.mIdx]
|
||||
if (pv != null) f = f.replace(new RegExp('@\\{'+pn+'\\}','g'), pv)
|
||||
}
|
||||
detailCols.forEach(c => {
|
||||
const item = this.allItems.find(i => i.itemId === c.itemId)
|
||||
if (!item || !item.itemCode) return; const code = item.itemCode
|
||||
if (c.isShift) {
|
||||
const v1 = parseFloat(row['q'+c.itemId+'_1'])||0; const v2 = parseFloat(row['q'+c.itemId+'_2'])||0
|
||||
f = f.replace(new RegExp('@\\{'+code+'\\}\\.甲班','g'), v1).replace(new RegExp('@\\{'+code+'\\}\\.乙班','g'), v2)
|
||||
const v = shiftId ? (shiftId==='1'?v1:v2) : v1+v2
|
||||
f = f.replace(new RegExp('@\\{'+code+'\\}','g'), v)
|
||||
} else {
|
||||
const v = parseFloat(row['q'+c.itemId])||0
|
||||
f = f.replace(new RegExp('@\\{'+code+'\\}\\.甲班','g'), v).replace(new RegExp('@\\{'+code+'\\}\\.乙班','g'), v).replace(new RegExp('@\\{'+code+'\\}','g'), v)
|
||||
}
|
||||
})
|
||||
f = f.replace(/input_weight/g, rp.inputWeight||0).replace(/output_weight/g, rp.outputWeight||0)
|
||||
return this.evalF(f)
|
||||
}
|
||||
if (m.isShift) { row['mv'+m.mIdx+'_1']=ef('1'); row['mv'+m.mIdx+'_2']=ef('2') }
|
||||
else row['mv'+m.mIdx]=ef(null)
|
||||
})
|
||||
})
|
||||
},
|
||||
evalF(f) { const s = f.replace(/[^0-9+\-*/.()\s]/g,''); if(!s) return null; try { const r = new Function('return ('+s+')')(); return isFinite(r)?Math.round(r*10000)/10000:null } catch(e){ return null } },
|
||||
sortGrid() { this.gridRows.sort((a,b)=>{if(!a.detailDate)return 1;if(!b.detailDate)return -1;return a.detailDate.localeCompare(b.detailDate)}) },
|
||||
|
||||
async saveGrid() {
|
||||
const rid = this.activeReport.reportId; if (!rid) return; this.saving = true
|
||||
try {
|
||||
const exist = await listProdDetail({ reportId: rid, pageNum: 1, pageSize: 9999 })
|
||||
const ids = (exist.rows||[]).map(d => d.detailId)
|
||||
const detailCols = this.allCols.filter(c => c.$type === 'detail'); const detailList = []
|
||||
this.gridRows.forEach(row => {
|
||||
if (!row.detailDate) return
|
||||
detailCols.forEach(col => {
|
||||
const push = (shift, sfx) => { const qty = row['q'+col.itemId+sfx]; if (qty != null && qty !== '') detailList.push({ reportId: rid, detailDate: row.detailDate, shift: shift||'0', itemId: col.itemId, quantity: qty }) }
|
||||
if (col.isShift) { push('1','_1'); push('2','_2') } else push(null,'')
|
||||
})
|
||||
})
|
||||
await batchSaveProdDetail({ detailIds: ids, prodDetailList: detailList })
|
||||
this.$modal.msgSuccess("保存成功"); await this.loadGrid()
|
||||
} catch(e) { this.$modal.msgError("保存失败") } finally { this.saving = false }
|
||||
},
|
||||
|
||||
/* copy config */
|
||||
async openCopyCfg() { const r = await listProdReport({ pageNum:1, pageSize:9999 }); this.copyReports = (r.rows||[]).filter(rp=>rp.reportId!==this.activeReport.reportId); this.copySrc=null; this.copyCfgOpen=true },
|
||||
async doCopyCfg() {
|
||||
if (!this.copySrc) return; const sr = await getProdReport(this.copySrc.reportId)
|
||||
const srcCfg = JSON.parse(((sr.data&&sr.data.colConfig)||'null'))
|
||||
if (!srcCfg || (!srcCfg.columns && !srcCfg.itemIds)) { this.$modal.msgWarning('源报表无列配置'); return }
|
||||
await this.loadItems(); await this.loadAllMetrics()
|
||||
const usedIds = new Set(this.allCols.filter(c=>c.$type==='detail').map(c=>c.itemId))
|
||||
const usedMids = new Set(this.allCols.filter(c=>c.$type==='metric'&&c.metricId).map(c=>c.metricId))
|
||||
const cols = srcCfg.columns || []
|
||||
cols.forEach(sc => {
|
||||
if (sc.t === 'd') { if (!usedIds.has(sc.id)) { const item = this.allItems.find(i=>i.itemId===sc.id); if (item) { this.allCols.push({ $type:'detail', itemId:item.itemId, itemCode:item.itemCode, itemName:item.itemName, unit:item.unit, isShift:!!sc.s, color:sc.c||null }); usedIds.add(sc.id) } } }
|
||||
else if (sc.t === 'm') {
|
||||
let def
|
||||
if (sc.id) { def = this._allMetricDefs.find(m=>m.metricId===sc.id); if (usedMids.has(sc.id)) return; usedMids.add(sc.id) }
|
||||
else def = this._allMetricDefs.find(m=>m.metricName===sc.n)
|
||||
if (def) this.allCols.push({ $type:'metric', metricId:def.metricId, metricName:def.metricName, metricFormula:def.metricFormula, unit:def.remark||'', isShift:!!sc.s, color:sc.c||null })
|
||||
}
|
||||
})
|
||||
this.copyCfgOpen = false; let mi = 0; this.allCols.forEach(c => { if (c.$type === 'metric') c.mIdx = mi++ })
|
||||
this.$modal.msgSuccess('配置已复用')
|
||||
},
|
||||
|
||||
/* helpers */
|
||||
async loadItems() { if (!this.allItems.length) { const r = await listItem({ pageNum:1, pageSize:999 }); this.allItems = r.rows || [] } },
|
||||
async loadAllMetrics() {
|
||||
const r = await listProdMetric({ pageNum:1, pageSize:99999 }); const map = {}
|
||||
;(r.rows||[]).forEach(m => { if (m.metricName && m.metricFormula && !map[m.metricId]) map[m.metricId] = m })
|
||||
this._allMetricDefs = Object.values(map)
|
||||
},
|
||||
async enter(row) { const r = await getProdReport(row.reportId); if (r.data) this.activeReport = r.data; else this.activeReport = row; this.loadGrid() }
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.mb8 { margin-bottom: 8px; }
|
||||
/deep/ .el-table--mini td { padding: 2px 0; }
|
||||
/deep/ .el-table--mini th { padding: 4px 0; font-size: 12px; }
|
||||
/deep/ .el-table--mini .cell { padding: 0 3px; line-height: 1.2; }
|
||||
/deep/ .el-input--mini .el-input__inner { height: 24px; line-height: 24px; padding: 0 5px; }
|
||||
/deep/ .el-date-editor.el-input--mini { width: 124px !important; }
|
||||
/deep/ .el-date-editor.el-input--mini .el-input__inner { padding-left: 5px; padding-right: 18px; }
|
||||
/deep/ .el-date-editor.el-input--mini .el-input__prefix { left: auto; right: 2px; }
|
||||
/deep/ .el-button--mini { padding: 4px 8px; font-size: 12px; }
|
||||
/deep/ .el-button--mini.el-button--text { padding: 0; }
|
||||
.report-tab-bar { display: flex; align-items: center; border-bottom: 1px solid #dcdfe6; margin-bottom: 12px; padding: 0 4px; }
|
||||
.report-tabs { flex: 1; display: flex; overflow-x: auto; margin-bottom: -1px; }
|
||||
.report-tab { display: inline-block; padding: 7px 16px; cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; font-size: 13px; color: #606266; transition: all 0.2s; user-select: none; }
|
||||
.report-tab:hover { color: #409eff; }
|
||||
.report-tab.active { color: #409eff; border-bottom-color: #409eff; font-weight: 500; }
|
||||
.empty-hint { text-align: center; padding: 60px 0; color: #999; font-size: 14px; }
|
||||
.entry-header { line-height: 28px; }
|
||||
.entry-title { font-weight: bold; font-size: 15px; }
|
||||
.entry-meta { margin-left: 10px; color: #999; font-size: 12px; }
|
||||
.shift-cell { display: flex; align-items: center; }
|
||||
.shift-tag { font-size: 10px; color: #909399; width: 16px; flex-shrink: 0; }
|
||||
.shift-input { flex: 1; min-width: 0; }
|
||||
.shift-metric { font-size: 12px; line-height: 1.5; }
|
||||
.formula-vars { padding: 4px 6px; margin-bottom: 6px; background: #f5f7fa; border-radius: 3px; border: 1px solid #e4e7ed; line-height: 1.8; }
|
||||
.vars-tag { cursor: pointer; margin: 1px; }
|
||||
.vars-tag:hover { opacity: 0.8; }
|
||||
.var-sys { background: #ecf5ff; border-color: #d9ecff; color: #409eff; }
|
||||
.var-mtr { background: #f0f9eb; border-color: #e1f3d8; color: #67c23a; }
|
||||
</style>
|
||||
356
klp-ui/src/views/cost/detail.vue
Normal file
356
klp-ui/src/views/cost/detail.vue
Normal file
@@ -0,0 +1,356 @@
|
||||
<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="生产月报ID" prop="reportId">
|
||||
<el-input
|
||||
v-model="queryParams.reportId"
|
||||
placeholder="请输入生产月报ID"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="班次 1=甲班 2=乙班" prop="shift">
|
||||
<el-input
|
||||
v-model="queryParams.shift"
|
||||
placeholder="请输入班次 1=甲班 2=乙班"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="日期" prop="detailDate">
|
||||
<el-date-picker clearable
|
||||
v-model="queryParams.detailDate"
|
||||
type="date"
|
||||
value-format="yyyy-MM-dd"
|
||||
placeholder="请选择日期">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="成本项目ID" prop="itemId">
|
||||
<el-input
|
||||
v-model="queryParams.itemId"
|
||||
placeholder="请输入成本项目ID"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="消耗用量" prop="quantity">
|
||||
<el-input
|
||||
v-model="queryParams.quantity"
|
||||
placeholder="请输入消耗用量"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="单价" prop="unitPrice">
|
||||
<el-input
|
||||
v-model="queryParams.unitPrice"
|
||||
placeholder="请输入单价"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="总金额" prop="amount">
|
||||
<el-input
|
||||
v-model="queryParams.amount"
|
||||
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"
|
||||
>新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="el-icon-edit"
|
||||
size="mini"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
>修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="el-icon-download"
|
||||
size="mini"
|
||||
@click="handleExport"
|
||||
>导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="prodDetailList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="主键ID" align="center" prop="detailId" v-if="true"/>
|
||||
<el-table-column label="生产月报ID" align="center" prop="reportId" />
|
||||
<el-table-column label="班次 1=甲班 2=乙班" align="center" prop="shift" />
|
||||
<el-table-column label="日期" align="center" prop="detailDate" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.detailDate, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="成本项目ID" align="center" prop="itemId" />
|
||||
<el-table-column label="消耗用量" align="center" prop="quantity" />
|
||||
<el-table-column label="单价" align="center" prop="unitPrice" />
|
||||
<el-table-column label="总金额" align="center" prop="amount" />
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<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)"
|
||||
>修改</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
>删除</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>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="生产月报ID" prop="reportId">
|
||||
<el-input v-model="form.reportId" placeholder="请输入生产月报ID" />
|
||||
</el-form-item>
|
||||
<el-form-item label="班次 1=甲班 2=乙班" prop="shift">
|
||||
<el-input v-model="form.shift" placeholder="请输入班次 1=甲班 2=乙班" />
|
||||
</el-form-item>
|
||||
<el-form-item label="日期" prop="detailDate">
|
||||
<el-date-picker clearable
|
||||
v-model="form.detailDate"
|
||||
type="datetime"
|
||||
value-format="yyyy-MM-dd HH:mm:ss"
|
||||
placeholder="请选择日期">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="成本项目ID" prop="itemId">
|
||||
<el-input v-model="form.itemId" placeholder="请输入成本项目ID" />
|
||||
</el-form-item>
|
||||
<el-form-item label="消耗用量" prop="quantity">
|
||||
<el-input v-model="form.quantity" placeholder="请输入消耗用量" />
|
||||
</el-form-item>
|
||||
<el-form-item label="单价" prop="unitPrice">
|
||||
<el-input v-model="form.unitPrice" placeholder="请输入单价" />
|
||||
</el-form-item>
|
||||
<el-form-item label="总金额" prop="amount">
|
||||
<el-input v-model="form.amount" placeholder="请输入总金额" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listProdDetail, getProdDetail, delProdDetail, addProdDetail, updateProdDetail } from "@/api/cost/prodDetail";
|
||||
|
||||
export default {
|
||||
name: "ProdDetail",
|
||||
data() {
|
||||
return {
|
||||
// 按钮loading
|
||||
buttonLoading: false,
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 生产成本明细表格数据
|
||||
prodDetailList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
reportId: undefined,
|
||||
shift: undefined,
|
||||
detailDate: undefined,
|
||||
itemId: undefined,
|
||||
quantity: undefined,
|
||||
unitPrice: undefined,
|
||||
amount: undefined,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询生产成本明细列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listProdDetail(this.queryParams).then(response => {
|
||||
this.prodDetailList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
detailId: undefined,
|
||||
reportId: undefined,
|
||||
shift: undefined,
|
||||
detailDate: undefined,
|
||||
itemId: undefined,
|
||||
quantity: undefined,
|
||||
unitPrice: undefined,
|
||||
amount: undefined,
|
||||
remark: undefined,
|
||||
delFlag: undefined,
|
||||
createBy: undefined,
|
||||
createTime: undefined,
|
||||
updateBy: undefined,
|
||||
updateTime: undefined
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.detailId)
|
||||
this.single = selection.length!==1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加生产成本明细";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.loading = true;
|
||||
this.reset();
|
||||
const detailId = row.detailId || this.ids
|
||||
getProdDetail(detailId).then(response => {
|
||||
this.loading = false;
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改生产成本明细";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
this.buttonLoading = true;
|
||||
if (this.form.detailId != null) {
|
||||
updateProdDetail(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
}).finally(() => {
|
||||
this.buttonLoading = false;
|
||||
});
|
||||
} else {
|
||||
addProdDetail(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
}).finally(() => {
|
||||
this.buttonLoading = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const detailIds = row.detailId || this.ids;
|
||||
this.$modal.confirm('是否确认删除生产成本明细编号为"' + detailIds + '"的数据项?').then(() => {
|
||||
this.loading = true;
|
||||
return delProdDetail(detailIds);
|
||||
}).then(() => {
|
||||
this.loading = false;
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('cost/prodDetail/export', {
|
||||
...this.queryParams
|
||||
}, `prodDetail_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
317
klp-ui/src/views/cost/index.vue
Normal file
317
klp-ui/src/views/cost/index.vue
Normal file
@@ -0,0 +1,317 @@
|
||||
<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="reportTitle">
|
||||
<el-input
|
||||
v-model="queryParams.reportTitle"
|
||||
placeholder="请输入报表标题"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="报表日期" prop="reportDate">
|
||||
<el-date-picker clearable
|
||||
v-model="queryParams.reportDate"
|
||||
type="date"
|
||||
value-format="yyyy-MM-dd"
|
||||
placeholder="请选择报表日期">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="投入量 单位:吨" prop="inputWeight">
|
||||
<el-input
|
||||
v-model="queryParams.inputWeight"
|
||||
placeholder="请输入投入量 单位:吨"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="产出量 单位:吨" prop="outputWeight">
|
||||
<el-input
|
||||
v-model="queryParams.outputWeight"
|
||||
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"
|
||||
>新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="el-icon-edit"
|
||||
size="mini"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
>修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="el-icon-download"
|
||||
size="mini"
|
||||
@click="handleExport"
|
||||
>导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="prodReportList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="主键ID" align="center" prop="reportId" v-if="true"/>
|
||||
<el-table-column label="报表标题" align="center" prop="reportTitle" />
|
||||
<el-table-column label="报表日期" align="center" prop="reportDate" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.reportDate, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="产线类型 acid=酸轧 galvanized=镀锌" align="center" prop="lineType" />
|
||||
<el-table-column label="投入量 单位:吨" align="center" prop="inputWeight" />
|
||||
<el-table-column label="产出量 单位:吨" align="center" prop="outputWeight" />
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<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)"
|
||||
>修改</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
>删除</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>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="报表标题" prop="reportTitle">
|
||||
<el-input v-model="form.reportTitle" placeholder="请输入报表标题" />
|
||||
</el-form-item>
|
||||
<el-form-item label="报表日期" prop="reportDate">
|
||||
<el-date-picker clearable
|
||||
v-model="form.reportDate"
|
||||
type="datetime"
|
||||
value-format="yyyy-MM-dd HH:mm:ss"
|
||||
placeholder="请选择报表日期">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="投入量 单位:吨" prop="inputWeight">
|
||||
<el-input v-model="form.inputWeight" placeholder="请输入投入量 单位:吨" />
|
||||
</el-form-item>
|
||||
<el-form-item label="产出量 单位:吨" prop="outputWeight">
|
||||
<el-input v-model="form.outputWeight" placeholder="请输入产出量 单位:吨" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listProdReport, getProdReport, delProdReport, addProdReport, updateProdReport } from "@/api/cost/prodReport";
|
||||
|
||||
export default {
|
||||
name: "ProdReport",
|
||||
data() {
|
||||
return {
|
||||
// 按钮loading
|
||||
buttonLoading: false,
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 生产月报表格数据
|
||||
prodReportList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
reportTitle: undefined,
|
||||
reportDate: undefined,
|
||||
lineType: undefined,
|
||||
inputWeight: undefined,
|
||||
outputWeight: undefined,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询生产月报列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listProdReport(this.queryParams).then(response => {
|
||||
this.prodReportList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
reportId: undefined,
|
||||
reportTitle: undefined,
|
||||
reportDate: undefined,
|
||||
lineType: undefined,
|
||||
inputWeight: undefined,
|
||||
outputWeight: undefined,
|
||||
remark: undefined,
|
||||
delFlag: undefined,
|
||||
createBy: undefined,
|
||||
createTime: undefined,
|
||||
updateBy: undefined,
|
||||
updateTime: undefined
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
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.reset();
|
||||
this.open = true;
|
||||
this.title = "添加生产月报";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.loading = true;
|
||||
this.reset();
|
||||
const reportId = row.reportId || this.ids
|
||||
getProdReport(reportId).then(response => {
|
||||
this.loading = false;
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改生产月报";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
this.buttonLoading = true;
|
||||
if (this.form.reportId != null) {
|
||||
updateProdReport(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
}).finally(() => {
|
||||
this.buttonLoading = false;
|
||||
});
|
||||
} else {
|
||||
addProdReport(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
}).finally(() => {
|
||||
this.buttonLoading = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const reportIds = row.reportId || this.ids;
|
||||
this.$modal.confirm('是否确认删除生产月报编号为"' + reportIds + '"的数据项?').then(() => {
|
||||
this.loading = true;
|
||||
return delProdReport(reportIds);
|
||||
}).then(() => {
|
||||
this.loading = false;
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('cost/prodReport/export', {
|
||||
...this.queryParams
|
||||
}, `prodReport_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
305
klp-ui/src/views/cost/item.vue
Normal file
305
klp-ui/src/views/cost/item.vue
Normal file
@@ -0,0 +1,305 @@
|
||||
<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="itemCode">
|
||||
<el-input
|
||||
v-model="queryParams.itemCode"
|
||||
placeholder="请输入成本项目编码"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="成本项目名称" prop="itemName">
|
||||
<el-input
|
||||
v-model="queryParams.itemName"
|
||||
placeholder="请输入成本项目名称"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="成本分类 原料/能耗/辅料/设备/人工" prop="category">
|
||||
<el-input
|
||||
v-model="queryParams.category"
|
||||
placeholder="请输入成本分类 原料/能耗/辅料/设备/人工"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="计量单位" prop="unit">
|
||||
<el-input
|
||||
v-model="queryParams.unit"
|
||||
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"
|
||||
>新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="el-icon-edit"
|
||||
size="mini"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
>修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="el-icon-download"
|
||||
size="mini"
|
||||
@click="handleExport"
|
||||
>导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="itemList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="主键ID" align="center" prop="itemId" v-if="true"/>
|
||||
<el-table-column label="成本项目编码" align="center" prop="itemCode" />
|
||||
<el-table-column label="成本项目名称" align="center" prop="itemName" />
|
||||
<el-table-column label="成本分类 原料/能耗/辅料/设备/人工" align="center" prop="category" />
|
||||
<el-table-column label="计量单位" align="center" prop="unit" />
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<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)"
|
||||
>修改</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
>删除</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>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="成本项目编码" prop="itemCode">
|
||||
<el-input v-model="form.itemCode" placeholder="请输入成本项目编码" />
|
||||
</el-form-item>
|
||||
<el-form-item label="成本项目名称" prop="itemName">
|
||||
<el-input v-model="form.itemName" placeholder="请输入成本项目名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="成本分类 原料/能耗/辅料/设备/人工" prop="category">
|
||||
<el-input v-model="form.category" placeholder="请输入成本分类 原料/能耗/辅料/设备/人工" />
|
||||
</el-form-item>
|
||||
<el-form-item label="计量单位" prop="unit">
|
||||
<el-input v-model="form.unit" placeholder="请输入计量单位" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listItem, getItem, delItem, addItem, updateItem } from "@/api/cost/item";
|
||||
|
||||
export default {
|
||||
name: "Item",
|
||||
data() {
|
||||
return {
|
||||
// 按钮loading
|
||||
buttonLoading: false,
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 成本项目配置表格数据
|
||||
itemList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
itemCode: undefined,
|
||||
itemName: undefined,
|
||||
category: undefined,
|
||||
unit: undefined,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询成本项目配置列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listItem(this.queryParams).then(response => {
|
||||
this.itemList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
itemId: undefined,
|
||||
itemCode: undefined,
|
||||
itemName: undefined,
|
||||
category: undefined,
|
||||
unit: undefined,
|
||||
remark: undefined,
|
||||
delFlag: undefined,
|
||||
createBy: undefined,
|
||||
createTime: undefined,
|
||||
updateBy: undefined,
|
||||
updateTime: undefined
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.itemId)
|
||||
this.single = selection.length!==1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加成本项目配置";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.loading = true;
|
||||
this.reset();
|
||||
const itemId = row.itemId || this.ids
|
||||
getItem(itemId).then(response => {
|
||||
this.loading = false;
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改成本项目配置";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
this.buttonLoading = true;
|
||||
if (this.form.itemId != null) {
|
||||
updateItem(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
}).finally(() => {
|
||||
this.buttonLoading = false;
|
||||
});
|
||||
} else {
|
||||
addItem(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
}).finally(() => {
|
||||
this.buttonLoading = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const itemIds = row.itemId || this.ids;
|
||||
this.$modal.confirm('是否确认删除成本项目配置编号为"' + itemIds + '"的数据项?').then(() => {
|
||||
this.loading = true;
|
||||
return delItem(itemIds);
|
||||
}).then(() => {
|
||||
this.loading = false;
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('cost/item/export', {
|
||||
...this.queryParams
|
||||
}, `item_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
319
klp-ui/src/views/cost/metric.vue
Normal file
319
klp-ui/src/views/cost/metric.vue
Normal file
@@ -0,0 +1,319 @@
|
||||
<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="生产日报ID" prop="reportId">
|
||||
<el-input
|
||||
v-model="queryParams.reportId"
|
||||
placeholder="请输入生产日报ID"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="指标编码" prop="metricCode">
|
||||
<el-input
|
||||
v-model="queryParams.metricCode"
|
||||
placeholder="请输入指标编码"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="指标名称" prop="metricName">
|
||||
<el-input
|
||||
v-model="queryParams.metricName"
|
||||
placeholder="请输入指标名称"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="指标计算公式" prop="metricFormula">
|
||||
<el-input
|
||||
v-model="queryParams.metricFormula"
|
||||
placeholder="请输入指标计算公式"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="指标计算结果值" prop="metricValue">
|
||||
<el-input
|
||||
v-model="queryParams.metricValue"
|
||||
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"
|
||||
>新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="el-icon-edit"
|
||||
size="mini"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
>修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="el-icon-download"
|
||||
size="mini"
|
||||
@click="handleExport"
|
||||
>导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="prodMetricList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="主键ID" align="center" prop="metricId" v-if="true"/>
|
||||
<el-table-column label="生产日报ID" align="center" prop="reportId" />
|
||||
<el-table-column label="指标编码" align="center" prop="metricCode" />
|
||||
<el-table-column label="指标名称" align="center" prop="metricName" />
|
||||
<el-table-column label="指标计算公式" align="center" prop="metricFormula" />
|
||||
<el-table-column label="指标计算结果值" align="center" prop="metricValue" />
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<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)"
|
||||
>修改</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
>删除</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>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="生产日报ID" prop="reportId">
|
||||
<el-input v-model="form.reportId" placeholder="请输入生产日报ID" />
|
||||
</el-form-item>
|
||||
<el-form-item label="指标编码" prop="metricCode">
|
||||
<el-input v-model="form.metricCode" type="textarea" placeholder="请输入内容" />
|
||||
</el-form-item>
|
||||
<el-form-item label="指标名称" prop="metricName">
|
||||
<el-input v-model="form.metricName" placeholder="请输入指标名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="指标计算公式" prop="metricFormula">
|
||||
<el-input v-model="form.metricFormula" type="textarea" placeholder="请输入内容" />
|
||||
</el-form-item>
|
||||
<el-form-item label="指标计算结果值" prop="metricValue">
|
||||
<el-input v-model="form.metricValue" placeholder="请输入指标计算结果值" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listProdMetric, getProdMetric, delProdMetric, addProdMetric, updateProdMetric } from "@/api/cost/prodMetric";
|
||||
|
||||
export default {
|
||||
name: "ProdMetric",
|
||||
data() {
|
||||
return {
|
||||
// 按钮loading
|
||||
buttonLoading: false,
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 生产指标明细表格数据
|
||||
prodMetricList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
reportId: undefined,
|
||||
metricCode: undefined,
|
||||
metricName: undefined,
|
||||
metricFormula: undefined,
|
||||
metricValue: undefined,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询生产指标明细列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listProdMetric(this.queryParams).then(response => {
|
||||
this.prodMetricList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
metricId: undefined,
|
||||
reportId: undefined,
|
||||
metricCode: undefined,
|
||||
metricName: undefined,
|
||||
metricFormula: undefined,
|
||||
metricValue: undefined,
|
||||
remark: undefined,
|
||||
delFlag: undefined,
|
||||
createBy: undefined,
|
||||
createTime: undefined,
|
||||
updateBy: undefined,
|
||||
updateTime: undefined
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.metricId)
|
||||
this.single = selection.length!==1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加生产指标明细";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.loading = true;
|
||||
this.reset();
|
||||
const metricId = row.metricId || this.ids
|
||||
getProdMetric(metricId).then(response => {
|
||||
this.loading = false;
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改生产指标明细";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
this.buttonLoading = true;
|
||||
if (this.form.metricId != null) {
|
||||
updateProdMetric(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
}).finally(() => {
|
||||
this.buttonLoading = false;
|
||||
});
|
||||
} else {
|
||||
addProdMetric(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
}).finally(() => {
|
||||
this.buttonLoading = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const metricIds = row.metricId || this.ids;
|
||||
this.$modal.confirm('是否确认删除生产指标明细编号为"' + metricIds + '"的数据项?').then(() => {
|
||||
this.loading = true;
|
||||
return delProdMetric(metricIds);
|
||||
}).then(() => {
|
||||
this.loading = false;
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('cost/prodMetric/export', {
|
||||
...this.queryParams
|
||||
}, `prodMetric_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
300
klp-ui/src/views/cost/price.vue
Normal file
300
klp-ui/src/views/cost/price.vue
Normal file
@@ -0,0 +1,300 @@
|
||||
<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="成本项目ID" prop="itemId">
|
||||
<el-input
|
||||
v-model="queryParams.itemId"
|
||||
placeholder="请输入成本项目ID"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="单价" prop="price">
|
||||
<el-input
|
||||
v-model="queryParams.price"
|
||||
placeholder="请输入单价"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="生效日期" prop="effectiveDate">
|
||||
<el-date-picker clearable
|
||||
v-model="queryParams.effectiveDate"
|
||||
type="date"
|
||||
value-format="yyyy-MM-dd"
|
||||
placeholder="请选择生效日期">
|
||||
</el-date-picker>
|
||||
</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"
|
||||
>新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="el-icon-edit"
|
||||
size="mini"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
>修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="el-icon-download"
|
||||
size="mini"
|
||||
@click="handleExport"
|
||||
>导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="priceList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="主键ID" align="center" prop="priceId" v-if="true"/>
|
||||
<el-table-column label="成本项目ID" align="center" prop="itemId" />
|
||||
<el-table-column label="单价" align="center" prop="price" />
|
||||
<el-table-column label="生效日期" align="center" prop="effectiveDate" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.effectiveDate, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<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)"
|
||||
>修改</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
>删除</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>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="成本项目ID" prop="itemId">
|
||||
<el-input v-model="form.itemId" placeholder="请输入成本项目ID" />
|
||||
</el-form-item>
|
||||
<el-form-item label="单价" prop="price">
|
||||
<el-input v-model="form.price" placeholder="请输入单价" />
|
||||
</el-form-item>
|
||||
<el-form-item label="生效日期" prop="effectiveDate">
|
||||
<el-date-picker clearable
|
||||
v-model="form.effectiveDate"
|
||||
type="datetime"
|
||||
value-format="yyyy-MM-dd HH:mm:ss"
|
||||
placeholder="请选择生效日期">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listPrice, getPrice, delPrice, addPrice, updatePrice } from "@/api/cost/price";
|
||||
|
||||
export default {
|
||||
name: "Price",
|
||||
data() {
|
||||
return {
|
||||
// 按钮loading
|
||||
buttonLoading: false,
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 成本单价历史表格数据
|
||||
priceList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
itemId: undefined,
|
||||
price: undefined,
|
||||
effectiveDate: undefined,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询成本单价历史列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listPrice(this.queryParams).then(response => {
|
||||
this.priceList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
priceId: undefined,
|
||||
itemId: undefined,
|
||||
price: undefined,
|
||||
effectiveDate: undefined,
|
||||
remark: undefined,
|
||||
delFlag: undefined,
|
||||
createBy: undefined,
|
||||
createTime: undefined,
|
||||
updateBy: undefined,
|
||||
updateTime: undefined
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.priceId)
|
||||
this.single = selection.length!==1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加成本单价历史";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.loading = true;
|
||||
this.reset();
|
||||
const priceId = row.priceId || this.ids
|
||||
getPrice(priceId).then(response => {
|
||||
this.loading = false;
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改成本单价历史";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
this.buttonLoading = true;
|
||||
if (this.form.priceId != null) {
|
||||
updatePrice(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
}).finally(() => {
|
||||
this.buttonLoading = false;
|
||||
});
|
||||
} else {
|
||||
addPrice(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
}).finally(() => {
|
||||
this.buttonLoading = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const priceIds = row.priceId || this.ids;
|
||||
this.$modal.confirm('是否确认删除成本单价历史编号为"' + priceIds + '"的数据项?').then(() => {
|
||||
this.loading = true;
|
||||
return delPrice(priceIds);
|
||||
}).then(() => {
|
||||
this.loading = false;
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('cost/price/export', {
|
||||
...this.queryParams
|
||||
}, `price_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
@@ -12,6 +12,14 @@
|
||||
<el-button type="warning" plain icon="el-icon-download" @click="handleExport">导出</el-button>
|
||||
</div>
|
||||
|
||||
<div class="dept-filter-section" v-if="departmentList.length > 0">
|
||||
<el-radio-group v-model="selectedDept" @change="handleDeptChange">
|
||||
<el-radio-button v-for="item in departmentList" :key="item.deptName" :label="item.deptName">
|
||||
{{ item.deptName }}({{ item.count }}人)
|
||||
</el-radio-button>
|
||||
</el-radio-group>
|
||||
</div>
|
||||
|
||||
<el-alert type="info" title="提示:双击单元格可查看考勤详情或调整考勤结果"></el-alert>
|
||||
|
||||
<div class="schedule-table-wrapper">
|
||||
@@ -350,13 +358,25 @@
|
||||
<el-table-column prop="endTime" label="结束时间" width="150" />
|
||||
<el-table-column prop="outHours" label="时长(小时)" width="100" />
|
||||
<el-table-column prop="outPlace" label="地点" />
|
||||
<el-table-column prop="approvalStatus" label="状态" width="100">
|
||||
<el-table-column prop="approvalStatus" label="状态" width="100">
|
||||
<template slot-scope="scope">
|
||||
<span :class="getApprovalStatusClass(scope.row.approvalStatus)">{{ getApprovalStatusText(scope.row.approvalStatus) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<!-- 打卡记录(不分页) -->
|
||||
<el-divider content-position="left">打卡记录</el-divider>
|
||||
<el-table v-loading="detailRecordsLoading" :data="detailRecordsList" border stripe size="small">
|
||||
<el-table-column prop="ename" label="姓名" width="100" />
|
||||
<el-table-column prop="deptname" label="部门" />
|
||||
<el-table-column prop="checktime" label="打卡时间">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ scope.row.checktime }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button v-if="!isEdit" type="primary" @click="handleEdit">编辑</el-button>
|
||||
<el-button v-if="isEdit" @click="cancelEdit">取消</el-button>
|
||||
@@ -365,7 +385,7 @@
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog title="考勤比对" :visible.sync="checkOpen" width="400px" append-to-body>
|
||||
<el-dialog title="考勤比对" :visible.sync="checkOpen" width="700px" append-to-body>
|
||||
<el-form ref="checkForm" :model="checkForm" :rules="checkRules" label-width="80px">
|
||||
<el-form-item label="开始日期" prop="startDate">
|
||||
<el-date-picker
|
||||
@@ -383,6 +403,16 @@
|
||||
placeholder="请选择结束日期">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="选择员工" prop="userIds">
|
||||
<el-transfer
|
||||
v-model="selectedUserIds"
|
||||
:data="transferData"
|
||||
:titles="['待选员工', '已选员工']"
|
||||
filterable
|
||||
filter-placeholder="请输入员工姓名">
|
||||
<span slot-scope="{ option }">{{ option.label }}</span>
|
||||
</el-transfer>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button :loading="checkLoading" type="primary" @click="submitCheck">确 定</el-button>
|
||||
@@ -397,6 +427,8 @@ import { listAttendanceCheck, getAttendanceCheck, delAttendanceCheck, generateAt
|
||||
import TimeRangePicker from "@/views/wms/report/components/timeRangePicker";
|
||||
import { listOutRequest } from "@/api/wms/outRequest";
|
||||
import { listLeaveRequest } from "@/api/wms/leaveRequest";
|
||||
import { listEmployeeInfo } from "@/api/wms/employeeInfo";
|
||||
import { listRecords } from "@/api/wms/attendance";
|
||||
import dayjs from "dayjs";
|
||||
|
||||
export default {
|
||||
@@ -406,7 +438,7 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
loading: true,
|
||||
checkLoading: false,
|
||||
showSearch: true,
|
||||
attendanceData: [],
|
||||
@@ -461,11 +493,30 @@ export default {
|
||||
detailOutList: [],
|
||||
detailOutQuery: {
|
||||
applicantName: ''
|
||||
}
|
||||
},
|
||||
|
||||
allEmployees: [],
|
||||
departmentList: [],
|
||||
selectedDept: '',
|
||||
currentDeptEmployeeIds: '',
|
||||
selectedUserIds: [],
|
||||
|
||||
detailRecordsLoading: false,
|
||||
detailRecordsList: []
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
transferData() {
|
||||
return this.allEmployees.map(emp => ({
|
||||
key: emp.infoId,
|
||||
label: emp.name + '(' + emp.dept + ')'
|
||||
}))
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.initDateRange();
|
||||
this.getAllEmployees().then(() => {
|
||||
this.initDateRange();
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
initDateRange() {
|
||||
@@ -487,6 +538,38 @@ export default {
|
||||
this.getOutList()
|
||||
},
|
||||
|
||||
getAllEmployees() {
|
||||
return listEmployeeInfo({
|
||||
pageNum: 1,
|
||||
pageSize: 10000
|
||||
}).then(res => {
|
||||
this.allEmployees = res.rows || []
|
||||
const deptMap = {}
|
||||
this.allEmployees.forEach(emp => {
|
||||
const deptName = emp.dept || '未分配部门'
|
||||
if (!deptMap[deptName]) {
|
||||
deptMap[deptName] = []
|
||||
}
|
||||
deptMap[deptName].push(emp.infoId)
|
||||
})
|
||||
this.departmentList = Object.keys(deptMap).map(deptName => ({
|
||||
deptName,
|
||||
count: deptMap[deptName].length,
|
||||
empIds: deptMap[deptName].join(',')
|
||||
}))
|
||||
if (this.departmentList.length > 0) {
|
||||
this.selectedDept = this.departmentList[0].deptName
|
||||
this.currentDeptEmployeeIds = this.departmentList[0].empIds
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
handleDeptChange(deptName) {
|
||||
const dept = this.departmentList.find(d => d.deptName === deptName)
|
||||
this.currentDeptEmployeeIds = dept ? dept.empIds : ''
|
||||
this.getList()
|
||||
},
|
||||
|
||||
formatDate(date) {
|
||||
const year = date.getFullYear()
|
||||
const month = (date.getMonth() + 1).toString().padStart(2, '0')
|
||||
@@ -546,7 +629,11 @@ export default {
|
||||
|
||||
getList() {
|
||||
this.loading = true
|
||||
listAttendanceCheck(this.dateRangeParams).then(response => {
|
||||
const params = {
|
||||
...this.dateRangeParams,
|
||||
userIds: this.currentDeptEmployeeIds.split(',')
|
||||
}
|
||||
listAttendanceCheck(params).then(response => {
|
||||
this.attendanceData = this.transformData(response.rows || [])
|
||||
this.loading = false
|
||||
}).catch(() => {
|
||||
@@ -616,6 +703,22 @@ export default {
|
||||
})
|
||||
},
|
||||
|
||||
getDetailRecords(ename, date) {
|
||||
this.detailRecordsLoading = true
|
||||
listRecords({
|
||||
pageNum: 1,
|
||||
pageSize: 100,
|
||||
ename,
|
||||
checktimeStart: date + ' 00:00:00',
|
||||
checktimeEnd: date + ' 23:59:59'
|
||||
}).then(response => {
|
||||
this.detailRecordsList = response.rows || []
|
||||
this.detailRecordsLoading = false
|
||||
}).catch(() => {
|
||||
this.detailRecordsLoading = false
|
||||
})
|
||||
},
|
||||
|
||||
transformData(rows) {
|
||||
const dataMap = {}
|
||||
rows.forEach(record => {
|
||||
@@ -717,6 +820,7 @@ export default {
|
||||
this.detailOutQuery.applicantName = row.employeeName
|
||||
this.getDetailLeaveList()
|
||||
this.getDetailOutList()
|
||||
this.getDetailRecords(row.employeeName, date)
|
||||
this.detailDialogVisible = true
|
||||
}
|
||||
},
|
||||
@@ -737,11 +841,13 @@ export default {
|
||||
startDate: this.dateRangeParams.startDate,
|
||||
endDate: this.dateRangeParams.endDate
|
||||
}
|
||||
this.selectedUserIds = this.allEmployees.map(emp => emp.infoId)
|
||||
},
|
||||
|
||||
cancelCheck() {
|
||||
this.checkOpen = false
|
||||
this.checkForm = { startDate: undefined, endDate: undefined }
|
||||
this.selectedUserIds = []
|
||||
this.$refs['checkForm'] && this.$refs['checkForm'].resetFields()
|
||||
},
|
||||
|
||||
@@ -749,7 +855,11 @@ export default {
|
||||
this.$refs["checkForm"].validate(valid => {
|
||||
if (valid) {
|
||||
this.checkLoading = true
|
||||
generateAttendanceCheck(this.checkForm).then(response => {
|
||||
const params = {
|
||||
...this.checkForm,
|
||||
employeeIds: this.selectedUserIds.join(',')
|
||||
}
|
||||
generateAttendanceCheck(params).then(response => {
|
||||
this.$modal.msgSuccess("比对成功")
|
||||
this.checkOpen = false
|
||||
this.dateRangeParams.startDate = this.checkForm.startDate
|
||||
@@ -1048,4 +1158,18 @@ export default {
|
||||
.approval-default {
|
||||
color: #606266;
|
||||
}
|
||||
|
||||
.dept-filter-section {
|
||||
margin-bottom: 20px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.dept-filter-label {
|
||||
font-size: 14px;
|
||||
color: #606266;
|
||||
margin-right: 10px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user