|
@@ -6,7 +6,7 @@
|
|
|
<el-form-item label="报损时间" prop="report_time" class="change-form-item">
|
|
|
<span v-if="type == 'detail'">{{ goodsInventoryAddForm.report_time }}</span>
|
|
|
<el-date-picker v-else v-model="goodsInventoryAddForm.report_time" value-format="yyyy-MM-dd HH:mm:ss"
|
|
|
- type="datetime" :disabled="type === 'detail' || type === 'audit'" placeholder="选择日期时间">
|
|
|
+ type="datetime" :disabled="type === 'detail' || type === 'audit' || type === 'edit'" placeholder="选择日期时间">
|
|
|
</el-date-picker>
|
|
|
</el-form-item>
|
|
|
<!-- <el-form-item label="所属部门" prop="dept_id" class="change-form-item">
|
|
@@ -21,34 +21,34 @@
|
|
|
<el-form-item label="仓库" prop="warehouse_id" class="change-form-item">
|
|
|
<span v-if="type == 'detail'">{{ getWarehouse(goodsInventoryAddForm.warehouse_id) }}</span>
|
|
|
<el-select v-else v-model="goodsInventoryAddForm.warehouse_id" @change="cleanGoodsList"
|
|
|
- :disabled="type === 'detail' || type === 'audit'">
|
|
|
+ :disabled="type === 'detail' || type === 'audit' || type === 'edit'">
|
|
|
<el-option v-for="item in warehouseList" :key="item.id" :label="item.name" :value="item.id" />
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="报损类型" prop="damage_type_value" class="change-form-item">
|
|
|
<span v-if="type == 'detail'">{{ getRoleSplit(goodsInventoryAddForm.damage_type_value) }}</span>
|
|
|
<el-select v-else v-model="goodsInventoryAddForm.damage_type_value"
|
|
|
- :disabled="type === 'detail' || type === 'audit'">
|
|
|
+ :disabled="type === 'detail' || type === 'audit' || type === 'edit'">
|
|
|
<el-option v-for="item in roleSplit" :key="item.label" :label="item.label" :value="item.value" />
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="制单人" prop="creator_id" class="change-form-item">
|
|
|
<span v-if="type == 'detail'">{{ getadminList(goodsInventoryAddForm.creator_id) }}</span>
|
|
|
- <el-select v-else v-model="goodsInventoryAddForm.creator_id" :disabled="type === 'detail' || type === 'audit'"
|
|
|
- @change="changeCreator">
|
|
|
+ <el-select v-else v-model="goodsInventoryAddForm.creator_id"
|
|
|
+ :disabled="type === 'detail' || type === 'audit' || type === 'edit'" @change="changeCreator">
|
|
|
<el-option v-for="item in adminList" :key="item.id" :label="item.real_name" :value="item.id" />
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="报损说明" prop="report_desc" class="change-form-item" style="width: 61%;">
|
|
|
<span v-if="type == 'detail'">{{ goodsInventoryAddForm.report_desc }}</span>
|
|
|
<el-input v-else style="flex: 1;" v-model="goodsInventoryAddForm.report_desc" type="textarea"
|
|
|
- :disabled="type === 'detail' || type === 'audit'" :autosize="{ minRows: 3, maxRows: 4 }"
|
|
|
+ :disabled="type === 'detail' || type === 'audit' || type === 'edit'" :autosize="{ minRows: 3, maxRows: 4 }"
|
|
|
placeholder="请输入报损说明"></el-input>
|
|
|
</el-form-item>
|
|
|
<div class="mx">
|
|
|
<h3>报损商品明细</h3>
|
|
|
- <el-button v-if=" type == 'edit'" class="button" size="mini" type="primary"
|
|
|
- @click="scanCode">录入SKU</el-button>
|
|
|
+ <el-button v-if="type !== 'edit' && type !== 'audit' && type !== 'detail'" class="button" size="mini"
|
|
|
+ type="primary" @click="scanCode">录入SKU</el-button>
|
|
|
<el-button v-if="type !== 'detail'" class="button" size="mini" type="primary"
|
|
|
@click="handleSelectWarehouseEntryBatch">选择</el-button>
|
|
|
</div>
|
|
@@ -115,22 +115,22 @@
|
|
|
<el-table-column label="报损数量">
|
|
|
<template slot-scope="scope">
|
|
|
<span v-if="type == 'edit'">{{ scope.row.num }}</span>
|
|
|
- <el-input v-else v-model="scope.row.num" type="number" :min="0" :maxlength="20"
|
|
|
+ <el-input v-else v-model="scope.row.report_num" type="number" :min="0" :maxlength="20"
|
|
|
:disabled="type === 'detail' || type === 'audit'"></el-input>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="录入数量" v-if="type == 'edit'">
|
|
|
+ <!-- <el-table-column label="录入数量" >
|
|
|
<template slot-scope="scope">
|
|
|
<span>{{ scope.row.report_num }}</span>
|
|
|
</template>
|
|
|
- </el-table-column>
|
|
|
+ </el-table-column> -->
|
|
|
<!-- <el-table-column label="调整说明">
|
|
|
<template slot-scope="scope">
|
|
|
<el-input v-model="scope.row.report_remark" :min="0" :maxlength="50"
|
|
|
:disabled="type === 'detail' || type === 'audit'"></el-input>
|
|
|
</template>
|
|
|
</el-table-column> -->
|
|
|
- <el-table-column label="操作" v-if="type !== 'detail' && type !== 'audit'">
|
|
|
+ <el-table-column label="操作" v-if="type !== 'detail' && type !== 'audit' && type !== 'edit'">
|
|
|
<template slot-scope="scope">
|
|
|
<el-button size="mini" type="danger"
|
|
|
@click="goodsInventoryAddForm.product_list.splice(scope.$index, 1)">删除</el-button>
|
|
@@ -145,26 +145,33 @@
|
|
|
</el-button>
|
|
|
<el-button v-if="type === 'audit'" type="danger" @click="dialogVisible = true">审核驳回
|
|
|
</el-button> -->
|
|
|
- <el-button v-if="type !== 'edit'&& type !== 'audit' && type !== 'detail'"
|
|
|
- type="primary" @click="submitGoodsInventoryAddForm">保存
|
|
|
+ <el-button v-if="type !== 'edit' && type !== 'audit' && type !== 'detail'" type="primary"
|
|
|
+ @click="submitGoodsInventoryAddForm">保存
|
|
|
</el-button>
|
|
|
- <el-button v-if="type === 'edit'"
|
|
|
- type="primary" @click="submitcont">确认
|
|
|
+ <el-button v-if="type === 'edit'" type="primary" @click="submitcont">审核
|
|
|
+ </el-button>
|
|
|
+ <el-button v-if="type === 'edit'" type="primary" @click="submitreject">驳回
|
|
|
</el-button>
|
|
|
<el-button @click="printIng" v-if="type == 'detail'">打印</el-button>
|
|
|
<el-button @click="$router.back()">返回
|
|
|
</el-button>
|
|
|
</div>
|
|
|
- <el-dialog title="扫码出库" :visible.sync="scanDialogVisible" width="30%" :close-on-click-modal="false">
|
|
|
- <el-form ref="scanGoodsForm" :model="scanGoodsForm" inline>
|
|
|
- <el-form-item label="sku" prop="bar_code">
|
|
|
- <el-input v-model="scanGoodsForm.bar_code" ref="input" @keyup.enter.native="toSearch()" :minlength="0"
|
|
|
- :maxlength="100"></el-input>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="序列号" prop="sn_code">
|
|
|
- <el-input v-model="sn_code" ref="sn_input" @keyup.enter.native="toSnCode()" :minlength="0"
|
|
|
- :maxlength="100"></el-input>
|
|
|
- </el-form-item>
|
|
|
+ <el-dialog title="扫码录入" :visible.sync="scanDialogVisible" width="30%" :close-on-click-modal="false">
|
|
|
+ <el-form ref="scanGoodsForm" :model="scanGoodsForm" inline label-width="60px">
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="18">
|
|
|
+ <el-form-item label="sku:" prop="bar_code">
|
|
|
+ <el-input v-model="scanGoodsForm.bar_code" ref="input" @keyup.enter.native="toSearch()" :minlength="0"
|
|
|
+ :maxlength="100"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="18">
|
|
|
+ <el-form-item label="序列号:" prop="sn_code">
|
|
|
+ <el-input v-model="sn_code" ref="sn_input" @keyup.enter.native="toSnCode()" :minlength="0"
|
|
|
+ :maxlength="100"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
</el-form>
|
|
|
<span slot="footer" class="dialog-footer">
|
|
|
<!-- <el-button @click="dialogVisible = false">取 消</el-button>
|
|
@@ -222,7 +229,7 @@ export default {
|
|
|
/** 出库单表单*/
|
|
|
goodsInventoryAddForm: {
|
|
|
product_list: [],
|
|
|
- creator_id:''
|
|
|
+ creator_id: ''
|
|
|
},
|
|
|
/** 校验规则 */
|
|
|
goodsInventoryAddFormRule: {
|
|
@@ -271,6 +278,47 @@ export default {
|
|
|
this.GET_AdministratorList()
|
|
|
},
|
|
|
methods: {
|
|
|
+ /* 驳回 */
|
|
|
+ submitreject() {
|
|
|
+ this.$refs['goodsInventoryAddForm'].validate(valid => {
|
|
|
+ if (valid) {
|
|
|
+ const { id } = this.goodsInventoryAddForm
|
|
|
+ const params = this.MixinClone(this.goodsInventoryAddForm)
|
|
|
+ if (params.dept_id) {
|
|
|
+ params.dept_name = this.deptListAll.find(dept => dept.id === params.dept_id).name
|
|
|
+ }
|
|
|
+ if (params.warehouse_id) {
|
|
|
+ params.warehouse_name = this.warehouseList.find(ware => ware.id === params.warehouse_id).name
|
|
|
+ }
|
|
|
+ /* params.report_time = Math.floor(params.report_time / 1000) */
|
|
|
+ if (params.damage_type_value) {
|
|
|
+ params.damage_type_key = this.roleSplit.find(ware => ware.value === params.damage_type_value).label
|
|
|
+ }
|
|
|
+ if (params.creator_id) {
|
|
|
+ params.creator = this.adminList.find(admin => admin.id === params.creator_id).real_name
|
|
|
+ }
|
|
|
+ params.status = 'CANCEL_HANDLE'
|
|
|
+ params.product_list = params.product_list.map(item => {
|
|
|
+ const query = {
|
|
|
+ report_num: item.report_num,
|
|
|
+ product_id: item.product_id,
|
|
|
+ product_stock_id: item.product_stock_id
|
|
|
+ }
|
|
|
+ return query
|
|
|
+ })
|
|
|
+ API_GoodsInventoryLossLoss.submit(id, params).then(response => {
|
|
|
+ this.$message.success('驳回成功!')
|
|
|
+ const { callback } = this.$route.params
|
|
|
+ if (typeof callback === 'function') callback()
|
|
|
+ this.$store.dispatch('delCurrentViews', {
|
|
|
+ view: this.$route,
|
|
|
+ $router: this.$router
|
|
|
+ })
|
|
|
+ this.$router.push({ name: 'goodsInventoryLoss' })
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
// 扫码出库
|
|
|
scanCode() {
|
|
|
this.scanDialogVisible = true;
|
|
@@ -296,20 +344,20 @@ export default {
|
|
|
});
|
|
|
// 如果商品不存在,则添加到列表
|
|
|
if (indexs === -1) {
|
|
|
- // 检查是否有相同商品在product_list中
|
|
|
- const existingProduct = this.goodsInventoryAddForm.product_list.find(el => (
|
|
|
- el.goods_vo.id === res.goods_id &&
|
|
|
- el.product_id === res.product_id &&
|
|
|
- el.product_vo.sku === res.product_vo.sku
|
|
|
- ));
|
|
|
-
|
|
|
- if (!existingProduct) {
|
|
|
- this.$message.error('订单内没有该商品,请重新录入');
|
|
|
- this.$nextTick(() => {
|
|
|
- this.$refs.input.focus();
|
|
|
- });
|
|
|
- return; // 退出函数,不继续执行
|
|
|
- }
|
|
|
+ /* // 检查是否有相同商品在product_list中
|
|
|
+ const existingProduct = this.goodsInventoryAddForm.product_list.find(el => (
|
|
|
+ el.goods_vo.id === res.goods_id &&
|
|
|
+ el.product_id === res.product_id &&
|
|
|
+ el.product_vo.sku === res.product_vo.sku
|
|
|
+ ));
|
|
|
+
|
|
|
+ if (!existingProduct) {
|
|
|
+ this.$message.error('订单内没有该商品,请重新录入');
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$refs.input.focus();
|
|
|
+ });
|
|
|
+ return; // 退出函数,不继续执行
|
|
|
+ } */
|
|
|
this.index = this.goodsInventoryAddForm.product_list.length
|
|
|
this.goodsInventoryAddForm.product_list.push(res);
|
|
|
} else {
|
|
@@ -321,8 +369,8 @@ export default {
|
|
|
});
|
|
|
} else {
|
|
|
this.goodsInventoryAddForm.product_list[this.index].report_num += 1
|
|
|
- if( this.goodsInventoryAddForm.product_list[this.index].report_num==this.goodsInventoryAddForm.product_list[this.index].num){
|
|
|
- this.scanDialogVisible = false;
|
|
|
+ if (this.goodsInventoryAddForm.product_list[this.index].report_num == this.goodsInventoryAddForm.product_list[this.index].num) {
|
|
|
+ this.scanDialogVisible = false;
|
|
|
}
|
|
|
}
|
|
|
});
|
|
@@ -344,29 +392,27 @@ export default {
|
|
|
);
|
|
|
}
|
|
|
this.goodsInventoryAddForm.product_list[this.index].report_num = this.goodsInventoryAddForm.product_list[this.index].sn_code_list.length
|
|
|
- const indexs = this.product_list.findIndex((el) => {
|
|
|
+ const indexs = this.goodsInventoryAddForm.product_list.findIndex((el) => {
|
|
|
return (
|
|
|
el.goods_id === res.goods_id &&
|
|
|
el.product_id === res.product_id &&
|
|
|
el.product_vo.sku === res.sku
|
|
|
);
|
|
|
});
|
|
|
- this.goodsInventoryAddForm.product_list[this.index].id = this.product_list[indexs].id
|
|
|
- if (this.goodsInventoryAddForm.product_list[this.index].report_num == this.product_list[indexs].report_num) {
|
|
|
- this.scanGoodsForm.bar_code = "";
|
|
|
- this.scanDialogVisible = false;
|
|
|
- } else {
|
|
|
- this.scanGoodsForm.bar_code = "";
|
|
|
- this.$nextTick(() => {
|
|
|
- this.$refs.input.focus();
|
|
|
- });
|
|
|
- }
|
|
|
+ this.goodsInventoryAddForm.product_list[this.index].id = this.goodsInventoryAddForm.product_list[indexs].id
|
|
|
+ this.scanGoodsForm.bar_code = "";
|
|
|
+ /* this.scanDialogVisible = false; */
|
|
|
+ this.scanGoodsForm.bar_code = "";
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$refs.input.focus();
|
|
|
+ });
|
|
|
+
|
|
|
|
|
|
});
|
|
|
},
|
|
|
|
|
|
/* 确认 */
|
|
|
- submitcont(){
|
|
|
+ submitcont() {
|
|
|
this.$refs['goodsInventoryAddForm'].validate(valid => {
|
|
|
if (valid) {
|
|
|
const { id } = this.goodsInventoryAddForm
|
|
@@ -392,16 +438,16 @@ export default {
|
|
|
}
|
|
|
return query
|
|
|
})
|
|
|
- API_GoodsInventoryLossLoss.submit(id, params).then(response => {
|
|
|
- this.$message.success('确认成功!')
|
|
|
- const { callback } = this.$route.params
|
|
|
- if (typeof callback === 'function') callback()
|
|
|
- this.$store.dispatch('delCurrentViews', {
|
|
|
- view: this.$route,
|
|
|
- $router: this.$router
|
|
|
- })
|
|
|
- this.$router.push({ name: 'goodsInventoryLoss' })
|
|
|
+ API_GoodsInventoryLossLoss.submit(id, params).then(response => {
|
|
|
+ this.$message.success('审核成功!')
|
|
|
+ const { callback } = this.$route.params
|
|
|
+ if (typeof callback === 'function') callback()
|
|
|
+ this.$store.dispatch('delCurrentViews', {
|
|
|
+ view: this.$route,
|
|
|
+ $router: this.$router
|
|
|
})
|
|
|
+ this.$router.push({ name: 'goodsInventoryLoss' })
|
|
|
+ })
|
|
|
}
|
|
|
})
|
|
|
},
|
|
@@ -512,9 +558,10 @@ export default {
|
|
|
}
|
|
|
params.product_list = params.product_list.map(item => {
|
|
|
const query = {
|
|
|
- report_num: item.num,
|
|
|
+ report_num: item.report_num,
|
|
|
product_id: item.product_id,
|
|
|
- product_stock_id: item.id
|
|
|
+ product_stock_id: item.id,
|
|
|
+ sn_code_list: item.sn_code_list
|
|
|
}
|
|
|
return query
|
|
|
})
|