Browse Source

excle报表导入

master
mch 2 years ago
parent
commit
6580a3cdec
  1. 7
      src/views/Home.vue
  2. 8
      src/views/basic-dictionary/ResultStatus.vue
  3. 326
      src/views/doctorCheck/personnelBatch.vue
  4. 2
      src/views/login/Login.vue

7
src/views/Home.vue

@ -164,6 +164,9 @@
<el-dropdown-item command="patientRegisterRefuse"
>弃检登记</el-dropdown-item
>
<el-dropdown-item command="personnelBatch"
>人员批量登记</el-dropdown-item
>
</el-dropdown-menu>
</el-dropdown>
</div>
@ -178,9 +181,7 @@
<el-dropdown-item command="sumDoctorCheck"
>总检医生诊台</el-dropdown-item
>
<el-dropdown-item command="personnelBatch"
>人员预约登记</el-dropdown-item
>
</el-dropdown-menu>
</el-dropdown>
</div>

8
src/views/basic-dictionary/ResultStatus.vue

@ -111,7 +111,7 @@
<!-- <el-input></el-input> -->
<!-- <input type="text" v-model="form.reportBackgroundColor"> -->
<el-input
v-model="form.reportBackgroundColor"
v-model.number="form.reportBackgroundColor"
@change="reportBackgroundColorchange1"
style="
width: 85%;
@ -134,7 +134,7 @@
@change="reportFontColorchange"
></el-color-picker>
<el-input
v-model="form.reportFontColor"
v-model.number="form.reportFontColor"
@change="reportFontColor1"
maxlength="15"
minlength="6"
@ -154,7 +154,7 @@
@change="dataInputBackgroundColorchange"
></el-color-picker>
<el-input
v-model="form.dataInputBackgroundColor"
v-model.number="form.dataInputBackgroundColor"
style="
width: 85%;
position: absolute;
@ -176,7 +176,7 @@
@change="dataInputFontColorchange"
></el-color-picker>
<el-input
v-model="form.dataInputFontColor"
v-model.number="form.dataInputFontColor"
@change="dataInputFontColor1"
style="
width: 85%;

326
src/views/doctorCheck/personnelBatch.vue

