index.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874
  1. <template>
  2. <div class="app-container">
  3. <el-radio-group v-model="tabPosition" style="margin: 5px">
  4. <el-radio-button label="first">物资柜位置</el-radio-button>
  5. <el-radio-button label="second">物资柜列表</el-radio-button>
  6. </el-radio-group>
  7. <div
  8. style="
  9. display: flex;
  10. justify-content: center;
  11. align-items: center;
  12. position: relative;
  13. "
  14. v-show="tabPosition == 'first'"
  15. >
  16. <!-- 缩放容器 -->
  17. <div
  18. ref="mapContainer"
  19. :style="{
  20. transform: `scale(${scaleFactor})`,
  21. transformOrigin: 'top left',
  22. width: '1250px',
  23. height: '700px',
  24. position: 'relative',
  25. }"
  26. >
  27. <img
  28. style="width: 100%; height: 100%"
  29. src="@/assets/images/marsBg.png"
  30. alt=""
  31. />
  32. <img
  33. v-for="(cabinet, index) in TicketListPage"
  34. :key="cabinet.cabinetId"
  35. :style="{
  36. width: '35px',
  37. height: '35px',
  38. position: 'absolute',
  39. cursor: 'pointer',
  40. // 图标垂直居中
  41. top: `${deptXLGCenter.top - 53}px`,
  42. // 图标水平居中,动态计算偏移
  43. left: `${
  44. deptXLGCenter.left -
  45. (TicketListPage.length * 35 + (TicketListPage.length - 1) * 5) /
  46. 2 +
  47. index * 40
  48. }px`,
  49. }"
  50. :src="require(`@/assets/images/${imageMap[cabinet.status]}.jpg`)"
  51. alt=""
  52. @click="handleCabinetClick(cabinet)"
  53. />
  54. <!-- deptCCO 区域的图标 -->
  55. <!-- <img-->
  56. <!-- v-for="(cabinet, index) in COCOTicketListPage"-->
  57. <!-- :key="cabinet.cabinetId"-->
  58. <!-- :style="{-->
  59. <!-- width: '35px',-->
  60. <!-- height: '35px',-->
  61. <!-- position: 'absolute',-->
  62. <!-- cursor: 'pointer',-->
  63. <!-- // 图标垂直居中-->
  64. <!-- top: `${deptCCOCenter.top - 53}px`,-->
  65. <!-- // 图标水平居中,动态计算偏移-->
  66. <!-- left: `${-->
  67. <!-- deptCCOCenter.left - -->
  68. <!-- (COCOTicketListPage.length * 35 +-->
  69. <!-- (COCOTicketListPage.length - 1) * 5) /-->
  70. <!-- 2 +-->
  71. <!-- index * 40-->
  72. <!-- }px`,-->
  73. <!-- }"-->
  74. <!-- :src="require('@/assets/images/table_map2.jpg')"-->
  75. <!-- alt=""-->
  76. <!-- @click="handleCabinetClick(cabinet)"-->
  77. <!-- />-->
  78. <div class="deptXLG">LD</div>
  79. <!-- <div class="deptCCO">CCO</div>-->
  80. </div>
  81. </div>
  82. <!-- 物资列表 -->
  83. <div v-if="tabPosition == 'second'" class="CabinetListcon">
  84. <div class="left">
  85. <!-- 岗位树 -->
  86. <div class="deptTree">
  87. <div class="head-container">
  88. <el-input
  89. v-model="queryParams.workstationName"
  90. placeholder="请输入区域名称"
  91. clearable
  92. size="small"
  93. prefix-icon="el-icon-search"
  94. style="margin-bottom: 20px"
  95. @clear="handleClear"
  96. />
  97. </div>
  98. <div class="head-container">
  99. <el-tree
  100. :data="workstationOptions"
  101. :props="defaultProps"
  102. :expand-on-click-node="false"
  103. :filter-node-method="filterNode"
  104. ref="treeData"
  105. node-key="id"
  106. default-expand-all
  107. @node-click="handleNodeClick"
  108. highlight-current
  109. />
  110. </div>
  111. </div>
  112. </div>
  113. <div class="right">
  114. <el-row>
  115. <el-form
  116. :model="queryParams"
  117. ref="queryForm"
  118. size="small"
  119. :inline="true"
  120. v-show="showSearch"
  121. label-width="100px"
  122. >
  123. <el-form-item label="物资柜编号" prop="cabinetId">
  124. <el-input
  125. v-model="queryParams.cabinetId"
  126. placeholder="请输入物资柜编号"
  127. clearable
  128. oninput="value=value.replace(/[^\d.]/g,'')"
  129. @keyup.enter.native="handleQuery"
  130. />
  131. </el-form-item>
  132. <el-form-item label="物资柜名称" prop="cabinetName">
  133. <el-input
  134. v-model="queryParams.cabinetName"
  135. placeholder="请输入物资柜名称"
  136. clearable
  137. @keyup.enter.native="handleQuery"
  138. />
  139. </el-form-item>
  140. <!-- <el-form-item label="物资柜状态" prop="status">-->
  141. <!-- <el-select v-model="queryParams.status" placeholder="物资柜状态">-->
  142. <!-- <el-option-->
  143. <!-- v-for="dict in dict.type.cabinet_status"-->
  144. <!-- :key="dict.value"-->
  145. <!-- :label="dict.label"-->
  146. <!-- :value="dict.value"-->
  147. <!-- />-->
  148. <!-- </el-select>-->
  149. <!-- </el-form-item>-->
  150. <el-form-item>
  151. <el-button
  152. v-no-more-click
  153. type="primary"
  154. icon="el-icon-search"
  155. size="mini"
  156. @click="handleQuery"
  157. >搜索</el-button
  158. >
  159. <el-button
  160. v-no-more-click
  161. icon="el-icon-refresh"
  162. size="mini"
  163. @click="resetQuery"
  164. >重置</el-button
  165. >
  166. </el-form-item>
  167. </el-form>
  168. </el-row>
  169. <el-row :gutter="10" class="mb8">
  170. <el-col :span="1.5">
  171. <el-button
  172. v-no-more-click
  173. type="primary"
  174. plain
  175. icon="el-icon-plus"
  176. size="mini"
  177. @click="handleAdd"
  178. v-hasPermi="['iscs:cabinet:add']"
  179. >新增
  180. </el-button>
  181. </el-col>
  182. <right-toolbar
  183. :showSearch.sync="showSearch"
  184. @queryTable="getList"
  185. ></right-toolbar>
  186. </el-row>
  187. <el-table
  188. v-loading="loading"
  189. :data="CabinetList"
  190. @selection-change="handleSelectionChange"
  191. >
  192. <!-- <el-table-column type="selection" width="55" align="center"/>-->
  193. <el-table-column label="物资柜编号" align="center" prop="cabinetId">
  194. </el-table-column>
  195. <el-table-column label="物资柜名称" prop="cabinetName" width="150" />
  196. <el-table-column label="物资柜图片" prop="cabinetPicture" width="100">
  197. <template slot-scope="scope">
  198. <div class="img-box" v-if="scope.row.cabinetPicture">
  199. <el-image
  200. style="width: 75px; height: 75px"
  201. :preview-teleported="true"
  202. class="images"
  203. :hide-on-click-modal="true"
  204. :src="scope.row.cabinetPicture"
  205. :zoom-rate="1.2"
  206. :preview-src-list="[scope.row.cabinetPicture]"
  207. :initial-index="1"
  208. fit="cover"
  209. >
  210. </el-image>
  211. <i class="el-icon-zoom-in" id="eyeicon"></i>
  212. </div>
  213. <span v-else>-</span>
  214. </template>
  215. </el-table-column>
  216. <el-table-column label="物资柜状态" align="center" prop="status">
  217. <template slot-scope="scope">
  218. <dict-tag
  219. :options="dict.type.cabinet_status"
  220. :value="scope.row.status"
  221. />
  222. </template>
  223. </el-table-column>
  224. <el-table-column label="异常类型" prop="exReason" width="100" >
  225. <template slot-scope="scope">
  226. <dict-tag
  227. :options="dict.type.exception_reason"
  228. :value="scope.row.exReason"
  229. />
  230. </template>
  231. </el-table-column>
  232. <el-table-column label="物资柜详情" align="center">
  233. <template slot-scope="scope">
  234. <el-button
  235. v-no-more-click
  236. size="mini"
  237. type="text"
  238. @click="handleLook(scope.row)"
  239. >查看
  240. </el-button>
  241. </template>
  242. </el-table-column>
  243. <el-table-column
  244. label="操作"
  245. align="center"
  246. class-name="small-padding fixed-width"
  247. >
  248. <template slot-scope="scope">
  249. <el-button
  250. v-no-more-click
  251. size="mini"
  252. type="text"
  253. icon="el-icon-edit"
  254. @click="handleUpdate(scope.row)"
  255. v-hasPermi="['iscs:cabinet:edit']"
  256. >编辑
  257. </el-button>
  258. <el-button
  259. v-no-more-click
  260. size="mini"
  261. type="text"
  262. icon="el-icon-delete"
  263. @click="handleDelete(scope.row)"
  264. v-hasPermi="['iscs:cabinet:remove']"
  265. >删除
  266. </el-button>
  267. </template>
  268. </el-table-column>
  269. </el-table>
  270. <pagination
  271. v-show="total > 0"
  272. :total="total"
  273. :page.sync="queryParams.current"
  274. :limit.sync="queryParams.size"
  275. @pagination="getList"
  276. />
  277. </div>
  278. </div>
  279. <!-- 添加或修改物资柜对话框 -->
  280. <el-dialog :visible.sync="open" width="510px" append-to-body>
  281. <div slot="title" class="dialog-title">
  282. <i></i>
  283. <span class="title">{{ title }}</span>
  284. </div>
  285. <el-form ref="form" :model="form" :rules="rules" label-width="110px">
  286. <el-form-item label="物资柜编码" prop="cabinetCode">
  287. <el-input
  288. v-model="form.cabinetCode"
  289. placeholder="请输入物资柜编码"
  290. style="width: 200px; margin-right: 10px"
  291. />
  292. <el-switch
  293. v-model="autoGenFlag"
  294. active-color="#13ce66"
  295. active-text="自动生成"
  296. @change="handleAutoGenChange(autoGenFlag)"
  297. >
  298. </el-switch>
  299. </el-form-item>
  300. <el-form-item label="物资柜名称" prop="cabinetName">
  301. <el-input
  302. style="width: 348px"
  303. v-model="form.cabinetName"
  304. placeholder="请输入物资柜名称"
  305. />
  306. </el-form-item>
  307. <el-form-item label="所属区域" prop="workstationId">
  308. <treeselect
  309. style="width: 348px"
  310. v-model="form.workstationId"
  311. :options="marsOptions"
  312. :normalizer="Marsnormalizer"
  313. placeholder="选择所属区域"
  314. />
  315. </el-form-item>
  316. <el-form-item label="物资柜图片" prop="cabinetPicture">
  317. <ImageUploadSingle
  318. :limit="1"
  319. :value="form.cabinetPicture"
  320. :fileSize="5"
  321. @onUploaded="handleIconUplaoded"
  322. @onRemoved="handleIconRemoved"
  323. ></ImageUploadSingle>
  324. </el-form-item>
  325. <el-form-item label="备注" prop="remark">
  326. <el-input
  327. v-model="form.remark"
  328. type="textarea"
  329. placeholder="请输入内容"
  330. style="width: 348px"
  331. />
  332. </el-form-item>
  333. </el-form>
  334. <div slot="footer" class="dialog-footer">
  335. <el-button
  336. v-no-more-click
  337. type="primary"
  338. @click="cancel"
  339. v-if="optType == 'view'"
  340. >返回
  341. </el-button>
  342. <el-button v-no-more-click type="primary" @click="submitForm" v-else
  343. >确 定
  344. </el-button>
  345. <el-button v-no-more-click @click="cancel">取 消</el-button>
  346. </div>
  347. </el-dialog>
  348. </div>
  349. </template>
  350. <script>
  351. import {
  352. getMaterialsCabinet,
  353. addMaterialsCabinet,
  354. updateMaterialsCabinet,
  355. deleteMaterialsCabinet,
  356. selectMaterialsCabinetById,
  357. } from "@/api/mes/material/lockers.js";
  358. import Treeselect from "@riophae/vue-treeselect";
  359. import "@riophae/vue-treeselect/dist/vue-treeselect.css";
  360. import { genCode } from "@/api/system/autocode/rule";
  361. import { listMarsDept } from "@/api/system/marsdept";
  362. import { listLoto } from "@/api/mes/lotoStation/lotoStation";
  363. export default {
  364. name: "Team",
  365. components: {
  366. Treeselect,
  367. },
  368. dicts: ["material_status", "cabinet_status",'exception_reason'],
  369. data() {
  370. return {
  371. //自动生成编码
  372. autoGenFlag: false,
  373. optType: undefined,
  374. tabPosition: "first", //顶部切换
  375. // 遮罩层
  376. loading: true,
  377. // 选中数组
  378. ids: [],
  379. codes: [],
  380. // 非单个禁用
  381. single: true,
  382. // 非多个禁用
  383. multiple: true,
  384. // 显示搜索条件
  385. showSearch: true,
  386. // 总条数
  387. total: 0,
  388. // 班组表格数据
  389. CabinetList: [],
  390. // 弹出层标题
  391. title: "",
  392. // 是否显示弹出层
  393. open: false,
  394. // 查询参数
  395. createTime: "",
  396. queryParams: {
  397. current: 1,
  398. size: 10,
  399. workstationName: undefined,
  400. workstationId: undefined,
  401. cabinetId: null,
  402. cabinetName: null,
  403. status: null,
  404. },
  405. // queryParamsList: {
  406. // current: 1,
  407. // size: 10,
  408. // cabinetId: null,
  409. // cabinetName: null,
  410. // status: null,
  411. // },
  412. imageMap: {
  413. 0: "table_map2", //正常
  414. 1: "table_map1", //使用中
  415. 2: "table_map3", //异常
  416. },
  417. pickerOptions: {
  418. shortcuts: [
  419. {
  420. text: "最近一周",
  421. onClick(picker) {
  422. const end = new Date();
  423. const start = new Date();
  424. start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
  425. picker.$emit("pick", [start, end]);
  426. },
  427. },
  428. {
  429. text: "最近一个月",
  430. onClick(picker) {
  431. const end = new Date();
  432. const start = new Date();
  433. start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
  434. picker.$emit("pick", [start, end]);
  435. },
  436. },
  437. {
  438. text: "最近三个月",
  439. onClick(picker) {
  440. const end = new Date();
  441. const start = new Date();
  442. start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
  443. picker.$emit("pick", [start, end]);
  444. },
  445. },
  446. ],
  447. },
  448. // 表单参数
  449. form: {},
  450. // 表单校验
  451. rules: {
  452. cabinetCode: [
  453. { required: true, message: "物资柜编码不能为空", trigger: "blur" },
  454. ],
  455. cabinetName: [
  456. { required: true, message: "物资柜名称不能为空", trigger: "blur" },
  457. ],
  458. },
  459. marsOptions: [], //岗位
  460. TicketListPage: [], //R&R岗位
  461. COCOTicketListPage: [], //CCO岗位
  462. scaleFactor: 1, // 缩放比例,初始值为1
  463. deptXLGPosition: {
  464. left: 500,
  465. top: 260,
  466. width: 65,
  467. height: 25,
  468. },
  469. deptCCOPosition: {
  470. left: 670,
  471. top: 480,
  472. width: 65,
  473. height: 25,
  474. },
  475. workstationOptions: [], //岗位
  476. defaultProps: {
  477. children: "children",
  478. label: "label",
  479. },
  480. };
  481. },
  482. computed: {
  483. deptXLGCenter() {
  484. return {
  485. left: this.deptXLGPosition.left + this.deptXLGPosition.width / 2,
  486. top: this.deptXLGPosition.top + this.deptXLGPosition.height / 2,
  487. };
  488. },
  489. deptCCOCenter() {
  490. return {
  491. left: this.deptCCOPosition.left + this.deptCCOPosition.width / 2,
  492. top: this.deptCCOPosition.top + this.deptCCOPosition.height / 2,
  493. };
  494. },
  495. },
  496. watch: {
  497. "queryParams.workstationId": function (newVal, oldVal) {
  498. if (newVal) {
  499. const data = {
  500. current: 1,
  501. size: -1,
  502. workstationId: this.queryParams.workstationId,
  503. };
  504. getMaterialsCabinet(data).then((response) => {
  505. this.CabinetList = response.data.records;
  506. });
  507. }
  508. },
  509. tabPosition: function (newVal, oldVal) {
  510. if (newVal) {
  511. this.getList();
  512. }
  513. },
  514. },
  515. created() {
  516. this.getList();
  517. this.getOtherList();
  518. },
  519. methods: {
  520. /** 查询物资柜信息列表 */
  521. getList() {
  522. this.loading = true;
  523. getMaterialsCabinet(this.queryParams).then((response) => {
  524. this.CabinetList = response.data.records;
  525. console.log(response, "所有物资柜");
  526. this.total = response.data.total;
  527. this.loading = false;
  528. });
  529. },
  530. getOtherList() {
  531. const data = {
  532. pasge: 1,
  533. size: -1,
  534. };
  535. getMaterialsCabinet(data).then((response) => {
  536. console.log(response, "所有物资柜");
  537. this.TicketListPage = response.data.records.filter((item) => {
  538. return item.workstationId == "6";
  539. });
  540. this.COCOTicketListPage = response.data.records.filter((item) => {
  541. return item.workstationId == "7";
  542. });
  543. this.total = response.data.total;
  544. this.loading = false;
  545. });
  546. listMarsDept(data).then((response) => {
  547. // 新增岗位单选
  548. const data = response.data.records.filter((item) => {
  549. return item.parentId == "0";
  550. });
  551. this.marsOptions = this.handleTree(data, "workstationId", "parentId");
  552. // mars岗位树数据
  553. this.workstationOptions = this.transformToTree(data);
  554. // 使用递归函数查找匹配的节点
  555. const selectedTreeNode = this.findNodeById(
  556. this.workstationOptions,
  557. this.queryParams.workstationId
  558. );
  559. // 调用 handleNodeClick 方法
  560. if (selectedTreeNode) {
  561. this.handleNodeClick(selectedTreeNode);
  562. } else {
  563. console.log("未找到匹配的节点");
  564. }
  565. });
  566. },
  567. // mars岗位树点击事件
  568. handleNodeClick(data) {
  569. this.queryParams.workstationId = data.id; //这里给查询传递参数
  570. this.queryParams.workstationName = data.label; //这里给回显框显示中文
  571. },
  572. /** 转换mars岗位树数据为树形结构 */
  573. transformToTree(records) {
  574. const recordMap = {}; // 创建一个 Map 以存储所有记录
  575. const tree = []; // 最终返回的树形结构
  576. // 初始化所有记录到 Map
  577. records.forEach((record) => {
  578. recordMap[record.workstationId] = {
  579. id: record.workstationId,
  580. label: record.workstationName,
  581. children: [],
  582. };
  583. });
  584. // 遍历记录并构建树
  585. records.forEach((record) => {
  586. const parentId = record.parentId;
  587. if (parentId === "0") {
  588. // 如果是顶层节点,直接添加到树中
  589. tree.push(recordMap[record.workstationId]);
  590. } else if (recordMap[parentId]) {
  591. // 如果有父节点,则将当前节点加入父节点的 children 中
  592. recordMap[parentId].children.push(recordMap[record.workstationId]);
  593. }
  594. });
  595. return tree;
  596. },
  597. // mars岗位数深层次遍历
  598. findNodeById(nodes, targetId) {
  599. for (let i = 0; i < nodes.length; i++) {
  600. const node = nodes[i];
  601. if (node.id === targetId) {
  602. return node;
  603. }
  604. if (node.children && node.children.length > 0) {
  605. const foundNode = this.findNodeById(node.children, targetId);
  606. if (foundNode) {
  607. return foundNode;
  608. }
  609. }
  610. }
  611. return null;
  612. },
  613. /** 转换mars岗位数据结构 */
  614. Marsnormalizer(node) {
  615. if (node.children && !node.children.length) {
  616. delete node.children;
  617. }
  618. return {
  619. id: node.workstationId,
  620. label: node.workstationName,
  621. children: node.children,
  622. };
  623. },
  624. // 筛选节点
  625. filterNode(value, data) {
  626. if (!value) return true;
  627. return data.label.indexOf(value) !== -1;
  628. },
  629. // 岗位查询 清除事件
  630. handleClear() {
  631. this.queryParams.workstationId = "";
  632. this.queryParams.workstationName = "";
  633. this.getList();
  634. },
  635. // 物资柜跳转详情
  636. handleCabinetClick(cabinet) {
  637. this.$router.push({
  638. path: "/mes/material/lockers/DetailsIndex",
  639. query: {
  640. cabinetId: cabinet.cabinetId,
  641. cabinetName: cabinet.cabinetName,
  642. },
  643. });
  644. console.log(cabinet, "地图跳转详情拿到的");
  645. },
  646. // 物资柜列表跳转详情
  647. handleLook(row) {
  648. this.$router.push({
  649. path: "/mes/material/lockers/DetailsIndex",
  650. query: { cabinetId: row.cabinetId, cabinetName: row.cabinetName },
  651. });
  652. console.log("列表详情");
  653. },
  654. // 取消按钮
  655. cancel() {
  656. this.open = false;
  657. this.reset();
  658. },
  659. // 表单重置
  660. reset() {
  661. this.form = {
  662. cabinetCode: "",
  663. cabinetName: "",
  664. workstationId: "",
  665. remark: "",
  666. cabinetPicture: "",
  667. };
  668. this.resetForm("form");
  669. this.autoGenFlag = false;
  670. },
  671. /** 搜索按钮操作 */
  672. handleQuery() {
  673. this.queryParams.current = 1;
  674. this.getList();
  675. },
  676. /** 重置按钮操作 */
  677. resetQuery() {
  678. this.createTime = "";
  679. this.queryParams.cabinetCode = null;
  680. this.queryParams.cabinetName = null;
  681. this.queryParams.cabinetId = null;
  682. this.queryParams.status = null;
  683. this.resetForm("queryForm");
  684. this.handleQuery();
  685. },
  686. // 多选框选中数据
  687. handleSelectionChange(selection) {
  688. this.ids = selection.map((item) => item.cabinetId);
  689. this.codes = selection.map((item) => item.cabinetCode);
  690. this.single = selection.length !== 1;
  691. this.multiple = !selection.length;
  692. },
  693. /** 新增按钮操作 */
  694. handleAdd() {
  695. this.reset();
  696. this.open = true;
  697. this.form.workstationId = null;
  698. this.title = "新增物资柜信息";
  699. this.optType = "add";
  700. },
  701. /** 修改按钮操作 */
  702. handleUpdate(row) {
  703. this.reset();
  704. selectMaterialsCabinetById(row.cabinetId).then((response) => {
  705. this.form = response.data;
  706. this.open = true;
  707. this.title = "编辑物资柜信息";
  708. this.optType = "edit";
  709. });
  710. },
  711. /** 提交按钮 */
  712. submitForm() {
  713. this.$refs["form"].validate((valid) => {
  714. if (valid) {
  715. if (this.form.cabinetId != null) {
  716. updateMaterialsCabinet(this.form).then((response) => {
  717. console.log(response, "修改返回");
  718. this.$modal.msgSuccess("修改成功");
  719. this.open = false;
  720. this.getList();
  721. });
  722. } else {
  723. addMaterialsCabinet(this.form).then((response) => {
  724. console.log(response, "新增返回");
  725. this.$modal.msgSuccess("新增成功");
  726. this.open = false;
  727. this.getList();
  728. });
  729. }
  730. }
  731. });
  732. },
  733. /** 删除按钮操作 */
  734. handleDelete(row) {
  735. const cabinetIds = row.cabinetId || this.ids;
  736. const cabinetCodes = row.cabinetCode || this.codes;
  737. this.$modal
  738. .confirm('是否确认删除编号为"' + cabinetCodes + '"的数据项?')
  739. .then(function () {
  740. return deleteMaterialsCabinet(cabinetIds);
  741. })
  742. .then(() => {
  743. this.getList();
  744. this.$modal.msgSuccess("删除成功");
  745. })
  746. .catch(() => {});
  747. },
  748. //图标上传成功
  749. handleIconUplaoded(imgUrl) {
  750. this.form.cabinetPicture = imgUrl[0].url;
  751. },
  752. // 图标移除
  753. handleIconRemoved(imgUrl) {
  754. this.form.cabinetPicture = null;
  755. },
  756. //自动生成编码
  757. handleAutoGenChange(autoGenFlag) {
  758. if (autoGenFlag) {
  759. genCode("MATERIALS_CABINET").then((response) => {
  760. this.form.cabinetCode = response;
  761. });
  762. } else {
  763. this.form.cabinetCode = null;
  764. }
  765. },
  766. },
  767. };
  768. </script>
  769. <style lang="scss" src="@/assets/styles/dialog-title.scss" scoped>
  770. </style>
  771. <style scoped lang="scss">
  772. .deptXLG {
  773. position: absolute;
  774. width: 65px;
  775. height: 25px;
  776. left: 500px;
  777. top: 260px;
  778. background: #70b26f;
  779. line-height: 25px;
  780. text-align: center;
  781. border-radius: 5px;
  782. color: #fff;
  783. cursor: pointer;
  784. }
  785. .deptCCO {
  786. position: absolute;
  787. width: 65px;
  788. height: 25px;
  789. left: 670px;
  790. top: 480px;
  791. background: #70b26f;
  792. line-height: 25px;
  793. text-align: center;
  794. border-radius: 5px;
  795. color: #fff;
  796. cursor: pointer;
  797. }
  798. //图片放大
  799. .img-box {
  800. width: 75px;
  801. height: 75px;
  802. position: relative;
  803. #eyeicon {
  804. display: none;
  805. }
  806. }
  807. .img-box:hover {
  808. background: #000;
  809. .images {
  810. opacity: 0.6;
  811. }
  812. #eyeicon {
  813. display: block;
  814. position: absolute;
  815. top: 40%;
  816. left: 40%;
  817. z-index: 100;
  818. color: white;
  819. pointer-events: none;
  820. }
  821. }
  822. .el-input-width {
  823. width: 380px !important;
  824. }
  825. .app-container {
  826. width: 100%;
  827. height: 100%;
  828. // background: green;
  829. .CabinetListcon {
  830. width: 100%;
  831. height: 100%;
  832. display: flex;
  833. // background: pink;
  834. .left {
  835. width: 15%;
  836. height: 100%;
  837. margin-right: 10px;
  838. // background: rgb(175, 214, 175);
  839. .deptTree {
  840. width: 100%;
  841. height: 90%;
  842. // background: rgb(199, 252, 247);
  843. }
  844. }
  845. .right {
  846. width: 83%;
  847. height: 100%;
  848. // background: yellow;
  849. }
  850. }
  851. }
  852. </style>