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.

859 lines
27 KiB

4 years ago
2 years ago
4 years ago
4 years ago
2 years ago
4 years ago
2 years ago
2 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" :model="queryForm">
  4. <el-form-item label="BU">
  5. <el-select v-model="queryForm.buDesc" placeholder="请选择" clearable style="width: 80px">
  6. <el-option
  7. v-for = "i in userBuList"
  8. :key = "i.buNo"
  9. :label = "i.buDesc"
  10. :value = "i.buDesc">
  11. </el-option>
  12. </el-select>
  13. </el-form-item>
  14. <el-form-item label="备品备件编码">
  15. <el-input v-model="queryForm.partNo" clearable style="width: 100px"></el-input>
  16. </el-form-item>
  17. <el-form-item label="备品备件名称">
  18. <el-input v-model="queryForm.partDescription" clearable style="width: 150px"></el-input>
  19. </el-form-item>
  20. <el-form-item label="序列号">
  21. <el-input v-model="queryForm.batchNo" clearable style="width: 100px"></el-input>
  22. </el-form-item>
  23. <el-form-item label="出库/入库">
  24. <el-select v-model="queryForm.direction" clearable style="width: 80px">
  25. <el-option value="-" label="出库"></el-option>
  26. <el-option value="+" label="入库"></el-option>
  27. </el-select>
  28. </el-form-item>
  29. <el-form-item label="单据状态">
  30. <el-select v-model="queryForm.status" clearable style="width: 110px">
  31. <el-option value="已录入" label="已录入"></el-option>
  32. <el-option value="待入库" label="待入库"></el-option>
  33. <el-option value="已入库" label="已入库"></el-option>
  34. <el-option value="待出库" label="待出库"></el-option>
  35. <el-option value="已出库" label="已出库"></el-option>
  36. </el-select>
  37. </el-form-item>
  38. <el-form-item label="货位编码">
  39. <el-input v-model="queryForm.locationId" clearable style="width: 100px"></el-input>
  40. </el-form-item>
  41. <el-form-item label="仓库">
  42. <el-select v-model="queryForm.warehouseId" clearable style="width: 150px">
  43. <el-option
  44. v-for = "item in wareHouseList"
  45. :key = "item.warehouseId"
  46. :value = "item.warehouseId"
  47. :label = "item.warehouseName"
  48. ></el-option>
  49. </el-select>
  50. </el-form-item>
  51. </el-form>
  52. <el-form :inline="true" label-position="top" :model="queryForm">
  53. <el-form-item label="操作日期">
  54. <el-date-picker
  55. style="width: 120px"
  56. v-model="queryForm.startTransDate"
  57. type="date"
  58. format="yyyy-MM-dd"
  59. value-format="yyyy-MM-dd"
  60. placeholder="选择日期">
  61. </el-date-picker>
  62. -
  63. <el-date-picker
  64. style="width: 120px"
  65. v-model="queryForm.endTransDate"
  66. type="date"
  67. format="yyyy-MM-dd"
  68. value-format="yyyy-MM-dd 23:59:59"
  69. placeholder="选择日期">
  70. </el-date-picker>
  71. </el-form-item>
  72. <el-form-item label="设备编码">
  73. <el-input v-model="queryForm.orderRef1" clearable style="width: 100px"></el-input>
  74. </el-form-item>
  75. <!-- <el-form-item label="操作员">-->
  76. <!-- <el-input v-model="queryForm.userName" clearable style="width: 100px"></el-input>-->
  77. <!-- </el-form-item>-->
  78. <el-form-item label="供应商名称">
  79. <el-input v-model="queryForm.supplierName" clearable style="width: 150px"></el-input>
  80. </el-form-item>
  81. <el-form-item label=" ">
  82. <el-button type="primary" @click="getDataList()">查询</el-button>
  83. <download-excel
  84. :fields="fields()"
  85. :data="exportData"
  86. type="xls"
  87. :name="exportName"
  88. :header="exportHeader"
  89. :footer="exportFooter"
  90. :fetch="createExportData"
  91. :before-generate="startDownload"
  92. :before-finish="finishDownload"
  93. worksheet="导出信息"
  94. class="el-button el-button--primary el-button--medium">
  95. {{ "导出" }}
  96. </download-excel>
  97. </el-form-item>
  98. </el-form>
  99. <el-table
  100. :data="dataList"
  101. border
  102. :height="height"
  103. v-loading="dataListLoading"
  104. style="width: 100%;">
  105. <el-table-column
  106. v-for="(item,index) in columnList" :key="index"
  107. v-if="item.columnProp!='averagePrice'||averagePriceFlag?true:false"
  108. :sortable="item.columnSortable"
  109. :prop="item.columnProp"
  110. :header-align="item.headerAlign"
  111. :show-overflow-tooltip="item.showOverflowTooltip"
  112. :align="item.align"
  113. :fixed="item.fixed==''?false:item.fixed"
  114. :min-width="item.columnWidth"
  115. :label="item.columnLabel">
  116. <template slot-scope="scope">
  117. <span v-if="!item.columnHidden"> {{ scope.row[item.columnProp] }}</span>
  118. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  119. </template>
  120. </el-table-column>
  121. </el-table>
  122. <el-pagination
  123. @size-change="sizeChangeHandle"
  124. @current-change="currentChangeHandle"
  125. :current-page="pageIndex"
  126. :page-sizes="[20, 100, 500, 1000]"
  127. :page-size="pageSize"
  128. :total="totalPage"
  129. layout="total, sizes, prev, pager, next, jumper">
  130. </el-pagination>
  131. </div>
  132. </template>
  133. <script>
  134. import {
  135. getRepairTransDetailList,
  136. getaveragePriceFlagList
  137. } from '@/api/partspare/repairtransdetail.js'
  138. import {getTableDefaultListLanguage, getTableUserListLanguage} from "@/api/table.js"
  139. import {
  140. getWareHouseList,
  141. } from '@/api/partspare/wareHouseEntity.js'
  142. import {userFavoriteList, saveUserFavorite, removeUserFavorite} from '@/api/userFavorite.js'
  143. import {getAllBuList}from '@/api/factory/site.js'
  144. export default {
  145. data() {
  146. return {
  147. userBuList: [],
  148. averagePriceFlagList: [],
  149. // 是否收藏
  150. favorite: false,
  151. // 导出 start
  152. exportData: [],
  153. exportName: "出入库明细" + this.dayjs().format('YYYYMMDDHHmmss'),
  154. exportHeader: ["出入库明细"],
  155. exportFooter: [],
  156. exportList:[],
  157. // 导出 end
  158. queryForm: {
  159. site: '',
  160. buDesc: '',
  161. direction: '',
  162. status: '',
  163. partNo: '',
  164. partDescription: '',
  165. batchNo: '',
  166. warehouseId: '',
  167. locationId: '',
  168. orderRef1: '',
  169. supplierName: '',
  170. startTransDate: this.dayjs().format('YYYY-MM-DD'),
  171. endTransDate: this.dayjs().format('YYYY-MM-DD 23:59:59'),
  172. userName: this.$store.state.user.name,
  173. limit: 1,
  174. page: ''
  175. },
  176. averagePriceFlag: false,
  177. dataList: [],
  178. wareHouseList: [],
  179. pageIndex: 1,
  180. pageSize: 20,
  181. totalPage: 0,
  182. height: 200,
  183. dataListLoading: false,
  184. dataListSelections: [],
  185. addOrUpdateVisible: false,
  186. // 展示列集
  187. columnList:[
  188. {
  189. userId: this.$store.state.user.name,
  190. functionId:200101104,
  191. serialNumber: '200101104TableBuNo',
  192. tableId: "200101104Table",
  193. tableName: "出入库明细表",
  194. columnProp: 'buDesc',
  195. headerAlign: "center",
  196. align: "left",
  197. columnLabel: 'BU',
  198. columnHidden: false,
  199. columnImage: false,
  200. columnSortable: true,
  201. sortLv: 0,
  202. status: true,
  203. fixed: '',
  204. columnWidth: 80,
  205. },
  206. {
  207. userId: this.$store.state.user.name,
  208. functionId:200101104,
  209. serialNumber: '200101104TablePartNo',
  210. tableId: "200101104Table",
  211. tableName: "出入库明细表",
  212. columnProp: 'partNo',
  213. headerAlign: "center",
  214. align: "left",
  215. columnLabel: '备品备件编码',
  216. columnHidden: false,
  217. columnImage: false,
  218. columnSortable: true,
  219. sortLv: 0,
  220. status: true,
  221. fixed: '',
  222. columnWidth: 140,
  223. },
  224. {
  225. userId: this.$store.state.user.name,
  226. functionId:200101104,
  227. serialNumber: '200101104TablePartDescription',
  228. tableId: "200101104Table",
  229. tableName: "出入库明细表",
  230. columnProp: 'partDescription',
  231. headerAlign: "center",
  232. align: "left",
  233. columnLabel: '备品备件名称',
  234. columnHidden: false,
  235. columnImage: false,
  236. columnSortable: false,
  237. sortLv: 0,
  238. status: true,
  239. fixed: '',
  240. columnWidth: 140,
  241. },
  242. {
  243. userId: this.$store.state.user.name,
  244. functionId:200101104,
  245. serialNumber: '200101104TableAveragePriceFlag',
  246. tableId: "200101104Table",
  247. tableName: "出入库明细表",
  248. columnProp: 'averagePrice',
  249. headerAlign: "center",
  250. align: "left",
  251. columnLabel: '单价',
  252. columnHidden: false,
  253. columnImage: false,
  254. columnSortable: false,
  255. sortLv: 0,
  256. status: true,
  257. fixed: '',
  258. columnWidth: 60,
  259. },
  260. {
  261. userId: this.$store.state.user.name,
  262. functionId:200101104,
  263. serialNumber: '200101104TableSpec',
  264. tableId: "200101104Table",
  265. tableName: "出入库明细表",
  266. columnProp: 'spec',
  267. headerAlign: "center",
  268. align: "left",
  269. columnLabel: '规格型号',
  270. columnHidden: false,
  271. columnImage: false,
  272. columnSortable: false,
  273. sortLv: 0,
  274. status: true,
  275. fixed: '',
  276. columnWidth: 140,
  277. }, {
  278. userId: this.$store.state.user.name,
  279. functionId:200101104,
  280. serialNumber: '200101104TableBatchNo',
  281. tableId: "200101104Table",
  282. tableName: "出入库明细表",
  283. columnProp: 'batchNo',
  284. headerAlign: "center",
  285. align: "left",
  286. columnLabel: '序列号',
  287. columnHidden: false,
  288. columnImage: false,
  289. columnSortable: false,
  290. sortLv: 0,
  291. status: true,
  292. fixed: '',
  293. columnWidth: 140,
  294. }, {
  295. userId: this.$store.state.user.name,
  296. functionId:200101104,
  297. serialNumber: '200101104TableTransType',
  298. tableId: "200101104Table",
  299. tableName: "出入库明细表",
  300. columnProp: 'transType',
  301. headerAlign: "center",
  302. align: "left",
  303. columnLabel: '记录类型',
  304. columnHidden: false,
  305. columnImage: false,
  306. columnSortable: false,
  307. sortLv: 0,
  308. status: true,
  309. fixed: '',
  310. columnWidth: 140,
  311. }, {
  312. userId: this.$store.state.user.name,
  313. functionId:200101104,
  314. serialNumber: '200101104TableStatus',
  315. tableId: "200101104Table",
  316. tableName: "出入库明细表",
  317. columnProp: 'status',
  318. headerAlign: "center",
  319. align: "left",
  320. columnLabel: '单据状态',
  321. columnHidden: false,
  322. columnImage: false,
  323. columnSortable: false,
  324. sortLv: 0,
  325. status: true,
  326. fixed: '',
  327. columnWidth: 90,
  328. }, {
  329. userId: this.$store.state.user.name,
  330. functionId:200101104,
  331. serialNumber: '200101104TableCabinetBillNo',
  332. tableId: "200101104Table",
  333. tableName: "出入库明细表",
  334. columnProp: 'cabinetBillNo',
  335. headerAlign: "center",
  336. align: "left",
  337. columnLabel: '柜侧单号',
  338. columnHidden: false,
  339. columnImage: false,
  340. columnSortable: false,
  341. sortLv: 0,
  342. status: true,
  343. fixed: '',
  344. columnWidth: 140,
  345. }, {
  346. userId: this.$store.state.user.name,
  347. functionId:200101104,
  348. serialNumber: '200101104TableWarehouseId',
  349. tableId: "200101104Table",
  350. tableName: "出入库明细表",
  351. columnProp: 'warehouseId',
  352. headerAlign: "center",
  353. align: "left",
  354. columnLabel: '仓库编码',
  355. columnHidden: false,
  356. columnImage: false,
  357. columnSortable: false,
  358. sortLv: 0,
  359. status: true,
  360. fixed: '',
  361. columnWidth: 140,
  362. }, {
  363. userId: this.$store.state.user.name,
  364. functionId:200101104,
  365. serialNumber: '200101104TableLocationId',
  366. tableId: "200101104Table",
  367. tableName: "出入库明细表",
  368. columnProp: 'locationId',
  369. headerAlign: "center",
  370. align: "left",
  371. columnLabel: '货位编码',
  372. columnHidden: false,
  373. columnImage: false,
  374. columnSortable: false,
  375. sortLv: 0,
  376. status: true,
  377. fixed: '',
  378. columnWidth: 140,
  379. }, {
  380. userId: this.$store.state.user.name,
  381. functionId:200101104,
  382. serialNumber: '200101104TableOrderRef1',
  383. tableId: "200101104Table",
  384. tableName: "出入库明细表",
  385. columnProp: 'orderRef1',
  386. headerAlign: "center",
  387. align: "left",
  388. columnLabel: '机台编码',
  389. columnHidden: false,
  390. columnImage: false,
  391. columnSortable: false,
  392. sortLv: 0,
  393. status: true,
  394. fixed: '',
  395. columnWidth: 140,
  396. }, {
  397. userId: this.$store.state.user.name,
  398. functionId: 200101104,
  399. serialNumber: '200101104TableSupplierID',
  400. tableId: "200101104Table",
  401. tableName: "出入库明细表",
  402. columnProp: 'supplierId',
  403. headerAlign: "center",
  404. align: "left",
  405. columnLabel: '供应商编码',
  406. columnHidden: false,
  407. columnImage: false,
  408. columnSortable: false,
  409. sortLv: 0,
  410. status: true,
  411. fixed: '',
  412. columnWidth: 140,
  413. }, {
  414. userId: this.$store.state.user.name,
  415. functionId: 200101104,
  416. serialNumber: '200101104TableSupplierName',
  417. tableId: "200101104Table",
  418. tableName: "出入库明细表",
  419. columnProp: 'supplierName',
  420. headerAlign: "center",
  421. align: "left",
  422. columnLabel: '供应商名称',
  423. columnHidden: false,
  424. columnImage: false,
  425. columnSortable: false,
  426. sortLv: 0,
  427. status: true,
  428. fixed: '',
  429. columnWidth: 140,
  430. }, {
  431. userId: this.$store.state.user.name,
  432. functionId: 200101104,
  433. serialNumber: '200101104TableTransQty',
  434. tableId: "200101104Table",
  435. tableName: "出入库明细表",
  436. columnProp: 'transQty',
  437. headerAlign: "center",
  438. align: "right",
  439. columnLabel: '数量',
  440. columnHidden: false,
  441. columnImage: false,
  442. columnSortable: false,
  443. sortLv: 0,
  444. status: true,
  445. fixed: '',
  446. columnWidth: 140,
  447. }, {
  448. userId: this.$store.state.user.name,
  449. functionId: 200101104,
  450. serialNumber: '200101104TableRemark',
  451. tableId: "200101104Table",
  452. tableName: "出入库明细表",
  453. columnProp: 'remark',
  454. headerAlign: "center",
  455. align: "left",
  456. columnLabel: '备注',
  457. columnHidden: false,
  458. columnImage: false,
  459. columnSortable: false,
  460. sortLv: 0,
  461. status: true,
  462. fixed: '',
  463. columnWidth: 140,
  464. },
  465. {
  466. userId: this.$store.state.user.name,
  467. functionId: 200101104,
  468. serialNumber: '200101104TableRemark3',
  469. tableId: "200101104Table",
  470. tableName: "出入库明细表",
  471. columnProp: 'remark3',
  472. headerAlign: "center",
  473. align: "left",
  474. columnLabel: '领用人',
  475. columnHidden: false,
  476. columnImage: false,
  477. columnSortable: false,
  478. sortLv: 0,
  479. status: true,
  480. fixed: '',
  481. columnWidth: 140,
  482. },
  483. {
  484. userId: this.$store.state.user.name,
  485. functionId: 200101104,
  486. serialNumber: '200101104TableUserName',
  487. tableId: "200101104Table",
  488. tableName: "出入库明细表",
  489. columnProp: 'userName',
  490. headerAlign: "center",
  491. align: "left",
  492. columnLabel: '操作员',
  493. columnHidden: false,
  494. columnImage: false,
  495. columnSortable: false,
  496. sortLv: 0,
  497. status: true,
  498. fixed: '',
  499. columnWidth: 140,
  500. }, {
  501. userId: this.$store.state.user.name,
  502. functionId: 200101104,
  503. serialNumber: '200101104TableTransDate',
  504. tableId: "200101104Table",
  505. tableName: "出入库明细表",
  506. columnProp: 'transDate',
  507. headerAlign: "center",
  508. align: "left",
  509. columnLabel: '操作日期',
  510. columnHidden: false,
  511. columnImage: false,
  512. columnSortable: false,
  513. sortLv: 0,
  514. status: true,
  515. fixed: '',
  516. columnWidth: 140,
  517. }],
  518. }
  519. },
  520. activated() {
  521. this.getDataList()
  522. this.getWareHouseList()
  523. this.favoriteIsOk()
  524. },
  525. mounted() {
  526. this.$nextTick(() => {
  527. this.height = window.innerHeight - 210
  528. })
  529. },
  530. created() {
  531. // 动态列
  532. this.getTableUserColumn(this.$route.meta.menuId+'table',1)
  533. this. getBu ()
  534. this.getaveragePriceFlagList()
  535. },
  536. methods: {
  537. // 获取bu列表
  538. getBu () {
  539. let tempData = {
  540. username: this.$store.state.user.name,
  541. }
  542. getAllBuList(tempData).then(({data}) => {
  543. if (data.code === 0) {
  544. this.userBuList = data.rows
  545. }
  546. })
  547. },
  548. getaveragePriceFlagList () {
  549. getaveragePriceFlagList().then(({data}) => {
  550. if (data.code === 0) {
  551. this.averagePriceFlagList = data.rows
  552. let usernameList = []
  553. this.averagePriceFlagList.forEach(val => {
  554. usernameList.push(val.adminID)
  555. })
  556. this.averagePriceFlag = usernameList.includes(this.$store.state.user.name)
  557. }
  558. })
  559. },
  560. // 每页数
  561. sizeChangeHandle (val) {
  562. this.pageSize = val
  563. this.pageIndex = 1
  564. this.getDataList()
  565. },
  566. // 当前页
  567. currentChangeHandle (val) {
  568. this.pageIndex = val
  569. this.getDataList()
  570. },
  571. // 获取数据列表
  572. getDataList () {
  573. this.dataListLoading = true
  574. this.queryForm.page = this.pageIndex
  575. this.queryForm.limit = this.pageSize
  576. getRepairTransDetailList(this.queryForm).then(({data}) => {
  577. if (data && data.code === 0) {
  578. this.dataList = data.page.list
  579. this.pageIndex = data.page.currPage
  580. this.pageSize = data.page.pageSize
  581. this.totalPage = data.page.totalCount
  582. }
  583. this.dataListLoading = false
  584. })
  585. },
  586. // 获取仓库列表
  587. getWareHouseList(){
  588. let wareHouse = {
  589. username: this.$store.state.user.name,
  590. warehousetype: "备品备件仓",
  591. }
  592. getWareHouseList(wareHouse).then(({data}) =>{
  593. if (data && data.code === 0){
  594. this.wareHouseList = data.data
  595. }
  596. })
  597. },
  598. // 新增 / 修改
  599. addOrUpdateHandle (id) {
  600. this.addOrUpdateVisible = true
  601. this.$nextTick(() => {
  602. this.$refs.addOrUpdate.init(id)
  603. })
  604. },
  605. // 删除
  606. deleteHandle (id) {
  607. var ids = id ? [id] : this.dataListSelections.map(item => {
  608. return item.transno
  609. })
  610. this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
  611. confirmButtonText: '确定',
  612. cancelButtonText: '取消',
  613. type: 'warning'
  614. }).then(() => {
  615. this.$http({
  616. url: this.$http.adornUrl('/pms/repairtransdetail/delete'),
  617. method: 'post',
  618. data: this.$http.adornData(ids, false)
  619. }).then(({data}) => {
  620. if (data && data.code === 0) {
  621. this.$message({
  622. message: '操作成功',
  623. type: 'success',
  624. duration: 1500,
  625. onClose: () => {
  626. this.getDataList()
  627. }
  628. })
  629. } else {
  630. this.$message.error(data.msg)
  631. }
  632. })
  633. })
  634. },
  635. //导出excel
  636. async createExportData () {
  637. this.queryForm.limit = -1
  638. this.queryForm.page = 1
  639. await getRepairTransDetailList(this.queryForm).then(({data}) => {
  640. this.exportList= data.page.list
  641. })
  642. return this.exportList
  643. },
  644. startDownload() {},
  645. finishDownload() {},
  646. fields () {
  647. let json = "{"
  648. this.columnList.forEach((item, index) => {
  649. if (index == this.columnList.length - 1) {
  650. json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\""
  651. } else {
  652. json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\"" + ","
  653. }
  654. })
  655. json += "}"
  656. let s = eval("(" + json + ")")
  657. return s
  658. },
  659. // 校验用户是否收藏
  660. favoriteIsOk () {
  661. let userFavorite = {
  662. userId: this.$store.state.user.id,
  663. languageCode: this.$i18n.locale
  664. }
  665. userFavoriteList(userFavorite).then(({data}) => {
  666. for (let i = 0; i < data.list.length; i++) {
  667. if(this.$route.meta.menuId === data.list[i].menuId){
  668. this.favorite = true
  669. }
  670. }
  671. })
  672. },
  673. // 收藏 OR 取消收藏
  674. favoriteFunction() {
  675. let userFavorite = {
  676. userId: this.$store.state.user.id,
  677. functionId: this.$route.meta.menuId,
  678. }
  679. if (this.favorite) {
  680. // 取消收藏
  681. this.$confirm(`确定取消收藏`, '提示', {
  682. confirmButtonText: '确定',
  683. cancelButtonText: '取消',
  684. type: 'warning'
  685. }).then(() => {
  686. removeUserFavorite(userFavorite).then(({data}) => {
  687. this.$message.success(data.msg)
  688. this.favorite = false
  689. })
  690. })
  691. } else {
  692. // 收藏
  693. saveUserFavorite(userFavorite).then(({data}) => {
  694. this.$message.success(data.msg)
  695. this.favorite = true
  696. })
  697. }
  698. },
  699. // 动态列开始 获取 用户保存的 格式列
  700. async getTableUserColumn (tableId, columnId) {
  701. let queryTableUser = {
  702. userId: this.$store.state.user.name,
  703. functionId: this.$route.meta.menuId,
  704. tableId: tableId,
  705. status: true,
  706. languageCode: this.$i18n.locale
  707. }
  708. await getTableUserListLanguage(queryTableUser).then(({data}) => {
  709. if (data.rows.length > 0) {
  710. //this.columnList1 = []
  711. switch (columnId) {
  712. case 1:
  713. // 检查是否有领用人列,如果没有则添加
  714. const hasRemark3 = data.rows.some(item => item.columnProp === 'remark3')
  715. const hasStatus = data.rows.some(item => item.columnProp === 'status')
  716. if (!hasStatus) {
  717. data.rows.push({
  718. userId: this.$store.state.user.name,
  719. functionId: 200101104,
  720. serialNumber: '200101104TableStatus',
  721. tableId: "200101104Table",
  722. tableName: "出入库明细表",
  723. columnProp: 'status',
  724. headerAlign: "center",
  725. align: "left",
  726. columnLabel: '单据状态',
  727. columnHidden: false,
  728. columnImage: false,
  729. columnSortable: false,
  730. sortLv: 0,
  731. status: true,
  732. fixed: '',
  733. columnWidth: 90
  734. })
  735. }
  736. if (!hasRemark3) {
  737. // 找到备注列的位置
  738. const remarkIndex = data.rows.findIndex(item => item.columnProp === 'remark')
  739. if (remarkIndex !== -1) {
  740. // 在备注列后面插入领用人列
  741. const newColumn = {
  742. userId: this.$store.state.user.name,
  743. functionId: 200101104,
  744. serialNumber: '200101104TableRemark3',
  745. tableId: "200101104Table",
  746. tableName: "出入库明细表",
  747. columnProp: 'remark3',
  748. headerAlign: "center",
  749. align: "left",
  750. columnLabel: '领用人',
  751. columnHidden: false,
  752. columnImage: false,
  753. columnSortable: false,
  754. sortLv: 0,
  755. status: true,
  756. fixed: '',
  757. columnWidth: 140,
  758. }
  759. data.rows.splice(remarkIndex + 1, 0, newColumn)
  760. }
  761. }
  762. this.columnList = data.rows
  763. break;
  764. }
  765. } else {
  766. this.getColumnList(tableId, columnId)
  767. }
  768. })
  769. },
  770. // 获取 tableDefault 列
  771. async getColumnList (tableId, columnId) {
  772. let queryTable = {
  773. functionId: this.$route.meta.menuId,
  774. tableId: tableId,
  775. languageCode: this.$i18n.locale
  776. }
  777. await getTableDefaultListLanguage(queryTable).then(({data}) => {
  778. if (!data.rows.length == 0) {
  779. switch (columnId) {
  780. case 1:
  781. // 检查是否有领用人列,如果没有则添加
  782. const hasRemark3 = data.rows.some(item => item.columnProp === 'remark3')
  783. const hasStatus = data.rows.some(item => item.columnProp === 'status')
  784. if (!hasStatus) {
  785. data.rows.push({
  786. userId: this.$store.state.user.name,
  787. functionId: 200101104,
  788. serialNumber: '200101104TableStatus',
  789. tableId: "200101104Table",
  790. tableName: "出入库明细表",
  791. columnProp: 'status',
  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: 90
  802. })
  803. }
  804. if (!hasRemark3) {
  805. // 找到备注列的位置
  806. const remarkIndex = data.rows.findIndex(item => item.columnProp === 'remark')
  807. if (remarkIndex !== -1) {
  808. // 在备注列后面插入领用人列
  809. const newColumn = {
  810. userId: this.$store.state.user.name,
  811. functionId: 200101104,
  812. serialNumber: '200101104TableRemark3',
  813. tableId: "200101104Table",
  814. tableName: "出入库明细表",
  815. columnProp: 'remark3',
  816. headerAlign: "center",
  817. align: "left",
  818. columnLabel: '领用人',
  819. columnHidden: false,
  820. columnImage: false,
  821. columnSortable: false,
  822. sortLv: 0,
  823. status: true,
  824. fixed: '',
  825. columnWidth: 140,
  826. }
  827. data.rows.splice(remarkIndex + 1, 0, newColumn)
  828. }
  829. }
  830. this.columnList = data.rows
  831. break;
  832. }
  833. }
  834. })
  835. },
  836. },
  837. }
  838. </script>