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

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