冷凝胶前端
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.

703 lines
20 KiB

2 years ago
  1. <template>
  2. <div class="mod-config">
  3. <!-- 条件查询 -->
  4. <el-form :inline="true" label-position="top" :model="searchData" @keyup.enter.native="getDataList()">
  5. <el-form-item :label="'物料编码:'">
  6. <el-input v-model="searchData.partNo" clearable style="width: 120px"></el-input>
  7. </el-form-item>
  8. <el-form-item :label="'库位编码:'">
  9. <el-input v-model="searchData.locationID" clearable style="width: 120px"></el-input>
  10. </el-form-item>
  11. <el-form-item :label="'料号描述:'">
  12. <el-input v-model="searchData.partDesc" clearable style="width: 120px"></el-input>
  13. </el-form-item>
  14. <el-form-item :label="'卷号:'">
  15. <el-input v-model="searchData.rollNo" clearable style="width: 120px"></el-input>
  16. </el-form-item>
  17. <el-form-item :label="' '">
  18. <el-button v-if="!authSearch" type="primary" @click="getDataList()">查询</el-button>
  19. <!-- <download-excel-->
  20. <!-- :fields="fields()"-->
  21. <!-- :data="exportData"-->
  22. <!-- type="xls"-->
  23. <!-- :name="exportName"-->
  24. <!-- :header="exportHeader"-->
  25. <!-- :footer="exportFooter"-->
  26. <!-- :fetch="createExportData"-->
  27. <!-- :before-generate="startDownload"-->
  28. <!-- :before-finish="finishDownload"-->
  29. <!-- worksheet="导出信息"-->
  30. <!-- class="el-button el-button&#45;&#45;primary el-button&#45;&#45;medium">-->
  31. <!-- {{ "导出" }}-->
  32. <!-- </download-excel>-->
  33. </el-form-item>
  34. </el-form>
  35. <!-- 展示列表 -->
  36. <el-table
  37. :height="height"
  38. :data="dataList"
  39. border
  40. highlight-current-row
  41. ref="mainTable"
  42. style="width: 100%;">
  43. <el-table-column
  44. v-for="(item,index) in columnList" :key="index"
  45. :sortable="item.columnSortable"
  46. :prop="item.columnProp"
  47. :header-align="item.headerAlign"
  48. :show-overflow-tooltip="item.showOverflowTooltip"
  49. :align="item.align"
  50. :fixed="item.fixed==''?false:item.fixed"
  51. :width="item.columnWidth"
  52. :label="item.columnLabel">
  53. <template slot-scope="scope">
  54. <span v-if="!item.columnHidden"> {{ scope.row[item.columnProp] }}</span>
  55. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  56. </template>
  57. </el-table-column>
  58. </el-table>
  59. <el-pagination
  60. @size-change="sizeChangeHandle"
  61. @current-change="currentChangeHandle"
  62. :current-page="pageIndex"
  63. :page-sizes="[20, 50, 100, 200, 500]"
  64. :page-size="pageSize"
  65. :total="totalPage"
  66. layout="total, sizes, prev, pager, next, jumper">
  67. </el-pagination>
  68. </div>
  69. </template>
  70. <script>
  71. import {
  72. findByRolls, // 物料库存按卷号查询
  73. // findByRoll //查询卷明细
  74. // // getSiteAndBuByUserName
  75. } from "@/api/material/seekByTrans.js"
  76. // import {getTableDefaultListLanguage, getTableUserListLanguage} from "@/api/table.js"
  77. // import {userFavoriteList, saveUserFavorite, removeUserFavorite} from '@/api/userFavorite.js'
  78. export default {
  79. data () {
  80. return {
  81. currentRow:'',
  82. headerData:'',
  83. wareHouseList:'',
  84. // 是否收藏
  85. favorite: false,
  86. // 导出 start
  87. exportData: [],
  88. exportName: "检验方法" + this.dayjs().format('YYYYMMDDHHmmss'),
  89. exportHeader: ["检验方法"],
  90. exportFooter: [],
  91. exportList: [],
  92. warehouseData: {
  93. id:'',
  94. site: '',
  95. },
  96. activeName:"detail",
  97. // 导出 end
  98. searchData: {
  99. transNo:'',
  100. site: '',
  101. userName: this.$store.state.user.name,
  102. transDate: '',
  103. warehouseID: '',
  104. rollNo: '',
  105. partNo: '',
  106. partDesc: '',
  107. transQty: '',
  108. batchNo: '',
  109. locationID: '',
  110. wdrNo: '',
  111. manufactureDate: '',
  112. orderRef1: '',
  113. receiver: '',
  114. enterDate: '',
  115. transType: '',
  116. page: 1,
  117. limit: 10,
  118. },
  119. pageIndex: 1,
  120. pageSize: 20,
  121. totalPage: 0,
  122. height: 200,
  123. secondHeight: 200,
  124. dataList: [],
  125. dataList2:[],
  126. dataListLoading: false,
  127. modalFlag: false,
  128. modalDisableFlag: false,
  129. modalData: {
  130. site: '',
  131. warehouseId: '',
  132. locationId: '',
  133. active: 'Y',
  134. locationName: '',
  135. creator: this.$store.state.user.name,
  136. // updateBy: this.$store.state.user.name,
  137. locationDescription: '',
  138. keeper: '',
  139. remarks: '',
  140. createTime: '',
  141. },
  142. // 标头展示
  143. columnList: [
  144. {
  145. userId: this.$store.state.user.name,
  146. functionId: 200004,
  147. serialNumber: '200004TableSite',
  148. tableId: "200004Table",
  149. tableName: "工厂编码",
  150. columnWidth: 100,
  151. columnProp: 'site',
  152. headerAlign: 'center',
  153. align: "center",
  154. columnLabel: '工厂编码',
  155. columnHidden: false,
  156. columnImage: false,
  157. columnSortable: false,
  158. sortLv: 0,
  159. status: true,
  160. fixed: '',
  161. },
  162. {
  163. userId: this.$store.state.user.name,
  164. functionId: 200004,
  165. serialNumber: '200004TableTransType',
  166. tableId: "200004Table",
  167. tableName: "出入库类型",
  168. columnWidth: 105,
  169. columnProp: 'transType',
  170. headerAlign: 'left',
  171. align: "left",
  172. columnLabel: '出入库类型',
  173. columnHidden: false,
  174. columnImage: false,
  175. columnSortable: false,
  176. sortLv: 0,
  177. status: true,
  178. fixed: '',
  179. },
  180. {
  181. userId: this.$store.state.user.name,
  182. functionId: 200004,
  183. serialNumber: '200004TableTransNo',
  184. tableId: "200004Table",
  185. tableName: "出入库单号",
  186. columnWidth: 100,
  187. columnProp: 'transNo',
  188. headerAlign: 'left',
  189. align: "left",
  190. columnLabel: '出入库单号',
  191. columnHidden: false,
  192. columnImage: false,
  193. columnSortable: false,
  194. sortLv: 0,
  195. status: true,
  196. fixed: '',
  197. },
  198. {
  199. userId: this.$store.state.user.name,
  200. functionId: 200004,
  201. serialNumber: '200004TableTransDate',
  202. tableId: "200004Table",
  203. tableName: "出入库日期",
  204. columnWidth: 105,
  205. columnProp: 'transDate',
  206. headerAlign: 'center',
  207. align: "center",
  208. columnLabel: '出入库日期',
  209. columnHidden: false,
  210. columnImage: false,
  211. columnSortable: false,
  212. sortLv: 0,
  213. status: true,
  214. fixed: '',
  215. },
  216. {
  217. userId: this.$store.state.user.name,
  218. functionId: 200004,
  219. serialNumber: '200004TableWarehouseId',
  220. tableId: "200004Table",
  221. tableName: "仓库编码",
  222. columnWidth: 105,
  223. columnProp: 'warehouseID',
  224. headerAlign: 'left',
  225. align: "left",
  226. columnLabel: '仓位编码',
  227. columnHidden: false,
  228. columnImage: false,
  229. columnSortable: false,
  230. sortLv: 0,
  231. status: true,
  232. fixed: '',
  233. },
  234. {
  235. userId: this.$store.state.user.name,
  236. functionId: 200004,
  237. serialNumber: '200004TableRollNo',
  238. tableId: "200004Table",
  239. tableName: "卷号",
  240. columnWidth: 100,
  241. columnProp: 'rollNo',
  242. headerAlign: 'center',
  243. align: "center",
  244. columnLabel: '卷号',
  245. columnHidden: false,
  246. columnImage: false,
  247. columnSortable: false,
  248. sortLv: 0,
  249. status: true,
  250. fixed: '',
  251. },
  252. {
  253. userId: this.$store.state.user.name,
  254. functionId: 200004,
  255. serialNumber: '200004TablePartNo',
  256. tableId: "200004Table",
  257. tableName: "物料编码",
  258. columnWidth: 105,
  259. columnProp: 'partNo',
  260. headerAlign: 'left',
  261. align: "left",
  262. columnLabel: '物料编码',
  263. columnHidden: false,
  264. columnImage: false,
  265. columnSortable: false,
  266. sortLv: 0,
  267. status: true,
  268. fixed: '',
  269. },
  270. {
  271. userId: this.$store.state.user.name,
  272. functionId: 200004,
  273. serialNumber: '200004TablePartDesc',
  274. tableId: "200004Table",
  275. tableName: "料号描述",
  276. columnWidth: 105,
  277. columnProp: 'partDesc',
  278. headerAlign: 'left',
  279. align: "left",
  280. columnLabel: '料号描述',
  281. columnHidden: false,
  282. columnImage: false,
  283. columnSortable: false,
  284. sortLv: 0,
  285. status: true,
  286. fixed: '',
  287. },
  288. // {
  289. // userId: this.$store.state.user.name,
  290. // functionId: 200004,
  291. // serialNumber: '200004TableNum',
  292. // tableId: "200004Table",
  293. // tableName: "卷数量",
  294. // columnWidth: 105,
  295. // columnProp: 'num',
  296. // headerAlign: 'right',
  297. // align: "right",
  298. // columnLabel: '卷数量',
  299. // columnHidden: false,
  300. // columnImage: false,
  301. // columnSortable: false,
  302. // sortLv: 0,
  303. // status: true,
  304. // fixed: '',
  305. // },
  306. {
  307. userId: this.$store.state.user.name,
  308. functionId: 200004,
  309. serialNumber: '200004TableTransQty',
  310. tableId: "200004Table",
  311. tableName: "出入库数量",
  312. columnWidth: 105,
  313. columnProp: 'transQty',
  314. headerAlign: 'right',
  315. align: "right",
  316. columnLabel: '出入库数量',
  317. columnHidden: false,
  318. columnImage: false,
  319. columnSortable: false,
  320. sortLv: 0,
  321. status: true,
  322. fixed: '',
  323. },
  324. {
  325. userId: this.$store.state.user.name,
  326. functionId: 200004,
  327. serialNumber: '200004TableBatchNo',
  328. tableId: "200004Table",
  329. tableName: "批号",
  330. columnWidth: 105,
  331. columnProp: 'batchNo',
  332. headerAlign: 'left',
  333. align: "left",
  334. columnLabel: '批号',
  335. columnHidden: false,
  336. columnImage: false,
  337. columnSortable: false,
  338. sortLv: 0,
  339. status: true,
  340. fixed: '',
  341. },
  342. {
  343. userId: this.$store.state.user.name,
  344. functionId: 200004,
  345. serialNumber: '200004TableLocationID',
  346. tableId: "200004Table",
  347. tableName: "库位",
  348. columnWidth: 105,
  349. columnProp: 'locationID',
  350. headerAlign: 'left',
  351. align: "left",
  352. columnLabel: '库位',
  353. columnHidden: false,
  354. columnImage: false,
  355. columnSortable: false,
  356. sortLv: 0,
  357. status: true,
  358. fixed: '',
  359. },
  360. {
  361. userId: this.$store.state.user.name,
  362. functionId: 200004,
  363. serialNumber: '200004TableWdrNo',
  364. tableId: "200004Table",
  365. tableName: "W/D/R",
  366. columnWidth: 105,
  367. columnProp: 'wdrNo',
  368. headerAlign: 'left',
  369. align: "left",
  370. columnLabel: 'W/D/R',
  371. columnHidden: false,
  372. columnImage: false,
  373. columnSortable: false,
  374. sortLv: 0,
  375. status: true,
  376. fixed: '',
  377. },
  378. {
  379. userId: this.$store.state.user.name,
  380. functionId: 200004,
  381. serialNumber: '200004TableManufactureDate',
  382. tableId: "200004Table",
  383. tableName: "生产日期",
  384. columnWidth: 105,
  385. columnProp: 'manufactureDate',
  386. headerAlign: 'center',
  387. align: "center",
  388. columnLabel: '生产日期',
  389. columnHidden: false,
  390. columnImage: false,
  391. columnSortable: false,
  392. sortLv: 0,
  393. status: true,
  394. fixed: '',
  395. },
  396. {
  397. userId: this.$store.state.user.name,
  398. functionId: 200004,
  399. serialNumber: '200004TableOrderRef1',
  400. tableId: "200004Table",
  401. tableName: "关联单号",
  402. columnWidth: 105,
  403. columnProp: 'orderRef1',
  404. headerAlign: 'left',
  405. align: "left",
  406. columnLabel: '关联单号',
  407. columnHidden: false,
  408. columnImage: false,
  409. columnSortable: false,
  410. sortLv: 0,
  411. status: true,
  412. fixed: '',
  413. },
  414. {
  415. userId: this.$store.state.user.name,
  416. functionId: 200004,
  417. serialNumber: '200004TableReceiver',
  418. tableId: "200004Table",
  419. tableName: "经手人",
  420. columnWidth: 100,
  421. columnProp: 'receiver',
  422. headerAlign: 'left',
  423. align: "left",
  424. columnLabel: '经手人',
  425. columnHidden: false,
  426. columnImage: false,
  427. columnSortable: false,
  428. sortLv: 0,
  429. status: true,
  430. fixed: '',
  431. },
  432. {
  433. userId: this.$store.state.user.name,
  434. functionId: 200004,
  435. serialNumber: '200004TableEnterDate',
  436. tableId: "200004Table",
  437. tableName: "录入时间",
  438. columnWidth: 130,
  439. columnProp: 'enterDate',
  440. headerAlign: 'center',
  441. align: "center",
  442. columnLabel: '录入时间',
  443. columnHidden: false,
  444. columnImage: false,
  445. columnSortable: false,
  446. sortLv: 0,
  447. status: true,
  448. fixed: '',
  449. },
  450. {
  451. userId: this.$store.state.user.name,
  452. functionId: 200004,
  453. serialNumber: '200004TableUserName',
  454. tableId: "200004Table",
  455. tableName: "录入人",
  456. columnWidth: 105,
  457. columnProp: 'userName',
  458. headerAlign: 'left',
  459. align: "left",
  460. columnLabel: '录入人',
  461. columnHidden: false,
  462. columnImage: false,
  463. columnSortable: false,
  464. sortLv: 0,
  465. status: true,
  466. fixed: '',
  467. },
  468. ],
  469. rules: {
  470. warehouseId:[
  471. {
  472. required: true,
  473. message: ' ',
  474. trigger: ['blur','change']
  475. }
  476. ],
  477. locationId:[
  478. {
  479. required: true,
  480. message: ' ',
  481. trigger: ['blur','change']
  482. }
  483. ],
  484. site:[
  485. {
  486. required: true,
  487. message: ' ',
  488. trigger: ['blur','change']
  489. }
  490. ],
  491. locationName:[
  492. {
  493. required: true,
  494. message: ' ',
  495. trigger: ['blur','change']
  496. }
  497. ]
  498. },
  499. options: [],
  500. userBuList: [],
  501. authSearch: false,
  502. authSave: false,
  503. authUpdate: false,
  504. authDelete: false,
  505. menuId: this.$route.meta.menuId,
  506. }
  507. },
  508. mounted () {
  509. this.$nextTick(() => {
  510. this.height = window.innerHeight - 180
  511. })
  512. },
  513. //页面加载前初始化着两个方法
  514. created () {
  515. this.getDataList()
  516. //this.getWareHouseList()
  517. },
  518. methods: {
  519. // 获取用户的bu
  520. getSiteAndBuByUserName () {
  521. let tempData = {
  522. username: this.$store.state.user.name,
  523. }
  524. getSiteAndBuByUserName(tempData).then(({data}) => {
  525. if (data.code === 0) {
  526. this.userBuList = data.rows
  527. }
  528. })
  529. },
  530. tabClick (tab, event) {
  531. // 刷新列表数据
  532. this.refreshCurrentTabTable()
  533. },
  534. changeData(row){
  535. this.currentRow = JSON.parse(JSON.stringify(row));
  536. this.headerData=row;
  537. this.refreshCurrentTabTable ();
  538. },
  539. // refreshCurrentTabTable(){
  540. // if(this.currentRow===''||this.currentRow===null){
  541. // this.currentRow={site:'',transNo:''}
  542. // }
  543. // findByRoll(this.currentRow).then(({data}) => {
  544. // //区分请求成功和失败的状况
  545. // if (data && data.code == 0) {
  546. // this.dataList2 = data.rows
  547. // } else {
  548. // this.dataList2 = [];
  549. // }
  550. // });
  551. // },
  552. // 查询获取数据列表
  553. getDataList (){
  554. this.searchData.limit = this.pageSize
  555. this.searchData.page = this.pageIndex
  556. findByRolls(this.searchData).then(({data}) => {
  557. if (data.code === 0) {
  558. this.dataList = data.page.list
  559. this.pageIndex = data.page.currPage
  560. this.pageSize = data.page.pageSize
  561. this.totalPage = data.page.totalCount
  562. if(this.dataList.length>0){
  563. this.$refs.mainTable.setCurrentRow(this.dataList[0]);
  564. this.changeData(this.dataList[0])
  565. }else {
  566. this.changeData(null)
  567. }
  568. }
  569. })
  570. },
  571. // 每页数
  572. sizeChangeHandle (val) {
  573. this.pageSize = val
  574. this.pageIndex = 1
  575. this.getDataList()
  576. },
  577. // 当前页
  578. currentChangeHandle (val) {
  579. this.pageIndex = val
  580. this.getDataList()
  581. },
  582. //导出excel
  583. async createExportData() {
  584. this.searchData.limit = -1
  585. this.searchData.page = 1
  586. await findByRolls(this.searchData).then(({data}) => {
  587. this.exportList= data.rows
  588. })
  589. return this.exportList
  590. },
  591. startDownload() {},
  592. finishDownload() {},
  593. fields () {
  594. let json = "{"
  595. this.columnList.forEach((item, index) => {
  596. if (index == this.columnList.length - 1) {
  597. json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\""
  598. } else {
  599. json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\"" + ","
  600. }
  601. })
  602. json += "}"
  603. let s = eval("(" + json + ")")
  604. return s
  605. },
  606. // 动态列开始 获取 用户保存的 格式列
  607. async getTableUserColumn (tableId, columnId) {
  608. let queryTableUser = {
  609. userId: this.$store.state.user.name,
  610. functionId: this.$route.meta.menuId,
  611. tableId: tableId,
  612. status: true,
  613. languageCode: this.$i18n.locale
  614. }
  615. await getTableUserListLanguage(queryTableUser).then(({data}) => {
  616. if (data.rows.length > 0) {
  617. //this.columnList1 = []
  618. switch (columnId) {
  619. case 1:
  620. this.columnList = data.rows
  621. break;
  622. // case 2:
  623. // this.columnDetailList = data.rows
  624. // break;
  625. // case 3:
  626. // this.columnList2 = data.rows
  627. // break;
  628. // case 4:
  629. // this.columnList3 = data.rows
  630. // break;
  631. }
  632. } else {
  633. this.getColumnList(tableId, columnId)
  634. }
  635. })
  636. },
  637. // 获取 tableDefault 列
  638. async getColumnList (tableId, columnId) {
  639. let queryTable = {
  640. functionId: this.$route.meta.menuId,
  641. tableId: tableId,
  642. languageCode: this.$i18n.locale
  643. }
  644. await getTableDefaultListLanguage(queryTable).then(({data}) => {
  645. if (!data.rows.length == 0) {
  646. switch (columnId) {
  647. case 1:
  648. this.columnList = data.rows
  649. break;
  650. // case 2:
  651. // this.columnDetailList = data.rows
  652. // break;
  653. // case 3:
  654. // this.columnList2 = data.rows
  655. // break;
  656. // case 4:
  657. // this.columnList3 = data.rows
  658. // break;
  659. }
  660. } else {
  661. // this.showDefault = true.
  662. }
  663. })
  664. },
  665. //获取按钮的权限数据
  666. getButtonAuthData () {
  667. let searchFlag = this.isAuth(this.menuId+":search")
  668. let saveFlag = this.isAuth(this.menuId+":save")
  669. let updateFlag = this.isAuth(this.menuId+":update")
  670. let deleteFlag = this.isAuth(this.menuId+":delete")
  671. //处理页面的权限数据
  672. this.authSearch = !searchFlag
  673. this.authSave = !saveFlag
  674. this.authUpdate = !updateFlag
  675. this.authDelete = !deleteFlag
  676. },
  677. }
  678. }
  679. </script>