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

338 lines
11 KiB

  1. <template>
  2. <div>
  3. <div class="edit-container" v-if="open">
  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.studyFormApply.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.studyFormApply.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.studyFormApply.zc') }}</el-button>
  28. <el-button type="primary" @click="next">{{ $t('page.business.study.studyFormApply.next') }}</el-button>
  29. </template>
  30. <template v-else>
  31. <el-button @click="saveNext">{{ $t('page.business.study.studyFormApply.save') }}</el-button>
  32. <el-button type="primary" @click="showtijjiao">{{ $t('page.business.study.studyFormApply.submit')
  33. }}</el-button>
  34. <el-button type="primary" @click="pre">{{ $t('page.business.study.studyFormApply.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="$t('page.business.form.bdmb')" prop="templateId">
  44. <SelectTemplate v-model="form.templateId" :studyType="studyType" :studyFormType="studyFormType" :name="form.templateMc"
  45. @change="selectTemplateChange" />
  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.studyFormApply.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.studyFormApply.yes')" value="是" />
  61. <el-option :label="$t('page.business.study.studyFormApply.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.studyFormApply.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 ref="templateTable" emitName="onApplyCallback" @onApplyCallback="onApplyCallback"
  79. :sn="form.templateSn" :templateData="templateData" fillType="actFill" />
  80. </div>
  81. </div>
  82. </div>
  83. <el-dialog :title="$t('page.business.study.studyFormApply.tjjl')" :visible.sync="openSubmit" width="500px"
  84. append-to-body :close-on-click-modal="false">
  85. <el-form ref="formSubmit" :model="form" :rules="rulesApprove" label-width="120px" v-if="openSubmit">
  86. <div class="sbzdtcma"> <input type="text"> <input type="password" show-password> </div>
  87. <el-row>
  88. <el-col :span="24">
  89. <el-form-item :label="$t('form.qmyy')" prop="qmyy">
  90. <el-input type="text" :value="form.qmyy" maxlength="50" disabled
  91. :placeholder="$t('form.placeholderInput')" />
  92. </el-form-item>
  93. </el-col>
  94. </el-row>
  95. <el-row>
  96. <el-col :span="24">
  97. <el-form-item :label="$t('form.remark')" prop="remark">
  98. <el-input type="textarea" v-model="form.remark" :rows="5" maxlength="500"
  99. :placeholder="$t('form.placeholderInput')">
  100. </el-input>
  101. </el-form-item>
  102. </el-col>
  103. </el-row>
  104. <el-row>
  105. <el-col :span="24">
  106. <el-form-item :label="$t('form.signer')">
  107. <el-input type="text" v-model="nickName" maxlength="50" disabled
  108. :placeholder="$t('form.placeholderInput')" />
  109. </el-form-item>
  110. </el-col>
  111. </el-row>
  112. <el-row>
  113. <el-col :span="24">
  114. <el-form-item :label="$t('form.password')" prop="qmrmm">
  115. <div class="sbzdtcma"> <input type="text"></div>
  116. <el-input type="password" show-password v-model="form.qmrmm" maxlength="20"
  117. :placeholder="$t('form.placeholderInput')" />
  118. </el-form-item>
  119. </el-col>
  120. </el-row>
  121. </el-form>
  122. <div slot="footer" class="dialog-footer">
  123. <el-button type="primary" @click="tj">{{ $t('form.confirm') }}</el-button>
  124. <el-button @click="openSubmit = false">{{ $t('form.cancel') }}</el-button>
  125. </div>
  126. </el-dialog>
  127. </div>
  128. </template>
  129. <script>
  130. import { studyFormApply_bc, studyFormApply_bcOnly, studyFormApply_tj, studyFormApply_info, studyFormApply_updateBdnr, studyFormApply_updateFhyjjl } from "@/api/business/study/studyFormApply"
  131. import { mapGetters } from 'vuex'
  132. import SelectTemplate from "@/views/business/comps/select/SelectTemplate";
  133. import SelectDeptUser from '@/views/business/comps/select/SelectDeptUser';
  134. import TemplateTable from '@/views/business/comps/template/TemplateTable';
  135. import { deepClone, caesarDecipher } from "@/utils/index";
  136. export default {
  137. name: "Bj",
  138. components: { SelectTemplate, SelectDeptUser, TemplateTable },
  139. data() {
  140. return {
  141. open: false,
  142. showIndex: 1,
  143. form: {},
  144. openSubmit: false,
  145. rulesApprove: {
  146. qmrmm: [{
  147. required: true,
  148. message: ' ',
  149. trigger: 'blur'
  150. }],
  151. fzrsh: [{
  152. required: true,
  153. message: ' ',
  154. trigger: 'blur'
  155. }],
  156. shryId: [{
  157. required: true,
  158. message: ' ',
  159. trigger: 'blur'
  160. }]
  161. },
  162. rules: {
  163. bdmc: [{
  164. required: true,
  165. message: ' ',
  166. trigger: 'blur'
  167. }],
  168. templateId: [{
  169. required: true,
  170. message: ' ',
  171. trigger: 'blur'
  172. }],
  173. sfbl: [{
  174. required: true,
  175. message: ' ',
  176. trigger: 'blur'
  177. }],
  178. },
  179. templateData: {},
  180. studyType: null,
  181. studyFormType:null
  182. }
  183. },
  184. computed: {
  185. ...mapGetters([
  186. 'nickName', 'name'
  187. ]),
  188. },
  189. created() {
  190. },
  191. methods: {
  192. onApplyCallback(data) {
  193. console.log("data:" + JSON.stringify(data))
  194. console.log("formdata:" + JSON.stringify(this.$refs.templateTable.getFilledFormData()))
  195. if (data.type == 'fieldChanged') {
  196. studyFormApply_updateBdnr(
  197. {
  198. id: this.form.id,
  199. bdnr: JSON.stringify(this.$refs.templateTable.getFilledFormData()),
  200. zdxgjl: JSON.stringify(data.resourceList),
  201. filedValue: JSON.stringify(data.newRecord)
  202. }
  203. ).then(response => {
  204. })
  205. }
  206. else if (data.type == 'reply') {
  207. studyFormApply_updateFhyjjl(
  208. {
  209. id: this.form.id,
  210. reply: JSON.stringify(data.newRecord),
  211. fhyjjl: JSON.stringify(data.resourceList)
  212. }
  213. ).then(response => {
  214. })
  215. }
  216. },
  217. pre() {
  218. this.showIndex = 1
  219. },
  220. next() {
  221. this.$refs["form"].validate(valid => {
  222. if (valid) {
  223. this.$modal.loading()
  224. studyFormApply_bcOnly(this.form).then(response => {
  225. this.form = response.data
  226. this.templateData.bdmc = this.form.bdmc
  227. this.showIndex = 2
  228. this.$modal.closeLoading()
  229. }).finally(() => {
  230. this.$modal.closeLoading()
  231. })
  232. }
  233. })
  234. },
  235. selectTemplateChange(val) {
  236. this.form.bdmc = val.name
  237. this.form.bdnr = val.content
  238. this.form.templateMc = val.name
  239. this.form.templateSn = val.sn
  240. this.templateData = deepClone(this.form)
  241. },
  242. cancel() {
  243. this.$emit('close')
  244. this.open = false
  245. },
  246. reset() {
  247. this.form = {
  248. id: null,
  249. studyId: null,
  250. bdbh: null,
  251. bdmc: '麻精药领取申请单',
  252. bdsm: null,
  253. templateId: 2,
  254. templateMc: '麻精药领取申请单',
  255. templateSn: 'MJYLQSQD',
  256. bdnr: null,
  257. fzrsh: null,
  258. shryId: null,
  259. sfbl: null,
  260. qmyy: this.$t('page.business.study.studyFormApply.cjjl'),
  261. shryMc: null,
  262. }
  263. this.resetForm("form")
  264. },
  265. selectDeptUserChange(val) {
  266. this.form.shryMc = val.name
  267. },
  268. edit(row) {
  269. this.reset()
  270. this.studyType = row.studyType||null
  271. this.studyFormType = row.studyFormType||null
  272. if (row && row.id) {
  273. this.showIndex = 2
  274. this.$modal.loading()
  275. studyFormApply_info({ id: row.id }).then(response => {
  276. this.form = _.merge({}, this.form, response.data)
  277. this.templateData = deepClone(this.form)
  278. this.open = true
  279. }).finally(() => {
  280. this.$modal.closeLoading()
  281. })
  282. } else {
  283. this.showIndex = 1
  284. this.form = _.merge({}, this.form, row)
  285. this.templateData = deepClone(this.form)
  286. this.open = true
  287. }
  288. },
  289. save() {
  290. this.$refs["form"].validate(valid => {
  291. if (valid) {
  292. this.$modal.loading()
  293. studyFormApply_bc(this.form).then(response => {
  294. this.$emit('close')
  295. this.open = false
  296. }).finally(() => {
  297. this.$modal.closeLoading()
  298. })
  299. }
  300. })
  301. },
  302. async showtijjiao() {
  303. let content = await this.$refs.templateTable.getFormData()
  304. if (content) {
  305. this.form.bdnr = JSON.stringify(content)
  306. this.openSubmit = true
  307. }
  308. },
  309. async saveNext() {
  310. this.form.bdnr = JSON.stringify(this.$refs.templateTable.getFilledFormData())
  311. this.$modal.loading()
  312. studyFormApply_bc(this.form).then(response => {
  313. this.$emit('close')
  314. this.open = false
  315. }).finally(() => {
  316. this.$modal.closeLoading()
  317. })
  318. },
  319. tj() {
  320. this.$refs["formSubmit"].validate(valid => {
  321. if (valid) {
  322. this.$modal.loading()
  323. studyFormApply_tj(this.form).then(response => {
  324. this.$emit('close')
  325. this.openSubmit = false
  326. this.open = false
  327. }).finally(() => {
  328. this.$modal.closeLoading()
  329. })
  330. }
  331. })
  332. }
  333. }
  334. }
  335. </script>