<template>
    <view class="td-root">
        <!-- pages/prescritionTemplate/prescriptionTemplate.wxml
 处方模板 -->
        <view class="diagnostic-wrapper">
            <view class="all">
                <view class="head">
                    <view class="topHead">
                        <view class="topHead__inner">
                            <view class="medType" @tap.stop.prevent="showOtherTemlateType">
                                <text>{{ templateType[checkTemplateIndex].desc }}</text>
                                <van-icon name="arrow-down" />
                            </view>
                            <view class="serachBOX">
                                <view class="serach">
                                    <icon type="search" class="serachIcon" size="20" />
                                    <input @input="selectTemplate" class="serachInfo" placeholder="搜索套餐/模板名称" />
                                </view>
                            </view>
                        </view>
                    </view>
                    <view class="other" v-if="showOtherType" v-for="(item, index) in medictionType" :key="index">
                        <view v-if="index != checkMedTypeIndex">
                            <button class="otherType" @tap.stop.prevent="checkMedType" :data-index="index">
                                <text>{{ item.desc }}</text>
                            </button>
                        </view>
                    </view>
                    <view class="other" v-if="showTemplateType" v-for="(item, index) in templateType" :key="index">
                        <view v-if="index != checkTemplateIndex">
                            <button class="otherType" @tap.stop.prevent="checkTempType" :data-index="index">
                                <text>{{ item.desc }}</text>
                            </button>
                        </view>
                    </view>
                </view>
                <view class="MedDody">
                    <view class="MedDody__inner">
                        <view class="col-4">
                            <view v-for="(item, index) in medicalRecode" :key="index">
                                <view @tap.stop.prevent="checkMedRecorde" :data-index="index" :class="medRecodeIndex == index ? 'checkMedArr' : 'medArr'">
                                    {{ item.ordTempletDesc }}
                                </view>
                            </view>
                        </view>
                        <view class="col-8" v-if="active == 1">
                            <view class="selectall" v-if="medRecodeDateil && medRecodeDateil.length > 0">
                                <checkbox :checked="checkedAll" @tap="checkall">全选/取消全选</checkbox>
                            </view>
                            <view class="col-8__list">
                                <view v-if="!medRecodeDateil || medRecodeDateil.length === 0" class="col-8__empty">
                                    <view class="col-8__empty-icon">∅</view>
                                    <view>暂无模板明细</view>
                                    <view style="margin-top: 8rpx; font-size: 22rpx; color: #cbd5e1;">请选择左侧模板</view>
                                </view>
                                <view v-for="(item, index) in medRecodeDateil" :key="index" v-else>
                                    <view class="medDateil row">
                                        <view class="col-9">
                                            <text>{{ item.ordTempletDetailItemDesc }}</text>
                                            <text class="useDateil">【{{ item.ordTempletDetailQty }} {{ item.ordTempletDetailQtyUnitDesc }}】</text>
                                            <text class="useDateil">【{{ item.way }}】</text>
                                        </view>
                                        <view class="col-3 checkButtonWrap">
                                            <checkbox :checked="item.checkStatus" color="dodgerblue" @tap.stop.prevent="checkSaveMed" :data-index="index"></checkbox>
                                        </view>
                                    </view>
                                </view>
                            </view>
                        </view>
                        <view v-if="active == 0" class="col-8">
                            <view class="selectall" v-if="medRecodeDateil && medRecodeDateil.length > 0">
                                <checkbox :checked="checkedAll" @tap="checkall">全选/取消全选</checkbox>
                            </view>
                            <view class="col-8__list">
                                <view v-if="!medRecodeDateil || medRecodeDateil.length === 0" class="col-8__empty">
                                    <view class="col-8__empty-icon">∅</view>
                                    <view>暂无模板明细</view>
                                    <view style="margin-top: 8rpx; font-size: 22rpx; color: #cbd5e1;">请选择左侧模板</view>
                                </view>
                                <view v-for="(item, index) in medRecodeDateil" :key="index" v-else>
                                    <view class="medDateil">
                                        <view class="checkMedDateil">
                                            <view class="medName p30">
                                                <text class="medName__text">{{ item.ordTempletDetailItemDesc }}</text>
                                                <checkbox
                                                    color="dodgerblue"
                                                    @tap.stop.prevent="checkSaveMed"
                                                    :data-index="index"
                                                    :checked="item.checkStatus"
                                                    class="checkButton"
                                                ></checkbox>
                                            </view>
                                            <view class="meDose colnone">
                                                <text class="colnone">规格：</text>
                                                {{ item.spec }}
                                            </view>
                                        </view>
                                    </view>
                                </view>
                            </view>
                        </view>
                    </view>
                </view>
            </view>
        </view>
        <!-- <view class="foot"> -->
        <button class="diagnostibutton" @tap.stop.prevent="savePres" :disabled="isLoading">{{ isLoading ? '保存中' : '保存到处方列表' }}</button>
        <!-- </view> -->
    </view>
