index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px" @submit.native.prevent>
  4. <el-form-item label="地图名称" prop="name">
  5. <el-input
  6. v-model="queryParams.name"
  7. placeholder="请输入地图名称"
  8. clearable
  9. style="width: 240px"
  10. @keyup.enter.native="handleQuery"
  11. />
  12. </el-form-item>
  13. <el-form-item>
  14. <el-button v-no-more-click type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  15. <el-button v-no-more-click icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  16. </el-form-item>
  17. </el-form>
  18. <el-row :gutter="10" class="mb8">
  19. <el-col :span="1.5">
  20. <el-button v-no-more-click
  21. type="primary"
  22. plain
  23. icon="el-icon-plus"
  24. size="mini"
  25. @click="handleAdd"
  26. v-hasPermi="['iscs:map:add']"
  27. >新增</el-button>
  28. </el-col>
  29. <el-button
  30. v-no-more-click
  31. type="info"
  32. plain
  33. icon="el-icon-upload2"
  34. size="mini"
  35. @click="handleOpenImport"
  36. v-show="sysAttrValue=='true'"
  37. >指纹人脸导入</el-button
  38. >
  39. <el-col :span="1.5">
  40. <el-button v-no-more-click
  41. type="danger"
  42. plain
  43. icon="el-icon-delete"
  44. size="mini"
  45. :disabled="multiple"
  46. @click="handleDelete"
  47. v-hasPermi="['iscs:map:remove']"
  48. >删除</el-button>
  49. </el-col>
  50. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  51. </el-row>
  52. <el-table v-loading="loading" :data="List" @selection-change="handleSelectionChange">
  53. <el-table-column type="selection" width="50" align="center"/>
  54. <el-table-column label="地图编号" align="center" prop="id" ></el-table-column>
  55. <el-table-column label="地图名称" align="center" prop="name">
  56. <template slot-scope="scope">
  57. <span>{{ scope.row.name }}</span>
  58. </template>
  59. </el-table-column>
  60. <el-table-column label="地图简称" align="center" prop="shortName" >
  61. <template slot-scope="scope">
  62. <span>{{ scope.row.shortName }}</span>
  63. </template>
  64. </el-table-column>
  65. <el-table-column label="地图图片" align="left" prop="imageUrl" :show-overflow-tooltip="true" >
  66. <template slot-scope="scope">
  67. <div class="img-box" v-if="scope.row.imageUrl">
  68. <el-image
  69. style="width: 75px; height: 75px"
  70. :preview-teleported="true"
  71. class="images"
  72. :hide-on-click-modal="true"
  73. :src="scope.row.imageUrl"
  74. :zoom-rate="1.2"
  75. :preview-src-list="[scope.row.imageUrl]"
  76. :initial-index="1"
  77. >
  78. </el-image>
  79. <i class="el-icon-zoom-in" id="eyeicon"></i>
  80. </div>
  81. <span v-else>-</span>
  82. </template>
  83. </el-table-column>
  84. <el-table-column label="地图宽度" align="center" prop="width" >
  85. </el-table-column>
  86. <el-table-column label="地图高度" align="center" prop="height" >
  87. </el-table-column>
  88. <el-table-column label="横坐标" align="center" prop="x" >
  89. </el-table-column>
  90. <el-table-column label="纵坐标" align="center" prop="y" >
  91. </el-table-column>
  92. <el-table-column label="创建时间" align="center" prop="createTime" >
  93. <template slot-scope="scope">
  94. <span>{{ scope.row.createTime }}</span>
  95. </template>
  96. </el-table-column>
  97. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  98. <template slot-scope="scope">
  99. <el-button v-no-more-click
  100. size="mini"
  101. type="text"
  102. icon="el-icon-edit"
  103. @click="handleUpdate(scope.row)"
  104. v-hasPermi="['iscs:map:edit']"
  105. >修改</el-button>
  106. <!-- <el-button v-no-more-click-->
  107. <!-- size="mini"-->
  108. <!-- type="text"-->
  109. <!-- icon="el-icon-edit"-->
  110. <!-- @click="handleDetail(scope.row)"-->
  111. <!-- v-hasPermi="['iscs:map:edit']"-->
  112. <!-- >详情</el-button>-->
  113. <el-button v-no-more-click
  114. size="mini"
  115. type="text"
  116. icon="el-icon-delete"
  117. @click="handleDelete(scope.row)"
  118. v-hasPermi="['iscs:map:remove']"
  119. >删除</el-button>
  120. </template>
  121. </el-table-column>
  122. </el-table>
  123. <pagination
  124. v-show="total>0"
  125. :total="total"
  126. :page.sync="queryParams.current"
  127. :limit.sync="queryParams.size"
  128. @pagination="getList"
  129. />
  130. <!-- 添加或修改参数配置对话框 -->
  131. <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
  132. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  133. <el-form-item label="地图名称" prop="name">
  134. <el-input v-model="form.name" placeholder="请输入地图名称" />
  135. </el-form-item>
  136. <el-form-item label="地图简称" prop="shortName">
  137. <el-input v-model="form.shortName" placeholder="请输入地图名称" />
  138. </el-form-item>
  139. <el-form-item label="地图图片" prop="imageUrl">
  140. <ImageUploadSingle
  141. :limit="1"
  142. :value="form.imageUrl"
  143. :fileSize="5"
  144. @onUploaded="handleIconUplaoded"
  145. @onRemoved="handleIconRemoved"
  146. ></ImageUploadSingle>
  147. </el-form-item>
  148. <el-form-item label="图片宽度" prop="width">
  149. <el-input v-model="form.width" placeholder="请输入图片宽度" />
  150. </el-form-item>
  151. <el-form-item label="图片高度" prop="height">
  152. <el-input v-model="form.height" placeholder="请输入图片高度" />
  153. </el-form-item>
  154. <el-form-item label="横坐标" prop="x">
  155. <el-input v-model="form.x" placeholder="请输入横坐标" />
  156. </el-form-item>
  157. <el-form-item label="纵坐标" prop="y">
  158. <el-input v-model="form.y" placeholder="请输入纵坐标" />
  159. </el-form-item>
  160. </el-form>
  161. <div slot="footer" class="dialog-footer">
  162. <el-button v-no-more-click type="primary" @click="submitForm">确 定</el-button>
  163. <el-button v-no-more-click @click="cancel">取 消</el-button>
  164. </div>
  165. </el-dialog>
  166. <!-- 车总测试-->
  167. <el-dialog :visible.sync="ImportVisible" width="500px" append-to-body>
  168. <el-form ref="form" :model="ImportForm" :rules="rules" label-width="80px">
  169. <el-form-item label="userName" prop="userName">
  170. <el-input v-model="ImportForm.userName" placeholder="请输入userName" />
  171. </el-form-item>
  172. <el-button
  173. type="info"
  174. plain
  175. icon="el-icon-upload2"
  176. size="mini"
  177. @click="handleImport('fingerprint')"
  178. >指纹导入</el-button>
  179. <el-button
  180. type="info"
  181. plain
  182. icon="el-icon-upload2"
  183. size="mini"
  184. @click="handleImport('face')"
  185. >人脸导入</el-button>
  186. <el-button
  187. type="success"
  188. plain
  189. icon="el-icon-user"
  190. size="mini"
  191. @click="handleImport('loginFingerprint')"
  192. >指纹登录</el-button>
  193. <el-button
  194. type="success"
  195. plain
  196. icon="el-icon-user-solid"
  197. size="mini"
  198. @click="handleImport('loginFace')"
  199. >人脸登录</el-button>
  200. </el-form>
  201. </el-dialog>
  202. <!-- 车总测试-->
  203. <el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
  204. <el-upload
  205. ref="upload"
  206. :limit="1"
  207. accept=".xlsx, .xls,.png,.jpg,.jpeg,.doc,.docx,.pdf"
  208. :headers="upload.headers"
  209. :action="upload.needUserName
  210. ? upload.url + '?userName=' + upload.userName
  211. : upload.url"
  212. :disabled="upload.isUploading"
  213. :on-progress="handleFileUploadProgress"
  214. :on-success="handleFileSuccess"
  215. :auto-upload="false"
  216. drag
  217. >
  218. <i class="el-icon-upload"></i>
  219. <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
  220. <div class="el-upload__tip text-center" slot="tip">
  221. <div class="el-upload__tip" slot="tip">
  222. <el-checkbox v-model="upload.userName" /> 是否更新已经存在的设备数据
  223. </div>
  224. <span>仅允许导入xls、xlsx格式文件。</span>
  225. </div>
  226. </el-upload>
  227. <div slot="footer" class="dialog-footer">
  228. <el-button v-no-more-click type="primary" @click="submitFileForm">确 定</el-button>
  229. <el-button v-no-more-click @click="upload.open = false">取 消</el-button>
  230. </div>
  231. </el-dialog>
  232. </div>
  233. </template>
  234. <script>
  235. import { deleteIsMapByIds, getIsMapPage, insertIsMap, selectIsMapById, updateIsMap } from '@/api/system/mapconfig'
  236. import { getToken } from '@/utils/auth'
  237. import { getIsSystemAttributeByKey } from '@/api/system/configuration'
  238. export default {
  239. name: "autoCodeRule",
  240. dicts: ['sys_yes_no'],
  241. data() {
  242. return {
  243. // 遮罩层
  244. loading: true,
  245. // 选中数组
  246. ids: [],
  247. // 非单个禁用
  248. single: true,
  249. // 非多个禁用
  250. multiple: true,
  251. // 显示搜索条件
  252. showSearch: true,
  253. // 总条数
  254. total: 0,
  255. // 字典表格数据
  256. List: [],
  257. // 弹出层标题
  258. title: "",
  259. // 是否显示弹出层
  260. open: false,
  261. // 查询参数
  262. queryParams: {
  263. current: 1,
  264. size: 10,
  265. name:undefined,
  266. },
  267. // 表单参数
  268. form: {},
  269. ImportVisible:false,//车总测试导入
  270. ImportForm:{},//车总测试
  271. // 车总测试 用户导入参数
  272. upload: {
  273. // 是否显示弹出层(用户导入)
  274. open: false,
  275. // 弹出层标题(用户导入)
  276. title: "",
  277. // 是否禁用上传
  278. isUploading: false,
  279. // 是否更新已经存在的用户数据
  280. userName: 0,
  281. needUserName:true,
  282. // 设置上传的请求头部
  283. headers: { Authorization: "Bearer " + getToken() },
  284. // 上传的地址
  285. url: ''
  286. },
  287. sysAttrValue:null,//判断是否显示导入按钮
  288. // 表单校验
  289. rules: {
  290. name: [
  291. { required: true, message: "地图名称", trigger: "blur" }
  292. ],
  293. imageUrl: [
  294. { required: true, message: "地图图片", trigger: "blur" }
  295. ]
  296. }
  297. };
  298. },
  299. created() {
  300. this.getList();
  301. },
  302. methods: {
  303. // 车总测试用的
  304. handleImport(type) {
  305. this.upload.title = "导入";
  306. this.upload.open = true;
  307. this.upload.userName=this.ImportForm.userName;
  308. this.upload.needUserName = type === "fingerprint" || type === "face";
  309. this.upload.url =
  310. process.env.VUE_APP_BASE_API +
  311. (type === "fingerprint"
  312. ? "/system/user/characteristic/insertUserFingerprintDat"
  313. : type === "face"
  314. ? "/system/user/characteristic/insertUserFace"
  315. : type === "loginFingerprint"
  316. ? "/loginByFingerprintDat"
  317. : "/loginByArcFace");
  318. },
  319. handleOpenImport(){
  320. this.ImportVisible = true;
  321. },
  322. // 文件上传中处理
  323. handleFileUploadProgress(event, file, fileList) {
  324. this.upload.isUploading = true;
  325. },
  326. // 文件上传成功处理
  327. handleFileSuccess(response, file, fileList) {
  328. this.upload.open = false;
  329. this.upload.isUploading = false;
  330. this.$refs.upload.clearFiles();
  331. this.$alert(
  332. "<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" +
  333. response.msg +
  334. "</div>",
  335. "导入结果",
  336. { dangerouslyUseHTMLString: true }
  337. );
  338. this.getList();
  339. },
  340. // 提交上传文件
  341. submitFileForm() {
  342. this.$refs.upload.submit();
  343. },
  344. // 上面都是车总测试
  345. handleDetail(row){
  346. selectIsMapById(row.id).then((res)=>{
  347. console.log(res);
  348. })
  349. },
  350. /** 查询字典类型列表 */
  351. getList() {
  352. this.loading = true;
  353. getIsMapPage(this.queryParams).then(response => {
  354. this.List = response.data.records;
  355. this.total = response.data.total;
  356. this.loading = false;
  357. }
  358. );
  359. const sysAttrKey ='sys.finger.face'
  360. getIsSystemAttributeByKey(sysAttrKey).then(response => {
  361. console.log(response, '获取物资柜底图')
  362. this.sysAttrValue = response.data.sysAttrValue
  363. })
  364. },
  365. // 取消按钮
  366. cancel() {
  367. this.open = false;
  368. this.reset();
  369. },
  370. // 表单重置
  371. reset() {
  372. this.form = {
  373. attribute:"",
  374. value:"",
  375. };
  376. this.resetForm("form");
  377. },
  378. /** 搜索按钮操作 */
  379. handleQuery() {
  380. this.queryParams.current = 1;
  381. this.getList();
  382. },
  383. /** 重置按钮操作 */
  384. resetQuery() {
  385. this.resetForm("queryForm");
  386. this.handleQuery();
  387. },
  388. /** 新增按钮操作 */
  389. handleAdd() {
  390. this.reset();
  391. this.open = true;
  392. this.title = "添加地图数据";
  393. },
  394. // 多选框选中数据
  395. handleSelectionChange(selection) {
  396. this.ids = selection.map(item => item.id)
  397. this.single = selection.length!=1
  398. this.multiple = !selection.length
  399. },
  400. /** 修改按钮操作 */
  401. handleUpdate(row) {
  402. this.reset();
  403. const ruleId = row.id || this.ids
  404. selectIsMapById(ruleId).then(response => {
  405. this.form = response.data;
  406. this.open = true;
  407. this.title = "修改地图数据";
  408. });
  409. },
  410. /** 提交按钮 */
  411. submitForm: function() {
  412. this.$refs["form"].validate(valid => {
  413. if (valid) {
  414. if (this.form.id != undefined) {
  415. updateIsMap(this.form).then(response => {
  416. this.$modal.msgSuccess("修改成功");
  417. this.open = false;
  418. this.getList();
  419. });
  420. } else {
  421. insertIsMap(this.form).then(response => {
  422. this.$modal.msgSuccess("新增成功");
  423. this.open = false;
  424. this.getList();
  425. });
  426. }
  427. }
  428. });
  429. },
  430. //图标上传成功
  431. handleIconUplaoded(imgUrl) {
  432. this.form.imageUrl = imgUrl[0].url
  433. },
  434. // 图标移除
  435. handleIconRemoved(imgUrl) {
  436. this.form.imageUrl = null
  437. },
  438. /** 删除按钮操作 */
  439. handleDelete(row) {
  440. debugger;
  441. const ruleIds = row.id || this.ids;
  442. this.$modal.confirm('是否确认删除所选数据项?').then(function() {
  443. return deleteIsMapByIds(ruleIds);
  444. }).then(() => {
  445. this.getList();
  446. this.$modal.msgSuccess("删除成功");
  447. }).catch(() => {});
  448. },
  449. }
  450. };
  451. </script>
  452. <style scoped lang="scss">
  453. //图片放大
  454. .img-box {
  455. width: 75px;
  456. height: 75px;
  457. position: relative;
  458. #eyeicon {
  459. display: none;
  460. }
  461. }
  462. .img-box:hover {
  463. background: #000;
  464. .images {
  465. opacity: 0.6;
  466. }
  467. #eyeicon {
  468. display: block;
  469. position: absolute;
  470. top: 40%;
  471. left: 40%;
  472. z-index: 100;
  473. color: white;
  474. pointer-events: none;
  475. }
  476. }
  477. </style>