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

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