Merge branch 'main' of http://120.76.84.145:10101/gitblit/r/H5/leshan-laboratory
| | |
| | | } |
| | | }, |
| | | methods: { |
| | | toggleRowSelection(row, selected) { |
| | | this.$refs.elTable.toggleRowSelection(row, selected) |
| | | this.$forceUpdate() |
| | | }, |
| | | clearSelection() { |
| | | this.$refs.elTable.clearSelection() |
| | | this.$forceUpdate() |
| | | }, |
| | | // toggleRowSelection(row, selected) { |
| | | // this.$refs.elTable.toggleRowSelection(row, selected) |
| | | // this.$forceUpdate() |
| | | // }, |
| | | // clearSelection() { |
| | | // this.$refs.elTable.clearSelection() |
| | | // this.$forceUpdate() |
| | | // }, |
| | | handleCurrentChange(page) { |
| | | this.$emit('handleCurrentChange', page) |
| | | }, |
| | |
| | | <div class="header-title-left"> |
| | | <img src="@/assets/public/headercard.png" /> |
| | | <div>所属实验调度</div> |
| | | <el-button v-if="isEngineer" @click="showScheduling = true" class="el-icon-plus" type="primary"> |
| | | <el-button v-if="isEngineer && pageType !== 'detail'" @click="showScheduling = true" class="el-icon-plus" type="primary"> |
| | | 选择实验调度</el-button> |
| | | </div> |
| | | <Table :data="schedulingData" :total="schedulingTotal" :height="null"> |
| | | <template> |
| | | <el-table-column prop="planCode" label="所属项目课题方案"></el-table-column> |
| | | <el-table-column prop="planName" label="实验编号"></el-table-column> |
| | | <el-table-column prop="planName" label="实验名称"></el-table-column> |
| | | <el-table-column prop="stage" label="通知时间"></el-table-column> |
| | | <el-table-column prop="stage" label="实验开始时间"></el-table-column> |
| | | <el-table-column prop="stage" label="实验结束时间"></el-table-column> |
| | | <el-table-column prop="stage" label="参加人员"></el-table-column> |
| | | <el-table-column prop="creator" label="状态"></el-table-column> |
| | | <el-table-column type="index" label="序号" width="80"></el-table-column> |
| | | <el-table-column prop="projectName" label="所属项目课题方案"></el-table-column> |
| | | <el-table-column prop="experimentCode" label="实验编号"></el-table-column> |
| | | <el-table-column prop="experimentName" label="实验名称"></el-table-column> |
| | | <el-table-column prop="experimentDate" label="通知时间"></el-table-column> |
| | | <el-table-column prop="experimentStartTime" label="实验开始时间"></el-table-column> |
| | | <el-table-column prop="experimentEndTime" label="实验结束时间"></el-table-column> |
| | | <el-table-column prop="participantsName" label="参加人员"></el-table-column> |
| | | <el-table-column prop="status" label="状态"> |
| | | <template slot-scope="scope"> |
| | | <el-tag :type="getStatusType(scope.row.status)"> |
| | | {{ getStatusText(scope.row.status) }} |
| | | </el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | </template> |
| | | </Table> |
| | | |
| | |
| | | <!-- 待收样列表 --> |
| | | <div class="pending-samples"> |
| | | <div class="sub-title">待收样列表</div> |
| | | <el-button type="primary" class="batch-receive" @click="handleBatchReceive">批量接收</el-button> |
| | | <Table :data="pendingSamples" :total="pendingSamplesTotal" :height="null" |
| | | @selection-change="handleSelectionChange"> |
| | | <el-button |
| | | type="primary" |
| | | class="batch-receive" |
| | | @click="handleBatchReceive" |
| | | :disabled="selectedSamples.length == 0" |
| | | >批量接收</el-button> |
| | | <Table ref="pendingTable" |
| | | :data="pendingSamples" |
| | | :total="pendingSamplesTotal" |
| | | :height="null" |
| | | :row-key="row => row.id" |
| | | @selection-change="handlePendingSelectionChange"> |
| | | <template> |
| | | <el-table-column type="selection" width="55"></el-table-column> |
| | | <el-table-column prop="index" label="序号" width="80"></el-table-column> |
| | | <el-table-column prop="sampleName" label="取样名称"></el-table-column> |
| | | <el-table-column prop="sampleCode" label="取样样品编号"></el-table-column> |
| | | <el-table-column prop="ph" label="PH"></el-table-column> |
| | | <el-table-column prop="sampleAmount" label="取样量"></el-table-column> |
| | | <el-table-column prop="sendTime" label="送样时间"></el-table-column> |
| | | <el-table-column prop="sender" label="送样人"></el-table-column> |
| | | <el-table-column prop="status" label="状态"></el-table-column> |
| | | <el-table-column |
| | | type="selection" |
| | | width="55" |
| | | fixed="left" > |
| | | </el-table-column> |
| | | <el-table-column type="index" label="序号" width="80"></el-table-column> |
| | | <el-table-column prop="samplingName" label="取样名称" width="150"></el-table-column> |
| | | <el-table-column prop="sampleCode" label="取样样品编号" width="150"></el-table-column> |
| | | <el-table-column prop="temperature" label="温度" width="150"></el-table-column> |
| | | <el-table-column prop="samplePh" label="PH" width="150"></el-table-column> |
| | | <el-table-column prop="waterAddition" label="加水量" width="150"></el-table-column> |
| | | <template v-if="showPendingColumns"> |
| | | <el-table-column prop="temperature" label="温度" width="150"></el-table-column> |
| | | <el-table-column prop="waterAmount" label="加水量" width="150"></el-table-column> |
| | | <el-table-column prop="additive1" label="加辅1" width="150"></el-table-column> |
| | | <el-table-column prop="additive2" label="加辅2" width="150"></el-table-column> |
| | | <el-table-column prop="additive3" label="加辅3" width="150"></el-table-column> |
| | | <el-table-column prop="additive4" label="加辅4" width="150"></el-table-column> |
| | | <el-table-column prop="additive5" label="加辅5" width="150"></el-table-column> |
| | | <el-table-column prop="addAuxiliaryOne" label="加辅1" width="150"></el-table-column> |
| | | <el-table-column prop="addAuxiliaryTwo" label="加辅2" width="150"></el-table-column> |
| | | <el-table-column prop="addAuxiliaryThree" label="加辅3" width="150"></el-table-column> |
| | | <el-table-column prop="addAuxiliaryFour" label="加辅4" width="150"></el-table-column> |
| | | <el-table-column prop="addAuxiliaryFive" label="加辅5" width="150"></el-table-column> |
| | | <el-table-column prop="addAuxiliarySix" label="加辅6" width="150"></el-table-column> |
| | | <el-table-column prop="addAuxiliarySeven" label="加辅7" width="150"></el-table-column> |
| | | <el-table-column prop="addAuxiliaryEight" label="加辅8" width="150"></el-table-column> |
| | | <el-table-column prop="addAuxiliaryNine" label="加辅9" width="150"></el-table-column> |
| | | <el-table-column prop="addAuxiliaryTen" label="加辅10" width="150"></el-table-column> |
| | | </template> |
| | | <el-table-column prop="sampleAmount" label="取样量" width="150"></el-table-column> |
| | | <el-table-column prop="pictures" label="拍照" width="150"> |
| | | <template slot-scope="scope"> |
| | | <template v-if="scope.row.pictures"> |
| | | <el-image |
| | | v-for="(url, index) in scope.row.pictures.split(',')" |
| | | :key="index" |
| | | src="https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg" |
| | | :preview-src-list="[url]" |
| | | style="width: 50px; height: 50px;" |
| | | /> |
| | | </template> |
| | | <span v-else>-</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="handlePersonName" label="操作人员" width="150"></el-table-column> |
| | | <el-table-column label="状态" prop="status" width="100" fixed="right"> |
| | | <template slot-scope="scope"> |
| | | <span>{{ scope.row.status == '2' ? '待接收' : '已接收' }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="操作" width="100" fixed="right"> |
| | | <template slot-scope="scope"> |
| | | <el-button type="text" @click="handleReceive(scope.row)">接收</el-button> |
| | |
| | | </template> |
| | | </Table> |
| | | </div> |
| | | |
| | | <!-- 已收样列表 --> |
| | | <div class="received-samples"> |
| | | <div class="sub-title">已收样列表</div> |
| | | <Table :data="receivedSamples" :total="receivedSamplesTotal" :height="null"> |
| | | <Table ref="receivedTable" :data="receivedSamples" :total="receivedSamplesTotal" :height="null"> |
| | | <template> |
| | | <el-table-column prop="index" label="序号" width="80"></el-table-column> |
| | | <el-table-column prop="sampleName" label="取样名称"></el-table-column> |
| | | <el-table-column prop="sampleCode" label="取样样品编号"></el-table-column> |
| | | <el-table-column type="index" label="序号" width="80"></el-table-column> |
| | | <el-table-column prop="samplingName" label="取样名称" width="150"></el-table-column> |
| | | <el-table-column prop="sampleCode" label="取样样品编号" width="150"></el-table-column> |
| | | <el-table-column prop="temperature" label="温度" width="150"></el-table-column> |
| | | <el-table-column prop="waterAmount" label="加水量" width="150"></el-table-column> |
| | | <el-table-column prop="ph" label="PH"></el-table-column> |
| | | <el-table-column prop="samplePh" label="PH" width="150"></el-table-column> |
| | | <el-table-column prop="waterAddition" label="加水量" width="150"></el-table-column> |
| | | <template v-if="showReceivedColumns"> |
| | | <el-table-column prop="additive1" label="加辅1" width="150"></el-table-column> |
| | | <el-table-column prop="additive2" label="加辅2" width="150"></el-table-column> |
| | | <el-table-column prop="additive3" label="加辅3" width="150"></el-table-column> |
| | | <el-table-column prop="additive4" label="加辅4" width="150"></el-table-column> |
| | | <el-table-column prop="additive5" label="加辅5" width="150"></el-table-column> |
| | | <el-table-column prop="addAuxiliaryOne" label="加辅1" width="150"></el-table-column> |
| | | <el-table-column prop="addAuxiliaryTwo" label="加辅2" width="150"></el-table-column> |
| | | <el-table-column prop="addAuxiliaryThree" label="加辅3" width="150"></el-table-column> |
| | | <el-table-column prop="addAuxiliaryFour" label="加辅4" width="150"></el-table-column> |
| | | <el-table-column prop="addAuxiliaryFive" label="加辅5" width="150"></el-table-column> |
| | | <el-table-column prop="addAuxiliarySix" label="加辅6" width="150"></el-table-column> |
| | | <el-table-column prop="addAuxiliarySeven" label="加辅7" width="150"></el-table-column> |
| | | <el-table-column prop="addAuxiliaryEight" label="加辅8" width="150"></el-table-column> |
| | | <el-table-column prop="addAuxiliaryNine" label="加辅9" width="150"></el-table-column> |
| | | <el-table-column prop="addAuxiliaryTen" label="加辅10" width="150"></el-table-column> |
| | | </template> |
| | | <el-table-column prop="sampleAmount" label="取样量"></el-table-column> |
| | | <el-table-column prop="sendTime" label="送样时间"></el-table-column> |
| | | <el-table-column prop="sender" label="送样人"></el-table-column> |
| | | <el-table-column prop="receiveTime" label="收样时间"></el-table-column> |
| | | <el-table-column prop="receiver" label="收样人"></el-table-column> |
| | | <el-table-column prop="status" label="状态" fixed="right"></el-table-column> |
| | | <el-table-column prop="sampleAmount" label="取样量" width="150"></el-table-column> |
| | | <el-table-column prop="pictures" label="拍照" width="150"> |
| | | <template slot-scope="scope"> |
| | | <template v-if="scope.row.pictures"> |
| | | <el-image |
| | | v-for="(url, index) in scope.row.pictures.split(',')" |
| | | :key="index" |
| | | src="https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg" |
| | | :preview-src-list="[url]" |
| | | style="width: 50px; height: 50px;" |
| | | /> |
| | | </template> |
| | | <span v-else>-</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="handlePersonName" label="操作人员" width="150"></el-table-column> |
| | | <el-table-column prop="receiveTime" label="收样时间" width="150"></el-table-column> |
| | | <el-table-column prop="receiver" label="收样人" width="150"></el-table-column> |
| | | <el-table-column label="状态" prop="status" width="100" fixed="right"> |
| | | <template slot-scope="scope"> |
| | | <span>{{ scope.row.status == '3' ? '已接收' : '待接收' }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | </template> |
| | | </Table> |
| | | </div> |
| | |
| | | <img src="@/assets/public/headercard.png" /> |
| | | <span>基础信息</span> |
| | | </div> |
| | | <el-form ref="form" :model="form" :rules="rules" inline label-position="top"> |
| | | <el-form ref="form" :model="form" :rules="rules" inline label-position="top" v-if="pageType !== 'detail'"> |
| | | <el-form-item label="取样单编号" prop="sampleCode"> |
| | | <el-input v-model="form.sampleCode" :disabled="true" placeholder="自动生成" /> |
| | | </el-form-item> |
| | | </el-form> |
| | | <div>取样单编号:{{ form.sampleCode }}</div> |
| | | <div class="header-title-left" style="margin-top: 38px"> |
| | | <img src="@/assets/public/headercard.png" /> |
| | | <span>取样操作记录</span> |
| | | <el-button type="primary" class="el-icon-plus" @click="showAddTime = true"> |
| | | <el-button v-if="isEngineer && pageType !== 'detail'" type="primary" class="el-icon-plus" @click="showAddTime = true"> |
| | | 新增工艺时间 |
| | | </el-button> |
| | | <el-button type="primary" class="el-icon-plus" @click="showAdditives = !showAdditives"> |
| | | {{ showAdditives ? "收起辅料详情" : "展开辅料详情" }} |
| | | </el-button> |
| | | </div> |
| | | <Table :data="sampleData" :total="sampleTotal" :height="null"> |
| | | <Table ref="sampleTable" :data="sampleData" :total="sampleTotal" :height="null"> |
| | | <template> |
| | | <el-table-column prop="index" label="序号" width="80"></el-table-column> |
| | | <el-table-column prop="processTime" label="工艺时间" width="150"></el-table-column> |
| | | <el-table-column prop="sampleName" label="取样名称" width="150"></el-table-column> |
| | | <el-table-column prop="samplingName" label="取样名称" width="150"></el-table-column> |
| | | <el-table-column prop="sampleCode" label="取样样品编号" width="150"></el-table-column> |
| | | <el-table-column prop="temperature" label="温度" width="150"></el-table-column> |
| | | <el-table-column prop="ph" label="PH" width="150"></el-table-column> |
| | | <el-table-column prop="waterAmount" label="加水量" width="150"></el-table-column> |
| | | <el-table-column prop="samplePh" label="PH" width="150"></el-table-column> |
| | | <el-table-column prop="waterAddition" label="加水量" width="150"></el-table-column> |
| | | <template v-if="showAdditives"> |
| | | <el-table-column prop="additive1" label="加辅1" width="150"></el-table-column> |
| | | <el-table-column prop="additive2" label="加辅2" width="150"></el-table-column> |
| | | <el-table-column prop="additive3" label="加辅3" width="150"></el-table-column> |
| | | <el-table-column prop="additive4" label="加辅4" width="150"></el-table-column> |
| | | <el-table-column prop="additive5" label="加辅5" width="150"></el-table-column> |
| | | <el-table-column prop="additive6" label="加辅6" width="150"></el-table-column> |
| | | <el-table-column prop="additive7" label="加辅7" width="150"></el-table-column> |
| | | <el-table-column prop="additive8" label="加辅8" width="150"></el-table-column> |
| | | <el-table-column prop="additive9" label="加辅9" width="150"></el-table-column> |
| | | <el-table-column prop="additive10" label="加辅10" width="150"></el-table-column> |
| | | <el-table-column prop="addAuxiliaryOne" label="加辅1" width="150"></el-table-column> |
| | | <el-table-column prop="addAuxiliaryTwo" label="加辅2" width="150"></el-table-column> |
| | | <el-table-column prop="addAuxiliaryThree" label="加辅3" width="150"></el-table-column> |
| | | <el-table-column prop="addAuxiliaryFour" label="加辅4" width="150"></el-table-column> |
| | | <el-table-column prop="addAuxiliaryFive" label="加辅5" width="150"></el-table-column> |
| | | <el-table-column prop="addAuxiliarySix" label="加辅6" width="150"></el-table-column> |
| | | <el-table-column prop="addAuxiliarySeven" label="加辅7" width="150"></el-table-column> |
| | | <el-table-column prop="addAuxiliaryEight" label="加辅8" width="150"></el-table-column> |
| | | <el-table-column prop="addAuxiliaryNine" label="加辅9" width="150"></el-table-column> |
| | | <el-table-column prop="addAuxiliaryTen" label="加辅10" width="150"></el-table-column> |
| | | </template> |
| | | <el-table-column prop="sampleAmount" label="取样量" width="150"></el-table-column> |
| | | <el-table-column prop="sampleTime" label="取样时间" width="150"></el-table-column> |
| | | <el-table-column prop="remark" label="拍照" width="150"></el-table-column> |
| | | <el-table-column prop="operator" label="操作人员" width="150"></el-table-column> |
| | | <el-table-column prop="pictures" label="拍照" width="150"> |
| | | <template slot-scope="scope"> |
| | | <template v-if="scope.row.pictures"> |
| | | <el-image |
| | | v-for="(url, index) in scope.row.pictures.split(',')" |
| | | :key="index" |
| | | :src="url" |
| | | :preview-src-list="[url]" |
| | | style="width: 50px; height: 50px;" |
| | | /> |
| | | </template> |
| | | <span v-else>-</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="handlePersonName" label="操作人员" width="150"></el-table-column> |
| | | </template> |
| | | </Table> |
| | | <div class="add-project-footer"> |
| | | <div v-if="pageType == 'detail'" style="margin-top: 38px">备注:</div> |
| | | <el-input |
| | | v-if="pageType == 'detail'" |
| | | type="textarea" |
| | | |
| | | v-model="form.remark" |
| | | placeholder="请输入内容" |
| | | style="margin-top: 10px" |
| | | :disabled="true" |
| | | /> |
| | | |
| | | <div class="add-project-footer" v-if="isEngineer && pageType !== 'detail'"> |
| | | <el-button type="primary" class="save-btn" @click="handleSave">保存</el-button> |
| | | <el-button>存草稿</el-button> |
| | | <el-button @click="handleSaveDraft">存草稿</el-button> |
| | | </div> |
| | | </div> |
| | | |
| | | <experimentalScheduling :show="showScheduling" /> |
| | | <experimentalScheduling :show="showScheduling" @close="handleSchedulingClose" @submit="handleSchedulingSubmit" /> |
| | | <addTime :show.sync="showAddTime" @confirm="handleAddTime" /> |
| | | <receive-confirm-dialog :visible.sync="showReceiveConfirm" :sample-count="selectedSamples.length" |
| | | @confirm="confirmReceive" /> |
| | |
| | | import experimentalScheduling from "./components/experimental-scheduling.vue"; |
| | | import addTime from "./components/addTime.vue"; |
| | | import ReceiveConfirmDialog from "./components/receiveConfirmDialog.vue"; |
| | | import { add, getDetail, update, batchCollectSamples } from "./service"; |
| | | |
| | | export default { |
| | | name: "AddSample", |
| | |
| | | showReceivedColumns: true, |
| | | schedulingData: [], |
| | | schedulingTotal: 0, |
| | | sampleData: [ |
| | | { |
| | | index: 1, |
| | | processTime: "2h", |
| | | sampleName: "样品A", |
| | | sampleCode: "SP001", |
| | | temperature: "25℃", |
| | | ph: "7.0", |
| | | waterAmount: "500ml", |
| | | additive1: "10g", |
| | | additive2: "5g", |
| | | additive3: "3g", |
| | | additive4: "", |
| | | additive5: "", |
| | | additive6: "", |
| | | additive7: "", |
| | | additive8: "", |
| | | additive9: "", |
| | | additive10: "", |
| | | sampleAmount: "100ml", |
| | | sampleTime: "2024-03-20 10:00:00", |
| | | remark: "", |
| | | operator: "张三", |
| | | }, |
| | | { |
| | | index: 2, |
| | | processTime: "4min", |
| | | sampleName: "样品B", |
| | | sampleCode: "SP002", |
| | | temperature: "30℃", |
| | | ph: "6.5", |
| | | waterAmount: "300ml", |
| | | additive1: "8g", |
| | | additive2: "4g", |
| | | additive3: "", |
| | | additive4: "", |
| | | additive5: "", |
| | | additive6: "", |
| | | additive7: "", |
| | | additive8: "", |
| | | additive9: "", |
| | | additive10: "", |
| | | sampleAmount: "50ml", |
| | | sampleTime: "2024-03-20 10:30:00", |
| | | remark: "", |
| | | operator: "李四", |
| | | }, |
| | | ], |
| | | sampleTotal: 2, |
| | | sampleData: [], |
| | | sampleTotal: 0, |
| | | form: { |
| | | sampleCode: "", |
| | | dispatchId: "", // 实验调度id |
| | | samplingCode: "", // 取样单编号 |
| | | status: 1, // 状态:1=已发送待提交 |
| | | samplingRecordOperations: [], // 取样操作记录集合 |
| | | remark: "", // 备注,json存储 |
| | | }, |
| | | rules: { |
| | | sampleCode: [ |
| | | { required: true, message: "请输入取样单编号", trigger: "blur" }, |
| | | ], |
| | | }, |
| | | userRole: "assayer", // engineer默认设置为工程师assayer化验师 |
| | | userRole: '', // 修改初始值为空字符串 |
| | | // 化验师相关数据 |
| | | pendingSamples: [ |
| | | { |
| | | index: 1, |
| | | sampleName: "名称名称名称", |
| | | sampleCode: "314234321", |
| | | ph: "5", |
| | | sampleAmount: "34", |
| | | sendTime: "2025-1-9 15:26:08", |
| | | sender: "李四", |
| | | status: "待接收", |
| | | }, |
| | | { |
| | | index: 2, |
| | | sampleName: "名称名称名称", |
| | | sampleCode: "314234321", |
| | | ph: "6", |
| | | sampleAmount: "23", |
| | | sendTime: "2025-1-9 15:26:08", |
| | | sender: "李四", |
| | | status: "待接收", |
| | | }, |
| | | { |
| | | index: 3, |
| | | sampleName: "名称名称名称", |
| | | sampleCode: "314234321", |
| | | ph: "7", |
| | | sampleAmount: "23", |
| | | sendTime: "2025-1-13 16:38:17", |
| | | sender: "李四", |
| | | status: "待接收", |
| | | }, |
| | | ], |
| | | pendingSamplesTotal: 3, |
| | | receivedSamples: [ |
| | | { |
| | | index: 1, |
| | | sampleName: "名称名称名称", |
| | | sampleCode: "314234321", |
| | | ph: "5", |
| | | sampleAmount: "34", |
| | | sendTime: "2025-1-9 15:26:08", |
| | | sender: "李四", |
| | | receiveTime: "2025-1-15 14:00:50", |
| | | receiver: "段向蒙", |
| | | status: "已接收", |
| | | }, |
| | | { |
| | | index: 2, |
| | | sampleName: "名称名称名称", |
| | | sampleCode: "314234321", |
| | | ph: "6", |
| | | sampleAmount: "23", |
| | | sendTime: "2025-1-9 15:26:08", |
| | | sender: "李四", |
| | | receiveTime: "2025-1-15 14:00:50", |
| | | receiver: "傅彦涛", |
| | | status: "已接收", |
| | | }, |
| | | { |
| | | index: 3, |
| | | sampleName: "名称名称名称", |
| | | sampleCode: "314234321", |
| | | ph: "7", |
| | | sampleAmount: "23", |
| | | sendTime: "2025-1-13 16:38:17", |
| | | sender: "李四", |
| | | receiveTime: "2025-1-15 14:00:50", |
| | | receiver: "王乐康", |
| | | status: "已接收", |
| | | }, |
| | | ], |
| | | receivedSamplesTotal: 3, |
| | | pendingSamples: [], |
| | | pendingSamplesTotal: 0, |
| | | receivedSamples: [], |
| | | receivedSamplesTotal: 0, |
| | | selectedSamples: [], |
| | | // 状态映射表 |
| | | statusTypeMap: { |
| | | "-1": "info", |
| | | "1": "warning", |
| | | "2": "success", |
| | | "3": "info" |
| | | }, |
| | | statusTextMap: { |
| | | "-1": "草稿箱", |
| | | "1": "待确认", |
| | | "2": "已确认", |
| | | "3": "已封存" |
| | | }, |
| | | // 页面类型:add-新增,edit-编辑,detail-详情 |
| | | pageType: 'add', |
| | | }; |
| | | }, |
| | | created() { |
| | | const userInfo = JSON.parse(sessionStorage.getItem('userInfo') || '{}'); |
| | | this.userRole = userInfo.roleType || ''; |
| | | |
| | | // 获取路由参数 |
| | | const { id, type } = this.$route.query; |
| | | if (id) { |
| | | this.pageType = type || 'detail'; |
| | | this.getDetailData(id); |
| | | } |
| | | }, |
| | | computed: { |
| | | isEngineer() { |
| | | return this.userRole === "engineer"; |
| | | return this.userRole == '3'; // 工艺工程师 |
| | | }, |
| | | isAssayer() { |
| | | return this.userRole === "assayer"; |
| | | return this.userRole == '4'; // 化验师 |
| | | }, |
| | | }, |
| | | methods: { |
| | | // 获取详情数据 |
| | | async getDetailData(id) { |
| | | try { |
| | | const res = await getDetail({ id }); |
| | | if (res) { |
| | | const detail = res; |
| | | console.log('获取到的详情数据:', detail); |
| | | |
| | | // 设置表单数据 |
| | | this.form = { |
| | | ...this.form, |
| | | ...detail, |
| | | dispatchId: detail.dispatchId, |
| | | sampleCode: detail.samplingCode, |
| | | }; |
| | | |
| | | // 设置实验调度数据 |
| | | if (detail.experimentDispatch) { |
| | | this.schedulingData = [detail.experimentDispatch]; |
| | | } |
| | | |
| | | // 设置取样操作记录 |
| | | if (detail.samplingRecordOperations && detail.samplingRecordOperations.length > 0) { |
| | | console.log('原始取样操作记录:', detail.samplingRecordOperations); |
| | | |
| | | // 如果是化验师角色,需要将数据分为待接收和已接收 |
| | | if (this.isAssayer) { |
| | | // 确保status是字符串类型 |
| | | this.pendingSamples = detail.samplingRecordOperations |
| | | .filter(item => { |
| | | const status = String(item.status); |
| | | console.log('过滤待接收样品:', item.id, status); |
| | | return status === '2'; |
| | | }) |
| | | .map(item => ({ |
| | | ...item, |
| | | status: String(item.status) |
| | | })); |
| | | console.log('处理后的待接收样品:', this.pendingSamples); |
| | | this.pendingSamplesTotal = this.pendingSamples.length; |
| | | |
| | | this.receivedSamples = detail.samplingRecordOperations |
| | | .filter(item => String(item.status) === '3') |
| | | .map(item => ({ |
| | | ...item, |
| | | status: String(item.status) |
| | | })); |
| | | this.receivedSamplesTotal = this.receivedSamples.length; |
| | | } else { |
| | | // 工程师角色保持原有逻辑 |
| | | this.sampleData = detail.samplingRecordOperations.map((item, index) => ({ |
| | | ...item, |
| | | index: index + 1, |
| | | status: String(item.status) |
| | | })); |
| | | } |
| | | } |
| | | |
| | | // 如果是详情模式,禁用所有输入 |
| | | if (this.pageType == 'detail') { |
| | | this.$nextTick(() => { |
| | | const inputs = document.querySelectorAll('input, textarea, select'); |
| | | inputs.forEach(input => { |
| | | input.disabled = true; |
| | | }); |
| | | }); |
| | | } |
| | | } |
| | | } catch (error) { |
| | | console.error('获取详情失败:', error); |
| | | this.$message.error('获取详情失败,请重试'); |
| | | } |
| | | }, |
| | | handleAddTime(processTime) { |
| | | const newRow = { |
| | | index: this.sampleData.length + 1, |
| | | processTime, |
| | | sampleName: "", |
| | | samplingName: "", |
| | | sampleCode: "", |
| | | temperature: "", |
| | | ph: "", |
| | | waterAmount: "", |
| | | additive1: "", |
| | | additive2: "", |
| | | additive3: "", |
| | | additive4: "", |
| | | additive5: "", |
| | | additive6: "", |
| | | additive7: "", |
| | | additive8: "", |
| | | additive9: "", |
| | | additive10: "", |
| | | samplePh: "", |
| | | waterAddition: "", |
| | | addAuxiliaryOne: "", |
| | | addAuxiliaryTwo: "", |
| | | addAuxiliaryThree: "", |
| | | addAuxiliaryFour: "", |
| | | addAuxiliaryFive: "", |
| | | addAuxiliarySix: "", |
| | | addAuxiliarySeven: "", |
| | | addAuxiliaryEight: "", |
| | | addAuxiliaryNine: "", |
| | | addAuxiliaryTen: "", |
| | | sampleAmount: "", |
| | | sampleTime: "", |
| | | remark: "", |
| | | operator: "", |
| | | pictures: "", |
| | | handlePersonId: "", |
| | | status: 1 // 1=待发送 |
| | | }; |
| | | this.sampleData.push(newRow); |
| | | this.$message.success("添加工艺时间成功"); |
| | | }, |
| | | handleSave() { |
| | | this.submitForm(); |
| | | // 验证是否选择了实验调度 |
| | | if (!this.schedulingData || this.schedulingData.length == 0) { |
| | | this.$message.warning('请选择所属实验调度'); |
| | | return; |
| | | } |
| | | |
| | | // 验证是否有取样操作记录 |
| | | if (!this.sampleData || this.sampleData.length == 0) { |
| | | this.$message.warning('请至少添加一条取样操作记录'); |
| | | return; |
| | | } |
| | | |
| | | this.$refs.form.validate(async (valid) => { |
| | | if (valid) { |
| | | try { |
| | | // 获取当前用户信息 |
| | | const userInfo = JSON.parse(sessionStorage.getItem('userInfo') || '{}'); |
| | | |
| | | // 构建提交数据 |
| | | const submitData = { |
| | | ...this.form, |
| | | dispatchId: this.schedulingData[0].id, |
| | | status: 1, // 正常保存状态为1 |
| | | samplingRecordOperations: this.sampleData.map(item => ({ |
| | | ...item, |
| | | handlePersonId: userInfo.userId, |
| | | status: 1 // 1=待发送 |
| | | })), |
| | | remark: this.form.remark, |
| | | samplingCode: this.form.sampleCode, |
| | | id: this.form.id, |
| | | }; |
| | | |
| | | // 打印提交数据 |
| | | console.log('保存提交数据:',submitData); |
| | | |
| | | let res; |
| | | if (this.pageType == 'edit') { |
| | | // 编辑模式调用update接口 |
| | | res = await update(submitData); |
| | | } else { |
| | | // 新增模式调用add接口 |
| | | res = await add(submitData); |
| | | } |
| | | |
| | | if (res.code == 200) { |
| | | this.$message.success(this.pageType == 'edit' ? '编辑成功' : '保存成功'); |
| | | this.$router.go(-1); |
| | | } else { |
| | | this.$message.error(res.msg || (this.pageType == 'edit' ? '编辑失败' : '保存失败')); |
| | | } |
| | | } catch (error) { |
| | | console.error(this.pageType == 'edit' ? '编辑失败:' : '保存失败:', error); |
| | | this.$message.error(this.pageType == 'edit' ? '编辑失败,请重试' : '保存失败,请重试'); |
| | | } |
| | | } |
| | | }); |
| | | }, |
| | | submitForm() { |
| | | // 在这里实现表单提交逻辑 |
| | | console.log("提交表单数据"); |
| | | this.$message.success("保存成功"); |
| | | // 添加存草稿方法 |
| | | async handleSaveDraft() { |
| | | try { |
| | | // 获取当前用户信息 |
| | | const userInfo = JSON.parse(sessionStorage.getItem('userInfo') || '{}'); |
| | | |
| | | // 构建提交数据 |
| | | const submitData = { |
| | | dispatchId: this.schedulingData?.[0]?.id || '', |
| | | status: -1, // 存草稿状态为-1 |
| | | samplingRecordOperations: (this.sampleData || []).map(item => ({ |
| | | ...item, |
| | | handlePersonId: userInfo.userId, |
| | | status: 1 // 1=待发送 |
| | | })), |
| | | remark: this.form.remark, |
| | | samplingCode: this.form.sampleCode, |
| | | id: this.form.id, |
| | | }; |
| | | |
| | | // 打印提交数据 |
| | | console.log('草稿提交数据:', submitData); |
| | | |
| | | let res; |
| | | if (this.pageType == 'edit') { |
| | | // 编辑模式调用update接口 |
| | | res = await update(submitData); |
| | | } else { |
| | | // 新增模式调用add接口 |
| | | res = await add(submitData); |
| | | } |
| | | |
| | | if (res.code == 200) { |
| | | this.$message.success(this.pageType == 'edit' ? '草稿保存成功' : '存草稿成功'); |
| | | this.$router.go(-1); |
| | | } else { |
| | | this.$message.error(res.msg || (this.pageType == 'edit' ? '草稿保存失败' : '存草稿失败')); |
| | | } |
| | | } catch (error) { |
| | | console.error(this.pageType == 'edit' ? '草稿保存失败:' : '存草稿失败:', error); |
| | | this.$message.error(this.pageType == 'edit' ? '草稿保存失败,请重试' : '存草稿失败,请重试'); |
| | | } |
| | | }, |
| | | handleSelectionChange(selection) { |
| | | handlePendingSelectionChange(selection) { |
| | | console.log("pending selection change:", selection); |
| | | console.log("pending samples data:", this.pendingSamples); |
| | | this.selectedSamples = selection; |
| | | // 强制更新视图 |
| | | this.$nextTick(() => { |
| | | this.$forceUpdate(); |
| | | }); |
| | | }, |
| | | handleReceive(row) { |
| | | // 清空之前的选择 |
| | | this.selectedSamples = []; |
| | | // 设置当前行为选中状态 |
| | | this.selectedSamples = [row]; |
| | | this.showReceiveConfirm = true; |
| | | }, |
| | | handleBatchReceive() { |
| | | if (this.selectedSamples.length === 0) { |
| | | if (this.selectedSamples.length == 0) { |
| | | this.$message.warning("请先选择要接收的样品"); |
| | | return; |
| | | } |
| | | this.showReceiveConfirm = true; |
| | | }, |
| | | confirmReceive(signature) { |
| | | // 这里处理接收确认逻辑 |
| | | const sampleIds = this.selectedSamples.map((item) => item.id); |
| | | console.log("接收样品", { sampleIds, signature }); |
| | | |
| | | // 模拟接收成功 |
| | | this.$message.success(`成功接收 ${this.selectedSamples.length} 个样品`); |
| | | |
| | | // 更新数据 |
| | | this.selectedSamples.forEach((sample) => { |
| | | const index = this.pendingSamples.findIndex( |
| | | (item) => item.id === sample.id |
| | | ); |
| | | if (index > -1) { |
| | | this.pendingSamples.splice(index, 1); |
| | | this.receivedSamples.unshift({ |
| | | ...sample, |
| | | receiveTime: new Date().toLocaleString(), |
| | | receiver: "当前用户", |
| | | status: "已接收", |
| | | }); |
| | | // 获取选中样品的ID并拼接 |
| | | const recordOperationIds = this.selectedSamples.map(item => item.id).join(','); |
| | | |
| | | // 调用批量收样接口 |
| | | batchCollectSamples({ |
| | | receiptsSign: signature, |
| | | recordOperationId: recordOperationIds |
| | | }).then(res => { |
| | | if (res.code == 200) { |
| | | this.$message.success(`成功接收 ${this.selectedSamples.length} 个样品`); |
| | | // 重新获取详情数据 |
| | | this.getDetailData(this.form.id); |
| | | } else { |
| | | this.$message.error(res.msg || '收样失败'); |
| | | } |
| | | }).catch(error => { |
| | | console.error('收样失败:', error); |
| | | this.$message.error('收样失败,请重试'); |
| | | }).finally(() => { |
| | | // 清空选择并关闭弹窗 |
| | | this.selectedSamples = []; |
| | | this.showReceiveConfirm = false; |
| | | }); |
| | | |
| | | // 清空选择 |
| | | this.selectedSamples = []; |
| | | }, |
| | | getStatusType(status) { |
| | | return this.statusTypeMap[status] || 'info'; |
| | | }, |
| | | getStatusText(status) { |
| | | return this.statusTextMap[status] || '未知状态'; |
| | | }, |
| | | handleSchedulingClose() { |
| | | this.showScheduling = false; |
| | | }, |
| | | handleSchedulingSubmit(data) { |
| | | this.schedulingData = data || []; |
| | | |
| | | }, |
| | | isSelectable(row) { |
| | | console.log('isSelectable row:', row); |
| | | console.log('row status:', row.status, typeof row.status); |
| | | const result = String(row.status) === '2'; |
| | | console.log('isSelectable result:', result); |
| | | return result; |
| | | }, |
| | | }, |
| | | }; |
| | |
| | | <template> |
| | | <div> |
| | | <el-dialog title="选择实验调度" :visible.sync="show" width="80%"> |
| | | <TableCustom :queryForm="form" :tableData="tableData" :total="total" :height="null"> |
| | | <el-dialog title="选择实验调度" :visible.sync="show" width="80%" @close="$emit('close', false)"> |
| | | <TableCustom |
| | | :queryForm="form" :tableData="tableData" |
| | | :total="total" :height="null" |
| | | @handleCurrentChange="handleCurrentChange" |
| | | @selection-change="changeSelectedRows" |
| | | @handleSizeChange="handleSizeChange"> |
| | | <template #search> |
| | | <el-form :model="form" label-width="140px" inline> |
| | | <el-form-item label="所属项目课题方案:"> |
| | |
| | | <el-form-item label="实验编号:"> |
| | | <el-input v-model="form.experimentCode" placeholder="请输入"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="实验名称:"> |
| | | <el-input v-model="form.experimentName" placeholder="请输入"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="通知时间:"> |
| | | <el-date-picker |
| | | v-model="form.createTime" |
| | | type="daterange" |
| | | range-separator="至" |
| | | start-placeholder="开始日期" |
| | | end-placeholder="结束日期" |
| | | value-format="yyyy-MM-dd"> |
| | | </el-date-picker> |
| | | <el-date-picker v-model="form.createTime" type="daterange" range-separator="至" |
| | | start-placeholder="开始日期" end-placeholder="结束日期" |
| | | value-format="yyyy-MM-dd" @change="handleDateChange"></el-date-picker> |
| | | </el-form-item> |
| | | <el-form-item label="状态:"> |
| | | <el-select v-model="form.status" placeholder="请选择"> |
| | | <el-option label="草稿箱" :value="-1"></el-option> |
| | | <el-option label="待确认" :value="1"></el-option> |
| | | <el-option label="已确认" :value="2"></el-option> |
| | | <el-option label="已封存" :value="3"></el-option> |
| | | <el-option label="全部" value=""></el-option> |
| | | <el-option label="待确认" value="1"></el-option> |
| | | <el-option label="已确认" value="2"></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="" class="search-btn-box"> |
| | |
| | | </template> |
| | | |
| | | <template #table> |
| | | <el-table-column prop="planCode" label="所属项目课题方案"></el-table-column> |
| | | <el-table-column prop="planName" label="实验编号"></el-table-column> |
| | | <el-table-column prop="planName" label="实验名称"></el-table-column> |
| | | <el-table-column prop="stage" label="通知时间"></el-table-column> |
| | | <el-table-column prop="stage" label="实验开始时间"></el-table-column> |
| | | <el-table-column prop="stage" label="实验结束时间"></el-table-column> |
| | | <el-table-column prop="stage" label="参加人员"></el-table-column> |
| | | <el-table-column prop="creator" label="状态"></el-table-column> |
| | | <el-table-column type="selection" width="55"></el-table-column> |
| | | <el-table-column prop="projectName" label="所属项目课题方案"></el-table-column> |
| | | <el-table-column prop="experimentCode" label="实验编号"></el-table-column> |
| | | <el-table-column prop="experimentName" label="实验名称"></el-table-column> |
| | | <el-table-column prop="experimentDate" label="通知时间"></el-table-column> |
| | | <el-table-column prop="experimentStartTime" label="实验开始时间"></el-table-column> |
| | | <el-table-column prop="experimentEndTime" label="实验结束时间"></el-table-column> |
| | | <el-table-column prop="participantsName" label="参加人员"></el-table-column> |
| | | <el-table-column prop="status" label="状态"> |
| | | <template slot-scope="scope"> |
| | | <el-tag :type="getStatusType(scope.row.status)"> |
| | | {{ getStatusText(scope.row.status) }} |
| | | </el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | </template> |
| | | </TableCustom> |
| | | <span slot="footer" class="dialog-footer"> |
| | | <el-button @click="show = false">取 消</el-button> |
| | | <el-button type="primary" @click="show = false">确 定</el-button> |
| | | <span slot="footer" class="select-member-footer"> |
| | | <el-button @click="$emit('close', false)">取 消</el-button> |
| | | <el-button type="primary" @click="handleConfirm">确 定</el-button> |
| | | </span> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import { getDispatchList } from '../service'; |
| | | import { getDispatchList } from "../service"; |
| | | |
| | | export default { |
| | | props: ['show'], |
| | | props: { |
| | | show: { |
| | | type: Boolean, |
| | | default: false |
| | | } |
| | | }, |
| | | data() { |
| | | return { |
| | | form: { |
| | | projectName: "", |
| | | experimentCode: "", |
| | | createTime: [], |
| | | status: null, |
| | | experimentName: "", |
| | | startTime: "", |
| | | endTime: "", |
| | | status: "", |
| | | pageNum: 1, |
| | | pageSize: 10 |
| | | }, |
| | | tableData: [], |
| | | total: 0 |
| | | }; |
| | | total: 0, |
| | | selectedRows: [] |
| | | } |
| | | }, |
| | | watch: { |
| | | show(val) { |
| | | if (val) { |
| | | this.getTableData(); |
| | | } |
| | | } |
| | | }, |
| | | methods: { |
| | | handleDateChange(val) { |
| | | if (val) { |
| | | this.form.startTime = val[0]; |
| | | this.form.endTime = val[1]; |
| | | } else { |
| | | this.form.startTime = ""; |
| | | this.form.endTime = ""; |
| | | } |
| | | }, |
| | | resetForm() { |
| | | this.form = { |
| | | projectName: "", |
| | | experimentCode: "", |
| | | createTime: [], |
| | | status: null, |
| | | experimentName: "", |
| | | startTime: "", |
| | | endTime: "", |
| | | status: "", |
| | | pageNum: 1, |
| | | pageSize: 10 |
| | | }; |
| | | this.handleSearch(); |
| | | this.getTableData(); |
| | | }, |
| | | async handleSearch() { |
| | | const params = { |
| | | projectName: this.form.projectName, |
| | | experimentCode: this.form.experimentCode, |
| | | startTime: this.form.createTime[0] || null, |
| | | endTime: this.form.createTime[1] || null, |
| | | status: this.form.status, |
| | | pageNum: this.form.pageNum, |
| | | pageSize: this.form.pageSize |
| | | handleSearch() { |
| | | this.form.pageNum = 1; |
| | | this.getTableData(); |
| | | }, |
| | | getStatusType(status) { |
| | | const statusMap = { |
| | | "-1": "info", |
| | | "1": "warning", |
| | | "2": "success", |
| | | "3": "info" |
| | | }; |
| | | try { |
| | | const res = await getDispatchList(params); |
| | | this.tableData = res.records || []; |
| | | this.total = res.total || 0; |
| | | } catch (error) { |
| | | console.error("查询失败:", error); |
| | | return statusMap[status] || "info"; |
| | | }, |
| | | getStatusText(status) { |
| | | const statusMap = { |
| | | "-1": "草稿箱", |
| | | "1": "待确认", |
| | | "2": "已确认", |
| | | "3": "已封存" |
| | | }; |
| | | return statusMap[status] || "未知"; |
| | | }, |
| | | getTableData() { |
| | | const params = { |
| | | ...this.form |
| | | }; |
| | | getDispatchList(params).then(res => { |
| | | console.log('222222222222',res) |
| | | if (res.code==200) { |
| | | this.tableData = res.data.records || []; |
| | | this.total = res.data.total || 0; |
| | | } |
| | | }); |
| | | }, |
| | | handleCurrentChange(val) { |
| | | this.form.pageNum = val; |
| | | this.getTableData(); |
| | | }, |
| | | handleSizeChange(val) { |
| | | this.form.pageSize = val; |
| | | this.form.pageNum = 1; |
| | | this.getTableData(); |
| | | }, |
| | | changeSelectedRows(val) { |
| | | console.log('val',val) |
| | | this.selectedRows = val; |
| | | }, |
| | | handleCancel() { |
| | | this.$emit('update:show', false); |
| | | }, |
| | | handleConfirm() { |
| | | if (!this.selectedRows || this.selectedRows.length === 0) { |
| | | this.$message.warning('请至少选择一条数据'); |
| | | return; |
| | | } |
| | | if (this.selectedRows.length != 1) { |
| | | this.$message.warning('请选择一条数据'); |
| | | return; |
| | | } |
| | | this.$emit('submit', this.selectedRows); |
| | | this.$emit('close', false); |
| | | } |
| | | } |
| | | }; |
| | | } |
| | | </script> |
| | | |
| | | <style lang="less" scoped> |
| | | .dialog-footer { |
| | | .select-member-footer { |
| | | display: flex; |
| | | justify-content: center; |
| | | gap: 10px; |
| | | } |
| | | ::v-deep .el-range-editor--small { |
| | | line-height: 30px !important; |
| | | justify-content: flex-end; |
| | | } |
| | | </style> |
| | |
| | | }, |
| | | handleSignatureConfirm(imageData) { |
| | | this.signatureDialogVisible = false; |
| | | this.imgSrc = imageData; |
| | | // this.imgSrc = imageData; |
| | | this.imgSrc = 'https://img.yzcdn.cn/vant/ipad.png'; |
| | | }, |
| | | handleConfirm() { |
| | | if (!this.imgSrc) { |
| | |
| | | <template> |
| | | <div class="list"> |
| | | <TableCustom :queryForm="form" :tableData="tableData" :total="total"> |
| | | <TableCustom :queryForm="form" :height="null" :tableData="tableData" :total="total" @handlePageChange="handlePageChange" @handleSizeChange="handleSizeChange" > |
| | | <template #search> |
| | | <el-form :model="form" labelWidth="auto" inline> |
| | | <el-form-item label="实验编号:"> |
| | | <el-input v-model="form.experimentCode" placeholder="请输入"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="实验名称:"> |
| | | <el-input v-model="form.experimentName" placeholder="请输入"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="所属项目课题方案:"> |
| | | <el-input v-model="form.projectName" placeholder="请输入"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="实验编号:"> |
| | | <el-input v-model="form.experimentCode" placeholder="请输入"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="创建时间:"> |
| | | <el-date-picker |
| | |
| | | </el-form-item> |
| | | <el-form-item label="状态:"> |
| | | <el-select v-model="form.status" placeholder="请选择"> |
| | | <el-option label="全部" :value="null"></el-option> |
| | | <el-option label="草稿箱" :value="-1"></el-option> |
| | | <el-option label="已发送待提交" :value="1"></el-option> |
| | | <el-option label="已提交" :value="2"></el-option> |
| | |
| | | </el-form-item> |
| | | <el-form-item label=""> |
| | | <el-button type="default" @click="resetForm">重置</el-button> |
| | | <el-button type="primary" @click="handleSearch">查询</el-button> |
| | | <el-button type="primary" @click="handleSearch" style="margin-left: 10px;">查询</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | </template> |
| | |
| | | <div class="tableTitle"> |
| | | <div class="flex a-center"> |
| | | <div |
| | | class="title" |
| | | :class="{active:currentType === 'list'}" |
| | | class="title" |
| | | :class="{active:currentType == 'list'}" |
| | | @click="handleTypeChange('list')" |
| | | >取样操作记录列表</div> |
| | | <div |
| | | class="drafts" |
| | | :class="{active:currentType === 'draft'}" |
| | | v-if="isProcessEngineer" |
| | | class="title" |
| | | :class="{active:currentType == 'draft'}" |
| | | @click="handleTypeChange('draft')" |
| | | >草稿箱</div> |
| | | </div> |
| | | <el-button @click="handleAddSample" class="el-icon-plus" type="primary"> |
| | | <el-button v-if="isProcessEngineer" @click="handleAddSample" class="el-icon-plus" type="primary"> |
| | | 新增取样操作记录</el-button |
| | | > |
| | | </div> |
| | |
| | | :prop="column.prop" |
| | | :label="column.label" |
| | | ></el-table-column> |
| | | <el-table-column label="操作" width="100"> |
| | | <el-table-column label="样品总数/待接收/已接收" v-if="isChemist"> |
| | | <template slot-scope="scope"> |
| | | <el-button type="text" @click="handleDetail(scope.row.id)">详情</el-button> |
| | | {{ getSampleStatus(scope.row) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="操作" width="200"> |
| | | <template slot-scope="scope"> |
| | | <el-button v-if="currentType == 'list'" type="text" @click="handleDetail(scope.row.id)">详情</el-button> |
| | | <template v-if="currentType == 'draft'"> |
| | | <el-button type="text" @click="handleEdit(scope.row)">编辑</el-button> |
| | | <el-button type="text" @click="handleDelete(scope.row)" style="color: #F56C6C;">删除</el-button> |
| | | </template> |
| | | </template> |
| | | </el-table-column> |
| | | </template> |
| | | </TableCustom> |
| | | <!-- 审批弹窗 --> |
| | | <approval-dialog |
| | | :visible.sync="approvalDialogVisible" |
| | | :type="approvalDialogType" |
| | | :data="currentApprovalData" |
| | | @approve="handleApproveSubmit" |
| | | @reject="handleRejectSubmit" |
| | | <!-- 删除确认弹窗 --> |
| | | <ShowDelConfirm |
| | | :title="changeStatusTitle" |
| | | :tip="changeStatusTip" |
| | | :show="changeStatus" |
| | | @close="changeStatus = false" |
| | | @confirm="handleChangeStatusConfirm" |
| | | /> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import ApprovalDialog from './components/approvalDialog.vue' |
| | | import { getList } from './service' |
| | | import ShowDelConfirm from "@/components/showDelConfirm/index.vue"; |
| | | import { getList, deleteById } from './service' |
| | | |
| | | export default { |
| | | name: "ProjectList", |
| | | components: { |
| | | ApprovalDialog |
| | | ShowDelConfirm |
| | | }, |
| | | data() { |
| | | return { |
| | | userRole: 'chemist', // 用户角色 |
| | | userRole: '', // 用户角色 |
| | | currentType: 'list', // 当前显示类型:list-列表,draft-草稿箱 |
| | | form: { |
| | | experimentCode: "", |
| | |
| | | }, |
| | | tableData: [], |
| | | total: 0, |
| | | // 确认弹窗相关数据 |
| | | changeStatus: false, |
| | | changeStatusTitle: "", |
| | | changeStatusTip: "", |
| | | currentOperationRow: null, // 当前操作的行数据 |
| | | // 不同角色的表头配置 |
| | | columnConfig: { |
| | | default: [ |
| | | { prop: 'projectPlan', label: '所属项目课题方案' }, |
| | | { prop: 'experimentNo', label: '实验编号' }, |
| | | { prop: 'projectName', label: '所属项目课题方案' }, |
| | | { prop: 'experimentCode', label: '实验编号' }, |
| | | { prop: 'experimentName', label: '实验名称' }, |
| | | { prop: 'sampleNo', label: '取样单编号' }, |
| | | { prop: 'creator', label: '创建人' }, |
| | | { prop: 'samplingCode', label: '取样单编号' }, |
| | | { prop: 'createBy', label: '创建人' }, |
| | | { prop: 'createTime', label: '创建时间' }, |
| | | { prop: 'sendTo', label: '发送对象' }, |
| | | { prop: 'sendTime', label: '发送时间' } |
| | | ], |
| | | chemist: [ |
| | | { prop: 'projectPlan', label: '所属项目课题方案' }, |
| | | { prop: 'experimentNo', label: '实验编号' }, |
| | | '4': [ |
| | | { prop: 'projectName', label: '所属项目课题方案' }, |
| | | { prop: 'experimentCode', label: '实验编号' }, |
| | | { prop: 'experimentName', label: '实验名称' }, |
| | | { prop: 'sampleNo', label: '取样单编号' }, |
| | | { prop: 'creator', label: '创建人' }, |
| | | { prop: 'samplingCode', label: '取样单编号' }, |
| | | { prop: 'createBy', label: '创建人' }, |
| | | { prop: 'createTime', label: '创建时间' }, |
| | | { prop: 'sampleCount', label: '样品总数' }, |
| | | { prop: 'receivedCount', label: '待接收' }, |
| | | { prop: 'completedCount', label: '已接收' } |
| | | // { prop: 'sampleCount', label: '样品总数' }, |
| | | // { prop: 'receivedCount', label: '待接收' }, |
| | | // { prop: 'completedCount', label: '已接收' } |
| | | ] |
| | | }, |
| | | // 模拟数据 |
| | | mockListData: [ |
| | | { |
| | | id: '1', |
| | | projectPlan: '2024年度实验室设备性能评估方案', |
| | | experimentNo: 'EXP20240315001', |
| | | experimentName: '设备性能测试实验A', |
| | | sampleNo: 'SAMPLE20240315001', |
| | | creator: '张三', |
| | | createTime: '2024-03-15 09:30:00', |
| | | sendTo: '质检部门', |
| | | sendTime: '2024-03-15 10:00:00', |
| | | sampleCount: 5, |
| | | receivedCount: 2, |
| | | completedCount: 3 |
| | | }, |
| | | { |
| | | id: '2', |
| | | projectPlan: '新型材料研究项目方案', |
| | | experimentNo: 'EXP20240315002', |
| | | experimentName: '材料强度测试实验', |
| | | sampleNo: 'SAMPLE20240315002', |
| | | creator: '李四', |
| | | createTime: '2024-03-15 11:30:00', |
| | | sendTo: '研发部门', |
| | | sendTime: '2024-03-15 14:00:00', |
| | | sampleCount: 3, |
| | | receivedCount: 1, |
| | | completedCount: 2 |
| | | }, |
| | | { |
| | | id: '3', |
| | | projectPlan: '环境监测系统优化方案', |
| | | experimentNo: 'EXP20240315003', |
| | | experimentName: '空气质量检测实验', |
| | | sampleNo: 'SAMPLE20240315003', |
| | | creator: '王五', |
| | | createTime: '2024-03-15 15:30:00', |
| | | sendTo: '环境监测组', |
| | | sendTime: '2024-03-15 16:00:00' |
| | | }, |
| | | { |
| | | id: '4', |
| | | projectPlan: '生物样本分析项目', |
| | | experimentNo: 'EXP20240315004', |
| | | experimentName: '细胞活性测试', |
| | | sampleNo: 'SAMPLE20240315004', |
| | | creator: '赵六', |
| | | createTime: '2024-03-15 16:30:00', |
| | | sendTo: '生物实验室', |
| | | sendTime: '2024-03-15 17:00:00' |
| | | } |
| | | ], |
| | | mockDraftData: [ |
| | | { |
| | | id: '5', |
| | | projectPlan: '化学反应监测方案', |
| | | experimentNo: 'EXP20240316001', |
| | | experimentName: '催化剂效率测试', |
| | | sampleNo: 'SAMPLE20240316001', |
| | | creator: '孙七', |
| | | createTime: '2024-03-16 09:30:00', |
| | | sendTo: '化学实验室', |
| | | sendTime: '2024-03-16 10:00:00' |
| | | }, |
| | | { |
| | | id: '6', |
| | | projectPlan: '药物稳定性研究方案', |
| | | experimentNo: 'EXP20240316002', |
| | | experimentName: '药物降解测试', |
| | | sampleNo: 'SAMPLE20240316002', |
| | | creator: '周八', |
| | | createTime: '2024-03-16 11:30:00', |
| | | sendTo: '药物研究部', |
| | | sendTime: '2024-03-16 14:00:00' |
| | | } |
| | | ], |
| | | approvalDialogVisible: false, |
| | | approvalDialogType: 'approve', |
| | | currentApprovalData: null, |
| | | } |
| | | }; |
| | | }, |
| | | computed: { |
| | |
| | | }, |
| | | // 判断是否为化验师角色 |
| | | isChemist() { |
| | | return this.userRole === 'chemist'; |
| | | return this.userRole == '4'; |
| | | }, |
| | | // 判断是否为工艺工程师角色 |
| | | isProcessEngineer() { |
| | | return this.userRole == '3'; // 假设工艺工程师的角色代码为2 |
| | | } |
| | | }, |
| | | created() { |
| | |
| | | this.getTableData(); |
| | | }, |
| | | methods: { |
| | | getSampleStatus(row) { |
| | | const send = row.sendCount || 0; |
| | | const receive = row.receiveCount || 0; |
| | | const received = row.receivedCount || 0; |
| | | const total = send + receive + received; |
| | | return `${total} / ${receive} / ${received}`; |
| | | }, |
| | | // 获取用户角色 |
| | | async getUserRole() { |
| | | // TODO: 从用户信息或接口中获取角色 |
| | | // 示例:this.userRole = await getUserRole(); |
| | | this.userRole = 'chemist'; // 临时写死,实际应该从接口获取 |
| | | getUserRole() { |
| | | const userInfo = JSON.parse(sessionStorage.getItem('userInfo') || '{}'); |
| | | this.userRole = userInfo.roleType || ''; |
| | | }, |
| | | resetForm() { |
| | | this.form = { |
| | |
| | | projectName: this.form.projectName, |
| | | startTime: this.form.createTime[0] || null, |
| | | endTime: this.form.createTime[1] || null, |
| | | status: this.form.status, |
| | | status: this.currentType == 'draft' ? -1 : this.form.status, |
| | | pageNum: this.form.pageNum, |
| | | pageSize: this.form.pageSize |
| | | }; |
| | | try { |
| | | const res = await getList(params) |
| | | this.tableData = res.records || []; |
| | | this.total = res.total || 0; |
| | | this.tableData = res.data.records || []; |
| | | this.total = res.data.total || 0; |
| | | } catch (error) { |
| | | console.error("查询失败:", error); |
| | | } |
| | | }, |
| | | getStatusType(status) { |
| | | const statusMap = { |
| | | pending: "warning", |
| | | rejected: "danger", |
| | | approved: "success", |
| | | archived: "info", |
| | | draft: "info" |
| | | }; |
| | | return statusMap[status] || "info"; |
| | | }, |
| | | getStatusText(status) { |
| | | const statusMap = { |
| | | pending: "待审批", |
| | | rejected: "已驳回", |
| | | approved: "已通过", |
| | | archived: "已封存", |
| | | draft: "草稿" |
| | | }; |
| | | return statusMap[status] || "未知"; |
| | | }, |
| | | handleAddSample() { |
| | | this.$router.push({ |
| | | path: "/sampleManage/addSample", |
| | | }); |
| | | }, |
| | | handleApprove(row) { |
| | | this.currentApprovalData = row; |
| | | this.approvalDialogType = 'approve'; |
| | | this.approvalDialogVisible = true; |
| | | }, |
| | | handleApproveSubmit(data) { |
| | | // 处理审批通过 |
| | | console.log('审批通过:', data); |
| | | this.approvalDialogVisible = false; |
| | | this.$message.success('审批通过成功'); |
| | | this.getTableData(); |
| | | }, |
| | | handleRejectSubmit(data) { |
| | | // 处理审批驳回 |
| | | console.log('审批驳回:', data); |
| | | this.approvalDialogVisible = false; |
| | | this.$message.success('审批驳回成功'); |
| | | this.getTableData(); |
| | | }, |
| | | handleRevokeApprove(row) { |
| | | // 实现撤销审批逻辑 |
| | | console.log("撤销审批数据:", row); |
| | | }, |
| | | handleEdit(row) { |
| | | // 实现编辑逻辑 |
| | | console.log("编辑数据:", row); |
| | | this.$router.push({ |
| | | path: "/sampleManage/addSample", |
| | | query: { |
| | | id: row.id, |
| | | type: 'edit' |
| | | } |
| | | }); |
| | | }, |
| | | handleDelete(row) { |
| | | // 实现删除逻辑 |
| | | console.log("删除数据:", row); |
| | | this.currentOperationRow = row; |
| | | this.changeStatusTitle = "确认要删除这条信息吗?"; |
| | | this.changeStatusTip = "删除后信息无法找回"; |
| | | this.changeStatus = true; |
| | | }, |
| | | handleDetail(id) { |
| | | this.$router.push({ |
| | | path: "/sampleManage/addSample", |
| | | query: { |
| | | id: id |
| | | id: id, |
| | | type: 'detail' |
| | | } |
| | | }); |
| | | }, |
| | |
| | | }, |
| | | getTableData() { |
| | | this.handleSearch(); |
| | | }, |
| | | handlePageChange(pageNum) { |
| | | this.form.pageNum = pageNum; |
| | | this.getTableData(); |
| | | }, |
| | | handleSizeChange(pageSize) { |
| | | this.form.pageSize = pageSize; |
| | | this.getTableData(); |
| | | }, |
| | | handleChangeStatusConfirm() { |
| | | // 处理删除逻辑 |
| | | deleteById({ |
| | | id: this.currentOperationRow.id |
| | | }).then(() => { |
| | | this.$message.success("删除成功"); |
| | | this.changeStatus = false; |
| | | this.getTableData(); |
| | | }).catch(error => { |
| | | this.$message.error("删除失败"); |
| | | }); |
| | | }, |
| | | }, |
| | | }; |
| | |
| | | border-radius: 8px 8px 0px 0px; |
| | | border: 1px solid #dcdfe6; |
| | | padding: 16px 29px; |
| | | font-weight: bold; |
| | | font-weight: 400; |
| | | font-size: 18px; |
| | | color: #606266; |
| | | width: unset; |
| | | cursor: pointer; |
| | | } |
| | | .drafts { |
| | | padding: 16px 65px; |
| | | background: #fafafc; |
| | | border-radius: 8px 8px 0px 0px; |
| | | border: 1px solid #dcdfe6; |
| | | font-weight: 400; |
| | | font-size: 18px; |
| | | color: #606266; |
| | | margin-left: 16px; |
| | | cursor: pointer; |
| | | } |
| | | .active{ |
| | | color: #049c9a; |
| | | background: #ffffff; |
| | | border-radius: 8px 8px 0px 0px; |
| | | border: 1px solid #049c9a; |
| | | margin-right: 16px; |
| | | &:last-child { |
| | | margin-right: 0; |
| | | } |
| | | &.active { |
| | | color: #049c9a; |
| | | background: #ffffff; |
| | | border-radius: 8px 8px 0px 0px; |
| | | border: 1px solid #049c9a; |
| | | font-weight: bold; |
| | | } |
| | | } |
| | | } |
| | | </style> |
| | |
| | | |
| | | // 列表 |
| | | export const getList = (data) => { |
| | | return axios.post('/t-sampling-record/api/t-sampling-record/pageList', { ...data }) |
| | | return axios.post('/api/t-sampling-record/pageList', { ...data }) |
| | | } |
| | | // 详情 |
| | | export const getDetail = (data) => { |
| | | return axios.get('/open/t-sampling-record/getDetailById', { params:data }) |
| | | } |
| | | //添加 |
| | | export const add = (data) => { |
| | | return axios.post('/api/t-sampling-record/add', { ...data }) |
| | | } |
| | | //修改 |
| | | export const update = (data) => { |
| | | return axios.post('/api/t-sampling-record/update', { ...data }) |
| | | } |
| | | //删除 |
| | | export const deleteById = (data) => { |
| | | return axios.delete('/open/t-sampling-record/deleteById', { params:data }) |
| | | } |
| | | //批量删除 |
| | | export const deleteByIds = (data) => { |
| | | return axios.delete('/open/t-sampling-record/deleteByIds', { params:data }) |
| | | } |
| | | |
| | | // 获取实验调度分页列表 |
| | | // 实验员提交记录 |
| | | export const commitRecord = (data) => { |
| | | return axios.post('/api/t-sampling-record/commitRecord', { params:data }) |
| | | } |
| | | // 修改取样操作记录 |
| | | export const updateRecordOperation = (data) => { |
| | | return axios.post('/api/t-sampling-record/updateRecordOperation', { params:data }) |
| | | } |
| | | // 批量收样 |
| | | export const batchCollectSamples = (data) => { |
| | | return axios.post('/open/t-sampling-record/batchCollectSamples', { ...data }) |
| | | } |
| | | // 批量送样 |
| | | export const batchSendSamples = (data) => { |
| | | return axios.post('/open/t-sampling-record/batchSendSamples', { params:data }) |
| | | } |
| | | |
| | | // 获取实验调度列表 |
| | | export const getDispatchList = (data) => { |
| | | return axios.post('/t-experiment-dispatch/api/t-experiment-dispatch/pageList', { ...data }) |
| | | } |
| | | return axios.post('/api/t-experiment-dispatch/pageList', { params:data }) |
| | | } |
| | |
| | | <template> |
| | | <Card> |
| | | <div class="header-title-left"> |
| | | <img src="@/assets/public/headercard.png" /> |
| | | <div>所属实验调度</div> |
| | | </div> |
| | | <Table :data="schedulingData" :total="0" :height="null"> |
| | | <template> |
| | | <el-table-column type="index" label="序号" width="80"></el-table-column> |
| | | <el-table-column prop="projectName" label="所属项目课题方案"></el-table-column> |
| | | <el-table-column prop="experimentCode" label="实验编号"></el-table-column> |
| | | <el-table-column prop="experimentName" label="实验名称"></el-table-column> |
| | | <el-table-column prop="experimentDate" label="通知时间"></el-table-column> |
| | | <el-table-column prop="experimentStartTime" label="实验开始时间"></el-table-column> |
| | | <el-table-column prop="experimentEndTime" label="实验结束时间"></el-table-column> |
| | | <el-table-column prop="participantsName" label="参加人员"></el-table-column> |
| | | <el-table-column prop="status" label="状态"> |
| | | <template slot-scope="scope"> |
| | | <el-tag :type="getStatusType(scope.row.status)"> |
| | | {{ getStatusText(scope.row.status) }} |
| | | </el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | </template> |
| | | </Table> |
| | | <div class="header-title-left" style="margin-top: 38px"> |
| | | <img src="@/assets/public/headercard.png" /> |
| | | <span>基础信息</span> |
| | | </div> |
| | | <div class="number">取样单编号:213421241</div> |
| | | <div class="number">取样单编号:{{ detailData.samplingCode || '-' }}</div> |
| | | <div class="header-title-left" style="margin-top: 38px"> |
| | | <img src="@/assets/public/headercard.png" /> |
| | | <span>取样操作记录</span> |
| | |
| | | </div> |
| | | <Table :data="sampleData" :total="sampleTotal" :height="null"> |
| | | <template> |
| | | <el-table-column prop="index" label="序号" width="80"></el-table-column> |
| | | <el-table-column |
| | | prop="processTime" |
| | | label="工艺时间" |
| | | width="120" |
| | | ></el-table-column> |
| | | <el-table-column |
| | | prop="sampleName" |
| | | label="取样名称" |
| | | width="150" |
| | | ></el-table-column> |
| | | <el-table-column |
| | | prop="sampleCode" |
| | | label="取样样品编号" |
| | | width="150" |
| | | ></el-table-column> |
| | | <el-table-column |
| | | prop="temperature" |
| | | label="温度" |
| | | width="100" |
| | | ></el-table-column> |
| | | <el-table-column prop="ph" label="PH" width="100"></el-table-column> |
| | | <el-table-column |
| | | prop="waterAmount" |
| | | label="加水量" |
| | | width="100" |
| | | ></el-table-column> |
| | | <el-table-column type="index" label="序号" width="80"></el-table-column> |
| | | <el-table-column prop="processTime" label="工艺时间" width="150"></el-table-column> |
| | | <el-table-column prop="samplingName" label="取样名称" width="150"></el-table-column> |
| | | <el-table-column prop="sampleCode" label="取样样品编号" width="150"></el-table-column> |
| | | <el-table-column prop="temperature" label="温度" width="150"></el-table-column> |
| | | <el-table-column prop="samplePh" label="PH" width="150"></el-table-column> |
| | | <el-table-column prop="waterAddition" label="加水量" width="150"></el-table-column> |
| | | <template v-if="showAdditives"> |
| | | <el-table-column |
| | | prop="additive1" |
| | | label="加辅1" |
| | | width="150" |
| | | ></el-table-column> |
| | | <el-table-column |
| | | prop="additive2" |
| | | label="加辅2" |
| | | width="150" |
| | | ></el-table-column> |
| | | <el-table-column |
| | | prop="additive3" |
| | | label="加辅3" |
| | | width="150" |
| | | ></el-table-column> |
| | | <el-table-column |
| | | prop="additive4" |
| | | label="加辅4" |
| | | width="150" |
| | | ></el-table-column> |
| | | <el-table-column |
| | | prop="additive5" |
| | | label="加辅5" |
| | | width="150" |
| | | ></el-table-column> |
| | | <el-table-column |
| | | prop="additive6" |
| | | label="加辅6" |
| | | width="150" |
| | | ></el-table-column> |
| | | <el-table-column |
| | | prop="additive7" |
| | | label="加辅7" |
| | | width="150" |
| | | ></el-table-column> |
| | | <el-table-column |
| | | prop="additive8" |
| | | label="加辅8" |
| | | width="150" |
| | | ></el-table-column> |
| | | <el-table-column |
| | | prop="additive9" |
| | | label="加辅9" |
| | | width="150" |
| | | ></el-table-column> |
| | | <el-table-column |
| | | prop="additive10" |
| | | label="加辅10" |
| | | width="150" |
| | | ></el-table-column> |
| | | <el-table-column prop="addAuxiliaryOne" label="加辅1" width="150"></el-table-column> |
| | | <el-table-column prop="addAuxiliaryTwo" label="加辅2" width="150"></el-table-column> |
| | | <el-table-column prop="addAuxiliaryThree" label="加辅3" width="150"></el-table-column> |
| | | <el-table-column prop="addAuxiliaryFour" label="加辅4" width="150"></el-table-column> |
| | | <el-table-column prop="addAuxiliaryFive" label="加辅5" width="150"></el-table-column> |
| | | <el-table-column prop="addAuxiliarySix" label="加辅6" width="150"></el-table-column> |
| | | <el-table-column prop="addAuxiliarySeven" label="加辅7" width="150"></el-table-column> |
| | | <el-table-column prop="addAuxiliaryEight" label="加辅8" width="150"></el-table-column> |
| | | <el-table-column prop="addAuxiliaryNine" label="加辅9" width="150"></el-table-column> |
| | | <el-table-column prop="addAuxiliaryTen" label="加辅10" width="150"></el-table-column> |
| | | </template> |
| | | <el-table-column |
| | | prop="sampleAmount" |
| | | label="取样量" |
| | | width="100" |
| | | ></el-table-column> |
| | | <el-table-column |
| | | prop="sampleTime" |
| | | label="取样时间" |
| | | width="150" |
| | | ></el-table-column> |
| | | <el-table-column |
| | | prop="remark" |
| | | label="拍照" |
| | | width="100" |
| | | ></el-table-column> |
| | | <el-table-column |
| | | prop="operator" |
| | | label="操作人员" |
| | | width="100" |
| | | ></el-table-column> |
| | | <el-table-column prop="sampleAmount" label="取样量" width="150"></el-table-column> |
| | | <el-table-column prop="pictures" label="拍照" width="150"> |
| | | <template slot-scope="scope"> |
| | | <template v-if="scope.row.pictures"> |
| | | <el-image |
| | | v-for="(url, index) in scope.row.pictures.split(',')" |
| | | :key="index" |
| | | :src="url" |
| | | :preview-src-list="[url]" |
| | | style="width: 50px; height: 50px;" |
| | | /> |
| | | </template> |
| | | <span v-else>-</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="handlePersonName" label="操作人员" width="150"></el-table-column> |
| | | <el-table-column |
| | | fixed="right" |
| | | label="操作" |
| | | width="100" |
| | | v-if="type !== 'detail'" |
| | | > |
| | | <template slot-scope="scope"> |
| | | <el-button type="text" @click="handleEdit(scope.$index, scope.row)" |
| | |
| | | v-model="form.remark" |
| | | :rows="4" |
| | | placeholder="请输入备注信息" |
| | | :disabled="type === 'detail'" |
| | | ></el-input> |
| | | </el-form-item> |
| | | </el-form> |
| | | </div> |
| | | <div class="add-project-footer"> |
| | | <div class="add-project-footer" v-if="type !== 'detail'"> |
| | | <el-button type="primary" class="save-btn" @click="handleSave">保存</el-button> |
| | | <el-button>存草稿</el-button> |
| | | </div> |
| | | <sample-dialog |
| | | :visible.sync="showSampleDialog" |
| | |
| | | :visible.sync="showConfirmDialog" |
| | | :form-data="form" |
| | | :sample-data="sampleData" |
| | | :detail-data="detailData" |
| | | @confirm="handleConfirm" |
| | | /> |
| | | </Card> |
| | |
| | | <script> |
| | | import SampleDialog from "./components/sampleDialog.vue"; |
| | | import ConfirmDialog from './components/confirmDialog.vue'; |
| | | import { getDetail, add, update, commitRecord } from './service'; |
| | | import moment from 'moment'; |
| | | |
| | | export default { |
| | | name: "ChangeRecord", |
| | |
| | | }, |
| | | data() { |
| | | return { |
| | | id: null, |
| | | type: 'add', // add-新增, edit-编辑, detail-详情 |
| | | showSampleDialog: false, |
| | | showConfirmDialog: false, |
| | | currentSampleData: {}, |
| | | currentEditIndex: -1, |
| | | showAdditives: true, |
| | | sampleData: [ |
| | | { |
| | | index: 1, |
| | | processTime: "2h", |
| | | sampleName: "样品A", |
| | | sampleCode: "SP001", |
| | | temperature: "25℃", |
| | | ph: "7.0", |
| | | waterAmount: "500ml", |
| | | additive1: "10g", |
| | | additive2: "5g", |
| | | additive3: "3g", |
| | | additive4: "", |
| | | additive5: "", |
| | | additive6: "", |
| | | additive7: "", |
| | | additive8: "", |
| | | additive9: "", |
| | | additive10: "", |
| | | sampleAmount: "100ml", |
| | | sampleTime: "2024-03-20 10:00:00", |
| | | remark: "", |
| | | operator: "张三" |
| | | }, |
| | | { |
| | | index: 2, |
| | | processTime: "4min", |
| | | sampleName: "样品B", |
| | | sampleCode: "SP002", |
| | | temperature: "30℃", |
| | | ph: "6.5", |
| | | waterAmount: "300ml", |
| | | additive1: "8g", |
| | | additive2: "4g", |
| | | additive3: "", |
| | | additive4: "", |
| | | additive5: "", |
| | | additive6: "", |
| | | additive7: "", |
| | | additive8: "", |
| | | additive9: "", |
| | | additive10: "", |
| | | sampleAmount: "50ml", |
| | | sampleTime: "2024-03-20 10:30:00", |
| | | remark: "", |
| | | operator: "李四", |
| | | }, |
| | | ], |
| | | sampleTotal: 2, |
| | | schedulingData: [], |
| | | sampleData: [], |
| | | sampleTotal: 0, |
| | | detailData: {}, |
| | | form: { |
| | | remark: "", |
| | | }, |
| | | statusTypeMap: { |
| | | '-1': 'info', |
| | | '1': 'warning', |
| | | '2': 'success', |
| | | '3': 'info' |
| | | }, |
| | | statusTextMap: { |
| | | '-1': '草稿箱', |
| | | '1': '待提交', |
| | | '2': '已提交', |
| | | '3': '已封存' |
| | | } |
| | | }; |
| | | }, |
| | | created() { |
| | | this.id = this.$route.query.id; |
| | | this.type = this.$route.query.type || 'add'; |
| | | if (this.id) { |
| | | this.getDetailData(); |
| | | } |
| | | }, |
| | | methods: { |
| | | async getDetailData() { |
| | | try { |
| | | const res = await getDetail({ id: this.id }); |
| | | if (res) { |
| | | this.detailData = res || {}; |
| | | this.schedulingData = [this.detailData.experimentDispatch] || []; |
| | | this.sampleData = this.detailData.samplingRecordOperations || []; |
| | | this.sampleTotal = this.sampleData.length; |
| | | this.form.remark = this.detailData.remark || ''; |
| | | } |
| | | } catch (error) { |
| | | console.error('获取详情失败:', error); |
| | | this.$message.error('获取详情失败'); |
| | | } |
| | | }, |
| | | handleEdit(index, row) { |
| | | this.currentEditIndex = index; |
| | | this.currentSampleData = { ...row }; |
| | |
| | | this.showSampleDialog = false; |
| | | }, |
| | | handleSave() { |
| | | // 检查是否有取样记录 |
| | | if (this.sampleData.length === 0) { |
| | | this.$message.warning('请至少添加一条取样记录'); |
| | | return; |
| | | } |
| | | |
| | | // 检查每条记录的必要字段是否填写 |
| | | const invalidRecord = this.sampleData.find(record => !record.samplingName); |
| | | if (invalidRecord) { |
| | | this.$message.warning('请确保所有取样记录都填写了完整的取样信息(取样名称、取样编号、温度、PH、加水量、取样量、拍照)'); |
| | | return; |
| | | } |
| | | |
| | | this.showConfirmDialog = true; |
| | | }, |
| | | handleConfirm(signature) { |
| | | this.submitForm(signature); |
| | | handleConfirm(params) { |
| | | this.submitForm(params); |
| | | }, |
| | | submitForm(signature = null) { |
| | | // 在这里实现表单提交逻辑 |
| | | console.log('提交表单数据', { signature }); |
| | | this.$message.success('保存成功'); |
| | | this.showConfirmDialog = false; |
| | | } |
| | | async submitForm(params) { |
| | | try { |
| | | console.log(params, 'params') |
| | | const res = await commitRecord(params); |
| | | console.log(res, 'res') |
| | | if (res.code === 200) { |
| | | this.$message.success('提交成功'); |
| | | this.showConfirmDialog = false; |
| | | this.$router.go(-1); |
| | | } else { |
| | | this.$message.error(res.msg || '提交失败'); |
| | | } |
| | | } catch (error) { |
| | | console.error('提交失败:', error); |
| | | this.$message.error('提交失败'); |
| | | } |
| | | }, |
| | | getStatusType(status) { |
| | | return this.statusTypeMap[status] || 'info'; |
| | | }, |
| | | getStatusText(status) { |
| | | return this.statusTextMap[status] || '未知状态'; |
| | | }, |
| | | } |
| | | }; |
| | | </script> |
| | |
| | | <div class="sample-info"> |
| | | <div class="info-item"> |
| | | <span class="label">项目课题方案名称:</span> |
| | | <span class="value">{{ formData.planName }}</span> |
| | | <span class="value">{{ detailData.experimentDispatch?.projectName || '-' }}</span> |
| | | </div> |
| | | <div class="info-item"> |
| | | <span class="label">申请项目执行方案编号:</span> |
| | | <span class="value">{{ formData.planName }}</span> |
| | | <span class="value">{{ detailData.experimentDispatch?.experimentCode || '-' }}</span> |
| | | </div> |
| | | <div class="info-item"> |
| | | <span class="label">实验编号:</span> |
| | | <span class="value">{{ formData.testCode }}</span> |
| | | <span class="value">{{ detailData.experimentDispatch?.experimentCode || '-' }}</span> |
| | | </div> |
| | | <div class="info-item"> |
| | | <span class="label">实验名称:</span> |
| | | <span class="value">{{ formData.testName }}</span> |
| | | <span class="value">{{ detailData.experimentDispatch?.experimentName || '-' }}</span> |
| | | </div> |
| | | <div class="info-item"> |
| | | <span class="label">取样单编号:</span> |
| | | <span class="value">{{ formData.sampleCode }}</span> |
| | | <span class="value">{{ detailData.samplingCode || '-' }}</span> |
| | | </div> |
| | | </div> |
| | | |
| | |
| | | width="150" |
| | | ></el-table-column> |
| | | <el-table-column |
| | | prop="sampleName" |
| | | prop="samplingName" |
| | | label="取样名称" |
| | | width="150" |
| | | ></el-table-column> |
| | |
| | | width="150" |
| | | ></el-table-column> |
| | | <el-table-column |
| | | prop="ph" |
| | | prop="samplePh" |
| | | label="PH" |
| | | width="150" |
| | | ></el-table-column> |
| | | <el-table-column |
| | | prop="waterAmount" |
| | | prop="waterAddition" |
| | | label="加水量" |
| | | width="150" |
| | | ></el-table-column> |
| | | <template v-if="showAdditives"> |
| | | <el-table-column |
| | | prop="additive1" |
| | | prop="addAuxiliaryOne" |
| | | label="加辅1" |
| | | width="150" |
| | | ></el-table-column> |
| | | <el-table-column |
| | | prop="additive2" |
| | | prop="addAuxiliaryTwo" |
| | | label="加辅2" |
| | | width="150" |
| | | ></el-table-column> |
| | | <el-table-column |
| | | prop="additive3" |
| | | prop="addAuxiliaryThree" |
| | | label="加辅3" |
| | | width="150" |
| | | ></el-table-column> |
| | | <el-table-column |
| | | prop="additive4" |
| | | prop="addAuxiliaryFour" |
| | | label="加辅4" |
| | | width="150" |
| | | ></el-table-column> |
| | | <el-table-column |
| | | prop="additive5" |
| | | prop="addAuxiliaryFive" |
| | | label="加辅5" |
| | | width="150" |
| | | ></el-table-column> |
| | | <el-table-column |
| | | prop="additive6" |
| | | prop="addAuxiliarySix" |
| | | label="加辅6" |
| | | width="150" |
| | | ></el-table-column> |
| | | <el-table-column |
| | | prop="additive7" |
| | | prop="addAuxiliarySeven" |
| | | label="加辅7" |
| | | width="150" |
| | | ></el-table-column> |
| | | <el-table-column |
| | | prop="additive8" |
| | | prop="addAuxiliaryEight" |
| | | label="加辅8" |
| | | width="150" |
| | | ></el-table-column> |
| | | <el-table-column |
| | | prop="additive9" |
| | | prop="addAuxiliaryNine" |
| | | label="加辅9" |
| | | width="150" |
| | | ></el-table-column> |
| | | <el-table-column |
| | | prop="additive10" |
| | | prop="addAuxiliaryTen" |
| | | label="加辅10" |
| | | width="150" |
| | | ></el-table-column> |
| | |
| | | width="150" |
| | | ></el-table-column> |
| | | <el-table-column |
| | | prop="sampleTime" |
| | | label="取样时间" |
| | | width="150" |
| | | ></el-table-column> |
| | | <el-table-column |
| | | prop="remark" |
| | | prop="pictures" |
| | | label="拍照" |
| | | width="150" |
| | | ></el-table-column> |
| | | > |
| | | <template slot-scope="scope"> |
| | | <el-image |
| | | v-for="(url, index) in scope.row.pictures.split(',')" |
| | | :key="index" |
| | | :src="url" |
| | | :preview-src-list="[url]" |
| | | style="width: 50px; height: 50px;" |
| | | /> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | prop="operator" |
| | | prop="handlePersonName" |
| | | fixed="right" |
| | | label="操作人员" |
| | | width="150" |
| | |
| | | |
| | | <div slot="footer" class="dialog-footer select-member-footer"> |
| | | <el-button @click="handleClose">取 消</el-button> |
| | | <el-button type="primary" @click="handleConfirm" :disabled="!imgSrc" |
| | | >确 认</el-button |
| | | > |
| | | <el-button type="primary" @click="handleConfirm">确 认</el-button> |
| | | </div> |
| | | |
| | | <SignatureCanvas |
| | |
| | | |
| | | <script> |
| | | import SignatureCanvas from "@/components/SignatureCanvas.vue"; |
| | | import moment from 'moment'; |
| | | |
| | | export default { |
| | | name: "ConfirmDialog", |
| | |
| | | type: Array, |
| | | default: () => [], |
| | | }, |
| | | detailData: { |
| | | type: Object, |
| | | default: () => ({}), |
| | | }, |
| | | }, |
| | | data() { |
| | | return { |
| | | signatureDialogVisible: false, |
| | | imgSrc: "", |
| | | imgSrc: "https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg", |
| | | showAdditives: true, |
| | | }; |
| | | }, |
| | | methods: { |
| | | handleClose() { |
| | | this.$emit("update:visible", false); |
| | | this.imgSrc = ""; |
| | | this.imgSrc = "https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg"; |
| | | }, |
| | | openSignature() { |
| | | this.signatureDialogVisible = true; |
| | |
| | | this.$message.warning("请先完成签名确认"); |
| | | return; |
| | | } |
| | | this.$emit("confirm", this.imgSrc); |
| | | const now = new Date().toISOString(); |
| | | const params = { |
| | | id: this.detailData.id, |
| | | commitPersonId: this.detailData.commitPersonId, |
| | | commitSign: this.imgSrc, |
| | | commitTime: moment().format('YYYY-MM-DD HH:mm:ss'), |
| | | dispatchId: this.detailData.experimentDispatch?.id, |
| | | samplingCode: this.detailData.samplingCode, |
| | | remark: this.formData.remark, |
| | | samplingRecordOperations: this.sampleData, |
| | | status: 2 // 已提交状态 |
| | | }; |
| | | this.$emit("confirm", params); |
| | | this.handleClose(); |
| | | }, |
| | | }, |
| | |
| | | > |
| | | <el-row :gutter="20"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="取样名称" prop="sampleName"> |
| | | <el-form-item label="取样名称" prop="samplingName"> |
| | | <el-input |
| | | v-model="form.sampleName" |
| | | v-model="form.samplingName" |
| | | placeholder="请输入取样名称" |
| | | /> |
| | | </el-form-item> |
| | |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="7.5"> |
| | | <el-form-item label="PH" prop="ph"> |
| | | <el-form-item label="PH" prop="samplePh"> |
| | | <el-input |
| | | v-model="form.ph" |
| | | v-model="form.samplePh" |
| | | placeholder="请输入PH值" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="7.5"> |
| | | <el-form-item label="加水量" prop="waterAmount"> |
| | | <el-form-item label="加水量" prop="waterAddition"> |
| | | <el-input |
| | | v-model="form.waterAmount" |
| | | v-model="form.waterAddition" |
| | | placeholder="请输入加水量" |
| | | /> |
| | | </el-form-item> |
| | |
| | | </el-row> |
| | | |
| | | <el-row :gutter="20"> |
| | | <el-col :span="4.6" v-for="i in 5" :key="'additive' + i"> |
| | | <el-form-item :label="'加辅' + i" :prop="'additive' + i"> |
| | | <el-input v-model="form['additive' + i]" placeholder="请输入" /> |
| | | <el-col :span="4.6" v-for="i in 5" :key="'addAuxiliary' + i"> |
| | | <el-form-item :label="'加辅' + i" :prop="'addAuxiliary' + (i === 1 ? 'One' : i === 2 ? 'Two' : i === 3 ? 'Three' : i === 4 ? 'Four' : 'Five')"> |
| | | <el-input v-model="form['addAuxiliary' + (i === 1 ? 'One' : i === 2 ? 'Two' : i === 3 ? 'Three' : i === 4 ? 'Four' : 'Five')]" placeholder="请输入" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | |
| | | <el-row :gutter="20"> |
| | | <el-col :span="4.6" v-for="i in 5" :key="'additive' + (i + 5)"> |
| | | <el-col :span="4.6" v-for="i in 5" :key="'addAuxiliary' + (i + 5)"> |
| | | <el-form-item |
| | | :label="'加辅' + (i + 5)" |
| | | :prop="'additive' + (i + 5)" |
| | | :prop="'addAuxiliary' + (i === 1 ? 'Six' : i === 2 ? 'Seven' : i === 3 ? 'Eight' : i === 4 ? 'Nine' : 'Ten')" |
| | | > |
| | | <el-input |
| | | v-model="form['additive' + (i + 5)]" |
| | | v-model="form['addAuxiliary' + (i === 1 ? 'Six' : i === 2 ? 'Seven' : i === 3 ? 'Eight' : i === 4 ? 'Nine' : 'Ten')]" |
| | | placeholder="请输入" |
| | | /> |
| | | </el-form-item> |
| | |
| | | <el-col :span="24"> |
| | | <el-form-item |
| | | label="拍照" |
| | | prop="fileList" |
| | | prop="pictures" |
| | | :rules="[ |
| | | { required: true, message: '请上传照片', trigger: 'change' }, |
| | | ]" |
| | |
| | | :file-list="fileList" |
| | | :auto-upload="false" |
| | | list-type="picture-card" |
| | | :on-change="handleChange" |
| | | :on-remove="handleRemove" |
| | | :before-upload="beforeUpload" |
| | | multiple |
| | | > |
| | | <i class="el-icon-plus"></i> |
| | | </el-upload> |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | import { updateRecordOperation } from '../service' |
| | | |
| | | export default { |
| | | name: "SampleDialog", |
| | | props: { |
| | |
| | | return { |
| | | form: { |
| | | processTime: "", |
| | | sampleName: "", |
| | | samplingName: "", |
| | | sampleCode: "", |
| | | temperature: "", |
| | | ph: "", |
| | | waterAmount: "", |
| | | additive1: "", |
| | | additive2: "", |
| | | additive3: "", |
| | | additive4: "", |
| | | additive5: "", |
| | | additive6: "", |
| | | additive7: "", |
| | | additive8: "", |
| | | additive9: "", |
| | | additive10: "", |
| | | samplePh: "", |
| | | waterAddition: "", |
| | | addAuxiliaryOne: "", |
| | | addAuxiliaryTwo: "", |
| | | addAuxiliaryThree: "", |
| | | addAuxiliaryFour: "", |
| | | addAuxiliaryFive: "", |
| | | addAuxiliarySix: "", |
| | | addAuxiliarySeven: "", |
| | | addAuxiliaryEight: "", |
| | | addAuxiliaryNine: "", |
| | | addAuxiliaryTen: "", |
| | | sampleAmount: "", |
| | | pictures: "", |
| | | }, |
| | | rules: { |
| | | sampleName: [ |
| | | samplingName: [ |
| | | { required: true, message: "请输入取样名称", trigger: "blur" }, |
| | | ], |
| | | sampleCode: [ |
| | |
| | | temperature: [ |
| | | { required: true, message: "请输入温度", trigger: "blur" }, |
| | | ], |
| | | ph: [{ required: true, message: "请输入PH值", trigger: "blur" }], |
| | | waterAmount: [ |
| | | samplePh: [{ required: true, message: "请输入PH值", trigger: "blur" }], |
| | | waterAddition: [ |
| | | { required: true, message: "请输入加水量", trigger: "blur" }, |
| | | ], |
| | | }, |
| | | fileList: [], |
| | | defaultImage: 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg', |
| | | }; |
| | | }, |
| | | watch: { |
| | |
| | | handler(val) { |
| | | if (val) { |
| | | this.form = { ...this.form, ...val }; |
| | | // 如果有图片数据,设置到fileList中 |
| | | if (val.pictures) { |
| | | const imageUrls = val.pictures.split(','); |
| | | this.fileList = imageUrls.map((url, index) => ({ |
| | | name: `sample-image-${index + 1}.png`, |
| | | url: url |
| | | })); |
| | | } |
| | | } |
| | | }, |
| | | immediate: true, |
| | |
| | | this.form = this.$options.data().form; |
| | | this.fileList = []; |
| | | }, |
| | | handleSubmit() { |
| | | this.$refs.form.validate((valid) => { |
| | | // 上传前校验 |
| | | beforeUpload(file) { |
| | | const isImage = file.type.startsWith('image/'); |
| | | const isLt2M = file.size / 1024 / 1024 < 2; |
| | | |
| | | if (!isImage) { |
| | | this.$message.error('只能上传图片文件!'); |
| | | return false; |
| | | } |
| | | if (!isLt2M) { |
| | | this.$message.error('图片大小不能超过 2MB!'); |
| | | return false; |
| | | } |
| | | return true; |
| | | }, |
| | | // 文件状态改变时的钩子 |
| | | handleChange(file, fileList) { |
| | | this.fileList = fileList; |
| | | |
| | | // 更新pictures字段 |
| | | if (fileList.length === 0) { |
| | | this.form.pictures = this.defaultImage; |
| | | } else { |
| | | const imageUrls = fileList.map(file => file.url || this.defaultImage); |
| | | this.form.pictures = imageUrls.join(','); |
| | | } |
| | | }, |
| | | // 移除文件时的钩子 |
| | | handleRemove(file, fileList) { |
| | | this.fileList = fileList; |
| | | |
| | | // 更新pictures字段 |
| | | if (fileList.length === 0) { |
| | | this.form.pictures = this.defaultImage; |
| | | } else { |
| | | const imageUrls = fileList.map(file => file.url || this.defaultImage); |
| | | this.form.pictures = imageUrls.join(','); |
| | | } |
| | | }, |
| | | async handleSubmit() { |
| | | this.$refs.form.validate(async (valid) => { |
| | | if (valid) { |
| | | const submitData = { |
| | | ...this.form, |
| | | sampleTime: new Date().toISOString(), |
| | | operator: window._userInfo?.name || "", |
| | | handlePersonId: JSON.parse(sessionStorage.getItem('userInfo') || '{}').userId || "", |
| | | handlePersonName: JSON.parse(sessionStorage.getItem('userInfo') || '{}').nickName || "", |
| | | fileList: this.fileList, |
| | | }; |
| | | this.$emit("submit", submitData); |
| | | this.handleClose(); |
| | | |
| | | try { |
| | | // 先调用updateRecordOperation接口保存数据 |
| | | const res = await updateRecordOperation(submitData); |
| | | if (res.code === 200) { |
| | | // 保存成功,继续执行原来的提交逻辑 |
| | | this.$emit("submit", submitData); |
| | | this.handleClose(); |
| | | } else { |
| | | this.$message.error(res.msg || '保存失败'); |
| | | } |
| | | } catch (error) { |
| | | console.error('保存失败:', error); |
| | | this.$message.error('保存失败,请重试'); |
| | | } |
| | | } |
| | | }); |
| | | }, |
| | |
| | | <template> |
| | | <div class="list"> |
| | | <TableCustom :queryForm="form" :tableData="tableData" :total="total"> |
| | | <TableCustom :queryForm="form" :height="null" :tableData="tableData" :total="total" @handlePageChange="handlePageChange" @handleSizeChange="handleSizeChange"> |
| | | <template #search> |
| | | <el-form :model="form" labelWidth="auto" inline> |
| | | <el-form-item label="所属项目课题方案:"> |
| | | <el-input v-model="form.planName" placeholder="请输入"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="实验名称:"> |
| | | <el-input v-model="form.planCode" placeholder="请输入"></el-input> |
| | | <el-input v-model="form.projectName" placeholder="请输入"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="实验编号:"> |
| | | <el-input v-model="form.planCode" placeholder="请输入"></el-input> |
| | | <el-input v-model="form.experimentCode" placeholder="请输入"></el-input> |
| | | </el-form-item> |
| | | |
| | | <el-form-item label="创建时间:"> |
| | | <el-date-picker |
| | | v-model="form.createTime" |
| | | type="daterange" |
| | | range-separator="至" |
| | | start-placeholder="开始日期" |
| | | end-placeholder="结束日期" |
| | | value-format="yyyy-MM-dd" |
| | | ></el-date-picker> |
| | | </el-form-item> |
| | | <el-form-item label="状态:"> |
| | | <el-input v-model="form.approver" placeholder="请输入"></el-input> |
| | | <el-select v-model="form.status" placeholder="请选择"> |
| | | <el-option label="全部" :value="''"></el-option> |
| | | <el-option label="待提交" :value="1"></el-option> |
| | | <el-option label="已提交" :value="2"></el-option> |
| | | <el-option label="已封存" :value="3"></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label=""> |
| | | <el-button type="default" @click="resetForm">重置</el-button> |
| | | <el-button type="primary" @click="handleSearch">查询</el-button> |
| | | <el-button type="primary" @click="handleSearch" style="margin-left: 10px;">查询</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | </template> |
| | | <template #setting> |
| | | <div class="tableTitle"> |
| | | <div class="flex a-center"> |
| | | <div |
| | | class="title" |
| | | :class="{active:currentType === 'list'}" |
| | | @click="handleTypeChange('list')" |
| | | >{{ type === 'draft' ? '草稿箱' : '取样操作记录列表' }}</div> |
| | | <div class="title active">取样操作记录列表</div> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | <template #table> |
| | | <el-table-column |
| | | prop="planName" |
| | | label="所属项目课题方案" |
| | | v-for="(column, index) in columns" |
| | | :key="index" |
| | | :prop="column.prop" |
| | | :label="column.label" |
| | | ></el-table-column> |
| | | <el-table-column |
| | | prop="experimentNo" |
| | | label="实验编号" |
| | | ></el-table-column> |
| | | <el-table-column |
| | | prop="experimentName" |
| | | label="实验名称" |
| | | ></el-table-column> |
| | | <el-table-column |
| | | prop="sampleNo" |
| | | label="取样单编号" |
| | | ></el-table-column> |
| | | <el-table-column prop="creator" label="创建人"></el-table-column> |
| | | <el-table-column prop="createTime" label="创建时间"></el-table-column> |
| | | <el-table-column prop="status" label="当前状态"> |
| | | <el-table-column prop="status" label="状态"> |
| | | <template slot-scope="scope"> |
| | | <el-tag :type="getStatusType(scope.row.status)"> |
| | | {{ getStatusText(scope.row.status) }} |
| | |
| | | </el-table-column> |
| | | <el-table-column label="操作" width="150"> |
| | | <template slot-scope="scope"> |
| | | <el-button |
| | | type="text" |
| | | @click="handleEdit(scope.row)" |
| | | >编辑</el-button> |
| | | <el-button |
| | | type="text" |
| | | @click="handleDetail(scope.row)" |
| | | >详情</el-button> |
| | | <el-button type="text" @click="handleDetail(scope.row.id)">详情</el-button> |
| | | <el-button type="text" @click="handleEdit(scope.row.id)" v-if="scope.row.status == 1">编辑</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </template> |
| | | </TableCustom> |
| | | <!-- 审批弹窗 --> |
| | | <!-- <approval-dialog |
| | | :visible.sync="approvalDialogVisible" |
| | | :type="approvalDialogType" |
| | | :data="currentApprovalData" |
| | | @approve="handleApproveSubmit" |
| | | @reject="handleRejectSubmit" |
| | | /> --> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | // import ApprovalDialog from './components/approvalDialog.vue' |
| | | import { getList } from './service' |
| | | |
| | | export default { |
| | | name: "ProjectList", |
| | | components: { |
| | | // ApprovalDialog |
| | | }, |
| | | data() { |
| | | return { |
| | | type: 'list', |
| | | currentType: 'list', |
| | | form: { |
| | | planName: "", |
| | | planCode: "", |
| | | creator: "", |
| | | experimentCode: "", |
| | | experimentName: "", |
| | | projectName: "", |
| | | createTime: [], |
| | | approver: "", |
| | | status: "", |
| | | status: '', |
| | | pageNum: 1, |
| | | pageSize: 10 |
| | | }, |
| | | tableData: [], |
| | | total: 0, |
| | | // 模拟数据 |
| | | mockListData: [ |
| | | { |
| | | planName: '2024年度实验室设备升级方案', |
| | | experimentNo: '31423764', |
| | | experimentName: '设备性能测试', |
| | | sampleNo: '2024-05-28', |
| | | creator: '刘大大', |
| | | createTime: '2025-1-2 16:27:17', |
| | | status: 'pending' |
| | | } |
| | | ], |
| | | mockDraftData: [ |
| | | { |
| | | planCode: 'DRAFT-2024-001', |
| | | planName: '实验室设备采购计划(草稿)', |
| | | stage: '规划阶段', |
| | | creator: '张三', |
| | | createTime: '2024-03-16', |
| | | status: 'draft', |
| | | approver: '', |
| | | approveTime: '' |
| | | }, |
| | | { |
| | | planCode: 'DRAFT-2024-002', |
| | | planName: '实验室改造方案(草稿)', |
| | | stage: '准备阶段', |
| | | creator: '李四', |
| | | createTime: '2024-03-15', |
| | | status: 'draft', |
| | | approver: '', |
| | | approveTime: '' |
| | | } |
| | | ], |
| | | approvalDialogVisible: false, |
| | | approvalDialogType: 'approve', |
| | | currentApprovalData: null, |
| | | columns: [ |
| | | { prop: 'projectName', label: '所属项目课题方案' }, |
| | | { prop: 'experimentCode', label: '实验编号' }, |
| | | { prop: 'experimentName', label: '实验名称' }, |
| | | { prop: 'samplingCode', label: '取样单编号' }, |
| | | { prop: 'createBy', label: '创建人' }, |
| | | { prop: 'createTime', label: '创建时间' } |
| | | ] |
| | | }; |
| | | }, |
| | | created() { |
| | |
| | | methods: { |
| | | resetForm() { |
| | | this.form = { |
| | | planName: "", |
| | | planCode: "", |
| | | creator: "", |
| | | experimentCode: "", |
| | | experimentName: "", |
| | | projectName: "", |
| | | createTime: [], |
| | | approver: "", |
| | | status: "", |
| | | status: '', |
| | | pageNum: 1, |
| | | pageSize: 10 |
| | | }; |
| | | this.handleSearch(); |
| | | }, |
| | | handleSearch() { |
| | | // 实现查询逻辑 |
| | | console.log("查询条件:", this.form); |
| | | async handleSearch() { |
| | | const params = { |
| | | experimentCode: this.form.experimentCode, |
| | | experimentName: this.form.experimentName, |
| | | projectName: this.form.projectName, |
| | | startTime: this.form.createTime[0] || null, |
| | | endTime: this.form.createTime[1] || null, |
| | | status: this.form.status, |
| | | pageNum: this.form.pageNum, |
| | | pageSize: this.form.pageSize |
| | | }; |
| | | try { |
| | | const res = await getList(params) |
| | | this.tableData = res.data.records || []; |
| | | this.total = res.data.total || 0; |
| | | } catch (error) { |
| | | console.error("查询失败:", error); |
| | | } |
| | | }, |
| | | getStatusType(status) { |
| | | const statusMap = { |
| | | pending: "warning", |
| | | rejected: "danger", |
| | | approved: "success", |
| | | archived: "info", |
| | | draft: "info" |
| | | '-1': 'info', |
| | | '1': 'warning', |
| | | '2': 'success', |
| | | '3': 'info' |
| | | }; |
| | | return statusMap[status] || "info"; |
| | | return statusMap[status] || 'info'; |
| | | }, |
| | | getStatusText(status) { |
| | | const statusMap = { |
| | | pending: "待审批", |
| | | rejected: "已驳回", |
| | | approved: "已通过", |
| | | archived: "已封存", |
| | | draft: "草稿" |
| | | '-1': '草稿箱', |
| | | '1': '待提交', |
| | | '2': '已提交', |
| | | '3': '已封存' |
| | | }; |
| | | return statusMap[status] || "未知"; |
| | | return statusMap[status] || '未知'; |
| | | }, |
| | | handleAddSample() { |
| | | this.$router.push({ |
| | | path: "/sampleManage/changeRecord", |
| | | }); |
| | | }, |
| | | handleApprove(row) { |
| | | this.currentApprovalData = row; |
| | | this.approvalDialogType = 'approve'; |
| | | this.approvalDialogVisible = true; |
| | | }, |
| | | handleApproveSubmit(data) { |
| | | // 处理审批通过 |
| | | console.log('审批通过:', data); |
| | | this.approvalDialogVisible = false; |
| | | this.$message.success('审批通过成功'); |
| | | this.getTableData(); |
| | | }, |
| | | handleRejectSubmit(data) { |
| | | // 处理审批驳回 |
| | | console.log('审批驳回:', data); |
| | | this.approvalDialogVisible = false; |
| | | this.$message.success('审批驳回成功'); |
| | | this.getTableData(); |
| | | }, |
| | | handleRevokeApprove(row) { |
| | | // 实现撤销审批逻辑 |
| | | console.log("撤销审批数据:", row); |
| | | }, |
| | | handleEdit(row) { |
| | | handleDetail(id) { |
| | | this.$router.push({ |
| | | path: "/sampleManage/changeRecord", |
| | | query: { |
| | | type: 'edit', |
| | | id: row.id |
| | | id: id, |
| | | type: 'detail' |
| | | } |
| | | }); |
| | | }, |
| | | handleDelete(row) { |
| | | // 实现删除逻辑 |
| | | console.log("删除数据:", row); |
| | | }, |
| | | handleDetail(row) { |
| | | handleEdit(id) { |
| | | this.$router.push({ |
| | | path: "/sampleManage/changeRecord", |
| | | query: { |
| | | type: 'view', |
| | | id: row.id |
| | | id: id, |
| | | type: 'edit' |
| | | } |
| | | }); |
| | | }, |
| | | handleTypeChange(type) { |
| | | this.currentType = type; |
| | | this.type = type; |
| | | this.getTableData(); |
| | | }, |
| | | getTableData() { |
| | | // 根据currentType请求不同的数据 |
| | | if (this.currentType === 'list') { |
| | | this.tableData = this.mockListData; |
| | | this.total = this.mockListData.length; |
| | | } else { |
| | | this.tableData = this.mockDraftData; |
| | | this.total = this.mockDraftData.length; |
| | | } |
| | | this.handleSearch(); |
| | | }, |
| | | handlePageChange(pageNum) { |
| | | this.form.pageNum = pageNum; |
| | | this.getTableData(); |
| | | }, |
| | | handleSizeChange(pageSize) { |
| | | this.form.pageSize = pageSize; |
| | | this.getTableData(); |
| | | } |
| | | }, |
| | | }; |
| | | </script> |
| | |
| | | border-radius: 8px 8px 0px 0px; |
| | | border: 1px solid #dcdfe6; |
| | | padding: 16px 29px; |
| | | font-weight: bold; |
| | | font-weight: 400; |
| | | font-size: 18px; |
| | | color: #606266; |
| | | width: unset; |
| | | cursor: pointer; |
| | | } |
| | | .drafts { |
| | | padding: 16px 65px; |
| | | background: #fafafc; |
| | | border-radius: 8px 8px 0px 0px; |
| | | border: 1px solid #dcdfe6; |
| | | font-weight: 400; |
| | | font-size: 18px; |
| | | color: #606266; |
| | | margin-left: 16px; |
| | | cursor: pointer; |
| | | } |
| | | .active{ |
| | | color: #049c9a; |
| | | background: #ffffff; |
| | | border-radius: 8px 8px 0px 0px; |
| | | border: 1px solid #049c9a; |
| | | &.active { |
| | | color: #049c9a; |
| | | background: #ffffff; |
| | | border-radius: 8px 8px 0px 0px; |
| | | border: 1px solid #049c9a; |
| | | font-weight: bold; |
| | | } |
| | | } |
| | | } |
| | | </style> |
New file |
| | |
| | | import axios from '@/utils/request'; |
| | | |
| | | // 列表 |
| | | export const getList = (data) => { |
| | | return axios.post('/api/t-sampling-record/pageList', { ...data }) |
| | | } |
| | | // 详情 |
| | | export const getDetail = (data) => { |
| | | return axios.get('/open/t-sampling-record/getDetailById', { params:data }) |
| | | } |
| | | //添加 |
| | | export const add = (data) => { |
| | | return axios.post('/api/t-sampling-record/add', { ...data }) |
| | | } |
| | | //修改 |
| | | export const update = (data) => { |
| | | return axios.post('/api/t-sampling-record/update', { ...data }) |
| | | } |
| | | //删除 |
| | | export const deleteById = (data) => { |
| | | return axios.delete('/open/t-sampling-record/deleteById', { params:data }) |
| | | } |
| | | //批量删除 |
| | | export const deleteByIds = (data) => { |
| | | return axios.delete('/open/t-sampling-record/deleteByIds', { params:data }) |
| | | } |
| | | |
| | | // 实验员提交记录 |
| | | export const commitRecord = (data) => { |
| | | return axios.post('/api/t-sampling-record/commitRecord', { ...data }) |
| | | } |
| | | // 修改取样操作记录 |
| | | export const updateRecordOperation = (data) => { |
| | | return axios.post('/api/t-sampling-record/updateRecordOperation', { ...data }) |
| | | } |
| | | // 批量收样 |
| | | export const batchCollectSamples = (data) => { |
| | | return axios.post('/open/t-sampling-record/batchCollectSamples', { params:data }) |
| | | } |
| | | // 批量送样 |
| | | export const batchSendSamples = (data) => { |
| | | return axios.post('/open/t-sampling-record/batchSendSamples', { params:data }) |
| | | } |
| | | |
| | | // 获取实验调度列表 |
| | | export const getDispatchList = (data) => { |
| | | return axios.post('/api/t-experiment-dispatch/pageList', { params:data }) |
| | | } |
| | |
| | | }, |
| | | handleSignatureConfirm(imageData) { |
| | | this.signatureDialogVisible = false; |
| | | this.imgSrc = imageData; |
| | | // this.imgSrc = imageData; |
| | | this.imgSrc = 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg'; |
| | | }, |
| | | handleConfirm() { |
| | | if (!this.imgSrc) { |
| | | this.$message.warning("请先完成签名确认"); |
| | | return; |
| | | } |
| | | this.$emit("confirm", this.imgSrc); |
| | | const defaultSignature = 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg'; |
| | | this.$emit("confirm", this.imgSrc || defaultSignature); |
| | | this.handleClose(); |
| | | }, |
| | | }, |
| | |
| | | <template> |
| | | <div class="list"> |
| | | <TableCustom :queryForm="form" :tableData="tableData" :total="total"> |
| | | <TableCustom :queryForm="form" :height="null" :tableData="tableData" :total="total" |
| | | @handlePageChange="handlePageChange" @handleSizeChange="handleSizeChange"> |
| | | <template #search> |
| | | <el-form :model="form" labelWidth="auto" inline> |
| | | <el-form-item label="所属项目课题方案:"> |
| | | <el-input v-model="form.planName" placeholder="请输入"></el-input> |
| | | <el-input v-model="form.projectName" placeholder="请输入"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="实验编号:"> |
| | | <el-input |
| | | v-model="form.planCode" |
| | | placeholder="请输入" |
| | | ></el-input> </el-form-item |
| | | ><el-form-item label="实验名称:"> |
| | | <el-input v-model="form.planCode" placeholder="请输入"></el-input> |
| | | <el-input v-model="form.experimentCode" placeholder="请输入"></el-input> |
| | | </el-form-item> |
| | | |
| | | <el-form-item label="实验名称:"> |
| | | <el-input v-model="form.experimentName" placeholder="请输入"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="状态:"> |
| | | <el-input v-model="form.approver" placeholder="请输入"></el-input> |
| | | <el-select v-model="form.status" placeholder="请选择"> |
| | | <el-option label="全部" :value="''"></el-option> |
| | | <el-option label="待提交" :value="1"></el-option> |
| | | <el-option label="已提交" :value="2"></el-option> |
| | | <el-option label="已封存" :value="3"></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label=""> |
| | | <el-button type="default" @click="resetForm">重置</el-button> |
| | | <el-button type="primary" @click="handleSearch">查询</el-button> |
| | | <el-button type="primary" @click="handleSearch" style="margin-left: 10px;">查询</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | </template> |
| | | <template #setting> |
| | | <div class="tableTitle"> |
| | | <div class="flex a-center"> |
| | | <div class="title"> |
| | | 取样操作记录列表 |
| | | </div> |
| | | <div class="title active">取样操作记录列表</div> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | <template #table> |
| | | <el-table-column |
| | | prop="planName" |
| | | label="所属项目课题方案" |
| | | ></el-table-column> |
| | | <el-table-column |
| | | prop="experimentNo" |
| | | label="实验编号" |
| | | ></el-table-column> |
| | | <el-table-column |
| | | prop="experimentName" |
| | | label="实验名称" |
| | | ></el-table-column> |
| | | <el-table-column |
| | | prop="sampleNo" |
| | | label="取样单编号" |
| | | ></el-table-column> |
| | | <el-table-column |
| | | prop="creator" |
| | | label="创建人" |
| | | ></el-table-column> |
| | | <el-table-column |
| | | prop="createTime" |
| | | label="创建时间" |
| | | ></el-table-column> |
| | | <el-table-column |
| | | prop="sampleStatus" |
| | | label="样品总数/待送达/待接收/已接收" |
| | | ></el-table-column> |
| | | <el-table-column label="操作" width="100"> |
| | | <el-table-column v-for="(column, index) in columns" :key="index" :prop="column.prop" |
| | | :label="column.label"></el-table-column> |
| | | <el-table-column label="样品总数/待送达/待接收/已接收"> |
| | | <template slot-scope="scope"> |
| | | <el-button type="text" @click="handleDetail(scope.row)">详情</el-button> |
| | | {{ getSampleStatus(scope.row) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="操作" width="150"> |
| | | <template slot-scope="scope"> |
| | | <el-button type="text" @click="handleDetail(scope.row.id)">详情</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </template> |
| | |
| | | |
| | | <script> |
| | | // import ApprovalDialog from './components/approvalDialog.vue' |
| | | import { getList } from './service' |
| | | |
| | | export default { |
| | | name: "ProjectList", |
| | |
| | | data() { |
| | | return { |
| | | form: { |
| | | planName: "", |
| | | planCode: "", |
| | | creator: "", |
| | | createTime: [], |
| | | approver: "", |
| | | status: "", |
| | | experimentCode: "", |
| | | experimentName: "", |
| | | projectName: "", |
| | | status: '', |
| | | pageNum: 1, |
| | | pageSize: 10 |
| | | }, |
| | | tableData: [], |
| | | total: 0, |
| | | // 模拟数据 |
| | | mockListData: [ |
| | | { |
| | | planCode: "PLAN-2024-001", |
| | | planName: "2024年度实验室设备升级方案", |
| | | stage: "规划阶段", |
| | | creator: "张三", |
| | | createTime: "2024-03-15", |
| | | status: "pending", |
| | | approver: "李四", |
| | | approveTime: "2024-03-16", |
| | | }, |
| | | { |
| | | planCode: "PLAN-2024-002", |
| | | planName: "实验室安全管理制度更新方案", |
| | | stage: "实施阶段", |
| | | creator: "王五", |
| | | createTime: "2024-03-14", |
| | | status: "approved", |
| | | approver: "赵六", |
| | | approveTime: "2024-03-15", |
| | | }, |
| | | { |
| | | planCode: "PLAN-2024-003", |
| | | planName: "实验室人员培训计划", |
| | | stage: "准备阶段", |
| | | creator: "孙七", |
| | | createTime: "2024-03-13", |
| | | status: "rejected", |
| | | approver: "周八", |
| | | approveTime: "2024-03-14", |
| | | }, |
| | | ], |
| | | columns: [ |
| | | { prop: 'projectName', label: '所属项目课题方案' }, |
| | | { prop: 'experimentCode', label: '实验编号' }, |
| | | { prop: 'experimentName', label: '实验名称' }, |
| | | { prop: 'samplingCode', label: '取样单编号' }, |
| | | { prop: 'createBy', label: '创建人' }, |
| | | { prop: 'createTime', label: '创建时间' } |
| | | ] |
| | | }; |
| | | }, |
| | | created() { |
| | |
| | | methods: { |
| | | resetForm() { |
| | | this.form = { |
| | | planName: "", |
| | | planCode: "", |
| | | creator: "", |
| | | createTime: [], |
| | | approver: "", |
| | | status: "", |
| | | experimentCode: "", |
| | | experimentName: "", |
| | | projectName: "", |
| | | status: '', |
| | | pageNum: 1, |
| | | pageSize: 10 |
| | | }; |
| | | this.handleSearch(); |
| | | }, |
| | | handleSearch() { |
| | | // 实现查询逻辑 |
| | | console.log("查询条件:", this.form); |
| | | this.getTableData(); |
| | | async handleSearch() { |
| | | const params = { |
| | | experimentCode: this.form.experimentCode, |
| | | experimentName: this.form.experimentName, |
| | | projectName: this.form.projectName, |
| | | status: this.form.status, |
| | | pageNum: this.form.pageNum, |
| | | pageSize: this.form.pageSize |
| | | }; |
| | | try { |
| | | const res = await getList(params) |
| | | this.tableData = res.data.records || []; |
| | | this.total = res.data.total || 0; |
| | | } catch (error) { |
| | | console.error("查询失败:", error); |
| | | } |
| | | }, |
| | | handleDetail(row) { |
| | | getStatusType(status) { |
| | | const statusMap = { |
| | | '-1': 'info', |
| | | '1': 'warning', |
| | | '2': 'success', |
| | | '3': 'info' |
| | | }; |
| | | return statusMap[status] || 'info'; |
| | | }, |
| | | getStatusText(status) { |
| | | const statusMap = { |
| | | '-1': '草稿箱', |
| | | '1': '待提交', |
| | | '2': '已提交', |
| | | '3': '已封存' |
| | | }; |
| | | return statusMap[status] || '未知'; |
| | | }, |
| | | handleDetail(id) { |
| | | this.$router.push({ |
| | | path: "/sampleManage/submission", |
| | | query: { |
| | | id: row.id, |
| | | type: 'view' |
| | | id: id, |
| | | type: 'detail' |
| | | } |
| | | }); |
| | | }, |
| | | handleEdit(id) { |
| | | this.$router.push({ |
| | | path: "/sampleManage/submission", |
| | | query: { |
| | | id: id, |
| | | type: 'edit' |
| | | } |
| | | }); |
| | | }, |
| | | getTableData() { |
| | | // 获取列表数据 |
| | | this.tableData = this.mockListData; |
| | | this.total = this.mockListData.length; |
| | | this.handleSearch(); |
| | | }, |
| | | handlePageChange(pageNum) { |
| | | this.form.pageNum = pageNum; |
| | | this.getTableData(); |
| | | }, |
| | | handleSizeChange(pageSize) { |
| | | this.form.pageSize = pageSize; |
| | | this.getTableData(); |
| | | }, |
| | | getSampleStatus(row) { |
| | | const send = row.sendCount || 0; |
| | | const receive = row.receiveCount || 0; |
| | | const received = row.receivedCount || 0; |
| | | const total = send + receive + received; |
| | | return `${total} / ${send} / ${receive} / ${received}`; |
| | | } |
| | | }, |
| | | }; |
| | | </script> |
| | |
| | | .list { |
| | | height: 100%; |
| | | } |
| | | |
| | | .flex { |
| | | display: flex; |
| | | align-items: center; |
| | | } |
| | | |
| | | .tableTitle { |
| | | display: flex; |
| | | padding-bottom: 20px; |
| | | justify-content: space-between; |
| | | align-items: center; |
| | | |
| | | .title { |
| | | background: #ffffff; |
| | | border-radius: 8px 8px 0px 0px; |
New file |
| | |
| | | import axios from '@/utils/request'; |
| | | |
| | | // 列表 |
| | | export const getList = (data) => { |
| | | return axios.post('/api/t-sampling-record/pageList', { ...data }) |
| | | } |
| | | // 详情 |
| | | export const getDetail = (data) => { |
| | | return axios.get('/open/t-sampling-record/getDetailById', { params:data }) |
| | | } |
| | | //添加 |
| | | export const add = (data) => { |
| | | return axios.post('/api/t-sampling-record/add', { ...data }) |
| | | } |
| | | //修改 |
| | | export const update = (data) => { |
| | | return axios.post('/api/t-sampling-record/update', { ...data }) |
| | | } |
| | | //删除 |
| | | export const deleteById = (data) => { |
| | | return axios.delete('/open/t-sampling-record/deleteById', { params:data }) |
| | | } |
| | | //批量删除 |
| | | export const deleteByIds = (data) => { |
| | | return axios.delete('/open/t-sampling-record/deleteByIds', { params:data }) |
| | | } |
| | | |
| | | // 实验员提交记录 |
| | | export const commitRecord = (data) => { |
| | | return axios.post('/api/t-sampling-record/commitRecord', { ...data }) |
| | | } |
| | | // 修改取样操作记录 |
| | | export const updateRecordOperation = (data) => { |
| | | return axios.post('/api/t-sampling-record/updateRecordOperation', { params:data }) |
| | | } |
| | | // 批量收样 |
| | | export const batchCollectSamples = (data) => { |
| | | return axios.post('/open/t-sampling-record/batchCollectSamples', { params:data }) |
| | | } |
| | | // 批量送样 |
| | | export const batchSendSamples = (data) => { |
| | | return axios.post('/open/t-sampling-record/batchSendSamples', { ...data }) |
| | | } |
| | | |
| | | // 获取实验调度列表 |
| | | export const getDispatchList = (data) => { |
| | | return axios.post('/api/t-experiment-dispatch/pageList', { params:data }) |
| | | } |
| | |
| | | <img src="@/assets/public/headercard.png" /> |
| | | <div>所属实验调度</div> |
| | | </div> |
| | | <Table :data="schedulingData" :total="schedulingTotal" :height="null"> |
| | | <Table :data="schedulingData" :total="0" :height="null" > |
| | | <template> |
| | | <el-table-column prop="planCode" label="所属项目课题方案" width="150"></el-table-column> |
| | | <el-table-column prop="experimentCode" label="实验编号" width="150"></el-table-column> |
| | | <el-table-column prop="experimentName" label="实验名称" width="150"></el-table-column> |
| | | <el-table-column prop="notifyTime" label="通知时间" width="150"></el-table-column> |
| | | <el-table-column prop="startTime" label="实验开始时间" width="150"></el-table-column> |
| | | <el-table-column prop="endTime" label="实验结束时间" width="150"></el-table-column> |
| | | <el-table-column prop="participants" label="参加人员" width="150"></el-table-column> |
| | | <el-table-column prop="status" label="状态" width="100"></el-table-column> |
| | | <el-table-column prop="projectName" label="所属项目课题方案" width="200"></el-table-column> |
| | | <el-table-column prop="experimentCode" label="实验编号" width="200"></el-table-column> |
| | | <el-table-column prop="experimentName" label="实验名称" width="200"></el-table-column> |
| | | <el-table-column prop="experimentDate" label="通知时间" width="200"></el-table-column> |
| | | <el-table-column prop="experimentStartTime" label="实验开始时间" width="200"></el-table-column> |
| | | <el-table-column prop="experimentEndTime" label="实验结束时间" width="200"></el-table-column> |
| | | <el-table-column prop="participantsName" label="参加人员" width="200"></el-table-column> |
| | | <el-table-column prop="status" label="状态" width="150"> |
| | | <template slot-scope="scope"> |
| | | <el-tag :type="getStatusType(scope.row.status)"> |
| | | {{ getStatusText(scope.row.status) }} |
| | | </el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | </template> |
| | | </Table> |
| | | |
| | |
| | | <div class="table-header"> |
| | | <el-button type="primary" class="batch-send" @click="handleBatchSend">批量发送</el-button> |
| | | </div> |
| | | <Table :data="sampleList" :total="sampleTotal" :height="null" @selection-change="handleSelectionChange"> |
| | | <Table :data="sampleList" :total="sampleTotal" :height="null" |
| | | @selection-change="handleSelectionChange"> |
| | | <template> |
| | | <el-table-column type="selection" width="55"></el-table-column> |
| | | <el-table-column prop="index" label="序号" width="80"></el-table-column> |
| | | <el-table-column prop="processTime" label="工艺时间间/h" width="120"></el-table-column> |
| | | <el-table-column prop="sampleName" label="取样名称" width="150"></el-table-column> |
| | | <el-table-column type="selection" width="55" :selectable="isSelectable"></el-table-column> |
| | | <el-table-column type="index" label="序号" width="80"></el-table-column> |
| | | <el-table-column prop="processTime" label="工艺时间" width="120"></el-table-column> |
| | | <el-table-column prop="samplingName" label="取样名称" width="150"></el-table-column> |
| | | <el-table-column prop="sampleCode" label="取样样品编号" width="150"></el-table-column> |
| | | <el-table-column prop="temperature" label="温度" width="100"></el-table-column> |
| | | <el-table-column prop="ph" label="PH" width="100"></el-table-column> |
| | | <el-table-column prop="waterAmount" label="加水量" width="100"></el-table-column> |
| | | <el-table-column prop="samplePh" label="PH" width="100"></el-table-column> |
| | | <el-table-column prop="waterAddition" label="加水量" width="100"></el-table-column> |
| | | <template v-if="showAdditives"> |
| | | <el-table-column prop="additive1" label="加辅1" width="150"></el-table-column> |
| | | <el-table-column prop="additive2" label="加辅2" width="150"></el-table-column> |
| | | <el-table-column prop="additive3" label="加辅3" width="150"></el-table-column> |
| | | <el-table-column prop="additive4" label="加辅4" width="150"></el-table-column> |
| | | <el-table-column prop="additive5" label="加辅5" width="150"></el-table-column> |
| | | <el-table-column prop="additive6" label="加辅6" width="150"></el-table-column> |
| | | <el-table-column prop="additive7" label="加辅7" width="150"></el-table-column> |
| | | <el-table-column prop="additive8" label="加辅8" width="150"></el-table-column> |
| | | <el-table-column prop="additive9" label="加辅9" width="150"></el-table-column> |
| | | <el-table-column prop="additive10" label="加辅10" width="150"></el-table-column> |
| | | <el-table-column prop="addAuxiliaryOne" label="加辅1" width="150"></el-table-column> |
| | | <el-table-column prop="addAuxiliaryTwo" label="加辅2" width="150"></el-table-column> |
| | | <el-table-column prop="addAuxiliaryThree" label="加辅3" width="150"></el-table-column> |
| | | <el-table-column prop="addAuxiliaryFour" label="加辅4" width="150"></el-table-column> |
| | | <el-table-column prop="addAuxiliaryFive" label="加辅5" width="150"></el-table-column> |
| | | <el-table-column prop="addAuxiliarySix" label="加辅6" width="150"></el-table-column> |
| | | <el-table-column prop="addAuxiliarySeven" label="加辅7" width="150"></el-table-column> |
| | | <el-table-column prop="addAuxiliaryEight" label="加辅8" width="150"></el-table-column> |
| | | <el-table-column prop="addAuxiliaryNine" label="加辅9" width="150"></el-table-column> |
| | | <el-table-column prop="addAuxiliaryTen" label="加辅10" width="150"></el-table-column> |
| | | </template> |
| | | <el-table-column prop="sampleAmount" label="取样量" width="100"></el-table-column> |
| | | <el-table-column prop="sampleTime" label="取样时间" width="150"></el-table-column> |
| | | <el-table-column prop="photo" label="拍照" width="100"> |
| | | <el-table-column prop="pictures" label="拍照" width="100"> |
| | | <template slot-scope="scope"> |
| | | <img v-if="scope.row.photo" :src="scope.row.photo" class="sample-photo" /> |
| | | <el-image |
| | | v-for="(url, index) in scope.row.pictures.split(',')" |
| | | :key="index" |
| | | :src="url" |
| | | :preview-src-list="[url]" |
| | | style="width: 50px; height: 50px;" |
| | | /> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="operator" label="操作人" width="100"></el-table-column> |
| | | <el-table-column prop="status" label="状态" width="100"></el-table-column> |
| | | <el-table-column prop="handlePersonName" label="操作人员" width="100"></el-table-column> |
| | | <el-table-column prop="status" label="状态" width="100" fixed="right"> |
| | | <template slot-scope="scope"> |
| | | <el-tag :type="getSampleStatusType(scope.row.status)"> |
| | | {{ getSampleStatusText(scope.row.status) }} |
| | | </el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="操作" width="100" fixed="right"> |
| | | <template slot-scope="scope"> |
| | | <el-button type="text" @click="handleSend(scope.row)" v-if="scope.row.status === '待发送'">发送</el-button> |
| | | <el-button type="text" @click="handleSend(scope.row)" v-if="scope.row.status == '1'">发送</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </template> |
| | |
| | | |
| | | <script> |
| | | import ReceiveConfirmDialog from './components/receiveConfirmDialog.vue' |
| | | import { getDetail, commitRecord, batchSendSamples, sendSample } from './service' |
| | | |
| | | export default { |
| | | name: "SampleSubmission", |
| | |
| | | }, |
| | | data() { |
| | | return { |
| | | id: null, |
| | | showReceiveConfirm: false, |
| | | showAdditives: true, |
| | | schedulingData: [{ |
| | | planCode: 'DD-EX001', |
| | | experimentCode: 'DD-EX001', |
| | | experimentName: '名称名称名称', |
| | | notifyTime: '2025-1-2 14:50:19', |
| | | startTime: '2025-02-27', |
| | | endTime: '2025-06-06', |
| | | participants: '张弘, 李天浩, 陈三, 李四', |
| | | status: '已确认' |
| | | }], |
| | | schedulingTotal: 1, |
| | | schedulingData: [], |
| | | schedulingTotal: 0, |
| | | form: { |
| | | sampleCode: "DD-25010BS01", |
| | | sampleCode: "", |
| | | }, |
| | | sampleList: [ |
| | | { |
| | | index: 1, |
| | | processTime: "2", |
| | | sampleName: "名称名称名称", |
| | | sampleCode: "314234321", |
| | | temperature: "34", |
| | | ph: "34", |
| | | waterAmount: "34", |
| | | additive1: "10g", |
| | | additive2: "5g", |
| | | additive3: "3g", |
| | | additive4: "", |
| | | additive5: "", |
| | | additive6: "", |
| | | additive7: "", |
| | | additive8: "", |
| | | additive9: "", |
| | | additive10: "", |
| | | sampleAmount: "34", |
| | | sampleTime: "2025-1-9 15:26:08", |
| | | photo: "@/assets/sample-photos/photo1.jpg", |
| | | operator: "张三", |
| | | status: "待发送" |
| | | }, |
| | | { |
| | | index: 2, |
| | | processTime: "4", |
| | | sampleName: "名称名称名称", |
| | | sampleCode: "314234321", |
| | | temperature: "23", |
| | | ph: "23", |
| | | waterAmount: "23", |
| | | additive1: "8g", |
| | | additive2: "4g", |
| | | additive3: "", |
| | | additive4: "", |
| | | additive5: "", |
| | | additive6: "", |
| | | additive7: "", |
| | | additive8: "", |
| | | additive9: "", |
| | | additive10: "", |
| | | sampleAmount: "23", |
| | | sampleTime: "2025-1-9 15:26:08", |
| | | photo: "@/assets/sample-photos/photo2.jpg", |
| | | operator: "李四", |
| | | status: "待接收" |
| | | }, |
| | | { |
| | | index: 3, |
| | | processTime: "8", |
| | | sampleName: "名称名称名称", |
| | | sampleCode: "314234321", |
| | | temperature: "23", |
| | | ph: "23", |
| | | waterAmount: "23", |
| | | additive1: "", |
| | | additive2: "", |
| | | additive3: "", |
| | | additive4: "", |
| | | additive5: "", |
| | | additive6: "", |
| | | additive7: "", |
| | | additive8: "", |
| | | additive9: "", |
| | | additive10: "", |
| | | sampleAmount: "23", |
| | | sampleTime: "2025-1-9 15:26:08", |
| | | photo: "@/assets/sample-photos/photo3.jpg", |
| | | operator: "王五", |
| | | status: "已接收" |
| | | } |
| | | ], |
| | | sampleTotal: 3, |
| | | selectedSamples: [] |
| | | sampleList: [], |
| | | sampleTotal: 0, |
| | | selectedSamples: [], |
| | | statusTypeMap: { |
| | | '-1': 'info', |
| | | '1': 'warning', |
| | | '2': 'success', |
| | | '3': 'info' |
| | | }, |
| | | statusTextMap: { |
| | | '-1': '草稿箱', |
| | | '1': '待提交', |
| | | '2': '已提交', |
| | | '3': '已封存' |
| | | }, |
| | | sampleStatusTypeMap: { |
| | | '1': 'warning', |
| | | '2': 'info', |
| | | '3': 'success' |
| | | }, |
| | | sampleStatusTextMap: { |
| | | '1': '待发送', |
| | | '2': '待接收', |
| | | '3': '已接收' |
| | | } |
| | | }; |
| | | }, |
| | | created() { |
| | | this.id = this.$route.query.id; |
| | | if (this.id) { |
| | | this.getDetailData(); |
| | | } |
| | | }, |
| | | methods: { |
| | | async getDetailData() { |
| | | try { |
| | | const res = await getDetail({ id: this.id }); |
| | | if (res) { |
| | | this.schedulingData = [res.experimentDispatch] || []; |
| | | this.schedulingTotal = this.schedulingData.length; |
| | | this.form.sampleCode = res.samplingCode || ''; |
| | | this.sampleList = res.samplingRecordOperations || []; |
| | | this.sampleTotal = this.sampleList.length; |
| | | } |
| | | } catch (error) { |
| | | console.error('获取详情失败:', error); |
| | | this.$message.error('获取详情失败'); |
| | | } |
| | | }, |
| | | handleSelectionChange(selection) { |
| | | this.selectedSamples = selection; |
| | | }, |
| | | handleSend(row) { |
| | | async handleSend(row) { |
| | | this.selectedSamples = [row]; |
| | | this.showReceiveConfirm = true; |
| | | }, |
| | | handleBatchSend() { |
| | | if (this.selectedSamples.length === 0) { |
| | | async handleBatchSend() { |
| | | if (this.selectedSamples.length == 0) { |
| | | this.$message.warning('请先选择要发送的样品'); |
| | | return; |
| | | } |
| | | this.showReceiveConfirm = true; |
| | | }, |
| | | confirmSend(signature) { |
| | | // 处理发送确认逻辑 |
| | | const sampleIds = this.selectedSamples.map(item => item.id); |
| | | console.log('发送样品', { sampleIds, signature }); |
| | | |
| | | // 更新状态 |
| | | this.selectedSamples.forEach(sample => { |
| | | const index = this.sampleList.findIndex(item => item.id === sample.id); |
| | | if (index > -1) { |
| | | this.sampleList[index].status = '待接收'; |
| | | async confirmSend(signature) { |
| | | try { |
| | | const recordOperationIds = this.selectedSamples.map(item => item.id).join(','); |
| | | const res = await batchSendSamples({ |
| | | recordOperationId: recordOperationIds, |
| | | sendSign: signature |
| | | }); |
| | | |
| | | if (res.code == 200) { |
| | | this.$message.success(`成功发送 ${this.selectedSamples.length} 个样品`); |
| | | this.selectedSamples = []; |
| | | this.showReceiveConfirm = false; |
| | | // 刷新数据 |
| | | this.getDetailData(); |
| | | } else { |
| | | this.$message.error(res.msg || '发送失败'); |
| | | } |
| | | }); |
| | | |
| | | this.$message.success(`成功发送 ${this.selectedSamples.length} 个样品`); |
| | | this.selectedSamples = []; |
| | | } |
| | | } catch (error) { |
| | | console.error('发送失败:', error); |
| | | this.$message.error('发送失败'); |
| | | } |
| | | }, |
| | | getStatusType(status) { |
| | | return this.statusTypeMap[status] || 'info'; |
| | | }, |
| | | getStatusText(status) { |
| | | return this.statusTextMap[status] || '未知状态'; |
| | | }, |
| | | isSelectable(row) { |
| | | return row.status == '1'; |
| | | }, |
| | | getSampleStatusType(status) { |
| | | return this.sampleStatusTypeMap[status] || 'info'; |
| | | }, |
| | | getSampleStatusText(status) { |
| | | return this.sampleStatusTextMap[status] || '未知状态'; |
| | | }, |
| | | } |
| | | }; |
| | | </script> |