|
@@ -0,0 +1,735 @@
|
|
|
+<template>
|
|
|
+ <div class="bg-in-stock">
|
|
|
+ <el-form ref="goodsInventoryAddFormRef" :model="goodsInventoryAddForm" :rules="goodsInventoryAddFormRule" label-width="120px" inline class="change-form">
|
|
|
+ <h3 style="width: 100%">库存报损</h3>
|
|
|
+ <el-form-item label="报损时间" prop="report_time" class="change-form-item">
|
|
|
+ <span v-if="type == 'view'|| type == 'examine'">{{ 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 === 'view' || type === 'examine' || type === 'edit'"
|
|
|
+ placeholder="选择日期时间"
|
|
|
+ >
|
|
|
+ </el-date-picker>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="仓库" prop="warehouse_id" class="change-form-item">
|
|
|
+ <span v-if="type == 'view'|| type === 'examine'">{{ getWarehouse(goodsInventoryAddForm.warehouse_id) }}</span>
|
|
|
+ <el-select
|
|
|
+ v-else
|
|
|
+ v-model="goodsInventoryAddForm.warehouse_id"
|
|
|
+ @change="cleanGoodsList"
|
|
|
+ :disabled="type === 'view' || type === 'audit' || type === 'examine'"
|
|
|
+ >
|
|
|
+ <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 == 'view'|| type === 'examine'">{{ getRoleSplit(goodsInventoryAddForm.damage_type_value) }}</span>
|
|
|
+ <el-select v-else v-model="goodsInventoryAddForm.damage_type_value" :disabled="type === 'view' || type === 'audit' || type === 'examine'">
|
|
|
+ <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 == 'view'|| type === 'examine'">{{ getadminList(goodsInventoryAddForm.creator_id) }}</span>
|
|
|
+ <el-select
|
|
|
+ v-else
|
|
|
+ v-model="goodsInventoryAddForm.creator_id"
|
|
|
+ :disabled="type === 'view' || type === 'audit' || type === 'examine'"
|
|
|
+ @change="changeCreator"
|
|
|
+ >
|
|
|
+ <el-option v-for="item in adminList" :key="item.id" :label="item.nickname" :value="item.id" />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="是否通知审核人:" prop="has_notice" class="change-form-item">
|
|
|
+ <el-switch v-model="goodsInventoryAddForm.has_notice" :disabled="type === 'examine'" inline-prompt :active-text="true" :inactive-text="false" /> </el-form-item
|
|
|
+ ><!-- v-if="goodsInventoryAddForm.has_notice" -->
|
|
|
+ <el-form-item label="审核人:" prop="notice_user_id" class="change-form-item" v-if="goodsInventoryAddForm.has_notice">
|
|
|
+ <span v-if="id && type !== 'examine'||type !== 'view'">{{ getNotice(goodsInventoryAddForm.notice_user_id) }}</span>
|
|
|
+ <el-select v-else v-model="goodsInventoryAddForm.notice_user_id" :disabled="type === 'view' || type === 'audit' || type === 'examine'">
|
|
|
+ <el-option v-for="item in auditList" :key="item.id" :label="item.nickname" :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 == 'view'|| type === 'examine'">{{ goodsInventoryAddForm.report_desc }}</span>
|
|
|
+ <el-input
|
|
|
+ v-else
|
|
|
+ style="flex: 1"
|
|
|
+ v-model="goodsInventoryAddForm.report_desc"
|
|
|
+ type="textarea"
|
|
|
+ :disabled="type === 'view' || type === 'audit' || type === 'examine'"
|
|
|
+ :autosize="{ minRows: 3, maxRows: 4 }"
|
|
|
+ placeholder="请输入报损说明"
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <div class="mx">
|
|
|
+ <h3>报损商品明细</h3>
|
|
|
+ <el-button v-if="type !== 'examine' && type !== 'audit' && type !== 'view'" class="button" size="mini" type="primary" @click="scanCode"
|
|
|
+ >录入SKU</el-button
|
|
|
+ >
|
|
|
+ <el-button v-if="type !== 'view' type !== 'examine'" class="button" size="mini" type="primary" @click="handleSelectWarehouseEntryBatch">选择</el-button>
|
|
|
+ </div>
|
|
|
+ <div style="width: 100%; display: block">
|
|
|
+ <el-form-item style="width: 100%">
|
|
|
+ <el-table
|
|
|
+ :data="goodsInventoryAddForm.product_list"
|
|
|
+ border
|
|
|
+ :cell-style="{ textAlign: 'center' }"
|
|
|
+ :header-cell-style="{ textAlign: 'center' }"
|
|
|
+ style="width: 100%; margin-top: 20px"
|
|
|
+ >
|
|
|
+ <!-- <el-table-column label="商品编号">
|
|
|
+ <template #default="scope">
|
|
|
+ <span v-if="id"> {{ scope.row.goods_vo.sn }}</span>
|
|
|
+ <span v-else>{{ scope.row.goods_vo.sn }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column> -->
|
|
|
+ <el-table-column label="商品名称">
|
|
|
+ <template #default="scope">
|
|
|
+ <span v-if="id">{{ scope.row.product_vo.name }}</span>
|
|
|
+ <span v-else>{{ scope.row.product_vo.name }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="sku">
|
|
|
+ <template #default="scope">
|
|
|
+ <span>{{ scope.row.product_vo.sku }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <!-- <el-table-column label="序列号" v-if="sn_code_list">
|
|
|
+ <template #default="scope">
|
|
|
+ <div class="sn-code-container">
|
|
|
+ <span v-for="item in scope.row.sn_code_list" :key="item.id">
|
|
|
+ <p>{{ item.sn_code }}</p>
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="product_vo.spec_name" label="规格型号"> </el-table-column>-->
|
|
|
+ <el-table-column label="单位">
|
|
|
+ <template #default="scope">
|
|
|
+ <span v-if="!id"> {{ scope.row.product_vo.unit }}</span>
|
|
|
+ <span v-else> {{ scope.row.product_vo.unit }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="库存数量">
|
|
|
+ <template #default="scope">
|
|
|
+ {{ scope.row.usable_stock }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="报损数量">
|
|
|
+ <template #default="scope">
|
|
|
+ <span v-if="type == 'edit'">{{ scope.row.num }}</span>
|
|
|
+ <el-input
|
|
|
+ v-else
|
|
|
+ v-model="scope.row.report_num"
|
|
|
+ type="number"
|
|
|
+ :min="0"
|
|
|
+ :maxlength="20"
|
|
|
+ :disabled="type === 'view' || type === 'examine'"
|
|
|
+ ></el-input>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="操作" v-if="type !== 'view' && type !== 'audit' && type !== 'examine'">
|
|
|
+ <template #default="scope">
|
|
|
+ <el-button size="mini" type="danger" @click="goodsInventoryAddForm.product_list.splice(scope.$index, 1)">删除</el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </el-form-item>
|
|
|
+ </div>
|
|
|
+ </el-form>
|
|
|
+ <div class="footer">
|
|
|
+ <el-button v-if="type !== 'examine' && type !== 'audit' && type !== 'view'" type="primary" @click="submitGoodsInventoryAddForm">保存 </el-button>
|
|
|
+ <el-button v-if="type === 'edit'||type === 'examine'" type="primary" @click="submitcont">审核 </el-button>
|
|
|
+ <el-button v-if="type === 'edit'||type === 'examine'" type="primary" @click="submitreject">驳回 </el-button>
|
|
|
+ <el-button @click="printIng" v-if="type == 'view'">打印</el-button>
|
|
|
+ <el-button @click="$router.back()">返回 </el-button>
|
|
|
+ </div>
|
|
|
+ <el-dialog title="扫码录入" v-model="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="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="toSnCode()" :minlength="0" :maxlength="100"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </el-form>
|
|
|
+ <!-- <span slot="footer" class="dialog-footer">
|
|
|
+ </span> -->
|
|
|
+ </el-dialog>
|
|
|
+ <el-dialog title="提示" v-model="dialogVisible" width="30%">
|
|
|
+ <el-form ref="goodsInventoryAddForm" :model="goodsInventoryAddForm" label-width="120px" inline style="width: 900px">
|
|
|
+ <el-form-item label="驳回原因" prop="reject_reason">
|
|
|
+ <el-input v-model="goodsInventoryAddForm.reject_reason" type="textarea" :minlength="0" :maxlength="100"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <template #footer>
|
|
|
+ <el-button @click="dialogVisible = false">取 消</el-button>
|
|
|
+ <el-button type="primary" @click="handleRejectGoodsInventoryLoss()">确 定</el-button>
|
|
|
+ </template>
|
|
|
+ </el-dialog>
|
|
|
+ <el-dialog title="报损商品" v-model="goodsVisible" width="1000px" @close="closeGoosData">
|
|
|
+ <div style="display: flex; align-items: center; justify-content: flex-end; padding: 10px 0">
|
|
|
+ <span>搜索商品:</span><el-input v-model="params.keyWord" style="width: 200px; margin-right: 5px"></el-input>
|
|
|
+ <el-button @click="searchGoodEvent"> 搜索 </el-button>
|
|
|
+ </div>
|
|
|
+ <el-table :data="goodsData.records" border style="width: 100%" @selection-change="handleSelectionChange">
|
|
|
+ <el-table-column type="selection" width="55" />
|
|
|
+ <el-table-column prop="product_vo.name" label="商品名称"></el-table-column>
|
|
|
+ <el-table-column prop="product_vo.sku" label="sku"> </el-table-column>
|
|
|
+ <el-table-column prop="" label="品牌">
|
|
|
+ <template #default="scope">
|
|
|
+ {{ scope.row.product_vo.brand }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="product_vo.weight" label="重量"> </el-table-column>
|
|
|
+ <el-table-column prop="product_vo.unit" label="单位"> </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ <el-pagination
|
|
|
+ @size-change="goodsPageSizeChange"
|
|
|
+ @current-change="goodsPageCurrentChange"
|
|
|
+ :current-page="goodsData.current"
|
|
|
+ :page-sizes="[10, 20, 50, 100]"
|
|
|
+ :page-size="goodsData.size"
|
|
|
+ layout="total, sizes, prev, pager, next, jumper"
|
|
|
+ :total="goodsData.total"
|
|
|
+ >
|
|
|
+ </el-pagination>
|
|
|
+ <template #footer>
|
|
|
+ <el-button @click="closeGoosData">取 消</el-button>
|
|
|
+ <el-button type="primary" @click="submitGoosData()">确 定</el-button>
|
|
|
+ </template>
|
|
|
+ </el-dialog>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+ <script lang="ts" setup>
|
|
|
+import { ref, onMounted, nextTick, reactive } from 'vue';
|
|
|
+import { useRoute, useRouter } from 'vue-router';
|
|
|
+import { ElMessage, ElMessageBox } from 'element-plus';
|
|
|
+import { useStore } from 'vuex';
|
|
|
+import * as API_GoodsInventoryLoss from '@/api/goodsInventoryLoss';
|
|
|
+import * as API_GoodsInventory from '@/api/goodsInventory';
|
|
|
+import * as API_GoodsExchange from '@/api/goodsExchange';
|
|
|
+import * as API_Setting from '@/api/setting';
|
|
|
+import * as API_BasicSetting from '@/api/basicSetting';
|
|
|
+import * as API_Auth from '@/api/auth';
|
|
|
+/* import { Foundation, RegExp } from '~/ui-utils'; */
|
|
|
+
|
|
|
+const store = useStore();
|
|
|
+const route = useRoute();
|
|
|
+const router = useRouter();
|
|
|
+
|
|
|
+const adminList = ref<any>([]);
|
|
|
+const dialogVisible = ref(false);
|
|
|
+const warehouseList = ref<any>([]);
|
|
|
+const deptList = ref([]);
|
|
|
+const deptListAll = ref<any>([]);
|
|
|
+const roleSplit = ref<any>([]);
|
|
|
+const id = ref('');
|
|
|
+const type = ref('');
|
|
|
+const goodsInventoryAddForm = ref<any>({
|
|
|
+ product_list: [],
|
|
|
+ creator_id: '',
|
|
|
+ has_notice: false,
|
|
|
+});
|
|
|
+const goodsInventoryAddFormRule = ref({
|
|
|
+ warehouse_id: { required: true, message: '请选择报仓库', trigger: 'change' },
|
|
|
+ damage_type_value: { required: true, message: '请选择报损类型', trigger: 'change' },
|
|
|
+ dept_id: { required: true, message: '请选择所属部门', trigger: 'change' },
|
|
|
+ creator_id: { required: true, message: '请选择制单人', trigger: 'change' },
|
|
|
+});
|
|
|
+const warehouseProduct = ref(null);
|
|
|
+const scanDialogVisible = ref(false);
|
|
|
+const sn_code = ref('');
|
|
|
+const sku = ref('');
|
|
|
+const sn_code_list = ref([]);
|
|
|
+const index = ref('');
|
|
|
+const scanGoodsForm = ref<any>({});
|
|
|
+
|
|
|
+/* 获取审核人列表 */
|
|
|
+const auditList = ref<any>([]);
|
|
|
+const GET_AuditList = () => {
|
|
|
+ API_GoodsInventory.getUserByCompany().then((res) => {
|
|
|
+ auditList.value = res;
|
|
|
+ });
|
|
|
+};
|
|
|
+/* 获取审核人名称 */
|
|
|
+const getNotice = (value: string) => {
|
|
|
+ const type = auditList.value.find((type: any) => type.id === value);
|
|
|
+ return type ? type.nickname : '未知类型';
|
|
|
+};
|
|
|
+/* 报损商品信息 操作部分 */
|
|
|
+const goodsVisible = ref(false);
|
|
|
+const goodsData = ref<any>([]);
|
|
|
+const params = reactive({
|
|
|
+ page_no: 1,
|
|
|
+ page_size: 10,
|
|
|
+ keyWord: '',
|
|
|
+});
|
|
|
+/* 关闭报损商品 */
|
|
|
+const closeGoosData = () => {
|
|
|
+ goodsVisible.value = false;
|
|
|
+};
|
|
|
+/* 搜索报损商品 */
|
|
|
+const searchGoodEvent = () => {
|
|
|
+ API_GoodsExchange.getGoodsInfo(params, goodsInventoryAddForm.value.warehouse_id).then((res) => {
|
|
|
+ goodsData.value = res;
|
|
|
+ });
|
|
|
+};
|
|
|
+/* 选中的商品列表 */
|
|
|
+const goodsList = ref([]);
|
|
|
+const handleSelectionChange = (val) => {
|
|
|
+ goodsList.value = val.map((el) => {
|
|
|
+ /* el.product_id = el.id;
|
|
|
+ el.goods_id = el.id;
|
|
|
+ el.sn_code_list = []; */
|
|
|
+ return el;
|
|
|
+ });
|
|
|
+};
|
|
|
+const submitGoosData = () => {
|
|
|
+ if (goodsList.value.length >= 1) {
|
|
|
+ goodsInventoryAddForm.value.product_list = goodsList.value.map((el) => {
|
|
|
+ /* el.sn_code_list = []; */
|
|
|
+ return el;
|
|
|
+ });
|
|
|
+ goodsVisible.value = false;
|
|
|
+ } else {
|
|
|
+ ElMessage.error('请选择商品信息');
|
|
|
+ }
|
|
|
+};
|
|
|
+/* 盘点商品分页 */
|
|
|
+const goodsPageSizeChange = (size) => {
|
|
|
+ params.page_size = size;
|
|
|
+ searchGoodEvent();
|
|
|
+};
|
|
|
+
|
|
|
+const goodsPageCurrentChange = (page) => {
|
|
|
+ params.page_no = page;
|
|
|
+ searchGoodEvent();
|
|
|
+};
|
|
|
+
|
|
|
+const getadminList = (value: string) => {
|
|
|
+ const type = adminList.value.find((type) => type.id === value);
|
|
|
+ return type ? type.nickname : '未知类型';
|
|
|
+};
|
|
|
+
|
|
|
+const getRoleSplit = (value: string) => {
|
|
|
+ const type = roleSplit.value.find((type) => type.value === value);
|
|
|
+ return type ? type.label : '未知类型';
|
|
|
+};
|
|
|
+
|
|
|
+const getWarehouse = (value: string) => {
|
|
|
+ const type = warehouseList.value.find((type) => type.id === value);
|
|
|
+ return type ? type.name : '未知类型';
|
|
|
+};
|
|
|
+
|
|
|
+const cleanGoodsList = () => {
|
|
|
+ goodsInventoryAddForm.value.product_list = [];
|
|
|
+};
|
|
|
+
|
|
|
+const changeCreator = () => {
|
|
|
+ // Force update if necessary
|
|
|
+};
|
|
|
+
|
|
|
+const scanCode = () => {
|
|
|
+ scanDialogVisible.value = true;
|
|
|
+ nextTick(() => {
|
|
|
+ input.value.focus();
|
|
|
+ });
|
|
|
+};
|
|
|
+
|
|
|
+const sn_input = ref();
|
|
|
+const toSearch = () => {
|
|
|
+ API_GoodsExchange.getProduct(goodsInventoryAddForm.value.warehouse_id, scanGoodsForm.value.bar_code.replace(/\s+/g, '')).then((res) => {
|
|
|
+ res.sn_code_list = [];
|
|
|
+ sku.value = res.product_vo.sku;
|
|
|
+ const indexs = goodsInventoryAddForm.value.product_list.findIndex((el) => {
|
|
|
+ return el.goods_vo.id === res.goods_id && el.product_id === res.product_id && el.product_vo.sku === res.product_vo.sku;
|
|
|
+ });
|
|
|
+ if (indexs === -1) {
|
|
|
+ index.value = goodsInventoryAddForm.value.product_list.length;
|
|
|
+ goodsInventoryAddForm.value.product_list.push(res);
|
|
|
+ } else {
|
|
|
+ index.value = indexs;
|
|
|
+ }
|
|
|
+ if (res.product_vo.have_sn) {
|
|
|
+ nextTick(() => {
|
|
|
+ sn_input.value.focus();
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ goodsInventoryAddForm.value.product_list[index.value].report_num += 1;
|
|
|
+ if (goodsInventoryAddForm.value.product_list[index.value].report_num == goodsInventoryAddForm.value.product_list[index.value].num) {
|
|
|
+ scanDialogVisible.value = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+};
|
|
|
+const input = ref();
|
|
|
+const toSnCode = () => {
|
|
|
+ if (sku.value == '') return ElMessage.error('请录入正确的sku');
|
|
|
+ API_GoodsExchange.getSnCode('out', sku.value, sn_code.value.replace(/\s+/g, '')).then((res) => {
|
|
|
+ sn_code.value = '';
|
|
|
+ let exists = goodsInventoryAddForm.value.product_list[index.value].sn_code_list.find((item) => item.sn_code === res.sn_code && item.sku === res.sku);
|
|
|
+ if (!exists) {
|
|
|
+ goodsInventoryAddForm.value.product_list[index.value].sn_code_list.push(res);
|
|
|
+ }
|
|
|
+ goodsInventoryAddForm.value.product_list[index.value].report_num = goodsInventoryAddForm.value.product_list[index.value].sn_code_list.length;
|
|
|
+ const indexs = goodsInventoryAddForm.value.product_list.findIndex((el) => {
|
|
|
+ return el.goods_id === res.goods_id && el.product_id === res.product_id && el.product_vo.sku === res.sku;
|
|
|
+ });
|
|
|
+ goodsInventoryAddForm.value.product_list[index.value].id = goodsInventoryAddForm.value.product_list[indexs].id;
|
|
|
+ scanGoodsForm.value.bar_code = '';
|
|
|
+ nextTick(() => {
|
|
|
+ input.value.focus();
|
|
|
+ });
|
|
|
+ });
|
|
|
+};
|
|
|
+
|
|
|
+const goodsInventoryAddFormRef = ref();
|
|
|
+const submitGoodsInventoryAddForm = () => {
|
|
|
+ goodsInventoryAddFormRef.value.validate((valid: boolean) => {
|
|
|
+ if (valid) {
|
|
|
+ const params = { ...goodsInventoryAddForm.value };
|
|
|
+ if (params.dept_id) {
|
|
|
+ params.dept_name = deptListAll.value.find((dept) => dept.id === params.dept_id).name;
|
|
|
+ }
|
|
|
+ if (params.warehouse_id) {
|
|
|
+ params.warehouse_name = warehouseList.value.find((ware) => ware.id === params.warehouse_id).name;
|
|
|
+ }
|
|
|
+ if (params.damage_type_value) {
|
|
|
+ params.damage_type_key = roleSplit.value.find((ware) => ware.value === params.damage_type_value).label;
|
|
|
+ }
|
|
|
+ if (params.creator_id) {
|
|
|
+ params.creator = adminList.value.find((admin) => admin.id === params.creator_id).real_name;
|
|
|
+ }
|
|
|
+ params.product_list = params.product_list.map((item) => {
|
|
|
+ const query = {
|
|
|
+ report_num: item.report_num,
|
|
|
+ product_id: item.product_id,
|
|
|
+ product_stock_id: item.id,
|
|
|
+ sn_code_list: item.sn_code_list,
|
|
|
+ };
|
|
|
+ return query;
|
|
|
+ });
|
|
|
+ if (id.value) {
|
|
|
+ API_GoodsInventoryLoss.editgoodsInventoryLossAdd(id.value, params).then(() => {
|
|
|
+ ElMessage.success('修改成功!');
|
|
|
+ /* const { callback } = route.params;
|
|
|
+ if (typeof callback === 'function') callback();
|
|
|
+ store.dispatch('delCurrentViews', {
|
|
|
+ view: route,
|
|
|
+ $router: router
|
|
|
+ }); */
|
|
|
+ router.push({ name: 'goodsInventoryLoss' });
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ API_GoodsInventoryLoss.addgoodsInventoryLossAdd(params).then(() => {
|
|
|
+ ElMessage.success('添加成功!');
|
|
|
+ /* const { callback } = route.params;
|
|
|
+ if (typeof callback === 'function') callback();
|
|
|
+ store.dispatch('delCurrentViews', {
|
|
|
+ view: route,
|
|
|
+ $router: router
|
|
|
+ }); */
|
|
|
+ router.push({ name: 'goodsInventoryLoss' });
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+};
|
|
|
+
|
|
|
+const submitcont = () => {
|
|
|
+ goodsInventoryAddFormRef.value.validate((valid: boolean) => {
|
|
|
+ if (valid) {
|
|
|
+ const params = { ...goodsInventoryAddForm.value };
|
|
|
+ if (params.dept_id) {
|
|
|
+ params.dept_name = deptListAll.value.find((dept) => dept.id === params.dept_id).name;
|
|
|
+ }
|
|
|
+ if (params.warehouse_id) {
|
|
|
+ params.warehouse_name = warehouseList.value.find((ware) => ware.id === params.warehouse_id).name;
|
|
|
+ }
|
|
|
+ if (params.damage_type_value) {
|
|
|
+ params.damage_type_key = roleSplit.value.find((ware) => ware.value === params.damage_type_value).label;
|
|
|
+ }
|
|
|
+ if (params.creator_id) {
|
|
|
+ params.creator = adminList.value.find((admin) => admin.id === params.creator_id).real_name;
|
|
|
+ }
|
|
|
+ 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_GoodsInventoryLoss.submit(id.value, params).then(() => {
|
|
|
+ ElMessage.success('审核成功!');
|
|
|
+ /* const { callback } = route.params;
|
|
|
+ if (typeof callback === 'function') callback();
|
|
|
+ store.dispatch('delCurrentViews', {
|
|
|
+ view: route,
|
|
|
+ $router: router
|
|
|
+ }); */
|
|
|
+ router.push({ name: 'goodsInventoryLoss' });
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+};
|
|
|
+
|
|
|
+const submitreject = () => {
|
|
|
+ goodsInventoryAddFormRef.value.validate((valid: boolean) => {
|
|
|
+ if (valid) {
|
|
|
+ const params = { ...goodsInventoryAddForm.value };
|
|
|
+ if (params.dept_id) {
|
|
|
+ params.dept_name = deptListAll.value.find((dept) => dept.id === params.dept_id).name;
|
|
|
+ }
|
|
|
+ if (params.warehouse_id) {
|
|
|
+ params.warehouse_name = warehouseList.value.find((ware) => ware.id === params.warehouse_id).name;
|
|
|
+ }
|
|
|
+ if (params.damage_type_value) {
|
|
|
+ params.damage_type_key = roleSplit.value.find((ware) => ware.value === params.damage_type_value).label;
|
|
|
+ }
|
|
|
+ if (params.creator_id) {
|
|
|
+ params.creator = adminList.value.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_GoodsInventoryLoss.submit(id.value, params).then(() => {
|
|
|
+ ElMessage.success('驳回成功!');
|
|
|
+ const { callback } = route.params;
|
|
|
+ /* if (typeof callback === 'function') callback();
|
|
|
+ store.dispatch('delCurrentViews', {
|
|
|
+ view: route,
|
|
|
+ $router: router
|
|
|
+ }); */
|
|
|
+ router.push({ name: 'goodsInventoryLoss' });
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+};
|
|
|
+
|
|
|
+const handlePassGoodsInventoryLoss = () => {
|
|
|
+ ElMessageBox.confirm('确定通过吗?', '提示', { type: 'warning' })
|
|
|
+ .then(() => {
|
|
|
+ API_GoodsInventoryLoss.auditGoodsInventoryLoss(id.value, { status: 'PASS' }).then(() => {
|
|
|
+ ElMessage.success('已通过!');
|
|
|
+ /* const { callback } = route.params;
|
|
|
+ if (typeof callback === 'function') callback();
|
|
|
+ store.dispatch('delCurrentViews', {
|
|
|
+ view: route,
|
|
|
+ $router: router
|
|
|
+ }); */
|
|
|
+ router.push({ name: 'goodsInventoryLoss' });
|
|
|
+ });
|
|
|
+ })
|
|
|
+ .catch(() => {});
|
|
|
+};
|
|
|
+
|
|
|
+const handleRejectGoodsInventoryLoss = () => {
|
|
|
+ ElMessageBox.confirm('确定拒绝吗?', '提示', { type: 'warning' })
|
|
|
+ .then(() => {
|
|
|
+ API_GoodsInventoryLoss.auditGoodsInventoryLoss(id.value, { status: 'REJECT', reject_reason: goodsInventoryAddForm.value.reject_reason }).then(() => {
|
|
|
+ ElMessage.success('已拒绝!');
|
|
|
+ /* const { callback } = route.params;
|
|
|
+ if (typeof callback === 'function') callback();
|
|
|
+ store.dispatch('delCurrentViews', {
|
|
|
+ view: route,
|
|
|
+ $router: router
|
|
|
+ }); */
|
|
|
+ router.push({ name: 'goodsInventoryLoss' });
|
|
|
+ });
|
|
|
+ })
|
|
|
+ .catch(() => {});
|
|
|
+};
|
|
|
+
|
|
|
+const handleSelectWarehouseEntryBatch = async () => {
|
|
|
+ if (!goodsInventoryAddForm.value.warehouse_id) {
|
|
|
+ ElMessage.error('请先选择仓库!');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ API_GoodsExchange.getGoodsInfo(params, goodsInventoryAddForm.value.warehouse_id, 'gt').then((res) => {
|
|
|
+ goodsData.value = res;
|
|
|
+ goodsVisible.value = true;
|
|
|
+ });
|
|
|
+ /* const goodsData = await EnwarehouseEntryBatch({
|
|
|
+ goodsApi: `/admin/erp/warehouseOut/getGoodByWarehouse/${goodsInventoryAddForm.value.warehouse_id}`,
|
|
|
+ warehouseList: warehouseList.value,
|
|
|
+ selectedIds: id.value ? goodsInventoryAddForm.value.product_list.map((item) => item.id) : goodsInventoryAddForm.value.product_list.map((item) => item.id),
|
|
|
+ purchasePlanApiParams: { warehouse_id: goodsInventoryAddForm.value.warehouse_id },
|
|
|
+ });
|
|
|
+ goodsInventoryAddForm.value.warehouse_id = goodsData.warehouse_id;
|
|
|
+ goodsInventoryAddForm.value.product_list = goodsData.purchasePlans; */
|
|
|
+};
|
|
|
+
|
|
|
+const GET_AdministratorList = () => {
|
|
|
+ API_Auth.getAdministratorList({
|
|
|
+ page_no: 1,
|
|
|
+ page_size: 9999,
|
|
|
+ user_state: 0,
|
|
|
+ }).then((response) => {
|
|
|
+ adminList.value = response.data;
|
|
|
+ });
|
|
|
+};
|
|
|
+
|
|
|
+const GET_DictDataInfo = () => {
|
|
|
+ API_Setting.getDictDataInfo('es_stock_damage_report').then((response) => {
|
|
|
+ roleSplit.value = response;
|
|
|
+ });
|
|
|
+};
|
|
|
+
|
|
|
+const GET_WarehouseList = (e: any) => {
|
|
|
+ API_BasicSetting.getWarehouseListAll().then((response) => {
|
|
|
+ warehouseList.value = response;
|
|
|
+ });
|
|
|
+};
|
|
|
+
|
|
|
+const GET_DeptList = () => {
|
|
|
+ /* API_Setting.getDeptList().then(response => {
|
|
|
+ deptList.value = Foundation.buildTree(response, '0');
|
|
|
+ deptListAll.value = response;
|
|
|
+ }); */
|
|
|
+};
|
|
|
+
|
|
|
+const GET_goodsInventoryAddDetail = () => {
|
|
|
+ API_GoodsInventoryLoss.getGoodsInventoryLossInfo(id.value).then((response) => {
|
|
|
+ response.product_list.map((el) => {
|
|
|
+ el.num = el.report_num;
|
|
|
+ });
|
|
|
+ goodsInventoryAddForm.value = response;
|
|
|
+ goodsInventoryAddForm.value.distribution_name = response.staff_name;
|
|
|
+ });
|
|
|
+};
|
|
|
+
|
|
|
+onMounted(() => {
|
|
|
+ if(route.query.type==='view'){
|
|
|
+ type.value = 'view';
|
|
|
+ id.value=route.query.id as string
|
|
|
+ GET_goodsInventoryAddDetail()
|
|
|
+ }else if(route.query.type==='examine'){
|
|
|
+ type.value = 'examine';
|
|
|
+ id.value=route.query.id as string
|
|
|
+ GET_goodsInventoryAddDetail()
|
|
|
+ }
|
|
|
+ /*if (route.name === 'goodsInventoryLossEdit') {
|
|
|
+ type.value = 'edit';
|
|
|
+ } else if (route.name === 'goodsInventoryLossAudit') {
|
|
|
+ type.value = 'audit';
|
|
|
+ } else if (route.name === 'goodsInventoryLossReturn') {
|
|
|
+ type.value = 'return';
|
|
|
+ } else if (route.name === 'goodsInventoryLossAdd') {
|
|
|
+ type.value = 'add';
|
|
|
+
|
|
|
+ GET_WarehouseList({ dept_id: store.state.user.dept_id });
|
|
|
+ } else if (route.name === 'goodsInventoryLossDetail') {
|
|
|
+ type.value = 'detail';
|
|
|
+ }
|
|
|
+ if (route.params.id) {
|
|
|
+ id.value = route.params.id;
|
|
|
+ GET_goodsInventoryAddDetail();
|
|
|
+ }
|
|
|
+ GET_DeptList(); */
|
|
|
+ goodsInventoryAddForm.value.creator_id = store.state.user.uid;
|
|
|
+ goodsInventoryAddForm.value.dept_id = store.state.user.dept_id;
|
|
|
+ GET_DictDataInfo();
|
|
|
+ GET_WarehouseList({ dept_id: store.state.user.dept_id });
|
|
|
+ GET_AdministratorList();
|
|
|
+ GET_AuditList();
|
|
|
+});
|
|
|
+</script>
|
|
|
+
|
|
|
+<style scoped>
|
|
|
+.footer {
|
|
|
+ width: 100%;
|
|
|
+ padding: 10px;
|
|
|
+ bottom: 0px;
|
|
|
+ text-align: center;
|
|
|
+ z-index: 999;
|
|
|
+}
|
|
|
+
|
|
|
+.mx {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ width: 100%;
|
|
|
+}
|
|
|
+
|
|
|
+.mx .button {
|
|
|
+ margin-left: 10px;
|
|
|
+}
|
|
|
+
|
|
|
+.change-form {
|
|
|
+ display: flex;
|
|
|
+ justify-content: flex-start;
|
|
|
+ align-items: flex-start;
|
|
|
+ flex-wrap: wrap;
|
|
|
+ min-width: 900px;
|
|
|
+}
|
|
|
+
|
|
|
+.change-form .change-form-item {
|
|
|
+ width: 30%;
|
|
|
+ margin: 0 10px 20px 0;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: row;
|
|
|
+ flex-wrap: nowrap;
|
|
|
+}
|
|
|
+
|
|
|
+.change-form .el-form-item__content {
|
|
|
+ flex: 1;
|
|
|
+ width: 100%;
|
|
|
+}
|
|
|
+
|
|
|
+.change-form .el-date-editor,
|
|
|
+.change-form .el-cascader,
|
|
|
+.change-form .el-select {
|
|
|
+ width: 100%;
|
|
|
+}
|
|
|
+
|
|
|
+.bg-in-stock {
|
|
|
+ background-color: #fff;
|
|
|
+ margin: 10px;
|
|
|
+ padding: 25px;
|
|
|
+}
|
|
|
+
|
|
|
+.goods-info {
|
|
|
+ display: flex;
|
|
|
+}
|
|
|
+
|
|
|
+.goods-info .goods-name-box {
|
|
|
+ text-align: left;
|
|
|
+}
|
|
|
+
|
|
|
+.goods-info .goods-name-box .goods-name {
|
|
|
+ text-overflow: ellipsis;
|
|
|
+ display: -webkit-box;
|
|
|
+ -webkit-line-clamp: 2;
|
|
|
+ -webkit-box-orient: vertical;
|
|
|
+ overflow: hidden;
|
|
|
+ line-height: 16px;
|
|
|
+}
|
|
|
+
|
|
|
+.goods-info .goods-name-box .specs {
|
|
|
+ color: #999999;
|
|
|
+}
|
|
|
+
|
|
|
+.el-input--suffix .el-input__inner {
|
|
|
+ padding-right: 10px;
|
|
|
+}
|
|
|
+
|
|
|
+.error-input .el-input__inner {
|
|
|
+ border: 1px solid red;
|
|
|
+}
|
|
|
+</style>
|