123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296 |
- <template>
- <div class="hgxsc">
- <div class="rangDiv">
- <div class="block-title">选址范围</div>
- <range :keys="['hx', 'sc']" class="range" ref="range" />
- </div>
- <el-form :model="ruleForm" label-width="75px">
- <div class="block-title">基本信息</div>
- <el-form-item label="项目名称:" prop="xmmc">
- <el-input
- v-model="ruleForm.xmmc"
- size="mini"
- placeholder="请输入项目名称"
- ></el-input>
- </el-form-item>
- <el-form-item label="项目类型:" prop="xmlx">
- <el-input
- v-model="ruleForm.xmlx"
- size="mini"
- placeholder="请输入项目类型"
- ></el-input>
- </el-form-item>
- <el-form-item label="建设单位:" prop="jsdw">
- <el-input
- v-model="ruleForm.jsdw"
- size="mini"
- placeholder="请输入建设单位"
- ></el-input>
- </el-form-item>
- </el-form>
- <div class="block-title">
- 分析因子
- <div
- v-show="$store.getters.name == 'admin'"
- class="posi-abs pointer"
- style="right: 0; top: 1px; color: #409eff"
- @click="updateScx"
- >
- 关联资源目录
- </div>
- </div>
- <div class="treeDiv">
- <el-tree
- :data="treedata"
- ref="tree"
- show-checkbox
- node-key="id"
- :props="defaultProps"
- :default-expanded-keys="xz"
- >
- </el-tree>
- </div>
- <div class="bottomBtns">
- <el-button round class="btn-style" @click="reset">重置</el-button>
- <el-button type="primary" round class="btn-style" @click="submitData">
- 确定</el-button
- >
- </div>
- </div>
- </template>
- <script>
- import { Add, GetScx, UpdateScx } from "@/api/ghss/hgxfx.js";
- import { ElMessage, ElMessageBox } from "element-ui";
- import range from "@/components/mapview/range.vue"; ///mapview/range
- import hgxfx from "../../../../static/data/ghss/data.js";
- export default {
- components: {
- range,
- },
- props: {},
- data() {
- return {
- xz: [],
- treedata: [
- {
- id: 1,
- label: "一级控制线",
- children: [],
- },
- {
- id: 2,
- label: "二级控制线",
- children: [],
- },
- ],
- defaultProps: {
- children: "children",
- label: "label",
- },
- ruleForm: {
- xmmc: "",
- jsdw: "",
- xmlx: "",
- xzdw: "",
- ydxz_bsm: "",
- yjydlx: "",
- fwlx: 1,
- xzfw: "",
- xzmj: 0,
- },
- options: [],
- };
- },
- mounted() {
- this.getTreeData(); //getKzx();
- },
- methods: {
- //获取检查要素
- getKzx() {
- GetScx().then((res) => {
- if (res) {
- let GetAll = res.data;
- for (var t in GetAll) {
- const getall = GetAll[t];
- if (getall.kzxjb == 1) {
- this.treedata[0].children.push({
- id: getall.bsm,
- label: getall.ysmc,
- });
- this.xz.push(getall.bsm);
- } else if (getall.kzxjb == 2) {
- this.treedata[1].children.push({
- id: getall.bsm,
- label: getall.ysmc,
- });
- this.xz.push(getall.bsm);
- } else {
- let bool = false;
- for (let i = 0; i < this.treedata.length; i++) {
- if (this.treedata[i].id == getall.kzxjb) {
- bool = true;
- this.treedata[i].children.push({
- id: getall.bsm,
- label: getall.ysmc,
- });
- break;
- }
- }
- if (!bool) {
- this.treedata.push({
- id: getall.kzxjb,
- label: getall.tjzd,
- children: [
- {
- id: getall.bsm,
- label: getall.ysmc,
- },
- ],
- });
- }
- }
- }
- setTimeout(() => {
- this.$refs.tree.setCheckedKeys(this.xz);
- }, 1);
- }
- });
- },
- //获取检查要素
- getTreeData() {
- this.treedata = [
- { id: "XZFX", label: "现状分析" },
- {
- id: 2,
- label: "三线分析",
- children: [
- { id: "YJJBNT", label: "永久基本农田" },
- { id: "CZKFBJ", label: "城镇开发边界" },
- { id: "STBHHX", label: "生态保护红线" },
- ],
- },
- // { id: "TDLYGH", label: "土地利用规划" },
- { id: "KZXXXGH", label: "控制性详细规划" },
- ];
- },
- updateScx() {
- UpdateScx().then((res) => {
- if (res.statuscode == 200) {
- ElMessage.success(res.message);
- } else {
- ElMessage.error(res.message);
- }
- });
- },
- setydlx() {
- this.ruleForm.yjydlx = this.$refs.ydcascader
- .getCheckedNodes()[0]
- .pathLabels.join(",");
- this.$refs.ydcascader.togglePopperVisible();
- },
- reset() {
- this.ruleForm = {
- xmmc: "",
- jsdw: "",
- xmlx: "",
- xzdw: "",
- ydxz_bsm: "",
- yjydlx: "",
- scxs: [],
- fwlx: 1,
- xzfw: "",
- xzmj: 0,
- };
- this.$refs.range.reset();
- },
- submitData() {
- //更新范围
- var _temp = this.$refs.range.getRange();
- this.ruleForm.xzfw = _temp.xzfw;
- this.ruleForm.xzmj = _temp.xzmj || hgxfx.xzmj;
- this.is_form()
- .then((res) => {
- // ElMessageBox.confirm("是否开始进行合规性检查?", "合规性检查", {
- // confirmButtonText: "确定",
- // cancelButtonText: "取消",
- // type: "warning",
- // }).then(() => {
- this.$emit("updateParent", "loading", true);
- Add({ ...this.ruleForm }).then((res) => {
- if (res.success) {
- this.$emit("updateParent", "rzMc", this.ruleForm.xmmc);
- this.$emit("updateParent", "rzBsm", res.data);
- this.$emit("updateParent", "rwBsm", res.data);
- }
- this.$emit("updateParent", "loading", false);
- });
- // });
- })
- .catch((res) => {
- console.log("RES", res);
- // ElMessage.warning(res);
- });
- },
- is_form() {
- this.ruleForm.scxs = this.$refs.tree.getCheckedNodes(true).map((item) => {
- return item.id;
- });
- return new Promise((resolve, reject) => {
- if (this.ruleForm.xzmj == 0) {
- reject("请填写范围的数据!");
- }
- if (this.ruleForm.xmmc == "") {
- reject("请填写项目名称");
- }
- if (this.ruleForm.jsdw == "") {
- reject("请填写建设单位");
- }
- if (this.ruleForm.xmlx == "") {
- reject("请填写项目类型");
- }
- // if (this.ruleForm.ydxz_bsm == ("" || null)) {
- // reject("请选择用地性质");
- // }
- if (this.ruleForm.scxs.length == 0) {
- reject("至少选择一个项目信息");
- }
- resolve(true);
- });
- },
- },
- watch: {},
- };
- </script>
- <style lang="scss" scoped>
- .hgxsc {
- height: 100%;
- line-height: 40px;
- .rangDiv {
- width: 100%;
- // height: 100px;
- display: flex;
- justify-content: space-between;
- }
- .range {
- flex: 1;
- width: calc(100% - 100px);
- position: absolute;
- left: 100px;
- }
- .treeDiv {
- width: 100%;
- height: calc(100% - 390px);
- padding: 7px;
- margin-bottom: 10px;
- overflow-y: auto;
- }
- }
- </style>
|