<template>
  <van-action-sheet
    v-model="showApprovalAction"
    class="approval-action"
    :class="{ 'sava-action-sheet': currentAlias === 'saveDraft' }"
    get-container="body"
    @closed="handleClose"
  >
    <div class="header">
      <span
        class="left-cancel"
        @click="handleClose"
        :class="{ 'disabled-text': confirmLoading }"
      >
        取消
      </span>
      <span class="center-title">{{ approvalActionTitle[currentAlias] }}</span>
      <span class="right-confirm" @click="handleConfirm">
        <van-loading type="spinner" color="#409EFF" v-if="confirmLoading" />
        <span v-else>确定</span>
      </span>
    </div>
    <van-form class="btn-form-content" v-form ref="approvalActionForm">
      <van-field
        v-if="currentAlias === 'saveDraft'"
        name="saveType"
        label="保存类型"
        class="sava-type required-mark"
        :rules="[{ required: true, message: '请选择保存类型' }]"
      >
        <template #input>
          <van-radio-group
            v-model="form.saveType"
            direction="vertical"
            @change="handleSaveTypeChange"
          >
            <van-radio name="1">仅保存表单数据</van-radio>
            <van-radio name="2">保存表单数据和审批意见</van-radio>
          </van-radio-group>
        </template>
      </van-field>
      <van-field
        v-if="isShowUserSelector"
        name="users"
        :label="userSelectorLabel[currentAlias]"
        :rules="[
          {
            required: form.users ? false : true,
            message: `请选择${userSelectorLabel[currentAlias]}`,
          },
        ]"
        class="required-mark"
      >
        <template #input>
          <ht-user-selector-input
            v-model="form.users"
            quick-search-props="fullname,account"
            :append-to-body="true"
            :single="isSingle"
            :config="{ id: 'form.userIds' }"
          ></ht-user-selector-input>
        </template>
      </van-field>
      <van-field
        v-if="isShowInquiryType && currentAlias === 'inqu'"
        name="inquiryType"
        label="征询类型"
        class="required-mark"
      >
        <template #input>
          <van-radio-group v-model="form.inquiryType" direction="horizontal">
            <van-radio name="direct">直接返回</van-radio>
            <van-radio name="step">逐级返回</van-radio>
          </van-radio-group>
        </template>
      </van-field>
      <template v-if="currentAlias === 'reject'">
        <van-field
          name="rejectRecallMode"
          label="驳回重提模式"
          class="required-mark"
        >
          <template #input>
            <van-radio-group
              v-model="form.rejectRecallMode"
              direction="horizontal"
              @change="changeRejectRecallMode"
            >
              <van-radio
                :name="item.key"
                v-for="item in rejectRecallModeOptions"
                :key="item.key"
              >
                {{ item.value }}
              </van-radio>
            </van-radio-group>
          </template>
        </van-field>
        <van-field
          name="rejectMethod"
          label="驳回方式"
          class="required-mark"
          v-model="form.rejectMethod"
          :rules="[{ required: true, message: '请选择驳回方式' }]"
        >
          <template #input>
            <button-select
              v-model="form.rejectMethod"
              :actions="rejectMethodOptions"
              class="reject-method"
            />
          </template>
        </van-field>
        <van-field
          v-if="isShowSelect"
          name="nodeId"
          label="指定节点"
          class="required-mark"
          v-model="form.nodeId"
          :rules="[{ required: true, message: '请选择' }]"
        >
          <template #input>
            <button-select
              v-model="form.nodeId"
              :actions="canRejectNode"
              :props="{ key: 'nodeId', name: 'name' }"
            />
          </template>
        </van-field>
        <van-field
          v-if="
            rejectInfo.signTaskHisAssignMap &&
            rejectInfo.signTaskHisAssignMap[destinationNodeId]
          "
          label="选择处理人"
          class="required-mark"
          v-model="rejectUserIds"
          :rules="[{ required: true, message: '请选择' }]"
        >
          <template #input>
            <ht-select
              v-model="rejectUserIds"
              multiple
              :options="rejectInfo.signTaskHisAssignMap[destinationNodeId]"
              :props="{ key: 'id', value: 'name' }"
            ></ht-select>
          </template>
        </van-field>
      </template>
      <template v-if="nodeList && nodeList.length">
        <van-field
          v-if="selectConfig.jumpType && !selectConfig.choiceExcutor"
          name="selectNodeId"
          label="选择节点"
          class="required-mark not-required"
          v-model="form.selectNodeId"
        >
          <template #input>
            <div class="selected">
              <span class="select-val" @click="handleSelectNode">
                {{ selectNodeName }}
              </span>
              <van-icon
                name="clear"
                v-show="selectNodeName"
                @click="handleClear('selectNodeId')"
              />
              <van-icon name="arrow" @click="handleSelectNode" />
            </div>
          </template>
        </van-field>
        <template>
          <div v-if="!selectConfig.jumpType" v-form>
            <div
              class="user-wrap"
              v-for="(item, index) in nodeList"
              :key="item.nodeId"
            >
              <div class="sub-title">目标节点</div>
              <van-field
                name="selectNodeId"
                :label="item.nodeName"
                class="required-mark not-required"
                v-model="item.selectUserIds"
              >
                <template #input>
                  <ht-select
                    v-if="selectConfig.choiceExcutor == 'candidate'"
                    v-model="item.selectUserIds"
                    :options="item.excutorList"
                    clearable
                    multiple
                    :props="{ key: 'id', value: 'name' }"
                  ></ht-select>
                  <ht-user-selector-input
                    v-else
                    v-model="item.selectUsers"
                    :config="{ id: 'nodeList[' + index + '].id' }"
                    :append-to-body="true"
                  ></ht-user-selector-input>
                </template>
              </van-field>
            </div>
          </div>
          <van-field
            v-if="selectConfig.choiceExcutor && selectConfig.jumpType"
            name="selectNodeId"
            label="选择目标节点"
            class="required-mark not-required"
          >
            <template #input>
              <div
                class="selected select-box"
                :class="{
                  'no-value': !(currentSelectNodeAndUser || otherNodeUser),
                }"
              >
                <div class="select-val" @click="handleSelectNodeAndUser">
                  <span
                    class="select-top"
                    v-show="
                      selectedNodeAndUser && selectedNodeAndUser.selectNodeId
                    "
                  >
                    {{ currentSelectNodeAndUser }}
                  </span>
                  <span class="select-bottom">{{ otherNodeUser }}</span>
                </div>
                <van-icon
                  name="clear"
                  v-show="
                    selectedNodeAndUser && selectedNodeAndUser.selectNodeId
                  "
                  @click="handleClear"
                />
                <van-icon name="arrow" @click="handleSelectNodeAndUser" />
              </div>
            </template>
          </van-field>
        </template>
      </template>
      <template
        v-if="
          form.saveType === savaFormAndOpinion || currentAlias !== 'saveDraft'
        "
      >
        <van-field
          class="opinion-input placeholder-margin"
          v-model="form.opinion"
          name="opinion"
          rows="6"
          autosize
          type="textarea"
          maxlength="100"
          placeholder="请输入审批意见"
          show-word-limit
          :rules="[{ required: true, message: '请输入审批意见' }]"
        />
        <van-divider />
        <bott-order
          v-if="showApprovalAction"
          :isShowAttachment="isShowAttachment"
          overlay
          @selectOften="selectOften"
          @fileList="getFileList"
        ></bott-order>
      </template>
      <div class="signature-box" v-if="isShowSignature">
        <h4 class="signature-title">签章操作</h4>
        <van-field
          class="required-mark"
          v-model="form.signaturePassword"
          type="password"
          name="signaturePassword"
          label="签章密码"
          placeholder="请输入签章密码"
          :rules="[{ required: true, message: '请输入签章密码' }]"
        />
      </div>
      <template v-if="currentAlias === 'startTrans'">
        <van-collapse v-model="activeNames">
          <van-collapse-item title="其他设置" name="otherSet">
            <van-field
              name="radioVote"
              label="任务通过规则"
              class="required-mark"
              v-model="form.radioVote"
              :rules="[{ required: true, message: '请选择通过规则' }]"
            >
              <template #input>
                <button-select
                  v-model="form.radioVote"
                  :actions="radioVoteActions"
                />
              </template>
            </van-field>
            <!-- 4-自定义 -->
            <template v-if="form.radioVote === '4'">
              <van-field
                name="decideType"
                label="计票策略"
                class="required-mark"
                :rules="[{ required: true, message: '请选择计票策略' }]"
              >
                <template #input>
                  <van-radio-group
                    v-model="form.decideType"
                    direction="horizontal"
                  >
                    <van-radio name="agree">同意票</van-radio>
                    <van-radio name="refuse">否决票</van-radio>
                  </van-radio-group>
                </template>
              </van-field>
              <van-field
                name="voteType"
                label="投票类型"
                class="required-mark"
                :rules="[{ required: true, message: '请选择投票类型' }]"
              >
                <template #input>
                  <van-radio-group
                    v-model="form.voteType"
                    direction="horizontal"
                  >
                    <van-radio name="amount">绝对票</van-radio>
                    <van-radio name="percent">百分比</van-radio>
                  </van-radio-group>
                </template>
              </van-field>
              <van-field
                name="voteAmount"
                label="票数"
                class="required-mark"
                :class="{ postfix: form.voteType === 'percent' }"
                v-model="form.voteAmount"
                :rules="[
                  { pattern, message: '只能输入0-100的数字' },
                  { required: true, message: '请输入票数' },
                ]"
              ></van-field>
            </template>
            <van-field
              name="signType"
              label="流转类型"
              class="required-mark field-item"
              :rules="[{ required: true, message: '请选择流转类型' }]"
            >
              <template #input>
                <van-radio-group v-model="form.signType" direction="horizontal">
                  <van-radio name="parallel">并行</van-radio>
                  <van-radio name="seq">串行</van-radio>
                </van-radio-group>
              </template>
            </van-field>
            <van-field
              name="action"
              label="流转结束动作"
              class="required-mark field-item"
              :rules="[{ required: true, message: '请选择流转结束动作' }]"
            >
              <template #input>
                <van-radio-group v-model="form.action" direction="horizontal">
                  <van-radio name="submit">提交</van-radio>
                  <van-radio name="back">返回</van-radio>
                </van-radio-group>
              </template>
            </van-field>
          </van-collapse-item>
        </van-collapse>
      </template>
    </van-form>
    <van-action-sheet v-model="showSelectNode" class="dialog__min-height">
      <div class="header">
        <span class="left-cancel" @click="handleCloseNodeAction">取消</span>
        <span class="center-title">选择目标节点</span>
        <span class="right-confirm" @click="handleConfirmNodeAction">确定</span>
      </div>
      <van-search
        v-model="searchKeywords"
        shape="square"
        placeholder="搜索"
        @input="handleSearch"
      />
      <van-radio-group v-model="form.selectNodeId" class="node-list">
        <van-radio
          :name="item.nodeId"
          v-for="item in nodeList"
          :key="item.nodeId"
        >
          {{ item.nodeName }}
        </van-radio>
      </van-radio-group>
    </van-action-sheet>
    <task-select-destination
      ref="taskSelectDestination"
      :task-id="taskId"
      :def-id="bpmTask.procDefId"
      :currentAlias="currentAlias"
      :inst-id="instId"
      :leader-id="leaderId"
      @confirm="getCurrentSelected"
    ></task-select-destination>
  </van-action-sheet>
