lb #19
							
								
								
									
										78
									
								
								src/views/base/equipmentPlcConnect/http.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										78
									
								
								src/views/base/equipmentPlcConnect/http.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,78 @@
 | 
				
			|||||||
 | 
					import Mock from 'mockjs';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const baseURL = 'http://192.168.1.49:48080/admin-api';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Mock.setup({
 | 
				
			||||||
 | 
						timeout: 200,
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// @database
 | 
				
			||||||
 | 
					const list = Mock.mock({
 | 
				
			||||||
 | 
						'data|1-10': [
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								'id|+1': 1,
 | 
				
			||||||
 | 
								productionLine: (options) => {
 | 
				
			||||||
 | 
									// console.log('otpsion', options.context.currentContext);
 | 
				
			||||||
 | 
									return `EQ${options.context.currentContext.id}`;
 | 
				
			||||||
 | 
								},
 | 
				
			||||||
 | 
								workshopSection: ({ context: { currentContext } }) =>
 | 
				
			||||||
 | 
									`EQ${currentContext.id}_WS${Mock.Random.integer(1, 10)}`,
 | 
				
			||||||
 | 
								equipmentName: ({ context: { currentContext } }) =>
 | 
				
			||||||
 | 
									`设备${currentContext.id}`,
 | 
				
			||||||
 | 
								equipmentCode: ({ context: { currentContext } }) =>
 | 
				
			||||||
 | 
									`${currentContext.equipmentName}_Code`,
 | 
				
			||||||
 | 
								plcCode: ({ context: { currentContext } }) =>
 | 
				
			||||||
 | 
									`PLC_TABLE_CODE_${currentContext.id}`,
 | 
				
			||||||
 | 
								plcTableName: ({ context: { currentContext } }) =>
 | 
				
			||||||
 | 
									`PLC_TABLE_${currentContext.id}`,
 | 
				
			||||||
 | 
								plcName: ({ context: { currentContext } }) => `PLC_${currentContext.id}`,
 | 
				
			||||||
 | 
								'bindingParameters|1-10': 1,
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
						],
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// @page
 | 
				
			||||||
 | 
					Mock.mock(
 | 
				
			||||||
 | 
						RegExp(baseURL + '/base/equipment-plc-connect/page' + '.*'),
 | 
				
			||||||
 | 
						'get',
 | 
				
			||||||
 | 
						(options) => {
 | 
				
			||||||
 | 
							console.log('[Mock url]', options.url, list);
 | 
				
			||||||
 | 
							return {
 | 
				
			||||||
 | 
								code: 0,
 | 
				
			||||||
 | 
								data: {
 | 
				
			||||||
 | 
									list: list.data,
 | 
				
			||||||
 | 
									total: list.data.length,
 | 
				
			||||||
 | 
								},
 | 
				
			||||||
 | 
							};
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// @create
 | 
				
			||||||
 | 
					Mock.mock(baseURL + '/base/equipment-plc-connect/create', 'post', (options) => {
 | 
				
			||||||
 | 
						console.log('options', options);
 | 
				
			||||||
 | 
						const { url, type, body } = options;
 | 
				
			||||||
 | 
						const newItem = JSON.parse(body);
 | 
				
			||||||
 | 
						list.data.push(newItem);
 | 
				
			||||||
 | 
						return {
 | 
				
			||||||
 | 
							code: 0,
 | 
				
			||||||
 | 
							data: null,
 | 
				
			||||||
 | 
							msg: 'success',
 | 
				
			||||||
 | 
						};
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// @update
 | 
				
			||||||
 | 
					Mock.mock(
 | 
				
			||||||
 | 
						baseURL + '/admin-api/base/equipment-plc-connect/update',
 | 
				
			||||||
 | 
						'put',
 | 
				
			||||||
 | 
						(options) => {
 | 
				
			||||||
 | 
							const { url, type, body } = options;
 | 
				
			||||||
 | 
							const { id } = JSON.parse(body);
 | 
				
			||||||
 | 
							const newItem = list.data.find((item) => item.id == id);
 | 
				
			||||||
 | 
							newItem = { ...newItem, ...JSON.parse(body) };
 | 
				
			||||||
 | 
							return {
 | 
				
			||||||
 | 
								code: 0,
 | 
				
			||||||
 | 
								msg: 'success',
 | 
				
			||||||
 | 
								data: null,
 | 
				
			||||||
 | 
							};
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					);
 | 
				
			||||||
@@ -1,209 +1,333 @@
 | 
				
			|||||||
<template>
 | 
					<template>
 | 
				
			||||||
  <div class="app-container">
 | 
						<div class="app-container">
 | 
				
			||||||
 | 
							<!-- 搜索工作栏 -->
 | 
				
			||||||
 | 
							<SearchBar
 | 
				
			||||||
 | 
								:formConfigs="searchBarFormConfig"
 | 
				
			||||||
 | 
								ref="search-bar"
 | 
				
			||||||
 | 
								@headBtnClick="handleSearchBarBtnClick" />
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <!-- 搜索工作栏 -->
 | 
							<!-- 列表 -->
 | 
				
			||||||
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
 | 
							<base-table
 | 
				
			||||||
      <el-form-item label="plc表iD" prop="plcId">
 | 
								:table-props="tableProps"
 | 
				
			||||||
        <el-input v-model="queryParams.plcId" placeholder="请输入plc表iD" clearable @keyup.enter.native="handleQuery"/>
 | 
								:page="queryParams.pageNo"
 | 
				
			||||||
      </el-form-item>
 | 
								:limit="queryParams.pageSize"
 | 
				
			||||||
      <el-form-item label="设备表id" prop="equipmentId">
 | 
								:table-data="list"
 | 
				
			||||||
        <el-input v-model="queryParams.equipmentId" placeholder="请输入设备表id" clearable @keyup.enter.native="handleQuery"/>
 | 
								@emitFun="handleEmitFun">
 | 
				
			||||||
      </el-form-item>
 | 
								<method-btn
 | 
				
			||||||
      <el-form-item>
 | 
									v-if="tableBtn.length"
 | 
				
			||||||
        <el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
 | 
									slot="handleBtn"
 | 
				
			||||||
        <el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
 | 
									label="操作"
 | 
				
			||||||
      </el-form-item>
 | 
									:method-list="tableBtn"
 | 
				
			||||||
    </el-form>
 | 
									@clickBtn="handleTableBtnClick" />
 | 
				
			||||||
 | 
							</base-table>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <!-- 操作工具栏 -->
 | 
							<!-- 分页组件 -->
 | 
				
			||||||
    <el-row :gutter="10" class="mb8">
 | 
							<pagination
 | 
				
			||||||
      <el-col :span="1.5">
 | 
								v-show="total > 0"
 | 
				
			||||||
        <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
 | 
								:total="total"
 | 
				
			||||||
                   v-hasPermi="['base:equipment-plc-connect:create']">新增</el-button>
 | 
								:page.sync="queryParams.pageNo"
 | 
				
			||||||
      </el-col>
 | 
								:limit.sync="queryParams.pageSize"
 | 
				
			||||||
      <el-col :span="1.5">
 | 
								@pagination="getList" />
 | 
				
			||||||
        <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading"
 | 
					 | 
				
			||||||
                   v-hasPermi="['base:equipment-plc-connect:export']">导出</el-button>
 | 
					 | 
				
			||||||
      </el-col>
 | 
					 | 
				
			||||||
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
 | 
					 | 
				
			||||||
    </el-row>
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <!-- 列表 -->
 | 
							<!-- 对话框(添加 / 修改) -->
 | 
				
			||||||
    <el-table v-loading="loading" :data="list">
 | 
							<base-dialog
 | 
				
			||||||
      <el-table-column label="id" align="center" prop="id" />
 | 
								:dialogTitle="title"
 | 
				
			||||||
      <el-table-column label="plc表iD" align="center" prop="plcId" />
 | 
								:dialogVisible="open"
 | 
				
			||||||
      <el-table-column label="设备表id" align="center" prop="equipmentId" />
 | 
								width="700px"
 | 
				
			||||||
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
 | 
								@close="cancel"
 | 
				
			||||||
        <template v-slot="scope">
 | 
								@cancel="cancel"
 | 
				
			||||||
          <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
 | 
								@confirm="submitForm">
 | 
				
			||||||
                     v-hasPermi="['base:equipment-plc-connect:update']">修改</el-button>
 | 
								<DialogForm v-if="open" ref="form" :dataForm="form" :rows="rows" />
 | 
				
			||||||
          <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
 | 
							</base-dialog>
 | 
				
			||||||
                     v-hasPermi="['base:equipment-plc-connect:delete']">删除</el-button>
 | 
						</div>
 | 
				
			||||||
        </template>
 | 
					 | 
				
			||||||
      </el-table-column>
 | 
					 | 
				
			||||||
    </el-table>
 | 
					 | 
				
			||||||
    <!-- 分页组件 -->
 | 
					 | 
				
			||||||
    <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
 | 
					 | 
				
			||||||
                @pagination="getList"/>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    <!-- 对话框(添加 / 修改) -->
 | 
					 | 
				
			||||||
    <el-dialog :title="title" :visible.sync="open" width="500px" v-dialogDrag append-to-body>
 | 
					 | 
				
			||||||
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
 | 
					 | 
				
			||||||
        <el-form-item label="plc表iD" prop="plcId">
 | 
					 | 
				
			||||||
          <el-input v-model="form.plcId" placeholder="请输入plc表iD" />
 | 
					 | 
				
			||||||
        </el-form-item>
 | 
					 | 
				
			||||||
        <el-form-item label="设备表id" prop="equipmentId">
 | 
					 | 
				
			||||||
          <el-input v-model="form.equipmentId" placeholder="请输入设备表id" />
 | 
					 | 
				
			||||||
        </el-form-item>
 | 
					 | 
				
			||||||
      </el-form>
 | 
					 | 
				
			||||||
      <div slot="footer" class="dialog-footer">
 | 
					 | 
				
			||||||
        <el-button type="primary" @click="submitForm">确 定</el-button>
 | 
					 | 
				
			||||||
        <el-button @click="cancel">取 消</el-button>
 | 
					 | 
				
			||||||
      </div>
 | 
					 | 
				
			||||||
    </el-dialog>
 | 
					 | 
				
			||||||
  </div>
 | 
					 | 
				
			||||||
</template>
 | 
					</template>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<script>
 | 
					<script>
 | 
				
			||||||
import { createEquipmentPlcConnect, updateEquipmentPlcConnect, deleteEquipmentPlcConnect, getEquipmentPlcConnect, getEquipmentPlcConnectPage, exportEquipmentPlcConnectExcel } from "@/api/base/equipmentPlcConnect";
 | 
					import {
 | 
				
			||||||
 | 
						createEquipmentPlcConnect,
 | 
				
			||||||
 | 
						updateEquipmentPlcConnect,
 | 
				
			||||||
 | 
						deleteEquipmentPlcConnect,
 | 
				
			||||||
 | 
						getEquipmentPlcConnect,
 | 
				
			||||||
 | 
						getEquipmentPlcConnectPage,
 | 
				
			||||||
 | 
						exportEquipmentPlcConnectExcel,
 | 
				
			||||||
 | 
					} from '@/api/base/equipmentPlcConnect';
 | 
				
			||||||
 | 
					import moment from 'moment';
 | 
				
			||||||
 | 
					import basicPageMixin from '@/mixins/lb/basicPageMixin';
 | 
				
			||||||
 | 
					import './http';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export default {
 | 
					export default {
 | 
				
			||||||
  name: "EquipmentPlcConnect",
 | 
						name: 'EquipmentPlcConnect',
 | 
				
			||||||
  components: {
 | 
						mixins: [basicPageMixin],
 | 
				
			||||||
  },
 | 
						components: {},
 | 
				
			||||||
  data() {
 | 
						data() {
 | 
				
			||||||
    return {
 | 
							return {
 | 
				
			||||||
      // 遮罩层
 | 
								searchBarKeys: ['name', 'plcTableName'],
 | 
				
			||||||
      loading: true,
 | 
								// tableBtn: [
 | 
				
			||||||
      // 导出遮罩层
 | 
								// 	this.$auth.hasPermi('base:equipment-plc:update')
 | 
				
			||||||
      exportLoading: false,
 | 
								// 		? {
 | 
				
			||||||
      // 显示搜索条件
 | 
								// 				type: 'edit',
 | 
				
			||||||
      showSearch: true,
 | 
								// 				btnName: '修改',
 | 
				
			||||||
      // 总条数
 | 
								// 		  }
 | 
				
			||||||
      total: 0,
 | 
								// 		: undefined,
 | 
				
			||||||
      // 设备与实时采集关系表(一对多)列表
 | 
								// 	this.$auth.hasPermi('base:equipment-plc:delete')
 | 
				
			||||||
      list: [],
 | 
								// 		? {
 | 
				
			||||||
      // 弹出层标题
 | 
								// 				type: 'delete',
 | 
				
			||||||
      title: "",
 | 
								// 				btnName: '删除',
 | 
				
			||||||
      // 是否显示弹出层
 | 
								// 		  }
 | 
				
			||||||
      open: false,
 | 
								// 		: undefined,
 | 
				
			||||||
      // 查询参数
 | 
								// ].filter((v) => v),
 | 
				
			||||||
      queryParams: {
 | 
								tableBtn: [
 | 
				
			||||||
        pageNo: 1,
 | 
									{
 | 
				
			||||||
        pageSize: 10,
 | 
										type: 'edit',
 | 
				
			||||||
        plcId: null,
 | 
										btnName: '修改',
 | 
				
			||||||
        equipmentId: null,
 | 
									},
 | 
				
			||||||
      },
 | 
									// {
 | 
				
			||||||
      // 表单参数
 | 
									// 	type: 'params-bind',
 | 
				
			||||||
      form: {},
 | 
									// 	btnName: '参数绑定',
 | 
				
			||||||
      // 表单校验
 | 
									// },
 | 
				
			||||||
      rules: {
 | 
									{
 | 
				
			||||||
        plcId: [{ required: true, message: "plc表iD不能为空", trigger: "blur" }],
 | 
										type: 'delete',
 | 
				
			||||||
        equipmentId: [{ required: true, message: "设备表id不能为空", trigger: "blur" }],
 | 
										btnName: '删除',
 | 
				
			||||||
      }
 | 
									},
 | 
				
			||||||
    };
 | 
								],
 | 
				
			||||||
  },
 | 
								tableProps: [
 | 
				
			||||||
  created() {
 | 
									// {
 | 
				
			||||||
    this.getList();
 | 
									// 	prop: 'createTime',
 | 
				
			||||||
  },
 | 
									// 	label: '添加时间',
 | 
				
			||||||
  methods: {
 | 
									// 	fixed: true,
 | 
				
			||||||
    /** 查询列表 */
 | 
									// 	width: 180,
 | 
				
			||||||
    getList() {
 | 
									// 	filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'),
 | 
				
			||||||
      this.loading = true;
 | 
									// },
 | 
				
			||||||
      // 执行查询
 | 
									{ prop: 'productionLine', label: '产线', align: 'center' },
 | 
				
			||||||
      getEquipmentPlcConnectPage(this.queryParams).then(response => {
 | 
									{ prop: 'workshopSection', label: '工段', align: 'center' },
 | 
				
			||||||
        this.list = response.data.list;
 | 
									{ prop: 'equipmentName', label: '设备名', align: 'center' },
 | 
				
			||||||
        this.total = response.data.total;
 | 
									{ prop: 'equipmentCode', label: '设备编码', align: 'center' },
 | 
				
			||||||
        this.loading = false;
 | 
									{ prop: 'plcCode', label: '关联表编码', align: 'center' },
 | 
				
			||||||
      });
 | 
									{ prop: 'plcTableName', label: '关联表名', align: 'center' },
 | 
				
			||||||
    },
 | 
									{ prop: 'plcName', label: '标识名称', align: 'center' },
 | 
				
			||||||
    /** 取消按钮 */
 | 
									{ prop: 'bindingParameters', label: '绑定参数数量', align: 'center' },
 | 
				
			||||||
    cancel() {
 | 
									{
 | 
				
			||||||
      this.open = false;
 | 
										_action: 'params-bind',
 | 
				
			||||||
      this.reset();
 | 
										label: '查看绑定',
 | 
				
			||||||
    },
 | 
										align: 'center',
 | 
				
			||||||
    /** 表单重置 */
 | 
										subcomponent: {
 | 
				
			||||||
    reset() {
 | 
											props: ['injectData'],
 | 
				
			||||||
      this.form = {
 | 
											render: function (h) {
 | 
				
			||||||
        id: undefined,
 | 
												const _this = this;
 | 
				
			||||||
        plcId: undefined,
 | 
												return h(
 | 
				
			||||||
        equipmentId: undefined,
 | 
													'el-button',
 | 
				
			||||||
      };
 | 
													{
 | 
				
			||||||
      this.resetForm("form");
 | 
														props: { type: 'text' },
 | 
				
			||||||
    },
 | 
														on: {
 | 
				
			||||||
    /** 搜索按钮操作 */
 | 
															click: function () {
 | 
				
			||||||
    handleQuery() {
 | 
																console.log('inejctdata', _this.injectData);
 | 
				
			||||||
      this.queryParams.pageNo = 1;
 | 
																_this.$emit('emitData', {
 | 
				
			||||||
      this.getList();
 | 
																	action: _this.injectData._action,
 | 
				
			||||||
    },
 | 
																	payload: _this.injectData,
 | 
				
			||||||
    /** 重置按钮操作 */
 | 
																});
 | 
				
			||||||
    resetQuery() {
 | 
															},
 | 
				
			||||||
      this.resetForm("queryForm");
 | 
														},
 | 
				
			||||||
      this.handleQuery();
 | 
													},
 | 
				
			||||||
    },
 | 
													'查看绑定'
 | 
				
			||||||
    /** 新增按钮操作 */
 | 
												);
 | 
				
			||||||
    handleAdd() {
 | 
											},
 | 
				
			||||||
      this.reset();
 | 
										},
 | 
				
			||||||
      this.open = true;
 | 
									},
 | 
				
			||||||
      this.title = "添加设备与实时采集关系表(一对多)";
 | 
								],
 | 
				
			||||||
    },
 | 
								searchBarFormConfig: [
 | 
				
			||||||
    /** 修改按钮操作 */
 | 
									{
 | 
				
			||||||
    handleUpdate(row) {
 | 
										type: 'input',
 | 
				
			||||||
      this.reset();
 | 
										label: '设备名',
 | 
				
			||||||
      const id = row.id;
 | 
										placeholder: '请输入设备名',
 | 
				
			||||||
      getEquipmentPlcConnect(id).then(response => {
 | 
										param: 'equipmentId',
 | 
				
			||||||
        this.form = response.data;
 | 
									},
 | 
				
			||||||
        this.open = true;
 | 
									{
 | 
				
			||||||
        this.title = "修改设备与实时采集关系表(一对多)";
 | 
										type: 'input',
 | 
				
			||||||
      });
 | 
										label: '编码',
 | 
				
			||||||
    },
 | 
										placeholder: '请输入编码',
 | 
				
			||||||
    /** 提交按钮 */
 | 
										param: 'plcId',
 | 
				
			||||||
    submitForm() {
 | 
									},
 | 
				
			||||||
      this.$refs["form"].validate(valid => {
 | 
									{
 | 
				
			||||||
        if (!valid) {
 | 
										type: 'button',
 | 
				
			||||||
          return;
 | 
										btnName: '查询',
 | 
				
			||||||
        }
 | 
										name: 'search',
 | 
				
			||||||
        // 修改的提交
 | 
										color: 'primary',
 | 
				
			||||||
        if (this.form.id != null) {
 | 
									},
 | 
				
			||||||
          updateEquipmentPlcConnect(this.form).then(response => {
 | 
									{
 | 
				
			||||||
            this.$modal.msgSuccess("修改成功");
 | 
										type: 'separate',
 | 
				
			||||||
            this.open = false;
 | 
									},
 | 
				
			||||||
            this.getList();
 | 
									{
 | 
				
			||||||
          });
 | 
										// type: this.$auth.hasPermi('base:equipment-plc:create')
 | 
				
			||||||
          return;
 | 
										// 	? 'button'
 | 
				
			||||||
        }
 | 
										// 	: '',
 | 
				
			||||||
        // 添加的提交
 | 
										type: 'button',
 | 
				
			||||||
        createEquipmentPlcConnect(this.form).then(response => {
 | 
										btnName: '新增',
 | 
				
			||||||
          this.$modal.msgSuccess("新增成功");
 | 
										name: 'add',
 | 
				
			||||||
          this.open = false;
 | 
										plain: true,
 | 
				
			||||||
          this.getList();
 | 
										color: 'success',
 | 
				
			||||||
        });
 | 
									},
 | 
				
			||||||
      });
 | 
									// {
 | 
				
			||||||
    },
 | 
									// 	type: this.$auth.hasPermi('base:equipment-plc:export') ? 'button' : '',
 | 
				
			||||||
    /** 删除按钮操作 */
 | 
									// 	btnName: '导出',
 | 
				
			||||||
    handleDelete(row) {
 | 
									// 	name: 'export',
 | 
				
			||||||
      const id = row.id;
 | 
									// 	color: 'warning',
 | 
				
			||||||
      this.$modal.confirm('是否确认删除设备与实时采集关系表(一对多)编号为"' + id + '"的数据项?').then(function() {
 | 
									// },
 | 
				
			||||||
          return deleteEquipmentPlcConnect(id);
 | 
								],
 | 
				
			||||||
        }).then(() => {
 | 
								rows: [
 | 
				
			||||||
          this.getList();
 | 
									[
 | 
				
			||||||
          this.$modal.msgSuccess("删除成功");
 | 
										{
 | 
				
			||||||
        }).catch(() => {});
 | 
											select: true,
 | 
				
			||||||
    },
 | 
											label: '关联表名',
 | 
				
			||||||
    /** 导出按钮操作 */
 | 
											prop: 'plcId',
 | 
				
			||||||
    handleExport() {
 | 
											url: '/base/equipment-plc/listAll',
 | 
				
			||||||
      // 处理查询参数
 | 
											rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
 | 
				
			||||||
      let params = {...this.queryParams};
 | 
										},
 | 
				
			||||||
      params.pageNo = undefined;
 | 
									],
 | 
				
			||||||
      params.pageSize = undefined;
 | 
									[
 | 
				
			||||||
      this.$modal.confirm('是否确认导出所有设备与实时采集关系表(一对多)数据项?').then(() => {
 | 
										{
 | 
				
			||||||
          this.exportLoading = true;
 | 
											select: true,
 | 
				
			||||||
          return exportEquipmentPlcConnectExcel(params);
 | 
											label: '设备',
 | 
				
			||||||
        }).then(response => {
 | 
											prop: 'equipmentId',
 | 
				
			||||||
          this.$download.excel(response, '设备与实时采集关系表(一对多).xls');
 | 
											url: '/base/equipment/page?pageNo=1&pageSize=99',
 | 
				
			||||||
          this.exportLoading = false;
 | 
											rules: [{ required: true, message: '不能为空', trigger: 'blur' }],
 | 
				
			||||||
        }).catch(() => {});
 | 
										},
 | 
				
			||||||
    }
 | 
									],
 | 
				
			||||||
  }
 | 
								],
 | 
				
			||||||
 | 
								open: false,
 | 
				
			||||||
 | 
								// 查询参数
 | 
				
			||||||
 | 
								queryParams: {
 | 
				
			||||||
 | 
									pageNo: 1,
 | 
				
			||||||
 | 
									pageSize: 10,
 | 
				
			||||||
 | 
									plcId: null,
 | 
				
			||||||
 | 
									equipmentId: null,
 | 
				
			||||||
 | 
								},
 | 
				
			||||||
 | 
								// 表单参数
 | 
				
			||||||
 | 
								form: {},
 | 
				
			||||||
 | 
							};
 | 
				
			||||||
 | 
						},
 | 
				
			||||||
 | 
						created() {
 | 
				
			||||||
 | 
							this.getList();
 | 
				
			||||||
 | 
						},
 | 
				
			||||||
 | 
						methods: {
 | 
				
			||||||
 | 
							/** 覆盖 handleEmitFun 的默认实现 */
 | 
				
			||||||
 | 
							handleEmitFun({ action, payload }) {
 | 
				
			||||||
 | 
								switch (action) {
 | 
				
			||||||
 | 
									case 'params-bind':
 | 
				
			||||||
 | 
										this.reset();
 | 
				
			||||||
 | 
										console.log('Cha看绑定参数弹窗')
 | 
				
			||||||
 | 
										break;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							/** 查询列表 */
 | 
				
			||||||
 | 
							getList() {
 | 
				
			||||||
 | 
								this.loading = true;
 | 
				
			||||||
 | 
								// 执行查询
 | 
				
			||||||
 | 
								getEquipmentPlcConnectPage(this.queryParams).then((response) => {
 | 
				
			||||||
 | 
									this.list = response.data.list;
 | 
				
			||||||
 | 
									this.total = response.data.total;
 | 
				
			||||||
 | 
									this.loading = false;
 | 
				
			||||||
 | 
								});
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
							/** 取消按钮 */
 | 
				
			||||||
 | 
							cancel() {
 | 
				
			||||||
 | 
								this.open = false;
 | 
				
			||||||
 | 
								this.reset();
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
							/** 表单重置 */
 | 
				
			||||||
 | 
							reset() {
 | 
				
			||||||
 | 
								this.form = {
 | 
				
			||||||
 | 
									id: undefined,
 | 
				
			||||||
 | 
									plcId: undefined,
 | 
				
			||||||
 | 
									equipmentId: undefined,
 | 
				
			||||||
 | 
								};
 | 
				
			||||||
 | 
								this.resetForm('form');
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
							/** 搜索按钮操作 */
 | 
				
			||||||
 | 
							handleQuery() {
 | 
				
			||||||
 | 
								this.queryParams.pageNo = 1;
 | 
				
			||||||
 | 
								this.getList();
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
							/** 重置按钮操作 */
 | 
				
			||||||
 | 
							resetQuery() {
 | 
				
			||||||
 | 
								this.resetForm('queryForm');
 | 
				
			||||||
 | 
								this.handleQuery();
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
							/** 新增按钮操作 */
 | 
				
			||||||
 | 
							handleAdd() {
 | 
				
			||||||
 | 
								this.reset();
 | 
				
			||||||
 | 
								this.open = true;
 | 
				
			||||||
 | 
								this.title = '添加设备与实时采集关系表(一对多)';
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
							/** 修改按钮操作 */
 | 
				
			||||||
 | 
							handleUpdate(row) {
 | 
				
			||||||
 | 
								this.reset();
 | 
				
			||||||
 | 
								const id = row.id;
 | 
				
			||||||
 | 
								getEquipmentPlcConnect(id).then((response) => {
 | 
				
			||||||
 | 
									this.form = response.data;
 | 
				
			||||||
 | 
									this.open = true;
 | 
				
			||||||
 | 
									this.title = '修改设备与实时采集关系表(一对多)';
 | 
				
			||||||
 | 
								});
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
							/** 提交按钮 */
 | 
				
			||||||
 | 
							submitForm() {
 | 
				
			||||||
 | 
								this.$refs['form'].validate((valid) => {
 | 
				
			||||||
 | 
									if (!valid) {
 | 
				
			||||||
 | 
										return;
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
									// 修改的提交
 | 
				
			||||||
 | 
									if (this.form.id != null) {
 | 
				
			||||||
 | 
										updateEquipmentPlcConnect(this.form).then((response) => {
 | 
				
			||||||
 | 
											this.$modal.msgSuccess('修改成功');
 | 
				
			||||||
 | 
											this.open = false;
 | 
				
			||||||
 | 
											this.getList();
 | 
				
			||||||
 | 
										});
 | 
				
			||||||
 | 
										return;
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
									// 添加的提交
 | 
				
			||||||
 | 
									createEquipmentPlcConnect(this.form).then((response) => {
 | 
				
			||||||
 | 
										this.$modal.msgSuccess('新增成功');
 | 
				
			||||||
 | 
										this.open = false;
 | 
				
			||||||
 | 
										this.getList();
 | 
				
			||||||
 | 
									});
 | 
				
			||||||
 | 
								});
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
							/** 删除按钮操作 */
 | 
				
			||||||
 | 
							handleDelete(row) {
 | 
				
			||||||
 | 
								const id = row.id;
 | 
				
			||||||
 | 
								this.$modal
 | 
				
			||||||
 | 
									.confirm(
 | 
				
			||||||
 | 
										'是否确认删除设备与实时采集关系表(一对多)编号为"' +
 | 
				
			||||||
 | 
											id +
 | 
				
			||||||
 | 
											'"的数据项?'
 | 
				
			||||||
 | 
									)
 | 
				
			||||||
 | 
									.then(function () {
 | 
				
			||||||
 | 
										return deleteEquipmentPlcConnect(id);
 | 
				
			||||||
 | 
									})
 | 
				
			||||||
 | 
									.then(() => {
 | 
				
			||||||
 | 
										this.getList();
 | 
				
			||||||
 | 
										this.$modal.msgSuccess('删除成功');
 | 
				
			||||||
 | 
									})
 | 
				
			||||||
 | 
									.catch(() => {});
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
							/** 导出按钮操作 */
 | 
				
			||||||
 | 
							handleExport() {
 | 
				
			||||||
 | 
								// 处理查询参数
 | 
				
			||||||
 | 
								let params = { ...this.queryParams };
 | 
				
			||||||
 | 
								params.pageNo = undefined;
 | 
				
			||||||
 | 
								params.pageSize = undefined;
 | 
				
			||||||
 | 
								this.$modal
 | 
				
			||||||
 | 
									.confirm('是否确认导出所有设备与实时采集关系表(一对多)数据项?')
 | 
				
			||||||
 | 
									.then(() => {
 | 
				
			||||||
 | 
										this.exportLoading = true;
 | 
				
			||||||
 | 
										return exportEquipmentPlcConnectExcel(params);
 | 
				
			||||||
 | 
									})
 | 
				
			||||||
 | 
									.then((response) => {
 | 
				
			||||||
 | 
										this.$download.excel(response, '设备与实时采集关系表(一对多).xls');
 | 
				
			||||||
 | 
										this.exportLoading = false;
 | 
				
			||||||
 | 
									})
 | 
				
			||||||
 | 
									.catch(() => {});
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
 | 
						},
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
</script>
 | 
					</script>
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user