addWord
This commit is contained in:
parent
ab96880772
commit
46629a064c
|
@ -0,0 +1,8 @@
|
||||||
|
import request from '@/utils/request'
|
||||||
|
export function faceLogin(data) {
|
||||||
|
return request({
|
||||||
|
url: '/system/facelogin/',
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
|
@ -103,6 +103,7 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
activeName: "",
|
||||||
loading: false,
|
loading: false,
|
||||||
passwordType: "password",
|
passwordType: "password",
|
||||||
redirect: undefined,
|
redirect: undefined,
|
||||||
|
|
|
@ -1,237 +1,202 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
<el-card>
|
<el-card>
|
||||||
|
<el-descriptions title="子工序详情" :column="2" border>
|
||||||
<el-descriptions title="子工序详情" :column="2" border>
|
<el-descriptions-item label="工序名称" label-class-name="my-label" content-class-name="my-content">{{step.name}}</el-descriptions-item>
|
||||||
<el-descriptions-item label="工序名称" label-class-name="my-label" content-class-name="my-content">{{step.name}}</el-descriptions-item>
|
<el-descriptions-item label="步骤编号" label-class-name="my-label" content-class-name="my-content">{{step.number}}</el-descriptions-item>
|
||||||
<el-descriptions-item label="步骤编号" label-class-name="my-label" content-class-name="my-content">{{step.number}}</el-descriptions-item>
|
<el-descriptions-item label="相关设备" label-class-name="my-label" :contentStyle="{'text-align': 'left'}">
|
||||||
<el-descriptions-item label="相关设备" label-class-name="my-label" :contentStyle="{'text-align': 'left'}">
|
<el-tag v-for="item in step.equipments_"
|
||||||
<el-tag v-for="item in step.equipments_"
|
:key="item.number"
|
||||||
:key="item.number"
|
:label="item.name"
|
||||||
:label="item.name"
|
:value="item.number">{{item.name}}</el-tag>
|
||||||
:value="item.number">{{item.name}}</el-tag>
|
</el-descriptions-item>
|
||||||
</el-descriptions-item>
|
<el-descriptions-item label="指导书内容" label-class-name="my-label" :contentStyle="{'text-align': 'left'}">{{step.instruction_content}}</el-descriptions-item>
|
||||||
<el-descriptions-item label="指导书内容" label-class-name="my-label" :contentStyle="{'text-align': 'left'}">{{step.instruction_content}}</el-descriptions-item>
|
</el-descriptions>
|
||||||
</el-descriptions>
|
|
||||||
</el-card>
|
|
||||||
<el-card>
|
|
||||||
|
|
||||||
<el-tabs type="border-card">
|
|
||||||
<el-tab-pane label="过程记录">
|
|
||||||
|
|
||||||
<el-row :gutter="24">
|
|
||||||
<el-col :span="6" >
|
|
||||||
<el-card style="margin-top: 10px">
|
|
||||||
<el-button type="primary" icon="el-icon-plus" @click="handleCreate"
|
|
||||||
>新增</el-button>
|
|
||||||
<el-table
|
|
||||||
|
|
||||||
:data="recordformList.results"
|
|
||||||
border
|
|
||||||
fit
|
|
||||||
stripe
|
|
||||||
highlight-current-row
|
|
||||||
height="100"
|
|
||||||
v-el-height-adaptive-table="{bottomOffset: 50}"
|
|
||||||
@current-change="handleCurrentChange"
|
|
||||||
>
|
|
||||||
|
|
||||||
<el-table-column type="index" width="50" />
|
|
||||||
<el-table-column label="产品信息">
|
|
||||||
<template slot-scope="scope">{{ scope.row.name }}</template>
|
|
||||||
|
|
||||||
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column
|
|
||||||
align="center"
|
|
||||||
label="操作"
|
|
||||||
|
|
||||||
>
|
|
||||||
<template slot-scope="scope">
|
|
||||||
|
|
||||||
<el-link
|
|
||||||
v-if="checkPermission(['material_update'])"
|
|
||||||
@click="handleEdit(scope)"
|
|
||||||
>编辑</el-link
|
|
||||||
>
|
|
||||||
<el-link
|
|
||||||
v-if="checkPermission(['material_delete'])"
|
|
||||||
type="danger"
|
|
||||||
@click="handleDelete(scope)"
|
|
||||||
>删除</el-link
|
|
||||||
>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
|
|
||||||
</el-table>
|
|
||||||
<el-dialog
|
|
||||||
:visible.sync="dialogVisible"
|
|
||||||
:title="dialogType === 'edit' ? '编辑记录表格' : '新增记录表格'"
|
|
||||||
>
|
|
||||||
<el-form
|
|
||||||
ref="Forms"
|
|
||||||
:model="recordform"
|
|
||||||
label-width="80px"
|
|
||||||
label-position="right"
|
|
||||||
>
|
|
||||||
|
|
||||||
<el-form-item label="表格名称" prop="name">
|
|
||||||
<el-input v-model="recordform.name" placeholder="表格名称" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="表格类型" prop="type">
|
|
||||||
<el-select style="width: 100%" v-model="recordform.type" placeholder="请选择">
|
|
||||||
<el-option
|
|
||||||
v-for="item in typeoptions"
|
|
||||||
:key="item.value"
|
|
||||||
:label="item.label"
|
|
||||||
:value="item.value">
|
|
||||||
</el-option>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</el-form>
|
|
||||||
<div style="text-align: right">
|
|
||||||
<el-button type="danger" @click="dialogVisible = false">取消</el-button>
|
|
||||||
<el-button type="primary" @click="recordformconfirm('Forms')">确认</el-button>
|
|
||||||
</div>
|
|
||||||
</el-dialog>
|
|
||||||
</el-card>
|
</el-card>
|
||||||
|
<el-card>
|
||||||
|
<el-tabs type="border-card">
|
||||||
|
<el-tab-pane label="过程记录">
|
||||||
|
<el-row :gutter="24">
|
||||||
|
<el-col :span="6" >
|
||||||
|
<el-card style="margin-top: 10px">
|
||||||
|
<el-button type="primary" icon="el-icon-plus" @click="handleCreate"
|
||||||
|
>新增</el-button>
|
||||||
|
<el-table
|
||||||
|
|
||||||
</el-col>
|
:data="recordformList.results"
|
||||||
<el-col :span="18" >
|
border
|
||||||
<el-card class="box-card">
|
fit
|
||||||
<el-button type="primary" icon="el-icon-plus" @click="handlefieldCreate"
|
stripe
|
||||||
>新增</el-button>
|
highlight-current-row
|
||||||
<el-table
|
height="100"
|
||||||
|
v-el-height-adaptive-table="{bottomOffset: 50}"
|
||||||
|
@current-change="handleCurrentChange"
|
||||||
|
>
|
||||||
|
|
||||||
:data="fieldList.results"
|
<el-table-column type="index" width="50" />
|
||||||
border
|
<el-table-column label="产品信息">
|
||||||
fit
|
<template slot-scope="scope">{{ scope.row.name }}</template>
|
||||||
stripe
|
|
||||||
highlight-current-row
|
|
||||||
height="100"
|
|
||||||
v-el-height-adaptive-table="{bottomOffset: 50}"
|
|
||||||
|
|
||||||
>
|
|
||||||
|
|
||||||
<el-table-column type="index" width="50" />
|
|
||||||
<el-table-column label="字段类型">
|
|
||||||
<template slot-scope="scope">{{ options_[scope.row.field_type] }}</template>
|
|
||||||
</el-table-column>
|
|
||||||
|
|
||||||
<el-table-column label="字段名称">
|
|
||||||
<template slot-scope="scope">{{ scope.row.field_name }}</template>
|
|
||||||
</el-table-column>
|
|
||||||
|
|
||||||
<el-table-column label="字段标识">
|
|
||||||
<template slot-scope="scope">{{ scope.row.field_key }}</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="布尔类型显示名">
|
|
||||||
<template slot-scope="scope">{{ scope.row.boolean_field_display }}</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="选项显示名">
|
|
||||||
<template slot-scope="scope">{{ scope.row.field_choice }}</template>
|
|
||||||
</el-table-column>
|
|
||||||
|
|
||||||
|
|
||||||
<el-table-column
|
</el-table-column>
|
||||||
align="center"
|
<el-table-column
|
||||||
label="操作"
|
align="center"
|
||||||
|
label="操作"
|
||||||
|
|
||||||
>
|
>
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
|
|
||||||
<el-link
|
<el-link
|
||||||
v-if="checkPermission(['material_update'])"
|
v-if="checkPermission(['material_update'])"
|
||||||
@click="handlefieldEdit(scope)"
|
@click="handleEdit(scope)"
|
||||||
>编辑</el-link
|
>编辑</el-link
|
||||||
|
>
|
||||||
|
<el-link
|
||||||
|
v-if="checkPermission(['material_delete'])"
|
||||||
|
type="danger"
|
||||||
|
@click="handleDelete(scope)"
|
||||||
|
>删除</el-link
|
||||||
|
>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
</el-table>
|
||||||
|
<el-dialog
|
||||||
|
:visible.sync="dialogVisible"
|
||||||
|
:title="dialogType === 'edit' ? '编辑记录表格' : '新增记录表格'"
|
||||||
|
>
|
||||||
|
<el-form
|
||||||
|
ref="Forms"
|
||||||
|
:model="recordform"
|
||||||
|
label-width="80px"
|
||||||
|
label-position="right"
|
||||||
>
|
>
|
||||||
<el-link
|
<el-form-item label="表格名称" prop="name">
|
||||||
v-if="checkPermission(['material_delete'])"
|
<el-input v-model="recordform.name" placeholder="表格名称" />
|
||||||
type="danger"
|
</el-form-item>
|
||||||
@click="handlefieldDelete(scope)"
|
<el-form-item label="表格类型" prop="type">
|
||||||
>删除</el-link
|
<el-select style="width: 100%" v-model="recordform.type" placeholder="请选择">
|
||||||
>
|
<el-option
|
||||||
</template>
|
v-for="item in typeoptions"
|
||||||
</el-table-column>
|
:key="item.value"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.value">
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
</el-table>
|
|
||||||
|
|
||||||
|
</el-form>
|
||||||
|
<div style="text-align: right">
|
||||||
|
<el-button type="danger" @click="dialogVisible = false">取消</el-button>
|
||||||
|
<el-button type="primary" @click="recordformconfirm('Forms')">确认</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</el-card>
|
||||||
|
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="18" >
|
||||||
|
<el-card class="box-card">
|
||||||
|
<el-button type="primary" icon="el-icon-plus" @click="handlefieldCreate"
|
||||||
|
>新增</el-button>
|
||||||
|
<el-table
|
||||||
|
:data="fieldList.results"
|
||||||
|
border
|
||||||
|
fit
|
||||||
|
stripe
|
||||||
|
highlight-current-row
|
||||||
|
height="100"
|
||||||
|
v-el-height-adaptive-table="{bottomOffset: 50}"
|
||||||
|
>
|
||||||
|
<el-table-column type="index" width="50" />
|
||||||
|
<el-table-column label="字段类型">
|
||||||
|
<template slot-scope="scope">{{ options_[scope.row.field_type] }}</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column label="字段名称">
|
||||||
|
<template slot-scope="scope">{{ scope.row.field_name }}</template>
|
||||||
|
</el-table-column>
|
||||||
|
|
||||||
|
<el-table-column label="字段标识">
|
||||||
|
<template slot-scope="scope">{{ scope.row.field_key }}</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="布尔类型显示名">
|
||||||
|
<template slot-scope="scope">{{ scope.row.boolean_field_display }}</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="选项显示名">
|
||||||
|
<template slot-scope="scope">{{ scope.row.field_choice }}</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column
|
||||||
|
align="center"
|
||||||
|
label="操作"
|
||||||
|
>
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-link
|
||||||
|
v-if="checkPermission(['material_update'])"
|
||||||
|
@click="handlefieldEdit(scope)"
|
||||||
|
>编辑</el-link>
|
||||||
|
<el-link
|
||||||
|
v-if="checkPermission(['material_delete'])"
|
||||||
|
type="danger"
|
||||||
|
@click="handlefieldDelete(scope)"
|
||||||
|
>删除</el-link>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</el-card>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-dialog :visible.sync="dialogVisible1" :title="dialogType1 === 'edit' ? '编辑表格字段' : '新增表格字段'">
|
||||||
|
<el-form ref="Form" :model="field" label-width="80px" label-position="right">
|
||||||
|
<el-form-item label="字段类型" prop="field_type">
|
||||||
|
<el-select style="width: 100%" v-model="field.field_type" placeholder="请选择">
|
||||||
|
<el-option
|
||||||
|
v-for="item in fieldtypeoptions"
|
||||||
|
:key="item.value"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.value">
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="字段标识" prop="field_key">
|
||||||
|
<el-input v-model="field.field_key" placeholder="字段标识" onkeyup="value=value.replace(/[^A-Za-z_\/]/ig,'')"/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="字段名称" prop="field_name">
|
||||||
|
<el-input v-model="field.field_name" placeholder="字段名称" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="选项" v-show="field.field_type=='radio'||field.field_type=='checkbox'||field.field_type=='select'||field.field_type=='selects'">
|
||||||
|
<el-button @click.prevent="addDomain('1')" style="border: none;">
|
||||||
|
<i class="el-icon-circle-plus-outline"></i>
|
||||||
|
<span style="font-size:14px;">添加</span>
|
||||||
|
</el-button>
|
||||||
|
<el-row v-for="(domain, $index) in options" :key=domain+$index style="margin-bottom: 10px">
|
||||||
|
<el-col :span="20">
|
||||||
|
<el-input v-model="options[$index]" auto-complete="off"></el-input>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="3" style="text-align: center" v-if="$index!==0">
|
||||||
|
<i class="el-icon-remove-outline" @click.prevent="removeDomain($index,'1')" style="color: red;font-size: 16px;"></i>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="排序" prop="sort">
|
||||||
|
<el-input-number v-model="field.sort" :min="1" placeholder="排序"></el-input-number>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<div style="text-align: right">
|
||||||
|
<el-button type="danger" @click="dialogVisible1 = false">取消</el-button>
|
||||||
|
<el-button type="primary" @click="fieldconfirm('Form')">确认</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</el-tab-pane>
|
||||||
|
</el-tabs>
|
||||||
</el-card>
|
</el-card>
|
||||||
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
<el-dialog
|
|
||||||
:visible.sync="dialogVisible1"
|
|
||||||
:title="dialogType1 === 'edit' ? '编辑表格字段' : '新增表格字段'"
|
|
||||||
>
|
|
||||||
<el-form
|
|
||||||
ref="Form"
|
|
||||||
:model="field"
|
|
||||||
label-width="80px"
|
|
||||||
label-position="right"
|
|
||||||
>
|
|
||||||
|
|
||||||
<el-form-item label="字段类型" prop="field_type">
|
|
||||||
<el-select style="width: 100%" v-model="field.field_type" placeholder="请选择">
|
|
||||||
<el-option
|
|
||||||
v-for="item in fieldtypeoptions"
|
|
||||||
:key="item.value"
|
|
||||||
:label="item.label"
|
|
||||||
:value="item.value">
|
|
||||||
</el-option>
|
|
||||||
</el-select>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="字段标识" prop="field_key">
|
|
||||||
<el-input v-model="field.field_key" placeholder="字段标识" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="字段名称" prop="field_name">
|
|
||||||
<el-input v-model="field.field_name" placeholder="字段名称" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="布尔类型显示名" prop="boolean_field_display">
|
|
||||||
<vue-json-editor
|
|
||||||
v-model="field.boolean_field_display"
|
|
||||||
:showBtns="false"
|
|
||||||
:mode="'code'"
|
|
||||||
lang="zh"
|
|
||||||
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="选项" prop="field_choice">
|
|
||||||
|
|
||||||
<vue-json-editor
|
|
||||||
v-model="field.field_choice"
|
|
||||||
:showBtns="false"
|
|
||||||
:mode="'code'"
|
|
||||||
lang="zh"
|
|
||||||
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="排序" prop="sort">
|
|
||||||
<el-input v-model="field.sort" placeholder="排序" />
|
|
||||||
</el-form-item>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</el-form>
|
|
||||||
<div style="text-align: right">
|
|
||||||
<el-button type="danger" @click="dialogVisible1 = false">取消</el-button>
|
|
||||||
<el-button type="primary" @click="fieldconfirm('Form')">确认</el-button>
|
|
||||||
</div>
|
|
||||||
</el-dialog>
|
|
||||||
</el-tab-pane>
|
|
||||||
</el-tabs>
|
|
||||||
|
|
||||||
</el-card>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { getStep,getrecordformList,createrecordform,updaterecordform,deleterecordform,getrffieldList,createrffield,updaterffield,
|
import { getStep,getrecordformList,createrecordform,updaterecordform,deleterecordform,getrffieldList,createrffield,updaterffield,
|
||||||
deleterffield} from "@/api/mtm";
|
deleterffield} from "@/api/mtm";
|
||||||
|
// import vueJsonEditor from 'vue-json-editor'
|
||||||
import vueJsonEditor from 'vue-json-editor'
|
|
||||||
import checkPermission from "@/utils/permission";
|
import checkPermission from "@/utils/permission";
|
||||||
const defaultrecordform = {
|
const defaultrecordform = {
|
||||||
|
|
||||||
|
@ -240,63 +205,68 @@ const defaultfield = {
|
||||||
|
|
||||||
};
|
};
|
||||||
export default {
|
export default {
|
||||||
components: { vueJsonEditor },
|
name:'stepdo',
|
||||||
|
// components: { vueJsonEditor },
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
step:"",
|
step:"",
|
||||||
recordform: defaultrecordform,
|
recordform: defaultrecordform,
|
||||||
field: defaultfield,
|
field: {
|
||||||
dialogType: "new",
|
field_type:'',
|
||||||
|
field_key:'',
|
||||||
|
field_name:'',
|
||||||
|
sort:'',
|
||||||
|
field_choice:[],
|
||||||
|
},
|
||||||
|
date:'',
|
||||||
|
datetime:'',
|
||||||
|
time:'',
|
||||||
|
options:[''],
|
||||||
|
dialogType: "new",
|
||||||
dialogVisible:false,
|
dialogVisible:false,
|
||||||
dialogType1: "new",
|
dialogType1: "new",
|
||||||
dialogVisible1:false,
|
dialogVisible1:false,
|
||||||
listQueryrecordform: {
|
listQueryrecordform: {
|
||||||
page: 1,
|
page: 1,
|
||||||
page_size: 20,
|
page_size: 20,
|
||||||
},
|
},
|
||||||
recordformList: {
|
recordformList: {
|
||||||
count: 0,
|
count: 0,
|
||||||
},
|
},
|
||||||
fieldList: {
|
fieldList: {
|
||||||
count: 0,
|
count: 0,
|
||||||
},
|
},
|
||||||
listQueryfield: {
|
listQueryfield: {
|
||||||
page: 1,
|
page: 1,
|
||||||
page_size: 20,
|
page_size: 20,
|
||||||
},
|
},
|
||||||
options_: {
|
options_: {
|
||||||
'string':'字符串',
|
'string':'字符串',
|
||||||
'int':'整型',
|
'number':'数字',
|
||||||
'float': '浮点',
|
'date': '日期',
|
||||||
'boolean':'布尔',
|
'datetime': '日期时间',
|
||||||
'date': '日期',
|
'radio': '单选',
|
||||||
'datetime': '日期时间',
|
'checkbox': '多选',
|
||||||
'radio': '单选',
|
// 'select': '单选下拉',
|
||||||
'checkbox': '多选',
|
// 'selects': '多选下拉',
|
||||||
'select': '单选下拉',
|
// 'textarea': '文本域'
|
||||||
'selects': '多选下拉',
|
},
|
||||||
'textarea': '文本域'
|
fieldtypeoptions: [{
|
||||||
},
|
|
||||||
fieldtypeoptions: [{
|
|
||||||
value: 'string',
|
value: 'string',
|
||||||
label: '字符串'
|
label: '文字'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: 'int',
|
value: 'number',
|
||||||
label: '整型'
|
label: '数字'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: 'float',
|
value: 'date',
|
||||||
label: '浮点'
|
label: '日期'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: 'boolean',
|
value: 'time',
|
||||||
label: '布尔'
|
label: '时间'
|
||||||
},
|
},
|
||||||
{
|
|
||||||
value: 'date',
|
|
||||||
label: '日期'
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
value: 'datetime',
|
value: 'datetime',
|
||||||
label: '日期时间'
|
label: '日期时间'
|
||||||
|
@ -308,37 +278,31 @@ export default {
|
||||||
{
|
{
|
||||||
value: 'checkbox',
|
value: 'checkbox',
|
||||||
label: '多选'
|
label: '多选'
|
||||||
},
|
}
|
||||||
{
|
],
|
||||||
value: 'select',
|
typeoptions: [{
|
||||||
label: '单选下拉'
|
value: 1,
|
||||||
},
|
label: '生产记录'
|
||||||
{
|
}]
|
||||||
value: 'selects',
|
|
||||||
label: '多选下拉'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
value: 'textarea',
|
|
||||||
label: '文本域'
|
|
||||||
}],
|
|
||||||
typeoptions: [{
|
|
||||||
value: 1,
|
|
||||||
label: '生产记录'
|
|
||||||
}],
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {},
|
computed: {},
|
||||||
watch: {},
|
watch: {},
|
||||||
created() {
|
created() {
|
||||||
|
|
||||||
this.getStepD();
|
this.getStepD();
|
||||||
this.recordformLists();
|
this.recordformLists();
|
||||||
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
//添加
|
||||||
|
addDomain() {
|
||||||
|
this.options.push('')
|
||||||
|
},
|
||||||
|
//删除
|
||||||
|
removeDomain(index){
|
||||||
|
this.options.splice(index, 1)
|
||||||
|
},
|
||||||
checkPermission,
|
checkPermission,
|
||||||
getStepD()
|
getStepD(){
|
||||||
{
|
|
||||||
getStep(this.$route.params.id).then((response) => {
|
getStep(this.$route.params.id).then((response) => {
|
||||||
if (response.data) {
|
if (response.data) {
|
||||||
this.step = response.data;
|
this.step = response.data;
|
||||||
|
@ -396,104 +360,104 @@ export default {
|
||||||
this.$refs["Forms"].clearValidate();
|
this.$refs["Forms"].clearValidate();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
handlefieldEdit(scope) {
|
handlefieldEdit(scope) {
|
||||||
this.field = Object.assign({}, scope.row); // copy obj
|
this.field = Object.assign({}, scope.row); // copy obj
|
||||||
this.dialogType1 = "edit";
|
this.dialogType1 = "edit";
|
||||||
this.dialogVisible1 = true;
|
this.dialogVisible1 = true;
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.$refs["Form"].clearValidate();
|
this.$refs["Form"].clearValidate();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
handleDelete(scope) {
|
handleDelete(scope) {
|
||||||
this.$confirm("确认删除?", "警告", {
|
this.$confirm("确认删除?", "警告", {
|
||||||
confirmButtonText: "确认",
|
confirmButtonText: "确认",
|
||||||
cancelButtonText: "取消",
|
cancelButtonText: "取消",
|
||||||
type: "error",
|
type: "error",
|
||||||
})
|
})
|
||||||
.then(async () => {
|
.then(async () => {
|
||||||
await deleterecordform(scope.row.id);
|
await deleterecordform(scope.row.id);
|
||||||
this.recordformLists()
|
this.recordformLists()
|
||||||
this.$message.success("成功");
|
this.$message.success("成功");
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
handlefieldDelete(scope) {
|
handlefieldDelete(scope) {
|
||||||
this.$confirm("确认删除?", "警告", {
|
this.$confirm("确认删除?", "警告", {
|
||||||
confirmButtonText: "确认",
|
confirmButtonText: "确认",
|
||||||
cancelButtonText: "取消",
|
cancelButtonText: "取消",
|
||||||
type: "error",
|
type: "error",
|
||||||
})
|
})
|
||||||
.then(async () => {
|
.then(async () => {
|
||||||
await deleterffield(scope.row.id);
|
await deleterffield(scope.row.id);
|
||||||
this.fieldLists()
|
this.fieldLists()
|
||||||
this.$message.success("成功");
|
this.$message.success("成功");
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
});
|
|
||||||
},
|
|
||||||
async recordformconfirm(form) {
|
|
||||||
this.$refs[form].validate((valid) => {
|
|
||||||
if (valid) {
|
|
||||||
const isEdit = this.dialogType === "edit";
|
|
||||||
if (isEdit) {
|
|
||||||
this.recordform.step=this.$route.params.id
|
|
||||||
|
|
||||||
updaterecordform(this.recordform.id, this.recordform).then((res) => {
|
|
||||||
if (res.code >= 200) {
|
|
||||||
this.recordformLists()
|
|
||||||
this.dialogVisible = false;
|
|
||||||
this.$message.success("成功");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
this.recordform.step=this.$route.params.id
|
|
||||||
|
|
||||||
createrecordform(this.recordform).then((res) => {
|
|
||||||
if (res.code >= 200) {
|
|
||||||
this.recordformLists()
|
|
||||||
this.dialogVisible = false;
|
|
||||||
this.$message.success("成功");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
async fieldconfirm(form) {
|
async recordformconfirm(form) {
|
||||||
this.$refs[form].validate((valid) => {
|
this.$refs[form].validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
const isEdit = this.dialogType1 === "edit";
|
const isEdit = this.dialogType === "edit";
|
||||||
if (isEdit) {
|
if (isEdit) {
|
||||||
this.field.form=this.formID
|
this.recordform.step=this.$route.params.id
|
||||||
|
|
||||||
updaterffield(this.field.id, this.field).then((res) => {
|
updaterecordform(this.recordform.id, this.recordform).then((res) => {
|
||||||
if (res.code >= 200) {
|
if (res.code >= 200) {
|
||||||
this.fieldLists()
|
this.recordformLists()
|
||||||
this.dialogVisible1 = false;
|
this.dialogVisible = false;
|
||||||
this.$message.success("成功");
|
this.$message.success("成功");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
|
||||||
this.field.form=this.formID
|
|
||||||
|
|
||||||
createrffield(this.field).then((res) => {
|
|
||||||
if (res.code >= 200) {
|
|
||||||
this.fieldLists()
|
|
||||||
this.dialogVisible1 = false;
|
|
||||||
this.$message.success("成功");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
return false;
|
this.recordform.step=this.$route.params.id
|
||||||
|
|
||||||
|
createrecordform(this.recordform).then((res) => {
|
||||||
|
if (res.code >= 200) {
|
||||||
|
this.recordformLists()
|
||||||
|
this.dialogVisible = false;
|
||||||
|
this.$message.success("成功");
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
async fieldconfirm(form) {
|
||||||
|
this.$refs[form].validate((valid) => {
|
||||||
|
if (valid) {
|
||||||
|
const isEdit = this.dialogType1 === "edit";
|
||||||
|
if (isEdit) {
|
||||||
|
this.field.form=this.formID
|
||||||
|
|
||||||
|
updaterffield(this.field.id, this.field).then((res) => {
|
||||||
|
if (res.code >= 200) {
|
||||||
|
this.fieldLists()
|
||||||
|
this.dialogVisible1 = false;
|
||||||
|
this.$message.success("成功");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.field.form=this.formID;
|
||||||
|
this.field.field_choice = this.options;
|
||||||
|
createrffield(this.field).then((res) => {
|
||||||
|
if (res.code >= 200) {
|
||||||
|
this.fieldLists();
|
||||||
|
this.dialogVisible1 = false;
|
||||||
|
this.$message.success("成功");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import {faceLogin} from "@/api/testModel";
|
||||||
// import "tracking/build/data/face-min.js";
|
// import "tracking/build/data/face-min.js";
|
||||||
// import "tracking/build/data/mouth-min.js";
|
// import "tracking/build/data/mouth-min.js";
|
||||||
// import "tracking/build/data/tracking-min.js";
|
// import "tracking/build/data/tracking-min.js";
|
||||||
|
@ -64,11 +65,20 @@
|
||||||
let canvas = document.getElementById("myCanvas");
|
let canvas = document.getElementById("myCanvas");
|
||||||
let context = canvas.getContext('2d');
|
let context = canvas.getContext('2d');
|
||||||
var video = document.getElementById("myVideo");
|
var video = document.getElementById("myVideo");
|
||||||
context.drawImage(video,0,0,this.videoWidth,this.videoHeight);
|
context.drawImage(video,0,0,90,68);
|
||||||
var image = new Image();
|
var image = new Image();
|
||||||
image = canvas.toDataURL('image/png');
|
image = canvas.toDataURL('image/png');
|
||||||
document.getElementById('res').innerHTML = '<img style="border: 1px solid #666666;" src="'+image+'">';
|
document.getElementById('res').innerHTML = '<img style="border: 1px solid #666666;" src="'+image+'">';
|
||||||
},
|
console.log(image);
|
||||||
|
debugger;
|
||||||
|
let imgData = {base64:image};
|
||||||
|
faceLogin(imgData).then((res) => {
|
||||||
|
if (res.code >= 200) {
|
||||||
|
debugger;
|
||||||
|
this.$message.success("成功");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
// 关闭摄像头
|
// 关闭摄像头
|
||||||
closeCamera () {
|
closeCamera () {
|
||||||
if (!this.$refs['video'].srcObject) return;
|
if (!this.$refs['video'].srcObject) return;
|
||||||
|
@ -172,13 +182,13 @@
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|
||||||
.testTracking {
|
.testTracking {
|
||||||
min-height: 700px;
|
min-height: 700px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
.buttonDiv {
|
.buttonDiv {
|
||||||
bottom: 10px;
|
bottom: 10px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<button @click="back()">回退</button>
|
<button @click="back()">回退</button>
|
||||||
<button @click="saveTu()">保存</button>
|
<button @click="saveTu()">保存</button>
|
||||||
<hr>
|
<hr>
|
||||||
<!--<img src="./../../assets/404_images/404.png">-->
|
<img id="canvasImg" src="./../../assets/404_images/404.png" style="display: none">
|
||||||
<div style="position: relative;">
|
<div style="position: relative;">
|
||||||
<canvas id="canvas" width="700" height="500" >
|
<canvas id="canvas" width="700" height="500" >
|
||||||
您的浏览器不支持绘图,请升级或更换浏览器!
|
您的浏览器不支持绘图,请升级或更换浏览器!
|
||||||
|
@ -22,6 +22,7 @@
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
let preDrawAry = [];
|
let preDrawAry = [];
|
||||||
|
let img = new Image();
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
@ -38,60 +39,86 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted(){
|
mounted(){
|
||||||
|
let _this=this;
|
||||||
|
preDrawAry = [];
|
||||||
|
let canvas = document.getElementById('canvas');
|
||||||
this.canvas = document.getElementById('canvas');
|
this.canvas = document.getElementById('canvas');
|
||||||
this.ctx = this.canvas.getContext('2d');
|
this.ctx = canvas.getContext('2d');
|
||||||
this.myCanvas_rect = this.canvas.getBoundingClientRect();
|
this.myCanvas_rect = this.canvas.getBoundingClientRect();
|
||||||
this.Txt = document.getElementById('txt');
|
this.Txt = document.getElementById('txt');
|
||||||
this.word = document.getElementById('word');
|
this.word = document.getElementById('word');
|
||||||
this.widths = this.myCanvas_rect.width;
|
this.widths = this.myCanvas_rect.width;
|
||||||
this.heights = this.myCanvas_rect.height;
|
this.heights = this.myCanvas_rect.height;
|
||||||
|
setTimeout(function(){
|
||||||
|
_this.draw();
|
||||||
|
},1000)
|
||||||
|
/*
|
||||||
|
this.ctx .clearRect(0, 0, 700, 500);
|
||||||
let imgs = new Image();
|
let imgs = new Image();
|
||||||
imgs.src = "./../../assets/404_images/404.png";
|
imgs.src ="./../../assets/404_images/404.png";
|
||||||
this.ctx.drawImage(imgs,0,0,this.widths,this.heights);
|
setTimeout(function(){
|
||||||
preDrawAry = [];
|
this.draw();
|
||||||
|
this.ctx.drawImage(imgs,0,0,700,500);
|
||||||
|
},1000)*/
|
||||||
|
/* imgs.onload=function(){
|
||||||
|
this.ctx.drawImage(imgs,0,0,700,500);
|
||||||
|
this.ctx.closePath();
|
||||||
|
|
||||||
|
let pattern=this.ctx.createPattern(imgs,"no-repeat")//不加;号
|
||||||
|
this.ctx.fillStyle=pattern;
|
||||||
|
this.ctx.fillRect(0,0,700,500);
|
||||||
|
}*/
|
||||||
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
draw(){
|
||||||
|
debugger;
|
||||||
|
let canvasImg = document.getElementById("canvasImg");
|
||||||
|
canvasImg.style.width = '700px';
|
||||||
|
canvasImg.style.height = '500px';
|
||||||
|
this.ctx.drawImage(canvasImg,0,0,700,500);
|
||||||
|
},
|
||||||
// 叉号
|
// 叉号
|
||||||
error1(){
|
error1(){
|
||||||
let canvas1 = document.getElementById('canvas');
|
let canvas1 = document.getElementById('canvas');
|
||||||
let ctx1 = canvas1.getContext('2d');
|
let ctx1 = canvas1.getContext('2d');
|
||||||
this.Txt.style.display="none";
|
this.Txt.style.display="none";
|
||||||
this.word.style.display="none";
|
this.word.style.display="none";
|
||||||
ctx1.closePath();
|
ctx1.closePath();
|
||||||
this.canvas.onmousedown=function () {
|
canvas1.onmousedown=function () {
|
||||||
this.imgData= ctx1.getImageData(0,0,canvas1.width,canvas1.height);
|
this.imgData= ctx1.getImageData(0,0,canvas1.width,canvas1.height);
|
||||||
preDrawAry.push(this.imgData);
|
preDrawAry.push(this.imgData);
|
||||||
ctx1.beginPath();
|
ctx1.beginPath();
|
||||||
ctx1.strokeStyle = "#e42343";
|
ctx1.strokeStyle = "#e42343";
|
||||||
ctx1.lineWidth = "3";
|
ctx1.lineWidth = "3";
|
||||||
ctx1.lineJoin="round";
|
ctx1.lineJoin="round";
|
||||||
};
|
};
|
||||||
//鼠标按下的位置
|
//鼠标按下的位置
|
||||||
this.canvas.onmouseup=function (ev) {
|
canvas1.onmouseup=function (ev) {
|
||||||
let oldX = ev.offsetX;
|
let oldX = ev.offsetX;
|
||||||
let oldY = ev.offsetY;
|
let oldY = ev.offsetY;
|
||||||
ctx1.moveTo(oldX,oldY);
|
ctx1.moveTo(oldX,oldY);
|
||||||
ctx1.lineTo(ev.offsetX+10,ev.offsetY+10);
|
ctx1.lineTo(ev.offsetX+10,ev.offsetY+10);
|
||||||
ctx1.moveTo(ev.offsetX+10,ev.offsetY);
|
ctx1.moveTo(ev.offsetX+10,ev.offsetY);
|
||||||
ctx1.lineTo(ev.offsetX,ev.offsetY+10);
|
ctx1.lineTo(ev.offsetX,ev.offsetY+10);
|
||||||
ctx1.stroke();
|
ctx1.stroke();
|
||||||
};
|
};
|
||||||
this.ctx.closePath();
|
this.ctx.closePath();
|
||||||
},
|
},
|
||||||
|
|
||||||
// 文字先写字
|
// 文字先写字
|
||||||
text(){
|
text(){
|
||||||
let canvas2 = document.getElementById('canvas');
|
let canvas2 = document.getElementById('canvas');
|
||||||
let ctx2 = canvas2.getContext('2d');
|
let ctx2 = canvas2.getContext('2d');
|
||||||
let Txt2 = document.getElementById('txt');
|
let Txt2 = document.getElementById('txt');
|
||||||
Txt2.style.display="block";
|
Txt2.style.display="block";
|
||||||
this.word.style.display="none";
|
this.word.style.display="none";
|
||||||
ctx2.font="16px Microsoft Yahei";
|
ctx2.font="16px Microsoft Yahei";
|
||||||
canvas2.onmousedown=function (ev) {
|
canvas2.onmousedown=function (ev) {
|
||||||
this.imgData=ctx2.getImageData(0,0,canvas2.width,canvas2.height);
|
this.imgData=ctx2.getImageData(0,0,canvas2.width,canvas2.height);
|
||||||
preDrawAry.push(this.imgData);
|
preDrawAry.push(this.imgData);
|
||||||
var v = Txt2.value;
|
var v = Txt2.value;
|
||||||
// console.log(v);
|
// console.log(v);
|
||||||
if (v != '') {
|
if (v != '') {
|
||||||
var oldX = ev.offsetX;
|
var oldX = ev.offsetX;
|
||||||
var oldY = ev.offsetY;
|
var oldY = ev.offsetY;
|
||||||
|
@ -109,21 +136,21 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
// 文字
|
// 文字
|
||||||
word1(){
|
word1(){
|
||||||
let canvas3 = document.getElementById('canvas');
|
let canvas3 = document.getElementById('canvas');
|
||||||
let ctx3 = canvas3.getContext('2d');
|
let ctx3 = canvas3.getContext('2d');
|
||||||
let Txt3 = document.getElementById('txt');
|
let Txt3 = document.getElementById('txt');
|
||||||
let word3 = document.getElementById('word');
|
let word3 = document.getElementById('word');
|
||||||
Txt3.style.display="none";
|
Txt3.style.display="none";
|
||||||
ctx3.font="16px Microsoft Yahei";
|
ctx3.font="16px Microsoft Yahei";
|
||||||
canvas3.onmousedown=function () {
|
canvas3.onmousedown=function () {
|
||||||
ctx3.closePath();
|
ctx3.closePath();
|
||||||
}
|
}
|
||||||
canvas3.onmouseup=function (ev) {
|
canvas3.onmouseup=function (ev) {
|
||||||
var inputV= document.getElementById('inputV').value;
|
var inputV= document.getElementById('inputV').value;
|
||||||
if(inputV == 1){
|
if(inputV == 1){
|
||||||
document.getElementById('word').focus();
|
document.getElementById('word').focus();
|
||||||
// console.log(ev.offsetX,ev.offsetY);
|
// console.log(ev.offsetX,ev.offsetY);
|
||||||
var oldX = ev.offsetX;
|
var oldX = ev.offsetX;
|
||||||
var oldY = ev.offsetY;
|
var oldY = ev.offsetY;
|
||||||
word3.style.display="block";
|
word3.style.display="block";
|
||||||
|
@ -139,9 +166,6 @@
|
||||||
preDrawAry.push(img);
|
preDrawAry.push(img);
|
||||||
ctx3.moveTo(oldX,oldY);
|
ctx3.moveTo(oldX,oldY);
|
||||||
ctx3.fillStyle="#e42343";
|
ctx3.fillStyle="#e42343";
|
||||||
// ctx3.fillText(v,oldX,oldY+10);
|
|
||||||
// this.canvasTextAutoLine(v,canvas3,oldX,oldY,20);
|
|
||||||
|
|
||||||
let lineWidth = 0;
|
let lineWidth = 0;
|
||||||
let canvasWidth = canvas3.width;
|
let canvasWidth = canvas3.width;
|
||||||
let lastSubStrIndex= 0;
|
let lastSubStrIndex= 0;
|
||||||
|
@ -166,7 +190,7 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
// 文字过长超出换行toDataURL()
|
// 文字过长超出换行toDataURL()
|
||||||
canvasTextAutoLine(str,canvas,initX,initY,lineHeight){
|
canvasTextAutoLine(str,canvas,initX,initY,lineHeight){
|
||||||
let ctx = canvas.getContext("2d");
|
let ctx = canvas.getContext("2d");
|
||||||
let lineWidth = 0;
|
let lineWidth = 0;
|
||||||
let canvasWidth = canvas.width;
|
let canvasWidth = canvas.width;
|
||||||
|
@ -186,34 +210,64 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
// 删除批注
|
// 删除批注
|
||||||
restuya(){
|
restuya(){
|
||||||
this.word.style.display="none";
|
this.word.style.display="none";
|
||||||
this.Txt.style.display="none";
|
this.Txt.style.display="none";
|
||||||
this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height);
|
this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height);
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
},
|
},
|
||||||
|
|
||||||
// 撤销
|
// 撤销
|
||||||
back(){
|
back(){
|
||||||
this.word.style.display="none";
|
this.word.style.display="none";
|
||||||
this.Txt.style.display="none";
|
this.Txt.style.display="none";
|
||||||
if(preDrawAry.length>0) {
|
if(preDrawAry.length>0) {
|
||||||
// console.log(this.preDrawAry)
|
|
||||||
var popData = preDrawAry.pop();
|
var popData = preDrawAry.pop();
|
||||||
this.ctx.putImageData(popData, 0, 0);
|
this.ctx.putImageData(popData, 0, 0);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// 回退一次
|
// 回退一次
|
||||||
put(){
|
put(){
|
||||||
this.ctx.putImageData(this.imgData,0,0);
|
this.ctx.putImageData(this.imgData,0,0);
|
||||||
},
|
},
|
||||||
|
|
||||||
//保存
|
//保存
|
||||||
saveTu(){
|
saveTu(){
|
||||||
|
let canvas = document.getElementById('canvas');
|
||||||
var image = new Image();
|
var image = new Image();
|
||||||
image = this.canvas.toDataURL('image/png');
|
image = canvas.toDataURL('image/png');
|
||||||
document.getElementById('res').innerHTML = '<img style="border: 1px solid #666666;" src="'+image+'">';
|
document.getElementById('res').innerHTML = '<img style="border: 1px solid #666666;" src="'+image+'">';
|
||||||
|
console.log(image);
|
||||||
|
debugger;
|
||||||
|
/*img.setAttribute('crossOrigin', 'Anonymous') ;// 解决某些图片跨域(有些图片仍不可使用)
|
||||||
|
img.src = 'url';
|
||||||
|
img.onload = (imgs) => {
|
||||||
|
let base64 = this.setBase64(imgs);
|
||||||
|
var arr = base64.split(',');
|
||||||
|
var mime = arr[0].match(/:(.*?);/)[1] ;// 获取图片的类型 (image/jpg)
|
||||||
|
var bstr = atob(arr[1]); // 将base64转码
|
||||||
|
var n = bstr.length ;// 获得转码长度
|
||||||
|
var u8arr = new Uint8Array(n); // 获得length个为0的数组
|
||||||
|
while (n--) {
|
||||||
|
u8arr[n] = bstr.charCodeAt(n) // 获得unicode码
|
||||||
|
}
|
||||||
|
this.file = new File([u8arr], 'faceImg', { type: mime }); // 生成文件
|
||||||
|
console.log(this.file);
|
||||||
|
this.url = base64
|
||||||
|
}*/
|
||||||
|
},
|
||||||
|
setBase64(img) {
|
||||||
|
let ctx = document.createElement('canvas');
|
||||||
|
const c = ctx.getContext('2d');
|
||||||
|
ctx.width = img.path[0].width;
|
||||||
|
ctx.height = img.path[0].height;
|
||||||
|
c.drawImage(img.path[0], 0, 0, img.path[0].width, img.path[0].height);
|
||||||
|
let ext = img.src
|
||||||
|
.substring(img.src.lastIndexOf('.') + 1)
|
||||||
|
.toLowerCase(); // 获取图片后缀
|
||||||
|
let url = ctx.toDataURL(`image/${ext}`);
|
||||||
|
return url
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue