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.

481 lines
15 KiB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
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-column
  31. header-align="center"
  32. align="center"
  33. width="150"
  34. fixed="right"
  35. label="操作">
  36. <template slot-scope="scope">
  37. <a type="text" size="small" @click="updateModel(scope.row)">修改</a>
  38. <a type="text" size="small" @click="deleteData(scope.row)">删除</a>
  39. </template>
  40. </el-table-column>
  41. </el-table>
  42. <el-dialog
  43. width="600px"
  44. :title="!dataForm.id ? '添加' :'编辑'"
  45. :close-on-click-modal="false"
  46. :visible.sync="visible">
  47. <el-form :inline="true" label-position="top" label-width="100px" :rules="dataRole">
  48. <el-form-item :label="'项目料号'">
  49. <el-input v-model="dataForm.testPartNo" style="width: 130px" disabled></el-input>
  50. </el-form-item>
  51. <el-form-item prop="partTypeDesc" :rules="dataRole.partTypeDesc">
  52. <span slot="label" style="" @click="getBaseList(1013,1)"><a herf="#">物料类型</a></span>
  53. <el-input v-model="dataForm.partTypeDesc" style="width: 130px" readonly @focus="getBaseList(1013,1)" ></el-input>
  54. </el-form-item>
  55. </el-form>
  56. <el-form :inline="true" label-position="top" label-width="100px" :rules="dataRole">
  57. <el-form-item :label="'物料名称'" prop="partName" :rules="dataRole.partName">
  58. <el-input v-model="dataForm.partName" style="width: 562px" ></el-input>
  59. </el-form-item>
  60. </el-form>
  61. <el-form :inline="true" label-position="top" label-width="100px" >
  62. <el-form-item :label="'物料描述'">
  63. <el-input v-model="dataForm.partDesc" style="width: 562px" ></el-input>
  64. </el-form-item>
  65. </el-form>
  66. <el-form :inline="true" label-position="top" label-width="100px" >
  67. <el-form-item :label="'物料描述'">
  68. <el-input v-model="dataForm.partSpec" style="width: 562px" ></el-input>
  69. </el-form-item>
  70. </el-form>
  71. <el-form :inline="true" label-position="top" label-width="100px" >
  72. <el-form-item :label="'物料图号'">
  73. <el-input v-model="dataForm.materialNumber" style="width: 562px" ></el-input>
  74. </el-form-item>
  75. </el-form>
  76. <el-form :inline="true" label-position="top" label-width="100px" >
  77. <el-form-item :label="'备注'">
  78. <el-input v-model="dataForm.remark" style="width: 562px" ></el-input>
  79. </el-form-item>
  80. </el-form>
  81. <span slot="footer" class="dialog-footer">
  82. <el-button type="primary" @click="saveData()">{{'确定'}}</el-button>
  83. <el-button type="primary" @click="visible = false">{{'关闭'}}</el-button>
  84. </span>
  85. </el-dialog>
  86. <Chooselist ref="baseList" @getBaseData="getBaseData"></Chooselist>
  87. </div>
  88. </template>
  89. <script>
  90. import {
  91. getProjectInfoPartList,
  92. saveProjectPart,
  93. deleteProjectPartWithId,
  94. } from "@/api/project/project.js"
  95. import Chooselist from '@/views/modules/common/Chooselist'
  96. export default {
  97. components: {
  98. Chooselist
  99. },
  100. data() {
  101. return {
  102. dataList: [],
  103. searchData: {
  104. site: '',
  105. username: this.$store.state.user.name,
  106. projectId: '',
  107. },
  108. visible:false,
  109. dataListLoading: false,
  110. currentRow:'',
  111. columnList:[
  112. {
  113. userId: this.$store.state.user.name,
  114. functionId: 101002003,
  115. serialNumber: '101002003Table4TestPartNo',
  116. tableId: "101002003Table4",
  117. tableName: "项目物料",
  118. columnProp: "testPartNo",
  119. headerAlign: "center",
  120. align: "left",
  121. columnLabel: "物料编码",
  122. columnHidden: false,
  123. columnImage: false,
  124. columnSortable: false,
  125. sortLv: 0,
  126. status: true,
  127. fixed: '',
  128. columnWidth: 80
  129. },{
  130. userId: this.$store.state.user.name,
  131. functionId: 101002003,
  132. serialNumber: '101002003Table4PartType',
  133. tableId: "101002003Table4",
  134. tableName: "项目物料",
  135. columnProp: "partType",
  136. headerAlign: "center",
  137. align: "left",
  138. columnLabel: "物料分类",
  139. columnHidden: false,
  140. columnImage: false,
  141. columnSortable: false,
  142. sortLv: 0,
  143. status: true,
  144. fixed: '',
  145. columnWidth: 60
  146. },{
  147. userId: this.$store.state.user.name,
  148. functionId: 101002003,
  149. serialNumber: '101002003Table4PartTypeDesc',
  150. tableId: "101002003Table4",
  151. tableName: "项目物料",
  152. columnProp: "partTypeDesc",
  153. headerAlign: "center",
  154. align: "left",
  155. columnLabel: "物料分类名称",
  156. columnHidden: false,
  157. columnImage: false,
  158. columnSortable: false,
  159. sortLv: 0,
  160. status: true,
  161. fixed: '',
  162. columnWidth: 80
  163. },{
  164. userId: this.$store.state.user.name,
  165. functionId: 101002003,
  166. serialNumber: '101002003Table4PartName',
  167. tableId: "101002003Table4",
  168. tableName: "项目物料",
  169. columnProp: "partName",
  170. headerAlign: "center",
  171. align: "left",
  172. columnLabel: "物料名称",
  173. columnHidden: false,
  174. columnImage: false,
  175. columnSortable: false,
  176. sortLv: 0,
  177. status: true,
  178. fixed: '',
  179. columnWidth: 120
  180. },{
  181. userId: this.$store.state.user.name,
  182. functionId: 101002003,
  183. serialNumber: '101002003Table4PartDesc',
  184. tableId: "101002003Table4",
  185. tableName: "项目物料",
  186. columnProp: "partDesc",
  187. headerAlign: "center",
  188. align: "left",
  189. columnLabel: "物料描述",
  190. columnHidden: false,
  191. columnImage: false,
  192. columnSortable: false,
  193. sortLv: 0,
  194. status: true,
  195. fixed: '',
  196. columnWidth: 120
  197. },{
  198. userId: this.$store.state.user.name,
  199. functionId: 101002003,
  200. serialNumber: '101002003Table4PartSpec',
  201. tableId: "101002003Table4",
  202. tableName: "项目物料",
  203. columnProp: "partSpec",
  204. headerAlign: "center",
  205. align: "left",
  206. columnLabel: "规格型号",
  207. columnHidden: false,
  208. columnImage: false,
  209. columnSortable: false,
  210. sortLv: 0,
  211. status: true,
  212. fixed: '',
  213. columnWidth: 120
  214. },{
  215. userId: this.$store.state.user.name,
  216. functionId: 101002003,
  217. serialNumber: '101002003Table4MaterialNumber',
  218. tableId: "101002003Table4",
  219. tableName: "项目物料",
  220. columnProp: "materialNumber",
  221. headerAlign: "center",
  222. align: "left",
  223. columnLabel: "物料图号",
  224. columnHidden: false,
  225. columnImage: false,
  226. columnSortable: false,
  227. sortLv: 0,
  228. status: true,
  229. fixed: '',
  230. columnWidth: 120
  231. },{
  232. userId: this.$store.state.user.name,
  233. functionId: 101002003,
  234. serialNumber: '101002003Table4Remark',
  235. tableId: "101002003Table4",
  236. tableName: "项目物料",
  237. columnProp: "remark",
  238. headerAlign: "center",
  239. align: "left",
  240. columnLabel: "备注",
  241. columnHidden: false,
  242. columnImage: false,
  243. columnSortable: false,
  244. sortLv: 0,
  245. status: true,
  246. fixed: '',
  247. columnWidth: 120
  248. },{
  249. userId: this.$store.state.user.name,
  250. functionId: 101002003,
  251. serialNumber: '101002003Table4CreateDate',
  252. tableId: "101002003Table4",
  253. tableName: "项目物料",
  254. columnProp: "createDate",
  255. headerAlign: "center",
  256. align: "left",
  257. columnLabel: "创建时间",
  258. columnHidden: false,
  259. columnImage: false,
  260. columnSortable: false,
  261. sortLv: 0,
  262. status: true,
  263. fixed: '',
  264. columnWidth: 160
  265. },{
  266. userId: this.$store.state.user.name,
  267. functionId: 101002003,
  268. serialNumber: '101002003Table4CreateBy',
  269. tableId: "101002003Table4",
  270. tableName: "项目物料",
  271. columnProp: "createBy",
  272. headerAlign: "center",
  273. align: "left",
  274. columnLabel: "创建人",
  275. columnHidden: false,
  276. columnImage: false,
  277. columnSortable: false,
  278. sortLv: 0,
  279. status: true,
  280. fixed: '',
  281. columnWidth: 80
  282. },{
  283. userId: this.$store.state.user.name,
  284. functionId: 101002003,
  285. serialNumber: '101002003Table4UpdateDate',
  286. tableId: "101002003Table4",
  287. tableName: "项目物料",
  288. columnProp: "updateDate",
  289. headerAlign: "center",
  290. align: "left",
  291. columnLabel: "上次修改日期",
  292. columnHidden: false,
  293. columnImage: false,
  294. columnSortable: false,
  295. sortLv: 0,
  296. status: true,
  297. fixed: '',
  298. columnWidth: 160
  299. },{
  300. userId: this.$store.state.user.name,
  301. functionId: 101002003,
  302. serialNumber: '101002003Table4UpdateBy',
  303. tableId: "101002003Table4",
  304. tableName: "项目物料",
  305. columnProp: "updateBy",
  306. headerAlign: "center",
  307. align: "left",
  308. columnLabel: "修改人",
  309. columnHidden: false,
  310. columnImage: false,
  311. columnSortable: false,
  312. sortLv: 0,
  313. status: true,
  314. fixed: '',
  315. columnWidth: 80
  316. },
  317. ],
  318. dataForm:{
  319. id:'',
  320. site: '',
  321. projectId: '',
  322. testPartNo:'',
  323. partType:'',
  324. partTypeDesc:'',
  325. partName:'',
  326. partDesc:'',
  327. partSpec:'',
  328. remark:'',
  329. materialNumber:'',
  330. username:'',
  331. },
  332. dataRole: {
  333. partTypeDesc: [
  334. {
  335. required: true,
  336. message: ' ',
  337. trigger: 'change'
  338. }
  339. ],
  340. partName: [
  341. {
  342. required: true,
  343. message: ' ',
  344. trigger: 'change'
  345. }
  346. ],
  347. }
  348. }
  349. },
  350. methods: {
  351. // 获取基础数据列表S
  352. getBaseList (val, type) {
  353. this.tagNo = val
  354. this.tagNo1 = type
  355. this.$nextTick(() => {
  356. let strVal = ''
  357. if (val === 1013) {
  358. if(type==1) {
  359. strVal = this.dataForm.partType
  360. }
  361. }
  362. this.$refs.baseList.init(val, strVal)
  363. })
  364. },
  365. /* 列表方法的回调 */
  366. getBaseData (val) {
  367. if (this.tagNo === 1013) {
  368. if(this.tagNo1==1) {
  369. this.dataForm.partType = val.Base_id
  370. this.dataForm.partTypeDesc = val.Base_desc
  371. }
  372. }
  373. },
  374. //初始化组件的参数
  375. init(inData) {
  376. //初始化参数
  377. this.searchData = JSON.parse(JSON.stringify(inData));
  378. //刷新表格
  379. this.searchTable();
  380. },
  381. searchTable(){
  382. getProjectInfoPartList(this.searchData).then(({data}) => {
  383. //区分请求成功和失败的状况
  384. if (data && data.code == 0) {
  385. this.dataList = data.rows;
  386. } else {
  387. this.dataList = [];
  388. }
  389. });
  390. },
  391. addModal(){
  392. if(this.searchData.projectId==""||this.searchData.projectId==null){
  393. this.$alert('请选择项目!', '错误', {
  394. confirmButtonText: '确定'
  395. })
  396. return false;
  397. }
  398. this.dataForm={
  399. id:0,
  400. site: this.searchData.site,
  401. projectId: this.searchData.projectId,
  402. testPartNo:'',
  403. partType:'',
  404. partTypeDesc:'',
  405. partName:'',
  406. partDesc:'',
  407. partSpec:'',
  408. remark:'',
  409. materialNumber:'',
  410. username:this.$store.state.user.name,
  411. }
  412. this.visible=true;
  413. },
  414. updateModel(row){
  415. this.dataForm={
  416. id:row.id,
  417. site: row.site,
  418. projectId: row.projectId,
  419. testPartNo:row.testPartNo,
  420. partType:row.partType,
  421. partTypeDesc:row.partTypeDesc,
  422. partName:row.partName,
  423. partDesc:row.partDesc,
  424. partSpec:row.partSpec,
  425. remark:row.remark,
  426. materialNumber:row.materialNumber,
  427. username:this.$store.state.user.name,
  428. }
  429. this.visible=true;
  430. },
  431. saveData(){
  432. if(this.dataForm.partType==''||this.dataForm.partType==null){
  433. this.$alert('请选择物料类别!', '错误', {
  434. confirmButtonText: '确定'
  435. })
  436. return false;
  437. }
  438. if(this.dataForm.partName==''||this.dataForm.partName==null){
  439. this.$alert('请输入物料名称!', '错误', {
  440. confirmButtonText: '确定'
  441. })
  442. return false;
  443. }
  444. saveProjectPart(this.dataForm).then(({data}) => {
  445. if (data && data.code === 0) {
  446. this.$message.success( '操作成功')
  447. this.visible = false
  448. this.searchTable();
  449. } else {
  450. this.$message.error(data.msg)
  451. }
  452. })
  453. },
  454. deleteData(){
  455. this.$confirm('确定要删除这条数据?', '提示', {
  456. confirmButtonText: '确定',
  457. cancelButtonText: '取消',
  458. type: 'warning'
  459. }).then(() => {
  460. deleteProjectPartWithId(this.dataForm).then(({data}) => {
  461. if (data && data.code === 0) {
  462. this.$message.success( '操作成功')
  463. this.searchTable();
  464. } else {
  465. this.$message.error(data.msg)
  466. }
  467. })
  468. }).catch(() => {
  469. })
  470. },
  471. },
  472. }
  473. </script>
  474. <style scoped>
  475. </style>