lb #1
@@ -9,42 +9,7 @@
 | 
			
		||||
				<el-button v-if="$hasPermission('monitoring:equipmenplcparam:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
 | 
			
		||||
			</el-form-item>
 | 
			
		||||
		</el-form>
 | 
			
		||||
		<!-- <el-table :data="dataList" border v-loading="dataListLoading" @selection-change="selectionChangeHandle" style="width: 100%;">
 | 
			
		||||
			<el-table-column type="selection" header-align="center" align="center" width="50"> </el-table-column>
 | 
			
		||||
			<el-table-column prop="id" header-align="center" align="center" label="ID"> </el-table-column>
 | 
			
		||||
			<el-table-column prop="plcConId" header-align="center" align="center" label="plc连接表ID"> </el-table-column>
 | 
			
		||||
			<el-table-column prop="type" header-align="center" align="center" label="类型:status、data、constant"> </el-table-column>
 | 
			
		||||
			<el-table-column prop="paramCode" header-align="center" align="center" label="参数编码"> </el-table-column>
 | 
			
		||||
			<el-table-column prop="paramName" header-align="center" align="center" label="参数名称"> </el-table-column>
 | 
			
		||||
			<el-table-column prop="paramAddress" header-align="center" align="center" label="参数地址,对应实时数据库表的列名"> </el-table-column>
 | 
			
		||||
			<el-table-column prop="valueType" header-align="center" align="center" label="参数值类型:int、long、boolean、string、list 暂不使用"> </el-table-column>
 | 
			
		||||
			<el-table-column prop="unitDictValue" header-align="center" align="center" label="单位 关联数据字典表label_value"> </el-table-column>
 | 
			
		||||
			<el-table-column prop="minValue" header-align="center" align="center" label="最小值"> </el-table-column>
 | 
			
		||||
			<el-table-column prop="maxValue" header-align="center" align="center" label="最大值"> </el-table-column>
 | 
			
		||||
			<el-table-column prop="defaultValue" header-align="center" align="center" label="参数设定标准值"> </el-table-column>
 | 
			
		||||
			<el-table-column prop="description" header-align="center" align="center" label="描述"> </el-table-column>
 | 
			
		||||
			<el-table-column prop="enabled" header-align="center" align="center" label="启用状态:0 、停用,1、启用"> </el-table-column>
 | 
			
		||||
			<el-table-column prop="remark" header-align="center" align="center" label="备注"> </el-table-column>
 | 
			
		||||
			<el-table-column prop="valid" header-align="center" align="center" label="删除标志,是否有效:1 可用 0不可用"> </el-table-column>
 | 
			
		||||
			<el-table-column prop="creatorId" header-align="center" align="center" label="创建人"> </el-table-column>
 | 
			
		||||
			<el-table-column prop="creatorName" header-align="center" align="center" label="创建人姓名"> </el-table-column>
 | 
			
		||||
			<el-table-column prop="createTime" header-align="center" align="center" label="创建时间"> </el-table-column>
 | 
			
		||||
			<el-table-column prop="updaterId" header-align="center" align="center" label="更新人"> </el-table-column>
 | 
			
		||||
			<el-table-column prop="updaterName" header-align="center" align="center" label="更新人姓名"> </el-table-column>
 | 
			
		||||
			<el-table-column prop="updateTime" header-align="center" align="center" label="更新时间"> </el-table-column>
 | 
			
		||||
			<el-table-column prop="version" header-align="center" align="center" label="版本号"> </el-table-column>
 | 
			
		||||
			<el-table-column prop="collection" header-align="center" align="center" label="0 代表不采集, 1 代表采集"> </el-table-column>
 | 
			
		||||
			<el-table-column prop="collectionCycle" header-align="center" align="center" label="采集周期(s) 暂不使用"> </el-table-column>
 | 
			
		||||
			<el-table-column prop="reportingCycle" header-align="center" align="center" label="上报周期(s) 暂不使用"> </el-table-column>
 | 
			
		||||
			<el-table-column prop="reportingMethod" header-align="center" align="center" label="上报方式 暂不使用"> </el-table-column>
 | 
			
		||||
			<el-table-column prop="reportingCode" header-align="center" align="center" label="上报编码 暂不使用"> </el-table-column>
 | 
			
		||||
			<el-table-column fixed="right" header-align="center" align="center" width="150" label="操作">
 | 
			
		||||
				<template slot-scope="scope">
 | 
			
		||||
					<el-button type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">修改</el-button>
 | 
			
		||||
					<el-button type="text" size="small" @click="deleteHandle(scope.row.id)">删除</el-button>
 | 
			
		||||
				</template>
 | 
			
		||||
			</el-table-column>
 | 
			
		||||
		</el-table> -->
 | 
			
		||||
 | 
			
		||||
		<base-table :data="dataList" :table-head-configs="tableConfigs" :max-height="500" />
 | 
			
		||||
		<el-pagination
 | 
			
		||||
			@size-change="sizeChangeHandle"
 | 
			
		||||
