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.

380 lines
12 KiB

3 years ago
  1. <template>
  2. <div class="mod-config">
  3. <el-form label-position="top" style="margin-top: 1px; margin-left: 0px;">
  4. <el-form :inline="true" label-position="top" style="margin-top: 0px">
  5. <!-- <el-button type="primary" @click="addModal()">新增</el-button>-->
  6. <download-excel
  7. :fields="fields()"
  8. :data="exportData"
  9. type="xls"
  10. :name="exportName"
  11. :header="exportHeader"
  12. :footer="exportFooter"
  13. :fetch="createExportData"
  14. :before-generate="startDownload"
  15. :before-finish="finishDownload"
  16. worksheet="导出信息"
  17. class="el-button el-button--primary el-button--medium">
  18. {{ '导出' }}
  19. </download-excel>
  20. </el-form>
  21. </el-form>
  22. <el-table
  23. :data="dataList"
  24. height="240"
  25. border
  26. v-loading="dataListLoading"
  27. style="width: 100%; ">
  28. <el-table-column
  29. v-for="(item,index) in columnList" :key="index"
  30. :sortable="item.columnSortable"
  31. :prop="item.columnProp"
  32. :header-align="item.headerAlign"
  33. :show-overflow-tooltip="item.showOverflowTooltip"
  34. :align="item.align"
  35. :fixed="item.fixed==''?false:item.fixed"
  36. :min-width="item.columnWidth"
  37. :label="item.columnLabel">
  38. <template slot-scope="scope">
  39. <span v-if="!item.columnHidden"> {{ scope.row[item.columnProp] }}</span>
  40. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]"
  41. style="width: 100px; height: 80px"/></span>
  42. </template>
  43. </el-table-column>
  44. <!-- <el-table-column-->
  45. <!-- header-align="center"-->
  46. <!-- align="center"-->
  47. <!-- width="150"-->
  48. <!-- fixed="right"-->
  49. <!-- label="操作">-->
  50. <!-- <template slot-scope="scope">-->
  51. <!-- <a type="text" size="small" @click="updateModel(scope.row)">修改</a>-->
  52. <!-- <a type="text" size="small" @click="deleteData(scope.row)">删除</a>-->
  53. <!-- </template>-->
  54. <!-- </el-table-column>-->
  55. </el-table>
  56. <Chooselist ref="baseList" @getBaseData="getBaseData"></Chooselist>
  57. </div>
  58. </template>
  59. <script>
  60. import {
  61. quotationInformationSearch, // 测试信息列表查询
  62. } from '@/api/quotation/quotationInformation.js'
  63. import Chooselist from '@/views/modules/common/Chooselist'
  64. export default {
  65. components: {
  66. Chooselist
  67. },
  68. data() {
  69. return {
  70. dataList: [],
  71. searchData: {
  72. site: '',
  73. username: this.$store.state.user.name,
  74. projectId: '',
  75. page: 1,
  76. limit: 1000
  77. },
  78. visible:false,
  79. dataListLoading: false,
  80. currentRow:'',
  81. columnList: [
  82. {
  83. userId: this.$store.state.user.name,
  84. functionId: 101002001,
  85. serialNumber: '101002001Table7SampleNo',
  86. tableId: '101002001Table7',
  87. tableName: '测试信息表',
  88. columnProp: 'sampleNo',
  89. headerAlign: 'center',
  90. align: 'center',
  91. columnLabel: '测试单号',
  92. columnHidden: false,
  93. columnImage: false,
  94. columnSortable: false,
  95. sortLv: 0,
  96. status: true,
  97. fixed: '',
  98. columnWidth: 120
  99. },
  100. {
  101. userId: this.$store.state.user.name,
  102. functionId: 101002001,
  103. serialNumber: '101002001Table7CustomerNo',
  104. tableId: '101002001Table7',
  105. tableName: '测试信息表',
  106. columnProp: 'customerNo',
  107. headerAlign: 'center',
  108. align: 'center',
  109. columnLabel: '状态',
  110. columnHidden: false,
  111. columnImage: false,
  112. columnSortable: false,
  113. sortLv: 0,
  114. status: true,
  115. fixed: '',
  116. columnWidth: 100
  117. },
  118. {
  119. userId: this.$store.state.user.name,
  120. functionId: 101002001,
  121. serialNumber: '101002001Table7CustomerDesc',
  122. tableId: '101002001Table7',
  123. tableName: '测试信息表',
  124. columnProp: 'customerDesc',
  125. headerAlign: 'center',
  126. align: 'center',
  127. columnLabel: '产品编码',
  128. columnHidden: false,
  129. columnImage: false,
  130. columnSortable: false,
  131. sortLv: 0,
  132. status: true,
  133. fixed: '',
  134. columnWidth: 120
  135. },
  136. {
  137. userId: this.$store.state.user.name,
  138. functionId: 101002001,
  139. serialNumber: '101002001Table7TrackerName',
  140. tableId: '101002001Table7',
  141. tableName: '测试信息表',
  142. columnProp: 'trackerName',
  143. headerAlign: 'center',
  144. align: 'center',
  145. columnLabel: '数量',
  146. columnHidden: false,
  147. columnImage: false,
  148. columnSortable: false,
  149. sortLv: 0,
  150. status: true,
  151. fixed: '',
  152. columnWidth: 80
  153. },
  154. {
  155. userId: this.$store.state.user.name,
  156. functionId: 101002001,
  157. serialNumber: '101002001Table7TrackerName',
  158. tableId: '101002001Table7',
  159. tableName: '测试信息表',
  160. columnProp: 'trackerName',
  161. headerAlign: 'center',
  162. align: 'center',
  163. columnLabel: '跟单员',
  164. columnHidden: false,
  165. columnImage: false,
  166. columnSortable: false,
  167. sortLv: 0,
  168. status: true,
  169. fixed: '',
  170. columnWidth: 80
  171. },
  172. {
  173. userId: this.$store.state.user.name,
  174. functionId: 101002001,
  175. serialNumber: '101002001Table7QuoterName',
  176. tableId: '101002001Table7',
  177. tableName: '测试信息表',
  178. columnProp: 'quoterName',
  179. headerAlign: 'center',
  180. align: 'center',
  181. columnLabel: '工程师',
  182. columnHidden: false,
  183. columnImage: false,
  184. columnSortable: false,
  185. sortLv: 0,
  186. status: true,
  187. fixed: '',
  188. columnWidth: 80
  189. },
  190. {
  191. userId: this.$store.state.user.name,
  192. functionId: 101002001,
  193. serialNumber: '101002001Table7TestPartNo',
  194. tableId: '101002001Table7',
  195. tableName: '测试信息表',
  196. columnProp: 'testPartNo',
  197. headerAlign: 'center',
  198. align: 'center',
  199. columnLabel: '优先级',
  200. columnHidden: false,
  201. columnImage: false,
  202. columnSortable: false,
  203. sortLv: 0,
  204. status: true,
  205. fixed: '',
  206. columnWidth: 100
  207. },
  208. {
  209. userId: this.$store.state.user.name,
  210. functionId: 101002001,
  211. serialNumber: '101002001Table7RequiredCompletionDate',
  212. tableId: '101002001Table7',
  213. tableName: '测试信息表',
  214. columnProp: 'requiredCompletionDate',
  215. headerAlign: 'center',
  216. align: 'center',
  217. columnLabel: '要求完成日期',
  218. columnHidden: false,
  219. columnImage: false,
  220. columnSortable: false,
  221. sortLv: 0,
  222. status: true,
  223. fixed: '',
  224. columnWidth: 160
  225. },
  226. {
  227. userId: this.$store.state.user.name,
  228. functionId: 101002001,
  229. serialNumber: '101002001Table7CreateDate',
  230. tableId: '101002001Table7',
  231. tableName: '测试信息表',
  232. align: 'center',
  233. columnLabel: '创建时间',
  234. columnHidden: false,
  235. columnImage: false,
  236. columnSortable: false,
  237. sortLv: 0,
  238. status: true,
  239. fixed: '',
  240. columnWidth: 160
  241. },
  242. {
  243. userId: this.$store.state.user.name,
  244. functionId: 101002001,
  245. serialNumber: '101002001Table7CreateBy',
  246. tableId: '101002001Table7',
  247. tableName: '测试信息表',
  248. columnProp: 'createBy',
  249. headerAlign: 'center',
  250. align: 'center',
  251. columnLabel: '创建人',
  252. columnHidden: false,
  253. columnImage: false,
  254. columnSortable: false,
  255. sortLv: 0,
  256. status: true,
  257. fixed: '',
  258. columnWidth: 80
  259. },
  260. {
  261. userId: this.$store.state.user.name,
  262. functionId: 101002001,
  263. serialNumber: '101002001Table7UpdateDate',
  264. tableId: '101002001Table7',
  265. tableName: '测试信息表',
  266. columnProp: 'updateDate',
  267. headerAlign: 'center',
  268. align: 'center',
  269. columnLabel: '更新时间',
  270. columnHidden: false,
  271. columnImage: false,
  272. columnSortable: false,
  273. sortLv: 0,
  274. status: true,
  275. fixed: '',
  276. columnWidth: 160
  277. },
  278. {
  279. userId: this.$store.state.user.name,
  280. functionId: 101002001,
  281. serialNumber: '101002001Table7UpdateBy',
  282. tableId: '101002001Table7',
  283. tableName: '测试信息表',
  284. columnProp: 'updateBy',
  285. headerAlign: 'center',
  286. align: 'center',
  287. columnLabel: '更新人',
  288. columnHidden: false,
  289. columnImage: false,
  290. columnSortable: false,
  291. sortLv: 0,
  292. status: true,
  293. fixed: '',
  294. columnWidth: 80
  295. }
  296. ],
  297. // 导出 start
  298. exportData: [],
  299. exportName: '项目测试'+this.dayjs().format('YYYYMMDDHHmmss'),
  300. exportHeader: ["项目测试"],
  301. exportFooter: [],
  302. // 导出 end
  303. }
  304. },
  305. methods: {
  306. // 获取基础数据列表S
  307. getBaseList (val, type) {
  308. this.tagNo = val
  309. this.tagNo1 = type
  310. this.$nextTick(() => {
  311. let strVal = ''
  312. // if (val === 1013) {
  313. // if(type==1) {
  314. // strVal = this.dataForm.partType
  315. // }
  316. // }
  317. this.$refs.baseList.init(val, strVal)
  318. })
  319. },
  320. /* 列表方法的回调 */
  321. getBaseData (val) {
  322. // if (this.tagNo === 1013) {
  323. // if(this.tagNo1==1) {
  324. // this.dataForm.partType = val.Base_id
  325. // this.dataForm.partTypeDesc = val.Base_desc
  326. // }
  327. // }
  328. },
  329. //初始化组件的参数
  330. init(inData) {
  331. //初始化参数
  332. this.searchData = JSON.parse(JSON.stringify(inData));
  333. //刷新表格
  334. // this.searchTable();
  335. },
  336. searchTable(){
  337. quotationInformationSearch(this.searchData).then(({data}) => {
  338. //区分请求成功和失败的状况
  339. if (data && data.code == 0) {
  340. this.dataList = data.page.list
  341. } else {
  342. this.dataList = [];
  343. }
  344. });
  345. },
  346. createExportData() {
  347. return this.dataList;
  348. },
  349. startDownload() {
  350. // this.exportData = this.dataList
  351. },
  352. finishDownload() {
  353. },
  354. fields() {
  355. let json = "{"
  356. this.columnList.forEach((item, index) => {
  357. if (index == this.columnList.length - 1) {
  358. json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\""
  359. } else {
  360. json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\"" + ","
  361. }
  362. })
  363. json += "}"
  364. let s = eval("(" + json + ")")
  365. return s
  366. },
  367. },
  368. }
  369. </script>
  370. <style scoped>
  371. </style>