gradingRulesList.vue 9.9 KB

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