vehicleConfigurationList.vue 8.9 KB

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