<template>
  <Modal
    :closable="false"
    :mask-closable="false"
    :title="data?'编辑机构':'添加机构'"
    @on-visible-change="visibleChange"
    v-model="my_show"
  >
    <div class="page-edit-wrap uinn-lr20">
      <ui-loading :show="page_loading.show"></ui-loading>

      <ul>
        <li class="ui-list">
          <div class="ui-list-title">
            <span class="title-require">*</span>所属企业:
          </div>
          <div class="ui-list-content">
            <Select
              filterable
              placeholder="请选择所属企业"
              v-model.trim="params.company_id"
              :disabled="data ? true : false"
            >
              <Option :value="item.id" :key="item.id" v-for="item in companies">{{ item.name }}</Option>
            </Select>
          </div>
        </li>

        <li class="ui-list">
          <div class="ui-list-title">
            <span class="title-require">*</span>机构名称：
          </div>
          <div class="ui-list-content">
            <p>
              <Input :disabled="data?true:false" v-model.trim="params.name"></Input>
            </p>
            <ul class="common-tips-wraper umar-t5">
              <li class="t-title">提示</li>
              <li class="t-content">长度在2-32之间</li>
            </ul>
          </div>
        </li>

        <li class="ui-list">
          <div class="ui-list-title">联系人：</div>
          <div class="ui-list-content">
            <p>
              <Input :maxlength="32" v-model.trim="params.contacts"></Input>
            </p>
            <ul class="common-tips-wraper umar-t5">
              <li class="t-title">提示</li>
              <li class="t-content">长度在2-32之间</li>
            </ul>
          </div>
        </li>

        <li class="ui-list">
          <div class="ui-list-title">手机号：</div>
          <div class="ui-list-content">
            <Input v-model.trim="params.mobile"></Input>
          </div>
        </li>

        <li class="ui-list">
          <div class="ui-list-title">地址:</div>
          <div class="ui-list-content">
            <p>
              <Input :maxlength="32" v-model.trim="params.address"></Input>
            </p>
          </div>
        </li>

        <li class="ui-list">
          <div class="ui-list-title">备注:</div>
          <div class="ui-list-content">
            <p>
              <Input v-model.trim="params.remark"></Input>
            </p>
          </div>
        </li>

        <li class="ui-list">
          <div class="ui-list-title">状态：</div>
          <div class="ui-list-content lh-32">
            <Switch size="large" :true-value="0" :false-value="1" v-model="params.status">
              <span slot="open">启用</span>
              <span slot="close">禁用</span>
            </Switch>
          </div>
        </li>
      </ul>
    </div>
    <footer class="ta-c" slot="footer">
      <Button @click="clear" class="w-80" ghost type="primary">取消</Button>
      <Button :loading="loading" @click="ok" class="w-80" type="primary">提交</Button>
    </footer>
  </Modal>
</template>

<script src="./js/edit.js"></script>
