assetsMaintain.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375
  1. <template>
  2. <div class="detail">
  3. <mt-header class="detail_head" fixed title="维护资产">
  4. <router-link to="" slot="left">
  5. <mt-button icon="back" v-on:click="jumpBack()"></mt-button>
  6. </router-link>
  7. </mt-header>
  8. <div class="detail_body">
  9. <div class="detailBox">
  10. <div style="padding:0.12rem;">资产编号</div>
  11. <mt-field id="userId" placeholder="请选择资产编号" disableClear disabled v-on:click.native="choosePeo()" type="textarea" v-model="idStr"></mt-field>
  12. </div>
  13. <div class="detailBox">
  14. <mt-field label="维护人" placeholder="请输入维护人" v-model="assetsForm.operator"></mt-field>
  15. <mt-field label="联系方式" placeholder="请输入维护人联系方式" v-model="assetsForm.operatorPhone"></mt-field>
  16. </div>
  17. <div class="detailBox">
  18. <mt-field label="维护厂家" placeholder="请输入维护厂家" v-model="assetsForm.company"></mt-field>
  19. <mt-field label="联系方式" placeholder="请输入维护厂家联系方式" v-model="assetsForm.companyPhone"></mt-field>
  20. </div>
  21. <div class="btn">
  22. <mt-button class="allBtn" size="large" type="primary" v-on:click.native="submit()">确定</mt-button>
  23. <mt-button class="allBtn" size="large" v-on:click.native="jumpBack()">取消</mt-button>
  24. </div>
  25. </div>
  26. <mt-popup v-model="popupVisible" position="right" class="allocation">
  27. <mt-header class="detail_head" fixed title="待维修资产">
  28. <router-link to="" slot="left">
  29. <mt-button icon="back" v-on:click="toPrev()"></mt-button>
  30. </router-link>
  31. </mt-header>
  32. <div class="detailBox">
  33. <mt-checklist title="checkbox list" v-model="ids" :options="list" @change="checkon"></mt-checklist>
  34. </div>
  35. </mt-popup>
  36. </div>
  37. </template>
  38. <script>
  39. export default {
  40. data() {
  41. return {
  42. id: this.$route.params.id,
  43. list: [],
  44. ids: [],
  45. idStr: '',
  46. assetsForm: {
  47. goodsId: this.$route.params.id,
  48. ids: '',
  49. operator: '',
  50. operatorPhone: '',
  51. company: '',
  52. companyPhone: '',
  53. },
  54. state: "",
  55. userName: "",
  56. popupVisible: false,
  57. canClick: true,
  58. }
  59. },
  60. methods: {
  61. // 待维护资产
  62. getMainList() {
  63. this.http.post(this.port.assets.maintainList, {
  64. 'id': this.id
  65. } ,
  66. res => {
  67. if (res.code == "ok") {
  68. var list = [];
  69. for(var i in res.data) {
  70. list.push({
  71. label: res.data[i].modelNo,
  72. value: res.data[i].id,
  73. })
  74. }
  75. this.list = list;
  76. } else {
  77. this.$toast({
  78. message: res.msg,
  79. duration: 2000
  80. });
  81. }
  82. }, error => {
  83. this.$toast({
  84. message: error,
  85. duration: 2000
  86. });
  87. })
  88. },
  89. choosePeo() {
  90. this.popupVisible = true;
  91. },
  92. toPrev() {
  93. this.popupVisible = false;
  94. },
  95. checkon() {
  96. this.idStr = "";
  97. this.assetsForm.ids = "";
  98. for(var i in this.ids) {
  99. for(var j in this.list) {
  100. if(this.ids[i] == this.list[j].value) {
  101. this.idStr += this.list[j].label + ',';
  102. this.assetsForm.ids += this.list[j].value + ',';
  103. break;
  104. }
  105. }
  106. }
  107. this.idStr = this.idStr.substring(0,this.idStr.length-1)
  108. this.assetsForm.ids = this.assetsForm.ids.substring(0,this.assetsForm.ids.length-1)
  109. },
  110. // 创建
  111. submit() {
  112. if(this.canClick) {
  113. this.canClick = false;
  114. if(this.assetsForm.ids == "") {
  115. this.$toast({
  116. message: '请选择资产编号',
  117. duration: 2000
  118. });
  119. this.canClick = true;
  120. return false;
  121. } else if(this.assetsForm.operator == null || this.assetsForm.operator == "") {
  122. this.$toast({
  123. message: '请输入维护人',
  124. duration: 2000
  125. });
  126. this.canClick = true;
  127. return false;
  128. } else if(this.assetsForm.operatorPhone == null || this.assetsForm.operatorPhone == "") {
  129. this.$toast({
  130. message: '请输入维护人联系方式',
  131. duration: 2000
  132. });
  133. this.canClick = true;
  134. return false;
  135. } else if(this.assetsForm.company == null || this.assetsForm.company == "") {
  136. this.$toast({
  137. message: '请输入维护厂家',
  138. duration: 2000
  139. });
  140. this.canClick = true;
  141. return false;
  142. } else if(this.assetsForm.companyPhone == null || this.assetsForm.companyPhone == "") {
  143. this.$toast({
  144. message: '请输入维护厂家联系方式',
  145. duration: 2000
  146. });
  147. this.canClick = true;
  148. return false;
  149. } else {
  150. this.$indicator.open();
  151. var _this = this;
  152. this.http.post( this.port.assets.maintain, this.assetsForm,
  153. res => {
  154. this.$indicator.close();
  155. if (res.code == "ok") {
  156. this.$toast({
  157. message: '维护成功',
  158. duration: 2000
  159. });
  160. setTimeout(function(){
  161. _this.$router.go(-1);
  162. }, 1000);
  163. } else {
  164. this.canClick = true;
  165. this.$toast({
  166. message: res.msg,
  167. duration: 2000
  168. });
  169. }
  170. },
  171. error => {
  172. this.canClick = true;
  173. this.$indicator.close();
  174. this.$toast({
  175. message: error,
  176. duration: 2000
  177. });
  178. });
  179. }
  180. } else {
  181. this.$toast({
  182. message: '请勿重复提交',
  183. duration: 2000
  184. });
  185. }
  186. },
  187. jumpBack() {
  188. this.$router.go(-1);
  189. }
  190. },
  191. created() {
  192. this.getMainList();
  193. },
  194. mounted() {
  195. }
  196. }
  197. </script>
  198. <style scoped>
  199. .detail_head {
  200. background: #fff;
  201. color: #333;
  202. height: 0.4rem;
  203. }
  204. .detail_body {
  205. margin-top: 0.4rem;
  206. padding-bottom: 0.15rem;
  207. }
  208. .detail {
  209. background: #EFEFEF;
  210. overflow: hidden;
  211. }
  212. .detailBox {
  213. background: #fff;
  214. margin-bottom: 0.11rem;
  215. }
  216. .left{
  217. float:left;
  218. margin: 0.15rem;
  219. }
  220. .upload .left {
  221. margin: 0.1rem 0.11rem;
  222. }
  223. .right div{
  224. line-height: 0.21rem;
  225. white-space: nowrap;
  226. overflow: hidden;
  227. text-overflow: ellipsis;
  228. }
  229. .btn {
  230. width: 80%;
  231. margin: 0.2rem auto 80px;
  232. }
  233. .allocation {
  234. width: 100%;
  235. height: 100%;
  236. }
  237. .address_first .current{
  238. background:#eee;
  239. color: #6f83ff;
  240. border-left: 2px solid #6f83ff;
  241. }
  242. .right > ul {
  243. margin: 0;
  244. padding: 0;
  245. overflow: auto;
  246. -webkit-transition-duration: 0.4s;
  247. box-sizing:border-box;
  248. padding: 0.08rem 0.1rem;
  249. }
  250. .right > ul > li {
  251. display: inline-block;
  252. height: 0.2rem;
  253. line-height: 0.2rem;
  254. font-size: 0.14rem;
  255. color: #ccc;
  256. padding: 0 0.12rem;
  257. margin: 0.06rem 0.03rem;
  258. border: 1px solid #ccc;
  259. border-radius: 50px;
  260. min-width: 0.3rem;
  261. text-align: center;
  262. }
  263. .right > ul > li.add {
  264. border: 1px solid #777;
  265. color: #777;
  266. }
  267. .right > ul > li.active {
  268. border: 1px solid #2680EB;
  269. color: #2680EB;
  270. }
  271. .upload_add {
  272. display: inline-block;
  273. margin-bottom: 0.2rem;
  274. }
  275. .upload_add_image {
  276. padding-top: 0.08rem;
  277. margin: 0.15rem 0 0 0.3rem ;
  278. width: 1rem;
  279. height: 0.9rem;
  280. border: 1px dashed rgba(0, 0, 0, .2);
  281. }
  282. .upload_add-image .camera {
  283. font-size: 24px;
  284. }
  285. .upload_add_image p {
  286. padding: 0;
  287. margin: 0;
  288. color: #8e8e8e;
  289. }
  290. .right div img.pic {
  291. width: 0.8rem;
  292. height: 0.8rem;
  293. margin: 0.15rem 0 0 0.3rem ;
  294. }
  295. .textColor {
  296. margin-top: 0.4rem;
  297. color: #8e8e8e;
  298. padding: 0.12rem;
  299. font-size: 0.12rem;
  300. }
  301. .example {
  302. color: #8e8e8e;
  303. padding: 0.02rem 0.12rem;
  304. font-size: 0.12rem;
  305. }
  306. .allBtn {
  307. width: 80%;
  308. margin: 0.18rem auto;
  309. }
  310. </style>
  311. <style>
  312. .detail_head .mint-header-title {
  313. font-weight: 600;
  314. font-size: 0.15rem;
  315. }
  316. .detail_head .mint-button-text {
  317. color: #26a2ff;
  318. }
  319. .detailBox .mint-cell {
  320. padding: 0 0 0 0.02rem;
  321. }
  322. .mint-popup.allocation {
  323. background: #efefef;
  324. }
  325. .mint-msgbox {
  326. width: 70%;
  327. }
  328. .mint-cell-wrapper {
  329. background-image: none;
  330. }
  331. input:disabled {
  332. background: #fff;
  333. }
  334. textarea:disabled {
  335. background: #fff;
  336. }
  337. </style>