projects/mesxc-zjl #189

Fusionnée
juzi a fusionné 2 révision(s) à partir de projects/mesxc-zjl vers projects/mesxc-test 2024-01-25 17:21:17 +08:00
5 fichiers modifiés avec 163 ajouts et 63 suppressions

Voir le fichier

@ -15,7 +15,7 @@ VUE_APP_TITLE = MES系统
# VUE_APP_BASE_API = 'http://100.64.0.26:48082'
# VUE_APP_BASE_API = 'http://10.70.2.2:8080'
VUE_APP_BASE_API = 'http://192.168.0.33:48082'
# VUE_APP_BASE_API = 'http://192.168.4.173:48080'
# VUE_APP_BASE_API = 'http://192.168.1.20:48080'
# VUE_APP_BASE_API = 'http://192.168.2.173:48080'
# VUE_APP_BASE_API = 'http://192.168.1.49:48082'
# VUE_APP_BASE_API = 'http://192.168.1.8:48082'

Voir le fichier

@ -0,0 +1,38 @@
<template>
<div class="tableInner">
<!-- <el-input v-model="list[itemProp]" @blur="changeInput" /> -->
<el-input-number v-model="list[itemProp]" @change="changeInput" :min="0" :max="999999999" style='width: 100%;' :controls='false' :precision='2'></el-input-number>
</div>
</template>
<script>
export default {
name: 'InputArea',
props: {
injectData: {
type: Object,
default: () => ({})
},
itemProp: {
type: String
}
},
data() {
return {
list: this.injectData
}
},
methods: {
changeInput() {
console.log(this.list)
this.$emit('emitData', this.list)
}
}
}
</script>
<style scoped>
.tableInner .el-input__inner {
border: none;
padding: 0;
height: 33px;
}
</style>

Voir le fichier

@ -0,0 +1,44 @@
<template>
<div class="tableInner">
<el-select v-model="list[itemProp]" placeholder="请选择" style="width: 100%;" @change="changeSelect">
<el-option
v-for="item in getDictDatas(DICT_TYPE.TABLE_NAME)"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</div>
</template>
<script>
export default {
name: 'SelectArea',
props: {
injectData: {
type: Object,
default: () => ({})
},
itemProp: {
type: String
}
},
data() {
return {
list: this.injectData
}
},
methods: {
changeSelect() {
console.log(this.list)
this.$emit('emitData', this.list)
}
}
}
</script>
<style scoped>
.tableInner .el-input__inner {
border: none;
padding: 0;
height: 33px;
}
</style>

Voir le fichier

