Merge remote-tracking branch 'origin/master'

prod
anthonywj 2 years ago
commit fa1921b710

@ -0,0 +1,89 @@
import axios from "../../utils/request";
export function getInvMAOrderList(params) {
return axios({
url: "/inv/MA/order/filterList",
method: "get",
params: params
});
}
export function addInvMAOrder(data) {
return axios({
url: "/inv/MA/order/addOrder",
method: "post",
data: data
});
}
export function updateInvMAOrder(data) {
return axios({
url: "/inv/MA/order/update",
method: "post",
data: data
});
}
export function submitAudit(data) {
return axios({
url: "/inv/MA/order/submitAudit",
method: "post",
data: data
});
}
export function updateStatus(data) {
return axios({
url: "/inv/MA/order/updateStatus",
method: "post",
data: data
});
}
export function deleteInvMAOrder(data) {
return axios({
url: "/inv/MA/order/delete",
method: "post",
data: data
});
}
export function getInvMAOrderDetailList(params) {
return axios({
url: "/inv/MA/order/detail/filterList",
method: "get",
params: params
});
}
export function addInvMAOrderDetail(data) {
return axios({
url: "/inv/MA/order/detail/addOrderDetail",
method: "post",
data: data
});
}
export function batchAddDetail(data) {
return axios({
url: "/inv/MA/order/detail/batchAddDetail",
method: "post",
data: data
});
}
export function deleteInvMAOrderDetail(data) {
return axios({
url: "/inv/MA/order/detail/delete",
method: "post",
data: data
});
}
export function updateInvMAOrderDetail(data) {
return axios({
url: "/inv/MA/order/detail/update",
method: "post",
data: data
});
}

@ -31,3 +31,11 @@ export function stockStatistics(params) {
params: params
});
}
export function getInvMAProducts(params) {
return axios({
url: "/spms/inv/product/getInvMAProducts",
method: "get",
params: params
});
}