</template>

<script>
import Cache from '../../../../../../../utils/cache';
// pages/prescritionTemplate/prescriptionTemplate.js../../config/https.js../../config/https.js
import { $http } from '../../../../../../../config/https';
export default {
    components: {},
    data() {
        return {
            medictionType: [
                {
                    id: 1,
                    desc: '西药及其他'
                },
                {
                    id: 2,
                    desc: '草药'
                }
            ],

            checkMedTypeIndex: 0,
            showOtherType: false,

            templateType: [
                {
                    id: 1,
                    desc: '个人模板'
                },
                {
                    id: 2,
                    desc: '科室模板'
                }
            ],

            checkTemplateIndex: 0,
            showTemplateType: false,
            search: '',
            medicalRecode: [],
            medRecodeIndex: 0,
            westMedRecode: [],
            medRecode: [],
            westMedRecodeIndex: 0,
            selectMedFlag: 'west',
            medRecodeDateil: [],
            selectInfo: '',
            saveArr: [],
            detailInfo: [],
            orderData: [],
            errorData: [],
            isLoading: false,
            checkedAll: false,
            recLoc: '',
            desc: ''
        };
    },
    /**
     * 可以使用全局样式
     */
    options: {
        addGlobalClass: true
    },
    props: {
        showRefusal: String,
        myProperty2: String,
        // 简化的定义方式
        addInfo: {
            type: Object,
            //类型
            default: () => ({}) //默认值
        },

        active: {
            type: Number,
            //类型
            default: 0 //默认值
        }
    },
    mounted() {
        // 处理小程序 attached 生命周期
        this.attached();
        // 处理小程序 ready 生命周期
        this.$nextTick(() => this.ready());
    },
    moved: function () {},
    destroyed: function () {},
    methods: {
        ready: function () {
            let { recLoc } = this;
            console.log(recLoc);
            this.setData({
                recLoc: recLoc
            });
            this.getDate();
        },

        // 生命周期函数，可以为函数，或一个在methods段中定义的方法名
        attached: function () {},

        selectPatient: function (e) {
            console.log('select---->', e.detail.value);
        },

        // checkMedType: function (e) {
        //   var selectMedFlag = 'west'
        //   var medicalRecode = this.data.westMedRecode
        //   if (e.currentTarget.dataset.index == 1) {
        //     selectMedFlag = "med"
        //     medicalRecode = this.data.medRecode
        //   }
        //   this.setData({
        //     medicalRecode: medicalRecode,
        //     checkMedTypeIndex: e.currentTarget.dataset.index,
        //     showOtherType: false,
        //     selectMedFlag: selectMedFlag
        //   }, () => {
        //     this.getDataDateil()
        //   })
        // },

        showOtherTypeFun: function (e) {
            if (!this.showOtherType) {
                this.setData({
                    showOtherType: true
                });
            } else {
                this.setData({
                    showOtherType: false,
                    saveArr: []
                });
            }
        },

        checkMedRecorde: function (e) {
            this.setData(
                {
                    medRecodeIndex: e.currentTarget.dataset.index,
                    saveArr: []
                },
                () => {
                    this.getDataDateil();
                }
            );
        },

        childFun: function () {
            if (this.active == 0) {
                this.setData(
                    {
                        medicalRecode: this.westMedRecode
                    },
                    () => {
                        this.getDataDateil;
                    }
                );
            } else {
                this.setData(
                    {
                        medicalRecode: this.medRecode
                    },
                    () => {
                        this.getDataDateil;
                    }
                );
            }
        },

        getDate: function (e) {
            let that = this;
            var active = this.active + 1;
            var templateType = this.templateType;
            var checkTemplateIndex = this.checkTemplateIndex;
            let data = {
                params: [
                    {
                        templetTypeID: templateType[checkTemplateIndex].id,
                        status: 'Y',
                        input: this.selectInfo
                    }
                ]
            };
            $http.post('urlDeault', this, {
                code: '03050011',
                data: data,
                success: function (res) {
                    console.log(res);
                    if (res.errorCode == '0') {
                        if (res.result) {
                            var medRecode = [];
                            var westMedRecode = [];
                            for (var i = 0; i < res.result.length; i++) {
                                if (res.result[i].templetCatID == 1) {
                                    westMedRecode = res.result[i].data;
                                }
                                if (res.result[i].templetCatID == 2) {
                                    medRecode = res.result[i].data;
                                }
                            }
                        }
                        this.setData(
                            {
                                medicalRecode: this.active == 0 ? westMedRecode : medRecode,
                                medRecode: medRecode,
                                westMedRecode: westMedRecode
                            },
                            () => {
                                this.getDataDateil();
                            }
                        );
                    }
                }
            });
        },

        checkTempType: function (e) {
            this.setData(
                {
                    checkTemplateIndex: e.currentTarget.dataset.index,
                    showTemplateType: false,
                    saveArr: [],
                    checkedAll: false
                },
                () => {
                    this.getDate();
                }
            );
        },

        selectTemplate: function (e) {
            this.setData(
                {
                    selectInfo: e.detail.value
                },
                () => {
                    this.getDate();
                }
            );
        },

        getDataDateil: function (e) {
            let that = this;
            if (this.medicalRecode != undefined && this.medicalRecode.length > 0) {
                let data = {
                    params: [
                        {
                            ordTempletID: this.medicalRecode[this.medRecodeIndex].ordTempletID
                        }
                    ]
                };
                $http.post('urlDeault', this, {
                    code: '03050014',
                    data: data,
                    success: function (res) {
                        console.log(res);
                        if (res.errorCode == '0') {
                            this.setData({
                                medRecodeDateil: res.result
                            });
                        }
                    }
                });
            } else {
                this.setData({
                    medRecodeDateil: []
                });
            }
        },

        showOtherTemlateType: function (e) {
            if (!this.showTemplateType) {
                this.setData({
                    showTemplateType: true
                });
            } else {
                this.setData({
                    showTemplateType: false
                });
            }
        },

        checkSaveMed: function (e) {
            var index = e.currentTarget.dataset.index;
            var checkStatus = this.medRecodeDateil[index].checkStatus;
            var medRecodeDateil = this.medRecodeDateil;
            if (checkStatus) {
                medRecodeDateil[index].checkStatus = false;
            } else {
                medRecodeDateil[index].checkStatus = true;
            }
            this.setData({
                medRecodeDateil: medRecodeDateil
            });
        },

        savePres: function (e) {
            this.setData({
                isLoading: true
            });
            const { medRecodeDateil } = this;
            var patientData = Cache.get('patientData');
            var userData = Cache.get('userData');
            this.setData({
                orderData: []
            });
            let that = this;
            var index = 0;
            medRecodeDateil.map((item) => {
                if (item.checkStatus) {
                    if (this.active == 0) {
                        // this.selectMedDateil(item.medID, index)
                        var arr = [];
                        if (item.medID) {
                            arr.push({
                                medID: item.medID
                            });
                        } else {
                            arr.push({
                                ordSetID: item.ordSetID
                            });
                        }
                        let data = {
                            params: [
                                {
                                    orders: arr,
                                    admID: patientData.admID
                                }
                            ]
                        };
                        $http.post('urlDeault', this, {
                            code: '03050020',
                            data: data,
                            success: function (res) {
                                this.setData({
                                    isLoading: false
                                });
                                if (res.errorCode == '0') {
                                    if (res.errorData.length != 0) {
                                        let contentStr = '';
                                        for (var len = 0; len < res.errorData.length; len++) {
                                            contentStr = contentStr + res.errorData[len].ordDesc + ':' + res.errorData[len].errorMessage + '\n';
                                        }
                                        uni.showModal({
                                            title: '提示',
                                            content: contentStr,
                                            confirmText: '确认',
                                            success(result) {
                                                if (result.confirm) {
                                                    that.setData(
                                                        {
                                                            detailInfo: res.data,
                                                            errorData: res.errorData
                                                        },
                                                        () => {
                                                            index = index + 1;
                                                            let invalid = Object.keys(res.data[0].defaultData).length > 0 ? '' : item.title;
                                                            that.pushMedDateil(item.medID, index, invalid, res.data);
                                                        }
                                                    );
                                                }
                                            }
                                        });
                                    } else {
                                        this.setData(
                                            {
                                                detailInfo: res.data,
                                                errorData: res.errorData
                                            },
                                            () => {
                                                index = index + 1;
                                                let invalid = Object.keys(res.data[0].defaultData).length > 0 ? '' : item.title;
                                                this.pushMedDateil(item.medID, index, invalid, res.data);
                                            }
                                        );
                                    }
                                }
                            },
                            fail: function (error) {
                                this.setData({
                                    isLoading: false
                                });
                            }
                        });
                    } else {
                        //this.selectMedicalDateil(item.medID, index)
                        var addInfo = this.addInfo;
                        let data = {
                            params: [
                                {
                                    admID: patientData.admID,
                                    groupID: userData.groupID,
                                    recLocID: addInfo.recLoc ? addInfo.recLoc.id : '',
                                    userID: userData.userID,
                                    locID: userData.locID,
                                    hospID: userData.hospID,
                                    orders: [
                                        {
                                            ordTempletDetailID: item.ordTempletDetailID
                                        }
                                    ]
                                }
                            ]
                        };
                        $http.post('urlDeault', this, {
                            code: '03050076',
                            data: data,
                            success: function (res) {
                                this.setData({
                                    isLoading: false
                                });
                                if (res.errorCode == '0') {
                                    console.log(res.data);
                                    this.setData(
                                        {
                                            detailInfo: res.data
                                        },
                                        () => {
                                            index = index + 1;
                                            this.pushMedDateil(item.medID, index, '', res.data);
                                        }
                                    );
                                }
                            },
                            fail: function (error) {
                                this.setData({
                                    isLoading: false
                                });
                            }
                        });
                    }
                } else {
                    this.setData({
                        isLoading: false
                    });
                }
            });
        },

        pushMedDateil: function (medID, index, invalid = '', detailInfo) {
            var active = this.active;
            let errorData = this.errorData;
            var orderData = this.orderData;
            var medRecodeDateil = this.medRecodeDateil;
            var valueindex = 0;
            medRecodeDateil.map((item) => {
                if (item.checkStatus) {
                    valueindex = valueindex + 1;
                }
            });
            if (active == 0) {
                if (medID) {
                    detailInfo[0].defaultData.medID = medID;
                    detailInfo[0].defaultData.otherFlag = 1;
                    if (invalid) {
                        detailInfo[0].defaultData.invalid = invalid;
                    }
                    // detailInfo[0].defaultData.ordFreqID = detailInfo[0].defaultData.ordFreqID?detailInfo[0].defaultData.ordFreqID:(addInfo.selectIndex2?addInfo.selectIndex2.id:"")
                    // detailInfo[0].defaultData.ordUsageID = detailInfo[0].defaultData.ordUsageID?detailInfo[0].defaultData.ordUsageID:(addInfo.selectIndex3?addInfo.selectIndex3.id:"")
                    orderData.push(detailInfo[0].defaultData);
                } else {
                    detailInfo.map((item) => {
                        item.defaultData.otherFlag = 1;
                        errorData.map((item1) => {
                            if (item1.indexId == item.indexId) {
                                item.defaultData.invalid = item1.ordDesc;
                            }
                        });
                        orderData.push(item.defaultData);
                    });
                    // console.log(detailInfo)
                }
                // detailInfo[0].defaultData.medID = medID
                // detailInfo[0].defaultData.otherFlag = 1
                // detailInfo[0].defaultData.ordFreqID = detailInfo[0].defaultData.ordFreqID?detailInfo[0].defaultData.ordFreqID:(addInfo.selectIndex2?addInfo.selectIndex2.id:"")
                // detailInfo[0].defaultData.ordUsageID = detailInfo[0].defaultData.ordUsageID?detailInfo[0].defaultData.ordUsageID:(addInfo.selectIndex3?addInfo.selectIndex3.id:"")
                // orderData.push(detailInfo[0].defaultData)
            } else {
                detailInfo.map((item) => {
                    // detailInfo.medID = medID
                    item.otherFlag = 1;
                    item.herbalFormID = item.herbalFormID ? item.herbalFormID : this.addInfo.herbalForm ? this.addInfo.herbalForm.id : '';
                    orderData.push(item);
                });
            }
            if (index == valueindex) {
                var orderObj = {};
                var active = this.active;
                orderObj.data = orderData;
                // 关键修复：addPrescription.vue 没有 callData / callData2 方法，
                // 正确方法是 callDataFun（西药）/ callData2Fun（草药），与 getAddInfo 保持一致
                try {
                    let pages = getCurrentPages();
                    let prevPage = pages[pages.length - 2];
                    if (active == 0) {
                        if (prevPage && typeof prevPage.callDataFun === 'function') {
                            prevPage.callDataFun(orderData);
                        } else if (prevPage && typeof prevPage.wListPush === 'function') {
                            orderData.forEach((it) => prevPage.wListPush(it, 'N'));
                        }
                        uni.navigateBack({
                            delta: 1
                        });
                    } else {
                        if (prevPage && typeof prevPage.callData2Fun === 'function') {
                            prevPage.callData2Fun({ gList: orderData });
                        } else if (prevPage && typeof prevPage.gListPush === 'function') {
                            orderData.forEach((it) => prevPage.gListPush(it));
                        }
                        orderObj.select = 0;
                        this.$emit('changeSelect', {
                            detail: orderObj
                        });
                    }
                } catch (err) {
                    console.warn('[templateDiagnostic.pushMedDateil] 通知父页面失败:', err);
                }
            }
        },

        selectMedDateil: function (medID, index) {},
        selectMedicalDateil: function (medID, index) {},

        /**全选
         *
         */
        checkall: function () {
            let data = this.medRecodeDateil;
            let { checkedAll } = this;
            for (var len = 0; len < data.length; len++) {
                data[len].checkStatus = !checkedAll;
            }
            this.setData({
                medRecodeDateil: data,
                checkedAll: !checkedAll
            });
        },

        checkMedType() {
            console.log('占位：函数 checkMedType 未声明');
        }
    },
    created: function () {}
};
</script>
<style>
/* @import '../../../Entry.css'; */

