dialog.editPoint.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. <template>
  2. <div class="rule-type">
  3. <el-dialog
  4. width="50%"
  5. :title="index >= 0 ? '编辑履职内容' : '新增履职内容'"
  6. :visible.sync="dataVisible"
  7. :show-close="false"
  8. append-to-body
  9. >
  10. <div>
  11. <el-form
  12. ref="form"
  13. :model="formData"
  14. :rules="formDataRules"
  15. label-width="110px"
  16. class="formbox"
  17. >
  18. <!-- <el-form-item label="检查要点编号" prop="pointNum">
  19. <el-input
  20. v-model="formData.pointNum"
  21. type="number"
  22. laceholder="请输入检查要点编号"
  23. @blur="check()"
  24. @input="formData.pointNum = Number(formData.pointNum)"
  25. ></el-input>
  26. </el-form-item> -->
  27. <el-form-item label="履职内容" prop="pointName">
  28. <el-input
  29. v-model="formData.pointName"
  30. placeholder="请输入履职内容"
  31. @blur="check()"
  32. maxlength="100"
  33. ></el-input>
  34. </el-form-item>
  35. <el-form-item label="履职区域" prop="areaId">
  36. <el-select
  37. v-model="formData.areaId"
  38. placeholder="请选择履职区域"
  39. clearable
  40. >
  41. <el-option
  42. v-for="item in areas"
  43. :key="item.id"
  44. :label="item.name"
  45. :value="item.id"
  46. ></el-option>
  47. </el-select>
  48. </el-form-item>
  49. <el-form-item label="数据来源" prop="businessType">
  50. <el-select
  51. v-model="formData.businessType"
  52. placeholder="请选择数据来源"
  53. clearable
  54. >
  55. <el-option
  56. v-for="item in dict.type.point_data_source"
  57. :key="item.id"
  58. :label="item.name"
  59. :value="item.id"
  60. ></el-option>
  61. </el-select>
  62. </el-form-item>
  63. <el-form-item label="备注" prop="remark">
  64. <el-input
  65. type="textarea"
  66. v-model="formData.remark"
  67. maxlength="200"
  68. clearable
  69. ></el-input>
  70. </el-form-item>
  71. </el-form>
  72. </div>
  73. <span slot="footer" class="dialog-footer">
  74. <el-button @click="dataVisible = false">取 消</el-button>
  75. <el-button type="primary" @click="onSubmit()" v-if="index>=0">{{
  76. index >= 0 ? "保 存" : "添 加"
  77. }}</el-button>
  78. </span>
  79. </el-dialog>
  80. </div>
  81. </template>
  82. <script>
  83. import { mapState, mapMutations } from "vuex";
  84. import {allAreaByOrgtype} from '@/api/system/area'
  85. export default {
  86. dicts:['point_data_source'],
  87. data() {
  88. return {
  89. index: null,
  90. dataVisible: false,
  91. formData: this.reset(),
  92. formDataRules: {
  93. name: [{ required: true, message: "请输入履职内容" }],
  94. areaId: [{ required: true, message: "请选择履职区域" }],
  95. },
  96. areas:[]
  97. };
  98. },
  99. props: {
  100. orgType:{
  101. type:String
  102. }
  103. },
  104. watch: {},
  105. computed: {
  106. ...mapState([]),
  107. },
  108. methods: {
  109. ...mapMutations([]),
  110. reset() {
  111. return {
  112. id: null,
  113. name: null,
  114. areaId: null,
  115. businessType: null,
  116. remark: null,
  117. };
  118. },
  119. async show(index, data) {
  120. if (index >= 0) {
  121. this.index = index;
  122. this.formData = data;
  123. } else {
  124. this.index = -1;
  125. this.formData = this.reset();
  126. }
  127. allAreaByOrgtype(this.orgType).then(d=>{
  128. this.areas=d;
  129. })
  130. this.dataVisible = true;
  131. },
  132. onSubmit() {
  133. this.$refs.form.validate((isValidate) => {
  134. if (!isValidate) return;
  135. let obj = {};
  136. obj = { ...this.formData };
  137. this.$emit("submit", obj);
  138. this.dataVisible = false;
  139. });
  140. },
  141. // 事件
  142. onHide() {
  143. this.isShow = false;
  144. },
  145. },
  146. mounted() {},
  147. components: {},
  148. };
  149. </script>
  150. <style lang="scss">
  151. .brand_info {
  152. .el-form {
  153. width: 600px;
  154. padding-top: 40px;
  155. }
  156. }
  157. </style>