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

331 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.studyFormPlan.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.studyFormPlan.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.studyFormPlan.zc') }}</el-button>
  28. <el-button type="primary" @click="next">{{ $t('page.business.study.studyFormPlan.next') }}</el-button>
  29. </template>
  30. <template v-else>
  31. <el-button @click="saveNext">{{ $t('page.business.study.studyFormPlan.save') }}</el-button>
  32. <el-button type="primary" @click="showtijiao">{{ $t('page.business.study.studyFormPlan.submit')
  33. }}</el-button>
  34. <el-button type="primary" @click="pre">{{ $t('page.business.study.studyFormPlan.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" :needPre="1" :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.studyFormPlan.bdsm')" prop="bdsm">
  59. <el-input type="textarea" v-model="form.bdsm" :rows="5" maxlength="500"
  60. :placeholder="$t('form.placeholderInput')">
  61. </el-input>
  62. </el-form-item>
  63. </el-col>
  64. </el-row>
  65. </el-form>
  66. </div>
  67. <div class="content" v-if="showIndex == 2">
  68. <TemplateTable ref="templateTable" emitName="onPlanCallback" @onPlanCallback="onPlanCallback"
  69. :sn="form.templateSn" :templateData="templateData" fillType="actFill" />
  70. </div>
  71. </div>
  72. </div>
  73. <el-dialog :title="$t('page.business.study.studyFormPlan.tjjl')" :visible.sync="openSubmit" width="500px"
  74. append-to-body :close-on-click-modal="false">
  75. <el-form ref="formSubmit" :model="form" :rules="rulesApprove" label-width="120px" v-if="openSubmit">
  76. <div class="sbzdtcma"> <input type="text"> <input type="password" show-password> </div>
  77. <el-row>
  78. <el-col :span="24">
  79. <el-form-item :label="$t('page.business.study.studyFormPlan.shryId')" prop="fshryId">
  80. <SelectStudyUser v-model="form.fshryId" :query="{
  81. studyId: form.studyId,
  82. permit: 'business:studyFormPlan:fh'
  83. }" key="fshryId" @change="selectDeptUserChange" />
  84. </el-form-item>
  85. </el-col>
  86. </el-row>
  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" show-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 { studyFormPlan_bc, studyFormPlan_bcOnly, studyFormPlan_tj, studyFormPlan_info, studyFormPlan_updateBdnr, studyFormFill_updateFhyjjl } from "@/api/business/study/studyFormPlan"
  130. import { mapGetters } from 'vuex'
  131. import SelectTemplate from "@/views/business/comps/select/SelectTemplate";
  132. import SelectStudyUser from '@/views/business/comps/select/SelectStudyUser';
  133. import TemplateTable from '@/views/business/comps/template/TemplateTable';
  134. import { deepClone } from "@/utils/index";
  135. export default {
  136. name: "Bj",
  137. components: { SelectTemplate, SelectStudyUser, TemplateTable },
  138. data() {
  139. return {
  140. open: false,
  141. showIndex: 1,
  142. form: {},
  143. openSubmit: false,
  144. rulesApprove: {
  145. fshryId: [{
  146. required: true,
  147. message: ' ',
  148. trigger: 'blur'
  149. }],
  150. qmrmm: [{
  151. required: true,
  152. message: ' ',
  153. trigger: 'blur'
  154. }],
  155. fzrsh: [{
  156. required: true,
  157. message: ' ',
  158. trigger: 'blur'
  159. }],
  160. shryId: [{
  161. required: true,
  162. message: ' ',
  163. trigger: 'blur'
  164. }]
  165. },
  166. rules: {
  167. bdmc: [{
  168. required: true,
  169. message: ' ',
  170. trigger: 'blur'
  171. }],
  172. templateId: [{
  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. onPlanCallback(data) {
  190. console.log("data:" + JSON.stringify(data))
  191. console.log("formdata:" + JSON.stringify(this.$refs.templateTable.getFilledFormData()))
  192. if (data.type == 'fieldChanged'&&data.newRecord&&data.newRecord!='') {
  193. studyFormPlan_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. } else if (data.type == 'reply') {
  203. studyFormFill_updateFhyjjl(
  204. {
  205. id: this.form.id,
  206. reply: JSON.stringify(data.newRecord),
  207. fhyjjl: JSON.stringify(data.resourceList)
  208. }
  209. ).then(response => {
  210. })
  211. }
  212. },
  213. pre() {
  214. this.showIndex = 1
  215. },
  216. next() {
  217. this.$refs["form"].validate(valid => {
  218. if (valid) {
  219. this.$modal.loading()
  220. studyFormPlan_bcOnly(this.form).then(response => {
  221. this.form = response.data
  222. this.templateData = deepClone(this.form)
  223. this.showIndex = 2
  224. this.$modal.closeLoading()
  225. }).finally(() => {
  226. this.$modal.closeLoading()
  227. })
  228. }
  229. })
  230. },
  231. selectTemplateChange(val) {
  232. this.form.bdnr = val.content
  233. this.form.bdmc = val.name
  234. this.form.templateMc = val.name
  235. this.form.templateSn = val.sn
  236. this.templateData = deepClone(this.form)
  237. },
  238. cancel() {
  239. this.$emit('close')
  240. this.open = false
  241. },
  242. reset() {
  243. this.form = {
  244. id: null,
  245. studyId: null,
  246. bdbh: null,
  247. bdmc: '试验物质配制计划表',
  248. bdsm: null,
  249. templateId: 1,
  250. templateMc: '试验物质配制计划表',
  251. templateSn: 'SYWZPZJHB',
  252. bdnr: null,
  253. fzrsh: null,
  254. shryId: null,
  255. shryMc: null,
  256. }
  257. this.resetForm("form")
  258. },
  259. selectDeptUserChange(val) {
  260. this.form.fhryMc = val.name
  261. },
  262. edit(row) {
  263. this.reset()
  264. this.form.qmyy = this.$t('page.business.study.studyFormPlan.cjjl')
  265. if (row && row.id) {
  266. this.showIndex = 2
  267. this.$modal.loading()
  268. studyFormPlan_info({ id: row.id }).then(response => {
  269. this.form = response.data
  270. this.templateData = deepClone(this.form)
  271. this.open = true
  272. }).finally(() => {
  273. this.$modal.closeLoading()
  274. })
  275. } else {
  276. this.showIndex = 1
  277. this.form = _.merge({}, this.form, row)
  278. this.templateData = deepClone(this.form)
  279. this.open = true
  280. }
  281. },
  282. save() {
  283. this.$refs["form"].validate(valid => {
  284. if (valid) {
  285. this.$modal.loading()
  286. studyFormPlan_bc(this.form).then(response => {
  287. this.$emit('close')
  288. this.open = false
  289. }).finally(() => {
  290. this.$modal.closeLoading()
  291. })
  292. }
  293. })
  294. },
  295. async saveNext() {
  296. this.form.bdnr = JSON.stringify(this.$refs.templateTable.getFilledFormData())
  297. this.$modal.loading()
  298. studyFormPlan_bc(this.form).then(response => {
  299. this.$emit('close')
  300. this.open = false
  301. }).finally(() => {
  302. this.$modal.closeLoading()
  303. })
  304. },
  305. tj() {
  306. this.$refs["formSubmit"].validate(valid => {
  307. if (valid) {
  308. this.$modal.loading()
  309. studyFormPlan_tj(this.form).then(response => {
  310. this.$emit('close')
  311. this.open = false
  312. this.openSubmit = false
  313. }).finally(() => {
  314. this.$modal.closeLoading()
  315. })
  316. }
  317. })
  318. },
  319. async showtijiao() {
  320. let content = await this.$refs.templateTable.getFormData()
  321. if (content) {
  322. this.form.bdnr = JSON.stringify(content)
  323. this.openSubmit = true
  324. }
  325. }
  326. }
  327. }
  328. </script>