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.

420 lines
13 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. </el-form>
  7. </el-form>
  8. <el-table
  9. :data="dataList"
  10. height="240"
  11. border
  12. v-loading="dataListLoading"
  13. style="width: 100%; ">
  14. <el-table-column
  15. v-for="(item,index) in columnList" :key="index"
  16. :sortable="item.columnSortable"
  17. :prop="item.columnProp"
  18. :header-align="item.headerAlign"
  19. :show-overflow-tooltip="item.showOverflowTooltip"
  20. :align="item.align"
  21. :fixed="item.fixed==''?false:item.fixed"
  22. :min-width="item.columnWidth"
  23. :label="item.columnLabel">
  24. <template slot-scope="scope">
  25. <span v-if="!item.columnHidden"> {{ scope.row[item.columnProp] }}</span>
  26. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]"
  27. style="width: 100px; height: 80px"/></span>
  28. </template>
  29. </el-table-column>
  30. </el-table>
  31. <el-dialog
  32. width="600px"
  33. :title="!dataForm.id ? '添加' :'编辑'"
  34. :close-on-click-modal="false"
  35. :visible.sync="visible">
  36. <el-form :inline="true" label-position="top" label-width="100px" >
  37. <el-form-item :label="'项目料号'">
  38. <el-input v-model="dataForm.testPartNo" style="width: 130px" disabled></el-input>
  39. </el-form-item>
  40. <el-form-item >
  41. <span slot="label" style="" @click="getBaseList(1013,1)"><a herf="#">物料类型</a></span>
  42. <el-input v-model="dataForm.partTypeDesc" style="width: 130px" readonly @focus="getBaseList(1013,1)"></el-input>
  43. </el-form-item>
  44. </el-form>
  45. <el-form :inline="true" label-position="top" label-width="100px" >
  46. <el-form-item :label="'物料名称'">
  47. <el-input v-model="dataForm.partName" style="width: 562px" ></el-input>
  48. </el-form-item>
  49. </el-form>
  50. <el-form :inline="true" label-position="top" label-width="100px" >
  51. <el-form-item :label="'物料描述'">
  52. <el-input v-model="dataForm.partDesc" style="width: 562px" ></el-input>
  53. </el-form-item>
  54. </el-form>
  55. <el-form :inline="true" label-position="top" label-width="100px" >
  56. <el-form-item :label="'物料描述'">
  57. <el-input v-model="dataForm.partSpec" style="width: 562px" ></el-input>
  58. </el-form-item>
  59. </el-form>
  60. <el-form :inline="true" label-position="top" label-width="100px" >
  61. <el-form-item :label="'物料图号'">
  62. <el-input v-model="dataForm.materialNumber" style="width: 562px" ></el-input>
  63. </el-form-item>
  64. </el-form>
  65. <el-form :inline="true" label-position="top" label-width="100px" >
  66. <el-form-item :label="'备注'">
  67. <el-input v-model="dataForm.remark" style="width: 562px" ></el-input>
  68. </el-form-item>
  69. </el-form>
  70. <span slot="footer" class="dialog-footer">
  71. <el-button type="primary" @click="saveData()">{{'确定'}}</el-button>
  72. <el-button type="primary" @click="visible = false">{{'关闭'}}</el-button>
  73. </span>
  74. </el-dialog>
  75. <Chooselist ref="baseList" @getBaseData="getBaseData"></Chooselist>
  76. </div>
  77. </template>
  78. <script>
  79. import {
  80. getProjectInfoPartList,
  81. saveProjectPart,
  82. } from "@/api/project/project.js"
  83. import Chooselist from '@/views/modules/common/Chooselist'
  84. export default {
  85. components: {
  86. Chooselist
  87. },
  88. data() {
  89. return {
  90. dataList: [],
  91. searchData: {
  92. site: '',
  93. username: this.$store.state.user.name,
  94. projectId: '',
  95. },
  96. visible:false,
  97. dataListLoading: false,
  98. currentRow:'',
  99. columnList:[
  100. {
  101. userId: this.$store.state.user.name,
  102. functionId: 101002003,
  103. serialNumber: '101002003Table3TestPartNo',
  104. tableId: "101002003Table3",
  105. tableName: "项目物料",
  106. columnProp: "testPartNo",
  107. headerAlign: "center",
  108. align: "left",
  109. columnLabel: "物料编码",
  110. columnHidden: false,
  111. columnImage: false,
  112. columnSortable: false,
  113. sortLv: 0,
  114. status: true,
  115. fixed: '',
  116. columnWidth: 80
  117. },{
  118. userId: this.$store.state.user.name,
  119. functionId: 101002003,
  120. serialNumber: '101002003Table3PartType',
  121. tableId: "101002003Table3",
  122. tableName: "项目物料",
  123. columnProp: "partType",
  124. headerAlign: "center",
  125. align: "left",
  126. columnLabel: "物料分类",
  127. columnHidden: false,
  128. columnImage: false,
  129. columnSortable: false,
  130. sortLv: 0,
  131. status: true,
  132. fixed: '',
  133. columnWidth: 60
  134. },{
  135. userId: this.$store.state.user.name,
  136. functionId: 101002003,
  137. serialNumber: '101002003Table3PartTypeDesc',
  138. tableId: "101002003Table3",
  139. tableName: "项目物料",
  140. columnProp: "partTypeDesc",
  141. headerAlign: "center",
  142. align: "left",
  143. columnLabel: "物料分类名称",
  144. columnHidden: false,
  145. columnImage: false,
  146. columnSortable: false,
  147. sortLv: 0,
  148. status: true,
  149. fixed: '',
  150. columnWidth: 80
  151. },{
  152. userId: this.$store.state.user.name,
  153. functionId: 101002003,
  154. serialNumber: '101002003Table3PartName',
  155. tableId: "101002003Table3",
  156. tableName: "项目物料",
  157. columnProp: "partName",
  158. headerAlign: "center",
  159. align: "left",
  160. columnLabel: "物料名称",
  161. columnHidden: false,
  162. columnImage: false,
  163. columnSortable: false,
  164. sortLv: 0,
  165. status: true,
  166. fixed: '',
  167. columnWidth: 120
  168. },{
  169. userId: this.$store.state.user.name,
  170. functionId: 101002003,
  171. serialNumber: '101002003Table3PartDesc',
  172. tableId: "101002003Table3",
  173. tableName: "项目物料",
  174. columnProp: "partDesc",
  175. headerAlign: "center",
  176. align: "left",
  177. columnLabel: "物料描述",
  178. columnHidden: false,
  179. columnImage: false,
  180. columnSortable: false,
  181. sortLv: 0,
  182. status: true,
  183. fixed: '',
  184. columnWidth: 120
  185. },{
  186. userId: this.$store.state.user.name,
  187. functionId: 101002003,
  188. serialNumber: '101002003Table3PartSpec',
  189. tableId: "101002003Table3",
  190. tableName: "项目物料",
  191. columnProp: "partSpec",
  192. headerAlign: "center",
  193. align: "left",
  194. columnLabel: "规格型号",
  195. columnHidden: false,
  196. columnImage: false,
  197. columnSortable: false,
  198. sortLv: 0,
  199. status: true,
  200. fixed: '',
  201. columnWidth: 120
  202. },{
  203. userId: this.$store.state.user.name,
  204. functionId: 101002003,
  205. serialNumber: '101002003Table3MaterialNumber',
  206. tableId: "101002003Table3",
  207. tableName: "项目物料",
  208. columnProp: "materialNumber",
  209. headerAlign: "center",
  210. align: "left",
  211. columnLabel: "物料图号",
  212. columnHidden: false,
  213. columnImage: false,
  214. columnSortable: false,
  215. sortLv: 0,
  216. status: true,
  217. fixed: '',
  218. columnWidth: 120
  219. },{
  220. userId: this.$store.state.user.name,
  221. functionId: 101002003,
  222. serialNumber: '101002003Table3Remark',
  223. tableId: "101002003Table3",
  224. tableName: "项目物料",
  225. columnProp: "remark",
  226. headerAlign: "center",
  227. align: "left",
  228. columnLabel: "备注",
  229. columnHidden: false,
  230. columnImage: false,
  231. columnSortable: false,
  232. sortLv: 0,
  233. status: true,
  234. fixed: '',
  235. columnWidth: 120
  236. },{
  237. userId: this.$store.state.user.name,
  238. functionId: 101002003,
  239. serialNumber: '101002003Table3CreateDate',
  240. tableId: "101002003Table3",
  241. tableName: "项目物料",
  242. columnProp: "createDate",
  243. headerAlign: "center",
  244. align: "left",
  245. columnLabel: "创建时间",
  246. columnHidden: false,
  247. columnImage: false,
  248. columnSortable: false,
  249. sortLv: 0,
  250. status: true,
  251. fixed: '',
  252. columnWidth: 160
  253. },{
  254. userId: this.$store.state.user.name,
  255. functionId: 101002003,
  256. serialNumber: '101002003Table3CreateBy',
  257. tableId: "101002003Table3",
  258. tableName: "项目物料",
  259. columnProp: "createBy",
  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: 80
  270. },{
  271. userId: this.$store.state.user.name,
  272. functionId: 101002003,
  273. serialNumber: '101002003Table3UpdateDate',
  274. tableId: "101002003Table3",
  275. tableName: "项目物料",
  276. columnProp: "updateDate",
  277. headerAlign: "center",
  278. align: "left",
  279. columnLabel: "上次修改日期",
  280. columnHidden: false,
  281. columnImage: false,
  282. columnSortable: false,
  283. sortLv: 0,
  284. status: true,
  285. fixed: '',
  286. columnWidth: 160
  287. },{
  288. userId: this.$store.state.user.name,
  289. functionId: 101002003,
  290. serialNumber: '101002003Table3UpdateBy',
  291. tableId: "101002003Table3",
  292. tableName: "项目物料",
  293. columnProp: "updateBy",
  294. headerAlign: "center",
  295. align: "left",
  296. columnLabel: "修改人",
  297. columnHidden: false,
  298. columnImage: false,
  299. columnSortable: false,
  300. sortLv: 0,
  301. status: true,
  302. fixed: '',
  303. columnWidth: 80
  304. },
  305. ],
  306. dataForm:{
  307. id:'',
  308. site: '',
  309. projectId: '',
  310. testPartNo:'',
  311. partType:'',
  312. partTypeDesc:'',
  313. partName:'',
  314. partDesc:'',
  315. partSpec:'',
  316. remark:'',
  317. materialNumber:'',
  318. username:'',
  319. },
  320. }
  321. },
  322. methods: {
  323. // 获取基础数据列表S
  324. getBaseList (val, type) {
  325. this.tagNo = val
  326. this.tagNo1 = type
  327. this.$nextTick(() => {
  328. let strVal = ''
  329. if (val === 1013) {
  330. if(type==1) {
  331. strVal = this.dataForm.partType
  332. }
  333. }
  334. this.$refs.baseList.init(val, strVal)
  335. })
  336. },
  337. /* 列表方法的回调 */
  338. getBaseData (val) {
  339. if (this.tagNo === 1013) {
  340. if(this.tagNo1==1) {
  341. this.dataForm.partType = val.Base_id
  342. this.dataForm.partTypeDesc = val.Base_desc
  343. }
  344. }
  345. },
  346. //初始化组件的参数
  347. init(inData) {
  348. //初始化参数
  349. this.searchData = JSON.parse(JSON.stringify(inData));
  350. //刷新表格
  351. this.searchTable();
  352. },
  353. searchTable(){
  354. getProjectInfoPartList(this.searchData).then(({data}) => {
  355. //区分请求成功和失败的状况
  356. if (data && data.code == 0) {
  357. this.dataList = data.rows;
  358. } else {
  359. this.dataList = [];
  360. }
  361. });
  362. },
  363. /*关闭modal*/
  364. closeDialog(){
  365. //刷新报工的页面
  366. this.$emit('refreshPageTables');
  367. //关闭当前的页面
  368. this.visible = false;
  369. },
  370. addModal(){
  371. this.dataForm={
  372. id:0,
  373. site: this.searchData.site,
  374. projectId: this.searchData.projectId,
  375. testPartNo:'',
  376. partType:'',
  377. partTypeDesc:'',
  378. partName:'',
  379. partDesc:'',
  380. partSpec:'',
  381. remark:'',
  382. materialNumber:'',
  383. username:this.$store.state.user.name,
  384. }
  385. this.visible=true;
  386. },
  387. saveData(){
  388. if(this.dataForm.partType==''||this.dataForm.partType==null){
  389. this.$alert('请选择物料类别!', '错误', {
  390. confirmButtonText: '确定'
  391. })
  392. return false;
  393. }
  394. if(this.dataForm.partName==''||this.dataForm.partName==null){
  395. this.$alert('请输入物料名称!', '错误', {
  396. confirmButtonText: '确定'
  397. })
  398. return false;
  399. }
  400. saveProjectPart(this.dataForm).then(({data}) => {
  401. if (data && data.code === 0) {
  402. this.$message.success( '操作成功')
  403. this.visible = false
  404. this.searchTable();
  405. } else {
  406. this.$message.error(data.msg)
  407. }
  408. })
  409. },
  410. },
  411. }
  412. </script>
  413. <style scoped>
  414. </style>