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

187 lines
6.7 KiB

  1. <template>
  2. <div>
  3. <!-- 编辑弹窗 -->
  4. <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body :close-on-click-modal="false">
  5. <el-form ref="form" :model="form" :rules="rules" label-width="120px">
  6. <el-row>
  7. <el-col :span="12">
  8. <el-form-item :label="$t('page.system.storageLocation.fzdd')" prop="location">
  9. <el-input v-model="form.location" :placeholder="$t('form.placeholderInput')" maxlength="50" />
  10. </el-form-item>
  11. </el-col>
  12. <el-col :span="12">
  13. <el-form-item :label="$t('page.system.storageLocation.sbmc')" prop="name">
  14. <el-input v-model="form.name" :placeholder="$t('form.placeholderInput')" maxlength="50" />
  15. </el-form-item>
  16. </el-col>
  17. </el-row>
  18. <el-row>
  19. <el-col :span="12">
  20. <el-form-item :label="$t('page.system.storageLocation.fzhj')" prop="shelfPlacement">
  21. <el-input v-model="form.shelfPlacement" :placeholder="$t('form.placeholderInput')" maxlength="50" />
  22. </el-form-item>
  23. </el-col>
  24. <el-col :span="12">
  25. <el-form-item :label="$t('page.system.storageLocation.wc')" prop="compartment">
  26. <BusinessSelect v-model="form.compartment" dictType="business_cctj" :multiple="true"></BusinessSelect>
  27. </el-form-item>
  28. </el-col>
  29. </el-row>
  30. <el-row>
  31. <el-col :span="12">
  32. <el-form-item :label="$t('page.system.storageLocation.ssbm')" prop="deptId">
  33. <SelectDept v-model="form.deptId" />
  34. </el-form-item>
  35. </el-col>
  36. <el-col :span="12">
  37. <el-form-item :label="$t('page.system.storageLocation.zt')" prop="status">
  38. <el-select v-model="form.status" :placeholder="$t('form.placeholderSelect')" style="width: 100%;">
  39. <el-option key="1" :label="$t('page.system.storageLocation.no')" :value="1" />
  40. <el-option key="10" :label="$t('page.system.storageLocation.yes')" :value="10" />
  41. </el-select>
  42. </el-form-item>
  43. </el-col>
  44. </el-row>
  45. <el-row>
  46. <el-col :span="12">
  47. <el-form-item :label="$t('form.qmyy')" prop="qmyy">
  48. <el-input v-model="form.qmyy" disabled :placeholder="$t('form.placeholderInput')" />
  49. </el-form-item>
  50. </el-col>
  51. <el-col :span="12">
  52. <el-form-item :label="$t('form.signer')" prop="qmrmc">
  53. <el-input v-model="nickName" disabled :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('form.signerPsw')" prop="qmrmm">
  60. <div class="sbzdtcma"> <input type="text"></div>
  61. <el-input v-model="form.qmrmm" show-password :placeholder="$t('form.placeholderInput')" type="password" @contextmenu.native.prevent @copy.native.prevent @cut.native.prevent
  62. maxlength="20" />
  63. </el-form-item>
  64. </el-col>
  65. </el-row>
  66. </el-form>
  67. <div slot="footer" class="dialog-footer">
  68. <el-button type="primary" @click="submitForm">{{ $t('form.saveConfirm') }}</el-button>
  69. <el-button @click="cancel">{{ $t('form.cancel') }}</el-button>
  70. </div>
  71. </el-dialog>
  72. </div>
  73. </template>
  74. <script>
  75. import { storageLocation_add, storageLocation_edit, storageLocation_info } from '@/api/business/storageLocation/storageLocation'
  76. import { mapGetters } from 'vuex'
  77. import BusinessSelect from '@/views/business/comps/select/BusinessSelect';
  78. import SelectDept from '@/views/business/comps/select/SelectDept';
  79. export default {
  80. name: "StorageLocationBj",
  81. components: { BusinessSelect, SelectDept },
  82. data() {
  83. return {
  84. ids: [],
  85. open: false,
  86. form: {},
  87. title: '',
  88. // 表单校验
  89. rules: {
  90. location: [
  91. { required: true, message: this.$t('form.notEmpty'), trigger: "change" },
  92. { min: 0, max: 50, message: this.$t('form.lengthLimit') + '50', trigger: 'blur' }
  93. ],
  94. name: [
  95. { required: true, message: this.$t('form.notEmpty'), trigger: "change" },
  96. { min: 0, max: 50, message: this.$t('form.lengthLimit') + '50', trigger: 'blur' }
  97. ],
  98. shelfPlacement: [
  99. { required: true, message: this.$t('form.notEmpty'), trigger: "change" },
  100. { min: 0, max: 50, message: this.$t('form.lengthLimit') + '50', trigger: 'blur' }
  101. ],
  102. compartment: [
  103. { required: true, message: this.$t('form.notEmpty'), trigger: "blur" }
  104. ],
  105. deptId: [
  106. { required: true, message: this.$t('form.notEmpty'), trigger: "change" },
  107. ],
  108. status: [
  109. { required: true, message: this.$t('form.notEmpty'), trigger: "change" },
  110. ],
  111. qmrmm: [
  112. { required: true, message: this.$t('form.signerPsw') + this.$t('form.notEmpty'), trigger: "change" },
  113. { min: 0, max: 20, message: this.$t('form.signerPsw') + this.$t('form.lengthLimit') + '20', trigger: 'blur' }
  114. ]
  115. }
  116. }
  117. },
  118. computed: {
  119. ...mapGetters([
  120. 'nickName','name'
  121. ]),
  122. },
  123. created() {
  124. },
  125. methods: {
  126. cancel() {
  127. this.reset()
  128. this.open = false
  129. },
  130. reset() {
  131. this.form = {
  132. compartment: null,
  133. deptId: null,
  134. deptName: null,
  135. location: null,
  136. name: null,
  137. status: null,
  138. shelfPlacement: null,
  139. wc: null,
  140. qmrmm: null,
  141. }
  142. this.resetForm("form")
  143. },
  144. showEdit(row) {
  145. this.reset()
  146. storageLocation_info({id: row.id}).then(response => {
  147. this.form = response.data
  148. this.form.qmyy = this.$t('page.system.storageLocation.editStroageLocation'),
  149. this.title = this.$t('form.edit')
  150. this.open = true
  151. })
  152. },
  153. showAdd() {
  154. this.reset()
  155. this.title = this.$t('form.add')
  156. this.form.qmyy = this.$t('page.system.storageLocation.addStroageLocation'),
  157. this.open = true
  158. },
  159. submitForm() {
  160. this.$refs["form"].validate(valid => {
  161. if (valid) {
  162. if (this.form.id) {
  163. storageLocation_edit(this.form).then((response) => {
  164. this.$modal.msgSuccess(this.$t('form.operationSuccess'))
  165. this.open = false
  166. this.$emit('callback')
  167. })
  168. } else {
  169. storageLocation_add(this.form).then((response) => {
  170. this.$modal.msgSuccess(this.$t('form.operationSuccess'))
  171. this.open = false
  172. this.$emit('callback')
  173. })
  174. }
  175. }
  176. })
  177. },
  178. onChangeCcwz(val) {
  179. this.form.cctj = val.wc
  180. }
  181. }
  182. }
  183. </script>