'update' #22

Merged
gtz217 merged 1 commits from fzq into develop 2023-02-09 15:08:05 +08:00
6 changed files with 697 additions and 245 deletions
Showing only changes of commit 0b5740d41c - Show all commits

View File

@ -4,7 +4,7 @@
* @Author: fzq * @Author: fzq
* @Date: 2022-11-25 09:51:46 * @Date: 2022-11-25 09:51:46
* @LastEditors: fzq * @LastEditors: fzq
* @LastEditTime: 2023-02-07 16:19:50 * @LastEditTime: 2023-02-09 14:40:52
--> -->
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
@ -39,7 +39,8 @@
<!-- 开发环境 --> <!-- 开发环境 -->
<% if (process.env.VUE_APP_NODE_ENV === 'dev') { %> <% if (process.env.VUE_APP_NODE_ENV === 'dev') { %>
<script> <script>
window.SITE_CONFIG['apiURL'] = 'http://192.168.1.8'; // window.SITE_CONFIG['apiURL'] = 'http://192.168.1.8';
window.SITE_CONFIG['apiURL'] = 'http://india.mes.picaiba.com/';
</script> </script>
<% } %> <% } %>
<!-- 集成测试环境 --> <!-- 集成测试环境 -->

View File

@ -1,10 +1,12 @@
<template> <template>
<div class="attr-form"> <div class="attr-form">
<h3> <h3>
{{ title }} <el-button style="margin-left: 8px;" type="text" v-if="!isDetail && !showAddAttr" @click="showAddAttr = true">{{ $t('add') }}</el-button> <!-- <el-button style="margin-left: 8px" type="text" v-if="!isDetail && !showAddAttr" @click="showAddAttr = true">{{ $t('add') }}</el-button> 跟在{{ title }} 同行后面 -->
{{ title }}
</h3> </h3>
<div v-if="!showAddAttr"> <div v-if="!showAddAttr">
<component <component
:top-btn-config="topBtnConfig"
key="sub-table" key="sub-table"
:is="require('../../base-table/index.vue').default" :is="require('../../base-table/index.vue').default"
:table-head-configs="filterTableConfigs()" :table-head-configs="filterTableConfigs()"
@ -12,8 +14,8 @@
:page="pageIndex" :page="pageIndex"
:size="pageSize" :size="pageSize"
:max-height="calcMaxHeight(8)" :max-height="calcMaxHeight(8)"
@operate-event="handleOperations" @clickTopBtn="clickTopBtn"
/> @operate-event="handleOperations" />
<el-pagination <el-pagination
@size-change="sizeChangeHandle" @size-change="sizeChangeHandle"
@current-change="currentChangeHandle" @current-change="currentChangeHandle"
@ -21,15 +23,14 @@
:page-sizes="[5, 10, 20, 50]" :page-sizes="[5, 10, 20, 50]"
:page-size="pageSize" :page-size="pageSize"
:total="totalPage" :total="totalPage"
layout="total, sizes, prev, pager, next, jumper" layout="total, sizes, prev, pager, next, jumper">
>
</el-pagination> </el-pagination>
</div> </div>
<div v-else style="background: #eee; border-radius: 8px; padding: 12px;"> <div v-else style="background: #eee; border-radius: 8px; padding: 12px">
<el-row> <el-row>
<el-col> <el-col>
<el-form ref="AttrForm" :model="AttrForm" :rules="AttrFormRules" :inline="true" label-position="top"> <el-form ref="AttrForm" :model="AttrForm" :rules="AttrFormRules" :inline="true" label-position="top">
<el-row :gutter="20" style="padding: 0 24px;"> <el-row :gutter="20" style="padding: 0 24px">
<el-col :span="attrFormFields.length > 6 ? 6 : 12" v-for="field in attrFormFields" :key="field.prop + 'col'"> <el-col :span="attrFormFields.length > 6 ? 6 : 12" v-for="field in attrFormFields" :key="field.prop + 'col'">
<el-form-item :key="field.prop" :prop="field.prop" :label="field.name" style="width: 100%"> <el-form-item :key="field.prop" :prop="field.prop" :label="field.name" style="width: 100%">
<el-input v-if="field.formType === 'input' || !field.formType" v-model="AttrForm[field.prop]" :placeholder="$t('hints.input')" clearable /> <el-input v-if="field.formType === 'input' || !field.formType" v-model="AttrForm[field.prop]" :placeholder="$t('hints.input')" clearable />
@ -43,7 +44,7 @@
</el-form> </el-form>
</el-col> </el-col>
</el-row> </el-row>
<el-row style="text-align: right;"> <el-row style="text-align: right">
<el-button size="small" @click="handleCloseAttrForm">{{ $t('cancel') }}</el-button> <el-button size="small" @click="handleCloseAttrForm">{{ $t('cancel') }}</el-button>
<el-button type="success" size="small" @click="handleSaveAttrForm">{{ $t('save') }}</el-button> <el-button type="success" size="small" @click="handleSaveAttrForm">{{ $t('save') }}</el-button>
</el-row> </el-row>
@ -56,6 +57,12 @@ import i18n from '@/i18n'
import BaseTable from '@/components/base-table' import BaseTable from '@/components/base-table'
import { pick } from 'lodash/object' import { pick } from 'lodash/object'
import { calcMaxHeight } from '@/utils' import { calcMaxHeight } from '@/utils'
const topBtnConfig = [
{
type: 'add',
btnName: i18n.t('add')
}
]
export default { export default {
name: 'AttrForm', name: 'AttrForm',
components: { BaseTable }, components: { BaseTable },
@ -96,6 +103,7 @@ export default {
data() { data() {
return { return {
calcMaxHeight, calcMaxHeight,
topBtnConfig,
showAddAttr: false, showAddAttr: false,
dataList: [], dataList: [],
pageIndex: 1, pageIndex: 1,
@ -107,9 +115,9 @@ export default {
}, },
computed: { computed: {
attrFormFields() { attrFormFields() {
const _ = this.tableConfigs.filter(item => item.formField) const _ = this.tableConfigs.filter((item) => item.formField)
/** 顺带配置 AttrForm */ /** 顺带配置 AttrForm */
_.forEach(item => { _.forEach((item) => {
this.$set(this.AttrForm, [item.prop], '') this.$set(this.AttrForm, [item.prop], '')
}) })
@ -126,11 +134,17 @@ export default {
} }
} }
}, },
// createdtopBtnConfig使? :
created() {
// if(!(!this.isDetail && !this.showAddAttr)) {
// this.topBtnConfig = []
// }
},
methods: { methods: {
filterTableConfigs() { filterTableConfigs() {
if (this.isDetail) { if (this.isDetail) {
/** 如果是查看详情,就屏蔽操作列 */ /** 如果是查看详情,就屏蔽操作列 */
return this.tableConfigs.filter(opt => opt.prop !== 'operations') return this.tableConfigs.filter((opt) => opt.prop !== 'operations')
} }
return this.tableConfigs return this.tableConfigs
}, },
@ -182,7 +196,7 @@ export default {
this.$nextTick(() => { this.$nextTick(() => {
this.$http.get(this.$http.adornUrl(`${this.url}/${id}`)).then(({ data: res }) => { this.$http.get(this.$http.adornUrl(`${this.url}/${id}`)).then(({ data: res }) => {
if (res && res.code === 0 && res.data) { if (res && res.code === 0 && res.data) {
const neededFields = [...this.attrFormFields.map(item => item.prop), 'id'] const neededFields = [...this.attrFormFields.map((item) => item.prop), 'id']
const filtered = pick(res.data, neededFields) const filtered = pick(res.data, neededFields)
for (let field of neededFields) { for (let field of neededFields) {
this.AttrForm[field] = filtered[field] this.AttrForm[field] = filtered[field]
@ -231,7 +245,7 @@ export default {
}, },
handleSaveAttrForm() { handleSaveAttrForm() {
this.$refs['AttrForm'].validate(valid => { this.$refs['AttrForm'].validate((valid) => {
if (valid) { if (valid) {
this.$http({ this.$http({
// url: this.$http.adornUrl(`${this.url}/${!this.AttrForm.id ? '' : this.AttrForm.id}`), // url: this.$http.adornUrl(`${this.url}/${!this.AttrForm.id ? '' : this.AttrForm.id}`),
@ -271,6 +285,9 @@ export default {
currentChangeHandle(val) { currentChangeHandle(val) {
this.pageIndex = val this.pageIndex = val
this.getDataList() this.getDataList()
},
clickTopBtn() {
this.showAddAttr = true
} }
} }
} }

View File

@ -126,7 +126,7 @@ const title = {
// //
const btnType = { const btnType = {
add: '#0b58ff', add: '#0b58ff',
save: '#000', save: '#0b58ff',
update: '#0b58ff', update: '#0b58ff',
reset: '' reset: ''
// cancel: 'text' // cancel: 'text'

View File

@ -4,15 +4,10 @@
<navbar :showhome="false" :show-title="true" /> <navbar :showhome="false" :show-title="true" />
</div> --> </div> -->
<div class="choicepart-box"> <div class="choicepart-box">
<div <div v-for="(item, index) in routeList" :key="item.path" class="choicepart-item" @click="handelClick(item, index)">
v-for="(item, index) in routeList"
:key="item.path"
class="choicepart-item"
@click="handelClick(item, index)"
>
<!-- :style="{ background: colorArr.colorList[index % 9] }" --> <!-- :style="{ background: colorArr.colorList[index % 9] }" -->
<div class="choicepart-item-border"> <div class="choicepart-item-border">
<img :src="require(`../../assets/img/choicepart/${item.name}.png`)" alt=""> <img :src="require(`../../assets/img/choicepart/${item.name}.png`)" alt="" />
</div> </div>
<div class="choicepart-item-title" :title="item.name">{{ item.name }}</div> <div class="choicepart-item-title" :title="item.name">{{ item.name }}</div>
</div> </div>
@ -62,7 +57,7 @@ export default {
// }) // })
// console.log(formatList) // console.log(formatList)
return window.SITE_CONFIG['menuList'] return window.SITE_CONFIG['menuList']
}, }
// ...mapGetters(['language', 'dictList', 'dictObj']) // ...mapGetters(['language', 'dictList', 'dictObj'])
}, },
created() { created() {
@ -130,17 +125,16 @@ export default {
toRouter(item) { toRouter(item) {
// console.log(item.children[0].url) // console.log(item.children[0].url)
// children // children
if ((item.children) && (item.children[0].url == "")){ if (item.children && item.children[0].url == '') {
this.$router.push({ name: item.children[0].children[0].url.replace(new RegExp('/', 'g'), '-') }) this.$router.push({ name: item.children[0].children[0].url.replace(new RegExp('/', 'g'), '-') })
} } else {
else {
this.$router.push({ name: item.children[0].url.replace(new RegExp('/', 'g'), '-') }) this.$router.push({ name: item.children[0].url.replace(new RegExp('/', 'g'), '-') })
} }
}, },
setIndex(list, index) { setIndex(list, index) {
list.meta.routeIndex = index list.meta.routeIndex = index
if (list.children) { if (list.children) {
list.children.map(item => { list.children.map((item) => {
this.setIndex(item, index) this.setIndex(item, index)
}) })
} }
@ -158,7 +152,11 @@ export default {
background: url('../../assets/img/choicepart/choicepart-back.png') repeat; background: url('../../assets/img/choicepart/choicepart-back.png') repeat;
background-size: cover; background-size: cover;
overflow-x: scroll; overflow-x: scroll;
// flex
.choicepart-box { .choicepart-box {
display: flex;
flex-flow: row wrap;
justify-content: center;
width: 1440px; width: 1440px;
margin: 0 auto; margin: 0 auto;
margin: 0 auto; margin: 0 auto;
@ -172,7 +170,7 @@ export default {
background: url('../../assets/img/choicepart/choice-item-back.png') no-repeat; background: url('../../assets/img/choicepart/choice-item-back.png') no-repeat;
background-size: 100% 100%; background-size: 100% 100%;
// border: 1px dashed #fff; // border: 1px dashed #fff;
box-shadow: 0 2px 10px rgba(0, 0, 0, .5); box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
top: 0; top: 0;
border-radius: 5px; border-radius: 5px;
overflow: hidden; overflow: hidden;
@ -189,7 +187,7 @@ export default {
line-height: 32px; line-height: 32px;
font-size: 28px; font-size: 28px;
font-weight: lighter; font-weight: lighter;
color: #2C6BD8; color: #2c6bd8;
overflow: hidden; overflow: hidden;
} }
.choicepart-item-title { .choicepart-item-title {
@ -207,12 +205,12 @@ export default {
line-height: 48px; line-height: 48px;
height: 48px; height: 48px;
letter-spacing: 2px; letter-spacing: 2px;
background-color: rgba($color: #0B58FF, $alpha: 0.45); background-color: rgba($color: #0b58ff, $alpha: 0.45);
} }
} }
.choicepart-item:hover { .choicepart-item:hover {
.choicepart-item-title { .choicepart-item-title {
background-color: rgba($color: #0B58FF, $alpha: 1); background-color: rgba($color: #0b58ff, $alpha: 1);
} }
} }
} }
@ -224,14 +222,17 @@ export default {
z-index: 10; z-index: 10;
} }
} }
::-webkit-scrollbar-track-piece { // ::-webkit-scrollbar-track-piece {
background: rgba(255, 255, 255, .1); //
background: rgba(255, 255, 255, 0.1);
} }
::-webkit-scrollbar {// ::-webkit-scrollbar {
//
width: 9px; width: 9px;
height: 9px; height: 9px;
} }
::-webkit-scrollbar-thumb {// ::-webkit-scrollbar-thumb {
//
background-color: #dddddd; background-color: #dddddd;
background-clip: padding-box; background-clip: padding-box;
min-height: 28px; min-height: 28px;

View File

@ -21,7 +21,16 @@
</el-form> </el-form>
<!-- <base-table :page="pageIndex" :size="pageSize" :data="dataList" :table-head-configs="tableConfigs" :max-height="calcMaxHeight(8)" @operate-event="handleOperations" @refreshDataList="getDataList" /> --> <!-- <base-table :page="pageIndex" :size="pageSize" :data="dataList" :table-head-configs="tableConfigs" :max-height="calcMaxHeight(8)" @operate-event="handleOperations" @refreshDataList="getDataList" /> -->
<base-table :data="dataList" :table-head-configs="tableConfigs" :max-height="calcMaxHeight(8)" /> <base-table v-if="tableConfigs.length > 3" :data="dataList" :table-head-configs="tableConfigs" :max-height="calcMaxHeight(8)" />
<base-table v-if="tableConfigs2.length > 3" :data="dataList2" :table-head-configs="tableConfigs2" :max-height="calcMaxHeight(8)" />
<base-table v-if="tableConfigs3.length > 3" :data="dataList3" :table-head-configs="tableConfigs3" :max-height="calcMaxHeight(8)" />
<base-table v-if="tableConfigs4.length > 3" :data="dataList4" :table-head-configs="tableConfigs4" :max-height="calcMaxHeight(8)" />
<base-table v-if="tableConfigs5.length > 3" :data="dataList5" :table-head-configs="tableConfigs5" :max-height="calcMaxHeight(8)" />
<base-table v-if="tableConfigs6.length > 3" :data="dataList6" :table-head-configs="tableConfigs6" :max-height="calcMaxHeight(8)" />
<base-table v-if="tableConfigs7.length > 3" :data="dataList7" :table-head-configs="tableConfigs7" :max-height="calcMaxHeight(8)" />
<base-table v-if="tableConfigs8.length > 3" :data="dataList8" :table-head-configs="tableConfigs8" :max-height="calcMaxHeight(8)" />
<base-table v-if="tableConfigs9.length > 3" :data="dataList9" :table-head-configs="tableConfigs9" :max-height="calcMaxHeight(8)" />
<base-table v-if="tableConfigs10.length > 3" :data="dataList10" :table-head-configs="tableConfigs10" :max-height="calcMaxHeight(8)" />
<!-- <base-table :data="dataList" :table-head-configs="tableConfigs" :max-height="calcMaxHeight(8)" /> --> <!-- <base-table :data="dataList" :table-head-configs="tableConfigs" :max-height="calcMaxHeight(8)" /> -->
</div> </div>
</template> </template>
@ -42,8 +51,26 @@ export default {
equipmentName: null, equipmentName: null,
equipmentCode: null, equipmentCode: null,
tableConfigs: [], tableConfigs: [],
tableConfigs2: [],
tableConfigs3: [],
tableConfigs4: [],
tableConfigs5: [],
tableConfigs6: [],
tableConfigs7: [],
tableConfigs8: [],
tableConfigs9: [],
tableConfigs10: [],
dataLength: null, dataLength: null,
dataList: [], dataList: [],
dataList2: [],
dataList3: [],
dataList4: [],
dataList5: [],
dataList6: [],
dataList7: [],
dataList8: [],
dataList9: [],
dataList10: [],
dataListLoading: false, dataListLoading: false,
dataListSelections: [] dataListSelections: []
} }
@ -92,11 +119,135 @@ export default {
// console.log(this.equipmentName) // console.log(this.equipmentName)
this.setTableProps(res.data[0].nameData) this.setTableProps(res.data[0].nameData)
this.setTableData(res.data[0].data) this.setTableData(res.data[0].data)
} else { }
this.dataList = [] if (
res &&
res.code === 0 &&
res.data &&
res.data.length > 0 &&
res.data[1].nameData &&
res.data[1].nameData.length > 0 &&
res.data[1].data &&
res.data[1].data.length > 0
) {
// console.log(this.equipmentName)
this.setTableProps2(res.data[1].nameData)
this.setTableData2(res.data[1].data)
}
if (
res &&
res.code === 0 &&
res.data &&
res.data.length > 0 &&
res.data[2].nameData &&
res.data[2].nameData.length > 0 &&
res.data[2].data &&
res.data[2].data.length > 0
) {
// console.log(this.equipmentName)
this.setTableProps3(res.data[2].nameData)
this.setTableData3(res.data[2].data)
}
if (
res &&
res.code === 0 &&
res.data &&
res.data.length > 0 &&
res.data[3].nameData &&
res.data[3].nameData.length > 0 &&
res.data[3].data &&
res.data[3].data.length > 0
) {
// console.log(this.equipmentName)
this.setTableProps4(res.data[3].nameData)
this.setTableData4(res.data[3].data)
}
if (
res &&
res.code === 0 &&
res.data &&
res.data.length > 0 &&
res.data[4].nameData &&
res.data[4].nameData.length > 0 &&
res.data[4].data &&
res.data[4].data.length > 0
) {
// console.log(this.equipmentName)
this.setTableProps5(res.data[4].nameData)
this.setTableData5(res.data[4].data)
}
if (
res &&
res.code === 0 &&
res.data &&
res.data.length > 0 &&
res.data[5].nameData &&
res.data[5].nameData.length > 0 &&
res.data[5].data &&
res.data[5].data.length > 0
) {
// console.log(this.equipmentName)
this.setTableProps6(res.data[5].nameData)
this.setTableData6(res.data[5].data)
}
if (
res &&
res.code === 0 &&
res.data &&
res.data.length > 0 &&
res.data[6].nameData &&
res.data[6].nameData.length > 0 &&
res.data[6].data &&
res.data[6].data.length > 0
) {
// console.log(this.equipmentName)
this.setTableProps7(res.data[6].nameData)
this.setTableData7(res.data[6].data)
}
if (
res &&
res.code === 0 &&
res.data &&
res.data.length > 0 &&
res.data[7].nameData &&
res.data[7].nameData.length > 0 &&
res.data[7].data &&
res.data[7].data.length > 0
) {
// console.log(this.equipmentName)
this.setTableProps8(res.data[7].nameData)
this.setTableData8(res.data[7].data)
}
if (
res &&
res.code === 0 &&
res.data &&
res.data.length > 0 &&
res.data[8].nameData &&
res.data[8].nameData.length > 0 &&
res.data[8].data &&
res.data[8].data.length > 0
) {
// console.log(this.equipmentName)
this.setTableProps9(res.data[8].nameData)
this.setTableData9(res.data[8].data)
}
if (
res &&
res.code === 0 &&
res.data &&
res.data.length > 0 &&
res.data[9].nameData &&
res.data[9].nameData.length > 0 &&
res.data[9].data &&
res.data[9].data.length > 0
) {
// console.log(this.equipmentName)
this.setTableProps10(res.data[9].nameData)
this.setTableData10(res.data[9].data)
} }
this.dataListLoading = false this.dataListLoading = false
}) }).catch(()=>{}) //------
}, },
setTableProps(nameData) { setTableProps(nameData) {
this.tableConfigs = [ this.tableConfigs = [
@ -115,6 +266,176 @@ export default {
] ]
// console.log(this.tableConfigs[i]); // console.log(this.tableConfigs[i]);
}, },
setTableProps2(nameData) {
this.tableConfigs2 = [
{
type: 'index',
name: i18n.t('index')
},
{ prop: 'time', name: this.$t('ti'), filter: timeFilter },
{ prop: 'plcCode', name: this.$t('plcCode') },
// { prop: 'equName', name: this.$t('equName') },
// { prop: 'equCode', name: this.$t('equCode') },
// ...['1', '2', '3'].map(name => {
// return { prop: name, name }
// })
...Array.from(new Set(nameData.map((item) => item.name))).map((name) => ({ prop: name, name }))
]
// console.log(this.tableConfigs[i]);
},
setTableProps3(nameData) {
this.tableConfigs3 = [
{
type: 'index',
name: i18n.t('index')
},
{ prop: 'time', name: this.$t('ti'), filter: timeFilter },
{ prop: 'plcCode', name: this.$t('plcCode') },
// { prop: 'equName', name: this.$t('equName') },
// { prop: 'equCode', name: this.$t('equCode') },
// ...['1', '2', '3'].map(name => {
// return { prop: name, name }
// })
...Array.from(new Set(nameData.map((item) => item.name))).map((name) => ({ prop: name, name }))
]
// console.log(this.tableConfigs[i]);
},
setTableProps3(nameData) {
this.tableConfigs3 = [
{
type: 'index',
name: i18n.t('index')
},
{ prop: 'time', name: this.$t('ti'), filter: timeFilter },
{ prop: 'plcCode', name: this.$t('plcCode') },
// { prop: 'equName', name: this.$t('equName') },
// { prop: 'equCode', name: this.$t('equCode') },
// ...['1', '2', '3'].map(name => {
// return { prop: name, name }
// })
...Array.from(new Set(nameData.map((item) => item.name))).map((name) => ({ prop: name, name }))
]
// console.log(this.tableConfigs[i]);
},
setTableProps4(nameData) {
this.tableConfigs4 = [
{
type: 'index',
name: i18n.t('index')
},
{ prop: 'time', name: this.$t('ti'), filter: timeFilter },
{ prop: 'plcCode', name: this.$t('plcCode') },
// { prop: 'equName', name: this.$t('equName') },
// { prop: 'equCode', name: this.$t('equCode') },
// ...['1', '2', '3'].map(name => {
// return { prop: name, name }
// })
...Array.from(new Set(nameData.map((item) => item.name))).map((name) => ({ prop: name, name }))
]
// console.log(this.tableConfigs[i]);
},
setTableProps5(nameData) {
this.tableConfigs5 = [
{
type: 'index',
name: i18n.t('index')
},
{ prop: 'time', name: this.$t('ti'), filter: timeFilter },
{ prop: 'plcCode', name: this.$t('plcCode') },
// { prop: 'equName', name: this.$t('equName') },
// { prop: 'equCode', name: this.$t('equCode') },
// ...['1', '2', '3'].map(name => {
// return { prop: name, name }
// })
...Array.from(new Set(nameData.map((item) => item.name))).map((name) => ({ prop: name, name }))
]
// console.log(this.tableConfigs[i]);
},
setTableProps6(nameData) {
this.tableConfigs6 = [
{
type: 'index',
name: i18n.t('index')
},
{ prop: 'time', name: this.$t('ti'), filter: timeFilter },
{ prop: 'plcCode', name: this.$t('plcCode') },
// { prop: 'equName', name: this.$t('equName') },
// { prop: 'equCode', name: this.$t('equCode') },
// ...['1', '2', '3'].map(name => {
// return { prop: name, name }
// })
...Array.from(new Set(nameData.map((item) => item.name))).map((name) => ({ prop: name, name }))
]
// console.log(this.tableConfigs[i]);
},
setTableProps7(nameData) {
this.tableConfigs7 = [
{
type: 'index',
name: i18n.t('index')
},
{ prop: 'time', name: this.$t('ti'), filter: timeFilter },
{ prop: 'plcCode', name: this.$t('plcCode') },
// { prop: 'equName', name: this.$t('equName') },
// { prop: 'equCode', name: this.$t('equCode') },
// ...['1', '2', '3'].map(name => {
// return { prop: name, name }
// })
...Array.from(new Set(nameData.map((item) => item.name))).map((name) => ({ prop: name, name }))
]
// console.log(this.tableConfigs[i]);
},
setTableProps8(nameData) {
this.tableConfigs8 = [
{
type: 'index',
name: i18n.t('index')
},
{ prop: 'time', name: this.$t('ti'), filter: timeFilter },
{ prop: 'plcCode', name: this.$t('plcCode') },
// { prop: 'equName', name: this.$t('equName') },
// { prop: 'equCode', name: this.$t('equCode') },
// ...['1', '2', '3'].map(name => {
// return { prop: name, name }
// })
...Array.from(new Set(nameData.map((item) => item.name))).map((name) => ({ prop: name, name }))
]
// console.log(this.tableConfigs[i]);
},
setTableProps9(nameData) {
this.tableConfigs9 = [
{
type: 'index',
name: i18n.t('index')
},
{ prop: 'time', name: this.$t('ti'), filter: timeFilter },
{ prop: 'plcCode', name: this.$t('plcCode') },
// { prop: 'equName', name: this.$t('equName') },
// { prop: 'equCode', name: this.$t('equCode') },
// ...['1', '2', '3'].map(name => {
// return { prop: name, name }
// })
...Array.from(new Set(nameData.map((item) => item.name))).map((name) => ({ prop: name, name }))
]
// console.log(this.tableConfigs[i]);
},
setTableProps10(nameData) {
this.tableConfigs10 = [
{
type: 'index',
name: i18n.t('index')
},
{ prop: 'time', name: this.$t('ti'), filter: timeFilter },
{ prop: 'plcCode', name: this.$t('plcCode') },
// { prop: 'equName', name: this.$t('equName') },
// { prop: 'equCode', name: this.$t('equCode') },
// ...['1', '2', '3'].map(name => {
// return { prop: name, name }
// })
...Array.from(new Set(nameData.map((item) => item.name))).map((name) => ({ prop: name, name }))
]
// console.log(this.tableConfigs[i]);
},
setTableData(data) { setTableData(data) {
this.dataList = data.map((item) => { this.dataList = data.map((item) => {
const rowItem = pick(item, ['time', 'plcCode', 'equName', 'equCode']) const rowItem = pick(item, ['time', 'plcCode', 'equName', 'equCode'])
@ -125,6 +446,105 @@ export default {
} }
return rowItem return rowItem
}) })
},
setTableData2(data) {
this.dataList2 = data.map((item) => {
const rowItem = pick(item, ['time', 'plcCode', 'equName', 'equCode'])
if (item.data && item.data.length > 0) {
item.data.forEach((param) => {
rowItem[param.dynamicName] = param.dynamicValue
})
}
return rowItem
})
},
setTableData3(data) {
this.dataList3 = data.map((item) => {
const rowItem = pick(item, ['time', 'plcCode', 'equName', 'equCode'])
if (item.data && item.data.length > 0) {
item.data.forEach((param) => {
rowItem[param.dynamicName] = param.dynamicValue
})
}
return rowItem
})
},
setTableData4(data) {
this.dataList4 = data.map((item) => {
const rowItem = pick(item, ['time', 'plcCode', 'equName', 'equCode'])
if (item.data && item.data.length > 0) {
item.data.forEach((param) => {
rowItem[param.dynamicName] = param.dynamicValue
})
}
return rowItem
})
},
setTableData5(data) {
this.dataList5 = data.map((item) => {
const rowItem = pick(item, ['time', 'plcCode', 'equName', 'equCode'])
if (item.data && item.data.length > 0) {
item.data.forEach((param) => {
rowItem[param.dynamicName] = param.dynamicValue
})
}
return rowItem
})
},
setTableData6(data) {
this.dataList6 = data.map((item) => {
const rowItem = pick(item, ['time', 'plcCode', 'equName', 'equCode'])
if (item.data && item.data.length > 0) {
item.data.forEach((param) => {
rowItem[param.dynamicName] = param.dynamicValue
})
}
return rowItem
})
},
setTableData7(data) {
this.dataList7 = data.map((item) => {
const rowItem = pick(item, ['time', 'plcCode', 'equName', 'equCode'])
if (item.data && item.data.length > 0) {
item.data.forEach((param) => {
rowItem[param.dynamicName] = param.dynamicValue
})
}
return rowItem
})
},
setTableData8(data) {
this.dataList8 = data.map((item) => {
const rowItem = pick(item, ['time', 'plcCode', 'equName', 'equCode'])
if (item.data && item.data.length > 0) {
item.data.forEach((param) => {
rowItem[param.dynamicName] = param.dynamicValue
})
}
return rowItem
})
},
setTableData9(data) {
this.dataList9 = data.map((item) => {
const rowItem = pick(item, ['time', 'plcCode', 'equName', 'equCode'])
if (item.data && item.data.length > 0) {
item.data.forEach((param) => {
rowItem[param.dynamicName] = param.dynamicValue
})
}
return rowItem
})
},
setTableData10(data) {
this.dataList10 = data.map((item) => {
const rowItem = pick(item, ['time', 'plcCode', 'equName', 'equCode'])
if (item.data && item.data.length > 0) {
item.data.forEach((param) => {
rowItem[param.dynamicName] = param.dynamicValue
})
}
return rowItem
})
} }
} }
} }

View File

@ -4,9 +4,8 @@
:title="isDetail ? $t('ws.detail') : !dataForm.id ? $t('add') : $t('edit')" :title="isDetail ? $t('ws.detail') : !dataForm.id ? $t('add') : $t('edit')"
:visible.sync="visible" :visible.sync="visible"
:close-on-click-modal="false" :close-on-click-modal="false"
:destroy-on-close="true" :destroy-on-close="true">
> <div style="max-height: 60vh; overflow-y: scroll; overflow-x: hidden">
<div style="max-height: 60vh; overflow-y: scroll; overflow-x: hidden;">
<el-form ref="dataForm" :model="dataForm" :rules="dataFormRules"> <el-form ref="dataForm" :model="dataForm" :rules="dataFormRules">
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="12" <el-col :span="12"
@ -49,8 +48,7 @@
:table-head-configs="tableProps" :table-head-configs="tableProps"
:max-height="calcMaxHeight(8)" :max-height="calcMaxHeight(8)"
@operate-event="handleOperations" @operate-event="handleOperations"
@refreshDataList="getDataList" @refreshDataList="getDataList" />
/>
<el-pagination <el-pagination
@size-change="sizeChangeHandle" @size-change="sizeChangeHandle"
@current-change="currentChangeHandle" @current-change="currentChangeHandle"
@ -58,16 +56,31 @@
:page-sizes="[5, 10, 15, 20]" :page-sizes="[5, 10, 15, 20]"
:page-size="limit" :page-size="limit"
:total="eqTotal" :total="eqTotal"
layout="total, sizes, prev, pager, next, jumper" layout="total, sizes, prev, pager, next, jumper" />
/>
</div> </div>
<attr-form v-else ref="AttrFrom" :workshop-section-id="dataForm.id" @close-attr-form="showAttrForm = false" @refresh-list="handleRefreshList" /> <attr-form v-else ref="AttrFrom" :workshop-section-id="dataForm.id" @close-attr-form="showAttrForm = false" @refresh-list="handleRefreshList" />
</section> </section>
</div> </div>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button @click="handleClick({ name: 'cancel' })">{{ $t('cancel') }}</el-button> <el-button @click="handleClick({ name: 'cancel' })">{{ $t('cancel') }}</el-button>
<el-button type="primary" v-if="dataForm.id" @click="handleClick({ name: 'update' })">{{ $t('update') }}</el-button> <el-button
<el-button type="success" v-else @click="handleClick({ name: 'save' })">{{ $t('save') }}</el-button> :style="{
backgroundColor: '#0b58ff',
color: '#fff'
}"
v-if="dataForm.id"
@click="handleClick({ name: 'update' })"
>{{ $t('update') }}</el-button
>
<el-button
:style="{
backgroundColor: '#0b58ff',
color: '#fff'
}"
v-else
@click="handleClick({ name: 'save' })"
>{{ $t('save') }}</el-button
>
</span> </span>
</el-dialog> </el-dialog>
</template> </template>
@ -292,7 +305,7 @@ export default {
} }
}, },
handleCreateOrUpdate() { handleCreateOrUpdate() {
this.$refs['dataForm'].validate(valid => { this.$refs['dataForm'].validate((valid) => {
if (valid) { if (valid) {
this.$http({ this.$http({
url: this.$http.adornUrl('/monitoring/workshopSection'), url: this.$http.adornUrl('/monitoring/workshopSection'),