¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="capacity-scope"> |
| | | <div> |
| | | <el-row class="title"> |
| | | <el-col :span="12" style="text-align: left"> |
| | | <el-radio-group v-model="radio" @input="selectorSwitch" size="medium" fill="#409EFF"> |
| | | <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-button size="medium" @click="$refs.itemParameterTable.openUpload()" v-if="inPower">--> |
| | | <!-- <i class="el-icon-upload2" style="color: #3A7BFA;"></i>--> |
| | | <!-- <span style="color: #3A7BFA;">导å
¥</span></el-button>--> |
| | | <el-button size="medium" type="primary" v-if="radio == 1 && importExcel" @click="uploadDia = true">导å
¥</el-button> |
| | | <el-button size="medium" type="primary" @click="openAdd()" v-if="addPower">æ°å¢</el-button> |
| | | <!-- <el-button size="medium" icon="el-icon-delete">å é¤</el-button> --> |
| | | </el-col> |
| | | </el-row> |
| | | </div> |
| | | <div v-if="radio==0" class="bodys"> |
| | | <div class="search"> |
| | | <div class="search_thing"> |
| | | <div class="search_label">æ£éªé¡¹ï¼</div> |
| | | <div class="search_input"><el-input size="small" placeholder="请è¾å
¥" clearable |
| | | v-model="itemParameterForm.inspectionItem" @keyup.enter.native="refreshTable()"></el-input></div> |
| | | </div> |
| | | <div class="search_thing"> |
| | | <div class="search_label">æ£éªå项ï¼</div> |
| | | <div class="search_input"><el-input size="small" placeholder="请è¾å
¥" clearable |
| | | v-model="itemParameterForm.inspectionItemSubclass" @keyup.enter.native="refreshTable()"></el-input> |
| | | </div> |
| | | </div> |
| | | <div class="search_thing"> |
| | | <div class="search_label">æ£éªå¯¹è±¡ï¼</div> |
| | | <div class="search_input"><el-input size="small" placeholder="请è¾å
¥" clearable |
| | | v-model="itemParameterForm.sample" @keyup.enter.native="refreshTable()"></el-input> |
| | | </div> |
| | | </div> |
| | | <div class="search_thing" style="padding-left: 30px;"> |
| | | <el-button size="small" @click="refresh()">é ç½®</el-button> |
| | | <el-button size="small" type="primary" @click="refreshTable()">æ¥ è¯¢</el-button> |
| | | </div> |
| | | </div> |
| | | <div class="table"> |
| | | <!-- <ValueTable ref="itemParameterTable"--> |
| | | <!-- :url="$api.capacityScope.selectItemParameterList" v-if="PROJECT === 'æ£æµä¸å¿'"--> |
| | | <!-- :upUrl="$api.capacityScope.upItemParameter" :delUrl="$api.capacityScope.delItemParameter"--> |
| | | <!-- :inputUrl="$api.capacityScope.importData" :componentData="itemParameterData" :key="upIndex" />--> |
| | | <!-- <ValueTable ref="itemParameterTable" :url="$api.capacityScope.selectItemParameterList" v-if="PROJECT === 'è£
å¤çµç¼'"--> |
| | | <!-- :upUrl="$api.capacityScope.upItemParameter" :delUrl="$api.capacityScope.delItemParameter"--> |
| | | <!-- :inputUrl="$api.capacityScope.importEquipData" :componentData="itemParameterData" :key="upIndex" />--> |
| | | </div> |
| | | </div> |
| | | <div class="bodys"> |
| | | <div class="search" v-if="radio==1"> |
| | | <div class="search_thing"> |
| | | <div class="search_label">æ£éªå¯¹è±¡ï¼</div> |
| | | <div class="search_input"><el-input size="small" placeholder="请è¾å
¥" clearable |
| | | v-model="testObjectData.entity.specimenName" @keyup.enter.native="refreshTable()"></el-input></div> |
| | | </div> |
| | | <div class="search_thing" style="padding-left: 30px;"> |
| | | <el-button size="small" @click="refresh()">é ç½®</el-button> |
| | | <el-button size="small" type="primary" @click="refreshTable()">æ¥ è¯¢</el-button> |
| | | </div> |
| | | </div> |
| | | <div class="table" v-if="radio==1"> |
| | | <!-- <ValueTable ref="testObjectTable" :url="$api.capacityScope.selectTestObjectList"--> |
| | | <!-- :upUrl="$api.capacityScope.upTestObject" :delUrl="$api.capacityScope.delTestObject"--> |
| | | <!-- :componentData="testObjectData" :key="upIndex" />--> |
| | | </div> |
| | | </div> |
| | | <el-dialog title="产åç»´æ¤" :visible.sync="diaProduct" width="600px"> |
| | | <div class="body" v-if="diaProduct" style="height: 350px;overflow-y: auto;padding: 5px 0;"> |
| | | <!-- <ValueTable ref="productData" :url="$api.capacityScope.selectProductListByObjectId"--> |
| | | <!-- :upUrl="$api.capacityScope.upProduct" :delUrl="$api.capacityScope.delProduct"--> |
| | | <!-- :componentData="productData" :key="upIndex"/>--> |
| | | </div> |
| | | <span slot="footer" class="dialog-footer"> |
| | | <el-button @click="diaProduct = false">å æ¶</el-button> |
| | | <el-button type="primary" @click="openAdd2" :loading="productLoad">æ° å¢</el-button> |
| | | </span> |
| | | </el-dialog> |
| | | <el-dialog title="æ°æ®å¯¼å
¥" :visible.sync="uploadDia" width="500px"> |
| | | <!-- <div style="margin: 0 auto;">--> |
| | | <!-- <el-upload ref="upload" drag :action="javaApi + $api.capacityScope.importExcel" :headers="token" :file-list="fileList" name="file"--> |
| | | <!-- :auto-upload="false" accept=".xlsx" :limit="1" :on-change="beforeUpload" :on-success="onSuccess"--> |
| | | <!-- :on-error="onError">--> |
| | | <!-- <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 type="primary" @click="submitUpload()" :loading="uploading">ä¸ ä¼ </el-button> |
| | | </span> |
| | | </el-dialog> |
| | | |
| | | <!-- ç¼è¾ æ°å¢ --> |
| | | <el-dialog |
| | | :title="title" |
| | | :visible.sync="dialogVisible" |
| | | width="50%" |
| | | :before-close="handleClose"> |
| | | <el-form :model="addOrupdateForm" label-width="120px" :rules="rules" inline ref="addOrupdateForm" size="mini"> |
| | | <el-form-item label="æ£éªé¡¹" prop="inspectionItem"> |
| | | <el-input v-model="addOrupdateForm.inspectionItem" placeholder="请è¾å
¥æ£éªé¡¹" size="mini" style="width: 220px;"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="æ£éªé¡¹EN" > |
| | | <el-input v-model="addOrupdateForm.inspectionItemEn" placeholder="请è¾å
¥æ£éªé¡¹EN" size="mini" style="width: 220px;"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="æ£éªé¡¹å项" > |
| | | <el-input v-model="addOrupdateForm.inspectionItemSubclass" placeholder="请è¾å
¥æ£éªé¡¹å项" size="mini" style="width: 220px;"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="æ£éªå项EN" > |
| | | <el-input v-model="addOrupdateForm.inspectionItemSubclassEn" placeholder="请è¾å
¥æ£éªå项EN" size="mini" style="width: 220px;"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="æ£éªå¯¹è±¡" > |
| | | <el-cascader |
| | | size="mini" style="width: 220px;" |
| | | filterable |
| | | v-model="addOrupdateForm.sample" |
| | | :options="tree" |
| | | :props="{value:'name',label: 'name', multiple: true, checkStrictly: true }" |
| | | clearable></el-cascader> |
| | | <!-- <el-input v-model="addOrupdateForm.sample" placeholder="请è¾å
¥æ£éªå¯¹è±¡" size="mini" style="width: 220px;"></el-input> --> |
| | | </el-form-item> |
| | | <el-form-item label="åä»·(å
)" > |
| | | <el-input v-model="addOrupdateForm.price" placeholder="请è¾å
¥åä»·" size="mini" style="width: 220px;"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="åºæ" > |
| | | <el-select v-model="addOrupdateForm.laboratory" filterable size="small" style="width: 220px;"> |
| | | <el-option |
| | | v-for="item in laboratory" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.label"> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="è¯éªå®¤" prop="sonLaboratory"> |
| | | <el-select v-model="addOrupdateForm.sonLaboratory" filterable size="small" style="width: 220px;"> |
| | | <el-option |
| | | v-for="item in dicList.sonLaboratory" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value"> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="è¦æ±æè¿°" > |
| | | <el-input v-model="addOrupdateForm.askTell" placeholder="请è¾å
¥è¦æ±æè¿°" size="mini" style="width: 220px;"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="è¦æ±å¼" > |
| | | <el-input v-model="addOrupdateForm.ask" placeholder="请è¾å
¥è¦æ±å¼" size="mini" style="width: 220px;"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="计éåä½" prop="unit"> |
| | | <el-select v-model="addOrupdateForm.unit" filterable size="small" style="width: 220px;"> |
| | | <el-option |
| | | v-for="item in dicList.unit" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value"> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="å·¥æ¶(H)" > |
| | | <el-input v-model="addOrupdateForm.manHour" placeholder="请è¾å
¥å·¥æ¶" size="mini" style="width: 220px;"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="é¢è®¡æ¶é´(H)" prop="manDay"> |
| | | <el-input v-model="addOrupdateForm.manDay" placeholder="请è¾å
¥é¢è®¡æ¶é´" size="mini" style="width: 220px;"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="å·¥æ¶åç»" > |
| | | <el-input v-model="addOrupdateForm.manHourGroup" placeholder="请è¾å
¥å·¥æ¶åç»" size="mini" style="width: 220px;"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="æ£éªé¡¹ç±»å" prop="inspectionItemType"> |
| | | <el-select v-model="addOrupdateForm.inspectionItemType" filterable size="small" style="width: 220px;"> |
| | | <el-option |
| | | v-for="item in dicList.inspectionItemType" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value"> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="æ£éªå¼ç±»å" prop="inspectionValueType"> |
| | | <el-select v-model="addOrupdateForm.inspectionValueType" filterable size="small" style="width: 220px;"> |
| | | <el-option |
| | | v-for="item in dicList.inspectionValueType" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value"> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="åå
¸ç±»å" > |
| | | <el-select v-model="addOrupdateForm.dic" clearable filterable size="small" style="width: 220px;"> |
| | | <el-option |
| | | v-for="item in dicList.dic" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value"> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="ç¹æ®æ è¯ç¬¦"> |
| | | <el-select v-model="addOrupdateForm.bsm" filterable size="small" style="width: 220px;"> |
| | | <el-option |
| | | v-for="item in dicList.bsm" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value"> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="åå§è®°å½æ¨¡æ¿" prop="templateId"> |
| | | <el-select v-model="addOrupdateForm.templateId" filterable size="small" style="width: 220px;"> |
| | | <el-option |
| | | v-for="item in dicList.templateId" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value"> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="æ£éªé¡¹åç±»" > |
| | | <el-input v-model="addOrupdateForm.inspectionItemClass" placeholder="请è¾å
¥æ£éªé¡¹åç±»" size="mini" style="width: 220px;"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="æ£éªé¡¹åç±»EN" > |
| | | <el-input v-model="addOrupdateForm.inspectionItemClassEn" placeholder="请è¾å
¥æ£éªé¡¹åç±»EN" size="mini" style="width: 220px;"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="è¯éªæ¹æ³" prop="method"> |
| | | <el-select v-model="addOrupdateForm.method" filterable multiple size="small" style="width: 220px;"> |
| | | <el-option |
| | | v-for="(item,index) in dicList.method" |
| | | :key="index" |
| | | :label="item.label" |
| | | :value="item.value"> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-form> |
| | | <span slot="footer" class="dialog-footer"> |
| | | <el-button @click="handleClose">å æ¶</el-button> |
| | | <el-button type="primary" @click="saveOrEnit">ç¡® å®</el-button> |
| | | </span> |
| | | </el-dialog> |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | // import ValueTable from '../tool/value-table.vue' |
| | | import {addItemParameter, getItemTree, upItemParameter} from "@/api/structural/capability"; |
| | | import {obtainItemParameterList} from "@/api/structural/laboratoryScope"; |
| | | import {selectStandardMethods} from "@/api/structural/standardMethod"; |
| | | |
| | | export default { |
| | | data() { |
| | | return { |
| | | dicList: { |
| | | inspectionItemType: [], |
| | | inspectionValueType: [], |
| | | bsm: [], |
| | | sonLaboratory: [], |
| | | unit: [], |
| | | dic: [], |
| | | method: [], |
| | | }, |
| | | addOrUpdate: '', |
| | | addOrupdateForm:{ |
| | | inspectionItem: '', |
| | | inspectionItemEn: '', |
| | | inspectionItemSubclass: '', |
| | | inspectionItemSubclassEn: '', |
| | | sample: null, |
| | | price: '', |
| | | laboratory: '', |
| | | sonLaboratory: '', |
| | | askTell: '', |
| | | ask: '', |
| | | unit: '', |
| | | manHour: '', |
| | | manDay: '', |
| | | manHourGroup: '', |
| | | inspectionItemType: '', |
| | | inspectionValueType: '', |
| | | dic: '', |
| | | bsm: '', |
| | | templateId: '', |
| | | inspectionItemClass: '', |
| | | inspectionItemClassEn: '', |
| | | method: [] |
| | | }, |
| | | tree: null, |
| | | rules:{ |
| | | inspectionItem: [ |
| | | { required: true, message: '请è¾å
¥æ£éªé¡¹', trigger: 'blur' } |
| | | ], |
| | | sonLaboratory: [ |
| | | { required: true, message: '请è¾å
¥è¯éªå®¤', trigger: 'change' } |
| | | ], |
| | | unit: [ |
| | | { required: true, message: '请è¾å
¥è®¡éåä½', trigger: 'change' } |
| | | ], |
| | | manDay: [ |
| | | { required: true, message: '请è¾å
¥é¢è®¡æ¶é´', trigger: 'blur' } |
| | | ], |
| | | inspectionItemType: [ |
| | | { required: true, message: '请è¾å
¥æ£éªé¡¹ç±»å', trigger: 'change' } |
| | | ], |
| | | inspectionValueType: [ |
| | | { required: true, message: '请è¾å
¥æ£éªå¼ç±»å', trigger: 'change' } |
| | | ], |
| | | method: [ |
| | | { required: true, message: 'è¯·éæ©è¯éªæ¹æ³', trigger: 'change' } |
| | | ], |
| | | templateId: [ |
| | | { required: true, message: '请è¾å
¥åå§è®°å½æ¨¡æ¿', trigger: 'change' } |
| | | ], |
| | | }, |
| | | dialogVisible: false, |
| | | loading: true, |
| | | itemParameterForm: { |
| | | inspectionItem: null, |
| | | inspectionItemSubclass: null, |
| | | sample: null |
| | | }, |
| | | logining:false, |
| | | radio: 0, |
| | | showItemParameter: true, |
| | | showTestObject: false, |
| | | itemParameterData: { |
| | | entity: { |
| | | inspectionItem: null, |
| | | inspectionItemSubclass: null, |
| | | sample: null, |
| | | orderBy: { |
| | | field: 'id', |
| | | order: 'asc' |
| | | } |
| | | }, |
| | | isIndex: true, |
| | | showSelect: false, |
| | | select: true, |
| | | row: 2, |
| | | do: [{ |
| | | id: 'update', |
| | | font: 'ç¼è¾', |
| | | type: 'text', |
| | | method: 'openAdd', |
| | | field: [] |
| | | }, { |
| | | id: 'delete', |
| | | font: 'å é¤', |
| | | type: 'text', |
| | | method: 'doDiy' |
| | | }], |
| | | tagField: { |
| | | }, |
| | | selectField: { |
| | | inspectionItemType: { |
| | | select: [] |
| | | }, |
| | | bsm: { |
| | | select: [] |
| | | }, |
| | | inspectionValueType: { |
| | | select: [] |
| | | }, |
| | | laboratory: { |
| | | select: [] |
| | | }, |
| | | templateId: { |
| | | select: [] |
| | | }, |
| | | method: { |
| | | select: [], |
| | | choose: true |
| | | }, |
| | | sonLaboratory: { |
| | | select: [] |
| | | }, |
| | | unit: { |
| | | select: [] |
| | | }, |
| | | dic: { |
| | | select: [] |
| | | }, |
| | | }, |
| | | cascaderField:{ |
| | | sample:{ |
| | | tree:[] |
| | | }, |
| | | // åæ®µé
ç½® |
| | | props:{ |
| | | value:'name', |
| | | label:'name', |
| | | checkStrictly: true, |
| | | multiple: true |
| | | } |
| | | }, |
| | | requiredAdd: ['sonLaboratory', 'inspectionItem', 'inspectionItemType', 'inspectionValueType', |
| | | 'unit', 'method', 'manDay', 'templateId' |
| | | ], |
| | | requiredUp: ['sonLaboratory', 'inspectionItem', 'inspectionItemType', 'inspectionValueType', |
| | | 'unit', 'method', 'manDay', 'templateId' |
| | | ], |
| | | accept: '.xlsx', |
| | | inputType: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', |
| | | needSort: ['createTime', 'updateTime', 'inspectionItem', 'inspectionItemSubclass', 'sample'], |
| | | }, |
| | | testObjectData: { |
| | | entity: { |
| | | specimenName: null, |
| | | orderBy: { |
| | | field: 'id', |
| | | order: 'asc' |
| | | } |
| | | }, |
| | | isIndex: true, |
| | | showSelect: false, |
| | | select: true, |
| | | do: [{ |
| | | id: 'update', |
| | | font: 'ç¼è¾', |
| | | type: 'text', |
| | | method: 'doDiy', |
| | | field: ['createUserName', 'updateUserName', 'product'] |
| | | }, { |
| | | id: 'delete', |
| | | font: 'å é¤', |
| | | type: 'text', |
| | | method: 'doDiy' |
| | | }, { |
| | | font: '产åç»´æ¤', |
| | | type: 'text', |
| | | method: 'upProduct' |
| | | }], |
| | | tagField: { |
| | | laboratoryId: { |
| | | select: [] |
| | | } |
| | | }, |
| | | selectField: { |
| | | laboratoryId: { |
| | | select: [] |
| | | } |
| | | }, |
| | | requiredAdd: ['specimenName', 'code', 'laboratoryId'], |
| | | requiredUp: ['specimenName', 'code', 'laboratoryId'], |
| | | needSort: ['createTime', 'updateTime', 'specimenName'], |
| | | }, |
| | | itemParameterEntityCopy: {}, |
| | | testObjectDataEntityCopy: {}, |
| | | upIndex: 0, |
| | | addDia: false, |
| | | addPower: true, |
| | | select: 0, |
| | | laboratory: [], |
| | | productLoad: false, |
| | | diaProduct: false, |
| | | productData: { |
| | | entity: { |
| | | objectId: 0, |
| | | orderBy: { |
| | | field: 'id', |
| | | order: 'asc' |
| | | } |
| | | }, |
| | | isPage: false, |
| | | isIndex: true, |
| | | showSelect: false, |
| | | select: true, |
| | | do: [{ |
| | | id: 'update', |
| | | font: 'ç¼è¾', |
| | | type: 'text', |
| | | method: 'doDiy', |
| | | field: [] |
| | | }, { |
| | | id: 'delete', |
| | | font: 'å é¤', |
| | | type: 'text', |
| | | method: 'doDiy' |
| | | }], |
| | | tagField: {}, |
| | | selectField: {}, |
| | | requiredAdd: ['name','nameEn'], |
| | | requiredUp: ['name','nameEn'], |
| | | }, |
| | | inPower: true, |
| | | importExcel: false, |
| | | uploadDia: false, |
| | | fileList: [], |
| | | token: null, |
| | | uploading: false, |
| | | } |
| | | }, |
| | | created() { |
| | | if (this.PROJECT === 'è£
å¤çµç¼') { |
| | | this.itemParameterData.requiredUp = ['sonLaboratory', 'inspectionItem', 'inspectionItemType', 'inspectionValueType', |
| | | 'unit', 'manDay', 'templateId' |
| | | ] |
| | | } |
| | | }, |
| | | mounted() { |
| | | this.token = { |
| | | 'token': sessionStorage.getItem('token') |
| | | } |
| | | this.itemParameterEntityCopy = this.HaveJson(this.itemParameterData.entity) |
| | | this.testObjectDataEntityCopy = this.HaveJson(this.testObjectData.entity) |
| | | this.obtainItemParameterList() //åºæ |
| | | this.selectStandardMethods() // è¯éªæ¹æ³ |
| | | this.selectTestObjectByName() |
| | | this.getStandardTemplate() // åå§è®°å½æ¨¡æ¿ |
| | | this.selectDocUnit() |
| | | |
| | | this.selectAllNeedEnum() |
| | | }, |
| | | computed: { |
| | | title() { |
| | | return this.addOrUpdate == 1 ? 'æ°å¢' : 'ç¼è¾' |
| | | } |
| | | }, |
| | | methods: { |
| | | //æ¥è¯¢éè¦çå
¨é¨æä¸¾ |
| | | selectAllNeedEnum(){ |
| | | // this.$axios.post(this.$api.enums.selectEnumListByCategory, |
| | | // {categoryList:['æ£éªé¡¹ç±»å','åå¼ç±»å','æ¯å¦','æ£éªå¼ç±»å','åå®éªå®¤','åä½']},{ |
| | | // headers: { |
| | | // 'Content-Type': 'application/json' |
| | | // } |
| | | // }).then(res => { |
| | | // res.data['æ£éªé¡¹ç±»å'].forEach(ele => { |
| | | // if(ele.label.indexOf('ééé')==0)ele.type='info' |
| | | // }); |
| | | // this.dicList.sonLaboratory = res.data['åå®éªå®¤'] |
| | | // this.dicList.unit = res.data['åä½'] |
| | | // this.dicList.inspectionItemType = res.data['æ£éªé¡¹ç±»å'] |
| | | // this.dicList.inspectionValueType = res.data['æ£éªå¼ç±»å'] |
| | | // this.dicList.bsm = res.data['æ¯å¦'] |
| | | // }) |
| | | }, |
| | | saveOrEnit() { |
| | | console.log('this.addOrupdateForm', this.addOrupdateForm.sample); |
| | | let flag = true |
| | | this.$refs['addOrupdateForm'].validate((valid) => { |
| | | if (valid) { |
| | | flag = false |
| | | return false |
| | | } |
| | | }); |
| | | if(flag) return |
| | | if(this.addOrupdateForm.sample != null && this.addOrupdateForm.sample != '' && this.addOrupdateForm.sample != undefined ) { |
| | | if(this.addOrupdateForm.sample.length > 0) { |
| | | this.addOrupdateForm.sample = JSON.stringify(this.addOrupdateForm.sample) |
| | | }else{ |
| | | this.addOrupdateForm.sample = '[]' |
| | | } |
| | | }else{ |
| | | this.addOrupdateForm.sample = '[]' |
| | | } |
| | | |
| | | // 1æ¯æ°å¢ |
| | | if(this.addOrUpdate == 1) { |
| | | this.addOrupdateForm.method = JSON.stringify(this.addOrupdateForm.method) |
| | | addItemParameter(this.addOrupdateForm).then(res => { |
| | | if(res.code == 200) { |
| | | this.$message.success('æ°å¢æå') |
| | | this.refreshTable() |
| | | this.handleClose() |
| | | this.dialogVisible = false |
| | | } else { |
| | | // æ¥é å°è½¬æ¢çmethod 以å sample 转æ¢åæ¥ |
| | | this.addOrupdateForm.method = JSON.parse(this.addOrupdateForm.method) |
| | | this.addOrupdateForm.sample = JSON.parse(this.addOrupdateForm.sample) |
| | | this.$message.error(res.message) |
| | | } |
| | | }) |
| | | }else{ |
| | | this.addOrupdateForm.method = JSON.stringify(this.addOrupdateForm.method) |
| | | upItemParameter(this.addOrupdateForm).then(res => { |
| | | if(res.code == 200) { |
| | | this.$message.success('ç¼è¾æå') |
| | | this.refreshTable() |
| | | this.handleClose() |
| | | this.dialogVisible = false |
| | | } else { |
| | | // æ¥é å°è½¬æ¢çmethod 以å sample 转æ¢åæ¥ |
| | | this.addOrupdateForm.method = JSON.parse(this.addOrupdateForm.method) |
| | | this.addOrupdateForm.sample = JSON.parse(this.addOrupdateForm.sample) |
| | | this.$message.error(res.message) |
| | | } |
| | | }) |
| | | } |
| | | }, |
| | | handleClose() { |
| | | this.dialogVisible = false |
| | | this.addOrupdateForm = { |
| | | inspectionItem: '', |
| | | inspectionItemEn: '', |
| | | inspectionItemSubclass: '', |
| | | inspectionItemSubclassEn: '', |
| | | sample: null, |
| | | price: '', |
| | | laboratory: '', |
| | | sonLaboratory: '', |
| | | askTell: '', |
| | | ask: '', |
| | | unit: '', |
| | | manHour: '', |
| | | manDay: '', |
| | | manHourGroup: '', |
| | | inspectionItemType: '', |
| | | inspectionValueType: '', |
| | | dic: '', |
| | | bsm: '', |
| | | templateId: '', |
| | | inspectionItemClass: '', |
| | | inspectionItemClassEn: '', |
| | | method: null |
| | | } |
| | | this.$refs['addOrupdateForm'].resetFields(); |
| | | this.addOrUpdate = '' |
| | | }, |
| | | 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 == 201) { |
| | | this.$message.error(response.message) |
| | | return |
| | | } |
| | | this.$message.success('ä¸ä¼ æå') |
| | | this.standardList = [] |
| | | this.productList = [] |
| | | this.refreshTable() |
| | | }, |
| | | onError(err, file, fileList) { |
| | | this.$message.error('ä¸ä¼ 失败') |
| | | this.$refs.upload.clearFiles() |
| | | this.uploading = false |
| | | }, |
| | | beforeUpload(file, fileList) { |
| | | if (file.raw.type != 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet') { |
| | | this.$message.error('ä¸ä¼ æä»¶æ ¼å¼ä¸æ£ç¡®'); |
| | | this.$refs.upload.clearFiles() |
| | | return false; |
| | | } |
| | | }, |
| | | selectorSwitch(radio) { |
| | | if (this.radio === '0') { |
| | | this.showItemParameter = true; |
| | | this.showTestObject = false; |
| | | this.selectTestObjectByName() |
| | | /* this.$nextTick(() => { |
| | | this.$refs.itemParameterTable.selectList() |
| | | }) */ |
| | | } else { |
| | | this.showTestObject = true; |
| | | this.showItemParameter = false; |
| | | } |
| | | }, |
| | | refreshTable() { |
| | | this.itemParameterData.entity.inspectionItem = this.itemParameterForm.inspectionItem |
| | | this.itemParameterData.entity.inspectionItemSubclass = this.itemParameterForm.inspectionItemSubclass |
| | | this.itemParameterData.entity.sample = this.itemParameterForm.sample |
| | | if (this.radio === '0') { |
| | | // this.$refs['itemParameterTable'].selectList() |
| | | } else { |
| | | // this.$refs['testObjectTable'].selectList() |
| | | } |
| | | }, |
| | | refresh() { |
| | | this.itemParameterData.entity = this.HaveJson(this.itemParameterEntityCopy) |
| | | this.testObjectData.entity = this.HaveJson(this.testObjectDataEntityCopy) |
| | | this.upIndex++ |
| | | }, |
| | | openAdd(row) { |
| | | //0代表æ£éªåæ°tab |
| | | if (this.radio === '0') { |
| | | // this.$refs.itemParameterTable.openAddDia(this.$api.capacityScope.addItemParameter); |
| | | if(!row) { |
| | | this.addOrUpdate = 1 |
| | | }else{ |
| | | if(typeof row.sample == 'string') { |
| | | row.sample = JSON.parse(row.sample) |
| | | } |
| | | this.addOrUpdate = '' |
| | | this.addOrupdateForm = JSON.parse(JSON.stringify(row)) |
| | | } |
| | | this.dialogVisible = true |
| | | } else { |
| | | // this.$refs.testObjectTable.openAddDia(this.$api.capacityScope.addTestObject); |
| | | } |
| | | }, |
| | | selectDocUnit() { |
| | | // this.$axios.post(this.$api.enums.getDic).then(res => { |
| | | // this.dicList.dic = res.data.map(m => { |
| | | // return { |
| | | // label: m, |
| | | // value: m |
| | | // } |
| | | // }) |
| | | // }) |
| | | }, |
| | | obtainItemParameterList() { |
| | | obtainItemParameterList().then(res => { |
| | | let data = [] |
| | | let data0 = [] |
| | | res.data.forEach(a => { |
| | | data.push({ |
| | | label: a.laboratoryName, |
| | | value: a.id |
| | | }) |
| | | data0.push({ |
| | | label: a.laboratoryName, |
| | | value: a.laboratoryName |
| | | }) |
| | | }) |
| | | // this.itemParameterData.selectField.laboratory.select = data0 |
| | | // this.itemParameterData.tagField.laboratory.select = data0 |
| | | this.testObjectData.selectField.laboratoryId.select = data |
| | | this.testObjectData.tagField.laboratoryId.select = data |
| | | this.laboratory = data |
| | | }) |
| | | }, |
| | | selectStandardMethods() { |
| | | selectStandardMethods().then(res => { |
| | | let data = [] |
| | | res.data.forEach(a => { |
| | | data.push({ |
| | | label: a.code, |
| | | value: a.code |
| | | }) |
| | | }) |
| | | this.dicList.method = data |
| | | }) |
| | | }, |
| | | selectTestObjectByName() { |
| | | getItemTree().then(res => { |
| | | res.data.forEach(a=>{ |
| | | this.cascaderFieldData(a) |
| | | }) |
| | | this.itemParameterData.cascaderField.sample.tree = res.data |
| | | this.tree = res.data |
| | | }) |
| | | }, |
| | | cascaderFieldData(val){ |
| | | if(val.children === undefined) { |
| | | return |
| | | }else if(val.children.length==0){[ |
| | | delete val.children |
| | | ]}else{ |
| | | val.children.forEach(a=>{ |
| | | this.cascaderFieldData(a) |
| | | }) |
| | | } |
| | | }, |
| | | getStandardTemplate() { |
| | | // this.$axios.get(this.$api.StandardTemplate.getStandardTemplate).then(res => { |
| | | // let data = [] |
| | | // res.data.forEach(a => { |
| | | // data.push({ |
| | | // label: a.name, |
| | | // value: a.id, |
| | | // type: 'success' |
| | | // }) |
| | | // }) |
| | | // // this.itemParameterData.selectField.templateId.select = data |
| | | // // this.itemParameterData.tagField.templateId.select = data |
| | | // this.dicList.templateId = data |
| | | // }) |
| | | }, |
| | | upProduct(row) { |
| | | this.productData.entity.objectId = row.id |
| | | this.diaProduct = true |
| | | }, |
| | | openAdd2(){ |
| | | // this.$refs.productData.openAddDia(this.$api.capacityScope.addProduct, {objectId: this.productData.entity.objectId}); |
| | | }, |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | .title { |
| | | height: 40px; |
| | | line-height: 40px; |
| | | margin-bottom: 10px; |
| | | } |
| | | </style> |