<template>
  <div class="system-explain">
    <div class="top">
      <el-button  type="primary" :icon="Plus" @click="save">保存</el-button>
    </div>
    <div class="content">
      <el-input type="textarea"   v-model="textarea"
                :autosize="{minRows:30,maxRows:30}"
                placeholder="Please input" />
    </div>
  </div>
</template>

<script>
import {Plus} from "@element-plus/icons-vue"
import {onBeforeMount, ref} from "vue";
import {proSelectXyxxIntroduce, proUpdateXyxxIntroduce} from "@/service/system-manage/system-explain/system-explain";
import {handleMes} from "@/units/element-ui/tip";
import {InsertSyslog} from "@/units/use-method/user-log";
export default {
  name: "SystemExplain",
  computed: {
    Plus(){
      return Plus
    }
  },
  setup(){
    const textarea = ref(null);
    function save(){
      proUpdateXyxxIntroduce({
        text:textarea.value
      }).then(res =>{
        handleMes(res,() => {
          InsertSyslog(localStorage.getItem("xyxx_usercode"),localStorage.getItem("xyxx_unitcode"), "信息修改", "系统说明修改成功", "系统说明", "")
          getData()
        })
      })
    }
    function getData(){
      proSelectXyxxIntroduce().then(res =>{
        InsertSyslog(localStorage.getItem("xyxx_usercode"),localStorage.getItem("xyxx_unitcode"), "信息查询", "系统说明查询成功", "系统说明", "")
        textarea.value = res.msg[0].Rows[0].TEXT;
      })
    }
    onBeforeMount(()=>{
      getData()
    })
    return {
      save,
      textarea
    }
  }
}
</script>

<style scoped lang="scss">
.system-explain{

}
.top{
  float: right;
  padding: 20px;
}
.content{
  height: 600px;
}
:deep{
  .el-textarea__inner{
    background: #eee;
  }
}
</style>