details.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439
  1. <template>
  2. <div class="content-height p20">
  3. <div class="page-title">
  4. <el-page-header @back="goBack">
  5. <div slot="content" class="pageContent">
  6. <div>物品详情 </div>
  7. <el-form class="topform">
  8. <el-form-item label="物品类型" label-width="70px">
  9. <span>{{ itemValue }}</span>
  10. </el-form-item>
  11. </el-form>
  12. </div>
  13. </el-page-header>
  14. </div>
  15. <div class="table-container">
  16. <div class="tree-col">
  17. <ItemDetail ref="itemDetailRef" :customForm="customForm" />
  18. </div>
  19. <div class="attribute-row">
  20. <RowDetail
  21. ref="rowDetailRef"
  22. :customForm="customForm"
  23. :defaultNum="defaultNum"
  24. />
  25. <div
  26. class="row-table"
  27. v-if="defaultNum != '8' && defaultNum != '2' && defaultNum != '5'"
  28. >
  29. <el-tabs v-model="activeName" type="card">
  30. <el-tab-pane
  31. label="匹配产品"
  32. name="product"
  33. v-if="defaultNum == '3' || defaultNum == '6'"
  34. >
  35. <el-table
  36. :data="productData"
  37. class="table-box"
  38. :header-cell-style="{ background: '#F0F3F3', border: 'none' }"
  39. >
  40. <el-table-column type="index" label="序号" width="50">
  41. </el-table-column>
  42. <el-table-column prop="informationCode" label="物品编码">
  43. </el-table-column>
  44. <el-table-column prop="informationName" label="物品名称">
  45. </el-table-column>
  46. <el-table-column prop="brandNum" label="牌号">
  47. </el-table-column>
  48. <el-table-column prop="modelType" label="型号">
  49. </el-table-column>
  50. <el-table-column
  51. label="物品类型"
  52. prop="classificationCode"
  53. :formatter="classificationCodeFormatter"
  54. >
  55. </el-table-column>
  56. <el-table-column prop="classificationUrl" label="分类">
  57. </el-table-column>
  58. </el-table>
  59. </el-tab-pane>
  60. <el-tab-pane
  61. label="匹配模具"
  62. name="mould"
  63. v-if="defaultNum == '1' || defaultNum == '4'"
  64. >
  65. <el-table
  66. :data="mouldData"
  67. class="table-box"
  68. :header-cell-style="{ background: '#F0F3F3', border: 'none' }"
  69. >
  70. <el-table-column type="index" label="序号" width="50">
  71. </el-table-column>
  72. <el-table-column prop="informationCode" label="物品编码">
  73. </el-table-column>
  74. <el-table-column prop="informationName" label="物品名称">
  75. </el-table-column>
  76. <el-table-column prop="brandNum" label="牌号">
  77. </el-table-column>
  78. <el-table-column prop="modelType" label="型号">
  79. </el-table-column>
  80. <el-table-column
  81. label="物品类型"
  82. prop="classificationCode"
  83. :formatter="classificationCodeFormatter"
  84. >
  85. </el-table-column>
  86. <el-table-column prop="classificationUrl" label="分类">
  87. </el-table-column>
  88. </el-table>
  89. </el-tab-pane>
  90. <el-tab-pane
  91. label="匹配备品备件"
  92. name="part"
  93. v-if="defaultNum == '1'"
  94. >
  95. <el-table
  96. :data="partData"
  97. class="table-box"
  98. :header-cell-style="{ background: '#F0F3F3', border: 'none' }"
  99. >
  100. <el-table-column type="index" label="序号" width="50">
  101. </el-table-column>
  102. <el-table-column prop="informationCode" label="物品编码">
  103. </el-table-column>
  104. <el-table-column prop="informationName" label="物品名称">
  105. </el-table-column>
  106. <el-table-column prop="modelType" label="型号">
  107. </el-table-column>
  108. <el-table-column
  109. label="物品类型"
  110. prop="classificationCode"
  111. :formatter="classificationCodeFormatter"
  112. >
  113. </el-table-column>
  114. <el-table-column prop="classificationUrl" label="分类">
  115. </el-table-column>
  116. </el-table>
  117. </el-tab-pane>
  118. <el-tab-pane label="BOM表" name="bom" v-if="defaultNum == '4'">
  119. <div class="bom-top">
  120. <div class="top-input">
  121. <span>基本数量</span>
  122. <div class="input-box">{{ customForm.basicNum }}</div>
  123. <span>{{ customForm.measuringUnit }}</span>
  124. </div>
  125. </div>
  126. <el-table
  127. :data="bomData"
  128. class="table-box"
  129. :header-cell-style="{ background: '#F0F3F3', border: 'none' }"
  130. >
  131. <el-table-column type="index" label="序号" width="50">
  132. </el-table-column>
  133. <el-table-column prop="informationCode" label="物品编码">
  134. </el-table-column>
  135. <el-table-column prop="informationName" label="物品名称">
  136. </el-table-column>
  137. <el-table-column prop="brandNum" label="牌号">
  138. </el-table-column>
  139. <el-table-column
  140. label="物品类型"
  141. prop="classificationCode"
  142. :formatter="classificationCodeFormatter"
  143. >
  144. </el-table-column>
  145. <el-table-column prop="classificationUrl" label="分类">
  146. </el-table-column>
  147. <el-table-column prop="num" label="数量"> </el-table-column>
  148. <el-table-column prop="date" label="计量单位">
  149. </el-table-column>
  150. </el-table>
  151. </el-tab-pane>
  152. <el-tab-pane
  153. label="匹配设备"
  154. name="facility"
  155. v-if="defaultNum == '6' || defaultNum == '7'"
  156. >
  157. <el-table
  158. :data="facilityData"
  159. class="table-box"
  160. :header-cell-style="{ background: '#F0F3F3', border: 'none' }"
  161. >
  162. <el-table-column type="index" label="序号" width="50">
  163. </el-table-column>
  164. <el-table-column prop="informationCode" label="物品编码">
  165. </el-table-column>
  166. <el-table-column prop="informationName" label="物品名称">
  167. </el-table-column>
  168. <el-table-column prop="modelType" label="型号">
  169. </el-table-column>
  170. <el-table-column
  171. label="物品类型"
  172. prop="classificationCode"
  173. :formatter="classificationCodeFormatter"
  174. >
  175. </el-table-column>
  176. <el-table-column prop="classificationUrl" label="分类">
  177. </el-table-column>
  178. </el-table>
  179. </el-tab-pane>
  180. <!-- <div class="pagination">
  181. <el-pagination
  182. background
  183. layout="total, sizes, prev, pager, next, jumper"
  184. :total="pagination.total"
  185. :page-sizes="[5, 10, 20, 50, 100]"
  186. :page-size="pagination.size"
  187. :current-page.sync="pagination.page"
  188. @current-change="handleCurrent"
  189. @size-change="handleSize"
  190. >
  191. </el-pagination>
  192. </div> -->
  193. </el-tabs>
  194. </div>
  195. </div>
  196. </div>
  197. </div>
  198. </template>
  199. <script>
  200. import ItemDetail from './components/ItemDetail';
  201. import RowDetail from './components/RowDetail';
  202. import { getDetails } from '@/api/classifyManage/itemInformation';
  203. export default {
  204. components: { ItemDetail, RowDetail },
  205. data () {
  206. return {
  207. pageTitle: '',
  208. typeList: [
  209. { id: 1, value: '1 生产设备', prefix: '1', code: 1 },
  210. { id: 2, value: '2 舟皿', prefix: '2', code: 2 },
  211. { id: 3, value: '5 周转车', prefix: '5', code: 5 },
  212. { id: 4, value: '6 模具', prefix: '6', code: 6 },
  213. { id: 5, value: '7 备品备件', prefix: '7', code: 7 },
  214. { id: 6, value: '3 物料', prefix: '3', code: 3 },
  215. { id: 7, value: '4 产品', prefix: '4', code: 4 },
  216. { id: 8, value: '8 耗材', prefix: '8', code: 8 }
  217. ],
  218. defaultNum: '1',
  219. // itemForm:{
  220. // priceType:0, dateType:0,
  221. // },
  222. customForm: {
  223. addList: []
  224. },
  225. activeName: 'product',
  226. productData: [],
  227. mouldData: [],
  228. partData: [],
  229. bomData: [],
  230. facilityData: [],
  231. pagination: {
  232. page: 1,
  233. size: 10,
  234. total: 0
  235. },
  236. itemValue: ''
  237. };
  238. },
  239. created () {
  240. this.getDetilInfo(this.$route.query.id);
  241. },
  242. methods: {
  243. async getDetilInfo (id) {
  244. const res = await getDetails(id);
  245. if (res.success) {
  246. this.customForm = res.data;
  247. this.defaultNum = res.data.classificationCode;
  248. this.formatterValue(res.data.classificationCode);
  249. this.setDefault(res.data.classificationCode);
  250. for (const key in this.customForm.informationRelationMap) {
  251. this.matchList(key, this.customForm.informationRelationMap);
  252. }
  253. }
  254. },
  255. formatterValue (code) {
  256. this.typeList.map((item) => {
  257. if (item.prefix == code) {
  258. this.itemValue = item.value;
  259. }
  260. });
  261. },
  262. goBack () {
  263. this.$router.go(-1);
  264. },
  265. // 显示默认选中的tab
  266. setDefault (val) {
  267. switch (val) {
  268. case '3': {
  269. this.activeName = 'product';
  270. break;
  271. }
  272. case '1': {
  273. this.activeName = 'mould';
  274. break;
  275. }
  276. case '4': {
  277. this.activeName = 'mould';
  278. break;
  279. }
  280. case '6': {
  281. this.activeName = 'product';
  282. break;
  283. }
  284. case '7': {
  285. this.activeName = 'facility';
  286. break;
  287. }
  288. default:
  289. break;
  290. }
  291. },
  292. matchList (key, data) {
  293. switch (key) {
  294. case '1': {
  295. this.facilityData = data[key];
  296. break;
  297. }
  298. case '6': {
  299. this.mouldData = data[key];
  300. break;
  301. }
  302. case '7': {
  303. this.partData = data[key];
  304. break;
  305. }
  306. case '4': {
  307. this.productData = data[key];
  308. break;
  309. }
  310. case '3': {
  311. this.bomData = data[key];
  312. break;
  313. }
  314. default:
  315. break;
  316. }
  317. },
  318. handleDelete (index, row) {},
  319. //点击添加打开弹窗
  320. clickAdd () {
  321. this.$refs.addDialogRef.equipmentdialog = true;
  322. },
  323. handleCurrent (page) {
  324. this.pagination.page = page;
  325. // this._getList(this.params)
  326. },
  327. handleSize (size) {
  328. this.pagination.page = 1;
  329. this.pagination.size = size;
  330. // this._getList(this.params)
  331. },
  332. // 物品类型格式化
  333. classificationCodeFormatter (row) {
  334. let itemName = '';
  335. this.typeList.map((item) => {
  336. if (item.prefix == row.classificationCode) {
  337. itemName = item.value;
  338. }
  339. });
  340. return itemName;
  341. }
  342. }
  343. };
  344. </script>
  345. <style lang="scss" scoped>
  346. :deep(.page-title) {
  347. border-bottom: 1px solid #eaeefb;
  348. padding-bottom: 8px;
  349. margin-bottom: 16px;
  350. display: flex;
  351. align-items: center;
  352. .el-page-header__left {
  353. display: flex;
  354. align-items: center;
  355. }
  356. .pageContent {
  357. display: flex;
  358. align-items: center;
  359. font-size: 18px;
  360. color: #303133;
  361. .topform {
  362. margin: 5px 0 0 30px;
  363. }
  364. }
  365. }
  366. .table-container {
  367. flex: 1;
  368. display: flex;
  369. overflow: hidden;
  370. .tree-col {
  371. margin-right: 10px;
  372. width: 25%;
  373. min-width: 250px;
  374. overflow: auto;
  375. padding: 20px 20px 20px 10px;
  376. background-color: #fff;
  377. margin-top: 10px;
  378. border: 1px solid #e6ebf5;
  379. border-radius: 4px;
  380. box-shadow: 0 2px 12px 0 rgb(0 0 0 / 10%);
  381. }
  382. }
  383. :deep(.attribute-row) {
  384. padding: 20px 5px;
  385. background: #fff;
  386. margin-top: 10px;
  387. overflow: auto;
  388. flex: 1;
  389. border: 1px solid #e6ebf5;
  390. border-radius: 4px;
  391. box-shadow: 0 2px 12px 0 rgb(0 0 0 / 10%);
  392. position: relative;
  393. .row-table {
  394. width: 100%;
  395. margin: 20px auto 0;
  396. .table-box {
  397. width: 100%;
  398. margin: 10px auto;
  399. min-height: 400px;
  400. }
  401. .bom-top {
  402. width: 100%;
  403. display: flex;
  404. align-items: center;
  405. justify-content: flex-start;
  406. .top-input {
  407. margin-left: 20px;
  408. display: flex;
  409. align-items: center;
  410. justify-content: flex-start;
  411. .input-box {
  412. width: 150px;
  413. margin: 0 10px;
  414. display: inline-box;
  415. }
  416. }
  417. }
  418. }
  419. .page-footer-btn {
  420. background: #fff;
  421. z-index: 1;
  422. position: fixed;
  423. bottom: 40px;
  424. right: 80px;
  425. text-align: right;
  426. width: 50%;
  427. }
  428. }
  429. </style>