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

290 lines
9.2 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.studyFormPre.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.studyFormPre.bdsj') }}
  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.studyFormPre.zc') }}</el-button>
  28. <el-button type="primary" @click="next">{{ $t('page.business.study.studyFormPre.next') }}</el-button>
  29. </template>
  30. <template v-else>
  31. <el-button @click="saveNext">{{ $t('page.business.study.studyFormPre.save') }}</el-button>
  32. <el-button type="primary" @click="showtj">{{ $t('page.business.study.studyFormPre.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.xtmbmc')" 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.studyFormPre.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" fillType="preFill" />
  67. </div>
  68. </div>
  69. </div>
  70. <el-dialog :title="$t('page.business.study.studyFormPre.tjysb')" :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. <el-row>
  74. <el-col :span="24">
  75. <el-form-item :label="$t('page.business.study.studyFormPre.shryId')" prop="shryId">
  76. <SelectDeptUser v-model="form.shryId" :name="form.shryMc" key="shryId" @change="selectDeptUserChange" />
  77. </el-form-item>
  78. </el-col>
  79. </el-row>
  80. <el-row>
  81. <el-col :span="24">
  82. <el-form-item :label="$t('page.business.study.studyFormPre.fzrsh')" prop="fzrsh">
  83. <el-radio-group v-model="form.fzrsh">
  84. <el-radio :label="10"></el-radio>
  85. <el-radio :label="1"></el-radio>
  86. </el-radio-group>
  87. </el-form-item>
  88. </el-col>
  89. </el-row>
  90. <el-row>
  91. <el-col :span="24">
  92. <el-form-item :label="$t('form.qmyy')" prop="qmyy">
  93. <el-input type="text" :value="form.qmyy" maxlength="50" disabled
  94. :placeholder="$t('form.placeholderInput')" />
  95. </el-form-item>
  96. </el-col>
  97. </el-row>
  98. <el-row>
  99. <el-col :span="24">
  100. <el-form-item :label="$t('form.remark')" prop="remark">
  101. <el-input type="textarea" v-model="form.getReason" :rows="5" maxlength="500"
  102. :placeholder="$t('form.placeholderInput')">
  103. </el-input>
  104. </el-form-item>
  105. </el-col>
  106. </el-row>
  107. <el-row>
  108. <el-col :span="24">
  109. <el-form-item :label="$t('form.signer')">
  110. <el-input type="text" v-model="nickName" maxlength="50" disabled
  111. :placeholder="$t('form.placeholderInput')" />
  112. </el-form-item>
  113. </el-col>
  114. </el-row>
  115. <el-row>
  116. <el-col :span="24">
  117. <el-form-item :label="$t('form.password')" prop="qmrmm">
  118. <el-input type="password" v-model="form.qmrmm" maxlength="20"
  119. :placeholder="$t('form.placeholderInput')" />
  120. </el-form-item>
  121. </el-col>
  122. </el-row>
  123. </el-form>
  124. <div slot="footer" class="dialog-footer">
  125. <el-button type="primary" @click="tj">{{ $t('form.confirm') }}</el-button>
  126. <el-button @click="openSubmit = false">{{ $t('form.cancel') }}</el-button>
  127. </div>
  128. </el-dialog>
  129. </div>
  130. </template>
  131. <script>
  132. import { studyFormPre_bc, studyFormPre_tj, studyFormPre_info } from "@/api/business/study/studyFormPre"
  133. import { mapGetters } from 'vuex'
  134. import SelectTemplate from "@/views/business/comps/select/SelectTemplate";
  135. import SelectDeptUser from '@/views/business/comps/select/SelectDeptUser';
  136. import TemplateTable from '@/views/business/comps/template/TemplateTable';
  137. export default {
  138. name: "Bj",
  139. components: { SelectTemplate, SelectDeptUser, TemplateTable },
  140. data() {
  141. return {
  142. open: false,
  143. showIndex: 1,
  144. form: {},
  145. openSubmit: false,
  146. rulesApprove: {
  147. qmrmm: [{
  148. required: true,
  149. message: ' ',
  150. trigger: 'blur'
  151. }],
  152. fzrsh: [{
  153. required: true,
  154. message: ' ',
  155. trigger: 'blur'
  156. }],
  157. shryId: [{
  158. required: true,
  159. message: ' ',
  160. trigger: 'blur'
  161. }]
  162. },
  163. rules: {
  164. bdmc: [{
  165. required: true,
  166. message: ' ',
  167. trigger: 'blur'
  168. }],
  169. templateId: [{
  170. required: true,
  171. message: ' ',
  172. trigger: 'blur'
  173. }]
  174. },
  175. }
  176. },
  177. computed: {
  178. ...mapGetters([
  179. 'nickName'
  180. ]),
  181. },
  182. created() {
  183. },
  184. methods: {
  185. next() {
  186. this.$refs["form"].validate(valid => {
  187. if (valid) {
  188. this.showIndex = 2
  189. }
  190. })
  191. },
  192. selectTemplateChange(val) {
  193. this.form.bdnr = val.content
  194. this.form.templateMc = val.name
  195. this.form.templateSn = val.sn
  196. },
  197. cancel() {
  198. this.$emit('close')
  199. },
  200. reset() {
  201. this.form = {
  202. id: null,
  203. studyId: null,
  204. bdbh: null,
  205. bdmc: null,
  206. bdsm: null,
  207. templateId: null,
  208. templateMc: null,
  209. bdnr: null,
  210. fzrsh: null,
  211. shryId: null,
  212. shryMc: null,
  213. }
  214. this.resetForm("form")
  215. },
  216. selectDeptUserChange(val) {
  217. this.form.shryMc = val.name
  218. },
  219. edit(row) {
  220. this.reset()
  221. this.showIndex = 1
  222. if (row && row.id) {
  223. this.$modal.loading()
  224. studyFormPre_info({ id: row.id }).then(response => {
  225. this.form = response.data
  226. this.form.qmyy = '制作提交预制表单'
  227. this.open = true
  228. this.$modal.closeLoading()
  229. }).finally(() => {
  230. this.$modal.closeLoading()
  231. })
  232. } else {
  233. this.form = _.merge({}, this.form, row)
  234. this.open = true
  235. }
  236. },
  237. save() {
  238. this.$refs["form"].validate(valid => {
  239. if (valid) {
  240. this.$modal.loading()
  241. studyFormPre_bc(this.form).then(response => {
  242. this.$emit('close')
  243. this.$modal.closeLoading()
  244. }).finally(() => {
  245. this.$modal.closeLoading()
  246. })
  247. }
  248. })
  249. },
  250. async saveNext() {
  251. let content = await this.$refs.templateTable.getFormData()
  252. this.form.bdnr = JSON.stringify(content)
  253. this.$modal.loading()
  254. studyFormPre_bc(this.form).then(response => {
  255. this.$emit('close')
  256. this.$modal.closeLoading()
  257. }).finally(() => {
  258. this.$modal.closeLoading()
  259. })
  260. },
  261. async showtj() {
  262. await this.$refs.templateTable.getFormData()
  263. this.openSubmit = true
  264. },
  265. tj() {
  266. this.$refs["formSubmit"].validate(valid => {
  267. if (valid) {
  268. this.dotj()
  269. }
  270. })
  271. },
  272. async dotj() {
  273. let content = await this.$refs.templateTable.getFormData()
  274. this.form.bdnr = JSON.stringify(content)
  275. this.$modal.loading()
  276. studyFormPre_tj(this.form).then(response => {
  277. this.$emit('close')
  278. this.openSubmit = false
  279. this.$modal.closeLoading()
  280. }).finally(() => {
  281. this.$modal.closeLoading()
  282. })
  283. }
  284. }
  285. }
  286. </script>