<template>
  <div class="app-container">
    <el-form
      :model="queryParams"
      ref="queryForm"
      :inline="true"
      v-show="showSearch"
      label-width="68px"
    >
      <div class="query-box">
        <div class="query-box__left">
          <el-form-item label="" prop="yljgId">
            <el-select
              style="width:160px"
              v-model="queryParams.yljgId"
              placeholder="请选择医疗机构"
            >
              <el-option
                v-for="item in listMedicalMechanismArr"
                :key="item.id"
                :value="item.id"
                :label="item.name"
                :disabled="item.state == 1 ? false : true"
              ></el-option>
            </el-select>
          </el-form-item>

          <el-form-item label="" prop="preNo">
            <el-input
              style="width:160px"
              v-model="queryParams.preNo"
              placeholder="请输入处方号"
              clearable
              size="small"
              @keyup.enter.native="handleQuery"
            />
          </el-form-item>

          <el-form-item label="" prop="name">
            <el-input
              style="width:160px"
              v-model="queryParams.name"
              placeholder="请输入患者姓名"
              clearable
              size="small"
              @keyup.enter.native="handleQuery"
            />
          </el-form-item>

          <el-form-item label="" prop="prescriptionTime">
            <el-date-picker
              style="width:160px"
              clearable
              size="small"
              v-model="queryParams.prescriptionTime"
              type="date"
              value-format="yyyy-MM-dd"
              placeholder="选择开方时间"
            >
            </el-date-picker>
          </el-form-item>

          <el-form-item label="" prop="state">
            <el-select v-model="queryParams.state" placeholder="请选择处方状态"
              style="width:160px">
              <el-option
                v-for="item in stateArr"
                :key="item.id"
                :value="item.id"
                :label="item.name"
              ></el-option>
            </el-select>
          </el-form-item>
          <el-form-item>
            <el-button
              type="primary"
              icon="el-icon-search"
              size="mini"
              @click="handleQuery"
              >搜索</el-button
            >
            <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
              >重置</el-button
            >
          </el-form-item>
        </div>
      </div>
    </el-form>


    <el-table
      v-loading="loading"
      :data="prescriptionCoreList"
      @selection-change="handleSelectionChange"
      border
      size="mini"
    >
      <el-table-column type="index" width="55" align="center" label="序号"/>
      <el-table-column label="处方号" align="center" prop="preNo" />
      <el-table-column label="医疗机构" align="center" prop="yljgId" />
      <el-table-column label="门诊/住院" align="center" prop="premzzy">
        <template slot-scope="scope">{{scope.row.preMzZy==1?'门诊':'住院'}}</template>
      </el-table-column>
      <el-table-column label="患者姓名" align="center" prop="name" />
      <el-table-column label="性别" align="center" prop="sex" />
      <el-table-column label="临床诊断" align="center" prop="westernDisease" />
      <el-table-column label="开方医生" align="center" prop="doctor" />
      <el-table-column label="处方类型" align="center" prop="type">
        <template slot-scope="scope">
          {{ scope.row.type === 1 ? "中药处方" : "中药制剂" }}
        </template>
      </el-table-column>
      <el-table-column
        label="开方时间"
        align="center"
        prop="prescriptionTime"
        width="180"
      >
        <template slot-scope="scope">
          <span>{{
            parseTime(scope.row.prescriptionTime, "{y}-{m}-{d}")
          }}</span>
        </template>
      </el-table-column>
      <el-table-column label="溯源状态" align="center" prop="deployState">
        <template slot-scope="scope">
          <dict-tag :options="deployStateArr" :value="scope.row.deployState-1" />
        </template>
      </el-table-column>

      <el-table-column label="备注" align="center" prop="remarks" />
      <el-table-column label="审核人" align="center" prop="checkBy" />
      <el-table-column label="审核时间" align="center" prop="checkTime" />

      <el-table-column
        label="操作"
        fixed="right"
        align="center"
        class-name="small-padding fixed-width"
      >
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="primary"
            style="width: 40px"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['prescription:prescriptionCore:edit']"
            >详情</el-button
          >
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total > 0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改处方审核对话框 -->
    <el-dialog
      :title="title"
      :visible.sync="open"
      width="1280px"
      append-to-body
    >
      <div>
        <div style="display: flex; align-items: center;margin-bottom:20px;">
          <h3>处方信息</h3>
          <div style="margin: 0 0 0 30px">处方号：{{detailData.preNo}}</div>
        </div>
        <div style="display: flex; align-items: center;">
          <h3>审核状态：</h3>
          <span style="color:#fff" :class="detailData.checkState==0?'yellow-btn':detailData.checkState==1?'green-btn':detailData.checkState==2?'red-btn':''">{{detailData.checkState == 0
              ? "待审核"
              : detailData.checkState == 1
              ? "审核通过"
              : detailData.checkState == 2
              ? "审核不通过"
              : ""}}</span>
          <h3 style="margin-left:50px">审核人：</h3>
          <span>{{detailData.checkBy}}</span>
          <h3 style="margin-left:50px">审核时间：</h3>
          <span>{{detailData.checkTime}}</span>
        </div>
        <el-divider></el-divider>
        <el-row :gutter="20">
          <el-col :span="24">
            <el-descriptions title="" :column="5">
              <el-descriptions-item label="患者姓名">{{
                detailData.name
              }}</el-descriptions-item>
              <el-descriptions-item label="性别">{{
                detailData.sex
              }}</el-descriptions-item>
              <el-descriptions-item label="年龄">{{
                detailData.age
              }}</el-descriptions-item>
              <el-descriptions-item label="科室">{{
                detailData.department
              }}</el-descriptions-item>
              <el-descriptions-item label="临床诊断">
                {{detailData.disName}}-{{detailData.symName}}
              </el-descriptions-item>
              <el-descriptions-item label="开方医生">{{
                detailData.doctor
              }}</el-descriptions-item>
              <el-descriptions-item label="处方类型">{{
                detailData.type == 1 ? "中药处方" : "中药制剂"
              }}</el-descriptions-item>
              <el-descriptions-item label="发药状态">{{ detailData.fyState == 0 ? "未发药": detailData.fyState==1?'已发药' : "取消发药" }}</el-descriptions-item>
              <el-descriptions-item label="煎药方式">{{
                detailData.oralPre && detailData.oralPre.decoctingMethod
              }} <span v-if="detailData.oralPre && detailData.oralPre.decoctingMethod=='浓煎'">{{detailData.oralPre && detailData.oralPre.concentration}}</span></el-descriptions-item>

              <!-- <el-descriptions-item
                label="取药方式
              "
                >{{ detailData.takingMethod }}</el-descriptions-item
              >
              <el-descriptions-item label="处方名">{{
                detailData.preName
              }}</el-descriptions-item> -->
              <el-descriptions-item label="处方金额">{{
                detailData.type == 1
                  ? detailData.oralPre &&
                    detailData.oralPre.prescriptionTotleSum
                  : detailData.solidPre &&
                    detailData.solidPre.prescriptionTotleSum
              }}</el-descriptions-item>
              <el-descriptions-item label="剂型">{{
                detailData.oralPre && detailData.oralPre.dosageForm
              }}</el-descriptions-item>
              <el-descriptions-item label="剂数">{{
                detailData.oralPre && detailData.oralPre.number
              }}</el-descriptions-item>
              <el-descriptions-item label="代煎剂数">{{
                detailData.oralPre && detailData.oralPre.daijianNumber
              }}</el-descriptions-item>
              <el-descriptions-item label="代煎费用">{{
                detailData.oralPre && detailData.oralPre.daijianCost
              }}</el-descriptions-item>
              <el-descriptions-item label="处方用法">{{
                detailData.oralPre && detailData.oralPre.prescriptionusage
              }}</el-descriptions-item>
              <el-descriptions-item label="服药时间">{{
                detailData.oralPre && detailData.oralPre.medicationTime
              }}</el-descriptions-item>
              <el-descriptions-item label="频次">{{
                detailData.oralPre && detailData.oralPre.frequency
              }}</el-descriptions-item>
              <el-descriptions-item label="快递单号">{{
                detailData.expressCode
              }}</el-descriptions-item>
              <el-descriptions-item label="收件人">{{
                detailData.consignee
              }}</el-descriptions-item>
              <el-descriptions-item label="收货电话">{{
                detailData.contactNumber
              }}</el-descriptions-item>
              <el-descriptions-item label="配送费用">{{
                detailData.oralPre && detailData.oralPre.distributionCost
              }}</el-descriptions-item>
              <el-descriptions-item label="总金额">{{
                detailData.oralPre && detailData.oralPre.prescriptionTotleSum
              }}</el-descriptions-item>
            </el-descriptions>
            <el-descriptions>
              <el-descriptions-item label="嘱托">{{
                detailData.oralPre && detailData.oralPre.entrust
              }}</el-descriptions-item>
            </el-descriptions>
            <el-descriptions>
              <el-descriptions-item label="收货地址">{{
                detailData.address
              }}</el-descriptions-item>
            </el-descriptions>
          </el-col>
          <el-col :span="24">
            <el-table
              v-loading="loading"
              :data="detailData && detailData.oralPreItemList"
              @selection-change="handleSelectionChange"
            >
              <el-table-column type="index" width="55" align="center" />
              <el-table-column label="药品名称" align="center" prop="matName" />
              <el-table-column
                label="药品规格"
                align="center"
                prop="ypggCenter"
              />
              <el-table-column label="单位" align="center" prop="matUnitName" />
              <el-table-column label="用法" align="center" prop="matUsageName" />
              <el-table-column label="剂量" align="center" prop="matDose" />
              <el-table-column label="零售价" align="center" prop="matXsj" />
              <el-table-column label="产地" align="center" prop="matOrigin" />
              <el-table-column
                label="小计"
                align="center"
                prop="subtotalMoney"
              />
              <!-- <el-table-column label="库存数量" align="center" prop="stock" /> -->
            </el-table>
          </el-col>
        </el-row>

        <h3 style="margin: 60px 0 0 0">溯源记录</h3>
