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

636 lines
23 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')" style="width: 100%;">
  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" show-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 style=" display: flex; flex-wrap: wrap; gap: 16px;">
  169. <div v-for="(item, index) in resource" :key="'r' + index" style=" flex: 0 0 calc(33.333% - 11px);">
  170. {{ item.bh }}
  171. <el-input type="text" v-model="item.syl" maxlength="50" style="width:150px;">
  172. <template slot="append">
  173. <div style="width: 20px;">
  174. <BusinessSelect v-model="item.syldw" :showMax="false" dictType="business_tjdw">
  175. </BusinessSelect>
  176. </div>
  177. </template>
  178. </el-input>
  179. </div>
  180. </div>
  181. </el-form-item>
  182. </el-col>
  183. </el-row>
  184. <el-row>
  185. <el-col :span="24">
  186. <el-form-item :label="$t('form.qmyy')" prop="qmyy">
  187. <el-input type="text" :value="formApprove.qmyy" maxlength="50" disabled
  188. :placeholder="$t('form.placeholderInput')" />
  189. </el-form-item>
  190. </el-col>
  191. </el-row>
  192. <el-row>
  193. <el-col :span="24">
  194. <el-form-item :label="$t('form.remark')" prop="remark">
  195. <el-input type="textarea" v-model="formApprove.remark" :rows="5" maxlength="500"
  196. :placeholder="$t('form.placeholderInput')">
  197. </el-input>
  198. </el-form-item>
  199. </el-col>
  200. </el-row>
  201. <el-row>
  202. <el-col :span="24">
  203. <el-form-item :label="$t('form.signer')">
  204. <el-input type="text" v-model="nickName" maxlength="50" disabled
  205. :placeholder="$t('form.placeholderInput')" />
  206. </el-form-item>
  207. </el-col>
  208. </el-row>
  209. <el-row>
  210. <el-col :span="24">
  211. <el-form-item :label="$t('form.password')" prop="qmrmm">
  212. <el-input type="password" show-password v-model="formApprove.qmrmm" maxlength="20"
  213. :placeholder="$t('form.placeholderInput')" />
  214. </el-form-item>
  215. </el-col>
  216. </el-row>
  217. </el-form>
  218. <div slot="footer" class="dialog-footer">
  219. <el-button type="primary" @click="tj">{{ $t('form.confirm') }}</el-button>
  220. <el-button @click="openApprove = false">{{ $t('form.cancel') }}</el-button>
  221. </div>
  222. </el-dialog>
  223. <el-dialog :title="$t('page.business.study.studyFormFill.bcjl')" :visible.sync="openSave" width="600px"
  224. append-to-body :close-on-click-modal="false">
  225. <el-form ref="formSave" :model="formSave" :rules="rulesSave" label-width="120px" v-if="openSave">
  226. <div class="sbzdtcma"> <input type="text"> <input type="password" show-password> </div>
  227. <el-row>
  228. <el-col :span="24">
  229. <el-form-item :label="$t('form.qmyy')" prop="qmyy">
  230. <el-input type="text" :value="formSave.qmyy" maxlength="50" disabled
  231. :placeholder="$t('form.placeholderInput')" />
  232. </el-form-item>
  233. </el-col>
  234. </el-row>
  235. <el-row>
  236. <el-col :span="24">
  237. <el-form-item :label="$t('form.remark')" prop="remark">
  238. <el-input type="textarea" v-model="formSave.remark" :rows="5" maxlength="500"
  239. :placeholder="$t('form.placeholderInput')">
  240. </el-input>
  241. </el-form-item>
  242. </el-col>
  243. </el-row>
  244. <el-row>
  245. <el-col :span="24">
  246. <el-form-item :label="$t('form.signer')">
  247. <el-input type="text" v-model="nickName" maxlength="50" disabled
  248. :placeholder="$t('form.placeholderInput')" />
  249. </el-form-item>
  250. </el-col>
  251. </el-row>
  252. <el-row>
  253. <el-col :span="24">
  254. <el-form-item :label="$t('form.password')" prop="qmrmm">
  255. <el-input type="password" show-password v-model="formSave.qmrmm" maxlength="20"
  256. :placeholder="$t('form.placeholderInput')" />
  257. </el-form-item>
  258. </el-col>
  259. </el-row>
  260. </el-form>
  261. <div slot="footer" class="dialog-footer">
  262. <el-button type="primary" @click="saveNext">{{ $t('form.confirm') }}</el-button>
  263. <el-button @click="openSave = false">{{ $t('form.cancel') }}</el-button>
  264. </div>
  265. </el-dialog>
  266. </div>
  267. </template>
  268. <script>
  269. import { studyFormFill_bc, studyFormFill_bcOnly, studyFormFill_updateBdnr, studyFormFill_tj, studyFormFill_info, studyFormFill_updateFhyjjl } from "@/api/business/study/studyFormFill"
  270. import { study_info } from "@/api/business/study/study"
  271. import { mapGetters } from 'vuex'
  272. import SelectTemplate from "@/views/business/comps/select/SelectTemplate";
  273. import SelectDeptUser from '@/views/business/comps/select/SelectDeptUser';
  274. import TemplateTable from '@/views/business/comps/template/TemplateTable';
  275. import BusinessSelect from '@/views/business/comps/select/BusinessSelect';
  276. import { deepClone, caesarDecipher } from "@/utils/index";
  277. export default {
  278. name: "Bj",
  279. components: { SelectTemplate, SelectDeptUser, TemplateTable, BusinessSelect },
  280. data() {
  281. return {
  282. showIndex: 1,
  283. form: {},
  284. rules: {
  285. bdmc: [{
  286. required: true,
  287. message: ' ',
  288. trigger: 'blur'
  289. }],
  290. templateId: [{
  291. required: true,
  292. message: ' ',
  293. trigger: 'blur'
  294. }],
  295. sfbl: [{
  296. required: true,
  297. message: ' ',
  298. trigger: 'blur'
  299. }],
  300. },
  301. czlist: [],
  302. cclist: [],
  303. openSave: false,
  304. openApprove: false,
  305. formSave: {
  306. qmyy: this.$t('page.business.study.studyFormFill.txbbc'),
  307. remark: '',
  308. qmrmm: '',
  309. },
  310. formApprove: {
  311. id: null,
  312. qmyy: this.$t('page.business.study.studyFormFill.txbtjjl'),
  313. remark: '',
  314. bdnr: '',
  315. resource: '',
  316. qmrmm: '',
  317. sfcz: false,
  318. czfs: '',
  319. czfsqt: '',
  320. czids: '',
  321. sfcc: false,
  322. cctj: '',
  323. ccwz: '',
  324. ccids: '',
  325. },
  326. resource: [],
  327. bdmbTitle: this.$t('page.business.form.bdmb'),
  328. rulesApprove: {
  329. qmrmm: [{
  330. required: true,
  331. message: ' ',
  332. trigger: 'blur'
  333. }]
  334. },
  335. rulesSave: {
  336. qmrmm: [{
  337. required: true,
  338. message: ' ',
  339. trigger: 'blur'
  340. }]
  341. },
  342. templateData: {}
  343. }
  344. },
  345. computed: {
  346. ...mapGetters([
  347. 'nickName', 'name'
  348. ]),
  349. },
  350. created() {
  351. this.getInfo()
  352. },
  353. methods: {
  354. onFillCallback(data) {
  355. console.log("data:" + JSON.stringify(data))
  356. console.log("formdata:" + JSON.stringify(this.$refs.templateTable.getFilledFormData()))
  357. if (data.type == 'fieldChanged'&&data.newRecord&&data.newRecord!='') {
  358. studyFormFill_updateBdnr(
  359. {
  360. id: this.form.id,
  361. bdnr: JSON.stringify(this.$refs.templateTable.getFilledFormData()),
  362. zdxgjl: data.resourceList ? JSON.stringify(data.resourceList) : '',
  363. filedValue: data.newRecord ? JSON.stringify(data.newRecord) : ''
  364. }
  365. ).then(response => {
  366. })
  367. } else if (data.type == 'reply') {
  368. studyFormFill_updateFhyjjl(
  369. {
  370. id: this.form.id,
  371. reply: JSON.stringify(data.newRecord),
  372. fhyjjl: JSON.stringify(data.resourceList)
  373. }
  374. ).then(response => {
  375. })
  376. }
  377. },
  378. delcc(index) {
  379. this.cclist.splice(index, 1)
  380. },
  381. delcz(index) {
  382. this.czlist.splice(index, 1)
  383. },
  384. addCz() {
  385. this.czlist.push({
  386. list: [],
  387. czfs: ''
  388. })
  389. },
  390. addCc() {
  391. this.cclist.push({
  392. list: [],
  393. cctj: '',
  394. ccwz: ''
  395. })
  396. },
  397. getInfo() {
  398. let key = this.$route.params.key
  399. if (key && key != undefined && key != '') {
  400. let params = null
  401. try {
  402. params = JSON.parse(caesarDecipher(this.$route.params.key))
  403. } catch (e) {
  404. console.log('参数错误')
  405. }
  406. if (params) {
  407. this.reset()
  408. if (params.formId && params.formId != '') {
  409. if (params.fromYt) {
  410. this.showIndex = 1
  411. this.bdmbTitle = this.$t('page.business.study.studyFormFill.ytbd')
  412. } else {
  413. this.showIndex = 2
  414. }
  415. this.$modal.loading()
  416. studyFormFill_info({ id: params.formId }).then(response => {
  417. this.form = response.data
  418. this.form.qmyy = this.$t('page.business.study.studyFormFill.zztjyzbd')
  419. this.templateData = deepClone(this.form)
  420. this.$modal.closeLoading()
  421. })
  422. } else {
  423. this.showIndex = 1
  424. this.$modal.loading()
  425. study_info({ id: params.studyId }).then(response => {
  426. this.form = _.merge({}, this.form, { stydyId: params.studyId, resourceStudy: response.data.resource, sftb: 1 })
  427. this.templateData = deepClone(this.form)
  428. this.$modal.closeLoading()
  429. })
  430. }
  431. } else {
  432. this.$tab.closeOpenPage('/404')
  433. }
  434. }
  435. },
  436. getDisabledCz(bh, idx) {
  437. let mark = false
  438. for (var i = 0; i < this.czlist.length; i++) {
  439. if (idx != i) {
  440. for (var j = 0; j < this.czlist[i].list.length; j++) {
  441. if (this.czlist[i].list[j] == bh) {
  442. mark = true;
  443. break
  444. }
  445. }
  446. }
  447. }
  448. return mark
  449. },
  450. getDisabledCc(bh, idx) {
  451. let mark = false
  452. for (var i = 0; i < this.cclist.length; i++) {
  453. if (idx != i) {
  454. for (var j = 0; j < this.cclist[i].list.length; j++) {
  455. if (this.cclist[i].list[j] == bh) {
  456. mark = true;
  457. break
  458. }
  459. }
  460. }
  461. }
  462. return mark
  463. },
  464. sfczChange() {
  465. if (!this.formApprove.sfcz) {
  466. this.czlist = []
  467. }
  468. },
  469. sfccChange() {
  470. if (!this.formApprove.sfcc) {
  471. this.cclist = []
  472. }
  473. },
  474. async showApprove() {
  475. let that = this
  476. let content = await that.$refs.templateTable.getFormData()
  477. if (content) {
  478. that.resetApprove()
  479. that.formApprove.id = that.form.id
  480. that.formApprove.bdnr = JSON.stringify(content)
  481. that.resource = that.$refs.templateTable.getResource()
  482. that.openApprove = true
  483. }
  484. },
  485. resetApprove() {
  486. this.formApprove = {
  487. id: null,
  488. qmyy: this.$t('page.business.study.studyFormFill.txbtjjl'),
  489. remark: '',
  490. bdnr: '',
  491. resource: '',
  492. qmrmm: '',
  493. sfcz: false,
  494. czlist: '',
  495. sfcc: false,
  496. cclist: '',
  497. }
  498. this.resetForm("formApprove")
  499. },
  500. pre() {
  501. this.showIndex = 1
  502. },
  503. next() {
  504. this.$refs["form"].validate(valid => {
  505. if (valid) {
  506. this.showIndex = 2
  507. this.$modal.loading()
  508. studyFormFill_bcOnly(this.form).then(response => {
  509. this.form = response.data
  510. this.templateData = deepClone(this.form)
  511. this.showIndex = 2
  512. const obj = Object.assign({}, this.$route, { title: this.form.bdmc })
  513. this.$tab.updatePage(obj);
  514. }).finally(() => {
  515. this.$modal.closeLoading()
  516. })
  517. }
  518. })
  519. },
  520. selectTemplateChange(val) {
  521. this.form.bdnr = val.content
  522. this.form.templateMc = val.name
  523. this.form.bdmc = val.name
  524. this.form.templateSn = val.sn
  525. },
  526. cancel() {
  527. try {
  528. let key = caesarDecipher(this.$route.params.key)
  529. let data = JSON.parse(key)
  530. if (data && data != undefined && data != '') {
  531. const obj = { path: data.url }
  532. this.$tab.closeOpenPage(obj)
  533. }
  534. } catch (e) {
  535. this.$tab.closeOpenPage('/404')
  536. }
  537. },
  538. cancelSave() {
  539. try {
  540. let key = caesarDecipher(this.$route.params.key)
  541. let data = JSON.parse(key)
  542. if (data && data != undefined && data != '') {
  543. const obj = { path: data.urlTj ? data.urlTj : data.url }
  544. this.$tab.closeOpenPage(obj)
  545. }
  546. } catch (e) {
  547. this.$tab.closeOpenPage('/404')
  548. }
  549. },
  550. reset() {
  551. this.form = {
  552. id: null,
  553. studyId: null,
  554. bdbh: null,
  555. bdmc: null,
  556. bdsm: null,
  557. templateId: null,
  558. templateMc: null,
  559. templateSn: null,
  560. bdnr: null,
  561. resource: null,
  562. resourceStudy: null,
  563. fzrsh: null,
  564. shryId: null,
  565. sfbl: null,
  566. shryMc: null,
  567. }
  568. this.resetForm("form")
  569. },
  570. selectDeptUserChange(val) {
  571. this.form.shryMc = val.name
  572. },
  573. save() {
  574. this.$refs["form"].validate(valid => {
  575. if (valid) {
  576. this.$modal.loading()
  577. studyFormFill_bcOnly(this.form).then(response => {
  578. this.$modal.closeLoading()
  579. this.cancelSave()
  580. }).finally(() => {
  581. this.$modal.closeLoading()
  582. })
  583. }
  584. })
  585. },
  586. showSave() {
  587. this.formSave.remark = ''
  588. this.formSave.qmrmm = ''
  589. this.openSave = true
  590. },
  591. async saveNext() {
  592. this.$refs["formSave"].validate(valid => {
  593. if (valid) {
  594. this.form.bdnr = JSON.stringify(this.$refs.templateTable.getFilledFormData())
  595. this.form.qmrmm = this.formSave.qmrmm
  596. this.form.remark = this.formSave.remark
  597. this.$modal.loading()
  598. studyFormFill_bc(this.form).then(response => {
  599. this.$modal.closeLoading()
  600. this.cancelSave()
  601. }).finally(() => {
  602. this.$modal.closeLoading()
  603. })
  604. }
  605. })
  606. },
  607. tj() {
  608. let that = this
  609. this.$refs["formApprove"].validate(valid => {
  610. if (valid) {
  611. that.$modal.loading()
  612. that.formApprove.resource = JSON.stringify(that.resource)
  613. if (that.czlist.length > 0) {
  614. that.formApprove.czlist = JSON.stringify(that.czlist)
  615. }
  616. if (that.cclist.length > 0) {
  617. that.formApprove.cclist = JSON.stringify(that.cclist)
  618. }
  619. studyFormFill_tj(that.formApprove).then(response => {
  620. that.openApprove = false
  621. that.$modal.closeLoading()
  622. that.cancelSave()
  623. }).finally(() => {
  624. that.$modal.closeLoading()
  625. })
  626. }
  627. })
  628. }
  629. }
  630. }
  631. </script>