@ -50,9 +50,120 @@
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="back3">上一步</el-button>
<el-button type="primary" @click="parseImportData(startRow)">分析</el-button>
<el-button type="primary" @click="nextTick">下一步</el-button
<el-button type="primary" @click="parseImportData(startRow)"
>分析</el-button
>
<el-button type="primary" @click="nextclick">下一步</el-button>
</span>
</el-dialog>
<!-- 录取弹框 -->
<el-dialog title="批量预登记" :visible.sync="dialogVisible5" width="50%">
<span style="margin-left: 30%; font-size: 18px">选择单位</span>
<div class="subheading" style="margin-top: 10px">
选择的病人必须直接属于该单位或者是该单位的一级部门,如果病人直接属于该单
</div>
<div class="subheading">立请将Exce1文件中该病人的部门名称设为空</div>
<!-- row -->
<el-row style="margin-top: 20px">
<el-col :span="4" style="height: 40px; font-size: 18px">
选择单位或部门:
</el-col>
<el-col :span="6">
<el-cascader :options="departmentdata" :show-all-levels="false" :props="{ value:'id',label: 'displayName',children: 'treeChildren'}"></el-cascader>
<!-- <el-select v-model="value" placeholder="请选择" @change="onchange">
<el-option
v-for="item in departmentdata"
:key="item.id"
:label="item.displayName"
:value="item.id"
>
</el-option>
</el-select> -->
</el-col>
<el-col :span="4" style="line-height: 40px; font-size: 18px"
>单位设置</el-col
>
</el-row>
<!-- row -->
<div style="width: 100%">
<div style="margin-top:10px;margin">
相同姓名的病人
<el-radio-group v-model="nameType" @input="splices">
<el-radio label="同名病人提示">同名病人提示</el-radio>
<el-radio label="仅本单位同名病人提示"
>仅本单位同名病人提示</el-radio
>
<el-radio label="不提示">不提示</el-radio>
</el-radio-group>
</div>
</div>
<div style="margin-top: 10px; margin-left: 10px">
登记状态
<el-radio-group v-model="nameType">
<el-radio label="预登记">预登记</el-radio>
<el-radio label="仅本单位同名病人提示">仅本单位同名病人提示</el-radio>
</el-radio-group>
</div>
<div style="margin-top: 10px">
<div>工卡号</div>
<div style="margin-top: 5px">
<el-checkbox v-model="checked">工卡号作为档案号</el-checkbox>
</div>
</div>
<div>
<span>工卡号开始位置</span>
<el-input
v-model="input"
placeholder="请输入内容"
type="number"
style="width: 20%; margin-left: 10px"
></el-input>
长度
<el-input
v-model="form.cardLength"
placeholder="请输入内容"
type="number"
style="width: 20%; margin-left: 10px"
></el-input>
</div>
<div style="margin-top: 10px">
<el-checkbox v-model="form.isAutoCreateDepartment" @change="createornot"
>自动创建部门</el-checkbox
>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible5 = false"> </el-button>
<el-button type="primary" @click="submitto"> </el-button>
</span>
</el-dialog>
<!-- -->
<!--dialogVisible4 -->
<el-dialog title="批量预约登记" :visible.sync="dialogVisible4" width="50%">
<el-table
:data="tableData"
@row-click="rowclick"
style="width: 100%"
height="300px"
highlight-current-row
ref="singleTable"
>
<el-table-column
v-for="(item, index) in tableDataCol"
:key="index"
:prop="item.excelCol"
:label="item.label"
/>
</el-table>
<div style="margin-top: 20px">
<div v-for="(item, index) in tableData" :key="index"></div>
<el-button @click="setCurrent(tableData[0])">全选</el-button>
<el-button @click="setCurrent()">取消选择</el-button>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible4 = false">上一步</el-button>
<el-button @click="back4">上一步</el-button>
<el-button type="primary" @click="tablenext">下一步</el-button>
</span>
</el-dialog>
<!-- -->
@ -60,32 +171,133 @@
</template>
<script>
import ExcelJS from "exceljs";
import { postapi, getapi } from "@/api/api";
export default {
data() {
return {
checked: "",
input: "",
form: {
nameType: "",
cardLength: "",
isAutoCreateDepartment: "N", //
customerOrgId: "", //id
isAutoCreatePatientNo: "N",
cardStartNum: "0",
patientName: "",
},
value: "",
nameType: "1",
currentRow: null,
radio: "1",
dialogVisible1: true,
dialogVisible2: false,
dialogVisible3: false,
startRow:2, // startRow - 1
importData:[], //
tableDataCol:{}, // key-valuekey excelvalue
tableData:[], //
dialogVisible4: false,
dialogVisible5: false,
startRow: 2, // startRow - 1
importData: [], //
tableDataCol: [], // {excelCol,apiCol,label}
tableData: [], //
formrow: {},
departmentdata: [], //
};
},
methods: {
submitto() {
if (this.form.customerOrgId == undefined) {
this.$message.warning("请选择单位");
} else {
this.form= Object.assign(this.form,this.formrow)
postapi(
"/api/app/patientregister/createpatientregisterexcel",
this.form
).then((res) => {
if (res.code == 1) {
this.$message.success(res.data.msg);
}
console.log(res);
});
console.log(this.form);
}
console.log(this.form.customerOrgId);
},
onchange(id) {
this.form.customerOrgId = id;
console.log(id);
},
splices() {
if (this.nameType == 1) {
this.nameType = "同名病人提示";
}
console.log(this.nameType);
},
//
createornot() {
if (this.form.isAutoCreateDepartment == true) {
this.form.isAutoCreateDepartment = "Y";
} else {
this.form.isAutoCreateDepartment = "N";
console.log("1");
}
console.log(this.form.isAutoCreateDepartment);
},
slicetdata() {
console.log("2");
getapi("/api/app/customer-org/by-code-all").then((res) => {
this.departmentdata = res.data;
console.log(res);
});
},
tablenext() {
if (JSON.stringify(this.formrow) == "{}") {
this.$message.warning("请选择数据");
} else {
this.form = this.formrow;
this.dialogVisible5 = true;
this.dialogVisible4 = false;
this.slicetdata();
}
},
determine() {
if (JSON.stringify(this.formrow) == "{}") {
this.$message.warning("请选择数据");
} else {
this.dialogVisible5 = true;
this.dialogVisible4 = false;
}
},
rowclick(row) {
// console.log(row);
this.form.patientName = row.姓名;
this.form.sexName = row.性别;
this.form.idNo = row.证件号码;
this.formrow = row;
// this.form.birthDate = row.this.formrow = row;
// console.log(this.formrow);
},
aa() {
console.log("1");
},
setCurrent(row) {
console.log(row);
this.$refs.singleTable.setCurrentRow(row);
console.log(row, column, "event", "cell");
console.log(this.$refs.singleTable);
},
handleCurrentChange(val) {
this.currentRow = val;
},
onFileChange(event) {
//
const file = event.target.files[0];
// Excel
this.importExcelFile(file);
this.parseImportData()
this.parseImportData();
},
importExcelFile(file) {
this.filepopupdialogVisible = true;
console.log("333");
// 簿
const workbook = new ExcelJS.Workbook();
@ -107,7 +319,7 @@ export default {
worksheet.eachRow((row, rowNumber) => {
console.log(row.values);
this.importData.push(row.values);
// console.log(`${row.rowNumber}${row.rowData}`);
});
});
@ -116,44 +328,70 @@ export default {
},
//
parseImportData(startRow){
if(!this.importData || this.importData.length == 0) return;
parseImportData(startRow) {
if (!this.importData || this.importData.length == 0) return;
let cols = [];
let record = {};
this.importData.forEach((item,index) =>{
console.log(index,item);
if(index == startRow - 2){
item.forEach((e,i) =>{
console.log('e',i,e);
if(i>0){
if(e){
this.tableDataCol[e] = e;
this.importData.forEach((item, index) => {
console.log(index, item);
if (index == startRow - 2) {
item.forEach((e, i) => {
console.log("e", i, e);
if (i > 0) {
if (e) {
this.tableDataCol.push({ excelCol: e, apiCol: "", label: e });
cols.push(e);
}else{
this.tableDataCol[`${Number(i)+1}`] = `${Number(i)+1}`;
cols.push(`${Number(i)+1}`);
}
}
});
}else if(index > startRow - 2){
for(let i=0;i<item.length;i++){
if(i>0){
console.log('cols[i]',i,cols[i-1]);
if(item[i]){
record[cols[i-1]] = item[i];
}else{
record[cols[i-1]] = null;
} else {
this.tableDataCol.push({
excelCol: `${Number(i) + 1}`,
apiCol: "",
lebel: `${Number(i) + 1}`,
});
cols.push(`${Number(i) + 1}`);
}
}
});
} else if (index > startRow - 2) {
for (let i = 0; i < item.length; i++) {
if (i > 0) {
console.log("cols[i]", i, cols[i - 1]);
if (item[i]) {
record[cols[i - 1]] = item[i];
} else {
record[cols[i - 1]] = null;
}
}
}
this.tableData.push({...record});
}
this.tableData.push({ ...record });
}
});
console.log('tableDataCol',this.tableDataCol);
console.log('tableData',this.tableData);
console.log("tableDataCol", this.tableDataCol);
console.log("tableData", this.tableData);
},
nextclick() {
if (this.tableData.length > 1) {
console.log("1");
this.dialogVisible4 = true;
this.dialogVisible3 = false;
//
getapi("/api/app/pay-mode").then((res) => {
this.paymodedata = res.data;
});
//
getapi("/api/app/marital-statuses").then((res) => {
this.maritalstatusesdata = res.data;
console.log(res);
});
//
getapi("/api/app/customer-org-register/in-filter").then((res) => {
console.log(res);
});
} else {
this.$message.warning("请选择导入的文件并解析");
}
console.log(this.tableData);
},
nextTick() {
if (this.radio == 1) {
this.dialogVisible1 = false;
@ -161,6 +399,10 @@ export default {
}
console.log(this.radio);
},
back4() {
this.dialogVisible4 = false;
this.dialogVisible3 = true;
},
back3() {
this.dialogVisible3 = false;
this.dialogVisible2 = true;
@ -172,7 +414,6 @@ export default {
},
//
nextstep() {
this.dialogVisible3 = true;
this.dialogVisible2 = false;
},
@ -181,6 +422,9 @@ export default {
};
</script>
<style scoped>
.subheading {
margin-left: 10%;
}
.selectfile {
display: flex;
}

2
src/views/login/Login.vue

@ -105,7 +105,7 @@ export default {
);
window.localStorage.setItem("tokentype", res.data.token_type);
window.localStorage.setItem("user", this.form.Username);
this.$message.success(msgs,+"登录成功");
// this.$message.success(msgs,+"");
this.$router.push({ path: "home" });
this.$store.state.changepassword = this.form.Password;
})

Loading…
Cancel
Save