华西海圻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.

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