distribution.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. <template>
  2. <div>
  3. <el-form
  4. ref="form"
  5. :model="formData"
  6. :rules="formRules"
  7. label-width="110px"
  8. >
  9. <el-form-item
  10. label="招商人员"
  11. prop="userId"
  12. >
  13. <el-cascader
  14. ref="userName"
  15. v-model="formData.userId"
  16. :props="defaultProps"
  17. :options="findUser"
  18. @change="findUserToggle()"
  19. ></el-cascader>
  20. </el-form-item>
  21. </el-form>
  22. </div>
  23. </template>
  24. <script >
  25. export default {
  26. props: ['params'],
  27. data () {
  28. return {
  29. defaultProps: {
  30. value: 'id', // 唯一标识
  31. label: 'label', // 标签显示
  32. children: 'children',
  33. emitPath: false
  34. },
  35. formData: {
  36. userId: '',
  37. userName: '',
  38. userPhone: '',
  39. rentOutIds: [],
  40. },
  41. findUser: [],
  42. formRules: {
  43. userId: [this.$valid.selectRequired('分配人员')]
  44. }
  45. };
  46. },
  47. methods: {
  48. submit () {
  49. this.$refs.form.validate((valid) => {
  50. if (valid) {
  51. var loading = this.$loading();
  52. this.$http
  53. .post('/czc-community/house/rent/out/distribute', this.formData)
  54. .then(({ status, msg }) => {
  55. if (status == 0) {
  56. this.$message.success(msg);
  57. this.params.callback();
  58. this.$emit('close');
  59. } else {
  60. this.$message.error(msg);
  61. }
  62. loading.close();
  63. })
  64. .catch(() => {
  65. loading.close();
  66. });
  67. }
  68. });
  69. },
  70. getUserList () {
  71. this.$http.get('/czc-user-center/user/findUserList').then(({ data, status, msg }) => {
  72. this.findUser = data;
  73. });
  74. },
  75. findUserToggle () {
  76. let thisObj = this.$refs['userName'].getCheckedNodes()[0];
  77. this.formData.userName = thisObj.label;
  78. }
  79. },
  80. created () {
  81. this.getUserList();
  82. this.params.house.map((item) => {
  83. this.formData.rentOutIds.push(item.rentOutId);
  84. this.formData.userPhone = item.residentPhone;
  85. });
  86. }
  87. };
  88. </script>
  89. <style lang="scss" scoped>
  90. .marginNone {
  91. margin-bottom: 0;
  92. }
  93. .zz-table {
  94. margin-bottom: 20px;
  95. }
  96. .noneBef {
  97. margin-top: 5px;
  98. &::before {
  99. content: none;
  100. }
  101. }
  102. .inline {
  103. display: flex;
  104. justify-content: space-between;
  105. }
  106. </style>