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

301 lines
9.9 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. import { deepClone } from "@/utils/index";
  134. export default {
  135. name: "Bj",
  136. components: { SelectTemplate, SelectDeptUser, TemplateTable },
  137. data() {
  138. return {
  139. open: false,
  140. showIndex: 1,
  141. form: {},
  142. openSubmit: false,
  143. rulesApprove: {
  144. qmrmm: [{
  145. required: true,
  146. message: ' ',
  147. trigger: 'blur'
  148. }],
  149. fzrsh: [{
  150. required: true,
  151. message: ' ',
  152. trigger: 'blur'
  153. }],
  154. shryId: [{
  155. required: true,
  156. message: ' ',
  157. trigger: 'blur'
  158. }]
  159. },
  160. rules: {
  161. bdmc: [{
  162. required: true,
  163. message: ' ',
  164. trigger: 'blur'
  165. }],
  166. templateId: [{
  167. required: true,
  168. message: ' ',
  169. trigger: 'blur'
  170. }],
  171. sfbl: [{
  172. required: true,
  173. message: ' ',
  174. trigger: 'blur'
  175. }],
  176. },
  177. templateData: {}
  178. }
  179. },
  180. computed: {
  181. ...mapGetters([
  182. 'nickName', 'name'
  183. ]),
  184. },
  185. created() {
  186. },
  187. methods: {
  188. pre() {
  189. this.showIndex = 1
  190. },
  191. next() {
  192. this.$refs["form"].validate(valid => {
  193. if (valid) {
  194. this.showIndex = 2
  195. }
  196. })
  197. },
  198. selectTemplateChange(val) {
  199. this.form.bdmc = val.name
  200. this.form.bdnr = val.content
  201. this.form.templateMc = val.name
  202. this.form.templateSn = val.sn
  203. this.templateData = deepClone(this.form)
  204. },
  205. cancel() {
  206. this.$emit('close')
  207. },
  208. reset() {
  209. this.form = {
  210. id: null,
  211. studyId: null,
  212. bdbh: null,
  213. bdmc: '麻醉/精神药品配制/领取申请单',
  214. bdsm: null,
  215. templateId: 2,
  216. templateMc: '麻醉/精神药品配制/领取申请单',
  217. templateSn: 'MJYLQSQD',
  218. bdnr: null,
  219. fzrsh: null,
  220. shryId: null,
  221. sfbl: null,
  222. qmyy: this.$t('page.business.study.studyFormApply.cjjl'),
  223. shryMc: null,
  224. }
  225. this.resetForm("form")
  226. },
  227. selectDeptUserChange(val) {
  228. this.form.shryMc = val.name
  229. },
  230. edit(row) {
  231. this.reset()
  232. if (row && row.id) {
  233. this.showIndex = 2
  234. this.$modal.loading()
  235. studyFormApply_info({ id: row.id }).then(response => {
  236. this.form = _.merge({}, this.form, response.data)
  237. this.templateData = deepClone(this.form)
  238. this.open = true
  239. this.$modal.closeLoading()
  240. })
  241. } else {
  242. this.showIndex = 1
  243. this.form = _.merge({}, this.form, row)
  244. this.templateData = deepClone(this.form)
  245. this.open = true
  246. }
  247. },
  248. save() {
  249. this.$refs["form"].validate(valid => {
  250. if (valid) {
  251. this.$modal.loading()
  252. studyFormApply_bc(this.form).then(response => {
  253. this.$emit('close')
  254. this.$modal.closeLoading()
  255. }).finally(() => {
  256. this.$modal.closeLoading()
  257. })
  258. }
  259. })
  260. },
  261. async showtijjiao() {
  262. let content = await this.$refs.templateTable.getFormData()
  263. if (content) {
  264. this.form.bdnr = JSON.stringify(content)
  265. this.openSubmit = true
  266. }
  267. },
  268. async saveNext() {
  269. let content = await this.$refs.templateTable.getFormData()
  270. if (content) {
  271. this.form.bdnr = JSON.stringify(content)
  272. this.$modal.loading()
  273. studyFormApply_bc(this.form).then(response => {
  274. this.$emit('close')
  275. this.$modal.closeLoading()
  276. }).finally(() => {
  277. this.$modal.closeLoading()
  278. })
  279. }
  280. },
  281. tj() {
  282. this.$refs["formSubmit"].validate(valid => {
  283. if (valid) {
  284. this.$modal.loading()
  285. studyFormApply_tj(this.form).then(response => {
  286. this.$emit('close')
  287. this.openSubmit = false
  288. this.$modal.closeLoading()
  289. }).finally(() => {
  290. this.$modal.closeLoading()
  291. })
  292. }
  293. })
  294. }
  295. }
  296. }
  297. </script>