<template>
  <div>

    <el-form :model="filterQuery" label-width="120px" ref="dataForm">
      <el-row type="flex">
        <el-col :span="11" class="el-col">
          <el-form-item label="医疗目录编码:" prop="medCatalogCode">
            <el-input style="width: 90%" size="small" placeholder="医疗目录编码"
                      disabled
                      v-model.trim="filterQuery.medCatalogCode"
            ></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="11" class="el-col">
          <el-form-item label="单味药名称:" prop="herbName">
            <el-input style="width: 90%" size="small" placeholder="单味药名称"
                      disabled
                      v-model.trim="filterQuery.herbName"
            ></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row type="flex">
        <el-col :span="11" class="el-col">
          <el-form-item label="单复方标志:" prop="compFlag">
            <el-input style="width: 90%" size="small"  placeholder="单复方标志"
                      disabled
                      v-model.trim="filterQuery.compFlag"
            ></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="11" class="el-col">
          <el-form-item label="质量等级:" prop="qualityGrade">
            <el-input style="width: 90%" size="small" placeholder="质量等级"
                      disabled
                      v-model.trim="filterQuery.qualityGrade"
            ></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row type="flex">
        <el-col :span="11" class="el-col">
          <el-form-item label="中草药年份:" prop="herbYear">
            <el-input style="width: 90%" size="small"  placeholder="中草药年份"
                      disabled
                      v-model.trim="filterQuery.herbYear"
            ></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="11" class="el-col">
          <el-form-item label="药用部位:" prop="medPart">
            <el-input style="width: 90%" size="small" placeholder="药用部位"
                      disabled
                      v-model.trim="filterQuery.medPart"
            ></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row type="flex">
        <el-col :span="11" class="el-col">
          <el-form-item label="安全计量:" prop="safeDosage">
            <el-input style="width: 90%" size="small"  placeholder="安全计量"
                      disabled
                      v-model.trim="filterQuery.safeDosage"
            ></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="11" class="el-col">
          <el-form-item label="常规用法:" prop="usualUsage">
            <el-input style="width: 90%" size="small" placeholder="常规用法"
                      disabled
                      v-model.trim="filterQuery.usualUsage"
            ></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row type="flex">
        <el-col :span="11" class="el-col">
          <el-form-item label="性味:" prop="tasteNature">
            <el-input style="width: 90%" size="small"  placeholder="性味"
                      disabled
                      v-model.trim="filterQuery.tasteNature"
            ></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="11" class="el-col">
          <el-form-item label="药品剂型:" prop="dosageForm">
            <el-input style="width: 90%" size="small" placeholder="药品剂型"
                      disabled
                      v-model.trim="filterQuery.dosageForm"
            ></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row type="flex">
        <el-col :span="11" class="el-col">
          <el-form-item label="归经:" prop="meridianTropism">
            <el-input style="width: 90%" size="small"  placeholder="归经"
                      disabled
                      v-model.trim="filterQuery.meridianTropism"
            ></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="11" class="el-col">
          <el-form-item label="品种:" prop="variety">
            <el-input style="width: 90%" size="small" placeholder="品种"
                      disabled
                      v-model.trim="filterQuery.variety"
            ></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row type="flex">
        <el-col :span="11" class="el-col">
          <el-form-item label="开始日期:" prop="startDate">
            <el-input style="width: 90%" size="small" placeholder="开始日期"
                      disabled
                      v-model.trim="filterQuery.startDate"
            ></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="11" class="el-col">
          <el-form-item label="结束日期:" prop="endDate">
            <el-input style="width: 90%" size="small"  placeholder="结束日期"
                      disabled
                      v-model.trim="filterQuery.endDate"
            ></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row type="flex">
        <el-col :span="11" class="el-col">
          <el-form-item label="有效标志:" prop="activeMark">
            <el-input style="width: 90%" size="small" placeholder="有效标志"
                      disabled
                      v-model.trim="filterQuery.activeMark"
            ></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="11" class="el-col">
          <el-form-item label="唯一记录号:" prop="uniqueRecordNum">
            <el-input style="width: 90%" size="small"  placeholder="唯一记录号"
                      disabled
                      v-model.trim="filterQuery.uniqueRecordNum"
            ></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row type="flex">
        <el-col :span="11" class="el-col">
          <el-form-item label="数据创建时间:" prop="dataCreateTime">
            <el-input style="width: 90%" size="small" placeholder="数据创建时间"
                      disabled
                      v-model.trim="filterQuery.dataCreateTime"
            ></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="11" class="el-col">
          <el-form-item label="数据更新时间:" prop="dataUpdateTime">
            <el-input style="width: 90%" size="small"  placeholder="数据更新时间"
                      disabled
                      v-model.trim="filterQuery.dataUpdateTime"
            ></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row type="flex">

        <!--<el-col :span="11" class="el-col">-->
        <!--  <el-form-item label="版本号:" prop="versionNum">-->
        <!--    <el-input style="width: 90%" size="small" placeholder="版本号"-->
        <!--              disabled-->
        <!--              v-model.trim="filterQuery.versionNum"-->
        <!--    ></el-input>-->
        <!--  </el-form-item>-->
        <!--</el-col>-->
        <el-col :span="11" class="el-col">
          <el-form-item label="药材名称:" prop="medName">
            <el-input style="width: 90%" size="small" placeholder="药材名称"
                      disabled
                      v-model.trim="filterQuery.medName"
            ></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="11" class="el-col">
          <el-form-item label="版本名称:" prop="versionName">
            <el-input style="width: 90%" size="small"  placeholder="版本名称"
                      disabled
                      v-model.trim="filterQuery.versionName"
            ></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row type="flex">

      </el-row>
      <el-row type="flex">
        <el-col :span="11" class="el-col">
          <el-form-item label="功能主治:" prop="mainFunction">
            <el-input style="width: 90%" size="small"  placeholder="功能主治"
                      disabled
                      v-model.trim="filterQuery.mainFunction"
            ></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="11" class="el-col">
          <el-form-item label="炮制方法:" prop="processingMethod">
            <el-input style="width: 90%" size="small" placeholder="炮制方法"
                      disabled
                      v-model.trim="filterQuery.processingMethod"
            ></el-input>
          </el-form-item>
        </el-col>
      </el-row>

      <el-row type="flex">
        <el-col :span="11" class="el-col">
          <el-form-item label="功效分类:" prop="efficacyCategory">
            <el-input style="width: 90%" size="small"  placeholder="功效分类"
                      disabled
                      v-model.trim="filterQuery.efficacyCategory"
            ></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="11" class="el-col">
          <el-form-item label="药材种来源:" prop="medSource">
            <el-input style="width: 90%" size="small" placeholder="药材种来源"
                      disabled
                      v-model.trim="filterQuery.medSource"
            ></el-input>
          </el-form-item>
        </el-col>
      </el-row>

      <el-row type="flex">
        <el-col :span="11" class="el-col">
          <el-form-item label="国家医保支付政策:" prop="nationalInsurancePolicy">
            <el-input style="width: 90%" size="small"  placeholder="国家医保支付政策"
                      disabled
                      v-model.trim="filterQuery.nationalInsurancePolicy"
            ></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="11" class="el-col">
          <el-form-item label="省级医保支付政策:" prop="provincialInsurancePolicy">
            <el-input style="width: 90%" size="small" placeholder="省级医保支付政策"
                      disabled
                      v-model.trim="filterQuery.provincialInsurancePolicy"
            ></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row type="flex">
        <el-col :span="11" class="el-col">
          <el-form-item label="标准名称:" prop="standardName">
            <el-input style="width: 90%" size="small"  placeholder="标准名称"
                      disabled
                      v-model.trim="filterQuery.standardName"
            ></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="11" class="el-col">
          <el-form-item label="标准页码:" prop="standardPage">
            <el-input style="width: 90%" size="small" placeholder="标准页码"
                      disabled
                      v-model.trim="filterQuery.standardPage"
            ></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row type="flex">
        <el-col :span="11" class="el-col">
          <el-form-item label="标准电子档案:" prop="standardFile">
            <el-input style="width: 90%" size="small"  placeholder="标准电子档案"
                      disabled
                      v-model.trim="filterQuery.standardFile"
            ></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="11" class="el-col">
          <el-form-item label="下发标志:" prop="releaseMark">
            <el-input style="width: 90%" size="small" placeholder="下发标志"
                      disabled
                      v-model.trim="filterQuery.releaseMark"
            ></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <!--<el-row type="flex">-->
      <!--  <el-col :span="11" class="el-col">-->
      <!--    <el-form-item label="传输数据ID:" prop="transferDataId">-->
      <!--      <el-input style="width: 90%" size="small"  placeholder="传输数据ID"-->
      <!--                disabled-->
      <!--                v-model.trim="filterQuery.transferDataId"-->
      <!--      ></el-input>-->
      <!--    </el-form-item>-->
      <!--  </el-col>-->
      <!--</el-row>-->
      <el-row type="flex">
        <el-col :span="11" class="el-col">
          <el-form-item label="生效时间:" prop="effectiveTime">
            <el-input style="width: 90%" size="small" placeholder="生效时间"
                      disabled
                      v-model.trim="filterQuery.effectiveTime"
            ></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="11" class="el-col">
          <el-form-item label="失效时间:" prop="expiryTime">
            <el-input style="width: 90%" size="small"  placeholder="失效时间"
                      disabled
                      v-model.trim="filterQuery.expiryTime"
            ></el-input>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>

  </div>