@ -0,0 +1,337 @@
<template>
<div>
<el-card class="el-card">
<el-form :model="filterQuery" class="query-form" size="mini" :inline="true">
<el-form-item class="query-form-item" label="养护记录号:">
<el-input v-model="filterQuery.orderId" placeholder="请输入养护记录号"
clearable="true"></el-input>
</el-form-item>
<el-form-item class="query-form-item" label="仓库:">
<el-select v-model="filterQuery.invCode" placeholder="请选择仓库" clearable="true"
@change="invChange"
>
<el-option
v-for="item in invList"
:key="item.name"
:label="item.name"
:value="item.code">
<span style="float: left">{{ item.name }}</span>
</el-option>
</el-select>
</el-form-item>
<el-form-item class="query-form-item" label="货位:">
<el-select v-model="filterQuery.invSpaceCode" placeholder="请选择货位" clearable="true"
>
<el-option
v-for="item in spaceList"
:key="item.name"
:label="item.name"
:value="item.code">
<span style="float: left">{{ item.name }}</span>
</el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button-group style="margin-left: 10px;display:flex;">
<el-button type="primary" icon="el-icon-refresh" @click="onReset"></el-button>
<el-button type="primary" icon="el-icon-search" @click="onSubmit"></el-button>
</el-button-group>
</el-form-item>
</el-form>
<el-table v-loading="loading" :data="list" style="width: 100%" highlight-current-row
@current-change="handleChange"
border>
<el-table-column label="序号" type="index"></el-table-column>
<el-table-column label="养护记录号" prop="orderId"></el-table-column>
<el-table-column label="仓库" prop="invName"></el-table-column>
<el-table-column label="货位" prop="invSpaceName"></el-table-column>
<el-table-column label="养护日期" prop="createTime"></el-table-column>
<el-table-column label="养护人" prop="createUserName"></el-table-column>
<el-table-column label="状态" prop="status" show-overflow-tooltip width="120">
<template slot-scope="scope">
<el-tag>{{ statusMap[scope.row.status] }}</el-tag>
</template>
</el-table-column>
<el-table-column label="操作">
<template slot-scope="scope">
<el-button
type="text"
size="small"
@click.native.stop="auditOrder(scope.row)"
>审核
</el-button
>
<el-button
type="text"
size="small"
@click.native.stop="deleteDialog(scope.row.id)"
>删除
</el-button
>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:limit.sync="filterQuery.limit"
:page.sync="filterQuery.page"
@pagination="getList"
></pagination>
</el-card>
<el-card>
<el-table v-loading="detailLoading" :data="detailList" style="width: 100%; margin-top: 10px;">
<el-table-column label="序号" type="index" width="50"></el-table-column>
<el-table-column label="条码" width="150" prop="code" show-overflow-tooltip></el-table-column>
<el-table-column width="200" label="产品通用名" prop="productName"></el-table-column>
<el-table-column width="150" label="规格型号" prop="ggxh" show-overflow-tooltip></el-table-column>
<el-table-column width="150" label="批次号" prop="batchNo"></el-table-column>
<el-table-column label="养护日期" prop="createTime" width="150"></el-table-column>
<el-table-column width="150" label="养护数量" prop="count"></el-table-column>
<el-table-column width="150" label="养护状态" prop="maintenanceStatus">
<template slot-scope="scope">
<el-radio disabled="true" v-model="scope.row.maStatus"
:label="0">未养护
</el-radio>
<el-radio disabled="true" v-model="scope.row.maStatus"
:label="1">已养护
</el-radio>
</template>
</el-table-column>
<el-table-column width="150" label="设备状态" prop="deviceStatus">
<template slot-scope="scope">
<el-radio v-model="scope.row.deviceStatus" :label="1" disabled="true">
正常
</el-radio>
<el-radio v-model="scope.row.deviceStatus" :label="0" disabled="true">
异常
</el-radio>
</template>
</el-table-column>
<el-table-column width="200" label="养护备注" prop="remark">
</el-table-column>
<el-table-column width="150" label="生产日期(yyMMdd)" prop="productionDate"></el-table-column>
<el-table-column width="160" label="失效日期(yyMMdd)" prop="expireDate"
show-overflow-tooltip></el-table-column>
<el-table-column width="250" label="注册/备案凭证号" prop="zczbhhzbapzbh"
show-overflow-tooltip></el-table-column>
<el-table-column width="200" label="生产厂家" prop="ylqxzcrbarmc"
show-overflow-tooltip></el-table-column>
</el-table>
<pagination
v-show="detailTotal>0"
:total="detailTotal"
:limit.sync="detailQuery.limit"
:page.sync="detailQuery.page"
@pagination="getList"
></pagination>
</el-card>
</div>
</template>
<script>
import {getInvListByUser} from "@/api/system/invWarehouse";
import {getInvSpaceList} from "@/api/inventory/invSpace";
import {getInvMAOrderList, deleteInvMAOrder, getInvMAOrderDetailList, updateStatus} from "@/api/inventory/invMAOrder";
export default {
name: "InvMAOrderAudit",
data() {
return {
filterQuery: {
orderId: null,
invCode: this.$store.getters.locInvCode,
invSpaceCode: null,
status: 1,
page: 1,
limit: 20,
},
list: [],
total: 0,
invList: [],
spaceList: [],
loading: false,
codeTableLoading: false,
statusMap: {
0: "草稿",
1: "未审核",
2: "已完成"
},
detailList: [],
detailLoading: false,
detailQuery: {
orderIdFk: null,
page: 1,
limit: 20,
},
detailTotal: 0
};
},
methods: {
onReset() {
this.$router.push({
path: "",
});
this.filterQuery = {
orderId: null,
invCode: this.$store.getters.locInvCode,
invSpaceCode: null,
status: 1,
page: 1,
limit: 20,
};
this.spaceList = [];
this.getList();
},
onSubmit() {
this.filterQuery.page = 1;
this.getList();
},
getList() {
this.loading = true;
this.detailList = [];
this.detailTotal = 0;
getInvMAOrderList(this.filterQuery).then((res) => {
this.loading = false;
if (res.code === 20000) {
this.list = res.data.list || [];
this.total = res.data.total || 0;
} else {
this.$message.error(res.message);
this.list = [];
this.total = 0;
}
}).catch((error) => {
this.loading = false;
this.$message.error(error.message);
this.list = [];
this.total = 0;
})
},
invChange() {
this.spaceList = [];
this.getSpaceList();
this.getList();
},
getInvList() {
getInvListByUser()
.then((response) => {
this.invList = response.data || [];
this.getSpaceList();
this.getList();
})
.catch(() => {
});
},
getSpaceList() {
let params = {invWarehouseCode: this.filterQuery.invCode};
getInvSpaceList(params).then((res) => {
this.spaceList = res.data.list || [];
})
},
auditOrder(row) {
this.$confirm('请选择审核意见', '提示', {
confirmButtonText: '通过',
cancelButtonText: '驳回',
type: 'warning',
center: true,
closeOnPressEscape: false,// ESC
closeOnClickModal: false,//
distinguishCancelAndClose: true,//
}).then(() => {
let params = {
id: row.id,
status: 2
};
updateStatus(params).then((res) => {
if (res.code === 20000) {
this.$message.success("审核通过!");
this.getList();
} else {
this.$message.error(res.message);
}
}).catch((error) => {
this.$message.error(error.message);
})
}).catch((action) => {
if (action === "cancel") {
let params = {
id: row.id,
status: 0
};
updateStatus(params).then((res) => {
if (res.code === 20000) {
this.$message.success("已驳回!")
this.getList();
} else {
this.$message.error(res.message);
}
}).catch((error) => {
this.$message.error(error.message);
});
} else {
return;
}
});
},
deleteDialog(rowId) {
this.$confirm('此操作将永久删除该养护记录, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
let params = {id: rowId};
this.loading = true;
deleteInvMAOrder(params).then((res) => {
this.loading = false;
if (res.code === 20000) {
this.$message.success("删除成功!");
this.getList();
} else {
this.$message.error(res.message);
}
}).catch(() => {
this.loading = false;
});
});
},
handleChange(row) {
this.detailQuery.orderIdFk = row.orderId;
this.detailQuery.page = 1;
this.getDetailList();
},
getDetailList() {
getInvMAOrderDetailList(this.detailQuery).then((res) => {
if (res.code === 20000) {
this.detailList = res.data.list || [];
this.detailTotal = res.data.total || 0;
} else {
this.detailList = [];
this.detailTotal = 0;
}
}).catch(() => {
this.detailList = [];
this.detailTotal = 0;
});
},
},
mounted() {
document.body.ondrop = function (event) {
event.preventDefault();
event.stopPropagation();
};
},
created() {
this.getInvList();
},
};
</script>
<style type="text/scss" lang="scss">
</style>

