更新自贡
This commit is contained in:
		
							
								
								
									
										113
									
								
								src/views/cost/deep/costDeepEnergy/add-or-updata.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										113
									
								
								src/views/cost/deep/costDeepEnergy/add-or-updata.vue
									
									
									
									
									
										Normal 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>
 | 
			
		||||
							
								
								
									
										347
									
								
								src/views/cost/deep/costDeepEnergy/index.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										347
									
								
								src/views/cost/deep/costDeepEnergy/index.vue
									
									
									
									
									
										Normal 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>
 | 
			
		||||
							
								
								
									
										115
									
								
								src/views/cost/deep/costDeepOthercostHis/add-or-updata.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										115
									
								
								src/views/cost/deep/costDeepOthercostHis/add-or-updata.vue
									
									
									
									
									
										Normal 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>
 | 
			
		||||
							
								
								
									
										321
									
								
								src/views/cost/deep/costDeepOthercostHis/index.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										321
									
								
								src/views/cost/deep/costDeepOthercostHis/index.vue
									
									
									
									
									
										Normal 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>
 | 
			
		||||
							
								
								
									
										123
									
								
								src/views/cost/deep/costDeepOthercostLog/add-or-updata.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										123
									
								
								src/views/cost/deep/costDeepOthercostLog/add-or-updata.vue
									
									
									
									
									
										Normal 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>
 | 
			
		||||
							
								
								
									
										208
									
								
								src/views/cost/deep/costDeepOthercostLog/index.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										208
									
								
								src/views/cost/deep/costDeepOthercostLog/index.vue
									
									
									
									
									
										Normal 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>
 | 
			
		||||
							
								
								
									
										159
									
								
								src/views/cost/deep/costDeepOthercostRule/add-or-updata.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										159
									
								
								src/views/cost/deep/costDeepOthercostRule/add-or-updata.vue
									
									
									
									
									
										Normal 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>
 | 
			
		||||
							
								
								
									
										109
									
								
								src/views/cost/deep/costDeepOthercostRule/index.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										109
									
								
								src/views/cost/deep/costDeepOthercostRule/index.vue
									
									
									
									
									
										Normal 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>
 | 
			
		||||
							
								
								
									
										31
									
								
								src/views/cost/deep/costDeepOthercostRule/typeRule.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								src/views/cost/deep/costDeepOthercostRule/typeRule.vue
									
									
									
									
									
										Normal 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>
 | 
			
		||||
							
								
								
									
										113
									
								
								src/views/cost/raw/costEnergy/add-or-updata.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										113
									
								
								src/views/cost/raw/costEnergy/add-or-updata.vue
									
									
									
									
									
										Normal 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>
 | 
			
		||||
							
								
								
									
										347
									
								
								src/views/cost/raw/costEnergy/index.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										347
									
								
								src/views/cost/raw/costEnergy/index.vue
									
									
									
									
									
										Normal 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>
 | 
			
		||||
							
								
								
									
										114
									
								
								src/views/cost/raw/costMaterial/add-or-updata.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										114
									
								
								src/views/cost/raw/costMaterial/add-or-updata.vue
									
									
									
									
									
										Normal 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>
 | 
			
		||||
							
								
								
									
										346
									
								
								src/views/cost/raw/costMaterial/index.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										346
									
								
								src/views/cost/raw/costMaterial/index.vue
									
									
									
									
									
										Normal 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>
 | 
			
		||||
							
								
								
									
										23
									
								
								src/views/cost/raw/costMaterial/typeRule.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								src/views/cost/raw/costMaterial/typeRule.vue
									
									
									
									
									
										Normal 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>
 | 
			
		||||
							
								
								
									
										171
									
								
								src/views/cost/raw/costOriginRatioHis/add-or-updata.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										171
									
								
								src/views/cost/raw/costOriginRatioHis/add-or-updata.vue
									
									
									
									
									
										Normal 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>
 | 
			
		||||
							
								
								
									
										237
									
								
								src/views/cost/raw/costOriginRatioHis/index.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										237
									
								
								src/views/cost/raw/costOriginRatioHis/index.vue
									
									
									
									
									
										Normal 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>
 | 
			
		||||
							
								
								
									
										115
									
								
								src/views/cost/raw/costOthercostHis/add-or-updata.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										115
									
								
								src/views/cost/raw/costOthercostHis/add-or-updata.vue
									
									
									
									
									
										Normal 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>
 | 
			
		||||
							
								
								
									
										321
									
								
								src/views/cost/raw/costOthercostHis/index.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										321
									
								
								src/views/cost/raw/costOthercostHis/index.vue
									
									
									
									
									
										Normal 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>
 | 
			
		||||
							
								
								
									
										123
									
								
								src/views/cost/raw/costOthercostLog/add-or-updata.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										123
									
								
								src/views/cost/raw/costOthercostLog/add-or-updata.vue
									
									
									
									
									
										Normal 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>
 | 
			
		||||
							
								
								
									
										208
									
								
								src/views/cost/raw/costOthercostLog/index.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										208
									
								
								src/views/cost/raw/costOthercostLog/index.vue
									
									
									
									
									
										Normal 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>
 | 
			
		||||
