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

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