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

340 lines
11 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>
  88. <el-col :psna="24">
  89. <el-form-item>
  90. <el-checkbox v-model="showCz">处置</el-checkbox>
  91. </el-form-item>
  92. </el-col>
  93. <el-col :psna="24">
  94. <el-form-item>
  95. <el-checkbox v-model="showCc">存储</el-checkbox>
  96. </el-form-item>
  97. </el-col>
  98. <el-col :psna="24">
  99. <el-form-item>
  100. 用量统计
  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.qmyy')" prop="qmyy">
  107. <el-input type="text" :value="formApprove.qmyy" 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.remark')" prop="remark">
  115. <el-input type="textarea" v-model="formApprove.remark" :rows="5" maxlength="500"
  116. :placeholder="$t('form.placeholderInput')">
  117. </el-input>
  118. </el-form-item>
  119. </el-col>
  120. </el-row>
  121. <el-row>
  122. <el-col :span="24">
  123. <el-form-item :label="$t('form.signer')">
  124. <el-input type="text" v-model="nickName" maxlength="50" disabled
  125. :placeholder="$t('form.placeholderInput')" />
  126. </el-form-item>
  127. </el-col>
  128. </el-row>
  129. <el-row>
  130. <el-col :span="24">
  131. <el-form-item :label="$t('form.password')" prop="qmrmm">
  132. <el-input type="password" v-model="formApprove.qmrmm" maxlength="20"
  133. :placeholder="$t('form.placeholderInput')" />
  134. </el-form-item>
  135. </el-col>
  136. </el-row>
  137. </el-form>
  138. <div slot="footer" class="dialog-footer">
  139. <el-button type="primary" @click="tj">{{ $t('form.confirm') }}</el-button>
  140. <el-button @click="openApprove = false">{{ $t('form.cancel') }}</el-button>
  141. </div>
  142. </el-dialog>
  143. </div>
  144. </template>
  145. <script>
  146. import { studyFormFill_bc, studyFormFill_tj, studyFormFill_info } from "@/api/business/study/studyFormFill"
  147. import { study_info } from "@/api/business/study/study"
  148. import { mapGetters } from 'vuex'
  149. import SelectTemplate from "@/views/business/comps/select/SelectTemplate";
  150. import SelectDeptUser from '@/views/business/comps/select/SelectDeptUser';
  151. import TemplateTable from '@/views/business/comps/template/TemplateTable';
  152. export default {
  153. name: "Bj",
  154. components: { SelectTemplate, SelectDeptUser, TemplateTable },
  155. data() {
  156. return {
  157. open: false,
  158. showIndex: 1,
  159. showCz: false,
  160. showCc: false,
  161. form: {},
  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. openApprove: false,
  180. formApprove: {},
  181. bdmbTitle: this.$t('page.business.form.bdmb'),
  182. rulesApprove: {
  183. qmrmm: [{
  184. required: true,
  185. message: ' ',
  186. trigger: 'blur'
  187. }]
  188. },
  189. }
  190. },
  191. computed: {
  192. ...mapGetters([
  193. 'nickName', 'name'
  194. ]),
  195. },
  196. created() {
  197. this.getInfo()
  198. },
  199. methods: {
  200. getInfo() {
  201. let formId = this.$route.params.formId
  202. let studyId = this.$route.params.studyId
  203. let fromYt = this.$route.params.fromYt
  204. this.reset()
  205. if (parseInt(formId) > 0) {
  206. if (fromYt + '' == "10") {
  207. this.showIndex = 1
  208. this.bdmbTitle = this.$t('page.business.study.studyFormFill.ytbd')
  209. } else {
  210. this.showIndex = 2
  211. }
  212. this.$modal.loading()
  213. studyFormFill_info({ id: formId }).then(response => {
  214. this.form = response.data
  215. this.form.qmyy = '制作提交预制表单'
  216. this.$modal.closeLoading()
  217. })
  218. } else {
  219. this.showIndex = 1
  220. this.$modal.loading()
  221. study_info({ id: studyId }).then(response => {
  222. this.form = _.merge({}, this.form, { stydyId: studyId, resourceStudy: response.data.resource })
  223. this.$modal.closeLoading()
  224. })
  225. }
  226. },
  227. async showApprove() {
  228. let content = await this.$refs.templateTable.getFormData()
  229. if (content) {
  230. this.form.bdnr = JSON.stringify(content)
  231. this.resetApprove()
  232. this.formApprove.id = this.form.id
  233. this.openApprove = true
  234. }
  235. },
  236. resetApprove() {
  237. this.formApprove = {
  238. id: null,
  239. qmyy: '填写并提交记录',
  240. remark: '',
  241. bdnr: '',
  242. resource: '',
  243. qmrmm: '',
  244. }
  245. this.resetForm("formApprove")
  246. },
  247. pre() {
  248. this.showIndex = 1
  249. },
  250. next() {
  251. this.$refs["form"].validate(valid => {
  252. if (valid) {
  253. this.showIndex = 2
  254. }
  255. })
  256. },
  257. selectTemplateChange(val) {
  258. this.form.bdnr = val.content
  259. this.form.templateMc = val.name
  260. this.form.bdmc = val.name
  261. this.form.templateSn = val.sn
  262. },
  263. cancel() {
  264. let data = localStorage.getItem(this.$route.params.key)
  265. if (data && data != '') {
  266. let params = JSON.parse(data)
  267. const obj = { path: params.url }
  268. this.$tab.closeOpenPage(obj)
  269. }
  270. },
  271. reset() {
  272. this.form = {
  273. id: null,
  274. studyId: null,
  275. bdbh: null,
  276. bdmc: null,
  277. bdsm: null,
  278. templateId: null,
  279. templateMc: null,
  280. templateSn: null,
  281. bdnr: null,
  282. resource: null,
  283. resourceStudy: null,
  284. fzrsh: null,
  285. shryId: null,
  286. sfbl: null,
  287. shryMc: null,
  288. }
  289. this.resetForm("form")
  290. },
  291. selectDeptUserChange(val) {
  292. this.form.shryMc = val.name
  293. },
  294. save() {
  295. this.$refs["form"].validate(valid => {
  296. if (valid) {
  297. this.$modal.loading()
  298. studyFormFill_bc(this.form).then(response => {
  299. this.$modal.closeLoading()
  300. this.cancel()
  301. }).finally(() => {
  302. this.$modal.closeLoading()
  303. })
  304. }
  305. })
  306. },
  307. async saveNext() {
  308. let content = await this.$refs.templateTable.getFormData()
  309. if (content) {
  310. this.form.bdnr = JSON.stringify(content)
  311. this.$modal.loading()
  312. studyFormFill_bc(this.form).then(response => {
  313. this.$modal.closeLoading()
  314. this.cancel()
  315. }).finally(() => {
  316. this.$modal.closeLoading()
  317. })
  318. }
  319. },
  320. tj() {
  321. this.$refs["formApprove"].validate(valid => {
  322. if (valid) {
  323. this.$modal.loading()
  324. studyFormFill_tj(this.formApprove).then(response => {
  325. this.openApprove = false
  326. this.$modal.closeLoading()
  327. this.cancel()
  328. }).finally(() => {
  329. this.$modal.closeLoading()
  330. })
  331. }
  332. })
  333. }
  334. }
  335. }
  336. </script>