fieldSetModal.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. <template>
  2. <div class="dialog">
  3. <el-dialog
  4. :title="formData.name"
  5. width="40%"
  6. :visible.sync="dialogVisible"
  7. :before-close="close"
  8. :modal-append-to-body="false"
  9. :close-on-click-modal="false"
  10. >
  11. <div class="content">
  12. <el-table
  13. ref="multipleTable"
  14. :data="fieldList"
  15. style="width: 100%"
  16. @selection-change="handleSelectionChange"
  17. >
  18. <el-table-column label="序号" width="70px">
  19. <template slot-scope="scope">{{ scope.$index + 1 }}</template>
  20. </el-table-column>
  21. <el-table-column prop="filedName" label="字段名"> </el-table-column>
  22. <el-table-column
  23. prop="filedNameZh"
  24. label="中文名"
  25. show-overflow-tooltip
  26. >
  27. </el-table-column>
  28. <el-table-column label="是否可共享" width="150">
  29. <template #default="{ row, $index }">
  30. <el-checkbox
  31. v-model="row.checked"
  32. @change="changeShare(row, $index)"
  33. >
  34. 可共享
  35. </el-checkbox>
  36. </template></el-table-column
  37. >
  38. </el-table>
  39. </div>
  40. <span slot="footer" class="dialog-footer">
  41. <el-button type="primary" @click="refresh">刷新字段列表</el-button>
  42. <el-button type="primary" @click="submit">保存</el-button>
  43. <el-button @click="close">关闭</el-button>
  44. </span>
  45. </el-dialog>
  46. </div>
  47. </template>
  48. <script>
  49. import { Getfiledslist, fileds } from "@/api/shared.js";
  50. export default {
  51. components: {},
  52. props: {},
  53. data() {
  54. return {
  55. formData: {},
  56. fieldList: [{ label: "sc", name: "字段" }],
  57. dialogVisible: false,
  58. };
  59. },
  60. created() {},
  61. methods: {
  62. // 关闭弹窗
  63. close() {
  64. this.dialogVisible = false;
  65. this.$emit("close");
  66. },
  67. Init(rowdata) {
  68. this.formData = rowdata;
  69. this.dialogVisible = true;
  70. this.getfieldList(rowdata.bsm, false);
  71. },
  72. async getfieldList(zymlBsm, resetType) {
  73. this.fieldList = [];
  74. let res = await Getfiledslist({ zymlBsm, resetType });
  75. // this.fieldList = res.data;
  76. res.data.forEach((field) => {
  77. this.fieldList.push({ ...field, checked: field.shareDisplay == 0 });
  78. });
  79. },
  80. changeShare(row, index) {
  81. this.fieldList[index].shareDisplay = row.checked ? 0 : 1;
  82. },
  83. refresh() {
  84. this.getfieldList(this.formData.bsm, true);
  85. },
  86. async submit() {
  87. fileds(this.fieldList).then((res) => {
  88. if ((res.code = 200)) {
  89. this.$message.success("共享字段设置成功!");
  90. this.close();
  91. }
  92. });
  93. },
  94. },
  95. };
  96. </script>
  97. <style lang="scss" scoped>
  98. .dialog {
  99. .content {
  100. height: 400px;
  101. overflow-y: auto;
  102. overflow-x: hidden;
  103. color: #fff;
  104. .el-checkbox {
  105. color: #fff;
  106. }
  107. }
  108. }
  109. </style>
  110. <style lang="scss" >
  111. </style>