Merge branch 'develop' of https://e.coding.net/ctcdevteam/hberp/hberp into develop

This commit is contained in:
caoqianming 2021-09-09 14:39:46 +08:00
commit 87c158888a
14 changed files with 1514 additions and 1250 deletions

View File

@ -268,4 +268,34 @@ export function deleterffield(id, data) {
method: 'delete',
data
})
}
//技术文件
export function gettechdocList(query) {
return request({
url: '/mtm/techdoc/',
method: 'get',
params: query
})
}
export function createtechdoc(data) {
return request({
url: '/mtm/techdoc/',
method: 'post',
data
})
}
export function updatetechdoc(id, data) {
return request({
url: `/mtm/techdoc/${id}/`,
method: 'put',
data
})
}
export function deletetechdoc(id, data) {
return request({
url: `/mtm/techdoc/${id}/`,
method: 'delete',
data
})
}

View File

@ -0,0 +1,8 @@
import request from '@/utils/request'
export function faceLogin(data) {
return request({
url: '/system/facelogin/',
method: 'post',
data
})
}

View File

@ -97,7 +97,7 @@ export const asyncRoutes = [
path: 'index',
name: 'index',
component: () => import('@/views/equipment/index'),
meta: { title: '设备台账', icon: 'example', perms: ['index_manage'] }
meta: { title: '运维记录', icon: 'example', perms: ['index_manage'] }
}
]
},

View File

