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.

602 lines
19 KiB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  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=buttons.site>
  5. <el-input v-model="searchData.site" style="width: 120px"></el-input>
  6. </el-form-item>
  7. <el-form-item :label=buttons.partNo>
  8. <el-input v-model="searchData.partNo" style="width: 120px" oninput="this.value = this.value.toUpperCase()"></el-input>
  9. </el-form-item>
  10. <el-form-item :label=buttons.partDescription>
  11. <el-input v-model="searchData.partDescription" style="width: 120px"></el-input>
  12. </el-form-item>
  13. <el-form-item :label=buttons.spec>
  14. <el-input v-model="searchData.spec" style="width: 120px"></el-input>
  15. </el-form-item>
  16. <el-form-item :label=buttons.newDate>
  17. <el-date-picker
  18. style="width: 130px"
  19. v-model="searchData.date1"
  20. value-format="yyyy-MM-dd"
  21. placeholder="选择日期">
  22. </el-date-picker>
  23. </el-form-item>
  24. <el-form-item :label=buttons.to>
  25. <el-date-picker
  26. style="width: 130px"
  27. v-model="searchData.date2"
  28. value-format="yyyy-MM-dd"
  29. placeholder="选择日期">
  30. </el-date-picker>
  31. </el-form-item>
  32. <el-form-item :label=buttons.active>
  33. <el-select filterable v-model="searchData.active" style="width: 120px">
  34. <el-option :label=buttons.all value=""></el-option>
  35. <el-option :label=buttons.yes value="Y"></el-option>
  36. <el-option :label=buttons.no value="N"></el-option>
  37. </el-select>
  38. </el-form-item>
  39. </el-form>
  40. <el-form :inline="true" label-position="top" label-width="100px" style="margin-top: 5px;margin-left: -2px">
  41. <el-form-item>
  42. <el-button @click="getData()" type="primary" style="margin-left: 2px;">{{ buttons.search }}</el-button>
  43. <el-button @click="userSetting" type="primary">{{ buttons.settingTable }}</el-button>
  44. <el-button v-if="isAuth('sys:setting')" @click="saveColumnList()" type="primary">{{ buttons.defaultTable }}</el-button>
  45. <download-excel
  46. :fields="fields()"
  47. :data="exportData"
  48. type="xls"
  49. :name="exportName"
  50. :header="exportHeader"
  51. :footer="exportFooter"
  52. :fetch="createExportData"
  53. :before-generate="startDownload"
  54. :before-finish="finishDownload"
  55. worksheet="导出信息"
  56. class="el-button el-button--primary el-button--medium">
  57. {{ buttons.download }}
  58. </download-excel>
  59. </el-form-item>
  60. </el-form>
  61. <el-table
  62. :height="height"
  63. :data="dataList"
  64. border
  65. v-loading="dataListLoading"
  66. style="width: 100%;">
  67. <el-table-column
  68. v-for="(item,index) in columnList" :key="index"
  69. :sortable="item.columnSortable"
  70. :prop="item.columnProp"
  71. :header-align="item.headerAlign"
  72. :show-overflow-tooltip="item.showOverflowTooltip"
  73. :align="item.align"
  74. :fixed="item.fixed"
  75. :min-width="item.columnWidth"
  76. :label="item.columnLabel">
  77. <template slot-scope="scope">
  78. <span v-if="!item.columnHidden"> {{scope.row[item.columnProp]}}</span>
  79. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]"
  80. style="width: 100px; height: 80px"/></span>
  81. </template>
  82. </el-table-column>
  83. </el-table>
  84. <!-- 动态列 -->
  85. <column v-if="visible" ref="column" @refreshData="getTableUserColumn"></column>
  86. </div>
  87. </template>
  88. <script>
  89. import column from "../common/column";
  90. import {
  91. searchSysLanguagePackList,
  92. searchSysLanguageParam,
  93. searchFunctionButtonList,
  94. saveButtonList,
  95. searchSysLanguage,
  96. searchLanguageListByLanguageCode,
  97. saveSysLanguageOne,
  98. searchPageLanguageData,
  99. removerLanguage
  100. } from "@/api/sysLanguage.js"
  101. import {
  102. saveTableDefaultList,
  103. saveTableUser,
  104. getTableDefaultListLanguage,
  105. getTableUserListLanguage,
  106. removerDefault,
  107. removerUser
  108. } from "@/api/table.js"
  109. import {
  110. searchPartNoData,
  111. } from "@/api/base/site.js"
  112. export default {
  113. name: "searchPartNo",
  114. components: {column},
  115. data() {
  116. return {
  117. // 多语言 start
  118. buttonList: [
  119. {
  120. functionId: this.$route.meta.menuId,
  121. languageValue: '设置默认配置',
  122. objectId: 'defaultTable',
  123. objectType: "button",
  124. tableId: "6004Table"
  125. },
  126. {
  127. functionId: this.$route.meta.menuId,
  128. languageValue: '查询',
  129. objectId: 'search',
  130. objectType: "button",
  131. tableId: "6004Table"
  132. },
  133. {
  134. functionId: this.$route.meta.menuId,
  135. languageValue: '导出',
  136. objectId: 'download',
  137. objectType: "button",
  138. tableId: "6004Table"
  139. },
  140. {
  141. functionId: this.$route.meta.menuId,
  142. languageValue: '设置列表',
  143. objectId: 'settingTable',
  144. objectType: "button",
  145. tableId: "6004Table"
  146. },
  147. {
  148. functionId: this.$route.meta.menuId,
  149. languageValue: '工厂编码',
  150. objectId: 'site',
  151. objectType: "button",
  152. tableId: "6004Table"
  153. },
  154. {
  155. functionId: this.$route.meta.menuId,
  156. languageValue: '全部',
  157. objectId: 'all',
  158. objectType: "button",
  159. tableId: "6004Table"
  160. },
  161. {
  162. functionId: this.$route.meta.menuId,
  163. languageValue: '是',
  164. objectId: 'yes',
  165. objectType: "button",
  166. tableId: "6004Table"
  167. },
  168. {
  169. functionId: this.$route.meta.menuId,
  170. languageValue: '否',
  171. objectId: 'no',
  172. objectType: "button",
  173. tableId: "6004Table"
  174. },
  175. {
  176. functionId: this.$route.meta.menuId,
  177. languageValue: '在用',
  178. objectId: 'active',
  179. objectType: "button",
  180. tableId: "6004Table"
  181. },
  182. {
  183. functionId: this.$route.meta.menuId,
  184. languageValue: '物料编码',
  185. objectId: 'partNo',
  186. objectType: "button",
  187. tableId: "6004Table"
  188. },
  189. {
  190. functionId: this.$route.meta.menuId,
  191. languageValue: '物料名称',
  192. objectId: 'partDescription',
  193. objectType: "button",
  194. tableId: "6004Table"
  195. },
  196. {
  197. functionId: this.$route.meta.menuId,
  198. languageValue: '规则型号',
  199. objectId: 'spec',
  200. objectType: "button",
  201. tableId: "6004Table"
  202. },
  203. {
  204. functionId: this.$route.meta.menuId,
  205. languageValue: '新增日期',
  206. objectId: 'newDate',
  207. objectType: "button",
  208. tableId: "6004Table"
  209. },
  210. {
  211. functionId: this.$route.meta.menuId,
  212. languageValue: '至',
  213. objectId: 'to',
  214. objectType: "button",
  215. tableId: "6004Table"
  216. }
  217. ],
  218. showDefault:false,
  219. // 语言词典集合
  220. sysLanguageParams: [],
  221. dataListLoading: false,
  222. // 用户table 配置集合
  223. userColumnList: [],
  224. queryTableUser: {
  225. userId: this.$store.state.user.name,
  226. functionId: this.$route.meta.menuId,
  227. tableId: "6004Table",
  228. status: true,
  229. languageCode: this.$i18n.locale
  230. },
  231. buttons:{
  232. defaultTable:'设置默认配置',
  233. search:'查询',
  234. download:'导出',
  235. settingTable: '设置列表',
  236. site:'工厂编码',
  237. active:'在用',
  238. all:'全部',
  239. yes:'是',
  240. no:'否',
  241. partNo:'物料编码',
  242. partDescription:'物料名称',
  243. spec:'规则型号',
  244. newDate:'新增日期',
  245. to:'至',
  246. },
  247. // 默认table 查询参数
  248. queryTable: {
  249. functionId: this.$route.meta.menuId,
  250. tableId: "6004Table",
  251. languageCode: this.$i18n.locale
  252. },
  253. languageList: [],
  254. queryLanguage: {},
  255. visible:false,
  256. // 多语言 end
  257. // 导出 start
  258. exportData: [],
  259. exportName: "物料编码"+this.dayjs().format('YYYYMMDDHHmmss'),
  260. exportHeader: ["物料编码"],
  261. exportFooter: [],
  262. // 导出 end
  263. height: 200,
  264. modelFlag:false,
  265. modelInputFlag:true,
  266. selectList:[],
  267. searchData: {
  268. site:'',
  269. partNo:'',
  270. partDescription:'',
  271. active:'',
  272. spec:'',
  273. date1:new Date(),
  274. date2:'',
  275. user:this.$store.state.user.name,
  276. },
  277. dataList:[],
  278. columnList: [
  279. {
  280. userId: this.$store.state.user.name,
  281. functionId: this.$route.meta.menuId,
  282. serialNumber: '6004TablePartNo',
  283. tableId: "6004Table",
  284. tableName: "查询物料编码表",
  285. columnProp: "partNo",
  286. headerAlign: "center",
  287. align: "left",
  288. columnLabel: "物料编码",
  289. columnHidden: false,
  290. columnImage: false,
  291. columnSortable: false,
  292. sortLv: 0,
  293. status: true,
  294. fixed: false,
  295. columnWidth: 120
  296. },
  297. {
  298. userId: this.$store.state.user.name,
  299. functionId: this.$route.meta.menuId,
  300. serialNumber: '6004TablePartDescription',
  301. tableId: "6004Table",
  302. tableName: "查询物料编码表",
  303. columnProp: "partDescription",
  304. headerAlign: "center",
  305. align: "left",
  306. columnLabel: "物料名称",
  307. columnHidden: false,
  308. columnImage: false,
  309. columnSortable: false,
  310. sortLv: 0,
  311. status: true,
  312. fixed: false,
  313. columnWidth: 250
  314. },
  315. {
  316. userId: this.$store.state.user.name,
  317. functionId: this.$route.meta.menuId,
  318. serialNumber: '6004TableSpec',
  319. tableId: "6004Table",
  320. tableName: "查询物料编码表",
  321. columnProp: "spec",
  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: false,
  331. columnWidth: 100
  332. },
  333. {
  334. userId: this.$store.state.user.name,
  335. functionId: this.$route.meta.menuId,
  336. serialNumber: '6004TableConfigurationTemplateID',
  337. tableId: "6004Table",
  338. tableName: "查询物料编码表",
  339. columnProp: "configurationTemplateID",
  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: false,
  349. columnWidth: 160
  350. },
  351. {
  352. userId: this.$store.state.user.name,
  353. functionId: this.$route.meta.menuId,
  354. serialNumber: '6004TableRemark',
  355. tableId: "6004Table",
  356. tableName: "查询物料编码表",
  357. columnProp: "remark",
  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: false,
  367. columnWidth: 250
  368. },
  369. {
  370. userId: this.$store.state.user.name,
  371. functionId: this.$route.meta.menuId,
  372. serialNumber: '6004TableUmid',
  373. tableId: "6004Table",
  374. tableName: "查询物料编码表",
  375. columnProp: "umid",
  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: false,
  385. columnWidth: 60
  386. },
  387. {
  388. userId: this.$store.state.user.name,
  389. functionId: this.$route.meta.menuId,
  390. serialNumber: '6004TableActive',
  391. tableId: "6004Table",
  392. tableName: "查询物料编码表",
  393. columnProp: "active",
  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: false,
  403. columnWidth: 40
  404. },
  405. {
  406. userId: this.$store.state.user.name,
  407. functionId: this.$route.meta.menuId,
  408. serialNumber: '6004TableCreateDate',
  409. tableId: "6004Table",
  410. tableName: "查询物料编码表",
  411. columnProp: "createDate",
  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: false,
  421. columnWidth: 120
  422. },
  423. {
  424. userId: this.$store.state.user.name,
  425. functionId: this.$route.meta.menuId,
  426. serialNumber: '6004TableSite',
  427. tableId: "6004Table",
  428. tableName: "查询物料编码表",
  429. columnProp: "site",
  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: false,
  439. columnWidth: 60
  440. }
  441. ],
  442. }
  443. },
  444. mounted() {
  445. this.$nextTick(() => {
  446. this.height = window.innerHeight - 180;
  447. })
  448. },
  449. methods: {
  450. //多语言start
  451. // 获取页面多语言
  452. getMsgLanguage() {
  453. this.dataListLoading = true
  454. let queryLang = {
  455. functionId: this.$route.meta.menuId,
  456. table_id: '6004Table',
  457. languageCode: this.$i18n.locale
  458. }
  459. searchPageLanguageData(queryLang).then((data) => {
  460. if (JSON.stringify(data.data) != '{}') {
  461. this.pageLanguageData = data.data
  462. } else {
  463. }
  464. })
  465. this.dataListLoading = false
  466. },
  467. // 获取button的词典
  468. getFunctionButtonList() {
  469. searchFunctionButtonList(this.queryTable).then(({data}) => {
  470. if (JSON.stringify(data.data) != '{}') {
  471. this.buttons = data.data
  472. } else {
  473. // saveButtonList(this.buttonList).then(({data}) => {
  474. // })
  475. }
  476. })
  477. },
  478. // 获取语言词典
  479. getSysLanguageParamList() {
  480. searchSysLanguageParam(this.queryTable).then(({data}) => {
  481. this.sysLanguageParams = data.rows
  482. })
  483. },
  484. // 打开页面设置
  485. userSetting() {
  486. this.visible = true;
  487. let queryTable = {
  488. userId: this.$store.state.user.name,
  489. functionId: this.$route.meta.menuId,
  490. tableId: "6004Table",
  491. languageCode: this.$i18n.locale
  492. }
  493. this.$nextTick(() => {
  494. this.$refs.column.init(queryTable);
  495. });
  496. },
  497. // 获取 用户保存的 格式列
  498. getTableUserColumn() {
  499. getTableUserListLanguage(this.queryTableUser).then(({data}) => {
  500. if (data.rows.length>0) {
  501. //this.columnList = []
  502. this.columnList = data.rows
  503. } else {
  504. this.getColumnList()
  505. }
  506. })
  507. },
  508. // 保存 默认配置 列
  509. saveColumnList() {
  510. // 删除所有的该页面下保存的数据
  511. if (this.userColumnList) {
  512. //删除 user自定义的数据
  513. removerUser(this.queryTable)
  514. }
  515. // 删除默认配置
  516. removerDefault(this.queryTable)
  517. // 删除语言
  518. removerLanguage(this.queryTable)
  519. // 保存页面 table属性
  520. let sumColumnList = this.columnList;
  521. saveTableDefaultList(sumColumnList).then(({data}) => {
  522. })
  523. // 保存页面 button label title 属性
  524. saveButtonList(this.buttonList).then(({data}) => {
  525. })
  526. this.getFunctionButtonList()
  527. this.getColumnList()
  528. },
  529. // 获取 tableDefault 列
  530. getColumnList() {
  531. getTableDefaultListLanguage(this.queryTable).then(({data}) => {
  532. if (data.rows.length>0) {
  533. this.showDefault = false
  534. this.columnList = data.rows
  535. } else {
  536. this.showDefault = true
  537. }
  538. })
  539. },
  540. //多语言 end
  541. getData(){
  542. if((this.searchData.site==null||this.searchData.site=='')&&(this.searchData.partNo==null||this.searchData.partNo=='')&&(this.searchData.partDescription==null||this.searchData.partDescription=='')&&
  543. (this.searchData.spec==null||this.searchData.spec=='')&&(this.searchData.date1==null||this.searchData.date1=='')&&(this.searchData.date2==null||this.searchData.date2=='')){
  544. this.$alert("数据量过大,请至少输入一个查询条件!",'提示',{
  545. confirmButtonText:'确定'
  546. })
  547. return false;
  548. }
  549. searchPartNoData(this.searchData).then(({data}) => {
  550. this.dataList = data.rows
  551. })
  552. },
  553. //导出excel
  554. createExportData() {
  555. return this.dataList;
  556. },
  557. startDownload() {
  558. // this.exportData = this.dataList
  559. },
  560. finishDownload() {
  561. },
  562. fields() {
  563. let json = "{"
  564. this.columnList.forEach((item, index) => {
  565. if (index == this.columnList.length - 1) {
  566. json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\""
  567. } else {
  568. json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\"" + ","
  569. }
  570. })
  571. json += "}"
  572. let s = eval("(" + json + ")")
  573. return s
  574. },
  575. // 导出 end
  576. },
  577. created() {
  578. this.getTableUserColumn()
  579. this.getSysLanguageParamList()
  580. this.getFunctionButtonList()
  581. this.getMsgLanguage()
  582. }
  583. }
  584. </script>
  585. <style >
  586. .el-textarea__inner {
  587. padding: 5px 5px;
  588. }
  589. </style>