| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197 |
- <template>
- <div class="app-container">
- <el-form
- :model="queryParams"
- ref="queryForm"
- size="small"
- :inline="true"
- v-show="showSearch"
- label-width="100px"
- @submit.native.prevent
- >
- <!-- <el-form-item label="隔离点编号" prop="pointCode">-->
- <!-- <el-input-->
- <!-- v-model="queryParams.pointCode"-->
- <!-- placeholder="请输入隔离点编号"-->
- <!-- clearable-->
- <!-- @keyup.enter.native="handleQuery"-->
- <!-- />-->
- <!-- </el-form-item>-->
- <el-form-item label="隔离点名称" prop="pointName">
- <el-input
- v-model="queryParams.pointName"
- placeholder="请输入隔离点名称"
- clearable
- @keyup.enter.native="handleQuery"
- />
- </el-form-item>
- <el-form-item label="岗位" prop="workstationId">
- <treeselect style="width: 200px" v-model="queryParams.workstationId" :options="deptOptions"
- :normalizer="normalizer" placeholder="选择岗位"
- />
- </el-form-item>
- <el-form-item label="设备/工艺" prop="machineryId">
- <treeselect style="width: 200px" v-model="queryParams.machineryId" :options="machineryOptions"
- :normalizer="Machinerynormalizer" placeholder="选择设备/工艺"
- />
- </el-form-item>
- <el-form-item label="锁定站" prop="lotoId">
- <el-select
- v-model="queryParams.lotoId"
- placeholder="请选择锁定站"
- >
- <el-option
- v-for="dict in lotoOptions"
- :key="dict.value"
- :label="dict.label"
- :value="dict.value"
- />
- </el-select>
- </el-form-item>
- <!-- <el-form-item label="状态" prop="calendarType">
- <el-select v-model="queryParams.calendarType" placeholder="状态">
- <el-option>正常</el-option>
- <el-option>异常</el-option>
- </el-select>
- </el-form-item> -->
- <!-- <el-form-item label="隔离点类型" prop="pointType">-->
- <!-- <el-select-->
- <!-- v-model="queryParams.pointType"-->
- <!-- placeholder="请选择隔离点类型"-->
- <!-- >-->
- <!-- <el-option-->
- <!-- v-for="dict in dict.type.point_type"-->
- <!-- :key="dict.value"-->
- <!-- :label="dict.label"-->
- <!-- :value="dict.value"-->
- <!-- />-->
- <!-- </el-select>-->
- <!-- </el-form-item>-->
- <el-form-item label="能量源" prop="powerType">
- <el-select
- style="width: 200px"
- v-model="queryParams.powerType"
- placeholder="请选择能量源"
- >
- <el-option
- v-for="dict in dict.type.power_type"
- :key="dict.value"
- :label="dict.label"
- :value="dict.value"
- />
- </el-select>
- </el-form-item>
- <!-- <el-form-item label="创建时间">-->
- <!-- <el-date-picker-->
- <!-- v-model="createTime"-->
- <!-- type="daterange"-->
- <!-- align="right"-->
- <!-- unlink-panels-->
- <!-- range-separator="至"-->
- <!-- start-placeholder="开始日期"-->
- <!-- end-placeholder="结束日期"-->
- <!-- :picker-options="pickerOptions"-->
- <!-- >-->
- <!-- </el-date-picker>-->
- <!-- </el-form-item>-->
- <el-form-item>
- <el-button
- v-no-more-click
- type="primary"
- icon="el-icon-search"
- size="mini"
- @click="handleQuery"
- >搜索
- </el-button
- >
- <el-button
- v-no-more-click
- icon="el-icon-refresh"
- size="mini"
- @click="resetQuery"
- >重置
- </el-button
- >
- </el-form-item>
- </el-form>
- <el-row :gutter="10" class="mb8">
- <el-col :span="1.5">
- <el-button
- v-no-more-click
- type="primary"
- plain
- icon="el-icon-plus"
- size="mini"
- @click="handleAdd"
- v-hasPermi="['iscs:point:add']"
- >新增
- </el-button>
- </el-col>
- <el-col :span="1.5">
- <el-button
- v-no-more-click
- type="danger"
- plain
- icon="el-icon-delete"
- size="mini"
- :disabled="multiple"
- @click="handleDelete"
- v-hasPermi="['iscs:point:remove']"
- >批量删除
- </el-button>
- </el-col>
- <!-- <el-col :span="1.5">-->
- <!-- <el-button v-no-more-click-->
- <!-- type="warning"-->
- <!-- plain-->
- <!-- icon="el-icon-download"-->
- <!-- size="mini"-->
- <!-- @click="handleExport"-->
- <!-- v-hasPermi="['mes:cal:team:export']"-->
- <!-- >导出</el-button>-->
- <!-- </el-col>-->
- <right-toolbar
- :showSearch.sync="showSearch"
- @queryTable="getList"
- ></right-toolbar>
- </el-row>
- <el-table
- v-loading="loading"
- :data="isolationList"
- @selection-change="handleSelectionChange"
- >
- <el-table-column type="selection" width="55" align="center"/>
- <!-- <el-table-column label="隔离点ID" align="center" prop="pointId">
- <template slot-scope="scope">
- <el-button v-no-more-click
- type="text"
- @click="handleView(scope.row)"
- v-hasPermi="['mes:md:seg:query']"
- >{{ scope.row.pointId }}
- </el-button>
- </template>
- </el-table-column> -->
- <el-table-column label="隔离点编号" align="center" prop="pointCode" width="100">
- <template slot-scope="scope">
- <el-button
- v-no-more-click
- type="text"
- @click="handleView(scope.row)"
- v-hasPermi="['iscs:point:list']"
- >{{ scope.row.pointCode }}
- </el-button>
- </template>
- </el-table-column>
- <el-table-column label="隔离点名称" align="center" prop="pointName"/>
- <el-table-column
- label="隔离点图标"
- align="center"
- prop="pointIcon"
- width="90"
- >
- <template slot-scope="scope">
- <img
- v-if="scope.row.pointIcon"
- :src="scope.row.pointIcon"
- alt=""
- style="width: 50px; height: 50px"
- />
- <span v-else>-</span>
- </template>
- </el-table-column>
- <el-table-column label="开关状态" align="center" prop="switchStatus">
- <template slot-scope="scope">
- <!-- <dict-tag :options="dict.type.switch_status" :value="scope.row.switchStatus"></dict-tag>-->
- <el-switch
- style="pointer-events: none"
- v-if="scope.row.switchStatus!==null"
- v-model="scope.row.switchStatus"
- active-value="1"
- inactive-value="0"
- active-text="ON"
- inactive-text="OFF"
- active-color="#13ce66"
- inactive-color="#ff4949"
- ></el-switch>
- <span v-else>-</span>
- </template>
- </el-table-column>
- <el-table-column label="隔离点NFC" align="center" prop="pointNfc" >
- </el-table-column>
- <el-table-column label="岗位" align="center" prop="workstationName">
- </el-table-column>
- <el-table-column label="设备/工艺" align="center" prop="machineryName">
- </el-table-column>
- <el-table-column label="锁定站" align="center" prop="lotoName">
- </el-table-column>
- <el-table-column label="布局地图" align="center" prop="switchMapName">
- </el-table-column>
- <el-table-column label="隔离点序列号" align="center" prop="pointSerialNumber">
- </el-table-column>
- <el-table-column label="作用" align="center" prop="remark">
- </el-table-column>
- <!-- <el-table-column label="状态" align="center" prop="calendarType">
- <template slot-scope="scope">
- <dict-tag
- :options="dict.type.mes_calendar_type"
- :value="scope.row.calendarType"
- />
- </template>
- </el-table-column> -->
- <el-table-column
- label="隔离点图片"
- align="center"
- prop="pointPicture"
- width="90"
- >
- <template slot-scope="scope">
- <img
- v-if="scope.row.pointPicture"
- :src="scope.row.pointPicture"
- alt=""
- style="width: 50px; height: 50px"
- />
- <span v-else>-</span>
- </template>
- </el-table-column>
- <!-- <el-table-column label="隔离点类型" align="center" prop="pointType">-->
- <!-- <template slot-scope="scope">-->
- <!-- <dict-tag-->
- <!-- :options="dict.type.point_type"-->
- <!-- :value="scope.row.pointType"-->
- <!-- />-->
- <!-- </template>-->
- <!-- </el-table-column>-->
- <!--危险能量类型-->
- <el-table-column label="能量源" align="center" prop="powerType">
- <template slot-scope="scope">
- <dict-tag
- :options="dict.type.power_type"
- :value="scope.row.powerType"
- />
- </template>
- </el-table-column>
- <!-- <el-table-column-->
- <!-- label="挂锁类型图"-->
- <!-- align="center"-->
- <!-- prop="lockTypeImg"-->
- <!-- width="90"-->
- <!-- >-->
- <!-- <template slot-scope="scope">-->
- <!-- <img-->
- <!-- v-if="scope.row.lockTypeImg"-->
- <!-- :src="scope.row.lockTypeImg"-->
- <!-- alt=""-->
- <!-- style="width: 50px; height: 50px"-->
- <!-- />-->
- <!-- <span v-else>-</span>-->
- <!-- </template>-->
- <!-- </el-table-column>-->
- <!-- <el-table-column-->
- <!-- label="锁具机构类型图"-->
- <!-- align="center"-->
- <!-- prop="locksetTypeImg"-->
- <!-- width="90"-->
- <!-- >-->
- <!-- <template slot-scope="scope">-->
- <!-- <img-->
- <!-- v-if="scope.row.locksetTypeImg"-->
- <!-- :src="scope.row.locksetTypeImg"-->
- <!-- alt=""-->
- <!-- style="width: 50px; height: 50px"-->
- <!-- />-->
- <!-- <span v-else>-</span>-->
- <!-- </template>-->
- <!-- </el-table-column>-->
- <!-- <el-table-column label="创建时间" align="center" prop="createTime">-->
- <!-- </el-table-column>-->
- <el-table-column
- label="操作"
- align="center"
- class-name="small-padding fixed-width"
- >
- <template slot-scope="scope">
- <el-button
- v-no-more-click
- size="mini"
- type="text"
- icon="el-icon-edit"
- @click="handleUpdate(scope.row)"
- v-hasPermi="['iscs:point:edit']"
- >修改
- </el-button>
- <el-button
- v-no-more-click
- size="mini"
- type="text"
- icon="el-icon-delete"
- @click="handleDelete(scope.row)"
- v-hasPermi="['iscs:point:remove']"
- >删除
- </el-button>
- </template>
- </el-table-column>
- </el-table>
- <pagination
- v-show="total > 0"
- :total="total"
- :page.sync="queryParams.current"
- :limit.sync="queryParams.size"
- @pagination="getList"
- />
- <!-- 添加或修改班组对话框 -->
- <el-dialog :visible.sync="open" width="960px" append-to-body>
- <div slot="title" class="dialog-title">
- <i></i>
- <span class="title">{{ title }}</span>
- </div>
- <el-form ref="form" :model="form" :rules="rules" label-width="110px">
- <el-row>
- <el-col :span="7">
- <el-form-item label="隔离点编号" prop="pointCode">
- <el-input
- v-model="form.pointCode"
- placeholder="请输入隔离点编号"
- />
- </el-form-item>
- </el-col>
- <el-col :span="4">
- <el-form-item label-width="80">
- <el-switch
- v-model="autoGenFlag"
- active-color="#13ce66"
- active-text="自动生成"
- @change="handleAutoGenChange(autoGenFlag)"
- v-if="optType != 'view'"
- >
- </el-switch>
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="隔离点名称" prop="pointName">
- <el-input
- style="width: 300px"
- v-model="form.pointName"
- placeholder="请输入隔离点名称"
- />
- </el-form-item>
- </el-col>
- </el-row>
- <el-row>
- <!-- <el-col :span="11">-->
- <!-- <el-form-item label="隔离点类型" prop="pointType">-->
- <!-- <el-select-->
- <!-- style="width: 300px"-->
- <!-- v-model="form.pointType"-->
- <!-- placeholder="请选择隔离点类型"-->
- <!-- >-->
- <!-- <el-option-->
- <!-- v-for="dict in dict.type.point_type"-->
- <!-- :key="dict.value"-->
- <!-- :label="dict.label"-->
- <!-- :value="dict.value"-->
- <!-- />-->
- <!-- </el-select>-->
- <!-- </el-form-item>-->
- <!-- </el-col>-->
- <el-col :span="11">
- <el-form-item label="岗位" prop="workstationId">
- <treeselect style="width: 300px" v-model="form.workstationId" :options="deptOptions"
- :normalizer="normalizer" placeholder="选择岗位"
- />
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="隔离点NFC" prop="rfidId" >
- <!-- <el-input-->
- <!-- style="width: 300px"-->
- <!-- v-model="form.pointNfc"-->
- <!-- placeholder="请输入隔离点NFC"-->
- <!-- maxlength="16"-->
- <!-- />-->
- <el-select v-model="form.rfidId" style="width: 300px">
- <el-option v-for="dict in this.RfidTokenData" :label="dict.label" :value="dict.value"></el-option>
- </el-select>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row>
- <!-- <el-form-item label="作业区域" prop="workareaId">-->
- <!-- <treeselect-->
- <!-- style="width: 300px"-->
- <!-- v-model="form.workareaId"-->
- <!-- :options="deptOptions"-->
- <!-- :normalizer="normalizer"-->
- <!-- placeholder="选择作业区域"-->
- <!-- />-->
- <!-- </el-form-item>-->
- <el-col :span="11">
- <el-form-item label="锁定站" prop="lotoId">
- <el-select
- style="width: 300px"
- v-model="form.lotoId"
- placeholder="请选择锁定站"
- >
- <el-option
- v-for="dict in lotoOptions"
- :key="dict.value"
- :label="dict.label"
- :value="dict.value"
- />
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="11">
- <el-form-item label="布局地图" prop="switchMapId">
- <el-select
- style="width: 300px"
- v-model="form.switchMapId"
- placeholder="请选择布局地图"
- >
- <el-option
- v-for="dict in switchMapOptions"
- :key="dict.value"
- :label="dict.label"
- :value="dict.value"
- />
- </el-select>
- </el-form-item>
- </el-col>
- <!-- <el-col :span="11">-->
- <!-- <el-form-item label="挂锁类型" prop="lockTypeId">-->
- <!-- <treeselect-->
- <!-- style="width: 300px"-->
- <!-- v-model="form.lockTypeId"-->
- <!-- :options="padLockTypeOptions"-->
- <!-- :normalizer="normalizerpadLock"-->
- <!-- placeholder="选择挂锁类型"-->
- <!-- />-->
- <!-- </el-form-item>-->
- <!-- </el-col>-->
- </el-row>
- <el-row>
- <!-- <el-col :span="11">-->
- <!-- <el-form-item label="锁具机构名称" prop="lockTypeName">-->
- <!-- <el-input-->
- <!-- style="width: 300px"-->
- <!-- v-model="form.lockTypeName"-->
- <!-- placeholder="请输入锁具机构名称"-->
- <!-- />-->
- <!-- </el-form-item>-->
- <!-- </el-col>-->
- <el-col :span="11">
- <el-form-item label="能量源" prop="powerType">
- <el-select
- style="width: 300px"
- v-model="form.powerType"
- placeholder="请选择能量源"
- >
- <el-option
- v-for="dict in dict.type.power_type"
- :key="dict.value"
- :label="dict.label"
- :value="dict.value"
- />
- </el-select>
- </el-form-item>
- <!-- <el-form-item label="锁具机构类型" prop="locksetTypeId">-->
- <!-- <treeselect-->
- <!-- style="width: 300px"-->
- <!-- v-model="form.locksetTypeId"-->
- <!-- :options="LockTypeOptions"-->
- <!-- :normalizer="normalizerLockset"-->
- <!-- placeholder="选择锁具机构类型"-->
- <!-- />-->
- <!-- </el-form-item>-->
- </el-col>
- <el-col :span="11">
- <el-form-item label="隔离点序列号" prop="pointSerialNumber">
- <el-input
- style="width: 300px"
- v-model="form.pointSerialNumber"
- placeholder="请输入隔离点序列号"
- clearable
- @keyup.enter.native="handleQuery"
- />
- </el-form-item>
- </el-col>
- </el-row>
- <el-row>
- <el-col :span="8">
- <el-form-item label="作用" prop="remark">
- <el-input
- style="width: 300px"
- v-model="form.remark"
- placeholder="请输入作用"
- />
- </el-form-item>
- </el-col>
- </el-row>
- <el-row>
- <el-col :span="12">
- <el-form-item label="隔离点图标" prop="pointIcon">
- <!-- <ImageUploadSingle-->
- <!-- :limit="1"-->
- <!-- :value="form.pointIcon"-->
- <!-- :fileSize="5"-->
- <!-- @onUploaded="handleIconUplaoded"-->
- <!-- @onRemoved="handleIconRemoved"-->
- <!-- ></ImageUploadSingle>-->
- <div class="image-grid">
- <div
- v-for="(imageUrl, index) in imageMap"
- :key="index"
- class="image-item"
- :class="{ 'selected': selectedImageIndex === index }"
- @click="selectIcon(imageUrl, index)"
- >
- <img :src="imageUrl" alt="Isolation Icon" style="width: 50px; height: 50px;" />
- </div>
- </div>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="隔离点图片" prop="pointPicture">
- <ImageUploadSingle
- :limit="1"
- :value="form.pointPicture"
- :fileSize="5"
- @onUploaded="handleImgUplaoded"
- @onRemoved="handleImgRemoved"
- ></ImageUploadSingle>
- </el-form-item>
- </el-col>
- </el-row>
- <!-- <el-row>-->
- <!-- <el-col :span="8">-->
- <!-- <el-form-item label="挂锁类型图" prop="lockTypeImg">-->
- <!-- <ImageUploadSingle-->
- <!-- :limit="1"-->
- <!-- :value="form.lockTypeImg"-->
- <!-- :fileSize="5"-->
- <!-- @onUploaded="lockTypeImgUplaoded"-->
- <!-- @onRemoved="lockTypeImgRemoved"-->
- <!-- ></ImageUploadSingle>-->
- <!-- </el-form-item>-->
- <!-- </el-col>-->
- <!-- <el-col :span="8">-->
- <!-- <el-form-item label="锁具机构类型图" prop="locksetTypeImg">-->
- <!-- <ImageUploadSingle-->
- <!-- :limit="1"-->
- <!-- :value="form.locksetTypeImg"-->
- <!-- :fileSize="5"-->
- <!-- @onUploaded="locksetTypeImgUplaoded"-->
- <!-- @onRemoved="locksetTypeImgRemoved"-->
- <!-- ></ImageUploadSingle>-->
- <!-- </el-form-item>-->
- <!-- </el-col>-->
- <!-- </el-row>-->
- </el-form>
- <div slot="footer" class="dialog-footer">
- <el-button v-no-more-click type="primary" @click="submitForm"
- >确 定
- </el-button
- >
- <el-button v-no-more-click @click="cancel">取 消</el-button>
- </div>
- </el-dialog>
- </div>
- </template>
- <script>
- import {
- getIsIsolationPointPage,
- addinsertIsIsolationPoint,
- updateIsIsolationPoint,
- workshoplistAll,
- getIsWorkareaList,
- selectIsIsolationPointById,
- deleteIsIsolationPointByPointIds
- } from '@/api/mes/spm/segregationPoint'
- import { genCode } from '@/api/system/autocode/rule'
- import Treeselect from '@riophae/vue-treeselect'
- import '@riophae/vue-treeselect/dist/vue-treeselect.css'
- import { listWorkarea } from '@/api/mes/wa/workarea'
- import { listLockType } from '@/api/mes/locktype/locktype'
- import { listPadLockTypeAPI } from '@/api/mes/padLockType/padLockType'
- import { listLoto } from '@/api/mes/lotoStation/lotoStation'
- import { getIsLotoSwitchMapPage } from '@/api/mes/switchmanagement/switchmanagement'
- import { listMarsDept } from '@/api/system/marsdept'
- import { listTechnology } from '@/api/system/machinery'
- import { getIsSystemAttributeByKey, selectIsSystemAttributeById } from '@/api/system/configuration'
- import {getIsRfidTokenPage} from "@/api/mes/rfid_token";
- export default {
- name: 'Team',
- components: { Treeselect },
- dicts: ['power_type', 'point_type', 'lock_type','switch_status'],
- data() {
- return {
- //自动生成编码
- autoGenFlag: false,
- optType: undefined,
- // 遮罩层
- loading: true,
- // 选中数组
- ids: [],
- codes: [],
- // 非单个禁用
- single: true,
- // 非多个禁用
- multiple: true,
- // 部门树选项
- deptOptions: [],
- // 显示搜索条件
- showSearch: true,
- // 总条数
- total: 0,
- // 班组表格数据
- isolationList: [],
- // 弹出层标题
- title: '',
- // 是否显示弹出层
- open: false,
- // 车间数据
- workshopList: [],
- // 作业区域数据
- workareaList: [],
- // 新增或修改
- pointId: null,
- // 查询参数
- createTime: '',
- queryParams: {
- current: 1,
- size: 10,
- pointCode: '',
- pointName: '',
- lotoId:'',
- delFlag: '',
- pointType: '',
- powerType: '',
- startTime: '',
- endTime: ''
- },
- pickerOptions: {
- shortcuts: [
- {
- text: '最近一周',
- onClick(picker) {
- const end = new Date()
- const start = new Date()
- start.setTime(start.getTime() - 3600 * 1000 * 24 * 7)
- picker.$emit('pick', [start, end])
- }
- },
- {
- text: '最近一个月',
- onClick(picker) {
- const end = new Date()
- const start = new Date()
- start.setTime(start.getTime() - 3600 * 1000 * 24 * 30)
- picker.$emit('pick', [start, end])
- }
- },
- {
- text: '最近三个月',
- onClick(picker) {
- const end = new Date()
- const start = new Date()
- start.setTime(start.getTime() - 3600 * 1000 * 24 * 90)
- picker.$emit('pick', [start, end])
- }
- }
- ]
- },
- // 表单参数
- form: {},
- //工艺树
- machineryOptions: [],
- LockTypeOptions: [],//锁具机构类型下拉
- padLockTypeOptions: [],//挂锁类型下拉
- lotoOptions: [],//电柜下拉
- switchMapOptions: [],//布局地图下拉
- // 表单校验
- rules: {
- pointCode: [
- { required: true, message: '隔离点编号不能为空', trigger: 'blur' }
- ],
- pointName: [
- { required: true, message: '隔离点名称不能为空', trigger: 'blur' }
- ],
- workshopId: [
- { required: true, message: '所属车间不能为空', trigger: 'blur' }
- ],
- workareaId: [
- { required: true, message: '作业区域不能为空', trigger: 'blur' }
- ],
- lotoId: [
- { required: true, message: '锁定站不能为空', trigger: 'blur' }
- ],
- pointType: [
- { required: true, message: '隔离点类型不能为空', trigger: 'blur' }
- ],
- lockTypeId: [
- { required: true, message: '挂锁类型不能为空', trigger: 'blur' }
- ],
- rfidId: [
- { required: true, message: '隔离点NFC不能为空', trigger: 'blur' }
- ],
- switchMapId:[
- {required: true, message: '布局地图不能为空', trigger: 'blur'}
- ]
- },
- imageMap: {
- 0: '', //电能
- 1: '', //阀门
- 2: '', //空气能
- 3: '' //急停开关
- },
- selectedImageIndex: -1, // 用于记录选中的图片索引
- RfidTokenData:null,//绑定rfid的列表
- }
- },
- created() {
- this.getList()
- this.getworkShop()
- this.getworkArea()
- },
- methods: {
- // 格式化日期查询数据
- formatDate(date) {
- if (date && date instanceof Date && !isNaN(date)) {
- // 使用本地时间
- return `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(
- 2,
- '0'
- )}-${String(date.getDate()).padStart(2, '0')}`
- }
- return null
- },
- // 选择隔离点图标
- selectIcon(imageUrl, index) {
- this.form.pointIcon = imageUrl
- this.selectedImageIndex = index
- },
- /** 查询隔离点信息列表 */
- getList() {
- this.loading = true
- // 格式化日期并更新queryParams
- if (Array.isArray(this.createTime) && this.createTime.length === 2) {
- this.queryParams.startTime = this.formatDate(this.createTime[0])
- this.queryParams.endTime = this.formatDate(this.createTime[1])
- }
- getIsIsolationPointPage(this.queryParams).then((response) => {
- // console.log(response, "接口返回结果");
- this.isolationList = response.data.records
- this.total = response.data.total
- this.loading = false
- })
- // 获取隔离点图标组合
- const sysAttrKey1 = 'sys.icon_set.isolation' // 隔离点集合图标
- // 获取 ID 列表
- getIsSystemAttributeByKey(sysAttrKey1).then((response) => {
- const Values = response.data.sysAttrValue.split(',').map(Value => Value.trim())
- console.log(Values, 'Values')
- // 创建一个 Promise 数组,每个 Promise 处理一个 ID
- const promises = Values.map(Value => {
- return getIsSystemAttributeByKey(Value)
- })
- // 等待所有请求完成
- return Promise.all(promises)
- }).then((responses) => {
- // responses 是一个数组,包含每个请求的响应
- responses.forEach((response, index) => {
- // 假设每个响应包含一个图片地址
- this.imageMap[index] = response.data.sysAttrValue // 根据实际响应结构调整
- })
- console.log(this.imageMap, 'imageMap')
- }).catch(error => {
- console.error('Error fetching images:', error)
- })
- // 获取作业区域数据
- const data = {
- current: 1,
- size: -1
- }
- // 隔离点nfc-rfid-token的数据
- getIsRfidTokenPage(data).then(response => {
- console.log(response,'responserfid_token')
- this.RfidTokenData = response.data.records.map((record, index) => {
- return{
- value: record.rfidId,
- label:record.rfid,
- }
- })
- })
- // listWorkarea(data).then((response) => {
- // this.deptOptions = this.handleTree(
- // response.data.records,
- // 'workareaId',
- // 'parentId',
- // 'children'
- // )
- // })
- // 岗位
- listMarsDept(data).then(response => {
- this.deptOptions = this.handleTree(response.data.records, 'workstationId', 'parentId')
- })
- // 设备/工艺
- listTechnology(data).then((response) => {
- const data = response.data.records.filter((item) => item.machineryType == '工艺')
- this.machineryOptions = this.handleTree(
- data,
- 'machineryId',
- 'parentId'
- )
- })
- // 锁具机构类型
- listLockType(data).then((response) => {
- this.LockTypeOptions = this.handleTree(response.data.records, 'locksetTypeId')
- })
- // 挂锁类型
- listPadLockTypeAPI(data).then((response) => {
- this.padLockTypeOptions = this.handleTree(response.data.records, 'lockTypeId')
- })
- // 所属电柜
- listLoto(data).then((response) => {
- console.log(response, '电柜数据')
- this.lotoOptions = response.data.records.map((item) => {
- return {
- value: item.lotoId,
- label: item.lotoName
- }
- })
- })
- // 所属开关布局地图 switchMapOptions
- getIsLotoSwitchMapPage(data).then(response => {
- this.switchMapOptions= response.data.records.map((item) => {
- return {
- value: item.switchMapId,
- label: item.switchMapName
- }
- })
- })
- },
- /** 转换部门数据结构 */
- normalizer(node) {
- if (node.children && !node.children.length) {
- delete node.children
- }
- return {
- id: node.workstationId,
- label: node.workstationName,
- children: node.children
- }
- },
- Machinerynormalizer(node) {
- if (node.children && !node.children.length) {
- delete node.children
- }
- return {
- id: node.machineryId,
- label: node.machineryName,
- children: node.children
- }
- },
- // 取消按钮
- cancel() {
- this.open = false
- this.reset()
- },
- // 表单重置
- reset() {
- this.form = {
- pointCode: null,
- pointName: null,
- pointIcon: null,
- pointPicture: null,
- pointType: null,
- powerType: null,
- createTime: null
- }
- this.autoGenFlag = false
- this.resetForm('form')
- },
- /** 搜索按钮操作 */
- handleQuery() {
- this.queryParams.current = 1
- if (Array.isArray(this.createTime) && this.createTime.length === 2) {
- this.queryParams.startTime = this.formatDate(this.createTime[0])
- this.queryParams.endTime = this.formatDate(this.createTime[1])
- }
- getIsIsolationPointPage(this.queryParams).then((response) => {
- // console.log(response, "接口返回结果");
- this.isolationList = response.data.records
- this.total = response.data.total
- this.loading = false
- })
- },
- /** 重置按钮操作 */
- resetQuery() {
- this.createTime = '';
- (this.queryParams.startTime = ''),
- (this.queryParams.endTime = ''),
- this.resetForm('queryForm')
- if (Array.isArray(this.createTime) && this.createTime.length === 2) {
- this.queryParams.startTime = this.formatDate(this.createTime[0])
- this.queryParams.endTime = this.formatDate(this.createTime[1])
- }
- getIsIsolationPointPage(this.queryParams).then((response) => {
- // console.log(response, "接口返回结果");
- this.isolationList = response.data.records
- this.total = response.data.total
- this.loading = false
- })
- },
- // 多选框选中数据
- handleSelectionChange(selection) {
- this.ids = selection.map((item) => item.pointId)
- this.codes = selection.map((item) => item.pointCode)
- this.single = selection.length !== 1
- this.multiple = !selection.length
- },
- /** 新增按钮操作 */
- handleAdd() {
- this.reset()
- this.open = true
- this.title = '新增隔离点'
- this.optType = 'add'
- this.pointId = null
- this.form.workshopId = 0
- this.selectedImageIndex=null//为了初始化不选中任何图标
- this.getworkShop()
- },
- /** 修改按钮操作 */
- handleUpdate(row) {
- this.reset()
- this.pointId = row.pointId || this.ids
- selectIsIsolationPointById(this.pointId).then((response) => {
- this.form = response.data
- // 确定选中的图片索引
- this.selectedImageIndex = this.getImageIndexByIcon(response.data.pointIcon);
- this.open = true
- this.title = '修改隔离点信息'
- this.optType = 'edit'
- })
- },
- // 编辑的时候回显选中的隔离点图标
- getImageIndexByIcon(iconUrl) {
- for (const [index, imageUrl] of Object.entries(this.imageMap)) {
- if (imageUrl === iconUrl) {
- return index;
- }
- }
- return -1; // 如果没有找到匹配的图片,返回 -1
- },
- /** 提交按钮 */
- submitForm() {
- this.$refs['form'].validate((valid) => {
- if (valid) {
- console.log(this.pointId, 'this.pointId')
- if (this.pointId != null) {
- console.log(this.form, '隔离点修改form')
- updateIsIsolationPoint(this.form).then((response) => {
- this.$modal.msgSuccess('修改成功')
- this.open = false
- this.getList()
- })
- } else {
- console.log(this.form, '新增参数')
- addinsertIsIsolationPoint(this.form).then((response) => {
- this.$modal.msgSuccess('新增成功')
- this.open = false
- this.getList()
- this.pointId = null
- })
- }
- }
- })
- },
- /** 删除按钮操作 */
- handleDelete(row) {
- const teamIds = row.pointId || this.ids
- // const pointcodes = row.pointCode || this.codes
- // '是否确认删除隔离点编号为"' + pointcodes + '"的数据项?'
- this.$modal
- .confirm('是否确认删除所选数据项?')
- .then(function() {
- return deleteIsIsolationPointByPointIds(teamIds)
- })
- .then(() => {
- this.getList()
- this.$modal.msgSuccess('删除成功')
- })
- .catch(() => {
- })
- },
- /** 导出按钮操作 */
- handleExport() {
- this.download(
- 'cal/team/export',
- {
- ...this.queryParams
- },
- `team_${new Date().getTime()}.xlsx`
- )
- },
- //自动生成编码
- handleAutoGenChange(autoGenFlag) {
- if (autoGenFlag) {
- genCode('ISOLATION_POINT_CODE').then((response) => {
- this.form.pointCode = response
- })
- } else {
- this.form.pointCode = null
- }
- },
- // 获取车间数据
- getworkShop() {
- workshoplistAll().then((response) => {
- // console.log(response, "获取车间数据");
- this.workshopList = response.data.map((item) => {
- return {
- label: item.workshopName,
- value: item.workshopId,
- key: item.workshopCode
- }
- })
- })
- },
- // 所属车间下拉改变作业区域内容
- workShopChange() {
- this.getworkArea()
- },
- // 获取作业区域数据
- getworkArea() {
- const workshopId = this.form.workshopId
- if (workshopId) {
- getIsWorkareaList(workshopId).then((response) => {
- console.log(response, '获取作业区域数据')
- this.workareaList = response.data.map((item) => {
- return {
- label: item.workareaName,
- value: item.workareaId,
- key: item.workareaCode
- }
- })
- })
- }
- },
- normalizerLockset(node) {
- if (node.children && !node.children.length) {
- delete node.children
- }
- return {
- id: node.locksetTypeId,
- label: node.locksetTypeName,
- children: node.children
- }
- },
- normalizerpadLock(node) {
- if (node.children && !node.children.length) {
- delete node.children
- }
- return {
- id: node.lockTypeId,
- label: node.lockTypeName,
- children: node.children
- }
- },
- //图片上传成功
- handleImgUplaoded(imgUrl) {
- this.form.pointPicture = imgUrl[0].url
- },
- //图片移除
- handleImgRemoved(imgUrl) {
- this.form.pointPicture = null
- },
- //图标上传成功
- handleIconUplaoded(imgUrl) {
- this.form.pointIcon = imgUrl[0].url
- },
- // 图标移除
- handleIconRemoved(imgUrl) {
- this.form.pointIcon = null
- },
- //图标上传成功
- lockTypeImgUplaoded(imgUrl) {
- this.form.lockTypeImg = imgUrl[0].url
- },
- // 图标移除
- lockTypeImgRemoved(imgUrl) {
- this.form.lockTypeImg = null
- },
- //图标上传成功
- locksetTypeImgUplaoded(imgUrl) {
- this.form.locksetType = imgUrl[0].url
- },
- // 图标移除
- locksetTypeImgRemoved(imgUrl) {
- this.form.locksetType = null
- },
- }
- }
- </script>
- <style lang="scss" src="@/assets/styles/dialog-title.scss" scoped>
- .el-input-width {
- width: 380px !important;
- }
- </style>
- <style lang="scss" scoped>
- .image-grid {
- display: flex;
- flex-wrap: wrap;
- }
- .image-item {
- margin: 5px;
- height: 55px;
- //background: pink;
- cursor: pointer;
- border: 2px solid transparent;
- transition: border-color 0.3s;
- position: relative;
- }
- .image-item.selected {
- height: 55px;
- border-color: rgb(2, 86, 255);
- border-width: 2px;
- }
- </style>
|