From acae52a683b4a67eb0bcc5adef2d7729f5ff4b7e Mon Sep 17 00:00:00 2001 From: zhaowei <zhaowei> Date: 星期五, 15 十一月 2024 15:08:42 +0800 Subject: [PATCH] 根据菜单新增页面 --- src/views/mdc/base/StatisticsChart.vue | 45 src/views/mdc/base/DeviceLog.vue | 2 src/views/mdc/base/MdcUtilizationRateList.vue | 209 ++ src/views/mdc/base/modules/efficiencyPOReport/EfficiencyPOList.vue | 790 ++++++++ src/views/mdc/base/modules/StatisticsChart/StatisticsLegend.vue | 866 +++++++++ src/views/mdc/base/modules/TorqueconfigurationList/TorqueconfigurationList.vue | 762 ++++++++ src/views/mdc/base/Torqueconfiguration.vue | 139 + src/views/mdc/base/modules/EquipmentTypeList/MdcEquipmentTypeModal.vue | 60 src/views/mdc/base/modules/TorqueconfigurationList/TorqueconfigurationModalList.vue | 340 +++ src/views/mdc/base/modules/mdcUtilizationRate/MdcUtilizationRateModel.vue | 204 ++ src/views/mdc/base/alarmAnalysis.vue | 139 + src/views/mdc/base/modules/TorqueconfigurationList/TorqueconfigurationModal.vue | 385 ++++ src/views/mdc/base/modules/EquipmentTypeList/MdcEquipmentTypeForm.vue | 126 + src/views/mdc/base/modules/EquipmentTypeList/MdcEquipmentTypeModal.Style#Drawer.vue | 84 src/views/mdc/base/modules/TorqueconfigurationList/TorqueconfigurationModalEdit.vue | 372 ++++ src/views/mdc/base/EfficiencyPOReport.vue | 140 + src/views/mdc/base/modules/alarmAnalysis/alarmAnalysisMain.vue | 543 +++++ src/views/mdc/base/MdcEquipmentTypeList.vue | 218 ++ src/views/mdc/base/modules/DeviceLog/LogInfo.vue | 4 src/views/mdc/base/modules/TorqueconfigurationList/TorqueconfigurationForm.vue | 124 + 20 files changed, 5,549 insertions(+), 3 deletions(-) diff --git a/src/views/mdc/base/DeviceLog.vue b/src/views/mdc/base/DeviceLog.vue index 45817e3..b01762b 100644 --- a/src/views/mdc/base/DeviceLog.vue +++ b/src/views/mdc/base/DeviceLog.vue @@ -6,7 +6,7 @@ <base-tree @getCurrSelected="changeSelectionNode"></base-tree> </a-col> <a-col :md="24-5" :sm="24"> - <log-info :equipment="selectEquipment"></log-info> + <log-info :selectEquipment="selectEquipment"></log-info> </a-col> </a-row> </div> diff --git a/src/views/mdc/base/EfficiencyPOReport.vue b/src/views/mdc/base/EfficiencyPOReport.vue new file mode 100644 index 0000000..be55b7a --- /dev/null +++ b/src/views/mdc/base/EfficiencyPOReport.vue @@ -0,0 +1,140 @@ +<template> + <div style="width: 100%; height: 100%;"> + <a-card :bordered="false"> + <a-row type="flex" :gutter="16"> + <a-col :md="5"> + <a-tabs :activeKey="activeKey" @change="tabChange"> + <a-tab-pane key="1" tab="杞﹂棿灞傜骇" force-render> + <base-tree @getCurrSelected="changeSelectionNode" :filterAbnormalDeviceKey="'1'"></base-tree> + </a-tab-pane> + <a-tab-pane v-if="isDepartType == 0" key="2" tab="閮ㄩ棬灞傜骇">, + <depart-tree @getCurrSelectedDD="changeSelectionNodedd"></depart-tree> + </a-tab-pane> + </a-tabs> + </a-col> + <a-col :md="19"> + <efficiencyPO-list ref="EfficiencyPOList" :nodeTree='selectEquement' :nodePeople='selectPeople' :Type="slectTypeTree"/> + </a-col> + </a-row> + </a-card> + </div> + +</template> + +<script> +import { putAction, getAction } from '@/api/manage' +import { frozenBatch } from '@/api/api' +import { JeecgListMixin } from '@/mixins/JeecgListMixin' +import JInput from '@/components/jeecg/JInput' +import BaseTree from '../common/BaseTree' +import EfficiencyPOList from './modules/efficiencyPOReport/EfficiencyPOList' +import JSuperQuery from '@/components/jeecg/JSuperQuery' +import JThirdAppButton from '@/components/jeecgbiz/thirdApp/JThirdAppButton' +import DepartTree from './modules/DepartList/DepartListTree/DepartTree' +import {mapActions} from 'vuex' +export default { + name: 'EfficiencyPOReport', + components: { + JThirdAppButton, + JInput, + BaseTree, + JSuperQuery, + DepartTree, + EfficiencyPOList + }, + data() { + return { + activeKey: '1', + description: '璁惧淇℃伅', + selectEquementId: '', + selectEquement: {}, + selectPeople:{}, + slectTypeTree:"", + url: { + equipmentStatistics: '/mdc/equipment/equipmentStatistics' + }, + isDepartType:'', + } + }, + created() { + this.queryTreeData() + }, + methods: { + ...mapActions(['QueryDepartTree']), + queryTreeData() { + this.QueryDepartTree().then(res => { + if (res.success) { + this.isDepartType = res.result[0].value + } else { + // this.$message.warn(res.message) + this.$notification.warning({ + message:'娑堟伅', + description:res.message + }); + + } + }).finally(() =>{ + }) + }, + tabChange(val) { + // console.log(val); + this.activeKey = val + this.slectTypeTree = val + }, + // changeSelection(val) { + // this.selectEquementId = val + // this.$refs.efficiencyList.pQuery(val) + // this.$refs.efficiencyList.searchQuery() + // }, + changeSelectionNode(val) { + this.selectEquement = val + this.slectTypeTree = "1" + }, + changeSelectionNodedd(val) { + this.selectPeople = val + this.slectTypeTree = "2" + } + } + +} +</script> +<style scoped> +@import '~@assets/less/common.less'; + +.equipMessage { + width: 100%; + height: 10%; +} + +.equipMessage table { + width: 60%; + height: 100%; + line-height: 50%; +} + +.equipMessage table td { + text-align: center; +} + +.equipMessage table td span { + display: inline-block; + width: 15px; + height: 15px; +} + +.equipMessage table td .equipShutdown { + background-color: #808080; +} + +.equipMessage table td .equipStandby { + background-color: #ffbf37; +} + +.equipMessage table td .equipRun { + background-color: #19FE01; +} + +.equipMessage table td .equipAlarm { + background-color: #FD0008; +} +</style> \ No newline at end of file diff --git a/src/views/mdc/base/MdcEquipmentTypeList.vue b/src/views/mdc/base/MdcEquipmentTypeList.vue new file mode 100644 index 0000000..3f6577e --- /dev/null +++ b/src/views/mdc/base/MdcEquipmentTypeList.vue @@ -0,0 +1,218 @@ +<template> + <a-card :bordered="false"> + <!-- 鏌ヨ鍖哄煙 --> + <div class="table-page-search-wrapper"> + <a-form layout="inline" @keyup.enter.native="searchQuery"> + <a-row :gutter="24"> + <a-col :xl="6" :lg="7" :md="8" :sm="24"> + <a-form-item label="璁惧绫诲瀷鍚嶇О"> + <a-input placeholder="璇疯緭鍏ヨ澶囩被鍨嬪悕绉�" v-model="queryParam.equipmentTypeName"></a-input> + </a-form-item> + </a-col> + <a-col :xl="6" :lg="7" :md="8" :sm="24"> + <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons"> + <a-button type="primary" @click="searchQuery" icon="search">鏌ヨ</a-button> + <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">閲嶇疆</a-button> + <!--<a @click="handleToggleSearch" style="margin-left: 8px">--> + <!--{{ toggleSearchStatus ? '鏀惰捣' : '灞曞紑' }}--> + <!--<a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>--> + <!--</a>--> + </span> + </a-col> + </a-row> + </a-form> + </div> + <!-- 鏌ヨ鍖哄煙-END --> + + <!-- 鎿嶄綔鎸夐挳鍖哄煙 --> + <div class="table-operator"> + <a-button @click="handleAdd" type="primary" icon="plus">鏂板</a-button> + <!--<a-button type="primary" icon="download" @click="handleExportXls('璁惧绫诲瀷')">瀵煎嚭</a-button>--> + <!--<a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">--> + <!--<a-button type="primary" icon="import">瀵煎叆</a-button>--> + <!--</a-upload>--> + <!-- 楂樼骇鏌ヨ鍖哄煙 --> + <!--<j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query>--> + <a-dropdown v-if="selectedRowKeys.length > 0"> + <a-menu slot="overlay"> + <a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>鍒犻櫎</a-menu-item> + </a-menu> + <a-button style="margin-left: 8px"> 鎵归噺鎿嶄綔 <a-icon type="down" /></a-button> + </a-dropdown> + </div> + + <!-- table鍖哄煙-begin --> + <div> + <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;"> + <i class="anticon anticon-info-circle ant-alert-icon"></i> 宸查�夋嫨 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>椤� + <a style="margin-left: 24px" @click="onClearSelected">娓呯┖</a> + </div> + + <a-table + ref="table" + size="middle" + bordered + rowKey="id" + :columns="columns" + :dataSource="dataSource" + :pagination="ipagination" + :loading="loading" + :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}" + class="j-table-force-nowrap" + @change="handleTableChange" + :scroll="{x:'max-content',y:465}" + > + + <template slot="htmlSlot" slot-scope="text"> + <div v-html="text"></div> + </template> + <template slot="imgSlot" slot-scope="text,record"> + <span v-if="!text" style="font-size: 12px;font-style: italic;">鏃犲浘鐗�</span> + <img v-else :src="getImgView(text)" :preview="record.id" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/> + </template> + <template slot="fileSlot" slot-scope="text"> + <span v-if="!text" style="font-size: 12px;font-style: italic;">鏃犳枃浠�</span> + <a-button + v-else + :ghost="true" + type="primary" + icon="download" + size="small" + @click="downloadFile(text)"> + 涓嬭浇 + </a-button> + </template> + + <span slot="action" slot-scope="text, record"> + <a @click="handleEdit(record)">缂栬緫</a> + + <a-divider type="vertical" /> + <a-dropdown> + <a class="ant-dropdown-link">鏇村 <a-icon type="down" /></a> + <a-menu slot="overlay"> + <a-menu-item> + <a @click="handleDetail(record)">璇︽儏</a> + </a-menu-item> + <a-menu-item> + <a-popconfirm title="纭畾鍒犻櫎鍚�?" @confirm="() => handleDelete(record.id)"> + <a>鍒犻櫎</a> + </a-popconfirm> + </a-menu-item> + </a-menu> + </a-dropdown> + </span> + + </a-table> + </div> + + <mdc-equipment-type-modal ref="modalForm" @ok="modalFormOk"></mdc-equipment-type-modal> + </a-card> +</template> + +<script> + + import '@/assets/less/TableExpand.less' + import { mixinDevice } from '@/utils/mixin' + import { JeecgListMixin } from '@/mixins/JeecgListMixin' + import MdcEquipmentTypeModal from './modules/EquipmentTypeList/MdcEquipmentTypeModal' + import {filterMultiDictText} from '@/components/dict/JDictSelectUtil' + + export default { + name: 'MdcEquipmentTypeList', + mixins:[JeecgListMixin, mixinDevice], + components: { + MdcEquipmentTypeModal + }, + data () { + return { + description: '璁惧绫诲瀷绠$悊椤甸潰', + /* 鍒嗛〉鍙傛暟 */ + ipagination:{ + current: 1, + pageSize: 30, + pageSizeOptions: ['30', '50', '100'], + showTotal: (total, range) => { + return range[0] + "-" + range[1] + " 鍏�" + total + "鏉�" + }, + showQuickJumper: true, + showSizeChanger: true, + total: 0 + }, + // 琛ㄥご + columns: [ + { + title: '#', + dataIndex: '', + key:'rowIndex', + width:60, + align:"center", + customRender:function (t,r,index) { + return parseInt(index)+1; + } + }, + { + title:'璁惧绫诲瀷鍚嶇О', + align:"center", + dataIndex: 'equipmentTypeName', + width:530 + }, + { + title:'璁惧绫诲瀷鍥剧墖', + align:"center", + dataIndex: 'equipmentTypePictures', + scopedSlots: {customRender: 'imgSlot'}, + width:530 + }, + { + title:'璁惧绫诲瀷鐘舵��', + align:"center", + dataIndex: 'equipmentTypeStates', + customRender: (text) => (text ? filterMultiDictText(this.dictOptions['equipmentTypeStates'], text) : ''), + width:530 + }, + { + title: '鎿嶄綔', + dataIndex: 'action', + align:"center", + scopedSlots: { customRender: 'action' }, + width:150, + fixed:'right' + } + ], + url: { + list: "/mdc/mdcEquipmentType/queryWrapper", + delete: "/mdc/mdcEquipmentType/deleteEquipmentType", + deleteBatch: "/mdc/mdcEquipmentType/deleteBatchEquipmentType", + exportXlsUrl: "/mdcequipmenttype/mdcEquipmentType/exportXls", + importExcelUrl: "mdcequipmenttype/mdcEquipmentType/importExcel", + + }, + dictOptions:{}, + superFieldList:[], + } + }, + created() { + this.$set(this.dictOptions, 'equipmentTypeStates', [{text:'鏄�',value:'Y'},{text:'鍚�',value:'N'}]) + this.getSuperFieldList(); + }, + computed: { + importExcelUrl: function(){ + return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`; + }, + }, + methods: { + initDictConfig(){ + }, + getSuperFieldList(){ + let fieldList=[]; + fieldList.push({type:'string',value:'equipmentTypeName',text:'璁惧绫诲瀷鍚嶇О',dictCode:''}) + fieldList.push({type:'string',value:'equipmentTypePictures',text:'璁惧绫诲瀷鍥剧墖',dictCode:''}) + fieldList.push({type:'switch',value:'equipmentTypeStates',text:'璁惧绫诲瀷鐘舵��'}) + this.superFieldList = fieldList + } + } + } +</script> +<style scoped> + @import '~@assets/less/common.less'; +</style> \ No newline at end of file diff --git a/src/views/mdc/base/MdcUtilizationRateList.vue b/src/views/mdc/base/MdcUtilizationRateList.vue new file mode 100644 index 0000000..896efef --- /dev/null +++ b/src/views/mdc/base/MdcUtilizationRateList.vue @@ -0,0 +1,209 @@ +<template> + <a-card :bordered="false" class="mdcutilization_list"> + <!-- 鏌ヨ鍖哄煙 --> + <div class="table-page-search-wrapper"> + <a-form layout="inline" @keyup.enter.native="searchQuery"> + <a-row :gutter="24"> + <a-col :md="6" :sm="8"> + <a-form-item label="绫诲埆"> + <a-input placeholder="璇疯緭鍏ョ被鍒�" v-model="queryParam.rateParameterCategory"></a-input> + </a-form-item> + </a-col> + + <a-col :md="6" :sm="8"> + <a-space> + <a-button type="primary" @click="searchQuery" icon="search">鏌ヨ</a-button> + <a-button type="primary" @click="searchReset" icon="reload">閲嶇疆</a-button> + </a-space> + </a-col> + </a-row> + </a-form> + </div> + <!-- 鎿嶄綔鎸夐挳鍖哄煙 --> + <!--<div class="table-operator">--> + <!--<a-button type="primary" @click="searchQuery" icon="search">鏌ヨ</a-button>--> + <!--<a-button type="primary" @click="searchReset" icon="reload">閲嶇疆</a-button>--> + <!--</div>--> + + <!-- table鍖哄煙-begin --> + <div> + <a-table ref="table" size="middle" bordered rowKey="id" :columns="columns" :dataSource="dataSource" + :pagination="ipagination" :loading="loading" + @change="handleTableChange"> + <span slot="rateParameterColor" slot-scope="text, record"> + <div :style="{background:record.rateParameterColor}"> </div> + </span> + <span slot="action" slot-scope="text, record"> + <a href="javascript:;" @click="handleEdit(record)">缂栬緫</a> + </span> + <!--<span slot="action1" slot-scope="text,record">--> + <!--<span><=</span>--> + <!--</span>--> + </a-table> + </div> + <!-- table鍖哄煙-end --> + <mdc-utilization-rate-model ref="formModel" @ok="modalFormOk"></mdc-utilization-rate-model> + </a-card> +</template> + +<script> + import { + JeecgListMixin + } from '@/mixins/JeecgListMixin' + import JDictSelectTag from '@/components/dict/JDictSelectTag' + import { + initDictOptions, + filterDictText + } from '@/components/dict/JDictSelectUtil' + import { + requestPut + } from '@/api/manage' + import JInput from '@/components/jeecg/JInput' + import JEllipsis from '@/components/jeecg/JEllipsis' + import JDate from '@/components/jeecg/JDate' + import moment from 'moment' + import { + getAction, + postAction, + deleteAction + } from '@/api/manage' + import MdcUtilizationRateModel from './modules/mdcUtilizationRate/MdcUtilizationRateModel' + + export default { + name: 'MdcUtilizationRateList', + mixins: [JeecgListMixin], + + components: { + JDictSelectTag, + JInput, + JEllipsis, + JDate, + MdcUtilizationRateModel + }, + data() { + return { + /* 鍒嗛〉鍙傛暟 */ + ipagination:{ + current: 1, + pageSize: 30, + pageSizeOptions: ['30', '50', '100'], + showTotal: (total, range) => { + return range[0] + "-" + range[1] + " 鍏�" + total + "鏉�" + }, + showQuickJumper: true, + showSizeChanger: true, + total: 0 + }, + columns: [{ + title: '绫诲埆', + align: 'center', + dataIndex: 'rateParameterCategory' + }, + { + title: '棰滆壊', + align: 'center', + dataIndex: 'rateParameterColor', + scopedSlots: { + customRender: 'rateParameterColor' + } + }, + { + title: '鏈�灏忚寖鍥达紙鍗曚綅锛�%锛�', + align: 'center', + dataIndex: 'minimumRange' + }, + // { + // title:'', + // dataIndex:'action1', + // align:'center', + // scopedSlots: { + // customRender: 'action1' + // } + // }, + { + title: '鏈�澶ц寖鍥达紙鍗曚綅锛�%锛�', + align: 'center', + dataIndex: 'maximumRange' + }, + { + title: '绛夌骇', + align: 'center', + dataIndex: 'rateParameterLevel' + }, + { + title: '鎿嶄綔', + dataIndex: 'action', + align: 'center', + scopedSlots: { + customRender: 'action' + } + } + ], + url: { + list: '/mdc/MdcUtilizationRate/queryWrapper' + } + } + }, + created() { + this.loadData() + }, + methods: { + searchReset() { + this.queryParam = {} + this.loadData() + this.onClearSelected() + }, + searchQuery() { + this.loadData() + this.onClearSelected() + }, + modalFormOk(val) { + // 鏂板/淇敼 鎴愬姛鏃讹紝閲嶈浇鍒楄〃 + this.loadData() + this.selectedRowKeys = [val.borrowSubId] + }, + onSelectChange(selectedRowKeys, selectionRows) { + this.selectedRowKeys = selectedRowKeys + this.selectionRows = selectionRows + }, + handleEdit(record) { + this.$refs.formModel.edit(record) + this.$refs.formModel.title = '缂栬緫' + this.$refs.formModel.disableSubmit = false + } + } + } +</script> +<style> + @import '~@assets/less/common.less'; + @media screen and (min-width: 1920px){ + .mdcutilization_list{ + height: 825px!important; + overflow: scroll; + } + } + @media screen and (min-width: 1680px) and (max-width: 1920px){ + .mdcutilization_list{ + height: 825px!important; + overflow: scroll; + } + } + @media screen and (min-width: 1400px) and (max-width: 1680px){ + .mdcutilization_list{ + height: 655px!important; + overflow: scroll; + } + } + @media screen and (min-width: 1280px) and (max-width: 1400px){ + .mdcutilization_list{ + height: 552px!important; + overflow: scroll; + } + } + @media screen and (max-width: 1280px){ + .mdcutilization_list{ + height: 552px!important; + overflow: scroll; + } + } +</style> diff --git a/src/views/mdc/base/StatisticsChart.vue b/src/views/mdc/base/StatisticsChart.vue new file mode 100644 index 0000000..65bec31 --- /dev/null +++ b/src/views/mdc/base/StatisticsChart.vue @@ -0,0 +1,45 @@ +<template> + <a-card :bordered="false"> + <div style="width: 100%; height: 100%;overflow: hidden"> + <a-row type="flex" :gutter="16"> + <a-col :md="5" :sm="24"> + <base-tree @getCurrSelected="changeSelectionNode" :filterAbnormalDeviceKey="'1'"></base-tree> + </a-col> + <a-col :md="24-5" :sm="24"> + <statistics-legend :equip="selectEquementnode"></statistics-legend> + </a-col> + </a-row> + </div> + </a-card> +</template> + +<script> + import BaseTree from '../common/BaseTree' + import StatisticsLegend from './modules/StatisticsChart/StatisticsLegend' + export default { + name: 'StatisticsChart', + components:{ + BaseTree, + StatisticsLegend + }, + data() { + return { + description: '璁惧淇℃伅', + selectEquementnode:{}, + equipmentStatisticsInfo:{}, + url:{ + equipmentStatistics:"/mdc/equipment/equipmentStatistics" + } + } + }, + methods: { + changeSelectionNode(val){ + this.selectEquementnode = val + } + } + } +</script> + +<style scoped> + +</style> \ No newline at end of file diff --git a/src/views/mdc/base/Torqueconfiguration.vue b/src/views/mdc/base/Torqueconfiguration.vue new file mode 100644 index 0000000..be23e7e --- /dev/null +++ b/src/views/mdc/base/Torqueconfiguration.vue @@ -0,0 +1,139 @@ +<template> + <div style="width: 100%; height: 100%;"> + <a-card :bordered="false"> + <a-row type="flex" :gutter="16"> + <a-col :md="5"> + <a-tabs :activeKey="activeKey" @change="tabChange"> + <a-tab-pane key="1" tab="杞﹂棿灞傜骇" force-render> + <base-tree @getCurrSelected="changeSelectionNode"></base-tree> + </a-tab-pane> + <a-tab-pane v-if="isDepartType == 0" key="2" tab="閮ㄩ棬灞傜骇">, + <depart-tree @getCurrSelectedDD="changeSelectionNodedd"></depart-tree> + </a-tab-pane> + </a-tabs> + </a-col> + <a-col :md="19"> + <torqueconfiguration-list ref="TorqueconfigurationList" :nodePeople='selectPeople' :nodeTree = 'selectEquement' :Type="slectTypeTree"></torqueconfiguration-list> + </a-col> + </a-row> + </a-card> + </div> + +</template> + +<script> + import { putAction, getAction } from '@/api/manage' + import { frozenBatch } from '@/api/api' + import { JeecgListMixin } from '@/mixins/JeecgListMixin' + import JInput from '@/components/jeecg/JInput' + import BaseTree from '../common/BaseTree' + import TorqueconfigurationList from './modules/TorqueconfigurationList/TorqueconfigurationList' + import JSuperQuery from '@/components/jeecg/JSuperQuery' + import JThirdAppButton from '@/components/jeecgbiz/thirdApp/JThirdAppButton' + import DepartTree from './modules/DepartList/DepartListTree/DepartTree' + import {mapActions} from 'vuex' + export default { + name: 'Torqueconfiguration', + components: { + JThirdAppButton, + JInput, + BaseTree, + JSuperQuery, + DepartTree, + TorqueconfigurationList + }, + data() { + return { + activeKey: '1', + description: '璁惧淇℃伅', + selectEquementId: '', + selectEquement: {}, + selectPeople:{}, + slectTypeTree:"", + url: { + equipmentStatistics: '/mdc/equipment/equipmentStatistics' + }, + isDepartType:'', + } + }, + created() { + this.queryTreeData() + }, + methods: { + ...mapActions(['QueryDepartTree']), + queryTreeData() { + this.QueryDepartTree().then(res => { + if (res.success) { + this.isDepartType = res.result[0].value + } else { + // this.$message.warn(res.message) + this.$notification.warning({ + message:'娑堟伅', + description:res.message + }); + } + }).finally(() =>{ + }) + }, + tabChange(val) { + // console.log(val); + this.activeKey = val + this.slectTypeTree = val + }, + // changeSelection(val) { + // this.selectEquementId = val + // this.$refs.efficiencyList.pQuery(val) + // this.$refs.efficiencyList.searchQuery() + // }, + changeSelectionNode(val) { + this.selectEquement = val + this.slectTypeTree = "1" + }, + changeSelectionNodedd(val) { + this.selectPeople = val + this.slectTypeTree = "2" + } + } + + } +</script> +<style scoped> + @import '~@assets/less/common.less'; + + .equipMessage { + width: 100%; + height: 10%; + } + + .equipMessage table { + width: 60%; + height: 100%; + line-height: 50%; + } + + .equipMessage table td { + text-align: center; + } + + .equipMessage table td span { + display: inline-block; + width: 15px; + height: 15px; + } + + .equipMessage table td .equipShutdown { + background-color: #808080; + } + + .equipMessage table td .equipStandby { + background-color: #ffbf37; + } + + .equipMessage table td .equipRun { + background-color: #19FE01; + } + + .equipMessage table td .equipAlarm { + background-color: #FD0008; + } +</style> \ No newline at end of file diff --git a/src/views/mdc/base/alarmAnalysis.vue b/src/views/mdc/base/alarmAnalysis.vue new file mode 100644 index 0000000..ba83a02 --- /dev/null +++ b/src/views/mdc/base/alarmAnalysis.vue @@ -0,0 +1,139 @@ +<template> + <div style="width: 100%; height: 100%;"> + <a-card :bordered="false"> + <a-row type="flex" :gutter="16"> + <a-col :md="5"> + <a-tabs :activeKey="activeKey" @change="tabChange"> + <a-tab-pane key="1" tab="杞﹂棿灞傜骇" force-render> + <base-tree @getCurrSelected="changeSelectionNode"></base-tree> + </a-tab-pane> + <a-tab-pane v-if="isDepartType == 0" key="2" tab="閮ㄩ棬灞傜骇">, + <depart-tree @getCurrSelectedDD="changeSelectionNodedd"></depart-tree> + </a-tab-pane> + </a-tabs> + </a-col> + <a-col :md="19"> + <alarm-analysis-main ref="alarmAnalysisMain" :nodePeople='selectPeople' :nodeTree = 'selectEquement' :Type="slectTypeTree"></alarm-analysis-main> + </a-col> + </a-row> + </a-card> + </div> + +</template> + +<script> + import { putAction, getAction } from '@/api/manage' + import { frozenBatch } from '@/api/api' + import { JeecgListMixin } from '@/mixins/JeecgListMixin' + import JInput from '@/components/jeecg/JInput' + import BaseTree from '../common/BaseTree' + import alarmAnalysisMain from './modules/alarmAnalysis/alarmAnalysisMain' + import JSuperQuery from '@/components/jeecg/JSuperQuery' + import JThirdAppButton from '@/components/jeecgbiz/thirdApp/JThirdAppButton' + import DepartTree from './modules/DepartList/DepartListTree/DepartTree' + import {mapActions} from 'vuex' + export default { + name: 'alarmAnalysis', + components: { + JThirdAppButton, + JInput, + BaseTree, + JSuperQuery, + DepartTree, + alarmAnalysisMain + }, + data() { + return { + activeKey: '1', + description: '璁惧淇℃伅', + selectEquementId: '', + selectEquement: {}, + selectPeople:{}, + slectTypeTree:"", + url: { + equipmentStatistics: '/mdc/equipment/equipmentStatistics' + }, + isDepartType:'', + } + }, + created() { + this.queryTreeData() + }, + methods: { + ...mapActions(['QueryDepartTree']), + queryTreeData() { + this.QueryDepartTree().then(res => { + if (res.success) { + this.isDepartType = res.result[0].value + } else { + // this.$message.warn(res.message) + this.$notification.warning({ + message:'娑堟伅', + description:res.message + }); + } + }).finally(() =>{ + }) + }, + tabChange(val) { + // console.log(val); + this.activeKey = val + this.slectTypeTree = val + }, + // changeSelection(val) { + // this.selectEquementId = val + // this.$refs.efficiencyList.pQuery(val) + // this.$refs.efficiencyList.searchQuery() + // }, + changeSelectionNode(val) { + this.selectEquement = val + this.slectTypeTree = "1" + }, + changeSelectionNodedd(val) { + this.selectPeople = val + this.slectTypeTree = "2" + } + } + + } +</script> +<style scoped> + @import '~@assets/less/common.less'; + + .equipMessage { + width: 100%; + height: 10%; + } + + .equipMessage table { + width: 60%; + height: 100%; + line-height: 50%; + } + + .equipMessage table td { + text-align: center; + } + + .equipMessage table td span { + display: inline-block; + width: 15px; + height: 15px; + } + + .equipMessage table td .equipShutdown { + background-color: #808080; + } + + .equipMessage table td .equipStandby { + background-color: #ffbf37; + } + + .equipMessage table td .equipRun { + background-color: #19FE01; + } + + .equipMessage table td .equipAlarm { + background-color: #FD0008; + } +</style> \ No newline at end of file diff --git a/src/views/mdc/base/modules/DeviceLog/LogInfo.vue b/src/views/mdc/base/modules/DeviceLog/LogInfo.vue index da70e00..5bf1df3 100644 --- a/src/views/mdc/base/modules/DeviceLog/LogInfo.vue +++ b/src/views/mdc/base/modules/DeviceLog/LogInfo.vue @@ -175,7 +175,7 @@ WorkChartModel, WorkHistoryModel }, - props: { equipment: {} }, + props: { selectEquipment: {} }, data() { return { readOnly: true, @@ -350,7 +350,7 @@ this.initEquipment() }, watch: { - equipment(val) { + selectEquipment(val) { if (val && val.equipmentId) { this.$set(this.queryParams, 'equipmentName', val.equipmentName) this.$set(this.queryParams, 'equipmentId', val.equipmentId) diff --git a/src/views/mdc/base/modules/EquipmentTypeList/MdcEquipmentTypeForm.vue b/src/views/mdc/base/modules/EquipmentTypeList/MdcEquipmentTypeForm.vue new file mode 100644 index 0000000..15be1d3 --- /dev/null +++ b/src/views/mdc/base/modules/EquipmentTypeList/MdcEquipmentTypeForm.vue @@ -0,0 +1,126 @@ +<template> + <a-spin :spinning="confirmLoading"> + <j-form-container :disabled="formDisabled"> + <a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail"> + <a-row> + <a-col :span="24"> + <a-form-model-item label="璁惧绫诲瀷鍚嶇О" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="equipmentTypeName"> + <a-input v-model="model.equipmentTypeName" placeholder="璇疯緭鍏ヨ澶囩被鍨嬪悕绉�" ></a-input> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="璁惧绫诲瀷鍥剧墖" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="equipmentTypePictures"> + <j-image-upload v-model="model.equipmentTypePictures" ></j-image-upload> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="璁惧绫诲瀷鐘舵��" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="equipmentTypeStates"> + <j-switch v-model="model.equipmentTypeStates" ></j-switch> + </a-form-model-item> + </a-col> + </a-row> + </a-form-model> + </j-form-container> + </a-spin> +</template> + +<script> + + import { httpAction, getAction } from '@/api/manage' + import { validateDuplicateValue } from '@/utils/util' + + export default { + name: 'MdcEquipmentTypeForm', + components: { + }, + props: { + //琛ㄥ崟绂佺敤 + disabled: { + type: Boolean, + default: false, + required: false + } + }, + data () { + return { + model:{ + }, + labelCol: { + xs: { span: 24 }, + sm: { span: 5 }, + }, + wrapperCol: { + xs: { span: 24 }, + sm: { span: 16 }, + }, + confirmLoading: false, + validatorRules: { + equipmentTypeName: [ + { required: true, message: '璇疯緭鍏ヨ澶囩被鍨嬪悕绉�!'}, + { validator: (rule, value, callback) => validateDuplicateValue('mdc_equipment_type', 'equipment_type_name', value, this.model.id, callback)}, + ], + }, + url: { + add: "/mdc/mdcEquipmentType/addEquipmentType", + edit: "/mdc/mdcEquipmentType/editEquipmentType", + queryById: "/mdc/mdcEquipmentType/queryById" + } + } + }, + computed: { + formDisabled(){ + return this.disabled + }, + }, + created () { + //澶囦唤model鍘熷鍊� + this.modelDefault = JSON.parse(JSON.stringify(this.model)); + }, + methods: { + add () { + this.edit(this.modelDefault); + }, + edit (record) { + this.model = Object.assign({}, record); + this.visible = true; + }, + submitForm () { + const that = this; + // 瑙﹀彂琛ㄥ崟楠岃瘉 + this.$refs.form.validate(valid => { + if (valid) { + that.confirmLoading = true; + let httpurl = ''; + let method = ''; + if(!this.model.id){ + httpurl+=this.url.add; + method = 'post'; + }else{ + httpurl+=this.url.edit; + method = 'put'; + } + httpAction(httpurl,this.model,method).then((res)=>{ + if(res.success){ + // that.$message.success(res.message); + that.$notification.success({ + message:'娑堟伅', + description:res.message + }); + that.$emit('ok'); + }else{ + // that.$message.warning(res.message); + that.$notification.warning({ + message:'娑堟伅', + description:res.message + }); + } + }).finally(() => { + that.confirmLoading = false; + }) + } + + }) + }, + } + } +</script> \ No newline at end of file diff --git "a/src/views/mdc/base/modules/EquipmentTypeList/MdcEquipmentTypeModal.Style\043Drawer.vue" "b/src/views/mdc/base/modules/EquipmentTypeList/MdcEquipmentTypeModal.Style\043Drawer.vue" new file mode 100644 index 0000000..0fcd0b0 --- /dev/null +++ "b/src/views/mdc/base/modules/EquipmentTypeList/MdcEquipmentTypeModal.Style\043Drawer.vue" @@ -0,0 +1,84 @@ +<template> + <a-drawer + :title="title" + :width="width" + placement="right" + :closable="false" + @close="close" + destroyOnClose + :visible="visible"> + <mdc-equipment-type-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit" normal></mdc-equipment-type-form> + <div class="drawer-footer"> + <a-button @click="handleCancel" style="margin-bottom: 0;">鍏抽棴</a-button> + <a-button v-if="!disableSubmit" @click="handleOk" type="primary" style="margin-bottom: 0;">鎻愪氦</a-button> + </div> + </a-drawer> +</template> + +<script> + + import MdcEquipmentTypeForm from './MdcEquipmentTypeForm' + + export default { + name: 'MdcEquipmentTypeModal', + components: { + MdcEquipmentTypeForm + }, + data () { + return { + title:"鎿嶄綔", + width:800, + visible: false, + disableSubmit: false + } + }, + methods: { + add () { + this.visible=true + this.$nextTick(()=>{ + this.$refs.realForm.add(); + }) + }, + edit (record) { + this.visible=true + this.$nextTick(()=>{ + this.$refs.realForm.edit(record); + }); + }, + close () { + this.$emit('close'); + this.visible = false; + }, + submitCallback(){ + this.$emit('ok'); + this.visible = false; + }, + handleOk () { + this.$refs.realForm.submitForm(); + }, + handleCancel () { + this.close() + } + } + } +</script> + +<style lang="less" scoped> +/** Button鎸夐挳闂磋窛 */ + .ant-btn { + margin-left: 30px; + margin-bottom: 30px; + float: right; + } + .drawer-footer{ + position: absolute; + bottom: -8px; + width: 100%; + border-top: 1px solid #e8e8e8; + padding: 10px 16px; + text-align: right; + left: 0; + background: #fff; + border-radius: 0 0 2px 2px; + } +</style> \ No newline at end of file diff --git a/src/views/mdc/base/modules/EquipmentTypeList/MdcEquipmentTypeModal.vue b/src/views/mdc/base/modules/EquipmentTypeList/MdcEquipmentTypeModal.vue new file mode 100644 index 0000000..588bc6b --- /dev/null +++ b/src/views/mdc/base/modules/EquipmentTypeList/MdcEquipmentTypeModal.vue @@ -0,0 +1,60 @@ +<template> + <j-modal + :title="title" + :width="width" + :visible="visible" + switchFullscreen + @ok="handleOk" + :okButtonProps="{ class:{'jee-hidden': disableSubmit} }" + @cancel="handleCancel" + cancelText="鍏抽棴"> + <mdc-equipment-type-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"></mdc-equipment-type-form> + </j-modal> +</template> + +<script> + + import MdcEquipmentTypeForm from './MdcEquipmentTypeForm' + export default { + name: 'MdcEquipmentTypeModal', + components: { + MdcEquipmentTypeForm + }, + data () { + return { + title:'', + width:800, + visible: false, + disableSubmit: false + } + }, + methods: { + add () { + this.visible=true + this.$nextTick(()=>{ + this.$refs.realForm.add(); + }) + }, + edit (record) { + this.visible=true + this.$nextTick(()=>{ + this.$refs.realForm.edit(record); + }) + }, + close () { + this.$emit('close'); + this.visible = false; + }, + handleOk () { + this.$refs.realForm.submitForm(); + }, + submitCallback(){ + this.$emit('ok'); + this.visible = false; + }, + handleCancel () { + this.close() + } + } + } +</script> \ No newline at end of file diff --git a/src/views/mdc/base/modules/StatisticsChart/StatisticsLegend.vue b/src/views/mdc/base/modules/StatisticsChart/StatisticsLegend.vue new file mode 100644 index 0000000..7cb1658 --- /dev/null +++ b/src/views/mdc/base/modules/StatisticsChart/StatisticsLegend.vue @@ -0,0 +1,866 @@ +<template> + <div id="StatisticsLegend" + style="width: 100%; height: 100%; overflow: hidden;display: flex;flex-direction: column;background-color: #f5f4f4"> + <!-- 鏌ヨ鍖哄煙 --> + <div style="width: 100%; height: 44px; background-color: #fff" class="table-page-search-wrapper"> + <a-form layout="inline" @keyup.enter.native="searchQuery"> + <a-row :gutter="24"> + <a-col :md="5" :sm="5" :xs="5"> + <a-form-item label="鍚嶇О"> + <a-input placeholder="杈撳叆璁惧鍚嶇О鏌ヨ" :readOnly="readOnly" v-model="queryParam.tierName"></a-input> + </a-form-item> + </a-col> + <a-col :md="4" :sm="4" :xs="4"> + <a-form-item label="鏃ユ湡"> + <a-date-picker v-model="queryParams.collectTime" :disabledDate="disabledDate" format='YYYY-MM-DD' + @change="dataChange" :allowClear="false"/> + </a-form-item> + </a-col> + <a-col :md="2" :sm="2" :xs="2"> + <a-space> + <a-button type="primary" @click="searchQuery" icon="search">鏌ヨ</a-button> + <a-button type="primary" @click="searchReset" icon="reload">閲嶇疆</a-button> + </a-space> + </a-col> + </a-row> + </a-form> + </div> + <!--寮�鏈虹巼--> + <div class="PowerOnRate Line-box"> + <div class="title"> + <div class="circle"></div> + <div class="text">鍒╃敤鐜�</div> + </div> + <div class="PowerOnRate-box box-bottom"> + <div class="PowerOnRate-left" ref="PowerOnRatePie" id="PowerOnRatePie"></div> + <div class="PowerOnRate-right" ref="PowerOnRateLine" id="PowerOnRateLine"></div> + </div> + </div> + <!--鍒╃敤鐜囧拰寮�鍔ㄧ巼--> + <div class="UtilizationStartup"> + <div class="Utilization Line-box"> + <div class="title"> + <div class="circle"></div> + <div class="text">寮�鏈虹巼</div> + </div> + <div class="Utilization-box box-bottom"> + <div class="Utilization-left left"> + <div class="left-box"> + <div class="left-box-con"> + <div class="Rate-box-kong" :style="{height:100-UtilizationHeight+'%'}"></div> + <div class="Rate-box" :style="{height:UtilizationHeight+'%'}"> + <p class="Rate-box-text"> + <span ref="UtilizationRate">{{UtilizationHeight}}%</span> + <br> + 寮�鏈虹巼 + </p> + </div> + </div> + </div> + </div> + <div class="Utilization-right" ref="UtilizationLine" id="UtilizationLine"></div> + </div> + </div> + <div class="Startup Line-box"> + <div class="title"> + <div class="circle"></div> + <div class="text">寮�鍔ㄧ巼</div> + </div> + <div class="Startup-box box-bottom"> + <div class="Startup-left left" ref="StartupRate"> + <div class="left-box"> + <div class="left-box-con"> + <div class="Rate-box-kong" :style="{height:100-StartupHeight+'%'}"></div> + <div class="Rate-box" :style="{height:StartupHeight+'%'}"> + <p class="Rate-box-text"> + <span>{{StatCharUsedopeningRate}}%</span> + <br> + 寮�鍔ㄧ巼 + </p> + </div> + </div> + + </div> + </div> + <div class="Startup-right" ref="StartupLine" id="StartupLine"></div> + </div> + </div> + </div> + </div> +</template> + +<script> + import moment from 'moment' + import { putAction, getAction } from '@/api/manage' + import $ from 'jquery' + import * as echarts from 'echarts' + + export default { + name: 'StatisticsLegend', + props: { equip: {} }, + data() { + return { + readOnly: true, + showday: true, + StatCharOpeningRate: 0, + StatCharUsedRate: 0, + StatCharUsedopeningRate: 0, + openingLong: 0, + waitingLong: 0, + processLong: 0, + closedLong: 0, + totalLong: 0, + UtilizationHeight: 0, + StartupHeight: 0, + quip: {}, + dates: [], + queryParam: {}, + queryParams: { + collectTime: undefined + }, + shiftSubList: [], + shiftList: [], + url: { + getEquipmentByPid: '/mdc/mdcequipment/getEquipmentByPid', + dayStatisticalRate: '/mdc/efficiencyReport/dayStatisticalRate', + getBaseTree: '/mdc/mdcEquipment/queryTreeListByProduction' + } + } + }, + created() { + let collectTime = moment(moment().add(-1, 'd'), 'YYYY-MM-DD') + this.queryParams.collectTime = moment().add(-1, 'd').format('YYYY-MM-DD') + this.queryParams.dateTime = moment().add(-1, 'd').format('YYYYMMDD') + this.initEquipmentNode() + }, + + methods: { + disabledDate(current) { + //Can not slect days before today and today + return current && current > moment().subtract('days', 1) + }, + //鎶婄璁$畻鎴愬搴旂殑鏃跺垎绉掔殑鍑芥暟 + getTime(time) { + //杞崲涓烘椂鍒嗙 + let h = Math.round(time / 60 / 60) + h = h < 10 ? '0' + h : h + //浣滀负杩斿洖鍊艰繑鍥� + // console.log(h); + return h + }, + moment, + draw() { + //鍒╃敤鐜� + //楗煎浘 + let PowerOnRatePie = this.$echarts.init(document.getElementById('PowerOnRatePie'), 'macarons') + let PowerOnRatePie_option = { + // color: ["#3859fa", '#ccc'], + title: { + text: this.StatCharUsedRate + '%', + subtext: '鍒╃敤鐜�', + textStyle: { + color: '#268e80', + fontSize: 18 + + }, + subtextStyle: { + color: '#292929' + }, + x: 'center', + y: 'center' + }, + series: [{ + name: '', + type: 'pie', + radius: ['55%', '70%'], + itemStyle: { + normal: { + borderWidth: 4,//鎵囧尯闂村姞闂撮殧 + borderColor: '#fff'//闂撮殧涓虹櫧鑹� + } + }, + label: { + normal: { + show: false + } + }, + data: [{ + value: 100, + itemStyle: { + color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{ + offset: 0, + color: '#88a8fd' + }, + { + offset: 1, + color: '#544cee' + }], false) + } + }, + { + value: 100 - this.StatCharUsedRate, + itemStyle: { + color: '#f0f3f5' + } + } + ] + } + ] + } + PowerOnRatePie.setOption(PowerOnRatePie_option) + let PowerOnRateLine = this.$echarts.init(document.getElementById('PowerOnRateLine'), 'macarons') + let PowerOnRateLine_option = { + tooltip: { + trigger: 'axis' + }, + grid: { + left: '3%', + right: '4%', + bottom: '3%', + top: 60, + containLabel: true + }, + legend: { + // selected:{ + // "鏇茬嚎":false, + // }, + top: '0', + right: '10', + //璁剧疆鍗曢�夊閫夋ā寮� + // selectedMode:'single', + icon: 'pin', + data: [ + // { + // name:'鏇茬嚎', + // textStyle:{ + // padding:4, + // color:'#e957ff', + // // borderWidth:1, + // fontSize:16, + // // borderColor:'#50E6D7' + // } + // }, + { + name: '鏌辩姸鍥�', + textStyle: { + padding: 4, + fontSize: 16, + color: '#9996f8' + // borderWidth:1, + // borderColor:'#50E6D7' + } + } + ] + }, + xAxis: { + type: 'category', + data: ['寮�鏈烘椂闀�', '鍏虫満鏃堕暱', '杩愯鏃堕暱', '寰呮満鏃堕暱'], + axisLabel: { //鍧愭爣杞村瓧浣撻鑹� + textStyle: { + color: '#000' + } + }, + axisLine: { + lineStyle: { + color: '#e5e5e5' + } + }, + axisTick: { //y杞村埢搴︾嚎 + show: false + }, + splitLine: { //缃戞牸 + show: false + }, + boundaryGap: true + }, + yAxis: { + name: '鏃堕棿/灏忔椂', + type: 'value', + axisLabel: { //鍧愭爣杞村瓧浣撻鑹� + textStyle: { + color: '#000' + } + }, + axisLine: { + show: false + }, + axisTick: { //y杞村埢搴︾嚎 + show: false + }, + splitLine: { //缃戞牸 + show: true, + lineStyle: { + color: '#dadde4', + type: 'dashed' + } + } + }, + series: [ + // { + // name:'鏇茬嚎', + // type: 'line', + // smooth:true, + // symbol: 'circle', + // symbolSize: 8, + // label:{ + // show:true, + // position:"top", + // textStyle:{ + // color:'#000', + // }, + // formatter:"鏃堕暱锛歿c}H" + // }, + // itemStyle: { + // color: "rgb(87, 120, 225)", + // borderColor: "#fff", + // borderWidth: 2, + // shadowColor: 'rgba(0, 0, 0, .3)', + // }, + // lineStyle: { + // normal: { + // color:"rgb(87, 120, 225)", + // shadowColor: 'rgba(87, 120, 225, .4)', + // shadowBlur: 8, + // shadowOffsetY: 10, + // shadowOffsetX: 0, + // }, + // }, + // areaStyle: { + // normal: { + // color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{ + // offset: 0, + // color: 'rgba(87, 120, 225, .6)' + // }, { + // offset: 1, + // color: 'rgba(87, 120, 225, .3)' + // }]), + // } + // }, + // data: [this.openingLong, this.closedLong, this.processLong,this.waitingLong], + // }, + { + name: '鏌辩姸鍥�', + type: 'bar', + data: [this.openingLong, this.closedLong, this.processLong, this.waitingLong], + // data:[22,3,5,6], + barWidth: 25, + label: { + show: true, + position: 'top', + textStyle: { + color: '#000' + }, + // formatter:"鏃堕暱锛歿c}H", + formatter: params => { + const value = String(params.value) + return value.length == 2 && value[0] === '0' ? `鏃堕暱锛�${value.slice(1)}H` : `鏃堕暱锛�${value}H` + } + }, + itemStyle: { + normal: { + color: function(params) { + let colorList = [ + ['#6496e9', '#6bded3'], + ['#849db8', '#b4b8cc'], + ['#4fe1c5', '#4ecee1'], + // ["#9978fa","#88a1fa"], + ['#ffbb65', '#fdc68b'] + ] + // return colorList[params.dataIndex]; + let colorItem = colorList[params.dataIndex] + return new echarts.graphic.LinearGradient(0, 0, 0, 1, [{ + offset: 0, + color: colorItem[0] + }, + { + offset: 1, + color: colorItem[1] + }], false) + }, + barBorderRadius: [5, 5, 0, 0] + } + } + }] + } + PowerOnRateLine.setOption(PowerOnRateLine_option) + //寮�鏈虹巼 + let UtilizationLine = this.$echarts.init(document.getElementById('UtilizationLine'), 'macarons') + let UtilizationLine_option = { + tooltip: { + trigger: 'axis', + axisPointer: { + type: 'shadow' + } + }, + grid: { + top: '15%', + right: '3%', + left: '10%', + bottom: '12%' + }, + xAxis: [{ + type: 'category', + data: ['寮�鏈烘椂闀�', '鎬绘椂闀�'], + axisLine: { + lineStyle: { + // color: 'rgba(70, 196, 255, .8)' + } + }, + axisTick: { + show: false + }, + axisLabel: { + // color: 'rgba(111, 132, 189, 1)', + textStyle: { + fontSize: 14 + } + } + }], + yAxis: [{ + type: 'value', + name: '鏃堕棿/灏忔椂', + nameTextStyle: { + // color: 'rgba(111, 132, 189, 1)' + }, + axisLabel: { + formatter: '{value}' + // color: 'rgba(111, 132, 189, 1)', + }, + axisTick: { + show: false + }, + + axisLine: { + show: false + }, + splitLine: { + lineStyle: { + // color: 'rgba(70, 196, 255, .3)' + } + } + }], + series: [ + { + type: 'bar', + data: [this.openingLong, this.totalLong], + // data:[22,22], + barWidth: 25, + label: { + show: true, + position: 'top', + textStyle: { + color: '#000' + }, + // formatter:"鏃堕暱锛歿c}H", + formatter: params => { + const value = String(params.value) + return value.length == 2 && value[0] === '0' ? `鏃堕暱锛�${value.slice(1)}H` : `鏃堕暱锛�${value}H` + } + }, + itemStyle: { + normal: { + color: function(params) { + let colorList = [ + ['#6496e9', '#6bded3'], + ['#9978fa', '#88a1fa'] + ] + // return colorList[params.dataIndex]; + let colorItem = colorList[params.dataIndex] + return new echarts.graphic.LinearGradient(0, 0, 0, 1, [{ + offset: 0, + color: colorItem[0] + }, + { + offset: 1, + color: colorItem[1] + }], false) + }, + barBorderRadius: [5, 5, 0, 0] + } + } + }] + } + UtilizationLine.setOption(UtilizationLine_option) + //寮�鍔ㄧ巼 + let StartupLine = this.$echarts.init(document.getElementById('StartupLine'), 'macarons') + let StartupLine_option = { + tooltip: { + trigger: 'axis', + axisPointer: { + type: 'shadow' + } + }, + grid: { + top: '15%', + right: '3%', + left: '10%', + bottom: '12%' + }, + xAxis: [{ + type: 'category', + data: ['杩愯鏃堕暱', '寮�鏈烘椂闀�'], + axisLine: { + lineStyle: { + // color: 'rgba(70, 196, 255, .8)' + } + }, + axisTick: { + show: false + }, + axisLabel: { + // color: 'rgba(111, 132, 189, 1)', + textStyle: { + fontSize: 14 + } + } + }], + yAxis: [{ + type: 'value', + name: '鏃堕棿/灏忔椂', + nameTextStyle: { + // color: 'rgba(111, 132, 189, 1)' + }, + axisLabel: { + formatter: '{value}' + // color: 'rgba(111, 132, 189, 1)', + }, + axisTick: { + show: false + }, + + axisLine: { + show: false + }, + splitLine: { + lineStyle: { + // color: 'rgba(70, 196, 255, .3)' + } + } + }], + series: [{ + type: 'bar', + data: [this.processLong, this.openingLong], + // data:[22,22], + barWidth: 25, + label: { + show: true, + position: 'top', + textStyle: { + color: '#000' + }, + // formatter:"鏃堕暱锛歿c}H", + formatter: params => { + const value = String(params.value) + return value.length == 2 && value[0] === '0' ? `鏃堕暱锛�${value.slice(1)}H` : `鏃堕暱锛�${value}H` + } + }, + itemStyle: { + normal: { + color: function(params) { + let colorList = [ + ['#4fe1c5', '#4ecee1'], + ['#6496e9', '#6bded3'] + ] + // return colorList[params.dataIndex]; + let colorItem = colorList[params.dataIndex] + return new echarts.graphic.LinearGradient(0, 0, 0, 1, [{ + offset: 0, + color: colorItem[0] + }, + { + offset: 1, + color: colorItem[1] + }], false) + }, + barBorderRadius: [5, 5, 0, 0] + } + } + }] + } + StartupLine.setOption(StartupLine_option) + }, + queryStatistical() { + getAction(this.url.dayStatisticalRate, this.queryParams).then(res => { + if (res.success) { + this.StatCharOpeningRate = res.result.openRate + this.StatCharUsedRate = res.result.utilizationRate + this.UtilizationHeight = res.result.openRate + this.StatCharUsedopeningRate = res.result.usedOpenRate + this.StartupHeight = res.result.usedOpenRate + this.openingLong = this.getTime(res.result.openLong) + this.waitingLong = this.getTime(res.result.waitLong) + this.processLong = this.getTime(res.result.processLong) + this.closedLong = this.getTime(res.result.closeLong) + this.totalLong = parseInt(this.openingLong) + parseInt(this.closedLong) + this.draw() + } + }) + }, + dataChange(val) { + if (val) { + this.queryParams.dateTime = val.format('YYYYMMDD') + this.queryParams.collectTime = val.format('YYYY-MM-DD') + } + }, + initEquipmentNode() { + let _this = this + getAction(this.url.getBaseTree).then((res) => { + if (res.success) { + const { isEquipment, productionId, tierName } = this.$route.params + // 鍒ゆ柇鏄惁鏄粠鐪嬫澘璺宠浆杩囨潵锛宲roductionId 瀛樺湪鍒欎负浠庣湅鏉胯烦杞� + if (productionId) { + // 鍒ゆ柇鏄惁鐐瑰嚮鐨勬槸璁惧灞傜骇 + if (!isEquipment) { + _this.$set(this.queryParams, 'parentId', productionId) + _this.$set(this.queryParam, 'tierName', tierName) + } else { + _this.$set(this.queryParams, 'equipmentId', productionId) + _this.$set(this.queryParam, 'tierName', productionId + '/' + tierName) + } + } else { + if (res.result[0]) { + _this.$set(this.queryParam, 'tierName', res.result[0].title) + _this.$set(this.queryParams, 'parentId', res.result[0].key) + } + } + this.queryStatistical() + } else { + this.$notification.warning({ + message: '娑堟伅', + description: res.message + }) + } + }).finally(() => { + this.loading = false + this.cardLoading = false + }) + }, + searchReset() { + this.queryParam = {} + this.queryParams = { + collectTime: moment().add(-1, 'd').format('YYYY-MM-DD'), + dateTime: moment().add(-1, 'd').format('YYYYMMDD') + } + this.initEquipmentNode() + }, + searchQuery() { + this.queryStatistical() + } + }, + watch: { + equip(val) { + // console.log(val); + if (val && val.equipmentId) { + this.$set(this.queryParam, 'tierName', val.title) + this.$set(this.queryParam, 'equipmentId', val.equipmentId) + this.queryParams.parentId = '' + this.queryParams.equipmentId = val.equipmentId + } else { + this.queryParams.parentId = val.key + this.queryParams.equipmentId = '' + this.$set(this.queryParam, 'tierName', val.title) + } + this.searchQuery() + } + // this.searchQuery(); + } + + } +</script> + +<style scoped> + .charContent { + display: flex; + } + + @media screen and (min-width: 1920px) { + #StatisticsLegend { + height: 748px !important; + overflow: scroll; + } + } + + @media screen and (min-width: 1680px) and (max-width: 1920px) { + #StatisticsLegend { + height: 748px !important; + overflow: scroll; + } + } + + @media screen and (min-width: 1400px) and (max-width: 1680px) { + #StatisticsLegend { + height: 600px !important; + overflow: scroll; + } + } + + @media screen and (min-width: 1280px) and (max-width: 1400px) { + #StatisticsLegend { + height: 501px !important; + overflow: scroll; + } + } + + @media screen and (max-width: 1280px) { + #StatisticsLegend { + height: 501px !important; + overflow: scroll; + } + } + + #StatisticsLegend .PowerOnRate { + flex: 1; + margin-bottom: 15px; + background-color: #fff; + } + + #StatisticsLegend .UtilizationStartup { + flex: 1; + display: flex; + } + + #StatisticsLegend .UtilizationStartup > div { + flex: 1; + background-color: #fff; + } + + #StatisticsLegend .UtilizationStartup .Utilization { + margin-right: 15px; + } + + .title { + display: flex; + align-items: center; + padding-left: 15px; + padding-top: 5px; + } + + .title .circle { + width: 15px; + height: 15px; + background-color: #7282ec; + border-radius: 100%; + margin-right: 10px; + } + + .title .text { + font-size: 2vh; + } + + .Line-box { + display: flex; + flex-direction: column; + } + + .Line-box .box-bottom { + flex: 1; + } + + .PowerOnRate-box { + display: flex; + } + + .PowerOnRate-box .PowerOnRate-left { + width: 25%; + } + + .PowerOnRate-box .PowerOnRate-right { + flex: 1; + } + + .Utilization-box { + display: flex; + } + + .Utilization-box .Utilization-left { + width: 25%; + } + + .Utilization-box .Utilization-right { + flex: 1; + } + + .Startup-box { + display: flex; + } + + .Startup-box .Startup-left { + width: 25%; + } + + .Startup-box .Startup-right { + flex: 1; + } + + .left { + display: flex; + align-items: center; + } + + .left .left-box { + width: 65%; + height: 60%; + margin: 0 auto; + overflow: hidden; + border-radius: 8px; + + /*border: 6px solid red;*/ + /*!*background-color: yellow;*!*/ + /*border-image: linear-gradient(to top, #2bf3c7, #06a8f8) 1;*/ + } + + .left-box-con { + width: 100%; + height: 100%; + position: relative; + text-align: center; + border: 6px solid red; + /*background-color: yellow;*/ + border-image: linear-gradient(to top, #2bf3c7, #06a8f8) 1; + } + + .left .left-box .Rate-box-kong { + width: 100%; + background: -moz-linear-gradient(bottom, #b5dec2 0%, #f4f5ba 100%); + background: -webkit-gradient(linear, bottom bottom, top top, color-stop(0%, #b5dec2), color-stop(100%, #f4f5ba)); + background: -webkit-linear-gradient(bottom, #b5dec2 0%, #f4f5ba 100%); + background: -o-linear-gradient(bottom, #b5dec2 0%, #f4f5ba 100%); + background: -ms-linear-gradient(bottom, #b5dec2 0%, #f4f5ba 100%); + background: linear-gradient(to top, #b5dec2 0%, #f4f5ba 100%); + } + + .left .left-box .Rate-box { + position: absolute; + text-align: center; + bottom: 0; + width: 100%; + height: 89%; + /*background-color: green;*/ + background: -moz-linear-gradient(bottom, #06a8f8 0%, #2bf3c7 100%); + background: -webkit-gradient(linear, bottom bottom, top top, color-stop(0%, #06a8f8), color-stop(100%, #2bf3c7)); + background: -webkit-linear-gradient(bottom, #06a8f8 0%, #2bf3c7 100%); + background: -o-linear-gradient(bottom, #06a8f8 0%, #2bf3c7 100%); + background: -ms-linear-gradient(bottom, #06a8f8 0%, #2bf3c7 100%); + background: linear-gradient(to top, #06a8f8 0%, #2bf3c7 100%); + } + + .left .left-box .Rate-box p { + position: absolute; + bottom: 0; + color: #fff; + width: 100%; + text-align: center; + } + + .con-left { + display: flex; + flex-direction: column; + flex-wrap: wrap; + justify-content: space-around; + align-items: center; + } + + .con-left > span { + flex: 1; + } +</style> \ No newline at end of file diff --git a/src/views/mdc/base/modules/TorqueconfigurationList/TorqueconfigurationForm.vue b/src/views/mdc/base/modules/TorqueconfigurationList/TorqueconfigurationForm.vue new file mode 100644 index 0000000..eef3d6b --- /dev/null +++ b/src/views/mdc/base/modules/TorqueconfigurationList/TorqueconfigurationForm.vue @@ -0,0 +1,124 @@ +<template> + <a-spin :spinning="confirmLoading"> + <j-form-container :disabled="formDisabled"> + <a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail"> + <a-row> + <a-col :span="24"> + <a-form-model-item label="璁惧缂栧彿" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="equipmentid"> + <a-input v-model="model.equipmentid" placeholder="璇疯緭鍏ヨ澶囩紪鍙�" ></a-input> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="璁惧鍚嶇О" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="equipmentname"> + <a-input v-model="model.equipmentname" placeholder="璇疯緭鍏ヨ澶囧悕绉�" ></a-input> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="鏃堕棿" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="startdate"> + <j-date placeholder="璇烽�夋嫨鏃堕棿" v-model="model.startdate" style="width: 100%" /> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="鎵煩鍊�" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="torquevalue"> + <a-input v-model="model.torquevalue" placeholder="璇疯緭鍏ユ壄鐭╁��" ></a-input> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="澶囨敞" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="notes"> + <a-input v-model="model.notes" placeholder="璇疯緭鍏ュ娉�" ></a-input> + </a-form-model-item> + </a-col> + </a-row> + </a-form-model> + </j-form-container> + </a-spin> +</template> + +<script> + + import { httpAction, getAction } from '@/api/manage' + import { validateDuplicateValue } from '@/utils/util' + + export default { + name: 'TorqueconfigurationForm', + components: { + }, + props: { + //琛ㄥ崟绂佺敤 + disabled: { + type: Boolean, + default: false, + required: false + } + }, + data () { + return { + model:{ + }, + labelCol: { + xs: { span: 24 }, + sm: { span: 5 }, + }, + wrapperCol: { + xs: { span: 24 }, + sm: { span: 16 }, + }, + confirmLoading: false, + validatorRules: { + }, + url: { + add: "/torquec/torqueconfiguration/add", + edit: "/torquec/torqueconfiguration/edit", + queryById: "/torquec/torqueconfiguration/queryById" + } + } + }, + computed: { + formDisabled(){ + return this.disabled + }, + }, + created () { + //澶囦唤model鍘熷鍊� + this.modelDefault = JSON.parse(JSON.stringify(this.model)); + }, + methods: { + add () { + this.edit(this.modelDefault); + }, + edit (record) { + this.model = Object.assign({}, record); + this.visible = true; + }, + submitForm () { + const that = this; + // 瑙﹀彂琛ㄥ崟楠岃瘉 + this.$refs.form.validate(valid => { + if (valid) { + that.confirmLoading = true; + let httpurl = ''; + let method = ''; + if(!this.model.id){ + httpurl+=this.url.add; + method = 'post'; + }else{ + httpurl+=this.url.edit; + method = 'put'; + } + httpAction(httpurl,this.model,method).then((res)=>{ + if(res.success){ + that.$message.success(res.message); + that.$emit('ok'); + }else{ + that.$message.warning(res.message); + } + }).finally(() => { + that.confirmLoading = false; + }) + } + + }) + }, + } + } +</script> \ No newline at end of file diff --git a/src/views/mdc/base/modules/TorqueconfigurationList/TorqueconfigurationList.vue b/src/views/mdc/base/modules/TorqueconfigurationList/TorqueconfigurationList.vue new file mode 100644 index 0000000..e9f6724 --- /dev/null +++ b/src/views/mdc/base/modules/TorqueconfigurationList/TorqueconfigurationList.vue @@ -0,0 +1,762 @@ +<template> + <div class="device_list"> + <!-- 鏌ヨ鍖哄煙 --> + <div style=" background-color: #fff;overflow: auto" class="table-page-search-wrapper"> + <a-form layout="inline" @keyup.enter.native="searchQuery"> + <a-row :gutter="24" style="width: 100%;"> + <a-col :md="7" :sm="7"> + <a-form-item label="鏃堕棿"> + <a-range-picker @change="dateParamChange" v-model="dates" format="YYYY-MM-DD HH:mm:ss"/> + </a-form-item> + </a-col> + <a-col :md="5" :sm="5"> + <a-form-item label="璁惧缂栧彿"> + <a-input placeholder="杈撳叆璁惧缂栧彿鏌ヨ" v-model="queryParams.equipmentId"></a-input> + </a-form-item> + </a-col> + <a-col :md="5" :sm="5" :xs="5"> + <a-form-item label="璁惧鍚嶇О"> + <a-input placeholder="杈撳叆璁惧鍚嶇О鏌ヨ" v-model="queryParams.equipmentName"></a-input> + </a-form-item> + </a-col> + <a-col :md="2" :sm="2" :xs="2"> + <a-space> + <a-button type="primary" @click="searchQuery" icon="search">鏌ヨ</a-button> + <a-button type="primary" @click="searchReset" icon="reload">閲嶇疆</a-button> + </a-space> + </a-col> + <!--<a-col :md="2" :sm="3" :xs="3">--> + <!--<a-button type="primary" @click="searchQuery" icon="search">鏌ヨ</a-button>--> + <!--</a-col>--> + <!--<a-col :md="2" :sm="2" :xs="2">--> + <!--<a-button type="primary" @click="searchReset" icon="reload">閲嶇疆</a-button>--> + <!--</a-col>--> + <!--<a-col :lg="2" :md="3" :sm="3" :xs="3">--> + <!--<a-button type="primary" @click="exportExcel" icon="download">瀵煎嚭</a-button>--> + <!--</a-col>--> + </a-row> + </a-form> + </div> + <!-- 鎿嶄綔鎸夐挳鍖哄煙 --> + <div class="table-operator" style="display: inline;"> + <a-button @click="handleAdd" type="primary" icon="plus">鏂板 + </a-button> + <a-button type="primary" icon="download" @click="handleExportXls('鎵煩閰嶇疆')">瀵煎嚭</a-button> + <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel"> + <a-button type="primary" icon="import">瀵煎叆</a-button> + </a-upload> + <a-dropdown v-if="selectedRowKeys.length > 0"> + <a-menu slot="overlay"> + <a-menu-item key="1" @click="batchDel"> + <a-icon type="delete"/> + 鍒犻櫎 + </a-menu-item> + </a-menu> + <a-button style="margin-left: 8px"> 鎵归噺鎿嶄綔 + <a-icon type="down"/> + </a-button> + </a-dropdown> + </div> + + <!-- table鍖哄煙-begin --> + <div id="DeviceList" style="flex: 1;overflow: hidden"> + <a-table ref="table" bordered size="middle" rowKey="id" :columns="columns" + :dataSource="dataSource" :pagination="ipagination" :loading="loading" + :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}" + @change="handleTableChange" :scroll="{x:'max-content',y:scrollY}"> + <span slot="action" slot-scope="text, record"> + <a @click="handleEdit(record)">缂栬緫</a> + <a-divider type="vertical" /> + <a @click="handleDelete(record.id)">鍒犻櫎</a> + </span> + <!--瀛楃涓茶秴闀挎埅鍙栫渷鐣ュ彿鏄剧ず--> + <span slot="num" slot-scope="text" style="font-weight: bold"> + <j-ellipsis :value="text" :length="8"/> + </span> + <span slot="name" slot-scope="text" style="font-weight: bold"> + <j-ellipsis :value="text" :length="8"/> + </span> + <span slot="model" slot-scope="text" style="font-weight: bold"> + <j-ellipsis :value="text" :length="8"/> + </span> + </a-table> + </div> + <!-- table鍖哄煙-end --> + <!--<device-repair-model></device-repair-model>--> + <torqueconfiguration-modal ref="modalForm" @ok="modalFormOk"></torqueconfiguration-modal> + <torqueconfiguration-modaledit ref="modalFormedit" @ok="modalFormOk">></torqueconfiguration-modaledit> + <!--<device-repair-model-add ref="modalFormadd" @ok="modalFormOk"></device-repair-model-add>--> + <!--<device-repair-model-edit ref="modalFormedit" @ok="modalFormOk"></device-repair-model-edit>--> + <!--<repair-model ref="repairModelFrom" @ok="modalFormOk"></repair-model>--> + + </div> +</template> + +<script> + import moment from 'moment' + import $ from 'jquery' + import JDictSelectTag from '@/components/dict/JDictSelectTag' + import JDate from '../../../../../components/jeecg/JDate' + import { + requestPut, + deleteAction, + getAction, + downFile, + getFileAccessHttpUrl + } from '@/api/manage' + import TorqueconfigurationModal from './TorqueconfigurationModal' + import TorqueconfigurationModaledit from './TorqueconfigurationModalEdit' + // import DeviceRepairModelAdd from './DeviceRepairModelAdd' + // import DeviceRepairModelEdit from './DeviceRepairModelEdit' + import '@/components/table2excel/table2excel' + import { + JeecgListMixin + } from '@/mixins/JeecgListMixin' + import JInput from '@/components/jeecg/JInput' + import JEllipsis from '@/components/jeecg/JEllipsis' + import Tooltip from 'ant-design-vue/es/tooltip' + import { ajaxGetDictItems, getDictItemsFromCache, duplicateCheck } from '@/api/api' + export default { + name: 'TorqueconfigurationList', + mixins: [JeecgListMixin], + components: { + Tooltip, + TorqueconfigurationModal, + TorqueconfigurationModaledit, + // DeviceRepairModelAdd, + // DeviceRepairModelEdit, + JDictSelectTag, + JInput, + JDate, + JEllipsis + }, + props: { nodeTree: '', Type:'',nodePeople: '' }, + data() { + return { + typeTree:"", + typeParent:1, + typeEquipment:1, + dates: [], + xianshi:"", + readOnly:true, + queryParam: {}, + queryParams:{}, + queryParamEquip:{}, + queryParamPeople:{}, + dataStartsoucre:[], + scrollY:465, + /* 鍒嗛〉鍙傛暟 */ + ipagination:{ + current: 1, + pageSize: 30, + pageSizeOptions: ['30', '50', '100'], + showTotal: (total, range) => { + return range[0] + "-" + range[1] + " 鍏�" + total + "鏉�" + }, + showQuickJumper: true, + showSizeChanger: true, + total: 0 + }, + columns: [ + { + title: '璁惧缂栧彿', + align: 'center', + dataIndex: 'equipmentId', + width:200 + }, + { + title: '璁惧鍚嶇О', + align: 'center', + dataIndex: 'equipmentName', + width:250 + // defaultSortOrder:'descend', + // sorter: (a, b) => {return a.equipmentName>b.equipmentName?1:-1} + }, + { + title: '鏃堕棿', + align: 'center', + dataIndex: 'torqueDate', + width:250 + // scopedSlots:{customRender:'startTime'}, + // customRender:(text,row,index) => { + // return moment(text).format("YYYY-MM-DD HH:mm:ss") + // } + }, + { + title: '鎵煩鍊�', + align: 'center', + dataIndex: 'torqueValue', + width:150 + }, + { + title: '杩涚粰鍙傛暟', + align: 'center', + dataIndex: 'feedParameter', + width:150 + }, + { + title: '澶囨敞', + align: 'center', + dataIndex: 'notes', + width:250 + }, + { + title: '鎿嶄綔', + dataIndex: 'action', + scopedSlots: {customRender: 'action'}, + align: "center", + width: 150, + fixed:'right' + } + ], + url: { + list: '/mdc/MdcTorqueConfig/pageList', + delete: '/mdc/MdcTorqueConfig/deleteMdcTorqueConfig', + deleteBatch: '/mdc/MdcTorqueConfig/deleteBatchMdcTorqueConfig', + getEquipmentByPid: '/mdc/mdcequipment/getEquipmentByPid', + exportXlsUrl: "/mdc/MdcTorqueConfig/exportXls", + importExcelUrl: "/mdc/MdcTorqueConfig/importExcel", + } + } + }, + watch:{ + Type(valmath){ + this.dataList = []; + this.queryParams.typeTree = valmath + console.log(valmath,'瑙﹀彂Type鐨剋atch鏂规硶') + // console.log(this.queryParams.typeTree) + }, + nodeTree(val) { //鐩戝惉currSelected 鍙樺寲锛屽皢鍙樺寲鍚庣殑鏁板�间紶閫掔粰 getCurrSelected 浜嬩欢 + if (JSON.stringify(val) != '{}') { + if (val.equipmentId) { + this.queryParamEquip.parentId = "" + this.queryParams.equipmentId = val.equipmentId + this.queryParamEquip.equipmentId = val.equipmentId + } else { + this.queryParamEquip.parentId = val.key + this.queryParams.equipmentId = '' + } + this.searchQuery() + } + }, + nodePeople(val){ + if (JSON.stringify(val) != '{}') { + if (val.equipmentId) { + this.queryParamEquip.parentId = "" + this.queryParams.equipmentId = val.equipmentId + this.queryParamEquip.equipmentId = val.equipmentId + } else { + this.queryParamPeople.parentId = val.key + this.queryParams.equipmentId = '' + } + this.searchQuery() + } + } + }, + computed: { + importExcelUrl: function(){ + return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`; + }, + }, + methods: { + dateParamChange(v1, v2) { + // console.log(v1,v2) + this.queryParam.startTime = v2[0] + this.queryParam.endTime = v2[1] + // console.log(v2[0],v2[1]) + }, + onChange(value, dateString) { + // console.log('Selected Time: ', value); + // console.log('Formatted Selected Time: ', dateString); + }, + onOk(value) { + console.log('onOk: ', value); + }, + /** + * 鏌ヨ鍖哄煙閲嶇疆鎸夐挳 + */ + searchReset() { + if(this.queryParams.typeTree == "1"){ + console.log('绗竴涓殑typeTree',this.queryParams.typeTree) + this.typeTree = this.queryParams.typeTree + this.typeParent = this.queryParams.parentId + this.typeEquipment = this.queryParams.equipmentId + this.queryParams = {} + this.queryParam = {} + this.dates = [] + this.queryParams.typeTree = this.typeTree + this.queryParams.parentId = this.typeParent + console.log('杩涘叆绗竴涓�') + if(this.queryParams.parentId != ""){ + this.queryParams.equipmentId = "" + }else{ + if(this.queryParams.equipmentId == this.queryParamEquip.equipmentId){ + this.queryParams.equipmentId = this.typeEquipment + }else{ + this.queryParams.equipmentId = this.queryParamEquip.equipmentId + } + } + this.ipagination.current = 1 + this.ResetloadData(); + }else{ + console.log('杩涘叆绗簩涓�') + console.log('绗簩涓殑typeTree',this.queryParams.typeTree) + this.typeTree = this.queryParams.typeTree + this.typeParent = this.queryParams.parentId + // this.typeEquipment = this.queryParams.equipmentId + this.queryParams = {} + this.queryParam = {} + this.dates = [] + this.queryParams.typeTree = this.typeTree + this.queryParams.parentId = this.typeParent + // this.queryParams.equipmentId = this.typeEquipment + this.ipagination.current = 1 + this.ResetloadData(); + } + + }, + ResetloadData() { + if(!this.url.list){ + this.$message.error("璇疯缃畊rl.list灞炴��!") + return + } + //鍔犺浇鏁版嵁 鑻ヤ紶鍏ュ弬鏁�1鍒欏姞杞界涓�椤电殑鍐呭 + var params = this.getQueryParams();//鏌ヨ鏉′欢 + if(!params){ + return false; + } + params.typeTree = this.queryParams.typeTree + params.parentId = this.queryParams.parentId + params.equipmentId = this.queryParams.equipmentId + this.loading = true; + getAction(this.url.list, params).then((res) => { + if (res.success) { + this.dataSource = res.result.records||res.result; + // this.initDeviceType(this.dataSource) + //update-begin---author:zhangyafei Date:20201118 for锛氶�傞厤涓嶅垎椤电殑鏁版嵁鍒楄〃------------ + // this.dataSource = res.result.records||res.result; + if(res.result.total) + { + this.ipagination.total = res.result.total; + }else{ + this.ipagination.total = 0; + } + //update-end---author:zhangyafei Date:20201118 for锛氶�傞厤涓嶅垎椤电殑鏁版嵁鍒楄〃------------ + }else{ + // this.$message.warning(res.message) + this.$notification.warning({ + message:'娑堟伅', + description:res.message + }); + } + }).finally(() => { + this.loading = false + }) + }, + handleEdit: function (record) { + this.$refs.modalFormedit.edit(record); + this.$refs.modalFormedit.title = "缂栬緫"; + this.$refs.modalFormedit.disableSubmit = false; + }, + handleTableChange(pagination, filters, sorter) { + this.dataSource = [] + //鍒嗛〉銆佹帓搴忋�佺瓫閫夊彉鍖栨椂瑙﹀彂 + //TODO 绛涢�� + // console.log(pagination) + if (Object.keys(sorter).length > 0) { + this.isorter.column = sorter.field; + this.isorter.order = "ascend" == sorter.order ? "asc" : "desc" + } + this.ipagination = pagination; + //鑾峰彇鏌ヨ鏉′欢 + let sqp = {} + if(this.superQueryParams){ + sqp['superQueryParams']=encodeURI(this.superQueryParams) + sqp['superQueryMatchType'] = this.superQueryMatchType + } + var param = Object.assign(sqp, this.queryParams, this.isorter ,this.filters); + param.pageNo = this.ipagination.current; + param.pageSize = this.ipagination.pageSize; + param.field = this.getQueryField(); + param.parentId = this.queryParams.parentId; + param.equipmentId = this.queryParams.equipmentId; + param.startTime = this.queryParam.startTime; + param.endTime = this.queryParam.endTime; + getAction(this.url.list,param).then((res) => { + if(res.success){ + this.dataSource = res.result.records||res.result; + if(res.result.total) + { + this.ipagination.total = res.result.total; + }else{ + this.ipagination.total = 0; + } + }else{ + // this.$message.warning(res.message) + this.$notification.warning({ + message:'娑堟伅', + description:res.message + }); + } + }).finally(() => { + this.loading = false + }) + }, + searchQueryEdit(){ + if(this.queryParams.typeTree == "1"){ + this.queryParams.parentId = this.queryParamEquip.parentId + }else{ + this.queryParams.parentId = this.queryParamPeople.parentId + this.queryParams.equipmentIds = "" + } + this.dataSource = []; + //鑾峰彇鏌ヨ鏉′欢 + let sqp = {} + if(this.superQueryParams){ + sqp['superQueryParams']=encodeURI(this.superQueryParams) + sqp['superQueryMatchType'] = this.superQueryMatchType + } + var param = Object.assign(sqp, this.queryParams, this.isorter ,this.filters); + param.pageNo = this.ipagination.current; + param.pageSize = this.ipagination.pageSize; + param.field = this.getQueryField(); + param.parentId = this.queryParams.parentId; + param.equipmentId = this.queryParams.equipmentId; + param.startTime = this.queryParam.startTime; + param.endTime = this.queryParam.endTime; + getAction(this.url.list,param).then((res) => { + if(res.success){ + this.dataSource = res.result.records||res.result; + if(res.result.total) + { + this.ipagination.total = res.result.total; + }else{ + this.ipagination.total = 0; + } + }else{ + // this.$message.warning(res.message) + this.$notification.warning({ + message:'娑堟伅', + description:res.message + }); + } + }).finally(() => { + this.loading = false + }) + }, + searchQuery(){ + if(this.queryParams.typeTree == "1"){ + this.queryParams.parentId = this.queryParamEquip.parentId + // this.queryParams.equipmentId = this.queryParamEquip.equipmentId + }else{ + this.queryParams.parentId = this.queryParamPeople.parentId + // this.queryParams.equipmentId = "" + } + this.dataSource = []; + //鑾峰彇鏌ヨ鏉′欢 + let sqp = {} + if(this.superQueryParams){ + sqp['superQueryParams']=encodeURI(this.superQueryParams) + sqp['superQueryMatchType'] = this.superQueryMatchType + } + var param = Object.assign(sqp, this.queryParams, this.isorter ,this.filters); + param.pageNo = 1; + param.pageSize = this.ipagination.pageSize; + param.field = this.getQueryField(); + param.parentId = this.queryParams.parentId; + param.equipmentId = this.queryParams.equipmentId; + param.startTime = this.queryParam.startTime; + param.endTime = this.queryParam.endTime; + console.log('param',param); + getAction(this.url.list,param).then((res) => { + if(res.success){ + this.dataSource = res.result.records||res.result; + if(res.result.total) + { + this.ipagination.total = res.result.total; + }else{ + this.ipagination.total = 0; + } + }else{ + // this.$message.warning(res.message) + this.$notification.warning({ + message:'娑堟伅', + description:res.message + }); + + } + }).finally(() => { + this.loading = false + }) + }, + handleExportXls(fileName){ + if(!fileName || typeof fileName != "string"){ + fileName = "瀵煎嚭鏂囦欢" + } + let param = this.getQueryParams(); + if(this.selectedRowKeys && this.selectedRowKeys.length>0){ + param['selections'] = this.selectedRowKeys.join(",") + } + param.pageSize = this.ipagination.pageSize; + param.field = this.getQueryField(); + param.parentId = this.queryParams.parentId; + param.equipmentId = this.queryParams.equipmentId; + param.startTime = this.queryParam.startTime; + param.endTime = this.queryParam.endTime; + console.log("瀵煎嚭鍙傛暟",param) + downFile(this.url.exportXlsUrl,param).then((data)=>{ + if (!data) { + this.$message.warning("鏂囦欢涓嬭浇澶辫触") + return + } + if (typeof window.navigator.msSaveBlob !== 'undefined') { + window.navigator.msSaveBlob(new Blob([data],{type: 'application/vnd.ms-excel'}), fileName+'.xls') + }else{ + let url = window.URL.createObjectURL(new Blob([data],{type: 'application/vnd.ms-excel'})) + let link = document.createElement('a') + link.style.display = 'none' + link.href = url + link.setAttribute('download', fileName+'.xls') + document.body.appendChild(link) + link.click() + document.body.removeChild(link); //涓嬭浇瀹屾垚绉婚櫎鍏冪礌 + window.URL.revokeObjectURL(url); //閲婃斁鎺塨lob瀵硅薄 + } + }) + }, + loadData(arg) { + if(!this.url.list){ + this.$message.error("璇疯缃畊rl.list灞炴��!") + return + } + //鍔犺浇鏁版嵁 鑻ヤ紶鍏ュ弬鏁�1鍒欏姞杞界涓�椤电殑鍐呭 + if (arg === 1) { + this.ipagination.current = 1; + } + var params = this.getQueryParams();//鏌ヨ鏉′欢 + if(!params){ + return false; + } + this.loading = true; + getAction(this.url.list, params).then((res) => { + if (res.success) { + this.dataSource = res.result.records||res.result; + // this.initDeviceType(this.dataSource) + //update-begin---author:zhangyafei Date:20201118 for锛氶�傞厤涓嶅垎椤电殑鏁版嵁鍒楄〃------------ + // this.dataSource = res.result.records||res.result; + if(res.result.total) + { + this.ipagination.total = res.result.total; + }else{ + this.ipagination.total = 0; + } + //update-end---author:zhangyafei Date:20201118 for锛氶�傞厤涓嶅垎椤电殑鏁版嵁鍒楄〃------------ + }else{ + // this.$message.warning(res.message) + this.$notification.warning({ + message:'娑堟伅', + description:res.message + }); + } + }).finally(() => { + this.loading = false + }) + }, + modalFormOk(val) { + // 鏂板/淇敼 鎴愬姛鏃讹紝閲嶈浇鍒楄〃 + this.searchQueryEdit(); + // this.$emit('openBasetree','') + this.selectedRowKeys = [] + }, + handleDelete: function (id) { + if(!this.url.delete){ + this.$message.error("璇疯缃畊rl.delete灞炴��!") + return + } + var that = this; + deleteAction(that.url.delete, {id: id}).then((res) => { + if (res.success) { + //閲嶆柊璁$畻鍒嗛〉闂 + that.reCalculatePage(1) + // that.$message.success(res.message); + that.$notification.success({ + message:'娑堟伅', + description:res.message + }); + that.searchQuery(); + } else { + // that.$message.warning(res.message); + that.$notification.warning({ + message:'娑堟伅', + description:res.message + }); + } + }); + }, + batchDel: function () { + if(!this.url.deleteBatch){ + this.$message.error("璇疯缃畊rl.deleteBatch灞炴��!") + return + } + if (this.selectedRowKeys.length <= 0) { + // this.$message.warning('璇烽�夋嫨涓�鏉¤褰曪紒'); + this.$notification.warning({ + message:'娑堟伅', + description:"璇烽�夋嫨涓�鏉¤褰�" + }); + return; + } else { + var ids = ""; + for (var a = 0; a < this.selectedRowKeys.length; a++) { + ids += this.selectedRowKeys[a] + ","; + } + var that = this; + this.$confirm({ + title: "纭鍒犻櫎", + content: "鏄惁鍒犻櫎閫変腑鏁版嵁?", + onOk: function () { + that.loading = true; + deleteAction(that.url.deleteBatch, {ids: ids}).then((res) => { + if (res.success) { + //閲嶆柊璁$畻鍒嗛〉闂 + that.reCalculatePage(that.selectedRowKeys.length) + // that.$message.success(res.message); + that.$notification.warning({ + message:'娑堟伅', + description:res.message + }); + that.loadData(); + that.onClearSelected(); + } else { + // that.$message.warning(res.message); + that.$notification.warning({ + message:'娑堟伅', + description:res.message + }); + } + }).finally(() => { + that.loading = false; + }); + } + }); + } + }, + handleAdd() { + console.log(this.$refs.modalForm.edit) + this.$refs.modalForm.add(this.node) + this.$refs.modalForm.title = '鏂板' + this.$refs.modalForm.disableSubmit = false + }, + handleAddXIU() { + this.$refs.modalFormadd.add() + this.$refs.modalFormadd.title = '鏂板' + this.$refs.modalFormadd.disableSubmit = false + }, + pQuery(parentId) { + this.queryParam.parentId = parentId[0] + if(this.selectedRowKeys.length >= 1) { + this.selectedRowKeys.length = 0 + } + this.loadData() + }, + onSelectChange(selectedRowKeys) { + this.selectedRowKeys = selectedRowKeys + }, + initEquipment(id) { + let _this = this + getAction(this.url.getEquipmentByPid, { pid: id }).then((res) => { + if (res.success) { + if (res.result) { + _this.$set(this.queryParams, 'equipmentName', res.result.equipmentName) + _this.$set(this.queryParams, 'equipmentId', res.result.equipmentId) + _this.equipment = res.result + _this.searchQuery() + } else { + // _this.$message.warning('璇烽厤缃澶囷紒') + _this.$notification.warning({ + message:'娑堟伅', + description:'璇疯仈绯荤鐞嗗憳锛屽紑鏀捐澶囨潈闄愶紒' + }); + } + } + }) + }, + exportExcel() { + $("#DeviceList").table2excel({ + exclude: ".noExl", + name: "Excel Document Name", + filename: "鎵煩閰嶇疆", + exclude_img: true, + fileext: ".xls", + exclude_links: true, + exclude_inputs: true + }); + }, + + /** + * 褰撴祻瑙堝櫒鍙绐楀彛灏哄鍙戠敓鏀瑰彉鏃惰Е鍙� + */ + handleWindowResize(){ + const boxHeight = +window.getComputedStyle(document.getElementById('DeviceList')).height.slice(0,-2) + const tableHeadHeight = +window.getComputedStyle(document.querySelector('.ant-table-thead th')).height.slice(0,-2) + this.scrollY = boxHeight - tableHeadHeight - 50 + } + // /** + // * 杞﹂棿閫変腑椤瑰彇娑堝悗瑙﹀彂姝や簨浠讹紝鐢盉aseTree缁勪欢鐢变簨浠舵�荤嚎瑙﹀彂 + // * @param value 鎻愮ず淇℃伅 + // */ + // treeClearSelected(value){ + // this.queryParams.equipmentId='' + // this.queryParams.parentId='' + // this.ResetloadData() + // } + }, + created() { + this.queryParam.typeTree = "1" + // this.$bus.$on('treeClearSelected',this.treeClearSelected) + }, + mounted(){ + window.addEventListener('resize',this.handleWindowResize) + this.handleWindowResize() + }, + beforeDestroy(){ + window.removeEventListener('resize',this.handleWindowResize) + } + } +</script> + +<style lang="less" scoped> + @import '~@assets/less/common.less'; + + .device_list{ + overflow: hidden; + display: flex; + flex-direction: column; + } + + @media screen and (min-width: 1920px){ + .device_list{ + height: 811px!important; + } + } + @media screen and (min-width: 1680px) and (max-width: 1920px){ + .device_list{ + height: 811px!important; + } + } + @media screen and (min-width: 1400px) and (max-width: 1680px){ + .device_list{ + height: 663px!important; + } + } + @media screen and (min-width: 1280px) and (max-width: 1400px){ + .device_list{ + height: 564px!important; + } + } + @media screen and (max-width: 1280px){ + .device_list{ + height: 564px!important; + } + } +</style> diff --git a/src/views/mdc/base/modules/TorqueconfigurationList/TorqueconfigurationModal.vue b/src/views/mdc/base/modules/TorqueconfigurationList/TorqueconfigurationModal.vue new file mode 100644 index 0000000..ee2f506 --- /dev/null +++ b/src/views/mdc/base/modules/TorqueconfigurationList/TorqueconfigurationModal.vue @@ -0,0 +1,385 @@ +<template> + <a-modal :title="title" :width="800" :visible="visible" :confirmLoading="confirmLoading" + :okButtonProps="{ props: {disabled: disableSubmit} }" @ok="handleOk" @cancel="handleCancel" cancelText="鍏抽棴"> + <a-spin :spinning="confirmLoading"> + <a-form :form="form"> + <a-row :gutter="24"> + <a-col :span="12"> + <a-form-item label="璁惧缁�" :labelCol="labelCol" :wrapperCol="wrapperCol"> + <a-input-search :readOnly="true" v-decorator="['equipmentIds', validatorRules.equipmentIds]" + @search="deviceSearch" enter-button placeholder="璇烽�夋嫨璁惧"/> + </a-form-item> + </a-col> + <a-col :span="12"> + <a-form-item label="鏃堕棿" :labelCol="labelCol" :wrapperCol="wrapperCol"> + <j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="璇烽�夋嫨鏃堕棿" + v-decorator="['torqueDate', validatorRules.torqueDate]" style="width: 100%"></j-date> + </a-form-item> + </a-col> + </a-row> + <a-row :gutter="24"> + <a-col :span="12"> + <a-form-item label="鎵煩鍊�" :labelCol="labelCol" :wrapperCol="wrapperCol"> + <a-input-number :min="0" :disabled="disableSubmit" placeholder="璇疯緭鍏ユ壄鐭╁��" + v-decorator="['torqueValue', validatorRules.torqueValue]"/> + </a-form-item> + </a-col> + <a-col :span="12"> + <a-form-item label="杩涚粰鍙傛暟" :labelCol="labelCol" :wrapperCol="wrapperCol"> + <a-input placeholder="璇疯緭鍏ヨ繘缁欏弬鏁�" v-decorator="['feedParameter', validatorRules.feedParameter]"></a-input> + </a-form-item> + </a-col> + </a-row> + <a-row :gutter="24"> + <a-col :span="24"> + <a-form-item label="澶囨敞" :labelCol="labelColLong" :wrapperCol="wrapperColLong"> + <a-textarea :maxLength="20" v-decorator="['notes', validatorRules.notes]" + placeholder="璇疯緭鍏ュ娉�"></a-textarea> + </a-form-item> + </a-col> + </a-row> + </a-form> + </a-spin> + <select-device-drawer ref="selectDeviceDrawer" @selectFinished="selectOK" :title="'閫夋嫨璁惧'"/> + </a-modal> +</template> + +<script> + import moment from 'moment' + import pick from 'lodash.pick' + import TorqueconfigurationModalList from './TorqueconfigurationModalList' + // import JDate from './JDate' + import { + getAction, + postAction, + requestPut + } from '@/api/manage' + import { + duplicateCheck + } from '@/api/api' + import SelectDeviceDrawer from '../../../../system/modules/SelectDeviceDrawer' + + export default { + name: 'TorqueconfigurationModal', + components: { SelectDeviceDrawer }, + props: {}, + data() { + return { + mesag: 21, + readOnly: true, + title: '', + visible: false, + show: false, + model: {}, + checked: false, + startData: '', + endData: '', + labelCol: { + xs: { + span: 24 + }, + sm: { + span: 6 + } + }, + wrapperCol: { + xs: { + span: 24 + }, + sm: { + span: 18 + } + }, + labelColLong: { + xs: { + span: 24 + }, + sm: { + span: 3 + } + }, + wrapperColLong: { + xs: { + span: 24 + }, + sm: { + span: 21 + } + }, + confirmLoading: false, + form: this.$form.createForm(this), + validatorRules: { + equipmentIds: { + rules: [ + { + required: true, + message: '璇烽�夋嫨璁惧' + } + ] + }, + torqueDate: { + rules: [ + { + required: true, + message: '璇烽�夋嫨鏃堕棿' + } + ] + }, + torqueValue: { + rules: [ + { + required: true, + message: '璇疯緭鍏ユ壄鐭╁��' + } + ] + }, + feedParameter:{ + rules:[ + { + required:true, + message:'璇疯緭鍏ヨ繘缁欏弬鏁�' + } + ] + } + }, + + url: { + add: '/mdc/MdcTorqueConfig/addMdcTorqueConfig', + edit: '/mdc/MdcTorqueConfig/editMdcTorqueConfig' + }, + + disableSubmit: true, + partCategoryCascade: [], + cascadeDefaultValue: [] + } + }, + created() { + }, + + methods: { + // disabledDate(current){ + // //Can not slect days before today and today + // // return current && current < moment().endOf("day"); + // return current < moment().subtract(+1, 'day')//浠婂ぉ涔嬪墠鐨勫勾鏈堟棩涓嶅彲閫夛紝涓嶅寘鎷粖澶� + // }, + moment, + // onChange(dates) { + // // console.log(111) + // // console.log(dates,dateStrings) + // // console.log('From: ', dates[0], ', to: ', dates[1]); + // // console.log('From: ', dateStrings[0], ', to: ', dateStrings[1]); + // // this.startTime = dateStrings[0]; + // // this.endData = dateStrings[1]; + // // console.log(this.startData,this.endData); + // }, + onChangeEnd(dates, dateStrings) { + this.endTime = dateStrings[0] + }, + getDeviceRows(val) { + var equipmentIds + for (var i = 0; i < val.length; i++) { + if (i == 0) { + equipmentIds = val[i].equipmentId + } else { + equipmentIds = equipmentIds + ',' + val[i].equipmentId + } + } + // console.log("========",equipmentIds); + this.form.setFieldsValue({ + equipmentIds: equipmentIds + }) + // this.form.setFieldsValue({ + // equipmentId: val.equipmentId, + // equipmentName: val.equipmentName, + // equipmentModel: val.equipmentModel, + // equipmentIp: val.equipmentIp, + // dataPort: val.dataPort, + // driveType: val.driveType + // }) + }, + deviceSearch() { + this.$refs.selectDeviceDrawer.visible = true + this.$refs.selectDeviceDrawer.selectedRowKeys = [] + this.$refs.selectDeviceDrawer.selectedRows = [] + this.$refs.selectDeviceDrawer.checkedKeys = this.form.getFieldValue('equipmentIds') ? this.form.getFieldValue('equipmentIds').split(',') : [] + }, + //绾ц仈妗唎nChange浜嬩欢 + // onChange(value) { + // + // }, + getParentIdsById(id) { + let that = this + getAction(this.url.getParentIdsById, { + id: id + }).then((res) => { + if (res.success) { + that.form.setFieldsValue({ + partCategoryId: res.result + }) + } + }) + }, + add(node) { + let _this = this + this.visible = true + this.form.resetFields() + this.model = {} + this.$nextTick(() => { + // _this.form.setFieldsValue({ 'tierType': node.entity.tierType + 1, 'parentName': node.title }) + // _this.model.parentId = node.key + }) + }, + edit(record) { + this.form.resetFields() + this.model = Object.assign({}, record) + this.visible = true + this.$nextTick(() => { + this.form.setFieldsValue(pick(this.model, 'equipmentIds', 'equipmentName', 'mdcRepairType', 'startTime', 'endTime' + )) + }) + }, + close() { + this.$emit('close') + this.visible = false + this.show = false + }, + handleOk() { + const that = this + // 瑙﹀彂琛ㄥ崟楠岃瘉 + this.form.validateFields((err, values) => { + if (!err) { + that.confirmLoading = true + let formData = Object.assign(this.model, values) + // let start = moment(formData.startTime).format('YYYY-MM-DD HH:mm:ss'); + // let end = moment(formData.endTime).format('YYYY-MM-DD HH:mm:ss'); + // let startOne = start.replace(/:/g,''); + // let endOne = end.replace(/:/g,''); + // var data = new Date(); + // let stertDate = moment(data).format("YYYY-MM-DD HH:mm:ss"); + // let dataStart = stertDate.replace(/:/g,''); + // if(startOne < dataStart){ + // that.$message.warning("寮�濮嬫椂闂翠笉鑳藉皬浜庡綋鍓嶆椂闂�") + // that.confirmLoading = false + // }else{ + // if(startOne>=endOne){ + // that.$message.warning("缁撴潫鏃堕棿涓嶈兘灏忎簬寮�濮嬫椂闂�"); + // // console.log(this.model) + // // this.endTime = '' + // that.confirmLoading = false + // }else{ + let obj + if (!this.model.id) { + obj = postAction(this.url.add, formData) + } else { + obj = requestPut(this.url.edit, formData, { + id: this.model.id + }) + } + obj.then((res) => { + if (res.success) { + // that.$message.success("娣诲姞鎴愬姛") + that.$notification.success({ + message: '娑堟伅', + description: '娣诲姞鎴愬姛' + }) + // that.$message.success(res.message) + that.$emit('ok', res.result) + } else { + // that.$message.warning(res.message) + that.$notification.warning({ + message: '娑堟伅', + description: res.message + }) + } + }).finally(() => { + that.confirmLoading = false + that.close() + }) + } + // } + + // } + }) + }, + handleCancel() { + this.close() + }, + // loadCascade() { + // getAction(this.url.loadCascadeData).then((res) => { + // if (res.success) { + // this.partCategoryCascade = res.result + // } + // }) + // }, + onCascadeChange(value, selectedOptions) { + this.cascadeDefaultValue = [...value] + }, + filter(inputValue, path) { + return path.some(option => option.label.toLowerCase().indexOf(inputValue.toLowerCase()) > -1) + }, + //楠岃瘉 缂栫爜 + validateNum(rule, value, callback) { + var params = { + tableName: 'lxmes_base_part', + fieldName: 'num', + fieldVal: value, + dataId: this.model.id, + //鏁版嵁搴撲腑瀛樺湪瀛楁del_flag骞朵娇鐢ㄨ瀛楁浣滀负鏈垹闄ょ瓥鐣ワ紝鐪熷垹闄わ細false 鍋囧垹闄わ細true + delFlag: 'true' + } + duplicateCheck(params).then((res) => { + if (res.success) { + callback() + } else { + callback('瀛樿揣缂栫爜宸插瓨鍦�!') + } + }) + }, + checkboxChange(e) { + this.checked = e.target.checked + }, + + /** + * 閫夋嫨宸叉湁璁惧鍚庣偣鍑荤‘瀹氭椂瑙﹀彂 + * @param data 宸查�夋嫨鐨勮澶� + */ + selectOK(data) { + // let params = {} + // params.equipmentIdList = [] + // for (var a = 0; a < data.length; a++) { + // params.equipmentIdList.push(data[a]) + // } + console.log('data=', data) + this.form.setFieldsValue({ + equipmentIds: data.join(',') + }) + } + + } + } +</script> + +<style scoped lang="less"> + .ant-btn { + padding: 0 10px; + margin-left: 3px; + } + + .ant-form-item-control { + line-height: 0px; + } + + /** 涓昏〃鍗曡闂磋窛 */ + .ant-form .ant-form-item { + margin-bottom: 10px; + } + + /** Tab椤甸潰琛岄棿璺� */ + .ant-tabs-content .ant-form-item { + margin-bottom: 0px; + } + + /deep/ .ant-input-number { + width: 100% !important; + } +</style> diff --git a/src/views/mdc/base/modules/TorqueconfigurationList/TorqueconfigurationModalEdit.vue b/src/views/mdc/base/modules/TorqueconfigurationList/TorqueconfigurationModalEdit.vue new file mode 100644 index 0000000..ba239b5 --- /dev/null +++ b/src/views/mdc/base/modules/TorqueconfigurationList/TorqueconfigurationModalEdit.vue @@ -0,0 +1,372 @@ +<template> + <a-modal :title="title" :width="800" :visible="visible" :confirmLoading="confirmLoading" + :okButtonProps="{ props: {disabled: disableSubmit} }" @ok="handleOk" @cancel="handleCancel" cancelText="鍏抽棴"> + <a-spin :spinning="confirmLoading"> + <a-form :form="form"> + <a-row :gutter="24"> + <a-col :span="12"> + <a-form-item label="璁惧缂栧彿" :labelCol="labelCol" :wrapperCol="wrapperCol"> + <a-input :disabled="disableSubmit" :readOnly="readOnly" allow-clear placeholder="璇疯緭鍏ヨ澶囩紪鍙�" + v-decorator="['equipmentId',validatorRules.equipmentId]"/> + </a-form-item> + </a-col> + + <a-col :span="12"> + <a-form-item label="璁惧鍚嶇О" :labelCol="labelCol" :wrapperCol="wrapperCol"> + <a-input :disabled="disableSubmit" :readOnly="readOnly" allow-clear placeholder="璇疯緭鍏ヨ澶囧悕绉�" + v-decorator="['equipmentName',validatorRules.equipmentName]"/> + </a-form-item> + </a-col> + </a-row> + <a-row :gutter="24"> + <a-col :span="12"> + <a-form-item label="鏃堕棿" :labelCol="labelCol" :wrapperCol="wrapperCol"> + <j-date :show-time="true" date-format="YYYY-MM-DD HH:mm:ss" placeholder="璇烽�夋嫨鏃堕棿" + class="query-group-cust" v-decorator="['torqueDate', validatorRules.torqueDate]" style="width: 100%"></j-date> + </a-form-item> + </a-col> + + <a-col :span="12"> + <a-form-item label="鎵煩鍊�" :labelCol="labelCol" :wrapperCol="wrapperCol"> + <a-input-number :min="0" :disabled="disableSubmit" placeholder="璇疯緭鍏ユ壄鐭╁��" + v-decorator="['torqueValue', validatorRules.torqueValue]"/> + </a-form-item> + </a-col> + </a-row> + <a-row :gutter="24"> + <a-col :span="12"> + <a-form-item label="杩涚粰鍙傛暟" :labelCol="labelCol" :wrapperCol="wrapperCol"> + <a-input placeholder="璇疯緭鍏ヨ繘缁欏弬鏁�" v-decorator="['feedParameter', validatorRules.feedParameter]"></a-input> + </a-form-item> + </a-col> + </a-row> + <a-row :gutter="24"> + <a-form-item label="澶囨敞" :labelCol="labelColLong" :wrapperCol="wrapperColLong"> + <a-textarea :maxLength="20" :disabled="disableSubmit" v-decorator="['notes', validatorRules.notes]" placeholder="璇疯緭鍏ュ娉�" ></a-textarea> + </a-form-item> + </a-row> + </a-form> + </a-spin> + <!--<device-repair-list-model ref="deviceRepairListModel" @sendSelectionRows="getDeviceRows"></device-repair-list-model>--> + <!--<device-repair-edit-list-model ref="deviceRepairListModel" @sendSelectionRows="getDeviceRows"></device-repair-edit-list-model>--> + </a-modal> +</template> + +<script> + import moment from 'moment' + import pick from 'lodash.pick' + // import DeviceRepairListModel from './DeviceRepairListModel' + // import DeviceRepairEditListModel from './DeviceRepairEditListModel' + // import JDate from './JDate' + import { + getAction, + postAction, + requestPut + } from '@/api/manage' + import { + duplicateCheck + } from '@/api/api' + + export default { + name: 'TorqueconfigurationModalEdit', + // components: {DeviceRepairListModel,JDate,DeviceRepairEditListModel}, + props: {}, + data() { + return { + readOnly:true, + title: '', + visible: false, + show: false, + model: {}, + checked: false, + startData:"", + endData:"", + labelCol: { + xs: { + span: 24 + }, + sm: { + span: 6 + } + }, + wrapperCol: { + xs: { + span: 24 + }, + sm: { + span: 18 + } + }, + labelColLong: { + xs: { + span: 24 + }, + sm: { + span: 3 + } + }, + wrapperColLong: { + xs: { + span: 24 + }, + sm: { + span: 21 + } + }, + confirmLoading: false, + form: this.$form.createForm(this), + validatorRules: { + equipmentId:{ + rules:[ + { + required:true, + message: "" + }, + ], + }, + equipmentName:{ + rules:[ + { + required:true, + message: "" + }, + ], + }, + torqueDate:{ + rules:[ + { + required:true, + message: "璇烽�夋嫨鏃堕棿" + }, + ], + }, + torqueValue:{ + rules:[ + { + required:true, + message: "璇疯緭鍏ユ壄鐭╁��" + }, + ], + }, + feedParameter:{ + rules:[ + { + required:true, + message:'璇疯緭鍏ヨ繘缁欏弬鏁�' + } + ] + } + // mdcRepairType:{ + // rules:[ + // { + // required:true, + // message: "" + // }, + // ], + // initialValue: '浼戠彮' + // } + }, + + url: { + add: '/mdc/mdcEquipmentRepair/add', + edit: '/mdc/MdcTorqueConfig/editMdcTorqueConfig' + }, + + disableSubmit: true, + partCategoryCascade: [], + cascadeDefaultValue: [], + editStart:'' + } + }, + created() { + }, + + methods: { + disabledDate(current){ + //Can not slect days before today and today + // return current && current < moment().endOf("day"); + return current < moment().subtract(+1, 'day')//浠婂ぉ涔嬪墠鐨勫勾鏈堟棩涓嶅彲閫夛紝涓嶅寘鎷粖澶� + }, + moment, + // onChange(dates) { + // console.log(111) + // console.log(dates,dateStrings) + // // console.log('From: ', dates[0], ', to: ', dates[1]); + // // console.log('From: ', dateStrings[0], ', to: ', dateStrings[1]); + // // this.startTime = dateStrings[0]; + // // this.endData = dateStrings[1]; + // // console.log(this.startData,this.endData); + // }, + onChangeEnd(dates, dateStrings){ + this.endTime = dateStrings[0]; + }, + getDeviceRows(val) { + this.form.setFieldsValue({ + equipmentId: val.equipmentId, + equipmentName: val.equipmentName, + // // equipmentModel: val.equipmentModel, + // // equipmentIp: val.equipmentIp, + // // dataPort: val.dataPort, + // // driveType: val.driveType + }) + // var equipmentIds; + // for(var i = 0;i<val.length;i++){ + // if (i == 0) { + // equipmentIds = val[i].equipmentId; + // } else { + // equipmentIds = equipmentIds + "," + val[i].equipmentId; + // } + // } + // console.log("========",equipmentIds); + // this.form.setFieldsValue({ + // equipmentId: equipmentIds, + // }) + }, + deviceSearch() { + this.$refs.deviceRepairListModel.openPage() + this.$refs.deviceRepairListModel.title = '閫夋嫨璁惧' + this.$refs.deviceRepairListModel.disableSubmit = false + }, + //绾ц仈妗唎nChange浜嬩欢 + // onChange(value) { + // + // }, + getParentIdsById(id) { + let that = this + getAction(this.url.getParentIdsById, { + id: id + }).then((res) => { + if (res.success) { + that.form.setFieldsValue({ + partCategoryId: res.result + }) + } + }) + }, + add(node) { + let _this = this + this.visible = true + this.form.resetFields() + this.model = {} + this.$nextTick(() => { + // _this.form.setFieldsValue({ 'tierType': node.entity.tierType + 1, 'parentName': node.title }) + // _this.model.parentId = node.key + }) + }, + edit(record) { + this.form.resetFields() + this.model = Object.assign({}, record) + // this.editStart = (this.model.startTime).replace(/:/g,''); + this.visible = true + this.$nextTick(() => { + this.form.setFieldsValue(pick(this.model,'equipmentId', 'equipmentName','torqueDate', 'torqueValue','feedParameter','notes' + )) + }) + }, + close() { + this.$emit('close') + this.visible = false + this.show = false + }, + handleOk() { + const that = this + // 瑙﹀彂琛ㄥ崟楠岃瘉 + this.form.validateFields((err, values) => { + if (!err) { + that.confirmLoading = true + let formData = Object.assign(this.model, values) + let obj + if (!this.model.id) { + obj = postAction(this.url.add, formData) + } else { + obj = requestPut(this.url.edit, formData, { + id: this.model.id + }) + } + obj.then((res) => { + if (res.success) { + // that.$message.success("淇敼鎴愬姛") + that.$notification.success({ + message:'娑堟伅', + description:"淇敼鎴愬姛" + }); + // that.$message.success(res.message) + that.$emit('ok', res.result) + } else { + // that.$message.warning(res.message) + that.$notification.warning({ + message:'娑堟伅', + description:res.message + }); + } + }).finally(() => { + that.confirmLoading = false + that.close() + }) + } + }) + }, + handleCancel() { + this.close() + }, + // loadCascade() { + // getAction(this.url.loadCascadeData).then((res) => { + // if (res.success) { + // this.partCategoryCascade = res.result + // } + // }) + // }, + onCascadeChange(value, selectedOptions) { + this.cascadeDefaultValue = [...value] + }, + filter(inputValue, path) { + return path.some(option => option.label.toLowerCase().indexOf(inputValue.toLowerCase()) > -1) + }, + //楠岃瘉 缂栫爜 + validateNum(rule, value, callback) { + var params = { + tableName: 'lxmes_base_part', + fieldName: 'num', + fieldVal: value, + dataId: this.model.id, + //鏁版嵁搴撲腑瀛樺湪瀛楁del_flag骞朵娇鐢ㄨ瀛楁浣滀负鏈垹闄ょ瓥鐣ワ紝鐪熷垹闄わ細false 鍋囧垹闄わ細true + delFlag: 'true' + } + duplicateCheck(params).then((res) => { + if (res.success) { + callback() + } else { + callback('瀛樿揣缂栫爜宸插瓨鍦�!') + } + }) + }, + checkboxChange(e) { + this.checked = e.target.checked + } + } + } +</script> + +<style scoped lang="less"> + .ant-btn { + padding: 0 10px; + margin-left: 3px; + } + + .ant-form-item-control { + line-height: 0px; + } + + /** 涓昏〃鍗曡闂磋窛 */ + .ant-form .ant-form-item { + margin-bottom: 10px; + } + + /** Tab椤甸潰琛岄棿璺� */ + .ant-tabs-content .ant-form-item { + margin-bottom: 0px; + } + /deep/ .ant-input-number{ + width: 100%!important; + } +</style> diff --git a/src/views/mdc/base/modules/TorqueconfigurationList/TorqueconfigurationModalList.vue b/src/views/mdc/base/modules/TorqueconfigurationList/TorqueconfigurationModalList.vue new file mode 100644 index 0000000..3191785 --- /dev/null +++ b/src/views/mdc/base/modules/TorqueconfigurationList/TorqueconfigurationModalList.vue @@ -0,0 +1,340 @@ + +<template> + <a-modal :title="title" width="70%" :visible="visible" :maskClosable="false" @ok="handleOk" @cancel="handleCancel" + cancelText="鍏抽棴"> + <a-card :bordered="false"> + <!-- 鏌ヨ鍖哄煙 --> + <div class="table-page-search-wrapper"> + <a-form layout="inline" @keyup.enter.native="searchQuery"> + <a-row :gutter="24"> + <a-col :md="6" :sm="6" v-if="isDepartType == 0"> + <a-form-item label="閮ㄩ棬" v-if="isDepartType == 0"> + <!--<a-select v-model="queryParam.sectionPid" placeholder="璇烽�夋嫨閮ㄩ棬" :options="sectionPData" @change="initGroupOptions" />--> + <a-tree-select + v-model="value" + style="width: 100%" + :dropdown-style="{ maxHeight: '400px', overflow: 'auto' }" + :tree-data="treeData" + placeholder="璇烽�夋嫨閮ㄩ棬" + tree-default-expand-all + > + <!--<span v-if="key === '0-0-1'" slot="title" slot-scope="{ key, value }" style="color: #08c">--> + <!--Child Node1 {{ value }}--> + <!--</span>--> + </a-tree-select> + </a-form-item> + </a-col> + + <a-col :md="6" :sm="6"> + <a-form-item label="杞﹂棿" > + <!--<a-select v-model="queryParam.sectionId" placeholder="璇烽�夋嫨鍥㈤槦" :options="sectionData"/>--> + <a-tree-select + v-model="valueProduct" + style="width: 100%" + :dropdown-style="{ maxHeight: '400px', overflow: 'auto' }" + :tree-data="sectionData" + placeholder="璇烽�夋嫨杞﹂棿" + tree-default-expand-all + > + <!--<span v-if="key === '0-0-1'" slot="title" slot-scope="{ key, value }" style="color: #08c">--> + <!--Child Node1 {{ value }}--> + <!--</span>--> + </a-tree-select> + </a-form-item> + </a-col> + + <a-col :md="6" :sm="6"> + <a-form-item label="缁熶竴缂栫爜"> + <a-input placeholder="璇疯緭鍏ョ粺涓�缂栫爜妫�绱�" v-model="queryParam.equipmentId"></a-input> + </a-form-item> + </a-col> + + <a-col :md="6" :sm="6"> + <a-form-item label="璁惧鍚嶇О"> + <a-input placeholder="璇疯緭鍏ヨ澶囧悕绉版绱�" v-model="queryParam.equipmentName"></a-input> + </a-form-item> + </a-col> + </a-row> + </a-form> + </div> + <!-- 鎿嶄綔鎸夐挳鍖哄煙 --> + <div class="table-operator"> + <a-button type="primary" @click="searchQuery" icon="search">鏌ヨ</a-button> + <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">閲嶇疆</a-button> + </div> + <!-- table鍖哄煙-begin --> + <div> + <a-table ref="table" size="middle" bordered rowKey="id" :scroll="{聽 y: 400聽}" :columns="columns" + :dataSource="dataSource" :pagination="ipagination" :loading="loading" + :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}" + @change="handleTableChange"> + </a-table> + </div> + <!-- table鍖哄煙-end --> + </a-card> + </a-modal> +</template> + +<script> + import {mapActions} from 'vuex' + import { + ajaxGetSelectItems + } from '@/api/api' + import JDictSelectTag from '@/components/dict/JDictSelectTag' + import { + deleteAction, + requestPut, + getAction, + postAction + } from '@/api/manage' + import { + JeecgListMixin + } from '@/mixins/JeecgListMixin' + import JInput from '@/components/jeecg/JInput' + import JEllipsis from '@/components/jeecg/JEllipsis' + import Tooltip from 'ant-design-vue/es/tooltip' + import JDate from '@/components/jeecg/JDate' + import moment from 'moment' + + export default { + name: 'DeviceCalendarListModel', + mixins: [JeecgListMixin], + components: { + JDictSelectTag, + JEllipsis, + JInput, + Tooltip, + JDate + }, + props: { + status: { + type: Number, + default: 1 + } + }, + data() { + return { + isDepartType:'', + /*readOnly:true,*/ + title:'', + visible: false, + SelectedList:[], + treeData:[], + /*disableMixinCreated: true, + queryParam: {},*/ + columns: [ + { + title: '#', + dataIndex: '', + key: 'rowIndex', + width: 60, + align: "center", + customRender: function (t, r, index) { + return parseInt(index) + 1; + } + },{ + + title: '缁熶竴缂栫爜', + align: 'center', + dataIndex: 'equipmentId', + }, + { + title: '璁惧鍚嶇О', + align: 'center', + dataIndex: 'equipmentName', + }, + { + title: '椹卞姩绫诲瀷', + align: 'center', + dataIndex: 'driveType' + }, + { + title: '鏁版帶绯荤粺', + align: 'center', + dataIndex: 'controlSystem' + }, + ], + sectionPData: [], + sectionData: [], + url: { + list: '/mdc/mdcEquipment/findEquipmentList', + loadOptions: '/sys/sysDepart/loadDepartTreeOptions', + loadProductionOptions:'/mdc/mdcProduction/loadProductionTreeOptions' + }, + value:undefined, + valueProduct:undefined + } + }, + created() { + this.queryTreeData() + }, + watch: { + value(value) { + // console.log(value); + this.queryParam.departId = value + }, + valueProduct(value){ + this.queryParam.productionId = value + } + }, + methods: { + ...mapActions(['QueryDepartTree']), + queryTreeData() { + this.QueryDepartTree().then(res => { + if (res.success) { + this.isDepartType = res.result[0].value + } else { + // this.$message.warn(res.message) + this.$notification.warning({ + message:'娑堟伅', + description:res.message + }); + } + }).finally(() =>{ + }) + }, + onSelectChange(selectedRowKeys, selectionRows) { + // this.SelectedList.push(selectedRowKeys); + this.selectedRowKeys = selectedRowKeys; + this.selectionRows = selectionRows + // this.SelectedList =[...this.SelectedList,...selectionRows]; + // console.log(this.SelectedList); + }, + handleTableChange(pagination, filters, sorter) { + // this.onClearSelected() + //鍒嗛〉銆佹帓搴忋�佺瓫閫夊彉鍖栨椂瑙﹀彂 + //TODO 绛涢�� + if (Object.keys(sorter).length > 0) { + this.isorter.column = sorter.field; + this.isorter.order = "ascend" == sorter.order ? "asc" : "desc" + } + this.ipagination = pagination; + this.loadData(); + }, + openPage() { + this.visible = true + this.onClearSelected() + this.dataSource = []; + this.queryParam = { + status: this.status + }; + + this.loadData(); + this.initOptions(); + this.initGroupOptions() + }, + loadData(arg) { + if(!this.url.list){ + this.$message.error("璇疯缃畊rl.list灞炴��!") + return + } + //鍔犺浇鏁版嵁 鑻ヤ紶鍏ュ弬鏁�1鍒欏姞杞界涓�椤电殑鍐呭 + if (arg === 1) { + this.ipagination.current = 1; + } + var params = this.getQueryParams();//鏌ヨ鏉′欢 + + if(!params){ + return false; + } + + this.loading = true; + getAction(this.url.list, params).then((res) => { + if (res.success) { + // console.log(res) + //update-begin---author:zhangyafei Date:20201118 for锛氶�傞厤涓嶅垎椤电殑鏁版嵁鍒楄〃------------ + this.dataSource = res.result.records||res.result; + if(res.result.total) + { + this.ipagination.total = res.result.total; + }else{ + this.ipagination.total = 0; + } + //update-end---author:zhangyafei Date:20201118 for锛氶�傞厤涓嶅垎椤电殑鏁版嵁鍒楄〃------------ + }else{ + // this.$message.warning(res.message) + this.$notification.warning({ + message:'娑堟伅', + description:res.message + }); + } + }).finally(() => { + this.loading = false + }) + }, + modalFormOk(val) { + // 鏂板/淇敼 鎴愬姛鏃讹紝閲嶈浇鍒楄〃 + this.loadData(); + + this.selectedRowKeys = [val.id]; + }, + searchQuery() { + this.loadData(); + this.onClearSelected() + }, + searchReset() { + this.queryParam = { + status: 1 + }; + this.loadData(); + this.onClearSelected() + }, + close() { + this.$emit('close') + this.visible = false + }, + handleCancel() { + this.close() + }, + handleOk() { + // this.selectionRows = this.SelectedList; + // console.log(this.selectionRows); + this.$emit('sendSelectionRows', this.selectionRows) + this.close() + }, + initOptions() { + getAction(this.url.loadOptions).then(res => { + if (res.success) { + this.treeData = res.result + } else { + // this.$message.warning(res.message) + this.$notification.warning({ + message:'娑堟伅', + description:res.message + }); + } + }) + }, + + + initGroupOptions() { + getAction(this.url.loadProductionOptions).then(res => { + if (res.success) { + this.sectionData = res.result + } else { + // this.$message.warning(res.message) + this.$notification.warning({ + message:'娑堟伅', + description:res.message + }); + } + }) + } + }, + } +</script> +<style> + @import '~@assets/less/common.less'; + + .frozenRowClass { + color: #c9c9c9; + } + + .success { + color: green; + } + + .error { + color: red; + } +</style> diff --git a/src/views/mdc/base/modules/alarmAnalysis/alarmAnalysisMain.vue b/src/views/mdc/base/modules/alarmAnalysis/alarmAnalysisMain.vue new file mode 100644 index 0000000..8ee1144 --- /dev/null +++ b/src/views/mdc/base/modules/alarmAnalysis/alarmAnalysisMain.vue @@ -0,0 +1,543 @@ +<template> + <div class="efficiency_list" style="width: 100%;height: 100%;"> + <div :bordered="false" style="height: 100%"> + <!-- 鏌ヨ鍖哄煙 --> + <div class="table-page-search-wrapper"> + <a-form layout="inline" @keyup.enter.native="searchQuery"> + <a-row :gutter="24"> + <a-col :md="7" :sm="7"> + <a-form-item label="鏃堕棿"> + <a-range-picker @change="dateParamChange" :disabledDate="disabledDate" format="YYYYMMDD" + v-model="dates" :allowClear="false"/> + </a-form-item> + </a-col> + <a-col :lg="2" :md="2" :sm="2" :xs="2"> + <a-button type="primary" @click="searchQuery" icon="search">鏌ヨ</a-button> + </a-col> + </a-row> + </a-form> + </div> + <div id="DeviceList"> + <div class="openRateTrendDg"> + <a-table :columns="columns" :data-source="dataList" bordered :pagination="false" :scroll="{y:210}" + :customRow="customRow" + rowKey="alarmCode" @expand="handleExpandChange" :loading="outerDataLoading" + > + <span slot="timeCount" slot-scope="text">{{text | getFormattedTime}}</span> + <a-table + slot="expandedRowRender" + slot-scope="row" + :columns="innerColumns" + :data-source="row.innerDataList" + :pagination="false" + rowKey="rowIndex" + :loading="innerDataLoading" + > + <span slot="duration" slot-scope="text">{{text | getFormattedTime}}</span> + </a-table> + </a-table> + </div> + + <a-spin :spinning="echartLoading"> + <div style="width: 100%;height: 100%;display: flex;"> + <div id="MdcEquipmentWarningPie" style="height: 100%;width: 35%;"></div> + <div id="MdcEquipmentWarningLine" style="height: 100%;width: 65%;"></div> + </div> + </a-spin> + </div> + </div> + </div> +</template> + +<script> + import moment from 'moment' + import { putAction, getAction } from '@/api/manage' + import $ from 'jquery' + import '@/components/table2excel/table2excel' + import { ajaxGetDictItems, getDictItemsFromCache, duplicateCheck } from '@/api/api' + import { + JeecgListMixin + } from '@/mixins/JeecgListMixin' + + const columns = [ + { title: '鎶ヨ鍙�', dataIndex: 'alarmCode', key: 'alarmCode', align: 'center' }, + { title: '鍑虹幇娆℃暟', dataIndex: 'count', key: 'count', align: 'center', sorter: (a, b) => b.count - a.count }, + { + title: '鍚堣鎸佺画鏃堕棿', + dataIndex: 'timeCount', + key: 'timeCount', + scopedSlots: { customRender: 'timeCount' }, + align: 'center', + sorter: (a, b) => b.timeCount - a.timeCount + }, + { title: '鎶ヨ淇℃伅', dataIndex: 'alarmContent', key: 'alarmContent', align: 'center', ellipsis: true } + ] + + const innerColumns = [ + { + title: '', + dataIndex: 'rowIndex', + key: 'rowIndex', + width: 60, + align: 'center', + customRender: function(t, r, index) { + return parseInt(index) + 1 + } + }, + { title: '璁惧缂栧彿', dataIndex: 'equipmentId', key: 'equipmentId', align: 'center' }, + { title: '璁惧鍚嶇О', dataIndex: 'equipmentName', key: 'equipmentName', align: 'center' }, + { title: '鎶ヨ鏃堕棿', dataIndex: 'startTime', key: 'startTime', align: 'center' }, + { title: '缁撴潫鏃堕棿', dataIndex: 'endTime', key: 'endTime', align: 'center' }, + { + title: '鎸佺画鏃堕棿', + dataIndex: 'duration', + key: 'duration', + scopedSlots: { customRender: 'duration' }, + align: 'center' + } + ] + + export default { + // mixins: [JeecgListMixin], + name: 'alarmAnalysisMain', + components: {}, + data() { + return { + dataSource: [], + /* table鍔犺浇鐘舵�� */ + outerDataLoading: false, + innerDataLoading: false, + echartLoading: false, + typeTree: '', + typeParent: 1, + typeEquipment: 1, + TreeIDOne: 1, + TreeIDTwo: 2, + deviceTypeDict: '', + dates: [], + identifying: [], + queryParam: {}, + queryParams: {}, + queryParamEquip: {}, + queryParamPeople: {}, + efficiencyOptions: [ + { label: '鍒╃敤鐜�', value: 'lyl' }, + { label: '寮�鏈虹巼', value: 'kjl' }, + { label: '寮�鏈烘椂闂�', value: 'kjsj' }, + { label: '鍔犲伐鏃堕棿', value: 'jgsj' }, + { label: '寰呮満鏃堕棿', value: 'djsj' }, + { label: '鍏虫満鏃堕棿', value: 'gjsj' } + ], + checkedList: ['lyl'], + dataList: [], + url: { + efficiencyList: '/mdc/alarmAnalyze/alarmList', + listByType: '/mdc/MdcUtilizationRate/getByType', + alarmTrend: '/mdc/alarmAnalyze/alarmTrend', + equipmentAlarmList: '/mdc/alarmAnalyze/equipmentAlarmList' + }, + tableHeads: [], + pieDate: [0], + XData: [0], + YData: [0], + columns, + innerColumns, + hasRequsetAlarmCodeList: [] + } + }, + props: { nodeTree: '', Type: '', nodePeople: '' }, + /** + * 鐢熷懡鍛ㄦ湡 鎸傝浇鍓� + * */ + created() { + this.dates = [moment().subtract('days', 8), moment().subtract('days', 1)] + this.queryParam.startDate = moment(this.dates[0]).format('YYYYMMDD') + this.queryParam.endDate = moment(this.dates[1]).format('YYYYMMDD') + this.queryParam.typeTree = '1' + this.loadData1() + + }, + mounted() { + this.drawWrin() + window.addEventListener('resize', this.handleWindowResize) + }, + beforeDestroy() { + window.removeEventListener('resize', this.handleWindowResize) + }, + watch: { + Type(valmath) { + this.dataList = [] + this.queryParam.typeTree = valmath + }, + nodeTree(val) { //鐩戝惉currSelected 鍙樺寲锛屽皢鍙樺寲鍚庣殑鏁板�间紶閫掔粰 getCurrSelected 浜嬩欢 + if (JSON.stringify(val) != '{}') { + if (val.equipmentId != null) { + this.queryParamEquip.parentId = '' + this.queryParamEquip.equipmentId = val.equipmentId + } else { + this.queryParamEquip.parentId = val.key + this.queryParamEquip.equipmentId = '' + } + /*杩欓噷浣犳槸鐩戝惉鍒版爲寰楀彉鍖� 鏄笉鏄姹備竴娆�*/ + this.searchQuery() + } + }, + nodePeople(val) { + if (JSON.stringify(val) != '{}') { + if (val.equipmentId != null) { + this.queryParamPeople.parentId = val.equipmentId + this.queryParamPeople.equipmentId = '' + } else { + this.queryParamPeople.parentId = val.key + this.queryParamPeople.equipmentId = '' + } + this.searchQuery() + } + } + }, + filters: { + numFilter(value) { + if (value) { + return parseFloat((value * 100).toFixed(2)) + } else { + return '0' + } + }, + + /** + * 鏍煎紡鍖栨椂闂� + * @param seconds 绉掓暟 + * @returns '' 鏍煎紡鍖栧悗鏃堕棿瀛楃涓� + */ + getFormattedTime(seconds) { + var hours = Math.floor(seconds / 3600) + var minutes = Math.floor((seconds % 3600) / 60) + var secs = seconds % 60 + + if (hours === 0) { + if (minutes === 0) { + return secs === 0 ? 0 : `${secs}绉抈 + } else { + if (secs === 0) { + return `${minutes}鍒哷 + } + return `${minutes}鍒� ${secs}绉抈 + } + } else { + if (minutes === 0 && secs === 0) { + return `${hours}灏忔椂` + } else if (minutes !== 0 && secs === 0) { + return `${hours}灏忔椂 ${minutes}鍒哷 + } + } + return `${hours}灏忔椂 ${minutes}鍒� ${secs}绉抈 + } + }, + methods: { + numBerTwo(value) { + if (value) { + return parseFloat((value * 100).toFixed(2)) + } else { + return '0' + } + }, + TableDraw(key, val) { + let that = this + that.echartLoading = true + that.queryParam.alarmCode = val.alarmCode + console.log(this.queryParam) + getAction(that.url.alarmTrend, that.queryParam) + .then(res => { + if (res.success) { + that.pieDate = res.result.equipmentCountList.map(item => { + return { + name: item.key, + value: item.count + } + }) + that.XData = res.result.dateCountList.map(item => item.key) + that.YData = res.result.dateCountList.map(item => item.count) + + // this.tableHeads = res.result.dates + // this.dataList = res.result + // this.draw() + // this.checkSameData(this.dataList) + // this.checkSameData1(this.dataList) + // this.checkSameData2(this.dataList) + // this.combineCell(); + // this.initDeviceType(this.dataList) + that.drawWrin() + } + }) + .finally(() => { + that.echartLoading = false + }) + console.log(this.YData) + + }, + disabledDate(current) { + //Can not slect days before today and today + return current && current > moment().subtract('days', 1) + }, + initDeviceType(deviceList) { + let dictCode = 'mdc_equipmentType' + let items = [] + items = getDictItemsFromCache(dictCode) + if (deviceList && items.length > 0) { + for (let a = 0; a < deviceList.length; a++) { + if (items && items.length > 0) { + for (let i = 0; i < items.length; i++) { + if (deviceList[a].equipmentType == items[i].value) { + deviceList[a].equipmentType = items[i].title + } + } + } else { + ajaxGetDictItems(dictCode, null).then((res) => { + if (res.success) { + let items = res.result + for (let i = 0; i < items.length; i++) { + if (deviceList[a].equipmentType == items[i].value) { + deviceList[a].equipmentType = items[i].title + } + } + } + }) + } + } + } + }, + dateParamChange(v1, v2) { + this.queryParam.startDate = v2[0] + this.queryParam.endDate = v2[1] + }, + searchQuery() { + if (this.queryParam.typeTree == '1') { + this.queryParam.parentId = this.queryParamEquip.parentId + this.queryParam.equipmentId = this.queryParamEquip.equipmentId + } else { + this.queryParam.parentId = this.queryParamPeople.parentId + this.queryParam.equipmentId = '' + } + this.loadData1() + }, + loadData1() { + this.outerDataLoading = true + this.tableHeads = [] + this.dataList = [] + getAction(this.url.efficiencyList, this.queryParam).then(res => { + if (res.success) { + // this.tableHeads = res.result.dates + this.dataList = res.result + this.hasRequsetAlarmCodeList = [] + // this.draw() + // this.checkSameData(this.dataList) + // this.checkSameData1(this.dataList) + // this.checkSameData2(this.dataList) + // this.combineCell(); + // this.initDeviceType(this.dataList) + + } + }).finally(() => { + this.outerDataLoading = false + }) + }, + drawWrin() { + this.equipmentWarningPie = this.$echarts.init(document.getElementById('MdcEquipmentWarningPie'), 'macarons') + let equipmentWarningPieOption = { + title: { + text: '鍚勮澶囧嚭鐜版鎶ヨ鐨勬瘮渚�', + x: 'center', + y: 'bottom', + textStyle: { + color: '#4FAEDC' + } + }, + tooltip: { + trigger: 'item', + formatter: '<br/>{b} : {c} ({d}%)' + }, + calculable: true, + series: [{ + type: 'pie', + radius: '60%', + itemStyle: { + normal: { + color: function(params) { + var colorList = ['#5AB1EF', '#2EC7C9', '#B6A2DE', '#FFB980', '#D87A80', '#8D98B3'] + return colorList[params.dataIndex] + }, + label: { + show: true, + // position: 'top', + formatter: '{b}\n{c}', + color: function(params) { + var colorList = ['#5AB1EF', '#2EC7C9', '#B6A2DE', '#FFB980', '#D87A80', '#8D98B3'] + return colorList[params.dataIndex] + } + } + } + }, + data: this.pieDate + // data:[{name:'jjjjjjj',value:'2'}] + }] + } + this.equipmentWarningPie.setOption(equipmentWarningPieOption, true) + this.equipmentWarningLine = this.$echarts.init(document.getElementById('MdcEquipmentWarningLine'), 'macarons') + let equipmentWarningLineOption = { + title: { + text: '姣忓ぉ鍑虹幇姝ゆ姤璀︾殑鏁伴噺璧板娍', + x: 'center', + y: 'bottom', + textStyle: { + color: '#4FAEDC' + } + }, + tooltip: { + trigger: 'axis' + }, + calculable: true, + xAxis: [ + { + type: 'category', + show: true, + data: this.XData + /*axisLabel :{ + interval:0 + }*/, + axisLine: { + //x杞寸嚎鐨勯鑹蹭互鍙婂搴� + show: true, + lineStyle: { + width: 2, + color: '#4FAEDC' + } + } + } + ], + yAxis: [ + { + type: 'value', + name: '娆℃暟', + axisLine: { + //x杞寸嚎鐨勯鑹蹭互鍙婂搴� + show: true, + lineStyle: { + width: 2, + color: '#4FAEDC' + } + } + } + ], + series: [ + { + name: '鎶ヨ鏁伴噺', + type: 'line', + data: this.YData, + markPoint: { + data: [ + { type: 'max', name: '鏈�澶у��' }, + { type: 'min', name: '鏈�灏忓��' } + ], + label: { + color: '#fff' + } + }, + itemStyle: { + normal: { + color: '#2EC7C9' + } + } + } + ] + } + this.equipmentWarningLine.setOption(equipmentWarningLineOption, true) + }, + + /** + * 鑷畾涔夎〃鏍艰瑙﹀彂 + * @param record 褰撳墠琛屼俊鎭� + * @param index 褰撳墠琛屼笅鏍� + * @returns {{on: {click: on.click}}} 杩斿洖瀵硅薄 + */ + customRow(record, index) { + return { + on: { + click: (event) => { + // 濡傛灉鐐瑰嚮鐨勪笉鏄睍寮�鍥炬爣鍖哄煙鍒欐覆鏌撳浘琛紝鐩稿弽鍒欑浉褰撲簬鐐瑰嚮灞曞紑鍥炬爣 + if (event.target.className !== 'ant-table-row-expand-icon-cell') { + this.TableDraw(index, record) + } else { + if (event.target.children && event.target.children.length > 0) event.target.children[0].click() + } + } + } + } + }, + + /** + * 鑷畾涔夎〃鏍艰瑙﹀彂 + * @param expanded 褰撳墠琛屾槸鍚︿负灞曞紑鐘舵�� + * @param record 褰撳墠琛屼俊鎭� + */ + handleExpandChange(expanded, record) { + let _this = this + // 褰撳睍寮�鏃惰嫢璇ヨ鏈灞曞紑杩囨墠浼氳姹傚悗鍙版暟鎹紝灞曞紑杩囩殑鏁版嵁浼氳缂撳瓨鏃犻渶閲嶅璇锋眰 + this.queryParam.alarmCode = record.alarmCode + if (expanded && !this.hasRequsetAlarmCodeList.includes(record.alarmCode)) { + this.innerDataLoading = true + getAction(this.url.equipmentAlarmList, this.queryParam).then(res => { + if (res.success) { + _this.dataList.forEach(item => { + if (item.alarmCode === record.alarmCode) { + item.innerDataList = res.result + } + }) + _this.hasRequsetAlarmCodeList.push(record.alarmCode) + } + }) + .finally(() => { + _this.innerDataLoading = false + }) + } + }, + + /** + * 褰撴祻瑙堝櫒鍙绐楀彛灏哄鍙戠敓鏀瑰彉鏃惰Е鍙� + */ + handleWindowResize() { + if (this.equipmentWarningPie) this.equipmentWarningPie.resize() + if (this.equipmentWarningLine) this.equipmentWarningLine.resize() + } + } + } +</script> +<style scoped> + .efficiency_list #DeviceList { + height: 90% !important; + } + + /deep/ .ant-table-body .ant-table-row td { + padding-top: 10px; + padding-bottom: 10px; + } + + /deep/ .ant-table-scroll > .ant-table-body > table > .ant-table-tbody > .ant-table-row td { + cursor: pointer; + } + + /deep/ .ant-spin-nested-loading { + height: 55%; + } + + /deep/ .ant-spin-container { + height: 100%; + } + + /deep/ .ant-table.ant-table-bordered { + height: 265px; + } + + /deep/ .ant-table-scroll > .ant-table-placeholder { + height: 210px; + } +</style> \ No newline at end of file diff --git a/src/views/mdc/base/modules/efficiencyPOReport/EfficiencyPOList.vue b/src/views/mdc/base/modules/efficiencyPOReport/EfficiencyPOList.vue new file mode 100644 index 0000000..a280450 --- /dev/null +++ b/src/views/mdc/base/modules/efficiencyPOReport/EfficiencyPOList.vue @@ -0,0 +1,790 @@ +<template> + <div style="width: 100%;"> + <div :bordered="false"> + <!-- 鏌ヨ鍖哄煙 --> + <div class="table-page-search-wrapper"> + <a-form layout="inline" @keyup.enter.native="searchQuery"> + <a-row :gutter="24"> + <a-col :md="5" :sm="5"> + <a-form-item label="璁惧绫诲瀷"> + <a-select + :value="queryParams.equipmentType" + mode="multiple" + placeholder="璇烽�夋嫨璁惧绫诲瀷" + allow-clear + :maxTagCount="1" + @change="selectChange($event,'equipmentType')" + > + <a-select-option v-for="(item,index) in equipmentTypeList" :value="item.value" :key="index"> + {{item.label}} + </a-select-option> + </a-select> + </a-form-item> + </a-col> + <a-col :md="6" :sm="6"> + <a-form-item label="椹卞姩绫诲瀷"> + <a-select + :value="queryParams.driveType" + mode="multiple" + placeholder="璇烽�夋嫨椹卞姩绫诲瀷" + allow-clear + :maxTagCount="1" + @change="selectChange($event,'driveType')" + > + <a-select-option v-for="(item,index) in driveTypeList" :value="item.value" :key="index"> + {{item.label}} + </a-select-option> + </a-select> + </a-form-item> + </a-col> + <a-col :md="6" :sm="6"> + <a-form-item label="鏃堕棿"> + <a-range-picker @change="dateParamChange" :disabledDate="disabledDate" format="YYYYMMDD" v-model="dates" + :allowClear="false"/> + </a-form-item> + </a-col> +<!-- <a-col :md="5" :sm="5" :xs="5">--> +<!-- <a-form-item label="璁惧绉嶇被">--> +<!-- <a-select--> +<!-- :value="queryParams.deviceCategory"--> +<!-- mode="multiple"--> +<!-- placeholder="璇烽�夋嫨璁惧绉嶇被"--> +<!-- allow-clear--> +<!-- :maxTagCount="1"--> +<!-- @change="selectChange($event,'deviceCategory')"--> +<!-- >--> +<!-- <a-select-option v-for="(item,index) in device_category_list" :value="item.value" :key="index">--> +<!-- {{item.label}}--> +<!-- </a-select-option>--> +<!-- </a-select>--> +<!-- </a-form-item>--> +<!-- </a-col>--> + <a-col :md="5" :sm="5" :xs="5"> + <a-form-item label="璁惧绾у埆"> + <a-select + :value="queryParams.deviceLevel" + mode="multiple" + placeholder="璇烽�夋嫨璁惧绾у埆" + allow-clear + :maxTagCount="1" + @change="selectChange($event,'deviceLevel')" + > + <a-select-option v-for="(item,index) in device_level_list" :value="item.value" :key="index"> + {{item.label}} + </a-select-option> + </a-select> + </a-form-item> + </a-col> + <a-col :md="2" :sm="2"> + <a + @click="toggleSearchStatus=!toggleSearchStatus" + @selectstart="$event.preventDefault()" + style="display: inline-block;height: 32px;line-height: 32px" + > + {{ toggleSearchStatus ? '鏀惰捣' : '灞曞紑' }} + <a-icon :type="toggleSearchStatus ? 'up' : 'down'"/> + </a> + </a-col> + </a-row> + + <a-row :gutter="24" v-if="toggleSearchStatus"> + + <a-col :md="5" :sm="5" :xs="5"> + <a-form-item label="閲嶈绋嬪害"> + <a-select + :value="queryParams.deviceImportanceLevel" + mode="multiple" + placeholder="璇烽�夋嫨璁惧閲嶈绋嬪害" + allow-clear + :maxTagCount="1" + @change="selectChange($event,'deviceImportanceLevel')" + > + <a-select-option v-for="(item,index) in device_importance_level_list" :value="item.value" + :key="index"> + {{item.label}} + </a-select-option> + </a-select> + </a-form-item> + </a-col> + </a-row> + + <a-row :gutter="24" type="flex" align="middle"> + <a-col :md="24" :sm="24" :xs="24" + style="display: flex;justify-content: space-between;align-items: flex-start"> + <div> + <a-space style="margin-right: 20px"> + <a-button type="primary" @click="searchQuery" icon="search">鏌ヨ</a-button> + <a-button type="primary" @click="searchReset" icon="reload">閲嶇疆</a-button> + <a-button type="primary" @click="exportExcel" icon="download">瀵煎嚭</a-button> + <a-button type="primary" icon="printer" v-print="'#EfficiencyPO'" + v-has="'EfficiencyPO:print'">鎵撳嵃 + </a-button> + </a-space> + <a-checkbox-group :value="checkedList" :default-value="['lyl']" :options="efficiencyOptions" + @change="efficiencyOptionsOnChange"/> + </div> + <table cellpadding="5" cellspacing="1" style="border: 1px solid darkgray;"> + <tr> + <td v-for="(item, index) in identifying">{{item.title}}</td> + </tr> + <tr> + <td style="text-align:center;" v-for="(item, index) in identifying"> + <div class="identifyingclass" :style="{background: item.color}"></div> + </td> + </tr> + </table> + </a-col> + </a-row> + </a-form> + </div> + + <a-spin :spinning="spinning"> + <div class="container" id="EfficiencyPO" style="margin-top: 20px;"> + <div class="table2"> + <table class="dataContent table" border="1" cellspacing="0" cellpadding="0" style="white-space: nowrap" + v-if="dataList.length>0"> + <thead> + <tr class="thead fixed equipname"> + <th class="thgu dong1 name" rowspan="2" + style="min-width: 50px; max-width: 50px;width: 50px;height: 66px">鍏徃 + </th> + <th class="thgu dong2 name" rowspan="2" style="min-width: 50px; max-width: 50px;width: 50px;">杞﹂棿</th> + <th class="thgu dong3 name" rowspan="2" style="min-width: 50px; max-width: 50px;width: 50px;">宸ユ</th> + <th class="thgu dong4 name" rowspan="2" style="min-width: 100px; max-width: 100px;width: 100px;">璁惧缂栧彿 + </th> + <th class="thgu dong5 name" rowspan="2" style="min-width: 162px; max-width: 162px;width: 162px;">璁惧鍚嶇О + </th> + <th class="thgu dong6 name" rowspan="2" style="min-width: 100px; max-width: 100px;width: 100px;">璁惧绫诲瀷 + </th> + <th class="thgu dong7 name" rowspan="2" style="min-width: 120px; max-width: 120px;width: 120px;">璁惧鍨嬪彿 + </th> + <!--<th rowspan="2">缁勫埆</th>--> + <template v-for="(tableHead, index) in tableHeads"> + <th class="timeth" :colspan="checkedList.length">{{tableHead}}</th> + </template> + </tr> + <tr class="thead notfixed gudingth"> + <template v-for="(tableHead, index) in tableHeads"> + <th v-if="checkedList.indexOf('lyl') > -1">寮�鍔ㄧ巼(%)</th> + <th v-if="checkedList.indexOf('kjl') > -1">寮�鏈虹巼(%)</th> + <th v-if="checkedList.indexOf('kjsj') > -1">寮�鏈烘椂闂�(灏忔椂)</th> + <th v-if="checkedList.indexOf('jgsj') > -1">鍔犲伐鏃堕棿(灏忔椂)</th> + <th v-if="checkedList.indexOf('djsj') > -1">寰呮満鏃堕棿(灏忔椂)</th> + <th v-if="checkedList.indexOf('gjsj') > -1">鍏虫満鏃堕棿(灏忔椂)</th> + </template> + </tr> + </thead> + <tbody> + <tr class="mathData" v-for="(item, index) in dataList"> + <template v-if="item.level1!=='鍚堣'&&item.level1!=='骞冲潎鍊�'"> + <td class="tdgu kaitou" :rowspan="item.level1span" + :class="{hidden: item.level1dis,noExl:item.level1dis}" v-show="!item.level1dis"> + <div class="wenzi"> + {{item.level1}} + </div> + </td> + <td class="tdgu1 kaitou" :rowspan="item.level2span" + :class="{hidden: item.level2dis,noExl:item.level2dis}" v-show="!item.level2dis"> + <div class="wenzi"> + {{item.level2}} + </div> + </td> + <td class="tdgu2 kaitou" :rowspan="item.level3span" + :class="{hidden: item.level3dis,noExl:item.level3dis}" v-show="!item.level3dis"> + <div class="wenzi"> + {{item.level3}} + </div> + </td> + <td class="tdgu3 kaitou">{{item.equipmentId}}</td> + <td style="min-width: 162px; max-width: 162px;width: 162px;" class="tdgu4 kaitou"> + {{item.equipmentName}} + </td> + <td class="tdgu5 kaitou">{{item.equipmentType}}</td> + <td class="tdgu6 kaitou">{{item.equipmentModel}}</td> + </template> + + <template v-else> + <td colspan="7" class="tdgu kaitou">{{item.level1}}</td> + </template> + <template v-for="(tableHead, index) in item.dataList"> + <td :style="{background:tableHead.color }" v-if="checkedList.indexOf('lyl') > -1"> + {{tableHead.startRate | numFilter}} + </td> + <td :style="{background:tableHead.color }" v-if="checkedList.indexOf('kjl') > -1"> + {{tableHead.openRate | numFilter}} + </td> + <td :style="{background:tableHead.color }" v-if="checkedList.indexOf('kjsj') > -1"> + {{tableHead.openLong | getFormattedTime}} + </td> + <td :style="{background:tableHead.color }" v-if="checkedList.indexOf('jgsj') > -1"> + {{tableHead.processLong | getFormattedTime}} + </td> + <td :style="{background:tableHead.color }" v-if="checkedList.indexOf('djsj') > -1"> + {{tableHead.waitLong | getFormattedTime}} + </td> + <td :style="{background:tableHead.color }" v-if="checkedList.indexOf('gjsj') > -1"> + {{tableHead.closeLong | getFormattedTime}} + </td> + </template> + </tr> + </tbody> + </table> + </div> + </div> + </a-spin> + </div> + </div> +</template> + +<script> + import moment from 'moment' + import { putAction, getAction } from '@/api/manage' + import $ from 'jquery' + import '@/components/table2excel/table2excel' + import { ajaxGetDictItems, getDictItemsFromCache, duplicateCheck } from '@/api/api' + import api from '@/api/mdc' + + export default { + name: 'EfficiencyPOList', + components: {}, + data() { + return { + typeTree: '', + typeParent: 1, + typeEquipment: 1, + dates: [], + equipmentTypeList: [], + driveTypeList: [], + device_level_list: [], + device_category_list: [], + queryParam: {}, + queryParams: { + equipmentType: [], + driveType: [], + deviceLevel: [], + deviceCategory: [], + deviceImportanceLevel: [] + }, + queryParamEquip: {}, + queryParamPeople: {}, + identifying: [], + efficiencyOptions: [ + { label: '寮�鍔ㄧ巼', value: 'lyl' }, + { label: '寮�鏈虹巼', value: 'kjl' }, + { label: '寮�鏈烘椂闂�', value: 'kjsj' }, + { label: '鍔犲伐鏃堕棿', value: 'jgsj' }, + { label: '寰呮満鏃堕棿', value: 'djsj' }, + { label: '鍏虫満鏃堕棿', value: 'gjsj' } + ], + checkedList: ['lyl'], + dataList: [], + url: { + list: '/mdc/efficiencyReport/efficiencyPOList', + listByType: '/mdc/MdcUtilizationRate/getByType', + queryEquipmentType: '/mdc/mdcEquipmentType/queryEquipmentType' + }, + tableHeads: [], + spinning: false, + toggleSearchStatus: false + } + }, + props: { nodeTree: '', Type: '', nodePeople: '' }, + created() { + this.showIdentifying() + this.dates = [moment().subtract('days', 8), moment().subtract('days', 1)] + this.queryParam.startTime = moment(this.dates[0]).format('YYYYMMDD') + this.queryParam.endTime = moment(this.dates[1]).format('YYYYMMDD') + this.queryParam.typeTree = '1' + this.loadData() + this.queryGroup() + this.getDriveTypeByApi() + this.initDictData('device_level') + this.initDictData('device_category') + this.initDictData('device_importance_level') + }, + mounted() { + window.addEventListener('resize', this.handleWindowResize) + this.handleWindowResize() + }, + watch: { + Type(valmath) { + this.dataList = [] + this.queryParam.typeTree = valmath + }, + nodeTree(val) { //鐩戝惉currSelected 鍙樺寲锛屽皢鍙樺寲鍚庣殑鏁板�间紶閫掔粰 getCurrSelected 浜嬩欢 + if (JSON.stringify(val) != '{}') { + if (val.equipmentId != null) { + this.queryParamEquip.parentId = '' + this.queryParamEquip.equipmentId = val.equipmentId + } else { + this.queryParamEquip.parentId = val.key + this.queryParamEquip.equipmentId = '' + } + this.searchQuery() + } + }, + nodePeople(val) { + if (JSON.stringify(val) != '{}') { + if (val.equipmentId != null) { + this.queryParamPeople.parentId = val.equipmentId + this.queryParamPeople.equipmentId = '' + } else { + this.queryParamPeople.parentId = val.key + this.queryParamPeople.equipmentId = '' + } + this.searchQuery() + } + } + }, + filters: { + numFilter(value) { + if (value) { + return parseFloat((value * 100).toFixed(2)) + } else { + return '0' + } + }, + + /** + * 鏍煎紡鍖栨椂闂� + * @param seconds 绉掓暟 + * @returns '' 鏍煎紡鍖栧悗鏃堕棿瀛楃涓� + */ + getFormattedTime(seconds) { + if (seconds) { + return parseFloat((seconds / 3600).toFixed(2)) + } else { + return '0' + } + } + }, + methods: { + initDictData(dictCode) { + // //浼樺厛浠庣紦瀛樹腑璇诲彇瀛楀吀閰嶇疆 + if (getDictItemsFromCache(dictCode)) { + this[dictCode + '_list'] = getDictItemsFromCache(dictCode) + return + } + //鏍规嵁瀛楀吀Code, 鍒濆鍖栧瓧鍏告暟缁� + ajaxGetDictItems(dictCode, null).then((res) => { + if (res.success) { + this[dictCode + '_list'] = res.result + return + } + }) + }, + selectChange(value, key) { + this.queryParams[key] = value + }, + checkSameData(dataList) { + let cache = {} //瀛樺偍鐨勬槸閿槸kclx 鐨勫�硷紝鍊兼槸kclx 鍦╥ndeces涓暟缁勭殑涓嬫爣 + let indices = [] //鏁扮粍涓瘡涓�涓�兼槸涓�涓暟缁勶紝鏁扮粍涓殑姣忎竴涓厓绱犳槸鍘熸暟缁勪腑鐩稿悓kclx鐨勪笅鏍� + dataList.map((item, index) => { + let level1 = item.level1 + let _index = cache[level1] + if (_index !== undefined) { + indices[_index].push(index) + } else { + cache[level1] = indices.length + indices.push([index]) + } + }) + let result = [] + indices.map((item) => { + item.map((index) => { + result.push(dataList[index]) + }) + }) + this.dataList = result + }, + checkSameData1(dataList) { + let cache = {} //瀛樺偍鐨勬槸閿槸kclx 鐨勫�硷紝鍊兼槸kclx 鍦╥ndeces涓暟缁勭殑涓嬫爣 + let indices = [] //鏁扮粍涓瘡涓�涓�兼槸涓�涓暟缁勶紝鏁扮粍涓殑姣忎竴涓厓绱犳槸鍘熸暟缁勪腑鐩稿悓kclx鐨勪笅鏍� + dataList.map((item, index) => { + let level2 = item.level2 + let _index = cache[level2] + if (_index !== undefined) { + indices[_index].push(index) + } else { + cache[level2] = indices.length + indices.push([index]) + } + }) + let result = [] + indices.map((item) => { + item.map((index) => { + result.push(dataList[index]) + }) + }) + this.dataList = result + }, + checkSameData2(dataList) { + let cache = {} //瀛樺偍鐨勬槸閿槸kclx 鐨勫�硷紝鍊兼槸kclx 鍦╥ndeces涓暟缁勭殑涓嬫爣 + let indices = [] //鏁扮粍涓瘡涓�涓�兼槸涓�涓暟缁勶紝鏁扮粍涓殑姣忎竴涓厓绱犳槸鍘熸暟缁勪腑鐩稿悓kclx鐨勪笅鏍� + dataList.map((item, index) => { + let level3 = item.level3 + let _index = cache[level3] + if (_index !== undefined) { + indices[_index].push(index) + } else { + cache[level3] = indices.length + indices.push([index]) + } + }) + let result = [] + indices.map((item) => { + item.map((index) => { + result.push(dataList[index]) + }) + }) + this.dataList = result + }, + // 鍚堝苟 + combineCell() { + console.log(this.dataList) + let list = this.dataList + for (let field in list[0]) { + var k = 0 + while (k < list.length) { + list[k][field + 'span'] = 1 + list[k][field + 'dis'] = false + for (var i = k + 1; i <= list.length - 1; i++) { + if (list[k][field] == list[i][field] && list[k][field] != '') { + list[k][field + 'span']++ + list[k][field + 'dis'] = false + list[i][field + 'span'] = 1 + list[i][field + 'dis'] = true + } else { + break + } + } + k = i + } + } + return list + }, + disabledDate(current) { + //Can not slect days before today and today + return current && current > moment().subtract('days', 1) + }, + initDeviceType(deviceList) { + let dictCode = 'mdc_equipmentType' + let items = [] + items = getDictItemsFromCache(dictCode) + if (deviceList && items.length > 0) { + for (let a = 0; a < deviceList.length; a++) { + if (items && items.length > 0) { + for (let i = 0; i < items.length; i++) { + if (deviceList[a].equipmentType == items[i].value) { + deviceList[a].equipmentType = items[i].title + } + } + } else { + ajaxGetDictItems(dictCode, null).then((res) => { + if (res.success) { + let items = res.result + for (let i = 0; i < items.length; i++) { + if (deviceList[a].equipmentType == items[i].value) { + deviceList[a].equipmentType = items[i].title + } + } + } + }) + } + } + } + }, + exportExcel() { + $('#EfficiencyPO').table2excel({ + exclude: '.noExl', + name: 'Excel Document Name', + filename: '璁惧寮�鍔ㄧ巼', + exclude_img: true, + fileext: '.xls', + exclude_links: true, + exclude_inputs: true + }) + }, + showIdentifying() { + getAction(this.url.listByType, { type: 'kdl' }).then(res => { + if (res.success) { + this.identifying = res.result + } + }) + }, + dateParamChange(v1, v2) { + this.queryParam.startTime = v2[0] + this.queryParam.endTime = v2[1] + // 鐐瑰嚮鏃堕棿閫夋嫨鍣ㄧ殑娓呯┖鎸夐挳鏃朵細瑙﹀彂姝ゅ垽鏂�(鐐瑰嚮閲嶇疆鎸夐挳涓嶄細瑙﹀彂)锛屽疄鐜伴噸缃垪琛ㄥ姛鑳斤紝鍒囧疄鏀瑰彉鍒楄〃鏄剧ず鏁堟灉 + if (!this.queryParam.startTime && !this.queryParam.endTime) this.searchReset() + }, + efficiencyOptionsOnChange(checkedList) { + // let index = checkedList.indexOf('lyl') + // if (index < 0) { + // // this.$message.warn('涓嶈兘鍙栨秷鏌ヨ鍒╃敤鐜�') + // this.$notification.warning({ + // message:'娑堟伅', + // description:"涓嶈兘鍙栨秷鏌ヨ鍒╃敤鐜�" + // }) + // return false + // } + this.checkedList = checkedList + }, + searchQuery() { + if (this.queryParam.typeTree == '1') { + this.queryParam.parentId = this.queryParamEquip.parentId + this.queryParam.equipmentId = this.queryParamEquip.equipmentId + } else { + this.queryParam.parentId = this.queryParamPeople.parentId + this.queryParam.equipmentId = '' + } + Object.keys(this.queryParams).forEach(item => { + this.queryParam[item] = this.queryParams[item].join() + // 姝ゅ涓轰繚璇佹帴鍙e弬鏁颁笉澶氫綑锛屽彲鐪佺暐 + if (this.queryParams[item].length === 0) delete this.queryParam[item] + }) + this.loadData() + }, + searchReset() { + this.typeTree = this.queryParam.typeTree + this.typeParent = this.queryParam.parentId + this.typeEquipment = this.queryParam.equipmentId + this.queryParam = {} + this.queryParam.typeTree = this.typeTree + this.queryParam.parentId = this.typeParent + this.queryParam.equipmentId = this.typeEquipment + this.dates = [moment().subtract('days', 8), moment().subtract('days', 1)] + this.queryParam.startTime = moment(this.dates[0]).format('YYYYMMDD') + this.queryParam.endTime = moment(this.dates[1]).format('YYYYMMDD') + // this.ipagination.current = 1 + this.queryParams = { + equipmentType: [], + driveType: [], + deviceLevel: [], + deviceCategory: [] + } + this.loadData() + }, + loadData() { + this.spinning = true + this.tableHeads = [] + this.dataList = [] + getAction(this.url.list, this.queryParam).then(res => { + if (res.success) { + // console.log(res.result) + this.tableHeads = res.result.dates + this.dataList = res.result.mdcEfficiencyList + if (res.result.mdcEfficiencyList && !res.result.mdcEfficiencyList.length) { + this.$notification.info({ + message: '娑堟伅', + description: '鏆傛棤璇ヨ澶囩被鍨嬫暟鎹�' + }) + } + this.checkSameData(this.dataList) + this.checkSameData1(this.dataList) + this.checkSameData2(this.dataList) + this.combineCell() + // this.initDeviceType(this.dataList) + } + }).finally(() => { + this.spinning = false + }) + }, + queryGroup() { + getAction(this.url.queryEquipmentType).then(res => { + if (res.success) { + this.equipmentTypeList = res.result.map(item => { + return { + label: item.equipmentTypeName, + value: item.equipmentTypeName + } + }) + } else { + // this.$message.warning(res.message) + this.$notification.warning({ + message: '娑堟伅', + description: res.message + }) + } + }).finally(() => { + this.loading = false + }) + }, + + /** + * 璋冪敤鎺ュ彛鑾峰彇鎺у埗绯荤粺绫诲瀷 + */ + getDriveTypeByApi() { + api.getDriveTypeApi().then((res) => { + if (res.success) this.driveTypeList = res.result + }) + }, + + /** + * 鍒嗚鲸鐜囨敼鍙樻椂鍚屾椂鏀瑰彉琛ㄦ牸楂樺害宸蹭繚璇侀椤典竴杩涘叆涓嶆嫋鍔ㄥ瀭鐩存粴鍔ㄦ潯鏃跺嵆鍙嫋鍔ㄨ〃鏍兼按骞虫粴鍔ㄦ潯 + */ + handleWindowResize() { + const tableContainer = document.getElementById('EfficiencyPO') // 琛ㄦ牸瀹瑰櫒 + const clientHeight = document.documentElement.clientHeight || document.body.clientHeight // 娴忚鍣ㄥ彲瑙嗗尯鍩熼珮搴� + const containerTopToClientTopHeight = tableContainer.getBoundingClientRect().top // 琛ㄦ牸瀹瑰櫒椤堕儴鍒版祻瑙堝櫒鍙鍖哄煙椤堕儴鐨勯棿璺� + tableContainer.style.height = (clientHeight - containerTopToClientTopHeight - 32) + 'px' + } + } + } +</script> +<style scoped> + /*table鏍峰紡*/ + .table2 { + width: 100%; + height: 100%; + overflow: auto; + } + + .table2 thead tr th:first-child, + .table tbody tr .tdgu { + position: sticky; + left: 0; + z-index: 1; + } + + .table tbody tr .wenzi { + /*writing-mode: vertical-lr;*/ + /*text-orientation: upright;*/ + transform: rotate(360deg); + writing-mode: vertical-lr; + letter-spacing: 2px; + } + + .table tbody tr .kaitou { + z-index: 1; + background-color: white; + } + + .table tbody tr .tdgu1 { + position: sticky; + left: 50px; + z-index: 2; + } + + .table tbody tr .tdgu2 { + position: sticky; + left: 100px; + z-index: 2; + } + + .table tbody tr .tdgu3 { + position: sticky; + left: 150px; + z-index: 2; + } + + .table tbody tr .tdgu4 { + position: sticky; + left: 250px; + z-index: 2; + } + + .table tbody tr .tdgu5 { + position: sticky; + left: 412px; + z-index: 2; + } + + .table tbody tr .tdgu6 { + position: sticky; + left: 512px; + z-index: 2; + } + + .table2 thead tr .timeth, + .table2 thead tr .thgu { + position: sticky; + top: 0; + z-index: 3; + } + + .table2 thead .gudingth th { + position: sticky; + top: 32px; + z-index: 2; + } + + .table2 thead .equipname .name { + z-index: 3; + } + + .table2 thead .equipname .dong1 { + z-index: 4; + left: 0; + } + + .table2 thead .equipname .dong2 { + z-index: 5; + left: 50px; + } + + .table2 thead .equipname .dong3 { + z-index: 5; + left: 100px; + } + + .table2 thead .equipname .dong4 { + z-index: 5; + left: 150px; + } + + .table2 thead .equipname .dong5 { + z-index: 5; + left: 250px; + } + + .table2 thead .equipname .dong6 { + z-index: 5; + left: 412px; + } + + .table2 thead .equipname .dong7 { + z-index: 5; + left: 512px; + } + + #EfficiencyPO { + overflow: hidden; + } + + .identifyingclass { + width: 55px; + height: 15px; + display: inline-block + } + + .dataContent { + white-space: nowrap; + /*margin: 0;*/ + border-collapse: separate; + border-spacing: 0; + /*table-layout: fixed;*/ + border: 1px solid #ccc; + /*border: 1px solid #ccc;*/ + width: 100%; + /*height: 100%;*/ + /*overflow: hidden;*/ + /*overflow-y: auto;*/ + text-align: center; + } + + .dataContent .thead th { + background-color: #fafafa; + text-align: center; + height: 30px; + padding: 5px; + } + + .dataContent .notfixed th { + width: auto; + } + + .dataContent .mathData td { + padding: 10px; + } +</style> \ No newline at end of file diff --git a/src/views/mdc/base/modules/mdcUtilizationRate/MdcUtilizationRateModel.vue b/src/views/mdc/base/modules/mdcUtilizationRate/MdcUtilizationRateModel.vue new file mode 100644 index 0000000..a9059be --- /dev/null +++ b/src/views/mdc/base/modules/mdcUtilizationRate/MdcUtilizationRateModel.vue @@ -0,0 +1,204 @@ +<template> + <a-modal :title="title" :width="800" :visible="visible" :confirmLoading="confirmLoading" + :okButtonProps="{ props: {disabled: disableSubmit} }" @ok="handleOk" @cancel="handleCancel" cancelText="鍏抽棴"> + <a-spin :spinning="confirmLoading"> + <a-form :form="form"> + <a-row :gutter="24"> + <a-col :span="12"> + <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="绫诲埆"> + <a-input :disabled="true" v-decorator="['rateParameterCategory', validatorRules.rateParameterCategory]"/> + </a-form-item> + </a-col> + <a-col :span="12"> + <a-form-item label="绛夌骇" :labelCol="labelCol" :wrapperCol="wrapperCol"> + <a-input :disabled="true" v-decorator="['rateParameterLevel', validatorRules.rateParameterLevel]"/> + </a-form-item> + </a-col> + </a-row> + + <a-row :gutter="24"> + <a-col :span="24"> + <a-form-item label="鏈�灏忚寖鍥达紙鍗曚綅锛�%锛�" :labelCol="labelCol" :wrapperCol="wrapperCol"> + <a-input :disabled="disableSubmit" :readOnly="disableSubmit" allow-clear placeholder="璇疯緭鍏ユ渶灏忚寖鍥�" + v-decorator="['minimumRange',validatorRules.minimumRange]"/> + </a-form-item> + </a-col> + </a-row> + <a-row :gutter="24"> + <a-col :span="24"> + <a-form-item label="鏈�澶ц寖鍥达紙鍗曚綅锛�%锛�" :labelCol="labelCol" :wrapperCol="wrapperCol"> + <a-input :disabled="disableSubmit" :readOnly="disableSubmit" allow-clear placeholder="璇疯緭鍏ユ渶澶ц寖鍥�" + v-decorator="['maximumRange',validatorRules.maximumRange]"/> + </a-form-item> + </a-col> + </a-row> + <a-row :gutter="24"> + <a-col :span="24"> + <a-form-item label="棰滆壊" :labelCol="labelCol" :wrapperCol="wrapperCol"> + <a-input type="color" v-decorator="['rateParameterColor',validatorRules.rateParameterColor]"></a-input> + </a-form-item> + </a-col> + </a-row> + </a-form> + </a-spin> + </a-modal> +</template> + +<script> + import pick from 'lodash.pick' + import { + getAction, + postAction, + requestPut + } from '@/api/manage' + import { + duplicateCheck + } from '@/api/api' + + export default { + name: 'MdcUtilizationRateModel', + props: {}, + data() { + return { + title: '', + visible: false, + show: false, + model: {}, + checked: false, + labelCol: { + xs: { + span: 24 + }, + sm: { + span: 6 + } + }, + wrapperCol: { + xs: { + span: 24 + }, + sm: { + span: 18 + } + }, + confirmLoading: false, + form: this.$form.createForm(this), + validatorRules: {}, + url: { + edit: '/mdc/MdcUtilizationRate/editUtilization' + }, + disableSubmit: true + } + }, + created() { + }, + methods: { + //绾ц仈妗唎nChange浜嬩欢 + onChange(value) { + + }, + edit(record) { + this.form.resetFields() + this.model = Object.assign({}, record) + this.visible = true + this.$nextTick(() => { + this.form.setFieldsValue(pick(this.model, 'rateParameterCategory', 'rateParameterLevel', 'minimumRange', 'maximumRange', 'rateParameterColor')) + }) + }, + close() { + this.$emit('close') + this.visible = false + this.show = false + }, + handleOk() { + const that = this + // 瑙﹀彂琛ㄥ崟楠岃瘉 + this.form.validateFields((err, values) => { + if (!err) { + that.confirmLoading = true + let formData = Object.assign(this.model, values) + requestPut(this.url.edit, formData, { + id: this.model.id + }).then((res) => { + if (res.success) { + // that.$message.success("淇濆瓨鎴愬姛") + that.$notification.success({ + message: '娑堟伅', + description: '淇濆瓨鎴愬姛' + }) + that.$emit('ok', res.result) + } else { + // that.$message.warning(res.message) + that.$notification.warning({ + message: '娑堟伅', + description: res.message + }) + } + }).finally(() => { + that.confirmLoading = false + that.close() + }) + } + }) + }, + handleCancel() { + this.close() + }, + loadCascade() { + getAction(this.url.loadCascadeData).then((res) => { + if (res.success) { + this.partCategoryCascade = res.result + } + }) + }, + onCascadeChange(value, selectedOptions) { + this.cascadeDefaultValue = [...value] + }, + filter(inputValue, path) { + return path.some(option => option.label.toLowerCase().indexOf(inputValue.toLowerCase()) > -1) + }, + //楠岃瘉 缂栫爜 + validateNum(rule, value, callback) { + var params = { + tableName: 'lxmes_base_part', + fieldName: 'num', + fieldVal: value, + dataId: this.model.id, + //鏁版嵁搴撲腑瀛樺湪瀛楁del_flag骞朵娇鐢ㄨ瀛楁浣滀负鏈垹闄ょ瓥鐣ワ紝鐪熷垹闄わ細false 鍋囧垹闄わ細true + delFlag: 'true' + } + duplicateCheck(params).then((res) => { + if (res.success) { + callback() + } else { + callback('瀛樿揣缂栫爜宸插瓨鍦�!') + } + }) + }, + checkboxChange(e) { + this.checked = e.target.checked + } + } + } +</script> + +<style scoped> + .ant-btn { + padding: 0 10px; + margin-left: 3px; + } + + .ant-form-item-control { + line-height: 0px; + } + + /** 涓昏〃鍗曡闂磋窛 */ + .ant-form .ant-form-item { + margin-bottom: 10px; + } + + /** Tab椤甸潰琛岄棿璺� */ + .ant-tabs-content .ant-form-item { + margin-bottom: 0px; + } +</style> -- Gitblit v1.9.3