|
|
@@ -0,0 +1,584 @@
|
|
|
+<template>
|
|
|
+ <div class="app-container">
|
|
|
+ <el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
|
|
|
+ <el-form-item label="车间" prop="wsName">
|
|
|
+ <el-select v-model="queryParams.wsName" placeholder="请选择车间" clearable style="width: 150px"
|
|
|
+ @change="handleQuery">
|
|
|
+ <el-option
|
|
|
+ v-for="dict in dye_ws"
|
|
|
+ :key="dict.value"
|
|
|
+ :label="dict.label"
|
|
|
+ :value="dict.value"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="产线编号" prop="line">
|
|
|
+ <el-select
|
|
|
+ v-model="queryParams.line"
|
|
|
+ placeholder="请选择产线编号"
|
|
|
+ clearable
|
|
|
+ style="width: 150px"
|
|
|
+ @change="handleQuery"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in Array.from({length: 8}, (_, i) => i + 1)"
|
|
|
+ :key="item"
|
|
|
+ :label="item.toString()"
|
|
|
+ :value="item.toString()"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <!-- <el-form-item label="设备类型" prop="typeId">-->
|
|
|
+ <!-- <el-select-->
|
|
|
+ <!-- v-model="queryParams.typeId"-->
|
|
|
+ <!-- placeholder="请选择设备类型"-->
|
|
|
+ <!-- clearable-->
|
|
|
+ <!-- style="width: 150px"-->
|
|
|
+ <!-- @change="handleQuery"-->
|
|
|
+ <!-- >-->
|
|
|
+ <!-- <el-option-->
|
|
|
+ <!-- v-for="item in typeList"-->
|
|
|
+ <!-- :key="item.typeId"-->
|
|
|
+ <!-- :label="item.typeName"-->
|
|
|
+ <!-- :value="item.typeId"-->
|
|
|
+ <!-- />-->
|
|
|
+ <!-- </el-select>-->
|
|
|
+ <!-- </el-form-item>-->
|
|
|
+ <el-form-item label="设备编码" prop="deviceCode">
|
|
|
+ <el-input
|
|
|
+ v-model="queryParams.deviceCode"
|
|
|
+ placeholder="请输入设备编码"
|
|
|
+ clearable
|
|
|
+ @keyup.enter="handleQuery"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="设备名称" prop="deviceName">
|
|
|
+ <el-input
|
|
|
+ v-model="queryParams.deviceName"
|
|
|
+ placeholder="请输入设备名称"
|
|
|
+ clearable
|
|
|
+ @keyup.enter="handleQuery"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item>
|
|
|
+ <el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
|
|
+ <el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+
|
|
|
+ <el-row :gutter="10" class="mb8">
|
|
|
+ <el-col :span="1.5">
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ plain
|
|
|
+ icon="Plus"
|
|
|
+ @click="handleAdd"
|
|
|
+ >新增
|
|
|
+ </el-button>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="1.5">
|
|
|
+ <el-button
|
|
|
+ type="success"
|
|
|
+ plain
|
|
|
+ icon="Edit"
|
|
|
+ :disabled="single"
|
|
|
+ @click="handleUpdate"
|
|
|
+ >修改
|
|
|
+ </el-button>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="1.5">
|
|
|
+ <el-button
|
|
|
+ type="danger"
|
|
|
+ plain
|
|
|
+ icon="Delete"
|
|
|
+ :disabled="multiple"
|
|
|
+ @click="handleDelete"
|
|
|
+ >删除
|
|
|
+ </el-button>
|
|
|
+ </el-col>
|
|
|
+ <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
|
|
+ </el-row>
|
|
|
+
|
|
|
+ <el-table v-loading="loading" :data="deviceList" @selection-change="handleSelectionChange">
|
|
|
+ <el-table-column type="selection" width="55" align="center"/>
|
|
|
+ <!-- <el-table-column label="设备ID" align="center" prop="deviceId" />-->
|
|
|
+ <!-- <el-table-column label="类型ID" align="center" prop="typeId"/>-->
|
|
|
+ <el-table-column label="车间" align="center" prop="wsName" width="80px">
|
|
|
+ <template #default="scope">
|
|
|
+ <dict-tag :options="dye_ws" :value="scope.row.wsName"/>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="产线编号" align="center" prop="line" width="80px"/>
|
|
|
+ <el-table-column label="设备类型" align="center" prop="typeName"/>
|
|
|
+ <el-table-column label="设备编码" align="center" prop="deviceCode"/>
|
|
|
+ <el-table-column label="设备名称" align="center" prop="deviceName"/>
|
|
|
+ <el-table-column label="设备顺序" align="center" prop="sortNum" width="80px"/>
|
|
|
+ <!-- <el-table-column label="设备路径" align="center" prop="devicePath"/>-->
|
|
|
+ <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
|
|
+ <template #default="scope">
|
|
|
+ <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['dye:device:edit']">
|
|
|
+ 修改
|
|
|
+ </el-button>
|
|
|
+ <el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)"
|
|
|
+ v-hasPermi="['dye:device:remove']">删除
|
|
|
+ </el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+
|
|
|
+ <pagination
|
|
|
+ v-show="total>0"
|
|
|
+ :total="total"
|
|
|
+ v-model:page="queryParams.pageNum"
|
|
|
+ v-model:limit="queryParams.pageSize"
|
|
|
+ @pagination="getList"
|
|
|
+ />
|
|
|
+
|
|
|
+ <!-- 添加或修改染整线设备管理对话框 -->
|
|
|
+ <el-dialog :title="title" v-model="open" width="1200px" append-to-body>
|
|
|
+ <el-form ref="deviceRef" :model="form" :rules="rules" label-width="80px">
|
|
|
+ <el-row :gutter="20">
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-form-item label="产线编号" prop="line">
|
|
|
+ <el-radio-group v-model="form.line" placeholder="请选择产线编号">
|
|
|
+ <el-radio
|
|
|
+ v-for="item in Array.from({length: 8}, (_, i) => i + 1)"
|
|
|
+ :key="item"
|
|
|
+ :label="item.toString()"
|
|
|
+ >{{ item }}
|
|
|
+ </el-radio>
|
|
|
+ </el-radio-group>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row :gutter="20">
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="设备类型" prop="typeId">
|
|
|
+ <el-select
|
|
|
+ v-model="form.typeId"
|
|
|
+ placeholder="请选择类型"
|
|
|
+ @change="handleTypeChange"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in typeList"
|
|
|
+ :key="item.typeId"
|
|
|
+ :label="item.typeName"
|
|
|
+ :value="item.typeId"
|
|
|
+ ></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="车间" prop="wsName">
|
|
|
+ <el-select v-model="form.wsName" placeholder="请选择车间" disabled>
|
|
|
+ <el-option
|
|
|
+ v-for="dict in dye_ws"
|
|
|
+ :key="dict.value"
|
|
|
+ :label="dict.label"
|
|
|
+ :value="dict.value"
|
|
|
+ ></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+
|
|
|
+ <el-row :gutter="20">
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="设备名称" prop="deviceName">
|
|
|
+ <el-input v-model="form.deviceName" placeholder="请输入设备名称"/>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="设备顺序" prop="deviceName">
|
|
|
+ <el-input-number v-model="form.sortNum" placeholder="请输入设备顺序" :min="1" controls-position="right"/>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+
|
|
|
+ <el-row :gutter="20">
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="设备编码" prop="deviceCode">
|
|
|
+ <el-input v-model="form.deviceCode" placeholder="请输入设备编码"/>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="设备路径" prop="devicePath">
|
|
|
+ <el-input v-model="form.devicePath" placeholder="请输入设备路径"/>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-divider content-position="center">染整线设备参数管理信息</el-divider>
|
|
|
+ <el-row :gutter="10" class="mb8">
|
|
|
+ <el-col :span="1.5">
|
|
|
+ <el-button type="primary" icon="Plus" @click="handleAddDyeDevicePara">添加</el-button>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="1.5">
|
|
|
+ <el-button type="danger" icon="Delete" @click="handleDeleteDyeDevicePara">删除</el-button>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-table :data="dyeDeviceParaList" :row-class-name="rowDyeDeviceParaIndex"
|
|
|
+ @selection-change="handleDyeDeviceParaSelectionChange" ref="dyeDevicePara">
|
|
|
+ <el-table-column type="selection" width="50" align="center">
|
|
|
+ <template #default="scope">
|
|
|
+ <!-- 从能源基础配置导入的参数不允许选择删除 -->
|
|
|
+ <el-checkbox
|
|
|
+ v-model="scope.row.checked"
|
|
|
+ :disabled="scope.row.isFromEnergy"
|
|
|
+ @change="(val) => handleRowSelection(val, scope.row)">
|
|
|
+ </el-checkbox>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="序号" align="center" prop="index" width="50"/>
|
|
|
+ <el-table-column label="参数编码" prop="paraCode" width="150">
|
|
|
+ <template #default="scope">
|
|
|
+ <el-input
|
|
|
+ v-model="scope.row.paraCode"
|
|
|
+ placeholder="请输入参数编码"
|
|
|
+ :disabled="scope.row.isFromEnergy"/>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="参数名称" prop="paraName" width="180">
|
|
|
+ <template #default="scope">
|
|
|
+ <el-input
|
|
|
+ v-model="scope.row.paraName"
|
|
|
+ placeholder="请输入参数名称"
|
|
|
+ :disabled="scope.row.isFromEnergy"/>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="参数表达式" prop="paraExp" width="350">
|
|
|
+ <template #default="scope">
|
|
|
+ <el-input v-model="scope.row.paraExp" type="textarea" placeholder="请输入参数表达式"/>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="告警规则" prop="paraAlarm" width="150">
|
|
|
+ <template #default="scope">
|
|
|
+ <el-input v-model="scope.row.paraAlarm" placeholder="使用区间表达"/>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="产线标准" prop="lineStand" width="150">
|
|
|
+ <template #default="scope">
|
|
|
+ <el-select v-model="scope.row.lineStand" placeholder="产线标准" :disabled="scope.row.isFromEnergy">
|
|
|
+ <el-option
|
|
|
+ v-for="dict in line_stand"
|
|
|
+ :key="dict.value"
|
|
|
+ :label="dict.label"
|
|
|
+ :value="dict.value"
|
|
|
+ ></el-option>
|
|
|
+ </el-select>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </el-form>
|
|
|
+ <template #footer>
|
|
|
+ <div class="dialog-footer">
|
|
|
+ <el-button type="primary" @click="submitForm">确 定</el-button>
|
|
|
+ <el-button @click="cancel">取 消</el-button>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-dialog>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script setup name="Device">
|
|
|
+import {addDevice, delDevice, getDevice, listDevice, updateDevice} from "@/api/dye/device";
|
|
|
+import {listType} from "@/api/dye/type";
|
|
|
+import {listEnergy} from "@/api/dye/energy"; // 导入能源列表API
|
|
|
+import {createUniqueString} from "@/utils/index"; // 引入生成唯一字符串的工具函数
|
|
|
+
|
|
|
+const {proxy} = getCurrentInstance();
|
|
|
+const {dye_ws, sys_yes_no, line_stand} = proxy.useDict('dye_ws', 'sys_yes_no', 'line_stand');
|
|
|
+
|
|
|
+const deviceList = ref([]);
|
|
|
+const dyeDeviceParaList = ref([]);
|
|
|
+const typeList = ref([]); // 添加类型列表
|
|
|
+const open = ref(false);
|
|
|
+const loading = ref(true);
|
|
|
+const showSearch = ref(true);
|
|
|
+const ids = ref([]);
|
|
|
+const checkedDyeDevicePara = ref([]);
|
|
|
+const single = ref(true);
|
|
|
+const multiple = ref(true);
|
|
|
+const total = ref(0);
|
|
|
+const title = ref("");
|
|
|
+
|
|
|
+const data = reactive({
|
|
|
+ form: {},
|
|
|
+ queryParams: {
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ typeId: null,
|
|
|
+ wsName: null,
|
|
|
+ line: null,
|
|
|
+ typeName: null,
|
|
|
+ deviceCode: null,
|
|
|
+ deviceName: null,
|
|
|
+ devicePath: null,
|
|
|
+ createdBy: null,
|
|
|
+ createdTime: null,
|
|
|
+ updatedBy: null,
|
|
|
+ updatedTime: null,
|
|
|
+ remark: null
|
|
|
+ },
|
|
|
+ rules: {
|
|
|
+ typeId: [
|
|
|
+ { required: true, message: "设备类型不能为空", trigger: "blur" }
|
|
|
+ ],
|
|
|
+ line: [
|
|
|
+ { required: true, message: "产线编号不能为空", trigger: "blur" }
|
|
|
+ ],
|
|
|
+ typeName: [
|
|
|
+ { required: true, message: "类型名称不能为空", trigger: "blur" }
|
|
|
+ ],
|
|
|
+ deviceCode: [
|
|
|
+ { required: true, message: "设备编码不能为空", trigger: "blur" }
|
|
|
+ ],
|
|
|
+ sortNum: [
|
|
|
+ { required: true, message: "设备顺序号不能为空", trigger: "blur" }
|
|
|
+ ],
|
|
|
+ deviceName: [
|
|
|
+ { required: true, message: "设备名称不能为空", trigger: "blur" }
|
|
|
+ ],
|
|
|
+ devicePath: [
|
|
|
+ { required: true, message: "设备路径不能为空", trigger: "blur" }
|
|
|
+ ],
|
|
|
+ }
|
|
|
+});
|
|
|
+
|
|
|
+const {queryParams, form, rules} = toRefs(data);
|
|
|
+
|
|
|
+/** 查询染整线设备管理列表 */
|
|
|
+function getList() {
|
|
|
+ loading.value = true;
|
|
|
+ // 先获取类型列表
|
|
|
+ listType({pageSize: 10000}).then(response => {
|
|
|
+ typeList.value = response.rows;
|
|
|
+ // 再获取设备列表
|
|
|
+ listDevice(queryParams.value).then(response => {
|
|
|
+ deviceList.value = response.rows;
|
|
|
+ total.value = response.total;
|
|
|
+ loading.value = false;
|
|
|
+ });
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+// 取消按钮
|
|
|
+function cancel() {
|
|
|
+ open.value = false;
|
|
|
+ reset();
|
|
|
+}
|
|
|
+
|
|
|
+// 表单重置
|
|
|
+function reset() {
|
|
|
+ form.value = {
|
|
|
+ deviceId: null,
|
|
|
+ typeId: null,
|
|
|
+ wsName: null,
|
|
|
+ line: null,
|
|
|
+ typeName: null,
|
|
|
+ deviceCode: null,
|
|
|
+ deviceName: null,
|
|
|
+ devicePath: null,
|
|
|
+ createdBy: null,
|
|
|
+ createdTime: null,
|
|
|
+ updatedBy: null,
|
|
|
+ updatedTime: null,
|
|
|
+ remark: null
|
|
|
+ };
|
|
|
+ dyeDeviceParaList.value = [];
|
|
|
+ proxy.resetForm("deviceRef");
|
|
|
+}
|
|
|
+
|
|
|
+/** 搜索按钮操作 */
|
|
|
+function handleQuery() {
|
|
|
+ queryParams.value.pageNum = 1;
|
|
|
+ getList();
|
|
|
+}
|
|
|
+
|
|
|
+/** 重置按钮操作 */
|
|
|
+function resetQuery() {
|
|
|
+ proxy.resetForm("queryRef");
|
|
|
+ handleQuery();
|
|
|
+}
|
|
|
+
|
|
|
+// 多选框选中数据
|
|
|
+function handleSelectionChange(selection) {
|
|
|
+ ids.value = selection.map(item => item.deviceId);
|
|
|
+ single.value = selection.length != 1;
|
|
|
+ multiple.value = !selection.length;
|
|
|
+}
|
|
|
+
|
|
|
+/** 新增按钮操作 */
|
|
|
+function handleAdd() {
|
|
|
+ reset();
|
|
|
+ // 自动导入能源基础配置
|
|
|
+ listEnergy({pageSize: 10000}).then(response => {
|
|
|
+ if (response.rows && response.rows.length > 0) {
|
|
|
+ response.rows.forEach(energy => {
|
|
|
+ let obj = {};
|
|
|
+ obj.paraCode = energy.engCode; // 使用能源编码
|
|
|
+ obj.paraName = energy.engName; // 使用能源名称
|
|
|
+ obj.paraExp = "";
|
|
|
+ obj.paraAlarm = "";
|
|
|
+ obj.lineStand = energy.lineStand || ""; // 导入能源的产线标准
|
|
|
+ // 添加标记,表示这是从能源基础配置导入的,不可修改删除
|
|
|
+ obj.isFromEnergy = true;
|
|
|
+ dyeDeviceParaList.value.push(obj);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ open.value = true;
|
|
|
+ title.value = "添加染整线设备管理";
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+/** 修改按钮操作 */
|
|
|
+function handleUpdate(row) {
|
|
|
+ reset();
|
|
|
+ const _deviceId = row.deviceId || ids.value
|
|
|
+ getDevice(_deviceId).then(response => {
|
|
|
+ form.value = response.data;
|
|
|
+ // 获取所有能源数据,用于判断哪些参数是从能源导入的
|
|
|
+ listEnergy({pageSize: 10000}).then(energyResponse => {
|
|
|
+ const energyMap = new Map();
|
|
|
+ if (energyResponse.rows) {
|
|
|
+ energyResponse.rows.forEach(energy => {
|
|
|
+ energyMap.set(energy.engCode, {
|
|
|
+ name: energy.engName,
|
|
|
+ lineStand: energy.lineStand
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ // 为从能源导入的参数添加标记
|
|
|
+ if (response.data.dyeDeviceParaList) {
|
|
|
+ response.data.dyeDeviceParaList.forEach(item => {
|
|
|
+ // 如果参数编码在能源编码列表中,则标记为从能源导入
|
|
|
+ if (energyMap.has(item.paraCode)) {
|
|
|
+ const energyInfo = energyMap.get(item.paraCode);
|
|
|
+ // 同时检查名称是否匹配,避免误判
|
|
|
+ if (item.paraName === energyInfo.name) {
|
|
|
+ item.isFromEnergy = true;
|
|
|
+ // 如果产线标准为空,则使用能源的产线标准
|
|
|
+ if (!item.lineStand && energyInfo.lineStand) {
|
|
|
+ item.lineStand = energyInfo.lineStand;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ item.isFromEnergy = false;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ item.isFromEnergy = false;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ dyeDeviceParaList.value = response.data.dyeDeviceParaList;
|
|
|
+ open.value = true;
|
|
|
+ title.value = "修改染整线设备管理";
|
|
|
+ });
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+/** 提交按钮 */
|
|
|
+function submitForm() {
|
|
|
+ proxy.$refs["deviceRef"].validate(valid => {
|
|
|
+ if (valid) {
|
|
|
+ form.value.dyeDeviceParaList = dyeDeviceParaList.value;
|
|
|
+ if (form.value.deviceId != null) {
|
|
|
+ updateDevice(form.value).then(response => {
|
|
|
+ proxy.$modal.msgSuccess("修改成功");
|
|
|
+ open.value = false;
|
|
|
+ getList();
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ addDevice(form.value).then(response => {
|
|
|
+ proxy.$modal.msgSuccess("新增成功");
|
|
|
+ open.value = false;
|
|
|
+ getList();
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+/** 删除按钮操作 */
|
|
|
+function handleDelete(row) {
|
|
|
+ const _deviceIds = row.deviceId || ids.value;
|
|
|
+ proxy.$modal.confirm('是否确认删除染整线设备管理编号为"' + _deviceIds + '"的数据项?').then(function () {
|
|
|
+ return delDevice(_deviceIds);
|
|
|
+ }).then(() => {
|
|
|
+ getList();
|
|
|
+ proxy.$modal.msgSuccess("删除成功");
|
|
|
+ }).catch(() => {
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+/** 染整线设备参数管理序号 */
|
|
|
+function rowDyeDeviceParaIndex({row, rowIndex}) {
|
|
|
+ row.index = rowIndex + 1;
|
|
|
+}
|
|
|
+
|
|
|
+/** 染整线设备参数管理添加按钮操作 */
|
|
|
+function handleAddDyeDevicePara() {
|
|
|
+ let obj = {};
|
|
|
+ obj.paraCode = "PARA_" + createUniqueString(); // 自动生成唯一编码
|
|
|
+ obj.paraName = "";
|
|
|
+ obj.paraExp = "";
|
|
|
+ obj.paraAlarm = "";
|
|
|
+ obj.lineStand = "";
|
|
|
+ dyeDeviceParaList.value.push(obj);
|
|
|
+}
|
|
|
+
|
|
|
+/** 染整线设备参数管理删除按钮操作 */
|
|
|
+function handleDeleteDyeDevicePara() {
|
|
|
+ if (checkedDyeDevicePara.value.length == 0) {
|
|
|
+ proxy.$modal.msgError("请先选择要删除的染整线设备参数管理数据");
|
|
|
+ } else {
|
|
|
+ const dyeDeviceParas = dyeDeviceParaList.value;
|
|
|
+ const checkedDyeDeviceParas = checkedDyeDevicePara.value;
|
|
|
+ dyeDeviceParaList.value = dyeDeviceParas.filter(function (item) {
|
|
|
+ // 如果是从能源基础配置导入的参数,不允许删除
|
|
|
+ if (item.isFromEnergy) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ return checkedDyeDeviceParas.indexOf(item.index) == -1;
|
|
|
+ });
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+/** 复选框选中数据 */
|
|
|
+function handleDyeDeviceParaSelectionChange(selection) {
|
|
|
+ // 不再使用这个方法处理选择变更
|
|
|
+ // checkedDyeDevicePara.value = selection.map(item => item.index)
|
|
|
+}
|
|
|
+
|
|
|
+/** 处理类型选择变化 */
|
|
|
+function handleTypeChange(typeId) {
|
|
|
+ // 根据选择的类型ID查找对应的类型对象
|
|
|
+ const selectedType = typeList.value.find(item => item.typeId === typeId);
|
|
|
+ if (selectedType) {
|
|
|
+ // 设置车间名称
|
|
|
+ form.value.wsName = selectedType.wsName;
|
|
|
+ // 设置类型名称
|
|
|
+ form.value.typeName = selectedType.typeName;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+/** 导出按钮操作 */
|
|
|
+function handleExport() {
|
|
|
+ proxy.download('dye/device/export', {
|
|
|
+ ...queryParams.value
|
|
|
+ }, `device_${new Date().getTime()}.xlsx`)
|
|
|
+}
|
|
|
+
|
|
|
+// 添加行选择处理函数
|
|
|
+function handleRowSelection(val, row) {
|
|
|
+ if (val) {
|
|
|
+ checkedDyeDevicePara.value.push(row.index);
|
|
|
+ } else {
|
|
|
+ const index = checkedDyeDevicePara.value.indexOf(row.index);
|
|
|
+ if (index > -1) {
|
|
|
+ checkedDyeDevicePara.value.splice(index, 1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+getList();
|
|
|
+</script>
|