|
@@ -14,31 +14,32 @@
|
|
|
<el-switch v-model="queryParams.self"></el-switch>
|
|
<el-switch v-model="queryParams.self"></el-switch>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
<el-form-item label="月/周数据" prop="monthOrWeek">
|
|
<el-form-item label="月/周数据" prop="monthOrWeek">
|
|
|
- <el-radio-group v-model="queryParams.monthOrWeek">
|
|
|
|
|
|
|
+ <el-radio-group v-model="queryParams.monthOrWeek" @change="getList">
|
|
|
<el-radio-button label="1">月</el-radio-button>
|
|
<el-radio-button label="1">月</el-radio-button>
|
|
|
<el-radio-button label="2">周</el-radio-button>
|
|
<el-radio-button label="2">周</el-radio-button>
|
|
|
</el-radio-group>
|
|
</el-radio-group>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
-
|
|
|
|
|
- <el-form-item label="周期" prop="recordDate" v-if="queryParams.monthOrWeek==='1'">
|
|
|
|
|
- <el-date-picker
|
|
|
|
|
- v-model="queryParams.recordDate"
|
|
|
|
|
- type="month"
|
|
|
|
|
- value-format="yyyy-MM"
|
|
|
|
|
- placeholder="选择月份"
|
|
|
|
|
- @change="handleQuery"
|
|
|
|
|
- clearable>
|
|
|
|
|
- </el-date-picker>
|
|
|
|
|
- </el-form-item>
|
|
|
|
|
- <el-form-item label="周期" prop="recordDate" v-if="queryParams.monthOrWeek==='2'">
|
|
|
|
|
- <el-date-picker
|
|
|
|
|
- v-model="queryParams.recordDate"
|
|
|
|
|
- type="week"
|
|
|
|
|
- format="yyyy 第 WW 周"
|
|
|
|
|
- placeholder="选择周"
|
|
|
|
|
- @change="handleQuery"
|
|
|
|
|
- clearable>
|
|
|
|
|
- </el-date-picker>
|
|
|
|
|
|
|
+ <el-form-item label="周期" prop="recordDate">
|
|
|
|
|
+ <div v-if="queryParams.monthOrWeek==='1'">
|
|
|
|
|
+ <el-date-picker
|
|
|
|
|
+ v-model="queryParams.date"
|
|
|
|
|
+ type="month"
|
|
|
|
|
+ value-format="yyyy-MM"
|
|
|
|
|
+ placeholder="选择月份"
|
|
|
|
|
+ @change="handleQuery"
|
|
|
|
|
+ clearable>
|
|
|
|
|
+ </el-date-picker>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div v-if="queryParams.monthOrWeek==='2'">
|
|
|
|
|
+ <el-date-picker
|
|
|
|
|
+ v-model="queryParams.date"
|
|
|
|
|
+ type="week"
|
|
|
|
|
+ format="yyyy 第 WW 周"
|
|
|
|
|
+ placeholder="选择周"
|
|
|
|
|
+ @change="handleQuery"
|
|
|
|
|
+ clearable>
|
|
|
|
|
+ </el-date-picker>
|
|
|
|
|
+ </div>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
|
|
|
|
|
<el-form-item>
|
|
<el-form-item>
|
|
@@ -48,7 +49,7 @@
|
|
|
</el-form>
|
|
</el-form>
|
|
|
|
|
|
|
|
<el-row :gutter="10" style="margin-bottom: 8px">
|
|
<el-row :gutter="10" style="margin-bottom: 8px">
|
|
|
- <el-col :span="1.5">
|
|
|
|
|
|
|
+ <el-col :span="1.5" v-if="queryParams.monthOrWeek==='1'">
|
|
|
<el-button
|
|
<el-button
|
|
|
type="primary"
|
|
type="primary"
|
|
|
plain
|
|
plain
|
|
@@ -59,6 +60,18 @@
|
|
|
>新增
|
|
>新增
|
|
|
</el-button>
|
|
</el-button>
|
|
|
</el-col>
|
|
</el-col>
|
|
|
|
|
+ <el-col :span="1.5" v-if="queryParams.monthOrWeek==='1'">
|
|
|
|
|
+ <el-button
|
|
|
|
|
+ type="primary"
|
|
|
|
|
+ plain
|
|
|
|
|
+ icon="el-icon-plus"
|
|
|
|
|
+ size="mini"
|
|
|
|
|
+ :disabled="addList.length===0"
|
|
|
|
|
+ @click="handleSplit"
|
|
|
|
|
+ v-hasPermi="['material:receive:add']"
|
|
|
|
|
+ >周数据
|
|
|
|
|
+ </el-button>
|
|
|
|
|
+ </el-col>
|
|
|
<el-col :span="1.5">
|
|
<el-col :span="1.5">
|
|
|
<el-button
|
|
<el-button
|
|
|
plain
|
|
plain
|
|
@@ -70,37 +83,30 @@
|
|
|
</el-button>
|
|
</el-button>
|
|
|
</el-col>
|
|
</el-col>
|
|
|
</el-row>
|
|
</el-row>
|
|
|
-
|
|
|
|
|
<el-table :data="materialList"
|
|
<el-table :data="materialList"
|
|
|
- border
|
|
|
|
|
|
|
+ ref="materialList"
|
|
|
stripe
|
|
stripe
|
|
|
- size="mini">
|
|
|
|
|
- <el-table-column label="编号" prop="id" width="100"/>
|
|
|
|
|
|
|
+ border
|
|
|
|
|
+ size="mini"
|
|
|
|
|
+ @selection-change="handleSelectionChange">
|
|
|
|
|
+ <el-table-column type="selection" width="40" v-if="queryParams.monthOrWeek==='1'"/>
|
|
|
|
|
+ <el-table-column label="编号" prop="id" width="80"/>
|
|
|
<el-table-column label="物料名称" prop="materialName" :show-overflow-tooltip="true"/>
|
|
<el-table-column label="物料名称" prop="materialName" :show-overflow-tooltip="true"/>
|
|
|
<el-table-column label="规格" prop="specification" :show-overflow-tooltip="true"/>
|
|
<el-table-column label="规格" prop="specification" :show-overflow-tooltip="true"/>
|
|
|
<el-table-column label="品牌/货号" prop="articleNo" :show-overflow-tooltip="true"/>
|
|
<el-table-column label="品牌/货号" prop="articleNo" :show-overflow-tooltip="true"/>
|
|
|
<el-table-column label="厂商" prop="factory"/>
|
|
<el-table-column label="厂商" prop="factory"/>
|
|
|
- <el-table-column label="单位" prop="unit" width="80"/>
|
|
|
|
|
- <el-table-column label="领取量" prop="num" width="80"/>
|
|
|
|
|
- <el-table-column label="物料类型" width="80">
|
|
|
|
|
|
|
+ <el-table-column label="领取量" prop="num" mini-width="80"/>
|
|
|
|
|
+ <el-table-column label="单位" prop="unit" mini-width="80"/>
|
|
|
|
|
+ <el-table-column label="物料类型" mini-width="80">
|
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
|
<el-tag v-if="scope.row.materialType==='1'" type="warning" size="mini">生产</el-tag>
|
|
<el-tag v-if="scope.row.materialType==='1'" type="warning" size="mini">生产</el-tag>
|
|
|
<el-tag v-else type="info" size="mini">非生产</el-tag>
|
|
<el-tag v-else type="info" size="mini">非生产</el-tag>
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
- <el-table-column label="领用人" prop="receiveUserName" width="80"/>
|
|
|
|
|
- <el-table-column label="周期" prop="recordDate" width="155"/>
|
|
|
|
|
- <el-table-column label="操作" align="center" width="180">
|
|
|
|
|
|
|
+ <el-table-column label="领用人" prop="receiveUserName" width="100"/>
|
|
|
|
|
+ <el-table-column label="周期" prop="recordDate" :width="queryParams.monthOrWeek==='1'?100:160"/>
|
|
|
|
|
+ <el-table-column label="操作" align="center" width="130">
|
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
|
- <el-button
|
|
|
|
|
- size="mini"
|
|
|
|
|
- type="text"
|
|
|
|
|
- icon="el-icon-edit"
|
|
|
|
|
- @click="handleSplit(scope.row)"
|
|
|
|
|
- v-if="scope.row.monthOrWeek==='1'"
|
|
|
|
|
- v-hasPermi="['material:receive:add']"
|
|
|
|
|
- >周数据
|
|
|
|
|
- </el-button>
|
|
|
|
|
<el-button
|
|
<el-button
|
|
|
size="mini"
|
|
size="mini"
|
|
|
type="text"
|
|
type="text"
|
|
@@ -121,7 +127,6 @@
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
</el-table>
|
|
</el-table>
|
|
|
-
|
|
|
|
|
<div style="margin-top: 10px;text-align: center">
|
|
<div style="margin-top: 10px;text-align: center">
|
|
|
<el-pagination
|
|
<el-pagination
|
|
|
background
|
|
background
|
|
@@ -135,62 +140,161 @@
|
|
|
</el-pagination>
|
|
</el-pagination>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
- <!-- 添加或修改物料配置对话框 -->
|
|
|
|
|
- <el-dialog :title="title" :visible.sync="open" @close="dialogClose" width="500px" append-to-body
|
|
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 添加物料配置对话框 -->
|
|
|
|
|
+ <el-dialog :title="title" :visible.sync="open" @close="dialogClose" width="80%" append-to-body
|
|
|
:close-on-click-modal="false">
|
|
:close-on-click-modal="false">
|
|
|
- <el-form ref="form" :model="form" :rules="rules" size="mini" label-width="100px">
|
|
|
|
|
- <el-form-item label="数据周期" prop="recordDate">
|
|
|
|
|
- <div v-if="form.monthOrWeek==='1'">
|
|
|
|
|
- <el-date-picker
|
|
|
|
|
- v-model="form.recordDate"
|
|
|
|
|
- type="month"
|
|
|
|
|
- value-format="yyyy-MM"
|
|
|
|
|
- placeholder="选择月份"
|
|
|
|
|
- :picker-options="getPickerOptions('month')"
|
|
|
|
|
- clearable>
|
|
|
|
|
- </el-date-picker>
|
|
|
|
|
- </div>
|
|
|
|
|
- <div v-else>
|
|
|
|
|
- <el-date-picker
|
|
|
|
|
- v-model="form.recordDate"
|
|
|
|
|
- type="week"
|
|
|
|
|
- format="yyyy 第 WW 周"
|
|
|
|
|
- placeholder="选择周"
|
|
|
|
|
- :picker-options="getPickerOptions('week')"
|
|
|
|
|
- clearable>
|
|
|
|
|
- </el-date-picker>
|
|
|
|
|
- </div>
|
|
|
|
|
- </el-form-item>
|
|
|
|
|
|
|
+ <el-form ref="addForm" :model="addForm" :rules="rules" size="mini" inline>
|
|
|
|
|
+ <el-row>
|
|
|
|
|
+ <el-col :span="22">
|
|
|
|
|
+ <el-form-item label="数据周期">
|
|
|
|
|
+ <div v-if="addForm.monthOrWeek==='1'">
|
|
|
|
|
+ <el-date-picker
|
|
|
|
|
+ v-model="addForm.date"
|
|
|
|
|
+ type="month"
|
|
|
|
|
+ value-format="yyyy-MM"
|
|
|
|
|
+ placeholder="选择月份"
|
|
|
|
|
+ :picker-options="getPickerOptions('month')"
|
|
|
|
|
+ clearable>
|
|
|
|
|
+ </el-date-picker>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div v-else>
|
|
|
|
|
+ <el-date-picker
|
|
|
|
|
+ v-model="addForm.date"
|
|
|
|
|
+ type="week"
|
|
|
|
|
+ format="yyyy 第 WW 周"
|
|
|
|
|
+ placeholder="选择周"
|
|
|
|
|
+ :picker-options="getPickerOptions('week')"
|
|
|
|
|
+ clearable>
|
|
|
|
|
+ </el-date-picker>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </el-col>
|
|
|
|
|
+ <el-col :span="2">
|
|
|
|
|
+ <el-form-item>
|
|
|
|
|
+ <el-button icon="el-icon-plus" @click="addRow">添加</el-button>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </el-col>
|
|
|
|
|
+ </el-row>
|
|
|
|
|
+ </el-form>
|
|
|
|
|
+ <el-table :data="addList" class="add-table" border size="mini">
|
|
|
|
|
+ <el-table-column label="物料名称" prop="materialName">
|
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
|
+ <el-input v-model="scope.row.materialName" size="mini" placeholder="请输入物料名称"
|
|
|
|
|
+ :disabled="addForm.monthOrWeek==='2'"/>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ <el-table-column label="规格" prop="specification">
|
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
|
+ <el-input v-model="scope.row.specification" size="mini" placeholder="请输入物料规格"
|
|
|
|
|
+ :disabled="addForm.monthOrWeek==='2'"/>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ <el-table-column label="品牌/货号" prop="articleNo">
|
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
|
+ <el-input v-model="scope.row.articleNo" size="mini" placeholder="请输入品牌/货号"
|
|
|
|
|
+ :disabled="addForm.monthOrWeek==='2'"/>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ <el-table-column label="厂商" prop="factory">
|
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
|
+ <el-input v-model="scope.row.factory" size="mini" placeholder="请输入厂商"
|
|
|
|
|
+ :disabled="addForm.monthOrWeek==='2'"/>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ <el-table-column label="单位" prop="unit" width="120px">
|
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
|
+ <el-input v-model="scope.row.unit" size="mini" placeholder="请输入单位" :disabled="addForm.monthOrWeek==='2'"
|
|
|
|
|
+ style="width: 100%"/>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ <el-table-column label="价格" prop="price" width="120px">
|
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
|
+ <el-input v-model="scope.row.price" size="mini" placeholder="请输入单价" :disabled="addForm.monthOrWeek==='2'"
|
|
|
|
|
+ style="width: 100%"/>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ <el-table-column label="领取量" prop="num" width="100px">
|
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
|
+ <el-input-number v-model="scope.row.num" size="mini" controls-position="right" :min="0"
|
|
|
|
|
+ placeholder="请输入领取量" style="width: 100%"/>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ <el-table-column label="物料类型" prop="materialType" width="100px">
|
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
|
+ <el-select v-model="scope.row.materialType" size="mini" :disabled="addForm.monthOrWeek==='2'"
|
|
|
|
|
+ style="width: 100%">
|
|
|
|
|
+ <el-option label="生产" value="1"></el-option>
|
|
|
|
|
+ <el-option label="非生产" value="2"></el-option>
|
|
|
|
|
+ </el-select>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ <el-table-column label="用于项目" prop="projectId" width="120px">
|
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
|
+ <el-select v-model="scope.row.projectId" size="mini" :disabled="addForm.monthOrWeek==='2'"
|
|
|
|
|
+ style="width: 100%">
|
|
|
|
|
+ <el-option label="项目1" value="1"></el-option>
|
|
|
|
|
+ <el-option label="项目2" value="2"></el-option>
|
|
|
|
|
+ <el-option label="其他" value="0"></el-option>
|
|
|
|
|
+ </el-select>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ <el-table-column label="备注">
|
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
|
+ <el-input v-model="scope.row.remark" size="mini" type="textarea" autosize/>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ <el-table-column width="50">
|
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
|
+ <el-button
|
|
|
|
|
+ size="mini"
|
|
|
|
|
+ icon="el-icon-delete"
|
|
|
|
|
+ @click="deleteRow(scope.row)"
|
|
|
|
|
+ >
|
|
|
|
|
+ </el-button>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ </el-table>
|
|
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
|
|
+ <el-button type="primary" @click="submitForm" size="mini">确 定</el-button>
|
|
|
|
|
+ <el-button @click="cancel" size="mini">取 消</el-button>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </el-dialog>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 修改物料配置对话框 -->
|
|
|
|
|
+ <el-dialog title="修改" :visible.sync="editOpen" @close="dialogClose" width="500px" append-to-body
|
|
|
|
|
+ :close-on-click-modal="false">
|
|
|
|
|
+ <el-form ref="editForm" :model="editForm" :rules="rules" size="mini" label-width="100px">
|
|
|
<el-form-item label="物料名称" prop="materialName">
|
|
<el-form-item label="物料名称" prop="materialName">
|
|
|
- <el-input v-model="form.materialName" placeholder="请输入物料名称" :disabled="form.monthOrWeek==='2'"/>
|
|
|
|
|
|
|
+ <el-input v-model="editForm.materialName" placeholder="请输入物料名称" :disabled="editForm.monthOrWeek==='2'"/>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
<el-form-item label="物料规格" prop="specification">
|
|
<el-form-item label="物料规格" prop="specification">
|
|
|
- <el-input v-model="form.specification" placeholder="请输入物料规格" :disabled="form.monthOrWeek==='2'"/>
|
|
|
|
|
|
|
+ <el-input v-model="editForm.specification" placeholder="请输入物料规格" :disabled="editForm.monthOrWeek==='2'"/>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
<el-form-item label="品牌/货号" prop="articleNo">
|
|
<el-form-item label="品牌/货号" prop="articleNo">
|
|
|
- <el-input v-model="form.articleNo" placeholder="请输入品牌/货号" :disabled="form.monthOrWeek==='2'"/>
|
|
|
|
|
|
|
+ <el-input v-model="editForm.articleNo" placeholder="请输入品牌/货号" :disabled="editForm.monthOrWeek==='2'"/>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
<el-form-item label="厂商" prop="factory">
|
|
<el-form-item label="厂商" prop="factory">
|
|
|
- <el-input v-model="form.factory" placeholder="请输入厂商" :disabled="form.monthOrWeek==='2'"/>
|
|
|
|
|
|
|
+ <el-input v-model="editForm.factory" placeholder="请输入厂商" :disabled="editForm.monthOrWeek==='2'"/>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
<el-form-item label="单位" prop="unit">
|
|
<el-form-item label="单位" prop="unit">
|
|
|
- <el-input v-model="form.unit" placeholder="请输入单位" :disabled="form.monthOrWeek==='2'"/>
|
|
|
|
|
|
|
+ <el-input v-model="editForm.unit" placeholder="请输入单位" :disabled="editForm.monthOrWeek==='2'"/>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
<el-form-item label="领取量" prop="num">
|
|
<el-form-item label="领取量" prop="num">
|
|
|
- <el-input-number v-model="form.num" controls-position="right" :min="0" placeholder="请输入领取量"/>
|
|
|
|
|
|
|
+ <el-input-number v-model="editForm.num" controls-position="right" :min="0" placeholder="请输入领取量"/>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
<el-form-item label="物料类型" prop="materialType">
|
|
<el-form-item label="物料类型" prop="materialType">
|
|
|
- <el-radio-group v-model="form.materialType" :disabled="form.monthOrWeek==='2'">
|
|
|
|
|
|
|
+ <el-radio-group v-model="editForm.materialType" :disabled="editForm.monthOrWeek==='2'">
|
|
|
<el-radio label="1">生产</el-radio>
|
|
<el-radio label="1">生产</el-radio>
|
|
|
<el-radio label="2">非生产</el-radio>
|
|
<el-radio label="2">非生产</el-radio>
|
|
|
</el-radio-group>
|
|
</el-radio-group>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
<el-form-item label="备注">
|
|
<el-form-item label="备注">
|
|
|
- <el-input v-model="form.remark" type="textarea"/>
|
|
|
|
|
|
|
+ <el-input v-model="editForm.remark" type="textarea"/>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</el-form>
|
|
</el-form>
|
|
|
<div slot="footer" class="dialog-footer">
|
|
<div slot="footer" class="dialog-footer">
|
|
|
- <el-button type="primary" @click="submitForm">确 定</el-button>
|
|
|
|
|
|
|
+ <el-button type="primary" @click="submitEditForm">确 定</el-button>
|
|
|
<el-button @click="cancel">取 消</el-button>
|
|
<el-button @click="cancel">取 消</el-button>
|
|
|
</div>
|
|
</div>
|
|
|
</el-dialog>
|
|
</el-dialog>
|
|
@@ -228,17 +332,33 @@ export default {
|
|
|
materialName: undefined,
|
|
materialName: undefined,
|
|
|
factory: undefined,
|
|
factory: undefined,
|
|
|
self: false,
|
|
self: false,
|
|
|
- monthOrWeek: undefined,
|
|
|
|
|
- recordDate: undefined
|
|
|
|
|
|
|
+ monthOrWeek: "1",
|
|
|
|
|
+ date: undefined
|
|
|
},
|
|
},
|
|
|
// 表单参数
|
|
// 表单参数
|
|
|
- form: {},
|
|
|
|
|
|
|
+ addForm: {
|
|
|
|
|
+ date: undefined,
|
|
|
|
|
+ monthOrWeek: undefined,
|
|
|
|
|
+ },
|
|
|
|
|
+ addList: [],
|
|
|
|
|
+
|
|
|
|
|
+ editOpen: false,
|
|
|
|
|
+ editForm: {
|
|
|
|
|
+ id: undefined,
|
|
|
|
|
+ parentId: undefined,
|
|
|
|
|
+ materialName: undefined,
|
|
|
|
|
+ specification: undefined,
|
|
|
|
|
+ articleNo: undefined,
|
|
|
|
|
+ factory: undefined,
|
|
|
|
|
+ unit: undefined,
|
|
|
|
|
+ num: 0,
|
|
|
|
|
+ materialType: undefined,
|
|
|
|
|
+ monthOrWeek: undefined,
|
|
|
|
|
+ remark: undefined
|
|
|
|
|
+ },
|
|
|
|
|
|
|
|
// 表单校验
|
|
// 表单校验
|
|
|
rules: {
|
|
rules: {
|
|
|
- recordDate: [
|
|
|
|
|
- {required: true, message: "数据周期不能为空", trigger: "change"}
|
|
|
|
|
- ],
|
|
|
|
|
materialName: [
|
|
materialName: [
|
|
|
{required: true, message: "物料名称不能为空", trigger: "blur"}
|
|
{required: true, message: "物料名称不能为空", trigger: "blur"}
|
|
|
],
|
|
],
|
|
@@ -259,6 +379,9 @@ export default {
|
|
|
],
|
|
],
|
|
|
materialType: [
|
|
materialType: [
|
|
|
{required: true, message: "物料类型不能为空", trigger: "change"}
|
|
{required: true, message: "物料类型不能为空", trigger: "change"}
|
|
|
|
|
+ ],
|
|
|
|
|
+ monthOrWeek: [
|
|
|
|
|
+ {required: true, message: "月/周数据不能为空", trigger: "change"}
|
|
|
]
|
|
]
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
@@ -277,28 +400,38 @@ export default {
|
|
|
// 取消按钮
|
|
// 取消按钮
|
|
|
cancel() {
|
|
cancel() {
|
|
|
this.open = false;
|
|
this.open = false;
|
|
|
|
|
+ this.editOpen = false;
|
|
|
this.reset();
|
|
this.reset();
|
|
|
},
|
|
},
|
|
|
// 对话框关闭回调
|
|
// 对话框关闭回调
|
|
|
dialogClose() {
|
|
dialogClose() {
|
|
|
this.open = false;
|
|
this.open = false;
|
|
|
|
|
+ this.editOpen = false;
|
|
|
this.reset();
|
|
this.reset();
|
|
|
},
|
|
},
|
|
|
// 表单重置
|
|
// 表单重置
|
|
|
reset() {
|
|
reset() {
|
|
|
- this.form = {
|
|
|
|
|
|
|
+ this.addForm = {
|
|
|
|
|
+ date: undefined,
|
|
|
|
|
+ monthOrWeek: undefined,
|
|
|
|
|
+ };
|
|
|
|
|
+ this.addList = []
|
|
|
|
|
+ this.$refs.materialList.clearSelection();
|
|
|
|
|
+ this.resetForm("addForm");
|
|
|
|
|
+ this.editForm = {
|
|
|
id: undefined,
|
|
id: undefined,
|
|
|
|
|
+ parentId: undefined,
|
|
|
materialName: undefined,
|
|
materialName: undefined,
|
|
|
specification: undefined,
|
|
specification: undefined,
|
|
|
articleNo: undefined,
|
|
articleNo: undefined,
|
|
|
factory: undefined,
|
|
factory: undefined,
|
|
|
unit: undefined,
|
|
unit: undefined,
|
|
|
- num: undefined,
|
|
|
|
|
|
|
+ num: 0,
|
|
|
materialType: undefined,
|
|
materialType: undefined,
|
|
|
monthOrWeek: undefined,
|
|
monthOrWeek: undefined,
|
|
|
remark: undefined
|
|
remark: undefined
|
|
|
- };
|
|
|
|
|
- this.resetForm("form");
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+ this.resetForm("editForm");
|
|
|
},
|
|
},
|
|
|
/** 搜索按钮操作 */
|
|
/** 搜索按钮操作 */
|
|
|
handleQuery() {
|
|
handleQuery() {
|
|
@@ -311,6 +444,16 @@ export default {
|
|
|
this.$refs.queryForm.resetFields();
|
|
this.$refs.queryForm.resetFields();
|
|
|
this.handleQuery();
|
|
this.handleQuery();
|
|
|
},
|
|
},
|
|
|
|
|
+ handleSelectionChange(val) {
|
|
|
|
|
+ let temp = _.cloneDeep(val)
|
|
|
|
|
+ this.addList = temp.map(item => {
|
|
|
|
|
+ item.parentId = item.id
|
|
|
|
|
+ item.num = undefined
|
|
|
|
|
+ item.id = undefined
|
|
|
|
|
+ return item
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
handleSizeChange(val) {
|
|
handleSizeChange(val) {
|
|
|
this.pageSize = val;
|
|
this.pageSize = val;
|
|
|
this.getList();
|
|
this.getList();
|
|
@@ -326,7 +469,7 @@ export default {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
if (type === 'week') {
|
|
if (type === 'week') {
|
|
|
- let time1 = DateUtil.unix(this.form.recordDate) * 1000
|
|
|
|
|
|
|
+ let time1 = DateUtil.unix(this.addForm.date) * 1000
|
|
|
let time2 = DateUtil.unix(DateUtil.afterWeek()) * 1000
|
|
let time2 = DateUtil.unix(DateUtil.afterWeek()) * 1000
|
|
|
let limitTime = time1 > time2 ? time1 : time2;
|
|
let limitTime = time1 > time2 ? time1 : time2;
|
|
|
return {
|
|
return {
|
|
@@ -353,54 +496,104 @@ export default {
|
|
|
/** 新增按钮操作 */
|
|
/** 新增按钮操作 */
|
|
|
handleAdd() {
|
|
handleAdd() {
|
|
|
this.reset();
|
|
this.reset();
|
|
|
- this.form.monthOrWeek = '1'
|
|
|
|
|
|
|
+ this.addForm.monthOrWeek = '1'
|
|
|
this.title = "添加月物料计划";
|
|
this.title = "添加月物料计划";
|
|
|
|
|
+ this.addList.push({
|
|
|
|
|
+ id: undefined,
|
|
|
|
|
+ materialName: undefined,
|
|
|
|
|
+ specification: undefined,
|
|
|
|
|
+ articleNo: undefined,
|
|
|
|
|
+ factory: undefined,
|
|
|
|
|
+ unit: undefined,
|
|
|
|
|
+ num: 0,
|
|
|
|
|
+ materialType: undefined,
|
|
|
|
|
+ monthOrWeek: '1',
|
|
|
|
|
+ remark: undefined
|
|
|
|
|
+ })
|
|
|
this.open = true;
|
|
this.open = true;
|
|
|
},
|
|
},
|
|
|
|
|
+ addRow() {
|
|
|
|
|
+ this.addList.push({
|
|
|
|
|
+ id: undefined,
|
|
|
|
|
+ materialName: undefined,
|
|
|
|
|
+ specification: undefined,
|
|
|
|
|
+ articleNo: undefined,
|
|
|
|
|
+ factory: undefined,
|
|
|
|
|
+ unit: undefined,
|
|
|
|
|
+ num: 0,
|
|
|
|
|
+ price: 0,
|
|
|
|
|
+ projectId: undefined,
|
|
|
|
|
+ materialType: undefined,
|
|
|
|
|
+ monthOrWeek: '1',
|
|
|
|
|
+ remark: undefined
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
|
|
+ deleteRow(row) {
|
|
|
|
|
+ if (this.addList.length === 1) {
|
|
|
|
|
+ this.addList = [
|
|
|
|
|
+ {
|
|
|
|
|
+ id: undefined,
|
|
|
|
|
+ materialName: undefined,
|
|
|
|
|
+ specification: undefined,
|
|
|
|
|
+ articleNo: undefined,
|
|
|
|
|
+ factory: undefined,
|
|
|
|
|
+ unit: undefined,
|
|
|
|
|
+ num: 0,
|
|
|
|
|
+ materialType: undefined,
|
|
|
|
|
+ monthOrWeek: '1',
|
|
|
|
|
+ remark: undefined
|
|
|
|
|
+ }
|
|
|
|
|
+ ]
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ let index = this.addList.indexOf(row);
|
|
|
|
|
+ this.addList.splice(index, 1)
|
|
|
|
|
+
|
|
|
|
|
+ },
|
|
|
handleExport() {
|
|
handleExport() {
|
|
|
exportMaterial(this.queryParams)
|
|
exportMaterial(this.queryParams)
|
|
|
},
|
|
},
|
|
|
/** 周数据填报操作 */
|
|
/** 周数据填报操作 */
|
|
|
- handleSplit(row) {
|
|
|
|
|
- this.form = _.cloneDeep(row);
|
|
|
|
|
- this.form.parentId = row.id;
|
|
|
|
|
- this.form.id = undefined;
|
|
|
|
|
- this.form.recordDate = DateUtil.day(row.recordDate);
|
|
|
|
|
- this.form.num = undefined;
|
|
|
|
|
- this.form.monthOrWeek = '2'
|
|
|
|
|
|
|
+ handleSplit() {
|
|
|
|
|
+ this.addForm.id = undefined;
|
|
|
|
|
+ this.addForm.monthOrWeek = '2'
|
|
|
this.title = "添加周物料计划";
|
|
this.title = "添加周物料计划";
|
|
|
this.open = true;
|
|
this.open = true;
|
|
|
},
|
|
},
|
|
|
/** 修改按钮操作 */
|
|
/** 修改按钮操作 */
|
|
|
handleUpdate(row) {
|
|
handleUpdate(row) {
|
|
|
- this.reset();
|
|
|
|
|
- getMaterial(row.id).then(res => {
|
|
|
|
|
- this.form = res.data;
|
|
|
|
|
- if (this.form.monthOrWeek === '2') {
|
|
|
|
|
- this.form.recordDate = this.form.recordDate.split("~")[0]
|
|
|
|
|
- }
|
|
|
|
|
- this.open = true;
|
|
|
|
|
- this.title = "修改物料计划";
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ this.editForm = row
|
|
|
|
|
+ this.editOpen = true
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
/** 提交按钮 */
|
|
/** 提交按钮 */
|
|
|
submitForm() {
|
|
submitForm() {
|
|
|
- this.$refs["form"].validate(valid => {
|
|
|
|
|
|
|
+ this.$refs["addForm"].validate(valid => {
|
|
|
if (valid) {
|
|
if (valid) {
|
|
|
- if (this.form.id != undefined) {
|
|
|
|
|
- updateMaterial(this.form).then(res => {
|
|
|
|
|
- this.$message.success("修改成功");
|
|
|
|
|
- this.open = false;
|
|
|
|
|
- this.getList();
|
|
|
|
|
- });
|
|
|
|
|
- } else {
|
|
|
|
|
- addMaterial(this.form).then(res => {
|
|
|
|
|
- this.$message.success("新增成功");
|
|
|
|
|
- this.open = false;
|
|
|
|
|
- this.getList();
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ let data = {
|
|
|
|
|
+ date: this.addForm.date,
|
|
|
|
|
+ monthOrWeek: this.addForm.monthOrWeek,
|
|
|
|
|
+ addList: this.addList
|
|
|
}
|
|
}
|
|
|
|
|
+ addMaterial(data).then(res => {
|
|
|
|
|
+ this.$message.success("添加成功");
|
|
|
|
|
+ this.open = false;
|
|
|
|
|
+ this.getList();
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ submitEditForm() {
|
|
|
|
|
+ this.$refs["editForm"].validate(valid => {
|
|
|
|
|
+ if (valid) {
|
|
|
|
|
+ updateMaterial(this.editForm).then(res => {
|
|
|
|
|
+ this.$message.success("修改成功");
|
|
|
|
|
+ this.editOpen = false;
|
|
|
|
|
+ this.getList();
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
@@ -420,7 +613,13 @@ export default {
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
|
<style scoped lang="scss">
|
|
|
-.el-form-item--mini.el-form-item, .el-form-item--small.el-form-item {
|
|
|
|
|
- margin-bottom: 10px;
|
|
|
|
|
|
|
+.add-table::v-deep.el-table .cell {
|
|
|
|
|
+ padding-left: 2px;
|
|
|
|
|
+ padding-right: 2px;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+.add-table::v-deep.el-table th.el-table__cell > .cell {
|
|
|
|
|
+ padding-left: 5px;
|
|
|
|
|
+ padding-right: 5px;
|
|
|
}
|
|
}
|
|
|
</style>
|
|
</style>
|