123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149 |
- <template>
- <view>
- <view style="display: flex;justify-content: space-around;">
- <uni-forms ref="form" :modelValue="formData" >
- <uni-forms-item label="隔离点" name="IsolationPiontName" >
- <uni-data-select
- v-model="formData.valueIsolationPiont"
- :localdata="IsolationPiont"
- @change="changeIsolationPiont"
- :clear="false"
- ></uni-data-select>
- <!-- <input type="text" v-model="formData.IsolationPiontName" placeholder="请输入隔离点" /> -->
- </uni-forms-item>
- <uni-forms-item label="批次" name="SamplingBatch">
- <uni-data-select style="width: 100%;"
- v-model="formData.valueSamplingBatch"
- :localdata="dataSamplingBatch"
- @change="changeSamplingBatch"
- :clear="false"
- ></uni-data-select>
- </uni-forms-item>
- </uni-forms>
- <button @click="search()" style="margin: 10rpx;background-color: #1296db;color: white;text-align: center;">搜索</button>
- </view>
- <view>
- <text style="margin: 60rpx 60rpx;font-weight: bold;font-size: 40rpx;">样品列表</text>
- <ul class="samList-ul">
- <li class="samList-li" v-for="data in sampleList" :key="data.id">
- <span>{{data.name}}</span>
- <span style="width: 30%;text-align: right;" v-if="data.state==2||data.state==1">已检测</span>
- <span v-else style="width: 30%;">
- <uni-data-select
- v-model="data.value"
- :localdata="range"
- @change="change()"
- :clear="false"
- ></uni-data-select>
- </span>
- </li>
- </ul>
- </view>
- <view class="btn-box" style="position: fixed;bottom: 10%;width: 100%;">
- <button @click="submitF()" style="margin: 20rpx 40rpx;background-color: #1296db;color: #ffffff;" >提交</button>
- </view>
- </view>
- </template>
- <script>
- import { getSampleList,getIsolationpointsList,addResult } from "../../api/sampling.js"
- export default {
- data() {
- return {
- formData: {
- valueIsolationPiont:'',
- valueSamplingBatch:''
- },
- sampleList:[
- ],
- range: [
- { value: 1, text: "合格" },
- { value: 2, text: "不合格" },
- ],
- IsolationPiont:[],
- dataSamplingBatch:[
- { value: 1, text: "第一批" },
- { value: 2, text: "第二批" },
- { value: 3, text: "第三批" }
- ],
- };
- },
- methods:{
- search(){
- console.log(this.formData)
- getSampleList(this.formData).then(res=>{
- this.sampleList = res
- for(let i = 0 ;i<this.sampleList.length;i++){
- this.sampleList[i].value = this.sampleList.state
- }
- })
- },
- change(e,data) {
- console.log("e:", e)
- },
- changeIsolationPiont(e){
- console.log("e:", e);
- },
- changeSamplingBatch(e){
- console.log("e:", e);
- },
- submitF(){
- console.log(this.sampleList)
- for(let i = 0 ; i< this.sampleList.length;i++){
- if(this.sampleList[i].value===undefined){
- this.$delete(this.sampleList[i],"value")
- }else{
- this.sampleList[i].state = this.sampleList[i].value
- this.$delete(this.sampleList[i],"value")
- }
- }
- console.log(this.sampleList)
- const data={
- IsolationPiont:this.formData.valueIsolationPiont,
- SamplingBatch:this.formData.valueSamplingBatch,
- SampleList:this.sampleList
- }
- addResult(data).then(res=>{
- console.log(res)
- })
- }
- },
- onLoad() {
- getIsolationpointsList().then(res=>{
- // console.log(res.data)
- const arr = res.map(item=>{
- return {"text":item.IsolationPiontName,"value":item.Code}
- })
- console.log(arr)
- this.IsolationPiont = arr
- // console.log("a",this.IsolationPiont)
- })
- }
- }
- </script>
- <style>
- page{
- background-color: #Faf8f8;
- }
- </style>
- <style lang="scss" scoped>
- /deep/ .uni-forms-item{
- display: flex;
- align-items: center;
- margin: 0 40rpx;
- font-size: 35rpx;
- }
- /deep/ .uni-forms{
- flex-grow: 1;
- }
- .samList-ul{
- margin: 20rpx 40rpx;
- background-color: white;
- padding: 20rpx;
- line-height: 100rpx;
- }
- .samList-li{
- display: flex;
- justify-content: space-between;
- }
- </style>
|