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.

687 lines
21 KiB

  1. <template>
  2. <div class="mod-config">
  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: 120px"></el-input>
  6. </el-form-item>
  7. <!-- <el-form-item >-->
  8. <!-- <span slot="label" style="" @click="getBaseList(5)"><a herf="#">{{buttons.partNo}}</a></span>-->
  9. <!-- <el-input v-model="searchData.partNo" style="width: 120px" oninput="this.value = this.value.toUpperCase()"></el-input>-->
  10. <!-- </el-form-item>-->
  11. <el-form-item label="物料编码">
  12. <el-input v-model="searchData.partNo" style="width: 120px"></el-input>
  13. </el-form-item>
  14. <el-form-item label="物料名称">
  15. <el-input v-model="searchData.partDesc" style="width: 120px"></el-input>
  16. </el-form-item>
  17. <el-form-item label="新增日期">
  18. <el-date-picker
  19. style="width: 130px"
  20. v-model="searchData.date1"
  21. value-format="yyyy-MM-dd HH:mm:ss"
  22. placeholder="选择日期">
  23. </el-date-picker>
  24. </el-form-item>
  25. <el-form-item label="至">
  26. <el-date-picker
  27. style="width: 130px"
  28. v-model="searchData.date2"
  29. value-format="yyyy-MM-dd HH:mm:ss"
  30. placeholder="选择日期">
  31. </el-date-picker>
  32. </el-form-item>
  33. </el-form>
  34. <el-form :inline="true" label-position="top" label-width="100px" style="margin-top: 5px;margin-left: -2px">
  35. <el-form-item>
  36. <el-button @click="getData()" type="primary" style="margin-left: 2px;">查询</el-button>
  37. <!-- <el-button @click="userSetting" type="primary">设置列表</el-button>-->
  38. <el-button v-if="isAuth('sys:setting')" @click="saveColumnList()" type="primary">设置默认配置</el-button>
  39. <download-excel
  40. :fields="fields()"
  41. :data="exportData"
  42. type="xls"
  43. :name="exportName"
  44. :header="exportHeader"
  45. :footer="exportFooter"
  46. :fetch="createExportData"
  47. :before-generate="startDownload"
  48. :before-finish="finishDownload"
  49. worksheet="导出信息"
  50. class="el-button el-button--primary el-button--medium">
  51. 导出
  52. </download-excel>
  53. </el-form-item>
  54. </el-form>
  55. <el-table
  56. :height="700"
  57. :data="dataList"
  58. border
  59. v-loading="dataListLoading"
  60. style="width: 100%;">
  61. <el-table-column
  62. v-for="(item,index) in columnList" :key="index"
  63. :sortable="item.columnSortable"
  64. :prop="item.columnProp"
  65. :header-align="item.headerAlign"
  66. :show-overflow-tooltip="item.showOverflowTooltip"
  67. :align="item.align"
  68. :fixed="item.fixed==''?false:item.fixed"
  69. :min-width="item.columnWidth"
  70. :label="item.columnLabel">
  71. <template slot-scope="scope">
  72. <span v-if="!item.columnHidden"> {{scope.row[item.columnProp]}}</span>
  73. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]"
  74. style="width: 100px; height: 80px"/></span>
  75. </template>
  76. </el-table-column>
  77. </el-table>
  78. <el-pagination
  79. @size-change="sizeChangeHandle"
  80. @current-change="currentChangeHandle"
  81. :current-page="this.searchData.page"
  82. :page-sizes="[100, 200, 500]"
  83. :page-size="this.searchData.size"
  84. :total="this.searchData.total"
  85. layout="total, sizes, prev, pager, next, jumper">
  86. </el-pagination>
  87. <!-- 动态列 -->
  88. <column v-if="visible" ref="column" @refreshData="getTableUserColumn"></column>
  89. <Chooselist ref="baseList" @getBaseData="getBaseData"></Chooselist>
  90. </div>
  91. </template>
  92. <script>
  93. import {getCRollInfoList} from '@/api/crollinfo/crollinfo.js'
  94. import column from "../common/column";
  95. import Chooselist from '@/views/modules/common/Chooselist';
  96. import {
  97. searchSysLanguagePackList,
  98. searchSysLanguageParam,
  99. searchFunctionButtonList,
  100. saveButtonList,
  101. searchSysLanguage,
  102. searchLanguageListByLanguageCode,
  103. saveSysLanguageOne,
  104. searchPageLanguageData,
  105. removerLanguage
  106. } from "@/api/sysLanguage.js"
  107. import {
  108. saveTableDefaultList,
  109. saveTableUser,
  110. getTableDefaultListLanguage,
  111. getTableUserListLanguage,
  112. removerDefault,
  113. removerUser
  114. } from "@/api/table.js"
  115. import {
  116. searchPartNoDataWithPage,
  117. } from "@/api/base/site.js"
  118. import {
  119. getPurchasePartList
  120. } from "@/api/warehouse/inventoryPart.js"
  121. export default {
  122. name: "searchPartNo",
  123. components: {column,Chooselist},
  124. watch: {
  125. searchData: {
  126. deep: true,
  127. handler: function (newV, oldV) {
  128. this.searchData.partNo = this.searchData.partNo.toUpperCase()
  129. }
  130. }
  131. },
  132. data() {
  133. return {
  134. tagNo:'',
  135. // 多语言 start
  136. buttonList: [
  137. {
  138. functionId: this.$route.meta.menuId,
  139. languageValue: '设置默认配置',
  140. objectId: 'defaultTable',
  141. objectType: "button",
  142. tableId: "100005Table"
  143. },
  144. {
  145. functionId: this.$route.meta.menuId,
  146. languageValue: '查询',
  147. objectId: 'search',
  148. objectType: "button",
  149. tableId: "100005Table"
  150. },
  151. {
  152. functionId: this.$route.meta.menuId,
  153. languageValue: '导出',
  154. objectId: 'download',
  155. objectType: "button",
  156. tableId: "100005Table"
  157. },
  158. {
  159. functionId: this.$route.meta.menuId,
  160. languageValue: '设置列表',
  161. objectId: 'settingTable',
  162. objectType: "button",
  163. tableId: "100005Table"
  164. },
  165. {
  166. functionId: this.$route.meta.menuId,
  167. languageValue: '工厂编码',
  168. objectId: 'site',
  169. objectType: "button",
  170. tableId: "100005Table"
  171. },
  172. {
  173. functionId: this.$route.meta.menuId,
  174. languageValue: '全部',
  175. objectId: 'all',
  176. objectType: "button",
  177. tableId: "100005Table"
  178. },
  179. {
  180. functionId: this.$route.meta.menuId,
  181. languageValue: '是',
  182. objectId: 'yes',
  183. objectType: "button",
  184. tableId: "100005Table"
  185. },
  186. {
  187. functionId: this.$route.meta.menuId,
  188. languageValue: '否',
  189. objectId: 'no',
  190. objectType: "button",
  191. tableId: "100005Table"
  192. },
  193. {
  194. functionId: this.$route.meta.menuId,
  195. languageValue: '在用',
  196. objectId: 'active',
  197. objectType: "button",
  198. tableId: "100005Table"
  199. },
  200. {
  201. functionId: this.$route.meta.menuId,
  202. languageValue: '物料编码',
  203. objectId: 'partNo',
  204. objectType: "button",
  205. tableId: "100005Table"
  206. },
  207. {
  208. functionId: this.$route.meta.menuId,
  209. languageValue: '物料名称',
  210. objectId: 'partDescription',
  211. objectType: "button",
  212. tableId: "100005Table"
  213. },
  214. {
  215. functionId: this.$route.meta.menuId,
  216. languageValue: '规格型号',
  217. objectId: 'spec',
  218. objectType: "button",
  219. tableId: "100005Table"
  220. },
  221. {
  222. functionId: this.$route.meta.menuId,
  223. languageValue: '新增日期',
  224. objectId: 'newDate',
  225. objectType: "button",
  226. tableId: "100005Table"
  227. },
  228. {
  229. functionId: this.$route.meta.menuId,
  230. languageValue: '至',
  231. objectId: 'to',
  232. objectType: "button",
  233. tableId: "100005Table"
  234. }
  235. ],
  236. showDefault:false,
  237. // 语言词典集合
  238. sysLanguageParams: [],
  239. dataListLoading: false,
  240. // 用户table 配置集合
  241. userColumnList: [],
  242. queryTableUser: {
  243. userId: this.$store.state.user.name,
  244. functionId: this.$route.meta.menuId,
  245. tableId: "100005Table",
  246. status: true,
  247. languageCode: this.$i18n.locale
  248. },
  249. buttons:{
  250. defaultTable:'设置默认配置',
  251. search:'查询',
  252. download:'导出',
  253. settingTable: '设置列表',
  254. site:'工厂编码',
  255. active:'在用',
  256. all:'全部',
  257. yes:'是',
  258. no:'否',
  259. partNo:'物料编码',
  260. partDescription:'物料名称',
  261. spec:'规格型号',
  262. newDate:'新增日期',
  263. to:'至',
  264. },
  265. // 默认table 查询参数
  266. queryTable: {
  267. functionId: this.$route.meta.menuId,
  268. tableId: "100005Table",
  269. languageCode: this.$i18n.locale
  270. },
  271. languageList: [],
  272. queryLanguage: {},
  273. visible:false,
  274. // 多语言 end
  275. // 导出 start
  276. exportData: [],
  277. exportName: "物料编码"+this.dayjs().format('YYYYMMDDHHmmss'),
  278. exportHeader: ["物料编码"],
  279. exportFooter: [],
  280. // 导出 end
  281. height: 200,
  282. modelFlag:false,
  283. modelInputFlag:true,
  284. selectList:[],
  285. searchData: {
  286. site:'',
  287. page:1,
  288. size:100,
  289. total:0,
  290. partNo:'',
  291. partDesc:'',
  292. date1:'',
  293. date2:'',
  294. user:this.$store.state.user.name,
  295. },
  296. dataList:[],
  297. columnList: [
  298. {
  299. userId: this.$store.state.user.name,
  300. functionId: this.$route.meta.menuId,
  301. serialNumber: '100005TablePartNo',
  302. tableId: "100005Table",
  303. tableName: "查询物料编码表",
  304. columnProp: "partNo",
  305. headerAlign: "center",
  306. align: "left",
  307. columnLabel: "采购件编码",
  308. columnHidden: false,
  309. columnImage: false,
  310. columnSortable: false,
  311. sortLv: 0,
  312. status: true,
  313. fixed: '',
  314. columnWidth: 120
  315. },
  316. {
  317. userId: this.$store.state.user.name,
  318. functionId: this.$route.meta.menuId,
  319. serialNumber: '100005TablePartDescription',
  320. tableId: "100005Table",
  321. tableName: "查询物料编码表",
  322. columnProp: "partDesc",
  323. headerAlign: "center",
  324. align: "left",
  325. columnLabel: "采购件描述",
  326. columnHidden: false,
  327. columnImage: false,
  328. columnSortable: false,
  329. sortLv: 0,
  330. status: true,
  331. fixed: '',
  332. columnWidth: 200
  333. },
  334. {
  335. userId: this.$store.state.user.name,
  336. functionId: this.$route.meta.menuId,
  337. serialNumber: '100005TableUmid',
  338. tableId: "100005Table",
  339. tableName: "查询物料编码表",
  340. columnProp: "umId",
  341. headerAlign: "center",
  342. align: "left",
  343. columnLabel: "计量单位",
  344. columnHidden: false,
  345. columnImage: false,
  346. columnSortable: false,
  347. sortLv: 0,
  348. status: true,
  349. fixed: '',
  350. columnWidth: 60
  351. },
  352. {
  353. userId: this.$store.state.user.name,
  354. functionId: this.$route.meta.menuId,
  355. serialNumber: '100005TableCreateDate',
  356. tableId: "100005Table",
  357. tableName: "查询物料编码表",
  358. columnProp: "createDate",
  359. headerAlign: "center",
  360. align: "left",
  361. columnLabel: "新增日期",
  362. columnHidden: false,
  363. columnImage: false,
  364. columnSortable: false,
  365. sortLv: 0,
  366. status: true,
  367. fixed: '',
  368. columnWidth: 120
  369. },
  370. {
  371. userId: this.$store.state.user.name,
  372. functionId: this.$route.meta.menuId,
  373. serialNumber: '100005TableinventoryPart',
  374. tableId: "100005Table",
  375. tableName: "查询物料编码表",
  376. columnProp: "inventoryPart",
  377. headerAlign: "center",
  378. align: "left",
  379. columnLabel: "库存件",
  380. columnHidden: false,
  381. columnImage: false,
  382. columnSortable: false,
  383. sortLv: 0,
  384. status: true,
  385. fixed: '',
  386. columnWidth: 60
  387. },
  388. {
  389. userId: this.$store.state.user.name,
  390. functionId: this.$route.meta.menuId,
  391. serialNumber: '100005TableSite',
  392. tableId: "100005Table",
  393. tableName: "查询物料编码表",
  394. columnProp: "site",
  395. headerAlign: "center",
  396. align: "left",
  397. columnLabel: "工厂编号",
  398. columnHidden: false,
  399. columnImage: false,
  400. columnSortable: false,
  401. sortLv: 0,
  402. status: true,
  403. fixed: '',
  404. columnWidth: 60
  405. }
  406. ],
  407. //懒加载start
  408. loading: false,
  409. pagination: {
  410. page: 1,
  411. pageSize: 200,
  412. total: 0,
  413. },
  414. totalPage: 5,
  415. countTotal: 200,
  416. //懒加载end
  417. }
  418. },
  419. mounted() {
  420. this.$nextTick(() => {
  421. this.height = window.innerHeight - 180;
  422. this.lazyLoading();
  423. })
  424. },
  425. methods: {
  426. //多语言start
  427. // 获取页面多语言
  428. getMsgLanguage() {
  429. this.dataListLoading = true
  430. let queryLang = {
  431. functionId: this.$route.meta.menuId,
  432. table_id: '100005Table',
  433. languageCode: this.$i18n.locale
  434. }
  435. searchPageLanguageData(queryLang).then((data) => {
  436. if (data.code == 0) {
  437. this.pageLanguageData = data.data
  438. } else {
  439. }
  440. })
  441. this.dataListLoading = false
  442. },
  443. // 获取button的词典
  444. getFunctionButtonList() {
  445. searchFunctionButtonList(this.queryTable).then(({data}) => {
  446. if (data.code == 0) {
  447. this.buttons = data.data
  448. } else {
  449. // saveButtonList(this.buttonList).then(({data}) => {
  450. // })
  451. }
  452. })
  453. },
  454. getBaseData(val){
  455. if (this.tagNo === 5){
  456. this.searchData.partNo = val.PartNo
  457. }
  458. },
  459. // 获取基础数据列表
  460. getBaseList(val){
  461. this.tagNo = val
  462. this.$nextTick(() => {
  463. let strVal = "";
  464. if (val === 5){
  465. strVal = this.searchData.partNo
  466. }
  467. this.$refs.baseList.init(val, strVal);
  468. })
  469. },
  470. // 获取语言词典
  471. getSysLanguageParamList() {
  472. searchSysLanguageParam(this.queryTable).then(({data}) => {
  473. this.sysLanguageParams = data.rows
  474. })
  475. },
  476. // 打开页面设置
  477. userSetting() {
  478. this.visible = true;
  479. let queryTable = {
  480. userId: this.$store.state.user.name,
  481. functionId: this.$route.meta.menuId,
  482. tableId: "100005Table",
  483. languageCode: this.$i18n.locale
  484. }
  485. this.$nextTick(() => {
  486. this.$refs.column.init(queryTable);
  487. });
  488. },
  489. // 获取 用户保存的 格式列
  490. getTableUserColumn() {
  491. getTableUserListLanguage(this.queryTableUser).then(({data}) => {
  492. if (data.rows.length>0) {
  493. //this.columnList = []
  494. this.columnList = data.rows
  495. } else {
  496. this.getColumnList()
  497. }
  498. })
  499. },
  500. // 保存 默认配置 列
  501. saveColumnList() {
  502. // 删除所有的该页面下保存的数据
  503. if (this.userColumnList) {
  504. //删除 user自定义的数据
  505. removerUser(this.queryTable)
  506. }
  507. // 删除默认配置
  508. removerDefault(this.queryTable)
  509. // 删除语言
  510. removerLanguage(this.queryTable)
  511. // 保存页面 table属性
  512. let sumColumnList = this.columnList;
  513. saveTableDefaultList(sumColumnList).then(({data}) => {
  514. })
  515. // 保存页面 button label title 属性
  516. saveButtonList(this.buttonList).then(({data}) => {
  517. })
  518. this.getFunctionButtonList()
  519. this.getColumnList()
  520. },
  521. // 获取 tableDefault 列
  522. getColumnList() {
  523. getTableDefaultListLanguage(this.queryTable).then(({data}) => {
  524. if (data.rows.length>0) {
  525. // this.showDefault = false
  526. this.columnList = data.rows
  527. } else {
  528. // this.showDefault = true
  529. }
  530. })
  531. },
  532. // 每页数
  533. sizeChangeHandle(val) {
  534. this.searchData.size = val
  535. this.searchData.page = 1
  536. this.getData()
  537. },
  538. // 当前页
  539. currentChangeHandle (val) {
  540. this.searchData.page = val
  541. this.getData()
  542. },
  543. //多语言 end
  544. // getData(){
  545. // if((this.searchData.site==null||this.searchData.site=='')&&(this.searchData.partNo==null||this.searchData.partNo=='')&&(this.searchData.partDescription==null||this.searchData.partDescription=='')&&
  546. // (this.searchData.spec==null||this.searchData.spec=='')&&(this.searchData.date1==null||this.searchData.date1=='')&&(this.searchData.date2==null||this.searchData.date2=='')){
  547. // this.$alert("数据量过大,请至少输入一个查询条件!",'提示',{
  548. // confirmButtonText:'确定'
  549. // })
  550. // return false;
  551. // }
  552. // searchPartNoDataWithPage(this.searchData).then(({data}) => {
  553. // this.dataList = data.rows
  554. // })
  555. // },
  556. //导出excel
  557. createExportData() {
  558. return this.dataList;
  559. },
  560. startDownload() {
  561. // this.exportData = this.dataList
  562. },
  563. finishDownload() {
  564. },
  565. fields() {
  566. let json = "{"
  567. this.columnList.forEach((item, index) => {
  568. if (index == this.columnList.length - 1) {
  569. json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\""
  570. } else {
  571. json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\"" + ","
  572. }
  573. })
  574. json += "}"
  575. let s = eval("(" + json + ")")
  576. return s
  577. },
  578. // 导出 end
  579. lazyLoading() {
  580. // let dom = document.querySelector(".el-table__body-wrapper");
  581. // dom.addEventListener("scroll", (v) => {
  582. // const scrollDistance = dom.scrollHeight - dom.scrollTop - dom.clientHeight;
  583. // //console.log("鼠标滑动-scrollDistance", scrollDistance)
  584. // // if (scrollDistance <= 0) { //分辨率问题,如果设置 100% ,滑倒最底部,scrollDistance的值 可能为 0.201 到 -0.201
  585. // if (scrollDistance <= 1) {
  586. // //等于0证明已经到底,可以请求接口
  587. // if (this.pagination.page >= this.totalPage) {
  588. // //判断是否到达底部
  589. // // this.$message.warning("我~是有底线的 (~ ̄▽ ̄)~");
  590. // }
  591. // if (this.pagination.page < this.totalPage) {
  592. // //当前页数小于总页数就请求
  593. // this.pagination.page++; //当前页数自增
  594. // this.pagination.pageSize = this.countTotal;
  595. // this.getDataListAdd()
  596. // }
  597. // }
  598. // });
  599. },
  600. // 滚动获取数据
  601. getDataListAdd(val) {
  602. // this.dataListLoading = true
  603. // let query = {
  604. // parttypeFlag:'R',
  605. // limit: this.pagination.pageSize,
  606. // page: this.pagination.page,
  607. // site:this.searchData.site,
  608. // partNo:this.searchData.partNo,
  609. // partDescription:this.searchData.partDescription,
  610. // active:this.searchData.active,
  611. // spec:this.searchData.spec,
  612. // date1:this.searchData.date1,
  613. // date2:this.searchData.date2,
  614. // user:this.$store.state.user.name,
  615. // }
  616. // searchPartNoDataWithPage(query).then(({data}) => {
  617. // if (data && data.code === 0) {
  618. // let voList = data.page.list
  619. // this.dataList.push(...voList)
  620. // }
  621. // this.dataListLoading = false
  622. // })
  623. },
  624. // 获取数据列表
  625. getData(val) {
  626. if((this.searchData.site==null||this.searchData.site=='')&&(this.searchData.partNo==null||this.searchData.partNo=='')&&(this.searchData.partDescription==null||this.searchData.partDescription=='')&&
  627. (this.searchData.spec==null||this.searchData.spec=='')&&(this.searchData.date1==null||this.searchData.date1=='')&&(this.searchData.date2==null||this.searchData.date2=='')){
  628. this.$alert("数据量过大,请至少输入一个查询条件!",'提示',{
  629. confirmButtonText:'确定'
  630. })
  631. return false;
  632. }
  633. this.dataListLoading = true
  634. if (val != 0){
  635. this.pagination.pageSize=200
  636. }
  637. let query = {
  638. parttypeFlag:'R',
  639. limit: this.pagination.pageSize,
  640. page: this.pagination.page,
  641. site:this.searchData.site,
  642. partNo:this.searchData.partNo,
  643. partDescription:this.searchData.partDescription,
  644. active:this.searchData.active,
  645. spec:this.searchData.spec,
  646. date1:this.searchData.date1,
  647. date2:this.searchData.date2,
  648. user:this.$store.state.user.name,
  649. }
  650. getPurchasePartList(this.searchData).then(({data}) => {
  651. if (data && data.code === 0) {
  652. this.dataList = data.page.list
  653. this.searchData.page = data.page.currPage
  654. this.searchData.size = data.page.pageSize
  655. this.searchData.total = data.page.totalCount
  656. }
  657. this.dataListLoading = false
  658. })
  659. }
  660. },
  661. created() {
  662. this.getTableUserColumn()
  663. this.getSysLanguageParamList()
  664. this.getFunctionButtonList()
  665. this.getMsgLanguage()
  666. }
  667. }
  668. </script>
  669. <style >
  670. .el-textarea__inner {
  671. padding: 5px 5px;
  672. }
  673. </style>