| ¶Ô±ÈÐÂÎļþ |
| | |
| | | // æ°æ®ééä¸å¤ç页颿¥å£ |
| | | import request from '@/utils/request' |
| | | |
| | | // å页æ¥è¯¢æ°æ®éé |
| | | export function listDataCollection(query) { |
| | | return request({ |
| | | url: '/lims/dataCollection/listPage', |
| | | method: 'get', |
| | | params: query |
| | | }) |
| | | } |
| | | |
| | | // æ¥è¯¢æ°æ®ééè¯¦ç» |
| | | export function getDataCollection(id) { |
| | | return request({ |
| | | url: '/lims/dataCollection/' + id, |
| | | method: 'get' |
| | | }) |
| | | } |
| | | |
| | | // æ°å¢æ°æ®éé |
| | | export function addDataCollection(data) { |
| | | return request({ |
| | | url: '/lims/dataCollection/add', |
| | | method: 'post', |
| | | data: data |
| | | }) |
| | | } |
| | | |
| | | // ä¿®æ¹æ°æ®éé |
| | | export function updateDataCollection(data) { |
| | | return request({ |
| | | url: '/lims/dataCollection/update', |
| | | method: 'post', |
| | | data: data |
| | | }) |
| | | } |
| | | |
| | | // å 餿°æ®éé |
| | | export function delDataCollection(ids) { |
| | | return request({ |
| | | url: '/lims/dataCollection/delete', |
| | | method: 'delete', |
| | | data: ids |
| | | }) |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | // æ°æ®æ¥å£ç®¡ç页颿¥å£ |
| | | import request from '@/utils/request' |
| | | |
| | | // å页æ¥è¯¢æ°æ®æ¥å£ |
| | | export function listDataInterface(query) { |
| | | return request({ |
| | | url: '/lims/dataInterface/listPage', |
| | | method: 'get', |
| | | params: query |
| | | }) |
| | | } |
| | | |
| | | // æ¥è¯¢æ°æ®æ¥å£è¯¦ç» |
| | | export function getDataInterface(id) { |
| | | return request({ |
| | | url: '/lims/dataInterface/' + id, |
| | | method: 'get' |
| | | }) |
| | | } |
| | | |
| | | // æ°å¢æ°æ®æ¥å£ |
| | | export function addDataInterface(data) { |
| | | return request({ |
| | | url: '/lims/dataInterface/add', |
| | | method: 'post', |
| | | data: data |
| | | }) |
| | | } |
| | | |
| | | // ä¿®æ¹æ°æ®æ¥å£ |
| | | export function updateDataInterface(data) { |
| | | return request({ |
| | | url: '/lims/dataInterface/update', |
| | | method: 'post', |
| | | data: data |
| | | }) |
| | | } |
| | | |
| | | // å 餿°æ®æ¥å£ |
| | | export function delDataInterface(ids) { |
| | | return request({ |
| | | url: '/lims/dataInterface/delete', |
| | | method: 'delete', |
| | | data: ids |
| | | }) |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | // å®éªç®¡ç页颿¥å£ |
| | | import request from '@/utils/request' |
| | | |
| | | // å页æ¥è¯¢å®éª |
| | | export function listExperiment(query) { |
| | | return request({ |
| | | url: '/lims/experiment/listPage', |
| | | method: 'get', |
| | | params: query |
| | | }) |
| | | } |
| | | |
| | | // æ¥è¯¢å®éªè¯¦ç» |
| | | export function getExperiment(id) { |
| | | return request({ |
| | | url: '/lims/experiment/' + id, |
| | | method: 'get' |
| | | }) |
| | | } |
| | | |
| | | // æ°å¢å®éª |
| | | export function addExperiment(data) { |
| | | return request({ |
| | | url: '/lims/experiment/add', |
| | | method: 'post', |
| | | data: data |
| | | }) |
| | | } |
| | | |
| | | // ä¿®æ¹å®éª |
| | | export function updateExperiment(data) { |
| | | return request({ |
| | | url: '/lims/experiment/update', |
| | | method: 'post', |
| | | data: data |
| | | }) |
| | | } |
| | | |
| | | // å é¤å®éª |
| | | export function delExperiment(ids) { |
| | | return request({ |
| | | url: '/lims/experiment/delete', |
| | | method: 'delete', |
| | | data: ids |
| | | }) |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | // 宿¶çæ§ä¸é¢è¦é¡µé¢æ¥å£ |
| | | import request from '@/utils/request' |
| | | |
| | | // å页æ¥è¯¢çæ§æ°æ® |
| | | export function listRealtimeMonitor(query) { |
| | | return request({ |
| | | url: '/lims/realtimeMonitor/listPage', |
| | | method: 'get', |
| | | params: query |
| | | }) |
| | | } |
| | | |
| | | // æ¥è¯¢çæ§æ°æ®è¯¦ç» |
| | | export function getRealtimeMonitor(id) { |
| | | return request({ |
| | | url: '/lims/realtimeMonitor/' + id, |
| | | method: 'get' |
| | | }) |
| | | } |
| | | |
| | | // æ°å¢çæ§æ°æ® |
| | | export function addRealtimeMonitor(data) { |
| | | return request({ |
| | | url: '/lims/realtimeMonitor/add', |
| | | method: 'post', |
| | | data: data |
| | | }) |
| | | } |
| | | |
| | | // ä¿®æ¹çæ§æ°æ® |
| | | export function updateRealtimeMonitor(data) { |
| | | return request({ |
| | | url: '/lims/realtimeMonitor/update', |
| | | method: 'post', |
| | | data: data |
| | | }) |
| | | } |
| | | |
| | | // å é¤çæ§æ°æ® |
| | | export function delRealtimeMonitor(ids) { |
| | | return request({ |
| | | url: '/lims/realtimeMonitor/delete', |
| | | method: 'delete', |
| | | data: ids |
| | | }) |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | // æ ·å管ç页颿¥å£ |
| | | import request from '@/utils/request' |
| | | |
| | | // å页æ¥è¯¢æ ·å |
| | | export function listSample(query) { |
| | | return request({ |
| | | url: '/lims/sample/listPage', |
| | | method: 'get', |
| | | params: query |
| | | }) |
| | | } |
| | | |
| | | // æ¥è¯¢æ ·åè¯¦ç» |
| | | export function getSample(id) { |
| | | return request({ |
| | | url: '/lims/sample/' + id, |
| | | method: 'get' |
| | | }) |
| | | } |
| | | |
| | | // æ°å¢æ ·å |
| | | export function addSample(data) { |
| | | return request({ |
| | | url: '/lims/sample/add', |
| | | method: 'post', |
| | | data: data |
| | | }) |
| | | } |
| | | |
| | | // ä¿®æ¹æ ·å |
| | | export function updateSample(data) { |
| | | return request({ |
| | | url: '/lims/sample/update', |
| | | method: 'post', |
| | | data: data |
| | | }) |
| | | } |
| | | |
| | | // å 餿 ·å |
| | | export function delSample(ids) { |
| | | return request({ |
| | | url: '/lims/sample/delete', |
| | | method: 'delete', |
| | | data: ids |
| | | }) |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <div class="search_form"> |
| | | <div> |
| | | <span class="search_title">ééç¼å·ï¼</span> |
| | | <el-input |
| | | v-model="searchForm.collectionCode" |
| | | style="width: 200px" |
| | | placeholder="请è¾å
¥" |
| | | @change="handleQuery" |
| | | clearable |
| | | :prefix-icon="Search" |
| | | /> |
| | | <span class="search_title" style="margin-left: 20px">设å¤åç§°ï¼</span> |
| | | <el-input |
| | | v-model="searchForm.deviceName" |
| | | style="width: 200px" |
| | | placeholder="请è¾å
¥" |
| | | @change="handleQuery" |
| | | clearable |
| | | /> |
| | | <span class="search_title" style="margin-left: 20px">ééç¶æï¼</span> |
| | | <el-select |
| | | v-model="searchForm.collectionStatus" |
| | | style="width: 150px" |
| | | placeholder="è¯·éæ©" |
| | | clearable |
| | | @change="handleQuery" |
| | | > |
| | | <el-option label="ééä¸" value="collecting" /> |
| | | <el-option label="å¤çä¸" value="processing" /> |
| | | <el-option label="已宿" value="completed" /> |
| | | <el-option label="失败" value="failed" /> |
| | | </el-select> |
| | | <el-button type="primary" @click="handleQuery" style="margin-left: 10px" |
| | | >æç´¢</el-button |
| | | > |
| | | </div> |
| | | <div> |
| | | <el-button type="primary" @click="openForm('add')">æ°å¢éé</el-button> |
| | | <el-button @click="handleOut">导åº</el-button> |
| | | <el-button type="danger" plain @click="handleDelete">å é¤</el-button> |
| | | </div> |
| | | </div> |
| | | <div class="table_list"> |
| | | <PIMTable |
| | | rowKey="id" |
| | | :column="tableColumn" |
| | | :tableData="tableData" |
| | | :page="page" |
| | | :isSelection="true" |
| | | @selection-change="handleSelectionChange" |
| | | :tableLoading="tableLoading" |
| | | @pagination="pagination" |
| | | ></PIMTable> |
| | | </div> |
| | | <el-dialog |
| | | v-model="dialogFormVisible" |
| | | :title="operationType === 'add' ? 'æ°å¢æ°æ®éé' : 'ç¼è¾æ°æ®éé'" |
| | | width="70%" |
| | | @close="closeDia" |
| | | > |
| | | <el-form |
| | | :model="form" |
| | | label-width="140px" |
| | | label-position="top" |
| | | :rules="rules" |
| | | ref="formRef" |
| | | > |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="ééç¼å·ï¼" prop="collectionCode"> |
| | | <el-input |
| | | v-model="form.collectionCode" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="设å¤åç§°ï¼" prop="deviceName"> |
| | | <el-input |
| | | v-model="form.deviceName" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="设å¤ç¼å·ï¼" prop="deviceCode"> |
| | | <el-input |
| | | v-model="form.deviceCode" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="æ°æ®ç±»åï¼" prop="dataType"> |
| | | <el-select |
| | | v-model="form.dataType" |
| | | placeholder="è¯·éæ©" |
| | | clearable |
| | | style="width: 100%" |
| | | > |
| | | <el-option label="温度" value="temperature" /> |
| | | <el-option label="湿度" value="humidity" /> |
| | | <el-option label="åå" value="pressure" /> |
| | | <el-option label="æµé" value="flow" /> |
| | | <el-option label="æµåº¦" value="concentration" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="ééæ°å¼ï¼" prop="collectionValue"> |
| | | <el-input |
| | | v-model="form.collectionValue" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="计éåä½ï¼" prop="unit"> |
| | | <el-select |
| | | v-model="form.unit" |
| | | placeholder="è¯·éæ©" |
| | | clearable |
| | | style="width: 100%" |
| | | > |
| | | <el-option label="ææ°åº¦(°C)" value="celsius" /> |
| | | <el-option label="ç¾åæ¯(%)" value="percent" /> |
| | | <el-option label="叿¯å¡(Pa)" value="pa" /> |
| | | <el-option label="å/åé(L/min)" value="lmin" /> |
| | | <el-option label="毫å
/å(mg/L)" value="mgl" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="ééæ¶é´ï¼" prop="collectionTime"> |
| | | <el-date-picker |
| | | style="width: 100%" |
| | | v-model="form.collectionTime" |
| | | value-format="YYYY-MM-DD HH:mm:ss" |
| | | format="YYYY-MM-DD HH:mm:ss" |
| | | type="datetime" |
| | | placeholder="è¯·éæ©" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="ééç¶æï¼" prop="collectionStatus"> |
| | | <el-select |
| | | v-model="form.collectionStatus" |
| | | placeholder="è¯·éæ©" |
| | | clearable |
| | | style="width: 100%" |
| | | > |
| | | <el-option label="ééä¸" value="collecting" /> |
| | | <el-option label="å¤çä¸" value="processing" /> |
| | | <el-option label="已宿" value="completed" /> |
| | | <el-option label="失败" value="failed" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="æ°æ®è´¨éï¼" prop="dataQuality"> |
| | | <el-select |
| | | v-model="form.dataQuality" |
| | | placeholder="è¯·éæ©" |
| | | clearable |
| | | style="width: 100%" |
| | | > |
| | | <el-option label="åæ ¼" value="qualified" /> |
| | | <el-option label="å¼å¸¸" value="abnormal" /> |
| | | <el-option label="å¾
æ ¡éª" value="pending" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="å¤çæ¹å¼ï¼" prop="processMethod"> |
| | | <el-select |
| | | v-model="form.processMethod" |
| | | placeholder="è¯·éæ©" |
| | | clearable |
| | | style="width: 100%" |
| | | > |
| | | <el-option label="èªå¨æ¸
æ´" value="autoClean" /> |
| | | <el-option label="äººå·¥æ ¡éª" value="manualVerify" /> |
| | | <el-option label="æ°æ®è½¬æ¢" value="dataTransform" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="24"> |
| | | <el-form-item label="åå§æ°æ®ï¼" prop="rawData"> |
| | | <el-input |
| | | v-model="form.rawData" |
| | | type="textarea" |
| | | :rows="3" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="24"> |
| | | <el-form-item label="å¤çåæ°æ®ï¼" prop="processedData"> |
| | | <el-input |
| | | v-model="form.processedData" |
| | | type="textarea" |
| | | :rows="3" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="24"> |
| | | <el-form-item label="夿³¨ï¼" prop="remark"> |
| | | <el-input |
| | | v-model="form.remark" |
| | | type="textarea" |
| | | :rows="2" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="ç»´æ¤äººï¼" prop="maintainer"> |
| | | <el-select |
| | | v-model="form.maintainer" |
| | | placeholder="è¯·éæ©" |
| | | clearable |
| | | disabled |
| | | > |
| | | <el-option |
| | | v-for="item in userList" |
| | | :key="item.nickName" |
| | | :label="item.nickName" |
| | | :value="item.nickName" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="ç»´æ¤æ¶é´ï¼" prop="maintenanceTime"> |
| | | <el-date-picker |
| | | style="width: 100%" |
| | | v-model="form.maintenanceTime" |
| | | value-format="YYYY-MM-DD" |
| | | format="YYYY-MM-DD" |
| | | type="date" |
| | | placeholder="è¯·éæ©" |
| | | clearable |
| | | disabled |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | </el-form> |
| | | <template #footer> |
| | | <div class="dialog-footer"> |
| | | <el-button type="primary" @click="submitForm">确认</el-button> |
| | | <el-button @click="closeDia">åæ¶</el-button> |
| | | </div> |
| | | </template> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { onMounted, ref, reactive } from "vue"; |
| | | import { Search } from "@element-plus/icons-vue"; |
| | | import { |
| | | addDataCollection, |
| | | delDataCollection, |
| | | getDataCollection, |
| | | listDataCollection, |
| | | updateDataCollection, |
| | | } from "@/api/lims/dataCollection.js"; |
| | | import { ElMessageBox } from "element-plus"; |
| | | import { userListNoPage } from "@/api/system/user.js"; |
| | | import useUserStore from "@/store/modules/user"; |
| | | const { proxy } = getCurrentInstance(); |
| | | const userStore = useUserStore(); |
| | | |
| | | const tableColumn = ref([ |
| | | { |
| | | label: "ééç¼å·", |
| | | prop: "collectionCode", |
| | | width: 150, |
| | | }, |
| | | { |
| | | label: "设å¤åç§°", |
| | | prop: "deviceName", |
| | | width: 180, |
| | | }, |
| | | { |
| | | label: "设å¤ç¼å·", |
| | | prop: "deviceCode", |
| | | width: 150, |
| | | }, |
| | | { |
| | | label: "æ°æ®ç±»å", |
| | | prop: "dataType", |
| | | width: 120, |
| | | }, |
| | | { |
| | | label: "ééæ°å¼", |
| | | prop: "collectionValue", |
| | | width: 120, |
| | | }, |
| | | { |
| | | label: "åä½", |
| | | prop: "unit", |
| | | width: 80, |
| | | }, |
| | | { |
| | | label: "ééæ¶é´", |
| | | prop: "collectionTime", |
| | | width: 180, |
| | | }, |
| | | { |
| | | label: "ééç¶æ", |
| | | prop: "collectionStatus", |
| | | width: 100, |
| | | }, |
| | | { |
| | | label: "æ°æ®è´¨é", |
| | | prop: "dataQuality", |
| | | width: 100, |
| | | }, |
| | | { |
| | | label: "å¤çæ¹å¼", |
| | | prop: "processMethod", |
| | | width: 120, |
| | | }, |
| | | { |
| | | label: "ç»´æ¤äºº", |
| | | prop: "maintainer", |
| | | }, |
| | | { |
| | | label: "ç»´æ¤æ¶é´", |
| | | prop: "maintenanceTime", |
| | | width: 100, |
| | | }, |
| | | { |
| | | dataType: "action", |
| | | label: "æä½", |
| | | align: "center", |
| | | fixed: 'right', |
| | | operation: [ |
| | | { |
| | | name: "ç¼è¾", |
| | | type: "text", |
| | | clickFun: (row) => { |
| | | openForm("edit", row); |
| | | }, |
| | | disabled: (row) => { |
| | | return row.maintainer !== userStore.nickName |
| | | } |
| | | }, |
| | | ], |
| | | }, |
| | | ]); |
| | | const tableData = ref([]); |
| | | const selectedRows = ref([]); |
| | | const userList = ref([]); |
| | | const tableLoading = ref(false); |
| | | const page = reactive({ |
| | | current: 1, |
| | | size: 100, |
| | | total: 0, |
| | | }); |
| | | |
| | | const operationType = ref(""); |
| | | const dialogFormVisible = ref(false); |
| | | const data = reactive({ |
| | | searchForm: { |
| | | collectionCode: "", |
| | | deviceName: "", |
| | | collectionStatus: "", |
| | | }, |
| | | form: { |
| | | collectionCode: "", |
| | | deviceName: "", |
| | | deviceCode: "", |
| | | dataType: "", |
| | | collectionValue: "", |
| | | unit: "", |
| | | collectionTime: "", |
| | | collectionStatus: "collecting", |
| | | dataQuality: "", |
| | | processMethod: "", |
| | | rawData: "", |
| | | processedData: "", |
| | | remark: "", |
| | | maintainer: "", |
| | | maintenanceTime: "", |
| | | }, |
| | | rules: { |
| | | collectionCode: [{ required: true, message: "请è¾å
¥", trigger: "blur" }], |
| | | deviceName: [{ required: true, message: "请è¾å
¥", trigger: "blur" }], |
| | | deviceCode: [{ required: true, message: "请è¾å
¥", trigger: "blur" }], |
| | | dataType: [{ required: true, message: "è¯·éæ©", trigger: "change" }], |
| | | collectionValue: [{ required: true, message: "请è¾å
¥", trigger: "blur" }], |
| | | unit: [{ required: true, message: "è¯·éæ©", trigger: "change" }], |
| | | collectionTime: [{ required: true, message: "è¯·éæ©", trigger: "change" }], |
| | | collectionStatus: [{ required: true, message: "è¯·éæ©", trigger: "change" }], |
| | | dataQuality: [{ required: true, message: "è¯·éæ©", trigger: "change" }], |
| | | processMethod: [{ required: true, message: "è¯·éæ©", trigger: "change" }], |
| | | maintainer: [{ required: false, message: "è¯·éæ©", trigger: "change" }], |
| | | maintenanceTime: [ |
| | | { required: false, message: "è¯·éæ©", trigger: "change" }, |
| | | ], |
| | | }, |
| | | }); |
| | | const { searchForm, form, rules } = toRefs(data); |
| | | |
| | | const handleQuery = () => { |
| | | page.current = 1; |
| | | getList(); |
| | | }; |
| | | const pagination = (obj) => { |
| | | page.current = obj.page; |
| | | page.size = obj.limit; |
| | | getList(); |
| | | }; |
| | | const getList = () => { |
| | | tableLoading.value = true; |
| | | listDataCollection({ ...searchForm.value, ...page }).then((res) => { |
| | | tableLoading.value = false; |
| | | tableData.value = res.data.records; |
| | | page.total = res.data.total; |
| | | }); |
| | | }; |
| | | const handleSelectionChange = (selection) => { |
| | | selectedRows.value = selection; |
| | | }; |
| | | const openForm = (type, row) => { |
| | | operationType.value = type; |
| | | form.value = {}; |
| | | form.value.maintainer = userStore.nickName; |
| | | form.value.collectionStatus = "collecting"; |
| | | form.value.maintenanceTime = getCurrentDate(); |
| | | userListNoPage().then((res) => { |
| | | userList.value = res.data; |
| | | }); |
| | | if (type === "edit") { |
| | | getDataCollection(row.id).then((res) => { |
| | | form.value = { ...res.data }; |
| | | }); |
| | | } |
| | | dialogFormVisible.value = true; |
| | | }; |
| | | const submitForm = () => { |
| | | proxy.$refs["formRef"].validate((valid) => { |
| | | if (valid) { |
| | | if (operationType.value === "edit") { |
| | | submitEdit(); |
| | | } else { |
| | | submitAdd(); |
| | | } |
| | | } |
| | | }); |
| | | }; |
| | | const submitAdd = () => { |
| | | addDataCollection(form.value).then((res) => { |
| | | proxy.$modal.msgSuccess("æäº¤æå"); |
| | | closeDia(); |
| | | getList(); |
| | | }); |
| | | }; |
| | | const submitEdit = () => { |
| | | updateDataCollection(form.value).then((res) => { |
| | | proxy.$modal.msgSuccess("æäº¤æå"); |
| | | closeDia(); |
| | | getList(); |
| | | }); |
| | | }; |
| | | const closeDia = () => { |
| | | proxy.resetForm("formRef"); |
| | | dialogFormVisible.value = false; |
| | | }; |
| | | const handleOut = () => { |
| | | ElMessageBox.confirm("éä¸çå
容å°è¢«å¯¼åºï¼æ¯å¦ç¡®è®¤å¯¼åºï¼", "导åº", { |
| | | confirmButtonText: "确认", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning", |
| | | }) |
| | | .then(() => { |
| | | proxy.download("/lims/dataCollection/export", {}, "æ°æ®ééä¸å¤ç.xlsx"); |
| | | }) |
| | | .catch(() => { |
| | | proxy.$modal.msg("已忶"); |
| | | }); |
| | | }; |
| | | const handleDelete = () => { |
| | | let ids = []; |
| | | if (selectedRows.value.length > 0) { |
| | | const unauthorizedData = selectedRows.value.filter(item => item.maintainer !== userStore.nickName); |
| | | if (unauthorizedData.length > 0) { |
| | | proxy.$modal.msgWarning("ä¸å¯å é¤ä»äººç»´æ¤çæ°æ®"); |
| | | return; |
| | | } |
| | | ids = selectedRows.value.map((item) => item.id); |
| | | } else { |
| | | proxy.$modal.msgWarning("è¯·éæ©æ°æ®"); |
| | | return; |
| | | } |
| | | ElMessageBox.confirm("éä¸çå
容å°è¢«å é¤ï¼æ¯å¦ç¡®è®¤å é¤ï¼", "å é¤æç¤º", { |
| | | confirmButtonText: "确认", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning", |
| | | }) |
| | | .then(() => { |
| | | tableLoading.value = true; |
| | | delDataCollection(ids) |
| | | .then((res) => { |
| | | proxy.$modal.msgSuccess("å 餿å"); |
| | | getList(); |
| | | }) |
| | | .finally(() => { |
| | | tableLoading.value = false; |
| | | }); |
| | | }) |
| | | .catch(() => { |
| | | proxy.$modal.msg("已忶"); |
| | | }); |
| | | }; |
| | | |
| | | function getCurrentDate() { |
| | | const today = new Date(); |
| | | const year = today.getFullYear(); |
| | | const month = String(today.getMonth() + 1).padStart(2, "0"); |
| | | const day = String(today.getDate()).padStart(2, "0"); |
| | | return `${year}-${month}-${day}`; |
| | | } |
| | | |
| | | onMounted(() => { |
| | | getList(); |
| | | }); |
| | | </script> |
| | | |
| | | <style scoped lang="scss"></style> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <div class="search_form"> |
| | | <div> |
| | | <span class="search_title">æ¥å£åç§°ï¼</span> |
| | | <el-input |
| | | v-model="searchForm.interfaceName" |
| | | style="width: 240px" |
| | | placeholder="请è¾å
¥" |
| | | @change="handleQuery" |
| | | clearable |
| | | :prefix-icon="Search" |
| | | /> |
| | | <span class="search_title" style="margin-left: 20px">设å¤ç±»åï¼</span> |
| | | <el-select |
| | | v-model="searchForm.deviceType" |
| | | style="width: 200px" |
| | | placeholder="è¯·éæ©" |
| | | clearable |
| | | @change="handleQuery" |
| | | > |
| | | <el-option label="仪å¨ä»ªè¡¨" value="instrument" /> |
| | | <el-option label="软件系ç»" value="software" /> |
| | | <el-option label="ä¼ æå¨" value="sensor" /> |
| | | </el-select> |
| | | <el-button type="primary" @click="handleQuery" style="margin-left: 10px" |
| | | >æç´¢</el-button |
| | | > |
| | | </div> |
| | | <div> |
| | | <el-button type="primary" @click="openForm('add')">æ°å¢æ¥å£</el-button> |
| | | <!-- <el-button @click="handleOut">导åº</el-button> --> |
| | | <el-button type="danger" plain @click="handleDelete">å é¤</el-button> |
| | | </div> |
| | | </div> |
| | | <div class="table_list"> |
| | | <PIMTable |
| | | rowKey="id" |
| | | :column="tableColumn" |
| | | :tableData="tableData" |
| | | :page="page" |
| | | :isSelection="true" |
| | | @selection-change="handleSelectionChange" |
| | | :tableLoading="tableLoading" |
| | | @pagination="pagination" |
| | | ></PIMTable> |
| | | </div> |
| | | <el-dialog |
| | | v-model="dialogFormVisible" |
| | | :title="operationType === 'add' ? 'æ°å¢æ°æ®æ¥å£' : 'ç¼è¾æ°æ®æ¥å£'" |
| | | width="70%" |
| | | @close="closeDia" |
| | | > |
| | | <el-form |
| | | :model="form" |
| | | label-width="140px" |
| | | label-position="top" |
| | | :rules="rules" |
| | | ref="formRef" |
| | | > |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="æ¥å£åç§°ï¼" prop="interfaceName"> |
| | | <el-input |
| | | v-model="form.interfaceName" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="æ¥å£ç¼ç ï¼" prop="interfaceCode"> |
| | | <el-input |
| | | v-model="form.interfaceCode" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="设å¤ç±»åï¼" prop="deviceType"> |
| | | <el-select |
| | | v-model="form.deviceType" |
| | | placeholder="è¯·éæ©" |
| | | clearable |
| | | style="width: 100%" |
| | | > |
| | | <el-option label="仪å¨ä»ªè¡¨" value="instrument" /> |
| | | <el-option label="软件系ç»" value="software" /> |
| | | <el-option label="ä¼ æå¨" value="sensor" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="设å¤åç§°ï¼" prop="deviceName"> |
| | | <el-input |
| | | v-model="form.deviceName" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="è¿æ¥åè®®ï¼" prop="protocol"> |
| | | <el-select |
| | | v-model="form.protocol" |
| | | placeholder="è¯·éæ©" |
| | | clearable |
| | | style="width: 100%" |
| | | > |
| | | <el-option label="HTTP" value="http" /> |
| | | <el-option label="TCP" value="tcp" /> |
| | | <el-option label="MQTT" value="mqtt" /> |
| | | <el-option label="Modbus" value="modbus" /> |
| | | <el-option label="OPC UA" value="opcua" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="è¿æ¥å°åï¼" prop="connectionUrl"> |
| | | <el-input |
| | | v-model="form.connectionUrl" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="端å£å·ï¼" prop="port"> |
| | | <el-input |
| | | v-model="form.port" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="æ¥å£ç¶æï¼" prop="status"> |
| | | <el-radio-group v-model="form.status"> |
| | | <el-radio label="1">å¯ç¨</el-radio> |
| | | <el-radio label="0">ç¦ç¨</el-radio> |
| | | </el-radio-group> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="24"> |
| | | <el-form-item label="æ¥å£æè¿°ï¼" prop="description"> |
| | | <el-input |
| | | v-model="form.description" |
| | | type="textarea" |
| | | :rows="3" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="ç»´æ¤äººï¼" prop="maintainer"> |
| | | <el-select |
| | | v-model="form.maintainer" |
| | | placeholder="è¯·éæ©" |
| | | clearable |
| | | disabled |
| | | > |
| | | <el-option |
| | | v-for="item in userList" |
| | | :key="item.nickName" |
| | | :label="item.nickName" |
| | | :value="item.nickName" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="ç»´æ¤æ¶é´ï¼" prop="maintenanceTime"> |
| | | <el-date-picker |
| | | style="width: 100%" |
| | | v-model="form.maintenanceTime" |
| | | value-format="YYYY-MM-DD" |
| | | format="YYYY-MM-DD" |
| | | type="date" |
| | | placeholder="è¯·éæ©" |
| | | clearable |
| | | disabled |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | </el-form> |
| | | <template #footer> |
| | | <div class="dialog-footer"> |
| | | <el-button type="primary" @click="submitForm">确认</el-button> |
| | | <el-button @click="closeDia">åæ¶</el-button> |
| | | </div> |
| | | </template> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { onMounted, ref, reactive } from "vue"; |
| | | import { Search } from "@element-plus/icons-vue"; |
| | | import { |
| | | addDataInterface, |
| | | delDataInterface, |
| | | getDataInterface, |
| | | listDataInterface, |
| | | updateDataInterface, |
| | | } from "@/api/lims/dataInterface.js"; |
| | | import { ElMessageBox } from "element-plus"; |
| | | import { userListNoPage } from "@/api/system/user.js"; |
| | | import useUserStore from "@/store/modules/user"; |
| | | const { proxy } = getCurrentInstance(); |
| | | const userStore = useUserStore(); |
| | | |
| | | const tableColumn = ref([ |
| | | { |
| | | label: "æ¥å£åç§°", |
| | | prop: "interfaceName", |
| | | width: 200, |
| | | }, |
| | | { |
| | | label: "æ¥å£ç¼ç ", |
| | | prop: "interfaceCode", |
| | | width: 150, |
| | | }, |
| | | { |
| | | label: "设å¤ç±»å", |
| | | prop: "deviceType", |
| | | width: 120, |
| | | }, |
| | | { |
| | | label: "设å¤åç§°", |
| | | prop: "deviceName", |
| | | width: 180, |
| | | }, |
| | | { |
| | | label: "è¿æ¥åè®®", |
| | | prop: "protocol", |
| | | width: 120, |
| | | }, |
| | | { |
| | | label: "è¿æ¥å°å", |
| | | prop: "connectionUrl", |
| | | width: 220, |
| | | }, |
| | | { |
| | | label: "端å£å·", |
| | | prop: "port", |
| | | width: 100, |
| | | }, |
| | | { |
| | | label: "æ¥å£ç¶æ", |
| | | prop: "status", |
| | | width: 100, |
| | | }, |
| | | { |
| | | label: "ç»´æ¤äºº", |
| | | prop: "maintainer", |
| | | }, |
| | | { |
| | | label: "ç»´æ¤æ¶é´", |
| | | prop: "maintenanceTime", |
| | | width: 100, |
| | | }, |
| | | { |
| | | dataType: "action", |
| | | label: "æä½", |
| | | align: "center", |
| | | fixed: 'right', |
| | | operation: [ |
| | | { |
| | | name: "ç¼è¾", |
| | | type: "text", |
| | | clickFun: (row) => { |
| | | openForm("edit", row); |
| | | }, |
| | | disabled: (row) => { |
| | | return row.maintainer !== userStore.nickName |
| | | } |
| | | }, |
| | | ], |
| | | }, |
| | | ]); |
| | | const tableData = ref([]); |
| | | const selectedRows = ref([]); |
| | | const userList = ref([]); |
| | | const tableLoading = ref(false); |
| | | const page = reactive({ |
| | | current: 1, |
| | | size: 100, |
| | | total: 0, |
| | | }); |
| | | |
| | | // æ°æ®æ¥å£è¡¨åå¼¹æ¡æ°æ® |
| | | const operationType = ref(""); |
| | | const dialogFormVisible = ref(false); |
| | | const data = reactive({ |
| | | searchForm: { |
| | | interfaceName: "", |
| | | deviceType: "", |
| | | }, |
| | | form: { |
| | | interfaceName: "", |
| | | interfaceCode: "", |
| | | deviceType: "", |
| | | deviceName: "", |
| | | protocol: "", |
| | | connectionUrl: "", |
| | | port: "", |
| | | status: "1", |
| | | description: "", |
| | | maintainer: "", |
| | | maintenanceTime: "", |
| | | }, |
| | | rules: { |
| | | interfaceName: [{ required: true, message: "请è¾å
¥", trigger: "blur" }], |
| | | interfaceCode: [{ required: true, message: "请è¾å
¥", trigger: "blur" }], |
| | | deviceType: [{ required: true, message: "è¯·éæ©", trigger: "change" }], |
| | | deviceName: [{ required: true, message: "请è¾å
¥", trigger: "blur" }], |
| | | protocol: [{ required: true, message: "è¯·éæ©", trigger: "change" }], |
| | | connectionUrl: [{ required: true, message: "请è¾å
¥", trigger: "blur" }], |
| | | port: [{ required: true, message: "请è¾å
¥", trigger: "blur" }], |
| | | status: [{ required: true, message: "è¯·éæ©", trigger: "change" }], |
| | | maintainer: [{ required: false, message: "è¯·éæ©", trigger: "change" }], |
| | | maintenanceTime: [ |
| | | { required: false, message: "è¯·éæ©", trigger: "change" }, |
| | | ], |
| | | }, |
| | | }); |
| | | const { searchForm, form, rules } = toRefs(data); |
| | | |
| | | // æ¥è¯¢å表 |
| | | /** æç´¢æé®æä½ */ |
| | | const handleQuery = () => { |
| | | page.current = 1; |
| | | getList(); |
| | | }; |
| | | const pagination = (obj) => { |
| | | page.current = obj.page; |
| | | page.size = obj.limit; |
| | | getList(); |
| | | }; |
| | | const getList = () => { |
| | | tableLoading.value = true; |
| | | listDataInterface({ ...searchForm.value, ...page }).then((res) => { |
| | | tableLoading.value = false; |
| | | tableData.value = res.data.records; |
| | | page.total = res.data.total; |
| | | }); |
| | | }; |
| | | // è¡¨æ ¼éæ©æ°æ® |
| | | const handleSelectionChange = (selection) => { |
| | | selectedRows.value = selection; |
| | | }; |
| | | // æå¼å¼¹æ¡ |
| | | const openForm = (type, row) => { |
| | | operationType.value = type; |
| | | form.value = {}; |
| | | form.value.maintainer = userStore.nickName; |
| | | form.value.status = "1"; |
| | | form.value.maintenanceTime = getCurrentDate(); |
| | | userListNoPage().then((res) => { |
| | | userList.value = res.data; |
| | | }); |
| | | if (type === "edit") { |
| | | getDataInterface(row.id).then((res) => { |
| | | form.value = { ...res.data }; |
| | | }); |
| | | } |
| | | dialogFormVisible.value = true; |
| | | }; |
| | | // æäº¤è¡¨å |
| | | const submitForm = () => { |
| | | proxy.$refs["formRef"].validate((valid) => { |
| | | if (valid) { |
| | | if (operationType.value === "edit") { |
| | | submitEdit(); |
| | | } else { |
| | | submitAdd(); |
| | | } |
| | | } |
| | | }); |
| | | }; |
| | | // æäº¤æ°å¢ |
| | | const submitAdd = () => { |
| | | addDataInterface(form.value).then((res) => { |
| | | proxy.$modal.msgSuccess("æäº¤æå"); |
| | | closeDia(); |
| | | getList(); |
| | | }); |
| | | }; |
| | | // æäº¤ä¿®æ¹ |
| | | const submitEdit = () => { |
| | | updateDataInterface(form.value).then((res) => { |
| | | proxy.$modal.msgSuccess("æäº¤æå"); |
| | | closeDia(); |
| | | getList(); |
| | | }); |
| | | }; |
| | | // å
³éå¼¹æ¡ |
| | | const closeDia = () => { |
| | | proxy.resetForm("formRef"); |
| | | dialogFormVisible.value = false; |
| | | }; |
| | | // å¯¼åº |
| | | const handleOut = () => { |
| | | ElMessageBox.confirm("éä¸çå
容å°è¢«å¯¼åºï¼æ¯å¦ç¡®è®¤å¯¼åºï¼", "导åº", { |
| | | confirmButtonText: "确认", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning", |
| | | }) |
| | | .then(() => { |
| | | proxy.download("/lims/dataInterface/export", {}, "æ°æ®æ¥å£ç®¡ç.xlsx"); |
| | | }) |
| | | .catch(() => { |
| | | proxy.$modal.msg("已忶"); |
| | | }); |
| | | }; |
| | | // å é¤ |
| | | const handleDelete = () => { |
| | | let ids = []; |
| | | if (selectedRows.value.length > 0) { |
| | | // æ£æ¥æ¯å¦æä»äººç»´æ¤çæ°æ® |
| | | const unauthorizedData = selectedRows.value.filter(item => item.maintainer !== userStore.nickName); |
| | | if (unauthorizedData.length > 0) { |
| | | proxy.$modal.msgWarning("ä¸å¯å é¤ä»äººç»´æ¤çæ°æ®"); |
| | | return; |
| | | } |
| | | ids = selectedRows.value.map((item) => item.id); |
| | | } else { |
| | | proxy.$modal.msgWarning("è¯·éæ©æ°æ®"); |
| | | return; |
| | | } |
| | | ElMessageBox.confirm("éä¸çå
容å°è¢«å é¤ï¼æ¯å¦ç¡®è®¤å é¤ï¼", "å é¤æç¤º", { |
| | | confirmButtonText: "确认", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning", |
| | | }) |
| | | .then(() => { |
| | | tableLoading.value = true; |
| | | delDataInterface(ids) |
| | | .then((res) => { |
| | | proxy.$modal.msgSuccess("å 餿å"); |
| | | getList(); |
| | | }) |
| | | .finally(() => { |
| | | tableLoading.value = false; |
| | | }); |
| | | }) |
| | | .catch(() => { |
| | | proxy.$modal.msg("已忶"); |
| | | }); |
| | | }; |
| | | |
| | | // è·åå½åæ¥æå¹¶æ ¼å¼å为 YYYY-MM-DD |
| | | function getCurrentDate() { |
| | | const today = new Date(); |
| | | const year = today.getFullYear(); |
| | | const month = String(today.getMonth() + 1).padStart(2, "0"); |
| | | const day = String(today.getDate()).padStart(2, "0"); |
| | | return `${year}-${month}-${day}`; |
| | | } |
| | | |
| | | onMounted(() => { |
| | | getList(); |
| | | }); |
| | | </script> |
| | | |
| | | <style scoped lang="scss"></style> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <div class="search_form"> |
| | | <div> |
| | | <span class="search_title">å®éªç¼å·ï¼</span> |
| | | <el-input |
| | | v-model="searchForm.experimentCode" |
| | | style="width: 200px" |
| | | placeholder="请è¾å
¥" |
| | | @change="handleQuery" |
| | | clearable |
| | | :prefix-icon="Search" |
| | | /> |
| | | <span class="search_title" style="margin-left: 20px">å®éªåç§°ï¼</span> |
| | | <el-input |
| | | v-model="searchForm.experimentName" |
| | | style="width: 200px" |
| | | placeholder="请è¾å
¥" |
| | | @change="handleQuery" |
| | | clearable |
| | | /> |
| | | <span class="search_title" style="margin-left: 20px">å®éªç¶æï¼</span> |
| | | <el-select |
| | | v-model="searchForm.experimentStatus" |
| | | style="width: 150px" |
| | | placeholder="è¯·éæ©" |
| | | clearable |
| | | @change="handleQuery" |
| | | > |
| | | <el-option label="计åä¸" value="planned" /> |
| | | <el-option label="è¿è¡ä¸" value="inProgress" /> |
| | | <el-option label="已宿" value="completed" /> |
| | | <el-option label="已忶" value="cancelled" /> |
| | | </el-select> |
| | | <el-button type="primary" @click="handleQuery" style="margin-left: 10px" |
| | | >æç´¢</el-button |
| | | > |
| | | </div> |
| | | <div> |
| | | <el-button type="primary" @click="openForm('add')">æ°å¢å®éª</el-button> |
| | | <el-button @click="handleOut">导åº</el-button> |
| | | <el-button type="danger" plain @click="handleDelete">å é¤</el-button> |
| | | </div> |
| | | </div> |
| | | <div class="table_list"> |
| | | <PIMTable |
| | | rowKey="id" |
| | | :column="tableColumn" |
| | | :tableData="tableData" |
| | | :page="page" |
| | | :isSelection="true" |
| | | @selection-change="handleSelectionChange" |
| | | :tableLoading="tableLoading" |
| | | @pagination="pagination" |
| | | ></PIMTable> |
| | | </div> |
| | | <el-dialog |
| | | v-model="dialogFormVisible" |
| | | :title="operationType === 'add' ? 'æ°å¢å®éª' : 'ç¼è¾å®éª'" |
| | | width="70%" |
| | | @close="closeDia" |
| | | > |
| | | <el-form |
| | | :model="form" |
| | | label-width="140px" |
| | | label-position="top" |
| | | :rules="rules" |
| | | ref="formRef" |
| | | > |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="å®éªç¼å·ï¼" prop="experimentCode"> |
| | | <el-input |
| | | v-model="form.experimentCode" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="å®éªåç§°ï¼" prop="experimentName"> |
| | | <el-input |
| | | v-model="form.experimentName" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="å®éªç±»åï¼" prop="experimentType"> |
| | | <el-select |
| | | v-model="form.experimentType" |
| | | placeholder="è¯·éæ©" |
| | | clearable |
| | | style="width: 100%" |
| | | > |
| | | <el-option label="åå¦åæ" value="chemicalAnalysis" /> |
| | | <el-option label="ç©çæµè¯" value="physicalTest" /> |
| | | <el-option label="å¾®çç©æ£æµ" value="microbialTest" /> |
| | | <el-option label="æ§è½æµè¯" value="performanceTest" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="å®éªæ åï¼" prop="experimentStandard"> |
| | | <el-input |
| | | v-model="form.experimentStandard" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="计åå¼å§æ¥æï¼" prop="planStartDate"> |
| | | <el-date-picker |
| | | style="width: 100%" |
| | | v-model="form.planStartDate" |
| | | value-format="YYYY-MM-DD" |
| | | format="YYYY-MM-DD" |
| | | type="date" |
| | | placeholder="è¯·éæ©" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="计åç»ææ¥æï¼" prop="planEndDate"> |
| | | <el-date-picker |
| | | style="width: 100%" |
| | | v-model="form.planEndDate" |
| | | value-format="YYYY-MM-DD" |
| | | format="YYYY-MM-DD" |
| | | type="date" |
| | | placeholder="è¯·éæ©" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="å®éªè´è´£äººï¼" prop="responsiblePerson"> |
| | | <el-input |
| | | v-model="form.responsiblePerson" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="å®éªç¶æï¼" prop="experimentStatus"> |
| | | <el-select |
| | | v-model="form.experimentStatus" |
| | | placeholder="è¯·éæ©" |
| | | clearable |
| | | style="width: 100%" |
| | | > |
| | | <el-option label="计åä¸" value="planned" /> |
| | | <el-option label="è¿è¡ä¸" value="inProgress" /> |
| | | <el-option label="已宿" value="completed" /> |
| | | <el-option label="已忶" value="cancelled" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="24"> |
| | | <el-form-item label="å®éªç®çï¼" prop="experimentPurpose"> |
| | | <el-input |
| | | v-model="form.experimentPurpose" |
| | | type="textarea" |
| | | :rows="2" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="24"> |
| | | <el-form-item label="å®éªè¿ç¨ï¼" prop="experimentProcess"> |
| | | <el-input |
| | | v-model="form.experimentProcess" |
| | | type="textarea" |
| | | :rows="3" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="24"> |
| | | <el-form-item label="å®éªç»æï¼" prop="experimentResult"> |
| | | <el-input |
| | | v-model="form.experimentResult" |
| | | type="textarea" |
| | | :rows="3" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="ç»´æ¤äººï¼" prop="maintainer"> |
| | | <el-select |
| | | v-model="form.maintainer" |
| | | placeholder="è¯·éæ©" |
| | | clearable |
| | | disabled |
| | | > |
| | | <el-option |
| | | v-for="item in userList" |
| | | :key="item.nickName" |
| | | :label="item.nickName" |
| | | :value="item.nickName" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="ç»´æ¤æ¶é´ï¼" prop="maintenanceTime"> |
| | | <el-date-picker |
| | | style="width: 100%" |
| | | v-model="form.maintenanceTime" |
| | | value-format="YYYY-MM-DD" |
| | | format="YYYY-MM-DD" |
| | | type="date" |
| | | placeholder="è¯·éæ©" |
| | | clearable |
| | | disabled |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | </el-form> |
| | | <template #footer> |
| | | <div class="dialog-footer"> |
| | | <el-button type="primary" @click="submitForm">确认</el-button> |
| | | <el-button @click="closeDia">åæ¶</el-button> |
| | | </div> |
| | | </template> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { onMounted, ref, reactive } from "vue"; |
| | | import { Search } from "@element-plus/icons-vue"; |
| | | import { |
| | | addExperiment, |
| | | delExperiment, |
| | | getExperiment, |
| | | listExperiment, |
| | | updateExperiment, |
| | | } from "@/api/lims/experiment.js"; |
| | | import { ElMessageBox } from "element-plus"; |
| | | import { userListNoPage } from "@/api/system/user.js"; |
| | | import useUserStore from "@/store/modules/user"; |
| | | const { proxy } = getCurrentInstance(); |
| | | const userStore = useUserStore(); |
| | | |
| | | const tableColumn = ref([ |
| | | { |
| | | label: "å®éªç¼å·", |
| | | prop: "experimentCode", |
| | | width: 150, |
| | | }, |
| | | { |
| | | label: "å®éªåç§°", |
| | | prop: "experimentName", |
| | | width: 180, |
| | | }, |
| | | { |
| | | label: "å®éªç±»å", |
| | | prop: "experimentType", |
| | | width: 120, |
| | | }, |
| | | { |
| | | label: "å®éªæ å", |
| | | prop: "experimentStandard", |
| | | width: 150, |
| | | }, |
| | | { |
| | | label: "计åå¼å§æ¥æ", |
| | | prop: "planStartDate", |
| | | width: 120, |
| | | }, |
| | | { |
| | | label: "计åç»ææ¥æ", |
| | | prop: "planEndDate", |
| | | width: 120, |
| | | }, |
| | | { |
| | | label: "å®éªè´è´£äºº", |
| | | prop: "responsiblePerson", |
| | | width: 120, |
| | | }, |
| | | { |
| | | label: "å®éªç¶æ", |
| | | prop: "experimentStatus", |
| | | width: 100, |
| | | }, |
| | | { |
| | | label: "ç»´æ¤äºº", |
| | | prop: "maintainer", |
| | | }, |
| | | { |
| | | label: "ç»´æ¤æ¶é´", |
| | | prop: "maintenanceTime", |
| | | width: 100, |
| | | }, |
| | | { |
| | | dataType: "action", |
| | | label: "æä½", |
| | | align: "center", |
| | | fixed: 'right', |
| | | operation: [ |
| | | { |
| | | name: "ç¼è¾", |
| | | type: "text", |
| | | clickFun: (row) => { |
| | | openForm("edit", row); |
| | | }, |
| | | disabled: (row) => { |
| | | return row.maintainer !== userStore.nickName |
| | | } |
| | | }, |
| | | ], |
| | | }, |
| | | ]); |
| | | const tableData = ref([]); |
| | | const selectedRows = ref([]); |
| | | const userList = ref([]); |
| | | const tableLoading = ref(false); |
| | | const page = reactive({ |
| | | current: 1, |
| | | size: 100, |
| | | total: 0, |
| | | }); |
| | | |
| | | // å®éªè¡¨åå¼¹æ¡æ°æ® |
| | | const operationType = ref(""); |
| | | const dialogFormVisible = ref(false); |
| | | const data = reactive({ |
| | | searchForm: { |
| | | experimentCode: "", |
| | | experimentName: "", |
| | | experimentStatus: "", |
| | | }, |
| | | form: { |
| | | experimentCode: "", |
| | | experimentName: "", |
| | | experimentType: "", |
| | | experimentStandard: "", |
| | | planStartDate: "", |
| | | planEndDate: "", |
| | | responsiblePerson: "", |
| | | experimentStatus: "planned", |
| | | experimentPurpose: "", |
| | | experimentProcess: "", |
| | | experimentResult: "", |
| | | maintainer: "", |
| | | maintenanceTime: "", |
| | | }, |
| | | rules: { |
| | | experimentCode: [{ required: true, message: "请è¾å
¥", trigger: "blur" }], |
| | | experimentName: [{ required: true, message: "请è¾å
¥", trigger: "blur" }], |
| | | experimentType: [{ required: true, message: "è¯·éæ©", trigger: "change" }], |
| | | experimentStandard: [{ required: true, message: "请è¾å
¥", trigger: "blur" }], |
| | | planStartDate: [{ required: true, message: "è¯·éæ©", trigger: "change" }], |
| | | planEndDate: [{ required: true, message: "è¯·éæ©", trigger: "change" }], |
| | | responsiblePerson: [{ required: true, message: "请è¾å
¥", trigger: "blur" }], |
| | | experimentStatus: [{ required: true, message: "è¯·éæ©", trigger: "change" }], |
| | | maintainer: [{ required: false, message: "è¯·éæ©", trigger: "change" }], |
| | | maintenanceTime: [ |
| | | { required: false, message: "è¯·éæ©", trigger: "change" }, |
| | | ], |
| | | }, |
| | | }); |
| | | const { searchForm, form, rules } = toRefs(data); |
| | | |
| | | // æ¥è¯¢å表 |
| | | /** æç´¢æé®æä½ */ |
| | | const handleQuery = () => { |
| | | page.current = 1; |
| | | getList(); |
| | | }; |
| | | const pagination = (obj) => { |
| | | page.current = obj.page; |
| | | page.size = obj.limit; |
| | | getList(); |
| | | }; |
| | | const getList = () => { |
| | | tableLoading.value = true; |
| | | listExperiment({ ...searchForm.value, ...page }).then((res) => { |
| | | tableLoading.value = false; |
| | | tableData.value = res.data.records; |
| | | page.total = res.data.total; |
| | | }); |
| | | }; |
| | | // è¡¨æ ¼éæ©æ°æ® |
| | | const handleSelectionChange = (selection) => { |
| | | selectedRows.value = selection; |
| | | }; |
| | | // æå¼å¼¹æ¡ |
| | | const openForm = (type, row) => { |
| | | operationType.value = type; |
| | | form.value = {}; |
| | | form.value.maintainer = userStore.nickName; |
| | | form.value.experimentStatus = "planned"; |
| | | form.value.maintenanceTime = getCurrentDate(); |
| | | userListNoPage().then((res) => { |
| | | userList.value = res.data; |
| | | }); |
| | | if (type === "edit") { |
| | | getExperiment(row.id).then((res) => { |
| | | form.value = { ...res.data }; |
| | | }); |
| | | } |
| | | dialogFormVisible.value = true; |
| | | }; |
| | | // æäº¤è¡¨å |
| | | const submitForm = () => { |
| | | proxy.$refs["formRef"].validate((valid) => { |
| | | if (valid) { |
| | | if (operationType.value === "edit") { |
| | | submitEdit(); |
| | | } else { |
| | | submitAdd(); |
| | | } |
| | | } |
| | | }); |
| | | }; |
| | | // æäº¤æ°å¢ |
| | | const submitAdd = () => { |
| | | addExperiment(form.value).then((res) => { |
| | | proxy.$modal.msgSuccess("æäº¤æå"); |
| | | closeDia(); |
| | | getList(); |
| | | }); |
| | | }; |
| | | // æäº¤ä¿®æ¹ |
| | | const submitEdit = () => { |
| | | updateExperiment(form.value).then((res) => { |
| | | proxy.$modal.msgSuccess("æäº¤æå"); |
| | | closeDia(); |
| | | getList(); |
| | | }); |
| | | }; |
| | | // å
³éå¼¹æ¡ |
| | | const closeDia = () => { |
| | | proxy.resetForm("formRef"); |
| | | dialogFormVisible.value = false; |
| | | }; |
| | | // å¯¼åº |
| | | const handleOut = () => { |
| | | ElMessageBox.confirm("éä¸çå
容å°è¢«å¯¼åºï¼æ¯å¦ç¡®è®¤å¯¼åºï¼", "导åº", { |
| | | confirmButtonText: "确认", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning", |
| | | }) |
| | | .then(() => { |
| | | proxy.download("/lims/experiment/export", {}, "å®éªç®¡ç.xlsx"); |
| | | }) |
| | | .catch(() => { |
| | | proxy.$modal.msg("已忶"); |
| | | }); |
| | | }; |
| | | // å é¤ |
| | | const handleDelete = () => { |
| | | let ids = []; |
| | | if (selectedRows.value.length > 0) { |
| | | // æ£æ¥æ¯å¦æä»äººç»´æ¤çæ°æ® |
| | | const unauthorizedData = selectedRows.value.filter(item => item.maintainer !== userStore.nickName); |
| | | if (unauthorizedData.length > 0) { |
| | | proxy.$modal.msgWarning("ä¸å¯å é¤ä»äººç»´æ¤çæ°æ®"); |
| | | return; |
| | | } |
| | | ids = selectedRows.value.map((item) => item.id); |
| | | } else { |
| | | proxy.$modal.msgWarning("è¯·éæ©æ°æ®"); |
| | | return; |
| | | } |
| | | ElMessageBox.confirm("éä¸çå
容å°è¢«å é¤ï¼æ¯å¦ç¡®è®¤å é¤ï¼", "å é¤æç¤º", { |
| | | confirmButtonText: "确认", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning", |
| | | }) |
| | | .then(() => { |
| | | tableLoading.value = true; |
| | | delExperiment(ids) |
| | | .then((res) => { |
| | | proxy.$modal.msgSuccess("å 餿å"); |
| | | getList(); |
| | | }) |
| | | .finally(() => { |
| | | tableLoading.value = false; |
| | | }); |
| | | }) |
| | | .catch(() => { |
| | | proxy.$modal.msg("已忶"); |
| | | }); |
| | | }; |
| | | |
| | | // è·åå½åæ¥æå¹¶æ ¼å¼å为 YYYY-MM-DD |
| | | function getCurrentDate() { |
| | | const today = new Date(); |
| | | const year = today.getFullYear(); |
| | | const month = String(today.getMonth() + 1).padStart(2, "0"); |
| | | const day = String(today.getDate()).padStart(2, "0"); |
| | | return `${year}-${month}-${day}`; |
| | | } |
| | | |
| | | onMounted(() => { |
| | | getList(); |
| | | }); |
| | | </script> |
| | | |
| | | <style scoped lang="scss"></style> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <div class="search_form"> |
| | | <div> |
| | | <span class="search_title">çæ§ç¼å·ï¼</span> |
| | | <el-input |
| | | v-model="searchForm.monitorCode" |
| | | style="width: 200px" |
| | | placeholder="请è¾å
¥" |
| | | @change="handleQuery" |
| | | clearable |
| | | :prefix-icon="Search" |
| | | /> |
| | | <span class="search_title" style="margin-left: 20px">çæ§å¯¹è±¡ï¼</span> |
| | | <el-input |
| | | v-model="searchForm.monitorTarget" |
| | | style="width: 200px" |
| | | placeholder="请è¾å
¥" |
| | | @change="handleQuery" |
| | | clearable |
| | | /> |
| | | <span class="search_title" style="margin-left: 20px">é¢è¦ç¶æï¼</span> |
| | | <el-select |
| | | v-model="searchForm.alertStatus" |
| | | style="width: 150px" |
| | | placeholder="è¯·éæ©" |
| | | clearable |
| | | @change="handleQuery" |
| | | > |
| | | <el-option label="æ£å¸¸" value="normal" /> |
| | | <el-option label="é¢è¦" value="warning" /> |
| | | <el-option label="åè¦" value="alert" /> |
| | | <el-option label="å·²å¤ç" value="resolved" /> |
| | | </el-select> |
| | | <el-button type="primary" @click="handleQuery" style="margin-left: 10px" |
| | | >æç´¢</el-button |
| | | > |
| | | </div> |
| | | <div> |
| | | <el-button type="primary" @click="openForm('add')">æ°å¢çæ§</el-button> |
| | | <el-button @click="handleOut">导åº</el-button> |
| | | <el-button type="danger" plain @click="handleDelete">å é¤</el-button> |
| | | </div> |
| | | </div> |
| | | <div class="table_list"> |
| | | <PIMTable |
| | | rowKey="id" |
| | | :column="tableColumn" |
| | | :tableData="tableData" |
| | | :page="page" |
| | | :isSelection="true" |
| | | @selection-change="handleSelectionChange" |
| | | :tableLoading="tableLoading" |
| | | @pagination="pagination" |
| | | ></PIMTable> |
| | | </div> |
| | | <el-dialog |
| | | v-model="dialogFormVisible" |
| | | :title="operationType === 'add' ? 'æ°å¢å®æ¶çæ§' : 'ç¼è¾å®æ¶çæ§'" |
| | | width="70%" |
| | | @close="closeDia" |
| | | > |
| | | <el-form |
| | | :model="form" |
| | | label-width="140px" |
| | | label-position="top" |
| | | :rules="rules" |
| | | ref="formRef" |
| | | > |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="çæ§ç¼å·ï¼" prop="monitorCode"> |
| | | <el-input |
| | | v-model="form.monitorCode" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="çæ§å¯¹è±¡ï¼" prop="monitorTarget"> |
| | | <el-input |
| | | v-model="form.monitorTarget" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="çæ§ç±»åï¼" prop="monitorType"> |
| | | <el-select |
| | | v-model="form.monitorType" |
| | | placeholder="è¯·éæ©" |
| | | clearable |
| | | style="width: 100%" |
| | | > |
| | | <el-option label="æ¸©åº¦çæ§" value="temperature" /> |
| | | <el-option label="æ¹¿åº¦çæ§" value="humidity" /> |
| | | <el-option label="ååçæ§" value="pressure" /> |
| | | <el-option label="设å¤ç¶æ" value="equipment" /> |
| | | <el-option label="å®éªè¿ç¨" value="experiment" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="çæ§ææ ï¼" prop="monitorIndicator"> |
| | | <el-input |
| | | v-model="form.monitorIndicator" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="å½åæ°å¼ï¼" prop="currentValue"> |
| | | <el-input |
| | | v-model="form.currentValue" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="计éåä½ï¼" prop="unit"> |
| | | <el-select |
| | | v-model="form.unit" |
| | | placeholder="è¯·éæ©" |
| | | clearable |
| | | style="width: 100%" |
| | | > |
| | | <el-option label="ææ°åº¦(°C)" value="celsius" /> |
| | | <el-option label="ç¾åæ¯(%)" value="percent" /> |
| | | <el-option label="叿¯å¡(Pa)" value="pa" /> |
| | | <el-option label="转/åé(rpm)" value="rpm" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="ä¸ééå¼ï¼" prop="upperLimit"> |
| | | <el-input |
| | | v-model="form.upperLimit" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="ä¸ééå¼ï¼" prop="lowerLimit"> |
| | | <el-input |
| | | v-model="form.lowerLimit" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="é¢è¦ç¶æï¼" prop="alertStatus"> |
| | | <el-select |
| | | v-model="form.alertStatus" |
| | | placeholder="è¯·éæ©" |
| | | clearable |
| | | style="width: 100%" |
| | | > |
| | | <el-option label="æ£å¸¸" value="normal" /> |
| | | <el-option label="é¢è¦" value="warning" /> |
| | | <el-option label="åè¦" value="alert" /> |
| | | <el-option label="å·²å¤ç" value="resolved" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="é¢è¦çº§å«ï¼" prop="alertLevel"> |
| | | <el-select |
| | | v-model="form.alertLevel" |
| | | placeholder="è¯·éæ©" |
| | | clearable |
| | | style="width: 100%" |
| | | > |
| | | <el-option label="ä¸è¬" value="low" /> |
| | | <el-option label="éè¦" value="medium" /> |
| | | <el-option label="ç´§æ¥" value="high" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="çæ§æ¶é´ï¼" prop="monitorTime"> |
| | | <el-date-picker |
| | | style="width: 100%" |
| | | v-model="form.monitorTime" |
| | | value-format="YYYY-MM-DD HH:mm:ss" |
| | | format="YYYY-MM-DD HH:mm:ss" |
| | | type="datetime" |
| | | placeholder="è¯·éæ©" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="å¤ç人ï¼" prop="handler"> |
| | | <el-input |
| | | v-model="form.handler" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="24"> |
| | | <el-form-item label="é¢è¦æè¿°ï¼" prop="alertDescription"> |
| | | <el-input |
| | | v-model="form.alertDescription" |
| | | type="textarea" |
| | | :rows="3" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="24"> |
| | | <el-form-item label="å¤çæªæ½ï¼" prop="handleMeasure"> |
| | | <el-input |
| | | v-model="form.handleMeasure" |
| | | type="textarea" |
| | | :rows="3" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="24"> |
| | | <el-form-item label="夿³¨ï¼" prop="remark"> |
| | | <el-input |
| | | v-model="form.remark" |
| | | type="textarea" |
| | | :rows="2" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="ç»´æ¤äººï¼" prop="maintainer"> |
| | | <el-select |
| | | v-model="form.maintainer" |
| | | placeholder="è¯·éæ©" |
| | | clearable |
| | | disabled |
| | | > |
| | | <el-option |
| | | v-for="item in userList" |
| | | :key="item.nickName" |
| | | :label="item.nickName" |
| | | :value="item.nickName" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="ç»´æ¤æ¶é´ï¼" prop="maintenanceTime"> |
| | | <el-date-picker |
| | | style="width: 100%" |
| | | v-model="form.maintenanceTime" |
| | | value-format="YYYY-MM-DD" |
| | | format="YYYY-MM-DD" |
| | | type="date" |
| | | placeholder="è¯·éæ©" |
| | | clearable |
| | | disabled |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | </el-form> |
| | | <template #footer> |
| | | <div class="dialog-footer"> |
| | | <el-button type="primary" @click="submitForm">确认</el-button> |
| | | <el-button @click="closeDia">åæ¶</el-button> |
| | | </div> |
| | | </template> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { onMounted, ref, reactive } from "vue"; |
| | | import { Search } from "@element-plus/icons-vue"; |
| | | import { |
| | | addRealtimeMonitor, |
| | | delRealtimeMonitor, |
| | | getRealtimeMonitor, |
| | | listRealtimeMonitor, |
| | | updateRealtimeMonitor, |
| | | } from "@/api/lims/realtimeMonitor.js"; |
| | | import { ElMessageBox } from "element-plus"; |
| | | import { userListNoPage } from "@/api/system/user.js"; |
| | | import useUserStore from "@/store/modules/user"; |
| | | const { proxy } = getCurrentInstance(); |
| | | const userStore = useUserStore(); |
| | | |
| | | const tableColumn = ref([ |
| | | { |
| | | label: "çæ§ç¼å·", |
| | | prop: "monitorCode", |
| | | width: 150, |
| | | }, |
| | | { |
| | | label: "çæ§å¯¹è±¡", |
| | | prop: "monitorTarget", |
| | | width: 180, |
| | | }, |
| | | { |
| | | label: "çæ§ç±»å", |
| | | prop: "monitorType", |
| | | width: 120, |
| | | }, |
| | | { |
| | | label: "çæ§ææ ", |
| | | prop: "monitorIndicator", |
| | | width: 150, |
| | | }, |
| | | { |
| | | label: "å½åæ°å¼", |
| | | prop: "currentValue", |
| | | width: 100, |
| | | }, |
| | | { |
| | | label: "åä½", |
| | | prop: "unit", |
| | | width: 80, |
| | | }, |
| | | { |
| | | label: "ä¸ééå¼", |
| | | prop: "upperLimit", |
| | | width: 100, |
| | | }, |
| | | { |
| | | label: "ä¸ééå¼", |
| | | prop: "lowerLimit", |
| | | width: 100, |
| | | }, |
| | | { |
| | | label: "é¢è¦ç¶æ", |
| | | prop: "alertStatus", |
| | | width: 100, |
| | | }, |
| | | { |
| | | label: "é¢è¦çº§å«", |
| | | prop: "alertLevel", |
| | | width: 100, |
| | | }, |
| | | { |
| | | label: "çæ§æ¶é´", |
| | | prop: "monitorTime", |
| | | width: 180, |
| | | }, |
| | | { |
| | | label: "ç»´æ¤äºº", |
| | | prop: "maintainer", |
| | | }, |
| | | { |
| | | label: "ç»´æ¤æ¶é´", |
| | | prop: "maintenanceTime", |
| | | width: 100, |
| | | }, |
| | | { |
| | | dataType: "action", |
| | | label: "æä½", |
| | | align: "center", |
| | | fixed: 'right', |
| | | operation: [ |
| | | { |
| | | name: "ç¼è¾", |
| | | type: "text", |
| | | clickFun: (row) => { |
| | | openForm("edit", row); |
| | | }, |
| | | disabled: (row) => { |
| | | return row.maintainer !== userStore.nickName |
| | | } |
| | | }, |
| | | ], |
| | | }, |
| | | ]); |
| | | const tableData = ref([]); |
| | | const selectedRows = ref([]); |
| | | const userList = ref([]); |
| | | const tableLoading = ref(false); |
| | | const page = reactive({ |
| | | current: 1, |
| | | size: 100, |
| | | total: 0, |
| | | }); |
| | | |
| | | const operationType = ref(""); |
| | | const dialogFormVisible = ref(false); |
| | | const data = reactive({ |
| | | searchForm: { |
| | | monitorCode: "", |
| | | monitorTarget: "", |
| | | alertStatus: "", |
| | | }, |
| | | form: { |
| | | monitorCode: "", |
| | | monitorTarget: "", |
| | | monitorType: "", |
| | | monitorIndicator: "", |
| | | currentValue: "", |
| | | unit: "", |
| | | upperLimit: "", |
| | | lowerLimit: "", |
| | | alertStatus: "normal", |
| | | alertLevel: "", |
| | | monitorTime: "", |
| | | alertDescription: "", |
| | | handler: "", |
| | | handleMeasure: "", |
| | | remark: "", |
| | | maintainer: "", |
| | | maintenanceTime: "", |
| | | }, |
| | | rules: { |
| | | monitorCode: [{ required: true, message: "请è¾å
¥", trigger: "blur" }], |
| | | monitorTarget: [{ required: true, message: "请è¾å
¥", trigger: "blur" }], |
| | | monitorType: [{ required: true, message: "è¯·éæ©", trigger: "change" }], |
| | | monitorIndicator: [{ required: true, message: "请è¾å
¥", trigger: "blur" }], |
| | | currentValue: [{ required: true, message: "请è¾å
¥", trigger: "blur" }], |
| | | unit: [{ required: true, message: "è¯·éæ©", trigger: "change" }], |
| | | upperLimit: [{ required: true, message: "请è¾å
¥", trigger: "blur" }], |
| | | lowerLimit: [{ required: true, message: "请è¾å
¥", trigger: "blur" }], |
| | | alertStatus: [{ required: true, message: "è¯·éæ©", trigger: "change" }], |
| | | monitorTime: [{ required: true, message: "è¯·éæ©", trigger: "change" }], |
| | | maintainer: [{ required: false, message: "è¯·éæ©", trigger: "change" }], |
| | | maintenanceTime: [ |
| | | { required: false, message: "è¯·éæ©", trigger: "change" }, |
| | | ], |
| | | }, |
| | | }); |
| | | const { searchForm, form, rules } = toRefs(data); |
| | | |
| | | const handleQuery = () => { |
| | | page.current = 1; |
| | | getList(); |
| | | }; |
| | | const pagination = (obj) => { |
| | | page.current = obj.page; |
| | | page.size = obj.limit; |
| | | getList(); |
| | | }; |
| | | const getList = () => { |
| | | tableLoading.value = true; |
| | | listRealtimeMonitor({ ...searchForm.value, ...page }).then((res) => { |
| | | tableLoading.value = false; |
| | | tableData.value = res.data.records; |
| | | page.total = res.data.total; |
| | | }); |
| | | }; |
| | | const handleSelectionChange = (selection) => { |
| | | selectedRows.value = selection; |
| | | }; |
| | | const openForm = (type, row) => { |
| | | operationType.value = type; |
| | | form.value = {}; |
| | | form.value.maintainer = userStore.nickName; |
| | | form.value.alertStatus = "normal"; |
| | | form.value.maintenanceTime = getCurrentDate(); |
| | | userListNoPage().then((res) => { |
| | | userList.value = res.data; |
| | | }); |
| | | if (type === "edit") { |
| | | getRealtimeMonitor(row.id).then((res) => { |
| | | form.value = { ...res.data }; |
| | | }); |
| | | } |
| | | dialogFormVisible.value = true; |
| | | }; |
| | | const submitForm = () => { |
| | | proxy.$refs["formRef"].validate((valid) => { |
| | | if (valid) { |
| | | if (operationType.value === "edit") { |
| | | submitEdit(); |
| | | } else { |
| | | submitAdd(); |
| | | } |
| | | } |
| | | }); |
| | | }; |
| | | const submitAdd = () => { |
| | | addRealtimeMonitor(form.value).then((res) => { |
| | | proxy.$modal.msgSuccess("æäº¤æå"); |
| | | closeDia(); |
| | | getList(); |
| | | }); |
| | | }; |
| | | const submitEdit = () => { |
| | | updateRealtimeMonitor(form.value).then((res) => { |
| | | proxy.$modal.msgSuccess("æäº¤æå"); |
| | | closeDia(); |
| | | getList(); |
| | | }); |
| | | }; |
| | | const closeDia = () => { |
| | | proxy.resetForm("formRef"); |
| | | dialogFormVisible.value = false; |
| | | }; |
| | | const handleOut = () => { |
| | | ElMessageBox.confirm("éä¸çå
容å°è¢«å¯¼åºï¼æ¯å¦ç¡®è®¤å¯¼åºï¼", "导åº", { |
| | | confirmButtonText: "确认", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning", |
| | | }) |
| | | .then(() => { |
| | | proxy.download("/lims/realtimeMonitor/export", {}, "宿¶çæ§ä¸é¢è¦.xlsx"); |
| | | }) |
| | | .catch(() => { |
| | | proxy.$modal.msg("已忶"); |
| | | }); |
| | | }; |
| | | const handleDelete = () => { |
| | | let ids = []; |
| | | if (selectedRows.value.length > 0) { |
| | | const unauthorizedData = selectedRows.value.filter(item => item.maintainer !== userStore.nickName); |
| | | if (unauthorizedData.length > 0) { |
| | | proxy.$modal.msgWarning("ä¸å¯å é¤ä»äººç»´æ¤çæ°æ®"); |
| | | return; |
| | | } |
| | | ids = selectedRows.value.map((item) => item.id); |
| | | } else { |
| | | proxy.$modal.msgWarning("è¯·éæ©æ°æ®"); |
| | | return; |
| | | } |
| | | ElMessageBox.confirm("éä¸çå
容å°è¢«å é¤ï¼æ¯å¦ç¡®è®¤å é¤ï¼", "å é¤æç¤º", { |
| | | confirmButtonText: "确认", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning", |
| | | }) |
| | | .then(() => { |
| | | tableLoading.value = true; |
| | | delRealtimeMonitor(ids) |
| | | .then((res) => { |
| | | proxy.$modal.msgSuccess("å 餿å"); |
| | | getList(); |
| | | }) |
| | | .finally(() => { |
| | | tableLoading.value = false; |
| | | }); |
| | | }) |
| | | .catch(() => { |
| | | proxy.$modal.msg("已忶"); |
| | | }); |
| | | }; |
| | | |
| | | function getCurrentDate() { |
| | | const today = new Date(); |
| | | const year = today.getFullYear(); |
| | | const month = String(today.getMonth() + 1).padStart(2, "0"); |
| | | const day = String(today.getDate()).padStart(2, "0"); |
| | | return `${year}-${month}-${day}`; |
| | | } |
| | | |
| | | onMounted(() => { |
| | | getList(); |
| | | }); |
| | | </script> |
| | | |
| | | <style scoped lang="scss"></style> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <div class="search_form"> |
| | | <div> |
| | | <span class="search_title">æ ·åç¼å·ï¼</span> |
| | | <el-input |
| | | v-model="searchForm.sampleCode" |
| | | style="width: 200px" |
| | | placeholder="请è¾å
¥" |
| | | @change="handleQuery" |
| | | clearable |
| | | :prefix-icon="Search" |
| | | /> |
| | | <span class="search_title" style="margin-left: 20px">æ ·ååç§°ï¼</span> |
| | | <el-input |
| | | v-model="searchForm.sampleName" |
| | | style="width: 200px" |
| | | placeholder="请è¾å
¥" |
| | | @change="handleQuery" |
| | | clearable |
| | | /> |
| | | <span class="search_title" style="margin-left: 20px">æ ·åç¶æï¼</span> |
| | | <el-select |
| | | v-model="searchForm.sampleStatus" |
| | | style="width: 150px" |
| | | placeholder="è¯·éæ©" |
| | | clearable |
| | | @change="handleQuery" |
| | | > |
| | | <el-option label="å¨åº" value="inStock" /> |
| | | <el-option label="åºåº" value="outStock" /> |
| | | <el-option label="æ£æµä¸" value="testing" /> |
| | | <el-option label="已鿝" value="destroyed" /> |
| | | </el-select> |
| | | <el-button type="primary" @click="handleQuery" style="margin-left: 10px" |
| | | >æç´¢</el-button |
| | | > |
| | | </div> |
| | | <div> |
| | | <el-button type="primary" @click="openForm('add')">æ°å¢æ ·å</el-button> |
| | | <el-button @click="handleOut">导åº</el-button> |
| | | <el-button type="danger" plain @click="handleDelete">å é¤</el-button> |
| | | </div> |
| | | </div> |
| | | <div class="table_list"> |
| | | <PIMTable |
| | | rowKey="id" |
| | | :column="tableColumn" |
| | | :tableData="tableData" |
| | | :page="page" |
| | | :isSelection="true" |
| | | @selection-change="handleSelectionChange" |
| | | :tableLoading="tableLoading" |
| | | @pagination="pagination" |
| | | ></PIMTable> |
| | | </div> |
| | | <el-dialog |
| | | v-model="dialogFormVisible" |
| | | :title="operationType === 'add' ? 'æ°å¢æ ·å' : 'ç¼è¾æ ·å'" |
| | | width="70%" |
| | | @close="closeDia" |
| | | > |
| | | <el-form |
| | | :model="form" |
| | | label-width="140px" |
| | | label-position="top" |
| | | :rules="rules" |
| | | ref="formRef" |
| | | > |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="æ ·åç¼å·ï¼" prop="sampleCode"> |
| | | <el-input |
| | | v-model="form.sampleCode" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="æ ·ååç§°ï¼" prop="sampleName"> |
| | | <el-input |
| | | v-model="form.sampleName" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="æ ·åç±»åï¼" prop="sampleType"> |
| | | <el-select |
| | | v-model="form.sampleType" |
| | | placeholder="è¯·éæ©" |
| | | clearable |
| | | style="width: 100%" |
| | | > |
| | | <el-option label="åæ" value="rawMaterial" /> |
| | | <el-option label="åæå" value="semiFinished" /> |
| | | <el-option label="æå" value="finishedProduct" /> |
| | | <el-option label="çæ ·" value="retainedSample" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="æ ·åè§æ ¼ï¼" prop="specification"> |
| | | <el-input |
| | | v-model="form.specification" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="å
¥åºæ¥æï¼" prop="inStockDate"> |
| | | <el-date-picker |
| | | style="width: 100%" |
| | | v-model="form.inStockDate" |
| | | value-format="YYYY-MM-DD" |
| | | format="YYYY-MM-DD" |
| | | type="date" |
| | | placeholder="è¯·éæ©" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="åå¨ä½ç½®ï¼" prop="storageLocation"> |
| | | <el-input |
| | | v-model="form.storageLocation" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="æ ·åæ°éï¼" prop="quantity"> |
| | | <el-input |
| | | v-model="form.quantity" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="计éåä½ï¼" prop="unit"> |
| | | <el-select |
| | | v-model="form.unit" |
| | | placeholder="è¯·éæ©" |
| | | clearable |
| | | style="width: 100%" |
| | | > |
| | | <el-option label="å
(g)" value="g" /> |
| | | <el-option label="åå
(kg)" value="kg" /> |
| | | <el-option label="毫å(ml)" value="ml" /> |
| | | <el-option label="å(L)" value="L" /> |
| | | <el-option label="个" value="piece" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="æ ·åç¶æï¼" prop="sampleStatus"> |
| | | <el-select |
| | | v-model="form.sampleStatus" |
| | | placeholder="è¯·éæ©" |
| | | clearable |
| | | style="width: 100%" |
| | | > |
| | | <el-option label="å¨åº" value="inStock" /> |
| | | <el-option label="åºåº" value="outStock" /> |
| | | <el-option label="æ£æµä¸" value="testing" /> |
| | | <el-option label="已鿝" value="destroyed" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="æææè³ï¼" prop="validityDate"> |
| | | <el-date-picker |
| | | style="width: 100%" |
| | | v-model="form.validityDate" |
| | | value-format="YYYY-MM-DD" |
| | | format="YYYY-MM-DD" |
| | | type="date" |
| | | placeholder="è¯·éæ©" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="24"> |
| | | <el-form-item label="夿³¨ï¼" prop="remark"> |
| | | <el-input |
| | | v-model="form.remark" |
| | | type="textarea" |
| | | :rows="3" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="ç»´æ¤äººï¼" prop="maintainer"> |
| | | <el-select |
| | | v-model="form.maintainer" |
| | | placeholder="è¯·éæ©" |
| | | clearable |
| | | disabled |
| | | > |
| | | <el-option |
| | | v-for="item in userList" |
| | | :key="item.nickName" |
| | | :label="item.nickName" |
| | | :value="item.nickName" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="ç»´æ¤æ¶é´ï¼" prop="maintenanceTime"> |
| | | <el-date-picker |
| | | style="width: 100%" |
| | | v-model="form.maintenanceTime" |
| | | value-format="YYYY-MM-DD" |
| | | format="YYYY-MM-DD" |
| | | type="date" |
| | | placeholder="è¯·éæ©" |
| | | clearable |
| | | disabled |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | </el-form> |
| | | <template #footer> |
| | | <div class="dialog-footer"> |
| | | <el-button type="primary" @click="submitForm">确认</el-button> |
| | | <el-button @click="closeDia">åæ¶</el-button> |
| | | </div> |
| | | </template> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { onMounted, ref, reactive } from "vue"; |
| | | import { Search } from "@element-plus/icons-vue"; |
| | | import { |
| | | addSample, |
| | | delSample, |
| | | getSample, |
| | | listSample, |
| | | updateSample, |
| | | } from "@/api/lims/sample.js"; |
| | | import { ElMessageBox } from "element-plus"; |
| | | import { userListNoPage } from "@/api/system/user.js"; |
| | | import useUserStore from "@/store/modules/user"; |
| | | const { proxy } = getCurrentInstance(); |
| | | const userStore = useUserStore(); |
| | | |
| | | const tableColumn = ref([ |
| | | { |
| | | label: "æ ·åç¼å·", |
| | | prop: "sampleCode", |
| | | width: 150, |
| | | }, |
| | | { |
| | | label: "æ ·ååç§°", |
| | | prop: "sampleName", |
| | | width: 180, |
| | | }, |
| | | { |
| | | label: "æ ·åç±»å", |
| | | prop: "sampleType", |
| | | width: 120, |
| | | }, |
| | | { |
| | | label: "æ ·åè§æ ¼", |
| | | prop: "specification", |
| | | width: 150, |
| | | }, |
| | | { |
| | | label: "å
¥åºæ¥æ", |
| | | prop: "inStockDate", |
| | | width: 120, |
| | | }, |
| | | { |
| | | label: "åå¨ä½ç½®", |
| | | prop: "storageLocation", |
| | | width: 150, |
| | | }, |
| | | { |
| | | label: "æ°é", |
| | | prop: "quantity", |
| | | width: 100, |
| | | }, |
| | | { |
| | | label: "åä½", |
| | | prop: "unit", |
| | | width: 80, |
| | | }, |
| | | { |
| | | label: "æ ·åç¶æ", |
| | | prop: "sampleStatus", |
| | | width: 100, |
| | | }, |
| | | { |
| | | label: "æææè³", |
| | | prop: "validityDate", |
| | | width: 120, |
| | | }, |
| | | { |
| | | label: "ç»´æ¤äºº", |
| | | prop: "maintainer", |
| | | }, |
| | | { |
| | | label: "ç»´æ¤æ¶é´", |
| | | prop: "maintenanceTime", |
| | | width: 100, |
| | | }, |
| | | { |
| | | dataType: "action", |
| | | label: "æä½", |
| | | align: "center", |
| | | fixed: 'right', |
| | | operation: [ |
| | | { |
| | | name: "ç¼è¾", |
| | | type: "text", |
| | | clickFun: (row) => { |
| | | openForm("edit", row); |
| | | }, |
| | | disabled: (row) => { |
| | | return row.maintainer !== userStore.nickName |
| | | } |
| | | }, |
| | | ], |
| | | }, |
| | | ]); |
| | | const tableData = ref([]); |
| | | const selectedRows = ref([]); |
| | | const userList = ref([]); |
| | | const tableLoading = ref(false); |
| | | const page = reactive({ |
| | | current: 1, |
| | | size: 100, |
| | | total: 0, |
| | | }); |
| | | |
| | | // æ ·å表åå¼¹æ¡æ°æ® |
| | | const operationType = ref(""); |
| | | const dialogFormVisible = ref(false); |
| | | const data = reactive({ |
| | | searchForm: { |
| | | sampleCode: "", |
| | | sampleName: "", |
| | | sampleStatus: "", |
| | | }, |
| | | form: { |
| | | sampleCode: "", |
| | | sampleName: "", |
| | | sampleType: "", |
| | | specification: "", |
| | | inStockDate: "", |
| | | storageLocation: "", |
| | | quantity: "", |
| | | unit: "", |
| | | sampleStatus: "inStock", |
| | | validityDate: "", |
| | | remark: "", |
| | | maintainer: "", |
| | | maintenanceTime: "", |
| | | }, |
| | | rules: { |
| | | sampleCode: [{ required: true, message: "请è¾å
¥", trigger: "blur" }], |
| | | sampleName: [{ required: true, message: "请è¾å
¥", trigger: "blur" }], |
| | | sampleType: [{ required: true, message: "è¯·éæ©", trigger: "change" }], |
| | | specification: [{ required: true, message: "请è¾å
¥", trigger: "blur" }], |
| | | inStockDate: [{ required: true, message: "è¯·éæ©", trigger: "change" }], |
| | | storageLocation: [{ required: true, message: "请è¾å
¥", trigger: "blur" }], |
| | | quantity: [{ required: true, message: "请è¾å
¥", trigger: "blur" }], |
| | | unit: [{ required: true, message: "è¯·éæ©", trigger: "change" }], |
| | | sampleStatus: [{ required: true, message: "è¯·éæ©", trigger: "change" }], |
| | | validityDate: [{ required: true, message: "è¯·éæ©", trigger: "change" }], |
| | | maintainer: [{ required: false, message: "è¯·éæ©", trigger: "change" }], |
| | | maintenanceTime: [ |
| | | { required: false, message: "è¯·éæ©", trigger: "change" }, |
| | | ], |
| | | }, |
| | | }); |
| | | const { searchForm, form, rules } = toRefs(data); |
| | | |
| | | // æ¥è¯¢å表 |
| | | /** æç´¢æé®æä½ */ |
| | | const handleQuery = () => { |
| | | page.current = 1; |
| | | getList(); |
| | | }; |
| | | const pagination = (obj) => { |
| | | page.current = obj.page; |
| | | page.size = obj.limit; |
| | | getList(); |
| | | }; |
| | | const getList = () => { |
| | | tableLoading.value = true; |
| | | listSample({ ...searchForm.value, ...page }).then((res) => { |
| | | tableLoading.value = false; |
| | | tableData.value = res.data.records; |
| | | page.total = res.data.total; |
| | | }); |
| | | }; |
| | | // è¡¨æ ¼éæ©æ°æ® |
| | | const handleSelectionChange = (selection) => { |
| | | selectedRows.value = selection; |
| | | }; |
| | | // æå¼å¼¹æ¡ |
| | | const openForm = (type, row) => { |
| | | operationType.value = type; |
| | | form.value = {}; |
| | | form.value.maintainer = userStore.nickName; |
| | | form.value.sampleStatus = "inStock"; |
| | | form.value.maintenanceTime = getCurrentDate(); |
| | | userListNoPage().then((res) => { |
| | | userList.value = res.data; |
| | | }); |
| | | if (type === "edit") { |
| | | getSample(row.id).then((res) => { |
| | | form.value = { ...res.data }; |
| | | }); |
| | | } |
| | | dialogFormVisible.value = true; |
| | | }; |
| | | // æäº¤è¡¨å |
| | | const submitForm = () => { |
| | | proxy.$refs["formRef"].validate((valid) => { |
| | | if (valid) { |
| | | if (operationType.value === "edit") { |
| | | submitEdit(); |
| | | } else { |
| | | submitAdd(); |
| | | } |
| | | } |
| | | }); |
| | | }; |
| | | // æäº¤æ°å¢ |
| | | const submitAdd = () => { |
| | | addSample(form.value).then((res) => { |
| | | proxy.$modal.msgSuccess("æäº¤æå"); |
| | | closeDia(); |
| | | getList(); |
| | | }); |
| | | }; |
| | | // æäº¤ä¿®æ¹ |
| | | const submitEdit = () => { |
| | | updateSample(form.value).then((res) => { |
| | | proxy.$modal.msgSuccess("æäº¤æå"); |
| | | closeDia(); |
| | | getList(); |
| | | }); |
| | | }; |
| | | // å
³éå¼¹æ¡ |
| | | const closeDia = () => { |
| | | proxy.resetForm("formRef"); |
| | | dialogFormVisible.value = false; |
| | | }; |
| | | // å¯¼åº |
| | | const handleOut = () => { |
| | | ElMessageBox.confirm("éä¸çå
容å°è¢«å¯¼åºï¼æ¯å¦ç¡®è®¤å¯¼åºï¼", "导åº", { |
| | | confirmButtonText: "确认", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning", |
| | | }) |
| | | .then(() => { |
| | | proxy.download("/lims/sample/export", {}, "æ ·å管ç.xlsx"); |
| | | }) |
| | | .catch(() => { |
| | | proxy.$modal.msg("已忶"); |
| | | }); |
| | | }; |
| | | // å é¤ |
| | | const handleDelete = () => { |
| | | let ids = []; |
| | | if (selectedRows.value.length > 0) { |
| | | // æ£æ¥æ¯å¦æä»äººç»´æ¤çæ°æ® |
| | | const unauthorizedData = selectedRows.value.filter(item => item.maintainer !== userStore.nickName); |
| | | if (unauthorizedData.length > 0) { |
| | | proxy.$modal.msgWarning("ä¸å¯å é¤ä»äººç»´æ¤çæ°æ®"); |
| | | return; |
| | | } |
| | | ids = selectedRows.value.map((item) => item.id); |
| | | } else { |
| | | proxy.$modal.msgWarning("è¯·éæ©æ°æ®"); |
| | | return; |
| | | } |
| | | ElMessageBox.confirm("éä¸çå
容å°è¢«å é¤ï¼æ¯å¦ç¡®è®¤å é¤ï¼", "å é¤æç¤º", { |
| | | confirmButtonText: "确认", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning", |
| | | }) |
| | | .then(() => { |
| | | tableLoading.value = true; |
| | | delSample(ids) |
| | | .then((res) => { |
| | | proxy.$modal.msgSuccess("å 餿å"); |
| | | getList(); |
| | | }) |
| | | .finally(() => { |
| | | tableLoading.value = false; |
| | | }); |
| | | }) |
| | | .catch(() => { |
| | | proxy.$modal.msg("已忶"); |
| | | }); |
| | | }; |
| | | |
| | | // è·åå½åæ¥æå¹¶æ ¼å¼å为 YYYY-MM-DD |
| | | function getCurrentDate() { |
| | | const today = new Date(); |
| | | const year = today.getFullYear(); |
| | | const month = String(today.getMonth() + 1).padStart(2, "0"); |
| | | const day = String(today.getDate()).padStart(2, "0"); |
| | | return `${year}-${month}-${day}`; |
| | | } |
| | | |
| | | onMounted(() => { |
| | | getList(); |
| | | }); |
| | | </script> |
| | | |
| | | <style scoped lang="scss"></style> |