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

996 lines
29 KiB

2 years ago
2 years ago
2 years ago
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-select v-model="searchData.transType" placeholder="请选择" clearable style="width: 120px">-->
  19. <!-- <el-option-->
  20. <!-- v-for="i in findTrans"-->
  21. <!-- :key ="i.transType"-->
  22. <!-- :label="i.transType"-->
  23. <!-- :value="i.transType">-->
  24. <!-- </el-option>-->
  25. <!-- </el-select>-->
  26. <!-- </el-form-item>-->
  27. <el-form-item :label="' '">
  28. <el-button v-if="!authSearch" type="primary" @click="getDataList()">查询</el-button>
  29. <!-- <download-excel-->
  30. <!-- :fields="fields()"-->
  31. <!-- :data="exportData"-->
  32. <!-- type="xls"-->
  33. <!-- :name="exportName"-->
  34. <!-- :header="exportHeader"-->
  35. <!-- :footer="exportFooter"-->
  36. <!-- :fetch="createExportData"-->
  37. <!-- :before-generate="startDownload"-->
  38. <!-- :before-finish="finishDownload"-->
  39. <!-- worksheet="导出信息"-->
  40. <!-- class="el-button el-button&#45;&#45;primary el-button&#45;&#45;medium">-->
  41. <!-- {{ "导出" }}-->
  42. <!-- </download-excel>-->
  43. </el-form-item>
  44. </el-form>
  45. <!-- 展示列表 -->
  46. <el-table
  47. :height="height"
  48. :data="dataList"
  49. @row-click="changeData"
  50. border
  51. style="width: 100%;">
  52. <el-table-column
  53. v-for="(item,index) in columnList" :key="index"
  54. :sortable="item.columnSortable"
  55. :prop="item.columnProp"
  56. :header-align="item.headerAlign"
  57. :show-overflow-tooltip="item.showOverflowTooltip"
  58. :align="item.align"
  59. :fixed="item.fixed==''?false:item.fixed"
  60. :width="item.columnWidth"
  61. :label="item.columnLabel">
  62. <template slot-scope="scope">
  63. <span v-if="!item.columnHidden"> {{ scope.row[item.columnProp] }}</span>
  64. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  65. </template>
  66. </el-table-column>
  67. </el-table>
  68. <!-- <el-tabs style="font-size: 12px;min-height: 200px" class="customer-tab" v-model="searchData2" type="border-card" @tab-click="tabClick">-->
  69. <!-- <el-tab-pane label="卷明细" name="detail">-->
  70. <!-- <el-table-->
  71. <!-- :data="dataList2"-->
  72. <!-- :height="height"-->
  73. <!-- border-->
  74. <!-- style="width: 100%; ">-->
  75. <!-- <el-table-column-->
  76. <!-- v-for="(item,index) in columnList2" :key="index"-->
  77. <!-- :sortable="item.columnSortable"-->
  78. <!-- :prop="item.columnProp"-->
  79. <!-- :header-align="item.headerAlign"-->
  80. <!-- :show-overflow-tooltip="item.showOverflowTooltip"-->
  81. <!-- :align="item.align"-->
  82. <!-- :fixed="item.fixed==''?false:item.fixed"-->
  83. <!-- :min-width="item.columnWidth"-->
  84. <!-- :label="item.columnLabel">-->
  85. <!-- <template slot-scope="scope">-->
  86. <!-- <span v-if="!item.columnHidden"> {{ scope.row[item.columnProp] }}</span>-->
  87. <!-- <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]"-->
  88. <!-- style="width: 100px; height: 80px"/></span>-->
  89. <!-- </template>-->
  90. <!-- </el-table-column>-->
  91. <!-- </el-table>-->
  92. <!-- </el-tab-pane>-->
  93. <!-- </el-tabs>-->
  94. <el-pagination
  95. @size-change="sizeChangeHandle"
  96. @current-change="currentChangeHandle"
  97. :current-page="pageIndex"
  98. :page-sizes="[20, 50, 100, 200, 500]"
  99. :page-size="pageSize"
  100. :total="totalPage"
  101. layout="total, sizes, prev, pager, next, jumper">
  102. </el-pagination>
  103. </div>
  104. </template>
  105. <script>
  106. import {
  107. findTrans, // 检验方法查询
  108. // saveLocation, // 检验方法新增
  109. // updateLocation, // 检验方法修改
  110. // deleteLocation, // 检验方法删除
  111. // findByWarehouse, //查询库区
  112. // inspectionTypeSearch, // 搜索所有检验类型
  113. // // getSiteAndBuByUserName
  114. } from "@/api/material/seekByTrans.js"
  115. import {findByRoll} from "../../../api/material/seekByTrans";
  116. // import {getTableDefaultListLanguage, getTableUserListLanguage} from "@/api/table.js"
  117. // import {userFavoriteList, saveUserFavorite, removeUserFavorite} from '@/api/userFavorite.js'
  118. export default {
  119. data () {
  120. return {
  121. currentRow:'',
  122. headerData:'',
  123. wareHouseList:'',
  124. // 是否收藏
  125. favorite: false,
  126. // 导出 start
  127. exportData: [],
  128. exportName: "检验方法" + this.dayjs().format('YYYYMMDDHHmmss'),
  129. exportHeader: ["检验方法"],
  130. exportFooter: [],
  131. exportList: [],
  132. warehouseData: {
  133. id:'',
  134. site: '',
  135. },
  136. searchData2: {
  137. transNo:'',
  138. rollNo:'',
  139. sum:'',
  140. manufactureDate:'',
  141. userName:'',
  142. enterDate:''
  143. },
  144. // 导出 end
  145. searchData: {
  146. transNo:'',
  147. site: '',
  148. userName: this.$store.state.user.name,
  149. transDate: '',
  150. warehouseID: '',
  151. rollNo: '',
  152. partNo: '',
  153. partDesc: '',
  154. transQty: '',
  155. batchNo: '',
  156. locationID: '',
  157. wdrNo: '',
  158. manufactureDate: '',
  159. orderRef1: '',
  160. receiver: '',
  161. enterDate: '',
  162. transType: '',
  163. page: 1,
  164. limit: 10,
  165. },
  166. pageIndex: 1,
  167. pageSize: 20,
  168. totalPage: 0,
  169. height: 200,
  170. dataList: [],
  171. dataList2:[],
  172. dataListLoading: false,
  173. modalFlag: false,
  174. modalDisableFlag: false,
  175. modalData: {
  176. site: '',
  177. warehouseId: '',
  178. locationId: '',
  179. active: 'Y',
  180. locationName: '',
  181. creator: this.$store.state.user.name,
  182. // updateBy: this.$store.state.user.name,
  183. locationDescription: '',
  184. keeper: '',
  185. remarks: '',
  186. createTime: '',
  187. },
  188. // 标头展示
  189. columnList: [
  190. {
  191. userId: this.$store.state.user.name,
  192. functionId: 200003,
  193. serialNumber: '200003TableSite',
  194. tableId: "200003Table",
  195. tableName: "工厂编码",
  196. columnWidth: 100,
  197. columnProp: 'site',
  198. headerAlign: 'center',
  199. align: "center",
  200. columnLabel: '工厂编码',
  201. columnHidden: false,
  202. columnImage: false,
  203. columnSortable: false,
  204. sortLv: 0,
  205. status: true,
  206. fixed: '',
  207. },
  208. {
  209. userId: this.$store.state.user.name,
  210. functionId: 200003,
  211. serialNumber: '200003TableTransNo',
  212. tableId: "200003Table",
  213. tableName: "出入库单号",
  214. columnWidth: 100,
  215. columnProp: 'transNo',
  216. headerAlign: 'center',
  217. align: "center",
  218. columnLabel: '出入库单号',
  219. columnHidden: false,
  220. columnImage: false,
  221. columnSortable: false,
  222. sortLv: 0,
  223. status: true,
  224. fixed: '',
  225. },
  226. {
  227. userId: this.$store.state.user.name,
  228. functionId: 200003,
  229. serialNumber: '200003TableTransDate',
  230. tableId: "200003Table",
  231. tableName: "出入库日期",
  232. columnWidth: 100,
  233. columnProp: 'transDate',
  234. headerAlign: 'center',
  235. align: "left",
  236. columnLabel: '出入库日期',
  237. columnHidden: false,
  238. columnImage: false,
  239. columnSortable: false,
  240. sortLv: 0,
  241. status: true,
  242. fixed: '',
  243. },
  244. {
  245. userId: this.$store.state.user.name,
  246. functionId: 200003,
  247. serialNumber: '200003TableWarehouseId',
  248. tableId: "200003Table",
  249. tableName: "仓位编码",
  250. columnWidth: 100,
  251. columnProp: 'warehouseID',
  252. headerAlign: 'center',
  253. align: "center",
  254. columnLabel: '仓位编码',
  255. columnHidden: false,
  256. columnImage: false,
  257. columnSortable: false,
  258. sortLv: 0,
  259. status: true,
  260. fixed: '',
  261. },
  262. {
  263. userId: this.$store.state.user.name,
  264. functionId: 200003,
  265. serialNumber: '200003TableRollNo',
  266. tableId: "200003Table",
  267. tableName: "卷号",
  268. columnWidth: 100,
  269. columnProp: 'rollNo',
  270. headerAlign: 'center',
  271. align: "center",
  272. columnLabel: '卷号',
  273. columnHidden: false,
  274. columnImage: false,
  275. columnSortable: false,
  276. sortLv: 0,
  277. status: true,
  278. fixed: '',
  279. },
  280. {
  281. userId: this.$store.state.user.name,
  282. functionId: 200003,
  283. serialNumber: '200003TablePartNo',
  284. tableId: "200003Table",
  285. tableName: "物料编码",
  286. columnWidth: 100,
  287. columnProp: 'partNo',
  288. headerAlign: 'center',
  289. align: "left",
  290. columnLabel: '物料编码',
  291. columnHidden: false,
  292. columnImage: false,
  293. columnSortable: false,
  294. sortLv: 0,
  295. status: true,
  296. fixed: '',
  297. },
  298. {
  299. userId: this.$store.state.user.name,
  300. functionId: 200003,
  301. serialNumber: '200003TablePartDesc',
  302. tableId: "200003Table",
  303. tableName: "料号描述",
  304. columnWidth: 100,
  305. columnProp: 'partDesc',
  306. headerAlign: 'center',
  307. align: "center",
  308. columnLabel: '料号描述',
  309. columnHidden: false,
  310. columnImage: false,
  311. columnSortable: false,
  312. sortLv: 0,
  313. status: true,
  314. fixed: '',
  315. },
  316. {
  317. userId: this.$store.state.user.name,
  318. functionId: 200003,
  319. serialNumber: '200003TableTransQty',
  320. tableId: "200003Table",
  321. tableName: "出入库数量",
  322. columnWidth: 100,
  323. columnProp: 'transQty',
  324. headerAlign: 'center',
  325. align: "center",
  326. columnLabel: '出入库数量',
  327. columnHidden: false,
  328. columnImage: false,
  329. columnSortable: false,
  330. sortLv: 0,
  331. status: true,
  332. fixed: '',
  333. },
  334. {
  335. userId: this.$store.state.user.name,
  336. functionId: 200003,
  337. serialNumber: '200003TableBatchNo',
  338. tableId: "200003Table",
  339. tableName: "批号",
  340. columnWidth: 100,
  341. columnProp: 'batchNo',
  342. headerAlign: 'center',
  343. align: "center",
  344. columnLabel: '批号',
  345. columnHidden: false,
  346. columnImage: false,
  347. columnSortable: false,
  348. sortLv: 0,
  349. status: true,
  350. fixed: '',
  351. },
  352. {
  353. userId: this.$store.state.user.name,
  354. functionId: 200003,
  355. serialNumber: '200003TableLocationID',
  356. tableId: "200003Table",
  357. tableName: "库位",
  358. columnWidth: 100,
  359. columnProp: 'locationID',
  360. headerAlign: 'center',
  361. align: "center",
  362. columnLabel: '库位',
  363. columnHidden: false,
  364. columnImage: false,
  365. columnSortable: false,
  366. sortLv: 0,
  367. status: true,
  368. fixed: '',
  369. },
  370. {
  371. userId: this.$store.state.user.name,
  372. functionId: 200003,
  373. serialNumber: '200003TableWdrNo',
  374. tableId: "200003Table",
  375. tableName: "W/D/R",
  376. columnWidth: 100,
  377. columnProp: 'wdrNo',
  378. headerAlign: 'center',
  379. align: "center",
  380. columnLabel: 'W/D/R',
  381. columnHidden: false,
  382. columnImage: false,
  383. columnSortable: false,
  384. sortLv: 0,
  385. status: true,
  386. fixed: '',
  387. },
  388. {
  389. userId: this.$store.state.user.name,
  390. functionId: 200003,
  391. serialNumber: '200003TableManufactureDate',
  392. tableId: "200003Table",
  393. tableName: "生产日期",
  394. columnWidth: 100,
  395. columnProp: 'manufactureDate',
  396. headerAlign: 'center',
  397. align: "center",
  398. columnLabel: '生产日期',
  399. columnHidden: false,
  400. columnImage: false,
  401. columnSortable: false,
  402. sortLv: 0,
  403. status: true,
  404. fixed: '',
  405. },
  406. {
  407. userId: this.$store.state.user.name,
  408. functionId: 200003,
  409. serialNumber: '200003TableOrderRef1',
  410. tableId: "200003Table",
  411. tableName: "关联单号",
  412. columnWidth: 100,
  413. columnProp: 'orderRef1',
  414. headerAlign: 'center',
  415. align: "center",
  416. columnLabel: '关联单号',
  417. columnHidden: false,
  418. columnImage: false,
  419. columnSortable: false,
  420. sortLv: 0,
  421. status: true,
  422. fixed: '',
  423. },
  424. {
  425. userId: this.$store.state.user.name,
  426. functionId: 200003,
  427. serialNumber: '200003TableReceiver',
  428. tableId: "200003Table",
  429. tableName: "经手人",
  430. columnWidth: 100,
  431. columnProp: 'receiver',
  432. headerAlign: 'center',
  433. align: "center",
  434. columnLabel: '经手人',
  435. columnHidden: false,
  436. columnImage: false,
  437. columnSortable: false,
  438. sortLv: 0,
  439. status: true,
  440. fixed: '',
  441. },
  442. {
  443. userId: this.$store.state.user.name,
  444. functionId: 200003,
  445. serialNumber: '200003TableEnterDate',
  446. tableId: "200003Table",
  447. tableName: "录入时间",
  448. columnWidth: 100,
  449. columnProp: 'enterDate',
  450. headerAlign: 'center',
  451. align: "center",
  452. columnLabel: '录入时间',
  453. columnHidden: false,
  454. columnImage: false,
  455. columnSortable: false,
  456. sortLv: 0,
  457. status: true,
  458. fixed: '',
  459. },
  460. {
  461. userId: this.$store.state.user.name,
  462. functionId: 200003,
  463. serialNumber: '200003TableUserName',
  464. tableId: "200003Table",
  465. tableName: "录入人",
  466. columnWidth: 100,
  467. columnProp: 'userName',
  468. headerAlign: 'center',
  469. align: "center",
  470. columnLabel: '录入人',
  471. columnHidden: false,
  472. columnImage: false,
  473. columnSortable: false,
  474. sortLv: 0,
  475. status: true,
  476. fixed: '',
  477. },
  478. {
  479. userId: this.$store.state.user.name,
  480. functionId: 200003,
  481. serialNumber: '200003TableTransType',
  482. tableId: "200003Table",
  483. tableName: "出入库类型",
  484. columnWidth: 100,
  485. columnProp: 'transType',
  486. headerAlign: 'center',
  487. align: "center",
  488. columnLabel: '出入库类型',
  489. columnHidden: false,
  490. columnImage: false,
  491. columnSortable: false,
  492. sortLv: 0,
  493. status: true,
  494. fixed: '',
  495. },
  496. ],
  497. columnList2:[
  498. {
  499. userId: this.$store.state.user.name,
  500. functionId: 200003,
  501. serialNumber: '200003TableTransNo',
  502. tableId: "200003Table",
  503. tableName: "出入库单号",
  504. columnWidth: 200,
  505. columnProp: 'transNo',
  506. headerAlign: 'center',
  507. align: "center",
  508. columnLabel: '出入库单号',
  509. columnHidden: false,
  510. columnImage: false,
  511. columnSortable: false,
  512. sortLv: 0,
  513. status: true,
  514. fixed: '',
  515. },
  516. {
  517. userId: this.$store.state.user.name,
  518. functionId: 200003,
  519. serialNumber: '200003TableRollNo',
  520. tableId: "200003Table",
  521. tableName: "卷号",
  522. columnWidth: 200,
  523. columnProp: 'rollNo',
  524. headerAlign: 'center',
  525. align: "center",
  526. columnLabel: '卷号',
  527. columnHidden: false,
  528. columnImage: false,
  529. columnSortable: false,
  530. sortLv: 0,
  531. status: true,
  532. fixed: '',
  533. },
  534. {
  535. userId: this.$store.state.user.name,
  536. functionId: 200003,
  537. serialNumber: '200003TableNum',
  538. tableId: "200003Table",
  539. tableName: "数量",
  540. columnWidth: 200,
  541. columnProp: 'num',
  542. headerAlign: 'center',
  543. align: "center",
  544. columnLabel: '数量',
  545. columnHidden: false,
  546. columnImage: false,
  547. columnSortable: false,
  548. sortLv: 0,
  549. status: true,
  550. fixed: '',
  551. },
  552. {
  553. userId: this.$store.state.user.name,
  554. functionId: 200003,
  555. serialNumber: '200003TableManufactureDate',
  556. tableId: "200003Table",
  557. tableName: "生产日期",
  558. columnWidth: 200,
  559. columnProp: 'manufactureDate',
  560. headerAlign: 'center',
  561. align: "center",
  562. columnLabel: '生产日期',
  563. columnHidden: false,
  564. columnImage: false,
  565. columnSortable: false,
  566. sortLv: 0,
  567. status: true,
  568. fixed: '',
  569. },
  570. {
  571. userId: this.$store.state.user.name,
  572. functionId: 200003,
  573. serialNumber: '200003TableEnterDate',
  574. tableId: "200003Table",
  575. tableName: "录入时间",
  576. columnWidth: 200,
  577. columnProp: 'enterDate',
  578. headerAlign: 'center',
  579. align: "center",
  580. columnLabel: '录入时间',
  581. columnHidden: false,
  582. columnImage: false,
  583. columnSortable: false,
  584. sortLv: 0,
  585. status: true,
  586. fixed: '',
  587. },
  588. ],
  589. rules: {
  590. warehouseId:[
  591. {
  592. required: true,
  593. message: ' ',
  594. trigger: ['blur','change']
  595. }
  596. ],
  597. locationId:[
  598. {
  599. required: true,
  600. message: ' ',
  601. trigger: ['blur','change']
  602. }
  603. ],
  604. site:[
  605. {
  606. required: true,
  607. message: ' ',
  608. trigger: ['blur','change']
  609. }
  610. ],
  611. locationName:[
  612. {
  613. required: true,
  614. message: ' ',
  615. trigger: ['blur','change']
  616. }
  617. ]
  618. },
  619. options: [],
  620. userBuList: [],
  621. authSearch: false,
  622. authSave: false,
  623. authUpdate: false,
  624. authDelete: false,
  625. menuId: this.$route.meta.menuId,
  626. }
  627. },
  628. mounted () {
  629. this.$nextTick(() => {
  630. this.height = window.innerHeight - 180
  631. })
  632. },
  633. //页面加载前初始化着两个方法
  634. created () {
  635. this.getDataList()
  636. //this.getWareHouseList()
  637. },
  638. methods: {
  639. // 获取用户的bu
  640. getSiteAndBuByUserName () {
  641. let tempData = {
  642. username: this.$store.state.user.name,
  643. }
  644. getSiteAndBuByUserName(tempData).then(({data}) => {
  645. if (data.code === 0) {
  646. this.userBuList = data.rows
  647. }
  648. })
  649. },
  650. tabClick (tab, event) {
  651. // 刷新列表数据
  652. this.refreshCurrentTabTable()
  653. },
  654. changeData(row){
  655. this.currentRow = JSON.parse(JSON.stringify(row));
  656. this.headerData=row;
  657. this.refreshCurrentTabTable ();
  658. },
  659. refreshCurrentTabTable(){
  660. if(this.currentRow===''||this.currentRow===null){
  661. this.currentRow={site:'',transNo:''}
  662. }
  663. if(this.activeName==='detail'){
  664. findByRoll(this.currentRow).then(({data}) => {
  665. //区分请求成功和失败的状况
  666. if (data && data.code == 0) {
  667. this.dataList2 = data.rows
  668. } else {
  669. this.dataList2 = [];
  670. }
  671. });
  672. }
  673. },
  674. //根据warehouse查询warehouseId
  675. getWareHouseList (){
  676. findByWarehouse(``).then(({data}) =>{
  677. this.wareHouseList=data.rows
  678. }
  679. )
  680. },
  681. // 查询获取数据列表
  682. getDataList (){
  683. this.searchData.limit = this.pageSize
  684. this.searchData.page = this.pageIndex
  685. findTrans(this.searchData).then(({data}) => {
  686. if (data.code === 0) {
  687. this.dataList = data.page.list
  688. this.pageIndex = data.page.currPage
  689. this.pageSize = data.page.pageSize
  690. this.totalPage = data.page.totalCount
  691. }
  692. })
  693. },
  694. // 每页数
  695. sizeChangeHandle (val) {
  696. this.pageSize = val
  697. this.pageIndex = 1
  698. this.getDataList()
  699. },
  700. // 当前页
  701. currentChangeHandle (val) {
  702. this.pageIndex = val
  703. this.getDataList()
  704. },
  705. // // 新增按钮
  706. // addModal () {
  707. // this.modalData = {
  708. // flag: '1',
  709. // site: '',
  710. // creator: this.$store.state.user.name,
  711. // locationId: '',
  712. // locationName: '',
  713. // active: 'Y',
  714. // warehouseId: '',
  715. // locationDescription: '',
  716. // keeper: '',
  717. // remarks: '',
  718. // }
  719. // this.modalDisableFlag = false
  720. // this.modalFlag = true
  721. // },
  722. // // 修改按钮
  723. // updateModal (row) {
  724. // this.modalData = {
  725. // flag: '2',
  726. // id:row.id,
  727. // site: row.site,
  728. // creator: this.$store.state.user.name,
  729. // warehouseId: row.warehouseId,
  730. // locationId: row.locationId,
  731. // active: row.active,
  732. // locationName: row.locationName,
  733. // locationDescription: row.locationDescription,
  734. // keeper: row.keeper,
  735. // remarks: row.remarks,
  736. // }
  737. // this.modalDisableFlag = true
  738. // this.modalFlag = true
  739. // },
  740. // 删除方法
  741. // deleteModal (row) {
  742. // this.$confirm(`是否删除这个检验方法?`, '提示', {
  743. // confirmButtonText: '确定',
  744. // cancelButtonText: '取消',
  745. // type: 'warning'
  746. // }).then(() => {
  747. // deleteLocation(row).then(({data}) => {
  748. // if (data && data.code === 0) {
  749. // this.getDataList()
  750. // this.$message({
  751. // message: '操作成功',
  752. // type: 'success',
  753. // duration: 1500,
  754. // onClose: () => {}
  755. // })
  756. // } else {
  757. // this.$alert(data.msg, '错误', {
  758. // confirmButtonText: '确定'
  759. // })
  760. // }
  761. // })
  762. // }).catch(() => {
  763. // })
  764. // },
  765. // 新增/修改方法
  766. // saveData () {
  767. // if (this.modalData.site === '' || this.modalData.site == null) {
  768. // this.$message.warning('请输入工厂编码!')
  769. // return
  770. // }
  771. // if (this.modalData.warehouseId === '' || this.modalData.warehouseId == null) {
  772. // this.$message.warning('请选择仓库编码!')
  773. // return
  774. // }
  775. // if(this.modalData.locationName === ''|| this.modalData.locationName == null){
  776. // this.$message.warning('请输入库位名称!')
  777. // return
  778. // }
  779. // if(this.modalData.locationId === ''|| this.modalData.locationId == null){
  780. // this.$message.warning('请输入库位编码!')
  781. // return
  782. // }
  783. // if (this.modalData.flag === '1') { // 新增
  784. // saveLocation(this.modalData).then(({data}) => {
  785. // if (data && data.code === 0) {
  786. // this.getDataList()
  787. // this.modalFlag = false
  788. // this.$message({
  789. // message: '操作成功',
  790. // type: 'success',
  791. // duration: 1500,
  792. // onClose: () => {}
  793. // })
  794. // } else {
  795. // this.$alert(data.msg, '错误', {
  796. // confirmButtonText: '确定'
  797. // })
  798. // }
  799. // })
  800. // } else { // 修改
  801. // updateLocation(this.modalData).then(({data}) => {
  802. // if (data && data.code === 0) {
  803. // this.getDataList()
  804. // this.modalFlag = false
  805. // this.$message({
  806. // message: '操作成功',
  807. // type: 'success',
  808. // duration: 1500,
  809. // onClose: () => {}
  810. // })
  811. // } else {
  812. // this.$alert(data.msg, '错误', {
  813. // confirmButtonText: '确定'
  814. // })
  815. // }
  816. // })
  817. // }
  818. // },
  819. // 查询检验类型
  820. inspectionTypeSearch () {
  821. let tempData = {
  822. site: this.$store.state.user.site
  823. }
  824. inspectionTypeSearch(tempData).then(({data}) => {
  825. if (data.code === 0) {
  826. this.options = data.rows
  827. }
  828. })
  829. },
  830. // 校验用户是否收藏
  831. favoriteIsOk () {
  832. let userFavorite = {
  833. userId: this.$store.state.user.id,
  834. languageCode: this.$i18n.locale
  835. }
  836. userFavoriteList(userFavorite).then(({data}) => {for (let i = 0; i < data.list.length; i++) {
  837. if(this.$route.meta.menuId === data.list[i].menuId){
  838. this.favorite = true
  839. }
  840. }
  841. })
  842. },
  843. // 收藏 OR 取消收藏
  844. favoriteFunction () {
  845. let userFavorite = {
  846. userId: this.$store.state.user.id,
  847. functionId: this.$route.meta.menuId,
  848. }
  849. if (this.favorite) {
  850. removeUserFavorite(userFavorite).then(({data}) => {
  851. this.$message.success(data.msg)
  852. this.favorite = false
  853. })
  854. } else {
  855. // 收藏
  856. saveUserFavorite(userFavorite).then(({data}) => {
  857. this.$message.success(data.msg)
  858. this.favorite = true
  859. })
  860. }
  861. },
  862. //导出excel
  863. async createExportData() {
  864. this.searchData.limit = -1
  865. this.searchData.page = 1
  866. await findTrans(this.searchData).then(({data}) => {
  867. this.exportList= data.rows
  868. })
  869. return this.exportList
  870. },
  871. startDownload() {},
  872. finishDownload() {},
  873. fields () {
  874. let json = "{"
  875. this.columnList.forEach((item, index) => {
  876. if (index == this.columnList.length - 1) {
  877. json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\""
  878. } else {
  879. json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\"" + ","
  880. }
  881. })
  882. json += "}"
  883. let s = eval("(" + json + ")")
  884. return s
  885. },
  886. // 动态列开始 获取 用户保存的 格式列
  887. async getTableUserColumn (tableId, columnId) {
  888. let queryTableUser = {
  889. userId: this.$store.state.user.name,
  890. functionId: this.$route.meta.menuId,
  891. tableId: tableId,
  892. status: true,
  893. languageCode: this.$i18n.locale
  894. }
  895. await getTableUserListLanguage(queryTableUser).then(({data}) => {
  896. if (data.rows.length > 0) {
  897. //this.columnList1 = []
  898. switch (columnId) {
  899. case 1:
  900. this.columnList = data.rows
  901. break;
  902. // case 2:
  903. // this.columnDetailList = data.rows
  904. // break;
  905. // case 3:
  906. // this.columnList2 = data.rows
  907. // break;
  908. // case 4:
  909. // this.columnList3 = data.rows
  910. // break;
  911. }
  912. } else {
  913. this.getColumnList(tableId, columnId)
  914. }
  915. })
  916. },
  917. // 获取 tableDefault 列
  918. async getColumnList (tableId, columnId) {
  919. let queryTable = {
  920. functionId: this.$route.meta.menuId,
  921. tableId: tableId,
  922. languageCode: this.$i18n.locale
  923. }
  924. await getTableDefaultListLanguage(queryTable).then(({data}) => {
  925. if (!data.rows.length == 0) {
  926. switch (columnId) {
  927. case 1:
  928. this.columnList = data.rows
  929. break;
  930. // case 2:
  931. // this.columnDetailList = data.rows
  932. // break;
  933. // case 3:
  934. // this.columnList2 = data.rows
  935. // break;
  936. // case 4:
  937. // this.columnList3 = data.rows
  938. // break;
  939. }
  940. } else {
  941. // this.showDefault = true.
  942. }
  943. })
  944. },
  945. //获取按钮的权限数据
  946. getButtonAuthData () {
  947. let searchFlag = this.isAuth(this.menuId+":search")
  948. let saveFlag = this.isAuth(this.menuId+":save")
  949. let updateFlag = this.isAuth(this.menuId+":update")
  950. let deleteFlag = this.isAuth(this.menuId+":delete")
  951. //处理页面的权限数据
  952. this.authSearch = !searchFlag
  953. this.authSave = !saveFlag
  954. this.authUpdate = !updateFlag
  955. this.authDelete = !deleteFlag
  956. },
  957. }
  958. }
  959. </script>