<!--        <div style="display:flex;align-items:center;margin-top:20px"><span style="color:#999;">当前状态：</span><dict-tag :options="deployStateArr" :value="detailData.deployState-1" /></div>-->
        <div style="display:flex;flex-wrap:wrap;align-items:center;margin-top:20px">
          <div style="display:flex;margin: 0 10px 5px 0" v-for="item in deployStateArr">
            <el-tag
              :key="item.id"
              class="mx-1"
              :effect="item.key===currentDepoly?'dark':'plain'"
              @click.native="handleDeploy(item)"
            >
              {{ item.name }}
            </el-tag>
            <i v-if="item.id<16" class="el-icon-d-arrow-right el-icon--right" style="display:flex;align-items:center;"></i>
          </div>
        </div>
        <el-divider></el-divider>
        <div class="deploy-record">
          <div class="deploy">
            <div class="title body">操作时间：</div>
            <div class="title body">操作模式：</div>
            <div class="title body">操作人：</div>
            <div class="title body">备注信息：</div>
          </div>
          <div class="deploy">
            <div class="body">{{ depolyStatusObj.createTime }}</div>
            <div class="body">{{ depolyStatusObj.operate }}</div>
            <div class="body">{{ depolyStatusObj.createBy }}</div>
            <div class="body">{{ depolyStatusObj.remarks }}</div>
          </div>
          <div class="deploy">
            <div class="title body">照片：</div>
          </div>
          <div class="deploy">
            <div class="body" v-if="depolyStatusObj&&depolyStatusObj.prescriptionFiles&&depolyStatusObj.prescriptionFiles.length>0&&depolyStatusObj.prescriptionFiles[0].url.length>4">
              <el-image v-for="img in depolyStatusObj.prescriptionFiles"
              style="width: 100px; height: 100px"
              :src="img.url.length>4?process.env.VUE_APP_BASE_API+img.url:''"
              fit="fill"></el-image>
            </div>
          </div>
        </div>
