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

296 lines
9.7 KiB

  1. <template>
  2. <div>
  3. <div class="edit-container">
  4. <div class="edit-top">
  5. <div class="left-top">
  6. <img src="@/assets/images/back.png" @click="cancel()" />
  7. <div class="left-title"></div>
  8. </div>
  9. <div class="center-top">
  10. <div>
  11. <div :class="showIndex == 1 ? 'el-step__icon is-text is-finish' : 'el-step__icon is-text is-info'">
  12. <div class="el-step__icon-inner">1</div>
  13. </div>
  14. {{ $t('page.business.study.studyFormApply.jcsz') }}
  15. </div>
  16. <div class="line"></div>
  17. <div>
  18. <div :class="showIndex == 2 ? 'el-step__icon is-text is-finish' : 'el-step__icon is-text is-info'">
  19. <div class="el-step__icon-inner">2</div>
  20. </div>
  21. {{ $t('page.business.study.studyFormApply.bdtb') }}
  22. </div>
  23. </div>
  24. <div class="right-top">
  25. <el-button @click="cancel()">{{ $t('form.cancel') }}</el-button>
  26. <template v-if="showIndex == 1">
  27. <el-button @click="save">{{ $t('page.business.study.studyFormApply.zc') }}</el-button>
  28. <el-button type="primary" @click="next">{{ $t('page.business.study.studyFormApply.next') }}</el-button>
  29. </template>
  30. <template v-else>
  31. <el-button @click="saveNext">{{ $t('page.business.study.studyFormApply.save') }}</el-button>
  32. <el-button type="primary" @click="showtijjiao">{{ $t('page.business.study.studyFormApply.submit')
  33. }}</el-button>
  34. <el-button type="primary" @click="pre">{{ $t('page.business.study.studyFormApply.pre') }}</el-button>
  35. </template>
  36. </div>
  37. </div>
  38. <div class="edit-content">
  39. <div class="content" style="width:60%" v-show="showIndex == 1">
  40. <el-form ref="form" :model="form" :rules="rules" label-width="120px">
  41. <el-row>
  42. <el-col :span="24">
  43. <el-form-item :label="$t('page.business.form.bdmb')" prop="templateId">
  44. <SelectTemplate v-model="form.templateId" :disabled="true" :name="form.templateMc"
  45. @change="selectTemplateChange" />
  46. </el-form-item>
  47. </el-col>
  48. </el-row>
  49. <el-row>
  50. <el-col :span="24">
  51. <el-form-item :label="$t('page.business.form.bdmc')" prop="bdmc">
  52. <el-input type="text" v-model="form.bdmc" maxlength="50" :placeholder="$t('form.placeholderInput')" />
  53. </el-form-item>
  54. </el-col>
  55. </el-row>
  56. <el-row>
  57. <el-col :span="24">
  58. <el-form-item :label="$t('page.business.study.studyFormApply.sfbl')" prop="sfbl">
  59. <el-select v-model="form.sfbl" :placeholder="$t('form.placeholderSelect')">
  60. <el-option :label="$t('page.business.study.studyFormApply.yes')" :value="10" />
  61. <el-option :label="$t('page.business.study.studyFormApply.no')" :value="1" />
  62. </el-select>
  63. </el-form-item>
  64. </el-col>
  65. </el-row>
  66. <el-row>
  67. <el-col :span="24">
  68. <el-form-item :label="$t('page.business.study.studyFormApply.bdsm')" prop="bdsm">
  69. <el-input type="textarea" v-model="form.bdsm" :rows="5" maxlength="500"
  70. :placeholder="$t('form.placeholderInput')">
  71. </el-input>
  72. </el-form-item>
  73. </el-col>
  74. </el-row>
  75. </el-form>
  76. </div>
  77. <div class="content" v-if="showIndex == 2">
  78. <TemplateTable ref="templateTable" :sn="form.templateSn" :templateData="form" fillType="actFill" />
  79. </div>
  80. </div>
  81. </div>
  82. <el-dialog :title="$t('page.business.study.studyFormApply.tjjl')" :visible.sync="openSubmit" width="500px"
  83. append-to-body :close-on-click-modal="false">
  84. <el-form ref="formSubmit" :model="form" :rules="rulesApprove" label-width="120px">
  85. <div class="sbzdtcma"> <input type="text"> <input type="password"> </div>
  86. <el-row>
  87. <el-col :span="24">
  88. <el-form-item :label="$t('form.qmyy')" prop="qmyy">
  89. <el-input type="text" :value="form.qmyy" maxlength="50" disabled
  90. :placeholder="$t('form.placeholderInput')" />
  91. </el-form-item>
  92. </el-col>
  93. </el-row>
  94. <el-row>
  95. <el-col :span="24">
  96. <el-form-item :label="$t('form.remark')" prop="remark">
  97. <el-input type="textarea" v-model="form.remark" :rows="5" maxlength="500"
  98. :placeholder="$t('form.placeholderInput')">
  99. </el-input>
  100. </el-form-item>
  101. </el-col>
  102. </el-row>
  103. <el-row>
  104. <el-col :span="24">
  105. <el-form-item :label="$t('form.signer')">
  106. <el-input type="text" v-model="nickName" maxlength="50" disabled
  107. :placeholder="$t('form.placeholderInput')" />
  108. </el-form-item>
  109. </el-col>
  110. </el-row>
  111. <el-row>
  112. <el-col :span="24">
  113. <el-form-item :label="$t('form.password')" prop="qmrmm">
  114. <el-input type="password" v-model="form.qmrmm" maxlength="20"
  115. :placeholder="$t('form.placeholderInput')" />
  116. </el-form-item>
  117. </el-col>
  118. </el-row>
  119. </el-form>
  120. <div slot="footer" class="dialog-footer">
  121. <el-button type="primary" @click="tj">{{ $t('form.confirm') }}</el-button>
  122. <el-button @click="openSubmit = false">{{ $t('form.cancel') }}</el-button>
  123. </div>
  124. </el-dialog>
  125. </div>
  126. </template>
  127. <script>
  128. import { studyFormApply_bc, studyFormApply_tj, studyFormApply_info } from "@/api/business/study/studyFormApply"
  129. import { mapGetters } from 'vuex'
  130. import SelectTemplate from "@/views/business/comps/select/SelectTemplate";
  131. import SelectDeptUser from '@/views/business/comps/select/SelectDeptUser';
  132. import TemplateTable from '@/views/business/comps/template/TemplateTable';
  133. export default {
  134. name: "Bj",
  135. components: { SelectTemplate, SelectDeptUser, TemplateTable },
  136. data() {
  137. return {
  138. open: false,
  139. showIndex: 1,
  140. form: {},
  141. openSubmit: false,
  142. rulesApprove: {
  143. qmrmm: [{
  144. required: true,
  145. message: ' ',
  146. trigger: 'blur'
  147. }],
  148. fzrsh: [{
  149. required: true,
  150. message: ' ',
  151. trigger: 'blur'
  152. }],
  153. shryId: [{
  154. required: true,
  155. message: ' ',
  156. trigger: 'blur'
  157. }]
  158. },
  159. rules: {
  160. bdmc: [{
  161. required: true,
  162. message: ' ',
  163. trigger: 'blur'
  164. }],
  165. templateId: [{
  166. required: true,
  167. message: ' ',
  168. trigger: 'blur'
  169. }],
  170. sfbl: [{
  171. required: true,
  172. message: ' ',
  173. trigger: 'blur'
  174. }],
  175. }
  176. }
  177. },
  178. computed: {
  179. ...mapGetters([
  180. 'nickName', 'name'
  181. ]),
  182. },
  183. created() {
  184. },
  185. methods: {
  186. pre() {
  187. this.showIndex = 1
  188. },
  189. next() {
  190. this.$refs["form"].validate(valid => {
  191. if (valid) {
  192. this.showIndex = 2
  193. }
  194. })
  195. },
  196. selectTemplateChange(val) {
  197. this.form.bdmc = val.name
  198. this.form.bdnr = val.content
  199. this.form.templateMc = val.name
  200. this.form.templateSn = val.sn
  201. },
  202. cancel() {
  203. this.$emit('close')
  204. },
  205. reset() {
  206. this.form = {
  207. id: null,
  208. studyId: null,
  209. bdbh: null,
  210. bdmc: '麻醉/精神药品配制/领取申请单',
  211. bdsm: null,
  212. templateId: 2,
  213. templateMc: '麻醉/精神药品配制/领取申请单',
  214. templateSn: 'MJYLQSQD',
  215. bdnr: null,
  216. fzrsh: null,
  217. shryId: null,
  218. sfbl: null,
  219. qmyy: this.$t('page.business.study.studyFormApply.cjjl'),
  220. shryMc: null,
  221. }
  222. this.resetForm("form")
  223. },
  224. selectDeptUserChange(val) {
  225. this.form.shryMc = val.name
  226. },
  227. edit(row) {
  228. this.reset()
  229. if (row && row.id) {
  230. this.showIndex = 2
  231. this.$modal.loading()
  232. studyFormApply_info({ id: row.id }).then(response => {
  233. this.form = _.merge({}, this.form, response.data)
  234. this.open = true
  235. this.$modal.closeLoading()
  236. })
  237. } else {
  238. this.showIndex = 1
  239. this.form = _.merge({}, this.form, row)
  240. this.open = true
  241. }
  242. },
  243. save() {
  244. this.$refs["form"].validate(valid => {
  245. if (valid) {
  246. this.$modal.loading()
  247. studyFormApply_bc(this.form).then(response => {
  248. this.$emit('close')
  249. this.$modal.closeLoading()
  250. }).finally(() => {
  251. this.$modal.closeLoading()
  252. })
  253. }
  254. })
  255. },
  256. async showtijjiao() {
  257. let content = await this.$refs.templateTable.getFormData()
  258. if (content) {
  259. this.form.bdnr = JSON.stringify(content)
  260. this.openSubmit = true
  261. }
  262. },
  263. async saveNext() {
  264. let content = await this.$refs.templateTable.getFormData()
  265. if (content) {
  266. this.form.bdnr = JSON.stringify(content)
  267. this.$modal.loading()
  268. studyFormApply_bc(this.form).then(response => {
  269. this.$emit('close')
  270. this.$modal.closeLoading()
  271. }).finally(() => {
  272. this.$modal.closeLoading()
  273. })
  274. }
  275. },
  276. tj() {
  277. this.$refs["formSubmit"].validate(valid => {
  278. if (valid) {
  279. this.$modal.loading()
  280. studyFormApply_tj(this.form).then(response => {
  281. this.$emit('close')
  282. this.openSubmit = false
  283. this.$modal.closeLoading()
  284. }).finally(() => {
  285. this.$modal.closeLoading()
  286. })
  287. }
  288. })
  289. }
  290. }
  291. }
  292. </script>