assetsDetail.vue 22 KB

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