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

534 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 } 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 } 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. // {"type":"fieldChanged","newRecord":{"userNameCn":"谭飞","userNameEn":"tf","key":"_versionNum","field":"试验基本信息-版本号","oldValue":"1.0","value":"1.0333","title":"修改记录","time":"2026-01-14 19:44:02"},"resourceList":[{"userNameCn":"谭飞","userNameEn":"tf","key":"_versionNum","field":"试验基本信息-版本号","oldValue":"1.0","value":"1.0","title":"修改记录","time":"2026-01-14 19:43:57"}]}
  302. if (data.type == 'fieldChanged') {
  303. studyFormFill_updateBdnr(
  304. {
  305. id: this.form.id,
  306. bdnr: JSON.stringify(this.$refs.templateTable.getFilledFormData()),
  307. zdxgjl: JSON.stringify(data.resourceList),
  308. filedValue: JSON.stringify(data.newRecord)
  309. }
  310. ).then(response => {
  311. })
  312. }
  313. },
  314. delcc(index) {
  315. this.cclist.splice(index, 1)
  316. },
  317. delcz(index) {
  318. this.czlist.splice(index, 1)
  319. },
  320. addCz() {
  321. this.czlist.push({
  322. list: [],
  323. czfs: ''
  324. })
  325. },
  326. addCc() {
  327. this.cclist.push({
  328. list: [],
  329. cctj: '',
  330. ccwz: ''
  331. })
  332. },
  333. getInfo() {
  334. let formId = this.$route.params.formId
  335. let studyId = this.$route.params.studyId
  336. let fromYt = this.$route.params.fromYt
  337. this.reset()
  338. if (parseInt(formId) > 0) {
  339. if (fromYt + '' == "10") {
  340. this.showIndex = 1
  341. this.bdmbTitle = this.$t('page.business.study.studyFormFill.ytbd')
  342. } else {
  343. this.showIndex = 2
  344. }
  345. this.$modal.loading()
  346. studyFormFill_info({ id: formId }).then(response => {
  347. this.form = response.data
  348. this.form.qmyy = this.$t('page.business.study.studyFormFill.zztjyzbd')
  349. this.templateData = deepClone(this.form)
  350. this.$modal.closeLoading()
  351. })
  352. } else {
  353. this.showIndex = 1
  354. this.$modal.loading()
  355. study_info({ id: studyId }).then(response => {
  356. this.form = _.merge({}, this.form, { stydyId: studyId, resourceStudy: response.data.resource, sftb: 1 })
  357. this.templateData = deepClone(this.form)
  358. this.$modal.closeLoading()
  359. })
  360. }
  361. },
  362. getDisabledCz(bh, idx) {
  363. let mark = false
  364. for (var i = 0; i < this.czlist.length; i++) {
  365. if (idx != i) {
  366. for (var j = 0; j < this.czlist[i].list.length; j++) {
  367. if (this.czlist[i].list[j] == bh) {
  368. mark = true;
  369. break
  370. }
  371. }
  372. }
  373. }
  374. return mark
  375. },
  376. getDisabledCc(bh, idx) {
  377. let mark = false
  378. for (var i = 0; i < this.cclist.length; i++) {
  379. if (idx != i) {
  380. for (var j = 0; j < this.cclist[i].list.length; j++) {
  381. if (this.cclist[i].list[j] == bh) {
  382. mark = true;
  383. break
  384. }
  385. }
  386. }
  387. }
  388. return mark
  389. },
  390. sfczChange() {
  391. if (!this.formApprove.sfcz) {
  392. this.czlist = []
  393. }
  394. },
  395. sfccChange() {
  396. if (!this.formApprove.sfcc) {
  397. this.cclist = []
  398. }
  399. },
  400. async showApprove() {
  401. let that = this
  402. let content = await that.$refs.templateTable.getFormData()
  403. if (content) {
  404. that.resetApprove()
  405. that.formApprove.id = that.form.id
  406. that.formApprove.bdnr = JSON.stringify(content)
  407. that.resource = that.$refs.templateTable.getResource()
  408. that.openApprove = true
  409. }
  410. },
  411. resetApprove() {
  412. this.formApprove = {
  413. id: null,
  414. qmyy: this.$t('page.business.study.studyFormFill.txbtjjl'),
  415. remark: '',
  416. bdnr: '',
  417. resource: '',
  418. qmrmm: '',
  419. sfcz: false,
  420. czlist: '',
  421. sfcc: false,
  422. cclist: '',
  423. }
  424. this.resetForm("formApprove")
  425. },
  426. pre() {
  427. this.showIndex = 1
  428. },
  429. next() {
  430. this.$refs["form"].validate(valid => {
  431. if (valid) {
  432. this.showIndex = 2
  433. this.$modal.loading()
  434. studyFormFill_bc(this.form).then(response => {
  435. this.form = response.data
  436. this.showIndex = 2
  437. }).finally(() => {
  438. this.$modal.closeLoading()
  439. })
  440. }
  441. })
  442. },
  443. selectTemplateChange(val) {
  444. this.form.bdnr = val.content
  445. this.form.templateMc = val.name
  446. this.form.bdmc = val.name
  447. this.form.templateSn = val.sn
  448. },
  449. cancel() {
  450. let data = localStorage.getItem(this.$route.params.key)
  451. if (data && data != '') {
  452. let params = JSON.parse(data)
  453. const obj = { path: params.url }
  454. this.$tab.closeOpenPage(obj)
  455. }
  456. },
  457. reset() {
  458. this.form = {
  459. id: null,
  460. studyId: null,
  461. bdbh: null,
  462. bdmc: null,
  463. bdsm: null,
  464. templateId: null,
  465. templateMc: null,
  466. templateSn: null,
  467. bdnr: null,
  468. resource: null,
  469. resourceStudy: null,
  470. fzrsh: null,
  471. shryId: null,
  472. sfbl: null,
  473. shryMc: null,
  474. }
  475. this.resetForm("form")
  476. },
  477. selectDeptUserChange(val) {
  478. this.form.shryMc = val.name
  479. },
  480. save() {
  481. this.$refs["form"].validate(valid => {
  482. if (valid) {
  483. this.$modal.loading()
  484. studyFormFill_bc(this.form).then(response => {
  485. this.$modal.closeLoading()
  486. this.cancel()
  487. }).finally(() => {
  488. this.$modal.closeLoading()
  489. })
  490. }
  491. })
  492. },
  493. async saveNext() {
  494. let content = await this.$refs.templateTable.getFormData()
  495. if (content) {
  496. this.form.bdnr = JSON.stringify(content)
  497. this.$modal.loading()
  498. studyFormFill_bc(this.form).then(response => {
  499. this.$modal.closeLoading()
  500. this.cancel()
  501. }).finally(() => {
  502. this.$modal.closeLoading()
  503. })
  504. }
  505. },
  506. tj() {
  507. let that = this
  508. this.$refs["formApprove"].validate(valid => {
  509. if (valid) {
  510. that.$modal.loading()
  511. that.formApprove.resource = JSON.stringify(that.resource)
  512. if (that.czlist.length > 0) {
  513. that.formApprove.czlist = JSON.stringify(that.czlist)
  514. }
  515. if (that.cclist.length > 0) {
  516. that.formApprove.cclist = JSON.stringify(that.cclist)
  517. }
  518. studyFormFill_tj(that.formApprove).then(response => {
  519. that.openApprove = false
  520. that.$modal.closeLoading()
  521. that.cancel()
  522. }).finally(() => {
  523. that.$modal.closeLoading()
  524. })
  525. }
  526. })
  527. }
  528. }
  529. }
  530. </script>