</template>
<script>
import { delReceive } from '@/api/thrsys/thrOrderReceive'
import {
  getHead, executeFuc
} from '@/utils/customConfig'
import { chDrugList, deleteChDrug } from '@/api/thrsys/medicalSupplies'

export default {
  props: {
    rowData: {
      type: Object,
      required: true,
    },
  },
  data() {
    return {
      defaultSort: { prop: 'createTime', order: 'desc' },
      showSearch: true,
      filterQuery: {
        medCatalogCode: '',
        tradeName: '',
        genericNum: '',
        genericName: '',
        page: 1,
        limit: 10
      },
      invList: [],
      formName: null,
      formMap: {
        add: '新增领用单据',
        update: '编辑领用单据'
      },
      statusMap: {
        1: '草稿',
        2: '未审核',
        3: '已审核',
        4: '已拒绝'
      },
      total: 0,
      tableHeader: [],
      queryList: [],
      fromList: [],
      options: {
        finCurInv: [],
        finCorpList: []
      },
      thirdSys: [],
      thirdSysDetail: null,
      busTypes: [],
      originTypes: [],
      list: [],
      detailList: [],
      uploadFileUrl: null,
      fileList: [],
      uploadData: {
        thirdSys: 'thirdId'
      },
      invCodebe: null,
      closeConfirm: false,
      loading: false,
      actDateRange: [],
      newSpDistributionVisible: false,
      pickerOptions: {
        shortcuts: [
          {
            text: '最近一周',
            onClick(picker) {
              const end = new Date()
              const start = new Date()
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 7)
              picker.$emit('pick', [start, end])
            }
          },
          {
            text: '最近一个月',
            onClick(picker) {
              const end = new Date()
              const start = new Date()
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 30)
              picker.$emit('pick', [start, end])
            }
          },
          {
            text: '最近三个月',
            onClick(picker) {
              const end = new Date()
              const start = new Date()
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 90)
              picker.$emit('pick', [start, end])
            }
          }
        ]
      },
      productType: null
    }
  },

  methods: {
    onReset() {
      this.$router.push({
        path: ''
      })
      this.filterQuery = {
        medCatalogCode: '',
        tradeName: '',
        genericNum: '',
        genericName: '',
        page: 1,
        limit: 10
      }
      this.getList()
    },

    onSubmitFind() {
      this.filterQuery.page = 1
      this.getList()
    },
    getList() {
      chDrugList(this.filterQuery)
        .then((response) => {
          if (response.code == 20000) {
            this.list = response.data.list || []
            this.total = response.data.total || 0
          } else {
            this.$message.error(response.message)
          }
        })
        .catch(() => {
          this.list = []
          this.total = 0
        })
    },

    handleDetail(_this,row) {
      _this.newSpDistributionVisible = true
    },
    hideSearch() {
      this.showSearch = !this.showSearch
    },
    deleteClick(_this,row) {
      _this.$confirm("此操作将永久删除该药品, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          deleteChDrug(row).then(res => {
            if (res.code == 20000){
              _this.$message.success("success")
              _this.getList()
            }else {
              _this.$message.error("删除失败")
            }
          })
        })
        .catch(() => {
        });
    },

    handleCurrentChange(val) {
      this.filterQuery.page = val.page
      this.getList()
    },
    closeDialog() {
      this.newSpDistributionVisible = false
      this.getList()
      this.detailList = []
    },
    executeFuc(row, type, clickFuc, value) {
      return executeFuc(this, row, type, clickFuc, value)
    },
    executeEval(row, expression, defaultRet) {
      if (expression) {
        return eval(expression)
      }
      return defaultRet
    }
  },
  components: {},
  mounted() {
  },
  created() {
    this.filterQuery = this.rowData
    this.getList()
    getHead('pharmaceuticals-1', '1').then((re) => {
      // 处理返回的数据
      console.log("res",re.data)
      this.tableHeader = re.data.tableList
      this.queryList = re.data.queryList;

    })

  }
}
</script>
<style scoped>
.itemTag {
  float: left;
  text-align: left;
  margin-top: 10px;
  width: 25%;
}

.text {
  font-size: 13px;
  font-family: "Microsoft YaHei";
}


.el-row {
  display: flex;
  flex-wrap: wrap;
}

.el-col {
  border-radius: 4px;
  flex-wrap: wrap;
}
</style>

