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

185 lines
6.9 KiB

  1. <template>
  2. <div>
  3. <!-- 处置试剂弹窗 -->
  4. <el-dialog :title="$t('page.business.resource.sj.cz')" :visible.sync="open" width="1200px" append-to-body
  5. :close-on-click-modal="false">
  6. <el-form ref="form" :model="form" :rules="rules" label-width="120px">
  7. <el-row style="margin:10px 0px;">
  8. <el-col :span="24">
  9. <el-table :data="selectList" border>
  10. <el-table-column :label="$t('page.business.resource.sj.mc')" align="left" prop="mc"
  11. :show-overflow-tooltip="true" width="120px" />
  12. <el-table-column :label="$t('page.business.resource.sj.bh')" align="left" prop="bh"
  13. :show-overflow-tooltip="true" width="120px" />
  14. <el-table-column :label="$t('page.business.resource.sj.sjczfs')" align="center" width="250px">
  15. <template slot-scope="scope">
  16. <BusinessSelect v-model="scope.row.czfs" dictType="business_czfs"></BusinessSelect>
  17. </template>
  18. </el-table-column>
  19. <el-table-column :label="$t('page.business.resource.sj.yuanyin')" align="center">
  20. <template slot-scope="scope">
  21. <el-input type="text" v-model="scope.row.czyy" maxlength="50"
  22. :placeholder="$t('form.placeholderInput')" />
  23. </template>
  24. </el-table-column>
  25. <el-table-column :label="$t('page.business.resource.sj.czl')" align="center">
  26. <template slot-scope="scope">
  27. <el-input type="text" v-model="scope.row.czl" maxlength="50"
  28. :placeholder="$t('form.placeholderInput')"> <template slot="append">{{ scope.row.kcdw }}</template>
  29. </el-input>
  30. </template>
  31. </el-table-column>
  32. <el-table-column :label="$t('form.operate')" align="center" width="150px">
  33. <template slot-scope="scope">
  34. <el-button type="text" @click="handleSc(scope.row)">{{
  35. $t('form.delete') }}</el-button>
  36. </template>
  37. </el-table-column>
  38. </el-table>
  39. </el-col>
  40. </el-row>
  41. <el-row>
  42. <el-col :span="12">
  43. <el-form-item :label="$t('form.qmyy')" prop="qmyy">
  44. <el-input type="text" :value="form.qmyy" maxlength="50" disabled
  45. :placeholder="$t('form.placeholderInput')" />
  46. </el-form-item>
  47. </el-col>
  48. <el-col :span="12">
  49. <el-form-item :label="$t('form.signer')">
  50. <el-input type="text" v-model="nickName" maxlength="50" disabled
  51. :placeholder="$t('form.placeholderInput')" />
  52. </el-form-item>
  53. </el-col>
  54. </el-row>
  55. <el-row>
  56. <el-col :span="24">
  57. <el-form-item :label="$t('form.password')" prop="qmrmm">
  58. <div class="sbzdtcma"> <input type="text"></div>
  59. <el-input type="password" @contextmenu.native.prevent @copy.native.prevent @cut.native.prevent
  60. v-model="form.qmrmm" maxlength="20" autocomplete="off" auto-complete="new-password" show-password
  61. :placeholder="$t('form.placeholderInput')" />
  62. </el-form-item>
  63. </el-col>
  64. </el-row>
  65. </el-form>
  66. <div slot="footer" class="dialog-footer">
  67. <el-button type="primary" @click="save">{{ $t('form.confirm') }}</el-button>
  68. <el-button @click="cancel">{{ $t('form.cancel') }}</el-button>
  69. </div>
  70. </el-dialog>
  71. </div>
  72. </template>
  73. <script>
  74. import { sj_plcz } from "@/api/business/sj/sj"
  75. import { mapGetters } from 'vuex'
  76. import SelectList from "./SelectList";
  77. import BusinessSelect from '@/views/business/comps/select/BusinessSelect';
  78. export default {
  79. name: "CzBatch",
  80. components: { SelectList, BusinessSelect },
  81. data() {
  82. return {
  83. ids: [],
  84. selectList: [],
  85. open: false,
  86. form: {},
  87. rules: {
  88. czfs: [
  89. { required: true, message: this.$t('page.business.resource.sj.sjczfs') + this.$t('form.notEmpty'), trigger: "change" },
  90. { min: 0, max: 50, message: this.$t('page.business.resource.sj.sjczfs') + this.$t('form.lengthLimit') + '50', trigger: 'blur' }
  91. ],
  92. czl: [
  93. { required: true, message: this.$t('page.business.resource.sj.czl') + this.$t('form.notEmpty'), trigger: "change" },
  94. ],
  95. remark: [
  96. { required: true, message: this.$t('page.business.resource.sj.yuanyin') + this.$t('form.notEmpty'), trigger: "change" },
  97. ],
  98. qmrmm: [
  99. { required: true, message: this.$t('form.signerPsw') + this.$t('form.notEmpty'), trigger: "change" },
  100. ]
  101. }
  102. }
  103. },
  104. computed: {
  105. ...mapGetters([
  106. 'nickName', 'name'
  107. ]),
  108. },
  109. created() {
  110. },
  111. methods: {
  112. // 删除
  113. handleSc(row) {
  114. const that = this
  115. this.$modal.confirm(this.$t('form.confirmDelete')).then(() => {
  116. const _index = _.findIndex(that.selectList, function (o) { return o.id === row.id })
  117. if (_index > -1) {
  118. that.selectList.splice(_index, 1)
  119. that.form.ids = that.selectList.map(item => item.id)
  120. }
  121. }).catch(() => { })
  122. },
  123. showBatch(val) {
  124. this.reset()
  125. this.isBatch = true
  126. this.form.ids = val.map(item => item.id)
  127. this.selectList = val
  128. this.open = true
  129. },
  130. cancel() {
  131. this.open = false
  132. },
  133. reset() {
  134. this.form = {
  135. id: null,
  136. ids: null,
  137. mc: null,
  138. bh: null,
  139. qmyy: this.$t('page.business.resource.sj.cz'),
  140. kcdw: '',
  141. qmrmm: null
  142. }
  143. this.resetForm("form")
  144. },
  145. save() {
  146. this.$refs["form"].validate(valid => {
  147. if (valid) {
  148. let params = this.form
  149. params.list = this.selectList
  150. if (this.selectList.length <= 0) {
  151. this.$modal.msgError("请选择要操作的试剂")
  152. } else {
  153. for (var i = 0; i < params.list.length; i++) {
  154. if (!params.list[i].czfs || params.list[i].czfs == '') {
  155. this.$modal.msgError(params.list[i].mc + "处置方式不能为空")
  156. return
  157. }
  158. if (!params.list[i].czyy || params.list[i].czyy == '') {
  159. this.$modal.msgError(params.list[i].mc + "处置原因不能为空")
  160. return
  161. } else {
  162. params.list[i].remark = params.list[i].czyy
  163. }
  164. if (!params.list[i].czl || params.list[i].czl == '') {
  165. this.$modal.msgError(params.list[i].mc + "处置量不能为空")
  166. return
  167. }
  168. }
  169. this.$modal.loading()
  170. sj_plcz(params).then(response => {
  171. this.open = false
  172. this.$emit('callback')
  173. this.$modal.closeLoading()
  174. }).finally(() => {
  175. this.$modal.closeLoading()
  176. })
  177. }
  178. }
  179. })
  180. }
  181. }
  182. }
  183. </script>