projects/mesxc-zjl #138

Merged
juzi merged 3 commits from projects/mesxc-zjl into projects/mesxc-test 2023-12-06 10:09:07 +08:00
11 changed files with 79 additions and 60 deletions
Showing only changes of commit fe0c84bc3a - Show all commits

View File

@ -13,8 +13,8 @@ VUE_APP_TITLE = MES系统
# 芋道管理系统/开发环境 # 芋道管理系统/开发环境
# VUE_APP_BASE_API = 'http://100.64.0.26:48082' # VUE_APP_BASE_API = 'http://100.64.0.26:48082'
# VUE_APP_BASE_API = 'http://192.168.0.33:48082' 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.4.173:48080'
# VUE_APP_BASE_API = 'http://192.168.2.173: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.49:48082'
# VUE_APP_BASE_API = 'http://192.168.1.8:48082' # VUE_APP_BASE_API = 'http://192.168.1.8:48082'

View File

@ -5,7 +5,7 @@
const baseURL = process.env.VUE_APP_BASE_API const baseURL = process.env.VUE_APP_BASE_API
// 日期格式化 // 日期格式化(通用)
export function parseTime(time, pattern) { export function parseTime(time, pattern) {
if (arguments.length === 0 || !time) { if (arguments.length === 0 || !time) {
return null return null
@ -48,6 +48,51 @@ export function parseTime(time, pattern) {
return time_str return time_str
} }
// 日期格式化(仅适用表格)
export function parseTimeTable(pattern) {
return function(time){
if (arguments.length === 0 || !time) {
return null
}
const format = pattern || '{y}-{m}-{d} {h}:{i}:{s}'
let date
if (typeof time === 'object') {
date = time
} else {
if ((typeof time === 'string') && (/^[0-9]+$/.test(time))) {
time = parseInt(time)
} else if (typeof time === 'string') {
time = time.replace(new RegExp(/-/gm), '/').replace('T', ' ').replace(new RegExp(/\.\d{3}/gm),'');
}
if ((typeof time === 'number') && (time.toString().length === 10)) {
time = time * 1000
}
date = new Date(time)
}
const formatObj = {
y: date.getFullYear(),
m: date.getMonth() + 1,
d: date.getDate(),
h: date.getHours(),
i: date.getMinutes(),
s: date.getSeconds(),
a: date.getDay()
}
const time_str = format.replace(/{([ymdhisa])+}/g, (result, key) => {
let value = formatObj[key]
// Note: getDay() returns 0 on Sunday
if (key === 'a') {
return ['日', '一', '二', '三', '四', '五', '六'][value]
}
if (result.length > 0 && value < 10) {
value = '0' + value
}
return value || 0
})
return time_str
}
}
// 表单重置 // 表单重置
export function resetForm(refName) { export function resetForm(refName) {
if (this.$refs[refName]) { if (this.$refs[refName]) {

View File

@ -45,7 +45,8 @@
<el-date-picker <el-date-picker
v-model="form.recordTime" v-model="form.recordTime"
type="date" type="date"
value-format="yyyy-MM-dd" format="yyyy-MM-dd"
value-format="timestamp"
placeholder="选择日期" placeholder="选择日期"
style="width: 100%;"> style="width: 100%;">
</el-date-picker> </el-date-picker>
@ -89,20 +90,17 @@ export default {
}, },
methods: { methods: {
init(params) { init(params) {
console.log(params) this.form.recordTime = moment().valueOf()
this.form.recordTime = moment().format('YYYY-MM-DD')
console.log(this.form.recordTime)
if (params.type === 'add') { if (params.type === 'add') {
this.isEdit = false this.isEdit = false
} else if (params.type === 'meterReading') { } else if (params.type === 'meterReading') {
this.isEdit = false this.isEdit = false
this.form.energyTypeId = params.energyType this.form.energyTypeId = params.energyTypeId
this.form.tableName = params.tableName + '' this.form.tableName = params.tableName + ''
}else { }else {
this.isEdit = true this.isEdit = true
this.form.id = params.id this.form.id = params.id
energyQuantityManualGet({id: this.form.id}).then(res => { energyQuantityManualGet({id: this.form.id}).then(res => {
console.log(res)
if (res.code === 0) { if (res.code === 0) {
this.form.energyTypeId = res.data.energyTypeId this.form.energyTypeId = res.data.energyTypeId
this.form.tableName = res.data.tableName ? res.data.tableName+'' : '' this.form.tableName = res.data.tableName ? res.data.tableName+'' : ''
@ -118,6 +116,7 @@ export default {
if (valid) { if (valid) {
if (!this.form.unit) { if (!this.form.unit) {
this.$modal.msgError("抄表数单位不能为空"); this.$modal.msgError("抄表数单位不能为空");
return false
} }
if (this.isEdit) { if (this.isEdit) {
// //

View File

@ -48,26 +48,29 @@
import { energyQuantityManualPage, energyQuantityManualDelete, energyQuantityManualExport } from "@/api/base/energyQuantityManual" import { energyQuantityManualPage, energyQuantityManualDelete, energyQuantityManualExport } from "@/api/base/energyQuantityManual"
import { getEnergyTypeListAll } from "@/api/base/energyType" import { getEnergyTypeListAll } from "@/api/base/energyType"
import { publicFormatter } from '@/utils/dict' import { publicFormatter } from '@/utils/dict'
import { parseTime } from '@/utils/ruoyi' import { parseTime, parseTimeTable } from '@/utils/ruoyi'
// import FileSaver from "file-saver" // import FileSaver from "file-saver"
// import * as XLSX from 'xlsx/xlsx.mjs' // import * as XLSX from 'xlsx/xlsx.mjs'
import EnergyQuantityManualAdd from './components/energyQuantityManualAdd.vue' import EnergyQuantityManualAdd from './components/energyQuantityManualAdd'
import moment from 'moment' import moment from 'moment'
const tableProps = [ const tableProps = [
{ {
prop: 'energyType', prop: 'energyType',
label: '能源类型' label: '能源类型',
minWidth: 110,
showOverflowtooltip: true
}, },
{ {
prop: 'tableName', prop: 'tableName',
label: '水/气表名', label: '水/气表名',
filter: publicFormatter('table_name') filter: publicFormatter('table_name'),
minWidth: 110
}, },
{ {
prop: 'recordTime', prop: 'recordTime',
label: '抄表日期', label: '抄表日期',
filter: parseTime, filter: parseTimeTable('{y}-{m}-{d}'),
minWidth: 160 minWidth: 110
}, },
{ {
prop: 'readingQuantity', prop: 'readingQuantity',
@ -76,12 +79,13 @@ const tableProps = [
{ {
prop: 'recordTimeLast', prop: 'recordTimeLast',
label: '上期抄表日期', label: '上期抄表日期',
filter: parseTime, filter: parseTimeTable('{y}-{m}-{d}'),
minWidth: 160 minWidth: 110
}, },
{ {
prop: 'readingQuantityLast', prop: 'readingQuantityLast',
label: '上期抄表值' label: '上期抄表值',
minWidth: 110
}, },
{ {
prop: 'diff', prop: 'diff',
@ -191,42 +195,15 @@ export default {
window.addEventListener('resize', () => { window.addEventListener('resize', () => {
this.tableH = this.tableHeight(260) this.tableH = this.tableHeight(260)
}) })
if (location.href.indexOf('?') > 0) { let end = moment(moment().format('YYYY-MM-DD 23:59:59')).valueOf()
let arr = location.href.split('?')[1].split('&') let start = moment(moment().subtract(7, 'days').format('YYYY-MM-DD 00:00:00')).valueOf()
this.formConfig[1].defaultSelect = [arr[0].split('=')[1], arr[1].split('=')[1]] this.formConfig[1].defaultSelect = [start, end]
this.queryParams.recordTime[0] = arr[0].split('=')[1] this.queryParams.recordTime[0] = start
this.queryParams.recordTime[1] = arr[1].split('=')[1] this.queryParams.recordTime[1] = end
} else {
let end = moment(moment().format('YYYY-MM-DD 23:59:59')).valueOf()
let start = moment(moment().subtract(7, 'days').format('YYYY-MM-DD 00:00:00')).valueOf()
this.formConfig[1].defaultSelect = [start, end]
this.queryParams.recordTime[0] = start
this.queryParams.recordTime[1] = end
}
this.getList(); this.getList();
this.getTypeList() this.getTypeList()
}, },
watch: {
$route: 'initData'
},
methods: { methods: {
initData(to) {
if (to.name === 'EnergyQuantityManual') {
if (location.href.indexOf('?') > 0) {
let arr = location.href.split('?')[1].split('&')
this.formConfig[1].defaultSelect = [arr[0].split('=')[1], arr[1].split('=')[1]]
this.queryParams.recordTime[0] = arr[0].split('=')[1]
this.queryParams.recordTime[1] = arr[1].split('=')[1]
} else {
let end = moment(moment().format('YYYY-MM-DD 23:59:59')).valueOf()
let start = moment(moment().subtract(7, 'days').format('YYYY-MM-DD 00:00:00')).valueOf()
this.formConfig[1].defaultSelect = [start, end]
this.queryParams.recordTime[0] = start
this.queryParams.recordTime[1] = end
}
this.getList()
}
},
buttonClick(val) { buttonClick(val) {
this.queryParams.pageNo = 1; this.queryParams.pageNo = 1;
this.queryParams.energyTypeId = val.energyTypeId this.queryParams.energyTypeId = val.energyTypeId
@ -293,7 +270,7 @@ export default {
this.centervisible = true this.centervisible = true
let paramB = {} let paramB = {}
paramB.type = 'meterReading' paramB.type = 'meterReading'
paramB.energyType = val.data.energyType paramB.energyTypeId = val.data.energyTypeId
paramB.tableName = val.data.tableName paramB.tableName = val.data.tableName
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.energyQuantityManualAdd.init(paramB) this.$refs.energyQuantityManualAdd.init(paramB)

View File

@ -80,7 +80,6 @@ export default {
let id = data.id let id = data.id
getEnergyType(id).then((res) => { getEnergyType(id).then((res) => {
if (res.code === 0) { if (res.code === 0) {
console.log(res)
if (res.data.pricingMethod === 0) { if (res.data.pricingMethod === 0) {
this.tableProps = this.temp1 this.tableProps = this.temp1
this.singlePrice = '' this.singlePrice = ''

View File

@ -22,7 +22,6 @@ export default {
}, },
methods: { methods: {
changeInput() { changeInput() {
console.log(this.list)
this.$emit('emitData', this.list) this.$emit('emitData', this.list)
} }
} }

View File

@ -28,7 +28,6 @@ export default {
}, },
methods: { methods: {
changeInput() { changeInput() {
console.log(this.list)
this.$emit('emitData', this.list) this.$emit('emitData', this.list)
} }
} }

View File

@ -221,10 +221,10 @@ export default {
// //
emitButtonClick1() { emitButtonClick1() {
let n = this.tableData1.length let n = this.tableData1.length
if (n >=3) { // if (n >=3) {
this.$modal.msgWarning('最多可添加3档计价') // this.$modal.msgWarning('3')
return false // return false
} // }
let obj = {} let obj = {}
obj.startTime = n === 0 ? '' : this.tableData1[n-1].endTime obj.startTime = n === 0 ? '' : this.tableData1[n-1].endTime
obj.endTime = '' obj.endTime = ''

View File

@ -43,6 +43,7 @@
import { getEnergyOverlimitLogPage } from "@/api/monitoring/energyOverlimitLog"; import { getEnergyOverlimitLogPage } from "@/api/monitoring/energyOverlimitLog";
import { getEnergyTypeListAll } from "@/api/base/energyType"; import { getEnergyTypeListAll } from "@/api/base/energyType";
import { publicFormatter } from '@/utils/dict' import { publicFormatter } from '@/utils/dict'
import { parseTime } from '@/utils/ruoyi'
const tableProps = [ const tableProps = [
{ {
prop: 'objName', prop: 'objName',

View File

@ -290,8 +290,7 @@ export default {
break; break;
case '2': // case '2': //
this.$router.push({ this.$router.push({
// path: '/energy/base/energy-quantity-realtime?startTime='+this.chooseObj.startTime+'&endTime='+this.chooseObj.endTime path: '/energy/base/energy-quantity-realtime?startTime='+this.chooseObj.startTime+'&endTime='+this.chooseObj.endTime
path: '/energy/base/energy-quantity-manual?startTime='+this.chooseObj.startTime+'&endTime='+this.chooseObj.endTime
}) })
break; break;
default: default:

View File

@ -28,6 +28,7 @@
<el-table v-if="refreshTable" v-loading="loading" :data="deptList" row-key="id" :default-expand-all="isExpandAll" <el-table v-if="refreshTable" v-loading="loading" :data="deptList" row-key="id" :default-expand-all="isExpandAll"
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"> :tree-props="{children: 'children', hasChildren: 'hasChildren'}">
<el-table-column prop="id" label="部门编码" width="260"></el-table-column>
<el-table-column prop="name" label="部门名称" width="260"></el-table-column> <el-table-column prop="name" label="部门名称" width="260"></el-table-column>
<el-table-column prop="leader" label="负责人" :formatter="userNicknameFormat" width="120"/> <el-table-column prop="leader" label="负责人" :formatter="userNicknameFormat" width="120"/>
<el-table-column prop="sort" label="排序" width="200"></el-table-column> <el-table-column prop="sort" label="排序" width="200"></el-table-column>