</template>

<script>
  import {
    ONLY_SAVA_FORM,
    SAVA_FORM_OPINION,
    APPROVAL_ACTION_TITLE,
    USER_SELECTOR_LABEL,
    RADIO_VOTE_ACTIONS,
    OPINION_MAP,
  } from './const'

  import _ from 'lodash-es'

  import approvalOpinion from '@/mixins/approvalOpinion'
  import reject from '@/mixins/reject'

  import bottOrder from './bottOrder.vue'
  import TaskSelectDestination from './TaskSelectDestination.vue'
  import ButtonSelect from '@/views/matter/components/ButtonSelect'

  import agreeButton from '@/mixins/agreeButton'

  import { Base64 } from 'js-base64'

  import { getCurrentSeal } from '@/api/uc.js'
  export default {
    name: 'ApprovalDialog',
    mixins: [approvalOpinion, reject, agreeButton],
    components: {
      bottOrder,
      TaskSelectDestination,
      ButtonSelect,
    },
    props: {
      currentAlias: {
        type: String,
        default: '',
      },
      show: {
        type: Boolean,
        default: false,
      },
      curNodeDef: {
        type: Object,
        default: () => {},
      },
      bpmTask: {
        type: Object,
        default: () => {},
      },
      data: {
        type: Object,
        default: () => {},
      },
      formType: {
        type: String,
        default: '',
      },
    },
    data() {
      return {
        actions: [],
        activeNames: [],
        form: {
          userIds: '',
          opinion: '',
          saveType: ONLY_SAVA_FORM,
          users: '',
          fileList: [],
          inquiryType: 'direct',
          radioVote: '1', //任务通过规则 1-全票通过,2-一票否决,3-一票同意,4-自定义
          decideType: 'agree', //计票策略
          voteType: 'percent', //投票类型
          voteAmount: '100', //票数
          signType: 'parallel', //流转类型
          action: 'submit', //流转结束后的动作
          rejectRecallMode: 'normal',
          rejectMethod: '',
          nodeId: '',
          signaturePassword: '',
          selectNodeId: '',
        },
        savaFormAndOpinion: SAVA_FORM_OPINION,
        approvalActionTitle: APPROVAL_ACTION_TITLE,
        showApprovalAction: false,
        userSelectorLabel: USER_SELECTOR_LABEL,
        pattern: new RegExp('^(\\d|[1-9]\\d|100)$'),
        showSelectNode: false,
        searchKeywords: '',
        nodeList: [],
        currentSelectNodeAndUser: '',
        otherNodeUser: '',
        selectedNodeAndUser: null,
        radioVoteActions: RADIO_VOTE_ACTIONS,
        agreeParams: null,
        rejectUserIds: '',
        selectNodeName: '',
        confirmLoading: false,
      }
    },
    computed: {
      taskId() {
        return this.$route.query.taskId || this.$route.params.taskId
      },
      instId() {
        return this.$route.query.instId || this.$route.params.instId
      },
      leaderId() {
        return this.$route.query.leaderId || this.$route.params.leaderId
      },
      isShowUserSelector() {
        return ['addSign', 'inqu', 'startTrans', 'delegate'].includes(
          this.currentAlias
        )
      },
      status() {
        return this.$route.query.status
      },
      isShowInquiryType() {
        return this.status !== 'TRANSFORMEDINQU'
      },
      isSingle() {
        return ['inqu', 'delegate'].includes(this.currentAlias) ? true : false
      },

      isShowAttachment() {
        return ['saveDraft', 'revoke'].includes(this.currentAlias)
          ? false
          : true
      },
    },
    watch: {
      show(val) {
        this.showApprovalAction = val
        if (val) {
          //打开弹窗清除表单数据
          this.resetFormData()
          this.$nextTick(() => {
            this.$refs.approvalActionForm &&
              this.$refs.approvalActionForm.resetValidation()
          })
        }
      },
      showApprovalAction(val) {
        if (val) {
          this.form.opinion = this.form.opinion
            ? this.form.opinion
            : OPINION_MAP[this.currentAlias]
        }
      },
      'form.radioVote': {
        handler(val) {
          // 1-全票通过，2-一票否决，3-一票同意，4-自定义
          if (val === '1') {
            this.form.voteType = 'percent'
            this.form.decideType = 'agree'
            this.form.voteAmount = '100'
          } else if (val === '2') {
            this.form.voteType = 'amount'
            this.form.decideType = 'refuse'
            this.form.voteAmount = '1'
          } else if (val === '3') {
            this.form.voteType = 'amount'
            this.form.decideType = 'agree'
            this.form.voteAmount = '1'
          }
        },
      },
      signatureStatus(val) {
        if (this.isShowSignature && val === 'success') {
          this.validateSignature()
        }
      },
      // 监听驳回的节点id变化。发生变化时从会签历史用户的map中取出历史审批人，选中
      destinationNodeId: function (nval, oval) {
        if (this.rejectInfo.signTaskHisAssignMap[nval]) {
          let ids = []
          this.rejectInfo.signTaskHisAssignMap[nval].forEach((i) => {
            ids.push(i.id)
          })
          this.$set(this, 'rejectUserIds', ids.join(','))
        }
      },
      'form.rejectMethod'(newVal, oldVal) {
        if (newVal !== oldVal) {
          this.form.nodeId = ''
        }
      },
    },
    methods: {
      openApprovalAction() {
        //打开弹窗清除表单数据
        this.resetFormData()
        //驳回打开弹窗
        if (
          this.curNodeDef?.type === 'USERTASK' &&
          this.bpmTask?.parentId != '0'
        ) {
          this.parentTaskId = this.bpmTask.parentId
        }
        this.getRejectTaskParamsByTaskId(true)
      },
      selectOften(val) {
        this.form.opinion = `${this.form.opinion ? this.form.opinion : ''}${
          val.name
        }`
      },
      getFileList(list) {
        this.form.fileList = list
      },
      handleClose() {
        this.showApprovalAction = false
        this.$emit('update:show', false)
        this.resetFormData()
      },
      handleConfirm() {
        this.$refs.approvalActionForm
          .validate()
          .then(() => {
            this.confirmLoading = true
            let params = {}
            if (this.currentAlias === 'reject') {
              params = {
                actionName:
                  this.form.rejectMethod == 'backToStart'
                    ? 'backToStart'
                    : 'reject',
                backHandMode: this.form.rejectRecallMode,
                destination: this.form.nodeId,
                files: this.form.fileList && JSON.stringify(this.form.fileList),
                rejectTaskId: this.parentTaskId,
              }
              if (
                this.rejectUserIds &&
                this.rejectInfo.signTaskHisAssignMap[this.destinationNodeId]
              ) {
                let nodeUser = { nodeId: this.destinationNodeId, executors: [] }
                this.rejectUserIds.split(',').forEach((n) => {
                  nodeUser.executors.push({
                    id: n,
                    name: this.rejectInfo.signTaskHisAssignMap[
                      this.destinationNodeId
                    ].filter((a) => a.id == n)[0].name,
                  })
                })
                params.assignSignUser = true
                params.nodeUsers = JSON.stringify([nodeUser])
              }
            } else if (
              ['agree', 'oppose', 'agreeTrans', 'opposeTrans'].includes(
                this.currentAlias
              )
            ) {
              params = {
                ...this.getSubmitData(),
                isSelectNodeOrUser: this.nodeList && this.nodeList.length,
              }
              if (this.currentAlias === 'agree' && this.signatureField) {
                this.handleSignature()
              }
              this.agreeParams = { ...params }
            }
            if (!this.isShowSignature) {
              setTimeout(
                () => {
                  this.$emit(
                    'confirm',
                    {
                      ...this.form,
                      rejectParams: params,
                      agreeParams: params,
                      inquiryType: this.isShowInquiryType
                        ? this.form.inquiryType
                        : '',
                    },
                    () => {
                      this.confirmLoading = false
                    }
                  )
                },
                this.currentAlias === 'agree' ? 500 : 0
              )
            }
          })
          .catch((e) => {})
      },
      handleConfirmLoading() {
        this.confirmLoading = false
      },
      validateSignature() {
        getCurrentSeal(this.form.signaturePassword, this.secretFree).then(
          (res) => {
            if (res.state) {
              this.$emit('confirm', {
                ...this.form,
                agreeParams: this.agreeParams,
                inquiryType: this.isShowInquiryType
                  ? this.form.inquiryType
                  : '',
              })
            } else {
              this.$notify({ type: 'danger', message: res.message })
            }
          }
        )
      },
      handleSaveTypeChange(val) {
        if (val === this.savaFormAndOpinion) {
          this.getApprovalOpinionByInstIdAndTaskId()
        }
      },
      resetFormData() {
        this.form = {
          userIds: '',
          opinion: '',
          saveType: ONLY_SAVA_FORM,
          users: '',
          fileList: '',
          inquiryType: 'direct',

          radioVote: '1', //任务通过规则 1-全票通过,2-一票否决,3-一票同意,4-自定义
          decideType: 'agree', //计票策略
          voteType: 'percent', //投票类型
          voteAmount: '100', //票数
          signType: 'parallel', //流转类型
          action: 'submit', //流转结束后的动作
          rejectRecallMode: 'normal',
          rejectMethod: '',
          nodeId: '',
          signaturePassword: '',
          selectNodeId: '',
        }
        this.otherNodeUser = ''
        this.currentSelectNodeAndUser = ''
        this.selectNodeName = ''
        this.$nextTick(() => {
          if (this.$refs.buttonSelect && this.$refs.buttonSelect.length) {
            this.$refs.buttonSelect.map((item) => {
              item.handleClear()
            })
          }
        })
      },
      handleSelectNode() {
        this.searchKeywords = ''
        this.handleSearch()
        this.showSelectNode = true
      },
      handleCloseNodeAction() {
        this.showSelectNode = false
      },
      handleConfirmNodeAction() {
        const currentSelectNode = this.selectConfig.afterNodes.find(
          (item) => item.nodeId === this.form.selectNodeId
        )
        this.selectNodeName = currentSelectNode
          ? currentSelectNode.nodeName
          : ''
        this.showSelectNode = false
      },
      handleSearch() {
        const afterNodeList = _.cloneDeep(this.selectConfig.afterNodes)
        this.nodeList = afterNodeList.filter((item) =>
          item.nodeName.includes(this.searchKeywords)
        )
      },
      handleClear(type) {
        if (type === 'selectNodeId') {
          this.form.selectNodeId = ''
          this.selectNodeName = ''
        } else {
          this.otherNodeUser = ''
          this.currentSelectNodeAndUser = ''
          this.selectedNodeAndUser = null
          this.$refs.taskSelectDestination.clearNodeOrUser()
        }
      },
      handleSelectNodeAndUser() {
        const data = this.formType
          ? Base64.encode(JSON.stringify(this.data))
          : ''
        this.$refs.taskSelectDestination.showDailog(
          {
            data: data,
            isAgree: true,
            selectedNodeAndUser: this.selectedNodeAndUser,
          },
          JSON.stringify(this.form.fileList),
          this.form.opinion
        )
      },
      getCurrentSelected(data) {
        this.selectedNodeAndUser = { ...data }
        if (data.selectConfig) {
          this.selectConfig = data.selectConfig
        }
        this.selectNodeId = data.selectNodeId
        const nodeUserList = data?.nodeUsers?.map((item) => {
          return {
            ...item,
            executors: item.executors.filter((it) => it.id),
          }
        })
        const selectNodeUser = data?.nodeUsers?.find(
          (item) => item.nodeId === data.selectNodeId
        )
        let otherUser = []
        if (selectNodeUser && selectNodeUser.executors.length > 1) {
          otherUser = selectNodeUser.executors?.filter(
            (item, index) => index > 0
          )
        }

        const allUserCount = selectNodeUser && selectNodeUser.executors.length

        if (selectNodeUser) {
          this.currentSelectNodeAndUser = `${data.selectNodeName}/${selectNodeUser.executors[0].name}`
        } else {
          this.currentSelectNodeAndUser = data.selectNodeName
        }
        if (otherUser && otherUser.length) {
          const userNameList = otherUser.map((item) => item.name)
          this.otherNodeUser = `${userNameList.slice(0, 2).join(',')} ${
            allUserCount > 2 ? `共${allUserCount}人` : ''
          }`
        }
      },
    },
  }