<!--        <el-tabs v-model="activeName" @tab-click="handleClick">-->
<!--          <el-tab-pane label="抓药记录" name="first">-->
<!--            <el-table-->
<!--              v-loading="loading"-->
<!--              :data="detailData.zy||[]"-->
<!--              @selection-change="handleSelectionChange"-->
<!--            >-->
<!--              <el-table-column type="index" width="55" align="center" />-->
<!--              <el-table-column-->
<!--                label="扫码时间"-->
<!--                align="center"-->
<!--                prop="createTime"-->
<!--              />-->
<!--              <el-table-column-->
<!--                label="操作人"-->
<!--                align="center"-->
<!--                prop="createBy"-->
<!--              />-->
<!--              <el-table-column label="照片" align="center">-->
<!--                <template slot-scope="scope"><el-image style="width:60px;height:60px" :src="scope.row.prescriptionFiles.length?$baseUrl+'/profile/ys/'+scope.row.prescriptionFiles[0].url:''" :preview-src-list="[scope.row.prescriptionFiles.length?$baseUrl+'/profile/'+scope.row.prescriptionFiles[0].url:'']"></el-image></template>-->
<!--              </el-table-column>-->
<!--              <el-table-column label="备注" align="center" prop="remarks" />-->
<!--            </el-table>-->
<!--          </el-tab-pane>-->
<!--          <el-tab-pane label="复核记录" name="second">-->
<!--            <el-table-->
<!--              v-loading="loading"-->
<!--              :data="detailData.fh||[]"-->
<!--              @selection-change="handleSelectionChange"-->
<!--            >-->
<!--              <el-table-column type="index" width="55" align="center" />-->
<!--              <el-table-column-->
<!--                label="扫码时间"-->
<!--                align="center"-->
<!--                prop="createTime"-->
<!--              />-->
<!--              <el-table-column-->
<!--                label="操作人"-->
<!--                align="center"-->
<!--                prop="createBy"-->
<!--              />-->
<!--              <el-table-column label="照片" align="center">-->
<!--                <template slot-scope="scope"><el-image style="width:60px;height:60px" :src="scope.row.prescriptionFiles.length?$baseUrl+'/profile/ys/'+scope.row.prescriptionFiles[0].url:''" :preview-src-list="[scope.row.prescriptionFiles.length?$baseUrl+'/profile/'+scope.row.prescriptionFiles[0].url:'']"></el-image></template>-->
<!--              </el-table-column>-->
<!--              <el-table-column label="备注" align="center" prop="remarks" />-->
<!--            </el-table>-->
<!--          </el-tab-pane>-->
<!--          <el-tab-pane label="浸泡记录" name="third">-->
<!--            <el-table-->
<!--              v-loading="loading"-->
<!--              :data="detailData.jp||[]"-->
<!--              @selection-change="handleSelectionChange"-->
<!--            >-->
<!--              <el-table-column type="index" width="55" align="center" />-->
<!--              <el-table-column-->
<!--                label="扫码时间"-->
<!--                align="center"-->
<!--                prop="createTime"-->
<!--              />-->
<!--              <el-table-column-->
<!--                label="操作人"-->
<!--                align="center"-->
<!--                prop="createBy"-->
<!--              />-->
<!--              <el-table-column label="照片" align="center">-->
<!--                <template slot-scope="scope"><el-image style="width:60px;height:60px" :src="scope.row.prescriptionFiles.length?$baseUrl+'/profile/ys/'+scope.row.prescriptionFiles[0].url:''" :preview-src-list="[scope.row.prescriptionFiles.length?$baseUrl+'/profile/'+scope.row.prescriptionFiles[0].url:'']"></el-image></template>-->
<!--              </el-table-column>-->
<!--              <el-table-column label="备注" align="center" prop="remarks" />-->
<!--            </el-table>-->
<!--          </el-tab-pane>-->
<!--          <el-tab-pane label="煎煮记录" name="decoct">-->
<!--            <el-table-->
<!--              v-loading="loading"-->
<!--              :data="detailData.jz||[]"-->
<!--              @selection-change="handleSelectionChange"-->
<!--            >-->
<!--              <el-table-column type="index" width="55" align="center" />-->
<!--              <el-table-column-->
<!--                label="扫码时间"-->
<!--                align="center"-->
<!--                prop="createTime"-->
<!--              />-->
<!--              <el-table-column-->
<!--                label="操作人"-->
<!--                align="center"-->
<!--                prop="createBy"-->
<!--              />-->
<!--              <el-table-column label="照片" align="center">-->
<!--                <template slot-scope="scope"><el-image style="width:60px;height:60px" :src="scope.row.prescriptionFiles.length?$baseUrl+'/profile/ys/'+scope.row.prescriptionFiles[0].url:''" :preview-src-list="[scope.row.prescriptionFiles.length?$baseUrl+'/profile/'+scope.row.prescriptionFiles[0].url:'']"></el-image></template>-->
<!--              </el-table-column>-->
<!--              <el-table-column-->
<!--                label="备注"-->
<!--                align="center"-->
<!--                prop="remarks"-->
<!--              /> </el-table-->
<!--          ></el-tab-pane>-->
<!--          <el-tab-pane label="打包记录" name="pack">-->
<!--            <el-table-->
<!--              v-loading="loading"-->
<!--              :data="detailData.db||[]"-->
<!--              @selection-change="handleSelectionChange"-->
<!--            >-->
<!--              <el-table-column type="index" width="55" align="center" />-->
<!--              <el-table-column-->
<!--                label="扫码时间"-->
<!--                align="center"-->
<!--                prop="createTime"-->
<!--              />-->
<!--              <el-table-column-->
<!--                label="操作人"-->
<!--                align="center"-->
<!--                prop="createBy"-->
<!--              />-->
<!--              <el-table-column label="照片" align="center">-->
<!--                <template slot-scope="scope"><el-image style="width:60px;height:60px" :src="scope.row.prescriptionFiles.length?$baseUrl+'/profile/ys/'+scope.row.prescriptionFiles[0].url:''" :preview-src-list="[scope.row.prescriptionFiles.length?$baseUrl+'/profile/'+scope.row.prescriptionFiles[0].url:'']"></el-image></template>-->
<!--              </el-table-column>-->
<!--              <el-table-column-->
<!--                label="备注"-->
<!--                align="center"-->
<!--                prop="remarks"-->
<!--              /> </el-table-->
<!--          ></el-tab-pane>-->
<!--        </el-tabs>-->
      </div>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="cancel">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import {
  listPrescriptionCore,
  getPrescriptionCore,
  delPrescriptionCore,
  addPrescriptionCore,
  updatePrescriptionCore,
  exportPrescriptionCore,
} from "@/api/prescription/prescriptionCore";

