<template>
    <global-popup v-model="showPopup" mode="right" :width="580" background="#F7F8FA" title="选择责任单位" :round="32" @close="showPopup = false">
        <view class="list">
            <view class="item" v-for="item in arrangeWorkExtendList" :key="item.id" @tap="handleClick(item)">
                {{ item.companyFullName }}
            </view>
        </view>
    </global-popup>
</template>

<script setup>
import { ref } from 'vue'
import useAssignWorkStore from 'mocp/store/assign-work'
import { storeToRefs } from 'pinia'

const assignWorkStore = useAssignWorkStore()
const { arrangeWorkExtendList } = storeToRefs(assignWorkStore)

const showPopup = ref(false)
const open = () => {
    showPopup.value = true
}
//切换责任公司
const handleClick = (row) => {
    showPopup.value = false
    assignWorkStore.setState('arrangeWorkExtend', row)
    uni.$mocpMessage.showToast('已切换成' + row.companyFullName)
}
defineExpose({
    open
})
</script>
<style lang="scss" scoped>
.list {
    padding: 18rpx 32rpx;
    .item {
        color: $mocp-text-4;
        font-size: 30rpx;
        background: #fff;
        margin-bottom: 24rpx;
        padding: 16rpx 24rpx;
    }
}
</style>
