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.

393 lines
12 KiB

1 year ago
1 year ago
1 year 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. <div v-if="item.columnProp === 'quotationNo'">
  40. <el-link v-if="!item.columnHidden" @click="handleClick(scope.row)">{{ scope.row[item.columnProp] }}</el-link>
  41. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  42. </div>
  43. <div v-else>
  44. <span v-if="!item.columnHidden">{{ scope.row[item.columnProp] }}</span>
  45. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  46. </div>
  47. </template>
  48. </el-table-column>
  49. <!-- <el-table-column-->
  50. <!-- header-align="center"-->
  51. <!-- align="center"-->
  52. <!-- width="150"-->
  53. <!-- fixed="right"-->
  54. <!-- label="操作">-->
  55. <!-- <template slot-scope="scope">-->
  56. <!-- <a type="text" size="small" @click="updateModel(scope.row)">修改</a>-->
  57. <!-- <a type="text" size="small" @click="deleteData(scope.row)">删除</a>-->
  58. <!-- </template>-->
  59. <!-- </el-table-column>-->
  60. </el-table>
  61. <Chooselist ref="baseList" @getBaseData="getBaseData"></Chooselist>
  62. </div>
  63. </template>
  64. <script>
  65. import {searchProjectToolApplyDetail
  66. } from "@/api/tool/toolApply.js"
  67. import Chooselist from '@/views/modules/common/Chooselist'
  68. export default {
  69. components: {
  70. Chooselist
  71. },
  72. data() {
  73. return {
  74. dataList: [],
  75. searchData: {
  76. site: '',
  77. username: this.$store.state.user.name,
  78. orderRef1: '',
  79. page: 1,
  80. limit: 1000
  81. },
  82. visible:false,
  83. dataListLoading: false,
  84. currentRow:'',
  85. columnList: [
  86. {
  87. userId: this.$store.state.user.name,
  88. functionId: 101002001,
  89. serialNumber: '101002001Table10ApplyNo',
  90. tableId: '101002001Table10',
  91. tableName: '工具申请明细',
  92. columnProp: 'applyNo',
  93. headerAlign: 'center',
  94. align: 'center',
  95. columnLabel: '申请单号',
  96. columnHidden: false,
  97. columnImage: false,
  98. columnSortable: false,
  99. sortLv: 0,
  100. status: true,
  101. fixed: '',
  102. columnWidth: 70
  103. },
  104. {
  105. userId: this.$store.state.user.name,
  106. functionId: 101002001,
  107. serialNumber: '101002001Table10SeqNo',
  108. tableId: '101002001Table10',
  109. tableName: '工具申请明细',
  110. columnProp: 'seqNo',
  111. headerAlign: 'center',
  112. align: 'center',
  113. columnLabel: '序号',
  114. columnHidden: false,
  115. columnImage: false,
  116. columnSortable: false,
  117. sortLv: 0,
  118. status: true,
  119. fixed: '',
  120. columnWidth: 40
  121. },
  122. {
  123. userId: this.$store.state.user.name,
  124. functionId: 101002001,
  125. serialNumber: '101002001Table10ToolNo',
  126. tableId: '101002001Table10',
  127. tableName: '工具申请明细',
  128. columnProp: 'toolId',
  129. headerAlign: 'center',
  130. align: 'center',
  131. columnLabel: '工具编码',
  132. columnHidden: false,
  133. columnImage: false,
  134. columnSortable: false,
  135. sortLv: 0,
  136. status: true,
  137. fixed: '',
  138. columnWidth: 70
  139. },
  140. {
  141. userId: this.$store.state.user.name,
  142. functionId: 101002001,
  143. serialNumber: '101002001Table10ToolDescription',
  144. tableId: '101002001Table10',
  145. tableName: '工具申请明细',
  146. columnProp: 'toolDesc',
  147. headerAlign: 'center',
  148. align: 'center',
  149. columnLabel: '工具描述',
  150. columnHidden: false,
  151. columnImage: false,
  152. columnSortable: false,
  153. sortLv: 0,
  154. status: true,
  155. fixed: '',
  156. columnWidth: 120
  157. },
  158. {
  159. userId: this.$store.state.user.name,
  160. functionId: 101002001,
  161. serialNumber: '101002001Table10ApplyQty',
  162. tableId: '101002001Table10',
  163. tableName: '工具申请明细',
  164. columnProp: 'applyQty',
  165. headerAlign: 'center',
  166. align: 'center',
  167. columnLabel: '申请数量',
  168. columnHidden: false,
  169. columnImage: false,
  170. columnSortable: false,
  171. sortLv: 0,
  172. status: true,
  173. fixed: '',
  174. columnWidth: 60
  175. },
  176. {
  177. userId: this.$store.state.user.name,
  178. functionId: 101002001,
  179. serialNumber: '101002001Table10UnitCost',
  180. tableId: '101002001Table10',
  181. tableName: '工具申请明细',
  182. columnProp: 'standardCost',
  183. headerAlign: 'center',
  184. align: 'center',
  185. columnLabel: '工具成本',
  186. columnHidden: false,
  187. columnImage: false,
  188. columnSortable: false,
  189. sortLv: 0,
  190. status: true,
  191. fixed: '',
  192. columnWidth: 60
  193. },
  194. {
  195. userId: this.$store.state.user.name,
  196. functionId: 101002001,
  197. serialNumber: '101002001Table10Remark',
  198. tableId: '101002001Table10',
  199. tableName: '工具申请明细',
  200. columnProp: 'remark',
  201. headerAlign: 'center',
  202. align: 'center',
  203. columnLabel: '备注',
  204. columnHidden: false,
  205. columnImage: false,
  206. columnSortable: false,
  207. sortLv: 0,
  208. status: true,
  209. fixed: '',
  210. columnWidth: 200
  211. },
  212. {
  213. userId: this.$store.state.user.name,
  214. functionId: 101002001,
  215. serialNumber: '101002001Table10QuotationNo',
  216. tableId: '101002001Table10',
  217. tableName: '工具申请明细',
  218. columnProp: 'orderRef2',
  219. headerAlign: 'center',
  220. align: 'center',
  221. columnLabel: '物料编码',
  222. columnHidden: false,
  223. columnImage: false,
  224. columnSortable: false,
  225. sortLv: 0,
  226. status: true,
  227. fixed: '',
  228. columnWidth: 70
  229. }, {
  230. userId: this.$store.state.user.name,
  231. functionId: 101002001,
  232. serialNumber: '101002001Table10QuotationNo',
  233. tableId: '101002001Table10',
  234. tableName: '工具申请明细',
  235. columnProp: 'orderRef3',
  236. headerAlign: 'center',
  237. align: 'center',
  238. columnLabel: '工艺路线版本',
  239. columnHidden: false,
  240. columnImage: false,
  241. columnSortable: false,
  242. sortLv: 0,
  243. status: true,
  244. fixed: '',
  245. columnWidth: 70
  246. },
  247. {
  248. userId: this.$store.state.user.name,
  249. functionId: 101002001,
  250. serialNumber: '101002001Table10QuotationNo',
  251. tableId: '101002001Table10',
  252. tableName: '工具申请明细',
  253. columnProp: 'orderRef5',
  254. headerAlign: 'center',
  255. align: 'center',
  256. columnLabel: '替代编码',
  257. columnHidden: false,
  258. columnImage: false,
  259. columnSortable: false,
  260. sortLv: 0,
  261. status: true,
  262. fixed: '',
  263. columnWidth: 70
  264. },{
  265. userId: this.$store.state.user.name,
  266. functionId: 101002001,
  267. serialNumber: '101002001Table10QuotationNo',
  268. tableId: '101002001Table10',
  269. tableName: '工具申请明细',
  270. columnProp: 'operationNo',
  271. headerAlign: 'center',
  272. align: 'center',
  273. columnLabel: '工序号',
  274. columnHidden: false,
  275. columnImage: false,
  276. columnSortable: false,
  277. sortLv: 0,
  278. status: true,
  279. fixed: '',
  280. columnWidth: 70
  281. },{
  282. userId: this.$store.state.user.name,
  283. functionId: 101002001,
  284. serialNumber: '101002001Table10QuotationNo',
  285. tableId: '101002001Table10',
  286. tableName: '工具申请明细',
  287. columnProp: 'operationName',
  288. headerAlign: 'center',
  289. align: 'center',
  290. columnLabel: '工序',
  291. columnHidden: false,
  292. columnImage: false,
  293. columnSortable: false,
  294. sortLv: 0,
  295. status: true,
  296. fixed: '',
  297. columnWidth: 70
  298. },
  299. ],
  300. // 导出 start
  301. exportData: [],
  302. exportName: '项目询价'+this.dayjs().format('YYYYMMDDHHmmss'),
  303. exportHeader: ["项目询价"],
  304. exportFooter: [],
  305. // 导出 end
  306. }
  307. },
  308. methods: {
  309. // 获取基础数据列表S
  310. getBaseList (val, type) {
  311. this.tagNo = val
  312. this.tagNo1 = type
  313. this.$nextTick(() => {
  314. let strVal = ''
  315. if (val === 1013) {
  316. if(type==1) {
  317. strVal = this.dataForm.partType
  318. }
  319. }
  320. this.$refs.baseList.init(val, strVal)
  321. })
  322. },
  323. /* 列表方法的回调 */
  324. getBaseData (val) {
  325. if (this.tagNo === 1013) {
  326. if(this.tagNo1==1) {
  327. this.dataForm.partType = val.Base_id
  328. this.dataForm.partTypeDesc = val.Base_desc
  329. }
  330. }
  331. },
  332. //初始化组件的参数
  333. init(inData) {
  334. //初始化参数
  335. this.searchData = JSON.parse(JSON.stringify(inData));
  336. //刷新表格
  337. this.searchTable();
  338. },
  339. searchTable(){
  340. if(this.searchData.orderRef1==null||this.searchData.orderRef1===''){
  341. this.dataList = [];
  342. }else {
  343. searchProjectToolApplyDetail(this.searchData).then(({data}) => {
  344. //区分请求成功和失败的状况
  345. if (data && data.code == 0) {
  346. this.dataList = data.rows
  347. } else {
  348. this.dataList = [];
  349. }
  350. });
  351. }
  352. },
  353. createExportData() {
  354. return this.dataList;
  355. },
  356. startDownload() {
  357. // this.exportData = this.dataList
  358. },
  359. finishDownload() {
  360. },
  361. fields() {
  362. let json = "{"
  363. this.columnList.forEach((item, index) => {
  364. if (index == this.columnList.length - 1) {
  365. json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\""
  366. } else {
  367. json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\"" + ","
  368. }
  369. })
  370. json += "}"
  371. let s = eval("(" + json + ")")
  372. return s
  373. },
  374. handleClick(row){
  375. if (this.$router.resolve(`/quotation-requestForQuote`).resolved.name === '404'){
  376. this.$alert('权限不足,访问失败', '警告', {confirmButtonText: '确定',});
  377. }else {
  378. this.$router.push({name:`quotation-requestForQuote`,params:{quotationNo:row.quotationNo},})
  379. }
  380. }
  381. },
  382. }
  383. </script>
  384. <style scoped>
  385. </style>