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,
|
||||
passwordType: "password",
|
||||
redirect: undefined,
|
||||
|
|
|
@ -1,237 +1,202 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<el-card>
|
||||
|
||||
<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.number}}</el-descriptions-item>
|
||||
<el-descriptions-item label="相关设备" label-class-name="my-label" :contentStyle="{'text-align': 'left'}">
|
||||
<el-tag v-for="item in step.equipments_"
|
||||
:key="item.number"
|
||||
:label="item.name"
|
||||
:value="item.number">{{item.name}}</el-tag>
|
||||
</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-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-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.number}}</el-descriptions-item>
|
||||
<el-descriptions-item label="相关设备" label-class-name="my-label" :contentStyle="{'text-align': 'left'}">
|
||||
<el-tag v-for="item in step.equipments_"
|
||||
:key="item.number"
|
||||
:label="item.name"
|
||||
:value="item.number">{{item.name}}</el-tag>
|
||||
</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-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>
|
||||
<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>
|
||||
:data="recordformList.results"
|
||||
border
|
||||
fit
|
||||
stripe
|
||||
highlight-current-row
|
||||
height="100"
|
||||
v-el-height-adaptive-table="{bottomOffset: 50}"
|
||||
@current-change="handleCurrentChange"
|
||||
>
|
||||
|
||||
<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-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-link
|
||||
v-if="checkPermission(['material_delete'])"
|
||||
type="danger"
|
||||
@click="handlefieldDelete(scope)"
|
||||
>删除</el-link
|
||||
>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
</el-table>
|
||||
</el-card>
|
||||
<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-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-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>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { getStep,getrecordformList,createrecordform,updaterecordform,deleterecordform,getrffieldList,createrffield,updaterffield,
|
||||
deleterffield} from "@/api/mtm";
|
||||
|
||||
import vueJsonEditor from 'vue-json-editor'
|
||||
// import vueJsonEditor from 'vue-json-editor'
|
||||
import checkPermission from "@/utils/permission";
|
||||
const defaultrecordform = {
|
||||
|
||||
|
@ -240,63 +205,68 @@ const defaultfield = {
|
|||
|
||||
};
|
||||
export default {
|
||||
components: { vueJsonEditor },
|
||||
name:'stepdo',
|
||||
// components: { vueJsonEditor },
|
||||
data() {
|
||||
return {
|
||||
step:"",
|
||||
step:"",
|
||||
recordform: defaultrecordform,
|
||||
field: defaultfield,
|
||||
dialogType: "new",
|
||||
field: {
|
||||
field_type:'',
|
||||
field_key:'',
|
||||
field_name:'',
|
||||
sort:'',
|
||||
field_choice:[],
|
||||
},
|
||||
date:'',
|
||||
datetime:'',
|
||||
time:'',
|
||||
options:[''],
|
||||
dialogType: "new",
|
||||
dialogVisible:false,
|
||||
dialogType1: "new",
|
||||
dialogType1: "new",
|
||||
dialogVisible1:false,
|
||||
listQueryrecordform: {
|
||||
listQueryrecordform: {
|
||||
page: 1,
|
||||
page_size: 20,
|
||||
},
|
||||
recordformList: {
|
||||
recordformList: {
|
||||
count: 0,
|
||||
},
|
||||
fieldList: {
|
||||
fieldList: {
|
||||
count: 0,
|
||||
},
|
||||
listQueryfield: {
|
||||
listQueryfield: {
|
||||
page: 1,
|
||||
page_size: 20,
|
||||
},
|
||||
options_: {
|
||||
'string':'字符串',
|
||||
'int':'整型',
|
||||
'float': '浮点',
|
||||
'boolean':'布尔',
|
||||
'date': '日期',
|
||||
'datetime': '日期时间',
|
||||
'radio': '单选',
|
||||
'checkbox': '多选',
|
||||
'select': '单选下拉',
|
||||
'selects': '多选下拉',
|
||||
'textarea': '文本域'
|
||||
},
|
||||
fieldtypeoptions: [{
|
||||
'string':'字符串',
|
||||
'number':'数字',
|
||||
'date': '日期',
|
||||
'datetime': '日期时间',
|
||||
'radio': '单选',
|
||||
'checkbox': '多选',
|
||||
// 'select': '单选下拉',
|
||||
// 'selects': '多选下拉',
|
||||
// 'textarea': '文本域'
|
||||
},
|
||||
fieldtypeoptions: [{
|
||||
value: 'string',
|
||||
label: '字符串'
|
||||
label: '文字'
|
||||
},
|
||||
{
|
||||
value: 'int',
|
||||
label: '整型'
|
||||
value: 'number',
|
||||
label: '数字'
|
||||
},
|
||||
{
|
||||
value: 'float',
|
||||
label: '浮点'
|
||||
},
|
||||
value: 'date',
|
||||
label: '日期'
|
||||
},
|
||||
{
|
||||
value: 'boolean',
|
||||
label: '布尔'
|
||||
},
|
||||
{
|
||||
value: 'date',
|
||||
label: '日期'
|
||||
},
|
||||
value: 'time',
|
||||
label: '时间'
|
||||
},
|
||||
{
|
||||
value: 'datetime',
|
||||
label: '日期时间'
|
||||
|
@ -308,37 +278,31 @@ export default {
|
|||
{
|
||||
value: 'checkbox',
|
||||
label: '多选'
|
||||
},
|
||||
{
|
||||
value: 'select',
|
||||
label: '单选下拉'
|
||||
},
|
||||
{
|
||||
value: 'selects',
|
||||
label: '多选下拉'
|
||||
},
|
||||
{
|
||||
value: 'textarea',
|
||||
label: '文本域'
|
||||
}],
|
||||
typeoptions: [{
|
||||
value: 1,
|
||||
label: '生产记录'
|
||||
}],
|
||||
}
|
||||
],
|
||||
typeoptions: [{
|
||||
value: 1,
|
||||
label: '生产记录'
|
||||
}]
|
||||
};
|
||||
},
|
||||
computed: {},
|
||||
watch: {},
|
||||
created() {
|
||||
|
||||
this.getStepD();
|
||||
this.recordformLists();
|
||||
|
||||
},
|
||||
methods: {
|
||||
//添加
|
||||
addDomain() {
|
||||
this.options.push('')
|
||||
},
|
||||
//删除
|
||||
removeDomain(index){
|
||||
this.options.splice(index, 1)
|
||||
},
|
||||
checkPermission,
|
||||
getStepD()
|
||||
{
|
||||
getStepD(){
|
||||
getStep(this.$route.params.id).then((response) => {
|
||||
if (response.data) {
|
||||
this.step = response.data;
|
||||
|
@ -396,104 +360,104 @@ export default {
|
|||
this.$refs["Forms"].clearValidate();
|
||||
});
|
||||
},
|
||||
handlefieldEdit(scope) {
|
||||
handlefieldEdit(scope) {
|
||||
this.field = Object.assign({}, scope.row); // copy obj
|
||||
this.dialogType1 = "edit";
|
||||
this.dialogVisible1 = true;
|
||||
this.$nextTick(() => {
|
||||
this.$refs["Form"].clearValidate();
|
||||
});
|
||||
},
|
||||
handleDelete(scope) {
|
||||
},
|
||||
handleDelete(scope) {
|
||||
this.$confirm("确认删除?", "警告", {
|
||||
confirmButtonText: "确认",
|
||||
cancelButtonText: "取消",
|
||||
type: "error",
|
||||
confirmButtonText: "确认",
|
||||
cancelButtonText: "取消",
|
||||
type: "error",
|
||||
})
|
||||
.then(async () => {
|
||||
await deleterecordform(scope.row.id);
|
||||
this.recordformLists()
|
||||
this.$message.success("成功");
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error(err);
|
||||
});
|
||||
},
|
||||
handlefieldDelete(scope) {
|
||||
.then(async () => {
|
||||
await deleterecordform(scope.row.id);
|
||||
this.recordformLists()
|
||||
this.$message.success("成功");
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error(err);
|
||||
});
|
||||
},
|
||||
handlefieldDelete(scope) {
|
||||
this.$confirm("确认删除?", "警告", {
|
||||
confirmButtonText: "确认",
|
||||
cancelButtonText: "取消",
|
||||
type: "error",
|
||||
confirmButtonText: "确认",
|
||||
cancelButtonText: "取消",
|
||||
type: "error",
|
||||
})
|
||||
.then(async () => {
|
||||
await deleterffield(scope.row.id);
|
||||
this.fieldLists()
|
||||
this.$message.success("成功");
|
||||
})
|
||||
.catch((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;
|
||||
}
|
||||
.then(async () => {
|
||||
await deleterffield(scope.row.id);
|
||||
this.fieldLists()
|
||||
this.$message.success("成功");
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error(err);
|
||||
});
|
||||
},
|
||||
async fieldconfirm(form) {
|
||||
},
|
||||
async recordformconfirm(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
|
||||
|
||||
createrffield(this.field).then((res) => {
|
||||
if (res.code >= 200) {
|
||||
this.fieldLists()
|
||||
this.dialogVisible1 = false;
|
||||
this.$message.success("成功");
|
||||
}
|
||||
});
|
||||
}
|
||||
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 {
|
||||
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>
|
||||
|
@ -505,4 +469,4 @@ export default {
|
|||
.my-content {
|
||||
background: #FDE2E2;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import {faceLogin} from "@/api/testModel";
|
||||
// import "tracking/build/data/face-min.js";
|
||||
// import "tracking/build/data/mouth-min.js";
|
||||
// import "tracking/build/data/tracking-min.js";
|
||||
|
@ -64,11 +65,20 @@
|
|||
let canvas = document.getElementById("myCanvas");
|
||||
let context = canvas.getContext('2d');
|
||||
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();
|
||||
image = canvas.toDataURL('image/png');
|
||||
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 () {
|
||||
if (!this.$refs['video'].srcObject) return;
|
||||
|
@ -172,13 +182,13 @@
|
|||
|
||||
<style scoped>
|
||||
|
||||
.testTracking {
|
||||
min-height: 700px;
|
||||
width: 100%;
|
||||
position: relative;
|
||||
}
|
||||
.buttonDiv {
|
||||
bottom: 10px;
|
||||
}
|
||||
.testTracking {
|
||||
min-height: 700px;
|
||||
width: 100%;
|
||||
position: relative;
|
||||
}
|
||||
.buttonDiv {
|
||||
bottom: 10px;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<button @click="back()">回退</button>
|
||||
<button @click="saveTu()">保存</button>
|
||||
<hr>
|
||||
<!--<img src="./../../assets/404_images/404.png">-->
|
||||
<img id="canvasImg" src="./../../assets/404_images/404.png" style="display: none">
|
||||
<div style="position: relative;">
|
||||
<canvas id="canvas" width="700" height="500" >
|
||||
您的浏览器不支持绘图,请升级或更换浏览器!
|
||||
|
@ -22,6 +22,7 @@
|
|||
</template>
|
||||
<script>
|
||||
let preDrawAry = [];
|
||||
let img = new Image();
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
|
@ -38,60 +39,86 @@
|
|||
}
|
||||
},
|
||||
mounted(){
|
||||
let _this=this;
|
||||
preDrawAry = [];
|
||||
let 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.Txt = document.getElementById('txt');
|
||||
this.word = document.getElementById('word');
|
||||
this.widths = this.myCanvas_rect.width;
|
||||
this.heights = this.myCanvas_rect.height;
|
||||
setTimeout(function(){
|
||||
_this.draw();
|
||||
},1000)
|
||||
/*
|
||||
this.ctx .clearRect(0, 0, 700, 500);
|
||||
let imgs = new Image();
|
||||
imgs.src = "./../../assets/404_images/404.png";
|
||||
this.ctx.drawImage(imgs,0,0,this.widths,this.heights);
|
||||
preDrawAry = [];
|
||||
imgs.src ="./../../assets/404_images/404.png";
|
||||
setTimeout(function(){
|
||||
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: {
|
||||
draw(){
|
||||
debugger;
|
||||
let canvasImg = document.getElementById("canvasImg");
|
||||
canvasImg.style.width = '700px';
|
||||
canvasImg.style.height = '500px';
|
||||
this.ctx.drawImage(canvasImg,0,0,700,500);
|
||||
},
|
||||
// 叉号
|
||||
error1(){
|
||||
let canvas1 = document.getElementById('canvas');
|
||||
let ctx1 = canvas1.getContext('2d');
|
||||
this.Txt.style.display="none";
|
||||
this.word.style.display="none";
|
||||
ctx1.closePath();
|
||||
this.canvas.onmousedown=function () {
|
||||
this.imgData= ctx1.getImageData(0,0,canvas1.width,canvas1.height);
|
||||
preDrawAry.push(this.imgData);
|
||||
ctx1.beginPath();
|
||||
ctx1.strokeStyle = "#e42343";
|
||||
ctx1.lineWidth = "3";
|
||||
ctx1.lineJoin="round";
|
||||
error1(){
|
||||
let canvas1 = document.getElementById('canvas');
|
||||
let ctx1 = canvas1.getContext('2d');
|
||||
this.Txt.style.display="none";
|
||||
this.word.style.display="none";
|
||||
ctx1.closePath();
|
||||
canvas1.onmousedown=function () {
|
||||
this.imgData= ctx1.getImageData(0,0,canvas1.width,canvas1.height);
|
||||
preDrawAry.push(this.imgData);
|
||||
ctx1.beginPath();
|
||||
ctx1.strokeStyle = "#e42343";
|
||||
ctx1.lineWidth = "3";
|
||||
ctx1.lineJoin="round";
|
||||
};
|
||||
//鼠标按下的位置
|
||||
this.canvas.onmouseup=function (ev) {
|
||||
canvas1.onmouseup=function (ev) {
|
||||
let oldX = ev.offsetX;
|
||||
let oldY = ev.offsetY;
|
||||
ctx1.moveTo(oldX,oldY);
|
||||
ctx1.lineTo(ev.offsetX+10,ev.offsetY+10);
|
||||
ctx1.moveTo(ev.offsetX+10,ev.offsetY);
|
||||
ctx1.lineTo(ev.offsetX,ev.offsetY+10);
|
||||
ctx1.stroke();
|
||||
ctx1.moveTo(oldX,oldY);
|
||||
ctx1.lineTo(ev.offsetX+10,ev.offsetY+10);
|
||||
ctx1.moveTo(ev.offsetX+10,ev.offsetY);
|
||||
ctx1.lineTo(ev.offsetX,ev.offsetY+10);
|
||||
ctx1.stroke();
|
||||
};
|
||||
this.ctx.closePath();
|
||||
this.ctx.closePath();
|
||||
},
|
||||
|
||||
// 文字先写字
|
||||
text(){
|
||||
let canvas2 = document.getElementById('canvas');
|
||||
let ctx2 = canvas2.getContext('2d');
|
||||
let Txt2 = document.getElementById('txt');
|
||||
Txt2.style.display="block";
|
||||
this.word.style.display="none";
|
||||
ctx2.font="16px Microsoft Yahei";
|
||||
canvas2.onmousedown=function (ev) {
|
||||
this.imgData=ctx2.getImageData(0,0,canvas2.width,canvas2.height);
|
||||
preDrawAry.push(this.imgData);
|
||||
text(){
|
||||
let canvas2 = document.getElementById('canvas');
|
||||
let ctx2 = canvas2.getContext('2d');
|
||||
let Txt2 = document.getElementById('txt');
|
||||
Txt2.style.display="block";
|
||||
this.word.style.display="none";
|
||||
ctx2.font="16px Microsoft Yahei";
|
||||
canvas2.onmousedown=function (ev) {
|
||||
this.imgData=ctx2.getImageData(0,0,canvas2.width,canvas2.height);
|
||||
preDrawAry.push(this.imgData);
|
||||
var v = Txt2.value;
|
||||
// console.log(v);
|
||||
// console.log(v);
|
||||
if (v != '') {
|
||||
var oldX = ev.offsetX;
|
||||
var oldY = ev.offsetY;
|
||||
|
@ -109,21 +136,21 @@
|
|||
},
|
||||
|
||||
// 文字
|
||||
word1(){
|
||||
let canvas3 = document.getElementById('canvas');
|
||||
let ctx3 = canvas3.getContext('2d');
|
||||
let Txt3 = document.getElementById('txt');
|
||||
let word3 = document.getElementById('word');
|
||||
Txt3.style.display="none";
|
||||
ctx3.font="16px Microsoft Yahei";
|
||||
canvas3.onmousedown=function () {
|
||||
ctx3.closePath();
|
||||
word1(){
|
||||
let canvas3 = document.getElementById('canvas');
|
||||
let ctx3 = canvas3.getContext('2d');
|
||||
let Txt3 = document.getElementById('txt');
|
||||
let word3 = document.getElementById('word');
|
||||
Txt3.style.display="none";
|
||||
ctx3.font="16px Microsoft Yahei";
|
||||
canvas3.onmousedown=function () {
|
||||
ctx3.closePath();
|
||||
}
|
||||
canvas3.onmouseup=function (ev) {
|
||||
canvas3.onmouseup=function (ev) {
|
||||
var inputV= document.getElementById('inputV').value;
|
||||
if(inputV == 1){
|
||||
document.getElementById('word').focus();
|
||||
// console.log(ev.offsetX,ev.offsetY);
|
||||
// console.log(ev.offsetX,ev.offsetY);
|
||||
var oldX = ev.offsetX;
|
||||
var oldY = ev.offsetY;
|
||||
word3.style.display="block";
|
||||
|
@ -139,9 +166,6 @@
|
|||
preDrawAry.push(img);
|
||||
ctx3.moveTo(oldX,oldY);
|
||||
ctx3.fillStyle="#e42343";
|
||||
// ctx3.fillText(v,oldX,oldY+10);
|
||||
// this.canvasTextAutoLine(v,canvas3,oldX,oldY,20);
|
||||
|
||||
let lineWidth = 0;
|
||||
let canvasWidth = canvas3.width;
|
||||
let lastSubStrIndex= 0;
|
||||
|
@ -166,7 +190,7 @@
|
|||
},
|
||||
|
||||
// 文字过长超出换行toDataURL()
|
||||
canvasTextAutoLine(str,canvas,initX,initY,lineHeight){
|
||||
canvasTextAutoLine(str,canvas,initX,initY,lineHeight){
|
||||
let ctx = canvas.getContext("2d");
|
||||
let lineWidth = 0;
|
||||
let canvasWidth = canvas.width;
|
||||
|
@ -186,34 +210,64 @@
|
|||
},
|
||||
|
||||
// 删除批注
|
||||
restuya(){
|
||||
this.word.style.display="none";
|
||||
this.Txt.style.display="none";
|
||||
this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height);
|
||||
restuya(){
|
||||
this.word.style.display="none";
|
||||
this.Txt.style.display="none";
|
||||
this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height);
|
||||
window.location.reload();
|
||||
},
|
||||
|
||||
// 撤销
|
||||
back(){
|
||||
this.word.style.display="none";
|
||||
this.Txt.style.display="none";
|
||||
back(){
|
||||
this.word.style.display="none";
|
||||
this.Txt.style.display="none";
|
||||
if(preDrawAry.length>0) {
|
||||
// console.log(this.preDrawAry)
|
||||
var popData = preDrawAry.pop();
|
||||
this.ctx.putImageData(popData, 0, 0);
|
||||
}
|
||||
},
|
||||
|
||||
// 回退一次
|
||||
put(){
|
||||
this.ctx.putImageData(this.imgData,0,0);
|
||||
put(){
|
||||
this.ctx.putImageData(this.imgData,0,0);
|
||||
},
|
||||
|
||||
//保存
|
||||
saveTu(){
|
||||
saveTu(){
|
||||
let canvas = document.getElementById('canvas');
|
||||
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+'">';
|
||||
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