index.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. <template>
  2. <div class="airportInfo scroll-y">
  3. <div class="wrap">
  4. <Minheader :is-auth="true" :is-statuser="true" @addForm="addForm">
  5. <template #header>
  6. <div class="status flex-wrap">
  7. <div class="manageTitle">消息模板</div>
  8. </div>
  9. </template></Minheader
  10. >
  11. <div class="app-containers">
  12. <DataTable
  13. :tableHeader="state.list"
  14. :tableData="tableData"
  15. :tableBtnGroup="tableBtnGroup"
  16. :tableProperty="{ rowKey: 'ID' }"
  17. @btnClick="btnClick"
  18. />
  19. </div>
  20. <Dialog
  21. :flag="flag"
  22. :type="type"
  23. :msgTitle="msgTitle"
  24. @resetForm="resetForm"
  25. @delRest="delRest"
  26. >
  27. <div class="diacont">
  28. <el-form :model="tableForm">
  29. <el-row :gutter="24">
  30. <el-col>
  31. <el-form-item label="名称" size="default">
  32. <el-input v-model="tableForm.name" placeholder="请输入名称" />
  33. </el-form-item>
  34. </el-col>
  35. <el-col>
  36. <el-form-item label="描述" size="default">
  37. <el-input
  38. type="textarea"
  39. v-model="tableForm.china"
  40. placeholder="请输入描述"
  41. />
  42. </el-form-item>
  43. </el-col>
  44. </el-row>
  45. </el-form>
  46. </div>
  47. </Dialog>
  48. </div>
  49. </div>
  50. </template>
  51. <script setup lang="ts">
  52. import DataTable from "@/components/tableTemp/index.vue";
  53. import Minheader from "@/components/minheader/index.vue";
  54. import Dialog from "@/components/dialog/index.vue";
  55. const flag = ref<Boolean>(false); //弹窗开关
  56. const type = ref<String>(""); //判断是否删除
  57. const msgTitle = ref<String>("新增消息模板"); //弹窗标题
  58. const tableColsCopys = reactive<Object>({}); //弹窗
  59. const tableForm = reactive({
  60. name: "",
  61. china: "",
  62. englin: "",
  63. two: "",
  64. three: "",
  65. text: "",
  66. }); //弹窗内容
  67. //列表
  68. const tableData = ref([
  69. {
  70. name: "中国国际航空",
  71. china: "国航",
  72. },
  73. {
  74. name: "中国国际航空",
  75. china: "国航",
  76. },
  77. {
  78. name: "中国国际航空",
  79. china: "国航",
  80. },
  81. ]);
  82. //表头
  83. const state = reactive({
  84. list: [
  85. { label: "名称", key: "name" },
  86. { label: "描述", key: "china" },
  87. ],
  88. listLoading: true,
  89. });
  90. const tableBtnGroup = ref([
  91. {
  92. name: "编辑",
  93. className: "editBtn",
  94. param: 2,
  95. },
  96. {
  97. name: "删除",
  98. className: "delBtn",
  99. param: 3,
  100. },
  101. ]);
  102. //新增
  103. const addForm = () => {
  104. msgTitle.value = "新增消息模板";
  105. flag.value = true;
  106. type.value = "";
  107. };
  108. //取消
  109. const resetForm = () => {
  110. flag.value = false;
  111. tableForm.name = "";
  112. tableForm.china = "";
  113. tableForm.englin = "";
  114. tableForm.two = "";
  115. tableForm.three = "";
  116. tableForm.text = "";
  117. };
  118. //编辑
  119. // const editDialog = (data) => {
  120. // msgTitle.value = "编辑航司信息维护";
  121. // flag.value = true;
  122. // type.value = "";
  123. // tableForm.name = data.name;
  124. // tableForm.china = data.china;
  125. // tableForm.englin = data.englin;
  126. // tableForm.two = data.two;
  127. // tableForm.three = data.three;
  128. // tableForm.text = data.text;
  129. // };
  130. //编辑-删除
  131. const btnClick = (row, index, param) => {
  132. if (param === 2) {
  133. msgTitle.value = "编辑消息模板";
  134. flag.value = true;
  135. type.value = "";
  136. tableForm.name = index.name;
  137. tableForm.china = index.china;
  138. tableForm.englin = index.englin;
  139. tableForm.two = index.two;
  140. tableForm.three = index.three;
  141. tableForm.text = index.text;
  142. } else if (param === 3) {
  143. msgTitle.value = "删除消息模板";
  144. flag.value = true;
  145. type.value = "del";
  146. } else if (param === 4) {
  147. }
  148. };
  149. //删除
  150. const eleDialog = () => {
  151. msgTitle.value = "删除消息模板";
  152. flag.value = true;
  153. type.value = "del";
  154. };
  155. //删除
  156. const delRest = () => {
  157. flag.value = false;
  158. };
  159. </script>
  160. <style lang="scss" scoped>
  161. ::v-deep .el-form-item__label {
  162. width: 50px;
  163. }
  164. .app-containers {
  165. height: calc(100vh - 180px);
  166. }
  167. </style>