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

502 lines
17 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="10" />
  62. <el-option :label="$t('page.business.study.studyFormFill.no')" :value="1" />
  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 ref="templateTable" :sn="form.templateSn" :templateData="form" 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">
  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. </div>
  222. </template>
  223. <script>
  224. import { studyFormFill_bc, studyFormFill_tj, studyFormFill_info } from "@/api/business/study/studyFormFill"
  225. import { study_info } from "@/api/business/study/study"
  226. import { mapGetters } from 'vuex'
  227. import SelectTemplate from "@/views/business/comps/select/SelectTemplate";
  228. import SelectDeptUser from '@/views/business/comps/select/SelectDeptUser';
  229. import TemplateTable from '@/views/business/comps/template/TemplateTable';
  230. import BusinessSelect from '@/views/business/comps/select/BusinessSelect';
  231. export default {
  232. name: "Bj",
  233. components: { SelectTemplate, SelectDeptUser, TemplateTable, BusinessSelect },
  234. data() {
  235. return {
  236. open: false,
  237. showIndex: 1,
  238. form: {},
  239. rules: {
  240. bdmc: [{
  241. required: true,
  242. message: ' ',
  243. trigger: 'blur'
  244. }],
  245. templateId: [{
  246. required: true,
  247. message: ' ',
  248. trigger: 'blur'
  249. }],
  250. sfbl: [{
  251. required: true,
  252. message: ' ',
  253. trigger: 'blur'
  254. }],
  255. },
  256. czlist: [],
  257. cclist: [],
  258. openApprove: false,
  259. formApprove: {
  260. id: null,
  261. qmyy: '填写并提交记录',
  262. remark: '',
  263. bdnr: '',
  264. resource: '',
  265. qmrmm: '',
  266. sfcz: false,
  267. czfs: '',
  268. czfsqt: '',
  269. czids: '',
  270. sfcc: false,
  271. cctj: '',
  272. ccwz: '',
  273. ccids: '',
  274. },
  275. resource: [],
  276. bdmbTitle: this.$t('page.business.form.bdmb'),
  277. rulesApprove: {
  278. qmrmm: [{
  279. required: true,
  280. message: ' ',
  281. trigger: 'blur'
  282. }]
  283. },
  284. }
  285. },
  286. computed: {
  287. ...mapGetters([
  288. 'nickName', 'name'
  289. ]),
  290. },
  291. created() {
  292. this.getInfo()
  293. },
  294. methods: {
  295. delcc(index) {
  296. this.cclist.splice(index, 1)
  297. },
  298. delcz(index) {
  299. this.czlist.splice(index, 1)
  300. },
  301. addCz() {
  302. this.czlist.push({
  303. list: [],
  304. czfs: ''
  305. })
  306. },
  307. addCc() {
  308. this.cclist.push({
  309. list: [],
  310. cctj: '',
  311. ccwz: ''
  312. })
  313. },
  314. getInfo() {
  315. let formId = this.$route.params.formId
  316. let studyId = this.$route.params.studyId
  317. let fromYt = this.$route.params.fromYt
  318. this.reset()
  319. if (parseInt(formId) > 0) {
  320. if (fromYt + '' == "10") {
  321. this.showIndex = 1
  322. this.bdmbTitle = this.$t('page.business.study.studyFormFill.ytbd')
  323. } else {
  324. this.showIndex = 2
  325. }
  326. this.$modal.loading()
  327. studyFormFill_info({ id: formId }).then(response => {
  328. this.form = response.data
  329. this.form.qmyy = '制作提交预制表单'
  330. this.$modal.closeLoading()
  331. })
  332. } else {
  333. this.showIndex = 1
  334. this.$modal.loading()
  335. study_info({ id: studyId }).then(response => {
  336. this.form = _.merge({}, this.form, { stydyId: studyId, resourceStudy: response.data.resource,sftb:1 })
  337. this.$modal.closeLoading()
  338. })
  339. }
  340. },
  341. getDisabledCz(bh, idx) {
  342. let mark = false
  343. for (var i = 0; i < this.czlist.length; i++) {
  344. if (idx != i) {
  345. for (var j = 0; j < this.czlist[i].list.length; j++) {
  346. if (this.czlist[i].list[j] == bh) {
  347. mark = true;
  348. break
  349. }
  350. }
  351. }
  352. }
  353. return mark
  354. },
  355. getDisabledCc(bh, idx) {
  356. let mark = false
  357. for (var i = 0; i < this.cclist.length; i++) {
  358. if (idx != i) {
  359. for (var j = 0; j < this.cclist[i].list.length; j++) {
  360. if (this.cclist[i].list[j] == bh) {
  361. mark = true;
  362. break
  363. }
  364. }
  365. }
  366. }
  367. return mark
  368. },
  369. sfczChange() {
  370. if (!this.formApprove.sfcz) {
  371. this.czlist = []
  372. }
  373. },
  374. sfccChange() {
  375. if (!this.formApprove.sfcc) {
  376. this.cclist = []
  377. }
  378. },
  379. async showApprove() {
  380. let that = this
  381. let content = await that.$refs.templateTable.getFormData()
  382. if (content) {
  383. that.resetApprove()
  384. that.formApprove.id = that.form.id
  385. that.formApprove.bdnr = JSON.stringify(content)
  386. that.resource = that.$refs.templateTable.getResource()
  387. that.openApprove = true
  388. }
  389. },
  390. resetApprove() {
  391. this.formApprove = {
  392. id: null,
  393. qmyy: '填写并提交记录',
  394. remark: '',
  395. bdnr: '',
  396. resource: '',
  397. qmrmm: '',
  398. sfcz: false,
  399. czlist: '',
  400. sfcc: false,
  401. cclist: '',
  402. }
  403. this.resetForm("formApprove")
  404. },
  405. pre() {
  406. this.showIndex = 1
  407. },
  408. next() {
  409. this.$refs["form"].validate(valid => {
  410. if (valid) {
  411. this.showIndex = 2
  412. }
  413. })
  414. },
  415. selectTemplateChange(val) {
  416. this.form.bdnr = val.content
  417. this.form.templateMc = val.name
  418. this.form.bdmc = val.name
  419. this.form.templateSn = val.sn
  420. },
  421. cancel() {
  422. let data = localStorage.getItem(this.$route.params.key)
  423. if (data && data != '') {
  424. let params = JSON.parse(data)
  425. const obj = { path: params.url }
  426. this.$tab.closeOpenPage(obj)
  427. }
  428. },
  429. reset() {
  430. this.form = {
  431. id: null,
  432. studyId: null,
  433. bdbh: null,
  434. bdmc: null,
  435. bdsm: null,
  436. templateId: null,
  437. templateMc: null,
  438. templateSn: null,
  439. bdnr: null,
  440. resource: null,
  441. resourceStudy: null,
  442. fzrsh: null,
  443. shryId: null,
  444. sfbl: null,
  445. shryMc: null,
  446. }
  447. this.resetForm("form")
  448. },
  449. selectDeptUserChange(val) {
  450. this.form.shryMc = val.name
  451. },
  452. save() {
  453. this.$refs["form"].validate(valid => {
  454. if (valid) {
  455. this.$modal.loading()
  456. studyFormFill_bc(this.form).then(response => {
  457. this.$modal.closeLoading()
  458. this.cancel()
  459. }).finally(() => {
  460. this.$modal.closeLoading()
  461. })
  462. }
  463. })
  464. },
  465. async saveNext() {
  466. let content = await this.$refs.templateTable.getFormData()
  467. if (content) {
  468. this.form.bdnr = JSON.stringify(content)
  469. this.$modal.loading()
  470. studyFormFill_bc(this.form).then(response => {
  471. this.$modal.closeLoading()
  472. this.cancel()
  473. }).finally(() => {
  474. this.$modal.closeLoading()
  475. })
  476. }
  477. },
  478. tj() {
  479. let that=this
  480. this.$refs["formApprove"].validate(valid => {
  481. if (valid) {
  482. that.$modal.loading()
  483. that.formApprove.resource = JSON.stringify(that.resource)
  484. that.formApprove.czlist = JSON.stringify(that.czlist)
  485. that.formApprove.cclist = JSON.stringify(that.cclist)
  486. studyFormFill_tj(that.formApprove).then(response => {
  487. that.openApprove = false
  488. that.$modal.closeLoading()
  489. that.cancel()
  490. }).finally(() => {
  491. that.$modal.closeLoading()
  492. })
  493. }
  494. })
  495. }
  496. }
  497. }
  498. </script>