explain.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. <template>
  2. <el-form v-if="disabled && form.monthSituation || !disabled" ref="formRef" :model="form" :rules="rules" :disabled="disabled" label-width="110px">
  3. <div class="dialog-title">月度争取情况说明</div>
  4. <el-row>
  5. <el-col :span="12">
  6. <el-form-item label="是否已落地" prop="isLand">
  7. <el-radio-group v-model="form.isLand" @change="form.landAmount = null, form.partPerson = null, form.partPersonArr = '[]'">
  8. <el-radio v-for="(label, key) in whetherDic" :key="key" :label="label" :value="parseInt(key)"></el-radio>
  9. </el-radio-group>
  10. </el-form-item>
  11. </el-col>
  12. <template v-if="form.isLand == 1">
  13. <el-col :span="12">
  14. <el-form-item label="落地金额" prop="landAmount">
  15. <el-input-number v-model="form.landAmount" :min="0" :step="0.1" :precision="2" controls-position="right" placeholder="请输入落地金额"></el-input-number>
  16. </el-form-item>
  17. </el-col>
  18. <el-col :span="24">
  19. <el-form-item label="参与人" prop="partPerson">
  20. <el-input v-model="form.partPerson" type="textarea" :rows="4" placeholder="请输入参与人(以英文 , 分割)"></el-input>
  21. </el-form-item>
  22. </el-col>
  23. </template>
  24. <el-col :span="24">
  25. <el-form-item class="label-column-2" label="月度争取情况说明" prop="monthSituation" label-width="80px">
  26. <el-input v-model="form.monthSituation" type="textarea" :rows="4" placeholder="请输入月度争取情况说明"></el-input>
  27. </el-form-item>
  28. </el-col>
  29. </el-row>
  30. </el-form>
  31. </template>
  32. <script>
  33. import API from "@/api/policy/strive";
  34. import { whetherDic } from "@/views/policyShare/main";
  35. export default {
  36. props: {
  37. isMaster: { type: Boolean, default: false },
  38. disabled: { type: Boolean, default: true },
  39. rowData: { type: Object, default: () => {} }
  40. },
  41. data() {
  42. return {
  43. whetherDic,
  44. form: {
  45. isLand: 0,
  46. landAmount: null,
  47. partPersonArr: "[]", // [{name: }]
  48. partPerson: null, // a1,a2
  49. monthSituation: null,
  50. },
  51. rules: {
  52. isLand: [{ required: true }],
  53. landAmount: [{ required: true, message: "请输入落地金额" }],
  54. partPerson: [{ required: true, message: "请输入参与人(以英文 , 分割)" }],
  55. monthSituation: [{ required: true, message: "请输入月度争取情况" }]
  56. },
  57. }
  58. },
  59. watch: {
  60. rowData: {
  61. deep: true,
  62. handler(value) {
  63. if (value.id) {
  64. this.form = Object.assign({}, this.rowData);
  65. }
  66. }
  67. }
  68. },
  69. mounted() {
  70. this.form = Object.assign({}, this.rowData);
  71. },
  72. methods: {
  73. submit() {
  74. this.$refs.formRef.validate(valid => {
  75. if (valid) {
  76. const partPersonArr = this.form.partPerson && JSON.stringify(this.form.partPerson.split(",").map(name => ({ name }))) || "";
  77. API.explain({ ...this.form, partPersonArr }).then(() => {
  78. ElMessage.success("操作成功");
  79. this.visible = false;
  80. this.$emit("success");
  81. });
  82. } else {
  83. return false;
  84. }
  85. });
  86. }
  87. }
  88. }
  89. </script>
  90. <style lang="scss" scoped>
  91. .dialog-title {
  92. margin-bottom: 15px;
  93. font-size: 15px;
  94. font-weight: 600;
  95. color: var(--el-text-color-primary);
  96. }
  97. .el-input-number {
  98. width: 100%;
  99. :deep(.el-input) .el-input__wrapper {
  100. padding: 1px 11px;
  101. .el-input__inner {
  102. text-align: unset;
  103. }
  104. }
  105. }
  106. .label-column-2 :deep(.el-form-item__label) {
  107. margin-left: 30px;
  108. }
  109. </style>