hberp/hb_client/src/views/mtm/materialdo.vue

1099 lines
38 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<div class="app-container">
<el-card>
<el-row :gutter="2">
<!--表格-->
<el-col :span="10">
<el-card>
<div
slot="header"
class="clearfix"
>
<span style="font-size: 16px; font-weight: 700">物料检验记录表</span>
</div>
<el-button
type="primary"
icon="el-icon-plus"
@click="handleCreate"
>
新增
</el-button>
<!--表格列表-->
<el-table
:data="recordformList.results"
border
fit
stripe
highlight-current-row
height="670"
v-el-height-adaptive-table="{ bottomOffset: 20 }"
@current-change="handleCurrentChange"
>
<el-table-column type="index" width="50"/>
<el-table-column label="表名称" prop="name">
</el-table-column>
<el-table-column label="表类型">
<template slot-scope="scope">
{{typeOptions_[scope.row.type]}}
</template>
</el-table-column>
<el-table-column label="是否启用">
<template slot-scope="scope">
<el-tag v-if="scope.row.enabled==false"></el-tag>
<el-tag v-if="scope.row.enabled==true"></el-tag>
</template>
</el-table-column>
<el-table-column align="center" label="操作">
<template slot-scope="scope">
<el-link
v-if="checkPermission(['material_update'])"
@click="handleLook(scope)"
>查看
</el-link>
<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"
:close-on-click-modal="false"
: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="formUsed">
<el-select
v-model="recordform.type"
clearable
style="width: 100%"
placeholder="请选择"
@change="formTypeChange"
>
<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="field_type">
<el-select
v-model="recordform.form"
style="width: 100%"
clearable
filterable
placeholder="请选择"
>
<el-option
v-for="item in formList"
:key="item.id"
:label="item.name"
:value="item.id"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="表单模板" prop="template">
<el-upload
ref="upload"
:action="upUrl"
:on-success="handleUpSuccess"
:on-remove="handleRemove"
:headers="upHeaders"
:file-list="fileList"
:limit="1"
accept=".docx"
>
<el-button size="small" type="primary">上传模板</el-button>
</el-upload>
</el-form-item>
<el-form-item label="是否启用" prop="name">
<el-switch v-model="recordform.enabled"></el-switch>
</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>
<!--<el-button type="primary" @click="recordformcon">管理员授权</el-button>-->
</div>
</el-dialog>
<!--表格展示-->
<el-dialog
class="bigDialog"
:visible.sync="dialogVisibleForm"
:close-on-click-modal="false"
:title="tableForm.name"
>
<customForm
:results="fieldList.results"
:hasPicture="hasPicture"
:formID="formID"
:isDisabled="isDisabled"
@formFunc="formFunc"
/>
<!--<el-form ref="Forms" label-width="100px" :model="checkForm">
<el-row>
<el-col
:span="12"
v-for="(item, $index) in fieldList.results"
v-show="filterBlock(item.parent,item.display_expression)"
:key="$index"
>
&lt;!&ndash;<div v-if="item.field_type === 'img'">&ndash;&gt;
<el-form-item v-if="item.field_type === 'string'" :label="item.field_name">
<el-input
v-model="checkForm[item.field_key]"
placeholder="请输入"
@input="keyChange(item.field_key)"
/>
</el-form-item>
<el-form-item
v-else-if="item.field_type === 'int'"
:label="item.field_name"
>
<el-input
v-model="checkForm[item.field_key]"
type="number"
placeholder="请输入"
@input="keyChange(item.field_key)"
/>
</el-form-item>
<el-form-item
v-else-if="item.field_type === 'float'"
:label="item.field_name"
>
<el-input
v-model="checkForm[item.field_key]"
type="number"
placeholder="请输入"
@input="keyChange(item.field_key)"
/>
</el-form-item>
<el-form-item
v-else-if="item.field_type === 'date'"
:label="item.field_name"
>
<el-date-picker
v-model="checkForm[item.field_key]"
type="date"
placeholder="选择日期"
value-format="yyyy-MM-dd"
style="width: 100%"
@change="keyChange(item.field_key)"
>
</el-date-picker>
</el-form-item>
<el-form-item
v-else-if="item.field_type === 'datetime'"
:label="item.field_name"
>
<el-date-picker
v-model="checkForm[item.field_key]"
type="datetime"
placeholder="选择日期"
value-format="yyyy-MM-dd HH:mm:ss"
style="width: 100%"
@change="keyChange(item.field_key)"
>
</el-date-picker>
</el-form-item>
<el-form-item
v-else-if="item.field_type === 'select'"
:label="item.field_name"
>
<el-select
v-model="checkForm[item.field_key]"
style="width: 100%"
placeholder="请选择"
@change="keyChange(item.field_key)"
>
<el-option
v-for="item1 in item.field_choice"
:key="item1"
:label="item1"
:value="item1"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item
v-else-if="item.field_type === 'selects'"
:label="item.field_name"
>
<el-select
v-model="checkForm[item.field_key]"
style="width: 100%"
multiple
placeholder="请选择"
>
<el-option
v-for="item1 in item.field_choice"
:key="item1"
:label="item1"
:value="item1"
>
</el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row v-show="hasPicture">
<el-form-item label="图表">
<div>
<img id="canvasImg" src="./../../assets/glass.png" style="width:300px;height: 200px;display: none">
<div style="position: relative;display: flex">
<canvas id="canvas" width="300" height="200">
您的浏览器不支持绘图请升级或更换浏览器
</canvas>
<input type="text" value="" class="hide" id="txt" placeholder="请输入文字">
<textarea class="hide" id="word" cols="15" rows="5" placeholder="请输入文字" autofocus></textarea>
<input id="inputV" type="hidden" value="1">
<div class="canvasBtnWrap">
<div class="canvasBtn" @click="error1">标记</div>
<div class="canvasBtn" @click="word1()">文字</div>
&lt;!&ndash;<button @click="restuya()">清除批注</button>&ndash;&gt;
<div class="canvasBtn" @click="back()">回退</div>
<div class="canvasBtn" @click="saveTu()">保存</div>
</div>
<div id="res"></div>
</div>
</div>
</el-form-item>
</el-row>
</el-form>-->
<!--<div style="text-align: right">-->
<!--<el-button type="primary" @click="judgeForm">-->
<!--合格验证-->
<!--</el-button>-->
<!--</div>-->
</el-dialog>
</el-card>
</el-col>
<!--表格字段-->
<el-col :span="14">
<el-card>
<div slot="header" class="clearfix">
<span style="font-size: 16px; font-weight: 300">记录字段</span>
</div>
<el-button
type="primary"
icon="el-icon-plus"
@click="handlefieldCreate"
>新增
</el-button>
<!--表格字段列表-->
<el-table
:data="fieldList.results"
border
fit
stripe
highlight-current-row
height="670"
v-el-height-adaptive-table="{ bottomOffset: 20 }"
>
<el-table-column type="index" width="50"/>
<el-table-column label="字段名称">
<template slot-scope="scope">
{{scope.row.field_name}}
</template>
</el-table-column>
<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_key}}
</template>
</el-table-column>
<!--
<el-table-column label="上限值">
<template slot-scope="scope">{{
scope.row.high_limit
}}</template>
</el-table-column>
<el-table-column label="上限规则">
<template slot-scope="scope">{{
highoptionss_[scope.row.high_rule]
}}</template>
</el-table-column>
<el-table-column label="下限值">
<template slot-scope="scope">{{
scope.row.low_limit
}}</template>
</el-table-column>
<el-table-column label="下限规则">
<template slot-scope="scope">
{{ lowoptionss_[scope.row.low_rule] }}</template
>
</el-table-column>
!-->
<el-table-column label="是否判定">
<template slot-scope="scope">
<el-tag v-if="scope.row.need_judge == true"></el-tag>
<el-tag v-else></el-tag>
</template>
</el-table-column>
<el-table-column align="center" label="操作">
<template slot-scope="scope">
<el-link
v-if="checkPermission(['material_update'])"
type="primary"
@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>
<pagination
v-show="fieldList.count > 0"
:total="fieldList.count"
:page.sync="listQueryfield.page"
:limit.sync="listQueryfield.page_size"
@pagination="fieldLists"
/>
<!--表格字段新增编辑-->
<el-dialog
:visible.sync="dialogVisible1"
:close-on-click-modal="false"
:title="dialogType1 === 'edit' ? '编辑表格字段' : '新增表格字段'"
>
<el-form
ref="Form"
:model="field"
label-width="100px"
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="字段标识" @input="checkValue"/>
</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" 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 field_choice"
:key="domain + $index"
style="margin-bottom: 10px"
>
<el-col :span="20">
<el-input
v-model="field_choice[$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="字段父级">
<treeselect v-model="field.parent" :multiple="false" :options="treeDate" placeholder="字段父级"/>
</el-form-item>-->
<el-form-item label="字段说明">
<el-input v-model="field.help_text" placeholder="字段名称"/>
</el-form-item>
<el-form-item label="是否需要判定" prop="need_judge">
<el-switch v-model="field.need_judge"></el-switch>
</el-form-item>
<el-form-item label="判定式" v-if="field.need_judge === true">
<el-input v-model="field.rule_expression" type="textarea"/>
</el-form-item>
<el-form-item label="展示表达式">
<el-input v-model="field.display_expression" type="textarea"/>
</el-form-item>
<el-form-item label="模板图片" v-if="field.field_type === 'draw'">
<el-upload
class="avatar-uploader"
:action="upUrl"
accept="image/jpeg, image/gif, image/png, image/bmp"
:show-file-list="false"
:on-success="handleAvatarSuccess"
:before-upload="beforeAvatarUpload"
:headers="upHeaders"
>
<img v-if="field.draw_template" :src="field.draw_template" class="avatar"/>
<i v-else class="el-icon-plus avatar-uploader-icon"/>
</el-upload>
</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-card>
</el-col>
</el-row>
</el-card>
<el-dialog :visible.sync="limitedPhoto">
<div style="font-size: 28px;color: #333333;text-align: center;font-weight: bold;margin-bottom: 15px;">权限验证</div>
<div class="testTracking">
<faceLogin
name="faceLogin"
:dialogType="dialogType"
:recordform="recordform"
@func="getMsgFormSon"
></faceLogin>
</div>
</el-dialog>
</div>
</template>
<script>
import customForm from '@/components/customForm/index'
import checkPermission from "@/utils/permission";
import {getEquipmentAll} from "@/api/equipment";
import vueJsonEditor from "vue-json-editor";
import {upUrl, upHeaders} from "@/api/file";
import faceLogin from '@/components/faceLogin/faceLogin.vue'
import {
getrecordformList,
createrecordform,
updaterecordform,
deleterecordform,
getrffieldList,
createrffield,
updaterffield,
deleterffield,
} from "@/api/mtm";
import {upFile} from "@/api/file";
import {genTree} from "@/utils";
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
import Treeselect from '@riophae/vue-treeselect';
import '@riophae/vue-treeselect/dist/vue-treeselect.css';
const defaultstep = {
name: "",
number: "",
};
const defaultrecordform = {enabled: false};
const defaultfield = {};
let preDrawAry = [];
export default {
components: {Pagination, vueJsonEditor, Treeselect, customForm, faceLogin},
data() {
return {
step: defaultstep,
stepList: [],
upHeaders: upHeaders(),
upUrl: upUrl(),
fileList: [],
hasPicture: true,
listLoading: true,
need_judge: false,
dialogVisibles: false,
dialogVisibleForm: false,
dialogTypes: "new",
field: {
field_type: null,
field_key: "",
field_name: null,
sort: null,
parent: null,
help_text: null,
rule_expression: null,
display_expression: null,
draw_template: null,//图片模板
field_choice: [""],
},
field_choice: [""],
options: [],
optio: [],
rule1: {
name: [{required: true, message: "请输入", trigger: "blur"}],
number: [{required: true, message: "请输入", trigger: "blur"}],
},
recordform: defaultrecordform,
dialogType: "new",
dialogVisible: false,
dialogType1: "new",
dialogVisible1: false,
tableForm: defaultrecordform,
checkForm: {
hhh: '',
},
listQueryrecordform: {
page: 1,
page_size: 20,
},
recordformList: {
count: 0,
},
formList:[],
fieldList: {
count: 0,
},
treeDate: [],
listQueryfield: {
page: 1,
page_size: 20,
},
highoptions: [
{value: 1, label: "<"},
{value: 2, label: "<="},
],
lowoptions: [
{value: 1, label: ">"},
{value: 2, label: ">="},
],
highoptionss_: {
1: "<",
2: "<=",
},
lowoptionss_: {
1: ">",
2: ">=",
},
options_: {
string: "文本",
int: "整数",
float: "小数",
date: "日期",
datetime: "日期时间",
select: "单选",
selects: "多选",
draw: "绘图模板",
},
fieldtypeoptions: [
{
value: "string",
label: "文本",
},
{
value: "int",
label: "整数",
},
{
value: "float",
label: "小数",
},
{
value: "date",
label: "日期",
},
{
value: "time",
label: "时间",
},
{
value: "datetime",
label: "日期时间",
},
{
value: "select",
label: "单选",
},
{
value: "selects",
label: "多选",
},
{
value: "draw",
label: "绘图模板",
},
],
typeOptions: [
{
value: 10,
label: "生产记录表",
}, {
value: 20,
label: "工序检查表",
}, {
value: 30,
label: "入厂检验表",
}, {
value: 40,
label: "成品检验表",
}, {
value: 50,
label: "首件检查表",
},
],
typeOptions_:{
10 : "生产记录表",
20 : "工序检查表",
30 : "入厂检验表",
40 : "成品检验表",
50 : "首件检查表",
},
canvas: null,
ctx: null,
myCanvas_rect: null,
Txt: null,
word: null,
formID: 0,
widths: 0,
heights: 0,
lineW: 3,
colorF: "#e42343",
imgData: '',
canvasImg: '',
judgeList: [],
limitedPhoto: false,
isDisabled: true,
};
},
computed: {},
watch: {},
created() {
this.material = this.$route.params.id;
this.recordformLists();
},
mounted(){
getrecordformList({page:0}).then((response) => {
if (response.data) {
this.formList = response.data;
}
});
},
methods: {
/* handlePreview(file) {
if ("url" in file) {
window.open(file.url);
} else {
window.open(file.response.data.path);
}
},*/
handleUpSuccess(res) {
this.recordform.export_template = res.data.path;
},
handleRemove() {
this.recordform.export_template = '';
},
formFunc(value) {
this.dialogVisibleForm = value;
},
handleAvatarSuccess(res, file) {
this.field.draw_template = res.data.path;
},
beforeAvatarUpload(file) {
const isLt2M = file.size / 1024 / 1024 < 2;
if (!isLt2M) {
this.$message.error("上传头像图片大小不能超过 2MB!");
}
return isLt2M;
},
keyChange(key) {
let y = this.checkForm[key];
this.$set(this.checkForm, key, y);
this.fieldList.results = [...this.fieldList.results];
this.filterBlock();
},
filterBlock(parent, rule) {
let that = this;
if (parent !== '' && parent !== null && parent !== undefined) {
if (rule !== '' && rule !== null && rule !== undefined) {
let reg = /\{(.+?)\}/g;
//let str = rule.replace(temp,'').replace('$','');//==''
//let y = that.checkForm[key];
if (rule.indexOf('||') > -1 || rule.indexOf('&&') > -1) {
let tam = '', arr = [];
if (rule.indexOf('||') > -1) {
arr = rule.split('||');
} else {
arr = rule.split('&&');
}
for (let i = 0; i < arr.length; i++) {
//获取判断依据
let a = '';
a = arr[i].replace(/`/g, '');
a = '`' + a + '`';
let tem = a.match(reg)[0];
let ky = tem.replace(/\{|\}/g, '');//qipao
if (that.checkForm[ky]) {
//替换变量
a = a.replace(ky, 'yyy');
let yyy = "'" + that.checkForm[ky] + "'";
if (eval(eval(a))) {
tam += 'true';
} else {
tam += 'false';
}
} else {
tam += 'false';
}
}
let rea = true;
if (rule.indexOf('||') > -1) {
if (tam.indexOf('true') > -1) {
rea = true;
} else {
rea = false;
}
} else {
if (tam.indexOf('false') > -1) {
rea = false;
} else {
rea = true;
}
}
return rea;
} else {
let temp = rule.match(reg)[0];
let key = temp.replace(/\{|\}/g, '');//qipao
let a = rule.replace(key, 'yy');
a = a.replace(key, 'yy');
let yy = "'" + that.checkForm[key] + "'";
return eval(eval(a));
// return eval("'"+y+"'"+str);
}
debugger;
} else {
return false;
}
} else {
return true;
}
},
checkValue() {
this.field.field_key = this.field.field_key.replace(/[^a-zA-Z]/g, '');
},
//添加字段选项
addDomain() {
this.field_choice.push("");
},
//删除字段选项
removeDomain(index) {
this.field_choice.splice(index, 1);
},
handleLook(scope) {
let that = this;
that.tableForm = Object.assign({}, scope.row); // copy obj
that.formID = that.tableForm.id;
that.listQueryfield.form = that.formID;
getrffieldList(that.listQueryfield).then((response) => {
if (response.data) {
this.hasPicture = false;
that.fieldList = response.data;
let list = response.data.results;
let arr = list.filter(item => {
return item.field_type === 'draw'
});
that.judgeList = [];
let listJudge = list.filter(item => {
return item.need_judge === true;
});
listJudge.forEach(item => {
let obj = new Object();
obj = item;
obj.judge = false;
that.judgeList.push(obj)
});
if (arr.length > 0) {
this.hasPicture = true;
}
for (let i = 0; i < list.length; i++) {
let key = list[i].field_key;
that.checkForm[key] = '';
that.$set(that.checkForm, key, '')
}
that.dialogVisibleForm = true;
/* setTimeout(function () {
that.canvasInit();
}, 500);*/
}
});
that.fieldLists();
},
checkPermission,
handleCurrentChange(row) {
this.formID = row.id;
this.fieldLists();
this.fieldLists1();
},
recordformLists() {
this.listQueryrecordform.material = this.material;
// this.listQueryrecordform.type = 2;
getrecordformList(this.listQueryrecordform).then((response) => {
if (response.data) {
this.recordformList = response.data;
}
});
},
fieldLists() {
let that = this;
that.listQueryfield.form = that.formID;
getrffieldList(that.listQueryfield).then((response) => {
if (response.data) {
that.fieldList = response.data;
that.fieldList.results = [...that.fieldList.results]
}
});
},
fieldLists1() {
let params = new Object();
let that = this;
params.page = 0;
params.form = this.formID;
getrffieldList(params).then((response) => {
if (response.data) {
let data = response.data;
data.forEach(item => {
item.name = item.field_name;
});
that.treeDate = genTree(data);
}
});
},
//新增记录表
handleCreate() {
this.recordform = Object.assign({}, defaultrecordform);
this.dialogType = "new";
this.dialogVisible = true;
this.$refs["Forms"].resetFields();
// this.$nextTick(() => {
// this.$refs["Forms"].resetFields();
// });
},
formTypeChange(){
getrecordformList({type:this.recordform.type,page:0}).then((response) => {
if (response.data) {
this.formList = response.data;
}
});
},
//新增字段
handlefieldCreate() {
this.field_choice = [""];
this.dialogType1 = "new";
this.dialogVisible1 = true;
// this.$refs["Form"].resetFields();
this.$nextTick(() => {
this.field.field_type = null;
this.field.field_key = null;
this.field.field_name = null;
this.field.sort = null;
this.field.parent = null;
this.field.help_text = null;
this.field.draw_template = null;
this.field.field_choice = null;
this.field.rule_expression = null;
this.field.display_expression = null;
this.$refs["Form"].clearValidate();
});
},
handleEdit(scope) {
debugger;
console.log( scope.row);
this.recordform = Object.assign({}, scope.row); // copy obj
this.dialogType = "edit";
this.dialogVisible = true;
if (this.recordform.export_template) {
this.fileList = [
{
name: this.recordform.export_template,
url: this.recordform.export_template,
},
];
}
this.$nextTick(() => {
this.$refs["Forms"].clearValidate();
});
},
handlefieldEdit(scope) {
this.field = Object.assign({}, scope.row); // copy obj
this.field_choice = this.field.field_choice;
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);
});
},
handlefieldDelete(scope) {
this.$confirm("确认删除?", "警告", {
confirmButtonText: "确认",
cancelButtonText: "取消",
type: "error",
})
.then(async () => {
await deleterffield(scope.row.id);
this.fieldLists();
this.fieldLists1();
this.$message.success("成功");
})
.catch((err) => {
console.error(err);
});
},
async recordformconfirm(form) {
this.$refs[form].validate((valid) => {
if (valid) {
const isEdit = this.dialogType === "edit";
let obj = new Object();
obj.name=this.recordform.name;
obj.type=this.recordform.type;
obj.enabled=this.recordform.enabled;
obj.export_template=this.recordform.export_template?this.recordform.export_template:'';
if (isEdit) {
obj.form=this.recordform.form?this.recordform.form:null;
updaterecordform(this.recordform.id, obj).then(
(res) => {
if (res.code >= 200) {
this.recordformLists();
this.dialogVisible = false;
this.$message.success("成功");
}
}
);
} else {
obj.material=parseInt(this.material);
obj.form=this.recordform.form!==''?this.recordform.form:null;
createrecordform(obj).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;
this.field.field_choice = this.field_choice;
updaterffield(this.field.id, this.field).then((res) => {
if (res.code >= 200) {
this.fieldLists();
this.fieldLists1();
this.dialogVisible1 = false;
this.$message.success("成功");
}
});
} else {
this.field.form = this.formID;
this.field.field_choice = this.field_choice;
createrffield(this.field).then((res) => {
if (res.code >= 200) {
this.fieldLists();
this.fieldLists1();
this.dialogVisible1 = false;
this.$message.success("成功");
}
});
}
} else {
return false;
}
});
},
recordformcon() {
this.recordform.material = this.material;
this.recordform.type = 2;
this.limitedPhoto = true;
},
getMsgFormSon(data) {
this.limitedPhoto = data;
this.recordformLists();
this.dialogVisible = false;
},
},
};
</script>
<style>
.my-label {
background: #e1f3d8;
}
.my-content {
background: #fde2e2;
}
</style>