Commit 6ae4536d by zhaopanyu

zpy 实验室药品管理 实验室管理修改

parent a34b7e02
......@@ -17,7 +17,7 @@ export function editInst(data) {
});
}
//查看仪器列表
export function getList(query) {
export function getListyq(query) {
return request({
url: "/schoolInstrument/list",
method: "get",
......
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1694586094638" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="11336" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M896 554.666667h-42.666667v298.666666H170.666667v-298.666666H128l384-384 384 384z m-640-8.533334V768h512v-221.866667l-256-256-256 256z m174.933333-76.8h170.666667v85.333334h-170.666667v-85.333334z" fill="#444444" p-id="11337"></path></svg>
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1694586094638" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="11336" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M896 554.666667h-42.666667v298.666666H170.666667v-298.666666H128l384-384 384 384z m-640-8.533334V768h512v-221.866667l-256-256-256 256z m174.933333-76.8h170.666667v85.333334h-170.666667v-85.333334z" fill="#444444" p-id="11337"></path></svg>
\ No newline at end of file
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1694585200349" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2468" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M375.754979 682.621159a68.262116 68.262116 0 1 0 136.524232 0 68.262116 68.262116 0 0 0-136.524232 0z" fill="#768197" p-id="2469"></path><path d="M580.541327 819.14539a68.262116 68.262116 0 1 0 136.524231 0 68.262116 68.262116 0 0 0-136.524231 0z" fill="#FFFFFF" p-id="2470"></path><path d="M977.280744 852.320779L703.413135 360.35571a43.756016 43.756016 0 0 1-11.399773-28.601827V57.203653h34.19932c17.133791 0 28.533564-11.468035 28.533564-28.601826S743.346473 0 726.212682 0H292.611722c-17.065529 0-28.533564 11.468035-28.533565 28.601827s11.399773 28.601827 28.533565 28.601826h34.267582V331.753883c0 11.468035 0 22.936071-5.734018 28.670089L47.277677 852.252516a133.862009 133.862009 0 0 0 0 114.407307c22.799547 34.335844 57.067129 57.203653 102.734485 57.203653h724.534098c40.0016 0 79.866676-22.867809 102.734484-57.203653 17.065529-34.335844 17.065529-80.071462 0-114.407307zM634.946233 57.203653V331.753883c0 22.936071 5.734018 40.069862 17.065529 62.937671l40.0016 68.671688H332.54506l39.933337-74.405706a110.584628 110.584628 0 0 0 17.133791-57.203653V57.203653h245.334045z m291.0014 880.922605c-11.399773 17.133791-28.533564 28.601827-51.401373 28.601827H150.012162c-22.867809 0-40.0016-11.468035-51.401373-28.601827a52.083994 52.083994 0 0 1 0-57.203653l205.468968-366.089727h422.132925l205.468969 366.089727c0 17.133791 0 40.069862-5.734018 57.203653z" fill="#768197" p-id="2471"></path></svg>
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1694585200349" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2468" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M375.754979 682.621159a68.262116 68.262116 0 1 0 136.524232 0 68.262116 68.262116 0 0 0-136.524232 0z" fill="#768197" p-id="2469"></path><path d="M580.541327 819.14539a68.262116 68.262116 0 1 0 136.524231 0 68.262116 68.262116 0 0 0-136.524231 0z" fill="#FFFFFF" p-id="2470"></path><path d="M977.280744 852.320779L703.413135 360.35571a43.756016 43.756016 0 0 1-11.399773-28.601827V57.203653h34.19932c17.133791 0 28.533564-11.468035 28.533564-28.601826S743.346473 0 726.212682 0H292.611722c-17.065529 0-28.533564 11.468035-28.533565 28.601827s11.399773 28.601827 28.533565 28.601826h34.267582V331.753883c0 11.468035 0 22.936071-5.734018 28.670089L47.277677 852.252516a133.862009 133.862009 0 0 0 0 114.407307c22.799547 34.335844 57.067129 57.203653 102.734485 57.203653h724.534098c40.0016 0 79.866676-22.867809 102.734484-57.203653 17.065529-34.335844 17.065529-80.071462 0-114.407307zM634.946233 57.203653V331.753883c0 22.936071 5.734018 40.069862 17.065529 62.937671l40.0016 68.671688H332.54506l39.933337-74.405706a110.584628 110.584628 0 0 0 17.133791-57.203653V57.203653h245.334045z m291.0014 880.922605c-11.399773 17.133791-28.533564 28.601827-51.401373 28.601827H150.012162c-22.867809 0-40.0016-11.468035-51.401373-28.601827a52.083994 52.083994 0 0 1 0-57.203653l205.468968-366.089727h422.132925l205.468969 366.089727c0 17.133791 0 40.069862-5.734018 57.203653z" fill="#768197" p-id="2471"></path></svg>
\ No newline at end of file
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1694585790298" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4238" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M821.8 767.8H107.9c-5.5 0-10-4.5-10-10V108.2c0-5.5 4.5-10 10-10h713.9c5.5 0 10 4.5 10 10v649.6c0 5.5-4.5 10-10 10z" fill="#EEEEEE" p-id="4239"></path><path d="M755.9 306.2v-67.7c0-0.4-0.1-0.8-0.2-1.1v-2.7h-0.4c-2.5-12.9-17.4-22.9-35.6-22.9H217.2c-18.2 0-33.1 10-35.6 22.9h-0.6v96.1h0.2V350c0 0.4-0.2 0.8-0.2 1.1v146.2c0 0.4 0.1 0.8 0.2 1.1v2.6h0.4c2.5 13 17.4 23 35.6 23h502.6c18.2 0 33.1-10 35.6-22.9h0.5V326.5h-0.2v-19.2c0-0.3 0.2-0.7 0.2-1.1z" fill="#5B5144" p-id="4240"></path><path d="M727.8 320.9v-59.3c0-0.3-0.1-0.7-0.1-1v-2.3h-0.3c-2.3-11.3-15.7-20.1-32.1-20.1H241.6c-16.4 0-29.9 8.7-32.1 20.1h-0.5v84.1h0.1v16.8c0 0.3-0.1 0.7-0.1 1v127.9c0 0.3 0.1 0.7 0.1 1v2.3h0.3c2.3 11.3 15.7 20.1 32.1 20.1h453.6c16.4 0 29.9-8.7 32.1-20.1h0.5V338.7h-0.1v-16.8c0-0.3 0.2-0.6 0.2-1z" fill="#3BCDAE" p-id="4241"></path><path d="M781.5 512.1c-0.1-11.3-12.4-20.4-27.6-20.4h-578c-15.2 0-27.6 9.1-27.6 20.4h633.2z" fill="#FCE38A" p-id="4242"></path><path d="M354.2 492.6c0-11.2-1.9-20.4-4.2-20.4h-87.5c-2.3 0-4.2 9.1-4.2 20.4h95.9z" fill="#FFFFFF" p-id="4243"></path><path d="M781.5 511.6c-0.1 11.3-12.4 20.4-27.6 20.4h-578c-15.2 0-27.6-9.1-27.6-20.4h633.2z" fill="#EEDBC3" p-id="4244"></path><path d="M447.9 334.8H256.4v-31.2h191.5v31.2zM384 396.7H256.4v-31.2H384v31.2z" fill="#FFFFFF" p-id="4245"></path><path d="M303.6 480.8h320.8v157.4H303.6z" fill="#78909C" p-id="4246"></path><path d="M290.5 480.8h350.9l37.1-24.9H253.4zM265.2 638.3h413.3v16H265.2z" fill="#B0BEC5" p-id="4247"></path><path d="M606 887.6V582.3c0-21 18-38.2 40-38.2h240c22 0 40 17.2 40 38.2v305.3c0 21-18 38.2-40 38.2H646c-22 0-40-17.2-40-38.2z" fill="#FFCCBC" p-id="4248"></path><path d="M878.4 732.1l-87.5-85.4v170.7l87.5-85.3z m-87.5 28.6H653.7v-57.3h137.1v57.3z" fill="#FD0000" p-id="4249"></path></svg>
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1694585790298" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4238" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M821.8 767.8H107.9c-5.5 0-10-4.5-10-10V108.2c0-5.5 4.5-10 10-10h713.9c5.5 0 10 4.5 10 10v649.6c0 5.5-4.5 10-10 10z" fill="#EEEEEE" p-id="4239"></path><path d="M755.9 306.2v-67.7c0-0.4-0.1-0.8-0.2-1.1v-2.7h-0.4c-2.5-12.9-17.4-22.9-35.6-22.9H217.2c-18.2 0-33.1 10-35.6 22.9h-0.6v96.1h0.2V350c0 0.4-0.2 0.8-0.2 1.1v146.2c0 0.4 0.1 0.8 0.2 1.1v2.6h0.4c2.5 13 17.4 23 35.6 23h502.6c18.2 0 33.1-10 35.6-22.9h0.5V326.5h-0.2v-19.2c0-0.3 0.2-0.7 0.2-1.1z" fill="#5B5144" p-id="4240"></path><path d="M727.8 320.9v-59.3c0-0.3-0.1-0.7-0.1-1v-2.3h-0.3c-2.3-11.3-15.7-20.1-32.1-20.1H241.6c-16.4 0-29.9 8.7-32.1 20.1h-0.5v84.1h0.1v16.8c0 0.3-0.1 0.7-0.1 1v127.9c0 0.3 0.1 0.7 0.1 1v2.3h0.3c2.3 11.3 15.7 20.1 32.1 20.1h453.6c16.4 0 29.9-8.7 32.1-20.1h0.5V338.7h-0.1v-16.8c0-0.3 0.2-0.6 0.2-1z" fill="#3BCDAE" p-id="4241"></path><path d="M781.5 512.1c-0.1-11.3-12.4-20.4-27.6-20.4h-578c-15.2 0-27.6 9.1-27.6 20.4h633.2z" fill="#FCE38A" p-id="4242"></path><path d="M354.2 492.6c0-11.2-1.9-20.4-4.2-20.4h-87.5c-2.3 0-4.2 9.1-4.2 20.4h95.9z" fill="#FFFFFF" p-id="4243"></path><path d="M781.5 511.6c-0.1 11.3-12.4 20.4-27.6 20.4h-578c-15.2 0-27.6-9.1-27.6-20.4h633.2z" fill="#EEDBC3" p-id="4244"></path><path d="M447.9 334.8H256.4v-31.2h191.5v31.2zM384 396.7H256.4v-31.2H384v31.2z" fill="#FFFFFF" p-id="4245"></path><path d="M303.6 480.8h320.8v157.4H303.6z" fill="#78909C" p-id="4246"></path><path d="M290.5 480.8h350.9l37.1-24.9H253.4zM265.2 638.3h413.3v16H265.2z" fill="#B0BEC5" p-id="4247"></path><path d="M606 887.6V582.3c0-21 18-38.2 40-38.2h240c22 0 40 17.2 40 38.2v305.3c0 21-18 38.2-40 38.2H646c-22 0-40-17.2-40-38.2z" fill="#FFCCBC" p-id="4248"></path><path d="M878.4 732.1l-87.5-85.4v170.7l87.5-85.3z m-87.5 28.6H653.7v-57.3h137.1v57.3z" fill="#FD0000" p-id="4249"></path></svg>
\ No newline at end of file
<template>
<div>
<el-form
:model="queryForm"
ref="queryForm"
size="small"
:inline="true"
label-width="68px"
>
<div class="app-container">
<el-form :model="queryForm" ref="queryForm" size="small" :inline="true" @submit.native.prevent label-width="78px">
<el-form-item label="仪器名称">
<el-input
v-model="queryForm.name"
placeholder="请输入"
clearable
></el-input>
<el-input v-model="queryForm.instrumentName" placeholder="请输入" clearable></el-input>
</el-form-item>
<el-form-item label="仪器分类">
<el-select
v-model="queryForm.name"
placeholder="请选择"
clearable
>
<el-option> </el-option>
</el-select>
<treeselect v-model="queryForm.instrumentTypeId" :options="equiList" :normalizer="normalizer"
placeholder="选择分类编码" clearable style="width: 192px" />
</el-form-item>
<el-form-item label="变更日期">
<el-date-picker
v-model="queryForm.name"
type="daterange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
>
<el-date-picker v-model="queryForm.startTime" type="date" placeholder="选择开始日期" value-format="yyyy-MM-dd">
</el-date-picker>
<el-date-picker v-model="queryForm.endTime" type="date" placeholder="选择结束日期" value-format="yyyy-MM-dd">
</el-date-picker>
</el-form-item>
<el-form-item>
<el-button
type="primary"
icon="el-icon-search"
size="mini"
@click="getList"
>搜索</el-button
>
<el-button
icon="el-icon-refresh"
size="mini"
@click="resetQuery"
>重置</el-button
>
<el-button type="primary" icon="el-icon-search" size="mini" @click="getList">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<!-- 表格 -->
<el-table stripe :data="tableData" border style="width: 98%">
<el-table-column
align="center"
type="index"
label="序号"
width="55"
/>
<el-table-column align="center" prop="name" label="仪器名称" />
<el-table-column align="center" prop="name" label="仪器分类" />
<el-table-column align="center" prop="name" label="仪器型号" />
<el-table-column align="center" prop="name" label="变动类型" />
<el-table-column align="center" prop="name" label="变动数量" />
<el-table-column align="center" prop="name" label="旧库存数量" />
<el-table-column align="center" prop="name" label="新库存数量" />
<el-table-column align="center" prop="name" label="变更时间" />
<el-table-column align="center" prop="name" label="备注" />
<el-table-column align="center" type="index" label="序号" width="55" />
<el-table-column align="center" prop="instrumentName" label="仪器名称" />
<el-table-column align="center" prop="instrumentTypeName" label="仪器分类" />
<el-table-column align="center" prop="variationType" label="仪器型号" />
<el-table-column align="center" prop="variationType" label="变动类型" />
<el-table-column align="center" prop="variationNum" label="变动数量" />
<el-table-column align="center" prop="oldStockNum" label="旧库存数量" />
<el-table-column align="center" prop="newStockNum" label="新库存数量" />
<el-table-column align="center" prop="variationTime" label="变更时间" />
<el-table-column align="center" prop="remark" label="备注" />
</el-table>
<!-- 分页 -->
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryForm.pageNum"
:limit.sync="queryForm.pageSize"
@pagination="getList"
/>
<pagination v-show="total > 0" :total="total" :page.sync="queryForm.pageNum" :limit.sync="queryForm.pageSize"
@pagination="getList" />
</div>
</template>
<script>
import {
getListrk,
} from '@/api/smartSchool/InstrumentDrugAdministration/instrumentManagement';
import {
getList,//查看列表
} from '@/api/smartSchool/InstrumentDrugAdministration/instrumentClassification';
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
export default {
name: 'instrumentDetails',
components: { Treeselect },
data() {
return {
queryForm: {
pageNum: 1,
pageSize: 10,
name: ''
instrumentName: "",
instrumentTypeId: "",
daterange: "",
startTime: "",
endTime: "",
},
//表格数据
tableData: [
{
name: 111222
}
],
equiList: [],
// 总计
total: 0
}
},
created() {
this.getList();
this.getListequ();
},
methods: {
// 搜索
getList() {},
getList() {
getListrk({ ...this.queryForm }).then(res => {
if (res.code == 200) {
this.total = res.total;
this.tableData = res.rows;
console.log(this.tableData);
this.loading = false
}
})
},
getListequ() {
this.loading = true;
getList(this.queryForm).then(response => {
this.equiList = this.handleTree(response.rows, "id", 'parentId', 'children');
console.log('this.tableData', this.tableData);
this.loading = false;
})
},
/** 转换分类编码数据结构 */
normalizer(node) {
if (node.children && !node.children.length) {
delete node.children;
}
return {
id: node.id,
label: node.instrumentTypeName,
children: node.children
};
},
// 重置
resetQuery() {}
resetQuery() {
this.queryForm = {
pageNum: 1,
pageSize: 10,
instrumentName: "",
instrumentTypeId: "",
startTime: "",
endTime: "",
},
this.getList();
}
}
}
</script>
<style lang="scss" scoped>
.el-form {
margin-top: 15px;
margin-left: 10px;
}
.el-table {
margin-left: 10px;
}
</style>
\ No newline at end of file
<style scoped></style>
\ No newline at end of file
......@@ -40,7 +40,7 @@
</el-table-column>
<el-table-column align="center" prop="labName" label="实验室" />
<el-table-column align="center" prop="chapterContent" label="章节内容" />
<el-table-column align="center" prop="schoolAccessoryList" label="附件">
<el-table-column align="center" prop="schoolAccessoryList" label="附件" width="200">
<template slot-scope="scope">
<div v-for="(accessory, index) in scope.row.accessoryList" :key="index">
<a :href="baseUrl + accessory.accessoryUrl" target="_blank">{{ accessory.accessoryName }}</a>
......@@ -62,7 +62,7 @@
<template v-else-if="scope.row.applyState === '1' && scope.row.state === '0'">
<div>
<el-button @click="handleLook(scope.row)" type="text" size="small">查看</el-button>
<el-button size="small" type="text" @click="upload.open = true">上传附件</el-button>
<el-button size="small" type="text" @click="handleUpload(scope.row)">上传附件</el-button>
</div>
</template>
<template v-else>
......@@ -166,11 +166,13 @@
</el-dialog>
<!-- 导入弹出框 -->
<el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
<el-dialog :title="upload.title" :visible.sync="opendr" width="400px" append-to-body>
<el-form ref="postForm" :model="postForm" label-width="110px">
<FileUploadlab @input="getFileList" :limit="1" :value="fileList"></FileUploadlab>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitFileForm">确 定</el-button>
<el-button @click="upload.open = false">取 消</el-button>
<el-button type="primary" @click="submitFileForm()"> 确 定 </el-button>
<el-button @click="cancel = false">取 消</el-button>
</div>
</el-dialog>
......@@ -223,6 +225,11 @@ export default {
form: {
},
postForm: {
id: '',
accessoryUrl: '',
accessoryName: '',
},
upload: {
// 是否显示弹出层(用户导入)
open: false,
......@@ -242,6 +249,7 @@ export default {
isEdit: true,
total: 0,
dialogTableVisible: false,
opendr: false,
}
},
created() {
......@@ -293,58 +301,84 @@ export default {
this.getList();
},
//提交按钮
submitFileForm(data) {
console.log("getFileList", data);
submitFileForm() {
// 将 fileList 中的数据转换成 schoolAccessoryList 格式的数组
const schoolAccessoryList = this.fileList.map(item => ({
accessoryUrl: item.originalFilename,
accessoryName: item.url
accessoryUrl: item.fjlj,
accessoryName: item.fjmc
}));
// 定义请求的参数对象
const params = {
id: this.form.id,
id: this.postForm.id,
schoolAccessoryList: schoolAccessoryList
};
console.log(params);
// 发送上传文件列表请求
uploadFilelist(params).then(response => {
console.log(params);
this.opendr = false;
this.getList();
console.log("schoolAccessoryList", schoolAccessoryList);
});
},
//上传附件按钮操作
handleUpload() {
handleUpload(row) {
console.log(row);
this.postForm.id = row.id;
this.opendr = true;
},
//取消按钮
cancle() {
this.dialogTableVisible = false;
this.opendr = false;
},
//上传按钮
// getFileList(data) {
// console.log('data', data);
// this.fileList = data;
// if (this.fileList.length !== 0) {
// const file = data[0]; // 获取第一个文件的信息
// console.log('file', file);
// this.accessoryUrl = file.originalFilename;
// this.accessoryName = file.url;
// console.log(this.accessoryUrl, this.accessoryName);
// } else {
// this.form.accessoryUrl = '';
// this.form.accessoryName = '';
// }
// },
getFileList(data) {
console.log('data', data);
this.fileList = data;
if (this.fileList.length !== 0) {
const file = data[0]; // 获取第一个文件的信息
console.log('file', file);
this.accessoryUrl = file.originalFilename;
this.accessoryName = file.url;
console.log(this.accessoryUrl, this.accessoryName);
console.log(this.fileList);
if (this.fileList.length != 0) {
this.postForm.accessoryUrl = data[0].fjlj;
this.postForm.accessoryName = data[0].fjmc;
console.log('this.postForm', this.postForm);
} else {
this.form.accessoryUrl = '';
this.form.accessoryName = '';
}
this.postForm.accessoryUrl = '';
this.postForm.accessoryName = '';
}
},
}
}
</script>
<style lang="scss" scoped></style>
\ No newline at end of file
<style lang="scss" scoped>
.el-table__column--ellipsis .cell {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
</style>
\ No newline at end of file
......@@ -51,7 +51,13 @@
</div>
</template>
</el-table-column>
<el-table-column align="center" prop="schoolAccessoryList" label="实验结果" />
<el-table-column align="center" prop="schoolAccessoryList" label="实验结果" width="200px">
<template slot-scope="scope">
<div v-for="(accessory, index) in scope.row.accessoryList" :key="index">
<a :href="baseUrl + accessory.accessoryUrl" target="_blank">{{ accessory.accessoryName }}</a>
</div>
</template>
</el-table-column>
<el-table-column align="center" prop="declareState" label="申报状态">
<template slot-scope="{ row }">
<div>{{ selectDictLabel(dict.type.declare_state, row.declareState) }}</div>
......@@ -263,11 +269,13 @@
</el-dialog>
<!-- 导入弹出框 -->
<el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
<el-dialog :title="upload.title" :visible.sync="opendr" width="400px" append-to-body>
<el-form ref="postForm" :model="postForm" label-width="110px">
<FileUploadlab @input="getFileList" :limit="1" :value="fileList"></FileUploadlab>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitFileForm">确 定</el-button>
<el-button @click="upload.open = false">取 消</el-button>
<el-button type="primary" @click="submitFileForm()"> 确 定 </el-button>
<el-button @click="cancel">取 消</el-button>
</div>
</el-dialog>
<pagination v-show="total > 0" :total="total" :page.sync="queryForm.pageNum" :limit.sync="queryForm.pageSize"
......@@ -343,12 +351,19 @@ export default {
url: process.env.VUE_APP_BASE_API + '/school/student/importData'
},
schoolTeacherExperimentApplyLabsList: [],
schoolAccessoryList: [],
//级部
gradeList: [],
gradeLists: [],
total: 0,
postForm: {
id: '',
accessoryUrl: '',
accessoryName: '',
},
dialogTableVisible: false,
open: false,
opendr: false,
rules: {
sub: [
{ required: true, message: "学科不能为空", trigger: "blur" }
......@@ -394,7 +409,12 @@ export default {
getApplylist(this.queryForm)
.then(response => {
this.tableData = response.rows;
this.tableData = response.rows.map(item => {
item.accessoryList = item.schoolAccessoryList; // 将附件信息赋值给accessoryList属性
return item;
});
console.log('response', response);
console.log(response.rows.a);
this.total = response.total;
this.loading = false;
})
......@@ -503,39 +523,38 @@ export default {
getFileList(data) {
console.log('data', data);
this.fileList = data;
if (this.fileList.length !== 0) {
const file = data[0]; // 获取第一个文件的信息
console.log('file', file);
this.accessoryUrl = file.accessoryUrl;
this.accessoryName = file.accessoryName;
setTimeout(() => {
console.log(this.accessoryUrl, this.accessoryName);
}, 100); // 等待100毫秒后再打印
console.log(this.fileList);
if (this.fileList.length != 0) {
this.postForm.accessoryUrl = data[0].fjlj;
this.postForm.accessoryName = data[0].fjmc;
console.log('this.postForm', this.postForm);
} else {
this.form.accessoryUrl = '';
this.form.accessoryName = '';
this.postForm.accessoryUrl = '';
this.postForm.accessoryName = '';
}
},
//提交按钮
submitFileForm(data) {
console.log("getFileList", data);
submitFileForm() {
// 将 fileList 中的数据转换成 schoolAccessoryList 格式的数组
const schoolAccessoryList = this.fileList.map(item => ({
accessoryUrl: item.originalFilename,
accessoryName: item.url
accessoryUrl: item.fjlj,
accessoryName: item.fjmc
}));
// 定义请求的参数对象
const params = {
id: this.form.id,
id: this.postForm.id,
schoolAccessoryList: schoolAccessoryList
};
console.log(params);
// 发送上传文件列表请求
getResult(params).then(response => {
console.log(params);
this.opendr = false;
this.getList();
console.log("schoolAccessoryList", schoolAccessoryList);
});
},
......@@ -688,18 +707,23 @@ export default {
},
//上传附件按钮操作
handleResult() {
handleResult(row) {
console.log(row);
this.upload.title = '实验结果'
this.upload.open = true
this.opendr = true;
this.postForm.id = row.id;
},
//取消按钮
cancel() {
this.dialogTableVisible = false;
this.open = false;
this.opendr = false;
},
},
}
</script>
<style lang="scss" scoped></style>
\ No newline at end of file
<style lang="scss" scoped>
</style>
\ No newline at end of file
......@@ -38,16 +38,12 @@
</template>
</el-table-column>
<el-table-column label="证书照片" align="center" prop="schoolAccessoryList">
<!-- <template slot-scope="scope">
<ListImage :image-url="pev + scope.row.accessoryUrl"></ListImage>
</template> -->
<template slot-scope="scope">
<!-- <ListImage :image-url="pev+scope.row.picUrl"></ListImage> -->
<!-- previewSrcList 开启预览大图的功能。-->
<el-image style="width: 100px; height: 100px" :src="scope.row.url" :preview-src-list="srcList">
</el-image>
<el-image style="width: 100px; height: 100px" :src="scope.row.pictureUrl"
:preview-src-list="scope.row.previewUrls"></el-image>
</template>
</el-table-column>
<el-table-column label="备注1" align="center" prop="remark1" />
<el-table-column label="备注2" align="center" prop="remark2" />
<el-table-column label="备注3" align="center" prop="remark3" />
......@@ -118,15 +114,17 @@
</el-row>
<el-row>
<el-col :span="10">
<el-form-item label="证书照片">
<el-form-item prop="schoolAccessoryList" label="证书照片">
<el-form-item prop="schoolAccessoryList" label="证书照片">
<el-upload v-loading="uploadLoading" class="avatar-uploader" action="#" accept="image/*"
:show-file-list="false" :on-success="handleAvatarSuccess" :before-upload="beforeAvatarUpload"
:http-request="uploadImage" :disabled="nowType == 2 ? true : false">
<img v-if="imageUrl" :src="imageUrl" style="width: 178px; height: 178px;" class="avatar" alt="" />
<!-- :preview-src-list="[imageUrl]"-->
:http-request="uploadImage">
<img v-if="form.schoolAccessoryList && form.schoolAccessoryList.length > 0"
:src="form.schoolAccessoryList[0].accessoryUrl" class="avatar" />
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
</el-upload>
</el-form-item>
</el-form-item>
</el-col>
<el-col :span="10">
<el-form-item label="备注1">
......@@ -156,7 +154,10 @@
</div>
</el-dialog>
<el-dialog ref="previewDialog" title="预览图片" :visible.sync="previewDialogVisible">
<el-image style="width: 100%; max-height: 80vh; object-fit: contain" :src="previewImageUrl"
fit="contain"></el-image>
</el-dialog>
</div>
</template>
......@@ -178,6 +179,8 @@ export default {
components: { picAvatar },
data() {
return {
//缩略图
srcList: [],
// 图片路径
imageUrl: undefined,
pev: process.env.VUE_APP_BASE_API,
......@@ -185,6 +188,7 @@ export default {
pageNum: 1,
pageSize: 10,
},
previewImageUrl: '',
//获取子组件传来的信息
pic: [],
// 图片路径
......@@ -199,6 +203,7 @@ export default {
dialogTitle: '', //弹窗标题
dialogVisible: false,
nowOption: null,
uploadedFiles: [],
form: {
schoolYear: '',
teacherId: '',
......@@ -210,9 +215,10 @@ export default {
remark1: '',
remark2: '',
remark3: '',
schoolAccessoryList: '',
schoolAccessoryList: [],
},
previewDialogVisible: false,
teacherList: [],
rules: {},
nowType: 0, // 0新增、1编辑、2查看
......@@ -232,15 +238,25 @@ export default {
this.getTeacher();
},
methods: {
handlePreview(url) {
this.previewImageUrl = url;
this.$refs.previewDialog.open();
},
//获取列表数据
getList() {
getCompetition(this.queryForm).then(response => {
this.competitionData = response.rows;
console.log('response', response);
this.total = response.total
this.loading = false
})
this.total = response.total;
this.loading = false;
this.competitionData.forEach(item => {
item.previewUrls = [item.schoolAccessoryList.map(accessory => accessory.accessoryUrl)];
item.pictureUrl = item.schoolAccessoryList.map(accessory => accessory.accessoryUrl);
});
});
},
//获取图片信息
getSchoolInfoPic(val) {
this.pic = val
......@@ -277,14 +293,19 @@ export default {
.then(response => {
this.uploadLoading = false
this.$modal.msgSuccess('上传成功')
this.imageUrl = this.pev + response.url
this.form.avatar = response.url
this.imageUrl = process.env.VUE_APP_BASE_API + response.url
// 添加以下代码将文件信息添加到 uploadedFiles 数组中
this.uploadedFiles.push({
accessoryUrl: process.env.VUE_APP_BASE_API + response.url,
accessoryName: fileData.name
})
})
.catch(error => {
this.uploadLoading = false
})
},
//重置
resetQuery() {
......@@ -330,10 +351,13 @@ export default {
const id = row.id
getCompetitionxq(id).then(response => {
if (response.code == 200) {
console.log(response);
Object.keys(this.form).forEach(key => {
if (response.data[key]) {
this.$set(this.form, key, response.data[key]);
}
if (response.data.schoolAccessoryList && response.data.schoolAccessoryList.length > 0) {
this.imageUrl = response.data.schoolAccessoryList[0].accessoryUrl; // 将图片地址赋值给 imageUrl
}
})
......@@ -353,11 +377,19 @@ export default {
},
/** 提交按钮 */
submitForm: function () {
let fileList = []; // 添加这行代码定义 fileList 变量
this.$refs['form'].validate(valid => {
if (valid) {
if (this.form.id != "") {
// 清空原有图片
this.form.schoolAccessoryList = [];
for (let i = 0; i < this.uploadedFiles.length; i++) {
const file = this.uploadedFiles[i];
this.form.schoolAccessoryList.push({
accessoryUrl: file.accessoryUrl,
accessoryName: file.accessoryName
});
}
updateCompetition(this.form).then(({ code }) => {
if (code == 200) {
this.$modal.msgSuccess('修改成功')
......@@ -368,12 +400,14 @@ export default {
this.$modal.msgError("修改失败");
});
} else {
for (let i = 0; i < fileList.length; i++) {
const file = fileList[i];
// 将照片信息添加到 schoolAccessoryList 数组中
// 清空原有图片
this.form.schoolAccessoryList = [];
for (let i = 0; i < this.uploadedFiles.length; i++) {
const file = this.uploadedFiles[i];
this.form.schoolAccessoryList.push({
accessoryUrl: file.url,
accessoryName: file.name
accessoryUrl: file.accessoryUrl,
accessoryName: file.accessoryName
});
}
......@@ -389,6 +423,7 @@ export default {
});
},
cancel() {
this.dialogVisible = false;
},
......
......@@ -236,7 +236,8 @@ export default {
getProductCategory().then(((res) => {
if (res.code == 200) {
this.sbflOptions = res.data;
// console.log('this.sbflOptions', this.sbflOptions);
// console.log(this.sbflOptions);
console.log('this.sbflOptions', this.sbflOptions);
}
}))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment