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

252 lines
7.8 KiB

  1. G<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.studyFormFill.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.studyFormFill.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.studyFormFill.zc') }}</el-button>
  28. <el-button type="primary" @click="next">{{ $t('page.business.study.studyFormFill.next') }}</el-button>
  29. </template>
  30. <template v-else>
  31. <el-button @click="saveNext">{{ $t('page.business.study.studyFormFill.save') }}</el-button>
  32. <el-button type="primary" @click="openSubmit = true">{{ $t('page.business.study.studyFormFill.submit')
  33. }}</el-button>
  34. </template>
  35. </div>
  36. </div>
  37. <div class="edit-content">
  38. <div class="content" style="width:60%" v-show="showIndex == 1">
  39. <el-form ref="form" :model="form" :rules="rules" label-width="120px">
  40. <el-row>
  41. <el-col :span="24">
  42. <el-form-item :label="$t('page.business.form.bdmb')" prop="templateId">
  43. <SelectTemplate v-model="form.templateId" :name="form.templateMc" @change="selectTemplateChange"
  44. :needPre="1" />
  45. </el-form-item>
  46. </el-col>
  47. </el-row>
  48. <el-row>
  49. <el-col :span="24">
  50. <el-form-item :label="$t('page.business.form.bdmc')" prop="bdmc">
  51. <el-input type="text" v-model="form.bdmc" maxlength="50" :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('page.business.study.studyFormFill.sfbl')" prop="sfbl">
  58. <el-select v-model="form.sfbl" :placeholder="$t('form.placeholderSelect')">
  59. <el-option :label="$t('page.business.study.studyFormFill.yes')" :value="10" />
  60. <el-option :label="$t('page.business.study.studyFormFill.no')" :value="1" />
  61. </el-select>
  62. </el-form-item>
  63. </el-col>
  64. </el-row>
  65. <el-row>
  66. <el-col :span="24">
  67. <el-form-item :label="$t('page.business.study.studyFormFill.bdsm')" prop="bdsm">
  68. <el-input type="textarea" v-model="form.bdsm" :rows="5" maxlength="500"
  69. :placeholder="$t('form.placeholderInput')">
  70. </el-input>
  71. </el-form-item>
  72. </el-col>
  73. </el-row>
  74. </el-form>
  75. </div>
  76. <div class="content" v-show="showIndex == 2">
  77. <TemplateTable ref="templateTable" :sn="form.templateSn" :templateData="form.bdnr" fillType="preFill" />
  78. </div>
  79. </div>
  80. </div>
  81. <el-dialog :title="$t('page.business.study.studyFormFill.tjjl')" :visible.sync="openSubmit" width="500px"
  82. append-to-body :close-on-click-modal="false">
  83. <el-form ref="formSubmit" :model="form" :rules="rulesApprove" label-width="120px">
  84. todo
  85. </el-form>
  86. <!-- <div slot="footer" class="dialog-footer">
  87. <el-button type="primary" @click="tj">{{ $t('form.confirm') }}</el-button>
  88. <el-button @click="openSubmit = false">{{ $t('form.cancel') }}</el-button>
  89. </div> -->
  90. </el-dialog>
  91. </div>
  92. </template>
  93. <script>
  94. import { studyFormFill_bc, studyFormFill_tj, studyFormFill_info } from "@/api/business/study/studyFormFill"
  95. import { mapGetters } from 'vuex'
  96. import SelectTemplate from "@/views/business/comps/select/SelectTemplate";
  97. import SelectDeptUser from '@/views/business/comps/select/SelectDeptUser';
  98. import TemplateTable from '@/views/business/comps/template/TemplateTable';
  99. export default {
  100. name: "Bj",
  101. components: { SelectTemplate, SelectDeptUser, TemplateTable },
  102. data() {
  103. return {
  104. open: false,
  105. showIndex: 1,
  106. form: {},
  107. openSubmit: false,
  108. rulesApprove: {
  109. qmrmm: [{
  110. required: true,
  111. message: ' ',
  112. trigger: 'blur'
  113. }],
  114. fzrsh: [{
  115. required: true,
  116. message: ' ',
  117. trigger: 'blur'
  118. }],
  119. shryId: [{
  120. required: true,
  121. message: ' ',
  122. trigger: 'blur'
  123. }]
  124. },
  125. rules: {
  126. bdmc: [{
  127. required: true,
  128. message: ' ',
  129. trigger: 'blur'
  130. }],
  131. templateId: [{
  132. required: true,
  133. message: ' ',
  134. trigger: 'blur'
  135. }],
  136. sfbl: [{
  137. required: true,
  138. message: ' ',
  139. trigger: 'blur'
  140. }],
  141. }
  142. }
  143. },
  144. computed: {
  145. ...mapGetters([
  146. 'nickName'
  147. ]),
  148. },
  149. created() {
  150. },
  151. methods: {
  152. next() {
  153. this.$refs["form"].validate(valid => {
  154. if (valid) {
  155. this.showIndex = 2
  156. }
  157. })
  158. },
  159. selectTemplateChange(val) {
  160. this.form.bdnr = val.content
  161. this.form.templateMc = val.name
  162. },
  163. cancel() {
  164. this.$emit('close')
  165. },
  166. reset() {
  167. this.form = {
  168. id: null,
  169. studyId: null,
  170. bdbh: null,
  171. bdmc: null,
  172. bdsm: null,
  173. templateId: null,
  174. templateMc: null,
  175. bdnr: null,
  176. fzrsh: null,
  177. shryId: null,
  178. sfbl: null,
  179. shryMc: null,
  180. }
  181. this.resetForm("form")
  182. },
  183. selectDeptUserChange(val) {
  184. this.form.shryMc = val.name
  185. },
  186. edit(row) {
  187. this.reset()
  188. this.showIndex = 1
  189. if (row && row.id) {
  190. this.$modal.loading()
  191. studyFormFill_info({ id: row.id }).then(response => {
  192. this.form = response.data
  193. this.form.qmyy = '制作提交预制表单'
  194. this.open = true
  195. this.$modal.closeLoading()
  196. })
  197. } else {
  198. this.form = _.merge({}, this.form, row)
  199. this.open = true
  200. }
  201. },
  202. save() {
  203. this.$refs["form"].validate(valid => {
  204. if (valid) {
  205. this.$modal.loading()
  206. studyFormFill_bc(this.form).then(response => {
  207. this.$emit('close')
  208. this.$modal.closeLoading()
  209. }).finally(() => {
  210. this.$modal.closeLoading()
  211. })
  212. }
  213. })
  214. },
  215. async saveNext() {
  216. let content = await this.$refs.templateTable.getFormData()
  217. this.form.bdnr = JSON.stringify(content)
  218. this.$modal.loading()
  219. studyFormFill_bc(this.form).then(response => {
  220. this.$emit('close')
  221. this.$modal.closeLoading()
  222. }).finally(() => {
  223. this.$modal.closeLoading()
  224. })
  225. },
  226. tj() {
  227. this.$refs["formSubmit"].validate(valid => {
  228. if (valid) {
  229. this.dotj()
  230. }
  231. })
  232. },
  233. async dotj() {
  234. let content = await this.$refs.templateTable.getFormData()
  235. this.form.bdnr = JSON.stringify(content)
  236. this.$modal.loading()
  237. studyFormFill_tj(this.form).then(response => {
  238. this.$emit('close')
  239. this.openSubmit = false
  240. this.$modal.closeLoading()
  241. }).finally(() => {
  242. this.$modal.closeLoading()
  243. })
  244. }
  245. }
  246. }
  247. </script>