/* 根容器：撑满父容器（addPrescription 中的 .addPres-subview） */
.td-root {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
}

.medType {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    height: 56rpx;
    padding: 0 20rpx;
    font-size: 26rpx;
    font-family: PingFang SC;
    font-weight: 500;
    color: #1f2937;
    background: #f4f7fb;
    border-radius: 28rpx;
    margin-right: 16rpx;
    position: relative;
    transition: all 0.2s ease;
}

.medType text {
    margin-right: 6rpx;
}

page {
    background-color: white;
    height: 100%;
}

.all {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: #f4f7fb;
}

.medType1 {
    font-size: 28rpx;
    color: dodgerblue;
}

.row {
    width: 100%;
    display: flex;
    align-items: center;
}

.col {
    height: 100%;
    display: flex;
    flex: 1;
    min-height: 0;
}

.col-4 {
    width: 38%;
    flex-shrink: 0;
    background-color: #fafbfc;
    border-right: 2rpx solid #eee;
    overflow-y: auto;
    height: 100%;
}

.col-8 {
    flex: 1;
    min-width: 0;
    background: #fff;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.col-8__list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    background: #fff;
    position: relative;
}

.col-8__empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
    font-size: 26rpx;
    padding: 80rpx 40rpx;
}

.col-8__empty-icon {
    width: 120rpx;
    height: 120rpx;
    background: #f4f7fb;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20rpx;
    font-size: 56rpx;
    color: #cbd5e1;
}