@ -50,6 +50,9 @@
</el-table-column>
<el-table-column label="型号规格">
<template slot-scope="scope">{{ scope.row.model }}</template>
</el-table-column>
<el-table-column label="类型">
<template slot-scope="scope">{{ type_[scope.row.type] }}</template>
</el-table-column>
<el-table-column label="购置日期">
<template slot-scope="scope">{{ scope.row.buy_date }}</template>
@ -66,6 +69,9 @@
<el-table-column label="任务备注">
<template slot-scope="scope">{{ scope.row.description }}</template>
</el-table-column>
<el-table-column label="创建时间">
<template slot-scope="scope">{{ scope.row.create_time }}</template>
</el-table-column>
<el-table-column
align="center"
@ -115,6 +121,17 @@
</el-form-item>
<el-form-item label="规格型号" prop="model">
<el-input v-model="equipment.model" placeholder="规格型号" />
</el-form-item>
<el-form-item label="类型" prop="type">
<el-select style="width: 100%" v-model="equipment.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-item label="设备状态" prop="state">
@ -127,6 +144,8 @@
</el-option>
</el-select>
</el-form-item>
<el-form-item label="生产厂商" prop="factory">
<el-input v-model="equipment.factory" placeholder="生产厂商" />
@ -220,6 +239,18 @@ export default {
equipmentList: {
count: 0,
},
type_: {
'1':'生产设备',
'2':'检验工具',
},
typeoptions: [{
value: 1,
label: '生产设备'
}, {
value: 2,
label: '检验工具'
}],
options: [{
value: 0,
label: '运转正常'
@ -242,6 +273,7 @@ export default {
rule1: {
name: [{ required: true, message: "请输入", trigger: "blur" }],
number: [{ required: true, message: "请输入", trigger: "blur" }],
type: [{ required: true, message: "请输入", trigger: "blur" }],
model: [{ required: true, message: "请输入", trigger: "blur" }],
state: [{ required: true, message: "请选择", trigger: "blur" }],
belong_dept:[{ required: true, message: "请选择", trigger: "blur" }]
@ -270,7 +302,7 @@ export default {
//组员列表
getUserList() {
getUserList({pageoff:true}).then((res) => {
this.keeperOptions = genTree(res.data.results);
this.keeperOptions = genTree(res.data);
});
},
//部门列表

View File

@ -52,7 +52,9 @@
<template slot-scope="scope">{{ scope.row.place }}</template>
</el-table-column>
<el-table-column label="创建时间">
<template slot-scope="scope">{{ scope.row.create_time }}</template>
</el-table-column>
<el-table-column
align="center"
label="操作"

View File

@ -103,6 +103,7 @@
},
activeName: "",
loading: false,
passwordType: "password",
redirect: undefined,

View File

@ -59,7 +59,9 @@
<el-table-column label="计量单位">
<template slot-scope="scope">{{ scope.row.unit }}</template>
</el-table-column>
<el-table-column label="创建时间">
<template slot-scope="scope">{{ scope.row.create_time }}</template>
</el-table-column>
<el-table-column
align="center"
@ -120,7 +122,7 @@
<el-form-item label="物料类别" prop="type">
<el-select style="width: 100%" v-model="material.type" placeholder="请选择">
<el-select style="width: 100%" v-model="material.type" placeholder="请选择" >
<el-option
v-for="item in options"
:key="item.value"
@ -129,7 +131,7 @@
</el-option>
</el-select>
</el-form-item>
<el-form-item label="绑定工序" prop="processes">
<el-form-item label="绑定工序" prop="processes" v-if="material.type==1">
<el-transfer
v-model="material.processes"
:data="processOptions"
@ -178,7 +180,7 @@ export default {
},
options: [{
value: 1,
label: ''
label: ''
}, {
value: 2,
label: '半成品'
@ -229,6 +231,7 @@ export default {
this.listLoading = false;
});
},
//工序清单
getProcessList() {
getProcessList().then((res) => {

View File

@ -34,6 +34,9 @@
<template slot-scope="scope" v-if="scope.row.instruction_">
<el-link :href="scope.row.instruction_.path" >{{scope.row.instruction_.name}}</el-link>
</template>
</el-table-column>
<el-table-column label="创建时间">
<template slot-scope="scope">{{ scope.row.create_time }}</template>
</el-table-column>
<el-table-column
align="center"
@ -167,7 +170,7 @@ export default {
},
methods: {
checkPermission,
//物料列表
//工序列表
getList() {
this.listLoading = true;
getProcessList(this.listQuery).then((response) => {

View File

@ -73,29 +73,29 @@
<el-tab-pane label="输入物料">
<el-button type="primary" icon="el-icon-plus" @click="handleinputCreate"
>新增</el-button>
<el-table
:data="inputtableData.results"
border
:data="inputtableData"
border
fit
stripe
highlight-current-row
v-el-height-adaptive-table="{bottomOffset: 50}"
style="width: 100%"
>
<el-table-column type="index" width="50" />
<el-table-column label="物料编号">
<el-table-column label="物料编号" min-width="100">
<template slot-scope="scope">{{scope.row.material_.number}}</template>
</el-table-column>
<el-table-column label="物料名称">
<el-table-column label="物料名称" min-width="100">
<template slot-scope="scope"> {{scope.row.material_.name}}</template>
</el-table-column>
<el-table-column label="计量单位">
<el-table-column label="计量单位" min-width="100">
<template slot-scope="scope">{{ scope.row.material_.unit }}</template>
</el-table-column>
<el-table-column label="单位消耗量">
<el-table-column label="单位消耗量" min-width="100">
<template slot-scope="scope">{{ scope.row.count }}</template>
</el-table-column>
@ -104,7 +104,6 @@
<el-table-column
align="center"
label="操作"
width="220px"
>
<template slot-scope="scope">
@ -169,12 +168,10 @@
>新增</el-button>
<el-table
:data="outputtableData.results"
:data="outputtableData"
border
fit
stripe
highlight-current-row
v-el-height-adaptive-table="{bottomOffset: 50}"
>
<el-table-column type="index" width="50" />
<el-table-column label="物料编号">
@ -263,12 +260,10 @@
>新增</el-button>
<el-table
:data="usedsteptableData.results"
:data="usedsteptableData"
border
fit
stripe
highlight-current-row
v-el-height-adaptive-table="{bottomOffset: 50}"
>
<el-table-column type="index" width="50" />
@ -282,7 +277,6 @@
<el-table-column
align="center"
label="操作"
width="220px"
>
<template slot-scope="scope">
@ -338,8 +332,88 @@
>新增</el-button>
</el-tab-pane>
<el-tab-pane label="技术文件">
<el-button type="primary" icon="el-icon-plus"
<el-button type="primary" icon="el-icon-plus" @click="handletechdocCreate"
>新增</el-button>
<el-table
:data="techdoctableData"
border
fit
stripe
highlight-current-row
>
<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" v-if="scope.row.file_">
<el-link :href="scope.row.file_.path" >{{scope.row.file_.name}}</el-link>
</template>
</el-table-column>
<el-table-column
align="center"
label="操作"
width="220px"
>
<template slot-scope="scope">
<el-link
v-if="checkPermission(['process_update'])"
@click="handletechdocEdit(scope)"
>编辑</el-link
>
<el-link
v-if="checkPermission(['process_delete'])"
type="danger"
@click="handletechdocDelete(scope)"
>删除</el-link
>
</template>
</el-table-column>
</el-table>
<el-dialog
:visible.sync="dialogVisiblet"
:title="dialogTypet === 'edit' ? '编辑文件' : '新增文件'"
>
<el-form
ref="Formt"
:model="techdoc"
label-width="100px"
label-position="right"
>
<el-form-item label="文件名称" prop="name">
<el-input v-model="techdoc.name" placeholder="工序名称" />
</el-form-item>
<el-form-item label="内容" prop="content">
<el-input type="textarea" :rows="6" v-model="techdoc.content" placeholder="内容" />
</el-form-item>
<el-form-item label="文件" prop="template" v-if="dialogVisiblet">
<el-upload
ref="upload"
:action="upUrl"
:on-preview="handlePreview"
:on-success="handleUpSuccess"
:on-remove="handleRemove"
:headers="upHeaders"
:file-list="fileList"
:limit="1"
accept=".doc,.docx,.xls,.xlsx,.ppt,.pptx"
>
<el-button size="small" type="primary">上传文件</el-button>
</el-upload>
</el-form-item>
</el-form>
<div style="text-align: right">
<el-button type="danger" @click="dialogVisiblet = false">取消</el-button>
<el-button type="primary" @click="techdocconfirm('Formt')">确认</el-button>
</div>
</el-dialog>
</el-tab-pane>
</el-tabs>
</el-col>
@ -349,8 +423,9 @@
<script>
import { getMaterialList,getMaterial,getInputmaterialList,createInputmaterial,updateInputmaterial
,deleteInputmaterial,getOutputmaterialList,createOutputmaterial,updateOutputmaterial,deleteOutputmaterial,
getUsedstepList,createUsedstep,deleteUsedstep,getStepList } from "@/api/mtm";
getUsedstepList,createUsedstep,deleteUsedstep,getStepList,gettechdocList,createtechdoc,updatetechdoc,deletetechdoc } from "@/api/mtm";
import { upUrl, upHeaders } from "@/api/file";
import checkPermission from "@/utils/permission";
import { genTree } from "@/utils";
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
@ -362,6 +437,9 @@ const defaultoutputmaterial = {
};
const defaultusedstep = {
};
const defaulttechdoc = {
};
export default {
@ -370,16 +448,20 @@ export default {
data() {
return {
materialoptions:[],
inputtableData:{count: 0},
inputmaterial: defaultinputmaterial,
outputtableData:{count: 0},
inputtableData:"",
techdoc: defaulttechdoc,
inputmaterial: defaultinputmaterial,
techdoctableData:"",
outputtableData:"",
outputmaterial: defaultoutputmaterial,
usedsteptableData:{count: 0},
usedsteptableData:"",
usedstep: defaultusedstep,
materialList: {
count: 0,
},
upHeaders: upHeaders(),
upUrl: upUrl(),
fileList:[],
stepoptions:[],
processoptions:[],
listQuery: {
@ -387,18 +469,18 @@ export default {
page_size: 20,
},
listQueryinput: {
page: 1,
page_size: 20,
page: 0,
},
listQueryoutput: {
page: 1,
page_size: 20,
page: 0,
},
listQueryusedstep: {
page: 1,
page_size: 20,
page: 0,
},
values:1,
listQuerytechdoc:{
page: 0,
},
values:7,
products:"",
dialogType: "new",
dialogVisible:false,
@ -406,6 +488,8 @@ export default {
dialogVisible1:false,
dialogTypeusedstep: "new",
dialogVisibleusedstep:false,
dialogTypet: "new",
dialogVisiblet:false,
listLoading: true,
};
@ -468,6 +552,7 @@ export default {
this.getOutputmaterialLists();
this.getstepList();
this. getUsedstepLists();
this.gettechdocLists();
},
@ -480,6 +565,7 @@ export default {
this.listQueryinput.process=this.process;
this.listQueryinput.product=this.product
//this.listQueryinput.page=0;
getInputmaterialList(this.listQueryinput).then((response) => {
if (response.data) {
@ -560,6 +646,7 @@ export default {
this.listQueryoutput.process=this.process;
this.listQueryoutput.product=this.product
// this.listQueryoutput.page=0;
getOutputmaterialList(this.listQueryoutput).then((response) => {
if (response.data) {
@ -639,6 +726,7 @@ export default {
this.listQueryusedstep.process=this.process;
this.listQueryusedstep.product=this.product
// this.listQueryusedstep.page=0;
getUsedstepList(this.listQueryusedstep).then((response) => {
if (response.data) {
@ -673,6 +761,8 @@ export default {
this.$refs["Formusedstep"].clearValidate();
});
},
handleusedstepEdit(scope) {
this.outputmaterial = Object.assign({}, scope.row); // copy obj
this.dialogType1 = "edit";
@ -709,30 +799,103 @@ export default {
}
});
},
//技术文件
gettechdocLists(){
this.listQuerytechdoc.process=this.process;
this.listQuerytechdoc.product=this.product;
// this.listQuerytechdoc.page=0;
gettechdocList(this.listQuerytechdoc).then((response) => {
if (response.data) {
this.techdoctableData = response.data;//技术文件
}
})
},
handletechdocCreate(){
this.techdoc = Object.assign({}, defaulttechdoc);
this.dialogTypet = "new";
this.dialogVisiblet = true;
this.fileList=[];
this.$nextTick(() => {
this.$refs["Formt"].clearValidate();
});
},
handlePreview(file) {
if ("url" in file) {
window.open(file.url);
} else {
window.open(file.response.data.path);
}
},
handleUpSuccess(res, file, filelist) {
this.techdoc.file = res.data.id;
},
handleRemove(file, filelist){
this.techdoc.file = null;
},
handletechdocEdit(scope) {
this.techdoc = Object.assign({}, scope.row); // copy obj
this.dialogTypet = "edit";
this.dialogVisiblet = true;
if (this.techdoc.file) {
this.fileList = [
{
name:this.techdoc.file_.name,
url: this.techdoc.file_.path,
},
];
}
this.$nextTick(() => {
this.$refs["Formt"].clearValidate();
});
},
handletechdocDelete(scope) {
this.$confirm("确认删除?", "警告", {
confirmButtonText: "确认",
cancelButtonText: "取消",
type: "error",
})
.then(async () => {
await deletetechdoc(scope.row.id);
this.gettechdocLists();
this.$message.success("成功");
})
.catch((err) => {
console.error(err);
});
},
async techdocconfirm(form) {
this.$refs[form].validate((valid) => {
if (valid) {
const isEdit = this.dialogTypet === "edit";
if (isEdit) {
updatetechdoc(this.techdoc.id, this.techdoc).then((res) => {
if (res.code >= 200) {
this.gettechdocLists();
this.dialogVisiblet = false;
this.$message.success("成功");
}
});
} else {
this.techdoc.process=this.process;
this.techdoc.product=this.product;
createtechdoc(this.techdoc).then((res) => {
if (res.code >= 200) {
this.gettechdocLists();
this.dialogVisiblet = false;
this.$message.success("成功");
}
});
}
} else {
return false;
}
});
},
},
};
</script>
<style>
.el-col {
border-radius: 4px;
}
.bg-purple-dark {
background: #99a9bf;
}
.bg-purple {
background: #d3dce6;
}
.bg-purple-light {
background: #e5e9f2;
}
.grid-content {
border-radius: 4px;
min-height: 36px;
}
.box-card{
height:130px;
}
</style>

File diff suppressed because it is too large Load Diff

View File

@ -1,508 +1,508 @@
<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">{{stepDO.name}}</el-descriptions-item>
<el-descriptions-item label="步骤编号" label-class-name="my-label" content-class-name="my-content">{{stepDO.number}}</el-descriptions-item>
<el-descriptions-item label="相关设备" label-class-name="my-label" :contentStyle="{'text-align': 'left'}">
<el-tag v-for="item in stepDO.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">{{stepDO.name}}</el-descriptions-item>
<el-descriptions-item label="步骤编号" label-class-name="my-label" content-class-name="my-content">{{stepDO.number}}</el-descriptions-item>
<el-descriptions-item label="相关设备" label-class-name="my-label" :contentStyle="{'text-align': 'left'}">
<el-tag v-for="item in stepDO.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-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-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-card>
</el-col>
</el-row>
</el-tab-pane>
</el-tabs>
</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-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-card>
</el-col>
</el-row>
</el-tab-pane>
</el-tabs>
</el-card>
</div>
</template>
<script>
import { getStep,getrecordformList,createrecordform,updaterecordform,deleterecordform,getrffieldList,createrffield,updaterffield,
deleterffield} from "@/api/mtm";
import { getStep,getrecordformList,createrecordform,updaterecordform,deleterecordform,getrffieldList,createrffield,updaterffield,
deleterffield} from "@/api/mtm";
import vueJsonEditor from 'vue-json-editor'
import checkPermission from "@/utils/permission";
const defaultrecordform = {
};
const defaultfield = {
};
export default {
components: { vueJsonEditor },
name: "stepdo",
props: ["stepid"],
data() {
return {
stepDO:"",
recordform: defaultrecordform,
import vueJsonEditor from 'vue-json-editor'
import checkPermission from "@/utils/permission";
const defaultrecordform = {
};
const defaultfield = {
};
export default {
components: { vueJsonEditor },
name: "stepdo",
props: ["stepid"],
data() {
return {
stepDO:"",
recordform: defaultrecordform,
field: defaultfield,
dialogType: "new",
dialogVisible:false,
dialogType1: "new",
dialogVisible1:false,
listQueryrecordform: {
page: 1,
page_size: 20,
},
recordformList: {
count: 0,
},
dialogType: "new",
dialogVisible:false,
dialogType1: "new",
dialogVisible1:false,
listQueryrecordform: {
page: 1,
page_size: 20,
},
recordformList: {
count: 0,
},
fieldList: {
count: 0,
},
listQueryfield: {
page: 1,
page_size: 20,
},
options_: {
'string':'字符串',
'int':'整型',
'float': '浮点',
count: 0,
},
listQueryfield: {
page: 1,
page_size: 20,
},
options_: {
'string':'字符串',
'int':'整型',
'float': '浮点',
'boolean':'布尔',
'date': '日期',
'date': '日期',
'datetime': '日期时间',
'radio': '单选',
'checkbox': '多选',
'select': '单选下拉',
'selects': '多选下拉',
'textarea': '文本域'
'radio': '单选',
'checkbox': '多选',
'select': '单选下拉',
'selects': '多选下拉',
'textarea': '文本域'
},
fieldtypeoptions: [{
value: 'string',
label: '字符串'
},
{
value: 'int',
label: '整型'
},
{
value: 'float',
label: '浮点'
},
{
value: 'boolean',
label: '布尔'
},
{
value: 'date',
label: '日期'
},
{
value: 'datetime',
label: '日期时间'
},
{
value: 'radio',
label: '单选'
},
{
value: 'checkbox',
label: '多选'
},
{
value: 'select',
label: '单选下拉'
},
{
value: 'selects',
label: '多选下拉'
},
{
value: 'textarea',
label: '文本域'
}],
typeoptions: [{
{
value: 'int',
label: '整型'
},
{
value: 'float',
label: '浮点'
},
{
value: 'boolean',
label: '布尔'
},
{
value: 'date',
label: '日期'
},
{
value: 'datetime',
label: '日期时间'
},
{
value: 'radio',
label: '单选'
},
{
value: 'checkbox',
label: '多选'
},
{
value: 'select',
label: '单选下拉'
},
{
value: 'selects',
label: '多选下拉'
},
{
value: 'textarea',
label: '文本域'
}],
typeoptions: [{
value: 1,
label: '生产记录'
}],
};
},
computed: {},
watch: {
},
created() {
this.getStepD();
this.recordformLists();
},
methods: {
checkPermission,
getStepD()
{
getStep(this.stepid).then((response) => {
if (response.data) {
this.stepDO = response.data;
}
});
},
handleCurrentChange(row){
this.formID=row.id;
this.fieldLists();
};
},
recordformLists()
{
this.listQueryrecordform.step=this.stepid;
getrecordformList(this.listQueryrecordform).then((response) => {
if (response.data) {
this.recordformList = response.data;
}
});
},
computed: {},
watch: {
},
created() {
this.getStepD();
this.recordformLists();
},
methods: {
checkPermission,
getStepD()
{
getStep(this.stepid).then((response) => {
if (response.data) {
this.stepDO = response.data;
}
});
},
handleCurrentChange(row){
this.formID=row.id;
this.fieldLists();
},
recordformLists()
{
this.listQueryrecordform.step=this.stepid;
getrecordformList(this.listQueryrecordform).then((response) => {
if (response.data) {
this.recordformList = response.data;
}
});
},
fieldLists()
{
this.listQueryfield.form=this.formID
getrffieldList(this.listQueryfield).then((response) => {
if (response.data) {
this.fieldList = response.data;
}
});
},
{
this.listQueryfield.form=this.formID
getrffieldList(this.listQueryfield).then((response) => {
if (response.data) {
this.fieldList = response.data;
}
});
},
handleCreate() {
this.recordform = Object.assign({}, defaultrecordform);
this.dialogType = "new";
this.dialogVisible = true;
this.$nextTick(() => {
this.$refs["Forms"].clearValidate();
});
},
this.recordform = Object.assign({}, defaultrecordform);
this.dialogType = "new";
this.dialogVisible = true;
this.$nextTick(() => {
this.$refs["Forms"].clearValidate();
});
},
handlefieldCreate() {
this.field = Object.assign({}, defaultfield);
this.dialogType1 = "new";
this.dialogVisible1 = true;
this.$nextTick(() => {
this.$refs["Form"].clearValidate();
});
},
this.field = Object.assign({}, defaultfield);
this.dialogType1 = "new";
this.dialogVisible1 = true;
this.$nextTick(() => {
this.$refs["Form"].clearValidate();
});
},
handleEdit(scope) {
this.recordform = Object.assign({}, scope.row); // copy obj
this.dialogType = "edit";
this.dialogVisible = true;
this.$nextTick(() => {
this.$refs["Forms"].clearValidate();
});
},
handlefieldEdit(scope) {
this.field = Object.assign({}, scope.row); // copy obj
this.dialogType1 = "edit";
this.dialogVisible1 = true;
this.$nextTick(() => {
this.$refs["Form"].clearValidate();
});
},
handleDelete(scope) {
this.$confirm("确认删除?", "警告", {
confirmButtonText: "确认",
cancelButtonText: "取消",
type: "error",
})
.then(async () => {
await deleterecordform(scope.row.id);
this.recordformLists()
this.$message.success("成功");
})
.catch((err) => {
console.error(err);
this.recordform = Object.assign({}, scope.row); // copy obj
this.dialogType = "edit";
this.dialogVisible = true;
this.$nextTick(() => {
this.$refs["Forms"].clearValidate();
});
},
handlefieldDelete(scope) {
this.$confirm("确认删除?", "警告", {
confirmButtonText: "确认",
cancelButtonText: "取消",
type: "error",
})
.then(async () => {
await deleterffield(scope.row.id);
this.fieldLists()
this.$message.success("成功");
})
.catch((err) => {
console.error(err);
},
handlefieldEdit(scope) {
this.field = Object.assign({}, scope.row); // copy obj
this.dialogType1 = "edit";
this.dialogVisible1 = true;
this.$nextTick(() => {
this.$refs["Form"].clearValidate();
});
},
async recordformconfirm(form) {
this.$refs[form].validate((valid) => {
if (valid) {
const isEdit = this.dialogType === "edit";
if (isEdit) {
this.recordform.step=this.stepid
updaterecordform(this.recordform.id, this.recordform).then((res) => {
if (res.code >= 200) {
this.recordformLists()
this.dialogVisible = false;
this.$message.success("成功");
}
});
},
handleDelete(scope) {
this.$confirm("确认删除?", "警告", {
confirmButtonText: "确认",
cancelButtonText: "取消",
type: "error",
})
.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",
})
.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.stepid
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.stepid
createrecordform(this.recordform).then((res) => {
if (res.code >= 200) {
this.recordformLists()
this.dialogVisible = false;
this.$message.success("成功");
}
});
}
} else {
this.recordform.step=this.stepid
createrecordform(this.recordform).then((res) => {
if (res.code >= 200) {
this.recordformLists()
this.dialogVisible = false;
this.$message.success("成功");
}
});
return false;
}
} 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("成功");
}
});
});
},
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
createrffield(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("成功");
}
});
return false;
}
} else {
return false;
}
});
});
},
},
},
};
};
</script>
<style>
.my-label {
@ -512,4 +512,4 @@ export default {
.my-content {
background: #FDE2E2;
}
</style>
</style>

View File

@ -58,7 +58,9 @@
<el-table-column label="备注">
<template slot-scope="scope">{{ scope.row.description }}</template>
</el-table-column>
<el-table-column label="创建时间">
<template slot-scope="scope">{{ scope.row.create_time }}</template>
</el-table-column>
<el-table-column
align="center"
label="操作"

View File

@ -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>

View File

@ -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
}
}
}