init
This commit is contained in:
@@ -0,0 +1,75 @@
|
||||
<!--
|
||||
* @Author: gtz
|
||||
* @Date: 2021-06-17 16:54:55
|
||||
* @LastEditors: gtz
|
||||
* @LastEditTime: 2021-06-17 17:19:56
|
||||
* @Description: file content
|
||||
-->
|
||||
<template>
|
||||
<div>
|
||||
<el-dialog :visible.sync="visible" :title="$t('module.equipmentManager.equipmentParams.choiceParam')" @open="onOpen" @close="onClose">
|
||||
<el-checkbox-group
|
||||
v-model="checkedItems"
|
||||
:min="0"
|
||||
:max="100"
|
||||
>
|
||||
<el-checkbox v-for="item in items" :key="item.id" :label="item.id">{{ item.name }}</el-checkbox>
|
||||
</el-checkbox-group>
|
||||
<div slot="footer">
|
||||
<el-button @click="close">{{ 'btn.cancel' | i18nFilter }}</el-button>
|
||||
<el-button type="primary" @click="handelConfirm">{{ 'btn.confirm' | i18nFilter }}</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
// import i18n from '@/lang'
|
||||
export default {
|
||||
components: {},
|
||||
inheritAttrs: false,
|
||||
props: {
|
||||
paramNameList: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
},
|
||||
checkParams: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
},
|
||||
isShow: {
|
||||
type: Boolean,
|
||||
default: () => false
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
items: [],
|
||||
checkedItems: [],
|
||||
visible: false
|
||||
}
|
||||
},
|
||||
computed: {},
|
||||
watch: {
|
||||
isShow: function(val) {
|
||||
this.visible = val
|
||||
}
|
||||
},
|
||||
created() {},
|
||||
mounted() {},
|
||||
methods: {
|
||||
onOpen() {
|
||||
this.items = JSON.parse(JSON.stringify(this.paramNameList))
|
||||
this.checkedItems = JSON.parse(JSON.stringify(this.checkParams))
|
||||
},
|
||||
onClose() {},
|
||||
close() {
|
||||
this.$emit('close')
|
||||
},
|
||||
handelConfirm() {
|
||||
this.$emit('handelConfirm', this.checkedItems)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
</style>
|
||||
185
src/views/EquipmentManager/equipmentParams/index.vue
Normal file
185
src/views/EquipmentManager/equipmentParams/index.vue
Normal file
@@ -0,0 +1,185 @@
|
||||
<!--
|
||||
* @Author: gtz
|
||||
* @Date: 2021-06-17 09:49:03
|
||||
* @LastEditors: gtz
|
||||
* @LastEditTime: 2021-06-17 17:53:30
|
||||
* @Description: file content
|
||||
-->
|
||||
<!--
|
||||
* @Date: 2020-12-15 15:36:52
|
||||
* @LastEditors: Please set LastEditors
|
||||
* @LastEditTime: 2021-05-25 08:57:51
|
||||
* @FilePath: \basic-admin\src\views\EquipmentManager\MaintainLog\index.vue
|
||||
* @Description:
|
||||
-->
|
||||
<template>
|
||||
<div class="usermanager-container">
|
||||
<div class="method-btn-area">
|
||||
{{ $t('module.equipmentManager.equipmentParams.startAndEndTime') }}:
|
||||
<el-date-picker
|
||||
v-model="date"
|
||||
type="daterange"
|
||||
range-separator="-"
|
||||
:start-placeholder="$t('module.equipmentManager.equipmentParams.startTime')"
|
||||
:end-placeholder="$t('module.equipmentManager.equipmentParams.endTime')"
|
||||
@change="changeTime"
|
||||
/>
|
||||
<el-button type="primary" @click="showChoiceParam">{{ $t('module.equipmentManager.equipmentParams.choiceParam') }}</el-button>
|
||||
<el-button type="primary" @click="getList">{{ 'btn.search' | i18nFilter }}</el-button>
|
||||
</div>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="4">
|
||||
<div class="tree-select-container">
|
||||
<Tree :tree-type="treeType" @lastNodeClick="eqChange" />
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="20">
|
||||
<base-table :table-config="tableProps" :table-data="list" :is-loading="listLoading" :page="listQuery.current" :limit="listQuery.size" />
|
||||
</el-col>
|
||||
</el-row>
|
||||
<pagination :total="total" :page.sync="listQuery.current" :limit.sync="listQuery.size" @pagination="getList" />
|
||||
<choice-dialog :param-name-list="paramNameList" :check-params="checkParamName" :is-show="choiceParamShow" @handleConfirm="handleConfirm" @close="closeDialog" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { timeFormatter } from '@/filters'
|
||||
import Tree from '@/components/Tree'
|
||||
const tableProps = [{
|
||||
prop: 'substrateId',
|
||||
label: i18n.t('module.equipmentManager.equipmentParams.substrateId'),
|
||||
align: 'center'
|
||||
}, {
|
||||
prop: 'createTime',
|
||||
label: i18n.t('module.equipmentManager.equipmentParams.createTime'),
|
||||
align: 'center',
|
||||
filter: timeFormatter
|
||||
}]
|
||||
import BaseTable from '@/components/BaseTable'
|
||||
import choiceDialog from './choiceParamModel.vue'
|
||||
// edit here
|
||||
import { getParamNameList, getParamList } from '@/api/equipment/equipmentParams'
|
||||
|
||||
import Pagination from '@/components/Pagination'
|
||||
import i18n from '@/lang'
|
||||
|
||||
export default {
|
||||
name: 'OrgManager',
|
||||
components: { Pagination, BaseTable, Tree, choiceDialog },
|
||||
props: {},
|
||||
data() {
|
||||
return {
|
||||
tableProps,
|
||||
list: [],
|
||||
total: 0,
|
||||
listLoading: false,
|
||||
showDialog: false,
|
||||
curEditId: null,
|
||||
showEditDialog: false,
|
||||
listQuery: {
|
||||
current: 1,
|
||||
size: 10,
|
||||
startTime: '',
|
||||
endTime: '',
|
||||
equipmentId: null,
|
||||
paramNameList: ''
|
||||
},
|
||||
paramNameList: [],
|
||||
paramNameObj: {},
|
||||
checkParamName: [],
|
||||
date: null,
|
||||
treeType: 'equipment',
|
||||
choiceParamShow: false
|
||||
}
|
||||
},
|
||||
created() {},
|
||||
mounted() {},
|
||||
methods: {
|
||||
async getList() {
|
||||
this.listLoading = true
|
||||
this.tableProps = tableProps
|
||||
this.checkParamName.map(item => {
|
||||
this.tableProps.push({
|
||||
prop: this.paramNameObj[item],
|
||||
label: this.paramNameObj[item],
|
||||
align: 'center'
|
||||
})
|
||||
})
|
||||
// edit here
|
||||
const result = await getParamList(this.listQuery)
|
||||
if (result.code === 0) {
|
||||
this.list = result.data.records.map(item => {
|
||||
item.paramList.map(i => {
|
||||
item[i.name] = i.value
|
||||
})
|
||||
return item
|
||||
})
|
||||
this.total = result.data.total
|
||||
this.listLoading = false
|
||||
}
|
||||
},
|
||||
async eqChange(data) {
|
||||
this.listQuery.equipmentId = data.id
|
||||
this.date = [new Date() - 1000 * 60 * 60 * 24, new Date()]
|
||||
const result = await getParamNameList({ equipmentId: data.id })
|
||||
if (result.code === 0) {
|
||||
this.paramNameList = result.data
|
||||
this.paramNameList(item => {
|
||||
this.paramNameObj[item.id] = item.name
|
||||
})
|
||||
if (this.paramNameList.length > 100) {
|
||||
this.listQuery.paramNameList = this.paramNameList.slice(0, 100).join(',')
|
||||
this.checkParamName = this.paramNameList.slice(0, 100).map(item => {
|
||||
return item.id
|
||||
})
|
||||
} else {
|
||||
this.listQuery.paramNameList = 'all'
|
||||
this.checkParamName = JSON.parse(JSON.stringify(this.ParamNameList)).map(item => {
|
||||
return item.id
|
||||
})
|
||||
}
|
||||
this.getList()
|
||||
}
|
||||
},
|
||||
showChoiceParam() {
|
||||
this.choiceParamShow = true
|
||||
},
|
||||
changeTime(val) {
|
||||
this.listQuery.startTime = val ? val[0] : null
|
||||
this.listQuery.endTime = val ? val[1] : null
|
||||
},
|
||||
handleConfirm(data) {
|
||||
this.checkParamName = data
|
||||
this.listQuery.paramNameList = data.join(',')
|
||||
this.choiceParamShow = false
|
||||
},
|
||||
closeDialog() {
|
||||
this.choiceParamShow = false
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.usermanager-container {
|
||||
padding: 20px;
|
||||
.method-btn-area {
|
||||
padding: 15px 30px;
|
||||
margin: 10px 0 20px 0;
|
||||
border: 1px solid #dfe6ec;
|
||||
}
|
||||
.tree-select-container {
|
||||
border: 1px solid #dfe6ec;
|
||||
min-height: 400px;
|
||||
padding: 20px;
|
||||
}
|
||||
}
|
||||
.edit-input {
|
||||
padding-right: 100px;
|
||||
}
|
||||
.cancel-btn {
|
||||
position: absolute;
|
||||
right: 15px;
|
||||
top: 10px;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user