plm前端
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.

207 lines
6.1 KiB

2 years ago
2 years ago
2 years ago
  1. <template>
  2. <div class="mod-config">
  3. <el-form :inline="true" label-position="top" label-width="100px" style="margin-top: -10px;">
  4. <el-button @click="getData()" type="primary" style="margin-left: 2px;margin-top: 33px">查询</el-button>
  5. </el-form>
  6. <el-table
  7. :height="height"
  8. :data="dataList"
  9. border
  10. v-loading="dataListLoading"
  11. style="width: 100%;">
  12. <el-table-column
  13. header-align="center"
  14. align="center"
  15. width="150"
  16. label="操作">
  17. <template slot-scope="scope">
  18. <a type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">修改</a>
  19. <a type="text" size="small" @click="deleteHandle(scope.row.id)">删除</a>
  20. </template>
  21. </el-table-column>
  22. <el-table-column
  23. v-for="(item,index) in columnList" :key="index"
  24. :sortable="item.columnSortable"
  25. :prop="item.columnProp"
  26. :header-align="item.headerAlign"
  27. :show-overflow-tooltip="item.showOverflowTooltip"
  28. :align="item.align"
  29. :fixed="item.fixed==''?false:item.fixed"
  30. :min-width="item.columnWidth"
  31. :label="item.columnLabel">
  32. <template slot-scope="scope">
  33. <span v-if="!item.columnHidden"> {{scope.row[item.columnProp]}}</span>
  34. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]"
  35. style="width: 100px; height: 80px"/></span>
  36. </template>
  37. </el-table-column>
  38. </el-table>
  39. </div>
  40. </template>
  41. <script>
  42. import {
  43. getTableDefaultListLanguage,
  44. getTableUserListLanguage,
  45. } from "@/api/table.js"
  46. import {userFavoriteList, saveUserFavorite, removeUserFavorite} from '@/api/userFavorite.js'
  47. export default {
  48. name: "null",
  49. data() {
  50. return {
  51. // 是否收藏 收藏夹功能
  52. favorite: false,
  53. //动态列开始
  54. visible: false,
  55. queryTable: {
  56. functionId: this.$route.meta.menuId,
  57. tableId: "mainTable",
  58. languageCode: this.$i18n.locale
  59. },
  60. // 用户table 查询参数
  61. queryTableUser: {
  62. userId: this.$store.state.user.name,
  63. functionId: this.$route.meta.menuId,
  64. tableId: "mainTable",
  65. status: true,
  66. languageCode: this.$i18n.locale
  67. },
  68. //动态列结束
  69. height: 200,
  70. dataList:[],
  71. dataListLoading: false,
  72. columnList: [
  73. {
  74. userId: this.$store.state.user.name,
  75. functionId: 104001001,
  76. serialNumber: '104001001Table3OrderNo',
  77. tableId: "104001001Table3",
  78. tableName: "生产订单数据获取表",
  79. columnProp: "orderNo",
  80. headerAlign: "center",
  81. align: "left",
  82. columnLabel: "订单号",
  83. columnHidden: false,
  84. columnImage: false,
  85. columnSortable: false,
  86. sortLv: 0,
  87. status: true,
  88. fixed: '',
  89. columnWidth: 120
  90. },
  91. ],
  92. }
  93. },
  94. watch: {
  95. // $route: {
  96. // handler: function (val, oldVal) {
  97. // this.$router.onReady(() => {
  98. // if (this.$route.query.order) {
  99. // this.modelData.orderNo = this.$route.query.order
  100. // this.modelData.site = this.$route.query.site
  101. // this.modelData.user = this.$route.query.user
  102. // if (this.modelData.orderNo) {
  103. // this.tableHanddle(this.modelData)
  104. // }
  105. // }
  106. // })
  107. // },
  108. // // 深度观察监听
  109. // deep: true
  110. // },
  111. // updateData: {
  112. // deep: true,
  113. // handler: function (newV, oldV) {
  114. // this.updateData.projectID = this.updateData.projectID.toUpperCase();
  115. // this.updateData.oriSOOrderNo = this.updateData.oriSOOrderNo.toUpperCase();
  116. // this.updateData.orderType = this.updateData.orderType.toUpperCase();
  117. // }
  118. // }
  119. },
  120. mounted() {
  121. this.$nextTick(() => {
  122. this.height = window.innerHeight - 240;
  123. })
  124. },
  125. methods: {
  126. // 动态列开始 获取 用户保存的 格式列
  127. async getTableUserColumn(tableId, columnId) {
  128. let queryTableUser = {
  129. userId: this.$store.state.user.name,
  130. functionId: this.$route.meta.menuId,
  131. tableId: tableId,
  132. status: true,
  133. languageCode: this.$i18n.locale
  134. }
  135. await getTableUserListLanguage(queryTableUser).then(({data}) => {
  136. if (data.rows.length > 0) {
  137. //this.columnList = []
  138. switch (columnId) {
  139. case 1:
  140. this.columnList = data.rows
  141. break;
  142. // case 2:
  143. // this.columnList1 = data.rows
  144. // break;
  145. // case 3:
  146. // this.columnList2 = data.rows
  147. // break;
  148. // case 4:
  149. // this.columnList3 = data.rows
  150. // break;
  151. }
  152. } else {
  153. this.getColumnList(tableId, columnId)
  154. }
  155. })
  156. },
  157. // 获取 tableDefault 列
  158. async getColumnList(tableId, columnId) {
  159. this.queryTable.tableId = tableId
  160. let queryTable= {
  161. functionId: this.$route.meta.menuId,
  162. tableId: tableId,
  163. languageCode: this.$i18n.locale
  164. }
  165. await getTableDefaultListLanguage(queryTable).then(({data}) => {
  166. if (!data.rows.length == 0) {
  167. switch (columnId) {
  168. case 1:
  169. this.columnList = data.rows
  170. break;
  171. // case 2:
  172. // this.columnList1 = data.rows
  173. // break;
  174. // case 3:
  175. // this.columnList2 = data.rows
  176. // break;
  177. // case 4:
  178. // this.columnList3 = data.rows
  179. // break;
  180. }
  181. } else {
  182. // this.showDefault = true
  183. }
  184. })
  185. },
  186. // 动态列结束
  187. },
  188. created() {
  189. this.getTableUserColumn(this.queryTable.functionId+'table',1)
  190. }
  191. }
  192. </script>
  193. <style scoped>
  194. </style>