addProjectInfo.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  1. <template>
  2. <div
  3. class="ZTGlobal"
  4. style="width: 100%; padding: 1rem 1rem 0rem 1rem; color: white"
  5. >
  6. <el-row :gutter="10">
  7. <el-col :span="24">
  8. <el-form ref="ruleForm" :model="form" :rules="rules" label-width="90px">
  9. <el-form-item label="项目名称" size="mini" prop="projectname">
  10. <el-col :span="20">
  11. <el-input size="mini" v-model="form.projectname"></el-input>
  12. </el-col>
  13. </el-form-item>
  14. <el-form-item label="申请单位" size="mini" prop="applicant">
  15. <el-col :span="20">
  16. <el-input size="mini" v-model="form.applicant"></el-input>
  17. </el-col>
  18. </el-form-item>
  19. <el-form-item label="项目地址" size="mini" prop="projectaddress">
  20. <el-col :span="20">
  21. <el-input size="mini" v-model="form.projectaddress"></el-input>
  22. </el-col>
  23. </el-form-item>
  24. <el-form-item label="地块编号" size="mini" prop="plotnumber">
  25. <el-col :span="20">
  26. <el-input size="mini" v-model="form.plotnumber"></el-input>
  27. </el-col>
  28. </el-form-item>
  29. <el-form-item label="用地面积" size="mini" prop="landarea">
  30. <el-col :span="20">
  31. <el-input size="mini" v-model.number="form.landarea"></el-input>
  32. </el-col>
  33. <el-col :span="4">平方米</el-col>
  34. </el-form-item>
  35. <el-form-item label="用地性质" size="mini" prop="landusenature">
  36. <el-col :span="20">
  37. <el-select
  38. v-model="form.landusenature"
  39. placeholder="用地性质"
  40. clearable
  41. >
  42. <el-option
  43. v-for="dict in zt_landusenature"
  44. :key="dict.value"
  45. :label="dict.label"
  46. :value="dict.value"
  47. />
  48. </el-select>
  49. </el-col>
  50. </el-form-item>
  51. <el-form-item label="项目定位" size="mini" prop="projectpositioning">
  52. <el-col :span="20">
  53. <el-input
  54. size="mini"
  55. v-model="form.projectpositioning"
  56. ></el-input>
  57. </el-col>
  58. </el-form-item>
  59. <el-form-item
  60. label="项目总投资"
  61. size="mini"
  62. prop="totalprojectinvestment"
  63. >
  64. <el-col :span="20">
  65. <el-input
  66. size="mini"
  67. v-model.number="form.totalprojectinvestment"
  68. ></el-input>
  69. </el-col>
  70. <el-col :span="4">亿元</el-col>
  71. </el-form-item>
  72. <el-form-item label="资金来源" size="mini" prop="fundingsource">
  73. <el-col :span="20">
  74. <el-select
  75. v-model="form.fundingsource"
  76. placeholder="资金来源"
  77. clearable
  78. >
  79. <el-option
  80. v-for="dict in zt_fundingsource"
  81. :key="dict.value"
  82. :label="dict.label"
  83. :value="dict.value"
  84. />
  85. </el-select>
  86. <!-- <el-input size="mini" v-model="form.fundingsource"></el-input> -->
  87. </el-col>
  88. </el-form-item>
  89. <el-form-item label="土地情况" size="mini" prop="landsituation">
  90. <el-col :span="20">
  91. <el-input
  92. type="textarea"
  93. :autosize="{ minRows: 2, maxRows: 4 }"
  94. size="mini"
  95. v-model="form.landsituation"
  96. ></el-input>
  97. </el-col>
  98. </el-form-item>
  99. </el-form>
  100. <div class="SaveCenter">
  101. <el-button type="primary" @click="submitForm('ruleForm')"
  102. >完成</el-button
  103. >
  104. <el-button @click="resetForm('ruleForm')">重置</el-button>
  105. </div>
  106. </el-col>
  107. </el-row>
  108. </div>
  109. </template>
  110. <script>
  111. import { v4 as uuidv4 } from "uuid";
  112. import {
  113. addProjectinformation,
  114. updateProjectinformation,
  115. } from "@/api/zt/ztApi.js";
  116. export default {
  117. data() {
  118. return {
  119. form: {
  120. id: "",
  121. meetingprogress: "0",
  122. applicant: "",
  123. projectname: "",
  124. projectaddress: "",
  125. plotnumber: "",
  126. landarea: "",
  127. landusenature: "",
  128. projectpositioning: "",
  129. landsituation: "",
  130. totalprojectinvestment: "",
  131. fundingsource: "",
  132. },
  133. zt_landusenature: window.dict.zt_landusenature,
  134. zt_fundingsource: window.dict.zt_fundingsource,
  135. rules: {
  136. projectname: [
  137. { required: true, message: "请输入项目名称", trigger: "blur" },
  138. ],
  139. plotnumber: [
  140. { required: true, message: "请输入地块编号", trigger: "blur" },
  141. ],
  142. landusenature: [
  143. { required: true, message: "用地性质", trigger: "blur" },
  144. ],
  145. landarea: [
  146. { required: true, message: "不能为空", trigger: "blur" },
  147. { type: "number", message: "必须为数字值", trigger: "blur" },
  148. { validator: this.validateNumber, trigger: "blur" },
  149. ],
  150. totalprojectinvestment: [
  151. { required: true, message: "不能为空", trigger: "blur" },
  152. { type: "number", message: "必须为数字值", trigger: "blur" },
  153. { validator: this.validateNumber, trigger: "blur" },
  154. ],
  155. },
  156. };
  157. },
  158. props: {
  159. info: {
  160. type: Object,
  161. default: () => {
  162. return {};
  163. },
  164. },
  165. layerid: {
  166. type: String,
  167. default: "",
  168. },
  169. lydata: {
  170. type: Object,
  171. default: () => {
  172. return {};
  173. },
  174. },
  175. lyoption: {
  176. type: Object,
  177. default: () => {
  178. return {};
  179. },
  180. },
  181. },
  182. computed: {},
  183. mounted() {
  184. debugger;
  185. // this.init();
  186. if (this.info.id) {
  187. this.form = this.info;
  188. if (this.form.landarea) {
  189. this.form.landarea = Number(this.form.landarea);
  190. }
  191. if (this.form.totalprojectinvestment) {
  192. this.form.totalprojectinvestment = Number(
  193. this.form.totalprojectinvestment
  194. );
  195. }
  196. }
  197. },
  198. methods: {
  199. validateNumber(rule, value, callback) {
  200. if (value < 0) {
  201. return callback(new Error("数字需大于等于0"));
  202. } else {
  203. callback();
  204. }
  205. },
  206. submitForm(formName) {
  207. let that = this;
  208. this.$refs[formName].validate(async (valid) => {
  209. if (valid) {
  210. if (this.info.id) {
  211. debugger;
  212. let result = await updateProjectinformation(that.form);
  213. if (result.code) {
  214. that.$message({
  215. message: "修改成功",
  216. type: "success",
  217. });
  218. that.$layer.close(that.layerid);
  219. }
  220. } else {
  221. that.form.id = uuidv4();
  222. that.form.meetingprogress = "0";
  223. // window.projectinformation.push(that.form);
  224. let result = await addProjectinformation(that.form);
  225. if (result.code) {
  226. that.$message({
  227. message: "添加成功",
  228. type: "success",
  229. });
  230. that.$layer.close(that.layerid);
  231. }
  232. }
  233. debugger;
  234. // that.lyoption.cancel();
  235. } else {
  236. return false;
  237. }
  238. });
  239. },
  240. resetForm(formName) {
  241. this.$refs[formName].resetFields();
  242. },
  243. },
  244. };
  245. </script>
  246. <style lang="scss">
  247. @import "@/../../zt.scss";
  248. </style>
  249. <style lang="scss" scoped></style>