| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501 |
- <template>
- <div class="app-container">
- <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px" @submit.native.prevent>
- <el-form-item label="地图名称" prop="name">
- <el-input
- v-model="queryParams.name"
- placeholder="请输入地图名称"
- clearable
- style="width: 240px"
- @keyup.enter.native="handleQuery"
- />
- </el-form-item>
- <el-form-item>
- <el-button v-no-more-click type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
- <el-button v-no-more-click icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
- </el-form-item>
- </el-form>
- <el-row :gutter="10" class="mb8">
- <el-col :span="1.5">
- <el-button v-no-more-click
- type="primary"
- plain
- icon="el-icon-plus"
- size="mini"
- @click="handleAdd"
- v-hasPermi="['iscs:map:add']"
- >新增</el-button>
- </el-col>
- <el-button
- v-no-more-click
- type="info"
- plain
- icon="el-icon-upload2"
- size="mini"
- @click="handleOpenImport"
- v-show="sysAttrValue=='true'"
- >指纹人脸导入</el-button
- >
- <el-col :span="1.5">
- <el-button v-no-more-click
- type="danger"
- plain
- icon="el-icon-delete"
- size="mini"
- :disabled="multiple"
- @click="handleDelete"
- v-hasPermi="['iscs:map:remove']"
- >删除</el-button>
- </el-col>
- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
- </el-row>
- <el-table v-loading="loading" :data="List" @selection-change="handleSelectionChange">
- <el-table-column type="selection" width="50" align="center"/>
- <el-table-column label="地图编号" align="center" prop="id" ></el-table-column>
- <el-table-column label="地图名称" align="center" prop="name">
- <template slot-scope="scope">
- <span>{{ scope.row.name }}</span>
- </template>
- </el-table-column>
- <el-table-column label="地图简称" align="center" prop="shortName" >
- <template slot-scope="scope">
- <span>{{ scope.row.shortName }}</span>
- </template>
- </el-table-column>
- <el-table-column label="地图图片" align="left" prop="imageUrl" :show-overflow-tooltip="true" >
- <template slot-scope="scope">
- <div class="img-box" v-if="scope.row.imageUrl">
- <el-image
- style="width: 75px; height: 75px"
- :preview-teleported="true"
- class="images"
- :hide-on-click-modal="true"
- :src="scope.row.imageUrl"
- :zoom-rate="1.2"
- :preview-src-list="[scope.row.imageUrl]"
- :initial-index="1"
- >
- </el-image>
- <i class="el-icon-zoom-in" id="eyeicon"></i>
- </div>
- <span v-else>-</span>
- </template>
- </el-table-column>
- <el-table-column label="地图宽度" align="center" prop="width" >
- </el-table-column>
- <el-table-column label="地图高度" align="center" prop="height" >
- </el-table-column>
- <el-table-column label="横坐标" align="center" prop="x" >
- </el-table-column>
- <el-table-column label="纵坐标" align="center" prop="y" >
- </el-table-column>
- <el-table-column label="创建时间" align="center" prop="createTime" >
- <template slot-scope="scope">
- <span>{{ scope.row.createTime }}</span>
- </template>
- </el-table-column>
- <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
- <template slot-scope="scope">
- <el-button v-no-more-click
- size="mini"
- type="text"
- icon="el-icon-edit"
- @click="handleUpdate(scope.row)"
- v-hasPermi="['iscs:map:edit']"
- >修改</el-button>
- <!-- <el-button v-no-more-click-->
- <!-- size="mini"-->
- <!-- type="text"-->
- <!-- icon="el-icon-edit"-->
- <!-- @click="handleDetail(scope.row)"-->
- <!-- v-hasPermi="['iscs:map:edit']"-->
- <!-- >详情</el-button>-->
- <el-button v-no-more-click
- size="mini"
- type="text"
- icon="el-icon-delete"
- @click="handleDelete(scope.row)"
- v-hasPermi="['iscs:map:remove']"
- >删除</el-button>
- </template>
- </el-table-column>
- </el-table>
- <pagination
- v-show="total>0"
- :total="total"
- :page.sync="queryParams.current"
- :limit.sync="queryParams.size"
- @pagination="getList"
- />
- <!-- 添加或修改参数配置对话框 -->
- <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
- <el-form ref="form" :model="form" :rules="rules" label-width="80px">
- <el-form-item label="地图名称" prop="name">
- <el-input v-model="form.name" placeholder="请输入地图名称" />
- </el-form-item>
- <el-form-item label="地图简称" prop="shortName">
- <el-input v-model="form.shortName" placeholder="请输入地图名称" />
- </el-form-item>
- <el-form-item label="地图图片" prop="imageUrl">
- <ImageUploadSingle
- :limit="1"
- :value="form.imageUrl"
- :fileSize="5"
- @onUploaded="handleIconUplaoded"
- @onRemoved="handleIconRemoved"
- ></ImageUploadSingle>
- </el-form-item>
- <el-form-item label="图片宽度" prop="width">
- <el-input v-model="form.width" placeholder="请输入图片宽度" />
- </el-form-item>
- <el-form-item label="图片高度" prop="height">
- <el-input v-model="form.height" placeholder="请输入图片高度" />
- </el-form-item>
- <el-form-item label="横坐标" prop="x">
- <el-input v-model="form.x" placeholder="请输入横坐标" />
- </el-form-item>
- <el-form-item label="纵坐标" prop="y">
- <el-input v-model="form.y" placeholder="请输入纵坐标" />
- </el-form-item>
- </el-form>
- <div slot="footer" class="dialog-footer">
- <el-button v-no-more-click type="primary" @click="submitForm">确 定</el-button>
- <el-button v-no-more-click @click="cancel">取 消</el-button>
- </div>
- </el-dialog>
- <!-- 车总测试-->
- <el-dialog :visible.sync="ImportVisible" width="500px" append-to-body>
- <el-form ref="form" :model="ImportForm" :rules="rules" label-width="80px">
- <el-form-item label="userName" prop="userName">
- <el-input v-model="ImportForm.userName" placeholder="请输入userName" />
- </el-form-item>
- <el-button
- type="info"
- plain
- icon="el-icon-upload2"
- size="mini"
- @click="handleImport('fingerprint')"
- >指纹导入</el-button>
- <el-button
- type="info"
- plain
- icon="el-icon-upload2"
- size="mini"
- @click="handleImport('face')"
- >人脸导入</el-button>
- <el-button
- type="success"
- plain
- icon="el-icon-user"
- size="mini"
- @click="handleImport('loginFingerprint')"
- >指纹登录</el-button>
- <el-button
- type="success"
- plain
- icon="el-icon-user-solid"
- size="mini"
- @click="handleImport('loginFace')"
- >人脸登录</el-button>
- </el-form>
- </el-dialog>
- <!-- 车总测试-->
- <el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
- <el-upload
- ref="upload"
- :limit="1"
- accept=".xlsx, .xls,.png,.jpg,.jpeg,.doc,.docx,.pdf"
- :headers="upload.headers"
- :action="upload.needUserName
- ? upload.url + '?userName=' + upload.userName
- : upload.url"
- :disabled="upload.isUploading"
- :on-progress="handleFileUploadProgress"
- :on-success="handleFileSuccess"
- :auto-upload="false"
- drag
- >
- <i class="el-icon-upload"></i>
- <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
- <div class="el-upload__tip text-center" slot="tip">
- <div class="el-upload__tip" slot="tip">
- <el-checkbox v-model="upload.userName" /> 是否更新已经存在的设备数据
- </div>
- <span>仅允许导入xls、xlsx格式文件。</span>
- </div>
- </el-upload>
- <div slot="footer" class="dialog-footer">
- <el-button v-no-more-click type="primary" @click="submitFileForm">确 定</el-button>
- <el-button v-no-more-click @click="upload.open = false">取 消</el-button>
- </div>
- </el-dialog>
- </div>
- </template>
- <script>
- import { deleteIsMapByIds, getIsMapPage, insertIsMap, selectIsMapById, updateIsMap } from '@/api/system/mapconfig'
- import { getToken } from '@/utils/auth'
- import { getIsSystemAttributeByKey } from '@/api/system/configuration'
- export default {
- name: "autoCodeRule",
- dicts: ['sys_yes_no'],
- data() {
- return {
- // 遮罩层
- loading: true,
- // 选中数组
- ids: [],
- // 非单个禁用
- single: true,
- // 非多个禁用
- multiple: true,
- // 显示搜索条件
- showSearch: true,
- // 总条数
- total: 0,
- // 字典表格数据
- List: [],
- // 弹出层标题
- title: "",
- // 是否显示弹出层
- open: false,
- // 查询参数
- queryParams: {
- current: 1,
- size: 10,
- name:undefined,
- },
- // 表单参数
- form: {},
- ImportVisible:false,//车总测试导入
- ImportForm:{},//车总测试
- // 车总测试 用户导入参数
- upload: {
- // 是否显示弹出层(用户导入)
- open: false,
- // 弹出层标题(用户导入)
- title: "",
- // 是否禁用上传
- isUploading: false,
- // 是否更新已经存在的用户数据
- userName: 0,
- needUserName:true,
- // 设置上传的请求头部
- headers: { Authorization: "Bearer " + getToken() },
- // 上传的地址
- url: ''
- },
- sysAttrValue:null,//判断是否显示导入按钮
- // 表单校验
- rules: {
- name: [
- { required: true, message: "地图名称", trigger: "blur" }
- ],
- imageUrl: [
- { required: true, message: "地图图片", trigger: "blur" }
- ]
- }
- };
- },
- created() {
- this.getList();
- },
- methods: {
- // 车总测试用的
- handleImport(type) {
- this.upload.title = "导入";
- this.upload.open = true;
- this.upload.userName=this.ImportForm.userName;
- this.upload.needUserName = type === "fingerprint" || type === "face";
- this.upload.url =
- process.env.VUE_APP_BASE_API +
- (type === "fingerprint"
- ? "/system/user/characteristic/insertUserFingerprintDat"
- : type === "face"
- ? "/system/user/characteristic/insertUserFace"
- : type === "loginFingerprint"
- ? "/loginByFingerprintDat"
- : "/loginByArcFace");
- },
- handleOpenImport(){
- this.ImportVisible = true;
- },
- // 文件上传中处理
- handleFileUploadProgress(event, file, fileList) {
- this.upload.isUploading = true;
- },
- // 文件上传成功处理
- handleFileSuccess(response, file, fileList) {
- this.upload.open = false;
- this.upload.isUploading = false;
- this.$refs.upload.clearFiles();
- this.$alert(
- "<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" +
- response.msg +
- "</div>",
- "导入结果",
- { dangerouslyUseHTMLString: true }
- );
- this.getList();
- },
- // 提交上传文件
- submitFileForm() {
- this.$refs.upload.submit();
- },
- // 上面都是车总测试
- handleDetail(row){
- selectIsMapById(row.id).then((res)=>{
- console.log(res);
- })
- },
- /** 查询字典类型列表 */
- getList() {
- this.loading = true;
- getIsMapPage(this.queryParams).then(response => {
- this.List = response.data.records;
- this.total = response.data.total;
- this.loading = false;
- }
- );
- const sysAttrKey ='sys.finger.face'
- getIsSystemAttributeByKey(sysAttrKey).then(response => {
- console.log(response, '获取物资柜底图')
- this.sysAttrValue = response.data.sysAttrValue
- })
- },
- // 取消按钮
- cancel() {
- this.open = false;
- this.reset();
- },
- // 表单重置
- reset() {
- this.form = {
- attribute:"",
- value:"",
- };
- this.resetForm("form");
- },
- /** 搜索按钮操作 */
- handleQuery() {
- this.queryParams.current = 1;
- this.getList();
- },
- /** 重置按钮操作 */
- resetQuery() {
- this.resetForm("queryForm");
- this.handleQuery();
- },
- /** 新增按钮操作 */
- handleAdd() {
- this.reset();
- this.open = true;
- this.title = "添加地图数据";
- },
- // 多选框选中数据
- handleSelectionChange(selection) {
- this.ids = selection.map(item => item.id)
- this.single = selection.length!=1
- this.multiple = !selection.length
- },
- /** 修改按钮操作 */
- handleUpdate(row) {
- this.reset();
- const ruleId = row.id || this.ids
- selectIsMapById(ruleId).then(response => {
- this.form = response.data;
- this.open = true;
- this.title = "修改地图数据";
- });
- },
- /** 提交按钮 */
- submitForm: function() {
- this.$refs["form"].validate(valid => {
- if (valid) {
- if (this.form.id != undefined) {
- updateIsMap(this.form).then(response => {
- this.$modal.msgSuccess("修改成功");
- this.open = false;
- this.getList();
- });
- } else {
- insertIsMap(this.form).then(response => {
- this.$modal.msgSuccess("新增成功");
- this.open = false;
- this.getList();
- });
- }
- }
- });
- },
- //图标上传成功
- handleIconUplaoded(imgUrl) {
- this.form.imageUrl = imgUrl[0].url
- },
- // 图标移除
- handleIconRemoved(imgUrl) {
- this.form.imageUrl = null
- },
- /** 删除按钮操作 */
- handleDelete(row) {
- debugger;
- const ruleIds = row.id || this.ids;
- this.$modal.confirm('是否确认删除所选数据项?').then(function() {
- return deleteIsMapByIds(ruleIds);
- }).then(() => {
- this.getList();
- this.$modal.msgSuccess("删除成功");
- }).catch(() => {});
- },
- }
- };
- </script>
- <style scoped lang="scss">
- //图片放大
- .img-box {
- width: 75px;
- height: 75px;
- position: relative;
- #eyeicon {
- display: none;
- }
- }
- .img-box:hover {
- background: #000;
- .images {
- opacity: 0.6;
- }
- #eyeicon {
- display: block;
- position: absolute;
- top: 40%;
- left: 40%;
- z-index: 100;
- color: white;
- pointer-events: none;
- }
- }
- </style>
|