diff --git a/src/api/base/energyQuantityManual.js b/src/api/base/energyQuantityManual.js new file mode 100644 index 00000000..d919b5a3 --- /dev/null +++ b/src/api/base/energyQuantityManual.js @@ -0,0 +1,56 @@ +import request from '@/utils/request' + +// 获得分页数据 +export function energyQuantityManualPage(data) { + return request({ + url: '/base/energy-quantity-manual/page', + method: 'post', + data: data + }) +} + +// 创建 +export function energyQuantityManualCreate(data) { + return request({ + url: '/base/energy-quantity-manual/create', + method: 'post', + data: data + }) +} + +// 更新 +export function energyQuantityManualUpdate(data) { + return request({ + url: '/base/energy-quantity-manual/update', + method: 'put', + data: data + }) +} + +//获得能源抄表(手动) +export function energyQuantityManualGet(query) { + return request({ + url: '/base/energy-quantity-manual/get', + method: 'get', + params: query + }) +} + +//删除 +export function energyQuantityManualDelete(query) { + return request({ + url: '/base/energy-quantity-manual/delete', + method: 'delete', + params: query + }) +} + +//导出 +export function energyQuantityManualExport(data) { + return request({ + url: '/base/energy-quantity-manual/export-excel', + method: 'post', + data: data, + responseType: 'blob' + }) +} \ No newline at end of file diff --git a/src/utils/dict.js b/src/utils/dict.js index ecaafb16..64695e1e 100644 --- a/src/utils/dict.js +++ b/src/utils/dict.js @@ -94,6 +94,8 @@ export const DICT_TYPE = { OBJECT_TYPE: 'object_type', STATISTIC_TYPE: 'statistic_type', TIME_DIM: 'time_dim', + TABLE_NAME: 'table_name', + METHOD: 'method', // ============== ORDER - 订单模块 ============= ORDER_STATUS: 'order_status', diff --git a/src/utils/ruoyi.js b/src/utils/ruoyi.js index 3b4e5256..5d875af0 100644 --- a/src/utils/ruoyi.js +++ b/src/utils/ruoyi.js @@ -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]) { diff --git a/src/views/energy/base/energyQuantityManual/components/energyQuantityManualAdd.vue b/src/views/energy/base/energyQuantityManual/components/energyQuantityManualAdd.vue new file mode 100644 index 00000000..1dda33d5 --- /dev/null +++ b/src/views/energy/base/energyQuantityManual/components/energyQuantityManualAdd.vue @@ -0,0 +1,149 @@ + + \ No newline at end of file diff --git a/src/views/energy/base/energyQuantityManual/index.vue b/src/views/energy/base/energyQuantityManual/index.vue new file mode 100644 index 00000000..e94da7bc --- /dev/null +++ b/src/views/energy/base/energyQuantityManual/index.vue @@ -0,0 +1,309 @@ + + + diff --git a/src/views/energy/base/energyType/components/InnerTable.vue b/src/views/energy/base/energyType/components/InnerTable.vue index 4dba190d..5eab7af9 100644 --- a/src/views/energy/base/energyType/components/InnerTable.vue +++ b/src/views/energy/base/energyType/components/InnerTable.vue @@ -1,12 +1,13 @@ @@ -91,6 +111,7 @@ export default { return { form: { id: '', + method: '1', objectId: '', objectType: '', energyTypeId: '', @@ -103,7 +124,8 @@ export default { objIds: [],// 回显数组 isEdit: false, //是否是编辑 rules: { - objectId: [{ required: true, message: '对象不能为空', trigger: 'change' }], + method: [{ required: true, message: '抄表方式不能为空', trigger: 'change' }], + objectId: [{ required: true, message: '监控对象不能为空', trigger: 'change' }], energyTypeId: [{ required: true, message: '能源类型不能为空', trigger: 'change' }], type: [{ required: true, message: '监控模式不能为空', trigger: 'change' }], limitType: [{ required: true, message: '指标类型不能为空', trigger: 'change' }] @@ -120,6 +142,7 @@ export default { if (res.code === 0) { this.form = res.data this.form.plcParamId = res.data.plcParamId || '' + this.form.method = this.form.method ? this.form.method + '' : '' this.form.limitType = this.form.limitType ? this.form.limitType + '' : '' this.objIds = this.changeDetSelect(this.form.objectId, this.objList) if (this.form.type === 2) { @@ -132,6 +155,14 @@ export default { this.form.id = '' } }, + // 切换方式 + changeMethod() { + if(this.form.method === '2'){ + this.form.limitType = "2" + }else{ + this.form.limitType = '' + } + }, // 监控详细参数 getDetailList() { getEnergyParamList({ diff --git a/src/views/energy/monitoring/energyLimit/index.vue b/src/views/energy/monitoring/energyLimit/index.vue index 1b82ab8b..d72aede2 100644 --- a/src/views/energy/monitoring/energyLimit/index.vue +++ b/src/views/energy/monitoring/energyLimit/index.vue @@ -51,6 +51,11 @@ import { getTree } from '@/api/base/factory' import { publicFormatter } from '@/utils/dict' import EnergyLimitAdd from './components/energyLimitAdd' const tableProps = [ + { + prop: 'method', + label: '抄表方式', + filter: publicFormatter('method') + }, { prop: 'objName', label: '监控对象' @@ -59,6 +64,11 @@ const tableProps = [ prop: 'objCode', label: '对象编码' }, + { + prop: 'tableName', + label: '水/气表名', + filter: publicFormatter('table_name') + }, { prop: 'energyType', label: '能源类型' diff --git a/src/views/energy/monitoring/energyOverlimitLog/index.vue b/src/views/energy/monitoring/energyOverlimitLog/index.vue index f748592c..1cffef1e 100644 --- a/src/views/energy/monitoring/energyOverlimitLog/index.vue +++ b/src/views/energy/monitoring/energyOverlimitLog/index.vue @@ -1,5 +1,5 @@