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.

333 lines
9.5 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  1. <template>
  2. <div class="mode-config">
  3. <el-row>
  4. <el-col>
  5. <el-form label-position="top" style="margin-top: 1px; margin-left: 0px;">
  6. <el-form :inline="true" label-position="top" style="margin-top: 0px">
  7. <download-excel
  8. :fields="fields2()"
  9. :data="exportData2"
  10. type="xls"
  11. :name="exportName2"
  12. :header="exportHeader2"
  13. :footer="exportFooter2"
  14. :fetch="createExportData2"
  15. :before-generate="startDownload2"
  16. :before-finish="finishDownload2"
  17. worksheet="导出信息"
  18. class="el-button el-button--primary el-button--medium">
  19. {{ '导出' }}
  20. </download-excel>
  21. </el-form>
  22. </el-form>
  23. </el-col>
  24. </el-row>
  25. <el-table
  26. :data="contactList"
  27. :height="height"
  28. border
  29. v-loading="dataListLoading"
  30. style="width: 100%;margin-top: 10px ">
  31. <el-table-column
  32. v-for="(item,index) in columnList2" :key="index"
  33. :sortable="item.columnSortable"
  34. :prop="item.columnProp"
  35. :header-align="item.headerAlign"
  36. :show-overflow-tooltip="item.showOverflowTooltip"
  37. :align="item.align"
  38. :fixed="item.fixed==''?false:item.fixed"
  39. :min-width="item.columnWidth"
  40. :label="item.columnLabel">
  41. <template slot-scope="scope">
  42. <span v-if="!item.columnHidden"> {{ scope.row[item.columnProp] }}</span>
  43. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]"
  44. style="width: 100px; height: 80px"/></span>
  45. </template>
  46. </el-table-column>
  47. </el-table>
  48. </div>
  49. </template>
  50. <script>
  51. import {
  52. getCustomerContactData,
  53. } from "@/api/project/project.js"
  54. export default {
  55. name: "quotationCustomerContact",
  56. props: {
  57. quotationHeader:{
  58. type: Object,
  59. default:()=>{}
  60. },
  61. height: {
  62. type: Number,
  63. default: 300
  64. }
  65. },
  66. data(){
  67. return{
  68. quotationData: {},
  69. contactList: [],
  70. exportData2: [],
  71. exportName2: "项目客户联系人" + this.dayjs().format('YYYYMMDDHHmmss'),
  72. exportHeader2: ["项目客户联系人"],
  73. exportFooter2: [],
  74. exportList2:[],
  75. dataListLoading: false,
  76. columnList2: [
  77. {
  78. userId: this.$store.state.user.name,
  79. functionId: 102003,
  80. serialNumber: '102003Table99ContactName',
  81. tableId: '102003Table99',
  82. tableName: '项目联系人表',
  83. columnProp: 'contactName',
  84. headerAlign: 'center',
  85. align: 'center',
  86. columnLabel: '联系人',
  87. columnHidden: false,
  88. columnImage: false,
  89. columnSortable: false,
  90. sortLv: 0,
  91. status: true,
  92. fixed: '',
  93. columnWidth: 80
  94. },
  95. {
  96. userId: this.$store.state.user.name,
  97. functionId: 102003,
  98. serialNumber: '102003Table99ContactPhoneNumber1',
  99. tableId: '102003Table99',
  100. tableName: '项目联系人表',
  101. columnProp: 'contactPhoneNumber1',
  102. headerAlign: 'center',
  103. align: 'center',
  104. columnLabel: '联系电话',
  105. columnHidden: false,
  106. columnImage: false,
  107. columnSortable: false,
  108. sortLv: 0,
  109. status: true,
  110. fixed: '',
  111. columnWidth: 80
  112. },
  113. {
  114. userId: this.$store.state.user.name,
  115. functionId: 102003,
  116. serialNumber: '102003Table99ContactLandlineNumber',
  117. tableId: '102003Table99',
  118. tableName: '项目联系人表',
  119. columnProp: 'contactLandlineNumber',
  120. headerAlign: 'center',
  121. align: 'center',
  122. columnLabel: '座机',
  123. columnHidden: false,
  124. columnImage: false,
  125. columnSortable: false,
  126. sortLv: 0,
  127. status: true,
  128. fixed: '',
  129. columnWidth: 80
  130. },
  131. {
  132. userId: this.$store.state.user.name,
  133. functionId: 102003,
  134. serialNumber: '102003Table99Position',
  135. tableId: '102003Table99',
  136. tableName: '项目联系人表',
  137. columnProp: 'position',
  138. headerAlign: 'center',
  139. align: 'center',
  140. columnLabel: '公司职务',
  141. columnHidden: false,
  142. columnImage: false,
  143. columnSortable: false,
  144. sortLv: 0,
  145. status: true,
  146. fixed: '',
  147. columnWidth: 80
  148. },
  149. {
  150. userId: this.$store.state.user.name,
  151. functionId: 102003,
  152. serialNumber: '102003Table99Mailbox',
  153. tableId: '102003Table99',
  154. tableName: '项目联系人表',
  155. columnProp: 'mailbox',
  156. headerAlign: 'center',
  157. align: 'center',
  158. columnLabel: '邮箱',
  159. columnHidden: false,
  160. columnImage: false,
  161. columnSortable: false,
  162. sortLv: 0,
  163. status: true,
  164. fixed: '',
  165. columnWidth: 80
  166. },
  167. {
  168. userId: this.$store.state.user.name,
  169. functionId: 102003,
  170. serialNumber: '102003Table99PrimaryContact',
  171. tableId: '102003Table99',
  172. tableName: '项目联系人表',
  173. columnProp: 'primaryContact',
  174. headerAlign: 'center',
  175. align: 'center',
  176. columnLabel: '默认联系人',
  177. columnHidden: false,
  178. columnImage: false,
  179. columnSortable: false,
  180. sortLv: 0,
  181. status: true,
  182. fixed: '',
  183. columnWidth: 40
  184. },
  185. {
  186. userId: this.$store.state.user.name,
  187. functionId: 102003,
  188. serialNumber: '102003Table99ContactStatus',
  189. tableId: '102003Table99',
  190. tableName: '项目联系人表',
  191. columnProp: 'contactStatus',
  192. headerAlign: 'center',
  193. align: 'center',
  194. columnLabel: '状态',
  195. columnHidden: false,
  196. columnImage: false,
  197. columnSortable: false,
  198. sortLv: 0,
  199. status: true,
  200. fixed: '',
  201. columnWidth: 40
  202. },
  203. {
  204. userId: this.$store.state.user.name,
  205. functionId: 102003,
  206. serialNumber: '102003Table99CreateDate',
  207. tableId: '102003Table99',
  208. tableName: '项目联系人表',
  209. columnProp: 'createDate',
  210. headerAlign: 'center',
  211. align: 'center',
  212. columnLabel: '创建时间',
  213. columnHidden: false,
  214. columnImage: false,
  215. columnSortable: false,
  216. sortLv: 0,
  217. status: true,
  218. fixed: '',
  219. columnWidth: 120
  220. },
  221. {
  222. userId: this.$store.state.user.name,
  223. functionId: 102003,
  224. serialNumber: '102003Table99CreateBy',
  225. tableId: '102003Table99',
  226. tableName: '项目联系人表',
  227. columnProp: 'createBy',
  228. headerAlign: 'center',
  229. align: 'center',
  230. columnLabel: '创建人',
  231. columnHidden: false,
  232. columnImage: false,
  233. columnSortable: false,
  234. sortLv: 0,
  235. status: true,
  236. fixed: '',
  237. columnWidth: 80
  238. },
  239. {
  240. userId: this.$store.state.user.name,
  241. functionId: 102003,
  242. serialNumber: '102003Table99UpdateDate',
  243. tableId: '102003Table99',
  244. tableName: '项目联系人表',
  245. columnProp: 'updateDate',
  246. headerAlign: 'center',
  247. align: 'center',
  248. columnLabel: '更新时间',
  249. columnHidden: false,
  250. columnImage: false,
  251. columnSortable: false,
  252. sortLv: 0,
  253. status: true,
  254. fixed: '',
  255. columnWidth: 120
  256. },
  257. {
  258. userId: this.$store.state.user.name,
  259. functionId: 102003,
  260. serialNumber: '102003Table99UpdateBy',
  261. tableId: '102003Table99',
  262. tableName: '项目联系人表',
  263. columnProp: 'updateBy',
  264. headerAlign: 'center',
  265. align: 'center',
  266. columnLabel: '更新人',
  267. columnHidden: false,
  268. columnImage: false,
  269. columnSortable: false,
  270. sortLv: 0,
  271. status: true,
  272. fixed: '',
  273. columnWidth: 80
  274. }
  275. ],
  276. }
  277. },
  278. methods:{
  279. initData(){
  280. let inData={
  281. site:this.quotationData.site,
  282. customerId:this.quotationData.customerNo,
  283. projectId:this.quotationData.projectId,
  284. }
  285. getCustomerContactData(inData).then(({data}) => {
  286. //区分请求成功和失败的状况
  287. if (data && data.code == 0) {
  288. this.contactList = data.rows;
  289. } else {
  290. this.contactList = [];
  291. }
  292. });
  293. },
  294. //导出excel
  295. async createExportData2() {
  296. return this.contactList;
  297. },
  298. startDownload2() {
  299. // this.exportData = this.dataList
  300. },
  301. finishDownload2() {
  302. },
  303. fields2() {
  304. let json = "{"
  305. this.columnList2.forEach((item, index) => {
  306. if (index == this.columnList2.length - 1) {
  307. json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\""
  308. } else {
  309. json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\"" + ","
  310. }
  311. })
  312. json += "}"
  313. let s = eval("(" + json + ")")
  314. return s
  315. },
  316. },
  317. watch:{
  318. // 父组件值发生改变,修改子组件的值
  319. quotationHeader: function (val) {
  320. this.quotationData = val;
  321. this.initData();
  322. }
  323. },
  324. created() {
  325. },
  326. mounted() {
  327. }
  328. }
  329. </script>
  330. <style scoped>
  331. </style>