hgxsc.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  1. <template>
  2. <div class="hgxsc">
  3. <div class="rangDiv">
  4. <div class="block-title">选址范围</div>
  5. <range :keys="['hx', 'sc']" class="range" ref="range" />
  6. </div>
  7. <el-form :model="ruleForm" label-width="75px">
  8. <div class="block-title">基本信息</div>
  9. <el-form-item label="项目名称:" prop="xmmc">
  10. <el-input
  11. v-model="ruleForm.xmmc"
  12. size="mini"
  13. placeholder="请输入项目名称"
  14. ></el-input>
  15. </el-form-item>
  16. <el-form-item label="项目类型:" prop="xmlx">
  17. <el-input
  18. v-model="ruleForm.xmlx"
  19. size="mini"
  20. placeholder="请输入项目类型"
  21. ></el-input>
  22. </el-form-item>
  23. <el-form-item label="建设单位:" prop="jsdw">
  24. <el-input
  25. v-model="ruleForm.jsdw"
  26. size="mini"
  27. placeholder="请输入建设单位"
  28. ></el-input>
  29. </el-form-item>
  30. </el-form>
  31. <div class="block-title">
  32. 分析因子
  33. <div
  34. v-show="$store.getters.name == 'admin'"
  35. class="posi-abs pointer"
  36. style="right: 0; top: 1px; color: #409eff"
  37. @click="updateScx"
  38. >
  39. 关联资源目录
  40. </div>
  41. </div>
  42. <div class="treeDiv">
  43. <el-tree
  44. :data="treedata"
  45. ref="tree"
  46. show-checkbox
  47. node-key="id"
  48. :props="defaultProps"
  49. :default-expanded-keys="xz"
  50. >
  51. </el-tree>
  52. </div>
  53. <div class="bottomBtns">
  54. <el-button round class="btn-style" @click="reset">重置</el-button>
  55. <el-button type="primary" round class="btn-style" @click="submitData">
  56. 确定</el-button
  57. >
  58. </div>
  59. </div>
  60. </template>
  61. <script>
  62. import { Add, GetScx, UpdateScx } from "@/api/ghss/hgxfx.js";
  63. import { ElMessage, ElMessageBox } from "element-ui";
  64. import range from "@/components/mapview/range.vue"; ///mapview/range
  65. import hgxfx from "../../../../static/data/ghss/data.js";
  66. export default {
  67. components: {
  68. range,
  69. },
  70. props: {},
  71. data() {
  72. return {
  73. xz: [],
  74. treedata: [
  75. {
  76. id: 1,
  77. label: "一级控制线",
  78. children: [],
  79. },
  80. {
  81. id: 2,
  82. label: "二级控制线",
  83. children: [],
  84. },
  85. ],
  86. defaultProps: {
  87. children: "children",
  88. label: "label",
  89. },
  90. ruleForm: {
  91. xmmc: "",
  92. jsdw: "",
  93. xmlx: "",
  94. xzdw: "",
  95. ydxz_bsm: "",
  96. yjydlx: "",
  97. fwlx: 1,
  98. xzfw: "",
  99. xzmj: 0,
  100. },
  101. options: [],
  102. };
  103. },
  104. mounted() {
  105. this.getTreeData(); //getKzx();
  106. },
  107. methods: {
  108. //获取检查要素
  109. getKzx() {
  110. GetScx().then((res) => {
  111. if (res) {
  112. let GetAll = res.data;
  113. for (var t in GetAll) {
  114. const getall = GetAll[t];
  115. if (getall.kzxjb == 1) {
  116. this.treedata[0].children.push({
  117. id: getall.bsm,
  118. label: getall.ysmc,
  119. });
  120. this.xz.push(getall.bsm);
  121. } else if (getall.kzxjb == 2) {
  122. this.treedata[1].children.push({
  123. id: getall.bsm,
  124. label: getall.ysmc,
  125. });
  126. this.xz.push(getall.bsm);
  127. } else {
  128. let bool = false;
  129. for (let i = 0; i < this.treedata.length; i++) {
  130. if (this.treedata[i].id == getall.kzxjb) {
  131. bool = true;
  132. this.treedata[i].children.push({
  133. id: getall.bsm,
  134. label: getall.ysmc,
  135. });
  136. break;
  137. }
  138. }
  139. if (!bool) {
  140. this.treedata.push({
  141. id: getall.kzxjb,
  142. label: getall.tjzd,
  143. children: [
  144. {
  145. id: getall.bsm,
  146. label: getall.ysmc,
  147. },
  148. ],
  149. });
  150. }
  151. }
  152. }
  153. setTimeout(() => {
  154. this.$refs.tree.setCheckedKeys(this.xz);
  155. }, 1);
  156. }
  157. });
  158. },
  159. //获取检查要素
  160. getTreeData() {
  161. this.treedata = [
  162. { id: "XZFX", label: "现状分析" },
  163. {
  164. id: 2,
  165. label: "三线分析",
  166. children: [
  167. { id: "YJJBNT", label: "永久基本农田" },
  168. { id: "CZKFBJ", label: "城镇开发边界" },
  169. { id: "STBHHX", label: "生态保护红线" },
  170. ],
  171. },
  172. // { id: "TDLYGH", label: "土地利用规划" },
  173. { id: "KZXXXGH", label: "控制性详细规划" },
  174. ];
  175. },
  176. updateScx() {
  177. UpdateScx().then((res) => {
  178. if (res.statuscode == 200) {
  179. ElMessage.success(res.message);
  180. } else {
  181. ElMessage.error(res.message);
  182. }
  183. });
  184. },
  185. setydlx() {
  186. this.ruleForm.yjydlx = this.$refs.ydcascader
  187. .getCheckedNodes()[0]
  188. .pathLabels.join(",");
  189. this.$refs.ydcascader.togglePopperVisible();
  190. },
  191. reset() {
  192. this.ruleForm = {
  193. xmmc: "",
  194. jsdw: "",
  195. xmlx: "",
  196. xzdw: "",
  197. ydxz_bsm: "",
  198. yjydlx: "",
  199. scxs: [],
  200. fwlx: 1,
  201. xzfw: "",
  202. xzmj: 0,
  203. };
  204. this.$refs.range.reset();
  205. },
  206. submitData() {
  207. //更新范围
  208. var _temp = this.$refs.range.getRange();
  209. this.ruleForm.xzfw = _temp.xzfw;
  210. this.ruleForm.xzmj = _temp.xzmj || hgxfx.xzmj;
  211. this.is_form()
  212. .then((res) => {
  213. // ElMessageBox.confirm("是否开始进行合规性检查?", "合规性检查", {
  214. // confirmButtonText: "确定",
  215. // cancelButtonText: "取消",
  216. // type: "warning",
  217. // }).then(() => {
  218. this.$emit("updateParent", "loading", true);
  219. Add({ ...this.ruleForm }).then((res) => {
  220. if (res.success) {
  221. this.$emit("updateParent", "rzMc", this.ruleForm.xmmc);
  222. this.$emit("updateParent", "rzBsm", res.data);
  223. this.$emit("updateParent", "rwBsm", res.data);
  224. }
  225. this.$emit("updateParent", "loading", false);
  226. });
  227. // });
  228. })
  229. .catch((res) => {
  230. console.log("RES", res);
  231. // ElMessage.warning(res);
  232. });
  233. },
  234. is_form() {
  235. this.ruleForm.scxs = this.$refs.tree.getCheckedNodes(true).map((item) => {
  236. return item.id;
  237. });
  238. return new Promise((resolve, reject) => {
  239. if (this.ruleForm.xzmj == 0) {
  240. reject("请填写范围的数据!");
  241. }
  242. if (this.ruleForm.xmmc == "") {
  243. reject("请填写项目名称");
  244. }
  245. if (this.ruleForm.jsdw == "") {
  246. reject("请填写建设单位");
  247. }
  248. if (this.ruleForm.xmlx == "") {
  249. reject("请填写项目类型");
  250. }
  251. // if (this.ruleForm.ydxz_bsm == ("" || null)) {
  252. // reject("请选择用地性质");
  253. // }
  254. if (this.ruleForm.scxs.length == 0) {
  255. reject("至少选择一个项目信息");
  256. }
  257. resolve(true);
  258. });
  259. },
  260. },
  261. watch: {},
  262. };
  263. </script>
  264. <style lang="scss" scoped>
  265. .hgxsc {
  266. height: 100%;
  267. line-height: 40px;
  268. .rangDiv {
  269. width: 100%;
  270. // height: 100px;
  271. display: flex;
  272. justify-content: space-between;
  273. }
  274. .range {
  275. flex: 1;
  276. width: calc(100% - 100px);
  277. position: absolute;
  278. left: 100px;
  279. }
  280. .treeDiv {
  281. width: 100%;
  282. height: calc(100% - 390px);
  283. padding: 7px;
  284. margin-bottom: 10px;
  285. overflow-y: auto;
  286. }
  287. }
  288. </style>