华西海圻ELN前端工程
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.

202 lines
6.2 KiB

  1. <template>
  2. <div class="app-container">
  3. <!-- 钥匙归还弹窗 -->
  4. <el-dialog :title="$t('page.business.resource.zcg.ysgh')" :visible.sync="open" width="1000px" append-to-body
  5. :close-on-click-modal="false">
  6. <el-form ref="form" :model="form" :rules="rules" label-width="160px">
  7. <div class="sbzdtcma"> <input type="text"> <input type="password"> </div>
  8. <template v-if="isBatch">
  9. <el-alert :title="$t('page.business.resource.zcg.ysghts')" type="error" :closable="false">
  10. </el-alert>
  11. <el-row style="margin:10px 0px;">
  12. <el-col :span="24">
  13. <SelectList :value="selectList" />
  14. </el-col>
  15. </el-row>
  16. </template>
  17. <template v-else>
  18. <el-row>
  19. <el-col :span="12">
  20. <el-form-item :label="$t('page.business.resource.zcg.zcg')" prop="mc">
  21. <el-input type="text" v-model="form.mc" maxlength="50" disabled
  22. :placeholder="$t('form.placeholderInput')" />
  23. </el-form-item>
  24. </el-col>
  25. <el-col :span="12">
  26. <el-form-item :label="$t('page.business.resource.zcg.glyj')" prop="glyj">
  27. <el-input type="text" v-model="form.glyj" maxlength="50" disabled
  28. :placeholder="$t('form.placeholderInput')" />
  29. </el-form-item>
  30. </el-col>
  31. </el-row>
  32. </template>
  33. <el-row>
  34. <el-col :span="12">
  35. <el-form-item :label="$t('page.business.resource.zcg.ghr1Id')" prop="ghr1Id">
  36. <SelectDeptUser v-model="form.ghr1Id" key="ghr1Id" />
  37. </el-form-item>
  38. </el-col>
  39. <el-col :span="12">
  40. <el-form-item :label="$t('page.business.resource.zcg.ghr1mm')" prop="ghr1mm">
  41. <el-input type="password" v-model="form.ghr1mm" maxlength="20" :placeholder="$t('form.placeholderInput')" />
  42. </el-form-item>
  43. </el-col>
  44. </el-row>
  45. <el-row>
  46. <el-col :span="12">
  47. <el-form-item :label="$t('page.business.resource.zcg.ghr2Id')" prop="ghr2Id">
  48. <SelectDeptUser v-model="form.ghr2Id" key="ghr2Id" />
  49. </el-form-item>
  50. </el-col>
  51. <el-col :span="12">
  52. <el-form-item :label="$t('page.business.resource.zcg.ghr2mm')" prop="ghr2mm">
  53. <el-input type="password" v-model="form.ghr2mm" maxlength="20" :placeholder="$t('form.placeholderInput')" />
  54. </el-form-item>
  55. </el-col>
  56. </el-row>
  57. <el-row>
  58. <el-col :span="12">
  59. <el-form-item :label="$t('page.business.resource.zcg.jsr')">
  60. <el-input type="text" v-model="nickName" maxlength="50" disabled
  61. :placeholder="$t('form.placeholderInput')" />
  62. </el-form-item>
  63. </el-col>
  64. <el-col :span="12">
  65. <el-form-item :label="$t('page.business.resource.zcg.jsrmm')" prop="jsrmm">
  66. <el-input type="password" v-model="form.jsrmm" maxlength="20" :placeholder="$t('form.placeholderInput')" />
  67. </el-form-item>
  68. </el-col>
  69. </el-row>
  70. <el-row>
  71. <el-col :span="12">
  72. <el-form-item :label="$t('form.qmyy')" prop="qmyy">
  73. <el-input type="text" :value="$t('page.business.resource.zcg.ysgh')" maxlength="50" disabled
  74. :placeholder="$t('form.placeholderInput')" />
  75. </el-form-item>
  76. </el-col>
  77. </el-row>
  78. </el-form>
  79. <div slot="footer" class="dialog-footer">
  80. <el-button type="primary" @click="save">{{ $t('form.confirm') }}</el-button>
  81. <el-button @click="cancel">{{ $t('form.cancel') }}</el-button>
  82. </div>
  83. </el-dialog>
  84. </div>
  85. </template>
  86. <script>
  87. import { zcg_ysgh, zcg_ysghBatch } from "@/api/business/zcg/zcg"
  88. import { mapGetters } from 'vuex'
  89. import SelectList from "./SelectList";
  90. import SelectDeptUser from '@/views/business/comps/select/SelectDeptUser';
  91. export default {
  92. name: "ZcgYsgh",
  93. components: { SelectList, SelectDeptUser },
  94. data() {
  95. return {
  96. isBatch: false,
  97. ids: [],
  98. selectList: [],
  99. open: false,
  100. form: {},
  101. rules: {
  102. ghr1Id: [{
  103. required: true,
  104. message: ' ',
  105. trigger: 'blur'
  106. }],
  107. ghr2Id: [{
  108. required: true,
  109. message: ' ',
  110. trigger: 'blur'
  111. }],
  112. ghr1mm: [{
  113. required: true,
  114. message: ' ',
  115. trigger: 'blur'
  116. }],
  117. ghr2mm: [{
  118. required: true,
  119. message: ' ',
  120. trigger: 'blur'
  121. }],
  122. jsrmm: [{
  123. required: true,
  124. message: ' ',
  125. trigger: 'blur'
  126. }],
  127. }
  128. }
  129. },
  130. computed: {
  131. ...mapGetters([
  132. 'nickName','name'
  133. ]),
  134. },
  135. created() {
  136. },
  137. methods: {
  138. showBatch(val) {
  139. this.reset()
  140. this.isBatch = true
  141. this.form.ids = val.map(item => item.id)
  142. this.selectList = val
  143. this.open = true
  144. },
  145. cancel() {
  146. this.open = false
  147. },
  148. reset() {
  149. this.form = {
  150. id: null,
  151. ids: null,
  152. mc: null,
  153. qmyy: this.$t('page.business.resource.zcg.qysgh'),
  154. ghr1Id: null,
  155. ghr2Id: null,
  156. ghr1mm: null,
  157. ghr2mm: null,
  158. jsrmm: null
  159. }
  160. this.resetForm("form")
  161. },
  162. show(row) {
  163. this.reset()
  164. this.isBatch = false
  165. this.form.ids = []
  166. this.selectList = []
  167. this.form.id = row.id
  168. this.form.mc = row.mc
  169. this.form.glyj = row.glyj
  170. this.open = true
  171. },
  172. save() {
  173. this.$refs["form"].validate(valid => {
  174. if (valid) {
  175. if (this.isBatch) {
  176. this.$modal.loading()
  177. zcg_ysghBatch(this.form).then(response => {
  178. this.open = false
  179. this.$emit('callback')
  180. this.$modal.closeLoading()
  181. }).finally(() => {
  182. this.$modal.closeLoading()
  183. })
  184. } else {
  185. this.$modal.loading()
  186. zcg_ysgh(this.form).then(response => {
  187. this.open = false
  188. this.$emit('callback')
  189. this.$modal.closeLoading()
  190. }).finally(() => {
  191. this.$modal.closeLoading()
  192. })
  193. }
  194. }
  195. })
  196. }
  197. }
  198. }
  199. </script>