</script>

<style lang="scss" scoped>
  .approval-action {
    .header {
      height: 44px;
      line-height: 44px;
      padding: 0 16px;
      display: flex;
      justify-content: space-between;
      .left-cancel,
      .right-confirm {
        color: $base-gray-text-color;
        font-size: $base-font-size-default;
        ::v-deep {
          .van-loading {
            text-align: center;
            .van-loading__spinner {
              width: 18px;
              height: 18px;
            }
          }
        }
      }
      .right-confirm {
        color: $--color-primary;
      }
      .center-title {
        color: $base-title-color;
        font-size: 17px;
      }
      .disabled-text {
        pointer-events: none;
      }
    }
    .btn-form-content {
      margin-top: 8px;
      .sava-type {
        padding: 12px 16px 16px 16px;
        ::v-deep {
          .van-radio {
            &:first-child {
              margin-bottom: 8px;
            }
          }
          .van-radio__label {
            color: $base-text-color;
          }
        }
      }
      .required-mark {
        align-items: center;
        ::v-deep {
          .van-field__label {
            flex-basis: 135px;
            color: $base-text-color;
            margin-right: 0;
            position: relative;
            &::after {
              content: '*';
              position: absolute;
              top: 0;
              color: $base-danger-color;
              font-size: $base-font-size-large;
            }
          }
          .van-radio {
            &:first-child {
              margin-right: 16px;
            }
            &:last-child {
              margin-right: 0;
            }
          }
          .van-action-sheet__cancel {
            padding: 12px 0;
          }
          .mobile-select__wrap {
            .van-cell__right-icon {
              font-size: 18px;
            }
            .van-icon-clear {
              font-size: 16px;
            }
          }
        }
      }

      .not-required {
        ::v-deep {
          .van-field__label {
            &::after {
              content: '';
            }
          }
        }
      }
      .field-item {
        ::v-deep {
          .van-field__value {
            margin-top: 2px;
          }
        }
      }
      ::v-deep {
        .van-field__word-limit {
          height: 40px;
          line-height: 40px;
          margin-top: 0;
          color: $base-gray-disabled-text-color;
          font-size: $base-font-size-default;
          .van-field__word-num {
            color: #333;
          }
        }
      }
    }
    ::v-deep {
      .van-popup {
        max-height: 80vh;
        overflow-y: unset;
        .node-user-list {
          height: calc(80vh - 84px);
          overflow-y: scroll;
        }
      }
      .van-field {
        padding: 12px 16px;
        .selected {
          width: 100%;
          justify-content: flex-end;
          display: flex;
          align-items: center;
          .select-val {
            color: $base-text-color;
            flex: 1;
            height: 20px;
            line-height: 20px;
          }
          .van-icon-clear {
            color: $base-gray-disabled-text-color;
            font-size: $base-font-size-big;
            padding-left: 8px;
            margin-top: 1px;
          }
          .van-icon-arrow {
            padding-left: 4px;
            margin-top: 2px;
            font-size: $base-font-size-bigger;
            color: $base-gray-text-color;
          }
        }
        .select-box {
          height: 44px;
          .select-val {
            display: flex;
            height: unset;
            line-height: unset;
            flex-direction: column;
          }
        }
        .no-value {
          .select-val {
            height: 20px;
          }
        }
        .van-field__control {
          text-align: right;
          color: $base-text-color;
        }
      }
      .postfix {
        .van-field__value {
          position: relative;
          margin-right: 22px;

          &::after {
            content: '%';
            position: absolute;
            top: 0;
            right: -22px;
            color: $base-text-color;
          }
        }
      }
      .opinion-input {
        height: unset;
        .van-field__control {
          text-align: left;
        }
      }
      .van-divider {
        margin: 8px 0 0;
      }
      .opinion-input {
        &::after {
          border-bottom: none;
        }
      }
      .van-field__error-message {
        text-align: right;
        color: $base-danger-color;
      }
      .van-field--error .van-field__control,
      .van-field--error .van-field__control::placeholder {
        color: $base-gray-disabled-text-color;
      }
      .van-action-sheet__content {
        max-height: 80vh;
        overflow-y: unset;
        .btn-form-content {
          max-height: calc(80vh - 52px);
          overflow-y: scroll;
        }
      }
      .van-collapse-item__content {
        padding: 0;
      }
      .van-field__value {
        .van-field__control {
          justify-content: flex-end;
        }
      }
      .van-hairline--top-bottom {
        &::after {
          border-top: none;
        }
      }
      .van-collapse-item {
        .van-collapse-item__title {
          padding: 12px 16px;
        }
        .van-icon-arrow {
        }
      }
      .van-search {
        padding: 8px 16px 0 16px;
        .van-search__content {
          border-radius: 8px;
          background: #f9f9f9;
          .van-cell {
            padding: 4px 0;
            .van-field__control {
              text-align: left;
            }
          }
        }
      }
      .node-list {
        margin: 12px 0 16px 0;
        .van-radio {
          height: 48px;
          display: flex;
          align-items: center;
          padding: 0 16px;
          border-bottom: 1px solid #eee;
          .van-radio__label {
            font-size: $base-font-size-default;
            margin-left: 12px;
            color: $base-text-color;
          }
        }
      }
    }
    .signature-box {
      .signature-title {
        height: 48px;
        line-height: 48px;
        margin: 0;
        padding-left: 16px;
        font-size: $base-font-size-default;
        color: $base-text-color;
      }
    }
    .user-wrap {
      padding-top: 5px;
      .sub-title {
        padding-left: 16px;
        color: $base-gray-text-color;
        font-size: $base-font-size-default;
      }
    }
    ::v-deep {
      .file-list__wrap.mobile-file-list .file-item {
        margin-bottom: 8px;
      }
    }
  }
  .sava-action-sheet {
    min-height: 40vh;
  }
</style>
