projects/mesxc-zhp #161
4
.env.dev
4
.env.dev
@ -13,8 +13,8 @@ VUE_APP_TITLE = MES系统
|
||||
|
||||
# 芋道管理系统/开发环境
|
||||
# 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.4.173:48080'
|
||||
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.2.173:48080'
|
||||
# VUE_APP_BASE_API = 'http://192.168.1.49:48082'
|
||||
# VUE_APP_BASE_API = 'http://192.168.1.8:48082'
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
const baseURL = process.env.VUE_APP_BASE_API
|
||||
|
||||
// 日期格式化
|
||||
// 日期格式化(通用)
|
||||
export function parseTime(time, pattern) {
|
||||
if (arguments.length === 0 || !time) {
|
||||
return null
|
||||
@ -48,6 +48,51 @@ export function parseTime(time, pattern) {
|
||||
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) {
|
||||
if (this.$refs[refName]) {
|
||||
|
@ -45,7 +45,8 @@
|
||||
<el-date-picker
|
||||
v-model="form.recordTime"
|
||||
type="date"
|
||||
value-format="yyyy-MM-dd"
|
||||
format="yyyy-MM-dd"
|
||||
value-format="timestamp"
|
||||
placeholder="选择日期"
|
||||
style="width: 100%;">
|
||||
</el-date-picker>
|
||||
@ -89,20 +90,17 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
init(params) {
|
||||
console.log(params)
|
||||
this.form.recordTime = moment().format('YYYY-MM-DD')
|
||||
console.log(this.form.recordTime)
|
||||
this.form.recordTime = moment().valueOf()
|
||||
if (params.type === 'add') {
|
||||
this.isEdit = false
|
||||
} else if (params.type === 'meterReading') {
|
||||
this.isEdit = false
|
||||
this.form.energyTypeId = params.energyType
|
||||
this.form.energyTypeId = params.energyTypeId
|
||||
this.form.tableName = params.tableName + ''
|
||||
}else {
|
||||
this.isEdit = true
|
||||
this.form.id = params.id
|
||||
energyQuantityManualGet({id: this.form.id}).then(res => {
|
||||
console.log(res)
|
||||
if (res.code === 0) {
|
||||
this.form.energyTypeId = res.data.energyTypeId
|
||||
this.form.tableName = res.data.tableName ? res.data.tableName+'' : ''
|
||||
@ -118,6 +116,7 @@ export default {
|
||||
if (valid) {
|
||||
if (!this.form.unit) {
|
||||
this.$modal.msgError("抄表数单位不能为空");
|
||||
return false
|
||||
}
|
||||
if (this.isEdit) {
|
||||
// 编辑
|
||||
|
@ -48,26 +48,29 @@
|
||||
import { energyQuantityManualPage, energyQuantityManualDelete, energyQuantityManualExport } from "@/api/base/energyQuantityManual"
|
||||
import { getEnergyTypeListAll } from "@/api/base/energyType"
|
||||
import { publicFormatter } from '@/utils/dict'
|
||||
import { parseTime } from '@/utils/ruoyi'
|
||||
import { parseTime, parseTimeTable } from '@/utils/ruoyi'
|
||||
// import FileSaver from "file-saver"
|
||||
// import * as XLSX from 'xlsx/xlsx.mjs'
|
||||
import EnergyQuantityManualAdd from './components/energyQuantityManualAdd.vue'
|
||||
import EnergyQuantityManualAdd from './components/energyQuantityManualAdd'
|
||||
import moment from 'moment'
|
||||
const tableProps = [
|
||||
{
|
||||
prop: 'energyType',
|
||||
label: '能源类型'
|
||||
label: '能源类型',
|
||||
minWidth: 110,
|
||||
showOverflowtooltip: true
|
||||
},
|
||||
{
|
||||
prop: 'tableName',
|
||||
label: '水/气表名',
|
||||
filter: publicFormatter('table_name')
|
||||
filter: publicFormatter('table_name'),
|
||||
minWidth: 110
|
||||
},
|
||||
{
|
||||
prop: 'recordTime',
|
||||
label: '抄表日期',
|
||||
filter: parseTime,
|
||||
minWidth: 160
|
||||
filter: parseTimeTable('{y}-{m}-{d}'),
|
||||
minWidth: 110
|
||||
},
|
||||
{
|
||||
prop: 'readingQuantity',
|
||||
@ -76,12 +79,13 @@ const tableProps = [
|
||||
{
|
||||
prop: 'recordTimeLast',
|
||||
label: '上期抄表日期',
|
||||
filter: parseTime,
|
||||
minWidth: 160
|
||||
filter: parseTimeTable('{y}-{m}-{d}'),
|
||||
minWidth: 110
|
||||
},
|
||||
{
|
||||
prop: 'readingQuantityLast',
|
||||
label: '上期抄表值'
|
||||
label: '上期抄表值',
|
||||
minWidth: 110
|
||||
},
|
||||
{
|
||||
prop: 'diff',
|
||||
@ -191,42 +195,15 @@ export default {
|
||||
window.addEventListener('resize', () => {
|
||||
this.tableH = this.tableHeight(260)
|
||||
})
|
||||
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
|
||||
}
|
||||
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.getTypeList()
|
||||
},
|
||||
watch: {
|
||||
$route: 'initData'
|
||||
},
|
||||
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) {
|
||||
this.queryParams.pageNo = 1;
|
||||
this.queryParams.energyTypeId = val.energyTypeId
|
||||
@ -293,7 +270,7 @@ export default {
|
||||
this.centervisible = true
|
||||
let paramB = {}
|
||||
paramB.type = 'meterReading'
|
||||
paramB.energyType = val.data.energyType
|
||||
paramB.energyTypeId = val.data.energyTypeId
|
||||
paramB.tableName = val.data.tableName
|
||||
this.$nextTick(() => {
|
||||
this.$refs.energyQuantityManualAdd.init(paramB)
|
||||
|
@ -80,7 +80,6 @@ export default {
|
||||
let id = data.id
|
||||
getEnergyType(id).then((res) => {
|
||||
if (res.code === 0) {
|
||||
console.log(res)
|
||||
if (res.data.pricingMethod === 0) {
|
||||
this.tableProps = this.temp1
|
||||
this.singlePrice = ''
|
||||
|
@ -22,7 +22,6 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
changeInput() {
|
||||
console.log(this.list)
|
||||
this.$emit('emitData', this.list)
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,6 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
changeInput() {
|
||||
console.log(this.list)
|
||||
this.$emit('emitData', this.list)
|
||||
}
|
||||
}
|
||||
|
@ -221,10 +221,10 @@ export default {
|
||||
// 增加
|
||||
emitButtonClick1() {
|
||||
let n = this.tableData1.length
|
||||
if (n >=3) {
|
||||
this.$modal.msgWarning('最多可添加3档计价')
|
||||
return false
|
||||
}
|
||||
// if (n >=3) {
|
||||
// this.$modal.msgWarning('最多可添加3档计价')
|
||||
// return false
|
||||
// }
|
||||
let obj = {}
|
||||
obj.startTime = n === 0 ? '' : this.tableData1[n-1].endTime
|
||||
obj.endTime = ''
|
||||
|
@ -43,6 +43,7 @@
|
||||
import { getEnergyOverlimitLogPage } from "@/api/monitoring/energyOverlimitLog";
|
||||
import { getEnergyTypeListAll } from "@/api/base/energyType";
|
||||
import { publicFormatter } from '@/utils/dict'
|
||||
import { parseTime } from '@/utils/ruoyi'
|
||||
const tableProps = [
|
||||
{
|
||||
prop: 'objName',
|
||||
|
@ -290,8 +290,7 @@ export default {
|
||||
break;
|
||||
case '2': // 能源
|
||||
this.$router.push({
|
||||
// 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
|
||||
path: '/energy/base/energy-quantity-realtime?startTime='+this.chooseObj.startTime+'&endTime='+this.chooseObj.endTime
|
||||
})
|
||||
break;
|
||||
default:
|
||||
|
@ -28,6 +28,7 @@
|
||||
|
||||
<el-table v-if="refreshTable" v-loading="loading" :data="deptList" row-key="id" :default-expand-all="isExpandAll"
|
||||
: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="leader" label="负责人" :formatter="userNicknameFormat" width="120"/>
|
||||
<el-table-column prop="sort" label="排序" width="200"></el-table-column>
|
||||
|
Loading…
Reference in New Issue
Block a user