buttonControl

This commit is contained in:
shijing 2022-04-26 15:08:16 +08:00
parent 5aa0fed51b
commit 01d41a5bf0
7 changed files with 724 additions and 755 deletions

View File

@ -7,7 +7,8 @@
">子工序列表</span> ">子工序列表</span>
</div> </div>
<el-button type="primary" icon="el-icon-plus" @click="handleCreateStep" <el-button type="primary" icon="el-icon-plus" @click="handleCreateStep"
>新增子工序</el-button> >新增子工序
</el-button>
<el-table <el-table
v-loading="listLoading" v-loading="listLoading"
:data="stepList" :data="stepList"
@ -18,7 +19,7 @@
max-height="600" max-height="600"
@row-click="rowClick" @row-click="rowClick"
> >
<el-table-column type="index" width="50" /> <el-table-column type="index" width="50"/>
<el-table-column label="子工序名称"> <el-table-column label="子工序名称">
<template slot-scope="scope">{{ scope.row.name }}</template> <template slot-scope="scope">{{ scope.row.name }}</template>
</el-table-column> </el-table-column>
@ -27,18 +28,19 @@
</el-table-column> </el-table-column>
<el-table-column label="相关设备"> <el-table-column label="相关设备">
<template slot-scope="scope" v-if="scope.row.equipments"> <template slot-scope="scope" v-if="scope.row.equipments">
<el-tag v-for="item in scope.row.equipments_" <el-tag
:key="item.number" v-for="item in scope.row.equipments_"
:label="item.name" :key="item.number"
:value="item.number">{{item.name}}</el-tag> :label="item.name"
:value="item.number"
>
{{item.name}}
</el-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="子工序类型"> <el-table-column label="子工序类型">
<template slot-scope="scope"> {{ type_[scope.row.type] }}</template> <template slot-scope="scope">{{ type_[scope.row.type] }}</template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
align="center" align="center"
label="操作" label="操作"
@ -46,17 +48,17 @@
> >
<template slot-scope="scope"> <template slot-scope="scope">
<el-link <el-link
v-if="checkPermission(['step_update'])"
type="primary" type="primary"
@click="handleEditStep(scope)" @click="handleEditStep(scope)"
>编辑</el-link
> >
编辑
</el-link>
<el-link <el-link
v-if="checkPermission(['step_delete'])"
type="danger" type="danger"
@click="handleDeleteStep(scope)" @click="handleDeleteStep(scope)"
>删除</el-link
> >
删除
</el-link>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -73,40 +75,36 @@
:rules="rule1" :rules="rule1"
> >
<el-form-item label="工序名称" prop="name"> <el-form-item label="工序名称" prop="name">
<el-input v-model="step.name" placeholder="工序名称" /> <el-input v-model="step.name" placeholder="工序名称"/>
</el-form-item> </el-form-item>
<el-form-item label="步骤编号" prop="number"> <el-form-item label="步骤编号" prop="number">
<el-input v-model="step.number" placeholder="工序编号" /> <el-input v-model="step.number" placeholder="工序编号"/>
</el-form-item> </el-form-item>
<el-form-item label="工序设备" prop="equipments"> <el-form-item label="工序设备" prop="equipments">
<el-select style="width: 100%" multiple v-model="step.equipments" placeholder="请选择">
<el-select style="width: 100%" multiple v-model="step.equipments" placeholder="请选择">
<el-option <el-option
v-for="item in options" v-for="item in options"
:key="item.value" :key="item.value"
:label="item.label" :label="item.label"
:value="item.value"> :value="item.value"
>
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="指导书内容" prop="instruction_content"> <el-form-item label="指导书内容" prop="instruction_content">
<el-input type="textarea" :rows="3" v-model="step.instruction_content" placeholder="指导书内容" /> <el-input type="textarea" :rows="3" v-model="step.instruction_content" placeholder="指导书内容"/>
</el-form-item> </el-form-item>
<el-form-item label="子工序类型" prop="type">
<el-form-item label="子工序类型" prop="type"> <el-select style="width: 100%" v-model="step.type" placeholder="请选择">
<el-select style="width: 100%" v-model="step.type" placeholder="请选择">
<el-option <el-option
v-for="item in typeoption" v-for="item in typeoption"
:key="item.value" :key="item.value"
:label="item.label" :label="item.label"
:value="item.value"> :value="item.value"
>
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-form> </el-form>
<div style="text-align: right"> <div style="text-align: right">
<el-button type="danger" @click="dialogVisibles = false">取消</el-button> <el-button type="danger" @click="dialogVisibles = false">取消</el-button>
@ -116,15 +114,16 @@
</el-card> </el-card>
<el-card> <el-card>
<el-row :gutter="2"> <el-row :gutter="2">
<el-col :span="9" > <el-col :span="9">
<el-card > <el-card>
<div slot="header" class="clearfix"> <div slot="header" class="clearfix">
<span style="font-size: 16px; <span style="font-size: 16px;
font-weight: 700; font-weight: 700;
">过程记录表</span> ">过程记录表</span>
</div> </div>
<el-button type="primary" icon="el-icon-plus" @click="handleCreate" <el-button type="primary" icon="el-icon-plus" @click="handleCreate"
>新增</el-button> >新增
</el-button>
<el-table <el-table
:data="recordformList.results" :data="recordformList.results"
border border
@ -135,17 +134,17 @@
v-el-height-adaptive-table="{bottomOffset: 50}" v-el-height-adaptive-table="{bottomOffset: 50}"
@current-change="handleCurrentChange" @current-change="handleCurrentChange"
> >
<el-table-column type="index" width="50" /> <el-table-column type="index" width="50"/>
<el-table-column label="名称"> <el-table-column label="名称">
<template slot-scope="scope">{{ scope.row.name }}</template> <template slot-scope="scope">{{ scope.row.name }}</template>
</el-table-column> </el-table-column>
<el-table-column label="状态"> <el-table-column label="状态">
<template slot-scope="scope"> <template slot-scope="scope">
<el-tag v-if="scope.row.enabled==true" >启用</el-tag> <el-tag v-if="scope.row.enabled==true">启用</el-tag>
<el-tag v-else>禁用</el-tag> <el-tag v-else>禁用</el-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="文件号"> <el-table-column label="文件号">
<template slot-scope="scope">{{ scope.row.number }}</template> <template slot-scope="scope">{{ scope.row.number }}</template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
@ -157,17 +156,20 @@
v-if="checkPermission(['material_update'])" v-if="checkPermission(['material_update'])"
type="primary" type="primary"
@click="handleLook(scope)" @click="handleLook(scope)"
>查看</el-link> >查看
</el-link>
<el-link <el-link
v-if="checkPermission(['material_update'])" v-if="checkPermission(['material_update'])"
type="primary" type="primary"
@click="handleEdit(scope)" @click="handleEdit(scope)"
>编辑</el-link> >编辑
</el-link>
<el-link <el-link
v-if="checkPermission(['material_delete'])" v-if="checkPermission(['material_delete'])"
type="danger" type="danger"
@click="handleDelete(scope)" @click="handleDelete(scope)"
>删除</el-link> >删除
</el-link>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -184,18 +186,18 @@
> >
<el-form-item label="表格名称" prop="name"> <el-form-item label="表格名称" prop="name">
<el-input v-model="recordform.name" placeholder="表格名称" /> <el-input v-model="recordform.name" placeholder="表格名称"/>
</el-form-item> </el-form-item>
<el-form-item label="文件号" prop="number"> <el-form-item label="文件号" prop="number">
<el-input v-model="recordform.number" placeholder="文件号" /> <el-input v-model="recordform.number" placeholder="文件号"/>
</el-form-item> </el-form-item>
<el-form-item label="状态"> <el-form-item label="状态">
<el-switch v-model="recordform.enabled"></el-switch> <el-switch v-model="recordform.enabled"></el-switch>
</el-form-item> </el-form-item>
<el-form-item label="表格类型" prop="type"> <el-form-item label="表格类型" prop="type">
<el-select style="width: 100%" v-model="recordform.type" placeholder="请选择"> <el-select style="width: 100%" v-model="recordform.type" placeholder="请选择">
<el-option <el-option
v-for="item in typeoptions" v-for="item in typeoptions"
:key="item.value" :key="item.value"
@ -206,7 +208,6 @@
</el-form-item> </el-form-item>
</el-form> </el-form>
<div style="text-align: right"> <div style="text-align: right">
<el-button type="danger" @click="dialogVisible = false">取消</el-button> <el-button type="danger" @click="dialogVisible = false">取消</el-button>
@ -222,15 +223,15 @@
label-width="80px" label-width="80px"
label-position="right" label-position="right"
> >
<el-row v-for="(item,$index) in fieldList.results" :key="$index"> <el-row v-for="(item,$index) in fieldList.results" :key="$index">
<el-form-item v-if="item.field_type==='string'" :label="item.field_name" > <el-form-item v-if="item.field_type==='string'" :label="item.field_name">
<el-input placeholder="请输入" v-model="item.sort"/> <el-input placeholder="请输入" v-model="item.sort"/>
</el-form-item> </el-form-item>
<el-form-item v-else-if="item.field_type==='int'" :label="item.field_name"> <el-form-item v-else-if="item.field_type==='int'" :label="item.field_name">
<el-input type="number" placeholder="请输入" v-model="item.sort"/> <el-input type="number" placeholder="请输入" v-model="item.sort"/>
</el-form-item> </el-form-item>
<el-form-item v-else-if="item.field_type==='float'" :label="item.field_name"> <el-form-item v-else-if="item.field_type==='float'" :label="item.field_name">
<el-input type="number" placeholder="请输入" v-model="item.sort"/> <el-input type="number" placeholder="请输入" v-model="item.sort"/>
</el-form-item> </el-form-item>
<el-form-item v-else-if="item.field_type==='date'" :label="item.field_name"> <el-form-item v-else-if="item.field_type==='date'" :label="item.field_name">
<el-date-picker <el-date-picker
@ -253,7 +254,7 @@
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
<el-form-item v-else-if="item.field_type==='select'" :label="item.field_name"> <el-form-item v-else-if="item.field_type==='select'" :label="item.field_name">
<el-select style="width: 100%" v-model="item.sort" placeholder="请选择"> <el-select style="width: 100%" v-model="item.sort" placeholder="请选择">
<el-option <el-option
v-for="item1 in item.field_choice" v-for="item1 in item.field_choice"
:key="item1" :key="item1"
@ -263,7 +264,7 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item v-else-if="item.field_type==='selects'" :label="item.field_name"> <el-form-item v-else-if="item.field_type==='selects'" :label="item.field_name">
<el-select style="width: 100%" v-model="optio" multiple placeholder="请选择"> <el-select style="width: 100%" v-model="optio" multiple placeholder="请选择">
<el-option <el-option
v-for="item1 in item.field_choice" v-for="item1 in item.field_choice"
:key="item1" :key="item1"
@ -275,21 +276,22 @@
</el-row> </el-row>
</el-form> </el-form>
<!--<div style="text-align: right">--> <!--<div style="text-align: right">-->
<!--<el-button type="danger">取消</el-button>--> <!--<el-button type="danger">取消</el-button>-->
<!--<el-button type="primary">确认</el-button>--> <!--<el-button type="primary">确认</el-button>-->
<!--</div>--> <!--</div>-->
</el-dialog> </el-dialog>
</el-card> </el-card>
</el-col> </el-col>
<el-col :span="15" > <el-col :span="15">
<el-card > <el-card>
<div slot="header" class="clearfix"> <div slot="header" class="clearfix">
<span style="font-size: 16px; <span style="font-size: 16px;
font-weight: 700; font-weight: 700;
">记录字段</span> ">记录字段</span>
</div> </div>
<el-button type="primary" icon="el-icon-plus" @click="handlefieldCreate" <el-button type="primary" icon="el-icon-plus" @click="handlefieldCreate"
>新增</el-button> >新增
</el-button>
<el-table <el-table
:data="fieldList.results" :data="fieldList.results"
@ -302,7 +304,7 @@
> >
<el-table-column type="index" width="50" /> <el-table-column type="index" width="50"/>
<el-table-column label="字段类型"> <el-table-column label="字段类型">
<template slot-scope="scope">{{ options_[scope.row.field_type] }}</template> <template slot-scope="scope">{{ options_[scope.row.field_type] }}</template>
</el-table-column> </el-table-column>
@ -331,29 +333,32 @@
v-if="checkPermission(['material_update'])" v-if="checkPermission(['material_update'])"
type="primary" type="primary"
@click="handlefieldEdit(scope)" @click="handlefieldEdit(scope)"
>编辑</el-link >编辑
</el-link
> >
<el-link <el-link
v-if="checkPermission(['material_delete'])" v-if="checkPermission(['material_delete'])"
type="danger" type="danger"
@click="handlefieldDelete(scope)" @click="handlefieldDelete(scope)"
>删除</el-link >删除
</el-link
> >
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<pagination <pagination
v-show="fieldList.count > 0" v-show="fieldList.count > 0"
:total="fieldList.count" :total="fieldList.count"
:page.sync="listQueryfield.page" :page.sync="listQueryfield.page"
:limit.sync="listQueryfield.page_size" :limit.sync="listQueryfield.page_size"
@pagination="fieldLists" @pagination="fieldLists"
/> />
<el-dialog :visible.sync="dialogVisible1" :close-on-click-modal="false" :title="dialogType1 === 'edit' ? '编辑表格字段' : '新增表格字段'"> <el-dialog :visible.sync="dialogVisible1" :close-on-click-modal="false"
:title="dialogType1 === 'edit' ? '编辑表格字段' : '新增表格字段'">
<el-form ref="Form" :model="field" label-width="80px" label-position="right"> <el-form ref="Form" :model="field" label-width="80px" label-position="right">
<el-form-item label="字段类型" prop="field_type"> <el-form-item label="字段类型" prop="field_type">
<el-select style="width: 100%" v-model="field.field_type" placeholder="请选择"> <el-select style="width: 100%" v-model="field.field_type" placeholder="请选择">
<el-option <el-option
v-for="item in fieldtypeoptions" v-for="item in fieldtypeoptions"
:key="item.value" :key="item.value"
@ -363,27 +368,31 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="字段标识" prop="field_key"> <el-form-item label="字段标识" prop="field_key">
<el-input v-model="field.field_key" placeholder="字段标识" onkeyup="value=value.replace(/[^A-Za-z_\/]/ig,'')"/> <el-input v-model="field.field_key" placeholder="字段标识"
onkeyup="value=value.replace(/[^A-Za-z_\/]/ig,'')"/>
</el-form-item> </el-form-item>
<el-form-item label="字段名称" prop="field_name"> <el-form-item label="字段名称" prop="field_name">
<el-input v-model="field.field_name" placeholder="字段名称" /> <el-input v-model="field.field_name" placeholder="字段名称"/>
</el-form-item> </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-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;"> <el-button @click.prevent="addDomain" style="border: none;">
<i class="el-icon-circle-plus-outline"></i> <i class="el-icon-circle-plus-outline"></i>
<span style="font-size:14px;">添加</span> <span style="font-size:14px;">添加</span>
</el-button> </el-button>
<el-row v-for="(domain, $index) in field_choice" :key=domain+$index style="margin-bottom: 10px"> <el-row v-for="(domain, $index) in field_choice" :key=domain+$index style="margin-bottom: 10px">
<el-col :span="20"> <el-col :span="20">
<el-input v-model="field_choice[$index]" auto-complete="off"></el-input> <el-input v-model="field_choice[$index]" auto-complete="off"></el-input>
</el-col> </el-col>
<el-col :span="3" style="text-align: center" v-if="$index!==0"> <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" @click.prevent="removeDomain($index,'1')"
style="color: red;font-size: 16px;"></i>
</el-col> </el-col>
</el-row> </el-row>
</el-form-item> </el-form-item>
<el-form-item label="排序" prop="sort"> <el-form-item label="排序" prop="sort">
<el-input-number v-model="field.sort" :min="1" placeholder="排序"></el-input-number> <el-input-number v-model="field.sort" :min="1" placeholder="排序"></el-input-number>
</el-form-item> </el-form-item>
</el-form> </el-form>
<div style="text-align: right"> <div style="text-align: right">
@ -399,63 +408,70 @@
</template> </template>
<script> <script>
import { getStepLists, createStep,updateStep,deleteStep } from "@/api/mtm"; import {getStepLists, createStep, updateStep, deleteStep} from "@/api/mtm";
import checkPermission from "@/utils/permission"; import checkPermission from "@/utils/permission";
import { getEquipmentAll } from "@/api/equipment"; import {getEquipmentAll} from "@/api/equipment";
import { upUrl, upHeaders } from "@/api/file"; import {upUrl, upHeaders} from "@/api/file";
import { getStep,getrecordformList,createrecordform,updaterecordform,deleterecordform,getrffieldList,createrffield,updaterffield, import {
deleterffield} from "@/api/mtm"; 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 { genTree } from "@/utils"; import {genTree} from "@/utils";
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
const defaultstep = { const defaultstep = {
name: "", name: "",
number: "", number: "",
type:null, type: null,
}; };
const defaultrecordform = { const defaultrecordform = {
enabled:true enabled: true
};
const defaultfield = {
}; };
const defaultfield = {};
export default { export default {
components: { Pagination,vueJsonEditor }, components: {Pagination, vueJsonEditor},
data() { data() {
return { return {
step: defaultstep, step: defaultstep,
stepList:[], stepList: [],
upHeaders: upHeaders(), upHeaders: upHeaders(),
upUrl: upUrl(), upUrl: upUrl(),
fileList:{ fileList: {
count: 0, count: 0,
}, },
listLoading: true, listLoading: true,
dialogVisibles: false, dialogVisibles: false,
dialogVisibleForm: false, dialogVisibleForm: false,
dialogTypes: "new", dialogTypes: "new",
field: { field: {
field_type:'', field_type: '',
field_key:'', field_key: '',
field_name:'', field_name: '',
sort:'', sort: '',
field_choice:[""], field_choice: [""],
}, },
field_choice:[''], field_choice: [''],
options:[], options: [],
optio:[], optio: [],
rule1: { rule1: {
name: [{ required: true, message: "请输入", trigger: "blur" }], name: [{required: true, message: "请输入", trigger: "blur"}],
number: [{ required: true, message: "请输入", trigger: "blur" }], number: [{required: true, message: "请输入", trigger: "blur"}],
}, },
recordform: defaultrecordform, recordform: defaultrecordform,
dialogType: "new", dialogType: "new",
dialogVisible:false, dialogVisible: false,
dialogType1: "new", dialogType1: "new",
dialogVisible1:false, dialogVisible1: false,
tableForm:{ tableForm: {
name:'', name: '',
}, },
listQueryrecordform: { listQueryrecordform: {
page: 1, page: 1,
@ -472,15 +488,15 @@
page_size: 20, page_size: 20,
}, },
type_: { type_: {
1:'常规', 1: '常规',
2:'分割', 2: '分割',
3:'结合', 3: '结合',
}, },
options_: { options_: {
'string':'文本', 'string': '文本',
'int':'整数', 'int': '整数',
'float':'小数', 'float': '小数',
'date': '日期', 'date': '日期',
'datetime': '日期时间', 'datetime': '日期时间',
'select': '单选', 'select': '单选',
@ -551,15 +567,15 @@
this.field_choice.push('') this.field_choice.push('')
}, },
//删除字段选项 //删除字段选项
removeDomain(index){ removeDomain(index) {
this.field_choice.splice(index, 1) this.field_choice.splice(index, 1)
}, },
handleLook(scope){ handleLook(scope) {
debugger; debugger;
console.log(scope); console.log(scope);
this.dialogVisibleForm = true; this.dialogVisibleForm = true;
this.tableForm = Object.assign({}, scope.row); // copy obj this.tableForm = Object.assign({}, scope.row); // copy obj
this.formID=this.tableForm.id; this.formID = this.tableForm.id;
this.fieldLists(); this.fieldLists();
}, },
checkPermission, checkPermission,
@ -591,13 +607,11 @@
handleUpSuccess(res, file, filelist) { handleUpSuccess(res, file, filelist) {
this.step.instruction = res.data.id; this.step.instruction = res.data.id;
}, },
handleRemove(file, filelist){ handleRemove(file, filelist) {
this.step.instruction = null; this.step.instruction = null;
}, },
handleFilter() { handleFilter() {
this.listQuery.page = 1; this.listQuery.page = 1;
this.getList(); this.getList();
@ -620,7 +634,7 @@
}, },
rowClick(row) { rowClick(row) {
this.stepid= row.id ; this.stepid = row.id;
this.recordformLists(); this.recordformLists();
}, },
@ -677,15 +691,14 @@
} }
}); });
}, },
handleCurrentChange(row){ handleCurrentChange(row) {
this.formID=row.id; this.formID = row.id;
this.fieldLists(); this.fieldLists();
}, },
recordformLists() recordformLists() {
{ this.listQueryrecordform.step = this.stepid;
this.listQueryrecordform.step=this.stepid; this.listQueryrecordform.type = 10;
this.listQueryrecordform.type=10;
getrecordformList(this.listQueryrecordform).then((response) => { getrecordformList(this.listQueryrecordform).then((response) => {
if (response.data) { if (response.data) {
this.recordformList = response.data; this.recordformList = response.data;
@ -693,9 +706,8 @@
}); });
}, },
fieldLists() fieldLists() {
{ this.listQueryfield.form = this.formID
this.listQueryfield.form=this.formID
getrffieldList(this.listQueryfield).then((response) => { getrffieldList(this.listQueryfield).then((response) => {
if (response.data) { if (response.data) {
this.fieldList = response.data; this.fieldList = response.data;
@ -777,7 +789,7 @@
if (valid) { if (valid) {
const isEdit = this.dialogType === "edit"; const isEdit = this.dialogType === "edit";
if (isEdit) { if (isEdit) {
this.recordform.step=this.stepid this.recordform.step = this.stepid
updaterecordform(this.recordform.id, this.recordform).then((res) => { updaterecordform(this.recordform.id, this.recordform).then((res) => {
if (res.code >= 200) { if (res.code >= 200) {
@ -787,7 +799,7 @@
} }
}); });
} else { } else {
this.recordform.step=this.stepid this.recordform.step = this.stepid
createrecordform(this.recordform).then((res) => { createrecordform(this.recordform).then((res) => {
if (res.code >= 200) { if (res.code >= 200) {
@ -807,7 +819,7 @@
if (valid) { if (valid) {
const isEdit = this.dialogType1 === "edit"; const isEdit = this.dialogType1 === "edit";
if (isEdit) { if (isEdit) {
this.field.form=this.formID; this.field.form = this.formID;
this.field.field_choice = this.field_choice; this.field.field_choice = this.field_choice;
updaterffield(this.field.id, this.field).then((res) => { updaterffield(this.field.id, this.field).then((res) => {
if (res.code >= 200) { if (res.code >= 200) {
@ -817,7 +829,7 @@
} }
}); });
} else { } else {
this.field.form=this.formID; this.field.form = this.formID;
this.field.field_choice = this.field_choice; this.field.field_choice = this.field_choice;
createrffield(this.field).then((res) => { createrffield(this.field).then((res) => {
if (res.code >= 200) { if (res.code >= 200) {

View File

@ -30,15 +30,10 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="产品状态"> <el-table-column label="产品状态">
<template slot-scope="scope">{{ <template slot-scope="scope">{{actstate_[scope.row.act_state]}}</template>
actstate_[scope.row.act_state]
}}
</template>
</el-table-column> </el-table-column>
<el-table-column label="生产状态"> <el-table-column label="生产状态">
<template slot-scope="scope"> <template slot-scope="scope">{{scope.row.step_.name}}</template>
{{scope.row.step_.name}}
</template>
</el-table-column> </el-table-column>
<el-table-column label="最后检验结果"> <el-table-column label="最后检验结果">
<template slot-scope="scope"> <template slot-scope="scope">
@ -58,7 +53,6 @@
> >
<template slot-scope="scope"> <template slot-scope="scope">
<el-link <el-link
v-if="checkPermission(['material_delete'])"
type="primary" type="primary"
@click="handleoption(scope)" @click="handleoption(scope)"
>生成流程卡 >生成流程卡

View File

@ -1,100 +1,95 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-card class="box-card"> <el-card class="box-card">
<div slot="header" class="clearfix"> <div slot="header" class="clearfix">
<span>生产任务列表</span> <span>生产任务列表</span>
</div>
</div> <el-table
<el-table
:data="subproductionplanList.results" :data="subproductionplanList.results"
fit fit
style="width: 100%" style="width: 100%"
height="100" height="100"
stripe stripe
border border
v-el-height-adaptive-table="{bottomOffset: 50}" v-el-height-adaptive-table="{bottomOffset: 50}"
> >
<el-table-column type="index" width="50" /> <el-table-column type="index" width="50"/>
<el-table-column label="子计划编号" width="100px">
<el-table-column label="子计划编号" width="100px"> <template slot-scope="scope">{{scope.row.number}}</template>
<template slot-scope="scope">{{scope.row.number}}</template> </el-table-column>
</el-table-column> <el-table-column label="产品名称" width="180px">
<el-table-column label="产品名称" width="180px" >
<template slot-scope="scope" v-if="scope.row.product_">{{ scope.row.product_.name }}</template> <template slot-scope="scope" v-if="scope.row.product_">{{ scope.row.product_.name }}</template>
</el-table-column> </el-table-column>
<el-table-column label="产品型号" > <el-table-column label="产品型号">
<template slot-scope="scope" v-if="scope.row.product_">{{ scope.row.product_.specification }}</template> <template slot-scope="scope" v-if="scope.row.product_">{{ scope.row.product_.specification }}</template>
</el-table-column> </el-table-column>
<el-table-column label="名称" width="160px"> <el-table-column label="名称" width="160px">
<template slot-scope="scope" v-if="scope.row.subproduction_">{{ scope.row.subproduction_.name }}</template> <template slot-scope="scope" v-if="scope.row.subproduction_">{{ scope.row.subproduction_.name }}</template>
</el-table-column> </el-table-column>
<el-table-column label="工序名">
<template slot-scope="scope" v-if="scope.row.process_">{{ scope.row.process_.name }}</template>
<el-table-column label="工序名" >
<template slot-scope="scope" v-if="scope.row.process_" >{{ scope.row.process_.name }}</template>
</el-table-column> </el-table-column>
<el-table-column label="工序编号"> <el-table-column label="工序编号">
<template slot-scope="scope" v-if="scope.row.process_">{{ scope.row.process_.number }}</template> <template slot-scope="scope" v-if="scope.row.process_">{{ scope.row.process_.number }}</template>
</el-table-column> </el-table-column>
<el-table-column label="子工序" width="200"> <el-table-column label="子工序" width="200">
<template slot-scope="scope" v-if="scope.row.steps"> <template slot-scope="scope" v-if="scope.row.steps">
<el-tag v-for="item in scope.row.steps" <el-tag v-for="item in scope.row.steps"
:key="item.number" :key="item.number"
:label="item.name" :label="item.name"
:value="item.number">{{item.name}}</el-tag> :value="item.number"
>
{{item.name}}
</el-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="生产车间" width="100px"> <el-table-column label="生产车间" width="100px">
<template slot-scope="scope" v-if="scope.row.workshop_">{{ scope.row.workshop_.name }}</template> <template slot-scope="scope" v-if="scope.row.workshop_">{{ scope.row.workshop_.name }}</template>
</el-table-column> </el-table-column>
<el-table-column label="生产数量"> <el-table-column label="生产数量">
<template slot-scope="scope">{{ scope.row.count }}</template> <template slot-scope="scope">{{ scope.row.count }}</template>
</el-table-column> </el-table-column>
<el-table-column label="开工时间" width="100px"> <el-table-column label="开工时间" width="100px">
<template slot-scope="scope">{{ scope.row.start_date }}</template> <template slot-scope="scope">{{ scope.row.start_date }}</template>
</el-table-column> </el-table-column>
<el-table-column label="完工时间" width="100px"> <el-table-column label="完工时间" width="100px">
<template slot-scope="scope">{{ scope.row.end_date }}</template> <template slot-scope="scope">{{ scope.row.end_date }}</template>
</el-table-column> </el-table-column>
<el-table-column label="下达状态"> <el-table-column label="下达状态">
<template slot-scope="scope">{{ state_[scope.row.state] }}</template> <template slot-scope="scope">{{ state_[scope.row.state] }}</template>
</el-table-column> </el-table-column>
<el-table-column label="创建时间" width="160px">
<el-table-column label="创建时间" width="160px">
<template slot-scope="scope">{{ scope.row.create_time }}</template> <template slot-scope="scope">{{ scope.row.create_time }}</template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
align="center" align="center"
label="操作" label="操作"
width="100px" width="100px"
fixed="right" fixed="right"
> >
<template slot-scope="scope"> <template slot-scope="scope">
<el-link type="primary" <el-link
v-if="checkPermission(['warehouse_update'])" type="primary"
@click="handleclick(scope)" @click="handleclick(scope)"
>修改日期</el-link
> >
<el-link type="primary" 修改日期
v-if="scope.row.state==10" </el-link>
<el-link
type="primary"
@click="handleissuedclick(scope)" @click="handleissuedclick(scope)"
>下达</el-link
> >
下达
<el-link type="primary" </el-link>
v-if="checkPermission(['warehouse_update'])" <el-link
type="primary"
@click="handleselectclick(scope)" @click="handleselectclick(scope)"
>查看详情</el-link
> >
查看详情
</el-link>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<pagination <pagination
v-show="subproductionplanList.count > 0" v-show="subproductionplanList.count > 0"
:total="subproductionplanList.count" :total="subproductionplanList.count"
:page.sync="listQuery.page" :page.sync="listQuery.page"
@ -124,7 +119,7 @@
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
<el-form-item label="子计划完工时间" prop="end_date"> <el-form-item label="子计划完工时间" prop="end_date">
<el-date-picker <el-date-picker
v-model="subproductionplan.end_date" v-model="subproductionplan.end_date"
type="date" type="date"
placeholder="选择日期" placeholder="选择日期"
@ -133,223 +128,204 @@
> >
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
</el-form> </el-form>
<div style="text-align: right"> <div style="text-align: right">
<el-button type="danger" @click="dialogVisible = false">取消</el-button> <el-button type="danger" @click="dialogVisible = false">取消</el-button>
<el-button type="primary" @click="confirm('Form')">确认</el-button> <el-button type="primary" @click="confirm('Form')">确认</el-button>
</div> </div>
</el-dialog> </el-dialog>
<el-dialog <el-dialog
:visible.sync="dialogVisibles" :visible.sync="dialogVisibles"
:close-on-click-modal="false" :close-on-click-modal="false"
> >
<el-table
<el-table
:data="xhwl" :data="xhwl"
border border
fit fit
stripe stripe
style="width: 100%" style="width: 100%"
max-height="400" max-height="400"
> >
<el-table-column type="index" width="50" /> <el-table-column type="index" width="50"/>
<el-table-column label="预计消耗">
<el-table-column label="预计消耗">
<template slot-scope="scope">{{ scope.row.count }}</template> <template slot-scope="scope">{{ scope.row.count }}</template>
</el-table-column> </el-table-column>
<el-table-column label="实际消耗"> <el-table-column label="实际消耗">
<template slot-scope="scope">{{ scope.row.count_real }}</template> <template slot-scope="scope">{{ scope.row.count_real }}</template>
</el-table-column> </el-table-column>
<el-table-column label="生产计划编号"> <el-table-column label="生产计划编号">
<template slot-scope="scope">{{ scope.row.subproduction_plan_.number }}</template> <template slot-scope="scope">{{ scope.row.subproduction_plan_.number }}</template>
</el-table-column> </el-table-column>
<el-table-column label="物料名称"> <el-table-column label="物料名称">
<template slot-scope="scope">{{ scope.row.material_.name }}</template> <template slot-scope="scope">{{ scope.row.material_.name }}</template>
</el-table-column> </el-table-column>
<el-table-column label="物料编号"> <el-table-column label="物料编号">
<template slot-scope="scope">{{ scope.row.material_.number }}</template> <template slot-scope="scope">{{ scope.row.material_.number }}</template>
</el-table-column> </el-table-column>
<el-table-column label="物料型号"> <el-table-column label="物料型号">
<template slot-scope="scope">{{ scope.row.material_.specification }}</template> <template slot-scope="scope">{{ scope.row.material_.specification }}</template>
</el-table-column> </el-table-column>
<el-table-column label="物料单位"> <el-table-column label="物料单位">
<template slot-scope="scope">{{ scope.row.material_.unit }}</template> <template slot-scope="scope">{{ scope.row.material_.unit }}</template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<el-table <el-table
:data="ccwl" :data="ccwl"
border border
fit fit
stripe stripe
style="width: 100%" style="width: 100%"
max-height="400" max-height="400"
> >
<el-table-column type="index" width="50" /> <el-table-column type="index" width="50"/>
<el-table-column label="预计产出">
<el-table-column label="预计产出">
<template slot-scope="scope">{{ scope.row.count }}</template> <template slot-scope="scope">{{ scope.row.count }}</template>
</el-table-column> </el-table-column>
<el-table-column label="实际产出"> <el-table-column label="实际产出">
<template slot-scope="scope">{{ scope.row.count_real }}</template> <template slot-scope="scope">{{ scope.row.count_real }}</template>
</el-table-column> </el-table-column>
<el-table-column label="生产计划编号"> <el-table-column label="生产计划编号">
<template slot-scope="scope">{{ scope.row.subproduction_plan_.number }}</template> <template slot-scope="scope">{{ scope.row.subproduction_plan_.number }}</template>
</el-table-column> </el-table-column>
<el-table-column label="物料名称"> <el-table-column label="物料名称">
<template slot-scope="scope">{{ scope.row.material_.name }}</template> <template slot-scope="scope">{{ scope.row.material_.name }}</template>
</el-table-column> </el-table-column>
<el-table-column label="物料编号"> <el-table-column label="物料编号">
<template slot-scope="scope">{{ scope.row.material_.number }}</template> <template slot-scope="scope">{{ scope.row.material_.number }}</template>
</el-table-column> </el-table-column>
<el-table-column label="物料型号"> <el-table-column label="物料型号">
<template slot-scope="scope">{{ scope.row.material_.specification }}</template> <template slot-scope="scope">{{ scope.row.material_.specification }}</template>
</el-table-column> </el-table-column>
<el-table-column label="物料单位"> <el-table-column label="物料单位">
<template slot-scope="scope">{{ scope.row.material_.unit }}</template> <template slot-scope="scope">{{ scope.row.material_.unit }}</template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<div style="text-align: right"> <div style="text-align: right">
<el-button type="danger" @click="dialogVisibles = false">取消</el-button> <el-button type="danger" @click="dialogVisibles = false">取消</el-button>
</div> </div>
</el-dialog> </el-dialog>
</div> </div>
</template> </template>
<script> <script>
import { getsubproductionplanList,updatesubproductionplan,getProgress,issuesubplan } from "@/api/pm"; import {getsubproductionplanList, updatesubproductionplan, getProgress, issuesubplan} from "@/api/pm";
import checkPermission from "@/utils/permission"; import checkPermission from "@/utils/permission";
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
const defaultesubproductionplan = { const defaultesubproductionplan = {};
}; export default {
export default { components: {Pagination},
components: { Pagination }, data() {
data() { return {
return {
subproductionplan: defaultesubproductionplan, subproductionplan: defaultesubproductionplan,
subproductionplanList: { subproductionplanList: {
count: 0, count: 0,
}, },
listQuery: { listQuery: {
page: 1, page: 1,
page_size: 20, page_size: 20,
}, },
xhwl:[], xhwl: [],
ccwl:[], ccwl: [],
listLoading: true, listLoading: true,
dialogVisible: false, dialogVisible: false,
dialogVisibles: false, dialogVisibles: false,
dialogType: "new", dialogType: "new",
rule1: { rule1: {
number: [{ required: true, message: "请输入", trigger: "blur" }], number: [{required: true, message: "请输入", trigger: "blur"}],
}, },
state_:{ state_: {
10:'制定中', 10: '制定中',
20:'已下达', 20: '已下达',
30:'已接受', 30: '已接受',
40:'生产中', 40: '生产中',
50:'已完成'} 50: '已完成'
};
},
computed: {},
watch: {},
created() {
this.id=this.$route.params.id;
this.getspList();
},
methods: {
checkPermission,
//订单列表
getspList() {
this.listLoading = true;
this.listQuery.production_plan = this.id;
console.log(this.listQuery)
getsubproductionplanList(this.listQuery).then((response) => {
if (response.data) {
this.subproductionplanList = response.data;
} }
this.listLoading = false; };
});
}, },
handleclick(scope) computed: {},
{ watch: {},
this.subproductionplan = Object.assign({}, scope.row); // copy obj created() {
this.dialogVisible = true; this.id = this.$route.params.id;
this.getspList();
},
methods: {
checkPermission,
//订单列表
getspList() {
this.listLoading = true;
this.listQuery.production_plan = this.id;
console.log(this.listQuery)
getsubproductionplanList(this.listQuery).then((response) => {
if (response.data) {
this.subproductionplanList = response.data;
}
this.listLoading = false;
});
},
handleclick(scope) {
this.subproductionplan = Object.assign({}, scope.row); // copy obj
this.dialogVisible = true;
this.$nextTick(() => { this.$nextTick(() => {
this.$refs["Form"].clearValidate(); this.$refs["Form"].clearValidate();
}); });
}, },
handleselectclick(scope) handleselectclick(scope) {
{ this.dialogVisibles = true;
this.dialogVisibles = true; this.xhwl = [];
this.xhwl=[];
this.ccwl=[]; this.ccwl = [];
getProgress(scope.row.id).then((res) => { getProgress(scope.row.id).then((res) => {
if (res.code >= 200) { if (res.code >= 200) {
res.data.forEach((item) => { res.data.forEach((item) => {
if(item.type==1)
{
this.xhwl.push(item);
}
else if(item.type==2)
{
this.ccwl.push(item);
}
});
if (item.type == 1) {
this.xhwl.push(item);
} else if (item.type == 2) {
this.ccwl.push(item);
} }
});
},
confirm()
{
updatesubproductionplan(this.subproductionplan.id,this.subproductionplan).then((res) => {
if (res.code >= 200) {
this.getspList();
this.dialogVisible = false;
this.$message.success("成功");
}
});
},
handleissuedclick(scope) });
{
this.$confirm("确定下达子计划?", "提醒", { }
confirmButtonText: "确认", });
cancelButtonText: "取消", },
type: "warning", confirm() {
}) updatesubproductionplan(this.subproductionplan.id, this.subproductionplan).then((res) => {
.then(async () => { if (res.code >= 200) {
await issuesubplan(scope.row.id).then((res) => { this.getspList();
this.dialogVisible = false;
this.$message.success("成功");
}
});
},
handleissuedclick(scope) {
this.$confirm("确定下达子计划?", "提醒", {
confirmButtonText: "确认",
cancelButtonText: "取消",
type: "warning",
})
.then(async () => {
await issuesubplan(scope.row.id).then((res) => {
if (res.code >= 200) { if (res.code >= 200) {
this.getspList(); this.getspList();
this.$message.success("子计划已下达!"); this.$message.success("子计划已下达!");
} }
}); });
}) })
.catch((err) => { .catch((err) => {
console.error(err); console.error(err);
}); });
} }
}, },
}; };
</script> </script>

View File

@ -2,9 +2,13 @@
<div class="app-container"> <div class="app-container">
<el-card> <el-card>
<div> <div>
<el-button type="primary" icon="el-icon-plus" @click="handleCreate" <el-button
>新增采购订单项</el-button type="primary"
icon="el-icon-plus"
@click="handleCreate"
> >
新增采购订单项
</el-button>
</div> </div>
</el-card> </el-card>
<el-card style="margin-top: 2px"> <el-card style="margin-top: 2px">
@ -19,32 +23,30 @@
height="100" height="100"
v-el-height-adaptive-table="{ bottomOffset: 43 }" v-el-height-adaptive-table="{ bottomOffset: 43 }"
> >
<el-table-column type="index" width="50" /> <el-table-column type="index" width="50"/>
<el-table-column label="物料名称"> <el-table-column label="物料名称">
<template slot-scope="scope">{{ scope.row.material_.name }}</template> <template slot-scope="scope">{{ scope.row.material_.name }}</template>
</el-table-column> </el-table-column>
<el-table-column label="物料型号"> <el-table-column label="物料型号">
<template slot-scope="scope">{{ scope.row.material_.specification }}</template> <template slot-scope="scope">{{ scope.row.material_.specification }}</template>
</el-table-column> </el-table-column>
<el-table-column label="采购数量">
<el-table-column label="采购数量">
<template slot-scope="scope">{{ scope.row.count }}</template> <template slot-scope="scope">{{ scope.row.count }}</template>
</el-table-column> </el-table-column>
<el-table-column label="已到货数量"> <el-table-column label="已到货数量">
<template slot-scope="scope">{{ scope.row.delivered_count }}</template> <template slot-scope="scope">{{ scope.row.delivered_count }}</template>
</el-table-column> </el-table-column>
<el-table-column label="截止到货时间"> <el-table-column label="截止到货时间">
<template slot-scope="scope">{{ scope.row.delivery_date }}</template> <template slot-scope="scope">{{ scope.row.delivery_date }}</template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="操作" width="220px"> <el-table-column align="center" label="操作" width="220px">
<template slot-scope="scope"> <template slot-scope="scope">
<el-link <el-link
v-if="checkPermission(['vendor_delete'])"
type="danger" type="danger"
@click="handleDelete(scope)" @click="handleDelete(scope)"
>删除</el-link
> >
删除
</el-link>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -65,10 +67,10 @@
:rules="rule1" :rules="rule1"
> >
<el-form-item label="所需数量" prop="number"> <el-form-item label="所需数量" prop="number">
<el-input v-model="puorderTtem.count" placeholder="所需数量" /> <el-input v-model="puorderTtem.count" placeholder="所需数量"/>
</el-form-item> </el-form-item>
<el-form-item label="截止到货时间" prop="delivery_date"> <el-form-item label="截止到货时间" prop="delivery_date">
<el-date-picker <el-date-picker
v-model="puorderTtem.delivery_date" v-model="puorderTtem.delivery_date"
type="date" type="date"
placeholder="选择日期" placeholder="选择日期"
@ -97,101 +99,101 @@
</div> </div>
</template> </template>
<script> <script>
import { getpVendorList } from "@/api/vendor"; import {getpVendorList} from "@/api/vendor";
import { getMaterialList } from "@/api/mtm"; import {getMaterialList} from "@/api/mtm";
import { import {
getPuorderItemList, getPuorderItemList,
createPuorderItem, createPuorderItem,
deletePuorderItem, deletePuorderItem,
} from "@/api/pum"; } from "@/api/pum";
import checkPermission from "@/utils/permission"; import checkPermission from "@/utils/permission";
import { genTree } from "@/utils"; import {genTree} from "@/utils";
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
const defaultpuorderItem = { const defaultpuorderItem = {
pu_order:null, pu_order: null,
}; };
export default { export default {
components: { Pagination }, components: {Pagination},
data() { data() {
return { return {
puorderTtem: defaultpuorderItem, puorderTtem: defaultpuorderItem,
puorderTtemList: { puorderTtemList: {
count: 0, count: 0,
}, },
materialoptions: [], materialoptions: [],
listQuery: { listQuery: {
page: 1, page: 1,
page_size: 20, page_size: 20,
}, },
dialogVisible:false, dialogVisible: false,
rule1: { rule1: {
delivery_date: [{ required: true, message: "请选择日期", trigger: "blur" }], delivery_date: [{required: true, message: "请选择日期", trigger: "blur"}],
material: [ material: [
{ required: true, message: "请选择物料", trigger: "change" }, {required: true, message: "请选择物料", trigger: "change"},
], ],
}, },
}; };
},
computed: {},
watch: {},
created() {
this.id = this.$route.params.id;
this.getList();
this.getmaterialList();
},
methods: {
checkPermission,
//采购订单列表
getList() {
this.listQuery.pu_order= this.id;
getPuorderItemList(this.listQuery).then((response) => {
if (response.data) {
this.puorderTtemList = response.data;
}
});
}, },
//物料 computed: {},
getmaterialList() { watch: {},
getMaterialList({ page: 0 }).then((response) => { created() {
if (response.data) { this.id = this.$route.params.id;
this.materialoptions = response.data; this.getList();
} this.getmaterialList();
});
}, },
handleCreate() { methods: {
this.puorderTtem = Object.assign({}, defaultpuorderItem); checkPermission,
this.dialogVisible = true; //采购订单列表
this.$nextTick(() => { getList() {
this.$refs["Form"].clearValidate(); this.listQuery.pu_order = this.id;
}); getPuorderItemList(this.listQuery).then((response) => {
}, if (response.data) {
async confirm() { this.puorderTtemList = response.data;
this.puorderTtem.pu_order=this.id }
createPuorderItem(this.puorderTtem).then((res) => {
if (res.code >= 200) {
this.getList();
this.dialogVisible = false;
this.$message.success("成功");
}
});
},
handleDelete(scope) {
this.$confirm("确认删除?", "警告", {
confirmButtonText: "确认",
cancelButtonText: "取消",
type: "error",
})
.then(async () => {
await deletePuorderItem(scope.row.id);
this.getList();
this.$message.success("成功");
})
.catch((err) => {
console.error(err);
}); });
},
//物料
getmaterialList() {
getMaterialList({page: 0}).then((response) => {
if (response.data) {
this.materialoptions = response.data;
}
});
},
handleCreate() {
this.puorderTtem = Object.assign({}, defaultpuorderItem);
this.dialogVisible = true;
this.$nextTick(() => {
this.$refs["Form"].clearValidate();
});
},
async confirm() {
this.puorderTtem.pu_order = this.id
createPuorderItem(this.puorderTtem).then((res) => {
if (res.code >= 200) {
this.getList();
this.dialogVisible = false;
this.$message.success("成功");
}
});
},
handleDelete(scope) {
this.$confirm("确认删除?", "警告", {
confirmButtonText: "确认",
cancelButtonText: "取消",
type: "error",
})
.then(async () => {
await deletePuorderItem(scope.row.id);
this.getList();
this.$message.success("成功");
})
.catch((err) => {
console.error(err);
});
},
}, },
}, };
};
</script> </script>

View File

@ -99,7 +99,6 @@
> >
<template slot-scope="scope"> <template slot-scope="scope">
<el-link <el-link
v-if="checkPermission(['material_delete'])"
type="primary" type="primary"
@click="handleoption(scope)" @click="handleoption(scope)"
>查看 >查看
@ -137,7 +136,6 @@
> >
<template slot-scope="scope"> <template slot-scope="scope">
<el-link <el-link
v-if="checkPermission(['material_delete'])"
type="primary" type="primary"
@click="handleprocess(scope)" @click="handleprocess(scope)"
>查看 >查看

View File

@ -1,19 +1,19 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-card style="margin-top: 2px"> <el-card style="margin-top: 2px">
<el-descriptions title="基本信息" :column="8" :size="size" border> <el-descriptions title="基本信息" :column="8" :size="size" border>
<el-descriptions-item label="合同名称" > {{contractdetail.name}}</el-descriptions-item> <el-descriptions-item label="合同名称"> {{contractdetail.name}}</el-descriptions-item>
<el-descriptions-item label="编号" > {{contractdetail.number}}</el-descriptions-item> <el-descriptions-item label="编号"> {{contractdetail.number}}</el-descriptions-item>
<el-descriptions-item label="金额" > {{contractdetail.amount}}</el-descriptions-item> <el-descriptions-item label="金额"> {{contractdetail.amount}}</el-descriptions-item>
<el-descriptions-item label="客户名称" v-if="contractdetail.customer"> {{contractdetail.customer_.name}} </el-descriptions-item> <el-descriptions-item label="客户名称" v-if="contractdetail.customer"> {{contractdetail.customer_.name}}
</el-descriptions> </el-descriptions-item>
</el-card> </el-descriptions>
<el-card class="box-card"> </el-card>
<div slot="header" class="clearfix"> <el-card class="box-card">
<span>关联订单</span> <div slot="header" class="clearfix">
</div> <span>关联订单</span>
<el-table </div>
<el-table
v-loading="listLoading" v-loading="listLoading"
:data="OrderList" :data="OrderList"
border border
@ -21,110 +21,102 @@
stripe stripe
highlight-current-row highlight-current-row
height="510px" height="510px"
> >
<el-table-column type="index" width="50" /> <el-table-column type="index" width="50"/>
<el-table-column label="订单编号" width="160" show-overflow-tooltip>
<el-table-column label="订单编号" width="160" show-overflow-tooltip>
<template slot-scope="scope">{{ scope.row.number }}</template> <template slot-scope="scope">{{ scope.row.number }}</template>
</el-table-column> </el-table-column>
<el-table-column label="客户" width="200" show-overflow-tooltip> <el-table-column label="客户" width="200" show-overflow-tooltip>
<template slot-scope="scope">{{ scope.row.customer_.name }}</template> <template slot-scope="scope">{{ scope.row.customer_.name }}</template>
</el-table-column> </el-table-column>
<el-table-column label="产品名称" width="200" show-overflow-tooltip>
<el-table-column label="产品名称" width="200" show-overflow-tooltip>
<template slot-scope="scope">{{ scope.row.product_.name }}</template> <template slot-scope="scope">{{ scope.row.product_.name }}</template>
</el-table-column> </el-table-column>
<el-table-column label="产品型号" width="120" show-overflow-tooltip> <el-table-column label="产品型号" width="120" show-overflow-tooltip>
<template slot-scope="scope">{{ scope.row.product_.specification }}</template> <template slot-scope="scope">{{ scope.row.product_.specification }}</template>
</el-table-column> </el-table-column>
<el-table-column label="产品数量" > <el-table-column label="产品数量">
<template slot-scope="scope">{{ scope.row.count }}</template> <template slot-scope="scope">{{ scope.row.count }}</template>
</el-table-column> </el-table-column>
<el-table-column label="交货日期" > <el-table-column label="交货日期">
<template slot-scope="scope">{{ scope.row.delivery_date }}</template> <template slot-scope="scope">{{ scope.row.delivery_date }}</template>
</el-table-column> </el-table-column>
<el-table-column label="已交货数量" > <el-table-column label="已交货数量">
<template slot-scope="scope">{{ scope.row.delivered_count }}</template> <template slot-scope="scope">{{ scope.row.delivered_count }}</template>
</el-table-column> </el-table-column>
<el-table-column label="创建时间" width="160">
<el-table-column label="创建时间" width="160" >
<template slot-scope="scope">{{ scope.row.create_time }}</template> <template slot-scope="scope">{{ scope.row.create_time }}</template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
align="center" align="center"
label="操作" label="操作"
width="220px" width="220px"
> >
<template slot-scope="scope"> <template slot-scope="scope">
<el-link
type="primary"
<el-link
v-if="checkPermission(['warehouse_delete'])"
type="primary"
@click="handleDetail(scope)" @click="handleDetail(scope)"
>详情</el-link
> >
详情
</el-link>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
</el-card> </el-card>
</div> </div>
</template> </template>
<script> <script>
import {getContract,getOrderList} from "@/api/sam"; import {getContract, getOrderList} from "@/api/sam";
import checkPermission from "@/utils/permission"; import checkPermission from "@/utils/permission";
import { genTree } from "@/utils"; import {genTree} from "@/utils";
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
export default { export default {
components: { Pagination }, components: {Pagination},
data() { data() {
return { return {
contractdetail:"", contractdetail: "",
OrderList:"", OrderList: "",
}; };
},
computed: {},
watch: {},
created() {
this.id = this.$route.params.id;
this.getdetail();
this.getList();
},
methods: {
checkPermission,
getList() {
getOrderList({contract:this.id,page:0}).then((response) => {
if (response.data) {
this.OrderList = response.data;
}
})
}, },
//详情 computed: {},
getdetail() { watch: {},
created() {
this.id = this.$route.params.id;
this.getdetail();
this.getList();
getContract(this.id).then((response) => {
if (response.data) {
this.contractdetail = response.data;
}
})
}, },
methods: {
checkPermission,
getList() {
getOrderList({contract: this.id, page: 0}).then((response) => {
if (response.data) {
this.OrderList = response.data;
}
//订单详情 })
handleDetail(scope){ },
this.$router.push({name: "orderdetail", params: { id: scope.row.id }, }) //详情
} getdetail() {
},
}; getContract(this.id).then((response) => {
if (response.data) {
this.contractdetail = response.data;
}
})
},
//订单详情
handleDetail(scope) {
this.$router.push({name: "orderdetail", params: {id: scope.row.id},})
}
},
};
</script> </script>

View File

@ -3,30 +3,30 @@
<el-card style="margin-top: 2px"> <el-card style="margin-top: 2px">
<el-descriptions title="基本信息" direction="vertical" :column="6" border> <el-descriptions title="基本信息" direction="vertical" :column="6" border>
<el-descriptions-item label="客户名称" v-if="salesdetail.customer"> <el-descriptions-item label="客户名称" v-if="salesdetail.customer">
{{ salesdetail.customer_.name }}</el-descriptions-item {{ salesdetail.customer_.name }}
> </el-descriptions-item>
<el-descriptions-item label="产品名称" v-if="salesdetail.product"> <el-descriptions-item label="产品名称" v-if="salesdetail.product">
{{ salesdetail.product_.name }}</el-descriptions-item {{ salesdetail.product_.name }}
> </el-descriptions-item>
<el-descriptions-item <el-descriptions-item
v-if="salesdetail.product"
label="产品型号" label="产品型号"
:span="2" :span="2"
v-if="salesdetail.product"
> >
{{ salesdetail.product_.specification }}</el-descriptions-item {{ salesdetail.product_.specification }}
> </el-descriptions-item>
<el-descriptions-item label="合同名称" v-if="salesdetail.order"> <el-descriptions-item label="合同名称" v-if="salesdetail.order">
{{ salesdetail.order_.contract_.name }}</el-descriptions-item {{ salesdetail.order_.contract_.name }}
> </el-descriptions-item>
<el-descriptions-item label="合同编号" v-if="salesdetail.order"> <el-descriptions-item label="合同编号" v-if="salesdetail.order">
{{ salesdetail.order_.contract_.number }}</el-descriptions-item {{ salesdetail.order_.contract_.number }}
> </el-descriptions-item>
<el-descriptions-item label="订单编号" v-if="salesdetail.order"> <el-descriptions-item label="订单编号" v-if="salesdetail.order">
{{ salesdetail.order_.number }} {{ salesdetail.order_.number }}
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item label="物流详情" v-if="ship_pic!=''"> <el-descriptions-item v-if="ship_pic!=''" label="物流详情">
<el-link type="primary" :href="salesdetail.ship_pic">物流单</el-link></el-descriptions-item> <el-link type="primary" :href="salesdetail.ship_pic">物流单</el-link>
</el-descriptions-item>
</el-descriptions> </el-descriptions>
<el-button type="primary" style="margin-top:10px" @click="upload">上传物流信息</el-button> <el-button type="primary" style="margin-top:10px" @click="upload">上传物流信息</el-button>
</el-card> </el-card>
@ -40,38 +40,36 @@
highlight-current-row highlight-current-row
style="width: 100%" style="width: 100%"
> >
<el-table-column type="index" width="50" /> <el-table-column type="index" width="50"/>
<el-table-column label="产品编号" show-overflow-tooltip> <el-table-column label="产品编号" show-overflow-tooltip>
<template slot-scope="scope">{{ scope.row.number }}</template> <template slot-scope="scope">{{ scope.row.number }}</template>
</el-table-column> </el-table-column>
<el-table-column label="产品名称" show-overflow-tooltip> <el-table-column label="产品名称" show-overflow-tooltip>
<template slot-scope="scope">{{ <template slot-scope="scope">
scope.row.iproduct_.material_.name {{scope.row.iproduct_.material_.name }}
}}</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="批次"> <el-table-column label="批次">
<template slot-scope="scope">{{ <template slot-scope="scope">
scope.row.iproduct_.batch {{scope.row.iproduct_.batch }}
}}</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="仓库"> <el-table-column label="仓库">
<template slot-scope="scope">{{ <template slot-scope="scope">
scope.row.iproduct_.warehouse_.name {{scope.row.iproduct_.warehouse_.name }}
}}</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="是否已军检"> <el-table-column label="是否已军检">
<template slot-scope="scope"> <template slot-scope="scope">
<el-tag v-if="scope.row.is_mtested == false">未军检</el-tag> <el-tag v-if="scope.row.is_mtested == false">未军检</el-tag>
<el-tag v-else>已军检</el-tag></template <el-tag v-else>已军检</el-tag>
> </template>
</el-table-column> </el-table-column>
<el-table-column label="军检"> <el-table-column label="军检">
<template slot-scope="scope"> <template slot-scope="scope">
<el-tag v-if="scope.row.is_mtestok == false">不合格</el-tag> <el-tag v-if="scope.row.is_mtestok == false">不合格</el-tag>
<el-tag v-else>合格</el-tag></template <el-tag v-else>合格</el-tag>
> </template>
</el-table-column> </el-table-column>
<el-table-column label="装箱单号" show-overflow-tooltip> <el-table-column label="装箱单号" show-overflow-tooltip>
<template slot-scope="scope">{{ scope.row.packnum }}</template> <template slot-scope="scope">{{ scope.row.packnum }}</template>
@ -82,60 +80,59 @@
<el-table-column align="center" label="操作" width="220px"> <el-table-column align="center" label="操作" width="220px">
<template slot-scope="scope"> <template slot-scope="scope">
<el-link <el-link
v-if="checkPermission(['warehouse_delete'])"
type="primary" type="primary"
@click="handlePack(scope)" @click="handlePack(scope)"
>装箱</el-link
> >
装箱
</el-link>
<el-link <el-link
v-if="checkPermission(['warehouse_delete'])"
type="primary" type="primary"
@click="handleNotPack(scope)" @click="handleNotPack(scope)"
>备注</el-link
> >
备注
</el-link>
<el-link <el-link
v-if="checkPermission(['warehouse_delete'])"
type="danger" type="danger"
@click="handleDelete(scope)" @click="handleDelete(scope)"
>删除</el-link
> >
删除
</el-link>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<el-dialog <el-dialog
:close-on-click-modal="false" :close-on-click-modal="false"
:visible.sync="dialogVisibless" :visible.sync="dialogVisibless"
title="上传物流文件" title="上传物流文件"
>
<el-form
ref="Forms"
:model="ship"
label-width="100px"
label-position="right"
:rules="rule1"
> >
<el-form-item label="文件" prop="template" > <el-form
<el-upload ref="Forms"
ref="upload" :model="ship"
:action="upUrl" label-width="100px"
:on-preview="handlePreview" label-position="right"
:on-success="handleUpSuccess" :rules="rule1"
:on-remove="handleRemove" >
:headers="upHeaders" <el-form-item label="文件" prop="template">
:file-list="fileList" <el-upload
:limit="1" ref="upload"
accept=".webp,.bmp,.jpg,.png,.tif,.gif,.apng" :action="upUrl"
> :on-preview="handlePreview"
<el-button size="small" type="primary">上传文件</el-button> :on-success="handleUpSuccess"
</el-upload> :on-remove="handleRemove"
</el-form-item> :headers="upHeaders"
</el-form> :file-list="fileList"
<div style="text-align: right"> :limit="1"
<el-button type="danger" @click="dialogVisibless = false">取消</el-button> accept=".webp,.bmp,.jpg,.png,.tif,.gif,.apng"
<el-button type="primary" @click="uploadship">确认</el-button> >
</div> <el-button size="small" type="primary">上传文件</el-button>
</el-dialog> </el-upload>
</el-form-item>
</el-form>
<div style="text-align: right">
<el-button type="danger" @click="dialogVisibless = false">取消</el-button>
<el-button type="primary" @click="uploadship">确认</el-button>
</div>
</el-dialog>
<el-dialog <el-dialog
:visible.sync="dialogVisible" :visible.sync="dialogVisible"
:close-on-click-modal="false" :close-on-click-modal="false"
@ -149,9 +146,8 @@
label-position="right" label-position="right"
> >
<el-form-item label="装箱单号" prop="packnum"> <el-form-item label="装箱单号" prop="packnum">
<el-input v-model="packData.packnum" placeholder="装箱单号" /> <el-input v-model="packData.packnum" placeholder="装箱单号"/>
</el-form-item> </el-form-item>
<el-form-item label="装箱文件确认" prop="iproducts"> <el-form-item label="装箱文件确认" prop="iproducts">
<el-table <el-table
:data="packlist" :data="packlist"
@ -162,7 +158,7 @@
ref="multipleTable" ref="multipleTable"
height="300" height="300"
> >
<el-table-column type="index" width="50" label="序号" /> <el-table-column type="index" width="50" label="序号"/>
<el-table-column label="名称"> <el-table-column label="名称">
<template slot-scope="scope">{{ scope.row.name }}</template> <template slot-scope="scope">{{ scope.row.name }}</template>
</el-table-column> </el-table-column>
@ -183,22 +179,22 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="库存数量"> <el-table-column label="库存数量">
<template slot-scope="scope" v-if="scope.row.material_">{{ <template slot-scope="scope" v-if="scope.row.material_">
scope.row.material_.count {{scope.row.material_.count}}
}}</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="安全库存数量"> <el-table-column label="安全库存数量">
<template slot-scope="scope" v-if="scope.row.material_">{{ <template slot-scope="scope" v-if="scope.row.material_">
scope.row.material_.count_safe {{scope.row.material_.count_safe}}
}}</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
</el-form-item> </el-form-item>
</el-form> </el-form>
<div style="text-align: right"> <div style="text-align: right">
<el-button type="danger" @click="dialogVisible = false" <el-button type="danger" @click="dialogVisible = false">
>取消</el-button 取消
> </el-button>
<el-button type="primary" @click="submitPack">确认</el-button> <el-button type="primary" @click="submitPack">确认</el-button>
</div> </div>
</el-dialog> </el-dialog>
@ -215,13 +211,13 @@
label-position="right" label-position="right"
> >
<el-form-item label="备注" prop="remark"> <el-form-item label="备注" prop="remark">
<el-input v-model="notpackData.remark" placeholder="未装箱备注" /> <el-input v-model="notpackData.remark" placeholder="未装箱备注"/>
</el-form-item> </el-form-item>
</el-form> </el-form>
<div style="text-align: right"> <div style="text-align: right">
<el-button type="danger" @click="dialogVisibles = false" <el-button type="danger" @click="dialogVisibles = false">
>取消</el-button 取消
> </el-button>
<el-button type="primary" @click="submitnotPack">确认</el-button> <el-button type="primary" @click="submitnotPack">确认</el-button>
</div> </div>
</el-dialog> </el-dialog>
@ -229,63 +225,63 @@
</div> </div>
</template> </template>
<script> <script>
import { import {
getSale, getSale,
getSaleproductList, getSaleproductList,
deleteSaleproduct, deleteSaleproduct,
gePack, gePack,
subPack, subPack,
notPackremark, notPackremark,
ship ship
} from "@/api/sam"; } from "@/api/sam";
import checkPermission from "@/utils/permission"; import checkPermission from "@/utils/permission";
import { upUrl, upHeaders } from "@/api/file"; import {upUrl, upHeaders} from "@/api/file";
import { genTree } from "@/utils"; import {genTree} from "@/utils";
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
const defaultepackData = { const defaultepackData = {
packnum: "", packnum: "",
}; };
export default { export default {
components: { Pagination }, components: {Pagination},
data() { data() {
return { return {
salesdetail: "", salesdetail: "",
saleproduct: "", saleproduct: "",
packlist: [], packlist: [],
upHeaders: upHeaders(), upHeaders: upHeaders(),
upUrl: upUrl(), upUrl: upUrl(),
dialogVisible: false, dialogVisible: false,
dialogVisibles: false, dialogVisibles: false,
dialogVisibless: false, dialogVisibless: false,
ship:{}, ship: {},
packData: defaultepackData, packData: defaultepackData,
notpackData: { remark: "" }, notpackData: {remark: ""},
detail: [], detail: [],
fileList:[], fileList: [],
saleproductId: null, saleproductId: null,
saleProductid: null, saleProductid: null,
dialogType: "new", dialogType: "new",
}; };
},
computed: {},
watch: {},
created() {
this.id = this.$route.params.id;
this.getList();
this.getSaleproductLists();
},
methods: {
checkPermission,
//详情
getList() {
getSale(this.id).then((response) => {
if (response.data) {
this.salesdetail = response.data;
}
});
}, },
//上传物流文件
computed: {},
watch: {},
created() {
this.id = this.$route.params.id;
this.getList();
this.getSaleproductLists();
},
methods: {
checkPermission,
//详情
getList() {
getSale(this.id).then((response) => {
if (response.data) {
this.salesdetail = response.data;
}
});
},
//上传物流文件
handlePreview(file) { handlePreview(file) {
if ("url" in file) { if ("url" in file) {
window.open(file.url); window.open(file.url);
@ -295,95 +291,94 @@ export default {
}, },
handleUpSuccess(res, file, filelist) { handleUpSuccess(res, file, filelist) {
this.ship.path = res.data.path; this.ship.path = res.data.path;
this.salesdetail.ship_pic=res.data.path; this.salesdetail.ship_pic = res.data.path;
console.log(this.ship.path) console.log(this.ship.path)
}, },
handleRemove(file, filelist){ handleRemove(file, filelist) {
this.ship.path = null; this.ship.path = null;
}, },
upload() { upload() {
this.dialogVisibless=true; this.dialogVisibless = true;
}, },
uploadship() uploadship() {
{ console.log(this.ship);
console.log(this.ship); ship(this.id, this.ship).then((res) => {
ship(this.id, this.ship).then((res) => { if (res.code >= 200) {
if (res.code >= 200) {
this.dialogVisibless = false; this.dialogVisibless = false;
this.$message.success("物流文件上传成功!"); this.$message.success("物流文件上传成功!");
} }
});
},
getSaleproductLists() {
getSaleproductList({ sale: this.id, page: 0 }).then((response) => {
if (response.data) {
this.saleproduct = response.data;
}
});
},
handleDelete(scope) {
this.$confirm("确认删除?", "警告", {
confirmButtonText: "确认",
cancelButtonText: "取消",
type: "error",
})
.then(async () => {
await deleteSaleproduct(scope.row.id);
this.getSaleproductLists();
this.$message.success("成功");
})
.catch((err) => {
console.error(err);
}); });
}, },
//装箱操作
handlePack(scope) {
this.packData = Object.assign({}, scope.row);
this.dialogType = "new";
this.dialogVisible = true;
this.$nextTick(() => {
this.$refs["Form"].clearValidate();
});
gePack(scope.row.id).then((response) => {
if (response.data) {
this.packlist = response.data.detail;
}
});
this.saleproductId = scope.row.id;
},
submitPack() { getSaleproductLists() {
this.packData.detail = this.packlist; getSaleproductList({sale: this.id, page: 0}).then((response) => {
console.log(this.packData); if (response.data) {
subPack(this.saleproductId, this.packData).then((res) => { this.saleproduct = response.data;
if (res.code >= 200) { }
this.getSaleproductLists(); });
this.dialogVisible = false; },
this.$message.success("成功"); handleDelete(scope) {
} this.$confirm("确认删除?", "警告", {
}); confirmButtonText: "确认",
cancelButtonText: "取消",
type: "error",
})
.then(async () => {
await deleteSaleproduct(scope.row.id);
this.getSaleproductLists();
this.$message.success("成功");
})
.catch((err) => {
console.error(err);
});
},
//装箱操作
handlePack(scope) {
this.packData = Object.assign({}, scope.row);
this.dialogType = "new";
this.dialogVisible = true;
this.$nextTick(() => {
this.$refs["Form"].clearValidate();
});
gePack(scope.row.id).then((response) => {
if (response.data) {
this.packlist = response.data.detail;
}
});
this.saleproductId = scope.row.id;
},
submitPack() {
this.packData.detail = this.packlist;
console.log(this.packData);
subPack(this.saleproductId, this.packData).then((res) => {
if (res.code >= 200) {
this.getSaleproductLists();
this.dialogVisible = false;
this.$message.success("成功");
}
});
},
//未装箱备注
handleNotPack(scope) {
this.dialogVisibles = true;
this.saleProductid = scope.row.id;
},
submitnotPack() {
notPackremark(this.saleProductid, this.notpackData).then((res) => {
if (res.code >= 200) {
this.getSaleproductLists();
this.dialogVisible = false;
this.$message.success("成功");
}
});
},
}, },
//未装箱备注 };
handleNotPack(scope) {
this.dialogVisibles = true;
this.saleProductid = scope.row.id;
},
submitnotPack() {
notPackremark(this.saleProductid, this.notpackData).then((res) => {
if (res.code >= 200) {
this.getSaleproductLists();
this.dialogVisible = false;
this.$message.success("成功");
}
});
},
},
};
</script> </script>