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

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