@ -0,0 +1,254 @@
<template>
<div>
<el-card class="el-card">
<el-form :model="filterQuery" class="query-form" size="mini" :inline="true">
<el-form-item class="query-form-item" label="养护记录号:">
<el-input v-model="filterQuery.orderId" placeholder="请输入养护记录号"
clearable="true"></el-input>
</el-form-item>
<el-form-item class="query-form-item" label="仓库:">
<el-select v-model="filterQuery.invCode" placeholder="请选择仓库" clearable="true"
@change="invChange"
>
<el-option
v-for="item in invList"
:key="item.name"
:label="item.name"
:value="item.code">
<span style="float: left">{{ item.name }}</span>
</el-option>
</el-select>
</el-form-item>
<el-form-item class="query-form-item" label="货位:">
<el-select v-model="filterQuery.invSpaceCode" placeholder="请选择货位" clearable="true"
>
<el-option
v-for="item in spaceList"
:key="item.name"
:label="item.name"
:value="item.code">
<span style="float: left">{{ item.name }}</span>
</el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button-group style="margin-left: 10px;display:flex;">
<el-button type="primary" icon="el-icon-refresh" @click="onReset"></el-button>
<el-button type="primary" icon="el-icon-search" @click="onSubmit"></el-button>
</el-button-group>
</el-form-item>
</el-form>
<el-table v-loading="loading" :data="list" style="width: 100%" highlight-current-row
@current-change="handleChange"
border>
<el-table-column label="序号" type="index"></el-table-column>
<el-table-column label="养护记录号" prop="orderId"></el-table-column>
<el-table-column label="仓库" prop="invName"></el-table-column>
<el-table-column label="货位" prop="invSpaceName"></el-table-column>
<el-table-column label="养护日期" prop="createTime"></el-table-column>
<el-table-column label="养护人" prop="createUserName"></el-table-column>
<el-table-column label="审核人" prop="auditUserName"></el-table-column>
<el-table-column label="状态" prop="status" show-overflow-tooltip width="120">
<template slot-scope="scope">
<el-tag>{{ statusMap[scope.row.status] }}</el-tag>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:limit.sync="filterQuery.limit"
:page.sync="filterQuery.page"
@pagination="getList"
></pagination>
</el-card>
<el-card>
<el-table v-loading="detailLoading" :data="detailList" style="width: 100%; margin-top: 10px;">
<el-table-column label="序号" type="index" width="50"></el-table-column>
<el-table-column label="条码" width="150" prop="code" show-overflow-tooltip></el-table-column>
<el-table-column width="200" label="产品通用名" prop="productName"></el-table-column>
<el-table-column width="150" label="规格型号" prop="ggxh" show-overflow-tooltip></el-table-column>
<el-table-column width="150" label="批次号" prop="batchNo"></el-table-column>
<el-table-column label="养护日期" prop="createTime" width="150"></el-table-column>
<el-table-column width="150" label="养护数量" prop="count"></el-table-column>
<el-table-column width="150" label="养护状态" prop="maintenanceStatus">
<template slot-scope="scope">
<el-radio disabled="true" v-model="scope.row.maStatus"
:label="0">未养护
</el-radio>
<el-radio disabled="true" v-model="scope.row.maStatus"
:label="1">已养护
</el-radio>
</template>
</el-table-column>
<el-table-column width="150" label="设备状态" prop="deviceStatus">
<template slot-scope="scope">
<el-radio v-model="scope.row.deviceStatus" :label="1" disabled="true">
正常
</el-radio>
<el-radio v-model="scope.row.deviceStatus" :label="0" disabled="true">
异常
</el-radio>
</template>
</el-table-column>
<el-table-column width="200" label="养护备注" prop="remark">
</el-table-column>
<el-table-column width="150" label="生产日期(yyMMdd)" prop="productionDate"></el-table-column>
<el-table-column width="160" label="失效日期(yyMMdd)" prop="expireDate"
show-overflow-tooltip></el-table-column>
<el-table-column width="250" label="注册/备案凭证号" prop="zczbhhzbapzbh"
show-overflow-tooltip></el-table-column>
<el-table-column width="200" label="生产厂家" prop="ylqxzcrbarmc"
show-overflow-tooltip></el-table-column>
</el-table>
<pagination
v-show="detailTotal>0"
:total="detailTotal"
:limit.sync="detailQuery.limit"
:page.sync="detailQuery.page"
@pagination="getList"
></pagination>
</el-card>
</div>
</template>
<script>
import {getInvListByUser} from "@/api/system/invWarehouse";
import {getInvSpaceList} from "@/api/inventory/invSpace";
import {getInvMAOrderList, getInvMAOrderDetailList} from "@/api/inventory/invMAOrder";
export default {
name: "InvMAOrderAudit",
data() {
return {
filterQuery: {
orderId: null,
invCode: this.$store.getters.locInvCode,
invSpaceCode: null,
status: 2,
page: 1,
limit: 20,
},
list: [],
total: 0,
invList: [],
spaceList: [],
loading: false,
codeTableLoading: false,
statusMap: {
0: "草稿",
1: "未审核",
2: "已完成"
},
detailList: [],
detailLoading: false,
detailQuery: {
orderIdFk: null,
page: 1,
limit: 20,
},
detailTotal: 0
};
},
methods: {
onReset() {
this.$router.push({
path: "",
});
this.filterQuery = {
orderId: null,
invCode: this.$store.getters.locInvCode,
invSpaceCode: null,
status: 2,
page: 1,
limit: 20,
};
this.spaceList = [];
this.getList();
},
onSubmit() {
this.filterQuery.page = 1;
this.getList();
},
getList() {
this.loading = true;
this.detailList = [];
this.detailTotal = 0;
getInvMAOrderList(this.filterQuery).then((res) => {
this.loading = false;
if (res.code === 20000) {
this.list = res.data.list || [];
this.total = res.data.total || 0;
} else {
this.$message.error(res.message);
this.list = [];
this.total = 0;
}
}).catch((error) => {
this.loading = false;
this.$message.error(error.message);
this.list = [];
this.total = 0;
})
},
invChange() {
this.spaceList = [];
this.getSpaceList();
this.getList();
},
getInvList() {
getInvListByUser()
.then((response) => {
this.invList = response.data || [];
this.getSpaceList();
this.getList();
})
.catch(() => {
});
},
getSpaceList() {
let params = {invWarehouseCode: this.filterQuery.invCode};
getInvSpaceList(params).then((res) => {
this.spaceList = res.data.list || [];
})
},
handleChange(row) {
this.detailQuery.orderIdFk = row.orderId;
this.detailQuery.page = 1;
this.getDetailList();
},
getDetailList() {
getInvMAOrderDetailList(this.detailQuery).then((res) => {
if (res.code === 20000) {
this.detailList = res.data.list || [];
this.detailTotal = res.data.total || 0;
} else {
this.detailList = [];
this.detailTotal = 0;
}
}).catch(() => {
this.detailList = [];
this.detailTotal = 0;
});
},
},
mounted() {
document.body.ondrop = function (event) {
event.preventDefault();
event.stopPropagation();
};
},
created() {
this.getInvList();
},
};
</script>
<style type="text/scss" lang="scss">
</style>