.head {
    background-color: #ffffff;
    padding: 12rpx 20rpx;
    border-radius: 8rpx;
    margin-bottom: 8rpx;
}

.arrow {
    margin-left: 16rpx;
    font-size: 20rpx;
    padding-bottom: 16rpx;
}

.other {
    z-index: 99;
    position: fixed;
    background: white;
    box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.08);
    border-radius: 8rpx;
    padding: 8rpx;
    margin-top: 4rpx;
}

.otherType {
    border-radius: 6rpx;
    font-size: 26rpx;
    font-weight: 400;
    width: 180rpx !important;
    margin-bottom: 4rpx;
    text-align: center;
    background: #f4f7fb;
    color: #4b5563;
    line-height: 1.6;
}

.otherType::after {
    border: initial;
}

.medDateil {
    background: #ffffff;
    padding: 18rpx 20rpx;
    font-size: 28rpx;
    border-bottom: 1rpx solid #f2f2f2;
    display: flex;
    align-items: flex-start;
    gap: 12rpx;
}

.useDateil {
    margin-left: 8rpx;
    color: #9ca3af;
    font-size: 24rpx;
}

.westUseDateil {
    margin-left: 15rpx;
    color: #999;
    width: 60%;
}

.MedDody {
    flex: 1;
    min-height: 0;
    background: #fff;
    border-radius: 8rpx;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.MedDody__inner {
    display: flex;
    width: 100%;
    height: 100%;
}

.serach {
    background-color: #f4f7fb;
    color: #999;
    font-size: 26rpx;
    height: 56rpx;
    line-height: 56rpx;
    border-radius: 28rpx;
    margin: 0;
    padding: 0 20rpx;
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
}

.topHead {
    height: auto;
    overflow: visible;
}

.topHead__inner {
    display: flex;
    align-items: center;
    gap: 4rpx;
}

.serachIcon {
    width: 28rpx;
    height: 28rpx;
    margin-right: 10rpx;
    flex-shrink: 0;
}

.serachInfo {
    font-size: 26rpx;
    flex: 1;
    min-width: 0;
    background: transparent;
    height: 56rpx;
    line-height: 56rpx;
}

.medArr {
    display: block;
    font-size: 28rpx;
    border-bottom: 1rpx solid #f2f2f2;
    font-weight: 400;
    padding: 24rpx 20rpx;
    color: #4b5563;
    line-height: 1.4;
    word-break: break-all;
}

.checkMedArr {
    display: block;
    font-size: 28rpx;
    border-bottom: 1rpx solid #f2f2f2;
    font-weight: 600;
    color: #1687ff;
    padding: 24rpx 16rpx;
    border-left: 6rpx solid #1687ff;
    background: #e8f3ff;
    line-height: 1.4;
    word-break: break-all;
}

.saveButton {
    align-items: center;
    border-radius: 40rpx;
    background-color: dodgerblue;
    color: white;
    font-size: 28rpx;
    margin-top: 20rpx;
    font-weight: 400;
}

.checkButton {
    margin-left: auto;
    flex-shrink: 0;
}

.checkButtonWrap {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    width: 30%;
    flex-shrink: 0;
}

.borBtom {
    border-bottom: 2rpx solid #eee;
    padding-bottom: 30rpx;
}

.serachBOX {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
}

.medName {
    padding: 18rpx 20rpx;
    border-bottom: 1rpx solid #f1f1f1;
    font-size: 28rpx;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16rpx;
    color: #1f2937;
    font-weight: 500;
}

.medName__text {
    flex: 1;
    min-width: 0;
    word-break: break-all;
    line-height: 1.4;
}

.meDose {
    padding: 12rpx 20rpx 16rpx;
    font-size: 24rpx;
    color: #9ca3af;
    line-height: 1.4;
}

.colnone {
    font-size: 24rpx;
    color: #969799;
}

.p30 {
    padding: 0;
}

.selectall {
    display: flex;
    align-items: center;
    gap: 8rpx;
    font-size: 26rpx;
    background: #ffffff;
    border-bottom: 1rpx solid #f2f2f2;
    color: #1687ff;
    padding: 16rpx 20rpx;
    flex-shrink: 0;
    font-weight: 500;
}

/* 保存按钮：与 prescription.vue .diagnostibutton 风格一致的药丸悬浮按钮 */
.td-root .diagnostibutton {
    position: fixed;
    left: 20rpx;
    right: 20rpx;
    bottom: 24rpx;
    height: 84rpx;
    line-height: 84rpx;
    background: #1890ff;
    color: #fff;
    font-size: 30rpx;
    font-weight: 500;
    text-align: center;
    border-radius: 999rpx;
    padding: 0;
    margin: 0;
    z-index: 10;
    box-shadow: 0 6rpx 16rpx rgba(24, 144, 255, 0.28);
}

.td-root .diagnostibutton::after {
    border: initial;
}

.td-root .diagnostibutton[disabled] {
    background: #91cfff;
    color: #fff;
    box-shadow: none;
}
</style>
