assetsDetail.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603
  1. <template>
  2. <div class="detail">
  3. <mt-header class="detail_head" fixed title="资产详情">
  4. <router-link to="/assets" slot="left">
  5. <mt-button icon="back"></mt-button>
  6. </router-link>
  7. <mt-button slot="right" v-if="power.indexOf('assets_operation')>-1" v-on:click.native="jumpTo(3)">操作记录</mt-button>
  8. </mt-header>
  9. <div class="detail_body">
  10. <div class="detailBox userInfo" v-on:click="showBase()">
  11. <div class="left">
  12. <img v-if="detail.pic != null" :src="detail.pic">
  13. <img v-else src="../../assets/image/noPic.png">
  14. </div>
  15. <div class="right">
  16. <div>
  17. <span class="name">{{detail.name}}</span>
  18. </div>
  19. <div class="department">
  20. {{detail.modelNumber}}
  21. </div>
  22. <div>
  23. <span class="num">{{detail.goodsNosVO!=null?detail.goodsNosVO.length:0}}{{detail.unit}}</span>
  24. <span v-if="power.indexOf('update_assets')>-1" class="arrow"><img src="../../assets/image/pull_down_blue.png"></span>
  25. </div>
  26. </div>
  27. </div>
  28. <div class="detailBox">
  29. <mt-cell v-if="power.indexOf('maintenance_assets')>-1" title="维护资产" is-link v-on:click.native="jumpTo(1)"></mt-cell>
  30. <!-- <mt-cell v-if="power.indexOf('update_assets')>-1" title="资产编号" is-link v-on:click.native="jumpTo(2)"></mt-cell> -->
  31. </div>
  32. <div class="detailBox">
  33. <div class="assDel assDel_Head">
  34. 资产详情列表
  35. <img v-if="power.indexOf('update_assets')>-1" v-on:click="addNo()" src="../../assets/image/add.png">
  36. </div>
  37. <div class="assDel assDel_Status">
  38. <span class="active" v-on:click="changeState(-1)">全部 {{delList.length}}</span>
  39. <span v-on:click="changeState(0)">未用 {{unuList.length}}</span>
  40. <span v-on:click="changeState(1)">在用 {{useList.length}}</span>
  41. <span v-on:click="changeState(3)">报废 {{scrList.length}}</span>
  42. </div>
  43. <div class="assDel assDel_List">
  44. <div class="one_assDel" v-for="item in delList" v-if="state == -1 || item.state == state">
  45. <mt-cell-swipe v-if="power.indexOf('handle_assets') == -1 && power.indexOf('update_assets') == -1" :right="[]" :class="item.username==null?'noName':''">
  46. <div class="one_assDel_head">
  47. <span class="canJump"><span style="color:#DC143C;font-weight:600">{{item.isMaintain == 1?"[待维护] ":""}}</span>{{item.modelNo}}</span>
  48. <span v-if="item.state == 0">未用</span>
  49. <span v-if="item.state == 1">在用</span>
  50. <span v-if="item.state == 3">报废</span>
  51. </div>
  52. <div class="one_assDel_body">
  53. <span>{{item.username}} {{item.phone}}</span>
  54. </div>
  55. </mt-cell-swipe>
  56. <mt-cell-swipe v-if="power.indexOf('handle_assets') > -1 && power.indexOf('update_assets') == -1" :right="[
  57. { content: '处置', style: { background: 'rgba(38,162,255,0.9)', color: '#fff' }, handler: () => handle(item.id) },
  58. ]" :class="item.username==null?'noName':''">
  59. <div class="one_assDel_head">
  60. <span class="canJump"><span style="color:#DC143C;font-weight:600">{{item.isMaintain == 1?"[待维护] ":""}}</span>{{item.modelNo}}</span>
  61. <span v-if="item.state == 0">未用</span>
  62. <span v-if="item.state == 1">在用</span>
  63. <span v-if="item.state == 3">报废</span>
  64. </div>
  65. <div class="one_assDel_body">
  66. <span>{{item.username}} {{item.phone}}</span>
  67. </div>
  68. </mt-cell-swipe>
  69. <mt-cell-swipe v-if="power.indexOf('handle_assets') == -1 && power.indexOf('update_assets') > -1" :right="[
  70. { content: '删除', style: { background: 'rgba(220,0,0,0.7)', color: '#fff', }, handler: () => deleteNos(item.id)}
  71. ]" :class="item.username==null?'noName':''">
  72. <div class="one_assDel_head">
  73. <span class="canJump"><span style="color:#DC143C;font-weight:600">{{item.isMaintain == 1?"[待维护] ":""}}</span>{{item.modelNo}}</span>
  74. <span v-if="item.state == 0">未用</span>
  75. <span v-if="item.state == 1">在用</span>
  76. <span v-if="item.state == 3">报废</span>
  77. </div>
  78. <div class="one_assDel_body">
  79. <span>{{item.username}} {{item.phone}}</span>
  80. </div>
  81. </mt-cell-swipe>
  82. <mt-cell-swipe v-if="power.indexOf('handle_assets') > -1 && power.indexOf('update_assets') > -1" :right="[
  83. { content: '处置', style: { background: 'rgba(38,162,255,0.9)', color: '#fff' }, handler: () => handle(item.id) },
  84. { content: '删除', style: { background: 'rgba(220,0,0,0.7)', color: '#fff', }, handler: () => deleteNos(item.id)}
  85. ]" :class="item.username==null?'noName':''">
  86. <div class="one_assDel_head">
  87. <span class="canJump"><span style="color:#DC143C;font-weight:600">{{item.isMaintain == 1?"[待维护] ":""}}</span>{{item.modelNo}}</span>
  88. <span v-if="item.state == 0">未用</span>
  89. <span v-if="item.state == 1">在用</span>
  90. <span v-if="item.state == 3">报废</span>
  91. </div>
  92. <div class="one_assDel_body">
  93. <span>{{item.username}} {{item.phone}}</span>
  94. </div>
  95. </mt-cell-swipe>
  96. </div>
  97. </div>
  98. </div>
  99. </div>
  100. <mt-popup v-model="popupVisible" position="right" class="allocation">
  101. <mt-header class="detail_head" fixed title="资产基本信息">
  102. <router-link to="" slot="left">
  103. <mt-button icon="back" v-on:click="closeBase()"></mt-button>
  104. </router-link>
  105. </mt-header>
  106. <div class="detail_body">
  107. <div class="detailBox userInfo" v-on:click="power.indexOf('update_assets') > -1 ?jumpTo(0):''">
  108. <div class="left">
  109. <img v-if="detail.pic != null" :src="detail.pic">
  110. <img v-else src="../../assets/image/noPic.png">
  111. </div>
  112. <div class="right">
  113. <div>
  114. <span class="nameEdit">{{detail.name}}</span>
  115. <span v-if="power.indexOf('update_assets')>-1" class="arrowEdit"><img src="../../assets/image/edit.png"></span>
  116. </div>
  117. <div class="department">
  118. {{detail.modelNumber}}
  119. </div>
  120. <div>
  121. <span class="num">{{detail.goodsNosVO!=null?detail.goodsNosVO.length:0}}{{detail.unit}}</span>
  122. </div>
  123. </div>
  124. </div>
  125. <div class="detailBox">
  126. <mt-cell title="资产分类" :value="detail.tagName"></mt-cell>
  127. <mt-cell title="数量" :value="detail.goodsNosVO!=null?detail.goodsNosVO.length:0"></mt-cell>
  128. <mt-cell title="单位" :value="detail.unit"></mt-cell>
  129. <mt-cell title="地址" :value="detail.address"></mt-cell>
  130. </div>
  131. <div class="detailBox">
  132. <mt-cell title="项目编号" :value="detail.projectNo"></mt-cell>
  133. <mt-cell title="项目名称" :value="detail.projectName"></mt-cell>
  134. <mt-cell title="采购日期" :value="detail.purchaseDate"></mt-cell>
  135. </div>
  136. <div class="detailBox">
  137. <mt-cell title="供应商" :value="detail.factory"></mt-cell>
  138. <mt-cell title="采购价格" :value="detail.price"></mt-cell>
  139. <mt-cell title="质保期限" :value="detail.warrantyPeriod==null?'': detail.warrantyPeriod + '年'"></mt-cell>
  140. <mt-cell title="服务期限" :value="detail.serviceLife==null?'': detail.serviceLife + '天'"></mt-cell>
  141. <mt-cell title="下次维护时间" :value="detail.nextIndate"></mt-cell>
  142. </div>
  143. <div class="detailBox">
  144. <mt-cell title="备注"></mt-cell>
  145. <p style="padding: 0.05rem 0.12rem;margin:0;font-size:0.16rem;color:#888;line-height:0.25rem;">
  146. {{detail.content}}
  147. </p>
  148. </div>
  149. </div>
  150. </mt-popup>
  151. </div>
  152. </template>
  153. <script>
  154. import { MessageBox } from 'mint-ui';
  155. export default {
  156. data() {
  157. return {
  158. id: this.$route.params.id,
  159. power: sessionStorage.getItem("power"),
  160. detail: "",
  161. delList: [],
  162. useList: [],
  163. serList: [],
  164. scrList: [],
  165. unuList: [],
  166. state: -1,
  167. popupVisible: false,
  168. }
  169. },
  170. methods: {
  171. getDetail() {
  172. this.$indicator.open();
  173. this.http.post(this.port.assets.detail, {
  174. 'id': this.id
  175. } ,
  176. res => {
  177. this.$indicator.close();
  178. if (res.code == "ok") {
  179. this.detail = res.data;
  180. this.delList = res.data.goodsNosVO;
  181. var list = res.data.goodsNosVO,
  182. useList = [],
  183. serList = [],
  184. scrList = [],
  185. unuList = [];
  186. for(var i in list) {
  187. if(list[i].state == 0) {
  188. unuList.push(list[i])
  189. } else if(list[i].state == 1) {
  190. useList.push(list[i])
  191. serList.push(list[i])
  192. } else if(list[i].state == 3) {
  193. scrList.push(list[i])
  194. }
  195. }
  196. this.useList = useList;
  197. this.serList = serList;
  198. this.scrList = scrList;
  199. this.unuList = unuList;
  200. } else {
  201. this.$toast({
  202. message: res.msg,
  203. duration: 2000
  204. });
  205. }
  206. }, error => {
  207. this.$indicator.close();
  208. this.$toast({
  209. message: error,
  210. duration: 2000
  211. });
  212. })
  213. },
  214. changeState(type) {
  215. if(type == 3) {
  216. $(".assDel_Status span:eq(3)").addClass("active").siblings().removeClass("active");
  217. } else {
  218. $(".assDel_Status span:eq("+ (type + 1) +")").addClass("active").siblings().removeClass("active");
  219. }
  220. this.state = type;
  221. },
  222. // 添加资产编号
  223. addNo() {
  224. MessageBox({
  225. $type:'prompt',
  226. title:'',
  227. message:'添加资产数量',
  228. closeOnClickModal:false,
  229. showCancelButton:true,
  230. inputValidator:function(v){
  231. if (v === null) {
  232.    return true;
  233. }
  234. var str = /^[0-9]*[1-9][0-9]*$/;
  235. if(str.test(v) && v != "") {
  236. return true
  237. } else {
  238. return false
  239. }
  240. },
  241. inputErrorMessage:'请输入资产编号数量',
  242. showInput:true
  243. }).then(({ value, action }) => {
  244. if(value == null) {
  245. this.$toast({
  246. message: '创建失败',
  247. duration: 2000
  248. });
  249. return false;
  250. } else {
  251. this.$indicator.open();
  252. this.http.post(this.port.assets.addNo, {
  253. 'goodsId': this.id,
  254. 'count': value
  255. } ,
  256. res => {
  257. this.$indicator.close();
  258. if (res.code == "ok") {
  259. this.$toast({
  260. message: '创建成功',
  261. duration: 2000
  262. });
  263. this.getDetail();
  264. } else {
  265. this.$toast({
  266. message: res.msg,
  267. duration: 2000
  268. });
  269. }
  270. }, error => {
  271. this.$indicator.close();
  272. this.$toast({
  273. message: error,
  274. duration: 2000
  275. });
  276. })
  277. }
  278. }).catch(() => {
  279. });
  280. },
  281. // 删除资产编号
  282. deleteNos(id) {
  283. MessageBox.confirm('', { 
  284. message: '是否删除该资产?', 
  285. title: '', 
  286. confirmButtonText: '确定', 
  287. cancelButtonText: '取消' 
  288.  }).then(action => { 
  289. if (action == 'confirm') {     //确认的回调
  290. this.http.post(this.port.assets.delNo, {
  291. 'id': id
  292. } ,
  293. res => {
  294. if (res.code == "ok") {
  295. this.$toast({
  296. message: "删除成功",
  297. duration: 2000
  298. });
  299. for(var i in this.delList) {
  300. if(this.delList[i].id == id) {
  301. this.delList.splice(i, 1);
  302. }
  303. }
  304. var list = this.delList,
  305. useList = [],
  306. serList = [],
  307. scrList = [],
  308. unuList = [];
  309. for(var i in list) {
  310. if(list[i].state == 0) {
  311. unuList.push(list[i])
  312. } else if(list[i].state == 1) {
  313. useList.push(list[i])
  314. serList.push(list[i])
  315. } else if(list[i].state == 3) {
  316. scrList.push(list[i])
  317. }
  318. }
  319. this.useList = useList;
  320. this.serList = serList;
  321. this.scrList = scrList;
  322. this.unuList = unuList;
  323. } else {
  324. this.$toast({
  325. message: res.msg,
  326. duration: 2000
  327. });
  328. }
  329. }, error => {
  330. this.$toast({
  331. message: error,
  332. duration: 2000
  333. });
  334. })
  335. }
  336.  }).catch(err => { 
  337.  });
  338. },
  339. // 跳转
  340. jumpBack() {
  341. this.$router.push("/assets");
  342. },
  343. jumpTo(type) {
  344. if(type == 0) {
  345. this.$router.push("/assetsEdit/" + this.id );
  346. } else if(type == 1) {
  347. this.$router.push("/assetsMaintain/" + this.id );
  348. } else if(type == 2) {
  349. this.$router.push("/assetsNumber/" + this.id + "/" + this.detail.divisionCode + "/" + this.detail.suffixCode );
  350. } else if(type == 3) {
  351. this.$router.push("/assetsOperation/" + this.id );
  352. }
  353. },
  354. handle(id) {
  355. this.$router.push("/assetsHandle/" + id );
  356. },
  357. // 展示基础资料
  358. showBase() {
  359. this.popupVisible = true;
  360. },
  361. closeBase() {
  362. this.popupVisible = false;
  363. },
  364. },
  365. created() {
  366. this.getDetail();
  367. },
  368. mounted() {
  369. }
  370. }
  371. </script>
  372. <style scoped>
  373. .detail_head {
  374. background: #fff;
  375. color: #333;
  376. height: 0.4rem;
  377. }
  378. .detail_body {
  379. margin-top: 0.4rem;
  380. }
  381. .detail {
  382. background: #EFEFEF;
  383. }
  384. .detailBox {
  385. background: #fff;
  386. margin-bottom: 0.11rem;
  387. }
  388. .userInfo {
  389. padding: 0.22rem 0.1rem;
  390. }
  391. .left{
  392. float:left;
  393. margin-right: 0.15rem;
  394. }
  395. .left img {
  396. width: 0.6rem;
  397. height: 0.6rem;
  398. }
  399. .right div{
  400. line-height: 0.21rem;
  401. white-space: nowrap;
  402. overflow: hidden;
  403. text-overflow: ellipsis;
  404. }
  405. span.name {
  406. font-size: 0.16rem;
  407. font-weight: 600;
  408. margin: 0 0.15rem 0 0;
  409. width: 100%;
  410. overflow: hidden;
  411. white-space: nowrap;
  412. }
  413. span.nameEdit {
  414. font-size: 0.16rem;
  415. font-weight: 600;
  416. margin: 0 0.15rem 0 0;
  417. width: 80%;
  418. overflow: hidden;
  419. white-space: nowrap;
  420. }
  421. span.num {
  422. font-size: 0.14rem;
  423. color: #26a2ff;
  424. }
  425. div.department {
  426. font-size: 0.13rem;
  427. color: #9E9E9E;
  428. }
  429. span.arrow {
  430. float: right;
  431. }
  432. span.arrow img {
  433. width: 0.12rem;
  434. margin-right: 0.05rem;
  435. transform: rotate(-90deg);
  436. -ms-transform: rotate(-90deg); /* IE 9 */
  437. -moz-transform: rotate(-90deg); /* Firefox */
  438. -webkit-transform: rotate(-90deg); /* Safari and Chrome */
  439. -o-transform: rotate(-90deg); /* Opera */
  440. }
  441. span.arrowEdit {
  442. float: right;
  443. }
  444. span.arrowEdit img {
  445. width: 0.15rem;
  446. margin-right: 0.05rem;
  447. }
  448. .assDel {
  449. padding: 0.12rem 0.1rem;
  450. }
  451. .assDel_List {
  452. padding-top: 0;
  453. }
  454. .assDel_Status span {
  455. display: inline-block;
  456. text-align: center;
  457. width: 24%;
  458. color: #aaa;
  459. font-size: 0.15rem;
  460. }
  461. .assDel_Status span.active {
  462. color: #26a2ff;
  463. }
  464. .assDel_Head img {
  465. float: right;
  466. width: 0.2rem;
  467. height: 0.2rem;
  468. }
  469. .one_assDel {
  470. /* padding: 0 0.1rem; */
  471. margin: 0 0 0.15rem 0;
  472. }
  473. .mint-cell-wrapper {
  474. padding: 0;
  475. }
  476. .one_assDel_head {
  477. width: 100%;
  478. }
  479. .one_assDel_body {
  480. width: 100%;
  481. }
  482. .one_assDel_head > span {
  483. display:inline-block;
  484. vertical-align: middle;
  485. color: #666;
  486. line-height: 0.4rem;
  487. }
  488. .one_assDel_head > span:nth-child(1){
  489. width: 85%;
  490. font-size: 0.15rem;
  491. overflow: hidden;
  492. white-space: nowrap;
  493. text-overflow: ellipsis;
  494. }
  495. .one_assDel_head > span:nth-child(2){
  496. float: right;
  497. }
  498. .one_assDel_body span {
  499. color: #aaa;
  500. vertical-align: middle;
  501. }
  502. .one_assDel_body img {
  503. float: right;
  504. width: 0.25rem;
  505. height: 0.25rem;
  506. vertical-align: middle;
  507. }
  508. /* 资产基础数据样式 */
  509. .allocation {
  510. width: 100%;
  511. height: 100%;
  512. overflow-y: auto;
  513. }
  514. .address_first .current{
  515. background:#eee;
  516. color: #6f83ff;
  517. border-left: 2px solid #6f83ff;
  518. }
  519. </style>
  520. <style>
  521. .detail_head .mint-header-title {
  522. font-weight: 600;
  523. font-size: 0.15rem;
  524. }
  525. .detail_head .mint-button-text {
  526. color: #26a2ff;
  527. }
  528. .detailBox .mint-cell {
  529. padding: 0 0 0 0.02rem;
  530. }
  531. .one_assDel .mint-cell-value {
  532. display: block;
  533. width: 100%;
  534. }
  535. .one_assDel .mint-cell:last-child {
  536. background-image: none;
  537. }
  538. .one_assDel .mint-cell-wrapper {
  539. background-image: none;
  540. }
  541. .one_assDel .mint-cell-swipe-button {
  542. line-height: 0.55rem;
  543. }
  544. .one_assDel .noName .mint-cell-swipe-button {
  545. line-height: 48px;
  546. }
  547. </style>