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

335 lines
11 KiB

  1. <template>
  2. <div>
  3. <div class="edit-container" v-if="open">
  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" v-if="openSubmit">
  76. <div class="sbzdtcma"> <input type="text"> <input type="password" show-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: 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" show-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_bcOnly, 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. open: false,
  154. openSubmit: false,
  155. permitForSecectUser: '',
  156. rulesApprove: {
  157. qmrmm: [{
  158. required: true,
  159. message: ' ',
  160. trigger: 'blur'
  161. }],
  162. fzrsh: [{
  163. required: true,
  164. message: this.$t('form.placeholderSelect'),
  165. trigger: 'blur'
  166. }],
  167. shryId: [{
  168. required: true,
  169. message: ' ',
  170. trigger: 'blur'
  171. }]
  172. },
  173. rules: {
  174. bdmc: [{
  175. required: true,
  176. message: ' ',
  177. trigger: 'blur'
  178. }],
  179. templateId: [{
  180. required: true,
  181. message: ' ',
  182. trigger: 'blur'
  183. }]
  184. },
  185. templateData: {}
  186. }
  187. },
  188. computed: {
  189. ...mapGetters([
  190. 'nickName', 'name'
  191. ]),
  192. },
  193. created() {
  194. },
  195. methods: {
  196. onPreCallback(data) {
  197. console.log("data:" + JSON.stringify(data))
  198. console.log("formdata:" + JSON.stringify(this.$refs.templateTable.getFilledFormData()))
  199. if (data.type == 'fieldChanged'&&data.newRecord&&data.newRecord!='') {
  200. studyFormPre_updateBdnr(
  201. {
  202. id: this.form.id,
  203. bdnr: JSON.stringify(this.$refs.templateTable.getFilledFormData()),
  204. // zdxgjl: JSON.stringify(data.resourceList),
  205. // filedValue: JSON.stringify(data.newRecord)
  206. }
  207. ).then(response => {
  208. })
  209. }
  210. },
  211. pre() {
  212. this.showIndex = 1
  213. },
  214. next() {
  215. this.$refs["form"].validate(valid => {
  216. if (valid) {
  217. this.$modal.loading()
  218. studyFormPre_bcOnly(this.form).then(response => {
  219. this.form = response.data
  220. this.templateData = deepClone(this.form)
  221. this.showIndex = 2
  222. this.$modal.closeLoading()
  223. }).finally(() => {
  224. this.$modal.closeLoading()
  225. })
  226. }
  227. })
  228. },
  229. selectTemplateChange(val) {
  230. this.form.bdnr = val.content
  231. this.form.templateMc = val.name
  232. this.form.bdmc = val.name
  233. this.form.templateSn = val.sn
  234. this.templateData = deepClone(this.form)
  235. },
  236. cancel() {
  237. this.$emit('close')
  238. this.open = false
  239. },
  240. reset() {
  241. this.form = {
  242. id: null,
  243. studyId: null,
  244. bdbh: null,
  245. bdmc: null,
  246. bdsm: null,
  247. templateId: null,
  248. templateMc: null,
  249. templateSn: null,
  250. bdnr: null,
  251. fzrsh: null,
  252. shryId: null,
  253. shryMc: null,
  254. }
  255. this.resetForm("form")
  256. },
  257. selectDeptUserChange(val) {
  258. this.form.shryMc = val.name
  259. },
  260. edit(row) {
  261. this.reset()
  262. this.permitForSecectUser = row.permitForSecectUser
  263. if (row && row.id) {
  264. this.showIndex = 2
  265. this.$modal.loading()
  266. studyFormPre_info({ id: row.id }).then(response => {
  267. this.form = _.merge({}, response.data, { permitForSecectUser: row.permitForSecectUser })
  268. this.form.qmyy = this.$t('page.business.study.studyFormPre.zztjyzbd')
  269. this.templateData = deepClone(this.form)
  270. this.open = true
  271. this.$modal.closeLoading()
  272. }).finally(() => {
  273. this.$modal.closeLoading()
  274. })
  275. } else {
  276. this.showIndex = 1
  277. this.form = _.merge({}, this.form, row)
  278. this.templateData = deepClone(this.form)
  279. this.open = true
  280. }
  281. },
  282. save() {
  283. this.$refs["form"].validate(valid => {
  284. if (valid) {
  285. this.$modal.loading()
  286. studyFormPre_bc(this.form).then(response => {
  287. this.$emit('close')
  288. this.open = false
  289. this.$modal.closeLoading()
  290. }).finally(() => {
  291. this.$modal.closeLoading()
  292. })
  293. }
  294. })
  295. },
  296. async saveNext() {
  297. this.form.bdnr = JSON.stringify(this.$refs.templateTable.getFilledFormData())
  298. this.$modal.loading()
  299. studyFormPre_bc(this.form).then(response => {
  300. this.$emit('close')
  301. this.open = false
  302. this.$modal.closeLoading()
  303. }).finally(() => {
  304. this.$modal.closeLoading()
  305. })
  306. },
  307. async showtj() {
  308. let content = await this.$refs.templateTable.getFormData()
  309. if (content) {
  310. this.form.bdnr = JSON.stringify(content)
  311. debugger
  312. this.openSubmit = true
  313. }
  314. },
  315. tj() {
  316. this.$refs["formSubmit"].validate(valid => {
  317. if (valid) {
  318. this.$modal.loading()
  319. studyFormPre_tj(this.form).then(response => {
  320. this.$emit('close')
  321. this.open = false
  322. this.openSubmit = false
  323. this.$modal.closeLoading()
  324. }).finally(() => {
  325. this.$modal.closeLoading()
  326. })
  327. }
  328. })
  329. }
  330. }
  331. }
  332. </script>