index.vue 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197
  1. <template>
  2. <div class="app-container">
  3. <el-form
  4. :model="queryParams"
  5. ref="queryForm"
  6. size="small"
  7. :inline="true"
  8. v-show="showSearch"
  9. label-width="100px"
  10. @submit.native.prevent
  11. >
  12. <!-- <el-form-item label="隔离点编号" prop="pointCode">-->
  13. <!-- <el-input-->
  14. <!-- v-model="queryParams.pointCode"-->
  15. <!-- placeholder="请输入隔离点编号"-->
  16. <!-- clearable-->
  17. <!-- @keyup.enter.native="handleQuery"-->
  18. <!-- />-->
  19. <!-- </el-form-item>-->
  20. <el-form-item label="隔离点名称" prop="pointName">
  21. <el-input
  22. v-model="queryParams.pointName"
  23. placeholder="请输入隔离点名称"
  24. clearable
  25. @keyup.enter.native="handleQuery"
  26. />
  27. </el-form-item>
  28. <el-form-item label="岗位" prop="workstationId">
  29. <treeselect style="width: 200px" v-model="queryParams.workstationId" :options="deptOptions"
  30. :normalizer="normalizer" placeholder="选择岗位"
  31. />
  32. </el-form-item>
  33. <el-form-item label="设备/工艺" prop="machineryId">
  34. <treeselect style="width: 200px" v-model="queryParams.machineryId" :options="machineryOptions"
  35. :normalizer="Machinerynormalizer" placeholder="选择设备/工艺"
  36. />
  37. </el-form-item>
  38. <el-form-item label="锁定站" prop="lotoId">
  39. <el-select
  40. v-model="queryParams.lotoId"
  41. placeholder="请选择锁定站"
  42. >
  43. <el-option
  44. v-for="dict in lotoOptions"
  45. :key="dict.value"
  46. :label="dict.label"
  47. :value="dict.value"
  48. />
  49. </el-select>
  50. </el-form-item>
  51. <!-- <el-form-item label="状态" prop="calendarType">
  52. <el-select v-model="queryParams.calendarType" placeholder="状态">
  53. <el-option>正常</el-option>
  54. <el-option>异常</el-option>
  55. </el-select>
  56. </el-form-item> -->
  57. <!-- <el-form-item label="隔离点类型" prop="pointType">-->
  58. <!-- <el-select-->
  59. <!-- v-model="queryParams.pointType"-->
  60. <!-- placeholder="请选择隔离点类型"-->
  61. <!-- >-->
  62. <!-- <el-option-->
  63. <!-- v-for="dict in dict.type.point_type"-->
  64. <!-- :key="dict.value"-->
  65. <!-- :label="dict.label"-->
  66. <!-- :value="dict.value"-->
  67. <!-- />-->
  68. <!-- </el-select>-->
  69. <!-- </el-form-item>-->
  70. <el-form-item label="能量源" prop="powerType">
  71. <el-select
  72. style="width: 200px"
  73. v-model="queryParams.powerType"
  74. placeholder="请选择能量源"
  75. >
  76. <el-option
  77. v-for="dict in dict.type.power_type"
  78. :key="dict.value"
  79. :label="dict.label"
  80. :value="dict.value"
  81. />
  82. </el-select>
  83. </el-form-item>
  84. <!-- <el-form-item label="创建时间">-->
  85. <!-- <el-date-picker-->
  86. <!-- v-model="createTime"-->
  87. <!-- type="daterange"-->
  88. <!-- align="right"-->
  89. <!-- unlink-panels-->
  90. <!-- range-separator="至"-->
  91. <!-- start-placeholder="开始日期"-->
  92. <!-- end-placeholder="结束日期"-->
  93. <!-- :picker-options="pickerOptions"-->
  94. <!-- >-->
  95. <!-- </el-date-picker>-->
  96. <!-- </el-form-item>-->
  97. <el-form-item>
  98. <el-button
  99. v-no-more-click
  100. type="primary"
  101. icon="el-icon-search"
  102. size="mini"
  103. @click="handleQuery"
  104. >搜索
  105. </el-button
  106. >
  107. <el-button
  108. v-no-more-click
  109. icon="el-icon-refresh"
  110. size="mini"
  111. @click="resetQuery"
  112. >重置
  113. </el-button
  114. >
  115. </el-form-item>
  116. </el-form>
  117. <el-row :gutter="10" class="mb8">
  118. <el-col :span="1.5">
  119. <el-button
  120. v-no-more-click
  121. type="primary"
  122. plain
  123. icon="el-icon-plus"
  124. size="mini"
  125. @click="handleAdd"
  126. v-hasPermi="['iscs:point:add']"
  127. >新增
  128. </el-button>
  129. </el-col>
  130. <el-col :span="1.5">
  131. <el-button
  132. v-no-more-click
  133. type="danger"
  134. plain
  135. icon="el-icon-delete"
  136. size="mini"
  137. :disabled="multiple"
  138. @click="handleDelete"
  139. v-hasPermi="['iscs:point:remove']"
  140. >批量删除
  141. </el-button>
  142. </el-col>
  143. <!-- <el-col :span="1.5">-->
  144. <!-- <el-button v-no-more-click-->
  145. <!-- type="warning"-->
  146. <!-- plain-->
  147. <!-- icon="el-icon-download"-->
  148. <!-- size="mini"-->
  149. <!-- @click="handleExport"-->
  150. <!-- v-hasPermi="['mes:cal:team:export']"-->
  151. <!-- >导出</el-button>-->
  152. <!-- </el-col>-->
  153. <right-toolbar
  154. :showSearch.sync="showSearch"
  155. @queryTable="getList"
  156. ></right-toolbar>
  157. </el-row>
  158. <el-table
  159. v-loading="loading"
  160. :data="isolationList"
  161. @selection-change="handleSelectionChange"
  162. >
  163. <el-table-column type="selection" width="55" align="center"/>
  164. <!-- <el-table-column label="隔离点ID" align="center" prop="pointId">
  165. <template slot-scope="scope">
  166. <el-button v-no-more-click
  167. type="text"
  168. @click="handleView(scope.row)"
  169. v-hasPermi="['mes:md:seg:query']"
  170. >{{ scope.row.pointId }}
  171. </el-button>
  172. </template>
  173. </el-table-column> -->
  174. <el-table-column label="隔离点编号" align="center" prop="pointCode" width="100">
  175. <template slot-scope="scope">
  176. <el-button
  177. v-no-more-click
  178. type="text"
  179. @click="handleView(scope.row)"
  180. v-hasPermi="['iscs:point:list']"
  181. >{{ scope.row.pointCode }}
  182. </el-button>
  183. </template>
  184. </el-table-column>
  185. <el-table-column label="隔离点名称" align="center" prop="pointName"/>
  186. <el-table-column
  187. label="隔离点图标"
  188. align="center"
  189. prop="pointIcon"
  190. width="90"
  191. >
  192. <template slot-scope="scope">
  193. <img
  194. v-if="scope.row.pointIcon"
  195. :src="scope.row.pointIcon"
  196. alt=""
  197. style="width: 50px; height: 50px"
  198. />
  199. <span v-else>-</span>
  200. </template>
  201. </el-table-column>
  202. <el-table-column label="开关状态" align="center" prop="switchStatus">
  203. <template slot-scope="scope">
  204. <!-- <dict-tag :options="dict.type.switch_status" :value="scope.row.switchStatus"></dict-tag>-->
  205. <el-switch
  206. style="pointer-events: none"
  207. v-if="scope.row.switchStatus!==null"
  208. v-model="scope.row.switchStatus"
  209. active-value="1"
  210. inactive-value="0"
  211. active-text="ON"
  212. inactive-text="OFF"
  213. active-color="#13ce66"
  214. inactive-color="#ff4949"
  215. ></el-switch>
  216. <span v-else>-</span>
  217. </template>
  218. </el-table-column>
  219. <el-table-column label="隔离点NFC" align="center" prop="pointNfc" >
  220. </el-table-column>
  221. <el-table-column label="岗位" align="center" prop="workstationName">
  222. </el-table-column>
  223. <el-table-column label="设备/工艺" align="center" prop="machineryName">
  224. </el-table-column>
  225. <el-table-column label="锁定站" align="center" prop="lotoName">
  226. </el-table-column>
  227. <el-table-column label="布局地图" align="center" prop="switchMapName">
  228. </el-table-column>
  229. <el-table-column label="隔离点序列号" align="center" prop="pointSerialNumber">
  230. </el-table-column>
  231. <el-table-column label="作用" align="center" prop="remark">
  232. </el-table-column>
  233. <!-- <el-table-column label="状态" align="center" prop="calendarType">
  234. <template slot-scope="scope">
  235. <dict-tag
  236. :options="dict.type.mes_calendar_type"
  237. :value="scope.row.calendarType"
  238. />
  239. </template>
  240. </el-table-column> -->
  241. <el-table-column
  242. label="隔离点图片"
  243. align="center"
  244. prop="pointPicture"
  245. width="90"
  246. >
  247. <template slot-scope="scope">
  248. <img
  249. v-if="scope.row.pointPicture"
  250. :src="scope.row.pointPicture"
  251. alt=""
  252. style="width: 50px; height: 50px"
  253. />
  254. <span v-else>-</span>
  255. </template>
  256. </el-table-column>
  257. <!-- <el-table-column label="隔离点类型" align="center" prop="pointType">-->
  258. <!-- <template slot-scope="scope">-->
  259. <!-- <dict-tag-->
  260. <!-- :options="dict.type.point_type"-->
  261. <!-- :value="scope.row.pointType"-->
  262. <!-- />-->
  263. <!-- </template>-->
  264. <!-- </el-table-column>-->
  265. <!--危险能量类型-->
  266. <el-table-column label="能量源" align="center" prop="powerType">
  267. <template slot-scope="scope">
  268. <dict-tag
  269. :options="dict.type.power_type"
  270. :value="scope.row.powerType"
  271. />
  272. </template>
  273. </el-table-column>
  274. <!-- <el-table-column-->
  275. <!-- label="挂锁类型图"-->
  276. <!-- align="center"-->
  277. <!-- prop="lockTypeImg"-->
  278. <!-- width="90"-->
  279. <!-- >-->
  280. <!-- <template slot-scope="scope">-->
  281. <!-- <img-->
  282. <!-- v-if="scope.row.lockTypeImg"-->
  283. <!-- :src="scope.row.lockTypeImg"-->
  284. <!-- alt=""-->
  285. <!-- style="width: 50px; height: 50px"-->
  286. <!-- />-->
  287. <!-- <span v-else>-</span>-->
  288. <!-- </template>-->
  289. <!-- </el-table-column>-->
  290. <!-- <el-table-column-->
  291. <!-- label="锁具机构类型图"-->
  292. <!-- align="center"-->
  293. <!-- prop="locksetTypeImg"-->
  294. <!-- width="90"-->
  295. <!-- >-->
  296. <!-- <template slot-scope="scope">-->
  297. <!-- <img-->
  298. <!-- v-if="scope.row.locksetTypeImg"-->
  299. <!-- :src="scope.row.locksetTypeImg"-->
  300. <!-- alt=""-->
  301. <!-- style="width: 50px; height: 50px"-->
  302. <!-- />-->
  303. <!-- <span v-else>-</span>-->
  304. <!-- </template>-->
  305. <!-- </el-table-column>-->
  306. <!-- <el-table-column label="创建时间" align="center" prop="createTime">-->
  307. <!-- </el-table-column>-->
  308. <el-table-column
  309. label="操作"
  310. align="center"
  311. class-name="small-padding fixed-width"
  312. >
  313. <template slot-scope="scope">
  314. <el-button
  315. v-no-more-click
  316. size="mini"
  317. type="text"
  318. icon="el-icon-edit"
  319. @click="handleUpdate(scope.row)"
  320. v-hasPermi="['iscs:point:edit']"
  321. >修改
  322. </el-button>
  323. <el-button
  324. v-no-more-click
  325. size="mini"
  326. type="text"
  327. icon="el-icon-delete"
  328. @click="handleDelete(scope.row)"
  329. v-hasPermi="['iscs:point:remove']"
  330. >删除
  331. </el-button>
  332. </template>
  333. </el-table-column>
  334. </el-table>
  335. <pagination
  336. v-show="total > 0"
  337. :total="total"
  338. :page.sync="queryParams.current"
  339. :limit.sync="queryParams.size"
  340. @pagination="getList"
  341. />
  342. <!-- 添加或修改班组对话框 -->
  343. <el-dialog :visible.sync="open" width="960px" append-to-body>
  344. <div slot="title" class="dialog-title">
  345. <i></i>
  346. <span class="title">{{ title }}</span>
  347. </div>
  348. <el-form ref="form" :model="form" :rules="rules" label-width="110px">
  349. <el-row>
  350. <el-col :span="7">
  351. <el-form-item label="隔离点编号" prop="pointCode">
  352. <el-input
  353. v-model="form.pointCode"
  354. placeholder="请输入隔离点编号"
  355. />
  356. </el-form-item>
  357. </el-col>
  358. <el-col :span="4">
  359. <el-form-item label-width="80">
  360. <el-switch
  361. v-model="autoGenFlag"
  362. active-color="#13ce66"
  363. active-text="自动生成"
  364. @change="handleAutoGenChange(autoGenFlag)"
  365. v-if="optType != 'view'"
  366. >
  367. </el-switch>
  368. </el-form-item>
  369. </el-col>
  370. <el-col :span="12">
  371. <el-form-item label="隔离点名称" prop="pointName">
  372. <el-input
  373. style="width: 300px"
  374. v-model="form.pointName"
  375. placeholder="请输入隔离点名称"
  376. />
  377. </el-form-item>
  378. </el-col>
  379. </el-row>
  380. <el-row>
  381. <!-- <el-col :span="11">-->
  382. <!-- <el-form-item label="隔离点类型" prop="pointType">-->
  383. <!-- <el-select-->
  384. <!-- style="width: 300px"-->
  385. <!-- v-model="form.pointType"-->
  386. <!-- placeholder="请选择隔离点类型"-->
  387. <!-- >-->
  388. <!-- <el-option-->
  389. <!-- v-for="dict in dict.type.point_type"-->
  390. <!-- :key="dict.value"-->
  391. <!-- :label="dict.label"-->
  392. <!-- :value="dict.value"-->
  393. <!-- />-->
  394. <!-- </el-select>-->
  395. <!-- </el-form-item>-->
  396. <!-- </el-col>-->
  397. <el-col :span="11">
  398. <el-form-item label="岗位" prop="workstationId">
  399. <treeselect style="width: 300px" v-model="form.workstationId" :options="deptOptions"
  400. :normalizer="normalizer" placeholder="选择岗位"
  401. />
  402. </el-form-item>
  403. </el-col>
  404. <el-col :span="12">
  405. <el-form-item label="隔离点NFC" prop="rfidId" >
  406. <!-- <el-input-->
  407. <!-- style="width: 300px"-->
  408. <!-- v-model="form.pointNfc"-->
  409. <!-- placeholder="请输入隔离点NFC"-->
  410. <!-- maxlength="16"-->
  411. <!-- />-->
  412. <el-select v-model="form.rfidId" style="width: 300px">
  413. <el-option v-for="dict in this.RfidTokenData" :label="dict.label" :value="dict.value"></el-option>
  414. </el-select>
  415. </el-form-item>
  416. </el-col>
  417. </el-row>
  418. <el-row>
  419. <!-- <el-form-item label="作业区域" prop="workareaId">-->
  420. <!-- <treeselect-->
  421. <!-- style="width: 300px"-->
  422. <!-- v-model="form.workareaId"-->
  423. <!-- :options="deptOptions"-->
  424. <!-- :normalizer="normalizer"-->
  425. <!-- placeholder="选择作业区域"-->
  426. <!-- />-->
  427. <!-- </el-form-item>-->
  428. <el-col :span="11">
  429. <el-form-item label="锁定站" prop="lotoId">
  430. <el-select
  431. style="width: 300px"
  432. v-model="form.lotoId"
  433. placeholder="请选择锁定站"
  434. >
  435. <el-option
  436. v-for="dict in lotoOptions"
  437. :key="dict.value"
  438. :label="dict.label"
  439. :value="dict.value"
  440. />
  441. </el-select>
  442. </el-form-item>
  443. </el-col>
  444. <el-col :span="11">
  445. <el-form-item label="布局地图" prop="switchMapId">
  446. <el-select
  447. style="width: 300px"
  448. v-model="form.switchMapId"
  449. placeholder="请选择布局地图"
  450. >
  451. <el-option
  452. v-for="dict in switchMapOptions"
  453. :key="dict.value"
  454. :label="dict.label"
  455. :value="dict.value"
  456. />
  457. </el-select>
  458. </el-form-item>
  459. </el-col>
  460. <!-- <el-col :span="11">-->
  461. <!-- <el-form-item label="挂锁类型" prop="lockTypeId">-->
  462. <!-- <treeselect-->
  463. <!-- style="width: 300px"-->
  464. <!-- v-model="form.lockTypeId"-->
  465. <!-- :options="padLockTypeOptions"-->
  466. <!-- :normalizer="normalizerpadLock"-->
  467. <!-- placeholder="选择挂锁类型"-->
  468. <!-- />-->
  469. <!-- </el-form-item>-->
  470. <!-- </el-col>-->
  471. </el-row>
  472. <el-row>
  473. <!-- <el-col :span="11">-->
  474. <!-- <el-form-item label="锁具机构名称" prop="lockTypeName">-->
  475. <!-- <el-input-->
  476. <!-- style="width: 300px"-->
  477. <!-- v-model="form.lockTypeName"-->
  478. <!-- placeholder="请输入锁具机构名称"-->
  479. <!-- />-->
  480. <!-- </el-form-item>-->
  481. <!-- </el-col>-->
  482. <el-col :span="11">
  483. <el-form-item label="能量源" prop="powerType">
  484. <el-select
  485. style="width: 300px"
  486. v-model="form.powerType"
  487. placeholder="请选择能量源"
  488. >
  489. <el-option
  490. v-for="dict in dict.type.power_type"
  491. :key="dict.value"
  492. :label="dict.label"
  493. :value="dict.value"
  494. />
  495. </el-select>
  496. </el-form-item>
  497. <!-- <el-form-item label="锁具机构类型" prop="locksetTypeId">-->
  498. <!-- <treeselect-->
  499. <!-- style="width: 300px"-->
  500. <!-- v-model="form.locksetTypeId"-->
  501. <!-- :options="LockTypeOptions"-->
  502. <!-- :normalizer="normalizerLockset"-->
  503. <!-- placeholder="选择锁具机构类型"-->
  504. <!-- />-->
  505. <!-- </el-form-item>-->
  506. </el-col>
  507. <el-col :span="11">
  508. <el-form-item label="隔离点序列号" prop="pointSerialNumber">
  509. <el-input
  510. style="width: 300px"
  511. v-model="form.pointSerialNumber"
  512. placeholder="请输入隔离点序列号"
  513. clearable
  514. @keyup.enter.native="handleQuery"
  515. />
  516. </el-form-item>
  517. </el-col>
  518. </el-row>
  519. <el-row>
  520. <el-col :span="8">
  521. <el-form-item label="作用" prop="remark">
  522. <el-input
  523. style="width: 300px"
  524. v-model="form.remark"
  525. placeholder="请输入作用"
  526. />
  527. </el-form-item>
  528. </el-col>
  529. </el-row>
  530. <el-row>
  531. <el-col :span="12">
  532. <el-form-item label="隔离点图标" prop="pointIcon">
  533. <!-- <ImageUploadSingle-->
  534. <!-- :limit="1"-->
  535. <!-- :value="form.pointIcon"-->
  536. <!-- :fileSize="5"-->
  537. <!-- @onUploaded="handleIconUplaoded"-->
  538. <!-- @onRemoved="handleIconRemoved"-->
  539. <!-- ></ImageUploadSingle>-->
  540. <div class="image-grid">
  541. <div
  542. v-for="(imageUrl, index) in imageMap"
  543. :key="index"
  544. class="image-item"
  545. :class="{ 'selected': selectedImageIndex === index }"
  546. @click="selectIcon(imageUrl, index)"
  547. >
  548. <img :src="imageUrl" alt="Isolation Icon" style="width: 50px; height: 50px;" />
  549. </div>
  550. </div>
  551. </el-form-item>
  552. </el-col>
  553. <el-col :span="8">
  554. <el-form-item label="隔离点图片" prop="pointPicture">
  555. <ImageUploadSingle
  556. :limit="1"
  557. :value="form.pointPicture"
  558. :fileSize="5"
  559. @onUploaded="handleImgUplaoded"
  560. @onRemoved="handleImgRemoved"
  561. ></ImageUploadSingle>
  562. </el-form-item>
  563. </el-col>
  564. </el-row>
  565. <!-- <el-row>-->
  566. <!-- <el-col :span="8">-->
  567. <!-- <el-form-item label="挂锁类型图" prop="lockTypeImg">-->
  568. <!-- <ImageUploadSingle-->
  569. <!-- :limit="1"-->
  570. <!-- :value="form.lockTypeImg"-->
  571. <!-- :fileSize="5"-->
  572. <!-- @onUploaded="lockTypeImgUplaoded"-->
  573. <!-- @onRemoved="lockTypeImgRemoved"-->
  574. <!-- ></ImageUploadSingle>-->
  575. <!-- </el-form-item>-->
  576. <!-- </el-col>-->
  577. <!-- <el-col :span="8">-->
  578. <!-- <el-form-item label="锁具机构类型图" prop="locksetTypeImg">-->
  579. <!-- <ImageUploadSingle-->
  580. <!-- :limit="1"-->
  581. <!-- :value="form.locksetTypeImg"-->
  582. <!-- :fileSize="5"-->
  583. <!-- @onUploaded="locksetTypeImgUplaoded"-->
  584. <!-- @onRemoved="locksetTypeImgRemoved"-->
  585. <!-- ></ImageUploadSingle>-->
  586. <!-- </el-form-item>-->
  587. <!-- </el-col>-->
  588. <!-- </el-row>-->
  589. </el-form>
  590. <div slot="footer" class="dialog-footer">
  591. <el-button v-no-more-click type="primary" @click="submitForm"
  592. >确 定
  593. </el-button
  594. >
  595. <el-button v-no-more-click @click="cancel">取 消</el-button>
  596. </div>
  597. </el-dialog>
  598. </div>
  599. </template>
  600. <script>
  601. import {
  602. getIsIsolationPointPage,
  603. addinsertIsIsolationPoint,
  604. updateIsIsolationPoint,
  605. workshoplistAll,
  606. getIsWorkareaList,
  607. selectIsIsolationPointById,
  608. deleteIsIsolationPointByPointIds
  609. } from '@/api/mes/spm/segregationPoint'
  610. import { genCode } from '@/api/system/autocode/rule'
  611. import Treeselect from '@riophae/vue-treeselect'
  612. import '@riophae/vue-treeselect/dist/vue-treeselect.css'
  613. import { listWorkarea } from '@/api/mes/wa/workarea'
  614. import { listLockType } from '@/api/mes/locktype/locktype'
  615. import { listPadLockTypeAPI } from '@/api/mes/padLockType/padLockType'
  616. import { listLoto } from '@/api/mes/lotoStation/lotoStation'
  617. import { getIsLotoSwitchMapPage } from '@/api/mes/switchmanagement/switchmanagement'
  618. import { listMarsDept } from '@/api/system/marsdept'
  619. import { listTechnology } from '@/api/system/machinery'
  620. import { getIsSystemAttributeByKey, selectIsSystemAttributeById } from '@/api/system/configuration'
  621. import {getIsRfidTokenPage} from "@/api/mes/rfid_token";
  622. export default {
  623. name: 'Team',
  624. components: { Treeselect },
  625. dicts: ['power_type', 'point_type', 'lock_type','switch_status'],
  626. data() {
  627. return {
  628. //自动生成编码
  629. autoGenFlag: false,
  630. optType: undefined,
  631. // 遮罩层
  632. loading: true,
  633. // 选中数组
  634. ids: [],
  635. codes: [],
  636. // 非单个禁用
  637. single: true,
  638. // 非多个禁用
  639. multiple: true,
  640. // 部门树选项
  641. deptOptions: [],
  642. // 显示搜索条件
  643. showSearch: true,
  644. // 总条数
  645. total: 0,
  646. // 班组表格数据
  647. isolationList: [],
  648. // 弹出层标题
  649. title: '',
  650. // 是否显示弹出层
  651. open: false,
  652. // 车间数据
  653. workshopList: [],
  654. // 作业区域数据
  655. workareaList: [],
  656. // 新增或修改
  657. pointId: null,
  658. // 查询参数
  659. createTime: '',
  660. queryParams: {
  661. current: 1,
  662. size: 10,
  663. pointCode: '',
  664. pointName: '',
  665. lotoId:'',
  666. delFlag: '',
  667. pointType: '',
  668. powerType: '',
  669. startTime: '',
  670. endTime: ''
  671. },
  672. pickerOptions: {
  673. shortcuts: [
  674. {
  675. text: '最近一周',
  676. onClick(picker) {
  677. const end = new Date()
  678. const start = new Date()
  679. start.setTime(start.getTime() - 3600 * 1000 * 24 * 7)
  680. picker.$emit('pick', [start, end])
  681. }
  682. },
  683. {
  684. text: '最近一个月',
  685. onClick(picker) {
  686. const end = new Date()
  687. const start = new Date()
  688. start.setTime(start.getTime() - 3600 * 1000 * 24 * 30)
  689. picker.$emit('pick', [start, end])
  690. }
  691. },
  692. {
  693. text: '最近三个月',
  694. onClick(picker) {
  695. const end = new Date()
  696. const start = new Date()
  697. start.setTime(start.getTime() - 3600 * 1000 * 24 * 90)
  698. picker.$emit('pick', [start, end])
  699. }
  700. }
  701. ]
  702. },
  703. // 表单参数
  704. form: {},
  705. //工艺树
  706. machineryOptions: [],
  707. LockTypeOptions: [],//锁具机构类型下拉
  708. padLockTypeOptions: [],//挂锁类型下拉
  709. lotoOptions: [],//电柜下拉
  710. switchMapOptions: [],//布局地图下拉
  711. // 表单校验
  712. rules: {
  713. pointCode: [
  714. { required: true, message: '隔离点编号不能为空', trigger: 'blur' }
  715. ],
  716. pointName: [
  717. { required: true, message: '隔离点名称不能为空', trigger: 'blur' }
  718. ],
  719. workshopId: [
  720. { required: true, message: '所属车间不能为空', trigger: 'blur' }
  721. ],
  722. workareaId: [
  723. { required: true, message: '作业区域不能为空', trigger: 'blur' }
  724. ],
  725. lotoId: [
  726. { required: true, message: '锁定站不能为空', trigger: 'blur' }
  727. ],
  728. pointType: [
  729. { required: true, message: '隔离点类型不能为空', trigger: 'blur' }
  730. ],
  731. lockTypeId: [
  732. { required: true, message: '挂锁类型不能为空', trigger: 'blur' }
  733. ],
  734. rfidId: [
  735. { required: true, message: '隔离点NFC不能为空', trigger: 'blur' }
  736. ],
  737. switchMapId:[
  738. {required: true, message: '布局地图不能为空', trigger: 'blur'}
  739. ]
  740. },
  741. imageMap: {
  742. 0: '', //电能
  743. 1: '', //阀门
  744. 2: '', //空气能
  745. 3: '' //急停开关
  746. },
  747. selectedImageIndex: -1, // 用于记录选中的图片索引
  748. RfidTokenData:null,//绑定rfid的列表
  749. }
  750. },
  751. created() {
  752. this.getList()
  753. this.getworkShop()
  754. this.getworkArea()
  755. },
  756. methods: {
  757. // 格式化日期查询数据
  758. formatDate(date) {
  759. if (date && date instanceof Date && !isNaN(date)) {
  760. // 使用本地时间
  761. return `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(
  762. 2,
  763. '0'
  764. )}-${String(date.getDate()).padStart(2, '0')}`
  765. }
  766. return null
  767. },
  768. // 选择隔离点图标
  769. selectIcon(imageUrl, index) {
  770. this.form.pointIcon = imageUrl
  771. this.selectedImageIndex = index
  772. },
  773. /** 查询隔离点信息列表 */
  774. getList() {
  775. this.loading = true
  776. // 格式化日期并更新queryParams
  777. if (Array.isArray(this.createTime) && this.createTime.length === 2) {
  778. this.queryParams.startTime = this.formatDate(this.createTime[0])
  779. this.queryParams.endTime = this.formatDate(this.createTime[1])
  780. }
  781. getIsIsolationPointPage(this.queryParams).then((response) => {
  782. // console.log(response, "接口返回结果");
  783. this.isolationList = response.data.records
  784. this.total = response.data.total
  785. this.loading = false
  786. })
  787. // 获取隔离点图标组合
  788. const sysAttrKey1 = 'sys.icon_set.isolation' // 隔离点集合图标
  789. // 获取 ID 列表
  790. getIsSystemAttributeByKey(sysAttrKey1).then((response) => {
  791. const Values = response.data.sysAttrValue.split(',').map(Value => Value.trim())
  792. console.log(Values, 'Values')
  793. // 创建一个 Promise 数组,每个 Promise 处理一个 ID
  794. const promises = Values.map(Value => {
  795. return getIsSystemAttributeByKey(Value)
  796. })
  797. // 等待所有请求完成
  798. return Promise.all(promises)
  799. }).then((responses) => {
  800. // responses 是一个数组,包含每个请求的响应
  801. responses.forEach((response, index) => {
  802. // 假设每个响应包含一个图片地址
  803. this.imageMap[index] = response.data.sysAttrValue // 根据实际响应结构调整
  804. })
  805. console.log(this.imageMap, 'imageMap')
  806. }).catch(error => {
  807. console.error('Error fetching images:', error)
  808. })
  809. // 获取作业区域数据
  810. const data = {
  811. current: 1,
  812. size: -1
  813. }
  814. // 隔离点nfc-rfid-token的数据
  815. getIsRfidTokenPage(data).then(response => {
  816. console.log(response,'responserfid_token')
  817. this.RfidTokenData = response.data.records.map((record, index) => {
  818. return{
  819. value: record.rfidId,
  820. label:record.rfid,
  821. }
  822. })
  823. })
  824. // listWorkarea(data).then((response) => {
  825. // this.deptOptions = this.handleTree(
  826. // response.data.records,
  827. // 'workareaId',
  828. // 'parentId',
  829. // 'children'
  830. // )
  831. // })
  832. // 岗位
  833. listMarsDept(data).then(response => {
  834. this.deptOptions = this.handleTree(response.data.records, 'workstationId', 'parentId')
  835. })
  836. // 设备/工艺
  837. listTechnology(data).then((response) => {
  838. const data = response.data.records.filter((item) => item.machineryType == '工艺')
  839. this.machineryOptions = this.handleTree(
  840. data,
  841. 'machineryId',
  842. 'parentId'
  843. )
  844. })
  845. // 锁具机构类型
  846. listLockType(data).then((response) => {
  847. this.LockTypeOptions = this.handleTree(response.data.records, 'locksetTypeId')
  848. })
  849. // 挂锁类型
  850. listPadLockTypeAPI(data).then((response) => {
  851. this.padLockTypeOptions = this.handleTree(response.data.records, 'lockTypeId')
  852. })
  853. // 所属电柜
  854. listLoto(data).then((response) => {
  855. console.log(response, '电柜数据')
  856. this.lotoOptions = response.data.records.map((item) => {
  857. return {
  858. value: item.lotoId,
  859. label: item.lotoName
  860. }
  861. })
  862. })
  863. // 所属开关布局地图 switchMapOptions
  864. getIsLotoSwitchMapPage(data).then(response => {
  865. this.switchMapOptions= response.data.records.map((item) => {
  866. return {
  867. value: item.switchMapId,
  868. label: item.switchMapName
  869. }
  870. })
  871. })
  872. },
  873. /** 转换部门数据结构 */
  874. normalizer(node) {
  875. if (node.children && !node.children.length) {
  876. delete node.children
  877. }
  878. return {
  879. id: node.workstationId,
  880. label: node.workstationName,
  881. children: node.children
  882. }
  883. },
  884. Machinerynormalizer(node) {
  885. if (node.children && !node.children.length) {
  886. delete node.children
  887. }
  888. return {
  889. id: node.machineryId,
  890. label: node.machineryName,
  891. children: node.children
  892. }
  893. },
  894. // 取消按钮
  895. cancel() {
  896. this.open = false
  897. this.reset()
  898. },
  899. // 表单重置
  900. reset() {
  901. this.form = {
  902. pointCode: null,
  903. pointName: null,
  904. pointIcon: null,
  905. pointPicture: null,
  906. pointType: null,
  907. powerType: null,
  908. createTime: null
  909. }
  910. this.autoGenFlag = false
  911. this.resetForm('form')
  912. },
  913. /** 搜索按钮操作 */
  914. handleQuery() {
  915. this.queryParams.current = 1
  916. if (Array.isArray(this.createTime) && this.createTime.length === 2) {
  917. this.queryParams.startTime = this.formatDate(this.createTime[0])
  918. this.queryParams.endTime = this.formatDate(this.createTime[1])
  919. }
  920. getIsIsolationPointPage(this.queryParams).then((response) => {
  921. // console.log(response, "接口返回结果");
  922. this.isolationList = response.data.records
  923. this.total = response.data.total
  924. this.loading = false
  925. })
  926. },
  927. /** 重置按钮操作 */
  928. resetQuery() {
  929. this.createTime = '';
  930. (this.queryParams.startTime = ''),
  931. (this.queryParams.endTime = ''),
  932. this.resetForm('queryForm')
  933. if (Array.isArray(this.createTime) && this.createTime.length === 2) {
  934. this.queryParams.startTime = this.formatDate(this.createTime[0])
  935. this.queryParams.endTime = this.formatDate(this.createTime[1])
  936. }
  937. getIsIsolationPointPage(this.queryParams).then((response) => {
  938. // console.log(response, "接口返回结果");
  939. this.isolationList = response.data.records
  940. this.total = response.data.total
  941. this.loading = false
  942. })
  943. },
  944. // 多选框选中数据
  945. handleSelectionChange(selection) {
  946. this.ids = selection.map((item) => item.pointId)
  947. this.codes = selection.map((item) => item.pointCode)
  948. this.single = selection.length !== 1
  949. this.multiple = !selection.length
  950. },
  951. /** 新增按钮操作 */
  952. handleAdd() {
  953. this.reset()
  954. this.open = true
  955. this.title = '新增隔离点'
  956. this.optType = 'add'
  957. this.pointId = null
  958. this.form.workshopId = 0
  959. this.selectedImageIndex=null//为了初始化不选中任何图标
  960. this.getworkShop()
  961. },
  962. /** 修改按钮操作 */
  963. handleUpdate(row) {
  964. this.reset()
  965. this.pointId = row.pointId || this.ids
  966. selectIsIsolationPointById(this.pointId).then((response) => {
  967. this.form = response.data
  968. // 确定选中的图片索引
  969. this.selectedImageIndex = this.getImageIndexByIcon(response.data.pointIcon);
  970. this.open = true
  971. this.title = '修改隔离点信息'
  972. this.optType = 'edit'
  973. })
  974. },
  975. // 编辑的时候回显选中的隔离点图标
  976. getImageIndexByIcon(iconUrl) {
  977. for (const [index, imageUrl] of Object.entries(this.imageMap)) {
  978. if (imageUrl === iconUrl) {
  979. return index;
  980. }
  981. }
  982. return -1; // 如果没有找到匹配的图片,返回 -1
  983. },
  984. /** 提交按钮 */
  985. submitForm() {
  986. this.$refs['form'].validate((valid) => {
  987. if (valid) {
  988. console.log(this.pointId, 'this.pointId')
  989. if (this.pointId != null) {
  990. console.log(this.form, '隔离点修改form')
  991. updateIsIsolationPoint(this.form).then((response) => {
  992. this.$modal.msgSuccess('修改成功')
  993. this.open = false
  994. this.getList()
  995. })
  996. } else {
  997. console.log(this.form, '新增参数')
  998. addinsertIsIsolationPoint(this.form).then((response) => {
  999. this.$modal.msgSuccess('新增成功')
  1000. this.open = false
  1001. this.getList()
  1002. this.pointId = null
  1003. })
  1004. }
  1005. }
  1006. })
  1007. },
  1008. /** 删除按钮操作 */
  1009. handleDelete(row) {
  1010. const teamIds = row.pointId || this.ids
  1011. // const pointcodes = row.pointCode || this.codes
  1012. // '是否确认删除隔离点编号为"' + pointcodes + '"的数据项?'
  1013. this.$modal
  1014. .confirm('是否确认删除所选数据项?')
  1015. .then(function() {
  1016. return deleteIsIsolationPointByPointIds(teamIds)
  1017. })
  1018. .then(() => {
  1019. this.getList()
  1020. this.$modal.msgSuccess('删除成功')
  1021. })
  1022. .catch(() => {
  1023. })
  1024. },
  1025. /** 导出按钮操作 */
  1026. handleExport() {
  1027. this.download(
  1028. 'cal/team/export',
  1029. {
  1030. ...this.queryParams
  1031. },
  1032. `team_${new Date().getTime()}.xlsx`
  1033. )
  1034. },
  1035. //自动生成编码
  1036. handleAutoGenChange(autoGenFlag) {
  1037. if (autoGenFlag) {
  1038. genCode('ISOLATION_POINT_CODE').then((response) => {
  1039. this.form.pointCode = response
  1040. })
  1041. } else {
  1042. this.form.pointCode = null
  1043. }
  1044. },
  1045. // 获取车间数据
  1046. getworkShop() {
  1047. workshoplistAll().then((response) => {
  1048. // console.log(response, "获取车间数据");
  1049. this.workshopList = response.data.map((item) => {
  1050. return {
  1051. label: item.workshopName,
  1052. value: item.workshopId,
  1053. key: item.workshopCode
  1054. }
  1055. })
  1056. })
  1057. },
  1058. // 所属车间下拉改变作业区域内容
  1059. workShopChange() {
  1060. this.getworkArea()
  1061. },
  1062. // 获取作业区域数据
  1063. getworkArea() {
  1064. const workshopId = this.form.workshopId
  1065. if (workshopId) {
  1066. getIsWorkareaList(workshopId).then((response) => {
  1067. console.log(response, '获取作业区域数据')
  1068. this.workareaList = response.data.map((item) => {
  1069. return {
  1070. label: item.workareaName,
  1071. value: item.workareaId,
  1072. key: item.workareaCode
  1073. }
  1074. })
  1075. })
  1076. }
  1077. },
  1078. normalizerLockset(node) {
  1079. if (node.children && !node.children.length) {
  1080. delete node.children
  1081. }
  1082. return {
  1083. id: node.locksetTypeId,
  1084. label: node.locksetTypeName,
  1085. children: node.children
  1086. }
  1087. },
  1088. normalizerpadLock(node) {
  1089. if (node.children && !node.children.length) {
  1090. delete node.children
  1091. }
  1092. return {
  1093. id: node.lockTypeId,
  1094. label: node.lockTypeName,
  1095. children: node.children
  1096. }
  1097. },
  1098. //图片上传成功
  1099. handleImgUplaoded(imgUrl) {
  1100. this.form.pointPicture = imgUrl[0].url
  1101. },
  1102. //图片移除
  1103. handleImgRemoved(imgUrl) {
  1104. this.form.pointPicture = null
  1105. },
  1106. //图标上传成功
  1107. handleIconUplaoded(imgUrl) {
  1108. this.form.pointIcon = imgUrl[0].url
  1109. },
  1110. // 图标移除
  1111. handleIconRemoved(imgUrl) {
  1112. this.form.pointIcon = null
  1113. },
  1114. //图标上传成功
  1115. lockTypeImgUplaoded(imgUrl) {
  1116. this.form.lockTypeImg = imgUrl[0].url
  1117. },
  1118. // 图标移除
  1119. lockTypeImgRemoved(imgUrl) {
  1120. this.form.lockTypeImg = null
  1121. },
  1122. //图标上传成功
  1123. locksetTypeImgUplaoded(imgUrl) {
  1124. this.form.locksetType = imgUrl[0].url
  1125. },
  1126. // 图标移除
  1127. locksetTypeImgRemoved(imgUrl) {
  1128. this.form.locksetType = null
  1129. },
  1130. }
  1131. }
  1132. </script>
  1133. <style lang="scss" src="@/assets/styles/dialog-title.scss" scoped>
  1134. .el-input-width {
  1135. width: 380px !important;
  1136. }
  1137. </style>
  1138. <style lang="scss" scoped>
  1139. .image-grid {
  1140. display: flex;
  1141. flex-wrap: wrap;
  1142. }
  1143. .image-item {
  1144. margin: 5px;
  1145. height: 55px;
  1146. //background: pink;
  1147. cursor: pointer;
  1148. border: 2px solid transparent;
  1149. transition: border-color 0.3s;
  1150. position: relative;
  1151. }
  1152. .image-item.selected {
  1153. height: 55px;
  1154. border-color: rgb(2, 86, 255);
  1155. border-width: 2px;
  1156. }
  1157. </style>