1289 lines
38 KiB
Python
1289 lines
38 KiB
Python
<template>
|
||
<div class="app-container">
|
||
|
||
<el-row :gutter="2">
|
||
<el-col :span="9" >
|
||
<el-card >
|
||
<div slot="header" class="clearfix">
|
||
<span style="font-size: 16px;
|
||
font-weight: 700;
|
||
">产品列表</span>
|
||
</div>
|
||
<el-table
|
||
v-loading="listLoading"
|
||
:data="materialList.results"
|
||
border
|
||
fit
|
||
stripe
|
||
highlight-current-row
|
||
height="660px"
|
||
@current-change="handleCurrentChange">
|
||
|
||
<el-table-column type="index" width="50" />
|
||
|
||
<el-table-column label="产品编号">
|
||
<template slot-scope="scope"> {{ scope.row.number }}</template>
|
||
</el-table-column>
|
||
<el-table-column label="产品名称" width="200px">
|
||
<template slot-scope="scope">{{ scope.row.name }}</template>
|
||
</el-table-column>
|
||
|
||
<el-table-column label="规格型号">
|
||
<template slot-scope="scope">{{ scope.row.specification }}</template>
|
||
|
||
|
||
</el-table-column>
|
||
|
||
|
||
|
||
</el-table>
|
||
|
||
</el-card>
|
||
|
||
</el-col>
|
||
<el-col :span="15" >
|
||
<el-card class="box-card">
|
||
<div slot="header" class="clearfix">
|
||
<span style="font-size: 16px;
|
||
font-weight: 700;
|
||
">工艺流程</span>
|
||
</div>
|
||
<el-steps :active="values" spac="400px" align-center="" style="padding-top: 20px;height:80px">
|
||
<el-step :title="item.name" v-for="(item,index) in processoptions " :key="index" @click.native=stepclick(item.id)>
|
||
|
||
</el-step>
|
||
</el-steps>
|
||
</el-card>
|
||
<el-card class="box-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="handlesubproducationCreate"
|
||
>新增</el-button>
|
||
<el-table
|
||
height="190px"
|
||
:data="subproducationData"
|
||
border
|
||
fit
|
||
stripe
|
||
highlight-current-row
|
||
@current-change="handlespChange"
|
||
>
|
||
<el-table-column type="index" width="50" />
|
||
<el-table-column label="名称">
|
||
<template slot-scope="scope">{{scope.row.name}}</template>
|
||
</el-table-column>
|
||
<el-table-column label="工序">
|
||
<template slot-scope="scope">{{ scope.row.process_.name }}</template>
|
||
</el-table-column>
|
||
<el-table-column label="排序">
|
||
<template slot-scope="scope">{{ scope.row.sort }}</template>
|
||
</el-table-column>
|
||
|
||
|
||
|
||
<el-table-column
|
||
align="center"
|
||
label="操作"
|
||
width="220px"
|
||
>
|
||
<template slot-scope="scope">
|
||
|
||
<el-link
|
||
v-if="checkPermission(['material_update'])"
|
||
type="primary"
|
||
@click="handlesubproducationEdit(scope)"
|
||
>编辑</el-link
|
||
>
|
||
<el-link
|
||
v-if="checkPermission(['material_delete'])"
|
||
type="danger"
|
||
@click="handlesubproducationDelete(scope)"
|
||
>删除</el-link
|
||
>
|
||
</template>
|
||
</el-table-column>
|
||
</el-table>
|
||
|
||
<el-dialog
|
||
:visible.sync="dialogVisiblesp"
|
||
:title="dialogTypesp === 'edit' ? '编辑流程分解' : '新增流程分解'"
|
||
>
|
||
<el-form
|
||
ref="Formsp"
|
||
:model="subproducation"
|
||
label-width="80px"
|
||
label-position="right"
|
||
>
|
||
|
||
<el-form-item label="名称" prop="name">
|
||
<el-input v-model="subproducation.name" />
|
||
</el-form-item>
|
||
<el-form-item label="绑定工序" prop="process" >
|
||
<el-select v-model="subproducation.process" placeholder="请选择" >
|
||
<el-option
|
||
v-for="item in processOptions"
|
||
:key="item.value"
|
||
:label="item.label"
|
||
:value="item.value">
|
||
</el-option>
|
||
</el-select>
|
||
|
||
</el-form-item>
|
||
<el-form-item label="排序" prop="sort">
|
||
<el-input-number
|
||
v-model="subproducation.sort"
|
||
:min="-2147483648"
|
||
:max="2147483647"
|
||
></el-input-number>
|
||
</el-form-item>
|
||
|
||
|
||
|
||
|
||
</el-form>
|
||
<div style="text-align: right">
|
||
<el-button type="danger" @click="dialogVisiblesp = false">取消</el-button>
|
||
<el-button type="primary" @click="subproducationfirm('Formsp')">确认</el-button>
|
||
</div>
|
||
</el-dialog>
|
||
</el-card>
|
||
|
||
|
||
<el-tabs type="border-card" style="height:310px">
|
||
<el-tab-pane label="输入物料" >
|
||
<el-button type="primary" icon="el-icon-plus" @click="handleinputCreate"
|
||
>新增</el-button>
|
||
|
||
<el-table
|
||
|
||
:data="inputtableData"
|
||
border
|
||
fit
|
||
stripe
|
||
height="220px"
|
||
style="width: 100%;"
|
||
|
||
>
|
||
<el-table-column type="index" width="50" />
|
||
<el-table-column label="物料编号" min-width="100">
|
||
<template slot-scope="scope">{{scope.row.material_.number}}</template>
|
||
</el-table-column>
|
||
|
||
<el-table-column label="物料名称" min-width="100">
|
||
<template slot-scope="scope"> {{scope.row.material_.name}}</template>
|
||
</el-table-column>
|
||
|
||
<el-table-column label="计量单位" min-width="100">
|
||
<template slot-scope="scope">{{ scope.row.material_.unit }}</template>
|
||
</el-table-column>
|
||
|
||
<el-table-column label="单位消耗量" min-width="100">
|
||
<template slot-scope="scope">{{ scope.row.count }}</template>
|
||
</el-table-column>
|
||
|
||
|
||
|
||
<el-table-column
|
||
align="center"
|
||
label="操作"
|
||
>
|
||
<template slot-scope="scope">
|
||
|
||
<el-link
|
||
v-if="checkPermission(['material_update'])"
|
||
type="primary"
|
||
@click="handleinputEdit(scope)"
|
||
>编辑</el-link
|
||
>
|
||
<el-link
|
||
v-if="checkPermission(['material_delete'])"
|
||
type="danger"
|
||
@click="handleinputDelete(scope)"
|
||
>删除</el-link
|
||
>
|
||
</template>
|
||
</el-table-column>
|
||
</el-table>
|
||
|
||
<el-dialog
|
||
:visible.sync="dialogVisible"
|
||
:title="dialogType === 'edit' ? '编辑输入物料' : '新增输入物料'"
|
||
>
|
||
<el-form
|
||
ref="Form"
|
||
:model="inputmaterial"
|
||
label-width="80px"
|
||
label-position="right"
|
||
>
|
||
|
||
<el-form-item label="消耗量" prop="count">
|
||
<el-input-number v-model="inputmaterial.count" :min="0" placeholder="输入整数或小数" />
|
||
</el-form-item>
|
||
|
||
<el-form-item label="输入物料" prop="unit">
|
||
<el-select filterable style="width: 50%" v-model="inputmaterial.material" placeholder="请选择">
|
||
<el-option
|
||
v-for="item in materialoptions"
|
||
:key="item.id"
|
||
:label="item.name"
|
||
:value="item.id">
|
||
<span style="float: left">{{ item.name }}</span>
|
||
<span style="float: right; color: #8492a6; font-size: 13px">{{ item.specification }}</span>
|
||
</el-option>
|
||
|
||
</el-select>
|
||
</el-form-item>
|
||
<el-form-item label="排序" prop="sort">
|
||
<el-input-number
|
||
v-model="inputmaterial.sort"
|
||
:min="-2147483648"
|
||
:max="2147483647"
|
||
></el-input-number>
|
||
</el-form-item>
|
||
|
||
|
||
</el-form>
|
||
<div style="text-align: right">
|
||
<el-button type="danger" @click="dialogVisible = false">取消</el-button>
|
||
<el-button type="primary" @click="inputconfirm('Form')">确认</el-button>
|
||
</div>
|
||
</el-dialog>
|
||
</el-tab-pane>
|
||
<el-tab-pane label="输出物料">
|
||
<el-button type="primary" icon="el-icon-plus" @click="handleoutputCreate"
|
||
>新增</el-button>
|
||
<el-table
|
||
|
||
:data="outputtableData"
|
||
border
|
||
fit
|
||
stripe
|
||
>
|
||
<el-table-column type="index" width="50" />
|
||
<el-table-column label="物料编号">
|
||
<template slot-scope="scope">{{scope.row.material_.number}}</template>
|
||
</el-table-column>
|
||
|
||
<el-table-column label="物料名称">
|
||
<template slot-scope="scope"> {{scope.row.material_.name}}</template>
|
||
</el-table-column>
|
||
|
||
<el-table-column label="计量单位">
|
||
<template slot-scope="scope">{{ scope.row.material_.unit }}</template>
|
||
</el-table-column>
|
||
|
||
<el-table-column label="单位产出量">
|
||
<template slot-scope="scope">{{ scope.row.count }}</template>
|
||
</el-table-column>
|
||
<el-table-column label="是否主产出">
|
||
<template slot-scope="scope">
|
||
<el-tag v-if="scope.row.is_main==true"> 是</el-tag>
|
||
<el-tag v-else>否</el-tag>
|
||
</template>
|
||
</el-table-column>
|
||
|
||
|
||
|
||
<el-table-column
|
||
align="center"
|
||
label="操作"
|
||
width="220px"
|
||
>
|
||
<template slot-scope="scope">
|
||
|
||
<el-link
|
||
v-if="checkPermission(['material_update'])"
|
||
type="primary"
|
||
@click="handleoutputEdit(scope)"
|
||
>编辑</el-link
|
||
>
|
||
<el-link
|
||
v-if="checkPermission(['material_delete'])"
|
||
type="danger"
|
||
@click="handleoutputDelete(scope)"
|
||
>删除</el-link
|
||
>
|
||
</template>
|
||
</el-table-column>
|
||
</el-table>
|
||
|
||
<el-dialog
|
||
:visible.sync="dialogVisible1"
|
||
:title="dialogType1 === 'edit' ? '编辑输出物料' : '新增输出物料'"
|
||
>
|
||
<el-form
|
||
ref="Forms"
|
||
:model="outputmaterial"
|
||
label-width="120px"
|
||
label-position="right"
|
||
>
|
||
|
||
<el-form-item label="产出量" prop="count">
|
||
<el-input-number v-model="outputmaterial.count" :min="0" />
|
||
</el-form-item>
|
||
|
||
<el-form-item label="输出物料" prop="unit">
|
||
<el-select filterable style="width: 50%" v-model="outputmaterial.material" placeholder="请选择">
|
||
<el-option
|
||
v-for="item in materialoptions"
|
||
:key="item.id"
|
||
:label="item.name"
|
||
:value="item.id">
|
||
<span style="float: left">{{ item.name }}</span>
|
||
<span style="float: right; color: #8492a6; font-size: 13px">{{ item.specification }}</span>
|
||
</el-option>
|
||
</el-select>
|
||
</el-form-item>
|
||
|
||
<el-form-item label="是否主产出" prop="is_main">
|
||
<el-switch v-model="outputmaterial.is_main"></el-switch>
|
||
</el-form-item>
|
||
|
||
<el-form-item label="排序" prop="sort">
|
||
<el-input-number
|
||
v-model="outputmaterial.sort"
|
||
:min="-2147483648"
|
||
:max="2147483647"
|
||
></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="outputconfirm('Forms')">确认</el-button>
|
||
</div>
|
||
</el-dialog>
|
||
</el-tab-pane>
|
||
|
||
<el-tab-pane label="工具工装">
|
||
<el-button type="primary" icon="el-icon-plus" @click="handleotherCreate"
|
||
>新增</el-button>
|
||
|
||
<el-table
|
||
|
||
:data="othertableData"
|
||
border
|
||
fit
|
||
stripe
|
||
style="width: 100%"
|
||
>
|
||
<el-table-column type="index" width="50" />
|
||
<el-table-column label="物料编号" min-width="100">
|
||
<template slot-scope="scope">{{scope.row.material_.number}}</template>
|
||
</el-table-column>
|
||
|
||
<el-table-column label="物料名称" min-width="100">
|
||
<template slot-scope="scope"> {{scope.row.material_.name}}</template>
|
||
</el-table-column>
|
||
|
||
<el-table-column label="计量单位" min-width="100">
|
||
<template slot-scope="scope">{{ scope.row.material_.unit }}</template>
|
||
</el-table-column>
|
||
|
||
|
||
|
||
|
||
<el-table-column
|
||
align="center"
|
||
label="操作"
|
||
>
|
||
<template slot-scope="scope">
|
||
|
||
<el-link
|
||
v-if="checkPermission(['material_update'])"
|
||
type="primary"
|
||
@click="handleotherEdit(scope)"
|
||
>编辑</el-link
|
||
>
|
||
<el-link
|
||
v-if="checkPermission(['material_delete'])"
|
||
type="danger"
|
||
@click="handleotherDelete(scope)"
|
||
>删除</el-link
|
||
>
|
||
</template>
|
||
</el-table-column>
|
||
</el-table>
|
||
|
||
<el-dialog
|
||
:visible.sync="dialogVisibleother"
|
||
:title="dialogTypeother === 'edit' ? '编辑工具工装' : '新增工具工装'"
|
||
>
|
||
<el-form
|
||
ref="Formother"
|
||
:model="othermaterial"
|
||
label-width="80px"
|
||
label-position="right"
|
||
>
|
||
<!--
|
||
<el-form-item label="消耗量" prop="count">
|
||
<el-input-number v-model="othermaterial.count" :min="0" placeholder="输入整数或小数" />
|
||
</el-form-item>
|
||
!-->
|
||
<el-form-item label="输入物料" prop="unit">
|
||
<el-select filterable style="width: 50%" v-model="othermaterial.material" placeholder="请选择">
|
||
<el-option
|
||
v-for="item in materialoptions"
|
||
:key="item.id"
|
||
:label="item.name"
|
||
:value="item.id">
|
||
<span style="float: left">{{ item.name }}</span>
|
||
<span style="float: right; color: #8492a6; font-size: 13px">{{ item.specification }}</span>
|
||
</el-option>
|
||
</el-select>
|
||
</el-form-item>
|
||
<el-form-item label="排序" prop="sort">
|
||
<el-input-number
|
||
v-model="othermaterial.sort"
|
||
:min="-2147483648"
|
||
:max="2147483647"
|
||
></el-input-number>
|
||
</el-form-item>
|
||
|
||
|
||
</el-form>
|
||
<div style="text-align: right">
|
||
<el-button type="danger" @click="dialogVisibleother = false">取消</el-button>
|
||
<el-button type="primary" @click="otherconfirm('Formother')">确认</el-button>
|
||
</div>
|
||
</el-dialog>
|
||
</el-tab-pane>
|
||
|
||
<el-tab-pane label="子工序列表">
|
||
<el-button type="primary" icon="el-icon-plus" @click="handleusedstepCreate"
|
||
>新增</el-button>
|
||
<el-table
|
||
|
||
:data="usedsteptableData"
|
||
border
|
||
fit
|
||
stripe
|
||
>
|
||
<el-table-column type="index" width="50" />
|
||
|
||
|
||
|
||
<el-table-column label="子工序名称">
|
||
<template slot-scope="scope">{{ scope.row.step_.name }}</template>
|
||
</el-table-column >
|
||
<el-table-column label="备注">
|
||
<template slot-scope="scope">{{ scope.row.remark }}</template>
|
||
</el-table-column >
|
||
|
||
<el-table-column
|
||
align="center"
|
||
label="操作"
|
||
>
|
||
<template slot-scope="scope">
|
||
|
||
<el-link
|
||
type="primary"
|
||
@click="handlesearch(scope)"
|
||
|
||
>查看</el-link
|
||
>
|
||
<el-link
|
||
v-if="checkPermission(['material_delete'])"
|
||
type="danger"
|
||
@click="handleusedstepDelete(scope)"
|
||
>删除</el-link
|
||
>
|
||
</template>
|
||
</el-table-column>
|
||
</el-table>
|
||
|
||
<el-dialog
|
||
:visible.sync="dialogVisibleusedstep"
|
||
|
||
>
|
||
<el-form
|
||
ref="Formusedstep"
|
||
:model="usedstep"
|
||
label-width="80px"
|
||
label-position="right"
|
||
>
|
||
|
||
|
||
<el-form-item label="子工序" prop="unit">
|
||
<el-select style="width: 100%" v-model="usedstep.step" placeholder="请选择">
|
||
<el-option
|
||
v-for="item in stepoptions"
|
||
:key="item.value"
|
||
:label="item.label"
|
||
:value="item.value">
|
||
</el-option>
|
||
</el-select>
|
||
</el-form-item>
|
||
|
||
<el-form-item label="备注" prop="remark">
|
||
<el-input v-model="usedstep.remark" placeholder="输入备注信息" />
|
||
</el-form-item>
|
||
|
||
</el-form>
|
||
<div style="text-align: right">
|
||
<el-button type="danger" @click="dialogVisibleusedstep = false">取消</el-button>
|
||
<el-button type="primary" @click="usedstepconfirm('Formusedstep')">确认</el-button>
|
||
</div>
|
||
</el-dialog>
|
||
</el-tab-pane>
|
||
|
||
<el-tab-pane label="技术文件">
|
||
<el-button type="primary" icon="el-icon-plus" @click="handletechdocCreate"
|
||
>新增</el-button>
|
||
<el-table
|
||
:data="techdoctableData"
|
||
border
|
||
fit
|
||
stripe
|
||
highlight-current-row
|
||
>
|
||
<el-table-column type="index" width="50" />
|
||
<el-table-column label="文件名称">
|
||
<template slot-scope="scope">{{ scope.row.name }}</template>
|
||
</el-table-column>
|
||
<el-table-column 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" v-if="scope.row.file_">
|
||
<el-link :href="scope.row.file_.path" >{{scope.row.file_.name}}</el-link>
|
||
</template>
|
||
</el-table-column>
|
||
<el-table-column
|
||
align="center"
|
||
label="操作"
|
||
width="220px"
|
||
>
|
||
<template slot-scope="scope">
|
||
|
||
|
||
<el-link
|
||
v-if="checkPermission(['process_update'])"
|
||
type="primary"
|
||
@click="handletechdocEdit(scope)"
|
||
>编辑</el-link
|
||
>
|
||
<el-link
|
||
v-if="checkPermission(['process_delete'])"
|
||
type="danger"
|
||
@click="handletechdocDelete(scope)"
|
||
>删除</el-link
|
||
>
|
||
</template>
|
||
</el-table-column>
|
||
</el-table>
|
||
<el-dialog
|
||
:visible.sync="dialogVisiblet"
|
||
:title="dialogTypet === 'edit' ? '编辑文件' : '新增文件'"
|
||
>
|
||
<el-form
|
||
ref="Formt"
|
||
:model="techdoc"
|
||
label-width="100px"
|
||
label-position="right"
|
||
|
||
>
|
||
<el-form-item label="文件名称" prop="name">
|
||
<el-input v-model="techdoc.name" placeholder="文件名称" />
|
||
</el-form-item>
|
||
|
||
|
||
<el-form-item label="内容" prop="content" style="height:350px">
|
||
<quill-editor ref="text" v-model="techdoc.content" style="height:250px" :options="editorOption" />
|
||
|
||
</el-form-item>
|
||
<el-form-item label="是否启用" prop="name">
|
||
<el-switch v-model="techdoc.enabled"></el-switch>
|
||
</el-form-item>
|
||
<el-form-item label="文件" prop="template" v-if="dialogVisiblet">
|
||
<el-upload
|
||
ref="upload"
|
||
:action="upUrl"
|
||
:on-preview="handlePreview"
|
||
:on-success="handleUpSuccess"
|
||
:on-remove="handleRemove"
|
||
:headers="upHeaders"
|
||
:file-list="fileList"
|
||
:limit="1"
|
||
accept=".doc,.docx,.xls,.xlsx,.ppt,.pptx"
|
||
>
|
||
<el-button size="small" type="primary">上传文件</el-button>
|
||
</el-upload>
|
||
</el-form-item>
|
||
|
||
</el-form>
|
||
<div style="text-align: right">
|
||
<el-button type="danger" @click="dialogVisiblet = false">取消</el-button>
|
||
<el-button type="primary" @click="techdocconfirm('Formt')">确认</el-button>
|
||
</div>
|
||
</el-dialog>
|
||
</el-tab-pane>
|
||
</el-tabs>
|
||
</el-col>
|
||
</el-row>
|
||
|
||
</div>
|
||
</template>
|
||
<script>
|
||
import { getMaterialList,getMaterial,getInputmaterialList,createInputmaterial,updateInputmaterial
|
||
,deleteInputmaterial,getOutputmaterialList,createOutputmaterial,updateOutputmaterial,deleteOutputmaterial,
|
||
getUsedstepList,createUsedstep,deleteUsedstep,getStepList,gettechdocList,createtechdoc,updatetechdoc,deletetechdoc
|
||
,getsubproducationList,createsubproducation,updatesubproducation,deletesubproducation,getProcessList ,
|
||
getOthermaterialList,createOthermaterial,deleteOthermaterial} from "@/api/mtm";
|
||
import { quillEditor } from 'vue-quill-editor'
|
||
import 'quill/dist/quill.core.css'
|
||
import 'quill/dist/quill.snow.css'
|
||
import 'quill/dist/quill.bubble.css'
|
||
|
||
import { upUrl, upHeaders } from "@/api/file";
|
||
import checkPermission from "@/utils/permission";
|
||
import { genTree } from "@/utils";
|
||
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
|
||
const defaultinputmaterial = {
|
||
|
||
};
|
||
const defaultoutputmaterial = {
|
||
|
||
};
|
||
const defaultother = {};
|
||
const defaultusedstep = {
|
||
|
||
};
|
||
const defaulttechdoc = {enabled:false};
|
||
const defaultsubproducation = {
|
||
|
||
};
|
||
|
||
export default {
|
||
components: { Pagination ,quillEditor},
|
||
|
||
data() {
|
||
return {
|
||
materialoptions:[],
|
||
subproducationData:"",
|
||
inputtableData:"",
|
||
editorOption: {} ,
|
||
processOptions:[],
|
||
is_main:false,
|
||
othermaterial:defaultother,
|
||
techdoc: defaulttechdoc,
|
||
subproducation:defaultsubproducation,
|
||
inputmaterial: defaultinputmaterial,
|
||
techdoctableData:"",
|
||
outputtableData:"",
|
||
othertableData:"",
|
||
outputmaterial: defaultoutputmaterial,
|
||
usedsteptableData:"",
|
||
usedstep: defaultusedstep,
|
||
materialList: {
|
||
count: 0,
|
||
},
|
||
upHeaders: upHeaders(),
|
||
upUrl: upUrl(),
|
||
fileList:[],
|
||
stepoptions:[],
|
||
processoptions:[],
|
||
listQuery: {
|
||
page: 1,
|
||
page_size: 20,
|
||
},
|
||
listQuerysubproducation: {
|
||
page: 0,
|
||
},
|
||
listQueryinput: {
|
||
page: 0,
|
||
},
|
||
listQueryoutput: {
|
||
page: 0,
|
||
},
|
||
listQueryusedstep: {
|
||
page: 0,
|
||
},
|
||
listQueryother: {
|
||
page: 0,
|
||
},
|
||
listQuerytechdoc:{
|
||
page: 0,
|
||
},
|
||
listQuerystep:{
|
||
page: 0,
|
||
},
|
||
values:7,
|
||
products:"",
|
||
dialogType: "new",
|
||
dialogVisible:false,
|
||
dialogTypesp: "new",
|
||
dialogVisiblesp:false,
|
||
dialogType1: "new",
|
||
dialogVisible1:false,
|
||
dialogTypeusedstep: "new",
|
||
dialogVisibleusedstep:false,
|
||
dialogTypet: "new",
|
||
dialogVisiblet:false,
|
||
dialogVisibleother:false,
|
||
dialogTypeother: "new",
|
||
listLoading: true,
|
||
|
||
};
|
||
},
|
||
computed: {},
|
||
watch: {},
|
||
created() {
|
||
this.getList();
|
||
|
||
|
||
},
|
||
methods: {
|
||
checkPermission,
|
||
//产品列表
|
||
getList() {
|
||
this.listLoading = true;
|
||
this.listQuery.type=1;
|
||
getMaterialList(this.listQuery).then((response) => {
|
||
if (response.data) {
|
||
this.materialList = response.data;
|
||
}
|
||
this.listLoading = false;
|
||
});
|
||
},
|
||
//物料
|
||
getmaterialList() {
|
||
this.listLoading = true;
|
||
getMaterialList({pageoff:true}).then((response) => {
|
||
if (response.data) {
|
||
this.materialoptions = response.data;
|
||
}
|
||
this.listLoading = false;
|
||
});
|
||
},
|
||
//工序清单
|
||
getProcessList() {
|
||
getProcessList().then((res) => {
|
||
this.processOptions = genTree(res.data.results);
|
||
});
|
||
},
|
||
//获取产品,工艺
|
||
getMaterial(){
|
||
getMaterial(this.product).then((response) => {
|
||
if (response.data) {
|
||
this.products = response.data;//产品信息
|
||
this.processoptions = response.data.processes_;//产品工艺
|
||
}
|
||
})
|
||
},
|
||
//点击对应的产品弹出信息
|
||
handleCurrentChange(row){
|
||
this.product=row.id;
|
||
this.getMaterial();
|
||
this.getProcessList();
|
||
this.getsubproducationList();
|
||
|
||
},
|
||
//点击产品分解弹出输入、输出物料,子工序,技术文件
|
||
handlespChange(row){
|
||
this.subproduction = row.id;
|
||
this.processes = row.process;
|
||
|
||
this.getInputmaterialLists();//输入物料
|
||
|
||
this.getOutputmaterialLists();//输出物料
|
||
this.getOthermaterialLists();//辅助工装
|
||
this.getstepList();//子工序
|
||
this. getUsedstepLists();//
|
||
this.gettechdocLists();//技术文件
|
||
},
|
||
|
||
|
||
//产品分解
|
||
getsubproducationList(){
|
||
|
||
this.listQuerysubproducation.product=this.product
|
||
getsubproducationList(this.listQuerysubproducation).then((response) => {
|
||
if (response.data) {
|
||
|
||
this.subproducationData = response.data;//产品信息
|
||
|
||
}
|
||
})
|
||
},
|
||
handlesubproducationCreate()
|
||
{
|
||
this.subproducation = Object.assign({}, defaultsubproducation);
|
||
this.dialogTypesp = "new";
|
||
this.dialogVisiblesp = true;
|
||
this.$nextTick(() => {
|
||
this.$refs["Formsp"].clearValidate();
|
||
});
|
||
},
|
||
handlesubproducationEdit(scope) {
|
||
this.subproducation = Object.assign({}, scope.row); // copy obj
|
||
this.dialogTypesp = "edit";
|
||
this.dialogVisiblesp = true;
|
||
this.$nextTick(() => {
|
||
this.$refs["Formsp"].clearValidate();
|
||
});
|
||
},
|
||
handlesubproducationDelete(scope) {
|
||
this.$confirm("确认删除?", "警告", {
|
||
confirmButtonText: "确认",
|
||
cancelButtonText: "取消",
|
||
type: "error",
|
||
})
|
||
.then(async () => {
|
||
await deletesubproducation(scope.row.id);
|
||
this.getsubproducationList()
|
||
this.$message.success("成功");
|
||
})
|
||
.catch((err) => {
|
||
console.error(err);
|
||
});
|
||
},
|
||
async subproducationfirm(form) {
|
||
this.$refs[form].validate((valid) => {
|
||
if (valid) {
|
||
const isEdit = this.dialogTypesp === "edit";
|
||
if (isEdit) {
|
||
this.subproducation.product=this.product;
|
||
updatesubproducation(this.subproducation.id, this.subproducation).then((res) => {
|
||
if (res.code >= 200) {
|
||
this.getsubproducationList()
|
||
this.dialogVisiblesp = false;
|
||
this.$message.success("成功");
|
||
}
|
||
});
|
||
} else {
|
||
this.subproducation.product=this.product;
|
||
createsubproducation(this.subproducation).then((res) => {
|
||
if (res.code >= 200) {
|
||
this.getsubproducationList()
|
||
this.dialogVisiblesp = false;
|
||
this.$message.success("成功");
|
||
}
|
||
});
|
||
}
|
||
} else {
|
||
return false;
|
||
}
|
||
});
|
||
},
|
||
|
||
//输入物料列表
|
||
|
||
getInputmaterialLists(){
|
||
|
||
this.listQueryinput.subproduction=this.subproduction;
|
||
getInputmaterialList(this.listQueryinput).then((response) => {
|
||
if (response.data) {
|
||
|
||
this.inputtableData = response.data;//产品信息
|
||
|
||
}
|
||
})
|
||
},
|
||
//输入物料
|
||
handleinputCreate() {
|
||
this.inputmaterial = Object.assign({}, defaultinputmaterial);
|
||
this.dialogType = "new";
|
||
this.dialogVisible = true;
|
||
this.$nextTick(() => {
|
||
this.$refs["Form"].clearValidate();
|
||
});
|
||
this.getmaterialList();//物料列表
|
||
},
|
||
handleinputEdit(scope) {
|
||
this.inputmaterial = Object.assign({}, scope.row); // copy obj
|
||
this.dialogType = "edit";
|
||
this.dialogVisible = true;
|
||
this.$nextTick(() => {
|
||
this.$refs["Form"].clearValidate();
|
||
});
|
||
},
|
||
handleinputDelete(scope) {
|
||
this.$confirm("确认删除?", "警告", {
|
||
confirmButtonText: "确认",
|
||
cancelButtonText: "取消",
|
||
type: "error",
|
||
})
|
||
.then(async () => {
|
||
await deleteInputmaterial(scope.row.id);
|
||
this.getInputmaterialLists()
|
||
this.$message.success("成功");
|
||
})
|
||
.catch((err) => {
|
||
console.error(err);
|
||
});
|
||
},
|
||
async inputconfirm(form) {
|
||
this.$refs[form].validate((valid) => {
|
||
if (valid) {
|
||
const isEdit = this.dialogType === "edit";
|
||
if (isEdit) {
|
||
this.inputmaterial.subproduction=this.subproduction;
|
||
updateInputmaterial(this.inputmaterial.id, this.inputmaterial).then((res) => {
|
||
if (res.code >= 200) {
|
||
this.getInputmaterialLists()
|
||
this.dialogVisible = false;
|
||
this.$message.success("成功");
|
||
}
|
||
});
|
||
} else {
|
||
this.inputmaterial.subproduction=this.subproduction;
|
||
createInputmaterial(this.inputmaterial).then((res) => {
|
||
if (res.code >= 200) {
|
||
this.getInputmaterialLists()
|
||
this.dialogVisible = false;
|
||
this.$message.success("成功");
|
||
}
|
||
});
|
||
}
|
||
} else {
|
||
return false;
|
||
}
|
||
});
|
||
},
|
||
|
||
|
||
|
||
|
||
//输出物料列表
|
||
|
||
getOutputmaterialLists(){
|
||
|
||
this.listQueryoutput.subproduction=this.subproduction;
|
||
// this.listQueryoutput.page=0;
|
||
getOutputmaterialList(this.listQueryoutput).then((response) => {
|
||
if (response.data) {
|
||
|
||
this.outputtableData = response.data;//产品信息
|
||
|
||
}
|
||
})
|
||
},
|
||
|
||
|
||
//输出物料
|
||
handleoutputCreate() {
|
||
this.outputmaterial = Object.assign({}, defaultoutputmaterial);
|
||
this.dialogType1 = "new";
|
||
this.dialogVisible1 = true;
|
||
this.$nextTick(() => {
|
||
this.$refs["Forms"].clearValidate();
|
||
});
|
||
this.getmaterialList();//物料列表
|
||
},
|
||
handleoutputEdit(scope) {
|
||
this.outputmaterial = Object.assign({}, scope.row); // copy obj
|
||
this.dialogType1 = "edit";
|
||
this.dialogVisible1 = true;
|
||
this.$nextTick(() => {
|
||
this.$refs["Forms"].clearValidate();
|
||
});
|
||
},
|
||
handleoutputDelete(scope) {
|
||
this.$confirm("确认删除?", "警告", {
|
||
confirmButtonText: "确认",
|
||
cancelButtonText: "取消",
|
||
type: "error",
|
||
})
|
||
.then(async () => {
|
||
await deleteOutputmaterial(scope.row.id);
|
||
this.getOutputmaterialLists()
|
||
this.$message.success("成功");
|
||
})
|
||
.catch((err) => {
|
||
console.error(err);
|
||
});
|
||
},
|
||
async outputconfirm(form) {
|
||
this.$refs[form].validate((valid) => {
|
||
if (valid) {
|
||
const isEdit = this.dialogType1 === "edit";
|
||
if (isEdit) {
|
||
this.outputmaterial.subproduction=this.subproduction;
|
||
updateOutputmaterial(this.outputmaterial.id, this.outputmaterial).then((res) => {
|
||
if (res.code >= 200) {
|
||
this.getOutputmaterialLists()
|
||
this.dialogVisible1 = false;
|
||
this.$message.success("成功");
|
||
}
|
||
});
|
||
} else {
|
||
this.outputmaterial.subproduction=this.subproduction;
|
||
console.log(this.outputmaterial);
|
||
createOutputmaterial(this.outputmaterial).then((res) => {
|
||
if (res.code >= 200) {
|
||
this.getOutputmaterialLists()
|
||
this.dialogVisible1 = false;
|
||
this.$message.success("成功");
|
||
}
|
||
});
|
||
}
|
||
} else {
|
||
return false;
|
||
}
|
||
});
|
||
},
|
||
|
||
//输入其他物料列表
|
||
|
||
getOthermaterialLists(){
|
||
|
||
this.listQueryother.subproduction=this.subproduction;
|
||
getOthermaterialList(this.listQueryother).then((response) => {
|
||
if (response.data) {
|
||
|
||
this.othertableData = response.data;//工装列表
|
||
|
||
}
|
||
})
|
||
},
|
||
//输入其他物料
|
||
handleotherCreate() {
|
||
this.othermaterial = Object.assign({}, defaultother);
|
||
this.dialogTypeother = "new";
|
||
this.dialogVisibleother = true;
|
||
this.$nextTick(() => {
|
||
this.$refs["Formother"].clearValidate();
|
||
});
|
||
this.getmaterialList();//物料列表
|
||
},
|
||
handleotherEdit(scope) {
|
||
this.othermaterial = Object.assign({}, scope.row); // copy obj
|
||
this.dialogTypeother = "edit";
|
||
this.dialogVisibleother = true;
|
||
this.$nextTick(() => {
|
||
this.$refs["Formother"].clearValidate();
|
||
});
|
||
},
|
||
handleotherDelete(scope) {
|
||
this.$confirm("确认删除?", "警告", {
|
||
confirmButtonText: "确认",
|
||
cancelButtonText: "取消",
|
||
type: "error",
|
||
})
|
||
.then(async () => {
|
||
await deleteOthermaterial(scope.row.id);
|
||
this.getOthermaterialLists()
|
||
this.$message.success("成功");
|
||
})
|
||
.catch((err) => {
|
||
console.error(err);
|
||
});
|
||
},
|
||
async otherconfirm(form) {
|
||
this.$refs[form].validate((valid) => {
|
||
if (valid) {
|
||
const isEdit = this.dialogTypeother === "edit";
|
||
if (isEdit) {
|
||
this.othermaterial.subproduction=this.subproduction;
|
||
updateOthermaterial(this.othermaterial.id, this.othermaterial).then((res) => {
|
||
if (res.code >= 200) {
|
||
this.getOthermaterialLists()
|
||
this.dialogVisibleother = false;
|
||
this.$message.success("成功");
|
||
}
|
||
});
|
||
} else {
|
||
this.othermaterial.subproduction=this.subproduction;
|
||
createOthermaterial(this.othermaterial).then((res) => {
|
||
if (res.code >= 200) {
|
||
this.getOthermaterialLists()
|
||
this.dialogVisibleother = false;
|
||
this.$message.success("成功");
|
||
}
|
||
});
|
||
}
|
||
} else {
|
||
return false;
|
||
}
|
||
});
|
||
},
|
||
|
||
|
||
|
||
//子工序列表
|
||
|
||
getUsedstepLists(){
|
||
|
||
this.listQueryusedstep.subproduction=this.subproduction;
|
||
// this.listQueryusedstep.page=0;
|
||
getUsedstepList(this.listQueryusedstep).then((response) => {
|
||
if (response.data) {
|
||
|
||
this.usedsteptableData = response.data;//产品信息
|
||
|
||
}
|
||
})
|
||
},
|
||
|
||
getstepList() {
|
||
this.listQuerystep.process=this.processes;
|
||
getStepList(this.listQuerystep).then((response) => {
|
||
if (response.data) {
|
||
this.stepoptions = genTree(response.data);
|
||
}
|
||
|
||
});
|
||
},
|
||
|
||
handlesearch(scope) {
|
||
|
||
this.$router.push({name: "Step", params: { id: scope.row.step_.id }, })
|
||
|
||
},
|
||
|
||
//子工序列表
|
||
handleusedstepCreate(){
|
||
this.usedstep = Object.assign({}, defaultusedstep);
|
||
this.dialogTypeusedstep = "new";
|
||
this.dialogVisibleusedstep = true;
|
||
this.$nextTick(() => {
|
||
this.$refs["Formusedstep"].clearValidate();
|
||
});
|
||
},
|
||
|
||
|
||
handleusedstepEdit(scope) {
|
||
this.outputmaterial = Object.assign({}, scope.row); // copy obj
|
||
this.dialogType1 = "edit";
|
||
this.dialogVisible1 = true;
|
||
this.$nextTick(() => {
|
||
this.$refs["Forms"].clearValidate();
|
||
});
|
||
},
|
||
handleusedstepDelete(scope) {
|
||
this.$confirm("确认删除?", "警告", {
|
||
confirmButtonText: "确认",
|
||
cancelButtonText: "取消",
|
||
type: "error",
|
||
})
|
||
.then(async () => {
|
||
await deleteUsedstep(scope.row.id);
|
||
this.getUsedstepLists()
|
||
this.$message.success("成功");
|
||
})
|
||
.catch((err) => {
|
||
console.error(err);
|
||
});
|
||
},
|
||
async usedstepconfirm(form) {
|
||
|
||
this.usedstep.subproduction=this.subproduction;
|
||
console.log(this.usedstep);
|
||
createUsedstep(this.usedstep).then((res) => {
|
||
if (res.code >= 200) {
|
||
this.getUsedstepLists();
|
||
this.getMaterial();
|
||
this.dialogVisibleusedstep = false;
|
||
this.$message.success("成功");
|
||
}
|
||
});
|
||
},
|
||
//技术文件
|
||
gettechdocLists(){
|
||
this.listQuerytechdoc.subproduction=this.subproduction;
|
||
// this.listQuerytechdoc.page=0;
|
||
gettechdocList(this.listQuerytechdoc).then((response) => {
|
||
if (response.data) {
|
||
|
||
this.techdoctableData = response.data;//技术文件
|
||
|
||
}
|
||
})
|
||
},
|
||
handletechdocCreate(){
|
||
this.techdoc = Object.assign({}, defaulttechdoc);
|
||
this.dialogTypet = "new";
|
||
this.dialogVisiblet = true;
|
||
this.fileList=[];
|
||
this.$nextTick(() => {
|
||
this.$refs["Formt"].clearValidate();
|
||
});
|
||
},
|
||
handlePreview(file) {
|
||
if ("url" in file) {
|
||
window.open(file.url);
|
||
} else {
|
||
window.open(file.response.data.path);
|
||
}
|
||
},
|
||
handleUpSuccess(res, file, filelist) {
|
||
this.techdoc.file = res.data.id;
|
||
},
|
||
handleRemove(file, filelist){
|
||
this.techdoc.file = null;
|
||
},
|
||
|
||
handletechdocEdit(scope) {
|
||
this.techdoc = Object.assign({}, scope.row); // copy obj
|
||
this.dialogTypet = "edit";
|
||
this.dialogVisiblet = true;
|
||
if (this.techdoc.file) {
|
||
this.fileList = [
|
||
{
|
||
name:this.techdoc.file_.name,
|
||
url: this.techdoc.file_.path,
|
||
},
|
||
];
|
||
}
|
||
this.$nextTick(() => {
|
||
this.$refs["Formt"].clearValidate();
|
||
});
|
||
},
|
||
handletechdocDelete(scope) {
|
||
this.$confirm("确认删除?", "警告", {
|
||
confirmButtonText: "确认",
|
||
cancelButtonText: "取消",
|
||
type: "error",
|
||
})
|
||
.then(async () => {
|
||
await deletetechdoc(scope.row.id);
|
||
this.gettechdocLists();
|
||
this.$message.success("成功");
|
||
})
|
||
.catch((err) => {
|
||
console.error(err);
|
||
});
|
||
},
|
||
|
||
async techdocconfirm(form) {
|
||
this.$refs[form].validate((valid) => {
|
||
if (valid) {
|
||
const isEdit = this.dialogTypet === "edit";
|
||
|
||
if (isEdit) {
|
||
updatetechdoc(this.techdoc.id, this.techdoc).then((res) => {
|
||
if (res.code >= 200) {
|
||
this.gettechdocLists();
|
||
this.dialogVisiblet = false;
|
||
this.$message.success("成功");
|
||
}
|
||
});
|
||
} else {
|
||
this.techdoc.subproduction=this.subproduction;
|
||
createtechdoc(this.techdoc).then((res) => {
|
||
if (res.code >= 200) {
|
||
this.gettechdocLists();
|
||
this.dialogVisiblet = false;
|
||
this.$message.success("成功");
|
||
}
|
||
});
|
||
}
|
||
} else {
|
||
return false;
|
||
}
|
||
});
|
||
},
|
||
},
|
||
};
|
||
</script>
|
||
|