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.

606 lines
20 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: 0px;">
  4. <el-form-item :label="'参数卡编码'">
  5. <el-input v-model="searchData.projectId" style="width: 130px"></el-input>
  6. </el-form-item>
  7. <el-form-item >
  8. <span slot="label" style="" @click="getBaseList(1010,1)"><a herf="#">测试料号</a></span>
  9. <el-input v-model="searchData.projectType" style="width: 120px"></el-input>
  10. </el-form-item>
  11. <el-form-item :label="'状态'">
  12. <el-input v-model="searchData.projectOwnerName" style="width: 130px"></el-input>
  13. </el-form-item>
  14. <el-form-item label=" ">
  15. <el-button @click="search()" type="primary" style="margin-left: 2px;margin-top:0px">查询</el-button>
  16. <el-button @click="addOrUpdateHandle()" type="primary" style="margin-left: 2px;margin-top: 0px">新增</el-button>
  17. <download-excel
  18. :fields="fields()"
  19. :data="exportData"
  20. type="xls"
  21. :name="exportName"
  22. :header="exportHeader"
  23. :footer="exportFooter"
  24. :fetch="createExportData"
  25. :before-generate="startDownload"
  26. :before-finish="finishDownload"
  27. worksheet="导出信息"
  28. class="el-button el-button--primary el-button--medium">
  29. {{ '导出' }}
  30. </download-excel>
  31. </el-form-item>
  32. </el-form>
  33. <el-table
  34. :data="dataList"
  35. :height="height"
  36. border
  37. v-loading="dataListLoading"
  38. style="width: 100%; ">
  39. <el-table-column
  40. v-for="(item,index) in columnList1" :key="index"
  41. :sortable="item.columnSortable"
  42. :prop="item.columnProp"
  43. :header-align="item.headerAlign"
  44. :show-overflow-tooltip="item.showOverflowTooltip"
  45. :align="item.align"
  46. :fixed="item.fixed==''?false:item.fixed"
  47. :min-width="item.columnWidth"
  48. :label="item.columnLabel">
  49. <template slot-scope="scope">
  50. <span v-if="!item.columnHidden"> {{ scope.row[item.columnProp] }}</span>
  51. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  52. </template>
  53. </el-table-column>
  54. <el-table-column
  55. header-align="center"
  56. align="center"
  57. width="150"
  58. fixed="right"
  59. label="操作">
  60. <template slot-scope="scope">
  61. <a type="text" size="small" @click="updateModel(scope.row)">修改</a>
  62. <a type="text" size="small" @click="deleteData(scope.row)">删除</a>
  63. </template>
  64. </el-table-column>
  65. </el-table>
  66. <el-pagination
  67. @size-change="sizeChangeHandle"
  68. @current-change="currentChangeHandle"
  69. :current-page="pageIndex"
  70. :page-sizes="[20, 50, 100, 1000]"
  71. :page-size="pageSize"
  72. :total="totalPage"
  73. layout="total, sizes, prev, pager, next, jumper">
  74. </el-pagination>
  75. <el-dialog
  76. width="600px"
  77. :title="!dataForm.id ? '添加' :'编辑'"
  78. :close-on-click-modal="false"
  79. :visible.sync="visible">
  80. <el-form :inline="true" label-position="top" label-width="100px" :rules="dataRole">
  81. <el-form-item :label="'项目料号'">
  82. <el-input v-model="dataForm.testPartNo" style="width: 130px" disabled></el-input>
  83. </el-form-item>
  84. <el-form-item prop="partTypeDesc" :rules="dataRole.partTypeDesc">
  85. <span slot="label" style="" @click="getBaseList(1013,1)"><a herf="#">物料类型</a></span>
  86. <el-input v-model="dataForm.partTypeDesc" style="width: 130px" readonly @focus="getBaseList(1013,1)" ></el-input>
  87. </el-form-item>
  88. </el-form>
  89. <el-form :inline="true" label-position="top" label-width="100px" :rules="dataRole">
  90. <el-form-item :label="'物料名称'" prop="partName" :rules="dataRole.partName">
  91. <el-input v-model="dataForm.partName" style="width: 562px" ></el-input>
  92. </el-form-item>
  93. </el-form>
  94. <el-form :inline="true" label-position="top" label-width="100px" >
  95. <el-form-item :label="'物料描述'">
  96. <el-input v-model="dataForm.partDesc" style="width: 562px" ></el-input>
  97. </el-form-item>
  98. </el-form>
  99. <el-form :inline="true" label-position="top" label-width="100px" >
  100. <el-form-item :label="'物料描述'">
  101. <el-input v-model="dataForm.partSpec" style="width: 562px" ></el-input>
  102. </el-form-item>
  103. </el-form>
  104. <el-form :inline="true" label-position="top" label-width="100px" >
  105. <el-form-item :label="'物料图号'">
  106. <el-input v-model="dataForm.materialNumber" style="width: 562px" ></el-input>
  107. </el-form-item>
  108. </el-form>
  109. <el-form :inline="true" label-position="top" label-width="100px" >
  110. <el-form-item :label="'备注'">
  111. <el-input v-model="dataForm.remark" style="width: 562px" ></el-input>
  112. </el-form-item>
  113. </el-form>
  114. <span slot="footer" class="dialog-footer">
  115. <el-button type="primary" @click="saveData()">{{'确定'}}</el-button>
  116. <el-button type="primary" @click="visible = false">{{'关闭'}}</el-button>
  117. </span>
  118. </el-dialog>
  119. <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="search" v-drag></add-or-update>
  120. <Chooselist ref="baseList" @getBaseData="getBaseData"></Chooselist>
  121. </div>
  122. </template>
  123. <script>
  124. import {
  125. technicalSpecificationListSearch,
  126. } from "@/api/sampleManagement/technicalSpecificationList.js"
  127. import Chooselist from '@/views/modules/common/Chooselist'
  128. import AddOrUpdate from './technicalSpecificationList'
  129. export default {
  130. components: {
  131. Chooselist,
  132. AddOrUpdate,
  133. },
  134. data() {
  135. return {
  136. addOrUpdateVisible:false,
  137. height:200,
  138. dataList: [],
  139. searchData: {
  140. page: 1,
  141. limit: 100,
  142. site: this.$store.state.user.site,
  143. username: this.$store.state.user.name,
  144. projectId: '',
  145. },
  146. pageIndex: 1,
  147. pageSize: 100,
  148. totalPage: 0,
  149. visible:false,
  150. dataListLoading: false,
  151. currentRow:'',
  152. columnList1:[
  153. {
  154. userId: this.$store.state.user.name,
  155. functionId: 103002,
  156. serialNumber: '103002Table1CodeNo',
  157. tableId: "103002Table1",
  158. tableName: "技术参数卡列表",
  159. columnProp: "codeNo",
  160. headerAlign: "center",
  161. align: "left",
  162. columnLabel: "参数卡编码",
  163. columnHidden: false,
  164. columnImage: false,
  165. columnSortable: false,
  166. sortLv: 0,
  167. status: true,
  168. fixed: '',
  169. columnWidth: 80
  170. },{
  171. userId: this.$store.state.user.name,
  172. functionId: 103002,
  173. serialNumber: '103002Table1Status',
  174. tableId: "103002Table1",
  175. tableName: "技术参数卡列表",
  176. columnProp: "statusDesc",
  177. headerAlign: "center",
  178. align: "left",
  179. columnLabel: "状态",
  180. columnHidden: false,
  181. columnImage: false,
  182. columnSortable: false,
  183. sortLv: 0,
  184. status: true,
  185. fixed: '',
  186. columnWidth: 50
  187. },{
  188. userId: this.$store.state.user.name,
  189. functionId: 103002,
  190. serialNumber: '103002Table1FinalPartNo',
  191. tableId: "103002Table1",
  192. tableName: "技术参数卡列表",
  193. columnProp: "finalPartNo",
  194. headerAlign: "center",
  195. align: "left",
  196. columnLabel: "最终产品编码",
  197. columnHidden: false,
  198. columnImage: false,
  199. columnSortable: false,
  200. sortLv: 0,
  201. status: true,
  202. fixed: '',
  203. columnWidth: 80
  204. },{
  205. userId: this.$store.state.user.name,
  206. functionId: 103002,
  207. serialNumber: '103002Table1TestPartNo',
  208. tableId: "103002Table1",
  209. tableName: "技术参数卡列表",
  210. columnProp: "testPartNo",
  211. headerAlign: "center",
  212. align: "left",
  213. columnLabel: "项目料号",
  214. columnHidden: false,
  215. columnImage: false,
  216. columnSortable: false,
  217. sortLv: 0,
  218. status: true,
  219. fixed: '',
  220. columnWidth: 80
  221. },{
  222. userId: this.$store.state.user.name,
  223. functionId: 103002,
  224. serialNumber: '103002Table1PartName',
  225. tableId: "103002Table1",
  226. tableName: "技术参数卡列表",
  227. columnProp: "partDesc",
  228. headerAlign: "center",
  229. align: "left",
  230. columnLabel: "物料名称",
  231. columnHidden: false,
  232. columnImage: false,
  233. columnSortable: false,
  234. sortLv: 0,
  235. status: true,
  236. fixed: '',
  237. columnWidth: 120
  238. },{
  239. userId: this.$store.state.user.name,
  240. functionId: 103002,
  241. serialNumber: '103002Table1RevNo',
  242. tableId: "103002Table1",
  243. tableName: "技术参数卡列表",
  244. columnProp: "revNo",
  245. headerAlign: "center",
  246. align: "left",
  247. columnLabel: "版本号",
  248. columnHidden: false,
  249. columnImage: false,
  250. columnSortable: false,
  251. sortLv: 0,
  252. status: true,
  253. fixed: '',
  254. columnWidth: 50
  255. },{
  256. userId: this.$store.state.user.name,
  257. functionId: 103002,
  258. serialNumber: '103002Table1ECNFlag',
  259. tableId: "103002Table1",
  260. tableName: "技术参数卡列表",
  261. columnProp: "ecnFlag",
  262. headerAlign: "center",
  263. align: "left",
  264. columnLabel: "ECN变更",
  265. columnHidden: false,
  266. columnImage: false,
  267. columnSortable: false,
  268. sortLv: 0,
  269. status: true,
  270. fixed: '',
  271. columnWidth: 50
  272. },{
  273. userId: this.$store.state.user.name,
  274. functionId: 103002,
  275. serialNumber: '103002Table1EcnNo',
  276. tableId: "103002Table1",
  277. tableName: "技术参数卡列表",
  278. columnProp: "ecnNo",
  279. headerAlign: "center",
  280. align: "left",
  281. columnLabel: "ECN单据号",
  282. columnHidden: false,
  283. columnImage: false,
  284. columnSortable: false,
  285. sortLv: 0,
  286. status: true,
  287. fixed: '',
  288. columnWidth: 80
  289. },{
  290. userId: this.$store.state.user.name,
  291. functionId: 103002,
  292. serialNumber: '103002Table1ProofingNo',
  293. tableId: "103002Table1",
  294. tableName: "技术参数卡列表",
  295. columnProp: "proofingNo",
  296. headerAlign: "center",
  297. align: "left",
  298. columnLabel: "打样申请单号",
  299. columnHidden: false,
  300. columnImage: false,
  301. columnSortable: false,
  302. sortLv: 0,
  303. status: true,
  304. fixed: '',
  305. columnWidth: 80
  306. },{
  307. userId: this.$store.state.user.name,
  308. functionId: 103002,
  309. serialNumber: '103002Table1CreateDate',
  310. tableId: "103002Table1",
  311. tableName: "技术参数卡列表",
  312. columnProp: "createDate",
  313. headerAlign: "center",
  314. align: "left",
  315. columnLabel: "创建时间",
  316. columnHidden: false,
  317. columnImage: false,
  318. columnSortable: false,
  319. sortLv: 0,
  320. status: true,
  321. fixed: '',
  322. columnWidth: 120
  323. },{
  324. userId: this.$store.state.user.name,
  325. functionId: 103002,
  326. serialNumber: '103002Table1CreateBy',
  327. tableId: "103002Table1",
  328. tableName: "技术参数卡列表",
  329. columnProp: "createBy",
  330. headerAlign: "center",
  331. align: "left",
  332. columnLabel: "创建人",
  333. columnHidden: false,
  334. columnImage: false,
  335. columnSortable: false,
  336. sortLv: 0,
  337. status: true,
  338. fixed: '',
  339. columnWidth: 80
  340. },{
  341. userId: this.$store.state.user.name,
  342. functionId: 103002,
  343. serialNumber: '103002Table1UpdateDate',
  344. tableId: "103002Table1",
  345. tableName: "技术参数卡列表",
  346. columnProp: "updateDate",
  347. headerAlign: "center",
  348. align: "left",
  349. columnLabel: "上次修改日期",
  350. columnHidden: false,
  351. columnImage: false,
  352. columnSortable: false,
  353. sortLv: 0,
  354. status: true,
  355. fixed: '',
  356. columnWidth: 120
  357. },{
  358. userId: this.$store.state.user.name,
  359. functionId: 103002,
  360. serialNumber: '103002Table1UpdateBy',
  361. tableId: "103002Table1",
  362. tableName: "技术参数卡列表",
  363. columnProp: "updateBy",
  364. headerAlign: "center",
  365. align: "left",
  366. columnLabel: "修改人",
  367. columnHidden: false,
  368. columnImage: false,
  369. columnSortable: false,
  370. sortLv: 0,
  371. status: true,
  372. fixed: '',
  373. columnWidth: 80
  374. },{
  375. userId: this.$store.state.user.name,
  376. functionId: 103002,
  377. serialNumber: '103002Table1ecnAddress',
  378. tableId: "103002Table1",
  379. tableName: "技术参数卡列表",
  380. columnProp: "ecnAddress",
  381. headerAlign: "center",
  382. align: "left",
  383. columnLabel: "ECN文档链接",
  384. columnHidden: false,
  385. columnImage: false,
  386. columnSortable: false,
  387. sortLv: 0,
  388. status: true,
  389. fixed: '',
  390. columnWidth: 200
  391. },
  392. ],
  393. dataForm:{
  394. id:'',
  395. site: '',
  396. projectId: '',
  397. testPartNo:'',
  398. partType:'',
  399. partTypeDesc:'',
  400. partName:'',
  401. partDesc:'',
  402. partSpec:'',
  403. remark:'',
  404. materialNumber:'',
  405. username:'',
  406. },
  407. dataRole: {
  408. partTypeDesc: [
  409. {
  410. required: true,
  411. message: ' ',
  412. trigger: 'change'
  413. }
  414. ],
  415. partName: [
  416. {
  417. required: true,
  418. message: ' ',
  419. trigger: 'change'
  420. }
  421. ],
  422. },
  423. // 导出 start
  424. exportData: [],
  425. exportName: '技术参数卡清单'+this.dayjs().format('YYYYMMDDHHmmss'),
  426. exportHeader: ["技术参数卡清单"],
  427. exportFooter: [],
  428. // 导出 end
  429. }
  430. },
  431. mounted() {
  432. this.$nextTick(() => {
  433. this.height = window.innerHeight - 520;
  434. })
  435. },
  436. methods: {
  437. // 每页数
  438. sizeChangeHandle (val) {
  439. this.pageSize = val
  440. this.pageIndex = 1
  441. this.search()
  442. },
  443. // 当前页
  444. currentChangeHandle (val) {
  445. this.pageIndex = val
  446. this.search()
  447. },
  448. search(){
  449. this.searchData.limit = this.pageSize
  450. this.searchData.page = this.pageIndex
  451. technicalSpecificationListSearch(this.searchData).then(({data}) => {
  452. if (data.code == 0) {
  453. this.dataList1 = data.page.list
  454. this.pageIndex = data.page.currPage
  455. this.pageSize = data.page.pageSize
  456. this.totalPage = data.page.totalCount
  457. }
  458. this.dataListLoading = false
  459. })
  460. },
  461. // 获取基础数据列表S
  462. getBaseList (val, type) {
  463. this.tagNo = val
  464. this.tagNo1 = type
  465. this.$nextTick(() => {
  466. let strVal = ''
  467. if (val === 1013) {
  468. if(type==1) {
  469. strVal = this.dataForm.partType
  470. }
  471. }
  472. this.$refs.baseList.init(val, strVal)
  473. })
  474. },
  475. /* 列表方法的回调 */
  476. getBaseData (val) {
  477. if (this.tagNo === 1013) {
  478. if(this.tagNo1==1) {
  479. this.dataForm.partType = val.Base_id
  480. this.dataForm.partTypeDesc = val.Base_desc
  481. }
  482. }
  483. },
  484. // 新增 / 修改
  485. addOrUpdateHandle (id) {
  486. this.addOrUpdateVisible = true
  487. this.$nextTick(() => {
  488. this.$refs.addOrUpdate.init(id)
  489. })
  490. },
  491. addModal(){
  492. if(this.searchData.projectId==""||this.searchData.projectId==null){
  493. this.$alert('请选择项目!', '错误', {
  494. confirmButtonText: '确定'
  495. })
  496. return false;
  497. }
  498. this.dataForm={
  499. id:0,
  500. site: this.searchData.site,
  501. projectId: this.searchData.projectId,
  502. testPartNo:'',
  503. partType:'',
  504. partTypeDesc:'',
  505. partName:'',
  506. partDesc:'',
  507. partSpec:'',
  508. remark:'',
  509. materialNumber:'',
  510. username:this.$store.state.user.name,
  511. }
  512. this.visible=true;
  513. },
  514. updateModel(row){
  515. this.dataForm={
  516. id:row.id,
  517. site: row.site,
  518. projectId: row.projectId,
  519. testPartNo:row.testPartNo,
  520. partType:row.partType,
  521. partTypeDesc:row.partTypeDesc,
  522. partName:row.partName,
  523. partDesc:row.partDesc,
  524. partSpec:row.partSpec,
  525. remark:row.remark,
  526. materialNumber:row.materialNumber,
  527. username:this.$store.state.user.name,
  528. }
  529. this.visible=true;
  530. },
  531. saveData(){
  532. if(this.dataForm.partType==''||this.dataForm.partType==null){
  533. this.$alert('请选择物料类别!', '错误', {
  534. confirmButtonText: '确定'
  535. })
  536. return false;
  537. }
  538. if(this.dataForm.partName==''||this.dataForm.partName==null){
  539. this.$alert('请输入物料名称!', '错误', {
  540. confirmButtonText: '确定'
  541. })
  542. return false;
  543. }
  544. saveProjectPart(this.dataForm).then(({data}) => {
  545. if (data && data.code === 0) {
  546. this.$message.success( '操作成功')
  547. this.visible = false
  548. this.searchTable();
  549. } else {
  550. this.$message.error(data.msg)
  551. }
  552. })
  553. },
  554. deleteData(){
  555. this.$confirm('确定要删除这条数据?', '提示', {
  556. confirmButtonText: '确定',
  557. cancelButtonText: '取消',
  558. type: 'warning'
  559. }).then(() => {
  560. deleteProjectPartWithId(this.dataForm).then(({data}) => {
  561. if (data && data.code === 0) {
  562. this.$message.success( '操作成功')
  563. this.searchTable();
  564. } else {
  565. this.$message.error(data.msg)
  566. }
  567. })
  568. }).catch(() => {
  569. })
  570. },
  571. //导出excel
  572. createExportData() {
  573. return this.dataList;
  574. },
  575. startDownload() {
  576. // this.exportData = this.dataList
  577. },
  578. finishDownload() {
  579. },
  580. fields() {
  581. let json = "{"
  582. this.columnList1.forEach((item, index) => {
  583. if (index == this.columnList1.length - 1) {
  584. json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\""
  585. } else {
  586. json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\"" + ","
  587. }
  588. })
  589. json += "}"
  590. let s = eval("(" + json + ")")
  591. return s
  592. },
  593. },
  594. }
  595. </script>
  596. <style scoped>
  597. </style>