import { listMedicalMechanism } from "@/api/medical/mechanism";

export default {
  name: "PrescriptionCore",
  data() {
    return {
      $baseUrl: this.$baseUrl,
      detailData: {
        oralPre: {
          oralPreItemList: []
        }
      },
      activeName: "first",
      state: {
        1: "配药",
        2: "煎药",
        3: "发药",
        4: "配送",
      },
      stateArr: [
        { name: "配药", id: 1 },
        { name: "煎药", id: 2 },
        { name: "发药", id: 3 },
        { name: "配送", id: 4 },
      ],
      deployStateArr: [
        // { name: "抓药", id: 0, key: "zy" },
        // { name: "复核", id: 1, key: "fh" },
        // { name: "浸泡", id: 2, key: "jp" },
        // { name: "煎煮", id: 3, key: "jz" },
        // { name: "打包", id: 4, key: "db" },
        { name: "已审核", id: 5, key: "audited" },
        { name: "已调配", id: 6, key: "allocated" },
        { name: "已复核", id: 7, key: "reviewed" },
        { name: "已浸泡", id: 8, key: "soaked" },
        { name: "已煎煮", id: 9, key: "cooked" },
        { name: "已先煎", id: 10, key: "preCooked" },
        { name: "已开始煎煮", id: 11, key: "startedCooking" },
        { name: "已后下", id: 12, key: "lowered" },
        { name: "已结束煎煮", id: 13, key: "finishedCooking" },
        { name: "已开始浓缩", id: 14, key: "startedConcentration" },
        { name: "已结束浓缩", id: 15, key: "finishedConcentration" },
        { name: "已打包", id: 16, key: "packaged" },
      ],
      depolyStatusObj:{
        type:'',
        createTime:'',
        operate:'',
        createBy:'',
        prescriptionFiles:[],
        remarks:''
      },
      effectStatus:'plain',
      currentDepoly:'',
      // 遮罩层
      loading: true,
      // 导出遮罩层
      exportLoading: false,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 处方审核表格数据
      prescriptionCoreList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        notCheckState: 0,
        pageNum: 1,
        pageSize: 10,
        state: null,
        appId: null,
        yljgId: null,
        timeStamp: null,
        token: null,
        preNo: null,
        preName: null,
        name: null,
        sex: null,
        age: null,
        department: null,
        doctor: null,
        prescriptionTime: null,
        disCode: null,
        disName: null,
        symCode: null,
        symName: null,
        westernDisease: null,
        westernCode: null,
        patientContent: null,
        nowDesc: null,
        pastDesc: null,
        fourDiagnosis: null,
        physical: null,
        auxiliaryExam: null,
        premzzy: null,
        visitNo: null,
        checkState: null,
        remarks: null,
        extendedTxt: null,
        address: null,
        contactNumber: null,
        consignee: null,
        takingMethod: null,
        yfId: window.localStorage.getItem("pharmacyId"),
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {},
      listMedicalMechanismArr: [],
    };
  },
  created() {
    this.getList();
    this.getListMedicalMechanism();
    this.currentDepoly = 'audited';
  },
  methods: {
    handleClick(tab, event) {
      //console.log(tab, event);
    },
    /** 查询处方审核列表 */
    getList() {
      this.loading = true;
      console.log('this.queryParams',this.queryParams)
      listPrescriptionCore(this.queryParams).then((response) => {
        this.prescriptionCoreList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    getListMedicalMechanism() {
      listMedicalMechanism().then((res) => {
        this.listMedicalMechanismArr = res.data;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        appId: null,
        yljgId: null,
        yfId: null,
        timeStamp: null,
        token: null,
        preNo: null,
        preName: null,
        name: null,
        sex: null,
        age: null,
        department: null,
        doctor: null,
        prescriptionTime: null,
        disCode: null,
        disName: null,
        symCode: null,
        symName: null,
        westernDisease: null,
        westernCode: null,
        patientContent: null,
        nowDesc: null,
        pastDesc: null,
        fourDiagnosis: null,
        physical: null,
        auxiliaryExam: null,
        premzzy: null,
        visitNo: null,
        checkState: null,
        remarks: null,
        extendedTxt: null,
        address: null,
        contactNumber: null,
        consignee: null,
        takingMethod: null,
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map((item) => item.id);
      this.single = selection.length !== 1;
      this.multiple = !selection.length;
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.activeName = 'first'
      this.title = "添加处方审核";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const id = row.id || this.ids;
      getPrescriptionCore(id).then((response) => {
        // this.form = response.data;
        this.detailData = response.data;
        this.open = true;
        this.activeName = 'first'
        this.title = "溯源详情";
        //console.log(response);
      });
    },
    /** 提交按钮 */
    // submitForm() {
    //   this.$refs["form"].validate((valid) => {
    //     if (valid) {
    //       if (this.form.id != null) {
    //         updatePrescriptionCore(this.form).then((response) => {
    //           this.msgSuccess("修改成功");
    //           this.open = false;
    //           this.getList();
    //         });
    //       } else {
    //         addPrescriptionCore(this.form).then((response) => {
    //           this.msgSuccess("新增成功");
    //           this.open = false;
    //           this.getList();
    //         });
    //       }
    //     }
    //   });
    // },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$confirm(
        '是否确认删除处方审核编号为"' + ids + '"的数据项?',
        "警告",
        {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning",
        }
      )
        .then(function () {
          return delPrescriptionCore(ids);
        })
        .then(() => {
          this.getList();
          this.msgSuccess("删除成功");
        })
        .catch(() => {});
    },
    /** 导出按钮操作 */
    handleExport() {
      const queryParams = this.queryParams;
      this.$confirm("是否确认导出所有处方审核数据项?", "警告", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          this.exportLoading = true;
          return exportPrescriptionCore(queryParams);
        })
        .then((response) => {
          this.download(response.msg);
          this.exportLoading = false;
        })
        .catch(() => {});
    },
    // 改变溯源记录的状态
    handleDeploy(item) {
      console.log('item.name',item.name)
      this.currentDepoly = item.key
      this.depolyStatusObj = this.detailData[this.currentDepoly][0] ||{}
      // test code
      // this.depolyStatusObj.remarks = this.depolyStatusObj?.remarks? + this.currentDepoly
    }
  },
};
</script>
<style scoped>
h3 {
  margin: 0;
}
.el-divider--horizontal{
  margin: 8px 0;
  /*background: 0 0;*/
  /*border-top: 1px dashed #e8eaec;*/
}
.deploy-record{
  display: flex;

}
.deploy {
  display: flex;
  flex-direction:column;
  align-items:flex-end;
  justify-content:center;

}
.body{
  display: flex;
  height: 30px;
  width: 200px;
  justify-content:flex-start;
  align-items: center;
}
.title{
  margin-bottom: 0;
  font-weight: bolder;
  justify-content: flex-end!important;
  width: 90px!important;
  /*justify-content:center;*/
}

</style>
