addVehicleConfiguration.vue 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305
  1. <template>
  2. <div>
  3. <el-form ref="form" :model="form" :rules="rules" label-width="108px">
  4. <div class="inputBox flexBox">
  5. <span class="label">配置ID</span>
  6. <div>{{ confId }}</div>
  7. </div>
  8. <div class="flexBox headBox">
  9. <el-form-item label="配置名称:" prop="secrete">
  10. <el-select v-model="form.secrete">
  11. <el-option
  12. v-for="item in confList"
  13. :label="item.caption"
  14. :value="item.code"
  15. :key="item.code"
  16. ></el-option>
  17. </el-select>
  18. </el-form-item>
  19. <el-form-item label="配置描述:" prop="title">
  20. <el-input
  21. placeholder="请输入"
  22. maxlength="150"
  23. v-autoTrim="{ obj: form, key: 'title' }"
  24. v-model="form.title"
  25. >
  26. </el-input>
  27. </el-form-item>
  28. <el-form-item label="车辆名称:" prop="title">
  29. <el-input
  30. placeholder="请输入"
  31. maxlength="150"
  32. v-autoTrim="{ obj: form, key: 'title' }"
  33. v-model="form.title"
  34. >
  35. </el-input>
  36. </el-form-item>
  37. <el-form-item label="车辆描述:" prop="title">
  38. <el-input
  39. placeholder="请输入"
  40. maxlength="150"
  41. v-autoTrim="{ obj: form, key: 'title' }"
  42. v-model="form.title"
  43. >
  44. </el-input>
  45. </el-form-item>
  46. </div>
  47. <div class="contentBox">
  48. <div>
  49. <el-button type="primary" class="previewBtn"
  50. >预览</el-button
  51. >
  52. <handle-config-list
  53. v-for="index in 4"
  54. :isActiveA="index === 1"
  55. :titleCode="index - 1"
  56. :key="index"
  57. @curItem="curItem"
  58. ></handle-config-list>
  59. </div>
  60. <div class="model">
  61. <img src="../../assets/common/image/car.png" width="100%" />
  62. </div>
  63. <div class="conditions">
  64. <div class="titlePanel">
  65. <i class="el-icon el-icon-video-camera"></i>
  66. <span class="name">{{ curTitle }}</span>
  67. </div>
  68. <div class="forms">
  69. <el-form-item label="X(M):" prop="x">
  70. <el-input
  71. placeholder="请输入"
  72. maxlength="15"
  73. v-autoTrim="{ obj: form, key: 'x' }"
  74. v-model="form.x"
  75. >
  76. </el-input>
  77. </el-form-item>
  78. <el-form-item label="Y(M):" prop="y">
  79. <el-input
  80. placeholder="请输入"
  81. maxlength="15"
  82. v-autoTrim="{ obj: form, key: 'y' }"
  83. v-model="form.y"
  84. >
  85. </el-input>
  86. </el-form-item>
  87. <el-form-item label="Z(M):" prop="z">
  88. <el-input
  89. placeholder="请输入"
  90. maxlength="15"
  91. v-autoTrim="{ obj: form, key: 'z' }"
  92. v-model="form.z"
  93. >
  94. </el-input>
  95. </el-form-item>
  96. <el-form-item label="横摆角(deg):" prop="title">
  97. <el-input
  98. placeholder="请输入"
  99. maxlength="15"
  100. v-autoTrim="{ obj: form, key: 'title' }"
  101. v-model="form.title"
  102. >
  103. </el-input>
  104. </el-form-item>
  105. <el-form-item label="俯仰角(deg):" prop="title">
  106. <el-input
  107. placeholder="请输入"
  108. maxlength="15"
  109. v-autoTrim="{ obj: form, key: 'title' }"
  110. v-model="form.title"
  111. >
  112. </el-input>
  113. </el-form-item>
  114. <el-form-item label="翻滚角(deg):" prop="title">
  115. <el-input
  116. placeholder="请输入"
  117. maxlength="15"
  118. v-autoTrim="{ obj: form, key: 'title' }"
  119. v-model="form.title"
  120. >
  121. </el-input>
  122. </el-form-item>
  123. </div>
  124. </div>
  125. </div>
  126. <div class="btns">
  127. <el-button type="primary" @click="save">保存</el-button>
  128. <el-button type="primary">取消</el-button>
  129. <el-button type="primary">分享</el-button>
  130. </div>
  131. </el-form>
  132. </div>
  133. </template>
  134. <script>
  135. import handleConfigList from "./components/handleConfigList.vue";
  136. export default {
  137. name: "addVehicleConfiguration", // 新增车辆配置
  138. components: { handleConfigList },
  139. data() {
  140. let validateNum = (rule, value, callback) => {
  141. // !/^(-?\d+)(\.\d{1,2})?$/.test(value) &&
  142. !/^(-?(0|[1-9][0-9]+))(\.\d{1,2})?$/.test(value) &&
  143. callback(new Error(rule.message));
  144. callback();
  145. };
  146. return {
  147. confId: "l2s2d3k4j5fl90898",
  148. confList: [{ caption: "玩儿", code: 1 }],
  149. curTitle: "水电费可接受的李逵负荆",
  150. form: {
  151. title: "",
  152. content: "",
  153. sendto: "",
  154. sendtoIds: "",
  155. md5PathList: [],
  156. secrete: "",
  157. x: "",
  158. y: "",
  159. z: "",
  160. },
  161. rules: {
  162. title: [
  163. { required: true, message: "请输入标题", trigger: "blur" },
  164. ],
  165. content: [
  166. { required: true, message: "请输入内容", trigger: "blur" },
  167. ],
  168. sendto: [
  169. {
  170. required: true,
  171. message: "请选择发送对象",
  172. trigger: "change",
  173. },
  174. ],
  175. secrete: [
  176. { required: true, message: "请选择密级", trigger: "blur" },
  177. ],
  178. x: [
  179. {
  180. required: true,
  181. message: "请输入X轴坐标",
  182. trigger: "blur",
  183. },
  184. {
  185. validator: validateNum,
  186. message: "请输入最多带有2位小数的数字",
  187. trigger: ["blur"],
  188. },
  189. ],
  190. y: [
  191. {
  192. required: true,
  193. message: "请输入Y轴坐标",
  194. trigger: "blur",
  195. },
  196. {
  197. validator: validateNum,
  198. message: "请输入最多带有2位小数的数字",
  199. trigger: ["blur"],
  200. },
  201. ],
  202. z: [
  203. {
  204. required: true,
  205. message: "请输入Z轴坐标",
  206. trigger: "blur",
  207. },
  208. {
  209. validator: validateNum,
  210. message: "请输入最多带有2位小数的数字",
  211. trigger: ["blur"],
  212. },
  213. ],
  214. },
  215. };
  216. },
  217. computed: {},
  218. methods: {
  219. save() {
  220. this.$refs.form.validate().then(
  221. async (valid) => {
  222. console.log(6);
  223. },
  224. (valid) => {
  225. // 表单校验失败
  226. this.$message.error("错了哦");
  227. }
  228. );
  229. },
  230. curItem(title) {
  231. this.curTitle = title;
  232. },
  233. },
  234. // mounted: {},
  235. };
  236. </script>
  237. <style lang='less' scoped>
  238. .el-form {
  239. margin: 55px 50px 0;
  240. }
  241. .headBox {
  242. .el-form-item {
  243. margin-right: 20px;
  244. }
  245. }
  246. .inputBox.flexBox {
  247. margin-bottom: 22px;
  248. .label {
  249. width: 88px;
  250. }
  251. div {
  252. line-height: 32px;
  253. }
  254. }
  255. .contentBox {
  256. display: flex;
  257. justify-content: space-between;
  258. margin-top: 30px;
  259. .previewBtn {
  260. width: 100%;
  261. margin-bottom: 15px;
  262. }
  263. .model {
  264. width: 400px;
  265. }
  266. .conditions {
  267. .titlePanel {
  268. padding-bottom: 30px;
  269. color: @themeColor;
  270. .name {
  271. margin-left: 10px;
  272. }
  273. }
  274. .forms /deep/ .el-form-item__label {
  275. width: 120px !important;
  276. }
  277. .forms /deep/ .el-form-item__content {
  278. margin-left: 120px !important;
  279. }
  280. }
  281. }
  282. .btns {
  283. padding-top: 30px;
  284. text-align: center;
  285. }
  286. </style>