insert.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. <template>
  2. <view>
  3. <my_form ref="form" :form="form" @isUncomplete="isUncomplete" requiredFieldOnly />
  4. </view>
  5. </template>
  6. <script>
  7. export default {
  8. data() {
  9. return {
  10. sys_enterprise_hrid: 0,
  11. form: []
  12. }
  13. },
  14. async onLoad() {
  15. uni.setNavigationBarTitle({
  16. title: '新增人员'
  17. });
  18. let form = [{
  19. key: "name",
  20. type: "text",
  21. label: "姓名",
  22. isMust: true,//是否必填
  23. value: "",
  24. }, {
  25. key: "phonenumber",
  26. type: "text",
  27. label: "手机号",
  28. isMust: true,//是否必填
  29. value: "",
  30. placeholder: "请输入收货人手机号",
  31. inputmode: 'number',
  32. verify: [this.getReg("phonenumber")]
  33. }, {
  34. key: "sex",
  35. type: "sex",
  36. label: "性别",
  37. value: "男",
  38. }, {
  39. key: "birthday",
  40. type: "date",
  41. label: "生日",
  42. value: "",
  43. placeholder: "请选择出生日期",
  44. }, {
  45. key: "email",
  46. type: "text",
  47. label: "邮箱",
  48. isMust: false,//是否必填
  49. value: "",
  50. verify: [this.getReg("email")]
  51. }, {
  52. key: "position",
  53. type: "text",
  54. label: "店内职位",
  55. isMust: false,//是否必填
  56. value: "",
  57. }, {
  58. key: "sa_storeids",
  59. type: "route",
  60. path: "/select/store/store",
  61. isRadio: false,
  62. label: "所属门店",
  63. isMust: false,//是否必填
  64. value: [],
  65. showValue: [],
  66. }];
  67. this.form = form;
  68. },
  69. methods: {
  70. isUncomplete(uncomplete) {
  71. this.uncomplete = uncomplete;
  72. },
  73. submit() {
  74. this.loading = true;
  75. let that = this;
  76. this.$refs.form.submit().then(data => {
  77. this.$Http.basic({
  78. "id": 20240410164102,
  79. "content": {
  80. "sys_enterprise_hrid": this.sys_enterprise_hrid,
  81. ...data
  82. }
  83. }).then(res => {
  84. this.loading = false;
  85. console.log("加入团队", res)
  86. if (this.cutoff(res.msg)) return;
  87. this.loading = true;
  88. if (this.attachmentids.length) {
  89. this.uploadCallback(this.attachmentids, "sys_users", this.userid).then(s => {
  90. if (s) getUserMsg()
  91. });
  92. if (this.headportraits.length) this.$Http.basic({
  93. "classname": "system.attachment.Attachment",
  94. "method": "deleteFileLink",
  95. "content": {
  96. linksids: this.headportraits.map(v => v.linksid)
  97. }
  98. })
  99. } else {
  100. getUserMsg()
  101. }
  102. function getUserMsg() {
  103. that.$Http.wechatLogin().then(token => {
  104. that.loading = false;
  105. uni.showModal({
  106. title: '提示',
  107. content: '成功加入团队',
  108. showCancel: false,
  109. confirmText: '确定',
  110. confirmColor: '#C40C24',
  111. success: ({ confirm }) => {
  112. if (confirm) uni.redirectTo({
  113. url: '/pages/index/index',
  114. })
  115. }
  116. });
  117. })
  118. }
  119. })
  120. })
  121. },
  122. },
  123. }
  124. </script>
  125. <style></style>