@ -0,0 +1,272 @@
<template>
<div>
<el-card class="el-card">
<el-form :model="filterQuery" class="query-form" size="mini" :inline="true">
<el-form-item class="query-form-item" label="养护记录号:">
<el-input v-model="filterQuery.orderId" placeholder="请输入养护记录号"
clearable="true"></el-input>
</el-form-item>
<el-form-item class="query-form-item" label="仓库:">
<el-select v-model="filterQuery.invCode" placeholder="请选择仓库" clearable="true"
@change="invChange"
>
<el-option
v-for="item in invList"
:key="item.name"
:label="item.name"
:value="item.code">
<span style="float: left">{{ item.name }}</span>
</el-option>
</el-select>
</el-form-item>
<el-form-item class="query-form-item" label="货位:">
<el-select v-model="filterQuery.invSpaceCode" placeholder="请选择货位" clearable="true"
>
<el-option
v-for="item in spaceList"
:key="item.name"
:label="item.name"
:value="item.code">
<span style="float: left">{{ item.name }}</span>
</el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button-group style="margin-left: 10px;display:flex;">
<el-button type="primary" icon="el-icon-refresh" @click="onReset"></el-button>
<el-button type="primary" icon="el-icon-search" @click="onSubmit"></el-button>
<el-button type="primary" icon="el-icon-plus" @click="addMAOrder"></el-button>
</el-button-group>
</el-form-item>
</el-form>
<el-table v-loading="loading" :data="list" style="width: 100%" highlight-current-row
border>
<el-table-column label="序号" type="index"></el-table-column>
<el-table-column label="养护记录号" prop="orderId" ></el-table-column>
<el-table-column label="仓库" prop="invName" ></el-table-column>
<el-table-column label="货位" prop="invSpaceName" ></el-table-column>
<el-table-column label="养护日期" prop="createTime" ></el-table-column>
<el-table-column label="养护人" prop="createUserName"></el-table-column>
<el-table-column label="状态" prop="status" show-overflow-tooltip width="120">
<template slot-scope="scope">
<el-tag>{{ statusMap[scope.row.status] }}</el-tag>
</template>
</el-table-column>
<el-table-column label="操作" >
<template slot-scope="scope">
<el-button
type="text"
size="small"
@click.native.stop="editOrder(scope.row)"
>编辑
</el-button
>
<el-button
type="text"
size="small"
@click.native.stop="submitAudit(scope.row)"
>提交审核
</el-button
>
<el-button
type="text"
size="small"
@click.native.stop="deleteDialog(scope.row.id)"
>删除
</el-button
>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:limit.sync="filterQuery.limit"
:page.sync="filterQuery.page"
@pagination="getList"
></pagination>
</el-card>
<el-dialog
:title="formMap[formName]"
:visible.sync="formVisible"
:close-on-click-modal="false"
:close-on-press-escape="false"
width="85%"
v-if="formVisible"
>
<addInvMAOrder
:maOrder="maOrder"
:closeDialog="closeDialog"
></addInvMAOrder>
</el-dialog>
</div>
</template>
<script>
import {getInvListByUser} from "@/api/system/invWarehouse";
import {getInvSpaceList} from "@/api/inventory/invSpace";
import {getInvMAOrderList, deleteInvMAOrder, submitAudit} from "@/api/inventory/invMAOrder";
import addInvMAOrder from "@/views/inventory/addInvMAOrder.vue";
export default {
name: "InvMAOrderNew",
data() {
return {
filterQuery: {
orderId: null,
invCode: this.$store.getters.locInvCode,
invSpaceCode: null,
status: 0,
page: 1,
limit: 20,
},
list: [],
total: 0,
invList: [],
spaceList: [],
loading: false,
formVisible: false,
codeTableLoading: false,
statusMap: {
0: "草稿",
1: "未审核",
2: "已完成"
},
formName: null,
formMap: {
add: "新增养护记录",
edit: "编辑养护记录"
},
maOrder: {},
};
},
methods: {
onReset() {
this.$router.push({
path: "",
});
this.filterQuery = {
orderId: null,
invCode: this.$store.getters.locInvCode,
invSpaceCode: null,
status: 0,
page: 1,
limit: 20,
};
this.spaceList = [];
this.getList();
},
onSubmit() {
this.filterQuery.page = 1;
this.getList();
},
getList() {
this.loading = true;
getInvMAOrderList(this.filterQuery).then((res) => {
this.loading = false;
if (res.code === 20000) {
this.list = res.data.list || [];
this.total = res.data.total || 0;
} else {
this.$message.error(res.message);
this.list = [];
this.total = 0;
}
}).catch((error) => {
this.loading = false;
this.$message.error(error.message);
this.list = [];
this.total = 0;
})
},
invChange() {
this.spaceList = [];
this.getSpaceList();
this.getList();
},
getInvList() {
getInvListByUser()
.then((response) => {
this.invList = response.data || [];
this.getSpaceList();
this.getList();
})
.catch(() => {
});
},
getSpaceList() {
let params = {invWarehouseCode: this.filterQuery.invCode};
getInvSpaceList(params).then((res) => {
this.spaceList = res.data.list || [];
})
},
addMAOrder() {
this.formVisible = true;
this.formName = 'add';
this.maOrder = {};
},
editOrder(row) {
this.formVisible = true;
this.formName = 'edit';
this.maOrder = row;
},
submitAudit(row) {
let params = {id: row.id};
submitAudit(params).then((res) => {
if (res.code === 20000) {
this.$message.success("提交成功!");
this.getList();
} else {
this.$message.error(res.message);
}
}).catch((error) => {
this.$message.error(error.message);
});
},
deleteDialog(rowId) {
this.$confirm('此操作将永久删除该养护记录, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
let params = {id: rowId};
this.loading = true;
deleteInvMAOrder(params).then((res) => {
this.loading = false;
if (res.code === 20000) {
this.$message.success("删除成功!");
this.getList();
} else {
this.$message.error(res.message);
}
}).catch(() => {
this.loading = false;
});
});
},
closeDialog() {
this.formVisible = false;
this.getList();
},
},
components: {
addInvMAOrder
},
mounted() {
document.body.ondrop = function (event) {
event.preventDefault();
event.stopPropagation();
};
},
created() {
this.getInvList();
},
};
</script>
<style type="text/scss" lang="scss">
</style>

