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

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