perf(src/views/user): 减少请求数

duizhaopin_ui
duan 2 years ago
parent 261963ad8d
commit 3e7a6637de

@ -90,7 +90,10 @@
align="center"
>
<template slot-scope="scope">
<el-tag :type="scope.row.is_enabled === 1?'success':'danger'">{{ scope.row.is_enabled === 1?'启用':'未启用' }}</el-tag>
<el-tag :type="scope.row.is_enabled === 1?'success':'danger'">{{
scope.row.is_enabled === 1 ? '启用' : '未启用'
}}
</el-tag>
</template>
</el-table-column>
<el-table-column
@ -102,7 +105,10 @@
<template slot-scope="scope">
<el-button size="mini" type="primary" plain @click="handleEdit(scope.$index, scope.row)">编辑</el-button>
<el-button size="mini" @click="handleFace(scope.$index, scope.row)">录入人脸</el-button>
<el-button size="mini" @click="handleRole(scope.$index, scope.row)"><svg-icon icon-class="" />分配功能权限</el-button>
<el-button size="mini" @click="handleRole(scope.$index, scope.row)">
<svg-icon icon-class="" />
分配功能权限
</el-button>
</template>
</el-table-column>
</el-table>
@ -123,7 +129,12 @@
width="38%"
@close="userFormDialogClose"
>
<UserForm :propsformdata="userFormData" :roledata="roleData" @handlesubmit="handleUserSubmit" @handlecancel="handleUserFormCancel" />
<UserForm
:propsformdata="userFormData"
:roledata="roleData"
@handlesubmit="handleUserSubmit"
@handlecancel="handleUserFormCancel"
/>
</el-dialog>
<el-dialog
title="分配用户权限"
@ -138,38 +149,88 @@
element-loading-text="拼命加载中"
>
<el-tab-pane label="后台管理" name="first">
<el-checkbox v-model="checkAll_drug_module_id" :indeterminate="isIndeterminate_drug_module_id" @change="(val) => handleCheckAllChange(val,'drug_module_id')"></el-checkbox>
<el-checkbox
v-model="checkAll_drug_module_id"
:indeterminate="isIndeterminate_drug_module_id"
@change="(val) => handleCheckAllChange(val,'drug_module_id')"
>全选
</el-checkbox>
<div style="margin: 15px 0;" />
<el-checkbox-group v-model="formData.drug_module_id" @change="(val) => handleCheckedCitiesChange(val,'drug_module_id')">
<el-checkbox v-for="item in drug_module_idOptions" :key="item.module_id" :label="item.module_id">{{ item.module_name }}</el-checkbox>
<el-checkbox-group
v-model="formData.drug_module_id"
@change="(val) => handleCheckedCitiesChange(val,'drug_module_id')"
>
<el-checkbox v-for="item in drug_module_idOptions" :key="item.module_id" :label="item.module_id">
{{ item.module_name }}
</el-checkbox>
</el-checkbox-group>
</el-tab-pane>
<el-tab-pane label="终端管理" name="second">
<el-checkbox v-model="checkAll_client_module_id" :indeterminate="isIndeterminate_client_module_id" @change="(val) =>handleCheckAllChange(val,'client_module_id')"></el-checkbox>
<el-checkbox
v-model="checkAll_client_module_id"
:indeterminate="isIndeterminate_client_module_id"
@change="(val) =>handleCheckAllChange(val,'client_module_id')"
>全选
</el-checkbox>
<div style="margin: 15px 0;" />
<el-checkbox-group v-model="formData.client_module_id" @change="(val) =>handleCheckedCitiesChange(val,'client_module_id')">
<el-checkbox v-for="item in client_module_idOptions" :key="item.module_id" :label="item.module_id">{{ item.module_name }}</el-checkbox>
<el-checkbox-group
v-model="formData.client_module_id"
@change="(val) =>handleCheckedCitiesChange(val,'client_module_id')"
>
<el-checkbox v-for="item in client_module_idOptions" :key="item.module_id" :label="item.module_id">
{{ item.module_name }}
</el-checkbox>
</el-checkbox-group>
</el-tab-pane>
<el-tab-pane label="标准品管理" name="data">
<el-checkbox v-model="checkAll_standard_module_id" :indeterminate="isIndeterminate_standard_module_id" @change="(val) =>handleCheckAllChange(val,'standard_module_id')"></el-checkbox>
<el-checkbox
v-model="checkAll_standard_module_id"
:indeterminate="isIndeterminate_standard_module_id"
@change="(val) =>handleCheckAllChange(val,'standard_module_id')"
>全选
</el-checkbox>
<div style="margin: 15px 0;" />
<el-checkbox-group v-model="formData.standard_module_id" @change="(val) =>handleCheckedCitiesChange(val,'standard_module_id')">
<el-checkbox v-for="item in standard_module_idOptions" :key="item.module_id" :label="item.module_id">{{ item.module_name }}</el-checkbox>
<el-checkbox-group
v-model="formData.standard_module_id"
@change="(val) =>handleCheckedCitiesChange(val,'standard_module_id')"
>
<el-checkbox v-for="item in standard_module_idOptions" :key="item.module_id" :label="item.module_id">
{{ item.module_name }}
</el-checkbox>
</el-checkbox-group>
</el-tab-pane>
<el-tab-pane label="耗材管理" name="third">
<el-checkbox v-model="checkAll_consumables_module_id" :indeterminate="isIndeterminate_consumables_module_id" @change="(val) =>handleCheckAllChange(val,'consumables_module_id')"></el-checkbox>
<el-checkbox
v-model="checkAll_consumables_module_id"
:indeterminate="isIndeterminate_consumables_module_id"
@change="(val) =>handleCheckAllChange(val,'consumables_module_id')"
>全选
</el-checkbox>
<div style="margin: 15px 0;" />
<el-checkbox-group v-model="formData.consumables_module_id" @change="(val) =>handleCheckedCitiesChange(val,'consumables_module_id')">
<el-checkbox v-for="item in consumables_module_idOptions" :key="item.module_id" :label="item.module_id">{{ item.module_name }}</el-checkbox>
<el-checkbox-group
v-model="formData.consumables_module_id"
@change="(val) =>handleCheckedCitiesChange(val,'consumables_module_id')"
>
<el-checkbox v-for="item in consumables_module_idOptions" :key="item.module_id" :label="item.module_id">
{{ item.module_name }}
</el-checkbox>
</el-checkbox-group>
</el-tab-pane>
<el-tab-pane label="仪器管理" name="fourth">
<el-checkbox v-model="checkAll_instrument_module_id" :indeterminate="isIndeterminate_instrument_module_id" @change="(val) =>handleCheckAllChange(val,'instrument_module_id')"></el-checkbox>
<el-checkbox
v-model="checkAll_instrument_module_id"
:indeterminate="isIndeterminate_instrument_module_id"
@change="(val) =>handleCheckAllChange(val,'instrument_module_id')"
>全选
</el-checkbox>
<div style="margin: 15px 0;" />
<el-checkbox-group v-model="formData.instrument_module_id" @change="(val) =>handleCheckedCitiesChange(val,'instrument_module_id')">
<el-checkbox v-for="item in instrument_module_idOptions" :key="item.module_id" :label="item.module_id">{{ item.module_name }}</el-checkbox>
<el-checkbox-group
v-model="formData.instrument_module_id"
@change="(val) =>handleCheckedCitiesChange(val,'instrument_module_id')"
>
<el-checkbox v-for="item in instrument_module_idOptions" :key="item.module_id" :label="item.module_id">
{{ item.module_name }}
</el-checkbox>
</el-checkbox-group>
</el-tab-pane>
</el-tabs>
@ -186,12 +247,11 @@
destroy-on-close
:visible="dialogFaceVisible"
width="400px"
@close="handleCancel"
@close="handleFaceCancel"
>
<div>
<div class="face-content">
<img v-if="play" id="video" width="200px" height="200px" :src="play" alt="">
<canvas id="canvas" width="200px" height="200px" style="transform:rotateY(180deg)" />
</div>
<div class="name">程小红</div>
<div class="code">工号779</div>
@ -273,7 +333,6 @@ export default {
//
dialogFaceVisible: false,
videoObj: null,
trackerTask: null,
web_stream: null,
img_list: [],
play: null,
@ -375,7 +434,9 @@ export default {
},
handleFace(index, row) {
faceStart().then(res => {
setTimeout(() => { this.play = process.env.VUE_APP_FACE_API + '/face/play/' }, 200)
setTimeout(() => {
this.play = process.env.VUE_APP_FACE_API + '/face/play/'
}, 200)
})
this.rflag = true
this.dialogFaceVisible = true
@ -418,7 +479,9 @@ export default {
this.formData.instrument_module_id = res.data.instrument_manage.filter(item => item.have === 1).map(item => item.module_id)
this.formData.standard_module_id = res.data.standard_manage.filter(item => item.have === 1).map(item => item.module_id)
this.formData.client_module_id = res.data.client_manage.filter(item => item.have === 1).map(item => item.module_id)
}).finally(() => { this.tabsLoading = false })
}).finally(() => {
this.tabsLoading = false
})
},
handleDelTem() {
if (this.multipleSelection.length !== 1) {
@ -479,8 +542,7 @@ export default {
instrument_module_id: []
}
},
handleCancel() {
handleFaceCancel() {
faceStop().then(
res => {
console.log(res)
@ -489,11 +551,13 @@ export default {
this.web_stream.destroy()
this.play = null
this.rflag = false
},
handleCancel() {
this.play = null
this.rflag = false
this.dialogFaceVisible = false
this.videoObj.srcObject.getTracks()[0].stop()
this.trackerTask.stop()
},
//
success(stream) {
this.videoObj.srcObject = stream
@ -514,25 +578,31 @@ export default {
padding: 1rem;
margin: 1rem;
background: white;
.title {
font-size: 20px;
font-weight: bold;
color: #000000;
}
.header {
margin: 1rem 0 1rem 0;
.el-input {
width: 12.5rem;
margin-right: 1rem;
}
.el-select {
width: 12.5rem;
margin-right: 1rem;
}
.header-right {
float: right;
}
}
#video, canvas {
position: absolute;
top: 100px;
@ -540,17 +610,20 @@ export default {
border-radius: 50%;
border: 1px solid #707070;
}
.face-content {
text-align: center;
height: 18.75rem;
width: 100%;
}
.name {
text-align: center;
font-size: 30px;
font-weight: 400;
color: #000000;
}
.code {
text-align: center;
font-size: 20px;
@ -558,6 +631,7 @@ export default {
color: #409EFF;
margin-top: 1rem;
}
.result {
margin-top: 1rem;
text-align: center;

Loading…
Cancel
Save