CheckAndEditModel.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. <template>
  2. <j-modal
  3. :title="title"
  4. :width="700"
  5. :visible="visible"
  6. :mask-closable="false"
  7. cancel-text="关闭"
  8. @close="close"
  9. >
  10. <a-form-model ref="form" :label-col="labelCol" :wrapper-col="wrapperCol" :rules="validatorRules" :model="model">
  11. <a-form-model-item label="员工姓名:" prop="zzh">
  12. <a-input v-model="model.zzh" />
  13. </a-form-model-item>
  14. <a-form-model-item label="数据权限" prop="qj">
  15. <j-dict-select-tag
  16. type="radioButton"
  17. v-model="model.zxqwqn"
  18. dict-code="word_type"
  19. />
  20. </a-form-model-item>
  21. <a-form-model-item label="登录账号:" prop="zzh">
  22. <a-input v-model="model.zzh" />
  23. </a-form-model-item>
  24. <a-form-model-item label="所属部门" prop="bm">
  25. <a-tree-select
  26. v-model="model.zzh"
  27. show-search
  28. style="width: 100%"
  29. :dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
  30. placeholder="选择部门"
  31. allow-clear
  32. tree-default-expand-all
  33. ></a-tree-select>
  34. </a-form-model-item>
  35. <a-form-model-item label="职工职务" prop="bm">
  36. </a-form-model-item>
  37. <a-form-model-item label="职工工号" prop="qj">
  38. <a-input v-model="model.zzh" />
  39. </a-form-model-item>
  40. <a-form-model-item label="手机号码" prop="qj">
  41. <a-input v-model="model.zzh" />
  42. </a-form-model-item>
  43. <a-form-model-item label="微信账号" prop="qj">
  44. <a-input v-model="model.zzh" />
  45. </a-form-model-item>
  46. <a-form-model-item label="邮箱地址" prop="qj">
  47. <a-input v-model="model.zzh" />
  48. </a-form-model-item>
  49. <a-form-model-item label="出生日期" prop="zzxh">
  50. <a-input v-model="model.zzh" />
  51. </a-form-model-item>
  52. <a-form-model-item label="性别" prop="zxqwqn">
  53. <j-dict-select-tag
  54. type="radioButton"
  55. v-model="model.zxqwqn"
  56. dict-code="word_type"
  57. />
  58. </a-form-model-item>
  59. </a-form-model>
  60. </j-modal>
  61. </template>
  62. <script>
  63. import { httpAction } from '@/api/request'
  64. import JModal from '@/components/JModal'
  65. export default {
  66. name: 'CheckAndEditModel',
  67. components: {
  68. JModal
  69. },
  70. data() {
  71. return {
  72. labelCol: { span: 4 },
  73. wrapperCol: { span: 19 },
  74. dataSource: [],
  75. title: '',
  76. visible: false,
  77. isCheck: false,
  78. model: {},
  79. validatorRules: {
  80. name: [{ required: true, message: '请输入' }],
  81. type: [{ required: true, message: '请选择' }]
  82. },
  83. url: {
  84. add: '/business/catenary/bus/zzdzxx/add',
  85. edit: '/business/catenary/bus/zzdzxx/update'
  86. }
  87. }
  88. },
  89. created() {
  90. },
  91. methods: {
  92. add() {
  93. this.model = {}
  94. this.visible = true
  95. },
  96. edit(record) {
  97. debugger
  98. this.model = Object.assign({}, record)
  99. this.visible = true
  100. },
  101. close(isSubmit) {
  102. if (isSubmit) {
  103. this.checkData()
  104. } else {
  105. this.visible = false
  106. }
  107. },
  108. checkData() {
  109. this.$refs.form.validate(valid => {
  110. if (valid) {
  111. this.saveData()
  112. } else {
  113. return false
  114. }
  115. })
  116. },
  117. saveData() {
  118. let url, type
  119. if (!this.model.id) {
  120. url = this.url.add
  121. type = 'post'
  122. } else {
  123. debugger
  124. url = this.url.edit
  125. type = 'put'
  126. }
  127. httpAction(url, this.model, type).then((res) => {
  128. if (res.code === 200) {
  129. this.$message.success(res.msg)
  130. this.$emit('ok')
  131. this.visible = false
  132. } else {
  133. console.log(res)
  134. }
  135. })
  136. }
  137. }
  138. }
  139. </script>