用工平台小程序后端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

161 lines
5.8 KiB

6 months ago
6 months ago
  1. <template>
  2. <a-spin :spinning="confirmLoading">
  3. <j-form-container :disabled="formDisabled">
  4. <a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail">
  5. <a-row>
  6. <a-col :span="24">
  7. <a-form-model-item label="用户名" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="userName">
  8. <a-input v-model="model.userName" placeholder="请输入用户名" ></a-input>
  9. </a-form-model-item>
  10. </a-col>
  11. <a-col :span="24">
  12. <a-form-model-item label="地址" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="address">
  13. <a-input v-model="model.address" placeholder="请输入地址" ></a-input>
  14. </a-form-model-item>
  15. </a-col>
  16. <a-col :span="24">
  17. <a-form-model-item label="工种" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="industryName">
  18. <a-input v-model="model.industryName" placeholder="工种" ></a-input>
  19. </a-form-model-item>
  20. </a-col>
  21. <a-col :span="24">
  22. <a-form-model-item label="个人简介" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="detail">
  23. <a-textarea v-model="model.detail" rows="4" placeholder="请输入个人简介" />
  24. </a-form-model-item>
  25. </a-col>
  26. <a-col :span="24">
  27. <a-form-model-item label="身份证上传" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="idcard">
  28. <j-image-upload isMultiple v-model="model.idCard" ></j-image-upload>
  29. </a-form-model-item>
  30. </a-col>
  31. <a-col :span="24">
  32. <a-form-model-item label="电话" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="phone">
  33. <a-input v-model="model.phone" placeholder="请输入电话" ></a-input>
  34. </a-form-model-item>
  35. </a-col>
  36. <a-col :span="24">
  37. <a-form-model-item label="年龄" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="age">
  38. <a-input-number v-model="model.age" placeholder="请输入年龄" style="width: 100%" />
  39. </a-form-model-item>
  40. </a-col>
  41. <a-col :span="24">
  42. <a-form-model-item label="性别" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="gender">
  43. <j-dict-select-tag type="list" v-model="model.gender" dictCode="sex" placeholder="请选择性别" />
  44. </a-form-model-item>
  45. </a-col>
  46. <a-col :span="24">
  47. <a-form-model-item label="期望薪资最小值" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="moneymin">
  48. <a-input-number v-model="model.moneyMin" placeholder="请输入期望薪资最小值" style="width: 100%" />
  49. </a-form-model-item>
  50. </a-col>
  51. <a-col :span="24">
  52. <a-form-model-item label="期望薪资最大值" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="moneymax">
  53. <a-input-number v-model="model.moneyMax" placeholder="请输入期望薪资最大值" style="width: 100%" />
  54. </a-form-model-item>
  55. </a-col>
  56. <a-col :span="24">
  57. <a-form-model-item label="角色" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="role">
  58. <j-dict-select-tag type="list" v-model="model.role" dictCode="user_role" placeholder="请选择角色" />
  59. </a-form-model-item>
  60. </a-col>
  61. <a-col :span="24">
  62. <a-form-model-item label="审核状态" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="auditStatus">
  63. <j-dict-select-tag type="list" v-model="model.auditStatus" dictCode="audit_status" placeholder="请选择审核状态" />
  64. </a-form-model-item>
  65. </a-col>
  66. </a-row>
  67. </a-form-model>
  68. </j-form-container>
  69. </a-spin>
  70. </template>
  71. <script>
  72. import { httpAction, getAction } from '@/api/manage'
  73. import { validateDuplicateValue } from '@/utils/util'
  74. export default {
  75. name: 'TbUserRoleForm',
  76. components: {
  77. },
  78. props: {
  79. //表单禁用
  80. disabled: {
  81. type: Boolean,
  82. default: false,
  83. required: false
  84. }
  85. },
  86. data () {
  87. return {
  88. model:{
  89. },
  90. labelCol: {
  91. xs: { span: 24 },
  92. sm: { span: 5 },
  93. },
  94. wrapperCol: {
  95. xs: { span: 24 },
  96. sm: { span: 16 },
  97. },
  98. confirmLoading: false,
  99. validatorRules: {
  100. },
  101. url: {
  102. add: "/userRole/tbUserRole/add",
  103. edit: "/userRole/tbUserRole/edit",
  104. queryById: "/userRole/tbUserRole/queryById"
  105. }
  106. }
  107. },
  108. computed: {
  109. formDisabled(){
  110. return this.disabled
  111. },
  112. },
  113. created () {
  114. //备份model原始值
  115. this.modelDefault = JSON.parse(JSON.stringify(this.model));
  116. },
  117. methods: {
  118. add () {
  119. this.edit(this.modelDefault);
  120. },
  121. edit (record) {
  122. this.model = Object.assign({}, record);
  123. this.visible = true;
  124. },
  125. submitForm () {
  126. const that = this;
  127. // 触发表单验证
  128. this.$refs.form.validate(valid => {
  129. if (valid) {
  130. that.confirmLoading = true;
  131. let httpurl = '';
  132. let method = '';
  133. if(!this.model.id){
  134. httpurl+=this.url.add;
  135. method = 'post';
  136. }else{
  137. httpurl+=this.url.edit;
  138. method = 'put';
  139. }
  140. httpAction(httpurl,this.model,method).then((res)=>{
  141. if(res.success){
  142. that.$message.success(res.message);
  143. that.$emit('ok');
  144. }else{
  145. that.$message.warning(res.message);
  146. }
  147. }).finally(() => {
  148. that.confirmLoading = false;
  149. })
  150. }
  151. })
  152. },
  153. }
  154. }
  155. </script>