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

duizhaopin_ui
duan 2 years ago
parent 261963ad8d
commit 3e7a6637de

@ -61,7 +61,7 @@
align="center" align="center"
> >
<template slot-scope="scope"> <template slot-scope="scope">
{{ scope.row.sex === 1?'男':'女' }} {{ scope.row.sex === 1 ? '男' : '女' }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
@ -90,7 +90,10 @@
align="center" align="center"
> >
<template slot-scope="scope"> <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> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
@ -102,7 +105,10 @@
<template slot-scope="scope"> <template slot-scope="scope">
<el-button size="mini" type="primary" plain @click="handleEdit(scope.$index, scope.row)">编辑</el-button> <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="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> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -123,7 +129,12 @@
width="38%" width="38%"
@close="userFormDialogClose" @close="userFormDialogClose"
> >
<UserForm :propsformdata="userFormData" :roledata="roleData" @handlesubmit="handleUserSubmit" @handlecancel="handleUserFormCancel" /> <UserForm
:propsformdata="userFormData"
:roledata="roleData"
@handlesubmit="handleUserSubmit"
@handlecancel="handleUserFormCancel"
/>
</el-dialog> </el-dialog>
<el-dialog <el-dialog
title="分配用户权限" title="分配用户权限"
@ -138,38 +149,88 @@
element-loading-text="拼命加载中" element-loading-text="拼命加载中"
> >
<el-tab-pane label="后台管理" name="first"> <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;" /> <div style="margin: 15px 0;" />
<el-checkbox-group v-model="formData.drug_module_id" @change="(val) => handleCheckedCitiesChange(val,'drug_module_id')"> <el-checkbox-group
<el-checkbox v-for="item in drug_module_idOptions" :key="item.module_id" :label="item.module_id">{{ item.module_name }}</el-checkbox> 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-checkbox-group>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="终端管理" name="second"> <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;" /> <div style="margin: 15px 0;" />
<el-checkbox-group v-model="formData.client_module_id" @change="(val) =>handleCheckedCitiesChange(val,'client_module_id')"> <el-checkbox-group
<el-checkbox v-for="item in client_module_idOptions" :key="item.module_id" :label="item.module_id">{{ item.module_name }}</el-checkbox> 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-checkbox-group>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="标准品管理" name="data"> <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;" /> <div style="margin: 15px 0;" />
<el-checkbox-group v-model="formData.standard_module_id" @change="(val) =>handleCheckedCitiesChange(val,'standard_module_id')"> <el-checkbox-group
<el-checkbox v-for="item in standard_module_idOptions" :key="item.module_id" :label="item.module_id">{{ item.module_name }}</el-checkbox> 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-checkbox-group>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="耗材管理" name="third"> <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;" /> <div style="margin: 15px 0;" />
<el-checkbox-group v-model="formData.consumables_module_id" @change="(val) =>handleCheckedCitiesChange(val,'consumables_module_id')"> <el-checkbox-group
<el-checkbox v-for="item in consumables_module_idOptions" :key="item.module_id" :label="item.module_id">{{ item.module_name }}</el-checkbox> 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-checkbox-group>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="仪器管理" name="fourth"> <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;" /> <div style="margin: 15px 0;" />
<el-checkbox-group v-model="formData.instrument_module_id" @change="(val) =>handleCheckedCitiesChange(val,'instrument_module_id')"> <el-checkbox-group
<el-checkbox v-for="item in instrument_module_idOptions" :key="item.module_id" :label="item.module_id">{{ item.module_name }}</el-checkbox> 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-checkbox-group>
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
@ -186,12 +247,11 @@
destroy-on-close destroy-on-close
:visible="dialogFaceVisible" :visible="dialogFaceVisible"
width="400px" width="400px"
@close="handleCancel" @close="handleFaceCancel"
> >
<div> <div>
<div class="face-content"> <div class="face-content">
<img v-if="play" id="video" width="200px" height="200px" :src="play" alt=""> <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>
<div class="name">程小红</div> <div class="name">程小红</div>
<div class="code">工号779</div> <div class="code">工号779</div>
@ -273,7 +333,6 @@ export default {
// //
dialogFaceVisible: false, dialogFaceVisible: false,
videoObj: null, videoObj: null,
trackerTask: null,
web_stream: null, web_stream: null,
img_list: [], img_list: [],
play: null, play: null,
@ -329,7 +388,7 @@ export default {
handleCheckedCitiesChange(value, t) { handleCheckedCitiesChange(value, t) {
const checkedCount = value.length const checkedCount = value.length
this.$set(this, 'checkAll_' + t, checkedCount === this[t + 'Options'].length) this.$set(this, 'checkAll_' + t, checkedCount === this[t + 'Options'].length)
this['isIndeterminate_' + t] = checkedCount > 0 && checkedCount < this[ t + 'Options'].length this['isIndeterminate_' + t] = checkedCount > 0 && checkedCount < this[t + 'Options'].length
}, },
handleSelectionChange(val) { handleSelectionChange(val) {
this.multipleSelection = val this.multipleSelection = val
@ -375,7 +434,9 @@ export default {
}, },
handleFace(index, row) { handleFace(index, row) {
faceStart().then(res => { 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.rflag = true
this.dialogFaceVisible = 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.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.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) 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() { handleDelTem() {
if (this.multipleSelection.length !== 1) { if (this.multipleSelection.length !== 1) {
@ -479,8 +542,7 @@ export default {
instrument_module_id: [] instrument_module_id: []
} }
}, },
handleFaceCancel() {
handleCancel() {
faceStop().then( faceStop().then(
res => { res => {
console.log(res) console.log(res)
@ -489,11 +551,13 @@ export default {
this.web_stream.destroy() this.web_stream.destroy()
this.play = null this.play = null
this.rflag = false this.rflag = false
},
handleCancel() {
this.play = null
this.rflag = false
this.dialogFaceVisible = false this.dialogFaceVisible = false
this.videoObj.srcObject.getTracks()[0].stop() this.videoObj.srcObject.getTracks()[0].stop()
this.trackerTask.stop()
}, },
// //
success(stream) { success(stream) {
this.videoObj.srcObject = stream this.videoObj.srcObject = stream
@ -509,55 +573,65 @@ export default {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.main-container-text{ .main-container-text {
min-height:calc(100vh - 110px) ; min-height: calc(100vh - 110px);
padding: 1rem; padding: 1rem;
margin: 1rem; margin: 1rem;
background: white; background: white;
.title{
.title {
font-size: 20px; font-size: 20px;
font-weight: bold; font-weight: bold;
color: #000000; color: #000000;
} }
.header{
.header {
margin: 1rem 0 1rem 0; margin: 1rem 0 1rem 0;
.el-input{
.el-input {
width: 12.5rem; width: 12.5rem;
margin-right: 1rem; margin-right: 1rem;
} }
.el-select { .el-select {
width: 12.5rem; width: 12.5rem;
margin-right: 1rem; margin-right: 1rem;
} }
.header-right{
.header-right {
float: right; float: right;
} }
} }
#video,canvas{
#video, canvas {
position: absolute; position: absolute;
top: 100px; top: 100px;
left: 120px; left: 120px;
border-radius: 50%; border-radius: 50%;
border: 1px solid #707070; border: 1px solid #707070;
} }
.face-content{
.face-content {
text-align: center; text-align: center;
height: 18.75rem; height: 18.75rem;
width: 100%; width: 100%;
} }
.name{
.name {
text-align: center; text-align: center;
font-size: 30px; font-size: 30px;
font-weight: 400; font-weight: 400;
color: #000000; color: #000000;
} }
.code{
.code {
text-align: center; text-align: center;
font-size: 20px; font-size: 20px;
font-weight: 400; font-weight: 400;
color: #409EFF; color: #409EFF;
margin-top: 1rem; margin-top: 1rem;
} }
.result { .result {
margin-top: 1rem; margin-top: 1rem;
text-align: center; text-align: center;

Loading…
Cancel
Save