plm前端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

908 lines
28 KiB

  1. <template>
  2. <div class="mod-config customer-tab">
  3. <el-form :inline="true" label-position="top" label-width="100px" style="margin-top: 0px;">
  4. <el-form-item label="工厂">
  5. <el-input v-model="searchData.site" style="width: 160px"></el-input>
  6. </el-form-item>
  7. <el-form-item label="工具编码">
  8. <el-input v-model="searchData.toolId" style="width: 160px"></el-input>
  9. </el-form-item>
  10. <el-form-item label="工具类型:">
  11. <span slot="label" style="" @click="getBaseList(1016)"><a herf="#">工具类型:</a></span>
  12. <el-input v-model="searchData.toolType" style="width: 160px"></el-input>
  13. </el-form-item>
  14. <el-form-item label=" ">
  15. <el-button @click="search()" type="primary" style="margin-left: 2px;margin-top:0px">查询</el-button>
  16. <el-button type="primary" @click="addToolInfoModal()">新增</el-button>
  17. <!-- <el-button @click="addOrUpdateHandle('save')" type="primary" style="margin-left: 2px;margin-top: 0px">新增</el-button>-->
  18. <download-excel
  19. :fields="fields()"
  20. :data="exportData"
  21. type="xls"
  22. :name="exportName"
  23. :header="exportHeader"
  24. :footer="exportFooter"
  25. :fetch="createExportData"
  26. :before-generate="startDownload"
  27. :before-finish="finishDownload"
  28. worksheet="导出信息"
  29. class="el-button el-button--primary el-button--medium">
  30. {{ '导出' }}
  31. </download-excel>
  32. </el-form-item>
  33. </el-form>
  34. <el-table
  35. :height="height"
  36. :data="dataList"
  37. border
  38. ref="mainTable"
  39. @row-click="changeData"
  40. highlight-current-row
  41. v-loading="dataListLoading"
  42. style="width: 100%;">
  43. <el-table-column
  44. header-align="center"
  45. align="center"
  46. width="150"
  47. fixed="right"
  48. label="操作">
  49. <template slot-scope="scope">
  50. <a type="text" size="small" @click="editToolInfoModal(scope.row)">编辑</a>
  51. <a type="text" size="small" @click="deleteToolInfoConfirm(scope.row)">删除</a>
  52. </template>
  53. </el-table-column>
  54. <el-table-column
  55. v-for="(item,index) in columnList" :key="index"
  56. :sortable="item.columnSortable"
  57. :prop="item.columnProp"
  58. :header-align="item.headerAlign"
  59. :show-overflow-tooltip="item.showOverflowTooltip"
  60. :align="item.align"
  61. :fixed="item.fixed==''?false:item.fixed"
  62. :min-width="item.columnWidth"
  63. :label="item.columnLabel">
  64. <template slot-scope="scope">
  65. <span v-if="!item.columnHidden"> {{scope.row[item.columnProp]}}</span>
  66. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]"
  67. style="width: 100px; height: 80px"/></span>
  68. </template>
  69. </el-table-column>
  70. </el-table>
  71. <el-pagination
  72. @size-change="sizeChangeHandle"
  73. @row-click="changeInstanceData"
  74. :current-page="pageIndex"
  75. :page-sizes="[20, 50, 100, 1000]"
  76. :page-size="pageSize"
  77. :total="totalPage"
  78. layout="total, sizes, prev, pager, next, jumper">
  79. </el-pagination>
  80. <el-tabs style="font-size: 12px;min-height: 330px" class="customer-tab" v-model="activeName" type="border-card" @tab-click="tabClick">
  81. <el-tab-pane label="工具实例" name="detail" style="margin-left: -10px;">
  82. <el-form label-position="top" style="margin-top: -15px; margin-left: 2px;">
  83. <el-button type="primary" @click="addToolInstanceModal()">新增</el-button>
  84. </el-form>
  85. <el-table
  86. :data="detailList"
  87. height="240"
  88. border
  89. v-loading="dataListLoading"
  90. style="width: 100%; ">
  91. <el-table-column
  92. v-for="(item,index) in columnDetailList" :key="index"
  93. :sortable="item.columnSortable"
  94. :prop="item.columnProp"
  95. :header-align="item.headerAlign"
  96. :show-overflow-tooltip="item.showOverflowTooltip"
  97. :align="item.align"
  98. :fixed="item.fixed==''?false:item.fixed"
  99. :min-width="item.columnWidth"
  100. :label="item.columnLabel">
  101. <template slot-scope="scope">
  102. <span v-if="!item.columnHidden"> {{ scope.row[item.columnProp] }}</span>
  103. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]"
  104. style="width: 100px; height: 80px"/></span>
  105. </template>
  106. </el-table-column>
  107. <el-table-column
  108. header-align="center"
  109. align="center"
  110. width="150"
  111. fixed="right"
  112. label="操作">
  113. <template slot-scope="scope">
  114. <a type="text" size="small" @click="editToolInstanceModal(scope.row)">编辑</a>
  115. <a type="text" size="small" @click="editToolInstanceDateModal(scope.row)">生命周期</a>
  116. <a type="text" size="small" @click="deleteToolInstanceConfirm(scope.row)">删除</a>
  117. </template>
  118. </el-table-column>
  119. </el-table>
  120. </el-tab-pane>
  121. </el-tabs>
  122. <!-- 选择组件 -->
  123. <Chooselist ref="baseList" @getBaseData="getBaseData"></Chooselist>
  124. <!-- 工具信息 -->
  125. <toolInfoAddUpdate ref="toolInfoAddUpdate" :close-on-click-modal="false" @refreshTooInfoData="refreshTooInfoData">
  126. </toolInfoAddUpdate>
  127. <!-- 工具实例信息 -->
  128. <toolInstanceAddUpdate ref="toolInstanceAddUpdate" :close-on-click-modal="false" @refreshTooInstanceData="refreshTooInstanceData">
  129. </toolInstanceAddUpdate>
  130. <!-- 工具实例生命周期信息 -->
  131. <toolInstanceDateAddUpdate ref="toolInstanceDateAddUpdate" :close-on-click-modal="false" @refreshTooInstanceData="refreshTooInstanceData">
  132. </toolInstanceDateAddUpdate>
  133. </div>
  134. </template>
  135. <script>
  136. import {
  137. getToolInfoList, // 工具信息查询
  138. getToolInstanceList, //工具实例信息查询
  139. removeToolInfo,/*删除工具信息*/
  140. removeToolInstance,/*删除工具实例信息*/
  141. } from '@/api/tool/tool_info.js'
  142. /*组件*/
  143. import Chooselist from '@/views/modules/common/Chooselist'; /*选择组件*/
  144. import toolInfoAddUpdate from "./components/com_tool_info_add_update"; /*工具新增和修改组件*/
  145. import toolInstanceAddUpdate from "./components/com_tool_instance_add_update"; /*工具实例新增和修改组件*/
  146. import toolInstanceDateAddUpdate from "./components/com_tool_instance_date_add_update"; /*工具实例新增日期和修改组件*/
  147. /*組件*/
  148. export default {
  149. components: {
  150. Chooselist,/*选择组件*/
  151. toolInfoAddUpdate,/*工具新增和修改组件*/
  152. toolInstanceAddUpdate,/*工具实例新增和修改组件*/
  153. toolInstanceDateAddUpdate,/*工具实例新增日期和修改组件*/
  154. },
  155. name: "null",
  156. data() {
  157. return {
  158. fileContentList: [],
  159. activeName: 'detail',
  160. searchData:{
  161. pageIndex: 1,
  162. pageSize: 100,
  163. site:this.$store.state.user.site,
  164. toolId:'',
  165. toolType:'',
  166. startDate:'',
  167. endDate:'',
  168. },
  169. currentRow:{},
  170. currentInstanceRow: {},
  171. height: 200,
  172. dataList:[],
  173. detailList:[],
  174. dataListLoading: false,
  175. // 导出 start
  176. exportData: [],
  177. exportName: "工具信息" + this.dayjs().format('YYYYMMDDHHmmss'),
  178. exportHeader: ["工具信息"],
  179. exportFooter: [],
  180. exportList:[],
  181. tagNo:'',
  182. pageIndex: 1,
  183. pageSize: 100,
  184. totalPage: 0,
  185. // 导出 end
  186. columnList: [
  187. {
  188. userId: this.$store.state.user.name,
  189. functionId: 106003,
  190. serialNumber: '106003Table1Site',
  191. tableId: "106003Table1",
  192. tableName: "刀具信息主表",
  193. columnProp: "site",
  194. headerAlign: "center",
  195. align: "left",
  196. columnLabel: "工厂编码",
  197. columnHidden: false,
  198. columnImage: false,
  199. columnSortable: false,
  200. sortLv: 0,
  201. status: true,
  202. fixed: '',
  203. columnWidth: 80
  204. },
  205. {
  206. userId: this.$store.state.user.name,
  207. functionId: 106003,
  208. serialNumber: '106003Table1ToolId',
  209. tableId: "106003Table1",
  210. tableName: "刀具信息主表",
  211. columnProp: "toolId",
  212. headerAlign: "center",
  213. align: "left",
  214. columnLabel: "工具编码",
  215. columnHidden: false,
  216. columnImage: false,
  217. columnSortable: false,
  218. sortLv: 0,
  219. status: true,
  220. fixed: '',
  221. columnWidth: 80
  222. },
  223. {
  224. userId: this.$store.state.user.name,
  225. functionId: 106003,
  226. serialNumber: '106003Table1ToolDesc',
  227. tableId: "106003Table1",
  228. tableName: "刀具信息主表",
  229. columnProp: "toolDesc",
  230. headerAlign: "center",
  231. align: "left",
  232. columnLabel: "工具描述",
  233. columnHidden: false,
  234. columnImage: false,
  235. columnSortable: false,
  236. sortLv: 0,
  237. status: true,
  238. fixed: '',
  239. columnWidth: 160
  240. },
  241. {
  242. userId: this.$store.state.user.name,
  243. functionId: 106003,
  244. serialNumber: '106003TableToolType',
  245. tableId: "106003Table1",
  246. tableName: "刀具信息主表",
  247. columnProp: "toolType",
  248. headerAlign: "center",
  249. align: "left",
  250. columnLabel: "工具类型",
  251. columnHidden: false,
  252. columnImage: false,
  253. columnSortable: false,
  254. sortLv: 0,
  255. status: true,
  256. fixed: '',
  257. columnWidth: 80
  258. },
  259. {
  260. userId: this.$store.state.user.name,
  261. functionId: 106003,
  262. serialNumber: '106003TableCalendarId',
  263. tableId: "106003Table1",
  264. tableName: "刀具信息主表",
  265. columnProp: "calendarId",
  266. headerAlign: "center",
  267. align: "left",
  268. columnLabel: "日历标识",
  269. columnHidden: false,
  270. columnImage: false,
  271. columnSortable: false,
  272. sortLv: 0,
  273. status: true,
  274. fixed: '',
  275. columnWidth: 80
  276. },
  277. {
  278. userId: this.$store.state.user.name,
  279. functionId: 106003,
  280. serialNumber: '106003TableSchedCapacity',
  281. tableId: "106003Table1",
  282. tableName: "刀具信息主表",
  283. columnProp: "schedCapacity",
  284. headerAlign: "center",
  285. align: "left",
  286. columnLabel: "计划能力",
  287. columnHidden: false,
  288. columnImage: false,
  289. columnSortable: false,
  290. sortLv: 0,
  291. status: true,
  292. fixed: '',
  293. columnWidth: 80
  294. },
  295. {
  296. userId: this.$store.state.user.name,
  297. functionId: 106003,
  298. serialNumber: '106003TableCalibrationControl',
  299. tableId: "106003Table1",
  300. tableName: "刀具信息主表",
  301. columnProp: "calibrationControl",
  302. headerAlign: "center",
  303. align: "left",
  304. columnLabel: "校对控制",
  305. columnHidden: false,
  306. columnImage: false,
  307. columnSortable: false,
  308. sortLv: 0,
  309. status: true,
  310. fixed: '',
  311. columnWidth: 80
  312. },
  313. {
  314. userId: this.$store.state.user.name,
  315. functionId: 106003,
  316. serialNumber: '106003TableCalibrationTime',
  317. tableId: "106003Table1",
  318. tableName: "刀具信息主表",
  319. columnProp: "calibrationTime",
  320. headerAlign: "center",
  321. align: "left",
  322. columnLabel: "校对间隔时间",
  323. columnHidden: false,
  324. columnImage: false,
  325. columnSortable: false,
  326. sortLv: 0,
  327. status: true,
  328. fixed: '',
  329. columnWidth: 80
  330. },
  331. {
  332. userId: this.$store.state.user.name,
  333. functionId: 106003,
  334. serialNumber: '106003TableLastUsed',
  335. tableId: "106003Table1",
  336. tableName: "刀具信息主表",
  337. columnProp: "lastUsed",
  338. headerAlign: "center",
  339. align: "left",
  340. columnLabel: "上次使用",
  341. columnHidden: false,
  342. columnImage: false,
  343. columnSortable: false,
  344. sortLv: 0,
  345. status: true,
  346. fixed: '',
  347. columnWidth: 80
  348. },
  349. {
  350. userId: this.$store.state.user.name,
  351. functionId: 106003,
  352. serialNumber: '106003TableAlternateToolId',
  353. tableId: "106003Table1",
  354. tableName: "刀具信息主表",
  355. columnProp: "alternateToolId",
  356. headerAlign: "center",
  357. align: "left",
  358. columnLabel: "备选工具标识号",
  359. columnHidden: false,
  360. columnImage: false,
  361. columnSortable: false,
  362. sortLv: 0,
  363. status: true,
  364. fixed: '',
  365. columnWidth: 80
  366. },
  367. {
  368. userId: this.$store.state.user.name,
  369. functionId: 106003,
  370. serialNumber: '106003TableEnabledForControlPlanDb',
  371. tableId: "106003Table1",
  372. tableName: "刀具信息主表",
  373. columnProp: "enabledForControlPlanDb",
  374. headerAlign: "center",
  375. align: "left",
  376. columnLabel: "为控制计划启用",
  377. columnHidden: false,
  378. columnImage: false,
  379. columnSortable: false,
  380. sortLv: 0,
  381. status: true,
  382. fixed: '',
  383. columnWidth: 80
  384. },
  385. {
  386. userId: this.$store.state.user.name,
  387. functionId: 106003,
  388. serialNumber: '106003TableNoteText',
  389. tableId: "106003Table1",
  390. tableName: "刀具信息主表",
  391. columnProp: "noteText",
  392. headerAlign: "center",
  393. align: "left",
  394. columnLabel: "备注",
  395. columnHidden: false,
  396. columnImage: false,
  397. columnSortable: false,
  398. sortLv: 0,
  399. status: true,
  400. fixed: '',
  401. columnWidth: 180
  402. },
  403. ],
  404. columnDetailList: [
  405. {
  406. userId: this.$store.state.user.name,
  407. functionId: 106003,
  408. serialNumber: '106003Table2ToolInstance',
  409. tableId: '106003Table2',
  410. tableName: '工具实例明细',
  411. columnProp: 'toolInstance',
  412. headerAlign: 'center',
  413. align: 'center',
  414. columnLabel: '工具样品',
  415. columnHidden: false,
  416. columnImage: false,
  417. columnSortable: false,
  418. sortLv: 0,
  419. status: true,
  420. fixed: '',
  421. columnWidth: 40
  422. },
  423. {
  424. userId: this.$store.state.user.name,
  425. functionId: 106003,
  426. serialNumber: '106003Table2Description',
  427. tableId: '106003Table2',
  428. tableName: '工具实例明细',
  429. columnProp: 'description',
  430. headerAlign: 'center',
  431. align: 'center',
  432. columnLabel: '工具样品描述',
  433. columnHidden: false,
  434. columnImage: false,
  435. columnSortable: false,
  436. sortLv: 0,
  437. status: true,
  438. fixed: '',
  439. columnWidth: 70
  440. },
  441. {
  442. userId: this.$store.state.user.name,
  443. functionId: 106003,
  444. serialNumber: '106003Table2ToolNo',
  445. tableId: '106003Table2',
  446. tableName: '工具实例明细',
  447. columnProp: 'toolNo',
  448. headerAlign: 'center',
  449. align: 'center',
  450. columnLabel: '工具编码',
  451. columnHidden: false,
  452. columnImage: false,
  453. columnSortable: false,
  454. sortLv: 0,
  455. status: true,
  456. fixed: '',
  457. columnWidth: 70
  458. },
  459. {
  460. userId: this.$store.state.user.name,
  461. functionId: 106003,
  462. serialNumber: '106003Table2LastCalibrationDate',
  463. tableId: '106003Table2',
  464. tableName: '工具实例明细',
  465. columnProp: 'lastCalibrationDate',
  466. headerAlign: 'center',
  467. align: 'center',
  468. columnLabel: '最近校准日期',
  469. columnHidden: false,
  470. columnImage: false,
  471. columnSortable: false,
  472. sortLv: 0,
  473. status: true,
  474. fixed: '',
  475. columnWidth: 120
  476. },
  477. {
  478. userId: this.$store.state.user.name,
  479. functionId: 106003,
  480. serialNumber: '106003Table2ObjectId',
  481. tableId: '106003Table2',
  482. tableName: '工具实例明细',
  483. columnProp: 'objectId',
  484. headerAlign: 'center',
  485. align: 'center',
  486. columnLabel: '对象标识',
  487. columnHidden: false,
  488. columnImage: false,
  489. columnSortable: false,
  490. sortLv: 0,
  491. status: true,
  492. fixed: '',
  493. columnWidth: 120
  494. },
  495. {
  496. userId: this.$store.state.user.name,
  497. functionId: 106003,
  498. serialNumber: '106003Table2NormalWorkCenterNo',
  499. tableId: '106003Table2',
  500. tableName: '工具实例明细',
  501. columnProp: 'normalWorkCenterNo',
  502. headerAlign: 'center',
  503. align: 'center',
  504. columnLabel: '工作中心',
  505. columnHidden: false,
  506. columnImage: false,
  507. columnSortable: false,
  508. sortLv: 0,
  509. status: true,
  510. fixed: '',
  511. columnWidth: 60
  512. },
  513. {
  514. userId: this.$store.state.user.name,
  515. functionId: 106003,
  516. serialNumber: '106003Table2NormalWorkCenterDesc',
  517. tableId: '106003Table2',
  518. tableName: '工具实例明细',
  519. columnProp: 'normalWorkCenterDesc',
  520. headerAlign: 'center',
  521. align: 'center',
  522. columnLabel: '工作重心描述',
  523. columnHidden: false,
  524. columnImage: false,
  525. columnSortable: false,
  526. sortLv: 0,
  527. status: true,
  528. fixed: '',
  529. columnWidth: 60
  530. },
  531. {
  532. userId: this.$store.state.user.name,
  533. functionId: 106003,
  534. serialNumber: '106003Table2NormalProductionLine',
  535. tableId: '106003Table2',
  536. tableName: '工具实例明细',
  537. columnProp: 'normalProductionLine',
  538. headerAlign: 'center',
  539. align: 'center',
  540. columnLabel: '生产线',
  541. columnHidden: false,
  542. columnImage: false,
  543. columnSortable: false,
  544. sortLv: 0,
  545. status: true,
  546. fixed: '',
  547. columnWidth: 50
  548. },
  549. {
  550. userId: this.$store.state.user.name,
  551. functionId: 106003,
  552. serialNumber: '106003Table2NormalProductionLineDesc',
  553. tableId: '106003Table2',
  554. tableName: '工具实例明细',
  555. columnProp: 'normalProductionLineDesc',
  556. headerAlign: 'center',
  557. align: 'center',
  558. columnLabel: '生产线描述',
  559. columnHidden: false,
  560. columnImage: false,
  561. columnSortable: false,
  562. sortLv: 0,
  563. status: true,
  564. fixed: '',
  565. columnWidth: 60
  566. },
  567. {
  568. userId: this.$store.state.user.name,
  569. functionId: 106003,
  570. serialNumber: '106003Table2NoteText',
  571. tableId: '106003Table2',
  572. tableName: '工具实例明细',
  573. columnProp: 'noteText',
  574. headerAlign: 'center',
  575. align: 'center',
  576. columnLabel: '备注',
  577. columnHidden: false,
  578. columnImage: false,
  579. columnSortable: false,
  580. sortLv: 0,
  581. status: true,
  582. fixed: '',
  583. columnWidth: 200
  584. },
  585. ],
  586. }
  587. },
  588. watch: {
  589. // columnList: {
  590. // deep: true,
  591. // handler: function (newV, oldV) {
  592. // debugger
  593. //
  594. // }
  595. // }
  596. },
  597. mounted() {
  598. this.$nextTick(() => {
  599. this.height = window.innerHeight - 520;
  600. })
  601. },
  602. methods: {
  603. // 获取基础数据列表S
  604. getBaseList (val, type) {
  605. this.tagNo = val
  606. this.$nextTick(() => {
  607. let strVal = ''
  608. this.$refs.baseList.init(val, strVal)
  609. })
  610. },
  611. /* 列表方法的回调 */
  612. getBaseData (val) {
  613. if (this.tagNo === 1016) {
  614. this.searchData.toolType = val.tool_type;
  615. }
  616. },
  617. //导出excel
  618. async createExportData() {
  619. this.searchData.limit = -1
  620. this.searchData.page = 1
  621. await getToolInfoList(this.searchData).then(({data}) => {
  622. this.exportList= data.page.list;
  623. })
  624. return this.exportList;
  625. },
  626. startDownload() {
  627. // this.exportData = this.dataList
  628. },
  629. finishDownload() {
  630. },
  631. fields() {
  632. let json = "{"
  633. this.columnList.forEach((item, index) => {
  634. if (index == this.columnList.length - 1) {
  635. json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\""
  636. } else {
  637. json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\"" + ","
  638. }
  639. })
  640. json += "}"
  641. let s = eval("(" + json + ")")
  642. return s
  643. },
  644. /*刷新工具信息*/
  645. refreshTooInfoData() {
  646. this.searchData.pageSize = this.pageSize
  647. this.searchData.pageIndex = this.pageIndex
  648. getToolInfoList(this.searchData).then(({data}) => {
  649. if (data.code == 200) {
  650. this.dataList = data.rows;
  651. this.totalPage = data.total;
  652. }
  653. this.dataListLoading = false
  654. })
  655. },
  656. /*新增工具的modal*/
  657. addToolInfoModal(){
  658. //打开modal的页面
  659. this.$nextTick(() => {
  660. this.$refs.toolInfoAddUpdate.init(null, true)
  661. });
  662. },
  663. /*编辑工具信息*/
  664. editToolInfoModal(toolInfo){
  665. //打开modal的页面
  666. this.$nextTick(() => {
  667. this.$refs.toolInfoAddUpdate.init(toolInfo, false)
  668. });
  669. },
  670. /*删除工具的确认选项*/
  671. deleteToolInfoConfirm(toolInfo) {
  672. this.$confirm('是否删除工具标识号:'+ toolInfo.toolId+'?', '提示', {
  673. confirmButtonText: '确定',
  674. cancelButtonText: '取消',
  675. type: 'warning'
  676. }).then(() => {
  677. removeToolInfo(toolInfo).then(({data}) => {
  678. if (data.code === 200) {
  679. this.$message.success('操作成功!');
  680. this.refreshTooInfoData();
  681. } else {
  682. this.$message.error(data.msg);
  683. }
  684. })
  685. })
  686. },
  687. /*新增工具实例的modal*/
  688. addToolInstanceModal(){
  689. //判断是否选择好数据
  690. if(this.currentRow && Object.keys(this.currentRow).length > 0){
  691. //打开modal的页面
  692. this.$nextTick(() => {
  693. this.$refs.toolInstanceAddUpdate.init(this.currentRow, true)
  694. });
  695. }else{
  696. this.$message.error('请先选择工具信息再添加工具实例!');
  697. }
  698. },
  699. /*修改工具实例的modal*/
  700. editToolInstanceModal(row){
  701. this.currentInstanceRow = row;
  702. //判断是否选择好数据
  703. if(Object.keys(this.currentInstanceRow).length > 0){
  704. //打开modal的页面
  705. this.$nextTick(() => {
  706. this.$refs.toolInstanceAddUpdate.init(this.currentInstanceRow, false)
  707. });
  708. }else{
  709. this.$message.error('请先选择工具实例再添加工具实例!');
  710. }
  711. },
  712. /*刷新工具信息*/
  713. refreshTooInstanceData() {
  714. getToolInstanceList(this.currentRow).then(({data}) => {
  715. if (data.code == 200) {
  716. this.detailList = data.rows;
  717. }
  718. this.dataListLoading = false
  719. })
  720. },
  721. /*删除工具实例确认*/
  722. deleteToolInstanceConfirm(toolInfo){
  723. this.$confirm('是否删除工具实例:'+ toolInfo.toolInstance+'?', '提示', {
  724. confirmButtonText: '确定',
  725. cancelButtonText: '取消',
  726. type: 'warning'
  727. }).then(() => {
  728. removeToolInstance(toolInfo).then(({data}) => {
  729. if (data.code === 200) {
  730. this.$message.success('操作成功!');
  731. this.refreshTooInstanceData();
  732. } else {
  733. this.$message.error(data.msg);
  734. }
  735. })
  736. })
  737. },
  738. /*工具实例的生命周期*/
  739. editToolInstanceDateModal(toolInfo){
  740. this.currentInstanceRow = toolInfo;
  741. //判断是否选择好数据
  742. if(Object.keys(this.currentInstanceRow).length > 0){
  743. //打开modal的页面
  744. this.$nextTick(() => {
  745. this.$refs.toolInstanceDateAddUpdate.init(this.currentInstanceRow)
  746. });
  747. }else{
  748. this.$message.error('请先选择工具实例再添加工具实例!');
  749. }
  750. },
  751. //切换工具触发
  752. changeData(row) {
  753. this.currentRow = JSON.parse(JSON.stringify(row));
  754. this.refreshCurrentTabTable ();
  755. },
  756. /*切换工具实例*/
  757. changeInstanceData(row){
  758. this.currentRow = JSON.parse(JSON.stringify(row));
  759. },
  760. // 获取数据列表
  761. search () {
  762. this.searchData.pageSize = this.pageSize
  763. this.searchData.pageIndex = this.pageIndex
  764. getToolInfoList(this.searchData).then(({data}) => {
  765. if (data.code == 200) {
  766. this.dataList = data.rows;
  767. this.totalPage = data.total;
  768. if(this.dataList.length > 0){
  769. this.$refs.mainTable.setCurrentRow(this.dataList[0]);
  770. this.currentRow = JSON.parse(JSON.stringify(this.dataList[0]));
  771. }else {
  772. this.currentRow ={}
  773. }
  774. this.refreshCurrentTabTable ()
  775. }
  776. this.dataListLoading = false
  777. })
  778. },
  779. tabClick (tab, event) {
  780. // 刷新列表数据
  781. this.refreshCurrentTabTable()
  782. },
  783. // 刷新页签的table数据
  784. refreshCurrentTabTable () {
  785. if (this.activeName == 'detail') {
  786. this.refreshToolInstanceData();
  787. }
  788. },
  789. /*刷新工具实例的信息*/
  790. refreshToolInstanceData(){
  791. getToolInstanceList(this.currentRow).then(({data}) => {
  792. if (data.code == 200) {
  793. this.detailList = data.rows;
  794. }
  795. this.dataListLoading = false
  796. })
  797. },
  798. // 下载
  799. downloadFile(row){
  800. downLoadProjectFile(row)
  801. .then(({data}) => {
  802. // 不限制文件下载类型
  803. const blob = new Blob([data], {type:'application/octet-stream;charset=utf-8'})
  804. // 下载文件名称
  805. const fileName = row.fileName
  806. // a标签下载
  807. const linkNode = document.createElement('a')
  808. linkNode.download = fileName // a标签的download属性规定下载文件的名称
  809. linkNode.style.display = 'none'
  810. linkNode.href = URL.createObjectURL(blob) // 生成一个Blob URL
  811. console.log(linkNode)
  812. // if(val == 'Y'){
  813. // this.pdfVisible = true
  814. // this.pdfUrl = linkNode.href
  815. // }else {
  816. document.body.appendChild(linkNode)
  817. linkNode.click() // 模拟在按钮上的一次鼠标单击
  818. URL.revokeObjectURL(linkNode.href) // 释放URL 对象
  819. document.body.removeChild(linkNode)
  820. // }
  821. })
  822. // }else {
  823. // this.$alert('没有权限下载这个项目的文件!', '错误', {
  824. // confirmButtonText: '确定'
  825. // })
  826. // }
  827. // })
  828. },
  829. // 每页数
  830. sizeChangeHandle (val) {
  831. this.pageSize = val
  832. this.pageIndex = 1
  833. this.search()
  834. },
  835. },
  836. activated() {
  837. },
  838. }
  839. </script>
  840. <style >
  841. /deep/ .customer-tab .el-tabs__content {
  842. padding: 0px !important;
  843. }
  844. .el-transfer-panel {
  845. border: 2px solid #17b3a3;
  846. border-radius: 4px;
  847. overflow: hidden;
  848. background: #fff;
  849. display: inline-block;
  850. vertical-align: middle;
  851. width: 200px;
  852. max-height: 100%;
  853. -webkit-box-sizing: border-box;
  854. box-sizing: border-box;
  855. position: relative;
  856. }
  857. .el-transfer-panel .el-transfer-panel__header {
  858. height: 40px;
  859. line-height: 40px;
  860. background: #17b3a3;
  861. margin: 0;
  862. padding-left: 15px;
  863. border-bottom: 1px solid #17b3a3;
  864. -webkit-box-sizing: border-box;
  865. box-sizing: border-box;
  866. color: #000;
  867. }
  868. .el-transfer-panel .el-transfer-panel__header .el-checkbox .el-checkbox__label {
  869. font-size: 14px;
  870. color: #303133;
  871. font-weight: 400;
  872. }
  873. </style>