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.

335 lines
8.4 KiB

1 year ago
  1. <template>
  2. <div style="padding: 10px 0;">
  3. <div>
  4. <el-form :model="form" :rules="rules" ref="ruleForm" label-width="70px">
  5. <el-row>
  6. <el-col :span="24">
  7. <el-form-item label="模板编号" prop="">
  8. <el-input v-model="form.id" :disabled="true" size="small"></el-input>
  9. </el-form-item>
  10. </el-col>
  11. </el-row>
  12. <el-row>
  13. <el-col :span="24">
  14. <el-form-item label="词条类别" prop="bigtextResultTypeId">
  15. <el-cascader v-model="form.bigtextResultTypeId" :options="bigtextResultTypeId" popper-class="example"
  16. ref="bigtextResultTypeIds" @change="ischangsItemTypeId" :props="{
  17. value: 'bigtextResultTypeId',
  18. label: 'displayName',
  19. children: 'treeChildren',
  20. checkStrictly: true,
  21. expandTrigger: 'hover',
  22. }" size="small">
  23. </el-cascader>
  24. </el-form-item>
  25. </el-col>
  26. </el-row>
  27. <el-row>
  28. <el-col :span="8">
  29. <el-form-item label="模板名称" prop="displayName">
  30. <el-input v-model="form.displayName" ref="refinput" size="small"></el-input>
  31. </el-form-item>
  32. </el-col>
  33. </el-row>
  34. <el-divider></el-divider>
  35. <el-row>
  36. <el-col :span="5">
  37. <el-form-item label="创建者">
  38. <el-input v-model="form.creatorName" disabled size="small"></el-input>
  39. </el-form-item>
  40. </el-col>
  41. <el-col :span="7">
  42. <el-form-item label="创建时间" style="margin-left: -5%">
  43. <el-input :value="form.creationTime | dateFormat" disabled style="width: 90%" size="small"></el-input>
  44. </el-form-item>
  45. </el-col>
  46. <el-col :span="5">
  47. <el-form-item label="修改者" style="margin-left: -25%">
  48. <el-input v-model="form.creatorName" disabled size="small"></el-input>
  49. </el-form-item>
  50. </el-col>
  51. <el-col :span="7">
  52. <el-form-item label="修改时间" style="margin-left: -5%">
  53. <el-input :value="form.lastModificationTime | dateFormat" disabled style="width: 90%"
  54. size="small"></el-input>
  55. </el-form-item>
  56. </el-col>
  57. </el-row>
  58. </el-form>
  59. </div>
  60. <div style="display: flex;justify-content: space-between;padding: 10px 0;">
  61. <div></div>
  62. <div>
  63. <el-button @click="btnCancel" class="difference"> </el-button>
  64. <el-button type="primary" @click="btnSubmit" class="commonbutton"> </el-button>
  65. </div>
  66. </div>
  67. </div>
  68. </template>
  69. <script>
  70. import { mapState } from "vuex";
  71. import Sortable from "sortablejs";
  72. import { getapi, postapi, deletapi } from "@/api/api";
  73. import { examinationgender, instrumentlist } from "@/request/systemapi";
  74. import { deepCopy, objCopy, dddw, tcdate } from "../../utlis/proFunc";
  75. export default {
  76. props: ["refParams", "refFunOther"],
  77. data() {
  78. return {
  79. form: {
  80. id: "",
  81. displayName: "",
  82. bigtextResultTypeId: "",
  83. },
  84. bigtextResultTypeId: [], //项目类别
  85. rules: {
  86. displayName: [
  87. { required: true, message: "请输入名称", trigger: "blur" },
  88. ],
  89. bigtextResultTypeId: [
  90. { required: true, message: "请选择词条类别", trigger: "blur" },
  91. ]
  92. }, //表单校验对象
  93. };
  94. },
  95. created() {
  96. },
  97. mounted() {
  98. // this.getBigtextResultType();
  99. this.dispEdit()
  100. },
  101. updated() {
  102. // this.$nextTick(() => {
  103. // this.$refs.table.doLayout();
  104. // });
  105. },
  106. computed: {
  107. ...mapState(["window", "dict", "dialogWin", "dataTransOpts"]),
  108. },
  109. methods: {
  110. dddw,
  111. // 结果类别
  112. getBigtextResultType() {
  113. postapi('/api/app/BigtextResultType/GetByCodeAll').then((res) => {
  114. if (res.code != -1) {
  115. this.bigtextResultTypeId = res.data;
  116. tcdate(this.bigtextResultTypeId)
  117. }
  118. });
  119. },
  120. ischangsItemTypeId(v) {
  121. if (v) {
  122. this.form.bigtextResultTypeId = v[v.length - 1]
  123. } else {
  124. this.form.bigtextResultTypeId = null
  125. }
  126. },
  127. formFocus() {
  128. this.$nextTick(() => {
  129. this.$refs.refinput.focus();
  130. });
  131. },
  132. //编辑弹框
  133. dispEdit() {
  134. // 需要刷新上级节点字典库,因为有可能更新
  135. this.getBigtextResultType()
  136. console.log('this.refParams', this.refParams)
  137. if (this.$refs.ruleForm !== undefined) {
  138. this.$refs.ruleForm.resetFields();
  139. }
  140. if (this.refParams.id) {
  141. objCopy(this.refParams, this.form)
  142. postapi('/api/app/BigtextResultType/Get', { bigtextResultTemplateId: this.refParams.id }).then((res) => {
  143. if (res.code > -1) {
  144. objCopy(res.data, this.form);
  145. this.formFocus()
  146. }
  147. })
  148. } else {
  149. objCopy(this.refParams, this.form)
  150. this.formFocus()
  151. }
  152. },
  153. btnCancel() {
  154. this.dialogWin.BigtextResultTemplateEdit = false;
  155. // this.$refs.bigtextResultTypeIds.toggleDropDownVisible();
  156. },
  157. //确定新增或者编辑
  158. btnSubmit() {
  159. this.$refs.ruleForm.validate((v) => {
  160. if (v) {
  161. let obj = Object.assign({}, this.form, { bigtextResultTemplateId: this.form.id })
  162. if (!this.form.id) {
  163. postapi('/api/app/BigtextResultTemplate/Create', obj).then(res => {
  164. if (res.code > -1) {
  165. this.refFunOther(res.data)
  166. this.dataTransOpts.tableS.bigtext_result_template.id = res.data.id
  167. this.dialogWin.BigtextResultTemplateEdit = false;
  168. }
  169. })
  170. } else {
  171. postapi('/api/app/BigtextResultTemplate/Update', obj).then(res => {
  172. if (res.code > -1) {
  173. this.refFunOther(obj)
  174. this.dialogWin.BigtextResultTemplateEdit = false;
  175. }
  176. })
  177. }
  178. }
  179. });
  180. },
  181. },
  182. //监听事件
  183. watch: {
  184. //
  185. "dataTransOpts.refresh.bigtext_result_template.S": {
  186. // immediate:true,
  187. handler(newVal, oldVal) {
  188. console.log(`watch dataTransOpts.refresh.bigtext_result_template.S newVal: ${newVal}, oldVal: ${oldVal}`);
  189. if (newVal != oldVal) this.dispEdit()
  190. }
  191. },
  192. },
  193. };
  194. </script>
  195. <style scoped>
  196. @import "../../assets/css/global_button.css";
  197. @import "../../assets/css/global_dialog.css";
  198. @import "../../assets/css/global_table.css";
  199. @import "../../assets/css/global_form.css";
  200. @import "../../assets/css/global_input.css";
  201. @import "../../assets/css/global.css";
  202. .mainleftbox {
  203. flex: 1;
  204. }
  205. .Selectbutton {
  206. margin: 0 20px;
  207. display: flex;
  208. flex-direction: column;
  209. justify-content: center;
  210. align-items: center;
  211. }
  212. .mainbox {
  213. display: flex;
  214. justify-content: center;
  215. margin-top: 5px;
  216. }
  217. .box {
  218. display: flex;
  219. flex-direction: column;
  220. }
  221. /* form表单每一项的下边距 */
  222. :deep .el-form-item {
  223. margin-bottom: 14px;
  224. }
  225. /* 去掉input textarea的手动扩张样式 */
  226. :deep(.el-textarea__inner) {
  227. resize: none;
  228. }
  229. /* el-dialog的头部样式 */
  230. :deep .el-dialog__header {
  231. padding: 11px 20px 11px;
  232. }
  233. /* el-dialog的主体样式 */
  234. :deep .el-dialog__body {
  235. padding: 0px 20px 0px;
  236. }
  237. /* el-divider样式 */
  238. :deep .el-divider--horizontal {
  239. margin: 0px 0 12px;
  240. }
  241. /* el-dialog的底部样式 */
  242. :deep .el-dialog__footer {
  243. padding: 0px 20px 14px;
  244. }
  245. /* 默认结果后面下拉框样式 */
  246. :deep .downText .el-input--suffix .el-input__inner {
  247. width: 0;
  248. height: 100%;
  249. padding: 0 19px;
  250. }
  251. /* 默认结果后面下拉框图标样式 */
  252. :deep .downText .el-input--suffix .el-input__suffix {
  253. right: 12px;
  254. }
  255. /* 默认结果后面下拉框 */
  256. :deep .downText {
  257. display: flex !important;
  258. }
  259. /* 诊断函数后面按钮样式 */
  260. :deep .el-input-group__append {
  261. padding: 0 11px;
  262. }
  263. /* 默认结果整体样式 */
  264. .my-el-form-item :deep .el-form-item__content {
  265. line-height: 0 !important;
  266. }
  267. .my-el-form-item :deep .el-input__icon {
  268. line-height: 0 !important;
  269. }
  270. /* 指引信息 */
  271. .guidelines :deep .el-form-item {
  272. margin-bottom: 0;
  273. }
  274. .seachinput {
  275. width: 250px;
  276. margin-right: 110px;
  277. }
  278. :deep .seachinput .el-select {
  279. width: 100%;
  280. }
  281. .layeredleftright {
  282. width: 95%;
  283. display: flex;
  284. flex-direction: column;
  285. }
  286. :deep .el-tree-node>.el-tree-node__children {
  287. overflow: visible;
  288. }
  289. :deep .el-form-item {
  290. margin-bottom: 8px;
  291. }
  292. </style>