更新自贡 #345

Merged
zwq merged 1 commits from projects/zg-zwq into projects/zg-test 2024-04-22 16:56:43 +08:00
34 changed files with 4163 additions and 79 deletions
Showing only changes of commit 07dd135daa - Show all commits

View File

@ -0,0 +1,34 @@
/*
* @Author: zwq
* @Date: 2024-04-18 16:53:17
* @LastEditors: zwq
* @LastEditTime: 2024-04-19 16:11:19
* @Description:
*/
import request from '@/utils/request'
// 更新原片能源历史
export function updateEnergyHis(data) {
return request({
url: '/monitoring/cost-energy-his/update',
method: 'put',
data: data
})
}
// 获得原片能源历史分页
export function getEnergyHisPage(query) {
return request({
url: '/monitoring/cost-energy-his/page',
method: 'get',
params: query
})
}
// 获得原片能源-成本查询分页
export function getEnergyRealtimePage(query) {
return request({
url: '/monitoring/cost-energy-realtime/page',
method: 'get',
params: query
})
}

View File

@ -0,0 +1,34 @@
/*
* @Author: zwq
* @Date: 2024-04-18 16:53:17
* @LastEditors: zwq
* @LastEditTime: 2024-04-22 14:51:14
* @Description:
*/
import request from '@/utils/request'
// 更新深加工能源历史
export function updateEnergyHis(data) {
return request({
url: '/monitoring/cost-deep-energy-his/update',
method: 'put',
data: data
})
}
// 获得深加工能源历史分页
export function getEnergyHisPage(query) {
return request({
url: '/monitoring/cost-deep-energy-his/page',
method: 'get',
params: query
})
}
// 获得深加工能源-成本查询分页
export function getEnergyRealtimePage(query) {
return request({
url: '/monitoring/cost-deep-energy-realtime/page',
method: 'get',
params: query
})
}

View File

@ -0,0 +1,34 @@
/*
* @Author: zwq
* @Date: 2024-04-18 16:53:17
* @LastEditors: zwq
* @LastEditTime: 2024-04-19 16:12:14
* @Description:
*/
import request from '@/utils/request'
// 更新原料成本-历史
export function updateMaterialHis(data) {
return request({
url: '/monitoring/cost-material-his/update',
method: 'put',
data: data
})
}
// 获得原料成本-历史分页
export function getMaterialHisPage(query) {
return request({
url: '/monitoring/cost-material-his/page',
method: 'get',
params: query
})
}
// 获得原料成本-成本查询分页
export function getMaterialRealtimePage(query) {
return request({
url: '/monitoring/cost-material-realtime/page',
method: 'get',
params: query
})
}

View File

@ -0,0 +1,26 @@
/*
* @Author: zwq
* @Date: 2024-04-18 16:53:17
* @LastEditors: zwq
* @LastEditTime: 2024-04-22 10:53:55
* @Description:
*/
import request from '@/utils/request'
// 更新原片良品率
export function updatecostOriginRatioHis(data) {
return request({
url: '/monitoring/cost-origin-ratio-his/update',
method: 'put',
data: data
})
}
// 获得原片良品率
export function getcostOriginRatioHisPage(query) {
return request({
url: '/monitoring/cost-origin-ratio-his/page',
method: 'get',
params: query
})
}

View File

@ -0,0 +1,34 @@
/*
* @Author: zwq
* @Date: 2024-04-18 16:53:17
* @LastEditors: zwq
* @LastEditTime: 2024-04-19 14:24:17
* @Description:
*/
import request from '@/utils/request'
// 更新原片其他成本-历史
export function updateRawOthercostHis(data) {
return request({
url: '/monitoring/cost-othercost-his/update',
method: 'put',
data: data
})
}
// 获得原片其他成本-历史分页
export function getRawOthercostHisPage(query) {
return request({
url: '/monitoring/cost-othercost-his/page',
method: 'get',
params: query
})
}
// 获得原片其他成本-成本查询分页
export function getRawOthercostSunPage(query) {
return request({
url: '/monitoring/cost-othercost-log/page-sum',
method: 'get',
params: query
})
}

View File

@ -0,0 +1,34 @@
/*
* @Author: zwq
* @Date: 2024-04-18 16:53:17
* @LastEditors: zwq
* @LastEditTime: 2024-04-22 15:15:18
* @Description:
*/
import request from '@/utils/request'
// 更新深加工其他成本-历史
export function updateRawOthercostHis(data) {
return request({
url: '/monitoring/cost-deep-othercost-his/update',
method: 'put',
data: data
})
}
// 获得深加工其他成本-历史分页
export function getRawOthercostHisPage(query) {
return request({
url: '/monitoring/cost-deep-othercost-his/page',
method: 'get',
params: query
})
}
// 获得深加工其他成本-成本查询分页
export function getRawOthercostSunPage(query) {
return request({
url: '/monitoring/cost-deep-othercost-log/page-sum',
method: 'get',
params: query
})
}

View File

@ -0,0 +1,68 @@
/*
* @Author: zwq
* @Date: 2024-04-15 17:01:20
* @LastEditors: zwq
* @LastEditTime: 2024-04-18 15:40:27
* @Description:
*/
import request from '@/utils/request'
// 创建原片其他成本-记录
export function createRawOthercostLog(data) {
return request({
url: '/monitoring/cost-othercost-log/create',
method: 'post',
data: data
})
}
// 更新原片其他成本-记录
export function updateRawOthercostLog(data) {
return request({
url: '/monitoring/cost-othercost-log/update',
method: 'put',
data: data
})
}
// 删除原片其他成本-记录
export function deleteRawOthercostLog(id) {
return request({
url: '/monitoring/cost-othercost-log/delete?id=' + id,
method: 'delete'
})
}
// 获得原片其他成本-记录
export function getRawOthercostLog(id) {
return request({
url: '/monitoring/cost-othercost-log/get?id=' + id,
method: 'get'
})
}
// 获得原片其他成本-记录分页
export function getRawOthercostLogPage(query) {
return request({
url: '/monitoring/cost-othercost-log/page',
method: 'get',
params: query
})
}
// 导出原片其他成本-记录 Excel
export function exportRawOthercostLogExcel(query) {
return request({
url: '/monitoring/cost-othercost-log/export-excel',
method: 'get',
params: query,
responseType: 'blob'
})
}
// 获得所有原片其他成本-记录列表
export function getRawOthercostLogAll() {
return request({
url: '/monitoring/cost-othercost-log/listAll',
method: 'get'
})
}

View File

@ -0,0 +1,68 @@
/*
* @Author: zwq
* @Date: 2024-04-15 17:01:20
* @LastEditors: zwq
* @LastEditTime: 2024-04-22 14:59:35
* @Description:
*/
import request from '@/utils/request'
// 创建深加工其他成本-记录
export function createRawOthercostLog(data) {
return request({
url: '/monitoring/cost-deep-othercost-log/create',
method: 'post',
data: data
})
}
// 更新深加工其他成本-记录
export function updateRawOthercostLog(data) {
return request({
url: '/monitoring/cost-deep-othercost-log/update',
method: 'put',
data: data
})
}
// 删除深加工其他成本-记录
export function deleteRawOthercostLog(id) {
return request({
url: '/monitoring/cost-deep-othercost-log/delete?id=' + id,
method: 'delete'
})
}
// 获得深加工其他成本-记录
export function getRawOthercostLog(id) {
return request({
url: '/monitoring/cost-deep-othercost-log/get?id=' + id,
method: 'get'
})
}
// 获得深加工其他成本-记录分页
export function getRawOthercostLogPage(query) {
return request({
url: '/monitoring/cost-deep-othercost-log/page',
method: 'get',
params: query
})
}
// 导出深加工其他成本-记录 Excel
export function exportRawOthercostLogExcel(query) {
return request({
url: '/monitoring/cost-deep-othercost-log/export-excel',
method: 'get',
params: query,
responseType: 'blob'
})
}
// 获得所有深加工其他成本-记录列表
export function getRawOthercostLogAll() {
return request({
url: '/monitoring/cost-deep-othercost-log/listAll',
method: 'get'
})
}

View File

@ -0,0 +1,68 @@
/*
* @Author: zwq
* @Date: 2024-04-15 17:01:20
* @LastEditors: zwq
* @LastEditTime: 2024-04-22 14:55:00
* @Description:
*/
import request from '@/utils/request'
// 创建深加工其他成本-配置
export function createRawOthercostRule(data) {
return request({
url: '/monitoring/cost-deep-othercost-rule/create',
method: 'post',
data: data
})
}
// 更新深加工其他成本-配置
export function updateRawOthercostRule(data) {
return request({
url: '/monitoring/cost-deep-othercost-rule/update',
method: 'put',
data: data
})
}
// 删除深加工其他成本-配置
export function deleteRawOthercostRule(id) {
return request({
url: '/monitoring/cost-deep-othercost-rule/delete?id=' + id,
method: 'delete'
})
}
// 获得深加工其他成本-配置
export function getRawOthercostRule(id) {
return request({
url: '/monitoring/cost-deep-othercost-rule/get?id=' + id,
method: 'get'
})
}
// 获得深加工其他成本-配置分页
export function getRawOthercostRulePage(query) {
return request({
url: '/monitoring/cost-deep-othercost-rule/page',
method: 'get',
params: query
})
}
// 导出深加工其他成本-配置 Excel
export function exportRawOthercostRuleExcel(query) {
return request({
url: '/monitoring/cost-deep-othercost-rule/export-excel',
method: 'get',
params: query,
responseType: 'blob'
})
}
// 获得所有深加工其他成本-配置列表
export function getRawOthercostRuleAll() {
return request({
url: '/monitoring/cost-deep-othercost-rule/listAll',
method: 'get'
})
}

View File

