tb-business-car-add.html 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>-添加/修改</title>
  5. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  6. <meta name="viewport"
  7. content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
  8. <!-- 所有的 css js 资源 -->
  9. <link rel="stylesheet" href="../../static/kj/element-ui/theme-chalk/index.css">
  10. <link rel="stylesheet" href="../../static/sa.css">
  11. <script src="../../static/kj/vue.min.js"></script>
  12. <script src="../../static/kj/element-ui/index.js"></script>
  13. <script src="../../static/kj/httpVueLoader.js"></script>
  14. <script src="../../static/kj/jquery.min.js"></script>
  15. <script src="../../static/kj/layer/layer.js"></script>
  16. <script src="../../static/sa.js"></script>
  17. <script src="../../static/kj/upload-util.js"></script>
  18. <style type="text/css">
  19. .c-panel .el-form .c-label {
  20. width: 7em !important;
  21. }
  22. .c-panel .el-form .el-input,
  23. .c-panel .el-form .el-textarea__inner {
  24. width: 250px;
  25. }
  26. .china-car-size .el-input__inner {
  27. width: 130px;
  28. }
  29. </style>
  30. </head>
  31. <body>
  32. <div class="vue-box" :class="{sbot: id}" style="display: none;" :style="'display: block;'">
  33. <!-- ------- 内容部分 ------- -->
  34. <div class="s-body">
  35. <div class="c-panel">
  36. <div class="c-title" v-if="id == 0">数据添加</div>
  37. <div class="c-title" v-else>数据修改</div>
  38. <el-form v-if="m">
  39. <sa-item type="text" name="车牌号" v-model="m.carNo" br></sa-item>
  40. <div class="c-item">
  41. <label class="c-label"><span style="color: red;">*</span>车辆规格:</label>
  42. <el-input-number class="china-car-size" v-model="m.carSize" controls-position="right"
  43. :min="4.2" :max="50"></el-input-number>
  44. </div>
  45. <div class="c-item">
  46. <label class="c-label">车牌颜色:</label>
  47. <el-select v-model="m.color" placeholder="请选择">
  48. <el-option v-for="item in colorList" :label="item.carNoColor" :value="item.carNoColor">
  49. </el-option>
  50. </el-select>
  51. </div>
  52. <div class="c-item">
  53. <label class="c-label">入场时间:</label>
  54. <el-date-picker type="datetime" value-format="yyyy-MM-dd HH:mm:ss" v-model="m.realInTime">
  55. </el-date-picker>
  56. </div>
  57. <sa-item type="img" name="入场图片" v-model="m.inImage" br></sa-item>
  58. <div class="c-item">
  59. <label class="c-label">离场时间:</label>
  60. <el-date-picker type="datetime" value-format="yyyy-MM-dd HH:mm:ss" v-model="m.realOutTime">
  61. </el-date-picker>
  62. </div>
  63. <sa-item type="img" name="出场图片" v-model="m.outImage" br></sa-item>
  64. <sa-item name="" class="s-ok" br>
  65. <el-button type="primary" icon="el-icon-plus" @click="ok()">保存</el-button>
  66. </sa-item>
  67. <div class="c-item">
  68. <label class="c-label">
  69. <span style="color: red;" v-if="m.realInTime">*</span>备注:</label>
  70. <div style="display: inline-block;">
  71. <el-input type="textarea" v-model="m.remark" placeholder="备注"></el-input>
  72. </div>
  73. </div>
  74. <div class="c-item">
  75. <label class="c-label">
  76. <span style="color: red;" v-if="m.realOutTime">*</span>出场确认说明:</label>
  77. <div style="display: inline-block;">
  78. <el-input type="textarea" v-model="m.outRemark" placeholder="出场确认说明"
  79. :disabled="!m.realOutTime"></el-input>
  80. </div>
  81. </div>
  82. </el-form>
  83. </div>
  84. </div>
  85. <!-- ------- 底部按钮 ------- -->
  86. <div class="s-foot">
  87. <el-button type="primary" @click="ok()">确定</el-button>
  88. <el-button @click="sa.closeCurrIframe()">取消</el-button>
  89. </div>
  90. </div>
  91. <script>
  92. var app = new Vue({
  93. components: {
  94. "sa-item": httpVueLoader('../../sa-frame/com/sa-item.vue')
  95. },
  96. el: '.vue-box',
  97. data: {
  98. colorList: [],
  99. id: sa.p('id', 0), // 获取超链接中的id参数(0=添加,非0=修改)
  100. m: {
  101. id: '', //
  102. carNo: '', //
  103. carSize: '', //
  104. driverName: '', //
  105. money: '', //
  106. driverPhone: '', //
  107. image: '',
  108. realInTime: '',
  109. realOutTime: '',
  110. pay: '',
  111. isLock: '',
  112. inImage: '',
  113. outImage: '',
  114. remark: '',
  115. outRemark: ''
  116. }, // 实体对象
  117. },
  118. methods: {
  119. getCadNoColor() {
  120. sa.ajax('/TbCarNoColor/getList', function(resp) {
  121. this.colorList = resp.data;
  122. }.bind(this))
  123. },
  124. // 提交数据
  125. ok: function() {
  126. // 表单校验
  127. let m = this.m;
  128. sa.checkNull(m.carNo, '请输入 [车牌号]');
  129. sa.checkNull(m.color, '请选择 [车牌颜色]');
  130. let realInTime = m.realInTime;
  131. if (realInTime && !m.remark) {
  132. sa.error('入场补录备注必填');
  133. return;
  134. }
  135. let realOutTime = m.realOutTime;
  136. if (realOutTime && !m.outRemark) {
  137. sa.error('离场补录出场确认说明必填');
  138. return;
  139. }
  140. // 开始增加或修改
  141. sa.ajax('/TbBusinessCar/addCarRecord', m, function(res) {
  142. sa.alert('增加成功', this.clean);
  143. }.bind(this));
  144. },
  145. // 添加/修改 完成后的动作
  146. clean: function() {
  147. if (this.id == 0) {
  148. this.m = this.createModel();
  149. } else {
  150. parent.app.f5(); // 刷新父页面列表
  151. sa.closeCurrIframe(); // 关闭本页
  152. }
  153. }
  154. },
  155. mounted: function() {
  156. this.getCadNoColor();
  157. }
  158. })
  159. </script>
  160. </body>
  161. </html>