274 lines
		
	
	
		
			8.2 KiB
		
	
	
	
		
			Plaintext
		
	
	
			
		
		
	
	
			274 lines
		
	
	
		
			8.2 KiB
		
	
	
	
		
			Plaintext
		
	
	
<template>
 | 
						|
  <div style="position: relative">
 | 
						|
    <el-button
 | 
						|
      size="mini"
 | 
						|
      type="primary"
 | 
						|
      style="position: absolute;right: 10px;top: 15px"
 | 
						|
      @click="handleAdd"
 | 
						|
    >
 | 
						|
      配置
 | 
						|
    </el-button>
 | 
						|
    <el-form  size="small" :inline="true"  label-width="110px">
 | 
						|
      <el-divider content-position="left">阅片问题</el-divider>
 | 
						|
      <el-form-item label="评估更新类型" style="width: 100%">
 | 
						|
      </el-form-item>
 | 
						|
      <el-table
 | 
						|
        v-loading="loading"
 | 
						|
        style="width: 100%"
 | 
						|
        :data="list"
 | 
						|
        stripe
 | 
						|
      >
 | 
						|
        <el-table-column
 | 
						|
          prop=""
 | 
						|
          label="序号"
 | 
						|
          width="50"
 | 
						|
        >
 | 
						|
          <template slot-scope="scope">
 | 
						|
            {{scope.$index + 1}}
 | 
						|
          </template>
 | 
						|
        </el-table-column>
 | 
						|
        <el-table-column
 | 
						|
          prop="ValueCN"
 | 
						|
          label="中文值"
 | 
						|
          show-overflow-tooltip
 | 
						|
        >
 | 
						|
        </el-table-column>
 | 
						|
        <el-table-column
 | 
						|
          prop="Value"
 | 
						|
          label="英文值"
 | 
						|
          show-overflow-tooltip
 | 
						|
        >
 | 
						|
        </el-table-column>
 | 
						|
        <el-table-column
 | 
						|
          prop="IsBaseLineUse"
 | 
						|
          label="是否基线评估"
 | 
						|
          show-overflow-tooltip
 | 
						|
        >
 | 
						|
          <template slot-scope="scope">
 | 
						|
            <!--              <el-switch-->
 | 
						|
            <!--                @change="(v) => {BaseLineUseChange(v, scope.row)}"-->
 | 
						|
            <!--                v-model="scope.row.IsBaseLineUse"-->
 | 
						|
            <!--              >-->
 | 
						|
            <!--              </el-switch>-->
 | 
						|
            <el-tag v-if="scope.row.IsBaseLineUse" type="primary">{{ $fd('YesOrNo', scope.row.IsBaseLineUse) }}</el-tag>
 | 
						|
            <el-tag v-else type="danger">{{ $fd('YesOrNo', scope.row.IsBaseLineUse) }}</el-tag>
 | 
						|
          </template>
 | 
						|
        </el-table-column>
 | 
						|
        <el-table-column
 | 
						|
          prop="IsFollowVisitUse"
 | 
						|
          label="是否随访评估"
 | 
						|
          show-overflow-tooltip
 | 
						|
        >
 | 
						|
          <template slot-scope="scope">
 | 
						|
            <!--              <el-switch-->
 | 
						|
            <!--                @change="(v) => {FollowVisitUseChange(v, scope.row)}"-->
 | 
						|
            <!--                v-model="scope.row.IsFollowVisitUse"-->
 | 
						|
            <!--              >-->
 | 
						|
            <!--              </el-switch>-->
 | 
						|
            <el-tag v-if="scope.row.IsFollowVisitUse" type="primary">{{ $fd('YesOrNo', scope.row.IsFollowVisitUse) }}</el-tag>
 | 
						|
            <el-tag v-else type="danger">{{ $fd('YesOrNo', scope.row.IsFollowVisitUse) }}</el-tag>
 | 
						|
            <!--              <span>{{$fd('YesOrNo', scope.row.IsFollowVisitUse)}}</span>-->
 | 
						|
          </template>
 | 
						|
        </el-table-column>
 | 
						|
      </el-table>
 | 
						|
    </el-form>
 | 
						|
    <base-model
 | 
						|
      :config="config"
 | 
						|
    >
 | 
						|
      <template slot="dialog-body">
 | 
						|
        <el-form  size="small" :inline="true"  label-width="110px">
 | 
						|
          <el-form-item label="评估更新类型" style="width: 100%">
 | 
						|
          </el-form-item>
 | 
						|
          <el-table
 | 
						|
            v-loading="loading"
 | 
						|
            ref="multipleTable"
 | 
						|
            :data="$d.GlobalAssessType"
 | 
						|
            stripe
 | 
						|
            @selection-change="handleSelectionChange"
 | 
						|
          >
 | 
						|
            <el-table-column
 | 
						|
              type="selection"
 | 
						|
              width="55">
 | 
						|
            </el-table-column>
 | 
						|
            <el-table-column
 | 
						|
              prop="raw.ValueCN"
 | 
						|
              label="中文值"
 | 
						|
              show-overflow-tooltip
 | 
						|
            >
 | 
						|
            </el-table-column>
 | 
						|
            <el-table-column
 | 
						|
              prop="raw.Value"
 | 
						|
              label="英文值"
 | 
						|
              show-overflow-tooltip
 | 
						|
            >
 | 
						|
            </el-table-column>
 | 
						|
            <el-table-column
 | 
						|
              prop="IsBaseLineUse"
 | 
						|
              label="是否基线评估"
 | 
						|
              show-overflow-tooltip
 | 
						|
            >
 | 
						|
              <template slot-scope="scope">
 | 
						|
                <el-switch
 | 
						|
                  v-model="scope.row.IsBaseLineUse"
 | 
						|
                  @change="() => $forceUpdate()"
 | 
						|
                >
 | 
						|
                </el-switch>
 | 
						|
                <span>{{$fd('YesOrNo', scope.row.IsBaseLineUse)}}</span>
 | 
						|
              </template>
 | 
						|
            </el-table-column>
 | 
						|
            <el-table-column
 | 
						|
              prop="IsFollowVisitUse"
 | 
						|
              label="是否随访评估"
 | 
						|
              show-overflow-tooltip
 | 
						|
            >
 | 
						|
              <template slot-scope="scope">
 | 
						|
                <el-switch
 | 
						|
                  v-model="scope.row.IsFollowVisitUse"
 | 
						|
                  @change="() => $forceUpdate()"
 | 
						|
                >
 | 
						|
                </el-switch>
 | 
						|
                <span>{{$fd('YesOrNo', scope.row.IsFollowVisitUse)}}</span>
 | 
						|
              </template>
 | 
						|
            </el-table-column>
 | 
						|
          </el-table>
 | 
						|
        </el-form>
 | 
						|
      </template>
 | 
						|
      <template slot="dialog-footer">
 | 
						|
        <el-button :disabled="loading" size="small" type="primary" @click="config.visible = false">取消</el-button>
 | 
						|
        <el-button size="small" type="primary" :loading="loading" @click="handleSave">保存</el-button>
 | 
						|
      </template>
 | 
						|
    </base-model>
 | 
						|
  </div>
 | 
						|