@@ -2,7 +2,7 @@
 | 
			
		||||
 * @Author: zwq
 | 
			
		||||
 * @Date: 2023-08-01 13:52:10
 | 
			
		||||
 * @LastEditors: zwq
 | 
			
		||||
 * @LastEditTime: 2024-03-21 15:59:26
 | 
			
		||||
 * @LastEditTime: 2024-04-17 16:59:58
 | 
			
		||||
 * @Description:
 | 
			
		||||
-->
 | 
			
		||||
<template>
 | 
			
		||||
@@ -16,77 +16,62 @@
 | 
			
		||||
		label-position="top">
 | 
			
		||||
		<el-row :gutter="20">
 | 
			
		||||
			<el-col :span="12">
 | 
			
		||||
				<el-form-item label="原料名称" prop="materialId">
 | 
			
		||||
					<el-select
 | 
			
		||||
						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 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="grade">
 | 
			
		||||
					<el-select
 | 
			
		||||
						v-model="dataForm.grade"
 | 
			
		||||
						filterable
 | 
			
		||||
						clearable
 | 
			
		||||
						: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 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">
 | 
			
		||||
				<el-form-item label="原料编码" prop="code">
 | 
			
		||||
					<el-input v-model="dataForm.code" clearable readonly />
 | 
			
		||||
				</el-form-item>
 | 
			
		||||
			</el-col>
 | 
			
		||||
			<el-col :span="12">
 | 
			
		||||
				<el-form-item label="单价" prop="price">
 | 
			
		||||
			<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
 | 
			
		||||
						placeholder="请输入允许留存时间" />
 | 
			
		||||
					(元/吨)
 | 
			
		||||
						clearable />
 | 
			
		||||
					(元)
 | 
			
		||||
				</el-form-item>
 | 
			
		||||
			</el-col>
 | 
			
		||||
			<el-col :span="12">
 | 
			
		||||
				<el-form-item label="生效开始时间" prop="enabledTime">
 | 
			
		||||
					<el-date-picker
 | 
			
		||||
						v-model="dataForm.enabledTime"
 | 
			
		||||
						type="datetime"
 | 
			
		||||
						value-format="timestamp"
 | 
			
		||||
						:style="{ width: '100%' }"
 | 
			
		||||
						placeholder="选择开始时间"></el-date-picker>
 | 
			
		||||
			<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">
 | 
			
		||||
				<el-form-item label="生效结束时间" prop="disabledTime">
 | 
			
		||||
					<el-date-picker
 | 
			
		||||
						v-model="dataForm.disabledTime"
 | 
			
		||||
						type="datetime"
 | 
			
		||||
						value-format="timestamp"
 | 
			
		||||
						:style="{ width: '100%' }"
 | 
			
		||||
						placeholder="选择结束时间"></el-date-picker>
 | 
			
		||||
			<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="请输入备注" />
 | 
			
		||||
@@ -97,14 +82,12 @@
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<script>
 | 
			
		||||
import basicAdd from '@/mixins/basic-add';
 | 
			
		||||
