|
@@ -0,0 +1,249 @@
|
|
|
+<template>
|
|
|
+ <div id="aiConfig w-full" style="width:100%">
|
|
|
+ <div class="page-header">
|
|
|
+ <div class="page-title flex align-center">
|
|
|
+ <el-button icon="el-icon-top" size="mini" style="font-size: 20px; color: #000;" type="text" @click="toBack" ></el-button>
|
|
|
+ <el-divider direction="vertical"></el-divider>
|
|
|
+ <span v-if="!isEdit"> {{ libData.libraryName }}</span>
|
|
|
+ <el-input v-else-if="isEdit" v-model="libraryName">
|
|
|
+ <el-button slot="append" :loading="isLoading" @click="changeLibraryName">确认</el-button>
|
|
|
+ </el-input>
|
|
|
+ </div>
|
|
|
+ <div class="page-header-btn">
|
|
|
+ <el-button icon="el-icon-edit" size="mini" style="font-size: 16px; color: #000;" type="text" :loading="isLoading" @click="editMode" >
|
|
|
+ {{ isEdit?'取消编辑':'编辑' }}</el-button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <el-container v-loading="isLoading" style="width:100%;min-height: 82vh;flex-direction: column;" >
|
|
|
+ <div class="">
|
|
|
+ <el-input class="ml-5 input-with-select" placeholder="输入工人信息片段" v-model="key" >
|
|
|
+ <el-button slot="append"
|
|
|
+ style="width: 80px;"
|
|
|
+ icon="el-icon-search"
|
|
|
+ type="primary"
|
|
|
+ :loading="isLoading"
|
|
|
+ @click="searchLibList">搜索</el-button>
|
|
|
+ </el-input>
|
|
|
+ </div>
|
|
|
+ <el-table :data="itemList" style="width: 100%;font-size: 12px;" header-row-class-name="table-header">
|
|
|
+ <el-table-column prop="itemId" label="id" ></el-table-column>
|
|
|
+ <el-table-column v-if="libData.arithmetic === aiTypes.face" prop="imageUrl" label="照片" min-width="160">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <img class="personImg" :src="`/aiLib/libImg/${scope.row.imageUrl}`" :alt="`${scope.row.itemName}的照片`"/>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="itemName"
|
|
|
+ :label="(libData.arithmetic === aiTypes.face)?'人员名称':'名称'"
|
|
|
+ min-width="160"></el-table-column>
|
|
|
+ <el-table-column prop="itemNo" label="号码" ></el-table-column>
|
|
|
+ <el-table-column v-if="libData.arithmetic === aiTypes.face" prop="idCard" label="身份证号" min-width="160"></el-table-column>
|
|
|
+ <el-table-column v-else-if="libData.arithmetic === aiTypes.face" prop="carNo" label="车牌号" min-width="160"></el-table-column>
|
|
|
+ <el-table-column label="操作" >
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-button size="medium" @click="editLibItemHandle(scope.row)">编辑</el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ <el-pagination
|
|
|
+ style="float: right"
|
|
|
+ @size-change="handleSizeChange"
|
|
|
+ @current-change="currentChange"
|
|
|
+ :current-page="currentPage"
|
|
|
+ :page-size="count"
|
|
|
+ :page-sizes="[15, 25, 35, 50]"
|
|
|
+ layout="total, sizes, prev, pager, next"
|
|
|
+ :total="total"
|
|
|
+ ></el-pagination>
|
|
|
+ </el-container>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import aiMap from "@/map/ai";
|
|
|
+import handle from "@/until/handle";
|
|
|
+
|
|
|
+export default {
|
|
|
+ name: "editLib",
|
|
|
+ data(){
|
|
|
+ return {
|
|
|
+ aiTypes: aiMap.aiTypes,
|
|
|
+ isLoading: false,
|
|
|
+ isEdit: false,
|
|
|
+ libraryId: this.$route.params.libraryId,
|
|
|
+ libData: {},
|
|
|
+ libraryName: '',
|
|
|
+ itemList: {},
|
|
|
+ currentPage: 1,
|
|
|
+ count: 15,
|
|
|
+ total: 1,
|
|
|
+ lastPage: 1,
|
|
|
+ key: '',
|
|
|
+ searchKey: '',
|
|
|
+ }
|
|
|
+ },
|
|
|
+ async mounted(){
|
|
|
+ await this.loadLibInfo();
|
|
|
+ await this.searchLibList();
|
|
|
+ },
|
|
|
+ methods:{
|
|
|
+ async loadLibInfo(){
|
|
|
+ this.isLoading = true;
|
|
|
+ let [err,res] = await handle(this.$axios.get(`/api/device/query/libInfo/${this.libraryId}/`));
|
|
|
+ this.isLoading = false;
|
|
|
+ console.log(res);
|
|
|
+ if(err){
|
|
|
+ console.error(err);
|
|
|
+ return this.$message.error(err.message);
|
|
|
+ }
|
|
|
+ let result = res.data;
|
|
|
+ if(result.code === 0){
|
|
|
+ this.libData = result.data;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ async loadLibItems(searchParam){
|
|
|
+ this.isLoading = true;
|
|
|
+ this.searchKey = searchParam.key;
|
|
|
+ this.searchArithmetic = searchParam.lib;
|
|
|
+ searchParam.libraryId = this.libraryId;
|
|
|
+ let [err,res] = await handle(this.$axios({
|
|
|
+ method: 'get',
|
|
|
+ url: `/api/device/query/libItems`,
|
|
|
+ params: searchParam
|
|
|
+ }))
|
|
|
+ this.isLoading = false;
|
|
|
+ if(err){
|
|
|
+ console.error(err);
|
|
|
+ this.$message.error(err.message);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ console.log('------------');
|
|
|
+ console.log(res)
|
|
|
+ let result = res.data;
|
|
|
+ if(res.data.code === 0){
|
|
|
+ this.total = result.data.total;
|
|
|
+ this.itemList = result.data.list;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ searchLibList(){
|
|
|
+ // 按搜索按钮进行搜索.
|
|
|
+ let searchParam = {
|
|
|
+ page: 1,
|
|
|
+ count: this.count,
|
|
|
+ key: this.key
|
|
|
+ }
|
|
|
+ this.loadLibItems(searchParam);
|
|
|
+ },
|
|
|
+ toBack(){
|
|
|
+ this.$router.back();
|
|
|
+ this.beforeUrl = "/aiLib"
|
|
|
+ },
|
|
|
+ editMode(){
|
|
|
+ if(!this.isEdit){
|
|
|
+ this.libraryName = this.libData.libraryName;
|
|
|
+ this.isEdit = true;
|
|
|
+ }else {
|
|
|
+ this.isEdit = false;
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
+ async changeLibraryName(){
|
|
|
+ this.isLoading = true;
|
|
|
+ let data = {
|
|
|
+ libraryName: this.libraryName,
|
|
|
+ }
|
|
|
+ let [err,res] = await handle(this.$axios.post(`/api/device/query/editLib/${this.libraryId}`,data));
|
|
|
+ this.isLoading = false;
|
|
|
+ console.log(res);
|
|
|
+ if(err){
|
|
|
+ console.error(err);
|
|
|
+ return this.$message.error(err.message);
|
|
|
+ }
|
|
|
+ let result = res.data;
|
|
|
+ if(result.code === 0){
|
|
|
+ this.libData.libraryName = data.libraryName;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ async submitData(){
|
|
|
+ let data = {};
|
|
|
+ data.arithmetic = this.aiTypeVal;
|
|
|
+ data.libraryName = this.libraryName;
|
|
|
+ this.isLoading = true;
|
|
|
+ let [err,res] = await handle(this.$axios.post(
|
|
|
+ '/api/device/config/addLib',data));
|
|
|
+ this.isLoading = false;
|
|
|
+ if(err){
|
|
|
+ console.error(err)
|
|
|
+ this.$message({
|
|
|
+ showClose: true,
|
|
|
+ message: err,
|
|
|
+ type: 'error'
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ console.log(res);
|
|
|
+ this.$message.success("创建成功!!!");
|
|
|
+ this.init();
|
|
|
+ },
|
|
|
+ editLibItemHandle(row){
|
|
|
+ console.log('编辑员工');
|
|
|
+ },
|
|
|
+ changePage(){
|
|
|
+ // 使用当前配置进行搜索
|
|
|
+ let searchParam = {
|
|
|
+ page: this.currentPage,
|
|
|
+ count: this.count,
|
|
|
+ key: this.searchKey,
|
|
|
+ }
|
|
|
+ this.loadLibItems(searchParam);
|
|
|
+ },
|
|
|
+ currentChange: function (val) {
|
|
|
+ this.currentPage = val;
|
|
|
+ this.changePage();
|
|
|
+ },
|
|
|
+ handleSizeChange: function (val) {
|
|
|
+ this.count = val;
|
|
|
+ this.changePage();
|
|
|
+ },
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|
|
|
+
|
|
|
+<style scoped>
|
|
|
+
|
|
|
+.box-center{
|
|
|
+ width:100%;
|
|
|
+ height: auto;
|
|
|
+}
|
|
|
+.box-center{
|
|
|
+ width: 100%;
|
|
|
+ height: auto;
|
|
|
+ padding: 10px 5px;
|
|
|
+ box-sizing: border-box;
|
|
|
+}
|
|
|
+.box-center .line{
|
|
|
+ width: 100%;
|
|
|
+ height: 35px;
|
|
|
+ display: flex;
|
|
|
+ margin-bottom: 10px;
|
|
|
+}
|
|
|
+.box-center .line .label{
|
|
|
+ width: 20%;
|
|
|
+ height: 100%;
|
|
|
+ display: flex;
|
|
|
+ justify-content: center;
|
|
|
+ align-items: center;
|
|
|
+}
|
|
|
+.box-center .line .input{
|
|
|
+ width: 80%;
|
|
|
+ height: 100%;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ box-sizing: border-box;
|
|
|
+ padding-left: 8px;
|
|
|
+ border-left: 1px solid grey;
|
|
|
+}
|
|
|
+.personImg{
|
|
|
+ width: auto;
|
|
|
+ height: 120px;
|
|
|
+}
|
|
|
+</style>
|