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

631 lines
22 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="showSave">{{ $t('page.business.study.studyFormFill.save') }}</el-button>
  32. <el-button type="primary" @click="showApprove">{{ $t('page.business.study.studyFormFill.submit')
  33. }}</el-button>
  34. <el-button type="primary" @click="pre">{{ $t('page.business.study.studyFormFill.pre') }}</el-button>
  35. </template>
  36. </div>
  37. </div>
  38. <div class="edit-content">
  39. <div class="content" style="width:60%" v-show="showIndex == 1">
  40. <el-form ref="form" :model="form" :rules="rules" label-width="120px">
  41. <el-row>
  42. <el-col :span="24">
  43. <el-form-item :label="bdmbTitle" prop="templateId">
  44. <SelectTemplate v-model="form.templateId" :disabled="form.id && form.id !== ''"
  45. :name="form.templateMc" @change="selectTemplateChange" :needPre="1" />
  46. </el-form-item>
  47. </el-col>
  48. </el-row>
  49. <el-row>
  50. <el-col :span="24">
  51. <el-form-item :label="$t('page.business.form.bdmc')" prop="bdmc">
  52. <el-input type="text" v-model="form.bdmc" maxlength="50" :placeholder="$t('form.placeholderInput')" />
  53. </el-form-item>
  54. </el-col>
  55. </el-row>
  56. <el-row>
  57. <el-col :span="24">
  58. <el-form-item :label="$t('page.business.study.studyFormFill.sfbl')" prop="sfbl">
  59. <el-select v-model="form.sfbl" :placeholder="$t('form.placeholderSelect')">
  60. <el-option :label="$t('page.business.study.studyFormFill.yes')" value="是" />
  61. <el-option :label="$t('page.business.study.studyFormFill.no')" value="否" />
  62. </el-select>
  63. </el-form-item>
  64. </el-col>
  65. </el-row>
  66. <el-row>
  67. <el-col :span="24">
  68. <el-form-item :label="$t('page.business.study.studyFormFill.bdsm')" prop="bdsm">
  69. <el-input type="textarea" v-model="form.bdsm" :rows="5" maxlength="500"
  70. :placeholder="$t('form.placeholderInput')">
  71. </el-input>
  72. </el-form-item>
  73. </el-col>
  74. </el-row>
  75. </el-form>
  76. </div>
  77. <div class="content" v-if="showIndex == 2">
  78. <TemplateTable emitName="onFillCallback" @onFillCallback="onFillCallback" ref="templateTable"
  79. :sn="form.templateSn" :templateData="templateData" fillType="actFill" />
  80. </div>
  81. </div>
  82. </div>
  83. <el-dialog :title="$t('page.business.study.studyFormFill.tjjl')" :visible.sync="openApprove" width="1200px"
  84. append-to-body :close-on-click-modal="false">
  85. <el-form ref="formApprove" :model="formApprove" :rules="rulesApprove" label-width="120px" v-if="openApprove">
  86. <div class="sbzdtcma"> <input type="text"> <input type="password"> </div>
  87. <el-row v-if="form.sftb == 1">
  88. <el-col :psna="24">
  89. <el-form-item>
  90. <div><el-checkbox v-model="formApprove.sfcz" @change="sfczChange">{{
  91. $t('page.business.study.studyFormFill.cz') }}</el-checkbox>
  92. <el-button type="primary" v-if="formApprove.sfcz" @click="addCz" style="margin-left: 10px;">{{
  93. $t('page.business.study.studyFormFill.tjcz') }}</el-button>
  94. </div>
  95. <template v-if="formApprove.sfcz">
  96. <div v-if="czlist.length > 0">
  97. <el-card class="box-card" v-for="(citem, cindex) in czlist" :key="'cz' + cindex"
  98. style="margin-top: 10px;">
  99. <div slot="header" class="clearfix">
  100. <div style="display: flex;justify-content: space-between;">
  101. <div style="display: flex;">
  102. <div> 处置方式</div>
  103. <div>
  104. <BusinessSelect v-model="citem.czfs" dictType="business_czfs" style="width: 200px;">
  105. </BusinessSelect>
  106. </div>
  107. </div>
  108. <div>
  109. <el-button type="danger" icon="el-icon-delete" circle @click="delcz(cindex)"></el-button>
  110. </div>
  111. </div>
  112. </div>
  113. <el-checkbox-group v-model="citem.list">
  114. <el-checkbox :label="item.bh" v-for="item in resource" :key="'icz' + item.bh"
  115. :disabled="getDisabledCz(item.bh, cindex)"></el-checkbox>
  116. </el-checkbox-group>
  117. </el-card>
  118. </div>
  119. </template>
  120. </el-form-item>
  121. </el-col>
  122. <el-col :psna="24">
  123. <el-form-item>
  124. <div><el-checkbox v-model="formApprove.sfcc" @change="sfccChange">{{
  125. $t('page.business.study.studyFormFill.cc') }}</el-checkbox>
  126. <el-button type="primary" v-if="formApprove.sfcc" @click="addCc" style="margin-left: 10px;">{{
  127. $t('page.business.study.studyFormFill.tjcc') }}</el-button>
  128. </div>
  129. <template v-if="formApprove.sfcc">
  130. <div v-if="cclist.length > 0">
  131. <el-card class="box-card" v-for="(citem, cindex) in cclist" :key="'cz' + cindex"
  132. style="margin-top: 10px;">
  133. <div slot="header" class="clearfix">
  134. <div style="display: flex;justify-content: space-between;">
  135. <div style="display: flex;">
  136. <div style="display: flex;">
  137. <div> 存储条件</div>
  138. <div>
  139. <BusinessSelect v-model="citem.cctj" dictType="business_cctj" style="width: 200px;">
  140. </BusinessSelect>
  141. </div>
  142. </div>
  143. <div style="display: flex; margin-left: 10px;">
  144. <div> 存储位置</div>
  145. <div>
  146. <BusinessSelect v-model="citem.ccwz" dictType="business_ccwz" style="width: 200px;">
  147. </BusinessSelect>
  148. </div>
  149. </div>
  150. </div>
  151. <div>
  152. <el-button type="danger" icon="el-icon-delete" circle @click="delcc(cindex)"></el-button>
  153. </div>
  154. </div>
  155. </div>
  156. <el-checkbox-group v-model="citem.list">
  157. <el-checkbox :label="item.bh" v-for="item in resource" :key="'icz' + item.bh"
  158. :disabled="getDisabledCc(item.bh, cindex)"></el-checkbox>
  159. </el-checkbox-group>
  160. </el-card>
  161. </div>
  162. </template>
  163. </el-form-item>
  164. </el-col>
  165. <el-col :psna="24">
  166. <el-form-item>
  167. <div>{{ $t('page.business.study.studyFormFill.yltj') }}</div>
  168. <div v-for="(item, index) in resource" :key="'r' + index">
  169. {{ item.bh }}
  170. <el-input type="text" v-model="item.syl" maxlength="50" style="width: 250px;">
  171. <template slot="append">
  172. <div style="width: 70px;">
  173. <BusinessSelect v-model="item.syldw" dictType="business_tjdw">
  174. </BusinessSelect>
  175. </div>
  176. </template>
  177. </el-input>
  178. </div>
  179. </el-form-item>
  180. </el-col>
  181. </el-row>
  182. <el-row>
  183. <el-col :span="24">
  184. <el-form-item :label="$t('form.qmyy')" prop="qmyy">
  185. <el-input type="text" :value="formApprove.qmyy" maxlength="50" disabled
  186. :placeholder="$t('form.placeholderInput')" />
  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.remark')" prop="remark">
  193. <el-input type="textarea" v-model="formApprove.remark" :rows="5" maxlength="500"
  194. :placeholder="$t('form.placeholderInput')">
  195. </el-input>
  196. </el-form-item>
  197. </el-col>
  198. </el-row>
  199. <el-row>
  200. <el-col :span="24">
  201. <el-form-item :label="$t('form.signer')">
  202. <el-input type="text" v-model="nickName" maxlength="50" disabled
  203. :placeholder="$t('form.placeholderInput')" />
  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.password')" prop="qmrmm">
  210. <el-input type="password" v-model="formApprove.qmrmm" maxlength="20"
  211. :placeholder="$t('form.placeholderInput')" />
  212. </el-form-item>
  213. </el-col>
  214. </el-row>
  215. </el-form>
  216. <div slot="footer" class="dialog-footer">
  217. <el-button type="primary" @click="tj">{{ $t('form.confirm') }}</el-button>
  218. <el-button @click="openApprove = false">{{ $t('form.cancel') }}</el-button>
  219. </div>
  220. </el-dialog>
  221. <el-dialog :title="$t('page.business.study.studyFormFill.bcjl')" :visible.sync="openSave" width="600px"
  222. append-to-body :close-on-click-modal="false">
  223. <el-form ref="formSave" :model="formSave" :rules="rulesSave" label-width="120px" v-if="openSave">
  224. <div class="sbzdtcma"> <input type="text"> <input type="password"> </div>
  225. <el-row>
  226. <el-col :span="24">
  227. <el-form-item :label="$t('form.qmyy')" prop="qmyy">
  228. <el-input type="text" :value="formSave.qmyy" maxlength="50" disabled
  229. :placeholder="$t('form.placeholderInput')" />
  230. </el-form-item>
  231. </el-col>
  232. </el-row>
  233. <el-row>
  234. <el-col :span="24">
  235. <el-form-item :label="$t('form.remark')" prop="remark">
  236. <el-input type="textarea" v-model="formSave.remark" :rows="5" maxlength="500"
  237. :placeholder="$t('form.placeholderInput')">
  238. </el-input>
  239. </el-form-item>
  240. </el-col>
  241. </el-row>
  242. <el-row>
  243. <el-col :span="24">
  244. <el-form-item :label="$t('form.signer')">
  245. <el-input type="text" v-model="nickName" maxlength="50" disabled
  246. :placeholder="$t('form.placeholderInput')" />
  247. </el-form-item>
  248. </el-col>
  249. </el-row>
  250. <el-row>
  251. <el-col :span="24">
  252. <el-form-item :label="$t('form.password')" prop="qmrmm">
  253. <el-input type="password" v-model="formSave.qmrmm" maxlength="20"
  254. :placeholder="$t('form.placeholderInput')" />
  255. </el-form-item>
  256. </el-col>
  257. </el-row>
  258. </el-form>
  259. <div slot="footer" class="dialog-footer">
  260. <el-button type="primary" @click="saveNext">{{ $t('form.confirm') }}</el-button>
  261. <el-button @click="openSave = false">{{ $t('form.cancel') }}</el-button>
  262. </div>
  263. </el-dialog>
  264. </div>
  265. </template>
  266. <script>
  267. import { studyFormFill_bc, studyFormFill_bcOnly, studyFormFill_updateBdnr, studyFormFill_tj, studyFormFill_info, studyFormFill_updateFhyjjl } from "@/api/business/study/studyFormFill"
  268. import { study_info } from "@/api/business/study/study"
  269. import { mapGetters } from 'vuex'
  270. import SelectTemplate from "@/views/business/comps/select/SelectTemplate";
  271. import SelectDeptUser from '@/views/business/comps/select/SelectDeptUser';
  272. import TemplateTable from '@/views/business/comps/template/TemplateTable';
  273. import BusinessSelect from '@/views/business/comps/select/BusinessSelect';
  274. import { deepClone, caesarDecipher } from "@/utils/index";
  275. export default {
  276. name: "Bj",
  277. components: { SelectTemplate, SelectDeptUser, TemplateTable, BusinessSelect },
  278. data() {
  279. return {
  280. showIndex: 1,
  281. form: {},
  282. rules: {
  283. bdmc: [{
  284. required: true,
  285. message: ' ',
  286. trigger: 'blur'
  287. }],
  288. templateId: [{
  289. required: true,
  290. message: ' ',
  291. trigger: 'blur'
  292. }],
  293. sfbl: [{
  294. required: true,
  295. message: ' ',
  296. trigger: 'blur'
  297. }],
  298. },
  299. czlist: [],
  300. cclist: [],
  301. openSave: false,
  302. openApprove: false,
  303. formSave: {
  304. qmyy: this.$t('page.business.study.studyFormFill.txbbc'),
  305. remark: '',
  306. qmrmm: '',
  307. },
  308. formApprove: {
  309. id: null,
  310. qmyy: this.$t('page.business.study.studyFormFill.txbtjjl'),
  311. remark: '',
  312. bdnr: '',
  313. resource: '',
  314. qmrmm: '',
  315. sfcz: false,
  316. czfs: '',
  317. czfsqt: '',
  318. czids: '',
  319. sfcc: false,
  320. cctj: '',
  321. ccwz: '',
  322. ccids: '',
  323. },
  324. resource: [],
  325. bdmbTitle: this.$t('page.business.form.bdmb'),
  326. rulesApprove: {
  327. qmrmm: [{
  328. required: true,
  329. message: ' ',
  330. trigger: 'blur'
  331. }]
  332. },
  333. rulesSave: {
  334. qmrmm: [{
  335. required: true,
  336. message: ' ',
  337. trigger: 'blur'
  338. }]
  339. },
  340. templateData: {}
  341. }
  342. },
  343. computed: {
  344. ...mapGetters([
  345. 'nickName', 'name'
  346. ]),
  347. },
  348. created() {
  349. this.getInfo()
  350. },
  351. methods: {
  352. onFillCallback(data) {
  353. console.log("data:" + JSON.stringify(data))
  354. console.log("formdata:" + JSON.stringify(this.$refs.templateTable.getFilledFormData()))
  355. if (data.type == 'fieldChanged') {
  356. studyFormFill_updateBdnr(
  357. {
  358. id: this.form.id,
  359. bdnr: JSON.stringify(this.$refs.templateTable.getFilledFormData()),
  360. zdxgjl: data.resourceList ? JSON.stringify(data.resourceList) : '',
  361. filedValue: data.newRecord ? JSON.stringify(data.newRecord) : ''
  362. }
  363. ).then(response => {
  364. })
  365. } else if (data.type == 'reply') {
  366. studyFormFill_updateFhyjjl(
  367. {
  368. id: this.form.id,
  369. reply: JSON.stringify(data.newRecord),
  370. fhyjjl: JSON.stringify(data.resourceList)
  371. }
  372. ).then(response => {
  373. })
  374. }
  375. },
  376. delcc(index) {
  377. this.cclist.splice(index, 1)
  378. },
  379. delcz(index) {
  380. this.czlist.splice(index, 1)
  381. },
  382. addCz() {
  383. this.czlist.push({
  384. list: [],
  385. czfs: ''
  386. })
  387. },
  388. addCc() {
  389. this.cclist.push({
  390. list: [],
  391. cctj: '',
  392. ccwz: ''
  393. })
  394. },
  395. getInfo() {
  396. let key = this.$route.params.key
  397. if (key && key != undefined && key != '') {
  398. let params = null
  399. try {
  400. params = JSON.parse(caesarDecipher(this.$route.params.key))
  401. } catch (e) {
  402. console.log('参数错误')
  403. }
  404. if (params) {
  405. this.reset()
  406. if (params.formId && params.formId != '') {
  407. if (params.fromYt) {
  408. this.showIndex = 1
  409. this.bdmbTitle = this.$t('page.business.study.studyFormFill.ytbd')
  410. } else {
  411. this.showIndex = 2
  412. }
  413. this.$modal.loading()
  414. studyFormFill_info({ id: params.formId }).then(response => {
  415. this.form = response.data
  416. this.form.qmyy = this.$t('page.business.study.studyFormFill.zztjyzbd')
  417. this.templateData = deepClone(this.form)
  418. this.$modal.closeLoading()
  419. })
  420. } else {
  421. this.showIndex = 1
  422. this.$modal.loading()
  423. study_info({ id: params.studyId }).then(response => {
  424. this.form = _.merge({}, this.form, { stydyId: params.studyId, resourceStudy: response.data.resource, sftb: 1 })
  425. this.templateData = deepClone(this.form)
  426. this.$modal.closeLoading()
  427. })
  428. }
  429. } else {
  430. this.$tab.closeOpenPage('/404')
  431. }
  432. }
  433. },
  434. getDisabledCz(bh, idx) {
  435. let mark = false
  436. for (var i = 0; i < this.czlist.length; i++) {
  437. if (idx != i) {
  438. for (var j = 0; j < this.czlist[i].list.length; j++) {
  439. if (this.czlist[i].list[j] == bh) {
  440. mark = true;
  441. break
  442. }
  443. }
  444. }
  445. }
  446. return mark
  447. },
  448. getDisabledCc(bh, idx) {
  449. let mark = false
  450. for (var i = 0; i < this.cclist.length; i++) {
  451. if (idx != i) {
  452. for (var j = 0; j < this.cclist[i].list.length; j++) {
  453. if (this.cclist[i].list[j] == bh) {
  454. mark = true;
  455. break
  456. }
  457. }
  458. }
  459. }
  460. return mark
  461. },
  462. sfczChange() {
  463. if (!this.formApprove.sfcz) {
  464. this.czlist = []
  465. }
  466. },
  467. sfccChange() {
  468. if (!this.formApprove.sfcc) {
  469. this.cclist = []
  470. }
  471. },
  472. async showApprove() {
  473. let that = this
  474. let content = await that.$refs.templateTable.getFormData()
  475. if (content) {
  476. that.resetApprove()
  477. that.formApprove.id = that.form.id
  478. that.formApprove.bdnr = JSON.stringify(content)
  479. that.resource = that.$refs.templateTable.getResource()
  480. that.openApprove = true
  481. }
  482. },
  483. resetApprove() {
  484. this.formApprove = {
  485. id: null,
  486. qmyy: this.$t('page.business.study.studyFormFill.txbtjjl'),
  487. remark: '',
  488. bdnr: '',
  489. resource: '',
  490. qmrmm: '',
  491. sfcz: false,
  492. czlist: '',
  493. sfcc: false,
  494. cclist: '',
  495. }
  496. this.resetForm("formApprove")
  497. },
  498. pre() {
  499. this.showIndex = 1
  500. },
  501. next() {
  502. this.$refs["form"].validate(valid => {
  503. if (valid) {
  504. this.showIndex = 2
  505. this.$modal.loading()
  506. studyFormFill_bcOnly(this.form).then(response => {
  507. this.form = response.data
  508. this.showIndex = 2
  509. }).finally(() => {
  510. this.$modal.closeLoading()
  511. })
  512. }
  513. })
  514. },
  515. selectTemplateChange(val) {
  516. this.form.bdnr = val.content
  517. this.form.templateMc = val.name
  518. this.form.bdmc = val.name
  519. this.form.templateSn = val.sn
  520. },
  521. cancel() {
  522. try {
  523. let key = caesarDecipher(this.$route.params.key)
  524. let data = JSON.parse(key)
  525. if (data && data != undefined && data != '') {
  526. const obj = { path: data.url }
  527. this.$tab.closeOpenPage(obj)
  528. }
  529. } catch (e) {
  530. this.$tab.closeOpenPage('/404')
  531. }
  532. },
  533. cancelSave() {
  534. try {
  535. let key = caesarDecipher(this.$route.params.key)
  536. let data = JSON.parse(key)
  537. if (data && data != undefined && data != '') {
  538. const obj = { path: data.urlTj ? data.urlTj : data.url }
  539. this.$tab.closeOpenPage(obj)
  540. }
  541. } catch (e) {
  542. this.$tab.closeOpenPage('/404')
  543. }
  544. },
  545. reset() {
  546. this.form = {
  547. id: null,
  548. studyId: null,
  549. bdbh: null,
  550. bdmc: null,
  551. bdsm: null,
  552. templateId: null,
  553. templateMc: null,
  554. templateSn: null,
  555. bdnr: null,
  556. resource: null,
  557. resourceStudy: null,
  558. fzrsh: null,
  559. shryId: null,
  560. sfbl: null,
  561. shryMc: null,
  562. }
  563. this.resetForm("form")
  564. },
  565. selectDeptUserChange(val) {
  566. this.form.shryMc = val.name
  567. },
  568. save() {
  569. this.$refs["form"].validate(valid => {
  570. if (valid) {
  571. this.$modal.loading()
  572. studyFormFill_bcOnly(this.form).then(response => {
  573. this.$modal.closeLoading()
  574. this.cancelSave()
  575. }).finally(() => {
  576. this.$modal.closeLoading()
  577. })
  578. }
  579. })
  580. },
  581. showSave() {
  582. this.formSave.remark = ''
  583. this.formSave.qmrmm = ''
  584. this.openSave = true
  585. },
  586. async saveNext() {
  587. this.$refs["formSave"].validate(valid => {
  588. if (valid) {
  589. this.form.bdnr = JSON.stringify(this.$refs.templateTable.getFilledFormData())
  590. this.form.qmrmm = this.formSave.qmrmm
  591. this.form.remark = this.formSave.remark
  592. this.$modal.loading()
  593. studyFormFill_bc(this.form).then(response => {
  594. this.$modal.closeLoading()
  595. this.cancelSave()
  596. }).finally(() => {
  597. this.$modal.closeLoading()
  598. })
  599. }
  600. })
  601. },
  602. tj() {
  603. let that = this
  604. this.$refs["formApprove"].validate(valid => {
  605. if (valid) {
  606. that.$modal.loading()
  607. that.formApprove.resource = JSON.stringify(that.resource)
  608. if (that.czlist.length > 0) {
  609. that.formApprove.czlist = JSON.stringify(that.czlist)
  610. }
  611. if (that.cclist.length > 0) {
  612. that.formApprove.cclist = JSON.stringify(that.cclist)
  613. }
  614. studyFormFill_tj(that.formApprove).then(response => {
  615. that.openApprove = false
  616. that.$modal.closeLoading()
  617. that.cancelSave()
  618. }).finally(() => {
  619. that.$modal.closeLoading()
  620. })
  621. }
  622. })
  623. }
  624. }
  625. }
  626. </script>