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