You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
spms-vue/src/views/basic/UdiInfoselectErpUdi.vue

596 lines
23 KiB
Vue

3 years ago
<template>
<div>
<el-card class="el-card">
<div>
<el-form :inline="true" :model="erpQuery" style="display: flex;" size="mini">
<el-row>
<el-form-item class="query-form-item">
<el-input
v-model="erpQuery.code"
placeholder="产品编码/商品条码/医保编码" clearable="true"
@keyup.enter.native="keyupErp_submit($event)"
></el-input>
</el-form-item>
<el-form-item class="query-form-item">
<el-input
v-model="erpQuery.name"
placeholder="产品名称" clearable="true"
@keyup.enter.native="keyup_submit($event)"
></el-input>
</el-form-item>
<el-form-item class="query-form-item">
<el-input
v-model="erpQuery.spec"
placeholder="规格型号" clearable="true"
@keyup.enter.native="keyupErp_submit($event)"
></el-input>
</el-form-item>
<el-form-item class="query-form-item">
<el-input
v-model="erpQuery.registerNo" clearable="true"
placeholder="注册/备案凭证号"
@keyup.enter.native="keyup_submit($event)"
></el-input>
</el-form-item>
<el-form-item class="query-form-item">
<el-input
v-model="erpQuery.manufactory" clearable="true"
placeholder="生产厂家"
@keyup.enter.native="keyup_submit($event)"
></el-input>
</el-form-item>
<el-form-item class="query-form-item">
<el-input
v-model="erpQuery.supName" clearable="true"
placeholder="配送企业"
@keyup.enter.native="keyup_submit($event)"
></el-input>
</el-form-item>
3 years ago
<el-form-item class="query-form-item">
<el-select v-model="thirdSysFk" placeholder="请设置主系统" disabled="isImport">
<el-option
v-for="item in thirdSys"
:key="item.value"
:label="item.thirdName"
:value="item.thirdId">
<span style="float: left">{{ item.thirdName }}</span>
<span
style="float: right; color: #8492a6; font-size: 13px">{{ item.thirdId }}</span>
</el-option>
</el-select>
</el-form-item>
<el-form-item style="display: flex">
<el-button-group>
<el-button type="primary" icon="search" @click="searchErpList"></el-button>
<el-button type="primary" icon="search" @click="combine" :loading="combineLoading"
>选入
</el-button
>
3 years ago
<el-button type="primary" icon="search" @click="combineAll"
v-if="isImport && !supEnable"
3 years ago
>结果全部选入
</el-button
>
</el-button-group>
</el-form-item>
</el-row>
</el-form>
<el-table
:data="erpList"
style="width: 100%"
highlight-current-row="true"
v-loading="erpLloading"
@current-change="handleErpChange"
@selection-change="handleSelectionChange"
>
<el-table-column
v-if="isImport"
type="selection"
width="55"
></el-table-column>
<el-table-column label="序号" type="index"></el-table-column>
<el-table-column label="产品编码" prop="code"></el-table-column>
<el-table-column label="产品名称" prop="name"></el-table-column>
<el-table-column label="计量单位" prop="measname"></el-table-column>
<el-table-column label="规格型号" prop="spec"></el-table-column>
<el-table-column label="注册/备案凭证号" prop="registerNo"></el-table-column>
<el-table-column label="生产厂家" prop="manufactory"></el-table-column>
<el-table-column label="配送企业" prop="supName"></el-table-column>
3 years ago
</el-table>
<el-pagination
:page-size="erpQuery.limit"
@current-change="handleErpPageChange"
layout="prev, pager, next"
:total="pageTotal"
></el-pagination>
</div>
</el-card>
<el-card class="el-card" v-if="!isImport">
<div v-if="!isImport" style="margin-bottom: 20px">
<el-row :gutter="20" class="el-row" type="flex">
<el-col :span="12" class="el-col">
<div class="text item">
<div class="itemTag">
<span>产品名称:&nbsp;</span>
</div>
<el-input
style="width: 65%"
size="small"
splaceholder="请输入内容"
:disabled="true"
v-model="data.cpmctymc"
></el-input>
</div>
</el-col>
<el-col :span="12" class="el-col">
<div class="text item">
<div class="itemTag">
<span>产品标识:&nbsp;</span>
</div>
<el-input
style="width: 65%"
:disabled="true"
size="small"
splaceholder="请输入内容"
v-model="data.nameCode"
></el-input>
</div>
</el-col>
</el-row>
<el-row :gutter="20" class="el-row" type="flex">
<el-col :span="12" class="el-col">
<div class="text item">
<div class="itemTag">
<span>规格型号:&nbsp;</span>
</div>
<el-input
style="width: 65%"
:disabled="true"
size="small"
splaceholder="请输入内容"
v-model="data.ggxh"
></el-input>
</div>
</el-col>
<el-col :span="12" class="el-col">
<div class="text item">
<div class="itemTag">
<span>医疗器械注册人:&nbsp;</span>
</div>
<el-input
style="width: 65%"
:disabled="true"
size="small"
splaceholder="ylqxzcrbarmc"
v-model="data.ylqxzcrbarmc"
></el-input>
</div>
</el-col>
</el-row>
<el-row :gutter="20" class="el-row" type="flex">
<el-col :span="12" class="el-col">
<div class="text item">
<div class="itemTag">
<span>注册人英文名称:&nbsp;</span>
</div>
<el-input
style="width: 65%"
:disabled="true"
size="small"
splaceholder="请输入内容"
v-model="data.ylqxzcrbarywmc"
></el-input>
</div>
</el-col>
<el-col :span="12" class="el-col">
<div class="text item">
<div class="itemTag">
<span>器械类别:&nbsp;</span>
</div>
<el-input
style="width: 65%"
:disabled="true"
size="small"
splaceholder="请输入内容"
v-model="data.qxlb"
></el-input>
</div>
</el-col>
</el-row>
<el-row :gutter="20" class="el-row" type="flex">
<el-col :span="12" class="el-col">
<div class="text item">
<div class="itemTag">
<span>产品类别:&nbsp;</span>
</div>
<el-input
style="width: 65%"
:disabled="true"
size="small"
splaceholder="请输入内容"
v-model="data.cplb"
></el-input>
</div>
</el-col>
<el-col :span="12" class="el-col">
<div class="text item">
<div class="itemTag">
<span>分类编码:&nbsp;</span>
</div>
<el-input
style="width: 65%"
:disabled="true"
size="small"
splaceholder="请输入内容"
v-model="data.flbm"
></el-input>
</div>
</el-col>
</el-row>
<el-row :gutter="20" class="el-row" type="flex">
<el-col :span="12" class="el-col">
<div class="text item">
<div class="itemTag">
<span>商品条码:&nbsp;</span>
</div>
<el-input
style="width: 65%"
:disabled="true"
size="small"
splaceholder="请输入内容"
v-model="data.sptm"
></el-input>
</div>
</el-col>
<el-col :span="12" class="el-col">
<div class="text item">
<div class="itemTag">
<span>医保编码:&nbsp;</span>
</div>
<el-input
style="width: 65%"
:disabled="true"
size="small"
splaceholder="请输入内容"
v-model="data.ybbm"
></el-input>
</div>
</el-col>
</el-row>
<el-row :gutter="20" class="el-row" type="flex">
<el-col :span="12" class="el-col">
<div class="text item">
<div class="itemTag">
<span>统一社会信用号:&nbsp;</span>
</div>
<el-input
style="width: 65%"
:disabled="true"
size="small"
splaceholder="请输入内容"
v-model="data.tyshxydm"
></el-input>
</div>
</el-col>
<el-col :span="12" class="el-col">
<div class="text item">
<div class="itemTag">
<span>注册证/备案号:&nbsp;</span>
</div>
<el-input
style="width: 65%"
:disabled="true"
size="small"
splaceholder="请输入内容"
v-model="data.zczbhhzbapzbh"
></el-input>
</div>
</el-col>
</el-row>
</div>
</el-card>
</div>
</template>
<script>
3 years ago
import {modifyRel, addErp, addAllErp} from "../../api/basic/udiRelevance";
import {getInvbasdoc} from "../../api/basic/getErps";
import {getBasicThirdSys} from "../../api/basic/basicThirdSys";
export default {
name: "closeDialog",
props: {
uuid: {
type: Object,
required: true,
},
3 years ago
3 years ago
data: {
type: Object,
required: true,
},
3 years ago
3 years ago
relId: {
type: Number,
required: true,
},
3 years ago
3 years ago
isImport: {
type: Boolean,
required: true,
3 years ago
},
3 years ago
closeDialog: {
type: Function,
required: true,
3 years ago
},
3 years ago
defaultSys: {
type: Object,
required: true,
},
supEnable: {
type: Object,
required: true,
}
},
data() {
return {
erpQuery: {
code: null,
name: null,
spec: null,
registerNo: null,
manufactory: null,
thirdSys: null,
supName: null,
page: 1,
limit: 10,
3 years ago
},
3 years ago
combineLoading: false,
combineQuery: {
thirdId: "",
relId: "",
erpName: "",
keys: [],
thirdIds: [],
thirdSys: null,
query: null,
isRlInv: null,
3 years ago
},
3 years ago
udidlList: [],
erpList: [],
pageTotal: 1,
total: 1,
currentRow: null,
loading: false,
erpLloading: false,
multipleUdiSelection: [],
thirdSys: [],
thirdSysFk: null,
};
},
methods: {
tableRowClassName({row}) {
if (row.checked) return "warning-row";
return "";
},
checkSelectable(row) {
return !row.checked;
},
handleCurrentChange(val) {
this.unionQuery.page = val;
this.getList();
},
handleErpChange(val) {
console.log(val);
this.currentRow = val;
},
handleErpPageChange(val) {
this.erpQuery.page = val;
this.getErpList();
},
3 years ago
3 years ago
searchErpList() {
this.erpQuery.page = 1;
this.getErpList();
},
3 years ago
3 years ago
keyup_submit(event) {
this.erpQuery.page = 1;
this.getErpList();
event.target.select();
},
getErpList() {
this.erplLoading = true;
this.erpQuery.thirdSys = this.thirdSysFk;
getInvbasdoc(this.erpQuery)
.then((response) => {
this.erplLoading = false;
if (response.code == 20000) {
this.erpList = response.data.list || [];
this.pageTotal = response.data.total || 0;
} else {
this.$message.error(response.message);
3 years ago
this.erpList = [];
this.pageTotal = 0;
3 years ago
}
})
.catch(() => {
this.erplLoading = false;
this.erpList = [];
this.pageTotal = 0;
});
},
intentBack() {
this.closeDialog();
},
combineAll() {
this.$confirm("此操作将在后台自动下载所有查询结果, 是否继续?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
this.combineQuery.thirdSys = this.thirdSysFk;
this.combineQuery.query = this.erpQuery;
addAllErp(this.combineQuery)
.then((response) => {
if (response.code == 20000) {
this.$message.success(response.data);
this.$emit("closeUdi", true);
} else {
this.$message.error(response.message);
this.$emit("closeUdi", false);
}
})
.catch(() => {
this.$emit("closeUdi", false);
});
})
.catch(() => {
});
3 years ago
3 years ago
},
3 years ago
3 years ago
combine() {
this.combineQuery.query = null;
this.combineQuery.relId = this.relId;
this.combineQuery.thirdSys = this.thirdSysFk;
this.combineQuery.supEnable = this.supEnable;
if (this.isImport) {
this.combineQuery.thirdId = null;
let selectData = this.multipleUdiSelection;
let selected = '';
selectData.forEach((row) => {
if (row.checked) {
selected = selected + row.code + ",";
}
this.combineQuery.thirdIds.push(row.code);
});
// if (selected != null) {
// this.$message.warning("产品编码:" + selected.code + "已被选入");
// return;
// }
this.$confirm("产品编码:" + selected + "已被添加,是否继续添加", "提示", {
3 years ago
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
3 years ago
this.combineLoading = true;
addErp(this.combineQuery)
3 years ago
.then((response) => {
3 years ago
this.combineLoading = false;
3 years ago
if (response.code == 20000) {
this.$emit("closeUdi", true);
3 years ago
this.$message.success(response.data);
3 years ago
} else {
this.$emit("closeUdi", false);
3 years ago
this.$message.warning(response.message);
// let msgs= response.message.split(";");
// for(let i = 0;i<msgs.length;i++){
// this.$message.warning(msgs[i]);
// }
3 years ago
}
})
.catch(() => {
3 years ago
this.combineLoading = false;
3 years ago
this.$emit("closeUdi", false);
});
})
.catch(() => {
});
3 years ago
} else {
this.combineQuery.thirdId = this.currentRow.code;
this.combineQuery.erpName = this.currentRow.name;
if (this.currentRow.checked) {
this.$message.warning("产品编码:" + this.currentRow.code + "已被选入");
return;
3 years ago
}
3 years ago
this.combineLoading = true;
modifyRel(this.combineQuery)
3 years ago
.then((response) => {
3 years ago
this.combineLoading = false;
if (response.code == 20000) {
this.$emit("closeUdi", true);
} else {
this.$emit("closeUdi", false);
3 years ago
}
})
.catch(() => {
3 years ago
this.combineLoading = false;
this.$emit("closeUdi", false);
3 years ago
});
3 years ago
}
3 years ago
},
3 years ago
handleSelectionChange(val) {
console.log("----" + val);
this.multipleUdiSelection = val;
},
getBasicThirdSys() {
let query = {
enabled: true,
mainSys: false,
filter: true,
};
if (this.isImport) {
query.mainSys = true;
}
getBasicThirdSys(query)
.then((response) => {
this.thirdSys = response.data.list || [];
this.thirdSysFk = this.thirdSys[0].thirdId;
if (this.defaultSys != null) {
this.thirdSysFk = this.defaultSys;
}
})
.catch(() => {
this.loading = false;
this.list = [];
});
3 years ago
},
3 years ago
},
created() {
console.log("-------------" + this.uuid);
this.getBasicThirdSys();
},
};
3 years ago
</script>
<style scoped>
3 years ago
div /deep/ .el-table .warning-row {
background: #bebebe;
}
3 years ago
3 years ago
div /deep/ .el-table .success-row {
background: #ffffff;
}
3 years ago
</style>