scenarioTestPackageManagementList.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  1. <template>
  2. <div>
  3. <search-layout :needBox="true">
  4. <template slot="searchItem1">
  5. <span class="label">指标ID</span>
  6. <el-input
  7. v-model="searchParams.packageCode"
  8. size="small"
  9. clearable
  10. maxlength="60"
  11. placeholder="请输入"
  12. >
  13. </el-input>
  14. </template>
  15. <template slot="searchItem2">
  16. <span class="label">指标名称</span>
  17. <el-input
  18. v-model="searchParams.packageName"
  19. size="small"
  20. clearable
  21. maxlength="60"
  22. placeholder="请输入"
  23. >
  24. </el-input>
  25. </template>
  26. <template slot="searchItem3">
  27. <span class="label">创建时间</span>
  28. <el-date-picker
  29. v-model="searchDate"
  30. type="daterange"
  31. format="yyyy-MM-dd"
  32. value-format="yyyy-MM-dd"
  33. range-separator="至"
  34. start-placeholder="开始日期"
  35. end-placeholder="结束日期"
  36. >
  37. </el-date-picker>
  38. </template>
  39. <template slot="searchBtn1">
  40. <el-button type="primary" @click="doSearch">查询</el-button>
  41. </template>
  42. <template slot="searchBtn2">
  43. <el-button type="primary" @click="doReset">重置</el-button>
  44. </template>
  45. </search-layout>
  46. <div class="myTabsBox">
  47. <el-tabs v-model="activeName" type="card" @tab-click="pageControl">
  48. <el-tab-pane label="公有" name="1"></el-tab-pane>
  49. <el-tab-pane label="私有" name="2"></el-tab-pane>
  50. </el-tabs>
  51. <el-button
  52. class="addBtn"
  53. icon="el-icon-circle-plus-outline"
  54. @click="addConfig"
  55. type="primary"
  56. :disabled="activeName === '1'"
  57. >新增</el-button
  58. >
  59. </div>
  60. <tableList
  61. ref="table"
  62. style="margin: 0 30px"
  63. :columns="columns"
  64. :getDataWay="getDataWay"
  65. :pagination="pagination"
  66. index
  67. >
  68. <el-table-column label="操作" slot="cgInfos" align="center">
  69. <template v-slot="scope">
  70. <i
  71. v-if="activeName === '2'"
  72. @click="shareRow(scope.row)"
  73. class="el-icon-share elIcon"
  74. title="分享"
  75. ></i>
  76. <i
  77. @click="editRow(scope.row)"
  78. class="el-icon-edit-outline elIcon"
  79. title="编辑"
  80. ></i>
  81. <i
  82. v-if="activeName === '2'"
  83. @click="delRow(scope.row)"
  84. class="el-icon-delete elIcon"
  85. title="删除"
  86. ></i>
  87. </template>
  88. </el-table-column>
  89. </tableList>
  90. </div>
  91. </template>
  92. <script>
  93. import searchLayout from "@/components/grid/searchLayout";
  94. import tableList from "@/components/grid/TableList";
  95. import toolbarTab from "@/components/toolbar/toolbarTab";
  96. export default {
  97. name: "scenarioTestPackageManagementList", // 场景测试包管理
  98. components: { searchLayout, tableList, toolbarTab },
  99. data() {
  100. return {
  101. searchParams: {
  102. //搜索参数
  103. packageCode: "", //指标ID
  104. packageName: "", //指标名称
  105. yearMin: "", // 开始时间
  106. yearMax: "", // 结束时间
  107. },
  108. searchDate: "", // 创建时间
  109. activeName: "1",
  110. columns: [
  111. {
  112. label: "指标ID",
  113. prop: "packageCode",
  114. },
  115. {
  116. label: "指标名称",
  117. prop: "packageName",
  118. },
  119. {
  120. label: "场景数量",
  121. prop: "sceneNum",
  122. },
  123. {
  124. label: "创建时间",
  125. prop: "startDateStr",
  126. formatter(row) {
  127. return row.createTime.slice(0, 10);
  128. },
  129. },
  130. {
  131. label: "操作",
  132. prop: "cgInfos",
  133. template: true,
  134. },
  135. ],
  136. pagination: {
  137. //分页使用
  138. currentPage: 1,
  139. pageSize: 10,
  140. position: "right",
  141. pageSizes: [10, 30, 50, 100, 200],
  142. layout: "sizes, total, prev, pager, next, jumper",
  143. },
  144. getDataWay: {
  145. //加载表格数据
  146. dataType: "url",
  147. type: "post",
  148. // firstRequest: false,
  149. data: this.$api.sceneLibrary.queryScenePackageList,
  150. param: {
  151. share: "1",
  152. },
  153. },
  154. };
  155. },
  156. methods: {
  157. doSearch() {
  158. if (this.searchDate) {
  159. this.searchParams.yearMin = `${this.searchDate[0]} 00:00:00`;
  160. this.searchParams.yearMax = `${this.searchDate[1]} 23:59:59`;
  161. } else {
  162. this.searchParams.yearMin = "";
  163. this.searchParams.yearMax = "";
  164. }
  165. let pageMap = {
  166. packageCode: this.searchParams.packageCode,
  167. packageName: this.searchParams.packageName,
  168. yearMin: this.searchParams.yearMin,
  169. yearMax: this.searchParams.yearMax,
  170. share: this.activeName === "1" ? "1" : "0",
  171. };
  172. this.refreshList(pageMap);
  173. },
  174. //刷新table
  175. refreshList(param) {
  176. param
  177. ? this.$refs["table"].loadData(param)
  178. : this.$refs["table"].loadData();
  179. },
  180. doReset() {
  181. this.searchParams = {
  182. packageCode: "",
  183. packageName: "",
  184. yearMin: "",
  185. yearMax: "",
  186. };
  187. this.searchDate = "";
  188. this.doSearch();
  189. },
  190. pageControl(data) {
  191. this.activeName = data.name;
  192. this.doSearch();
  193. },
  194. addConfig() {
  195. this.$router.push({ path: "/scenePacketList" });
  196. },
  197. shareRow(row) {
  198. this.$confirm("确认是否分享?", "提示", {
  199. confirmButtonText: "确定",
  200. cancelButtonText: "取消",
  201. type: "warning",
  202. }).then(() => {
  203. this.$axios({
  204. method: "post",
  205. url: this.$api.sceneLibrary.instShareList,
  206. data: {
  207. packageId: row.packageId,
  208. },
  209. }).then((res) => {
  210. if (res.code == 200) {
  211. this.$message.success("分享成功");
  212. } else {
  213. this.$message.error(res.message || "分享失败");
  214. }
  215. this.doSearch();
  216. });
  217. });
  218. },
  219. delRow(row) {
  220. this.$confirm("确认是否删除?", "提示", {
  221. confirmButtonText: "确定",
  222. cancelButtonText: "取消",
  223. type: "warning",
  224. }).then((e) => {
  225. this.$axios({
  226. method: "post",
  227. url: this.$api.sceneLibrary.deleteList,
  228. data: {
  229. packageId: row.packageId,
  230. },
  231. }).then((res) => {
  232. if (res.code == 200) {
  233. this.$message.success("删除成功");
  234. } else {
  235. this.$message.error(res.message || "删除失败");
  236. }
  237. this.doSearch();
  238. });
  239. });
  240. },
  241. editRow(row) {
  242. this.$router.push({
  243. path: "/scenePacketList",
  244. query: { packageId: row.packageId, share: row.share },
  245. });
  246. },
  247. },
  248. // created() {},
  249. };
  250. </script>
  251. <style scoped lang="less">
  252. </style>