@ -13,33 +13,6 @@
</el-select>
</el-form-item>
</el-col>
<el-col :span='12'>
<el-form-item label="水/气表名" prop="tableName">
<el-select v-model="form.tableName" placeholder="请选择" style="width: 100%;" filterable>
<el-option
v-for="item in getDictDatas(DICT_TYPE.TABLE_NAME)"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span='12'>
<el-form-item label="抄表数" prop="readingQuantity">
<el-input-number v-model="form.readingQuantity" :min="0" :max="999999999999" :controls='false' style="width: 50%;"></el-input-number>
<el-select v-model="form.unit" placeholder="单位" style="width: 50%;">
<el-option
v-for="item in getDictDatas(DICT_TYPE.ENERGY_UNIT)"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span='12'>
<el-form-item label="抄表日期" prop="recordTime">
<el-date-picker
@ -53,11 +26,37 @@
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span='24'>
<base-table
border
:table-props="tableProps"
:table-data="tableData"
:add-button-show="addButtonShow"
@emitFun="inputChange"
@emitButtonClick="emitButtonClick"
/>
</el-col>
</el-row>
</el-form>
</template>
<script>
import { energyQuantityManualCreate, energyQuantityManualUpdate, energyQuantityManualGet } from '@/api/base/energyQuantityManual'
import moment from 'moment'
import InputArea from './InputArea'
import SelectArea from './SelectArea'
const tableProps = [
{
prop: 'tableName',
label: '表名',
subcomponent: SelectArea
},
{
prop: 'readingQuantity',
label: '抄表数',
subcomponent: InputArea
}
]
export default {
name: 'EnergyQuantityManualAdd',
props: {
@ -71,18 +70,17 @@ export default {
},
data() {
return {
tableProps,
tableData: [],
addButtonShow:'新增',
form: {
id: '',
energyTypeId: '',
tableName: '',
readingQuantity: null,
unit: '',
recordTime: ''
},
rules: {
energyTypeId: [{ required: true, message: '能源类型不能为空', trigger: 'change' }],
tableName: [{ required: true, message: '水/气表名不能为空', trigger: 'change' }],
readingQuantity: [{ required: true, message: '抄表数不能为空', trigger: 'blur' }],
recordTime: [{ required: true, message: '抄表日期不能为空', trigger: 'change' }]
},
isEdit: false
@ -96,38 +94,71 @@ export default {
} else if (params.type === 'meterReading') {
this.isEdit = false
this.form.energyTypeId = params.energyTypeId
this.form.tableName = params.tableName + ''
let obj = {}
obj.tableName = params.tableName + ''
obj.readingQuantity = 0
this.tableData.push(obj)
}else {
this.isEdit = true
this.form.id = params.id
this.addButtonShow = ''
energyQuantityManualGet({id: this.form.id}).then(res => {
if (res.code === 0) {
this.form.energyTypeId = res.data.energyTypeId
this.form.tableName = res.data.tableName ? res.data.tableName+'' : ''
this.form.readingQuantity = res.data.readingQuantity
this.form.unit = res.data.unit ? res.data.unit+'' : ''
this.form.recordTime = res.data.recordTime ? res.data.recordTime : null
let obj = {}
obj.tableName = res.data.tableName ? res.data.tableName+'' : ''
obj.readingQuantity = res.data.readingQuantity
this.tableData.push(obj)
}
})
}
},
inputChange(val) {
this.tableData[val._pageIndex - 1][val.prop] = val[val.prop]
},
emitButtonClick() {
let obj = {}
obj.tableName = ''
obj.readingQuantity = 0
this.tableData.push(obj)
},
submitForm() {
this.$refs['energyQuantityManualForm'].validate((valid) => {
if (valid) {
if (!this.form.unit) {
this.$modal.msgError("抄表数单位不能为空");
//
if (this.tableData.length === 0) {
this.$modal.msgError("抄表数据不能为空");
return false
}else{
for (let item of this.tableData) {
console.log(item)
if (!item.tableName || (!item.readingQuantity && item.readingQuantity!==0)) {
this.$modal.msgError("抄表数据有空值,请检查");
return false
}
}
}
if (this.isEdit) {
//
energyQuantityManualUpdate({...this.form}).then((res) => {
energyQuantityManualUpdate({
id:this.form.id,
energyTypeId:this.form.energyTypeId,
recordTime:this.form.recordTime,
tableName:this.tableData[0].tableName,
readingQuantity:this.tableData[0].readingQuantity
}).then((res) => {
if (res.code === 0) {
this.$modal.msgSuccess("操作成功");
this.$emit('successSubmit')
}
})
} else {
energyQuantityManualCreate({...this.form}).then((res) => {
energyQuantityManualCreate({
energyTypeId:this.form.energyTypeId,
recordTime:this.form.recordTime,
data:this.tableData
}).then((res) => {
if (res.code === 0) {
this.$modal.msgSuccess("操作成功");
this.$emit('successSubmit')
@ -143,6 +174,8 @@ export default {
this.$refs.energyQuantityManualForm.resetFields()
this.form.unit = ''
this.isEdit = false
this.addButtonShow = '新增'
this.tableData = []
}
}
}

Voir le fichier

@ -60,6 +60,12 @@ const tableProps = [
minWidth: 110,
showOverflowtooltip: true
},
{
prop: 'unit',
label: '单位',
filter: publicFormatter('energy_unit'),
minWidth: 110
},
{
prop: 'tableName',
label: '水/气表名',
@ -77,18 +83,7 @@ const tableProps = [
label: '抄表值'
},
{
prop: 'recordTimeLast',
label: '上期抄表日期',
filter: parseTimeTable('{y}-{m}-{d}'),
minWidth: 110
},
{
prop: 'readingQuantityLast',
label: '上期抄表值',
minWidth: 110
},
{
prop: 'diff',
prop: 'useQty',
label: '差值'
}
]
@ -156,17 +151,7 @@ export default {
this.$auth.hasPermi('base:energy-quantity-manual:update')
? {
type: 'edit',
btnName: '编辑',
showParam: {
type: '&',
data: [
{
type: 'equal',
name: 'latest',
value: 1
}
]
}
btnName: '编辑'
}
: undefined,
this.$auth.hasPermi('base:energy-quantity-manual:delete')