Merge branch 'dev' of http://114.132.189.42:9002/r/center-lims-before-ruoyi into dev
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import request from '@/utils/request' |
| | | |
| | | // è·åæ£éªé¡¹ç®åæ° |
| | | export function selectItemParameterList(query) { |
| | | return request({ |
| | | url: '/capacityScope/selectItemParameterList', |
| | | method: 'get', |
| | | params: query |
| | | }) |
| | | } |
| | | // è·åæ£æµå¯¹è±¡ |
| | | export function selectTestObjectList(query) { |
| | | return request({ |
| | | url: '/capacityScope/selectTestObjectList', |
| | | method: 'get', |
| | | params: query |
| | | }) |
| | | } |
| | | // æ°å¢æ£éªé¡¹ç®åæ° |
| | | export function addItemParameter(query) { |
| | | return request({ |
| | | url: '/capacityScope/addItemParameter', |
| | | method: 'post', |
| | | data: query |
| | | }) |
| | | } |
| | | // å 餿£éªé¡¹ç®åæ° |
| | | export function delItemParameter(query) { |
| | | return request({ |
| | | url: '/capacityScope/delItemParameter', |
| | | method: 'delete', |
| | | params: query |
| | | }) |
| | | } |
| | | // ä¿®æ¹æ£éªé¡¹ç®åæ° |
| | | export function upItemParameter(query) { |
| | | return request({ |
| | | url: '/capacityScope/upItemParameter', |
| | | method: 'post', |
| | | data: query |
| | | }) |
| | | } |
| | | // è·åæ£éªå¯¹è±¡æ |
| | | export function getItemTree() { |
| | | return request({ |
| | | url: '/capacityScope/getItemTree', |
| | | method: 'get' |
| | | }) |
| | | } |
| | | // æ°å¢æ£æµå¯¹è±¡ |
| | | export function addTestObject(query) { |
| | | return request({ |
| | | url: '/capacityScope/addTestObject', |
| | | method: 'post', |
| | | data: query |
| | | }) |
| | | } |
| | | // å 餿£æµå¯¹è±¡ |
| | | export function delTestObject(query) { |
| | | return request({ |
| | | url: '/capacityScope/delTestObject', |
| | | method: 'delete', |
| | | params: query |
| | | }) |
| | | } |
| | | // ä¿®æ¹æ£æµå¯¹è±¡ |
| | | export function upTestObject(query) { |
| | | return request({ |
| | | url: '/capacityScope/upTestObject', |
| | | method: 'post', |
| | | data: query |
| | | }) |
| | | } |
| | | // æ¥è¯¢æ£éªå¯¹è±¡ç产åç»´æ¤å表 |
| | | export function selectProductListByObjectId(query) { |
| | | return request({ |
| | | url: '/capacityScope/selectProductListByObjectId', |
| | | method: 'get', |
| | | params: query |
| | | }) |
| | | } |
| | | // æ°å¢äº§å |
| | | export function addProduct(query) { |
| | | return request({ |
| | | url: '/capacityScope/addProduct', |
| | | method: 'post', |
| | | data: query |
| | | }) |
| | | } |
| | | // å é¤äº§å |
| | | export function delProduct(query) { |
| | | return request({ |
| | | url: '/capacityScope/delProduct', |
| | | method: 'delete', |
| | | params: query |
| | | }) |
| | | } |
| | | // ä¿®æ¹äº§å |
| | | export function upProduct(query) { |
| | | return request({ |
| | | url: '/capacityScope/upProduct', |
| | | method: 'post', |
| | | data: query |
| | | }) |
| | | } |
| | | // è·åå®éªå®¤åç§° |
| | | export function obtainItemParameterList() { |
| | | return request({ |
| | | url: '/laboratoryScope/obtainItemParameterList', |
| | | method: 'get', |
| | | }) |
| | | } |
| | | // æ¥è¯¢åå§è®°å½æ¨¡æ¿æä¸¾ |
| | | export function getStandardTemplate() { |
| | | return request({ |
| | | url: '/StandardTemplate/getStandardTemplate', |
| | | method: 'get', |
| | | }) |
| | | } |
| | | // æ ¹æ®äº§åidæ¥è¯¢åå®¶å¯åº¦ç»å® |
| | | export function selectSupplierDensityByProductId(query) { |
| | | return request({ |
| | | url: '/productSupplierDensity/selectSupplierDensityByProductId', |
| | | method: 'get', |
| | | params: query |
| | | }) |
| | | } |
| | | // æ°å¢äº§ååå®¶å¯åº¦ç»å® |
| | | export function addProductSupplierDensity(query) { |
| | | return request({ |
| | | url: '/productSupplierDensity/addProductSupplierDensity', |
| | | method: 'post', |
| | | data: query |
| | | }) |
| | | } |
| | | // ä¿®æ¹äº§ååå®¶å¯åº¦ç»å® |
| | | export function updateProductSupplierDensity(query) { |
| | | return request({ |
| | | url: '/productSupplierDensity/updateProductSupplierDensity', |
| | | method: 'post', |
| | | data: query |
| | | }) |
| | | } |
| | | // å é¤äº§ååå®¶å¯åº¦ç»å® |
| | | export function deleteProductSupplierDensity(query) { |
| | | return request({ |
| | | url: '/productSupplierDensity/deleteProductSupplierDensity', |
| | | method: 'delete', |
| | | params: query |
| | | }) |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="capacity-scope"> |
| | | <div> |
| | | <el-row class="title"> |
| | | <el-col :span="12" style="text-align: left"> |
| | | <el-radio-group v-model="radio" size="medium" fill="#409EFF" @change="refreshTable"> |
| | | <el-radio-button :label="0">æ£éªé¡¹ç®åæ°</el-radio-button> |
| | | <el-radio-button :label="1">æ£éªå¯¹è±¡</el-radio-button> |
| | | </el-radio-group> |
| | | </el-col> |
| | | <el-col :span="12" style="text-align: right;"> |
| | | <el-upload v-if="radio === 0" ref='upload1' |
| | | style="display: inline;margin-right: 8px" |
| | | :action="uploadAction1" |
| | | :before-upload="beforeUpload1" :headers="token" :on-error="onError1" |
| | | :on-success="handleSuccessUp1" :show-file-list="false" accept='.doc,.docx,.xls,.xlsx'> |
| | | <el-button size="small" type="primary">导å
¥</el-button> |
| | | </el-upload> |
| | | <el-button size="small" type="primary" v-if="radio === 1" @click="uploadDia = true">导å
¥</el-button> |
| | | <el-button size="small" type="primary" @click="openAdd()">æ°å¢</el-button> |
| | | </el-col> |
| | | </el-row> |
| | | </div> |
| | | <div> |
| | | <el-form :model="itemParameterForm" ref="itemParameterForm" size="small" :inline="true"> |
| | | <el-form-item label="æ£éªé¡¹" prop="inspectionItem" v-if="radio===0"> |
| | | <el-input size="small" placeholder="请è¾å
¥" clearable |
| | | v-model="itemParameterForm.inspectionItem" @keyup.enter.native="refreshTable()"> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="æ£éªå项" prop="inspectionItemSubclass" v-if="radio===0"> |
| | | <el-input size="small" placeholder="请è¾å
¥" clearable |
| | | v-model="itemParameterForm.inspectionItemSubclass" @keyup.enter.native="refreshTable()"> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="æ£éªå¯¹è±¡" prop="specimenName"> |
| | | <el-input size="small" placeholder="请è¾å
¥" clearable |
| | | v-model="itemParameterForm.specimenName" @keyup.enter.native="refreshTable()"> |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" icon="el-icon-search" size="mini" @click="refreshTable">æ¥ è¯¢</el-button> |
| | | <el-button icon="el-icon-refresh" size="mini" @click="refresh">é ç½®</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | <!-- æ£éªé¡¹ç®åæ°è¡¨æ ¼--> |
| | | <div class="table" v-if="radio===0"> |
| | | <lims-table :tableData="tableData" :column="column" key="tableData" |
| | | @pagination="pagination" :height="'calc(100vh - 290px)'" |
| | | :page="page" :tableLoading="tableLoading"></lims-table> |
| | | </div> |
| | | <!-- æ£éªå¯¹è±¡è¡¨æ ¼--> |
| | | <div class="table" v-if="radio===1"> |
| | | <lims-table :tableData="testObjectTableData" :column="testObjectColumn" key="testObjectTableData" |
| | | @pagination="pagination" :height="'calc(100vh - 290px)'" |
| | | :page="testObjectPage" :tableLoading="tableLoading"></lims-table> |
| | | </div> |
| | | </div> |
| | | <!--产åç»´æ¤å¼¹æ¡--> |
| | | <el-dialog title="产åç»´æ¤" :visible.sync="diaProduct" width="900px"> |
| | | <lims-table :tableData="productData" :column="productColumn" height="460" |
| | | :page="productPage" :tableLoading="productableLoading"></lims-table> |
| | | <span slot="footer" class="dialog-footer"> |
| | | <el-button @click="diaProduct = false">å æ¶</el-button> |
| | | <el-button type="primary" @click="editProduct('add')" :loading="productLoad">æ° å¢</el-button> |
| | | </span> |
| | | </el-dialog> |
| | | <!--产åç»´æ¤ç¼è¾--> |
| | | <el-dialog title="æä½äº§åç»´æ¤" :visible.sync="productEditDia" width="400px"> |
| | | <el-form :model="productEditForm" ref="productEditForm" :rules="productRules" label-position="right" label-width="100px"> |
| | | <el-form-item label="产ååç§°" prop="name"> |
| | | <el-input size="small" placeholder="请è¾å
¥" clearable v-model="productEditForm.name"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="产ååç§°EN" prop="nameEn"> |
| | | <el-input size="small" placeholder="请è¾å
¥" clearable v-model="productEditForm.nameEn"> |
| | | </el-input> |
| | | </el-form-item> |
| | | </el-form> |
| | | <span slot="footer" class="dialog-footer"> |
| | | <el-button @click="closeProduct">å æ¶</el-button> |
| | | <el-button :loading="uploading" type="primary" @click="submitProduct">确 认</el-button> |
| | | </span> |
| | | </el-dialog> |
| | | <el-dialog :visible.sync="uploadDia" title="æ°æ®å¯¼å
¥" width="500px"> |
| | | <div style="margin: 0 auto;"> |
| | | <el-upload ref="upload" :action="uploadAction" |
| | | :auto-upload="false" :file-list="fileList" |
| | | :headers="token" :limit="1" |
| | | :on-change="beforeUpload" :on-error="onError" :on-success="onSuccess" accept=".xlsx" drag |
| | | name="file"> |
| | | <i class="el-icon-upload"></i> |
| | | <div class="el-upload__text">å°æä»¶æå°æ¤å¤ï¼æ<em>ç¹å»ä¸ä¼ </em></div> |
| | | </el-upload> |
| | | </div> |
| | | <span slot="footer" class="dialog-footer"> |
| | | <el-button @click="uploadDia = false">å æ¶</el-button> |
| | | <el-button :loading="uploading" type="primary" @click="submitUpload()">ä¸ ä¼ </el-button> |
| | | </span> |
| | | </el-dialog> |
| | | <!--æ£éªé¡¹ç®åæ°-ç¼è¾å¼¹æ¡--> |
| | | <EditForm ref="editForm" @refreshList="refreshList1"></EditForm> |
| | | <testObjectEditForm ref="testObjectEditForm" @refreshList="refreshList"></testObjectEditForm> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import { |
| | | addProduct, |
| | | delItemParameter, delProduct, delTestObject, selectItemParameterList, selectProductListByObjectId, |
| | | selectTestObjectList, upProduct, |
| | | } from "@/api/structural/capability"; |
| | | import limsTable from "@/components/Table/lims-table.vue"; |
| | | import EditForm from "@/views/structural/capabilityAndLaboratory/capabilityComponents/EditForm.vue"; |
| | | import testObjectEditForm from "@/views/structural/capabilityAndLaboratory/capabilityComponents/testObjectEditForm.vue"; |
| | | import {getToken} from "@/utils/auth"; |
| | | import { obtainItemParameterList } from '@/api/structural/laboratoryScope' |
| | | |
| | | export default { |
| | | components: {limsTable, EditForm, testObjectEditForm}, |
| | | data() { |
| | | return { |
| | | uploadAction: process.env.VUE_APP_BASE_API + '/capacityScope/importExcel', |
| | | uploadAction1: process.env.VUE_APP_BASE_API + '/capacityScope/importEquipData', |
| | | tableData: [], |
| | | tableLoading: false, |
| | | column: [ |
| | | {label: 'æ£éªé¡¹', prop: 'inspectionItem'}, |
| | | {label: 'æ£éªé¡¹EN', prop: 'inspectionItemEn'}, |
| | | {label: 'æ£éªå项', prop: 'inspectionItemSubclass'}, |
| | | {label: 'æ£éªå项EN', prop: 'inspectionItemSubclassEn'}, |
| | | {label: 'æ£éªé¡¹åç±»', prop: 'inspectionItemClass'}, |
| | | {label: 'æ£éªé¡¹åç±»EN', prop: 'inspectionItemClassEn'}, |
| | | {label: 'æ£éªå¯¹è±¡', prop: 'sample'}, |
| | | {label: 'åä»·(å
)', prop: 'price'}, |
| | | {label: 'è¯éªå®¤', prop: 'sonLaboratory'}, |
| | | {label: 'è¦æ±æè¿°', prop: 'askTell'}, |
| | | {label: 'è¦æ±å¼', prop: 'ask'}, |
| | | {label: '计éåä½', prop: 'unit'}, |
| | | {label: 'å·¥æ¶(H)', prop: 'manHour'}, |
| | | {label: 'é¢è®¡æ¶é´(H)', prop: 'manDay'}, |
| | | {label: 'å·¥æ¶åç»', prop: 'manHourGroup'}, |
| | | {label: 'å建æ¶é´', prop: 'createTime'}, |
| | | {label: 'ä¿®æ¹æ¶é´', prop: 'updateTime'}, |
| | | {label: 'æ¡ä»¶', prop: 'radiusList'}, |
| | | { |
| | | dataType: 'action', |
| | | fixed: 'right', |
| | | label: 'æä½', |
| | | width: '140px', |
| | | operation: [ |
| | | { |
| | | name: 'ç¼è¾', |
| | | type: 'text', |
| | | clickFun: (row) => { |
| | | this.editForm(row); |
| | | }, |
| | | }, |
| | | { |
| | | name: 'å é¤', |
| | | type: 'text', |
| | | clickFun: (row) => { |
| | | this.delete(row); |
| | | }, |
| | | }, |
| | | ] |
| | | } |
| | | ], |
| | | page: { |
| | | total:0, |
| | | size:10, |
| | | current:1 |
| | | }, |
| | | testObjectTableData: [], |
| | | testObjectColumn: [ |
| | | { |
| | | dataType: 'tag', |
| | | label: 'åºæ', |
| | | prop: 'laboratoryId', |
| | | minWidth: '130', |
| | | formatData: (params) => { |
| | | let index = this.laboratoryList.findIndex(item => item.value == params) |
| | | if(index > -1) { |
| | | return this.laboratoryList[index].label |
| | | }else { |
| | | return null |
| | | } |
| | | // if (params == 1) { |
| | | // return 'è£
å¤çµç¼è¯éªå®¤' |
| | | // } else if (params == 5) { |
| | | // return 'é信产åå®éªå®¤' |
| | | // } else if (params == 6) { |
| | | // return 'çµå产åå®éªå®¤' |
| | | // } else if (params == 8) { |
| | | // return 'å¨è½äº§åå®éªå®¤' |
| | | // } else { |
| | | // return 'å°é¢çº¿ç¼å®éªå®¤' |
| | | // } |
| | | }, |
| | | formatType: (params) => { |
| | | if (params == 1) { |
| | | return 'success' |
| | | } else if (params == 5) { |
| | | return 'info' |
| | | } else if (params == 6) { |
| | | return 'warning' |
| | | } else if (params == 8) { |
| | | return 'danger' |
| | | } else { |
| | | return null |
| | | } |
| | | } |
| | | }, |
| | | {label: 'æ£éªå¯¹è±¡', prop: 'specimenName'}, |
| | | {label: 'æ£éªå¯¹è±¡EN', prop: 'specimenNameEn'}, |
| | | {label: '产å', prop: 'product'}, |
| | | {label: '对象代å·', prop: 'code'}, |
| | | {label: '对象类å', prop: 'objectType', |
| | | dataType: 'tag', |
| | | formatData: (params) => { |
| | | if (params == 1) { |
| | | return 'åææ' |
| | | } else if (params == 2) { |
| | | return 'æå' |
| | | } else { |
| | | return 'è¾
æ' |
| | | } |
| | | }, |
| | | formatType: (params) => { |
| | | if (params == 1) { |
| | | return 'success' |
| | | } else if (params == 2) { |
| | | return 'info' |
| | | } else { |
| | | return 'warning' |
| | | } |
| | | }}, |
| | | {label: 'å建人', prop: 'createUserName'}, |
| | | {label: 'æ´æ°äºº', prop: 'updateUserName'}, |
| | | {label: 'å建æ¶é´', prop: 'createTime'}, |
| | | {label: 'æ´æ°æ¶é´', prop: 'updateTime'}, |
| | | { |
| | | dataType: 'action', |
| | | fixed: 'right', |
| | | label: 'æä½', |
| | | width: '240px', |
| | | operation: [ |
| | | { |
| | | name: 'ç¼è¾', |
| | | type: 'text', |
| | | clickFun: (row) => { |
| | | this.editTestObjectForm(row); |
| | | }, |
| | | }, |
| | | { |
| | | name: 'å é¤', |
| | | type: 'text', |
| | | clickFun: (row) => { |
| | | this.deleteTest(row); |
| | | }, |
| | | }, |
| | | { |
| | | name: '产åç»´æ¤', |
| | | type: 'text', |
| | | clickFun: (row) => { |
| | | this.upProduct(row); |
| | | }, |
| | | }, |
| | | ] |
| | | } |
| | | ], |
| | | testObjectPage: { |
| | | total:0, |
| | | size:10, |
| | | current:0 |
| | | }, |
| | | addOrUpdate: '', |
| | | tree: null, |
| | | loading: true, |
| | | itemParameterForm: { |
| | | inspectionItem: null, |
| | | inspectionItemSubclass: null, |
| | | specimenName: null |
| | | }, |
| | | radio: 0, |
| | | productLoad: false, |
| | | diaProduct: false, |
| | | productColumn: [ |
| | | {label: '产ååç§°', prop: 'name'}, |
| | | {label: '产ååç§°EN', prop: 'nameEn'}, |
| | | { |
| | | dataType: 'action', |
| | | label: 'æä½', |
| | | operation: [ |
| | | { |
| | | name: 'ç¼è¾', |
| | | type: 'text', |
| | | clickFun: (row) => { |
| | | this.editProduct('edit', row); |
| | | }, |
| | | }, |
| | | { |
| | | name: 'å é¤', |
| | | type: 'text', |
| | | clickFun: (row) => { |
| | | this.deleteProduct(row); |
| | | }, |
| | | }, |
| | | ] |
| | | } |
| | | ], |
| | | productData: [], |
| | | productPage: { |
| | | total:0, |
| | | size:10, |
| | | current:0, |
| | | layout: 'total, prev, pager, next' |
| | | }, |
| | | productableLoading: false, |
| | | productEditDia: false, |
| | | operationType: '', |
| | | productEditForm: { |
| | | objectId: '', |
| | | id: '', |
| | | name: '', |
| | | nameEn: '' |
| | | }, |
| | | objectId: '', |
| | | productRules: { |
| | | name: [{ required: true, message: '请填å产ååç§°', trigger: 'blur' }], |
| | | nameEn: [{ required: true, message: '请填å产ååç§°EN', trigger: 'blur' }] |
| | | }, |
| | | uploadDia: false, |
| | | fileList: [], |
| | | token: {Authorization: "Bearer " + getToken()}, |
| | | uploading: false, |
| | | laboratoryList:[] |
| | | } |
| | | }, |
| | | created() { |
| | | this.getItemParameterList() |
| | | this.refreshTable() |
| | | }, |
| | | computed: { |
| | | title() { |
| | | return this.addOrUpdate === 1 ? 'æ°å¢' : 'ç¼è¾' |
| | | } |
| | | }, |
| | | methods: { |
| | | submitUpload() { |
| | | if (this.$refs.upload.uploadFiles.length === 0) { |
| | | this.$message.error('æªéæ©æä»¶') |
| | | return |
| | | } |
| | | this.uploading = true |
| | | this.$refs.upload.submit(); |
| | | }, |
| | | onSuccess(response, file, fileList) { |
| | | this.$refs.upload.clearFiles() |
| | | this.uploadDia = false |
| | | this.uploading = false |
| | | if (response.code !== 200) { |
| | | this.$message.error(response.msg) |
| | | return |
| | | } |
| | | this.$message.success('ä¸ä¼ æå') |
| | | this.productList = [] |
| | | this.refreshTable() |
| | | }, |
| | | onError(err, file, fileList) { |
| | | this.$message.error('ä¸ä¼ 失败') |
| | | this.$refs.upload.clearFiles() |
| | | this.uploading = false |
| | | }, |
| | | beforeUpload(file, fileList) { |
| | | if (file.size > 1024 * 1024 * 10) { |
| | | this.$message.error('ä¸ä¼ æä»¶ä¸è¶
è¿10M'); |
| | | this.$refs.upload.clearFiles() |
| | | return false; |
| | | } else { |
| | | return true; |
| | | } |
| | | }, |
| | | onError1(err, file, fileList) { |
| | | this.$message.error('ä¸ä¼ 失败') |
| | | this.$refs.upload1.clearFiles() |
| | | this.uploading = false |
| | | }, |
| | | beforeUpload1(file, fileList) { |
| | | if (file.size > 1024 * 1024 * 10) { |
| | | this.$message.error('ä¸ä¼ æä»¶ä¸è¶
è¿10M'); |
| | | this.$refs.upload1.clearFiles() |
| | | return false; |
| | | } else { |
| | | return true; |
| | | } |
| | | }, |
| | | handleSuccessUp1 (response, file, fileList) { |
| | | this.$refs.upload1.clearFiles() |
| | | if (response.code !== 200) { |
| | | this.$message.error(response.msg) |
| | | return |
| | | } |
| | | this.$message.success('ä¸ä¼ æå') |
| | | this.refreshTable() |
| | | }, |
| | | refreshList () { |
| | | this.refreshTable() |
| | | }, |
| | | refreshList1 () { |
| | | this.refreshTable() |
| | | }, |
| | | refreshTable() { |
| | | this.tableLoading = true |
| | | if (this.radio === 0) { |
| | | selectItemParameterList({...this.page, ...this.itemParameterForm}).then(res => { |
| | | this.tableLoading = false |
| | | if (res.code === 200) { |
| | | this.tableData = res.data.records |
| | | this.page.total = res.data.total |
| | | } |
| | | }).catch(err => { |
| | | this.tableLoading = false |
| | | }) |
| | | } else { |
| | | selectTestObjectList({...this.testObjectPage, ...this.itemParameterForm}).then(res => { |
| | | this.tableLoading = false |
| | | if (res.code === 200) { |
| | | this.testObjectTableData = res.data.records |
| | | this.testObjectPage.total = res.data.total |
| | | } |
| | | }).catch(err => { |
| | | this.tableLoading = false |
| | | }) |
| | | } |
| | | }, |
| | | refresh() { |
| | | this.resetForm('itemParameterForm') |
| | | this.page.current = 1 |
| | | this.refreshTable() |
| | | }, |
| | | pagination (page) { |
| | | this.page.size = page.limit |
| | | this.refreshTable() |
| | | }, |
| | | // æ£éªé¡¹ç®åæ°æ°å¢ |
| | | openAdd() { |
| | | if (this.radio === 0) { |
| | | this.$refs.editForm.openDia('add') |
| | | } else { |
| | | this.$refs.testObjectEditForm.openDia('add') |
| | | } |
| | | }, |
| | | // æ£éªé¡¹ç®åæ°-æå¼ä¿®æ¹å¼¹æ¡ |
| | | editForm (row) { |
| | | this.$refs.editForm.openDia('edit', row) |
| | | }, |
| | | // æ£éªé¡¹ç®åæ°-å é¤ |
| | | delete (row) { |
| | | this.$confirm('æ¤æä½å°å é¤è¯¥æ°æ®, æ¯å¦ç»§ç»?', 'æç¤º', { |
| | | confirmButtonText: 'ç¡®å®', |
| | | cancelButtonText: 'åæ¶', |
| | | type: 'warning' |
| | | }).then(() => { |
| | | delItemParameter({id:row.id}).then(res => { |
| | | if (res.code === 200) { |
| | | this.$message.success('å 餿å') |
| | | this.refreshTable(); |
| | | } |
| | | }) |
| | | }).catch(() => { |
| | | this.$message({ |
| | | type: 'info', |
| | | message: '已忶å é¤' |
| | | }); |
| | | }) |
| | | }, |
| | | // æ£éªå¯¹è±¡-æå¼ä¿®æ¹å¼¹æ¡ |
| | | editTestObjectForm (row) { |
| | | this.$refs.testObjectEditForm.openDia('edit', row) |
| | | }, |
| | | // æ£éªé¡¹ç®åæ°-å é¤ |
| | | deleteTest (row) { |
| | | this.$confirm('æ¤æä½å°å é¤è¯¥æ°æ®, æ¯å¦ç»§ç»?', 'æç¤º', { |
| | | confirmButtonText: 'ç¡®å®', |
| | | cancelButtonText: 'åæ¶', |
| | | type: 'warning' |
| | | }).then(() => { |
| | | delTestObject({id:row.id}).then(res => { |
| | | if (res.code === 200) { |
| | | this.$message.success('å 餿å') |
| | | this.refreshTable(); |
| | | } |
| | | }) |
| | | }).catch(() => { |
| | | this.$message({ |
| | | type: 'info', |
| | | message: '已忶å é¤' |
| | | }); |
| | | }) |
| | | }, |
| | | // 产åç»´æ¤ |
| | | upProduct(row) { |
| | | this.diaProduct = true |
| | | this.objectId = row.id |
| | | this.getProductList(row) |
| | | }, |
| | | getProductList () { |
| | | const params = { |
| | | objectId: this.objectId, |
| | | } |
| | | this.productableLoading = true |
| | | selectProductListByObjectId({...params, ...this.productPage}).then(res => { |
| | | this.productableLoading = false |
| | | this.productData = res.data.records |
| | | this.productPage.total = res.data.total |
| | | }).catch(err => { |
| | | this.productableLoading = false |
| | | }) |
| | | }, |
| | | // 产åç»´æ¤-æ°å¢-ç¼è¾ |
| | | editProduct (type, row) { |
| | | this.productEditDia = true |
| | | this.operationType = type |
| | | if (type === 'edit') { |
| | | this.productEditForm = this.HaveJson(row) |
| | | } |
| | | }, |
| | | // æäº¤äº§åç»´æ¤ä¿®æ¹ |
| | | submitProduct () { |
| | | this.$refs['productEditForm'].validate((valid) => { |
| | | if (valid) { |
| | | this.uploading = true |
| | | this.productEditForm.objectId = this.objectId |
| | | if (this.operationType === 'add') { |
| | | addProduct(this.productEditForm).then(res => { |
| | | this.uploading = false |
| | | if (res.code === 200) { |
| | | this.$message.success('æ°å¢æå') |
| | | this.closeProduct() |
| | | this.getProductList(); |
| | | } |
| | | }).catch(err => { |
| | | this.uploading = false |
| | | }) |
| | | } else { |
| | | upProduct(this.productEditForm).then(res => { |
| | | this.uploading = false |
| | | if (res.code === 200) { |
| | | this.$message.success('æ°å¢æå') |
| | | this.closeProduct() |
| | | this.getProductList(); |
| | | } |
| | | }).catch(err => { |
| | | this.uploading = false |
| | | }) |
| | | } |
| | | } |
| | | }) |
| | | }, |
| | | closeProduct() { |
| | | this.resetForm('productEditForm') |
| | | this.productEditDia = false |
| | | }, |
| | | // 产åç»´æ¤-å é¤ |
| | | deleteProduct (row) { |
| | | this.$confirm('æ¤æä½å°å é¤è¯¥æ°æ®, æ¯å¦ç»§ç»?', 'æç¤º', { |
| | | confirmButtonText: 'ç¡®å®', |
| | | cancelButtonText: 'åæ¶', |
| | | type: 'warning' |
| | | }).then(() => { |
| | | delProduct({id:row.id}).then(res => { |
| | | if (res.code === 200) { |
| | | this.$message.success('å 餿å') |
| | | this.getProductList(); |
| | | } |
| | | }) |
| | | }).catch(() => { |
| | | this.$message({ |
| | | type: 'info', |
| | | message: '已忶å é¤' |
| | | }); |
| | | }) |
| | | }, |
| | | getItemParameterList(){ |
| | | obtainItemParameterList().then(res => { |
| | | let data = [] |
| | | res.data.forEach(a => { |
| | | data.push({ |
| | | label: a.laboratoryName, |
| | | value: a.id |
| | | }) |
| | | }) |
| | | this.laboratoryList = data |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | .capacity-scope { |
| | | padding: 20px; |
| | | } |
| | | .title { |
| | | height: 40px; |
| | | line-height: 40px; |
| | | margin-bottom: 10px; |
| | | } |
| | | </style> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div> |
| | | <el-dialog :title="operationType === 'add' ? 'æ°å¢' : 'ç¼è¾'" :visible.sync="editFormDia" width="60%" @close="closeDia"> |
| | | <el-form ref="editForm" :model="editForm" :rules="editFormRules" label-width="140px"> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="æ£éªé¡¹ï¼" prop="inspectionItem"> |
| | | <el-input v-model="editForm.inspectionItem" clearable size="small"></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="æ£éªé¡¹ENï¼" prop="inspectionItemEn"> |
| | | <el-input v-model="editForm.inspectionItemEn" clearable size="small"></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="æ£éªå项ï¼" prop="inspectionItemSubclass"> |
| | | <el-input v-model="editForm.inspectionItemSubclass" clearable size="small"></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="æ£éªå项ENï¼" prop="inspectionItemSubclassEn"> |
| | | <el-input v-model="editForm.inspectionItemSubclassEn" clearable size="small"></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="æ£éªå¯¹è±¡ï¼" prop="sample"> |
| | | <el-cascader v-model="editForm.sample" :options="itemParameterData.cascaderField.sample.tree" |
| | | :props="{value:'name',label:'name',checkStrictly: true, multiple: true}" |
| | | :show-all-levels="false" clearable |
| | | filterable placeholder="è¯·éæ©" size="small" style="width: 100%;"></el-cascader> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="åä»·(å
)ï¼" prop="price"> |
| | | <el-input v-model="editForm.price" clearable size="small"></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="åºæï¼" prop="laboratory"> |
| | | <el-select v-model="editForm.laboratory" clearable placeholder="è¯·éæ©" size="small" style="width: 100%"> |
| | | <el-option v-for="item in laboratoryList" :key="item.label" :label="item.label" :value="item.label"></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="è¯éªå®¤ï¼" prop="sonLaboratory"> |
| | | <el-select v-model="editForm.sonLaboratory" clearable placeholder="è¯·éæ©" size="small" style="width: 100%"> |
| | | <el-option v-for="item in dict.type.sys_sub_lab" :key="item.value" :label="item.label" :value="item.value"></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="è¦æ±æè¿°ï¼" prop="askTell"> |
| | | <el-input v-model="editForm.askTell" clearable size="small"></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="è¦æ±å¼ï¼" prop="ask"> |
| | | <el-input v-model="editForm.ask" clearable size="small"></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="计éåä½ï¼" prop="unit"> |
| | | <el-select v-model="editForm.unit" clearable placeholder="è¯·éæ©" size="small" style="width: 100%"> |
| | | <el-option v-for="item in dict.type.sys_unit" :key="item.value" :label="item.label" :value="item.value"></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="å·¥æ¶(H)ï¼" prop="manHour"> |
| | | <el-input v-model="editForm.manHour" clearable size="small"></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="é¢è®¡æ¶é´(H)ï¼" prop="manDay"> |
| | | <el-input v-model="editForm.manDay" clearable size="small"></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="å·¥æ¶åç»ï¼" prop="manHourGroup"> |
| | | <el-input v-model="editForm.manHourGroup" clearable size="small"></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="æ£éªé¡¹ç±»åï¼" prop="inspectionItemType"> |
| | | <el-select v-model="editForm.inspectionItemType" clearable placeholder="è¯·éæ©" size="small" style="width: 100%"> |
| | | <el-option v-for="item in dict.type.inspection_item_type" :key="item.value" :label="item.label" :value="item.value"></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="æ£éªå¼ç±»åï¼" prop="inspectionValueType"> |
| | | <el-select v-model="editForm.inspectionValueType" clearable placeholder="è¯·éæ©" size="small" style="width: 100%"> |
| | | <el-option v-for="item in dict.type.inspection_value_type" :key="item.value" :label="item.label" :value="item.value"></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="ç¹æ®æ è¯ï¼" prop="bsm"> |
| | | <el-select v-model="editForm.bsm" clearable placeholder="è¯·éæ©" size="small" style="width: 100%"> |
| | | <el-option v-for="item in dict.type.inspection_bsm" :key="item.value" :label="item.label" :value="item.value"></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="åå§è®°å½æ¨¡æ¿ï¼" prop="templateId"> |
| | | <el-select v-model="editForm.templateId" clearable placeholder="è¯·éæ©" size="small" style="width: 100%"> |
| | | <el-option v-for="item in templateIdList" :key="item.value" :label="item.label" :value="item.value"></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="æ£éªé¡¹åç±»ï¼" prop="inspectionItemClass"> |
| | | <el-input v-model="editForm.inspectionItemClass" clearable size="small"></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="æ£éªé¡¹åç±»ENï¼" prop="inspectionItemClassEn"> |
| | | <el-input v-model="editForm.inspectionItemClassEn" clearable size="small"></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="è¯éªæ¹æ³ï¼" prop="method"> |
| | | <el-select v-model="editForm.method" clearable multiple placeholder="è¯·éæ©" size="small" style="width: 100%"> |
| | | <el-option v-for="item in methodList" :key="item.value" :label="item.label" :value="item.label"></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="æ¡ä»¶ï¼" prop="radiusList"> |
| | | <el-select v-model="editForm.radiusList" allow-create default-first-option filterable multiple |
| | | placeholder="è¯·éæ©" |
| | | size="small" |
| | | style="width: 100%"> |
| | | <el-option v-for="item in radiusListList" :key="item.value" :label="item.label" :value="item.value"></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="æ¶è´¹æ å(å
/次)ï¼" prop="rates"> |
| | | <el-input v-model="editForm.rates" clearable size="small"></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <!-- <el-col :span="12">--> |
| | | <!-- <el-form-item label="åå
¸ç±»åï¼" prop="dic">--> |
| | | <!-- <el-select v-model="editForm.dic" clearable placeholder="è¯·éæ©" size="small" style="width: 100%">--> |
| | | <!-- <el-option v-for="item in dicList" :key="item.value" :label="item.label" :value="item.value"></el-option>--> |
| | | <!-- </el-select>--> |
| | | <!-- </el-form-item>--> |
| | | <!-- </el-col>--> |
| | | </el-form> |
| | | <span slot="footer" class="dialog-footer"> |
| | | <el-button @click="closeDia">å æ¶</el-button> |
| | | <el-button :loading="editLoad" type="primary" @click="handleEdit">æ 交</el-button> |
| | | </span> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | |
| | | import { |
| | | addItemParameter, |
| | | getItemTree, |
| | | getStandardTemplate, |
| | | obtainItemParameterList, |
| | | upItemParameter |
| | | } from "@/api/structural/capability"; |
| | | import {selectStandardMethods} from "@/api/standard/standardLibrary"; |
| | | |
| | | export default { |
| | | name: "EditForm", |
| | | // import å¼å
¥çç»ä»¶éè¦æ³¨å
¥å°å¯¹è±¡ä¸æè½ä½¿ç¨ |
| | | components: {}, |
| | | dicts: ['sys_sub_lab', 'inspection_item_type', 'sys_unit', 'inspection_value_type', 'inspection_bsm'], |
| | | data() { |
| | | // è¿éåæ¾æ°æ® |
| | | return { |
| | | editFormDia: false, |
| | | editLoad: false, |
| | | editForm: { |
| | | inspectionItem: '', // æ£éªé¡¹ |
| | | inspectionItemEn: '', // æ£éªé¡¹EN |
| | | inspectionItemSubclass: '', // æ£éªå项 |
| | | inspectionItemSubclassEn: '', // æ£éªå项EN |
| | | sample: [], // æ£éªå¯¹è±¡ |
| | | price: '', // åä»· |
| | | laboratory: '', // åºæ |
| | | sonLaboratory: '', // è¯éªå®¤ |
| | | askTell: '', // è¦æ±æè¿° |
| | | ask: '', // è¦æ±å¼ |
| | | unit: '', // 计éåä½ |
| | | manHour: '', // å·¥æ¶ |
| | | manDay: '', // é¢è®¡æ¶é´ |
| | | manHourGroup: '', // å·¥æ¶åç» |
| | | inspectionItemType: '', // æ£éªé¡¹ç±»å |
| | | inspectionValueType: '', // æ£éªå¼ç±»å |
| | | dic: '', // åå
¸ç±»å |
| | | bsm: '', // ç¹æ®æ è¯ |
| | | templateId: '', // åå§è®°å½æ¨¡æ¿ |
| | | inspectionItemClass: '', // æ£éªé¡¹åç±» |
| | | inspectionItemClassEn: '', // æ£éªé¡¹åç±»EN |
| | | method: '', // è¯éªæ¹æ³ |
| | | radiusList: [], // æ¡ä»¶ |
| | | rates: '', // æ¡ä»¶ |
| | | }, |
| | | sampleList: [], // æ£éªå¯¹è±¡ä¸ææ¡ |
| | | laboratoryList: [], // åºæä¸ææ¡ |
| | | inspectionItemTypeList: [], // æ£éªé¡¹ç±»åä¸ææ¡ |
| | | dicList: [], // åå
¸ç±»åä¸ææ¡ |
| | | templateIdList: [], // åå§è®°å½æ¨¡æ¿ä¸ææ¡ |
| | | methodList: [], // è¯éªæ¹æ³ä¸ææ¡ |
| | | radiusListList: [], // æ¡ä»¶ä¸ææ¡ |
| | | itemParameterData: { |
| | | cascaderField: { |
| | | sample: { |
| | | tree: [] |
| | | }, |
| | | } |
| | | }, |
| | | editFormRules: { |
| | | inspectionItem: [ |
| | | { required: true, message: 'è¯·éæ©æ£éªé¡¹', trigger: 'change' } |
| | | ], |
| | | sonLaboratory: [ |
| | | { required: true, message: 'è¯·éæ©è¯éªå®¤', trigger: 'change' } |
| | | ], |
| | | unit: [ |
| | | { required: true, message: 'è¯·éæ©è®¡éåä½', trigger: 'change' } |
| | | ], |
| | | inspectionItemType: [ |
| | | { required: true, message: 'è¯·éæ©æ£éªé¡¹ç±»å', trigger: 'change' } |
| | | ], |
| | | inspectionValueType: [ |
| | | { required: true, message: 'è¯·éæ©æ£éªå¼ç±»å', trigger: 'change' } |
| | | ], |
| | | templateId: [ |
| | | { required: true, message: 'è¯·éæ©åå§è®°å½æ¨¡æ¿', trigger: 'change' } |
| | | ] |
| | | }, |
| | | operationType: '' |
| | | } |
| | | }, |
| | | // æ¹æ³éå |
| | | methods: { |
| | | openDia (type, row) { |
| | | this.operationType = type |
| | | this.editFormDia = true |
| | | this.obtainItemParameterList() // åºæç±»å |
| | | this.getStandardTemplate() // åå§è®°å½æ¨¡æ¿ä¸ææ¡ |
| | | this.getSelectStandardMethods() // è¯éªæ¹æ³ |
| | | this.selectTestObjectByName() // æ£éªå¯¹è±¡ |
| | | if (type === 'add') { |
| | | this.editForm = { |
| | | inspectionItem: '', // æ£éªé¡¹ |
| | | inspectionItemEn: '', // æ£éªé¡¹EN |
| | | inspectionItemSubclass: '', // æ£éªå项 |
| | | inspectionItemSubclassEn: '', // æ£éªå项EN |
| | | sample: [], // æ£éªå¯¹è±¡ |
| | | price: '', // åä»· |
| | | laboratory: '', // åºæ |
| | | sonLaboratory: '', // è¯éªå®¤ |
| | | askTell: '', // è¦æ±æè¿° |
| | | ask: '', // è¦æ±å¼ |
| | | unit: '', // 计éåä½ |
| | | manHour: '', // å·¥æ¶ |
| | | manDay: '', // é¢è®¡æ¶é´ |
| | | manHourGroup: '', // å·¥æ¶åç» |
| | | inspectionItemType: '', // æ£éªé¡¹ç±»å |
| | | inspectionValueType: '', // æ£éªå¼ç±»å |
| | | dic: '', // åå
¸ç±»å |
| | | bsm: '', // ç¹æ®æ è¯ |
| | | templateId: '', // åå§è®°å½æ¨¡æ¿ |
| | | inspectionItemClass: '', // æ£éªé¡¹åç±» |
| | | inspectionItemClassEn: '', // æ£éªé¡¹åç±»EN |
| | | method: '', // è¯éªæ¹æ³ |
| | | radiusList: [], // æ¡ä»¶ |
| | | rates: '', // æ¡ä»¶ |
| | | } |
| | | this.resetForm('editForm') |
| | | } else { |
| | | this.editForm = this.HaveJson(row) |
| | | this.editForm.sample = JSON.parse(this.editForm.sample) |
| | | this.editForm.radiusList = JSON.parse(this.editForm.radiusList) |
| | | this.editForm.method = JSON.parse(this.editForm.method) |
| | | } |
| | | }, |
| | | // æäº¤ç¼è¾ |
| | | handleEdit () { |
| | | this.$refs.editForm.validate(valid => { |
| | | if (valid) { |
| | | this.editLoad = true |
| | | let obj = this.HaveJson(this.editForm) |
| | | obj.method = JSON.stringify(obj.method) |
| | | obj.sample = JSON.stringify(obj.sample) |
| | | if (obj.radiusList?.length > 0) { |
| | | obj.radiusList = JSON.stringify(obj.radiusList) |
| | | } else { |
| | | obj.radiusList = null |
| | | } |
| | | if(obj.id){ |
| | | // ä¿®æ¹ |
| | | upItemParameter(obj).then(res => { |
| | | this.editLoad = false |
| | | if (res.code === 500) { |
| | | return |
| | | } |
| | | this.$message.success('ä¿®æ¹æå') |
| | | this.editFormDia = false |
| | | this.$emit('refreshList') |
| | | }).catch(e => { |
| | | this.editLoad = false |
| | | }) |
| | | }else{ |
| | | // æ°å¢ |
| | | addItemParameter(obj).then(res => { |
| | | this.editLoad = false |
| | | if (res.code === 500) { |
| | | return |
| | | } |
| | | this.$message.success('æ·»å æå') |
| | | this.editFormDia = false |
| | | this.$emit('refreshList') |
| | | }).catch(e => { |
| | | this.editLoad = false |
| | | }) |
| | | } |
| | | } |
| | | }) |
| | | }, |
| | | // å
³éå¼¹æ¡ |
| | | closeDia () { |
| | | this.editFormDia = false |
| | | this.resetForm("editForm"); |
| | | }, |
| | | selectTestObjectByName() { |
| | | getItemTree().then(res => { |
| | | if (res.data.length > 0) { |
| | | res.data.forEach(a=>{ |
| | | this.cascaderFieldData(a) |
| | | }) |
| | | this.itemParameterData.cascaderField.sample.tree = res.data |
| | | } |
| | | }) |
| | | }, |
| | | cascaderFieldData(val){ |
| | | if(val.children === undefined) { |
| | | return |
| | | }else if(val.children.length==0){ |
| | | val.label = val.name |
| | | val.value = val.id |
| | | delete val.children |
| | | }else{ |
| | | val.label = val.name |
| | | val.value = val.id |
| | | val.children.forEach(a=>{ |
| | | a.label = a.name |
| | | a.value = a.id |
| | | this.cascaderFieldData(a) |
| | | }) |
| | | } |
| | | }, |
| | | getSelectStandardMethods() { |
| | | selectStandardMethods().then(res => { |
| | | let data = [] |
| | | if (res.data.length > 0) { |
| | | res.data.forEach(a => { |
| | | data.push({ |
| | | label: a.code, |
| | | value: a.id, |
| | | }) |
| | | }) |
| | | this.methodList = data |
| | | } |
| | | }) |
| | | }, |
| | | obtainItemParameterList() { |
| | | obtainItemParameterList().then(res => { |
| | | let data = [] |
| | | if (res.data.length > 0) { |
| | | res.data.forEach(a => { |
| | | data.push({ |
| | | label: a.laboratoryName, |
| | | value: a.id |
| | | }) |
| | | }) |
| | | } |
| | | this.laboratoryList = data |
| | | }) |
| | | }, |
| | | getStandardTemplate() { |
| | | getStandardTemplate().then(res => { |
| | | let data = [] |
| | | res.data.forEach(a => { |
| | | data.push({ |
| | | label: a.name, |
| | | value: a.id, |
| | | type: 'success' |
| | | }) |
| | | }) |
| | | this.templateIdList = data |
| | | }) |
| | | }, |
| | | }, |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | ::v-deep .el-dialog__body { |
| | | height: 620px; |
| | | overflow-y: auto; |
| | | } |
| | | </style> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div> |
| | | <el-dialog :title="operationType === 'add' ? 'æ°å¢' : 'ç¼è¾'" :visible.sync="editFormDia" width="500px" @close="closeDia"> |
| | | <el-form ref="editForm" :model="editForm" :rules="editFormRules" label-width="120px" label-position="right"> |
| | | <el-form-item label="åºæï¼" prop="laboratoryId"> |
| | | <el-select v-model="editForm.laboratoryId" clearable placeholder="è¯·éæ©" size="small" style="width: 100%"> |
| | | <el-option v-for="item in laboratoryList" :key="item.value" :label="item.label" :value="item.value"></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="æ£éªå¯¹è±¡ï¼" prop="specimenName"> |
| | | <el-input v-model="editForm.specimenName" clearable size="small"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="æ£éªå¯¹è±¡ENï¼" prop="specimenNameEn"> |
| | | <el-input v-model="editForm.specimenNameEn" clearable size="small"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="对象代å·ï¼" prop="code"> |
| | | <el-input v-model="editForm.code" clearable size="small"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="对象类åï¼" prop="objectType"> |
| | | <el-select v-model="editForm.objectType" clearable placeholder="è¯·éæ©" size="small" style="width: 100%"> |
| | | <el-option v-for="item in dict.type.object_type" :key="item.value" :label="item.label" :value="item.value"></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-form> |
| | | <span slot="footer" class="dialog-footer"> |
| | | <el-button @click="closeDia">å æ¶</el-button> |
| | | <el-button :loading="editLoad" type="primary" @click="handleEdit">æ 交</el-button> |
| | | </span> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | |
| | | import {obtainItemParameterList} from "@/api/structural/laboratoryScope"; |
| | | import {addTestObject, upTestObject} from "@/api/structural/capability"; |
| | | |
| | | export default { |
| | | name: "EditForm", |
| | | // import å¼å
¥çç»ä»¶éè¦æ³¨å
¥å°å¯¹è±¡ä¸æè½ä½¿ç¨ |
| | | dicts: ['object_type'], |
| | | components: {}, |
| | | data() { |
| | | // è¿éåæ¾æ°æ® |
| | | return { |
| | | editFormDia: false, |
| | | editLoad: false, |
| | | editForm: { |
| | | id: '', |
| | | laboratoryId: '', // åºæ |
| | | specimenName: '', // æ£éªå¯¹è±¡ |
| | | specimenNameEn: '', // æ£éªå¯¹è±¡EN |
| | | code: '', // å¯¹è±¡ä»£å· |
| | | objectType: '', // 对象类å |
| | | }, |
| | | laboratoryList: [], |
| | | editFormRules: { |
| | | laboratoryId: [ |
| | | { required: true, message: 'è¯·éæ©åºæ', trigger: 'change' } |
| | | ], |
| | | specimenName: [ |
| | | { required: true, message: '请è¾å
¥æ£éªå¯¹è±¡', trigger: 'blur' } |
| | | ], |
| | | code: [ |
| | | { required: true, message: '请è¾å
¥å¯¹è±¡ä»£å·', trigger: 'blur' } |
| | | ], |
| | | }, |
| | | operationType: '' |
| | | } |
| | | }, |
| | | // æ¹æ³éå |
| | | methods: { |
| | | openDia (type, row) { |
| | | this.operationType = type |
| | | this.obtainItemParameterList() |
| | | this.editFormDia = true |
| | | if (type === 'add') { |
| | | this.resetForm("editForm"); |
| | | } else { |
| | | this.editForm = {...row} |
| | | } |
| | | }, |
| | | // æäº¤ç¼è¾ |
| | | handleEdit () { |
| | | this.$refs.editForm.validate(valid => { |
| | | if (valid) { |
| | | this.editLoad = true |
| | | if(this.editForm.id){ |
| | | // ä¿®æ¹ |
| | | upTestObject(this.editForm).then(res => { |
| | | this.editLoad = false |
| | | if (res.code === 500) { |
| | | return |
| | | } |
| | | this.$message.success('ä¿®æ¹æå') |
| | | this.closeDia() |
| | | this.$emit('refreshList') |
| | | }).catch(e => { |
| | | this.editLoad = false |
| | | }) |
| | | }else{ |
| | | // æ°å¢ |
| | | addTestObject(this.editForm).then(res => { |
| | | this.editLoad = false |
| | | if (res.code === 500) { |
| | | return |
| | | } |
| | | this.$message.success('æ·»å æå') |
| | | this.closeDia() |
| | | this.$emit('refreshList') |
| | | }).catch(e => { |
| | | this.editLoad = false |
| | | }) |
| | | } |
| | | } |
| | | }) |
| | | }, |
| | | // å
³éå¼¹æ¡ |
| | | closeDia () { |
| | | this.editFormDia = false |
| | | this.resetForm("editForm"); |
| | | }, |
| | | // è·ååºæä¸ææ¡çå¼ |
| | | obtainItemParameterList() { |
| | | obtainItemParameterList().then(res => { |
| | | let data = [] |
| | | res.data.forEach(a => { |
| | | data.push({ |
| | | label: a.laboratoryName, |
| | | value: a.id |
| | | }) |
| | | }) |
| | | this.laboratoryList = data |
| | | }) |
| | | }, |
| | | }, |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | |
| | | </style> |