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

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