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

828 lines
30 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.studyFormFill.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.studyFormFill.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.studyFormFill.zc') }}</el-button>
  28. <el-button type="primary" @click="next">{{ $t('page.business.study.studyFormFill.next') }}</el-button>
  29. </template>
  30. <template v-else>
  31. <el-button @click="showYjcc" v-if="form.templateShowYjcc==10">{{ $t('page.business.study.studyFormFill.yjcc')
  32. }}</el-button>
  33. <el-button @click="showSave">{{ $t('page.business.study.studyFormFill.save') }}</el-button>
  34. <el-button type="primary" @click="showApprove">{{ $t('page.business.study.studyFormFill.submit')
  35. }}</el-button>
  36. <el-button type="primary" @click="pre">{{ $t('page.business.study.studyFormFill.pre') }}</el-button>
  37. </template>
  38. </div>
  39. </div>
  40. <div class="edit-content">
  41. <div class="content" style="width:60%" v-show="showIndex == 1">
  42. <el-form ref="form" :model="form" :rules="rules" label-width="120px">
  43. <el-row>
  44. <el-col :span="24">
  45. <el-form-item :label="bdmbTitle" prop="templateId">
  46. <SelectTemplate v-model="form.templateId" :disabled="form.id && form.id !== ''"
  47. :name="form.templateMc" :studyType="studyType" :studyFormType="studyFormType" @change="selectTemplateChange" :needPre="1" />
  48. </el-form-item>
  49. </el-col>
  50. </el-row>
  51. <el-row>
  52. <el-col :span="24">
  53. <el-form-item :label="$t('page.business.form.bdmc')" prop="bdmc">
  54. <el-input type="text" v-model="form.bdmc" maxlength="50" :placeholder="$t('form.placeholderInput')" />
  55. </el-form-item>
  56. </el-col>
  57. </el-row>
  58. <el-row>
  59. <el-col :span="24">
  60. <el-form-item :label="$t('page.business.study.studyFormFill.sfbl')" prop="sfbl">
  61. <el-select v-model="form.sfbl" :placeholder="$t('form.placeholderSelect')" style="width: 100%;">
  62. <el-option :label="$t('page.business.study.studyFormFill.yes')" value="是" />
  63. <el-option :label="$t('page.business.study.studyFormFill.no')" value="否" />
  64. </el-select>
  65. </el-form-item>
  66. </el-col>
  67. </el-row>
  68. <el-row>
  69. <el-col :span="24">
  70. <el-form-item :label="$t('page.business.study.studyFormFill.bdsm')" prop="bdsm">
  71. <el-input type="textarea" v-model="form.bdsm" :rows="5" maxlength="500"
  72. :placeholder="$t('form.placeholderInput')">
  73. </el-input>
  74. </el-form-item>
  75. </el-col>
  76. </el-row>
  77. </el-form>
  78. </div>
  79. <div class="content" v-if="showIndex == 2">
  80. <TemplateTable emitName="onFillCallback" @onFillCallback="onFillCallback" ref="templateTable"
  81. :sn="form.templateSn" :templateData="templateData" fillType="actFill" />
  82. </div>
  83. </div>
  84. </div>
  85. <el-dialog :title="$t('page.business.study.studyFormFill.tjjl')" :visible.sync="openApprove" width="1200px"
  86. append-to-body :close-on-click-modal="false">
  87. <el-form ref="formApprove" :model="formApprove" :rules="rulesApprove" label-width="120px" v-if="openApprove">
  88. <div class="sbzdtcma"> <input type="text"> <input type="password" show-password> </div>
  89. <el-row v-if="form.sftb == 1">
  90. <el-col :psna="24">
  91. <el-form-item>
  92. <div><el-checkbox v-model="formApprove.sfcz" @change="sfczChange">{{
  93. $t('page.business.study.studyFormFill.cz') }}</el-checkbox>
  94. <el-button type="primary" v-if="formApprove.sfcz" @click="addCz" style="margin-left: 10px;">{{
  95. $t('page.business.study.studyFormFill.tjcz') }}</el-button>
  96. </div>
  97. <template v-if="formApprove.sfcz">
  98. <div v-if="czlist.length > 0">
  99. <el-card class="box-card" v-for="(citem, cindex) in czlist" :key="'cz' + cindex"
  100. style="margin-top: 10px;">
  101. <div slot="header" class="clearfix">
  102. <div style="display: flex;justify-content: space-between;">
  103. <div style="display: flex;">
  104. <div> 处置方式</div>
  105. <div>
  106. <BusinessSelect v-model="citem.czfs" dictType="business_czfs" style="width: 200px;">
  107. </BusinessSelect>
  108. </div>
  109. </div>
  110. <div>
  111. <el-button type="danger" icon="el-icon-delete" circle @click="delcz(cindex)"></el-button>
  112. </div>
  113. </div>
  114. </div>
  115. <el-checkbox-group v-model="citem.list">
  116. <el-checkbox :label="item.bh" v-for="item in resource" :key="'icz' + item.bh"
  117. :disabled="getDisabledCz(item.bh, cindex)"></el-checkbox>
  118. </el-checkbox-group>
  119. </el-card>
  120. </div>
  121. </template>
  122. </el-form-item>
  123. </el-col>
  124. <el-col :psna="24">
  125. <el-form-item>
  126. <div><el-checkbox v-model="formApprove.sfcc" @change="sfccChange">{{
  127. $t('page.business.study.studyFormFill.cc') }}</el-checkbox>
  128. <el-button type="primary" v-if="formApprove.sfcc" @click="addCc" style="margin-left: 10px;">{{
  129. $t('page.business.study.studyFormFill.tjcc') }}</el-button>
  130. </div>
  131. <template v-if="formApprove.sfcc">
  132. <div v-if="cclist.length > 0">
  133. <el-card class="box-card" v-for="(citem, cindex) in cclist" :key="'cz' + cindex"
  134. style="margin-top: 10px;">
  135. <div slot="header" class="clearfix">
  136. <div style="display: flex;justify-content: space-between;">
  137. <div style="display: flex;">
  138. <div style="display: flex;">
  139. <div> 存储条件</div>
  140. <div>
  141. <BusinessSelect v-model="citem.cctj" dictType="business_cctj" style="width: 200px;">
  142. </BusinessSelect>
  143. </div>
  144. </div>
  145. <div style="display: flex; margin-left: 10px;">
  146. <div> 存储位置</div>
  147. <div>
  148. <BusinessSelect v-model="citem.ccwz" dictType="business_ccwz" style="width: 200px;">
  149. </BusinessSelect>
  150. </div>
  151. </div>
  152. </div>
  153. <div>
  154. <el-button type="danger" icon="el-icon-delete" circle @click="delcc(cindex)"></el-button>
  155. </div>
  156. </div>
  157. </div>
  158. <el-checkbox-group v-model="citem.list">
  159. <el-checkbox :label="item.bh" v-for="item in resource" :key="'icz' + item.bh"
  160. :disabled="getDisabledCc(item.bh, cindex)"></el-checkbox>
  161. </el-checkbox-group>
  162. </el-card>
  163. </div>
  164. </template>
  165. </el-form-item>
  166. </el-col>
  167. <el-col :psna="24">
  168. <el-form-item>
  169. <div>{{ $t('page.business.study.studyFormFill.yltj') }}</div>
  170. <div style=" display: flex; flex-wrap: wrap; gap: 16px;">
  171. <div v-for="(item, index) in resource" :key="'r' + index" style=" flex: 0 0 calc(33.333% - 11px);">
  172. {{ item.bh }}
  173. <el-input type="number" v-model="item.syl" maxlength="50" style="width:150px;">
  174. <template slot="append">
  175. <div style="width: 20px;">
  176. <BusinessSelect v-model="item.syldw" :showMax="false" dictType="business_tjdw">
  177. </BusinessSelect>
  178. </div>
  179. </template>
  180. </el-input>
  181. </div>
  182. </div>
  183. </el-form-item>
  184. </el-col>
  185. </el-row>
  186. <el-row>
  187. <el-col :span="24">
  188. <el-form-item :label="$t('form.qmyy')" prop="qmyy">
  189. <el-input type="text" :value="formApprove.qmyy" maxlength="50" disabled
  190. :placeholder="$t('form.placeholderInput')" />
  191. </el-form-item>
  192. </el-col>
  193. </el-row>
  194. <el-row>
  195. <el-col :span="24">
  196. <el-form-item :label="$t('form.remark')" prop="remark">
  197. <el-input type="textarea" v-model="formApprove.remark" :rows="5" maxlength="500"
  198. :placeholder="$t('form.placeholderInput')">
  199. </el-input>
  200. </el-form-item>
  201. </el-col>
  202. </el-row>
  203. <el-row>
  204. <el-col :span="24">
  205. <el-form-item :label="$t('form.signer')">
  206. <el-input type="text" v-model="nickName" maxlength="50" disabled
  207. :placeholder="$t('form.placeholderInput')" />
  208. </el-form-item>
  209. </el-col>
  210. </el-row>
  211. <el-row>
  212. <el-col :span="24">
  213. <el-form-item :label="$t('form.password')" prop="qmrmm">
  214. <div class="sbzdtcma"> <input type="text"></div>
  215. <el-input type="password" show-password v-model="formApprove.qmrmm" maxlength="20"
  216. :placeholder="$t('form.placeholderInput')" />
  217. </el-form-item>
  218. </el-col>
  219. </el-row>
  220. </el-form>
  221. <div slot="footer" class="dialog-footer">
  222. <el-button type="primary" @click="tj">{{ $t('form.confirm') }}</el-button>
  223. <el-button @click="openApprove = false">{{ $t('form.cancel') }}</el-button>
  224. </div>
  225. </el-dialog>
  226. <el-dialog :title="$t('page.business.study.studyFormFill.yjcc')" :visible.sync="openYjcc" width="1200px"
  227. append-to-body :close-on-click-modal="false">
  228. <el-form ref="formYjcc" :model="formYjcc" :rules="rulesYjcc" label-width="120px" v-if="openYjcc">
  229. <div class="sbzdtcma"> <input type="text"> <input type="password" show-password> </div>
  230. <el-row>
  231. <el-col :psna="24">
  232. <el-form-item>
  233. <div>
  234. <el-button type="primary" @click="addCcYj" style="margin-left: 10px;">{{
  235. $t('page.business.study.studyFormFill.tjcc') }}</el-button>
  236. </div>
  237. <template>
  238. <div v-if="cclistYj.length > 0">
  239. <el-card class="box-card" v-for="(citem, cindex) in cclistYj" :key="'cz' + cindex"
  240. style="margin-top: 10px;">
  241. <div slot="header" class="clearfix">
  242. <div style="display: flex;justify-content: space-between;">
  243. <div style="display: flex;">
  244. <div style="display: flex;">
  245. <div> 存储条件</div>
  246. <div>
  247. <BusinessSelect v-model="citem.cctj" dictType="business_cctj" style="width: 200px;">
  248. </BusinessSelect>
  249. </div>
  250. </div>
  251. <div style="display: flex; margin-left: 10px;">
  252. <div> 存储位置</div>
  253. <div>
  254. <BusinessSelect v-model="citem.ccwz" dictType="business_ccwz" style="width: 200px;">
  255. </BusinessSelect>
  256. </div>
  257. </div>
  258. </div>
  259. <div>
  260. <el-button type="danger" icon="el-icon-delete" v-if="cclistYj.length > 1" circle
  261. @click="delccYj(cindex)"></el-button>
  262. </div>
  263. </div>
  264. </div>
  265. <el-checkbox-group v-model="citem.list">
  266. <el-checkbox :label="item.bh" v-for="item in resourceYj" :key="'icz' + item.bh"
  267. :disabled="getDisabledCcYj(item.bh, cindex)"></el-checkbox>
  268. </el-checkbox-group>
  269. </el-card>
  270. </div>
  271. </template>
  272. </el-form-item>
  273. </el-col>
  274. </el-row>
  275. <el-row>
  276. <el-col :span="24">
  277. <el-form-item :label="$t('form.qmyy')" prop="qmyy">
  278. <el-input type="text" :value="formYjcc.qmyy" maxlength="50" disabled
  279. :placeholder="$t('form.placeholderInput')" />
  280. </el-form-item>
  281. </el-col>
  282. </el-row>
  283. <el-row>
  284. <el-col :span="24">
  285. <el-form-item :label="$t('form.remark')" prop="remark">
  286. <el-input type="textarea" v-model="formYjcc.remark" :rows="5" maxlength="500"
  287. :placeholder="$t('form.placeholderInput')">
  288. </el-input>
  289. </el-form-item>
  290. </el-col>
  291. </el-row>
  292. <el-row>
  293. <el-col :span="24">
  294. <el-form-item :label="$t('form.signer')">
  295. <el-input type="text" v-model="nickName" maxlength="50" disabled
  296. :placeholder="$t('form.placeholderInput')" />
  297. </el-form-item>
  298. </el-col>
  299. </el-row>
  300. <el-row>
  301. <el-col :span="24">
  302. <el-form-item :label="$t('form.password')" prop="qmrmm">
  303. <div class="sbzdtcma"> <input type="text"></div>
  304. <el-input type="password" show-password v-model="formYjcc.qmrmm" maxlength="20"
  305. :placeholder="$t('form.placeholderInput')" />
  306. </el-form-item>
  307. </el-col>
  308. </el-row>
  309. </el-form>
  310. <div slot="footer" class="dialog-footer">
  311. <el-button type="primary" @click="yjcc">{{ $t('form.confirm') }}</el-button>
  312. <el-button @click="openYjcc = false">{{ $t('form.cancel') }}</el-button>
  313. </div>
  314. </el-dialog>
  315. <el-dialog :title="$t('page.business.study.studyFormFill.bcjl')" :visible.sync="openSave" width="600px"
  316. append-to-body :close-on-click-modal="false">
  317. <el-form ref="formSave" :model="formSave" :rules="rulesSave" label-width="120px" v-if="openSave">
  318. <div class="sbzdtcma"> <input type="text"> <input type="password" show-password> </div>
  319. <el-row>
  320. <el-col :span="24">
  321. <el-form-item :label="$t('form.qmyy')" prop="qmyy">
  322. <el-input type="text" :value="formSave.qmyy" maxlength="50" disabled
  323. :placeholder="$t('form.placeholderInput')" />
  324. </el-form-item>
  325. </el-col>
  326. </el-row>
  327. <el-row>
  328. <el-col :span="24">
  329. <el-form-item :label="$t('form.remark')" prop="remark">
  330. <el-input type="textarea" v-model="formSave.remark" :rows="5" maxlength="500"
  331. :placeholder="$t('form.placeholderInput')">
  332. </el-input>
  333. </el-form-item>
  334. </el-col>
  335. </el-row>
  336. <el-row>
  337. <el-col :span="24">
  338. <el-form-item :label="$t('form.signer')">
  339. <el-input type="text" v-model="nickName" maxlength="50" disabled
  340. :placeholder="$t('form.placeholderInput')" />
  341. </el-form-item>
  342. </el-col>
  343. </el-row>
  344. <el-row>
  345. <el-col :span="24">
  346. <el-form-item :label="$t('form.password')" prop="qmrmm">
  347. <div class="sbzdtcma"> <input type="text"></div>
  348. <el-input type="password" show-password v-model="formSave.qmrmm" maxlength="20"
  349. :placeholder="$t('form.placeholderInput')" />
  350. </el-form-item>
  351. </el-col>
  352. </el-row>
  353. </el-form>
  354. <div slot="footer" class="dialog-footer">
  355. <el-button type="primary" @click="saveNext">{{ $t('form.confirm') }}</el-button>
  356. <el-button @click="openSave = false">{{ $t('form.cancel') }}</el-button>
  357. </div>
  358. </el-dialog>
  359. </div>
  360. </template>
  361. <script>
  362. import { studyFormFill_bc,studyFormFill_yjcc, studyFormFill_bcOnly, studyFormFill_updateBdnr, studyFormFill_tj, studyFormFill_info, studyFormFill_updateFhyjjl } from "@/api/business/study/studyFormFill"
  363. import { study_info } from "@/api/business/study/study"
  364. import { mapGetters } from 'vuex'
  365. import SelectTemplate from "@/views/business/comps/select/SelectTemplate";
  366. import SelectDeptUser from '@/views/business/comps/select/SelectDeptUser';
  367. import TemplateTable from '@/views/business/comps/template/TemplateTable';
  368. import BusinessSelect from '@/views/business/comps/select/BusinessSelect';
  369. import { deepClone, caesarDecipher } from "@/utils/index";
  370. export default {
  371. name: "Bj",
  372. components: { SelectTemplate, SelectDeptUser, TemplateTable, BusinessSelect },
  373. data() {
  374. return {
  375. showIndex: 1,
  376. form: {},
  377. rules: {
  378. bdmc: [{
  379. required: true,
  380. message: ' ',
  381. trigger: 'blur'
  382. }],
  383. templateId: [{
  384. required: true,
  385. message: ' ',
  386. trigger: 'blur'
  387. }],
  388. sfbl: [{
  389. required: true,
  390. message: ' ',
  391. trigger: 'blur'
  392. }],
  393. },
  394. czlist: [],
  395. cclist: [],
  396. cclistYj: [],
  397. openSave: false,
  398. openApprove: false,
  399. openYjcc: false,
  400. formSave: {
  401. qmyy: this.$t('page.business.study.studyFormFill.txbbc'),
  402. remark: '',
  403. qmrmm: '',
  404. },
  405. formApprove: {
  406. id: null,
  407. qmyy: this.$t('page.business.study.studyFormFill.txbtjjl'),
  408. remark: '',
  409. bdnr: '',
  410. resource: '',
  411. yqResource: '',
  412. qmrmm: '',
  413. sfcz: false,
  414. czfs: '',
  415. czfsqt: '',
  416. czids: '',
  417. sfcc: false,
  418. cctj: '',
  419. ccwz: '',
  420. ccids: '',
  421. },
  422. formYjcc: {
  423. id: null,
  424. qmyy: this.$t('page.business.study.studyFormFill.yjcc'),
  425. remark: '',
  426. resource: '',
  427. qmrmm: '',
  428. sfcz: false,
  429. czfs: '',
  430. czfsqt: '',
  431. czids: '',
  432. sfcc: false,
  433. cctj: '',
  434. ccwz: '',
  435. ccids: '',
  436. },
  437. resourceYj: [],
  438. resource: [],
  439. yqResource: [],
  440. bdmbTitle: this.$t('page.business.form.bdmb'),
  441. rulesApprove: {
  442. qmrmm: [{
  443. required: true,
  444. message: ' ',
  445. trigger: 'blur'
  446. }]
  447. },
  448. rulesSave: {
  449. qmrmm: [{
  450. required: true,
  451. message: ' ',
  452. trigger: 'blur'
  453. }]
  454. },
  455. templateData: {},
  456. studyType: null,
  457. studyFormType:null
  458. }
  459. },
  460. computed: {
  461. ...mapGetters([
  462. 'nickName', 'name'
  463. ]),
  464. },
  465. created() {
  466. this.getInfo()
  467. },
  468. methods: {
  469. onFillCallback(data) {
  470. console.log("data:" + JSON.stringify(data))
  471. console.log("formdata:" + JSON.stringify(this.$refs.templateTable.getFilledFormData()))
  472. if (data.type == 'fieldChanged') {
  473. studyFormFill_updateBdnr(
  474. {
  475. id: this.form.id,
  476. bdnr: JSON.stringify(this.$refs.templateTable.getFilledFormData()),
  477. zdxgjl: data.resourceList ? JSON.stringify(data.resourceList) : '',
  478. filedValue: data.newRecord ? JSON.stringify(data.newRecord) : ''
  479. }
  480. ).then(response => {
  481. })
  482. } else if (data.type == 'reply') {
  483. studyFormFill_updateFhyjjl(
  484. {
  485. id: this.form.id,
  486. reply: JSON.stringify(data.newRecord),
  487. fhyjjl: JSON.stringify(data.resourceList)
  488. }
  489. ).then(response => {
  490. })
  491. }
  492. },
  493. delcc(index) {
  494. this.cclist.splice(index, 1)
  495. },
  496. delccYj(index) {
  497. this.cclistYj.splice(index, 1)
  498. },
  499. delcz(index) {
  500. this.czlist.splice(index, 1)
  501. },
  502. addCz() {
  503. this.czlist.push({
  504. list: [],
  505. czfs: ''
  506. })
  507. },
  508. addCc() {
  509. this.cclist.push({
  510. list: [],
  511. cctj: '',
  512. ccwz: ''
  513. })
  514. },
  515. addCcYj() {
  516. this.cclistYj.push({
  517. list: [],
  518. cctj: '',
  519. ccwz: ''
  520. })
  521. },
  522. getInfo() {
  523. let key = this.$route.params.key
  524. if (key && key != undefined && key != '') {
  525. let params = null
  526. try {
  527. params = JSON.parse(caesarDecipher(this.$route.params.key))
  528. this.studyType = params.studyType || null
  529. this.studyFormType = params.studyFormType || null
  530. } catch (e) {
  531. console.log('参数错误')
  532. }
  533. if (params) {
  534. this.reset()
  535. if (params.formId && params.formId != '') {
  536. if (params.fromYt) {
  537. this.showIndex = 1
  538. this.bdmbTitle = this.$t('page.business.study.studyFormFill.ytbd')
  539. } else {
  540. this.showIndex = 2
  541. }
  542. this.$modal.loading()
  543. studyFormFill_info({ id: params.formId }).then(response => {
  544. this.form = response.data
  545. this.form.qmyy = this.$t('page.business.study.studyFormFill.zztjyzbd')
  546. this.templateData = deepClone(this.form)
  547. const obj = Object.assign({}, this.$route, { title: this.form.bdmc })
  548. this.$tab.updatePage(obj);
  549. this.$modal.closeLoading()
  550. })
  551. } else {
  552. this.showIndex = 1
  553. this.$modal.loading()
  554. study_info({ id: params.studyId }).then(response => {
  555. this.form = _.merge({}, this.form, { stydyId: params.studyId, resourceStudy: response.data.resource, sftb: 1 })
  556. this.templateData = deepClone(this.form)
  557. const obj = Object.assign({}, this.$route, { title: this.form.bdmc })
  558. this.$tab.updatePage(obj);
  559. this.$modal.closeLoading()
  560. })
  561. }
  562. } else {
  563. this.$tab.closeOpenPage('/404')
  564. }
  565. }
  566. },
  567. getDisabledCz(bh, idx) {
  568. let mark = false
  569. for (var i = 0; i < this.czlist.length; i++) {
  570. if (idx != i) {
  571. for (var j = 0; j < this.czlist[i].list.length; j++) {
  572. if (this.czlist[i].list[j] == bh) {
  573. mark = true;
  574. break
  575. }
  576. }
  577. }
  578. }
  579. return mark
  580. },
  581. getDisabledCc(bh, idx) {
  582. let mark = false
  583. for (var i = 0; i < this.cclist.length; i++) {
  584. if (idx != i) {
  585. for (var j = 0; j < this.cclist[i].list.length; j++) {
  586. if (this.cclist[i].list[j] == bh) {
  587. mark = true;
  588. break
  589. }
  590. }
  591. }
  592. }
  593. return mark
  594. },
  595. getDisabledCcYj(bh, idx) {
  596. let mark = false
  597. for (var i = 0; i < this.cclistYj.length; i++) {
  598. if (idx != i) {
  599. for (var j = 0; j < this.cclistYj[i].list.length; j++) {
  600. if (this.cclistYj[i].list[j] == bh) {
  601. mark = true;
  602. break
  603. }
  604. }
  605. }
  606. }
  607. return mark
  608. },
  609. sfczChange() {
  610. if (!this.formApprove.sfcz) {
  611. this.czlist = []
  612. }
  613. },
  614. sfccChange() {
  615. if (!this.formApprove.sfcc) {
  616. this.cclist = []
  617. }
  618. },
  619. async showApprove() {
  620. let that = this
  621. let content = await that.$refs.templateTable.getFormData()
  622. if (content) {
  623. that.resetApprove()
  624. that.formApprove.id = that.form.id
  625. that.formApprove.bdnr = JSON.stringify(content)
  626. that.resource = that.$refs.templateTable.getResource()
  627. that.yqResource = that.$refs.templateTable.getYqResource()
  628. that.openApprove = true
  629. }
  630. },
  631. async showYjcc() {
  632. let that = this
  633. let content = await that.$refs.templateTable.getFormData()
  634. if (content) {
  635. that.resetYjcc()
  636. that.formYjcc.id = that.form.id
  637. this.cclistYj = []
  638. that.addCcYj()
  639. that.resourceYj = that.$refs.templateTable.getResource()
  640. that.openYjcc = true
  641. }
  642. },
  643. resetYjcc() {
  644. this.formYjcc = {
  645. id: null,
  646. qmyy: this.$t('page.business.study.studyFormFill.yjcc'),
  647. remark: '',
  648. bdnr: '',
  649. resource: '',
  650. qmrmm: '',
  651. sfcz: false,
  652. czlist: '',
  653. sfcc: false,
  654. cclist: '',
  655. }
  656. this.resetForm("formYjcc")
  657. },
  658. resetApprove() {
  659. this.formApprove = {
  660. id: null,
  661. qmyy: this.$t('page.business.study.studyFormFill.txbtjjl'),
  662. remark: '',
  663. bdnr: '',
  664. resource: '',
  665. qmrmm: '',
  666. sfcz: false,
  667. czlist: '',
  668. sfcc: false,
  669. cclist: '',
  670. }
  671. this.resetForm("formApprove")
  672. },
  673. pre() {
  674. this.showIndex = 1
  675. },
  676. next() {
  677. this.$refs["form"].validate(valid => {
  678. if (valid) {
  679. this.showIndex = 2
  680. this.$modal.loading()
  681. studyFormFill_bcOnly(this.form).then(response => {
  682. this.form = response.data
  683. this.templateData.bdmc = this.form.bdmc
  684. this.showIndex = 2
  685. const obj = Object.assign({}, this.$route, { title: this.form.bdmc })
  686. this.$tab.updatePage(obj);
  687. }).finally(() => {
  688. this.$modal.closeLoading()
  689. })
  690. }
  691. })
  692. },
  693. selectTemplateChange(val) {
  694. this.form.bdnr = val.content
  695. this.form.templateMc = val.name
  696. this.form.bdmc = val.name
  697. this.form.templateSn = val.sn
  698. },
  699. cancel() {
  700. try {
  701. let key = caesarDecipher(this.$route.params.key)
  702. let data = JSON.parse(key)
  703. if (data && data != undefined && data != '') {
  704. const obj = { path: data.url }
  705. this.$tab.closeOpenPage(obj)
  706. }
  707. } catch (e) {
  708. this.$tab.closeOpenPage('/404')
  709. }
  710. },
  711. cancelSave() {
  712. try {
  713. let key = caesarDecipher(this.$route.params.key)
  714. let data = JSON.parse(key)
  715. if (data && data != undefined && data != '') {
  716. const obj = { path: data.urlTj ? data.urlTj : data.url }
  717. this.$tab.closeOpenPage(obj)
  718. }
  719. } catch (e) {
  720. this.$tab.closeOpenPage('/404')
  721. }
  722. },
  723. reset() {
  724. this.form = {
  725. id: null,
  726. studyId: null,
  727. bdbh: null,
  728. bdmc: null,
  729. bdsm: null,
  730. templateId: null,
  731. templateMc: null,
  732. templateSn: null,
  733. bdnr: null,
  734. resource: null,
  735. resourceStudy: null,
  736. fzrsh: null,
  737. shryId: null,
  738. sfbl: null,
  739. shryMc: null,
  740. }
  741. this.resetForm("form")
  742. },
  743. selectDeptUserChange(val) {
  744. this.form.shryMc = val.name
  745. },
  746. save() {
  747. this.$refs["form"].validate(valid => {
  748. if (valid) {
  749. this.$modal.loading()
  750. studyFormFill_bcOnly(this.form).then(response => {
  751. this.$modal.closeLoading()
  752. this.cancelSave()
  753. }).finally(() => {
  754. this.$modal.closeLoading()
  755. })
  756. }
  757. })
  758. },
  759. showSave() {
  760. this.formSave.remark = ''
  761. this.formSave.qmrmm = ''
  762. this.openSave = true
  763. },
  764. async saveNext() {
  765. this.$refs["formSave"].validate(valid => {
  766. if (valid) {
  767. this.form.bdnr = JSON.stringify(this.$refs.templateTable.getFilledFormData())
  768. this.form.qmrmm = this.formSave.qmrmm
  769. this.form.remark = this.formSave.remark
  770. this.$modal.loading()
  771. studyFormFill_bc(this.form).then(response => {
  772. this.$modal.closeLoading()
  773. this.cancelSave()
  774. }).finally(() => {
  775. this.$modal.closeLoading()
  776. })
  777. }
  778. })
  779. },
  780. yjcc() {
  781. let that = this
  782. this.$refs["formYjcc"].validate(valid => {
  783. if (valid) {
  784. that.$modal.loading()
  785. that.formYjcc.resource = JSON.stringify(that.resource)
  786. that.formApprove.cclist = JSON.stringify(that.cclistYj)
  787. studyFormFill_yjcc(that.formApprove).then(response => {
  788. that.openApprove = false
  789. that.$modal.closeLoading()
  790. that.cancelSave()
  791. }).finally(() => {
  792. that.$modal.closeLoading()
  793. })
  794. }
  795. })
  796. },
  797. tj() {
  798. let that = this
  799. this.$refs["formApprove"].validate(valid => {
  800. if (valid) {
  801. that.$modal.loading()
  802. that.formApprove.resource = JSON.stringify(that.resource)
  803. that.formApprove.yqResource = JSON.stringify(that.yqResource)
  804. if (that.czlist.length > 0) {
  805. that.formApprove.czlist = JSON.stringify(that.czlist)
  806. }
  807. if (that.cclist.length > 0) {
  808. that.formApprove.cclist = JSON.stringify(that.cclist)
  809. }
  810. studyFormFill_tj(that.formApprove).then(response => {
  811. that.openApprove = false
  812. that.$modal.closeLoading()
  813. that.cancelSave()
  814. }).finally(() => {
  815. that.$modal.closeLoading()
  816. })
  817. }
  818. })
  819. }
  820. }
  821. }
  822. </script>