import {
 | 
			
		||||
	updateRawOthercostRule,
 | 
			
		||||
	getRawOthercostRule,
 | 
			
		||||
} from '@/api/cost/rawOthercostRule';
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
	mixins: [basicAdd],
 | 
			
		||||
	data() {
 | 
			
		||||
		return {
 | 
			
		||||
			urlOptions: {
 | 
			
		||||
@@ -112,23 +95,65 @@ export default {
 | 
			
		||||
				infoURL: getRawOthercostRule,
 | 
			
		||||
			},
 | 
			
		||||
			dataForm: {
 | 
			
		||||
				id: undefined,
 | 
			
		||||
				code: '',
 | 
			
		||||
				materialId: '',
 | 
			
		||||
				price: '',
 | 
			
		||||
				grade: '',
 | 
			
		||||
				label: undefined,
 | 
			
		||||
				type: 1,
 | 
			
		||||
				price: 0,
 | 
			
		||||
				ratio: 0,
 | 
			
		||||
				timeLimit: 1,
 | 
			
		||||
				remark: '',
 | 
			
		||||
			},
 | 
			
		||||
			visible: false,
 | 
			
		||||
			dataRule: {
 | 
			
		||||
				materialId: [
 | 
			
		||||
					{ required: true, message: '原料不能为空', trigger: 'change' },
 | 
			
		||||
				price: [{ required: true, message: '价格不能为空', trigger: 'blur' }],
 | 
			
		||||
				ratio: [{ required: true, message: '折旧率不能为空', trigger: 'blur' }],
 | 
			
		||||
				timeLimit: [
 | 
			
		||||
					{ required: true, message: '折旧年限不能为空', trigger: 'blur' },
 | 
			
		||||
				],
 | 
			
		||||
				price: [{ 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>
 | 
			
		||||
 
 | 
			
		||||
@@ -1,3 +1,10 @@
 | 
			
		||||
<!--
 | 
			
		||||
 * @Author: zwq
 | 
			
		||||
 * @Date: 2024-04-15 16:52:38
 | 
			
		||||
 * @LastEditors: zwq
 | 
			
		||||
 * @LastEditTime: 2024-04-17 17:01:26
 | 
			
		||||
 * @Description:
 | 
			
		||||
-->
 | 
			
		||||
<template>
 | 
			
		||||
	<div class="app-container">
 | 
			
		||||
		<!-- 列表 -->
 | 
			
		||||
@@ -48,13 +55,12 @@ import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
 | 
			
		||||
 | 
			
		||||
const tableProps = [
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'name',
 | 
			
		||||
		prop: 'label',
 | 
			
		||||
		label: '成本名称',
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
		prop: 'type',
 | 
			
		||||
		label: '自动计算方式',
 | 
			
		||||
		width: 220,
 | 
			
		||||
		subcomponent: typeRule,
 | 
			
		||||
	},
 | 
			
		||||
	{
 | 
			
		||||
@@ -69,11 +75,10 @@ export default {
 | 
			
		||||
		return {
 | 
			
		||||
			urlOptions: {
 | 
			
		||||
				getDataListURL: getRawOthercostRulePage,
 | 
			
		||||
				deleteURL: deleteCostMaterialSet,
 | 
			
		||||
			},
 | 
			
		||||
			tableProps,
 | 
			
		||||
			tableBtn: [
 | 
			
		||||
				this.$auth.hasPermi(`extend:cost-material-set:update`)
 | 
			
		||||
				this.$auth.hasPermi(`monitoring:cost-othercost-rule:update`)
 | 
			
		||||
					? {
 | 
			
		||||
							type: 'edit',
 | 
			
		||||
							btnName: '编辑',
 | 
			
		||||
@@ -89,6 +94,16 @@ export default {
 | 
			
		||||
	created() {
 | 
			
		||||
	},
 | 
			
		||||
	methods: {
 | 
			
		||||
    //tableBtn点击
 | 
			
		||||
    handleClick(val) {
 | 
			
		||||
      if (val.type === "edit") {
 | 
			
		||||
        this.addOrUpdateVisible = true;
 | 
			
		||||
        this.addOrEditTitle = "编辑";
 | 
			
		||||
        this.$nextTick(() => {
 | 
			
		||||
          this.$refs.addOrUpdate.init(val.data);
 | 
			
		||||
        });
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
	},
 | 
			
		||||
};
 | 
			
		||||
</script>
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user