This commit is contained in:
shijing 2021-12-27 10:11:11 +08:00
parent 2e73713bae
commit 71a0858126
4 changed files with 401 additions and 301 deletions

View File

@ -1,11 +1,10 @@
<template>
<div class="app-container">
<el-card>
<div style="margin-top: 2px">
<el-button type="primary" icon="el-icon-plus" @click="handleCreate"
>新增</el-button
>
>新增
</el-button>
</div>
</el-card>
<el-card style="margin-top: 2px">
@ -44,13 +43,15 @@
<el-link
v-if="checkPermission(['customfield_update'])"
@click="handleEdit(scope)"
>编辑</el-link
>编辑
</el-link
>
<el-link
v-if="checkPermission(['customfield_delete'])"
type="danger"
@click="handleDeleteCustomfield(scope)"
>删除</el-link
>删除
</el-link
>
</template>
</el-table-column>
@ -78,7 +79,7 @@
<el-form-item label="占位符" prop="placeholder">
<el-input v-model="customfield.placeholder" placeholder="占位符"/>
</el-form-item>
<el-form-item label="字段类型" prop="field_type">
<el-form-item label="展示标签" prop="field_type">
<el-select style="width: 100%" v-model="customfield.field_type" placeholder="请选择">
<el-option
v-for="item in options"
@ -88,29 +89,54 @@
</el-option>
</el-select>
</el-form-item>
<el-form-item label="字段标签" v-show="customfield.field_type=='select'||customfield.field_type=='selects'">
<el-input v-model="customfield.label" placeholder="选项类型"/>
</el-form-item>
<el-form-item label="选项" v-show="customfield.field_type=='select'||customfield.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 choiceOption" :key=domain+$index style="margin-bottom: 10px">
<el-col :span="20">
<el-input v-model="choiceOption[$index]" auto-complete="off"></el-input>
<el-row v-for="(domain, $index) in choiceOption" :key='$index+1' style="margin-bottom: 10px">
<el-col :span="10">
<template>
<el-form-item label="id">
<el-input type="number" v-model="choiceOption[$index].id" auto-complete="off" placeholder="id为整数"></el-input>
</el-form-item>
</template>
</el-col>
<el-col :span="10">
<template>
<el-form-item label="name">
<el-input v-model="choiceOption[$index].name" auto-complete="off"></el-input>
</el-form-item>
</template>
</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>
<i
class="el-icon-remove-outline"
style="color: red;font-size: 16px;"
@click.prevent="removeDomain($index,'1')"
></i>
</el-col>
</el-row>
</el-form-item>
<el-form-item label="顺序ID" prop="sort">
<el-form-item label="顺序ID">
<el-input v-model="customfield.sort" type="number" placeholder="顺序"/>
</el-form-item>
<el-form-item label="默认值" prop="default_value">
<el-form-item label="默认值">
<el-input v-model="customfield.default_value" placeholder="默认值"/>
</el-form-item>
<el-form-item label="模板" prop="field_template">
<el-form-item label="模板">
<el-input v-model="customfield.field_template" placeholder="你有一个待办工单:{title}"/>
</el-form-item>
<el-form-item label="是否隐藏">
<el-radio-group v-model="customfield.is_hidden">
<el-radio :label="false">显示</el-radio>
<el-radio :label="true">隐藏</el-radio>
</el-radio-group>
</el-form-item>
</el-form>
<div style="text-align: right">
<el-button type="danger" @click="dialogVisible = false">取消</el-button>
@ -140,10 +166,14 @@ export default {
placeholder: '',
field_type: '',
sort: '',
label: 'name',
default_value: '',
field_template: '',
field_choice:[]
field_choice: [],
is_hidden:false,
},
fieldHidden: true,
fieldBlock: false,
view_permission_check: false,
hasJsonFlag: true, // json是否验证通过
hasJsonFlag1: true, // json是否验证通过
@ -151,7 +181,17 @@ export default {
// customfieldList: {
// count:0
// },
customfieldList:[],
customfieldList: [''],
labels:[{
label: '常规',
value: 'name'
},{
label: '名称|id',
value: 'name|id'
},{
label: '人员选择',
value: 'user'
}],
options: [{
value: 'string',
label: '文本'
@ -177,19 +217,20 @@ export default {
value: 'textarea',
label: '文本域'
},{
value: 'file',
label: '附件'
}],
/*, {
value: 'selectuser',
label: '用户名'
}, {
value: 'selectusers',
label: '多选的用户名'
}, {
value: 'file',
label: '附件'
}],
}, */
boolean_field_display: [],
choiceOption:[''],
choiceOption: [{id:null,name:""}],
field_choice: [],
dialogVisible: false,
dialogType: "new",
@ -207,7 +248,7 @@ export default {
methods: {
//添加字段选项
addDomain() {
this.choiceOption.push('')
this.choiceOption.push({id:null,name:""})
},
//删除字段选项
removeDomain(index) {
@ -216,7 +257,6 @@ export default {
checkPermission,
getList() {
getWfCustomfieldList(this.ID).then((response) => {
if (response.data) {
this.customfieldList = response.data;
@ -224,8 +264,6 @@ export default {
});
},
handleFilter() {
this.listQuery.page = 1;
this.getList();
@ -241,22 +279,23 @@ export default {
this.customfield = Object.assign({}, defaultcustomfield);
this.dialogType = "new";
this.dialogVisible = true;
this.$nextTick(() => {
this.$refs["Form"].clearValidate();
});
/*this.$nextTick(() => {
// this.$refs["Form"].clearValidate();
this.customfield.label = 1;
});*/
},
handleEdit(scope) {
debugger;
this.customfield = Object.assign({}, scope.row); // copy obj
this.choiceOption = scope.row.field_choice;
this.dialogType = "edit";
this.dialogVisible = true;
this.$nextTick(() => {
/*this.$nextTick(() => {
this.$refs["Form"].clearValidate();
});
});*/
},
handlecfgt(scope)
{
handlecfgt(scope) {
this.$router.push({name: "configuration", params: {customfield: scope.row.id}})
}
,
@ -267,7 +306,7 @@ export default {
type: "error",
})
.then(async () => {
await deleteWorkflow(scope.row.id);
await this.deleteWorkflow(scope.row.id);
this.getList();
this.$message.success("成功");
})
@ -277,14 +316,23 @@ export default {
},
async confirm(form) {
let that = this,choiceArr = [];
this.$refs[form].validate((valid) => {
if (valid) {
const isEdit = this.dialogType === "edit";
const isEdit = that.dialogType === "edit";
if(that.choiceOption[0]&&that.choiceOption[0].name!==''&&that.choiceOption[0].name!==null&&that.choiceOption[0].name!==undefined){
that.choiceOption.forEach((item)=>{
let obj = new Object();
obj.id = parseInt(item.id);
obj.name = item.name;
choiceArr.push(obj);
})
}
debugger;
console.log(choiceArr);
that.customfield.field_choice = choiceArr;
console.log(that.customfield);
if (isEdit) {
this.checkJson();
this.checkJson1();
this.checkJson2();
this.customfield.field_choice = this.choiceOption;
updateWfCustomfield(this.customfield.id, this.customfield).then((res) => {
if (res.code >= 200) {
this.getList();
@ -293,11 +341,7 @@ export default {
}
});
} else {
this.checkJson();
this.checkJson1();
this.checkJson2();
this.customfield.workflow = this.ID;
this.customfield.field_choice = this.choiceOption;
createWfCustomfield(this.customfield).then((res) => {
if (res.code >= 200) {
this.getList();
@ -327,7 +371,7 @@ export default {
});
},
onJsonChange (value) {
/* onJsonChange(value) {
// console.log('更改value:', value);
// 实时保存
this.onJsonSave(value)
@ -345,10 +389,10 @@ export default {
// 检查json
checkJson() {
if (this.hasJsonFlag == false) {
alert("布尔显示定义json验证失败")
// alert("布尔显示定义json验证失败")
return false
} else {
alert("布尔显示定义json验证成功")
// alert("布尔显示定义json验证成功")
return true
}
},
@ -367,10 +411,10 @@ export default {
// 检查json
checkJson1() {
if (this.hasJsonFlag1 == false) {
alert("选项json验证失败")
// alert("选项json验证失败")
return false
} else {
alert("选项json1验证成功")
// alert("选项json1验证成功")
return true
}
},
@ -389,13 +433,13 @@ export default {
// 检查json
checkJson2() {
if (this.hasJsonFlag2 == false) {
alert("标签json验证失败")
// alert("标签json验证失败")
return false
} else {
alert("标签json1验证成功")
// alert("标签json1验证成功")
return true
}
},
}*/
// },
},

View File

@ -187,6 +187,7 @@
<el-option label="只读" value="1"></el-option>
<el-option label="必填" value="2"></el-option>
<el-option label="可选" value="3"></el-option>
<el-option label="隐藏" value="4"></el-option>
</el-select>
</el-col>
<el-col :span="2" style="text-align: center" v-if="$index!==0">

View File

@ -308,9 +308,9 @@
<el-select style="width: 100%" v-model="item.default_value" placeholder="请选择">
<el-option
v-for="item1 in item.field_choice"
:key="item1"
:label="item1"
:value="item1"
:key="item1.id"
:label="item1.name"
:value="item1.id"
>
</el-option>
</el-select>
@ -319,9 +319,9 @@
<el-select style="width: 100%" multiple v-model="item.default_value" placeholder="请选择">
<el-option
v-for="item1 in item.field_choice"
:key="item1"
:label="item1"
:value="item1"
:key="item1.id"
:label="item1.name"
:value="item1.id"
>
</el-option>
</el-select>

View File

@ -508,98 +508,78 @@
</el-dialog>
<!--不合格半成品重审-->
<el-dialog title="不合格半成品重审" :close-on-click-modal="false" :visible.sync="limitedRetrial">
<el-form label-width="80px" label-position="right">
<el-row v-for="(item, $index) in fieldList.record_data" :key="$index">
<el-form-item
v-if="item.field_type === 'string'"
:label="item.field_name"
>
<el-input placeholder="请输入" v-model="item.sort" />
</el-form-item>
<el-form-item
v-else-if="item.field_type === 'int'"
:label="item.field_name"
>
<el-input
type="number"
placeholder="请输入"
v-model="item.sort"
/>
</el-form-item>
<el-form-item
v-else-if="item.field_type === 'float'"
:label="item.field_name"
>
<el-input
type="number"
placeholder="请输入"
v-model="item.sort"
/>
</el-form-item>
<el-form-item
v-else-if="item.field_type === 'date'"
:label="item.field_name"
>
<el-form label-width="130px" label-position="right">
<el-form-item :label="item.field_name" v-for="item in customfieldList" :key="item.id" v-show="!item.is_hidden">
<template v-if="item.field_type=='string'">
<el-input v-model="item.default_value" :placeholder="item.description" />
</template>
<template v-if="item.field_type==='int'">
<el-input v-model="item.default_value" type="number" :placeholder="item.description" oninput="value=value.replace(/[^\d]/g,'')" />
</template>
<template v-if="item.field_type==='float'">
<el-input v-model="item.default_value" type="number" :placeholder="item.description" />
</template>
<template v-if="item.field_type==='date'">
<el-date-picker
v-model="item.create_time"
v-model="item.default_value"
type="date"
placeholder="选择日期"
value-format="yyyy-MM-dd"
style="width: 100%"
>
</el-date-picker>
</el-form-item>
<el-form-item
v-else-if="item.field_type === 'datetime'"
:label="item.field_name"
>
</template>
<template v-if="item.field_type==='datetime'">
<el-date-picker
v-model="item.create_time"
v-model="item.default_value"
type="datetime"
placeholder="选择日期"
value-format="yyyy-MM-dd HH:mm:ss"
style="width: 100%"
>
</el-date-picker>
</el-form-item>
<el-form-item
v-else-if="item.field_type === 'select'"
:label="item.field_name"
>
<el-select
style="width: 100%"
v-model="item.sort"
placeholder="请选择"
>
</template>
<template v-if="item.field_type==='select'">
<el-select style="width: 100%" v-model="item.default_value" placeholder="请选择">
<el-option
v-for="item1 in item.field_choice"
:key="item1"
:label="item1"
:value="item1"
:key="item1.id"
:label="item1.name"
:value="item1.id"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item
v-else-if="item.field_type === 'selects'"
:label="item.field_name"
>
<el-select
style="width: 100%"
v-model="optio"
multiple
placeholder="请选择"
>
</template>
<template v-if="item.field_type==='selects'">
<el-select style="width: 100%" multiple v-model="item.default_value" placeholder="请选择">
<el-option
v-for="item1 in item.field_choice"
:key="item1"
:label="item1"
:value="item1"
:key="item1.id"
:label="item1.name"
:value="item1.id"
>
</el-option>
</el-select>
</template>
<template v-if="item.field_type==='textarea'">
<el-input type="textarea" :rows="3" v-model="item.default_value" placeholder="内容" />
</template>
<template v-if="item.field_type==='file'">
<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>
</template>
</el-form-item>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="limitedRetrial = false"> </el-button>
@ -609,12 +589,15 @@
</div>
</template>
<script>
import { getOrgAll } from "@/api/org";
import { getUserList } from "@/api/user";
import {getWarehouseList} from "@/api/inm";
import checkPermission from "@/utils/permission";
import customForm from '@/components/customForm/index';
import reviewForm from '@/components/customForm/review';
import {getwproductList, wproductTest, wproductPutin, createputins,testInit,scrap,getRetrial} from "@/api/wpm";
import checkPermission from "@/utils/permission";
import {getWarehouseList} from "@/api/inm";
import {getWfCustomfieldList,createTicket} from "@/api/workflow";
import {getMaterialList, getrecordformList, getrffieldList} from "@/api/mtm";
import {getwproductList, wproductTest, wproductPutin, createputins,testInit,scrap,getRetrial} from "@/api/wpm";
import {getTestRecord,getTestRecordItem,putTestRecordItem,delTestRecordItem,subTestRecordItem} from "@/api/qm";
import {genTree} from "@/utils";
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
@ -704,7 +687,10 @@
originList: [],
is_testok: "true",
field: [],
userList: [],//用户列表
orgList: [],//部门列表
recordformList: [],
customfieldList: [],
recordform: null,
recordId: null,
fifo_detail: "",
@ -728,6 +714,15 @@
dialogFormVisibles: false,
limitedCheckRecord: false,
testrecord: {},
retrialItem: {},//复检对象
retrialResponse: {},//复检对象
//复检表单
retrialForm: {
title:'',
transition:'',
workflow:'',
ticket_data:{},
},
WarehouseData: "",
formName: '项目检查表',
};
@ -823,14 +818,64 @@
},
//不合格产品重审展示
handleRetrial(scope){
let that =this;
this.retrialItem = Object.assign({}, scope.row);
console.log(this.retrialItem);
getRetrial(scope.row.id).then(res=>{
debugger;
console.log(res)
that.retrialResponse = res.data;
getWfCustomfieldList(res.data.workflow).then((response) => {
if (response.data) {
that.customfieldList = response.data;
for (let i=0;i<that.customfieldList.length;i++) {
if(that.customfieldList[i].field_key==="wproduct"){
that.customfieldList[i].default_value = that.retrialResponse.exist_data.wproduct;
}
if(that.customfieldList[i].field_key==="wproduct_name"){
that.customfieldList[i].default_value = that.retrialResponse.exist_data.wproduct_name;
}
if(that.customfieldList[i].field_key==="wproduct_type"){
that.customfieldList[i].default_value = that.retrialResponse.exist_data.wproduct_specification;
}
if(that.customfieldList[i].field_key==="finder"){
that.customfieldList[i].default_value = that.retrialResponse.exist_data.finder;
}
if(that.customfieldList[i].field_key==="find_process"){
that.customfieldList[i].default_value = that.retrialResponse.exist_data.find_process;
}
if(that.customfieldList[i].label==="sys_user"){
that.customfieldList[i].field_choice = that.userList;
}
if(that.customfieldList[i].label==="deptSelect"){
that.customfieldList[i].field_choice = that.orgList;
}
}
}
});
that.limitedRetrial = true;
})
},
//不合格产品重审提交
retrialSubmit(){
let that = this;
let fields = this.customfieldList;
let obj = new Object();
for(let i=0;i<fields.length;i++){
obj[fields[i].field_key] = fields[i].default_value
}
this.retrialForm.ticket_data = obj;
this.retrialForm.workflow = that.retrialResponse.workflow;
this.retrialForm.transition = 20;
this.retrialForm.title = that.retrialResponse.exist_data.wproduct_name+'的重审';
debugger;
console.log(this.retrialForm);
createTicket(this.retrialForm).then((res) => {
if (res.code >= 200) {
// this.getList();
this.limitedRetrial = false;
this.$message.success("成功");
}
});
},
//夹层半成品列表
getList3() {
@ -1202,5 +1247,15 @@
this.reload()
},
},
mounted() {
getUserList({page:0}).then(response => {
if (response.data) {
this.userList = response.data
}
});
getOrgAll().then((response) => {
this.orgList = response.data;
});
}
}
</script>