fxsz.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394
  1. <!--
  2. * @Author: 王志鹏
  3. * @Date: 2023-05-25 15:34:37
  4. * @LastEditors: siwei
  5. * @LastEditTime: 2023-05-30 14:20:37
  6. * @FilePath: \website\src\components\ghfxpj\wtsbztyy\fxsz.vue
  7. -->
  8. <template>
  9. <div class="fxsz max-box overflow-hidden flex-box column posi-rel">
  10. <div class="max-width flex-box column padding-10 box-sizing">
  11. <div class="block-title margin-top-5">{{ title }}说明</div>
  12. <div class="wenzi max-width column box-sizing" style="margin-top: 10px">
  13. {{ ctfxsm }}
  14. </div>
  15. </div>
  16. <div
  17. v-if="fxwdList.length > 1"
  18. class="max-width flex-box column padding-10 box-sizing"
  19. style="padding-top: 0"
  20. >
  21. <div class="block-title margin-top-5">分析维度</div>
  22. <div class="max-width flex-box wrap margin-top-10">
  23. <div
  24. class="city-item pointer"
  25. v-for="item in fxwdList"
  26. :key="item.id"
  27. :class="form.act_wd == item.id ? 'act_wd' : ''"
  28. @click="changeWD(item)"
  29. >
  30. {{ item.name }}
  31. </div>
  32. </div>
  33. </div>
  34. <div class="max-width height-100-55 flex-box column">
  35. <div
  36. class="max-width flex-box column padding-10 box-sizing"
  37. style="padding-top: 0"
  38. >
  39. <div class="block-title margin-top-5">分析范围</div>
  40. <div class="max-width flex-box wrap margin-top-10">
  41. <div
  42. class="city-item pointer"
  43. v-for="(item, index) in xzqList"
  44. :key="index"
  45. :class="form.act_xzq == item.value ? 'act_xzq' : ''"
  46. @click="changeXzq(item)"
  47. >
  48. {{ item.label }}
  49. </div>
  50. </div>
  51. </div>
  52. <div
  53. v-if="fxyzList.length > 1"
  54. class="max-width flex-box column padding-10 box-sizing"
  55. style="padding-top: 0"
  56. >
  57. <div class="block-title margin-top-5">分析因子</div>
  58. <div class="max-width flex-box wrap margin-top-10">
  59. <div
  60. class="city-item pointer"
  61. v-for="item in fxyzList"
  62. :key="item.id"
  63. :class="form.act_yz == item.id ? 'act_yz' : ''"
  64. @click="changeYz(item)"
  65. >
  66. {{ item.name }}
  67. </div>
  68. </div>
  69. </div>
  70. <div
  71. class="max-width flex-box column padding-10 box-sizing"
  72. style="padding-top: 0"
  73. >
  74. <div class="block-title margin-top-5">分析年度</div>
  75. <div class="max-width flex-box wrap margin-top-10">
  76. <div
  77. class="city-item pointer"
  78. v-for="item in yearList"
  79. :key="item.year"
  80. :class="form.act_year == item.year ? 'act_year' : ''"
  81. @click="changeYear(item)"
  82. >
  83. {{ item.year }}{{ item.year.indexOf("年") > 0 ? "" : "年" }}
  84. </div>
  85. <!-- <div
  86. class="padding-top-8 padding-bottom-8 padding-left-15 padding-right-15 margin-right-4 margin-bottom-5 pointer select-none"
  87. >
  88. ......
  89. </div> -->
  90. </div>
  91. </div>
  92. <div
  93. v-if="fxdlList.length > 0"
  94. class="max-width flex-box column padding-10 box-sizing"
  95. style="padding-top: 0"
  96. >
  97. <div class="block-title margin-top-5">分析地类</div>
  98. <div class="max-width flex-box wrap margin-top-10">
  99. <div
  100. class="city-item pointer"
  101. v-for="item in fxdlList"
  102. :key="item.id"
  103. :class="form.act_yz == item.id ? 'act_yz' : ''"
  104. @click="changeDl(item)"
  105. >
  106. {{ item.name }}
  107. </div>
  108. </div>
  109. </div>
  110. <div
  111. v-if="zytype != '7'"
  112. class="max-width flex-box column padding-10 box-sizing"
  113. style="padding-top: 0"
  114. >
  115. <div class="block-title margin-top-5">结果名称</div>
  116. <div class="max-width flex-box wrap margin-top-10">
  117. <el-input v-model="form.jgmc" />
  118. </div>
  119. </div>
  120. </div>
  121. <div
  122. class="posi-abs height-55 bottom-0 max-width flex-box justify-between align-center"
  123. style="background: #efefef; bottom: 0; z-index: 9"
  124. >
  125. <div class="max-height flex-box align-center margin-left-22"></div>
  126. <div class="max-height flex-box align-center">
  127. <el-button round class="btn-style" @click="reset">重置</el-button>
  128. <el-button
  129. type="primary"
  130. round
  131. class="btn-style margin-right-22"
  132. @click="submitData"
  133. >分析</el-button
  134. >
  135. </div>
  136. </div>
  137. </div>
  138. </template>
  139. <script>
  140. import { GetXzq } from "@/api/homeApi.js";
  141. import { getSjy, getFxyz, getFxyzYear, create } from "@/api/ghfxpj/ctfxApi.js";
  142. import { reactive, toRefs } from "@vue/reactivity";
  143. import {
  144. getCurrentInstance,
  145. onMounted,
  146. onUnmounted,
  147. watch,
  148. } from "@vue/runtime-core";
  149. import { useRouter } from "vue-router";
  150. import { useStore } from "vuex";
  151. import { ElMessage } from "element-plus";
  152. export default {
  153. props: {
  154. activeTabs: {
  155. type: String,
  156. },
  157. ctfxsm: {
  158. type: String,
  159. },
  160. zytype: {
  161. type: String,
  162. },
  163. },
  164. setup(prop, context) {
  165. const { proxy } = getCurrentInstance();
  166. const store = useStore();
  167. const router = useRouter();
  168. const parent = { ...context };
  169. const fxsz = reactive({
  170. isQiXian: store.state.user.isQiXian, // 当前登录用户是否为旗县用户
  171. fxyzList: [], // 分析因子列表
  172. yearList: [], // 分析年份列表
  173. fxwdList: [], // 分析维度列表
  174. fxdlList: [], // 分析地类
  175. active_layout: true,
  176. downloadLoading: false,
  177. xzqList: [],
  178. title: router.currentRoute.value.meta.title,
  179. qdfxsm:
  180. "土地开发强度,是指建设用地总量占行政区域面积的比例。在一般情况下,土地开发强度越高,土地利用经济效益就越高,地价也相应提高;反之,如果土地开发强度不足,亦即土地利用不充分,或因土地用途确定不当而导致开发强度不足,都会减弱土地的使用价值,降低地价水平。\n按照国际惯例,一个地区国土开发强度达到30%已经是警戒线,超过该强度,人的生存环境就会受到影响。",
  181. tableData: [
  182. { xzqmc: "科尔沁区", mj: 100 },
  183. { xzqmc: "霍林郭勒市", mj: 200 },
  184. { xzqmc: "开鲁县", mj: 300 },
  185. { xzqmc: "科尔沁左翼后旗", mj: 400 },
  186. { xzqmc: "科尔沁左翼中旗", mj: 500 },
  187. { xzqmc: "库伦旗", mj: 600 },
  188. { xzqmc: "奈曼旗", mj: 700 },
  189. { xzqmc: "扎鲁特旗", mj: 800 },
  190. ],
  191. form: {
  192. act_xzq: store.state.user.user.dept.district,
  193. act_xzqmc: "",
  194. act_wd: "",
  195. act_yz: "",
  196. act_year: "",
  197. jgmc: "",
  198. },
  199. changeXzq(item) {
  200. fxsz.form.act_xzq = item.value;
  201. fxsz.form.act_xzqmc = item.label;
  202. fxsz.getYear();
  203. },
  204. changeYz(item) {
  205. fxsz.form.act_yz = item.id;
  206. fxsz.getYear();
  207. // fxsz.closeEcharts();
  208. // if (router.currentRoute.value.meta.title == "生态保护冲突分析") {
  209. // fxsz.zhuoptions.title.text = `生态极重要区内${
  210. // prop.fxyzList[fxsz.form.act_yz].label
  211. // }统计`;
  212. // } else if (router.currentRoute.value.meta.title == "农业生产冲突分析") {
  213. // fxsz.zhuoptions.title.text = `种植业不适宜区内${
  214. // prop.fxyzList[fxsz.form.act_yz].label
  215. // }统计`;
  216. // } else if (router.currentRoute.value.meta.title == "城镇建设冲突分析") {
  217. // fxsz.zhuoptions.title.text = `城镇建设不适宜区内${
  218. // prop.fxyzList[fxsz.form.act_yz].label
  219. // }统计`;
  220. // } else if (router.currentRoute.value.meta.title == "村庄用地冲突分析") {
  221. // fxsz.zhuoptions.title.text = `${
  222. // prop.fxyzList[fxsz.form.act_yz].label
  223. // }内村庄用地统计`;
  224. // }
  225. // fxsz.init();
  226. },
  227. changeDl(item) {
  228. fxsz.form.act_yz = item.id;
  229. fxsz.getYear();
  230. },
  231. changeWD(item) {
  232. fxsz.form.act_wd = item.id;
  233. fxsz.getResultName();
  234. },
  235. changeYear(item) {
  236. fxsz.form.act_year = item.year;
  237. fxsz.getResultName();
  238. },
  239. reset() {
  240. fxsz.form.act_xzq = store.state.user.user.dept.district;
  241. fxsz.form.act_xzqmc = "";
  242. fxsz.form.jgmc = "";
  243. fxsz.form.act_yz = fxsz.fxyzList[0]?.id ?? "";
  244. fxsz.form.act_wd = fxsz.fxwdList[0]?.id ?? "";
  245. fxsz.getYear();
  246. },
  247. submitData() {
  248. let fxtable = fxsz.yearList.find(
  249. (item) => item.year === fxsz.form.act_year
  250. )?.tablename;
  251. if (!fxsz.form.jgmc) {
  252. ElMessage.warning("请输入结果名称!");
  253. return;
  254. }
  255. let obj = {
  256. ssmk: prop.zytype,
  257. name: fxsz.form.jgmc,
  258. fxyz: fxsz.form.act_yz,
  259. fxyear: fxsz.form.act_year,
  260. fxtable: fxtable,
  261. sjy: fxsz.form.act_wd,
  262. xzqdm: fxsz.form.act_xzq,
  263. };
  264. obj = proxy.$comfun.setFormData(obj);
  265. create(obj).then((res) => {
  266. if (res.statuscode === 200) {
  267. parent.emit("update:activeTabs", "fxlb");
  268. }
  269. });
  270. },
  271. //#region 初始化获取
  272. init() {
  273. fxsz.loadXzq();
  274. fxsz.getFXYZ();
  275. fxsz.getSJY();
  276. },
  277. // 获取行政区分析范围
  278. loadXzq() {
  279. GetXzq({ city: true }).then((res) => {
  280. if (res.success) {
  281. if (!fxsz.isQiXian) {
  282. fxsz.xzqList = res.data;
  283. res.data[0].children.map((item) => {
  284. fxsz.xzqList.push(item);
  285. });
  286. } else {
  287. res.data[0].children.map((item) => {
  288. if (item.label === store.state.user.user.dept.district) {
  289. fxsz.xzqList.push(item);
  290. item.children.map((item2) => {
  291. fxsz.xzqList.push(item2);
  292. });
  293. }
  294. });
  295. }
  296. }
  297. });
  298. },
  299. // 获取分析因子
  300. getFXYZ() {
  301. getFxyz({ moudleid: prop.zytype }).then((res) => {
  302. if (res.statuscode === 200) {
  303. fxsz.fxyzList = res.data;
  304. if (fxsz.fxyzList.length > 0) {
  305. fxsz.changeYz(fxsz.fxyzList[0]);
  306. }
  307. }
  308. });
  309. if (prop.zytype == "7") {
  310. fxsz.fxdlList = [
  311. { name: "所有建设用地", id: 0 },
  312. { name: "商业服务业用地", id: 1 },
  313. { name: "工矿用地", id: 2 },
  314. ];
  315. }
  316. },
  317. // 获取数据源
  318. getSJY() {
  319. getSjy({ moudleid: prop.zytype }).then((res) => {
  320. if (res.statuscode === 200) {
  321. fxsz.fxwdList = res.data;
  322. if (fxsz.fxwdList.length > 0) {
  323. fxsz.changeWD(fxsz.fxwdList[0]);
  324. }
  325. store.commit("SET_CTFX_SOURCE_LAYERS", res.data);
  326. }
  327. });
  328. },
  329. // 根据分析范围和分析因子获取分析年份
  330. getYear() {
  331. getFxyzYear({
  332. bsm: fxsz.form.act_yz,
  333. xzqdm: fxsz.form.act_xzq,
  334. }).then((res) => {
  335. if (res.statuscode === 200) {
  336. fxsz.yearList = res.data;
  337. fxsz.form.act_year = fxsz.yearList[0]?.year ?? "";
  338. // if (!fxsz.form.jgmc) {
  339. fxsz.getResultName();
  340. // }
  341. }
  342. });
  343. },
  344. // 获取结果名称 默认分析年份+分析范围+分析因子+与生态保护冲突分析
  345. getResultName() {
  346. if (!fxsz.form.act_xzqmc) {
  347. fxsz.form.act_xzqmc = fxsz.xzqList.find(
  348. (item) => item.value === fxsz.form.act_xzq
  349. ).label;
  350. }
  351. let fxyzName = fxsz.fxyzList.find(
  352. (item) => item.id === fxsz.form.act_yz
  353. ).name;
  354. let fxwdName = fxsz.fxwdList.find(
  355. (item) => item.id === fxsz.form.act_wd
  356. ).name;
  357. fxsz.form.jgmc = `${fxsz.form.act_year}年${fxsz.form.act_xzqmc}${fxyzName}与${fxwdName}`;
  358. },
  359. //#endregion
  360. });
  361. onMounted(() => {
  362. fxsz.init();
  363. });
  364. return { ...toRefs(fxsz) };
  365. },
  366. };
  367. </script>
  368. <style lang="less" scoped>
  369. .fxsz {
  370. .city-item {
  371. display: inline-block;
  372. height: max-content;
  373. padding: 5px 10px;
  374. border-radius: 20px;
  375. margin: 10px 0px 0px 10px;
  376. }
  377. .act_wd,
  378. .act_xzq,
  379. .act_yz,
  380. .act_year {
  381. background-color: #2a82e4;
  382. border-radius: 20px;
  383. color: #fff;
  384. }
  385. .wenzi {
  386. white-space: pre-line;
  387. text-align: justify;
  388. }
  389. }
  390. </style>