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

363 lines
12 KiB

  1. G<template>
  2. <div>
  3. <!-- 发放弹窗 -->
  4. <el-dialog :title="$t('page.business.zykgl.mjy.fafang')" :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. <div :style="isBatch ? 'display:block' : 'display:none'">
  8. <el-row style="margin:10px 0px;">
  9. <el-col :span="24">
  10. <el-table :data="selectList" border>
  11. <el-table-column :label="$t('page.business.zykgl.mjy.mc')" align="left" prop="mc"
  12. :show-overflow-tooltip="true" width="120px" />
  13. <el-table-column :label="$t('page.business.zykgl.mjy.bh')" align="left" prop="bh"
  14. :show-overflow-tooltip="true" width="120px" />
  15. <el-table-column :label="$t('page.business.zykgl.mjy.zytj')" align="center" width="250px">
  16. <template slot-scope="scope">
  17. <el-input type="text" v-model="scope.row.zytj" maxlength="50"
  18. :placeholder="$t('form.placeholderInput')" />
  19. </template>
  20. </el-table-column>
  21. <el-table-column :label="$t('page.business.zykgl.mjy.ckmz')" align="center" width="250px">
  22. <template slot-scope="scope">
  23. <el-input type="text" v-model="scope.row.ckmz" maxlength="50"
  24. :placeholder="$t('form.placeholderInput')"><template slot="append">{{ scope.row.ckmzdw }}</template>
  25. </el-input>
  26. </template>
  27. </el-table-column>
  28. <el-table-column :label="$t('page.business.zykgl.mjy.md')" align="center" width="250px">
  29. <template slot-scope="scope">
  30. <el-input type="text" v-model="scope.row.xmId" maxlength="50"
  31. :placeholder="$t('form.placeholderInput')" />
  32. </template>
  33. </el-table-column>
  34. <el-table-column :label="$t('form.remark')" align="center" width="250px">
  35. <template slot-scope="scope">
  36. <el-input type="text" v-model="scope.row.remark" maxlength="50"
  37. :placeholder="$t('form.placeholderInput')" />
  38. </template>
  39. </el-table-column>
  40. <el-table-column :label="$t('form.operate')" align="center" width="100px" fixed="right">
  41. <template slot-scope="scope">
  42. <el-button size="mini" type="text" @click="handleSc(scope.row)">{{
  43. $t('form.delete') }}</el-button>
  44. </template>
  45. </el-table-column>
  46. </el-table>
  47. </el-col>
  48. </el-row>
  49. </div>
  50. <div v-if="!isBatch">
  51. <el-row>
  52. <el-col :span="24">
  53. <el-form-item :label="$t('page.business.zykgl.mjy.mc')" prop="mc">
  54. <el-input type="text" v-model="form.mc" maxlength="50" disabled
  55. :placeholder="$t('form.placeholderInput')" />
  56. </el-form-item>
  57. </el-col>
  58. </el-row>
  59. <el-row>
  60. <el-col :span="24">
  61. <el-form-item :label="$t('page.business.zykgl.mjy.bh')" prop="glyj">
  62. <el-input type="text" v-model="form.bh" maxlength="50" disabled
  63. :placeholder="$t('form.placeholderInput')" />
  64. </el-form-item>
  65. </el-col>
  66. </el-row>
  67. <el-row>
  68. <el-col :span="12">
  69. <el-form-item :label="$t('page.business.zykgl.mjy.zytj')" prop="zytj">
  70. <el-input type="text" v-model="form.zytj" maxlength="50" :placeholder="$t('form.placeholderInput')" />
  71. </el-form-item>
  72. </el-col>
  73. <el-col :span="12">
  74. <el-form-item :label="$t('page.business.zykgl.mjy.ckmz')" prop="ckmz">
  75. <el-input type="number" v-model="form.ckmz" maxlength="20" :placeholder="$t('form.placeholderInput')">
  76. <template slot="append">{{ form.ckmzdw }}</template>
  77. </el-input>
  78. </el-form-item>
  79. </el-col>
  80. </el-row>
  81. <el-row>
  82. <el-col :span="24">
  83. <el-form-item :label="$t('page.business.zykgl.mjy.md')" prop="xmId">
  84. <el-input type="text" v-model="form.xmId" maxlength="50" :placeholder="$t('form.placeholderInput')" />
  85. </el-form-item>
  86. </el-col>
  87. </el-row>
  88. <el-row>
  89. <el-col :span="24">
  90. <el-form-item :label="$t('form.remark')" prop="remark">
  91. <el-input type="textarea" v-model="form.remark" :rows="2" maxlength="500"
  92. :placeholder="$t('form.placeholderInput')">
  93. </el-input>
  94. </el-form-item>
  95. </el-col>
  96. </el-row>
  97. </div>
  98. <el-row>
  99. <el-col :span="12">
  100. <el-form-item :label="$t('page.business.zykgl.mjy.lqr1')" prop="lqr1Id">
  101. <el-input type="text" v-model="form.lqr1Id" maxlength="50" :placeholder="$t('form.placeholderInput')" />
  102. </el-form-item>
  103. </el-col>
  104. <el-col :span="12">
  105. <el-form-item :label="$t('form.password')" prop="lqr1mm">
  106. <el-input type="password" v-model="form.lqr1mm" maxlength="20"
  107. :placeholder="$t('form.placeholderInput')" />
  108. </el-form-item>
  109. </el-col>
  110. </el-row>
  111. <el-row>
  112. <el-col :span="12">
  113. <el-form-item :label="$t('page.business.zykgl.mjy.lqr2')" prop="lqr2Id">
  114. <el-input type="text" v-model="form.lqr2Id" maxlength="50" :placeholder="$t('form.placeholderInput')" />
  115. </el-form-item>
  116. </el-col>
  117. <el-col :span="12">
  118. <el-form-item :label="$t('form.password')" prop="lqr2mm">
  119. <el-input type="password" v-model="form.lqr2mm" maxlength="20"
  120. :placeholder="$t('form.placeholderInput')" />
  121. </el-form-item>
  122. </el-col>
  123. </el-row>
  124. <el-row>
  125. <el-col :span="12">
  126. <el-form-item :label="$t('page.business.zykgl.mjy.ffr1')" prop="ffr1Id">
  127. <el-input type="text" v-model="form.ffr1Id" maxlength="50" :placeholder="$t('form.placeholderInput')" />
  128. </el-form-item>
  129. </el-col>
  130. <el-col :span="12">
  131. <el-form-item :label="$t('form.password')" prop="ffr1mm">
  132. <el-input type="password" v-model="form.ffr1mm" maxlength="20"
  133. :placeholder="$t('form.placeholderInput')" />
  134. </el-form-item>
  135. </el-col>
  136. </el-row>
  137. <el-row>
  138. <el-col :span="12">
  139. <el-form-item :label="$t('page.business.zykgl.mjy.ffr2')" prop="ffr2Id">
  140. <el-input type="text" v-model="form.ffr2Id" maxlength="50" :placeholder="$t('form.placeholderInput')" />
  141. </el-form-item>
  142. </el-col>
  143. <el-col :span="12">
  144. <el-form-item :label="$t('form.password')" prop="ffr2mm">
  145. <el-input type="password" v-model="form.ffr2mm" maxlength="20"
  146. :placeholder="$t('form.placeholderInput')" />
  147. </el-form-item>
  148. </el-col>
  149. </el-row>
  150. <el-row>
  151. <el-col :span="24">
  152. <el-form-item :label="$t('form.qmyy')" prop="qmyy">
  153. <el-input type="text" :value="form.qmyy" maxlength="50" disabled
  154. :placeholder="$t('form.placeholderInput')" />
  155. </el-form-item>
  156. </el-col>
  157. </el-row>
  158. </el-form>
  159. <div slot="footer" class="dialog-footer">
  160. <el-button type="primary" @click="save">{{ $t('form.confirm') }}</el-button>
  161. <el-button @click="cancel">{{ $t('form.cancel') }}</el-button>
  162. </div>
  163. </el-dialog>
  164. </div>
  165. </template>
  166. <script>
  167. import { mjy_ff, mjy_plff } from "@/api/business/mjy/mjy"
  168. import { mapGetters } from 'vuex'
  169. import SelectList from "./SelectList";
  170. export default {
  171. name: "MjyBj",
  172. components: { SelectList },
  173. data() {
  174. return {
  175. isBatch: false,
  176. ids: [],
  177. selectList: [],
  178. open: false,
  179. form: {},
  180. rules: {
  181. ffr2mm: [{
  182. required: true,
  183. message: ' ',
  184. trigger: 'blur'
  185. }],
  186. ffr2Id: [{
  187. required: true,
  188. message: ' ',
  189. trigger: 'blur'
  190. }],
  191. ffr1mm: [{
  192. required: true,
  193. message: ' ',
  194. trigger: 'blur'
  195. }],
  196. ffr1Id: [{
  197. required: true,
  198. message: ' ',
  199. trigger: 'blur'
  200. }],
  201. lqr2mm: [{
  202. required: true,
  203. message: ' ',
  204. trigger: 'blur'
  205. }],
  206. lqr1mm: [{
  207. required: true,
  208. message: ' ',
  209. trigger: 'blur'
  210. }],
  211. lqr2Id: [{
  212. required: true,
  213. message: ' ',
  214. trigger: 'blur'
  215. }],
  216. lqr1Id: [{
  217. required: true,
  218. message: ' ',
  219. trigger: 'blur'
  220. }],
  221. xmId: [{
  222. required: true,
  223. message: ' ',
  224. trigger: 'blur'
  225. }],
  226. ckmzdw: [{
  227. required: true,
  228. message: ' ',
  229. trigger: 'blur'
  230. }],
  231. sdrmm: [{
  232. required: true,
  233. message: ' ',
  234. trigger: 'blur'
  235. }],
  236. ckmz: [{
  237. required: true,
  238. message: ' ',
  239. trigger: 'blur'
  240. }],
  241. xmId: [{
  242. required: true,
  243. message: ' ',
  244. trigger: 'blur'
  245. }],
  246. zytj: [{
  247. required: true,
  248. message: ' ',
  249. trigger: 'blur'
  250. }]
  251. }
  252. }
  253. },
  254. computed: {
  255. ...mapGetters([
  256. 'nickName'
  257. ]),
  258. },
  259. created() {
  260. },
  261. methods: {
  262. handleSc(row) {
  263. const that = this
  264. this.$modal.confirm(this.$t('form.confirmDelete')).then(function () {
  265. return delDept(row.deptId)
  266. }).then(() => {
  267. const _index = _.findIndex(that.selectList, function (o) { return o.id === row.id })
  268. if (_index > -1) {
  269. that.selectList.splice(_index, 1)
  270. that.form.ids = that.selectList.map(item => item.id)
  271. }
  272. }).catch(() => { })
  273. },
  274. showBatch(val) {
  275. this.reset()
  276. this.isBatch = true
  277. this.form.ids = val.map(item => item.id)
  278. let tmp = []
  279. _.forEach(val, function (item) {
  280. tmp.push({
  281. id: item.id,
  282. mc: item.mc,
  283. bh: item.bh,
  284. ckmzdw: item.kcdw,
  285. zytj: null,
  286. ckmz: null,
  287. xmId: null,
  288. remark: null,
  289. })
  290. })
  291. this.selectList = tmp
  292. this.open = true
  293. },
  294. cancel() {
  295. this.open = false
  296. },
  297. reset() {
  298. this.form = {
  299. id: null,
  300. ids: null,
  301. mc: null,
  302. bh: null,
  303. ckmzdw: null,
  304. zytj: null,
  305. xmId: null,
  306. ckmz: null,
  307. lqr1Id: null,
  308. lqr2Id: null,
  309. lqr1mm: null,
  310. lqr2mm: null,
  311. ffr1Id: null,
  312. ffr1mm: null,
  313. ffr2Id: null,
  314. ffr2mm: null,
  315. xmId: null,
  316. qmyy: '领取发放',
  317. sdrmm: null,
  318. remark: null
  319. }
  320. this.resetForm("form")
  321. },
  322. show(row) {
  323. this.reset()
  324. this.isBatch = false
  325. this.form.ids = []
  326. this.selectList = []
  327. this.form.id = row.id
  328. this.form.mc = row.mc
  329. this.form.bh = row.bh
  330. this.form.ckmzdw = row.kcdw
  331. this.open = true
  332. },
  333. save() {
  334. this.$refs["form"].validate(valid => {
  335. if (valid) {
  336. let params = this.form
  337. if (this.isBatch) {
  338. params.list = this.selectList
  339. if (this.selectList.length <= 0) {
  340. this.$modal.msgError("请选择要操作的麻精药")
  341. } else {
  342. mjy_plff(params).then(response => {
  343. this.open = false
  344. this.$emit('callback')
  345. })
  346. }
  347. } else {
  348. mjy_ff(params).then(response => {
  349. this.open = false
  350. this.$emit('callback')
  351. })
  352. }
  353. }
  354. })
  355. }
  356. }
  357. }
  358. </script>