@@ -64,8 +29,11 @@
 | 
			
		||||
<script>
 | 
			
		||||
import AddOrUpdate from './equipmentPlcParam-add-or-update'
 | 
			
		||||
import BaseTable from '@/components/base-table'
 | 
			
		||||
import TableOperateComponent from '@/components/base-table/components/operationComponent'
 | 
			
		||||
import TableTextComponent from '@/components/base-table/components/detailComponent'
 | 
			
		||||
// import TableOperateComponent from '@/components/base-table/components/operationComponent'
 | 
			
		||||
// import TableTextComponent from '@/components/base-table/components/detailComponent'
 | 
			
		||||
import { dictFilter } from '@/utils/filters'
 | 
			
		||||
 | 
			
		||||
const UnitDictTypeId = '1557173812109242370'
 | 
			
		||||
 | 
			
		||||
const tableConfigs = [
 | 
			
		||||
	{ type: 'index', name: '序号' },
 | 
			
		||||
@@ -73,20 +41,21 @@ const tableConfigs = [
 | 
			
		||||
	{ prop: 'paramCode', name: '参数编码' },
 | 
			
		||||
	{ prop: 'paramName', name: '参数名称' },
 | 
			
		||||
	{ prop: 'paramAddress', name: '参数地址' },
 | 
			
		||||
	{ prop: 'unitDictValue', name: '单位' },
 | 
			
		||||
	{ prop: 'unitDictValue', name: '单位', filter: dictFilter(UnitDictTypeId) },
 | 
			
		||||
	{ prop: 'minValue', name: '最小值' },
 | 
			
		||||
	{ prop: 'maxValue', name: '最大值' },
 | 
			
		||||
	{ prop: 'defaultValue', name: '参数设定标准值' },
 | 
			
		||||
	{ prop: 'description', name: '描述' },
 | 
			
		||||
	{ prop: 'enabled', name: '启用状态:0 、停用,1、启用' },
 | 
			
		||||
	{ prop: 'enabled', name: '启用状态', filter: val => ['停用', '启用'][+val] },
 | 
			
		||||
	// { prop: 'enabled', name: '启用状态:0 、停用,1、启用' },
 | 
			
		||||
	{ prop: 'remark', name: '备注' },
 | 
			
		||||
	// { prop: 'createTime', name: '添加时间' },
 | 
			
		||||
	{ prop: 'collection', name: '0 代表不采集, 1 代表采集' },
 | 
			
		||||
	{ prop: 'collection', name: '是否采集', filter: val => ['不采集', '采集'][+val] }
 | 
			
		||||
	// { prop: 'collectionCycle', name: '采集周期(s) 暂不使用' },
 | 
			
		||||
	// { prop: 'reportingCycle', name: '上报周期(s) 暂不使用' },
 | 
			
		||||
	// { prop: 'reportingMethod', name: '上报方式 暂不使用' },
 | 
			
		||||
	// { prop: 'reportingCode', name: '上报编码 暂不使用' },
 | 
			
		||||
	{ prop: 'operations', name: '操作', fixed: 'right', width: 180, subcomponent: TableOperateComponent, options: ['edit', 'delete'] }
 | 
			
		||||
	// { prop: 'operations', name: '操作', fixed: 'right', width: 180, subcomponent: TableOperateComponent, options: ['edit', 'delete'] }
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
 
 | 
			
		||||
@@ -22,13 +22,13 @@
 | 
			
		||||
		>
 | 
			
		||||
		</el-pagination>
 | 
			
		||||
		<!-- 弹窗, 新增 / 修改 -->
 | 
			
		||||
		<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" :configs="addOrUpdateConfigs" @refreshDataList="getDataList" @destory-dialog="addOrUpdateVisible = false" />
 | 
			
		||||
		<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList" @destory-dialog="addOrUpdateVisible = false" />
 | 
			
		||||
	</div>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<script>
 | 
			
		||||
import AddOrUpdate from '@/components/base-dialog/addOrUpdate'
 | 
			
		||||
// import AddOrUpdate from './workshopSection-add-or-update'
 | 
			
		||||
// import AddOrUpdate from '@/components/base-dialog/addOrUpdate'
 | 
			
		||||
import AddOrUpdate from './workshopSectionDialog.vue'
 | 
			
		||||
import BaseTable from '@/components/base-table'
 | 
			
		||||
import TableOperateComponent from '@/components/base-table/components/operationComponent'
 | 
			
		||||
import TableTextComponent from '@/components/base-table/components/detailComponent'
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										266
									
								
								src/views/modules/monitoring/workshopSectionDialog.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										266
									
								
								src/views/modules/monitoring/workshopSectionDialog.vue
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,266 @@
 | 
			
		||||
<template>
 | 
			
		||||
	<el-dialog class="super-flexible-dialog" :title="isDetail ? '详情' : !dataForm.id ? '新增' : '编辑'" :visible.sync="visible" @close="handleClose">
 | 
			
		||||
		<div style="max-height: 60vh; overflow-y: scroll; overflow-x: hidden;">
 | 
			
		||||
			<el-form ref="dataForm" :model="dataForm" :rules="dataFormRules">
 | 
			
		||||
				<el-row :gutter="20">
 | 
			
		||||
					<el-col :span="12"
 | 
			
		||||
						><el-form-item label="工段名称" prop="name"> <el-input v-model="dataForm.name" placeholder="请输入工段名称" /> </el-form-item
 | 
			
		||||
					></el-col>
 | 
			
		||||
					<el-col :span="12"
 | 
			
		||||
						><el-form-item label="工段编码" prop="code"> <el-input v-model="dataForm.code" placeholder="请输入工段编码" /> </el-form-item
 | 
			
		||||
					></el-col>
 | 
			
		||||
				</el-row>
 | 
			
		||||
 | 
			
		||||
				<el-row :gutter="20">
 | 
			
		||||
					<el-col :span="12"
 | 
			
		||||
						><el-form-item label="所属产线" prop="productionLineId">
 | 
			
		||||
							<el-select v-model="dataForm.productionLineId" placeholder="请输入所属产线">
 | 
			
		||||
								<el-option v-for="line in lineList" :key="line.id" :value="line.id" :label="line.name" />
 | 
			
		||||
							</el-select> </el-form-item
 | 
			
		||||
					></el-col>
 | 
			
		||||
					<el-col :span="12"
 | 
			
		||||
						><el-form-item label="描述" prop="description"> <el-input v-model="dataForm.description" placeholder="请输入描述" /> </el-form-item
 | 
			
		||||
					></el-col>
 | 
			
		||||
				</el-row>
 | 
			
		||||
 | 
			
		||||
				<el-row :gutter="20">
 | 
			
		||||
					<el-col :span="12"
 | 
			
		||||
						><el-form-item label="备注" prop="remark"> <el-input v-model="dataForm.remark" placeholder="请输入备注" /> </el-form-item
 | 
			
		||||
					></el-col>
 | 
			
		||||
				</el-row>
 | 
			
		||||
			</el-form>
 | 
			
		||||
 | 
			
		||||
			<div class="table" v-if="dataForm.id && !showAttrForm">
 | 
			
		||||
				<h3>设备绑定 <el-button type="text" @click="addEq">新增</el-button></h3>
 | 
			
		||||
				<base-table :data="eqList" :table-head-configs="tableProps" :max-height="500" @operate-event="handleOperations" @refreshDataList="getDataList" />
 | 
			
		||||
 | 
			
		||||
				<el-pagination
 | 
			
		||||
					@size-change="sizeChangeHandle"
 | 
			
		||||
					@current-change="currentChangeHandle"
 | 
			
		||||
					:current-page="page"
 | 
			
		||||
					:page-sizes="[5, 10, 15, 20]"
 | 
			
		||||
					:page-size="limit"
 | 
			
		||||
					:total="eqTotal"
 | 
			
		||||
					layout="total, sizes, prev, pager, next, jumper"
 | 
			
		||||
				/>
 | 
			
		||||
			</div>
 | 
			
		||||
			<attr-form v-if="showAttrForm" />
 | 
			
		||||
		</div>
 | 
			
		||||
		<span slot="footer" class="dialog-footer">
 | 
			
		||||
			<el-button @click="handleClick({ name: 'cancel' })">返回</el-button>
 | 
			
		||||
			<el-button v-if="dataForm.id" @click="handleClick({ name: 'update' })">更新</el-button>
 | 
			
		||||
			<el-button v-else @click="handleClick({ name: 'save' })">保存</el-button>
 | 
			
		||||
		</span>
 | 
			
		||||
	</el-dialog>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<script>
 | 
			
		||||
import BaseTable from '@/components/base-table'
 | 
			
		||||
import SmallTitle from '@/components/small-title'
 | 
			
		||||
import { pick } from 'lodash/object'
 | 
			
		||||
import TableOperateComponent from '@/components/base-table/components/operationComponent'
 | 
			
		||||
 | 
			
		||||
const AttrForm = {
 | 
			
		||||
	name: 'AttrForm',
 | 
			
		||||
	props: ['workshopSectionId'],
 | 
			
		||||
	data() {
 | 
			
		||||
		return {
 | 
			
		||||
			dataForm: {
 | 
			
		||||
				id: '',
 | 
			
		||||
				equipmentId: null
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	},
 | 
			
		||||
	methods: {
 | 
			
		||||
		getEqList() {},
 | 
			
		||||
		handleCancel() {},
 | 
			
		||||
		handleSave() {}
 | 
			
		||||
	},
 | 
			
		||||
	template: `
 | 
			
		||||
    <div class="" style="background: #eee; border-radius: 8px; padding: 8px;">
 | 
			
		||||
      <el-row>
 | 
			
		||||
        <el-form ref="dataForm">
 | 
			
		||||
          <el-form-item :prop>
 | 
			
		||||
          </el-form>
 | 
			
		||||
        </el-row>
 | 
			
		||||
        <el-row style="text-align: right">
 | 
			
		||||
            <el-button size="small" @click="handleCancel">取消</el-button>
 | 
			
		||||
            <el-button size="small" type="success" @click="handleSave">保存</el-button>
 | 
			
		||||
        </el-row>
 | 
			
		||||
    </div>
 | 
			
		||||
  `,
 | 
			
		||||
	render: function(h) {
 | 
			
		||||
    var self = this
 | 
			
		||||
		return h('div', { style: { background: '#eee', borderRadius: '8px', padding: '8px' } }, [
 | 
			
		||||
			h('el-row', null,
 | 
			
		||||
        h('el-form', { ref: 'dataForm' },
 | 
			
		||||
          h('el-form-item', { props: { label: '设备名', prop: 'equipmentId' } },
 | 
			
		||||
            h('el-input', { domProps: { value: self.dataForm.equipmentId } })
 | 
			
		||||
      ),
 | 
			
		||||
			h('el-row', null, [])
 | 
			
		||||
		])
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const tableProps = [
 | 
			
		||||
	{ name: '设备名', prop: 'equipmentName' },
 | 
			
		||||
	{ name: '排序', prop: 'sort' },
 | 
			
		||||
	{ name: '操作', prop: 'operations', fixed: 'right', width: 180, subcomponent: TableOperateComponent, options: ['edit', 'delete'] }
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
	name: 'WorkshopDialog',
 | 
			
		||||
	components: { BaseTable, SmallTitle, AttrForm },
 | 
			
		||||
	data() {
 | 
			
		||||
		return {
 | 
			
		||||
			visible: false,
 | 
			
		||||
			isDetail: false,
 | 
			
		||||
			tableProps,
 | 
			
		||||
			lineList: [],
 | 
			
		||||
			eqList: [],
 | 
			
		||||
			eqTotal: 0,
 | 
			
		||||
			dataForm: {
 | 
			
		||||
				id: null,
 | 
			
		||||
				// 工段名称
 | 
			
		||||
				name: '',
 | 
			
		||||
				// 工段编码
 | 
			
		||||
				code: '',
 | 
			
		||||
				// 所属产线
 | 
			
		||||
				productionLineId: null,
 | 
			
		||||
				// 描述
 | 
			
		||||
				description: '',
 | 
			
		||||
				// 备注
 | 
			
		||||
				remark: ''
 | 
			
		||||
			},
 | 
			
		||||
			limit: 5,
 | 
			
		||||
			page: 1,
 | 
			
		||||
			dataFormRules: {},
 | 
			
		||||
			showAttrForm: false
 | 
			
		||||
		}
 | 
			
		||||
	},
 | 
			
		||||
	mounted() {
 | 
			
		||||
		this.getLineList()
 | 
			
		||||
	},
 | 
			
		||||
	methods: {
 | 
			
		||||
		init(id) {
 | 
			
		||||
			this.dataForm = {
 | 
			
		||||
				id: null,
 | 
			
		||||
				name: '',
 | 
			
		||||
				code: '',
 | 
			
		||||
				productionLineId: null,
 | 
			
		||||
				description: '',
 | 
			
		||||
				remark: ''
 | 
			
		||||
			}
 | 
			
		||||
			this.showAttrForm = false
 | 
			
		||||
			this.dataForm.id = id
 | 
			
		||||
			// this.isDetail = !!id
 | 
			
		||||
 | 
			
		||||
			this.$nextTick(() => {
 | 
			
		||||
				if (id) {
 | 
			
		||||
					// 编辑
 | 
			
		||||
					this.$http({
 | 
			
		||||
						url: this.$http.adornUrl('/monitoring/workshopSection/' + this.dataForm.id),
 | 
			
		||||
						method: 'get'
 | 
			
		||||
					}).then(({ data: res }) => {
 | 
			
		||||
						if (res.data) {
 | 
			
		||||
							const { name, code, productionLineId, description, remark } = res.data
 | 
			
		||||
							this.dataForm.name = name
 | 
			
		||||
							this.dataForm.code = code
 | 
			
		||||
							this.dataForm.productionLineId = productionLineId
 | 
			
		||||
							this.dataForm.description = description
 | 
			
		||||
							this.dataForm.remark = remark
 | 
			
		||||
						}
 | 
			
		||||
					})
 | 
			
		||||
					// 获取list
 | 
			
		||||
					this.getDataList()
 | 
			
		||||
				} else {
 | 
			
		||||
					this.getWsCode()
 | 
			
		||||
				}
 | 
			
		||||
			})
 | 
			
		||||
 | 
			
		||||
			this.visible = true
 | 
			
		||||
		},
 | 
			
		||||
		getWsCode() {
 | 
			
		||||
			this.$http({
 | 
			
		||||
				url: this.$http.adornUrl('/monitoring/workshopSection/getCode'),
 | 
			
		||||
				method: 'post'
 | 
			
		||||
			}).then(({ data: res }) => {
 | 
			
		||||
				if (res.data) {
 | 
			
		||||
					this.dataForm.code = res.data
 | 
			
		||||
				}
 | 
			
		||||
			})
 | 
			
		||||
		},
 | 
			
		||||
		getLineList() {
 | 
			
		||||
			this.$http({
 | 
			
		||||
				url: this.$http.adornUrl('/monitoring/productionLine/list'),
 | 
			
		||||
				method: 'get'
 | 
			
		||||
			}).then(({ data: res }) => {
 | 
			
		||||
				if (res.data) {
 | 
			
		||||
					this.lineList = res.data
 | 
			
		||||
				} else {
 | 
			
		||||
					this.lineList.splice(0)
 | 
			
		||||
				}
 | 
			
		||||
			})
 | 
			
		||||
		},
 | 
			
		||||
		getDataList() {
 | 
			
		||||
			// 获取设备关联表
 | 
			
		||||
			this.$http({
 | 
			
		||||
				url: this.$http.adornUrl('/monitoring/workshopSectionEquipment'),
 | 
			
		||||
				method: 'get',
 | 
			
		||||
				params: this.$http.adornParams({
 | 
			
		||||
					limit: this.limit,
 | 
			
		||||
					page: this.page,
 | 
			
		||||
					id: this.dataForm.id
 | 
			
		||||
				})
 | 
			
		||||
			}).then(({ data: res }) => {
 | 
			
		||||
				if (res.data && res.data.list) {
 | 
			
		||||
					this.eqList = res.data.list
 | 
			
		||||
					this.eqTotal = res.data.total
 | 
			
		||||
				} else {
 | 
			
		||||
					this.eqList.splice(0)
 | 
			
		||||
					this.eqTotal = 0
 | 
			
		||||
				}
 | 
			
		||||
			})
 | 
			
		||||
		},
 | 
			
		||||
		// 每页数
 | 
			
		||||
		sizeChangeHandle(val) {
 | 
			
		||||
			this.limit = val
 | 
			
		||||
			this.page = 1
 | 
			
		||||
			this.getDataList()
 | 
			
		||||
		},
 | 
			
		||||
		// 当前页
 | 
			
		||||
		currentChangeHandle(val) {
 | 
			
		||||
			this.page = val
 | 
			
		||||
			this.getDataList()
 | 
			
		||||
		},
 | 
			
		||||
		addEq() {
 | 
			
		||||
			this.showAttrForm = true
 | 
			
		||||
		},
 | 
			
		||||
		handleOperations() {},
 | 
			
		||||
		handleClose() {}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
</script>
 | 
			
		||||
 | 
			
		||||
<style scoped>
 | 
			
		||||
.super-flexible-dialog >>> .el-select,
 | 
			
		||||
.super-flexible-dialog >>> .el-cascader {
 | 
			
		||||
	width: 100%;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.super-flexible-dialog >>> ::-webkit-scrollbar {
 | 
			
		||||
	width: 4px;
 | 
			
		||||
	border-radius: 4px;
 | 
			
		||||
	background: #fff;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.super-flexible-dialog >>> ::-webkit-scrollbar-thumb {
 | 
			
		||||
	width: 4px;
 | 
			
		||||
	border-radius: 4px;
 | 
			
		||||
	background: #ccc;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.super-flexible-dialog >>> .hidden-input {
 | 
			
		||||
	display: none;
 | 
			
		||||
}
 | 
			
		||||
</style>
 | 
			
		||||
		Reference in New Issue
	
	Block a user