distribute.vue 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <template>
  2. <el-dialog
  3. title="选择下发机构状态"
  4. :visible.sync="isShow"
  5. class="g-dialog-select-safe-check"
  6. :close-on-click-modal="false"
  7. width="55%"
  8. top="10vh"
  9. append-to-body
  10. >
  11. <div class="el-dialog-div">
  12. <el-table :data="info.orgAndStatus" height="400px">
  13. <el-table-column type="index" label="序号" width="80"></el-table-column>
  14. <el-table-column prop="orgName" label="机构名称"></el-table-column>
  15. <el-table-column prop="status" label="计划状态">
  16. <template slot-scope="r">
  17. <el-switch
  18. v-model="r.row.status"
  19. active-text="启用"
  20. inactive-text="禁用"
  21. active-value="1"
  22. inactive-value="0"
  23. active-color="#008CD6"
  24. inactive-color="#ff4949"
  25. >
  26. </el-switch>
  27. </template>
  28. </el-table-column>
  29. </el-table>
  30. </div>
  31. <div slot="footer" class="dialog-footer">
  32. <el-button @click="onHide">关闭</el-button>
  33. <el-button type="primary" @click="onSubmit">确定</el-button>
  34. </div>
  35. </el-dialog>
  36. </template>
  37. <script>
  38. import { listByTypes } from "@/api/system/org.js";
  39. export default {
  40. components: { },
  41. data() {
  42. return {
  43. isShow: false,
  44. info: this.emptyInfo(),
  45. };
  46. },
  47. computed: {},
  48. watch: {},
  49. props: {
  50. defaultSelect: {
  51. type: Array,
  52. },
  53. orgType: {
  54. type: String,
  55. },
  56. },
  57. methods: {
  58. show(plan) {
  59. this.isShow = true;
  60. this.info.id = plan.id;
  61. listByTypes({
  62. orgId: plan.planCreateOrgId,
  63. orgTypes: ["2", "3", "4"],
  64. }).then((r) => {
  65. this.info.orgAndStatus = r.data.map((d) => {
  66. return { orgId: d.id, orgName: d.name, status: "1" };
  67. });
  68. });
  69. },
  70. onHide() {
  71. this.info=this.emptyInfo();
  72. this.isShow = false;
  73. },
  74. onSubmit() {
  75. console.info(this.info)
  76. this.$emit("select", this.info);
  77. this.onHide();
  78. },
  79. emptyInfo() {
  80. return {
  81. id: null, //计划id
  82. orgAndStatus: [], //机构及状态
  83. };
  84. },
  85. },
  86. mounted() {},
  87. };
  88. </script>
  89. <style lang="scss" scoped>
  90. .el-dialog-div {
  91. overflow: auto;
  92. }
  93. </style>