@ -2,12 +2,12 @@
* @Author: zwq * @Author: zwq
* @Date: 2024-04-15 17:01:20 * @Date: 2024-04-15 17:01:20
* @LastEditors: zwq * @LastEditors: zwq
* @LastEditTime: 2024-04-15 17:05:47 * @LastEditTime: 2024-04-18 15:39:12
* @Description: * @Description:
*/ */
import request from '@/utils/request' import request from '@/utils/request'
// 创建设备 // 创建原片其他成本-配置
export function createRawOthercostRule(data) { export function createRawOthercostRule(data) {
return request({ return request({
url: '/monitoring/cost-othercost-rule/create', url: '/monitoring/cost-othercost-rule/create',
@ -16,7 +16,7 @@ export function createRawOthercostRule(data) {
}) })
} }
// 更新设备 // 更新原片其他成本-配置
export function updateRawOthercostRule(data) { export function updateRawOthercostRule(data) {
return request({ return request({
url: '/monitoring/cost-othercost-rule/update', url: '/monitoring/cost-othercost-rule/update',
@ -25,7 +25,7 @@ export function updateRawOthercostRule(data) {
}) })
} }
// 删除设备 // 删除原片其他成本-配置
export function deleteRawOthercostRule(id) { export function deleteRawOthercostRule(id) {
return request({ return request({
url: '/monitoring/cost-othercost-rule/delete?id=' + id, url: '/monitoring/cost-othercost-rule/delete?id=' + id,
@ -33,7 +33,7 @@ export function deleteRawOthercostRule(id) {
}) })
} }
// 获得设备 // 获得原片其他成本-配置
export function getRawOthercostRule(id) { export function getRawOthercostRule(id) {
return request({ return request({
url: '/monitoring/cost-othercost-rule/get?id=' + id, url: '/monitoring/cost-othercost-rule/get?id=' + id,
@ -41,7 +41,7 @@ export function getRawOthercostRule(id) {
}) })
} }
// 获得设备分页 // 获得原片其他成本-配置分页
export function getRawOthercostRulePage(query) { export function getRawOthercostRulePage(query) {
return request({ return request({
url: '/monitoring/cost-othercost-rule/page', url: '/monitoring/cost-othercost-rule/page',
@ -50,7 +50,7 @@ export function getRawOthercostRulePage(query) {
}) })
} }
// 导出设备 Excel // 导出原片其他成本-配置 Excel
export function exportRawOthercostRuleExcel(query) { export function exportRawOthercostRuleExcel(query) {
return request({ return request({
url: '/monitoring/cost-othercost-rule/export-excel', url: '/monitoring/cost-othercost-rule/export-excel',
@ -59,7 +59,7 @@ export function exportRawOthercostRuleExcel(query) {
responseType: 'blob' responseType: 'blob'
}) })
} }
// 获得所有设备列表 // 获得所有原片其他成本-配置列表
export function getRawOthercostRuleAll() { export function getRawOthercostRuleAll() {
return request({ return request({
url: '/monitoring/cost-othercost-rule/listAll', url: '/monitoring/cost-othercost-rule/listAll',

View File

@ -0,0 +1,113 @@
<!--
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: zwq
* @LastEditTime: 2024-04-22 14:51:30
* @Description:
-->
<template>
<el-form
:model="dataForm"
:rules="dataRule"
ref="dataForm"
@keyup.enter.native="dataFormSubmit()"
label-width="80px">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="能源类型" prop="energyTypeName">
<el-input
v-model="dataForm.energyTypeName"
disabled
placeholder="请输入能源类型" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="日期" prop="recTime">
<el-date-picker
v-model="dataForm.recTime"
type="date"
value-format="timestamp"
:style="{ width: '100%' }"
readonly
placeholder="选择日期"></el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="总价" prop="price">
<el-input-number
:min="0"
style="width: 80%"
v-model="dataForm.price"
clearable
placeholder="请输入总价" />
()
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="累计用量" prop="quantity">
<el-input-number
:min="0"
style="width: 100%"
v-model="dataForm.quantity"
clearable
placeholder="请输入累计用量" />
</el-form-item>
</el-col>
</el-row>
</el-form>
</template>
<script>
import basicAdd from '@/mixins/basic-add';
import { updateEnergyHis } from '@/api/cost/costEnergyDeep';
export default {
mixins: [basicAdd],
data() {
return {
urlOptions: {
updateURL: updateEnergyHis,
},
dataForm: {
id: undefined,
price: undefined,
quantity: undefined,
energyTypeName: undefined,
recTime: undefined,
},
dataRule: {
price: [{ required: true, message: '总价不能为空', trigger: 'blur' }],
quantity: [
{ required: true, message: '累计用量不能为空', trigger: 'blur' },
],
},
};
},
methods: {
init(val, statisticType) {
this.visible = true;
this.$nextTick(() => {
this.$refs['dataForm'].resetFields();
this.dataForm = JSON.parse(JSON.stringify(val));
this.dataForm.statisticType = statisticType;
});
},
//
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (!valid) {
return false;
}
this.dataForm.modifyPrice = this.dataForm.price;
this.dataForm.modifyQuantity = this.dataForm.quantity;
//
this.urlOptions.updateURL(this.dataForm).then((response) => {
this.$modal.msgSuccess('修改成功');
this.visible = false;
this.$emit('refreshDataList');
});
});
},
},
};
</script>

View File

@ -0,0 +1,347 @@
<template>
<div class="app-container energyOverlimitLog">
<div v-show="activeName === 'his'">
<!-- 搜索工作栏 -->
<search-bar
:formConfigs="formConfig"
ref="searchBarForm"
@headBtnClick="buttonClick" />
</div>
<div v-show="activeName === 'now'">
<!-- 搜索工作栏 -->
<search-bar
:formConfigs="formConfig2"
ref="searchBarForm2"
@headBtnClick="buttonClick" />
</div>
<el-tabs v-model="activeName" @tab-click="toggleTab">
<el-tab-pane label="历史成本" name="his"></el-tab-pane>
<el-tab-pane label="成本查询" name="now"></el-tab-pane>
</el-tabs>
<!-- 列表 -->
<div v-if="activeName === 'his'">
<base-table
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-props="tableProps"
:table-data="tableData"
:max-height="tableH">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="80"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick" />
</base-table>
</div>
<div v-if="activeName === 'now'">
<base-table
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-props="tableProps2"
:table-data="tableData2"
:max-height="tableH" />
</div>
<pagination
:page.sync="listQuery.pageNo"
:limit.sync="listQuery.pageSize"
:total="listQuery.total"
@pagination="getDataList" />
<base-dialog
:dialogTitle="addOrEditTitle"
:dialogVisible="addOrUpdateVisible"
@cancel="handleCancel"
@confirm="handleConfirm"
:before-close="handleCancel"
width="50%">
<add-or-update
ref="addOrUpdate"
@refreshDataList="successSubmit"></add-or-update>
</base-dialog>
</div>
</template>
<script>
import AddOrUpdate from './add-or-updata';
import basicPage from '@/mixins/basic-page';
import { getEnergyTypePage } from '@/api/base/energyType';
import { getEnergyHisPage, getEnergyRealtimePage } from '@/api/cost/costEnergyDeep';
import { parseTime } from '@/filter/code-filter';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
const tableProps = [
{
prop: 'recTime',
label: '日期',
filter: (val) => parseTime(val, '{y}年{m}月{d}日'),
},
{
prop: 'energyTypeName',
label: '能源类型',
},
{
prop: 'bindObjectName',
label: '监控对象',
filter: (val) => (val != null ? val : '--'),
},
{
prop: 'meterName',
label: '抄表名',
filter: (val) => (val != null ? val : '--'),
},
{
prop: 'quantity',
label: '累计使用量',
},
{
prop: 'price',
label: '总价(元)',
align: 'right',
},
];
const tableProps2 = [
{
prop: 'energyTypeName',
label: '能源类型',
},
{
prop: 'bindObjectName',
label: '监控对象',
filter: (val) => (val != null ? val : '--'),
},
{
prop: 'meter',
label: '抄表名',
filter: (val) => (val != null ? val : '--'),
},
{
prop: 'quantity',
label: '累计使用量',
},
{
prop: 'price',
label: '总价(元)',
align: 'right',
},
];
export default {
name: 'costEnergy',
mixins: [basicPage, tableHeightMixin],
data() {
return {
urlOptions: {
getDataListURL: getEnergyHisPage,
},
formConfig: [
{
type: 'select',
label: '维度',
selectOptions: [
{ id: 1, name: '日' },
{ id: 2, name: '周' },
{ id: 3, name: '月' },
],
param: 'statisticType',
defaultSelect: 1, // ,
clearable: false,
},
{
type: 'select',
label: '能源类型',
selectOptions: [],
param: 'name',
labelField: 'name',
filterable: true,
},
{
type: 'datePicker',
label: '时间范围',
dateType: 'daterange',
format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd HH:mm:ss',
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
param: 'searchTime',
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
],
formConfig2: [
{
type: 'select',
label: '能源类型',
selectOptions: [],
param: 'name',
labelField: 'name',
filterable: true,
},
{
type: 'datePicker',
label: '时间范围',
dateType: 'daterange',
format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd HH:mm:ss',
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
param: 'searchTime',
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
],
listQuery: {
statisticType: 1,
},
activeName: 'his',
tableProps,
tableProps2,
tableBtn: [
this.$auth.hasPermi(`monitoring:cost-deep-energy-his:update`)
? {
type: 'edit',
btnName: '编辑',
}
: undefined,
].filter((v) => v),
tableData: [],
tableData2: [],
};
},
components: {
AddOrUpdate,
},
created() {
const params = {
pageNo: 1,
pageSize: 100,
};
getEnergyTypePage(params).then((response) => {
this.formConfig[1].selectOptions = response.data.list;
this.formConfig2[0].selectOptions = response.data.list;
});
},
methods: {
buttonClick(val) {
switch (val.btnName) {
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.energyTypeId = val.name || null;
this.listQuery.statisticType = val.statisticType || 1;
this.listQuery.startTime = val.searchTime ? val.searchTime[0] : null;
this.listQuery.endTime = val.searchTime
? val.searchTime[1].substr(0, 10) + ' 23:59:59'
: null;
if (this.activeName === 'his') {
this.getDataList();
} else {
this.getDataList2();
}
break;
case 'add':
this.addOrUpdateHandle();
break;
case 'export':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.energyTypeId = val.name;
this.listQuery.startTime = val.searchTime ? val.searchTime[0] : null;
this.listQuery.endTime = val.searchTime
? val.searchTime[1].substr(0, 10) + ' 23:59:59'
: null;
this.handleExport();
break;
default:
console.log(val);
}
},
toggleTab() {
if (this.activeName === 'his') {
this.$refs.searchBarForm.resetForm();
this.listQuery.name = null;
this.listQuery.startTime = null;
this.listQuery.endTime = null;
this.listQuery.statisticType = 1;
this.listQuery.pageNo = 1;
this.getDataList();
} else {
this.$refs.searchBarForm2.resetForm();
this.listQuery.name = null;
this.listQuery.startTime = null;
this.listQuery.endTime = null;
this.listQuery.pageNo = 1;
this.getDataList2();
}
},
// 2
getDataList2() {
if (this.listQuery.startTime) {
getEnergyRealtimePage(this.listQuery).then((response) => {
this.tableData2 = response.data.list;
this.listQuery.total = response.data.total;
});
} else {
this.$message.warning('请选择时间范围');
}
},
//tableBtn
handleClick(val) {
if (val.type === 'edit') {
this.addOrUpdateVisible = true;
this.addOrEditTitle = '编辑';
this.$nextTick(() => {
this.$refs.addOrUpdate.init(val.data, this.listQuery.statisticType);
});
} else {
this.otherMethods(val);
}
},
},
};
</script>
<style lang="scss">
.energyOverlimitLog {
.el-tabs__nav::after {
content: '';
position: absolute;
left: 0;
bottom: 0;
width: 100%;
height: 2px;
background-color: #e4e7ed;
}
.el-tabs__nav-wrap::after {
width: 0;
}
.el-tabs__item {
padding: 0 10px;
}
.el-tabs__item:hover {
color: rgba(0, 0, 0, 0.85);
}
.el-tabs__item.is-active {
color: rgba(0, 0, 0, 0.85);
}
.el-tabs__item {
color: rgba(0, 0, 0, 0.45);
}
.searchBarBox {
margin-bottom: 0;
}
}
</style>

View File

@ -0,0 +1,115 @@
<!--
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: zwq
* @LastEditTime: 2024-04-19 16:29:30
* @Description:
-->
<template>
<el-form
:model="dataForm"
:rules="dataRule"
ref="dataForm"
@keyup.enter.native="dataFormSubmit()"
label-width="80px">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="成本名称" prop="name">
<el-select
v-model="dataForm.name"
disabled
:style="{ width: '100%' }"
placeholder="请选择成本名称">
<el-option
v-for="item in nameArr"
:key="item.name"
:label="item.label"
:value="item.name"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="总价" prop="price">
<el-input-number
:min="0"
style="width: 80%"
v-model="dataForm.price"
clearable
placeholder="请输入总价" />
()
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="所属日期" prop="recTime">
<el-date-picker
v-model="dataForm.recTime"
type="date"
value-format="timestamp"
:style="{ width: '100%' }"
readonly
placeholder="选择所属日期"></el-date-picker>
</el-form-item>
</el-col>
</el-row>
</el-form>
</template>
<script>
import basicAdd from '@/mixins/basic-add';
import {
updateRawOthercostHis,
} from '@/api/cost/costOthercostHisDeep';
export default {
mixins: [basicAdd],
props: {
nameArr: {
type: Array,
default: () => [],
},
},
data() {
return {
urlOptions: {
updateURL: updateRawOthercostHis,
},
dataForm: {
id: undefined,
price: undefined,
name: undefined,
recTime: undefined,
},
dataRule: {
price: [
{ required: true, message: '总价不能为空', trigger: 'blur' },
],
},
};
},
methods: {
init(val,statisticType) {
this.visible = true;
this.$nextTick(() => {
this.$refs["dataForm"].resetFields();
this.dataForm = JSON.parse(JSON.stringify(val))
this.dataForm.statisticType = statisticType
});
},
//
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (!valid) {
return false;
}
this.dataForm.modifyPrice = this.dataForm.price
//
this.urlOptions.updateURL(this.dataForm).then((response) => {
this.$modal.msgSuccess('修改成功');
this.visible = false;
this.$emit('refreshDataList');
});
});
},
},
};
</script>

View File

@ -0,0 +1,321 @@
<template>
<div class="app-container energyOverlimitLog">
<div v-show="activeName === 'his'">
<!-- 搜索工作栏 -->
<search-bar
:formConfigs="formConfig"
ref="searchBarForm"
@headBtnClick="buttonClick" />
</div>
<div v-show="activeName === 'now'">
<!-- 搜索工作栏 -->
<search-bar
:formConfigs="formConfig2"
ref="searchBarForm2"
@headBtnClick="buttonClick" />
</div>
<el-tabs v-model="activeName" @tab-click="toggleTab">
<el-tab-pane label="历史成本" name="his"></el-tab-pane>
<el-tab-pane label="成本查询" name="now"></el-tab-pane>
</el-tabs>
<!-- 列表 -->
<div v-if="activeName === 'his'">
<base-table
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-props="tableProps"
:table-data="tableData"
:max-height="tableH">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="80"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick" />
</base-table>
</div>
<div v-if="activeName === 'now'">
<base-table
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-props="tableProps2"
:table-data="tableData2"
:max-height="tableH" />
</div>
<pagination
:page.sync="listQuery.pageNo"
:limit.sync="listQuery.pageSize"
:total="listQuery.total"
@pagination="getDataList" />
<base-dialog
:dialogTitle="addOrEditTitle"
:dialogVisible="addOrUpdateVisible"
@cancel="handleCancel"
@confirm="handleConfirm"
:before-close="handleCancel"
width="50%">
<add-or-update
ref="addOrUpdate"
:name-arr="formConfig[1].selectOptions"
@refreshDataList="successSubmit"></add-or-update>
</base-dialog>
</div>
</template>
<script>
import AddOrUpdate from './add-or-updata';
import basicPage from '@/mixins/basic-page';
import { getRawOthercostRulePage } from '@/api/cost/deepOthercostRule';
import {
getRawOthercostHisPage,
getRawOthercostSunPage,
} from '@/api/cost/costOthercostHisDeep';
import { parseTime } from '@/filter/code-filter';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
const tableProps = [
{
prop: 'recTime',
label: '日期',
filter: (val) => parseTime(val, '{y}年{m}月{d}日'),
},
{
prop: 'otherCostName',
label: '成本名称',
},
{
prop: 'price',
label: '总价(元)',
align: 'right',
},
];
const tableProps2 = [
{
prop: 'otherCostName',
label: '成本名称',
},
{
prop: 'price',
label: '总价(元)',
align: 'right',
},
];
export default {
name: 'costOthercostHis',
mixins: [basicPage, tableHeightMixin],
data() {
return {
urlOptions: {
getDataListURL: getRawOthercostHisPage,
},
formConfig: [
{
type: 'select',
label: '维度',
selectOptions: [
{ id: 1, name: '日' },
{ id: 2, name: '周' },
{ id: 3, name: '月' },
],
param: 'statisticType',
defaultSelect: 1, // ,
clearable: false,
},
{
type: 'select',
label: '成本名称',
selectOptions: [],
param: 'name',
labelField: 'label',
valueField: 'name',
filterable: true,
},
{
type: 'datePicker',
label: '时间范围',
dateType: 'daterange',
format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd HH:mm:ss',
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
param: 'searchTime',
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
],
formConfig2: [
{
type: 'select',
label: '成本名称',
selectOptions: [],
param: 'name',
labelField: 'label',
valueField: 'name',
filterable: true,
},
{
type: 'datePicker',
label: '时间范围',
dateType: 'daterange',
format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd HH:mm:ss',
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
param: 'searchTime',
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
],
listQuery: {
statisticType: 1,
},
activeName: 'his',
tableProps,
tableProps2,
tableBtn: [
this.$auth.hasPermi(`monitoring:cost-deep-othercost-his:update`)
? {
type: 'edit',
btnName: '编辑',
}
: undefined,
].filter((v) => v),
tableData: [],
tableData2: [],
};
},
components: {
AddOrUpdate,
},
created() {
const params = {
pageNo: 1,
pageSize: 100,
};
getRawOthercostRulePage(params).then((response) => {
this.formConfig[1].selectOptions = response.data.list;
this.formConfig2[0].selectOptions = response.data.list;
});
},
methods: {
buttonClick(val) {
switch (val.btnName) {
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.name = val.name || null;
this.listQuery.statisticType = val.statisticType || 1;
this.listQuery.startTime = val.searchTime ? val.searchTime[0] : null;
this.listQuery.endTime = val.searchTime
? val.searchTime[1].substr(0, 10) + ' 23:59:59'
: null;
if (this.activeName === 'his') {
this.getDataList();
} else {
this.getDataList2();
}
break;
case 'add':
this.addOrUpdateHandle();
break;
case 'export':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.name = val.name;
this.listQuery.startTime = val.searchTime ? val.searchTime[0] : null;
this.listQuery.endTime = val.searchTime
? val.searchTime[1].substr(0, 10) + ' 23:59:59'
: null;
this.handleExport();
break;
default:
console.log(val);
}
},
toggleTab() {
if (this.activeName === 'his') {
this.$refs.searchBarForm.resetForm();
this.listQuery.name = null;
this.listQuery.startTime = null;
this.listQuery.endTime = null;
this.listQuery.statisticType = 1;
this.listQuery.pageNo = 1;
this.getDataList();
} else {
this.$refs.searchBarForm2.resetForm();
this.listQuery.name = null;
this.listQuery.startTime = null;
this.listQuery.endTime = null;
this.listQuery.pageNo = 1;
this.getDataList2();
}
},
// 2
getDataList2() {
getRawOthercostSunPage(this.listQuery).then((response) => {
this.tableData2 = response.data.list;
this.listQuery.total = response.data.total;
});
},
//tableBtn
handleClick(val) {
if (val.type === 'edit') {
this.addOrUpdateVisible = true;
this.addOrEditTitle = '编辑';
this.$nextTick(() => {
this.$refs.addOrUpdate.init(val.data, this.listQuery.statisticType);
});
} else {
this.otherMethods(val);
}
},
},
};
</script>
<style lang="scss">
.energyOverlimitLog {
.el-tabs__nav::after {
content: '';
position: absolute;
left: 0;
bottom: 0;
width: 100%;
height: 2px;
background-color: #e4e7ed;
}
.el-tabs__nav-wrap::after {
width: 0;
}
.el-tabs__item {
padding: 0 10px;
}
.el-tabs__item:hover {
color: rgba(0, 0, 0, 0.85);
}
.el-tabs__item.is-active {
color: rgba(0, 0, 0, 0.85);
}
.el-tabs__item {
color: rgba(0, 0, 0, 0.45);
}
.searchBarBox {
margin-bottom: 0;
}
}
</style>

View File

@ -0,0 +1,123 @@
<!--
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: zwq
* @LastEditTime: 2024-04-22 14:59:49
* @Description:
-->
<template>
<el-form
:model="dataForm"
:rules="dataRule"
ref="dataForm"
@keyup.enter.native="dataFormSubmit()"
label-width="80px">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="成本名称" prop="name">
<el-select
v-model="dataForm.name"
filterable
clearable
:style="{ width: '100%' }"
@change="setLabel"
placeholder="请选择成本名称">
<el-option
v-for="item in nameArr"
:key="item.name"
:label="item.label"
:value="item.name"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="成本金额" prop="price">
<el-input-number
:min="0"
style="width: 80%"
v-model="dataForm.price"
clearable
placeholder="请输入成本金额" />
()
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="所属日期" prop="recTime">
<el-date-picker
v-model="dataForm.recTime"
type="date"
value-format="timestamp"
:style="{ width: '100%' }"
placeholder="选择所属日期"></el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="备注" prop="remark">
<el-input
v-model="dataForm.remark"
clearable
placeholder="请输入备注" />
</el-form-item>
</el-col>
</el-row>
</el-form>
</template>
<script>
import basicAdd from '@/mixins/basic-add';
import {
createRawOthercostLog,
updateRawOthercostLog,
getRawOthercostLog,
} from '@/api/cost/costOthercostLogDeep';
import moment from 'moment';
const nowData = moment().format('YYYY-MM-DD').valueOf()
export default {
mixins: [basicAdd],
props: {
nameArr: {
type: Array,
default: () => [],
},
},
data() {
return {
urlOptions: {
createURL: createRawOthercostLog,
updateURL: updateRawOthercostLog,
infoURL: getRawOthercostLog,
},
dataForm: {
id: undefined,
price: undefined,
name: undefined,
recTime: new Date().getTime(),
remark: undefined,
},
dataRule: {
price: [
{ required: true, message: '成本金额不能为空', trigger: 'blur' },
],
name: [
{ required: true, message: ' 成本名称不能为空', trigger: 'blur' },
],
recTime: [
{
required: true,
message: '所属日期不能为空',
trigger: 'change',
},
],
},
};
},
methods: {
setLabel(val){
this.dataForm.label = this.nameArr.find(item=>item.name===val).label
}
},
};
</script>

View File

@ -0,0 +1,208 @@
<template>
<div class="app-container">
<search-bar
:formConfigs="formConfig"
ref="searchBarForm"
@headBtnClick="buttonClick" />
<base-table
v-loading="dataListLoading"
:table-props="tableProps"
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:max-height="tableH"
:table-data="tableData">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="120"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick" />
</base-table>
<pagination
:limit.sync="listQuery.pageSize"
:page.sync="listQuery.pageNo"
:total="listQuery.total"
@pagination="getDataList" />
<base-dialog
:dialogTitle="addOrEditTitle"
:dialogVisible="addOrUpdateVisible"
@cancel="handleCancel"
@confirm="handleConfirm"
:before-close="handleCancel"
width="50%">
<add-or-update
ref="addOrUpdate"
:name-arr="formConfig[0].selectOptions"
@refreshDataList="successSubmit"></add-or-update>
</base-dialog>
</div>
</template>
<script>
import AddOrUpdate from './add-or-updata';
import basicPage from '@/mixins/basic-page';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
import { parseTime } from '@/filter/code-filter';
import {
deleteRawOthercostLog,
getRawOthercostLogPage,
exportRawOthercostLogExcel,
} from '@/api/cost/costOthercostLogDeep';
import { getRawOthercostRulePage } from '@/api/cost/deepOthercostRule';
const tableProps = [
{
prop: 'otherCostName',
label: '成本名称',
},
{
prop: 'recTime',
label: '日期',
filter: (val) => parseTime(val, '{y}年{m}月{d}日'),
},
{
prop: 'price',
label: '成本金额',
align: 'right',
},
{
prop: 'remark',
label: '备注',
},
];
export default {
mixins: [basicPage, tableHeightMixin],
data() {
return {
urlOptions: {
getDataListURL: getRawOthercostLogPage,
deleteURL: deleteRawOthercostLog,
exportURL: exportRawOthercostLogExcel,
},
tableProps,
tableBtn: [
this.$auth.hasPermi(`monitoring:cost-deep-othercost-log:update`)
? {
type: 'edit',
btnName: '编辑',
}
: undefined,
this.$auth.hasPermi(`monitoring:cost-deep-othercost-log:delete`)
? {
type: 'delete',
btnName: '删除',
}
: undefined,
].filter((v) => v),
tableData: [],
formConfig: [
{
type: 'select',
label: '成本名称',
selectOptions: [],
param: 'name',
labelField: 'label',
valueField: 'name',
filterable: true,
},
{
type: 'datePicker',
label: '时间范围',
dateType: 'daterange',
format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd HH:mm:ss',
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
param: 'searchTime',
},
{
type: 'button',
btnName: '搜索',
name: 'search',
color: 'primary',
},
{
type: this.$auth.hasPermi('monitoring:cost-deep-othercost-log:create')
? 'separate'
: '',
},
{
type: this.$auth.hasPermi('monitoring:cost-deep-othercost-log:create')
? 'button'
: '',
btnName: '新增',
name: 'add',
color: 'success',
plain: true,
},
// {
// type: this.$auth.hasPermi('monitoring:cost-othercost-log:create') ? 'separate' : '',
// },
// {
// type: this.$auth.hasPermi('monitoring:cost-othercost-log:export') ? 'button' : '',
// btnName: '',
// name: 'export',
// color: 'warning',
// },
],
};
},
components: {
AddOrUpdate,
},
created() {
const params = {
pageNo: 1,
pageSize: 100,
};
getRawOthercostRulePage(params).then((response) => {
this.formConfig[0].selectOptions = response.data.list;
});
},
methods: {
buttonClick(val) {
switch (val.btnName) {
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.name = val.name||null;
this.listQuery.startTime = val.searchTime ? val.searchTime[0] : null;
this.listQuery.endTime = val.searchTime
? val.searchTime[1].substr(0, 10) + ' 23:59:59'
: null;
this.getDataList();
break;
case 'add':
this.addOrUpdateHandle();
break;
case 'export':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.name = val.name;
this.listQuery.recTime = val.searchTime;
this.handleExport();
break;
default:
console.log(val);
}
},
//tableBtn
handleClick(val) {
if (val.type === "edit") {
this.addOrUpdateVisible = true;
this.addOrEditTitle = "编辑";
this.$nextTick(() => {
this.$refs.addOrUpdate.init(val.data.id);
});
} else if (val.type === "delete") {
this.deleteHandle(val.data.id, val.data.otherCostName, val.data._pageIndex)
} else {
this.otherMethods(val)
}
},
},
};
</script>

View File

@ -0,0 +1,159 @@
<!--
* @Author: zwq
* @Date: 2023-08-01 13:52:10
* @LastEditors: zwq
* @LastEditTime: 2024-04-22 14:56:17
* @Description:
-->
<template>
<el-form
:model="dataForm"
:rules="dataRule"
ref="dataForm"
v-if="visible"
@keyup.enter.native="dataFormSubmit()"
label-width="100px"
label-position="top">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="成本名称" prop="label">
<el-input v-model="dataForm.label" clearable readonly />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="自动计算策略" prop="type">
<el-radio-group v-model="dataForm.type" @input="setType">
<el-radio :label="1">每天等价</el-radio>
<el-radio :label="2">折旧</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
<el-col :span="12" v-if="dataForm.type === 1" key="one">
<el-form-item label="价格" prop="price">
<el-input-number
:min="0"
style="width: 80%"
v-model="dataForm.price"
clearable />
()
</el-form-item>
</el-col>
<el-col :span="12" v-if="dataForm.type === 2" key="two">
<el-form-item label="总价" prop="price">
<el-input-number
:min="0"
style="width: 80%"
v-model="dataForm.price"
clearable />
()
</el-form-item>
</el-col>
<el-col :span="12" v-if="dataForm.type === 2" key="three">
<el-form-item label="折旧率" prop="ratio">
<el-input-number
:min="0"
style="width: 80%"
v-model="dataForm.ratio"
clearable />
(%)
</el-form-item>
</el-col>
<el-col :span="12" v-if="dataForm.type === 2" key="four">
<el-form-item label="折旧年限" prop="timeLimit">
<el-input-number
:min="0"
style="width: 80%"
v-model="dataForm.timeLimit"
clearable />
()
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="备注" prop="remark">
<el-input
@input="$forceUpdate()"
v-model="dataForm.remark"
clearable
placeholder="请输入备注" />
</el-form-item>
</el-col>
</el-row>
</el-form>
</template>
<script>
import {
updateRawOthercostRule,
getRawOthercostRule,
} from '@/api/cost/deepOthercostRule';
export default {
data() {
return {
urlOptions: {
updateURL: updateRawOthercostRule,
infoURL: getRawOthercostRule,
},
dataForm: {
label: undefined,
type: 1,
price: 0,
ratio: 0,
timeLimit: 1,
remark: '',
},
visible: false,
dataRule: {
price: [{ required: true, message: '价格不能为空', trigger: 'blur' }],
ratio: [{ required: true, message: '折旧率不能为空', trigger: 'blur' }],
timeLimit: [
{ required: true, message: '折旧年限不能为空', trigger: 'blur' },
],
},
};
},
created() {},
methods: {
init(val) {
this.dataForm = {
label: undefined,
type: 1,
price: 0,
ratio: 0,
timeLimit: 1,
remark: '',
};
this.visible = true;
this.$nextTick(() => {
this.$refs['dataForm'].resetFields();
this.dataForm = JSON.parse(JSON.stringify(val));
});
},
setType(val) {
if (val === 1) {
} else {
}
},
//
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (!valid) {
return false;
}
//
this.urlOptions.updateURL(this.dataForm).then((response) => {
this.$modal.msgSuccess('修改成功');
this.visible = false;
this.$emit('refreshDataList');
});
});
},
/** 清空form */
formClear() {
if (this.$refs.dataForm !== undefined) {
this.$refs.dataForm.resetFields();
}
},
},
};
</script>

View File

@ -0,0 +1,109 @@
<!--
* @Author: zwq
* @Date: 2024-04-15 16:52:38
* @LastEditors: zwq
* @LastEditTime: 2024-04-22 16:46:26
* @Description:
-->
<template>
<div class="app-container">
<!-- 列表 -->
<base-table
v-loading="dataListLoading"
:table-props="tableProps"
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:max-height="tableH"
:table-data="tableData">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="80"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick" />
</base-table>
<pagination
:limit.sync="listQuery.pageSize"
:page.sync="listQuery.pageNo"
:total="listQuery.total"
@pagination="getDataList" />
<!-- 对话框(添加 / 修改) -->
<base-dialog
:dialogTitle="addOrEditTitle"
:dialogVisible="addOrUpdateVisible"
@cancel="handleCancel"
@confirm="handleConfirm"
:before-close="handleCancel"
width="40%">
<add-or-update
ref="addOrUpdate"
@refreshDataList="successSubmit"></add-or-update>
</base-dialog>
</div>
</template>
<script>
import AddOrUpdate from './add-or-updata';
import basicPage from '@/mixins/basic-page';
import typeRule from './typeRule';
import {
getRawOthercostRulePage,
} from '@/api/cost/deepOthercostRule';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
const tableProps = [
{
prop: 'label',
label: '成本名称',
},
{
prop: 'type',
label: '自动计算方式',
subcomponent: typeRule,
},
{
prop: 'remark',
label: '备注',
},
];
export default {
mixins: [basicPage,tableHeightMixin],
data() {
return {
urlOptions: {
getDataListURL: getRawOthercostRulePage,
},
tableProps,
tableBtn: [
this.$auth.hasPermi(`monitoring:cost-deep-othercost-rule:update`)
? {
type: 'edit',
btnName: '编辑',
}
: undefined,
].filter((v) => v),
tableData: [],
};
},
components: {
AddOrUpdate,
},
created() {
},
methods: {
//tableBtn
handleClick(val) {
if (val.type === "edit") {
this.addOrUpdateVisible = true;
this.addOrEditTitle = "编辑";
this.$nextTick(() => {
this.$refs.addOrUpdate.init(val.data);
});
}
},
},
};
</script>

View File

@ -0,0 +1,31 @@
<!--
* @Author: zwq
* @Date: 2023-12-05 13:45:59
* @LastEditors: zwq
* @LastEditTime: 2024-04-15 17:12:03
* @Description
-->
<template>
<div>
<span>
{{
injectData.type == 1
? `每天等价,${injectData.price}`
: injectData.type == 2
? `总价${injectData.price}元,年折旧率${injectData.ratio}%,折旧年限${injectData.timeLimit}`
: '-'
}}
</span>
</div>
</template>
<script>
export default {
name: '',
props: {
injectData: {
type: Object,
default: () => ({}),
},
},
};
</script>

View File

@ -0,0 +1,113 @@
<!--
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: zwq
* @LastEditTime: 2024-04-19 16:45:32
* @Description:
-->
<template>
<el-form
:model="dataForm"
:rules="dataRule"
ref="dataForm"
@keyup.enter.native="dataFormSubmit()"
label-width="80px">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="能源类型" prop="energyTypeName">
<el-input
v-model="dataForm.energyTypeName"
disabled
placeholder="请输入能源类型" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="日期" prop="recTime">
<el-date-picker
v-model="dataForm.recTime"
type="date"
value-format="timestamp"
:style="{ width: '100%' }"
readonly
placeholder="选择日期"></el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="总价" prop="price">
<el-input-number
:min="0"
style="width: 80%"
v-model="dataForm.price"
clearable
placeholder="请输入总价" />
()
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="累计用量" prop="quantity">
<el-input-number
:min="0"
style="width: 100%"
v-model="dataForm.quantity"
clearable
placeholder="请输入累计用量" />
</el-form-item>
</el-col>
</el-row>
</el-form>
</template>
<script>
import basicAdd from '@/mixins/basic-add';
import { updateEnergyHis } from '@/api/cost/costEnergy';
export default {
mixins: [basicAdd],
data() {
return {
urlOptions: {
updateURL: updateEnergyHis,
},
dataForm: {
id: undefined,
price: undefined,
quantity: undefined,
energyTypeName: undefined,
recTime: undefined,
},
dataRule: {
price: [{ required: true, message: '总价不能为空', trigger: 'blur' }],
quantity: [
{ required: true, message: '累计用量不能为空', trigger: 'blur' },
],
},
};
},
methods: {
init(val, statisticType) {
this.visible = true;
this.$nextTick(() => {
this.$refs['dataForm'].resetFields();
this.dataForm = JSON.parse(JSON.stringify(val));
this.dataForm.statisticType = statisticType;
});
},
//
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (!valid) {
return false;
}
this.dataForm.modifyPrice = this.dataForm.price;
this.dataForm.modifyQuantity = this.dataForm.quantity;
//
this.urlOptions.updateURL(this.dataForm).then((response) => {
this.$modal.msgSuccess('修改成功');
this.visible = false;
this.$emit('refreshDataList');
});
});
},
},
};
</script>

View File

@ -0,0 +1,347 @@
<template>
<div class="app-container energyOverlimitLog">
<div v-show="activeName === 'his'">
<!-- 搜索工作栏 -->
<search-bar
:formConfigs="formConfig"
ref="searchBarForm"
@headBtnClick="buttonClick" />
</div>
<div v-show="activeName === 'now'">
<!-- 搜索工作栏 -->
<search-bar
:formConfigs="formConfig2"
ref="searchBarForm2"
@headBtnClick="buttonClick" />
</div>
<el-tabs v-model="activeName" @tab-click="toggleTab">
<el-tab-pane label="历史成本" name="his"></el-tab-pane>
<el-tab-pane label="成本查询" name="now"></el-tab-pane>
</el-tabs>
<!-- 列表 -->
<div v-if="activeName === 'his'">
<base-table
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-props="tableProps"
:table-data="tableData"
:max-height="tableH">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="80"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick" />
</base-table>
</div>
<div v-if="activeName === 'now'">
<base-table
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-props="tableProps2"
:table-data="tableData2"
:max-height="tableH" />
</div>
<pagination
:page.sync="listQuery.pageNo"
:limit.sync="listQuery.pageSize"
:total="listQuery.total"
@pagination="getDataList" />
<base-dialog
:dialogTitle="addOrEditTitle"
:dialogVisible="addOrUpdateVisible"
@cancel="handleCancel"
@confirm="handleConfirm"
:before-close="handleCancel"
width="50%">
<add-or-update
ref="addOrUpdate"
@refreshDataList="successSubmit"></add-or-update>
</base-dialog>
</div>
</template>
<script>
import AddOrUpdate from './add-or-updata';
import basicPage from '@/mixins/basic-page';
import { getEnergyTypePage } from '@/api/base/energyType';
import { getEnergyHisPage, getEnergyRealtimePage } from '@/api/cost/costEnergy';
import { parseTime } from '@/filter/code-filter';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
const tableProps = [
{
prop: 'recTime',
label: '日期',
filter: (val) => parseTime(val, '{y}年{m}月{d}日'),
},
{
prop: 'energyTypeName',
label: '能源类型',
},
{
prop: 'bindObjectName',
label: '监控对象',
filter: (val) => (val != null ? val : '--'),
},
{
prop: 'meterName',
label: '抄表名',
filter: (val) => (val != null ? val : '--'),
},
{
prop: 'quantity',
label: '累计使用量',
},
{
prop: 'price',
label: '总价(元)',
align: 'right',
},
];
const tableProps2 = [
{
prop: 'energyTypeName',
label: '能源类型',
},
{
prop: 'bindObjectName',
label: '监控对象',
filter: (val) => (val != null ? val : '--'),
},
{
prop: 'meter',
label: '抄表名',
filter: (val) => (val != null ? val : '--'),
},
{
prop: 'quantity',
label: '累计使用量',
},
{
prop: 'price',
label: '总价(元)',
align: 'right',
},
];
export default {
name: 'costEnergy',
mixins: [basicPage, tableHeightMixin],
data() {
return {
urlOptions: {
getDataListURL: getEnergyHisPage,
},
formConfig: [
{
type: 'select',
label: '维度',
selectOptions: [
{ id: 1, name: '日' },
{ id: 2, name: '周' },
{ id: 3, name: '月' },
],
param: 'statisticType',
defaultSelect: 1, // ,
clearable: false,
},
{
type: 'select',
label: '能源类型',
selectOptions: [],
param: 'name',
labelField: 'name',
filterable: true,
},
{
type: 'datePicker',
label: '时间范围',
dateType: 'daterange',
format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd HH:mm:ss',
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
param: 'searchTime',
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
],
formConfig2: [
{
type: 'select',
label: '能源类型',
selectOptions: [],
param: 'name',
labelField: 'name',
filterable: true,
},
{
type: 'datePicker',
label: '时间范围',
dateType: 'daterange',
format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd HH:mm:ss',
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
param: 'searchTime',
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
],
listQuery: {
statisticType: 1,
},
activeName: 'his',
tableProps,
tableProps2,
tableBtn: [
this.$auth.hasPermi(`monitoring:cost-energy-his:update`)
? {
type: 'edit',
btnName: '编辑',
}
: undefined,
].filter((v) => v),
tableData: [],
tableData2: [],
};
},
components: {
AddOrUpdate,
},
created() {
const params = {
pageNo: 1,
pageSize: 100,
};
getEnergyTypePage(params).then((response) => {
this.formConfig[1].selectOptions = response.data.list;
this.formConfig2[0].selectOptions = response.data.list;
});
},
methods: {
buttonClick(val) {
switch (val.btnName) {
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.energyTypeId = val.name || null;
this.listQuery.statisticType = val.statisticType || 1;
this.listQuery.startTime = val.searchTime ? val.searchTime[0] : null;
this.listQuery.endTime = val.searchTime
? val.searchTime[1].substr(0, 10) + ' 23:59:59'
: null;
if (this.activeName === 'his') {
this.getDataList();
} else {
this.getDataList2();
}
break;
case 'add':
this.addOrUpdateHandle();
break;
case 'export':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.energyTypeId = val.name;
this.listQuery.startTime = val.searchTime ? val.searchTime[0] : null;
this.listQuery.endTime = val.searchTime
? val.searchTime[1].substr(0, 10) + ' 23:59:59'
: null;
this.handleExport();
break;
default:
console.log(val);
}
},
toggleTab() {
if (this.activeName === 'his') {
this.$refs.searchBarForm.resetForm();
this.listQuery.name = null;
this.listQuery.startTime = null;
this.listQuery.endTime = null;
this.listQuery.statisticType = 1;
this.listQuery.pageNo = 1;
this.getDataList();
} else {
this.$refs.searchBarForm2.resetForm();
this.listQuery.name = null;
this.listQuery.startTime = null;
this.listQuery.endTime = null;
this.listQuery.pageNo = 1;
this.getDataList2();
}
},
// 2
getDataList2() {
if (this.listQuery.startTime) {
getEnergyRealtimePage(this.listQuery).then((response) => {
this.tableData2 = response.data.list;
this.listQuery.total = response.data.total;
});
} else {
this.$message.warning('请选择时间范围');
}
},
//tableBtn
handleClick(val) {
if (val.type === 'edit') {
this.addOrUpdateVisible = true;
this.addOrEditTitle = '编辑';
this.$nextTick(() => {
this.$refs.addOrUpdate.init(val.data, this.listQuery.statisticType);
});
} else {
this.otherMethods(val);
}
},
},
};
</script>
<style lang="scss">
.energyOverlimitLog {
.el-tabs__nav::after {
content: '';
position: absolute;
left: 0;
bottom: 0;
width: 100%;
height: 2px;
background-color: #e4e7ed;
}
.el-tabs__nav-wrap::after {
width: 0;
}
.el-tabs__item {
padding: 0 10px;
}
.el-tabs__item:hover {
color: rgba(0, 0, 0, 0.85);
}
.el-tabs__item.is-active {
color: rgba(0, 0, 0, 0.85);
}
.el-tabs__item {
color: rgba(0, 0, 0, 0.45);
}
.searchBarBox {
margin-bottom: 0;
}
}
</style>

View File

@ -0,0 +1,114 @@
<!--
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: zwq
* @LastEditTime: 2024-04-19 16:59:45
* @Description:
-->
<template>
<el-form
:model="dataForm"
:rules="dataRule"
ref="dataForm"
@keyup.enter.native="dataFormSubmit()"
label-width="80px">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="原料名称" prop="materialName">
<el-input
v-model="dataForm.materialName"
disabled
placeholder="请输入原料名称" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="单价" prop="matPrice">
<el-input
v-model="dataForm.matPrice"
disabled
style="width: 70%"
placeholder="请输入单价" />
(/)
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="总价" prop="price">
<el-input-number
:min="0"
style="width: 80%"
v-model="dataForm.price"
clearable
placeholder="请输入总价" />
()
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="累计用量" prop="quantity">
<el-input-number
:min="0"
style="width: 80%"
v-model="dataForm.quantity"
clearable
placeholder="请输入累计用量" />
()
</el-form-item>
</el-col>
</el-row>
</el-form>
</template>
<script>
import basicAdd from '@/mixins/basic-add';
import { updateMaterialHis } from '@/api/cost/costMaterial';
export default {
mixins: [basicAdd],
data() {
return {
urlOptions: {
updateURL: updateMaterialHis,
},
dataForm: {
id: undefined,
price: undefined,
quantity: undefined,
matPrice: undefined,
materialName: undefined,
recTime: undefined,
},
dataRule: {
price: [{ required: true, message: '总价不能为空', trigger: 'blur' }],
quantity: [
{ required: true, message: '累计用量不能为空', trigger: 'blur' },
],
},
};
},
methods: {
init(val, statisticType) {
this.visible = true;
this.$nextTick(() => {
this.$refs['dataForm'].resetFields();
this.dataForm = JSON.parse(JSON.stringify(val));
this.dataForm.statisticType = statisticType;
});
},
//
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (!valid) {
return false;
}
this.dataForm.modifyPrice = this.dataForm.price;
this.dataForm.modifyQuantity = this.dataForm.quantity;
//
this.urlOptions.updateURL(this.dataForm).then((response) => {
this.$modal.msgSuccess('修改成功');
this.visible = false;
this.$emit('refreshDataList');
});
});
},
},
};
</script>

View File

@ -0,0 +1,346 @@
<template>
<div class="app-container energyOverlimitLog">
<div v-show="activeName === 'his'">
<!-- 搜索工作栏 -->
<search-bar
:formConfigs="formConfig"
ref="searchBarForm"
@headBtnClick="buttonClick" />
</div>
<div v-show="activeName === 'now'">
<!-- 搜索工作栏 -->
<search-bar
:formConfigs="formConfig2"
ref="searchBarForm2"
@headBtnClick="buttonClick" />
</div>
<el-tabs v-model="activeName" @tab-click="toggleTab">
<el-tab-pane label="历史成本" name="his"></el-tab-pane>
<el-tab-pane label="成本查询" name="now"></el-tab-pane>
</el-tabs>
<!-- 列表 -->
<div v-if="activeName === 'his'">
<base-table
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-props="tableProps"
:table-data="tableData"
:max-height="tableH">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="80"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick" />
</base-table>
</div>
<div v-if="activeName === 'now'">
<base-table
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-props="tableProps2"
:table-data="tableData2"
:max-height="tableH" />
</div>
<pagination
:page.sync="listQuery.pageNo"
:limit.sync="listQuery.pageSize"
:total="listQuery.total"
@pagination="getDataList" />
<base-dialog
:dialogTitle="addOrEditTitle"
:dialogVisible="addOrUpdateVisible"
@cancel="handleCancel"
@confirm="handleConfirm"
:before-close="handleCancel"
width="50%">
<add-or-update
ref="addOrUpdate"
@refreshDataList="successSubmit"></add-or-update>
</base-dialog>
</div>
</template>
<script>
import AddOrUpdate from './add-or-updata';
import basicPage from '@/mixins/basic-page';
import { getMaterialPage } from '@/api/base/material';
import {
getMaterialHisPage,
getMaterialRealtimePage,
} from '@/api/cost/costMaterial';
import { parseTime } from '@/filter/code-filter';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
import typeRule from './typeRule';
const tableProps = [
{
prop: 'recTime',
label: '日期',
filter: (val) => parseTime(val, '{y}年{m}月{d}日'),
},
{
prop: 'materialName',
label: '原料名称',
},
{
prop: 'matPrice',
label: '单价(元/吨)',
align: 'right',
},
{
prop: 'quantity',
label: '累计使用量(吨)',
},
{
prop: 'price',
label: '总价(元)',
align: 'right',
},
];
const tableProps2 = [
{
prop: 'materialName',
label: '原料名称',
},
{
prop: 'matPrice',
label: '单价(元/吨)',
align: 'right',
},
{
prop: 'time',
label: '单价生效时间',
subcomponent: typeRule,
},
{
prop: 'quantity',
label: '累计使用量(吨)',
},
{
prop: 'price',
label: '总价(元)',
align: 'right',
},
];
export default {
name: 'costMaterial',
mixins: [basicPage, tableHeightMixin],
data() {
return {
urlOptions: {
getDataListURL: getMaterialHisPage,
},
formConfig: [
{
type: 'select',
label: '维度',
selectOptions: [
{ id: 1, name: '日' },
{ id: 2, name: '周' },
{ id: 3, name: '月' },
],
param: 'statisticType',
defaultSelect: 1, // ,
clearable: false,
},
{
type: 'select',
label: '原料名称',
selectOptions: [],
param: 'name',
labelField: 'name',
filterable: true,
},
{
type: 'datePicker',
label: '时间范围',
dateType: 'daterange',
format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd HH:mm:ss',
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
param: 'searchTime',
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
],
formConfig2: [
{
type: 'select',
label: '原料名称',
selectOptions: [],
param: 'name',
labelField: 'name',
filterable: true,
},
{
type: 'datePicker',
label: '时间范围',
dateType: 'daterange',
format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd HH:mm:ss',
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
param: 'searchTime',
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
],
listQuery: {
statisticType: 1,
},
activeName: 'his',
tableProps,
tableProps2,
tableBtn: [
this.$auth.hasPermi(`monitoring:cost-material-his:update`)
? {
type: 'edit',
btnName: '编辑',
}
: undefined,
].filter((v) => v),
tableData: [],
tableData2: [],
};
},
components: {
AddOrUpdate,
},
created() {
const params = {
pageNo: 1,
pageSize: 100,
};
getMaterialPage(params).then((response) => {
this.formConfig[1].selectOptions = response.data.list;
this.formConfig2[0].selectOptions = response.data.list;
});
},
methods: {
buttonClick(val) {
switch (val.btnName) {
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.materialId = val.name || null;
this.listQuery.statisticType = val.statisticType || 1;
this.listQuery.startTime = val.searchTime ? val.searchTime[0] : null;
this.listQuery.endTime = val.searchTime
? val.searchTime[1].substr(0, 10) + ' 23:59:59'
: null;
if (this.activeName === 'his') {
this.getDataList();
} else {
this.getDataList2();
}
break;
case 'add':
this.addOrUpdateHandle();
break;
case 'export':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.name = val.name;
this.listQuery.startTime = val.searchTime ? val.searchTime[0] : null;
this.listQuery.endTime = val.searchTime
? val.searchTime[1].substr(0, 10) + ' 23:59:59'
: null;
this.handleExport();
break;
default:
console.log(val);
}
},
toggleTab() {
if (this.activeName === 'his') {
this.$refs.searchBarForm.resetForm();
this.listQuery.name = null;
this.listQuery.startTime = null;
this.listQuery.endTime = null;
this.listQuery.statisticType = 1;
this.listQuery.pageNo = 1;
this.getDataList();
} else {
this.$refs.searchBarForm2.resetForm();
this.listQuery.name = null;
this.listQuery.startTime = null;
this.listQuery.endTime = null;
this.listQuery.pageNo = 1;
this.getDataList2();
}
},
// 2
getDataList2() {
if (this.listQuery.startTime) {
getMaterialRealtimePage(this.listQuery).then((response) => {
this.tableData2 = response.data.list;
this.listQuery.total = response.data.total;
});
} else {
this.$message.warning('请选择时间范围');
}
},
//tableBtn
handleClick(val) {
if (val.type === 'edit') {
this.addOrUpdateVisible = true;
this.addOrEditTitle = '编辑';
this.$nextTick(() => {
this.$refs.addOrUpdate.init(val.data, this.listQuery.statisticType);
});
} else {
this.otherMethods(val);
}
},
},
};
</script>
<style lang="scss">
.energyOverlimitLog {
.el-tabs__nav::after {
content: '';
position: absolute;
left: 0;
bottom: 0;
width: 100%;
height: 2px;
background-color: #e4e7ed;
}
.el-tabs__nav-wrap::after {
width: 0;
}
.el-tabs__item {
padding: 0 10px;
}
.el-tabs__item:hover {
color: rgba(0, 0, 0, 0.85);
}
.el-tabs__item.is-active {
color: rgba(0, 0, 0, 0.85);
}
.el-tabs__item {
color: rgba(0, 0, 0, 0.45);
}
.searchBarBox {
margin-bottom: 0;
}
}
</style>

View File

@ -0,0 +1,23 @@
<!--
* @Author: zwq
* @Date: 2023-12-05 13:45:59
* @LastEditors: zwq
* @LastEditTime: 2024-04-15 17:12:03
* @Description
-->
<template>
<div>
<span>{{ parseTime(injectData.startTime,'{y}年{m}月{d}日') + '-' + (parseTime(injectData.endTime)?parseTime(injectData.endTime,'{y}年{m}月{d}日'):'永久') }}</span>
</div>
</template>
<script>
export default {
name: '',
props: {
injectData: {
type: Object,
default: () => ({}),
},
},
};
</script>

View File

@ -0,0 +1,171 @@
<!--
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: zwq
* @LastEditTime: 2024-04-22 11:12:58
* @Description:
-->
<template>
<el-form
:model="dataForm"
:rules="dataRule"
ref="dataForm"
@keyup.enter.native="dataFormSubmit()"
label-width="80px">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="产线" prop="bindObjectName">
<el-input
style="width: 100%"
v-model="dataForm.bindObjectName"
readonly />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="厚度" prop="thick">
<el-input-number
:min="0"
style="width: 100%"
v-model="dataForm.thick"
clearable
placeholder="请输入厚度" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="在线速度" prop="speed">
<el-input-number
:min="0"
style="width: 100%"
v-model="dataForm.speed"
clearable
placeholder="请输入在线速度" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="掰边宽度" prop="width">
<el-input-number
:min="0"
style="width: 100%"
v-model="dataForm.width"
clearable
placeholder="请输入掰边宽度" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="拉引量" prop="inArea">
<el-input-number
:min="0"
style="width: 80%"
v-model="dataForm.inArea"
clearable
placeholder="请输入拉引量" />
(/m²)
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="下片面积" prop="outArea">
<el-input-number
:min="0"
style="width: 80%"
v-model="dataForm.outArea"
clearable
placeholder="请输入下片面积" />
(/m²)
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="良品率" prop="ratio">
<el-input-number
:min="0"
style="width: 80%"
v-model="dataForm.ratio"
clearable
placeholder="请输入良品率" />
(%)
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="所属日期" prop="recTime">
<el-date-picker
v-model="dataForm.recTime"
type="date"
value-format="timestamp"
:style="{ width: '100%' }"
readonly
placeholder="选择所属日期"></el-date-picker>
</el-form-item>
</el-col>
</el-row>
</el-form>
</template>
<script>
import basicAdd from '@/mixins/basic-add';
import { updatecostOriginRatioHis } from '@/api/cost/costOriginRatioHis';
export default {
mixins: [basicAdd],
props: {
nameArr: {
type: Array,
default: () => [],
},
},
data() {
return {
urlOptions: {
updateURL: updatecostOriginRatioHis,
},
dataForm: {
id: undefined,
bindObjectName: undefined,
thick: undefined,
speed: undefined,
width: undefined,
inArea: undefined,
outArea: undefined,
ratio: undefined,
recTime: undefined,
},
dataRule: {},
};
},
methods: {
init(val, statisticType) {
this.visible = true;
this.$nextTick(() => {
this.$refs['dataForm'].resetFields();
this.dataForm = JSON.parse(JSON.stringify(val));
this.dataForm.statisticType = statisticType;
this.dataForm.ratio =
this.dataForm.ratio >= 0 ? this.dataForm.ratio * 100 : '';
});
},
//
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (!valid) {
return false;
}
const udata = {
id: this.dataForm.id,
statisticType: this.dataForm.statisticType,
modifyThick: this.dataForm.thick,
modifySpeed: this.dataForm.speed,
modifyWidth: this.dataForm.width,
modifyInArea: this.dataForm.inArea,
modifyOutArea: this.dataForm.outArea,
modifyRatio:
this.dataForm.ratio >= 0 ? this.dataForm.ratio / 100 : '',
};
//
this.urlOptions.updateURL(udata).then((response) => {
this.$modal.msgSuccess('修改成功');
this.visible = false;
this.$emit('refreshDataList');
});
});
},
},
};
</script>

View File

@ -0,0 +1,237 @@
<template>
<div class="app-container energyOverlimitLog">
<!-- 搜索工作栏 -->
<search-bar
:formConfigs="formConfig"
ref="searchBarForm"
@headBtnClick="buttonClick" />
<!-- 列表 -->
<base-table
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-props="tableProps"
:table-data="tableData"
:max-height="tableH">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="80"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick" />
</base-table>
<pagination
:page.sync="listQuery.pageNo"
:limit.sync="listQuery.pageSize"
:total="listQuery.total"
@pagination="getDataList" />
<base-dialog
:dialogTitle="addOrEditTitle"
:dialogVisible="addOrUpdateVisible"
@cancel="handleCancel"
@confirm="handleConfirm"
:before-close="handleCancel"
width="50%">
<add-or-update
ref="addOrUpdate"
:name-arr="formConfig[1].selectOptions"
@refreshDataList="successSubmit"></add-or-update>
</base-dialog>
</div>
</template>
<script>
import AddOrUpdate from './add-or-updata';
import basicPage from '@/mixins/basic-page';
import { getLineAll } from '@/api/base/productionLine';
import { getcostOriginRatioHisPage } from '@/api/cost/costOriginRatioHis';
import { parseTime } from '@/filter/code-filter';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
const tableProps = [
{
prop: 'recTime',
label: '日期',
filter: (val) => parseTime(val, '{y}年{m}月{d}日'),
},
{
prop: 'bindObjectName',
label: '产线',
},
{
prop: 'thick',
label: '厚度',
},
{
prop: 'speed',
label: '在线速度',
},
{
prop: 'width',
label: '掰边宽度',
},
{
prop: 'inArea',
label: '拉引量/m²',
},
{
prop: 'outArea',
label: '下片面积/m²',
},
{
prop: 'ratio',
label: '良品率',
filter: (val) => (val ? val * 100 + '%' : '-'),
},
];
export default {
name: 'costOriginRatioHis',
mixins: [basicPage, tableHeightMixin],
data() {
return {
urlOptions: {
getDataListURL: getcostOriginRatioHisPage,
},
formConfig: [
{
type: 'select',
label: '维度',
selectOptions: [
{ id: 1, name: '日' },
{ id: 2, name: '周' },
{ id: 3, name: '月' },
],
param: 'statisticType',
defaultSelect: 1, // ,
clearable: false,
},
{
type: 'select',
label: '产线',
selectOptions: [],
param: 'name',
filterable: true,
},
{
type: 'datePicker',
label: '时间范围',
dateType: 'daterange',
format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd HH:mm:ss',
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
param: 'searchTime',
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
],
listQuery: {
statisticType: 1,
},
tableProps,
tableBtn: [
this.$auth.hasPermi(`monitoring:cost-origin-ratio-his:update`)
? {
type: 'edit',
btnName: '编辑',
}
: undefined,
].filter((v) => v),
tableData: [],
};
},
components: {
AddOrUpdate,
},
created() {
getLineAll().then((response) => {
this.formConfig[1].selectOptions = response.data;
});
},
methods: {
buttonClick(val) {
switch (val.btnName) {
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.bindObjectId = val.name || null;
this.listQuery.statisticType = val.statisticType || 1;
this.listQuery.startTime = val.searchTime ? val.searchTime[0] : null;
this.listQuery.endTime = val.searchTime
? val.searchTime[1].substr(0, 10) + ' 23:59:59'
: null;
this.getDataList();
break;
case 'add':
this.addOrUpdateHandle();
break;
case 'export':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.name = val.name;
this.listQuery.startTime = val.searchTime ? val.searchTime[0] : null;
this.listQuery.endTime = val.searchTime
? val.searchTime[1].substr(0, 10) + ' 23:59:59'
: null;
this.handleExport();
break;
default:
console.log(val);
}
},
//tableBtn
handleClick(val) {
if (val.type === 'edit') {
this.addOrUpdateVisible = true;
this.addOrEditTitle = '编辑';
this.$nextTick(() => {
this.$refs.addOrUpdate.init(val.data, this.listQuery.statisticType);
});
} else {
this.otherMethods(val);
}
},
},
};
</script>
<style lang="scss">
.energyOverlimitLog {
.el-tabs__nav::after {
content: '';
position: absolute;
left: 0;
bottom: 0;
width: 100%;
height: 2px;
background-color: #e4e7ed;
}
.el-tabs__nav-wrap::after {
width: 0;
}
.el-tabs__item {
padding: 0 10px;
}
.el-tabs__item:hover {
color: rgba(0, 0, 0, 0.85);
}
.el-tabs__item.is-active {
color: rgba(0, 0, 0, 0.85);
}
.el-tabs__item {
color: rgba(0, 0, 0, 0.45);
}
.searchBarBox {
margin-bottom: 0;
}
}
</style>

View File

@ -0,0 +1,115 @@
<!--
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: zwq
* @LastEditTime: 2024-04-19 16:29:30
* @Description:
-->
<template>
<el-form
:model="dataForm"
:rules="dataRule"
ref="dataForm"
@keyup.enter.native="dataFormSubmit()"
label-width="80px">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="成本名称" prop="name">
<el-select
v-model="dataForm.name"
disabled
:style="{ width: '100%' }"
placeholder="请选择成本名称">
<el-option
v-for="item in nameArr"
:key="item.name"
:label="item.label"
:value="item.name"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="总价" prop="price">
<el-input-number
:min="0"
style="width: 80%"
v-model="dataForm.price"
clearable
placeholder="请输入总价" />
()
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="所属日期" prop="recTime">
<el-date-picker
v-model="dataForm.recTime"
type="date"
value-format="timestamp"
:style="{ width: '100%' }"
readonly
placeholder="选择所属日期"></el-date-picker>
</el-form-item>
</el-col>
</el-row>
</el-form>
</template>
<script>
import basicAdd from '@/mixins/basic-add';
import {
updateRawOthercostHis,
} from '@/api/cost/costOthercostHis';
export default {
mixins: [basicAdd],
props: {
nameArr: {
type: Array,
default: () => [],
},
},
data() {
return {
urlOptions: {
updateURL: updateRawOthercostHis,
},
dataForm: {
id: undefined,
price: undefined,
name: undefined,
recTime: undefined,
},
dataRule: {
price: [
{ required: true, message: '总价不能为空', trigger: 'blur' },
],
},
};
},
methods: {
init(val,statisticType) {
this.visible = true;
this.$nextTick(() => {
this.$refs["dataForm"].resetFields();
this.dataForm = JSON.parse(JSON.stringify(val))
this.dataForm.statisticType = statisticType
});
},
//
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (!valid) {
return false;
}
this.dataForm.modifyPrice = this.dataForm.price
//
this.urlOptions.updateURL(this.dataForm).then((response) => {
this.$modal.msgSuccess('修改成功');
this.visible = false;
this.$emit('refreshDataList');
});
});
},
},
};
</script>

