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.

409 lines
12 KiB

3 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. height: 200,
  52. dataList:[],
  53. dataListLoading: false,
  54. columnList: [
  55. {
  56. userId: this.$store.state.user.name,
  57. functionId: 101002001,
  58. serialNumber: '101002001Table1ProjectId',
  59. tableId: "101002001Table1",
  60. tableName: "项目信息主表",
  61. columnProp: "projectId",
  62. headerAlign: "center",
  63. align: "left",
  64. columnLabel: "项目号",
  65. columnHidden: false,
  66. columnImage: false,
  67. columnSortable: false,
  68. sortLv: 0,
  69. status: true,
  70. fixed: '',
  71. columnWidth: 100
  72. },
  73. {
  74. userId: this.$store.state.user.name,
  75. functionId: 101002001,
  76. serialNumber: '101002001Table1ProjectType',
  77. tableId: "101002001Table1",
  78. tableName: "项目信息主表",
  79. columnProp: "projectType",
  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: 80
  90. },
  91. {
  92. userId: this.$store.state.user.name,
  93. functionId: 101002001,
  94. serialNumber: '101002001Table1ProjectName',
  95. tableId: "101002001Table1",
  96. tableName: "项目信息主表",
  97. columnProp: "projectName",
  98. headerAlign: "center",
  99. align: "left",
  100. columnLabel: "项目名称",
  101. columnHidden: false,
  102. columnImage: false,
  103. columnSortable: false,
  104. sortLv: 0,
  105. status: true,
  106. fixed: '',
  107. columnWidth: 80
  108. },
  109. {
  110. userId: this.$store.state.user.name,
  111. functionId: 101002001,
  112. serialNumber: '101002001Table1Status',
  113. tableId: "101002001Table1",
  114. tableName: "项目信息主表",
  115. columnProp: "status",
  116. headerAlign: "center",
  117. align: "left",
  118. columnLabel: "项目状态",
  119. columnHidden: false,
  120. columnImage: false,
  121. columnSortable: false,
  122. sortLv: 0,
  123. status: true,
  124. fixed: '',
  125. columnWidth: 80
  126. },
  127. {
  128. userId: this.$store.state.user.name,
  129. functionId: 101002001,
  130. serialNumber: '101002001Table1Priority',
  131. tableId: "101002001Table1",
  132. tableName: "项目信息主表",
  133. columnProp: "priority",
  134. headerAlign: "center",
  135. align: "left",
  136. columnLabel: "优先级",
  137. columnHidden: false,
  138. columnImage: false,
  139. columnSortable: false,
  140. sortLv: 0,
  141. status: true,
  142. fixed: '',
  143. columnWidth: 40
  144. },
  145. {
  146. userId: this.$store.state.user.name,
  147. functionId: 101002001,
  148. serialNumber: '101002001Table1ProjectManagerId',
  149. tableId: "101002001Table1",
  150. tableName: "项目信息主表",
  151. columnProp: "projectManagerId",
  152. headerAlign: "center",
  153. align: "left",
  154. columnLabel: "项目负责人",
  155. columnHidden: false,
  156. columnImage: false,
  157. columnSortable: false,
  158. sortLv: 0,
  159. status: true,
  160. fixed: '',
  161. columnWidth: 80
  162. },
  163. {
  164. userId: this.$store.state.user.name,
  165. functionId: 101002001,
  166. serialNumber: '101002001Table1ProjectSource',
  167. tableId: "101002001Table1",
  168. tableName: "项目信息主表",
  169. columnProp: "projectSource",
  170. headerAlign: "center",
  171. align: "left",
  172. columnLabel: "项目来源",
  173. columnHidden: false,
  174. columnImage: false,
  175. columnSortable: false,
  176. sortLv: 0,
  177. status: true,
  178. fixed: '',
  179. columnWidth: 80
  180. },
  181. {
  182. userId: this.$store.state.user.name,
  183. functionId: 101002001,
  184. serialNumber: '101002001Table1CustomerId',
  185. tableId: "101002001Table1",
  186. tableName: "项目信息主表",
  187. columnProp: "customerId",
  188. headerAlign: "center",
  189. align: "left",
  190. columnLabel: "客户代码",
  191. columnHidden: false,
  192. columnImage: false,
  193. columnSortable: false,
  194. sortLv: 0,
  195. status: true,
  196. fixed: '',
  197. columnWidth: 80
  198. },
  199. {
  200. userId: this.$store.state.user.name,
  201. functionId: 101002001,
  202. serialNumber: '101002001Table1CustomerName',
  203. tableId: "101002001Table1",
  204. tableName: "项目信息主表",
  205. columnProp: "customerName",
  206. headerAlign: "center",
  207. align: "left",
  208. columnLabel: "客户名称",
  209. columnHidden: false,
  210. columnImage: false,
  211. columnSortable: false,
  212. sortLv: 0,
  213. status: true,
  214. fixed: '',
  215. columnWidth: 120
  216. },
  217. {
  218. userId: this.$store.state.user.name,
  219. functionId: 101002001,
  220. serialNumber: '101002001Table1CreateDate',
  221. tableId: "101002001Table1",
  222. tableName: "项目信息主表",
  223. columnProp: "createDate",
  224. headerAlign: "center",
  225. align: "left",
  226. columnLabel: "创建时间",
  227. columnHidden: false,
  228. columnImage: false,
  229. columnSortable: false,
  230. sortLv: 0,
  231. status: true,
  232. fixed: '',
  233. columnWidth: 120
  234. },
  235. {
  236. userId: this.$store.state.user.name,
  237. functionId: 101002001,
  238. serialNumber: '101002001Table1CreateBy',
  239. tableId: "101002001Table1",
  240. tableName: "项目信息主表",
  241. columnProp: "createBy",
  242. headerAlign: "center",
  243. align: "left",
  244. columnLabel: "创建人",
  245. columnHidden: false,
  246. columnImage: false,
  247. columnSortable: false,
  248. sortLv: 0,
  249. status: true,
  250. fixed: '',
  251. columnWidth: 80
  252. },
  253. {
  254. userId: this.$store.state.user.name,
  255. functionId: 101002001,
  256. serialNumber: '101002001Table1UpdateDate',
  257. tableId: "101002001Table1",
  258. tableName: "项目信息主表",
  259. columnProp: "updateDate",
  260. headerAlign: "center",
  261. align: "left",
  262. columnLabel: "修改时间",
  263. columnHidden: false,
  264. columnImage: false,
  265. columnSortable: false,
  266. sortLv: 0,
  267. status: true,
  268. fixed: '',
  269. columnWidth: 120
  270. },
  271. {
  272. userId: this.$store.state.user.name,
  273. functionId: 101002001,
  274. serialNumber: '101002001Table1UpdateBy',
  275. tableId: "101002001Table1",
  276. tableName: "项目信息主表",
  277. columnProp: "updateBy",
  278. headerAlign: "center",
  279. align: "left",
  280. columnLabel: "修改人",
  281. columnHidden: false,
  282. columnImage: false,
  283. columnSortable: false,
  284. sortLv: 0,
  285. status: true,
  286. fixed: '',
  287. columnWidth: 80
  288. },
  289. ],
  290. }
  291. },
  292. watch: {
  293. // $route: {
  294. // handler: function (val, oldVal) {
  295. // this.$router.onReady(() => {
  296. // if (this.$route.query.order) {
  297. // this.modelData.orderNo = this.$route.query.order
  298. // this.modelData.site = this.$route.query.site
  299. // this.modelData.user = this.$route.query.user
  300. // if (this.modelData.orderNo) {
  301. // this.tableHanddle(this.modelData)
  302. // }
  303. // }
  304. // })
  305. // },
  306. // // 深度观察监听
  307. // deep: true
  308. // },
  309. // updateData: {
  310. // deep: true,
  311. // handler: function (newV, oldV) {
  312. // this.updateData.projectID = this.updateData.projectID.toUpperCase();
  313. // this.updateData.oriSOOrderNo = this.updateData.oriSOOrderNo.toUpperCase();
  314. // this.updateData.orderType = this.updateData.orderType.toUpperCase();
  315. // }
  316. // }
  317. },
  318. mounted() {
  319. this.$nextTick(() => {
  320. this.height = window.innerHeight - 240;
  321. })
  322. },
  323. methods: {
  324. // 动态列开始 获取 用户保存的 格式列
  325. async getTableUserColumn(tableId, columnId) {
  326. let queryTableUser = {
  327. userId: this.$store.state.user.name,
  328. functionId: this.$route.meta.menuId,
  329. tableId: tableId,
  330. status: true,
  331. languageCode: this.$i18n.locale
  332. }
  333. await getTableUserListLanguage(queryTableUser).then(({data}) => {
  334. if (data.rows.length > 0) {
  335. //this.columnList = []
  336. switch (columnId) {
  337. case 1:
  338. this.columnList = data.rows
  339. break;
  340. // case 2:
  341. // this.columnList1 = data.rows
  342. // break;
  343. // case 3:
  344. // this.columnList2 = data.rows
  345. // break;
  346. // case 4:
  347. // this.columnList3 = data.rows
  348. // break;
  349. }
  350. } else {
  351. this.getColumnList(tableId, columnId)
  352. }
  353. })
  354. },
  355. // 获取 tableDefault 列
  356. async getColumnList(tableId, columnId) {
  357. this.queryTable.tableId = tableId
  358. let queryTable= {
  359. functionId: this.$route.meta.menuId,
  360. tableId: tableId,
  361. languageCode: this.$i18n.locale
  362. }
  363. await getTableDefaultListLanguage(queryTable).then(({data}) => {
  364. if (!data.rows.length == 0) {
  365. switch (columnId) {
  366. case 1:
  367. this.columnList = data.rows
  368. break;
  369. // case 2:
  370. // this.columnList1 = data.rows
  371. // break;
  372. // case 3:
  373. // this.columnList2 = data.rows
  374. // break;
  375. // case 4:
  376. // this.columnList3 = data.rows
  377. // break;
  378. }
  379. } else {
  380. // this.showDefault = true
  381. }
  382. })
  383. },
  384. //动态列结束
  385. },
  386. created() {
  387. this.getTableUserColumn(this.$route.meta.menuId+'table1',1)
  388. }
  389. }
  390. </script>
  391. <style scoped>
  392. </style>