阅行客电子档案
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.

84 lines
2.4 KiB

  1. <template>
  2. <el-dialog class="addEdit-category-form" :close-on-click-modal="false" :visible.sync="cuDialogVisible" :title="title">
  3. <div class="setting-dialog">
  4. <el-form ref="formData" :model="formData" size="small" label-width="90px">
  5. <el-row v-for="(item) in formData.fields" :key="item.id">
  6. <el-col :span="12">
  7. <el-form-item label="组成字段">
  8. <el-input v-model="item.fieldCnName" :disabled="true" />
  9. </el-form-item>
  10. </el-col>
  11. <el-col :span="12">
  12. <el-form-item label="组成符号">
  13. <el-input v-model="item.connector" />
  14. </el-form-item>
  15. </el-col>
  16. </el-row>
  17. </el-form>
  18. <div slot="footer" class="dialog-footer">
  19. <el-button @click="cuDialogVisible=false">取消</el-button>
  20. <el-button type="primary" :loading="loading" @click="save">确定</el-button>
  21. </div>
  22. </div>
  23. </el-dialog>
  24. </template>
  25. <script>
  26. import { add, edit } from '@/api/category/fileNoFormat'
  27. export default {
  28. data() {
  29. return {
  30. cuDialogVisible: false,
  31. formData: {},
  32. title: '新增档号规则',
  33. loading: false
  34. }
  35. },
  36. methods: {
  37. save() {
  38. this.loading = true
  39. if (this.title === '新增档号规则') {
  40. const addData = this.formData.fields.map((item) => {
  41. return {
  42. dictionaryId: item.id,
  43. fieldName: item.fieldName,
  44. fieldCnName: item.fieldCnName,
  45. connector: item.connector,
  46. categoryId: item.categoryId
  47. }
  48. })
  49. add(addData).then((res) => {
  50. this.$message({
  51. message: '保存成功',
  52. type: 'success',
  53. duration: 2500
  54. })
  55. this.cuDialogVisible = false
  56. this.loading = false
  57. this.$emit('refresh')
  58. })
  59. } else {
  60. edit(this.formData.fields).then((res) => {
  61. this.$message({
  62. message: '保存成功',
  63. type: 'success',
  64. duration: 2500
  65. })
  66. this.cuDialogVisible = false
  67. this.loading = false
  68. this.$emit('refresh')
  69. })
  70. }
  71. }
  72. }
  73. }
  74. </script>
  75. <style rel="stylesheet/scss" lang="scss" scoped>
  76. .fields-list {
  77. max-height: calc(100vh - 312px);
  78. overflow-x: hidden;
  79. overflow-y: auto;
  80. position: relative;
  81. }
  82. </style>