QMSetInfo.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324
  1. <template>
  2. <!-- @blur="selectBlur($event, index)" -->
  3. <div class="ZTGlobal" style="padding: 1rem; width: 100%">
  4. <el-row :gutter="10">
  5. <el-col :span="6">青苗补偿标准:</el-col>
  6. <el-col :span="18">
  7. <el-select v-model="bcbz" style="width: 90%">
  8. <el-option
  9. v-for="item in bcbzList"
  10. :key="item.value"
  11. :label="item.label"
  12. :value="item.value"
  13. ></el-option>
  14. </el-select>
  15. </el-col>
  16. </el-row>
  17. <el-row>
  18. <el-col :span="6">农作物补偿:</el-col>
  19. <el-col :span="16"
  20. ><el-input
  21. style="width: 100%"
  22. type="number"
  23. placeholder="请输入"
  24. readonly
  25. v-model="curBCBZ.BCBZ.TDCZ"
  26. ></el-input>
  27. </el-col>
  28. <el-col :span="2">元/亩</el-col>
  29. </el-row>
  30. <el-row>
  31. <el-col :span="6">经济作物:</el-col>
  32. <el-col :span="16">
  33. <el-input
  34. style="width: 100%"
  35. placeholder="请输入"
  36. v-model="curBCBZ.BCBZ.TDBCBS"
  37. ></el-input
  38. ></el-col>
  39. <el-col :span="2">元/亩</el-col>
  40. </el-row>
  41. <el-row>
  42. <el-col :span="6">树木补偿:</el-col>
  43. <el-col :span="16">
  44. <el-input
  45. style="width: 100%"
  46. placeholder="请输入"
  47. v-model="curBCBZ.BCBZ.TDBCBS"
  48. ></el-input
  49. ></el-col>
  50. <el-col :span="2">元/亩</el-col>
  51. </el-row>
  52. <el-row justify="center" type="flex">
  53. <el-button type="primary" @click="save()">保存</el-button>
  54. <el-button type="primary" @click="saveAs()">另存为</el-button>
  55. <el-button type="primary" @click="reset()">重置</el-button>
  56. </el-row>
  57. <el-dialog
  58. title="标准名称设置"
  59. modal="false"
  60. :visible.sync="dialogFormVisible"
  61. modal-append-to-body
  62. >
  63. <el-form :model="ruleForm" :rules="rules" ref="ruleForm">
  64. <el-form-item label="名称" prop="name">
  65. <el-input v-model="ruleForm.name" autocomplete="off"></el-input>
  66. </el-form-item>
  67. </el-form>
  68. <div slot="footer" class="dialog-footer">
  69. <el-button @click="dialogFormVisible = false">取消</el-button>
  70. <el-button type="primary" @click="submitForm('ruleForm')"
  71. >确 定</el-button
  72. >
  73. </div>
  74. </el-dialog>
  75. </div>
  76. </template>
  77. <script>
  78. export default {
  79. props: ["zdValue"],
  80. name: "QMSetInfo",
  81. data() {
  82. return {
  83. dialogFormVisible: false,
  84. ruleForm: {
  85. name: null,
  86. },
  87. rules: {
  88. name: [
  89. { required: true, message: "请输入名称", trigger: "blur" },
  90. // { min: 3, max: 5, message: '长度在 3 到 5 个字符', trigger: 'blur' }
  91. ],
  92. },
  93. /**
  94. * 补偿标准绑定值
  95. */
  96. bcbz: "",
  97. // curLabel: '',
  98. /**
  99. * 补偿标准列表
  100. */
  101. bcbzList: JSON.parse(JSON.stringify(window.ZSBC.ZDBCList)),
  102. /**
  103. * 当前标准
  104. */
  105. curBCBZ: {
  106. label: "",
  107. value: "",
  108. BCBZ: {
  109. /**
  110. * 土地统一年产值
  111. */
  112. TDCZ: 0,
  113. /**
  114. * 土地补偿倍数
  115. */
  116. TDBCBS: 0,
  117. /**
  118. * 土地补偿费
  119. */
  120. TDBCF: 0,
  121. /**
  122. * 安置补偿倍数
  123. */
  124. AZBCBS: 0,
  125. /**
  126. * 安置补偿费
  127. */
  128. AZBCF: 0,
  129. /**
  130. * 补偿合计
  131. */
  132. BCHJ: 0,
  133. },
  134. },
  135. };
  136. },
  137. mounted() {
  138. this.initForm();
  139. },
  140. methods: {
  141. initForm() {
  142. debugger;
  143. if (this.zdValue && this.zdValue != "") {
  144. this.bcbz = this.zdValue;
  145. var item = this.bcbzList.find((t) => t.value == this.bcbz);
  146. this.curBCBZ = item;
  147. }
  148. },
  149. selectZDBZ() {
  150. debugger;
  151. if (this.bcbz && this.bcbz != "") {
  152. this.curBCBZ = this.bcbzList.find((t) => t.value == this.bcbz);
  153. }
  154. this.changeZDBZ();
  155. },
  156. /**
  157. * 选择标准改变
  158. */
  159. changeZDBZ() {
  160. this.curBCBZ.BCBZ.TDBCF =
  161. this.curBCBZ.BCBZ.TDCZ * this.curBCBZ.BCBZ.TDBCBS;
  162. this.curBCBZ.BCBZ.AZBCF =
  163. this.curBCBZ.BCBZ.TDCZ * this.curBCBZ.BCBZ.AZBCBS;
  164. this.curBCBZ.BCBZ.BCHJ =
  165. this.curBCBZ.BCBZ.TDBCF + this.curBCBZ.BCBZ.AZBCF;
  166. },
  167. /**
  168. * 重置
  169. */
  170. reset() {
  171. // var val = this.bcbz
  172. this.bcbzList = JSON.parse(JSON.stringify(window.ZSBC.ZDBCList));
  173. var item = this.bcbzList.find((t) => t.value == this.bcbz);
  174. debugger;
  175. this.curBCBZ = {
  176. label: item.label,
  177. value: item.value,
  178. BCBZ: {
  179. /**
  180. * 土地统一年产值
  181. */
  182. TDCZ: item.BCBZ.TDCZ,
  183. /**
  184. * 土地补偿倍数
  185. */
  186. TDBCBS: item.BCBZ.TDBCBS,
  187. /**
  188. * 土地补偿费
  189. */
  190. TDBCF: item.BCBZ.TDBCF,
  191. /**
  192. * 安置补偿倍数
  193. */
  194. AZBCBS: item.BCBZ.AZBCBS,
  195. /**
  196. * 安置补偿费
  197. */
  198. AZBCF: item.BCBZ.AZBCF,
  199. /**
  200. * 补偿合计
  201. */
  202. BCHJ: item.BCBZ.BCHJ,
  203. },
  204. };
  205. // var item = this.bcbzList.find(t => t.value == this.bcbz)
  206. // this.bcbz = val;
  207. },
  208. /**
  209. * 保存修改
  210. */
  211. save() {
  212. if (this.bcbz == "") {
  213. this.$layer.alert("请选择补偿标准");
  214. return;
  215. }
  216. debugger;
  217. var index = window.ZSBC.ZDBCList.findIndex((t) => t.value == this.bcbz);
  218. if (index > -1) {
  219. window.ZSBC.ZDBCList[index] = this.curBCBZ;
  220. this.$layer.alert("保存完成");
  221. }
  222. },
  223. /***
  224. * 另存为
  225. */
  226. saveAs() {
  227. // if (this.bcbz == "") {
  228. // this.$layer.alert("请选择补偿标准");
  229. // return
  230. // }
  231. this.dialogFormVisible = true;
  232. },
  233. submitForm(formName) {
  234. this.$refs[formName].validate((valid) => {
  235. if (valid) {
  236. // alert('submit!');
  237. this.dialogFormVisible = false;
  238. this.saveData();
  239. // this.$layer.alert("保存完成");
  240. } else {
  241. console.log("error submit!!");
  242. return false;
  243. }
  244. });
  245. },
  246. /**
  247. * 另存数据
  248. */
  249. saveData() {
  250. debugger;
  251. var val = (window.ZSBC.ZDBCList.length + 1).toString();
  252. var newBCBZ = {
  253. label: this.ruleForm.name,
  254. value: val,
  255. BCBZ: {
  256. /**
  257. * 土地统一年产值
  258. */
  259. TDCZ: this.curBCBZ.BCBZ.TDCZ,
  260. /**
  261. * 土地补偿倍数
  262. */
  263. TDBCBS: this.curBCBZ.BCBZ.TDBCBS,
  264. /**
  265. * 土地补偿费
  266. */
  267. TDBCF: this.curBCBZ.BCBZ.TDBCF,
  268. /**
  269. * 安置补偿倍数
  270. */
  271. AZBCBS: this.curBCBZ.BCBZ.AZBCBS,
  272. /**
  273. * 安置补偿费
  274. */
  275. AZBCF: this.curBCBZ.BCBZ.AZBCF,
  276. /**
  277. * 补偿合计
  278. */
  279. BCHJ: this.curBCBZ.BCBZ.BCHJ,
  280. },
  281. };
  282. window.ZSBC.ZDBCList.push(newBCBZ);
  283. this.bcbzList = window.ZSBC.ZDBCList;
  284. this.bcbz = val;
  285. },
  286. },
  287. };
  288. </script>
  289. <style lang="scss">
  290. @import "@/../../zt.scss";
  291. </style>
  292. <style scoped>
  293. .el-row {
  294. /* padding: 0.5rem 0 0.5rem 0; */
  295. /* display: inline-flex; */
  296. /* align-items: center; */
  297. margin-bottom: 0.5rem;
  298. }
  299. .subtitle {
  300. color: #02a7f0;
  301. font-weight: 400;
  302. }
  303. /* .el -input>input, .el-select-dropdown, .el-textarea>textarea
  304. {
  305. color: #fff !important;
  306. background-color: rgba(4, 28, 50, 0.5) !important;
  307. border: 1px solid rgba(15, 122, 200, 0.4) !important;
  308. text-align: center;
  309. } */
  310. /* .el-input
  311. {
  312. text-align: center;
  313. } */
  314. </style>