</template>
 | 
						|
 | 
						|
<script>
 | 
						|
import BaseModel from '@/components/BaseModel'
 | 
						|
import { getAssessType, setAssessType, setDictionaryBaseLineUse, setDictionaryFollowVisitUse } from '@/api/dictionary'
 | 
						|
export default {
 | 
						|
  props: {
 | 
						|
    criterionId: {
 | 
						|
      type: String,
 | 
						|
      required: true
 | 
						|
    }
 | 
						|
  },
 | 
						|
  components: { BaseModel },
 | 
						|
  data() {
 | 
						|
    return {
 | 
						|
      list: [],
 | 
						|
      total: 0,
 | 
						|
      loading: false,
 | 
						|
      rowData: {},
 | 
						|
      activeName: '0',
 | 
						|
      addOrEdit: { visible: false, title: '' },
 | 
						|
      preview: { visible: false, title: 'eCRF预览' },
 | 
						|
      config: { visible: false, title: '评估更新类型', appendToBody: true, width: '600px', configType: 0 },
 | 
						|
      selectedList: []
 | 
						|
    }
 | 
						|
  },
 | 
						|
  beforecreate() {
 | 
						|
    this.$d.GlobalAssessType.forEach(v => {
 | 
						|
      v.IsBaseLineUse = false
 | 
						|
      v.IsFollowVisitUse = false
 | 
						|
    })
 | 
						|
  },
 | 
						|
  mounted() {
 | 
						|
    this.getList()
 | 
						|
  },
 | 
						|
  methods: {
 | 
						|
    FollowVisitUseChange(v, row) {
 | 
						|
      this.loading = true
 | 
						|
      setDictionaryFollowVisitUse({Id:row.Id, IsFollowVisitUse: v}).then(res => {
 | 
						|
        this.$message.success('保存成功')
 | 
						|
        this.loading = false
 | 
						|
      }).catch(() => {
 | 
						|
        this.loading = false
 | 
						|
      })
 | 
						|
    },
 | 
						|
    BaseLineUseChange(v, row) {
 | 
						|
      this.loading = true
 | 
						|
      setDictionaryBaseLineUse({Id:row.Id, isBaseLineUse: v}).then(res => {
 | 
						|
        this.$message.success('保存成功')
 | 
						|
        this.loading = false
 | 
						|
      }).catch(() => {
 | 
						|
        this.loading = false
 | 
						|
      })
 | 
						|
    },
 | 
						|
    toggleSelection(rows) {
 | 
						|
      console.log(this.$refs.multipleTable)
 | 
						|
      if (rows) {
 | 
						|
        rows.forEach(row => {
 | 
						|
          this.$refs.multipleTable.toggleRowSelection(row);
 | 
						|
        });
 | 
						|
      } else {
 | 
						|
        this.$refs.multipleTable.clearSelection();
 | 
						|
      }
 | 
						|
    },
 | 
						|
    handleSelectionChange(val) {
 | 
						|
      this.selectedList = val
 | 
						|
    },
 | 
						|
    getList() {
 | 
						|
      this.loading = true
 | 
						|
      getAssessType({
 | 
						|
        CriterionId: this.criterionId,
 | 
						|
        ParentCode: 'GlobalAssessType'
 | 
						|
      }).then(res => {
 | 
						|
        this.loading = false
 | 
						|
        this.list = res.Result
 | 
						|
        console.log(this.$d.GlobalAssessType)
 | 
						|
      })
 | 
						|
    },
 | 
						|
    handleAdd() {
 | 
						|
      this.config.visible = true
 | 
						|
      this.$nextTick(() => {
 | 
						|
        var a = this.$d.GlobalAssessType.filter(v => {
 | 
						|
          return !!this.list.find(v1 => {
 | 
						|
            return v1.DictionaryId === v.id
 | 
						|
          })
 | 
						|
        })
 | 
						|
        a.forEach(v => {
 | 
						|
          this.list.forEach(v1 => {
 | 
						|
            if (v1.DictionaryId === v.id) {
 | 
						|
              this.$set(v, 'IsBaseLineUse', v1.IsBaseLineUse)
 | 
						|
              this.$set(v, 'IsFollowVisitUse', v1.IsFollowVisitUse)
 | 
						|
              this.$forceUpdate()
 | 
						|
            }
 | 
						|
          })
 | 
						|
        })
 | 
						|
        this.toggleSelection(a)
 | 
						|
      })
 | 
						|
    },
 | 
						|
    handleSave() {
 | 
						|
      this.loading = true
 | 
						|
      var params = {
 | 
						|
        CriterionId: this.criterionId,
 | 
						|
        ParentCode: 'GlobalAssessType',
 | 
						|
        DictionaryList: this.selectedList.map(v => {
 | 
						|
          return {
 | 
						|
            dictionaryId: v.id,
 | 
						|
            IsBaseLineUse: v.IsBaseLineUse,
 | 
						|
            IsFollowVisitUse: v.IsFollowVisitUse,
 | 
						|
          }
 | 
						|
        }),
 | 
						|
      }
 | 
						|
      setAssessType(params).then(res => {
 | 
						|
        this.loading = false
 | 
						|
        this.$message.success('保存成功')
 | 
						|
        this.config.visible = false
 | 
						|
        this.selectedList = []
 | 
						|
        this.getList()
 | 
						|
      }).catch(() => {
 | 
						|
      })
 | 
						|
    },
 | 
						|
    handleDelete() {
 | 
						|
 | 
						|
    }
 | 
						|
  }
 | 
						|
}
 | 
						|
</script>
 | 
						|
 | 
						|
<style scoped>
 | 
						|
>>>.el-form-item__content{
 | 
						|
  width: calc(100% - 110px);
 | 
						|
}
 | 
						|
</style>
 |