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

932 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="templateData.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. xbxj:'',
  426. qmrmm: '',
  427. sfcz: false,
  428. czfs: '',
  429. czfsqt: '',
  430. czids: '',
  431. sfcc: false,
  432. cctj: '',
  433. ccwz: '',
  434. ccids: '',
  435. },
  436. formYjcc: {
  437. id: null,
  438. qmyy: this.$t('page.business.study.studyFormFill.yjcc'),
  439. remark: '',
  440. resource: '',
  441. qmrmm: '',
  442. sfcz: false,
  443. czfs: '',
  444. czfsqt: '',
  445. czids: '',
  446. sfcc: false,
  447. cctj: '',
  448. ccwz: '',
  449. ccids: '',
  450. },
  451. resourceYj: [],
  452. resource: [],
  453. yqResource: [],
  454. jcbList: [],
  455. xbxj: [],
  456. bdmbTitle: this.$t('page.business.form.bdmb'),
  457. rulesApprove: {
  458. qmrmm: [{
  459. required: true,
  460. message: ' ',
  461. trigger: 'blur'
  462. }]
  463. },
  464. rulesYjcc: {
  465. qmrmm: [{
  466. required: true,
  467. message: ' ',
  468. trigger: 'blur'
  469. }]
  470. },
  471. rulesSave: {
  472. qmrmm: [{
  473. required: true,
  474. message: ' ',
  475. trigger: 'blur'
  476. }]
  477. },
  478. templateData: {},
  479. studyType: null,
  480. studyFormType: null,
  481. ccwzlist: [],
  482. selectedDeptId: null,
  483. }
  484. },
  485. computed: {
  486. ...mapGetters([
  487. 'nickName', 'name'
  488. ]),
  489. },
  490. created() {
  491. this.getInfo()
  492. this.getCcwz()
  493. },
  494. methods: {
  495. getCcwz() {
  496. listData({
  497. pageNum: 1,
  498. pageSize: 999999,
  499. dictType: 'business_ccwz',
  500. status: 0
  501. }).then(response => {
  502. this.ccwzlist = response.rows
  503. })
  504. },
  505. ccwzChange(cindex) {
  506. let that = this
  507. let _index = _.findIndex(this.ccwzlist, function (item) {
  508. return item.id == that.cclist[cindex].ccwz
  509. })
  510. that.cclist[cindex].cctj = that.ccwzlist[_index].wc
  511. },
  512. ccwzYjChange(cindex) {
  513. let that = this
  514. let _index = _.findIndex(this.ccwzlist, function (item) {
  515. return item.id == that.cclistYj[cindex].ccwz
  516. })
  517. that.cclistYj[cindex].cctj = that.ccwzlist[_index].wc
  518. },
  519. onFillCallback(data) {
  520. console.log("data:" + JSON.stringify(data))
  521. console.log("formdata:" + JSON.stringify(this.$refs.templateTable.getFilledFormData()))
  522. if (data.type == 'fieldChanged') {
  523. studyFormFill_updateBdnr(
  524. {
  525. id: this.form.id,
  526. bdnr: JSON.stringify(this.$refs.templateTable.getFilledFormData()),
  527. zdxgjl: data.resourceList ? JSON.stringify(data.resourceList) : '',
  528. filedValue: data.newRecord ? JSON.stringify(data.newRecord) : ''
  529. }
  530. ).then(response => {
  531. })
  532. } else if (data.type == 'reply') {
  533. studyFormFill_updateFhyjjl(
  534. {
  535. id: this.form.id,
  536. reply: JSON.stringify(data.newRecord),
  537. fhyjjl: JSON.stringify(data.resourceList)
  538. }
  539. ).then(response => {
  540. })
  541. }
  542. },
  543. delcc(index) {
  544. this.cclist.splice(index, 1)
  545. },
  546. delccYj(index) {
  547. this.cclistYj.splice(index, 1)
  548. },
  549. delcz(index) {
  550. this.czlist.splice(index, 1)
  551. },
  552. addCz() {
  553. this.czlist.push({
  554. list: [],
  555. czfs: ''
  556. })
  557. },
  558. addCc() {
  559. this.cclist.push({
  560. list: [],
  561. cctj: '',
  562. ccwz: ''
  563. })
  564. },
  565. addCcYj() {
  566. this.cclistYj.push({
  567. list: [],
  568. cctj: '',
  569. ccwz: ''
  570. })
  571. },
  572. getInfo() {
  573. let key = this.$route.params.key
  574. if (key && key != undefined && key != '') {
  575. let params = null
  576. try {
  577. params = JSON.parse(caesarDecipher(this.$route.params.key))
  578. this.studyType = params.studyType || null
  579. this.studyFormType = params.studyFormType || 5
  580. this.selectedDeptId = params.selectedDeptId || null
  581. } catch (e) {
  582. console.log('参数错误')
  583. }
  584. if (params) {
  585. this.reset()
  586. if (params.formId && params.formId != '') {
  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. if (params.fromYt) {
  595. this.showIndex = 1
  596. this.bdmbTitle = this.$t('page.business.study.studyFormFill.ytbd')
  597. } else {
  598. this.showIndex = 2
  599. }
  600. this.saveSimpleLog({ jcmc: '填报表单编辑', jcmcEn: 'Record Edit', name: this.form.bdmc + '(' + this.form.bdbh + ')', nameEn: this.form.bdmc + '(' + this.form.bdbh + ')' })
  601. this.$modal.closeLoading()
  602. })
  603. } else {
  604. this.showIndex = 1
  605. this.$modal.loading()
  606. study_info({ id: params.studyId }).then(response => {
  607. this.form = _.merge({}, this.form, { studySubjectId: params.studySubjectId, studyId: params.studyId, resourceStudy: response.data.resource, sftb: 1,studyMc:response.data.name,studySn:response.data.sn })
  608. this.templateData = deepClone(this.form)
  609. const obj = Object.assign({}, this.$route, { title: this.$t('page.business.study.studyFormFill.xzbd') })
  610. this.$tab.updatePage(obj);
  611. let name = this.studyType == 1 ? '试验' : (this.studyType == 5 ? '非试验表单' : '麻精药表单')
  612. let nameEn = this.studyType == 1 ? 'Study' : (this.studyType == 5 ? 'Non-study' : 'ontrolled Drug')
  613. this.saveSimpleLog({ jcmc: '填报表单新增', jcmcEn: 'Record Create', name: name, nameEn: nameEn })
  614. this.$modal.closeLoading()
  615. })
  616. }
  617. } else {
  618. this.$tab.closeOpenPage('/404')
  619. }
  620. }
  621. },
  622. getDisabledCz(bh, idx) {
  623. let mark = false
  624. for (var i = 0; i < this.czlist.length; i++) {
  625. if (idx != i) {
  626. for (var j = 0; j < this.czlist[i].list.length; j++) {
  627. if (this.czlist[i].list[j] == bh) {
  628. mark = true;
  629. break
  630. }
  631. }
  632. }
  633. }
  634. return mark
  635. },
  636. getDisabledCc(bh, idx) {
  637. let mark = false
  638. for (var i = 0; i < this.cclist.length; i++) {
  639. if (idx != i) {
  640. for (var j = 0; j < this.cclist[i].list.length; j++) {
  641. if (this.cclist[i].list[j] == bh) {
  642. mark = true;
  643. break
  644. }
  645. }
  646. }
  647. }
  648. return mark
  649. },
  650. getDisabledCcYj(bh, idx) {
  651. let mark = false
  652. for (var i = 0; i < this.cclistYj.length; i++) {
  653. if (idx != i) {
  654. for (var j = 0; j < this.cclistYj[i].list.length; j++) {
  655. if (this.cclistYj[i].list[j] == bh) {
  656. mark = true;
  657. break
  658. }
  659. }
  660. }
  661. }
  662. return mark
  663. },
  664. sfczChange() {
  665. if (!this.formApprove.sfcz) {
  666. this.czlist = []
  667. }
  668. },
  669. sfccChange() {
  670. if (!this.formApprove.sfcc) {
  671. this.cclist = []
  672. }
  673. },
  674. async showApprove() {
  675. let that = this
  676. let content = await that.$refs.templateTable.getFormData()
  677. if (content) {
  678. that.resetApprove()
  679. that.formApprove.id = that.form.id
  680. that.formApprove.bdnr = JSON.stringify(content)
  681. that.resource = that.$refs.templateTable.getResource()
  682. that.yqResource = that.$refs.templateTable.getYqResource()
  683. that.jcbList = that.$refs.templateTable.getJcbList()
  684. that.xbxj = that.$refs.templateTable.getXbxj()
  685. that.openApprove = true
  686. }
  687. },
  688. async showYjcc() {
  689. let that = this
  690. that.resetYjcc()
  691. that.formYjcc.id = that.form.id
  692. that.cclistYj = []
  693. that.addCcYj()
  694. that.$refs.templateTable.getFilledFormData()
  695. let resource = that.$refs.templateTable.getResource()
  696. if (resource.length > 0) {
  697. that.$modal.loading()
  698. studyFormFill_yjccFilter({ id: this.form.id, resource: JSON.stringify(resource) }).then(response => {
  699. let tmpResource = JSON.parse(response.msg)
  700. if (tmpResource.length > 0) {
  701. that.resourceYj = tmpResource
  702. that.openYjcc = true
  703. } else {
  704. that.$modal.msgError("没有可存储的药剂")
  705. }
  706. }).finally(() => {
  707. that.$modal.closeLoading()
  708. })
  709. } else {
  710. that.$modal.msgError("没有可存储的药剂")
  711. }
  712. },
  713. resetYjcc() {
  714. this.formYjcc = {
  715. id: null,
  716. qmyy: this.$t('page.business.study.studyFormFill.yjcc'),
  717. remark: '',
  718. bdnr: '',
  719. resource: '',
  720. qmrmm: '',
  721. sfcz: false,
  722. czlist: '',
  723. sfcc: false,
  724. cclist: '',
  725. }
  726. this.resetForm("formYjcc")
  727. },
  728. resetApprove() {
  729. this.formApprove = {
  730. id: null,
  731. qmyy: this.$t('page.business.study.studyFormFill.txbtjjl'),
  732. remark: '',
  733. bdnr: '',
  734. resource: '',
  735. qmrmm: '',
  736. sfcz: false,
  737. czlist: '',
  738. sfcc: false,
  739. cclist: '',
  740. }
  741. this.resetForm("formApprove")
  742. },
  743. pre() {
  744. this.showIndex = 1
  745. },
  746. next() {
  747. this.$refs["form"].validate(valid => {
  748. if (valid) {
  749. this.showIndex = 2
  750. this.$modal.loading()
  751. studyFormFill_bcOnly(this.form).then(response => {
  752. this.form = response.data
  753. this.templateData.bdmc = this.form.bdmc
  754. this.showIndex = 2
  755. const obj = Object.assign({}, this.$route, { title: this.form.bdmc })
  756. this.$tab.updatePage(obj);
  757. }).finally(() => {
  758. this.$modal.closeLoading()
  759. })
  760. }
  761. })
  762. },
  763. selectTemplateChange(val) {
  764. this.form.bdnr = val.content
  765. if (this.$i18n.locale === 'zh_CN') {
  766. this.form.templateMc = val.name
  767. this.form.bdmc = val.name
  768. } else {
  769. this.form.templateMc = val.nameEn
  770. this.form.bdmc = val.nameEn
  771. }
  772. this.form.templateSn = val.sn
  773. this.templateData = deepClone(this.form)
  774. setTimeout(() => {
  775. this.$refs["form"].validate()
  776. }, 200)
  777. },
  778. cancel() {
  779. try {
  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.url }
  784. this.$tab.closeOpenPage(obj)
  785. }
  786. } catch (e) {
  787. this.$tab.closeOpenPage('/404')
  788. }
  789. },
  790. cancelSave() {
  791. try {
  792. // 类型1试验,5非试验表单,10麻精药表单
  793. if (this.form.studyType == 1) {
  794. EventBus.$emit('onRefreshStudyTbbdList', {});
  795. } else if (this.form.studyType == 5) {
  796. EventBus.$emit('onRefreshNonTrialTbbdList', {});
  797. } else if (this.form.studyType == 10) {
  798. EventBus.$emit('onRefreshDrugTbbdList', {});
  799. }
  800. let key = caesarDecipher(this.$route.params.key)
  801. let data = JSON.parse(key)
  802. if (data && data != undefined && data != '') {
  803. const obj = { path: data.urlTj ? data.urlTj : data.url }
  804. this.$tab.closeOpenPage(obj)
  805. }
  806. } catch (e) {
  807. this.$tab.closeOpenPage('/404')
  808. }
  809. },
  810. reset() {
  811. this.form = {
  812. id: null,
  813. studyId: null,
  814. bdbh: null,
  815. bdmc: null,
  816. bdsm: null,
  817. templateId: null,
  818. templateMc: null,
  819. templateSn: null,
  820. bdnr: null,
  821. resource: null,
  822. resourceStudy: null,
  823. fzrsh: null,
  824. shryId: null,
  825. sfbl: null,
  826. shryMc: null,
  827. }
  828. this.resetForm("form")
  829. },
  830. selectDeptUserChange(val) {
  831. this.form.shryMc = val.name
  832. },
  833. save() {
  834. this.$refs["form"].validate(valid => {
  835. if (valid) {
  836. this.$modal.loading()
  837. studyFormFill_bcOnly(this.form).then(response => {
  838. this.$modal.closeLoading()
  839. this.cancelSave()
  840. }).finally(() => {
  841. this.$modal.closeLoading()
  842. })
  843. }
  844. })
  845. },
  846. showSave() {
  847. this.formSave.remark = ''
  848. this.formSave.qmrmm = ''
  849. this.openSave = true
  850. },
  851. async saveNext() {
  852. this.$refs["formSave"].validate(valid => {
  853. if (valid) {
  854. this.form.bdnr = JSON.stringify(this.$refs.templateTable.getFilledFormData())
  855. this.form.qmrmm = this.formSave.qmrmm
  856. this.form.remark = this.formSave.remark
  857. this.$modal.loading()
  858. studyFormFill_bc(this.form).then(response => {
  859. this.$modal.closeLoading()
  860. this.cancelSave()
  861. }).finally(() => {
  862. this.$modal.closeLoading()
  863. })
  864. }
  865. })
  866. },
  867. yjcc() {
  868. let that = this
  869. this.$refs["formYjcc"].validate(valid => {
  870. if (valid) {
  871. if (that.cclistYj.length == 0) {
  872. this.$modal.msgError("请选择要处置的药剂")
  873. } else {
  874. for (var i = 0; i < that.cclistYj.length; i++) {
  875. if (!that.cclistYj[i].ccwz || that.cclistYj[i].ccwz == '') {
  876. this.$modal.msgError('第' + (i + 1) + "个存储,存储位置不能为空")
  877. return
  878. }
  879. if (!that.cclistYj[i].cctj || that.cclistYj[i].cctj == '') {
  880. this.$modal.msgError('第' + (i + 1) + "个存储,存储条件不能为空")
  881. return
  882. }
  883. }
  884. that.$modal.loading()
  885. that.formYjcc.resource = JSON.stringify(that.resourceYj)
  886. that.formYjcc.cclist = JSON.stringify(that.cclistYj)
  887. studyFormFill_yjcc(that.formYjcc).then(response => {
  888. that.openYjcc = false
  889. that.$modal.closeLoading()
  890. that.cancelSave()
  891. }).finally(() => {
  892. that.$modal.closeLoading()
  893. })
  894. }
  895. }
  896. })
  897. },
  898. tj() {
  899. let that = this
  900. this.$refs["formApprove"].validate(valid => {
  901. if (valid) {
  902. that.$modal.loading()
  903. that.formApprove.resource = JSON.stringify(that.resource)
  904. that.formApprove.yqResource = JSON.stringify(that.yqResource)
  905. that.formApprove.jcbList = JSON.stringify(that.jcbList)
  906. that.formApprove.xbxj = JSON.stringify(that.xbxj)
  907. if (that.czlist.length > 0) {
  908. that.formApprove.czlist = JSON.stringify(that.czlist)
  909. }
  910. if (that.cclist.length > 0) {
  911. that.formApprove.cclist = JSON.stringify(that.cclist)
  912. }
  913. studyFormFill_tj(that.formApprove).then(response => {
  914. that.openApprove = false
  915. that.$modal.closeLoading()
  916. that.cancelSave()
  917. }).finally(() => {
  918. that.$modal.closeLoading()
  919. })
  920. }
  921. })
  922. }
  923. }
  924. }
  925. </script>