View File

@ -0,0 +1,321 @@
<template>
<div class="app-container energyOverlimitLog">
<div v-show="activeName === 'his'">
<!-- 搜索工作栏 -->
<search-bar
:formConfigs="formConfig"
ref="searchBarForm"
@headBtnClick="buttonClick" />
</div>
<div v-show="activeName === 'now'">
<!-- 搜索工作栏 -->
<search-bar
:formConfigs="formConfig2"
ref="searchBarForm2"
@headBtnClick="buttonClick" />
</div>
<el-tabs v-model="activeName" @tab-click="toggleTab">
<el-tab-pane label="历史成本" name="his"></el-tab-pane>
<el-tab-pane label="成本查询" name="now"></el-tab-pane>
</el-tabs>
<!-- 列表 -->
<div v-if="activeName === 'his'">
<base-table
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-props="tableProps"
:table-data="tableData"
:max-height="tableH">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="80"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick" />
</base-table>
</div>
<div v-if="activeName === 'now'">
<base-table
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-props="tableProps2"
:table-data="tableData2"
:max-height="tableH" />
</div>
<pagination
:page.sync="listQuery.pageNo"
:limit.sync="listQuery.pageSize"
:total="listQuery.total"
@pagination="getDataList" />
<base-dialog
:dialogTitle="addOrEditTitle"
:dialogVisible="addOrUpdateVisible"
@cancel="handleCancel"
@confirm="handleConfirm"
:before-close="handleCancel"
width="50%">
<add-or-update
ref="addOrUpdate"
:name-arr="formConfig[1].selectOptions"
@refreshDataList="successSubmit"></add-or-update>
</base-dialog>
</div>
</template>
<script>
import AddOrUpdate from './add-or-updata';
import basicPage from '@/mixins/basic-page';
import { getRawOthercostRulePage } from '@/api/cost/rawOthercostRule';
import {
getRawOthercostHisPage,
getRawOthercostSunPage,
} from '@/api/cost/costOthercostHis';
import { parseTime } from '@/filter/code-filter';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
const tableProps = [
{
prop: 'recTime',
label: '日期',
filter: (val) => parseTime(val, '{y}年{m}月{d}日'),
},
{
prop: 'otherCostName',
label: '成本名称',
},
{
prop: 'price',
label: '总价(元)',
align: 'right',
},
];
const tableProps2 = [
{
prop: 'otherCostName',
label: '成本名称',
},
{
prop: 'price',
label: '总价(元)',
align: 'right',
},
];
export default {
name: 'costOthercostHis',
mixins: [basicPage, tableHeightMixin],
data() {
return {
urlOptions: {
getDataListURL: getRawOthercostHisPage,
},
formConfig: [
{
type: 'select',
label: '维度',
selectOptions: [
{ id: 1, name: '日' },
{ id: 2, name: '周' },
{ id: 3, name: '月' },
],
param: 'statisticType',
defaultSelect: 1, // ,
clearable: false,
},
{
type: 'select',
label: '成本名称',
selectOptions: [],
param: 'name',
labelField: 'label',
valueField: 'name',
filterable: true,
},
{
type: 'datePicker',
label: '时间范围',
dateType: 'daterange',
format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd HH:mm:ss',
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
param: 'searchTime',
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
],
formConfig2: [
{
type: 'select',
label: '成本名称',
selectOptions: [],
param: 'name',
labelField: 'label',
valueField: 'name',
filterable: true,
},
{
type: 'datePicker',
label: '时间范围',
dateType: 'daterange',
format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd HH:mm:ss',
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
param: 'searchTime',
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
],
listQuery: {
statisticType: 1,
},
activeName: 'his',
tableProps,
tableProps2,
tableBtn: [
this.$auth.hasPermi(`monitoring:cost-othercost-his:update`)
? {
type: 'edit',
btnName: '编辑',
}
: undefined,
].filter((v) => v),
tableData: [],
tableData2: [],
};
},
components: {
AddOrUpdate,
},
created() {
const params = {
pageNo: 1,
pageSize: 100,
};
getRawOthercostRulePage(params).then((response) => {
this.formConfig[1].selectOptions = response.data.list;
this.formConfig2[0].selectOptions = response.data.list;
});
},
methods: {
buttonClick(val) {
switch (val.btnName) {
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.name = val.name || null;
this.listQuery.statisticType = val.statisticType || 1;
this.listQuery.startTime = val.searchTime ? val.searchTime[0] : null;
this.listQuery.endTime = val.searchTime
? val.searchTime[1].substr(0, 10) + ' 23:59:59'
: null;
if (this.activeName === 'his') {
this.getDataList();
} else {
this.getDataList2();
}
break;
case 'add':
this.addOrUpdateHandle();
break;
case 'export':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.name = val.name;
this.listQuery.startTime = val.searchTime ? val.searchTime[0] : null;
this.listQuery.endTime = val.searchTime
? val.searchTime[1].substr(0, 10) + ' 23:59:59'
: null;
this.handleExport();
break;
default:
console.log(val);
}
},
toggleTab() {
if (this.activeName === 'his') {
this.$refs.searchBarForm.resetForm();
this.listQuery.name = null;
this.listQuery.startTime = null;
this.listQuery.endTime = null;
this.listQuery.statisticType = 1;
this.listQuery.pageNo = 1;
this.getDataList();
} else {
this.$refs.searchBarForm2.resetForm();
this.listQuery.name = null;
this.listQuery.startTime = null;
this.listQuery.endTime = null;
this.listQuery.pageNo = 1;
this.getDataList2();
}
},
// 2
getDataList2() {
getRawOthercostSunPage(this.listQuery).then((response) => {
this.tableData2 = response.data.list;
this.listQuery.total = response.data.total;
});
},
//tableBtn
handleClick(val) {
if (val.type === 'edit') {
this.addOrUpdateVisible = true;
this.addOrEditTitle = '编辑';
this.$nextTick(() => {
this.$refs.addOrUpdate.init(val.data, this.listQuery.statisticType);
});
} else {
this.otherMethods(val);
}
},
},
};
</script>
<style lang="scss">
.energyOverlimitLog {
.el-tabs__nav::after {
content: '';
position: absolute;
left: 0;
bottom: 0;
width: 100%;
height: 2px;
background-color: #e4e7ed;
}
.el-tabs__nav-wrap::after {
width: 0;
}
.el-tabs__item {
padding: 0 10px;
}
.el-tabs__item:hover {
color: rgba(0, 0, 0, 0.85);
}
.el-tabs__item.is-active {
color: rgba(0, 0, 0, 0.85);
}
.el-tabs__item {
color: rgba(0, 0, 0, 0.45);
}
.searchBarBox {
margin-bottom: 0;
}
}
</style>

View File

@ -0,0 +1,123 @@
<!--
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: zwq
* @LastEditTime: 2024-04-18 16:32:56
* @Description:
-->
<template>
<el-form
:model="dataForm"
:rules="dataRule"
ref="dataForm"
@keyup.enter.native="dataFormSubmit()"
label-width="80px">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="成本名称" prop="name">
<el-select
v-model="dataForm.name"
filterable
clearable
:style="{ width: '100%' }"
@change="setLabel"
placeholder="请选择成本名称">
<el-option
v-for="item in nameArr"
:key="item.name"
:label="item.label"
:value="item.name"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="成本金额" prop="price">
<el-input-number
:min="0"
style="width: 80%"
v-model="dataForm.price"
clearable
placeholder="请输入成本金额" />
()
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="所属日期" prop="recTime">
<el-date-picker
v-model="dataForm.recTime"
type="date"
value-format="timestamp"
:style="{ width: '100%' }"
placeholder="选择所属日期"></el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="备注" prop="remark">
<el-input
v-model="dataForm.remark"
clearable
placeholder="请输入备注" />
</el-form-item>
</el-col>
</el-row>
</el-form>
</template>
<script>
import basicAdd from '@/mixins/basic-add';
import {
createRawOthercostLog,
updateRawOthercostLog,
getRawOthercostLog,
} from '@/api/cost/costOthercostLog';
import moment from 'moment';
const nowData = moment().format('YYYY-MM-DD').valueOf()
export default {
mixins: [basicAdd],
props: {
nameArr: {
type: Array,
default: () => [],
},
},
data() {
return {
urlOptions: {
createURL: createRawOthercostLog,
updateURL: updateRawOthercostLog,
infoURL: getRawOthercostLog,
},
dataForm: {
id: undefined,
price: undefined,
name: undefined,
recTime: new Date().getTime(),
remark: undefined,
},
dataRule: {
price: [
{ required: true, message: '成本金额不能为空', trigger: 'blur' },
],
name: [
{ required: true, message: ' 成本名称不能为空', trigger: 'blur' },
],
recTime: [
{
required: true,
message: '所属日期不能为空',
trigger: 'change',
},
],
},
};
},
methods: {
setLabel(val){
this.dataForm.label = this.nameArr.find(item=>item.name===val).label
}
},
};
</script>

View File

@ -0,0 +1,208 @@
<template>
<div class="app-container">
<search-bar
:formConfigs="formConfig"
ref="searchBarForm"
@headBtnClick="buttonClick" />
<base-table
v-loading="dataListLoading"
:table-props="tableProps"
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:max-height="tableH"
:table-data="tableData">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="120"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick" />
</base-table>
<pagination
:limit.sync="listQuery.pageSize"
:page.sync="listQuery.pageNo"
:total="listQuery.total"
@pagination="getDataList" />
<base-dialog
:dialogTitle="addOrEditTitle"
:dialogVisible="addOrUpdateVisible"
@cancel="handleCancel"
@confirm="handleConfirm"
:before-close="handleCancel"
width="50%">
<add-or-update
ref="addOrUpdate"
:name-arr="formConfig[0].selectOptions"
@refreshDataList="successSubmit"></add-or-update>
</base-dialog>
</div>
</template>
<script>
import AddOrUpdate from './add-or-updata';
import basicPage from '@/mixins/basic-page';
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
import { parseTime } from '@/filter/code-filter';
import {
deleteRawOthercostLog,
getRawOthercostLogPage,
exportRawOthercostLogExcel,
} from '@/api/cost/costOthercostLog';
import { getRawOthercostRulePage } from '@/api/cost/rawOthercostRule';
const tableProps = [
{
prop: 'otherCostName',
label: '成本名称',
},
{
prop: 'recTime',
label: '日期',
filter: (val) => parseTime(val, '{y}年{m}月{d}日'),
},
{
prop: 'price',
label: '成本金额',
align: 'right',
},
{
prop: 'remark',
label: '备注',
},
];
export default {
mixins: [basicPage, tableHeightMixin],
data() {
return {
urlOptions: {
getDataListURL: getRawOthercostLogPage,
deleteURL: deleteRawOthercostLog,
exportURL: exportRawOthercostLogExcel,
},
tableProps,
tableBtn: [
this.$auth.hasPermi(`monitoring:cost-othercost-log:update`)
? {
type: 'edit',
btnName: '编辑',
}
: undefined,
this.$auth.hasPermi(`monitoring:cost-othercost-log:delete`)
? {
type: 'delete',
btnName: '删除',
}
: undefined,
].filter((v) => v),
tableData: [],
formConfig: [
{
type: 'select',
label: '成本名称',
selectOptions: [],
param: 'name',
labelField: 'label',
valueField: 'name',
filterable: true,
},
{
type: 'datePicker',
label: '时间范围',
dateType: 'daterange',
format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd HH:mm:ss',
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
param: 'searchTime',
},
{
type: 'button',
btnName: '搜索',
name: 'search',
color: 'primary',
},
{
type: this.$auth.hasPermi('monitoring:cost-othercost-log:create')
? 'separate'
: '',
},
{
type: this.$auth.hasPermi('monitoring:cost-othercost-log:create')
? 'button'
: '',
btnName: '新增',
name: 'add',
color: 'success',
plain: true,
},
// {
// type: this.$auth.hasPermi('monitoring:cost-othercost-log:create') ? 'separate' : '',
// },
// {
// type: this.$auth.hasPermi('monitoring:cost-othercost-log:export') ? 'button' : '',
// btnName: '',
// name: 'export',
// color: 'warning',
// },
],
};
},
components: {
AddOrUpdate,
},
created() {
const params = {
pageNo: 1,
pageSize: 100,
};
getRawOthercostRulePage(params).then((response) => {
this.formConfig[0].selectOptions = response.data.list;
});
},
methods: {
buttonClick(val) {
switch (val.btnName) {
case 'search':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.name = val.name||null;
this.listQuery.startTime = val.searchTime ? val.searchTime[0] : null;
this.listQuery.endTime = val.searchTime
? val.searchTime[1].substr(0, 10) + ' 23:59:59'
: null;
this.getDataList();
break;
case 'add':
this.addOrUpdateHandle();
break;
case 'export':
this.listQuery.pageNo = 1;
this.listQuery.pageSize = 10;
this.listQuery.name = val.name;
this.listQuery.recTime = val.searchTime;
this.handleExport();
break;
default:
console.log(val);
}
},
//tableBtn
handleClick(val) {
if (val.type === "edit") {
this.addOrUpdateVisible = true;
this.addOrEditTitle = "编辑";
this.$nextTick(() => {
this.$refs.addOrUpdate.init(val.data.id);
});
} else if (val.type === "delete") {
this.deleteHandle(val.data.id, val.data.otherCostName, val.data._pageIndex)
} else {
this.otherMethods(val)
}
},
},
};
</script>

View File

@ -2,7 +2,7 @@
* @Author: zwq * @Author: zwq
* @Date: 2023-08-01 13:52:10 * @Date: 2023-08-01 13:52:10
* @LastEditors: zwq * @LastEditors: zwq
* @LastEditTime: 2024-03-21 15:59:26 * @LastEditTime: 2024-04-17 16:59:58
* @Description: * @Description:
--> -->
<template> <template>
@ -16,77 +16,62 @@
label-position="top"> label-position="top">
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="12"> <el-col :span="12">
<el-form-item label="原料名称" prop="materialId"> <el-form-item label="成本名称" prop="label">
<el-select <el-input v-model="dataForm.label" clearable readonly />
v-model="dataForm.materialId"
filterable
clearable
@change="setCode"
:style="{ width: '100%' }"
placeholder="请选择原料名称">
<el-option
v-for="item in MaterialList"
:key="item.id"
:label="item.name"
:value="item.id"></el-option>
</el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="原料等级" prop="grade"> <el-form-item label="自动计算策略" prop="type">
<el-select <el-radio-group v-model="dataForm.type" @input="setType">
v-model="dataForm.grade" <el-radio :label="1">每天等价</el-radio>
filterable <el-radio :label="2">折旧</el-radio>
clearable </el-radio-group>
:style="{ width: '100%' }"
placeholder="请选择原料等级">
<el-option
v-for="item in urlOptions.dictList.dict0"
:key="item.id"
:label="item.label"
:value="parseInt(item.value)"></el-option>
</el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12" v-if="dataForm.type === 1" key="one">
<el-form-item label="原料编码" prop="code"> <el-form-item label="价格" prop="price">
<el-input v-model="dataForm.code" clearable readonly />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="单价" prop="price">
<el-input-number <el-input-number
:min="0" :min="0"
style="width: 80%" style="width: 80%"
v-model="dataForm.price" v-model="dataForm.price"
clearable clearable />
placeholder="请输入允许留存时间" /> ()
(/)
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12" v-if="dataForm.type === 2" key="two">
<el-form-item label="生效开始时间" prop="enabledTime"> <el-form-item label="总价" prop="price">
<el-date-picker <el-input-number
v-model="dataForm.enabledTime" :min="0"
type="datetime" style="width: 80%"
value-format="timestamp" v-model="dataForm.price"
:style="{ width: '100%' }" clearable />
placeholder="选择开始时间"></el-date-picker> ()
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12" v-if="dataForm.type === 2" key="three">
<el-form-item label="生效结束时间" prop="disabledTime"> <el-form-item label="折旧率" prop="ratio">
<el-date-picker <el-input-number
v-model="dataForm.disabledTime" :min="0"
type="datetime" style="width: 80%"
value-format="timestamp" v-model="dataForm.ratio"
:style="{ width: '100%' }" clearable />
placeholder="选择结束时间"></el-date-picker> (%)
</el-form-item>
</el-col>
<el-col :span="12" v-if="dataForm.type === 2" key="four">
<el-form-item label="折旧年限" prop="timeLimit">
<el-input-number
:min="0"
style="width: 80%"
v-model="dataForm.timeLimit"
clearable />
()
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="备注" prop="remark"> <el-form-item label="备注" prop="remark">
<el-input <el-input
@input="$forceUpdate()"
v-model="dataForm.remark" v-model="dataForm.remark"
clearable clearable
placeholder="请输入备注" /> placeholder="请输入备注" />
@ -97,14 +82,12 @@
</template> </template>
<script> <script>
import basicAdd from '@/mixins/basic-add';
import { import {
updateRawOthercostRule, updateRawOthercostRule,
getRawOthercostRule, getRawOthercostRule,
} from '@/api/cost/rawOthercostRule'; } from '@/api/cost/rawOthercostRule';
export default { export default {
mixins: [basicAdd],
data() { data() {
return { return {
urlOptions: { urlOptions: {
@ -112,23 +95,65 @@ export default {
infoURL: getRawOthercostRule, infoURL: getRawOthercostRule,
}, },
dataForm: { dataForm: {
id: undefined, label: undefined,
code: '', type: 1,
materialId: '', price: 0,
price: '', ratio: 0,
grade: '', timeLimit: 1,
remark: '', remark: '',
}, },
visible: false,
dataRule: { dataRule: {
materialId: [ price: [{ required: true, message: '价格不能为空', trigger: 'blur' }],
{ required: true, message: '原料不能为空', trigger: 'change' }, ratio: [{ required: true, message: '折旧率不能为空', trigger: 'blur' }],
timeLimit: [
{ required: true, message: '折旧年限不能为空', trigger: 'blur' },
], ],
price: [{ required: true, message: '单价不能为空', trigger: 'blur' }],
}, },
}; };
}, },
created() {}, created() {},
methods: { methods: {
init(val) {
this.dataForm = {
label: undefined,
type: 1,
price: 0,
ratio: 0,
timeLimit: 1,
remark: '',
};
this.visible = true;
this.$nextTick(() => {
this.$refs['dataForm'].resetFields();
this.dataForm = JSON.parse(JSON.stringify(val));
});
},
setType(val) {
if (val === 1) {
} else {
}
},
//
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (!valid) {
return false;
}
//
this.urlOptions.updateURL(this.dataForm).then((response) => {
this.$modal.msgSuccess('修改成功');
this.visible = false;
this.$emit('refreshDataList');
});
});
},
/** 清空form */
formClear() {
if (this.$refs.dataForm !== undefined) {
this.$refs.dataForm.resetFields();
}
},
}, },
}; };
</script> </script>

