check.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. <template>
  2. <div class="hgxsc">
  3. <el-form
  4. :model="ruleForm"
  5. ref="ruleForm"
  6. label-width="100px"
  7. :rules="rules"
  8. >
  9. <el-form-item label="分析范围:" prop="xzmj">
  10. <range type="hgxfx" :keys="['hx', 'sc']" class="range" ref="range" />
  11. </el-form-item>
  12. <el-form-item label="预检名称:" prop="xmmc">
  13. <el-input
  14. v-model="ruleForm.xmmc"
  15. size="mini"
  16. placeholder="请输入预检名称"
  17. ></el-input>
  18. </el-form-item>
  19. </el-form>
  20. <div class="bottomBtns">
  21. <span class="clearBtn" @click="reset">取消</span>
  22. <span class="sureBtn" @click="submitData">确定</span>
  23. </div>
  24. </div>
  25. </template>
  26. <script>
  27. import { Add } from "@/api/ghss/hgxfx.js";
  28. import { Message, MessageBox } from "element-ui";
  29. import range from "@/components/mapView/range.vue"; ///mapview/range
  30. import moment from "moment";
  31. export default {
  32. components: {
  33. range,
  34. },
  35. props: {},
  36. data() {
  37. return {
  38. ruleForm: {
  39. xmmc: "",
  40. xzfw: "",
  41. xzmj: 0,
  42. },
  43. rules: {
  44. xzmj: [{ required: true, message: "请填写范围的数据" }],
  45. xmmc: [
  46. { required: true, message: "请输入预检名称", trigger: "blur" },
  47. {
  48. min: 3,
  49. max: 50,
  50. message: "长度在 3 到 50 个字符",
  51. trigger: "blur",
  52. },
  53. ],
  54. },
  55. };
  56. },
  57. mounted() {
  58. this.initform();
  59. },
  60. methods: {
  61. initform() {
  62. this.ruleForm.xmmc = `整治预检_${moment(new Date()).format(
  63. "YYYYMMDDHHmmss"
  64. )}`;
  65. },
  66. reset() {
  67. this.ruleForm = {
  68. xmmc: "",
  69. xzfw: "",
  70. xzmj: 0,
  71. };
  72. this.$refs.range.reset();
  73. },
  74. submitData() {
  75. //更新范围
  76. var _temp = this.$refs.range.getRange();
  77. this.ruleForm.xzfw = _temp.xzfw;
  78. this.ruleForm.xzmj = _temp.xzmj;
  79. console.log(this.ruleForm);
  80. this.$refs.ruleForm.validate((valid) => {
  81. if (valid) {
  82. if (!this.ruleForm.xzfw) {
  83. Message.warning("请绘制或导入选址范围!");
  84. return;
  85. }
  86. MessageBox.confirm("是否开始进行整治预检?", "整治预检", {
  87. confirmButtonText: "确定",
  88. cancelButtonText: "取消",
  89. type: "warning",
  90. }).then(() => {
  91. this.$emit("updateParent", "loading", true);
  92. Add({ ...this.ruleForm }).then((res) => {
  93. if (res.success) {
  94. this.$emit("updateParent", "nowObj", this.ruleForm);
  95. this.$emit("updateParent", "rzBsm", res.message);
  96. this.reset();
  97. } else {
  98. Message.warning(res.message);
  99. }
  100. this.$emit("updateParent", "loading", false);
  101. });
  102. });
  103. }
  104. });
  105. },
  106. },
  107. watch: {},
  108. };
  109. </script>
  110. <style lang="scss" scoped>
  111. .hgxsc {
  112. height: 100%;
  113. line-height: 40px;
  114. .rangDiv {
  115. width: 100%;
  116. // height: 100px;
  117. display: flex;
  118. justify-content: space-between;
  119. }
  120. .range {
  121. flex: 1;
  122. width: 100%;
  123. // position: absolute;
  124. // left: 100px;
  125. }
  126. }
  127. /deep/ .el-input .el-input--mini .el-input--suffix {
  128. width: 100%;
  129. }
  130. /deep/ .el-select {
  131. width: 100%;
  132. }
  133. /deep/ .el-form-item__error {
  134. top: 32px !important;
  135. }
  136. </style>