index.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  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. width="508px"
  22. :flag="flag"
  23. :type="type"
  24. :msgTitle="msgTitle"
  25. @resetForm="resetForm"
  26. @delRest="delRest"
  27. >
  28. <div class="diacont">
  29. <el-form :model="tableForm">
  30. <el-row :gutter="24">
  31. <el-col>
  32. <el-form-item label="协议名称" size="default">
  33. <el-input
  34. v-model="tableForm.name"
  35. placeholder="请输入协议名称"
  36. />
  37. </el-form-item>
  38. </el-col>
  39. <el-col>
  40. <el-form-item label="类名" size="default">
  41. <el-input
  42. type="textarea"
  43. v-model="tableForm.china"
  44. placeholder="请输入类名"
  45. />
  46. </el-form-item>
  47. </el-col>
  48. <el-col>
  49. <el-form-item label="读方法名" size="default">
  50. <el-input
  51. v-model="tableForm.englin"
  52. placeholder="请输入读方法名"
  53. />
  54. </el-form-item>
  55. </el-col>
  56. <el-col>
  57. <el-form-item label="写方法名" size="default">
  58. <el-input
  59. v-model="tableForm.two"
  60. placeholder="请输入写方法名"
  61. />
  62. </el-form-item>
  63. </el-col>
  64. <el-col>
  65. <el-form-item label="文件名及路径" size="default">
  66. <el-input
  67. type="textarea"
  68. v-model="tableForm.three"
  69. placeholder="请输入文件名及路径"
  70. />
  71. </el-form-item>
  72. </el-col>
  73. </el-row>
  74. </el-form>
  75. </div>
  76. </Dialog>
  77. </div>
  78. </div>
  79. </template>
  80. <script setup lang="ts">
  81. import DataTable from "@/components/tableTemp/index.vue";
  82. import Minheader from "@/components/minheader/index.vue";
  83. import Dialog from "@/components/dialog/index.vue";
  84. const flag = ref<Boolean>(false); //弹窗开关
  85. const type = ref<String>(""); //判断是否删除
  86. const msgTitle = ref<String>("新增协议管理"); //弹窗标题
  87. const tableColsCopys = reactive<Object>({}); //弹窗
  88. const tableForm = reactive({
  89. name: "",
  90. china: "",
  91. englin: "",
  92. two: "",
  93. three: "",
  94. text: "",
  95. }); //弹窗内容
  96. //列表
  97. const tableData = ref([
  98. {
  99. name: "测试",
  100. china: "测试",
  101. englin: "测试",
  102. two: "测试",
  103. three: "测试",
  104. },
  105. {
  106. name: "测试",
  107. china: "测试",
  108. englin: "测试",
  109. two: "测试",
  110. three: "测试",
  111. },
  112. {
  113. name: "测试",
  114. china: "测试",
  115. englin: "测试",
  116. two: "测试",
  117. three: "测试",
  118. },
  119. ]);
  120. //表头
  121. const state = reactive({
  122. list: [
  123. { label: "协议名称", key: "name" },
  124. { label: "类名", key: "china" },
  125. { label: "读方法名", key: "englin" },
  126. { label: "写方法名", key: "two" },
  127. { label: "文件名及路径", key: "three" },
  128. ],
  129. listLoading: true,
  130. });
  131. const tableBtnGroup = ref([
  132. {
  133. name: "编辑",
  134. className: "editBtn",
  135. param: 2,
  136. },
  137. {
  138. name: "删除",
  139. className: "delBtn",
  140. param: 3,
  141. },
  142. ]);
  143. //新增
  144. const addForm = () => {
  145. msgTitle.value = "新增协议管理";
  146. flag.value = true;
  147. type.value = "";
  148. };
  149. //取消
  150. const resetForm = () => {
  151. flag.value = false;
  152. tableForm.name = "";
  153. tableForm.china = "";
  154. tableForm.englin = "";
  155. tableForm.two = "";
  156. tableForm.three = "";
  157. tableForm.text = "";
  158. };
  159. //编辑
  160. //编辑-删除
  161. const btnClick = (row, index, param) => {
  162. if (param === 2) {
  163. msgTitle.value = "编辑协议管理";
  164. flag.value = true;
  165. type.value = "";
  166. tableForm.name = index.name;
  167. tableForm.china = index.china;
  168. tableForm.englin = index.englin;
  169. tableForm.two = index.two;
  170. tableForm.three = index.three;
  171. tableForm.text = index.text;
  172. } else if (param === 3) {
  173. msgTitle.value = "删除协议管理";
  174. flag.value = true;
  175. type.value = "del";
  176. } else if (param === 4) {
  177. }
  178. };
  179. //删除
  180. const eleDialog = () => {
  181. msgTitle.value = "删除协议管理";
  182. flag.value = true;
  183. type.value = "del";
  184. };
  185. //删除
  186. const delRest = () => {
  187. flag.value = false;
  188. };
  189. </script>
  190. <style lang="scss" scoped>
  191. ::v-deep .el-form-item__label {
  192. width: 100px;
  193. }
  194. </style>