View File

@ -1,3 +1,10 @@
<!--
* @Author: zwq
* @Date: 2024-04-15 16:52:38
* @LastEditors: zwq
* @LastEditTime: 2024-04-17 17:01:26
* @Description:
-->
<template> <template>
<div class="app-container"> <div class="app-container">
<!-- 列表 --> <!-- 列表 -->
@ -48,13 +55,12 @@ import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
const tableProps = [ const tableProps = [
{ {
prop: 'name', prop: 'label',
label: '成本名称', label: '成本名称',
}, },
{ {
prop: 'type', prop: 'type',
label: '自动计算方式', label: '自动计算方式',
width: 220,
subcomponent: typeRule, subcomponent: typeRule,
}, },
{ {
@ -69,11 +75,10 @@ export default {
return { return {
urlOptions: { urlOptions: {
getDataListURL: getRawOthercostRulePage, getDataListURL: getRawOthercostRulePage,
deleteURL: deleteCostMaterialSet,
}, },
tableProps, tableProps,
tableBtn: [ tableBtn: [
this.$auth.hasPermi(`extend:cost-material-set:update`) this.$auth.hasPermi(`monitoring:cost-othercost-rule:update`)
? { ? {
type: 'edit', type: 'edit',
btnName: '编辑', btnName: '编辑',
@ -89,6 +94,16 @@ export default {
created() { created() {
}, },
methods: { methods: {
//tableBtn
handleClick(val) {
if (val.type === "edit") {
this.addOrUpdateVisible = true;
this.addOrEditTitle = "编辑";
this.$nextTick(() => {
this.$refs.addOrUpdate.init(val.data);
});
}
},
}, },
}; };
</script> </script>

View File

@ -207,9 +207,9 @@
<el-select v-model="form.roleIds" multiple placeholder="请选择"> <el-select v-model="form.roleIds" multiple placeholder="请选择">
<el-option <el-option
v-for="item in roleOptions" v-for="item in roleOptions"
:key="parseInt(item.id)" :key="item.id"
:label="item.name" :label="item.name"
:value="parseInt(item.id)" :value="item.id"
></el-option> ></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>