@ -0,0 +1,562 @@
<template>
<div>
<el-card style="margin: 5px;margin-top: -20px">
<el-form :model="formData" ref="dataForm" label-width="100px" style="margin-bottom: -15px">
<el-button-group style="display: flex;margin: 0px 0 10px 80%; height: 35px">
<el-button
type="primary"
:disabled="this.detailList.length > 0"
@click.native="selectInvProduct()"
>录入产品
</el-button>
<el-button
type="primary"
@click.native="saveMAOrder()"
>保存
</el-button>
</el-button-group>
<el-row>
<el-col :span="10">
<el-form-item class="query-form-item" label="养护记录号:">
<el-input v-model="formData.orderId"
auto-complete="off"
:disabled="true"
style="width: 90%"
clearable
></el-input>
</el-form-item>
</el-col>
<el-col :span="10">
<el-form-item class="query-form-item" label="养护日期:">
<el-input v-model="formData.createTime"
auto-complete="off"
:disabled="true"
style="width: 90%"
clearable
></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="10">
<el-form-item class="query-form-item" label="养护仓库:">
<el-select v-model="formData.invCode" placeholder="养护仓库信息"
:disabled="detailList.length >0 "
@change="invChange"
style="width: 90%;"
clearable>
<el-option
v-for="item in warehouseList"
:key="item.name"
:label="item.name"
:value="item.code">
<span style="float: left">{{ item.name }}</span>
<span style="float: right; color: #8492a6; font-size: 13px">{{ item.parentName }}</span>
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="10">
<el-form-item class="query-form-item" label="养护货位">
<el-select v-model="formData.invSpaceCode" placeholder="养护货位信息"
:disabled="detailList.length >0 "
style="width: 90%"
clearable>
<el-option
v-for="item in spaceList"
:key="item.name"
:label="item.name"
:value="item.code">
<span style="float: left">{{ item.name }}</span>
<span style="float: right; color: #8492a6; font-size: 13px">{{ item.code }}</span>
</el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="18">
<el-form-item class="query-form-item" label="扫码录入:">
<el-input
id="inputer"
@focus="getInputFocus($event)"
@keypress.enter.native="enterKey($event)"
ref='inputRef'
style="ime-mode:disabled"
type="tel"
v-model="formData.code"
></el-input>
</el-form-item>
</el-col>
<el-col :span="2">
<el-button
type="primary"
size="mini"
@click.native.stop="addCode()"
style="margin-left: 15px"
>添加
</el-button>
</el-col>
</el-row>
<el-table v-loading="loading" :data="detailList" style="width: 100%;margin-top: 20px;"
highlight-current-row
border max-height="300" height="300">
<el-table-column label="序号" type="index" width="50"></el-table-column>
<el-table-column label="条码" width="180" prop="code" show-overflow-tooltip></el-table-column>
<el-table-column width="150"
label="产品通用名"
prop="productName"
show-overflow-tooltip
></el-table-column>
<el-table-column width="150" label="规格型号" prop="ggxh" show-overflow-tooltip></el-table-column>
<el-table-column width="150" label="批次号" prop="batchNo"></el-table-column>
<el-table-column width="150" label="养护数量" prop="count"></el-table-column>
<el-table-column width="150" label="养护状态" prop="maintenanceStatus">
<template slot-scope="scope">
<el-radio :disabled="scope.$index !== currentIndex" v-model="scope.row.maStatus"
:label="0">未养护
</el-radio>
<el-radio :disabled="scope.$index !== currentIndex" v-model="scope.row.maStatus"
:label="1">已养护
</el-radio>
</template>
</el-table-column>
<el-table-column width="150" label="设备状态" prop="deviceStatus">
<template slot-scope="scope">
<el-radio :disabled="scope.$index !== currentIndex" v-model="scope.row.deviceStatus" :label="1">
正常
</el-radio>
<el-radio :disabled="scope.$index !== currentIndex" v-model="scope.row.deviceStatus" :label="0">
异常
</el-radio>
</template>
</el-table-column>
<el-table-column width="200" label="养护备注" prop="remark">
<template slot-scope="scope">
<el-input :disabled="scope.$index !== currentIndex" v-model="scope.row.remark"></el-input>
</template>
</el-table-column>
<el-table-column label="生产日期(yyMMdd)" prop="produceDate"></el-table-column>
<el-table-column label="失效日期(yyMMdd)" prop="expireDate"
show-overflow-tooltip></el-table-column>
<el-table-column label="注册/备案凭证号" prop="zczbhhzbapzbh"
show-overflow-tooltip></el-table-column>
<el-table-column label="生产厂家" prop="ylqxzcrbarmc"
show-overflow-tooltip></el-table-column>
<el-table-column label="操作" >
<template slot-scope="scope">
<el-button
type="text"
size="small"
@click.stop="true"
@click.native="editOrderDetail(scope.$index, scope.row)"
>编辑
</el-button
>
<el-button
type="text"
size="small"
@click.stop="true"
@click.native="updateOrderDetail(scope.row)"
>保存
</el-button
>
<el-button
type="text"
size="small"
@click.stop="true"
@click.native="deleteOrderDetail(scope.$index, scope.row)"
>减一
</el-button
>
</template>
</el-table-column>
</el-table>
</el-form>
</el-card>
<el-dialog
title="库存产品录入"
:visible.sync="selectInvProductVisible"
:close-on-click-modal="false"
:close-on-press-escape="false"
width="85%"
v-if="selectInvProductVisible"
:append-to-body='true'
>
<el-form :inline="true" :model="filterQuery" size="mini">
<el-row>
<el-form-item class="query-form-item">
<el-input v-model="filterQuery.nameCode" placeholder="产品标识DI" clearable></el-input>
</el-form-item>
<el-form-item class="query-form-item">
<el-input v-model="filterQuery.cpmctymc" placeholder="产品名称" clearable></el-input>
</el-form-item>
<el-form-item class="query-form-item">
<el-input v-model="filterQuery.batchNo" placeholder="批次号" clearable></el-input>
</el-form-item>
<el-form-item>
<el-button-group>
<el-button type="primary" icon="el-icon-refresh" @click="onReset"></el-button>
<el-button type="primary" icon="search" @click="queryInvProductsList"
>查询
</el-button
>
<el-button type="primary" icon="search" @click="combine"></el-button>
</el-button-group>
</el-form-item>
</el-row>
</el-form>
<el-table v-loading="loading" :data="productList" style="width: 100%"
highlight-current-row="false"
:row-key="getRowKeys"
@selection-change="handleSelectionChange"
ref="multipleTable">
<el-table-column
type="selection"
:reserve-selection="true"
width="55">
</el-table-column>
<el-table-column label="序号" type="index"></el-table-column>
<el-table-column label="产品标识" prop="nameCode"></el-table-column>
<el-table-column label="产品名称" prop="cpmctymc"></el-table-column>
<el-table-column label="规格型号" prop="ggxh"></el-table-column>
<el-table-column label="批次号" prop="batchNo"></el-table-column>
<el-table-column label="生产日期" prop="productionDate" width="120"></el-table-column>
<el-table-column label="失效日期" prop="expireDate" width="120"></el-table-column>
</el-table>
<pagination
v-show="productTotal>0"
:total="productTotal"
:limit.sync="filterQuery.limit"
:page.sync="filterQuery.page"
@pagination="getList"
></pagination>
</el-dialog>
</div>
</template>
<script>
import {getInvListByUser} from "@/api/system/invWarehouse";
import {getInvSpaceList} from "@/api/inventory/invSpace";
import {
addInvMAOrder,
addInvMAOrderDetail,
batchAddDetail,
updateInvMAOrderDetail,
updateInvMAOrder,
deleteInvMAOrderDetail,
getInvMAOrderDetailList
} from "@/api/inventory/invMAOrder";
import {getInvMAProducts} from "@/api/inventory/invPorduct";
import {isBlank} from "@/utils/strUtil";
export default {
props: {
maOrder: {
type: Object,
required: true,
},
closeDialog: {
type: Function,
required: true,
},
},
data() {
return {
filterQuery: {
nameCode: null,
cpmctymc: null,
batchNo: null,
invCode: null,
invSpaceCode: null,
page: 1,
limit: 10
},
productList: [],
productTotal: 0,
warehouseList: [],
spaceList: [],
formData: {
orderId: null,
createTime: null,
invCode: null,
invSpaceCode: null,
status: 0,
code: null,
},
detailList: [],
loading: false,
scanText: "扫码录入:",
currentIndex: -1,
selectInvProductVisible: false,
multiProduct: []
}
},
methods: {
getInvList() {
getInvListByUser().then((res) => {
if (res.code === 20000) {
this.warehouseList = res.data || [];
if (!isBlank(this.maOrder.invSpaceCode)) {
this.invChange();
this.formData.invSpaceCode = this.maOrder.invSpaceCode;
}
}
});
},
invChange() {
this.formData.invSpaceCode = null;
this.spaceList = [];
let params = {invWarehouseCode: this.formData.invCode};
getInvSpaceList(params).then((res) => {
this.spaceList = res.data.list || [];
});
},
selectInvProduct() {
if (isBlank(this.formData.invCode)) {
this.$message.error("请选择养护仓库");
return;
}
//
this.saveOrder();
this.onReset();
this.selectInvProductVisible = true;
},
saveMAOrder() {
this.saveOrder();
this.closeDialog();
},
saveOrder(code) {
if (isBlank(this.formData.invCode)) {
this.$message.warning("请选择养护仓库!");
return;
}
if (!isBlank(this.formData.orderId)) {
//
updateInvMAOrder(this.formData).then((res) => {
if (!isBlank(this.formData.code)) {
//
let params = {
orderIdFk: this.formData.orderId,
code: this.formData.code
}
addInvMAOrderDetail(params).then((res) => {
if (res.code === 20000) {
this.$message.success("添加成功!");
this.getList();
} else {
this.$message.error(res.message);
}
});
}
}).catch((error) => {
this.$message.error("更新单据信息失败!");
})
} else {
addInvMAOrder(this.formData).then((res) => {
if (res.code === 20000) {
this.formData.orderId = res.data.orderId;
this.formData.createTime = res.data.createTime;
if (!isBlank(code)) {
//
let params = {
orderIdFk: this.formData.orderId,
code: this.formData.code
}
addInvMAOrderDetail(params).then((res) => {
if (res.code === 20000) {
this.$message.success("添加成功!");
this.getList();
} else {
this.$message.error(res.message);
}
});
}
} else {
this.$message.error(res.message);
}
});
}
},
getInputFocus(event) {
event.currentTarget.select();
},
enterKey(event) {
this.addCode();
this.$refs.inputRef.focus();
this.$refs.inputRef.select();
},
addCode() {
if (isBlank(this.formData.invCode)) {
this.$message.warning("请先选择养护仓库!");
return;
}
if (isBlank(this.formData.code)) {
this.$message.error("请输入或扫描条码!")
return;
}
if (isBlank(this.formData.orderId)) {
this.saveOrder(this.formData.code);
return;
}
if (this.detailList.length === 0) {
this.saveOrder();
} else {
//
let params = {
orderIdFk: this.formData.orderId,
code: this.formData.code
};
addInvMAOrderDetail(params).then((res) => {
if (res.code === 20000) {
this.$message.success("添加成功!");
this.getList();
} else {
this.$message.error(res.message);
}
});
}
},
deleteOrderDetail(index, row) {
if (row.count === 1) {
this.$confirm('此产品养护数量为1减一后将删除此产品养护记录是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
let params = {id: row.id};
deleteInvMAOrderDetail(params).then((res) => {
if (res.code === 20000) {
this.$message.success("删除成功");
this.getList();
}
})
}).catch(() => {
});
} else {
let params = {id: row.id};
deleteInvMAOrderDetail(params).then((res) => {
if (res.code === 20000) {
this.$message.success("删除成功");
this.getList();
}
})
}
},
getList() {
let params = {orderIdFk: this.formData.orderId};
getInvMAOrderDetailList(params).then((res) => {
if (res.code === 20000) {
this.detailList = res.data.list || [];
}
})
},
updateOrderDetail(row) {
updateInvMAOrderDetail(row).then((res) => {
if (res.code === 20000) {
this.$message.success("保存成功!")
this.getList();
}
})
},
editOrderDetail(index, row) {
this.currentIndex = index;
},
onReset() {
this.filterQuery = {
nameCode: null,
cpmctymc: null,
batchNo: null,
invCode: null,
invSpaceCode: null,
page: 1,
limit: 10
};
this.multiProduct = [];
this.queryInvProducts();
},
handleCurrentChange(val) {
this.filterQuery.page = val;
this.queryInvProducts();
},
queryInvProductsList() {
this.filterQuery.page = 1;
this.queryInvProducts();
},
queryInvProducts() {
this.filterQuery.invCode = this.formData.invCode;
this.filterQuery.invSpaceCode = this.formData.invSpaceCode;
getInvMAProducts(this.filterQuery).then((res) => {
if (res.code === 20000) {
this.productList = res.data.list || [];
this.productTotal = res.data.total || 0;
} else {
this.$message.error(res.message);
this.productList = [];
this.productTotal = 0;
}
}).catch((error) => {
this.$message.error(error.message);
this.productList = [];
this.productTotal = 0;
});
},
combine() {
if (this.multiProduct.length === 0) {
this.$message.error("请选择养护产品!");
return;
}
let invProductIds = [];
this.multiProduct.forEach(item => {
invProductIds.push(item.id);
});
let params = {
orderIdFk: this.formData.orderId,
invProductIds: invProductIds
};
batchAddDetail(params).then((res) => {
if (res.code === 20000) {
this.$message.success("录入成功!");
this.selectInvProductVisible = false;
this.getList();
} else {
this.$message.error(res.message);
}
}).catch((error) => {
this.$message.error(error.message);
})
},
getRowKeys(row) {
return row.id;
},
handleSelectionChange(selectedRows) {
this.multiProduct = [];
selectedRows.forEach(item => {
this.multiProduct.push(item);
});
},
},
created() {
this.getInvList();
if (null !== this.maOrder) {
this.formData.orderId = this.maOrder.orderId;
this.formData.createTime = this.maOrder.createTime;
this.formData.invCode = this.maOrder.invWarehouseCode;
this.getList();
}
},
};
</script>
Loading…
Cancel
Save