tb-business-car-edit.html 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  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"><span style="color: red;">*</span>车牌颜色:</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;"
  70. v-if="m.realInTime&&!obj.realInTime||m.carNo!=obj.carNo">*</span>备注:</label>
  71. <div style="display: inline-block;">
  72. <el-input type="textarea" v-model="m.remark" placeholder="备注"></el-input>
  73. </div>
  74. </div>
  75. <div class="c-item">
  76. <label class="c-label">
  77. <span style="color: red;" v-if="m.realOutTime&&!obj.realOutTime">*</span>出场确认说明:</label>
  78. <div style="display: inline-block;">
  79. <el-input :disabled="!m.realOutTime" type="textarea" v-model="m.outRemark"
  80. placeholder="出场确认说明"></el-input>
  81. </div>
  82. </div>
  83. </el-form>
  84. </div>
  85. </div>
  86. <!-- ------- 底部按钮 ------- -->
  87. <div class="s-foot">
  88. <el-button type="primary" @click="ok()">确定</el-button>
  89. <el-button @click="sa.closeCurrIframe()">取消</el-button>
  90. </div>
  91. </div>
  92. <script>
  93. var app = new Vue({
  94. components: {
  95. "sa-item": httpVueLoader('../../sa-frame/com/sa-item.vue')
  96. },
  97. el: '.vue-box',
  98. data: {
  99. colorList: [],
  100. obj: {},
  101. id: sa.p('id', 0), // 获取超链接中的id参数(0=添加,非0=修改)
  102. m: {
  103. id: '', //
  104. carNo: '', //
  105. carSize: '', //
  106. driverName: '', //
  107. money: '', //
  108. driverPhone: '', //
  109. image: '',
  110. realInTime: '',
  111. realOutTime: '',
  112. pay: '',
  113. isLock: '',
  114. inImage: '',
  115. outImage: '',
  116. remark: '',
  117. outRemark: ''
  118. }, // 实体对象
  119. },
  120. methods: {
  121. getCadNoColor() {
  122. sa.ajax('/TbCarNoColor/getList', function(resp) {
  123. this.colorList = resp.data;
  124. }.bind(this))
  125. },
  126. // 提交数据
  127. ok: function() {
  128. // 表单校验
  129. let m = this.m;
  130. let obj = this.obj;
  131. sa.checkNull(m.carNo, '请输入 [车牌号]');
  132. sa.checkNull(m.color, '请选择 [车牌颜色]');
  133. let realInTime = m.realInTime;
  134. if (realInTime && !m.remark && !obj.realInTime) {
  135. sa.error('入场补录备注必填');
  136. return;
  137. }
  138. console.log(obj.carNo);
  139. console.log(m.carNo);
  140. if (!m.remark && obj.carNo != m.carNo) {
  141. sa.error('修改车牌备注必填');
  142. return;
  143. }
  144. let realOutTime = m.realOutTime;
  145. if (realOutTime != obj.realOutTime && !m.outRemark) {
  146. sa.error('离场补录出场确认说明必填');
  147. return;
  148. }
  149. // 开始增加或修改
  150. sa.ajax('/TbBusinessCar/updateCarRecord', sa.removeNull(m), function(res) {
  151. sa.alert('修改成功', this.clean);
  152. }.bind(this));
  153. },
  154. // 添加/修改 完成后的动作
  155. clean: function() {
  156. if (this.id == 0) {
  157. this.m = this.createModel();
  158. } else {
  159. parent.app.f5(); // 刷新父页面列表
  160. sa.closeCurrIframe(); // 关闭本页
  161. }
  162. }
  163. },
  164. mounted: function() {
  165. this.getCadNoColor();
  166. // 初始化数据
  167. if (this.id > 0) {
  168. sa.ajax('/TbBusinessCar/getById?id=' + this.id, function(res) {
  169. this.m = res.data;
  170. if (res.data == null) {
  171. sa.alert('未能查找到 id=' + this.id + " 详细数据");
  172. }
  173. this.obj = JSON.parse(JSON.stringify(this.m));
  174. }.bind(this))
  175. }
  176. }
  177. })
  178. </script>
  179. </body>
  180. </html>