vehicleConfigurationList.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372
  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. @keyup.enter.native="doSearch"
  13. >
  14. </el-input>
  15. </template>
  16. <template slot="searchItem2">
  17. <span class="label">配置名称</span>
  18. <el-input
  19. v-model="searchParams.configName"
  20. size="small"
  21. clearable
  22. placeholder="请输入"
  23. maxlength="60"
  24. @keyup.enter.native="doSearch"
  25. >
  26. </el-input>
  27. </template>
  28. <template slot="searchItem3">
  29. <span class="label">配置描述</span>
  30. <el-input
  31. v-model="searchParams.configDescription"
  32. size="small"
  33. clearable
  34. placeholder="请输入"
  35. maxlength="200"
  36. @keyup.enter.native="doSearch"
  37. >
  38. </el-input>
  39. </template>
  40. <template slot="searchItem4">
  41. <span class="label">车辆名称</span>
  42. <el-input
  43. v-model="searchParams.vehicleName"
  44. size="small"
  45. clearable
  46. placeholder="请输入"
  47. maxlength="60"
  48. @keyup.enter.native="doSearch"
  49. >
  50. </el-input>
  51. </template>
  52. <template slot="searchItem5">
  53. <span class="label">车辆描述</span>
  54. <el-input
  55. v-model="searchParams.vehicleDescription"
  56. size="small"
  57. clearable
  58. placeholder="请输入"
  59. maxlength="200"
  60. @keyup.enter.native="doSearch"
  61. >
  62. </el-input>
  63. </template>
  64. <template slot="searchBtn1">
  65. <el-button type="primary" @click="doSearch">查询</el-button>
  66. </template>
  67. <template slot="searchBtn2">
  68. <el-button type="primary" @click="doReset">重置</el-button>
  69. </template>
  70. </search-layout>
  71. <div class="myTabsBox">
  72. <el-tabs v-model="activeName" type="card" @tab-click="pageControl">
  73. <el-tab-pane label="公有" name="1"></el-tab-pane>
  74. <el-tab-pane label="私有" name="2"></el-tab-pane>
  75. </el-tabs>
  76. <el-button
  77. v-bind:class="{ addBtn: true, disabled: activeName === '1' }"
  78. icon="el-icon-circle-plus-outline"
  79. @click="addOne"
  80. type="primary"
  81. :disabled="activeName === '1'"
  82. >新增</el-button
  83. >
  84. </div>
  85. <tableList
  86. ref="table"
  87. class="myTable"
  88. style="margin: 0 30px"
  89. :columns="columns"
  90. :getDataWay="getDataWay"
  91. :pagination="pagination"
  92. index
  93. >
  94. <el-table-column
  95. label="传感器配置"
  96. slot="sensorCount"
  97. align="center"
  98. >
  99. <template v-slot="scope">
  100. <i
  101. class="sensorIcon sensorIconA"
  102. v-show="scope.row.sensorCount.camera"
  103. title="摄像头"
  104. ></i
  105. ><span
  106. class="sensorCount"
  107. v-show="scope.row.sensorCount.camera"
  108. >{{ scope.row.sensorCount.camera }}</span
  109. >
  110. <i
  111. class="sensorIcon sensorIconB"
  112. v-show="scope.row.sensorCount.ogt"
  113. title="完美传感器"
  114. ></i
  115. ><span
  116. class="sensorCount"
  117. v-show="scope.row.sensorCount.ogt"
  118. >{{ scope.row.sensorCount.ogt }}</span
  119. >
  120. <i
  121. class="sensorIcon sensorIconC"
  122. v-show="scope.row.sensorCount.lidar"
  123. title="激光雷达"
  124. ></i
  125. ><span
  126. class="sensorCount"
  127. v-show="scope.row.sensorCount.lidar"
  128. >{{ scope.row.sensorCount.lidar }}</span
  129. >
  130. <i
  131. class="sensorIcon sensorIconE"
  132. v-show="scope.row.sensorCount.gps"
  133. title="GPS"
  134. ></i
  135. ><span
  136. class="sensorCount"
  137. v-show="scope.row.sensorCount.gps"
  138. >{{ scope.row.sensorCount.gps }}</span
  139. >
  140. </template>
  141. </el-table-column>
  142. <el-table-column label="操作" slot="cgInfos" align="center">
  143. <template v-slot="scope">
  144. <i
  145. v-if="activeName === '2'"
  146. @click="shareRow(scope.row)"
  147. class="el-icon-share elIcon"
  148. title="分享"
  149. ></i>
  150. <i
  151. @click="editRow(scope.row)"
  152. class="el-icon-edit-outline elIcon"
  153. title="编辑"
  154. ></i>
  155. <i
  156. v-if="activeName === '2'"
  157. @click="delOne(scope.row)"
  158. class="el-icon-delete elIcon"
  159. title="删除"
  160. ></i>
  161. </template>
  162. </el-table-column>
  163. </tableList>
  164. </div>
  165. </template>
  166. <script>
  167. import searchLayout from "@/components/grid/searchLayout";
  168. import tableList from "@/components/grid/TableList";
  169. import toolbarTab from "@/components/toolbar/toolbarTab";
  170. export default {
  171. name: "vehicleConfigurationList", // 车辆配置
  172. components: { searchLayout, tableList, toolbarTab },
  173. data() {
  174. return {
  175. searchParams: {
  176. // 搜索参数
  177. configCode: "", // 配置ID
  178. configName: "", // 配置名称
  179. configDescription: "", // 配置描述
  180. vehicleName: "", // 车辆名称
  181. vehicleDescription: "", // 车辆描述
  182. },
  183. activeName: "2",
  184. columns: [
  185. {
  186. label: "配置ID",
  187. prop: "configCode",
  188. },
  189. {
  190. label: "配置名称",
  191. prop: "configName",
  192. },
  193. {
  194. label: "配置描述",
  195. prop: "configDescription",
  196. // showOverflowTooltip: true,
  197. },
  198. {
  199. label: "车辆名称",
  200. prop: "vehicleName",
  201. },
  202. {
  203. label: "车辆描述",
  204. prop: "vehicleDescription",
  205. },
  206. {
  207. label: "传感器配置",
  208. prop: "sensorCount",
  209. template: true,
  210. },
  211. {
  212. label: "操作",
  213. prop: "cgInfos",
  214. template: true,
  215. },
  216. ],
  217. pagination: {
  218. //分页使用
  219. currentPage: 1,
  220. pageSize: 10,
  221. position: "right",
  222. pageSizes: [10, 30, 50, 100, 200],
  223. layout: "sizes, total, prev, pager, next, jumper",
  224. },
  225. getDataWay: {
  226. //加载表格数据
  227. dataType: "url",
  228. type: "post",
  229. // firstRequest: false,
  230. data: this.$api.modelLibrary.getConfigPageList,
  231. param: {
  232. share: "0",
  233. },
  234. },
  235. };
  236. },
  237. methods: {
  238. pageControl(data) {
  239. this.activeName = data.name;
  240. this.doSearch();
  241. },
  242. doSearch() {
  243. let pageMap = {
  244. ...this.searchParams,
  245. share: this.activeName === "1" ? "1" : "0",
  246. };
  247. this.refreshList(pageMap);
  248. },
  249. //刷新table
  250. refreshList(param) {
  251. param
  252. ? this.$refs["table"].loadData(param)
  253. : this.$refs["table"].loadData();
  254. },
  255. doReset() {
  256. this.searchParams = {
  257. configCode: "",
  258. configName: "",
  259. configDescription: "",
  260. vehicleName: "",
  261. vehicleDescription: "",
  262. };
  263. this.doSearch();
  264. },
  265. addOne() {
  266. this.$router.push({ path: "/vehicleConfigurationDetail" });
  267. },
  268. editRow(row) {
  269. this.$router.push({
  270. path: "/vehicleConfigurationDetail",
  271. query: {
  272. id: row.id,
  273. share: row.share,
  274. },
  275. });
  276. },
  277. delOne(row) {
  278. this.$confirm("确认是否删除?", "提示", {
  279. confirmButtonText: "确定",
  280. cancelButtonText: "取消",
  281. type: "warning",
  282. }).then(() => {
  283. this.$axios({
  284. method: "post",
  285. url: this.$api.modelLibrary.delConfigById,
  286. data: {
  287. id: row.id,
  288. },
  289. }).then((res) => {
  290. if (res.code == 200) {
  291. this.$message.success("删除成功");
  292. } else {
  293. this.$message.error(res.message || "删除失败");
  294. }
  295. this.doSearch();
  296. });
  297. });
  298. },
  299. shareRow(row) {
  300. this.$confirm("确认是否分享?", "提示", {
  301. confirmButtonText: "确定",
  302. cancelButtonText: "取消",
  303. type: "warning",
  304. }).then(() => {
  305. this.$axios({
  306. method: "post",
  307. url: this.$api.modelLibrary.shareConfigById,
  308. data: {
  309. id: row.id,
  310. },
  311. }).then((res) => {
  312. if (res.code == 200) {
  313. this.$message.success("分享成功");
  314. } else {
  315. this.$message.error(res.message || "分享失败");
  316. }
  317. this.doSearch();
  318. });
  319. });
  320. },
  321. },
  322. created() {},
  323. };
  324. </script>
  325. <style scoped lang="less">
  326. .myTable {
  327. .sensorIconA {
  328. background: url("../../assets/common/image/sensor/001.png") center
  329. no-repeat;
  330. }
  331. .sensorIconB {
  332. background: url("../../assets/common/image/sensor/002.png") center
  333. no-repeat;
  334. }
  335. .sensorIconC {
  336. background: url("../../assets/common/image/sensor/003.png") center
  337. no-repeat;
  338. }
  339. .sensorIconD {
  340. background: url("../../assets/common/image/sensor/004.png") center
  341. no-repeat;
  342. }
  343. .sensorIconE {
  344. background: url("../../assets/common/image/sensor/005.png") center
  345. no-repeat;
  346. }
  347. .sensorIcon {
  348. display: inline-block;
  349. width: 18px;
  350. height: 18px;
  351. background-size: contain;
  352. vertical-align: middle;
  353. cursor: pointer;
  354. }
  355. .sensorCount {
  356. display: inline-block;
  357. width: 18px;
  358. height: 18px;
  359. margin-right: 6px;
  360. line-height: 18px;
  361. text-align: center;
  362. }
  363. }
  364. </style>