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

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