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.

1221 lines
38 KiB

1 year ago
  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. :row-style="rowToolStyle"
  39. ref="mainTable"
  40. @row-click="changeData"
  41. highlight-current-row
  42. v-loading="dataListLoading"
  43. style="width: 100%;">
  44. <el-table-column
  45. header-align="center"
  46. align="center"
  47. width="100"
  48. fixed="right"
  49. label="操作">
  50. <template slot-scope="scope">
  51. <a type="text" size="small" @click="updateCostModel(scope.row)">修改成本 </a>
  52. <!-- <a type="text" size="small" @click="editToolInfoModal(scope.row)">编辑 </a>-->
  53. <!-- <a type="text" size="small" v-if = "scope.row.propertyNo && scope.row.propertyNo !== ''" @click="editToolInfoPropertyModal(scope.row)">属性 </a>-->
  54. <!-- <a type="text" size="small" @click="deleteToolInfoConfirm(scope.row)">删除 </a>-->
  55. </template>
  56. </el-table-column>
  57. <el-table-column
  58. v-for="(item,index) in columnList" :key="index"
  59. :sortable="item.columnSortable"
  60. :prop="item.columnProp"
  61. :header-align="item.headerAlign"
  62. :show-overflow-tooltip="item.showOverflowTooltip"
  63. :align="item.align"
  64. :fixed="item.fixed==''?false:item.fixed"
  65. :min-width="item.columnWidth"
  66. :label="item.columnLabel">
  67. <template slot-scope="scope">
  68. <span v-if="!item.columnHidden"> {{scope.row[item.columnProp]}}</span>
  69. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]"
  70. style="width: 100px; height: 80px"/></span>
  71. </template>
  72. </el-table-column>
  73. </el-table>
  74. <el-pagination
  75. @size-change="sizeChangeHandle"
  76. :current-page="pageIndex"
  77. :page-sizes="[20, 50, 100, 1000]"
  78. :page-size="pageSize"
  79. :total="totalPage"
  80. layout="total, sizes, prev, pager, next, jumper">
  81. </el-pagination>
  82. <el-tabs style="font-size: 12px;min-height: 330px" class="customer-tab" v-model="activeName" type="border-card" @tab-click="tabClick">
  83. <el-tab-pane label="工具实例" name="detail" style="margin-left: -10px;">
  84. <!-- <el-form label-position="top" style="margin-top: -15px; margin-left: 2px;">-->
  85. <!-- <el-button type="primary" @click="addToolInstanceModal()">新增</el-button>-->
  86. <!-- </el-form>-->
  87. <el-table
  88. :data="detailList"
  89. height="240"
  90. border
  91. @row-click="changeInstanceData"
  92. highlight-current-row
  93. :row-style="rowToolInstanceStyle"
  94. v-loading="dataListLoading"
  95. style="width: 100%; ">
  96. <el-table-column
  97. v-for="(item,index) in columnDetailList" :key="index"
  98. :sortable="item.columnSortable"
  99. :prop="item.columnProp"
  100. :header-align="item.headerAlign"
  101. :show-overflow-tooltip="item.showOverflowTooltip"
  102. :align="item.align"
  103. :fixed="item.fixed==''?false:item.fixed"
  104. :min-width="item.columnWidth"
  105. :label="item.columnLabel">
  106. <template slot-scope="scope">
  107. <span v-if="!item.columnHidden"> {{ scope.row[item.columnProp] }}</span>
  108. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]"
  109. style="width: 100px; height: 80px"/></span>
  110. </template>
  111. </el-table-column>
  112. <!-- <el-table-column-->
  113. <!-- header-align="center"-->
  114. <!-- align="center"-->
  115. <!-- width="180"-->
  116. <!-- fixed="right"-->
  117. <!-- label="操作">-->
  118. <!-- <template slot-scope="scope">-->
  119. <!-- <a type="text" size="small" @click="editToolInstanceModal(scope.row)">编辑 </a>-->
  120. <!-- <a type="text" size="small" v-if = "scope.row.propertyNo && scope.row.propertyNo !== ''" @click="editToolInstancePropertyModal(scope.row)">属性 </a>-->
  121. <!-- <a type="text" size="small" @click="editToolInstanceDateModal(scope.row)">生命周期 </a>-->
  122. <!-- <a type="text" size="small" @click="deleteToolInstanceConfirm(scope.row)">删除 </a>-->
  123. <!-- </template>-->
  124. <!-- </el-table-column>-->
  125. </el-table>
  126. </el-tab-pane>
  127. </el-tabs>
  128. <el-dialog
  129. width="330px" v-drag
  130. :title="'编辑成本'"
  131. :close-on-click-modal="false"
  132. :visible.sync="costModelFlag">
  133. <el-form :inline="true" label-position="top" label-width="100px" >
  134. <el-form-item :label="'工具编码'">
  135. <el-input v-model="dataForm.toolId" style="width: 130px" disabled></el-input>
  136. </el-form-item>
  137. <el-form-item :label="'工具描述'">
  138. <el-input v-model="dataForm.toolDesc" style="width: 130px" disabled></el-input>
  139. </el-form-item>
  140. <el-form-item :label="'工具成本'">
  141. <el-input v-model="dataForm.standardCost" style="width: 130px" type="number"></el-input>
  142. </el-form-item>
  143. </el-form>
  144. <span slot="footer" class="dialog-footer">
  145. <el-button type="primary" @click="saveCost()">{{'保存'}}</el-button>
  146. <el-button type="primary" @click="costModelFlag = false">{{'取消'}}</el-button>
  147. </span>
  148. </el-dialog>
  149. <!-- 选择组件 -->
  150. <Chooselist ref="baseList" @getBaseData="getBaseData"></Chooselist>
  151. <!-- 工具信息 -->
  152. <toolInfoAddUpdate ref="toolInfoAddUpdate" :close-on-click-modal="false" @refreshTooInfoData="refreshTooInfoData" @changeCurrentToolInfo="changeCurrentToolInfo">
  153. </toolInfoAddUpdate>
  154. <!-- 工具实例信息 -->
  155. <toolInstanceAddUpdate ref="toolInstanceAddUpdate" :close-on-click-modal="false" @refreshTooInstanceData="refreshTooInstanceData" @changeCurrentToolInstance="changeCurrentToolInstance">
  156. </toolInstanceAddUpdate>
  157. <!-- 工具实例生命周期信息 -->
  158. <toolInstanceDateShow ref="toolInstanceDateShow" :close-on-click-modal="false" @refreshTooInstanceData="refreshTooInstanceData">
  159. </toolInstanceDateShow>
  160. <!-- 工具属性信息 -->
  161. <toolPropertyShow ref="toolPropertyShow" :close-on-click-modal="false" >
  162. </toolPropertyShow>
  163. </div>
  164. </template>
  165. <script>
  166. import {
  167. getToolInfoList, // 工具信息查询
  168. getToolInstanceList, //工具实例信息查询
  169. removeToolInfo,/*删除工具信息*/
  170. removeToolInstance,/*删除工具实例信息*/
  171. updateToolStandardCost,
  172. } from '@/api/tool/tool_info.js'
  173. /*组件*/
  174. import Chooselist from '@/views/modules/common/Chooselist'; /*选择组件*/
  175. import toolInfoAddUpdate from "./components/com_tool_info_add_update"; /*工具新增和修改组件*/
  176. import toolInstanceAddUpdate from "./components/com_tool_instance_add_update"; /*工具实例新增和修改组件*/
  177. import toolInstanceDateShow from "./components/com_tool_instance_date_show"; /*工具实例新增日期和修改组件*/
  178. import toolPropertyShow from "./components/com_tool_property_show"; /*工具属性修改组件*/
  179. /*組件*/
  180. export default {
  181. components: {
  182. Chooselist,/*选择组件*/
  183. toolInfoAddUpdate,/*工具新增和修改组件*/
  184. toolInstanceAddUpdate,/*工具实例新增和修改组件*/
  185. toolInstanceDateShow,/*工具实例新增日期和修改组件*/
  186. toolPropertyShow,/*工具属性修改组件*/
  187. },
  188. data() {
  189. return {
  190. costModelFlag: false,
  191. fileContentList: [],
  192. activeName: 'detail',
  193. searchData:{
  194. pageIndex: 1,
  195. pageSize: 100,
  196. site:this.$store.state.user.site,
  197. toolId:'',
  198. toolType:'',
  199. startDate:'',
  200. endDate:'',
  201. },
  202. dataForm:{
  203. site:'',
  204. toolId:'',
  205. toolDesc:'',
  206. standardCost:'',
  207. },
  208. currentRow:{},
  209. currentInstanceRow: {},
  210. height: 200,
  211. dataList:[],
  212. detailList:[],
  213. dataListLoading: false,
  214. // 导出 start
  215. exportData: [],
  216. exportName: "工具信息" + this.dayjs().format('YYYYMMDDHHmmss'),
  217. exportHeader: ["工具信息"],
  218. exportFooter: [],
  219. exportList:[],
  220. tagNo:'',
  221. pageIndex: 1,
  222. pageSize: 100,
  223. totalPage: 0,
  224. // 导出 end
  225. columnList: [
  226. {
  227. userId: this.$store.state.user.name,
  228. functionId: 106004,
  229. serialNumber: '106004Table1Site',
  230. tableId: "106004Table1",
  231. tableName: "刀具信息主表",
  232. columnProp: "site",
  233. headerAlign: "center",
  234. align: "left",
  235. columnLabel: "工厂编码",
  236. columnHidden: false,
  237. columnImage: false,
  238. columnSortable: false,
  239. sortLv: 0,
  240. status: true,
  241. fixed: '',
  242. columnWidth: 80
  243. },
  244. {
  245. userId: this.$store.state.user.name,
  246. functionId: 106004,
  247. serialNumber: '106004Table1ToolId',
  248. tableId: "106004Table1",
  249. tableName: "刀具信息主表",
  250. columnProp: "toolId",
  251. headerAlign: "center",
  252. align: "left",
  253. columnLabel: "工具编码",
  254. columnHidden: false,
  255. columnImage: false,
  256. columnSortable: false,
  257. sortLv: 0,
  258. status: true,
  259. fixed: '',
  260. columnWidth: 80
  261. },
  262. {
  263. userId: this.$store.state.user.name,
  264. functionId: 106004,
  265. serialNumber: '106004Table1ToolDesc',
  266. tableId: "106004Table1",
  267. tableName: "刀具信息主表",
  268. columnProp: "toolDesc",
  269. headerAlign: "center",
  270. align: "left",
  271. columnLabel: "工具描述",
  272. columnHidden: false,
  273. columnImage: false,
  274. columnSortable: false,
  275. sortLv: 0,
  276. status: true,
  277. fixed: '',
  278. columnWidth: 160
  279. },
  280. {
  281. userId: this.$store.state.user.name,
  282. functionId: 106004,
  283. serialNumber: '106004TableToolType',
  284. tableId: "106004Table1",
  285. tableName: "刀具信息主表",
  286. columnProp: "toolType",
  287. headerAlign: "center",
  288. align: "left",
  289. columnLabel: "工具类型",
  290. columnHidden: false,
  291. columnImage: false,
  292. columnSortable: false,
  293. sortLv: 0,
  294. status: true,
  295. fixed: '',
  296. columnWidth: 80
  297. }, {
  298. userId: this.$store.state.user.name,
  299. functionId: 106004,
  300. serialNumber: '106004TableStandardCost',
  301. tableId: "106004Table1",
  302. tableName: "刀具信息主表",
  303. columnProp: "standardCost",
  304. headerAlign: "center",
  305. align: "right",
  306. columnLabel: "工具成本",
  307. columnHidden: false,
  308. columnImage: false,
  309. columnSortable: false,
  310. sortLv: 0,
  311. status: true,
  312. fixed: '',
  313. columnWidth: 80
  314. },
  315. {
  316. userId: this.$store.state.user.name,
  317. functionId: 106004,
  318. serialNumber: '106004TableCalendarId',
  319. tableId: "106004Table1",
  320. tableName: "刀具信息主表",
  321. columnProp: "calendarId",
  322. headerAlign: "center",
  323. align: "left",
  324. columnLabel: "日历标识",
  325. columnHidden: false,
  326. columnImage: false,
  327. columnSortable: false,
  328. sortLv: 0,
  329. status: true,
  330. fixed: '',
  331. columnWidth: 80
  332. },
  333. {
  334. userId: this.$store.state.user.name,
  335. functionId: 106004,
  336. serialNumber: '106004TablePropertyNo',
  337. tableId: "106004Table1",
  338. tableName: "刀具信息主表",
  339. columnProp: "propertyNo",
  340. headerAlign: "center",
  341. align: "left",
  342. columnLabel: "属性模版",
  343. columnHidden: false,
  344. columnImage: false,
  345. columnSortable: false,
  346. sortLv: 0,
  347. status: true,
  348. fixed: '',
  349. columnWidth: 80
  350. },
  351. {
  352. userId: this.$store.state.user.name,
  353. functionId: 106004,
  354. serialNumber: '106004TableSchedCapacity',
  355. tableId: "106004Table1",
  356. tableName: "刀具信息主表",
  357. columnProp: "schedCapacity",
  358. headerAlign: "center",
  359. align: "left",
  360. columnLabel: "计划能力",
  361. columnHidden: false,
  362. columnImage: false,
  363. columnSortable: false,
  364. sortLv: 0,
  365. status: true,
  366. fixed: '',
  367. columnWidth: 80
  368. },
  369. {
  370. userId: this.$store.state.user.name,
  371. functionId: 106004,
  372. serialNumber: '106004TableCalibrationControl',
  373. tableId: "106004Table1",
  374. tableName: "刀具信息主表",
  375. columnProp: "calibrationControl",
  376. headerAlign: "center",
  377. align: "left",
  378. columnLabel: "校对控制",
  379. columnHidden: false,
  380. columnImage: false,
  381. columnSortable: false,
  382. sortLv: 0,
  383. status: true,
  384. fixed: '',
  385. columnWidth: 80
  386. },
  387. {
  388. userId: this.$store.state.user.name,
  389. functionId: 106004,
  390. serialNumber: '106004TableCalibrationTime',
  391. tableId: "106004Table1",
  392. tableName: "刀具信息主表",
  393. columnProp: "calibrationTime",
  394. headerAlign: "center",
  395. align: "left",
  396. columnLabel: "校对间隔时间",
  397. columnHidden: false,
  398. columnImage: false,
  399. columnSortable: false,
  400. sortLv: 0,
  401. status: true,
  402. fixed: '',
  403. columnWidth: 80
  404. },
  405. {
  406. userId: this.$store.state.user.name,
  407. functionId: 106004,
  408. serialNumber: '106004TableLastUsed',
  409. tableId: "106004Table1",
  410. tableName: "刀具信息主表",
  411. columnProp: "lastUsed",
  412. headerAlign: "center",
  413. align: "left",
  414. columnLabel: "上次使用",
  415. columnHidden: false,
  416. columnImage: false,
  417. columnSortable: false,
  418. sortLv: 0,
  419. status: true,
  420. fixed: '',
  421. columnWidth: 80
  422. },
  423. {
  424. userId: this.$store.state.user.name,
  425. functionId: 106004,
  426. serialNumber: '106004TableAlternateToolId',
  427. tableId: "106004Table1",
  428. tableName: "刀具信息主表",
  429. columnProp: "alternateToolId",
  430. headerAlign: "center",
  431. align: "left",
  432. columnLabel: "备选工具标识号",
  433. columnHidden: false,
  434. columnImage: false,
  435. columnSortable: false,
  436. sortLv: 0,
  437. status: true,
  438. fixed: '',
  439. columnWidth: 80
  440. },
  441. {
  442. userId: this.$store.state.user.name,
  443. functionId: 106004,
  444. serialNumber: '106004TableEnabledForControlPlanDb',
  445. tableId: "106004Table1",
  446. tableName: "刀具信息主表",
  447. columnProp: "enabledForControlPlanDb",
  448. headerAlign: "center",
  449. align: "left",
  450. columnLabel: "为控制计划启用",
  451. columnHidden: false,
  452. columnImage: false,
  453. columnSortable: false,
  454. sortLv: 0,
  455. status: true,
  456. fixed: '',
  457. columnWidth: 80
  458. },
  459. {
  460. userId: this.$store.state.user.name,
  461. functionId: 106004,
  462. serialNumber: '106004TableNoteText',
  463. tableId: "106004Table1",
  464. tableName: "刀具信息主表",
  465. columnProp: "noteText",
  466. headerAlign: "center",
  467. align: "left",
  468. columnLabel: "备注",
  469. columnHidden: false,
  470. columnImage: false,
  471. columnSortable: false,
  472. sortLv: 0,
  473. status: true,
  474. fixed: '',
  475. columnWidth: 180
  476. },
  477. {
  478. userId: this.$store.state.user.name,
  479. functionId: 106004,
  480. serialNumber: '106004Table1CreatedBy',
  481. tableId: "106004Table1",
  482. tableName: "刀具信息主表",
  483. columnProp: "createdBy",
  484. headerAlign: "center",
  485. align: "left",
  486. columnLabel: "创建人",
  487. columnHidden: false,
  488. columnImage: false,
  489. columnSortable: false,
  490. sortLv: 0,
  491. status: true,
  492. fixed: '',
  493. columnWidth: 80
  494. },
  495. {
  496. userId: this.$store.state.user.name,
  497. functionId: 106004,
  498. serialNumber: '106004Table1CreateDate',
  499. tableId: "106004Table1",
  500. tableName: "刀具信息主表",
  501. columnProp: "createDate",
  502. headerAlign: "center",
  503. align: "left",
  504. columnLabel: "创建时间",
  505. columnHidden: false,
  506. columnImage: false,
  507. columnSortable: false,
  508. sortLv: 0,
  509. status: true,
  510. fixed: '',
  511. columnWidth: 90
  512. },
  513. {
  514. userId: this.$store.state.user.name,
  515. functionId: 106004,
  516. serialNumber: '106004Table1UpdatedBy',
  517. tableId: "106004Table1",
  518. tableName: "刀具信息主表",
  519. columnProp: "updatedBy",
  520. headerAlign: "center",
  521. align: "left",
  522. columnLabel: "修改人",
  523. columnHidden: false,
  524. columnImage: false,
  525. columnSortable: false,
  526. sortLv: 0,
  527. status: true,
  528. fixed: '',
  529. columnWidth: 80
  530. },
  531. {
  532. userId: this.$store.state.user.name,
  533. functionId: 106004,
  534. serialNumber: '106004Table1UpdatedDate',
  535. tableId: "106004Table1",
  536. tableName: "刀具信息主表",
  537. columnProp: "updatedDate",
  538. headerAlign: "center",
  539. align: "left",
  540. columnLabel: "修改时间",
  541. columnHidden: false,
  542. columnImage: false,
  543. columnSortable: false,
  544. sortLv: 0,
  545. status: true,
  546. fixed: '',
  547. columnWidth: 90
  548. },
  549. ],
  550. columnDetailList: [
  551. {
  552. userId: this.$store.state.user.name,
  553. functionId: 106004,
  554. serialNumber: '106004Table2ToolInstance',
  555. tableId: '106004Table2',
  556. tableName: '工具实例明细',
  557. columnProp: 'toolInstance',
  558. headerAlign: 'center',
  559. align: 'center',
  560. columnLabel: '工具实例',
  561. columnHidden: false,
  562. columnImage: false,
  563. columnSortable: false,
  564. sortLv: 0,
  565. status: true,
  566. fixed: '',
  567. columnWidth: 40
  568. },
  569. {
  570. userId: this.$store.state.user.name,
  571. functionId: 106004,
  572. serialNumber: '106004Table2Description',
  573. tableId: '106004Table2',
  574. tableName: '工具实例明细',
  575. columnProp: 'description',
  576. headerAlign: 'center',
  577. align: 'center',
  578. columnLabel: '工具实例描述',
  579. columnHidden: false,
  580. columnImage: false,
  581. columnSortable: false,
  582. sortLv: 0,
  583. status: true,
  584. fixed: '',
  585. columnWidth: 70
  586. },
  587. {
  588. userId: this.$store.state.user.name,
  589. functionId: 106004,
  590. serialNumber: '106004Table2ToolNo',
  591. tableId: '106004Table2',
  592. tableName: '工具实例明细',
  593. columnProp: 'toolNo',
  594. headerAlign: 'center',
  595. align: 'center',
  596. columnLabel: '工具编码',
  597. columnHidden: false,
  598. columnImage: false,
  599. columnSortable: false,
  600. sortLv: 0,
  601. status: true,
  602. fixed: '',
  603. columnWidth: 70
  604. },
  605. {
  606. userId: this.$store.state.user.name,
  607. functionId: 106004,
  608. serialNumber: '106004Table2LastPropertyNo',
  609. tableId: '106004Table2',
  610. tableName: '工具实例明细',
  611. columnProp: 'propertyNo',
  612. headerAlign: 'center',
  613. align: 'center',
  614. columnLabel: '属性模版',
  615. columnHidden: false,
  616. columnImage: false,
  617. columnSortable: false,
  618. sortLv: 0,
  619. status: true,
  620. fixed: '',
  621. columnWidth: 120
  622. },
  623. {
  624. userId: this.$store.state.user.name,
  625. functionId: 106004,
  626. serialNumber: '106004Table2LastCalibrationDate',
  627. tableId: '106004Table2',
  628. tableName: '工具实例明细',
  629. columnProp: 'lastCalibrationDate',
  630. headerAlign: 'center',
  631. align: 'center',
  632. columnLabel: '最近校准日期',
  633. columnHidden: false,
  634. columnImage: false,
  635. columnSortable: false,
  636. sortLv: 0,
  637. status: true,
  638. fixed: '',
  639. columnWidth: 120
  640. },
  641. {
  642. userId: this.$store.state.user.name,
  643. functionId: 106004,
  644. serialNumber: '106004Table2ObjectId',
  645. tableId: '106004Table2',
  646. tableName: '工具实例明细',
  647. columnProp: 'objectId',
  648. headerAlign: 'center',
  649. align: 'center',
  650. columnLabel: '对象标识',
  651. columnHidden: false,
  652. columnImage: false,
  653. columnSortable: false,
  654. sortLv: 0,
  655. status: true,
  656. fixed: '',
  657. columnWidth: 120
  658. },
  659. {
  660. userId: this.$store.state.user.name,
  661. functionId: 106004,
  662. serialNumber: '106004Table2NormalWorkCenterNo',
  663. tableId: '106004Table2',
  664. tableName: '工具实例明细',
  665. columnProp: 'normalWorkCenterNo',
  666. headerAlign: 'center',
  667. align: 'center',
  668. columnLabel: '工作中心',
  669. columnHidden: false,
  670. columnImage: false,
  671. columnSortable: false,
  672. sortLv: 0,
  673. status: true,
  674. fixed: '',
  675. columnWidth: 60
  676. },
  677. {
  678. userId: this.$store.state.user.name,
  679. functionId: 106004,
  680. serialNumber: '106004Table2NormalWorkCenterDesc',
  681. tableId: '106004Table2',
  682. tableName: '工具实例明细',
  683. columnProp: 'normalWorkCenterDesc',
  684. headerAlign: 'center',
  685. align: 'center',
  686. columnLabel: '工作重心描述',
  687. columnHidden: false,
  688. columnImage: false,
  689. columnSortable: false,
  690. sortLv: 0,
  691. status: true,
  692. fixed: '',
  693. columnWidth: 60
  694. },
  695. {
  696. userId: this.$store.state.user.name,
  697. functionId: 106004,
  698. serialNumber: '106004Table2NormalProductionLine',
  699. tableId: '106004Table2',
  700. tableName: '工具实例明细',
  701. columnProp: 'normalProductionLine',
  702. headerAlign: 'center',
  703. align: 'center',
  704. columnLabel: '生产线',
  705. columnHidden: false,
  706. columnImage: false,
  707. columnSortable: false,
  708. sortLv: 0,
  709. status: true,
  710. fixed: '',
  711. columnWidth: 50
  712. },
  713. {
  714. userId: this.$store.state.user.name,
  715. functionId: 106004,
  716. serialNumber: '106004Table2NormalProductionLineDesc',
  717. tableId: '106004Table2',
  718. tableName: '工具实例明细',
  719. columnProp: 'normalProductionLineDesc',
  720. headerAlign: 'center',
  721. align: 'center',
  722. columnLabel: '生产线描述',
  723. columnHidden: false,
  724. columnImage: false,
  725. columnSortable: false,
  726. sortLv: 0,
  727. status: true,
  728. fixed: '',
  729. columnWidth: 60
  730. },
  731. {
  732. userId: this.$store.state.user.name,
  733. functionId: 106004,
  734. serialNumber: '106004Table2NoteText',
  735. tableId: '106004Table2',
  736. tableName: '工具实例明细',
  737. columnProp: 'noteText',
  738. headerAlign: 'center',
  739. align: 'center',
  740. columnLabel: '备注',
  741. columnHidden: false,
  742. columnImage: false,
  743. columnSortable: false,
  744. sortLv: 0,
  745. status: true,
  746. fixed: '',
  747. columnWidth: 200
  748. },
  749. {
  750. userId: this.$store.state.user.name,
  751. functionId: 106004,
  752. serialNumber: '106004Table2CreatedBy',
  753. tableId: "106004Table2",
  754. tableName: "工具实例明细",
  755. columnProp: "createdBy",
  756. headerAlign: "center",
  757. align: "left",
  758. columnLabel: "创建人",
  759. columnHidden: false,
  760. columnImage: false,
  761. columnSortable: false,
  762. sortLv: 0,
  763. status: true,
  764. fixed: '',
  765. columnWidth: 80
  766. },
  767. {
  768. userId: this.$store.state.user.name,
  769. functionId: 106004,
  770. serialNumber: '106004Table2CreatedDate',
  771. tableId: "106004Table2",
  772. tableName: "工具实例明细",
  773. columnProp: "createdDate",
  774. headerAlign: "center",
  775. align: "left",
  776. columnLabel: "创建时间",
  777. columnHidden: false,
  778. columnImage: false,
  779. columnSortable: false,
  780. sortLv: 0,
  781. status: true,
  782. fixed: '',
  783. columnWidth: 90
  784. },
  785. {
  786. userId: this.$store.state.user.name,
  787. functionId: 106004,
  788. serialNumber: '106004Table2UpdatedBy',
  789. tableId: "106004Table2",
  790. tableName: "工具实例明细",
  791. columnProp: "updatedBy",
  792. headerAlign: "center",
  793. align: "left",
  794. columnLabel: "修改人",
  795. columnHidden: false,
  796. columnImage: false,
  797. columnSortable: false,
  798. sortLv: 0,
  799. status: true,
  800. fixed: '',
  801. columnWidth: 80
  802. },
  803. {
  804. userId: this.$store.state.user.name,
  805. functionId: 106004,
  806. serialNumber: '106004Table2UpdatedDate',
  807. tableId: "106004Table2",
  808. tableName: "刀具信息主表",
  809. columnProp: "updatedDate",
  810. headerAlign: "center",
  811. align: "left",
  812. columnLabel: "修改时间",
  813. columnHidden: false,
  814. columnImage: false,
  815. columnSortable: false,
  816. sortLv: 0,
  817. status: true,
  818. fixed: '',
  819. columnWidth: 90
  820. },
  821. ],
  822. }
  823. },
  824. watch: {
  825. // columnList: {
  826. // deep: true,
  827. // handler: function (newV, oldV) {
  828. // debugger
  829. //
  830. // }
  831. // }
  832. },
  833. mounted() {
  834. this.$nextTick(() => {
  835. this.height = window.innerHeight - 520;
  836. })
  837. },
  838. methods: {
  839. // 获取基础数据列表S
  840. getBaseList (val, type) {
  841. this.tagNo = val
  842. this.$nextTick(() => {
  843. let strVal = ''
  844. this.$refs.baseList.init(val, strVal)
  845. })
  846. },
  847. /* 列表方法的回调 */
  848. getBaseData (val) {
  849. if (this.tagNo === 1016) {
  850. this.searchData.toolType = val.tool_type;
  851. }
  852. },
  853. //导出excel
  854. async createExportData() {
  855. this.searchData.limit = -1
  856. this.searchData.page = 1
  857. await getToolInfoList(this.searchData).then(({data}) => {
  858. this.exportList= data.page.list;
  859. })
  860. return this.exportList;
  861. },
  862. startDownload() {
  863. // this.exportData = this.dataList
  864. },
  865. finishDownload() {
  866. },
  867. fields() {
  868. let json = "{"
  869. this.columnList.forEach((item, index) => {
  870. if (index == this.columnList.length - 1) {
  871. json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\""
  872. } else {
  873. json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\"" + ","
  874. }
  875. })
  876. json += "}"
  877. let s = eval("(" + json + ")")
  878. return s
  879. },
  880. /*刷新工具信息*/
  881. refreshTooInfoData() {
  882. this.searchData.pageSize = this.pageSize
  883. this.searchData.pageIndex = this.pageIndex
  884. getToolInfoList(this.searchData).then(({data}) => {
  885. if (data.code == 200) {
  886. this.dataList = data.rows;
  887. this.totalPage = data.total;
  888. }
  889. this.dataListLoading = false
  890. })
  891. },
  892. /*新增工具的modal*/
  893. addToolInfoModal(){
  894. //打开modal的页面
  895. this.$nextTick(() => {
  896. this.$refs.toolInfoAddUpdate.init(null, true)
  897. });
  898. },
  899. /*编辑工具信息*/
  900. editToolInfoModal(toolInfo){
  901. //打开modal的页面
  902. this.$nextTick(() => {
  903. this.$refs.toolInfoAddUpdate.init(toolInfo, false)
  904. });
  905. },
  906. /*工具属性的维护*/
  907. editToolInfoPropertyModal(toolInfo){
  908. //打开modal的页面
  909. this.$nextTick(() => {
  910. this.$refs.toolPropertyShow.init(toolInfo, 'TL');
  911. });
  912. },
  913. /*工具实例属性的维护*/
  914. editToolInstancePropertyModal(toolInfo){
  915. //打开modal的页面
  916. this.$nextTick(() => {
  917. this.$refs.toolPropertyShow.init(toolInfo, 'TLI');
  918. });
  919. },
  920. /*删除工具的确认选项*/
  921. deleteToolInfoConfirm(toolInfo) {
  922. this.$confirm('是否删除工具标识号:'+ toolInfo.toolId+'?', '提示', {
  923. confirmButtonText: '确定',
  924. cancelButtonText: '取消',
  925. type: 'warning'
  926. }).then(() => {
  927. removeToolInfo(toolInfo).then(({data}) => {
  928. if (data.code === 200) {
  929. this.$message.success('操作成功!');
  930. this.refreshTooInfoData();
  931. } else {
  932. this.$message.error(data.msg);
  933. }
  934. })
  935. })
  936. },
  937. /*新增工具实例的modal*/
  938. addToolInstanceModal(){
  939. //判断是否选择好数据
  940. if(this.currentRow && Object.keys(this.currentRow).length > 0){
  941. //打开modal的页面
  942. this.$nextTick(() => {
  943. this.$refs.toolInstanceAddUpdate.init(this.currentRow, true)
  944. });
  945. }else{
  946. this.$message.error('请先选择工具信息再添加工具实例!');
  947. }
  948. },
  949. /*修改工具实例的modal*/
  950. editToolInstanceModal(row){
  951. this.currentInstanceRow = row;
  952. //判断是否选择好数据
  953. if(Object.keys(this.currentInstanceRow).length > 0){
  954. //打开modal的页面
  955. this.$nextTick(() => {
  956. this.$refs.toolInstanceAddUpdate.init(this.currentInstanceRow, false)
  957. });
  958. }else{
  959. this.$message.error('请先选择工具实例再添加工具实例!');
  960. }
  961. },
  962. /*刷新工具信息*/
  963. refreshTooInstanceData() {
  964. getToolInstanceList(this.currentRow).then(({data}) => {
  965. if (data.code == 200) {
  966. this.detailList = data.rows;
  967. }
  968. this.dataListLoading = false
  969. })
  970. },
  971. /*删除工具实例确认*/
  972. deleteToolInstanceConfirm(toolInfo){
  973. this.$confirm('是否删除工具实例:'+ toolInfo.toolInstance+'?', '提示', {
  974. confirmButtonText: '确定',
  975. cancelButtonText: '取消',
  976. type: 'warning'
  977. }).then(() => {
  978. removeToolInstance(toolInfo).then(({data}) => {
  979. if (data.code === 200) {
  980. this.$message.success('操作成功!');
  981. this.refreshTooInstanceData();
  982. } else {
  983. this.$message.error(data.msg);
  984. }
  985. })
  986. })
  987. },
  988. /*工具实例的生命周期*/
  989. editToolInstanceDateModal(toolInfo){
  990. this.currentInstanceRow = toolInfo;
  991. //添加工具分类和分类的描述信息
  992. this.currentInstanceRow.toolType = this.currentRow.toolType;
  993. this.currentInstanceRow.toolDesc = this.currentRow.toolDesc;
  994. //判断是否选择好数据
  995. if(Object.keys(this.currentInstanceRow).length > 0){
  996. //打开modal的页面
  997. this.$nextTick(() => {
  998. this.$refs.toolInstanceDateShow.init(this.currentInstanceRow)
  999. });
  1000. }else{
  1001. this.$message.error('请先选择工具实例再添加工具实例!');
  1002. }
  1003. },
  1004. //切换工具触发
  1005. changeData(row) {
  1006. this.currentRow = JSON.parse(JSON.stringify(row));
  1007. this.refreshCurrentTabTable ();
  1008. },
  1009. /*切换工具实例*/
  1010. changeInstanceData(row){
  1011. this.currentInstanceRow = JSON.parse(JSON.stringify(row));
  1012. },
  1013. updateCostModel(row){
  1014. this.dataForm.site=row.site
  1015. this.dataForm.toolId=row.toolId
  1016. this.dataForm.toolDesc=row.toolDesc
  1017. this.dataForm.standardCost=row.standardCost
  1018. this.costModelFlag=true
  1019. },
  1020. saveCost(){
  1021. updateToolStandardCost(this.dataForm).then(({data}) => {
  1022. if (data && data.code == 0) {
  1023. this.costModelFlag=false
  1024. this.$message({
  1025. message: '操作成功',
  1026. type: 'success',
  1027. duration: 1500,
  1028. onClose: () => {
  1029. }
  1030. })
  1031. this.search ()
  1032. } else {
  1033. this.$alert(data.msg, '错误', {
  1034. confirmButtonText: '确定'
  1035. })
  1036. }
  1037. })
  1038. },
  1039. // 获取数据列表
  1040. search () {
  1041. this.searchData.pageSize = this.pageSize
  1042. this.searchData.pageIndex = this.pageIndex
  1043. getToolInfoList(this.searchData).then(({data}) => {
  1044. if (data.code == 200) {
  1045. this.dataList = data.rows;
  1046. this.totalPage = data.total;
  1047. if(this.dataList.length > 0){
  1048. this.$refs.mainTable.setCurrentRow(this.dataList[0]);
  1049. //如果已经存在则 不修改默认数值 不然修改默认选择行为第一行
  1050. if(this.currentRow && Object.keys(this.currentRow).length > 0){
  1051. //已经存在 不需要修改
  1052. }else{
  1053. this.currentRow = JSON.parse(JSON.stringify(this.dataList[0]));
  1054. }
  1055. }else {
  1056. this.currentRow ={}
  1057. }
  1058. this.refreshCurrentTabTable ()
  1059. }
  1060. this.dataListLoading = false
  1061. })
  1062. },
  1063. tabClick (tab, event) {
  1064. // 刷新列表数据
  1065. this.refreshCurrentTabTable()
  1066. },
  1067. // 刷新页签的table数据
  1068. refreshCurrentTabTable () {
  1069. if (this.activeName == 'detail') {
  1070. this.refreshToolInstanceData();
  1071. }
  1072. },
  1073. /*刷新工具实例的信息*/
  1074. refreshToolInstanceData(){
  1075. getToolInstanceList(this.currentRow).then(({data}) => {
  1076. if (data.code == 200) {
  1077. this.detailList = data.rows;
  1078. }
  1079. this.dataListLoading = false
  1080. })
  1081. },
  1082. // 下载
  1083. downloadFile(row){
  1084. downLoadProjectFile(row)
  1085. .then(({data}) => {
  1086. // 不限制文件下载类型
  1087. const blob = new Blob([data], {type:'application/octet-stream;charset=utf-8'})
  1088. // 下载文件名称
  1089. const fileName = row.fileName
  1090. // a标签下载
  1091. const linkNode = document.createElement('a')
  1092. linkNode.download = fileName // a标签的download属性规定下载文件的名称
  1093. linkNode.style.display = 'none'
  1094. linkNode.href = URL.createObjectURL(blob) // 生成一个Blob URL
  1095. console.log(linkNode)
  1096. // if(val == 'Y'){
  1097. // this.pdfVisible = true
  1098. // this.pdfUrl = linkNode.href
  1099. // }else {
  1100. document.body.appendChild(linkNode)
  1101. linkNode.click() // 模拟在按钮上的一次鼠标单击
  1102. URL.revokeObjectURL(linkNode.href) // 释放URL 对象
  1103. document.body.removeChild(linkNode)
  1104. // }
  1105. })
  1106. // }else {
  1107. // this.$alert('没有权限下载这个项目的文件!', '错误', {
  1108. // confirmButtonText: '确定'
  1109. // })
  1110. // }
  1111. // })
  1112. },
  1113. // 每页数
  1114. sizeChangeHandle (val) {
  1115. this.pageSize = val
  1116. this.pageIndex = 1
  1117. this.search()
  1118. },
  1119. /*调整等待派工单的等待时间*/
  1120. changeCurrentToolInfo(tempData) {
  1121. //重置选择行
  1122. this.currentRow = JSON.parse(JSON.stringify(tempData));
  1123. },
  1124. /*调整等待派工单的等待时间*/
  1125. changeCurrentToolInstance(tempData) {
  1126. //重置选择行
  1127. this.currentInstanceRow = JSON.parse(JSON.stringify(tempData));
  1128. },
  1129. /*选中行的样式*/
  1130. rowToolStyle ({row}) {
  1131. if (this.currentRow.site === row.site && this.currentRow.toolId === row.toolId) {
  1132. return { 'background-color': '#D9EDF7', cursor: 'pointer' };
  1133. }
  1134. },
  1135. /*选中行的样式*/
  1136. rowToolInstanceStyle ({row}) {
  1137. if (this.currentInstanceRow.site === row.site && this.currentInstanceRow.toolInstance === row.toolInstance) {
  1138. return { 'background-color': '#D9EDF7', cursor: 'pointer' };
  1139. }
  1140. },
  1141. },
  1142. activated() {
  1143. },
  1144. }
  1145. </script>
  1146. <style >
  1147. /deep/ .customer-tab .el-tabs__content {
  1148. padding: 0px !important;
  1149. }
  1150. .el-transfer-panel {
  1151. border: 2px solid #17b3a3;
  1152. border-radius: 4px;
  1153. overflow: hidden;
  1154. background: #fff;
  1155. display: inline-block;
  1156. vertical-align: middle;
  1157. width: 200px;
  1158. max-height: 100%;
  1159. -webkit-box-sizing: border-box;
  1160. box-sizing: border-box;
  1161. position: relative;
  1162. }
  1163. .el-transfer-panel .el-transfer-panel__header {
  1164. height: 40px;
  1165. line-height: 40px;
  1166. background: #17b3a3;
  1167. margin: 0;
  1168. padding-left: 15px;
  1169. border-bottom: 1px solid #17b3a3;
  1170. -webkit-box-sizing: border-box;
  1171. box-sizing: border-box;
  1172. color: #000;
  1173. }
  1174. .el-transfer-panel .el-transfer-panel__header .el-checkbox .el-checkbox__label {
  1175. font-size: 14px;
  1176. color: #303133;
  1177. font-weight: 400;
  1178. }
  1179. </style>