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

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