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

328 lines
11 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.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. <el-button type="primary" @click="pre">{{ $t('page.business.study.studyFormPre.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="form.id && form.id !== ''" :needPre="10"
  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.studyFormPre.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" emitName="onPreCallback" @onPreCallback="onPreCallback"
  69. :sn="form.templateSn" :templateData="templateData" fillType="preFill" />
  70. </div>
  71. </div>
  72. </div>
  73. <el-dialog :title="$t('page.business.study.studyFormPre.tjysb')" :visible.sync="openSubmit" width="500px"
  74. append-to-body :close-on-click-modal="false">
  75. <el-form ref="formSubmit" :model="form" :rules="rulesApprove" label-width="120px">
  76. <div class="sbzdtcma"> <input type="text"> <input type="password"> </div>
  77. <el-row>
  78. <el-col :span="24">
  79. <el-form-item :label="$t('page.business.study.studyFormPre.shryId')" prop="shryId">
  80. <SelectStudyUser v-model="form.shryId" :query="{
  81. studyId: form.studyId,
  82. studySubjectId: form.studySubjectId,
  83. permit: form.permitForSecectUser
  84. }" key="shryId" @change="selectDeptUserChange" />
  85. </el-form-item>
  86. </el-col>
  87. </el-row>
  88. <el-row>
  89. <el-col :span="24">
  90. <el-form-item :label="$t('page.business.study.studyFormPre.fzrsh')" prop="fzrsh">
  91. <el-radio-group v-model="form.fzrsh">
  92. <el-radio :label="$t('page.business.study.studyFormPre.yes')"></el-radio>
  93. <el-radio :label="$t('page.business.study.studyFormPre.no')"></el-radio>
  94. </el-radio-group>
  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.qmyy')" prop="qmyy">
  101. <el-input type="text" :value="form.qmyy" maxlength="50" disabled
  102. :placeholder="$t('form.placeholderInput')" />
  103. </el-form-item>
  104. </el-col>
  105. </el-row>
  106. <el-row>
  107. <el-col :span="24">
  108. <el-form-item :label="$t('form.remark')" prop="remark">
  109. <el-input type="textarea" v-model="form.getReason" :rows="5" maxlength="500"
  110. :placeholder="$t('form.placeholderInput')">
  111. </el-input>
  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.signer')">
  118. <el-input type="text" v-model="nickName" maxlength="50" disabled
  119. :placeholder="$t('form.placeholderInput')" />
  120. </el-form-item>
  121. </el-col>
  122. </el-row>
  123. <el-row>
  124. <el-col :span="24">
  125. <el-form-item :label="$t('form.password')" prop="qmrmm">
  126. <el-input type="password" v-model="form.qmrmm" maxlength="20"
  127. :placeholder="$t('form.placeholderInput')" />
  128. </el-form-item>
  129. </el-col>
  130. </el-row>
  131. </el-form>
  132. <div slot="footer" class="dialog-footer">
  133. <el-button type="primary" @click="tj">{{ $t('form.confirm') }}</el-button>
  134. <el-button @click="openSubmit = false">{{ $t('form.cancel') }}</el-button>
  135. </div>
  136. </el-dialog>
  137. </div>
  138. </template>
  139. <script>
  140. import { studyFormPre_bc, studyFormPre_tj, studyFormPre_info, studyFormPre_updateBdnr } from "@/api/business/study/studyFormPre"
  141. import { mapGetters } from 'vuex'
  142. import SelectTemplate from "@/views/business/comps/select/SelectTemplate";
  143. import SelectStudyUser from '@/views/business/comps/select/SelectStudyUser';
  144. import TemplateTable from '@/views/business/comps/template/TemplateTable';
  145. import { deepClone } from "@/utils/index";
  146. export default {
  147. name: "Bj",
  148. components: { SelectTemplate, SelectStudyUser, TemplateTable },
  149. data() {
  150. return {
  151. showIndex: 1,
  152. form: {},
  153. openSubmit: false,
  154. rulesApprove: {
  155. qmrmm: [{
  156. required: true,
  157. message: ' ',
  158. trigger: 'blur'
  159. }],
  160. fzrsh: [{
  161. required: true,
  162. message: ' ',
  163. trigger: 'blur'
  164. }],
  165. shryId: [{
  166. required: true,
  167. message: ' ',
  168. trigger: 'blur'
  169. }]
  170. },
  171. rules: {
  172. bdmc: [{
  173. required: true,
  174. message: ' ',
  175. trigger: 'blur'
  176. }],
  177. templateId: [{
  178. required: true,
  179. message: ' ',
  180. trigger: 'blur'
  181. }]
  182. },
  183. templateData: {}
  184. }
  185. },
  186. computed: {
  187. ...mapGetters([
  188. 'nickName', 'name'
  189. ]),
  190. },
  191. created() {
  192. },
  193. methods: {
  194. onPreCallback(data) {
  195. console.log("data:" + JSON.stringify(data))
  196. console.log("formdata:" + JSON.stringify(this.$refs.templateTable.getFilledFormData()))
  197. if (data.type == 'fieldChanged') {
  198. studyFormPre_updateBdnr(
  199. {
  200. id: this.form.id,
  201. bdnr: JSON.stringify(this.$refs.templateTable.getFilledFormData()),
  202. // zdxgjl: JSON.stringify(data.resourceList),
  203. // filedValue: JSON.stringify(data.newRecord)
  204. }
  205. ).then(response => {
  206. })
  207. }
  208. },
  209. pre() {
  210. this.showIndex = 1
  211. },
  212. next() {
  213. this.$refs["form"].validate(valid => {
  214. if (valid) {
  215. this.$modal.loading()
  216. studyFormPre_bc(this.form).then(response => {
  217. this.form = response.data
  218. this.templateData = deepClone(this.form)
  219. this.showIndex = 2
  220. this.$modal.closeLoading()
  221. }).finally(() => {
  222. this.$modal.closeLoading()
  223. })
  224. }
  225. })
  226. },
  227. selectTemplateChange(val) {
  228. this.form.bdnr = val.content
  229. this.form.templateMc = val.name
  230. this.form.bdmc = val.name
  231. this.form.templateSn = val.sn
  232. this.templateData = deepClone(this.form)
  233. },
  234. cancel() {
  235. this.$emit('close')
  236. },
  237. reset() {
  238. this.form = {
  239. id: null,
  240. studyId: null,
  241. bdbh: null,
  242. bdmc: null,
  243. bdsm: null,
  244. templateId: null,
  245. templateMc: null,
  246. templateSn: null,
  247. bdnr: null,
  248. fzrsh: null,
  249. shryId: null,
  250. shryMc: null,
  251. }
  252. this.resetForm("form")
  253. },
  254. selectDeptUserChange(val) {
  255. this.form.shryMc = val.name
  256. },
  257. edit(row) {
  258. this.reset()
  259. if (row && row.id) {
  260. this.showIndex = 2
  261. this.$modal.loading()
  262. studyFormPre_info({ id: row.id }).then(response => {
  263. this.form = _.merge({}, response.data, { permitForSecectUser: row.permitForSecectUser })
  264. this.form.qmyy = this.$t('page.business.study.studyFormPre.zztjyzbd')
  265. this.templateData = deepClone(this.form)
  266. this.$modal.closeLoading()
  267. }).finally(() => {
  268. this.$modal.closeLoading()
  269. })
  270. } else {
  271. this.showIndex = 1
  272. this.form = _.merge({}, this.form, row)
  273. this.templateData = deepClone(this.form)
  274. }
  275. },
  276. save() {
  277. this.$refs["form"].validate(valid => {
  278. if (valid) {
  279. this.$modal.loading()
  280. studyFormPre_bc(this.form).then(response => {
  281. this.$emit('close')
  282. this.$modal.closeLoading()
  283. }).finally(() => {
  284. this.$modal.closeLoading()
  285. })
  286. }
  287. })
  288. },
  289. async saveNext() {
  290. let content = await this.$refs.templateTable.getFormData()
  291. if (content) {
  292. this.form.bdnr = JSON.stringify(content)
  293. this.$modal.loading()
  294. studyFormPre_bc(this.form).then(response => {
  295. this.$emit('close')
  296. this.$modal.closeLoading()
  297. }).finally(() => {
  298. this.$modal.closeLoading()
  299. })
  300. }
  301. },
  302. async showtj() {
  303. let content = await this.$refs.templateTable.getFormData()
  304. if (content) {
  305. this.form.bdnr = JSON.stringify(content)
  306. this.openSubmit = true
  307. }
  308. },
  309. tj() {
  310. this.$refs["formSubmit"].validate(valid => {
  311. if (valid) {
  312. this.$modal.loading()
  313. studyFormPre_tj(this.form).then(response => {
  314. this.$emit('close')
  315. this.openSubmit = false
  316. this.$modal.closeLoading()
  317. }).finally(() => {
  318. this.$modal.closeLoading()
  319. })
  320. }
  321. })
  322. }
  323. }
  324. }
  325. </script>