shuishen
2023-12-15 10964ea959757a6cc2871ae769bd4687595eac80
首页更换,部分菜单,操作栏调整,部分样式调整
28 files modified
6 files added
12176 ■■■■ changed files
public/favicon.png patch | view | raw | blame | history
public/img/anjian.png patch | view | raw | blame | history
public/img/bjkeji.png patch | view | raw | blame | history
public/img/fangyi.png patch | view | raw | blame | history
public/img/logo.png patch | view | raw | blame | history
public/img/tiwen.png patch | view | raw | blame | history
public/img/tongji.png patch | view | raw | blame | history
public/img/yijianbaoj.png patch | view | raw | blame | history
src/page/login/index.vue 218 ●●●● patch | view | raw | blame | history
src/styles/login.scss 269 ●●●● patch | view | raw | blame | history
src/styles/media.scss 328 ●●●● patch | view | raw | blame | history
src/util/util.js 14 ●●●●● patch | view | raw | blame | history
src/views/district/index.vue 616 ●●●● patch | view | raw | blame | history
src/views/grid/gridWorkLog/index.vue 604 ●●●● patch | view | raw | blame | history
src/views/grid/gridman.vue 595 ●●●● patch | view | raw | blame | history
src/views/grid/index.vue 591 ●●●● patch | view | raw | blame | history
src/views/monitor/log/api.vue 279 ●●●● patch | view | raw | blame | history
src/views/monitor/log/error.vue 289 ●●●● patch | view | raw | blame | history
src/views/monitor/log/usual.vue 289 ●●●● patch | view | raw | blame | history
src/views/place/index.vue 914 ●●●● patch | view | raw | blame | history
src/views/rotation/index.vue 557 ●●●● patch | view | raw | blame | history
src/views/task/eCall/index.vue 1034 ●●●● patch | view | raw | blame | history
src/views/task/index.vue 718 ●●●● patch | view | raw | blame | history
src/views/task/reportForRepairs.vue 608 ●●●● patch | view | raw | blame | history
src/views/tool/code.vue 1179 ●●●● patch | view | raw | blame | history
src/views/tool/datasource.vue 508 ●●●● patch | view | raw | blame | history
src/views/tool/model.vue 679 ●●●● patch | view | raw | blame | history
src/views/userHouse/houseHoldList.vue 1 ●●●● patch | view | raw | blame | history
src/views/wel/index.vue 177 ●●●● patch | view | raw | blame | history
src/views/work/claim.vue 357 ●●●● patch | view | raw | blame | history
src/views/work/done.vue 313 ●●●● patch | view | raw | blame | history
src/views/work/send.vue 332 ●●●● patch | view | raw | blame | history
src/views/work/start.vue 378 ●●●● patch | view | raw | blame | history
src/views/work/todo.vue 329 ●●●● patch | view | raw | blame | history
public/favicon.png

public/img/anjian.png
public/img/bjkeji.png
public/img/fangyi.png
public/img/logo.png

public/img/tiwen.png
public/img/tongji.png
public/img/yijianbaoj.png
src/page/login/index.vue
@@ -1,134 +1,134 @@
<template>
  <div class="login-container"
       ref="login"
       @keyup.enter.native="handleLogin">
    <top-color v-show="false"></top-color>
    <div class="login-weaper animated bounceInDown">
      <div class="login-left">
        <div class="login-time">
          {{time}}
        </div>
        <p class="title">{{ $t('login.info') }}</p>
      <!--<img class="img" src="/img/logo.png" alt="">-->
      </div>
      <div class="login-border">
        <div class="login-main">
          <h4 class="login-title">
            {{ $t('login.title') }}
            <!-- <top-lang></top-lang> -->
          </h4>
          <userLogin v-if="activeName==='user'"></userLogin>
          <!-- <codeLogin v-else-if="activeName==='code'"></codeLogin> -->
          <!-- <thirdLogin v-else-if="activeName==='third'"></thirdLogin> -->
          <div class="login-menu">
            <!-- <a href="#" @click.stop="activeName='user'">{{ $t('login.userLogin') }}</a> -->
            <!--<a href="#" @click.stop="activeName='code'">{{ $t('login.phoneLogin') }}</a>-->
            <!-- <a href="#" @click.stop="activeName='third'">{{ $t('login.thirdLogin') }}</a> -->
            <!-- <a :href="website.ssoUrl + website.redirectUri">{{ $t('login.ssoLogin') }}</a> -->
          </div>
        </div>
    <div class="login-container" ref="login" @keyup.enter.native="handleLogin">
        <top-color v-show="false"></top-color>
        <div class="login-weaper animated bounceInDown">
            <div class="login-left">
                <div class="login-time">
                    {{ time }}
                </div>
                <!-- <img class="img" src="/img/logo.png" alt=""> -->
                <p class="title">{{ $t('login.info') }}</p>
            </div>
            <div class="login-border">
                <img class="img" src="/img/logo.png" alt="">
                <div class="login-main">
      </div>
                    <h4 class="login-title">
                        {{ $t('login.title') }}
                        <!-- <top-lang></top-lang> -->
                    </h4>
                    <userLogin v-if="activeName === 'user'"></userLogin>
                    <!-- <codeLogin v-else-if="activeName==='code'"></codeLogin> -->
                    <!-- <thirdLogin v-else-if="activeName==='third'"></thirdLogin> -->
                    <div class="login-menu">
                        <!-- <a href="#" @click.stop="activeName='user'">{{ $t('login.userLogin') }}</a> -->
                        <!--<a href="#" @click.stop="activeName='code'">{{ $t('login.phoneLogin') }}</a>-->
                        <!-- <a href="#" @click.stop="activeName='third'">{{ $t('login.thirdLogin') }}</a> -->
                        <!-- <a :href="website.ssoUrl + website.redirectUri">{{ $t('login.ssoLogin') }}</a> -->
                    </div>
                </div>
            </div>
        </div>
    </div>
  </div>
</template>
<script>
  import userLogin from "./userlogin";
  import codeLogin from "./codelogin";
  import thirdLogin from "./thirdlogin";
  import {mapGetters} from "vuex";
  import {dateFormat} from "@/util/date";
  import {validatenull} from "@/util/validate";
  import topLang from "@/page/index/top/top-lang";
  import topColor from "@/page/index/top/top-color";
  import {getQueryString, getTopUrl} from "@/util/util";
import userLogin from "./userlogin"
import codeLogin from "./codelogin"
import thirdLogin from "./thirdlogin"
import { mapGetters } from "vuex"
import { dateFormat } from "@/util/date"
import { validatenull } from "@/util/validate"
import topLang from "@/page/index/top/top-lang"
import topColor from "@/page/index/top/top-color"
import { getQueryString, getTopUrl } from "@/util/util"
  export default {
export default {
    name: "login",
    components: {
      userLogin,
      codeLogin,
      thirdLogin,
      topLang,
      topColor
        userLogin,
        codeLogin,
        thirdLogin,
        topLang,
        topColor
    },
    data() {
      return {
        time: "",
        activeName: "user",
        socialForm: {
          tenantId: "000000",
          source: "",
          code: "",
          state: "",
    data () {
        return {
            time: "",
            activeName: "user",
            socialForm: {
                tenantId: "000000",
                source: "",
                code: "",
                state: "",
            }
        }
      };
    },
    watch: {
      $route() {
        this.handleLogin();
      }
        $route () {
            this.handleLogin()
        }
    },
    created() {
      this.handleLogin();
      this.getTime();
    created () {
        this.handleLogin()
        this.getTime()
    },
    mounted() {
    mounted () {
    },
    computed: {
      ...mapGetters(["website", "tagWel"])
        ...mapGetters(["website", "tagWel"])
    },
    props: [],
    methods: {
      getTime() {
        setInterval(() => {
          this.time = dateFormat(new Date());
        }, 1000);
      },
      handleLogin() {
        const topUrl = getTopUrl();
        const redirectUrl = "/oauth/redirect/";
        const ssoCode = "?code=";
        this.socialForm.source = getQueryString("source");
        this.socialForm.code = getQueryString("code");
        this.socialForm.state = getQueryString("state");
        if (validatenull(this.socialForm.source) && topUrl.includes(redirectUrl)) {
          let source = topUrl.split("?")[0];
          source = source.split(redirectUrl)[1];
          this.socialForm.source = source;
        getTime () {
            setInterval(() => {
                this.time = dateFormat(new Date())
            }, 1000)
        },
        handleLogin () {
            const topUrl = getTopUrl()
            const redirectUrl = "/oauth/redirect/"
            const ssoCode = "?code="
            this.socialForm.source = getQueryString("source")
            this.socialForm.code = getQueryString("code")
            this.socialForm.state = getQueryString("state")
            if (validatenull(this.socialForm.source) && topUrl.includes(redirectUrl)) {
                let source = topUrl.split("?")[0]
                source = source.split(redirectUrl)[1]
                this.socialForm.source = source
            }
            if (topUrl.includes(redirectUrl) && !validatenull(this.socialForm.source) && !validatenull(this.socialForm.code) && !validatenull(this.socialForm.state)) {
                const loading = this.$loading({
                    lock: true,
                    text: '第三方系统登录中,请稍后。。。',
                    spinner: "el-icon-loading"
                })
                this.$store.dispatch("LoginBySocial", this.socialForm).then(() => {
                    window.location.href = topUrl.split(redirectUrl)[0]
                    this.$router.push({ path: this.tagWel.value })
                    loading.close()
                }).catch(() => {
                    loading.close()
                })
            } else if (!topUrl.includes(redirectUrl) && !validatenull(this.socialForm.code) && !validatenull(this.socialForm.state)) {
                const loading = this.$loading({
                    lock: true,
                    text: '单点系统登录中,请稍后。。。',
                    spinner: "el-icon-loading"
                })
                this.$store.dispatch("LoginBySso", this.socialForm).then(() => {
                    window.location.href = topUrl.split(ssoCode)[0]
                    this.$router.push({ path: this.tagWel.value })
                    loading.close()
                }).catch(() => {
                    loading.close()
                })
            }
        }
        if (topUrl.includes(redirectUrl) && !validatenull(this.socialForm.source) && !validatenull(this.socialForm.code) && !validatenull(this.socialForm.state)) {
          const loading = this.$loading({
            lock: true,
            text: '第三方系统登录中,请稍后。。。',
            spinner: "el-icon-loading"
          });
          this.$store.dispatch("LoginBySocial", this.socialForm).then(() => {
            window.location.href = topUrl.split(redirectUrl)[0];
            this.$router.push({path: this.tagWel.value});
            loading.close();
          }).catch(() => {
            loading.close();
          });
        } else if (!topUrl.includes(redirectUrl) && !validatenull(this.socialForm.code) && !validatenull(this.socialForm.state)) {
          const loading = this.$loading({
            lock: true,
            text: '单点系统登录中,请稍后。。。',
            spinner: "el-icon-loading"
          });
          this.$store.dispatch("LoginBySso", this.socialForm).then(() => {
            window.location.href = topUrl.split(ssoCode)[0];
            this.$router.push({path: this.tagWel.value});
            loading.close();
          }).catch(() => {
            loading.close();
          });
        }
      }
    }
  };
}
</script>
<style lang="scss">
  @import "@/styles/login.scss";
@import "@/styles/login.scss";
</style>
src/styles/login.scss
@@ -1,184 +1,193 @@
.login-container {
  display: flex;
  align-items: center;
  position: relative;
  width: 100%;
  height: 100%;
  margin: 0 auto;
  background-color: #469BC0;
  // background-image: url("/img/bg/bg.jpg");
  background-size: 100% 100%;
    display: flex;
    align-items: center;
    position: relative;
    width: 100%;
    height: 100%;
    margin: 0 auto;
    background-color: #469BC0;
    // background-image: url("/img/bg/bg.jpg");
    background-size: 100% 100%;
}
.login-weaper {
  margin: 0 auto;
  width: 1000px;
  box-shadow: -4px 5px 10px rgba(0, 0, 0, 0.4);
    margin: 0 auto;
    width: 1000px;
    box-shadow: -4px 5px 10px rgba(0, 0, 0, 0.4);
  .el-input-group__append {
    border: none;
  }
    .el-input-group__append {
        border: none;
    }
}
.login-left,
.login-border {
  position: relative;
  min-height: 500px;
  align-items: center;
  display: flex;
    position: relative;
    min-height: 500px;
    align-items: center;
    display: flex;
}
.login-left {
  border-top-left-radius: 5px;
  border-bottom-left-radius: 5px;
  justify-content: center;
  flex-direction: column;
  background-color: #5A9CF8 !important;;
  color: #fff;
  float: left;
  width: 50%;
  position: relative;
    border-top-left-radius: 5px;
    border-bottom-left-radius: 5px;
    justify-content: center;
    flex-direction: column;
    background-color: #5A9CF8 !important;
    ;
    color: #fff;
    float: left;
    width: 50%;
    position: relative;
}
.login-left .img {
  width: 140px;
    width: 140px;
}
.login-time {
  position: absolute;
  left: 25px;
  top: 25px;
  width: 100%;
  color: #fff;
  font-weight: 200;
  opacity: 0.9;
  font-size: 18px;
  overflow: hidden;
    position: absolute;
    left: 25px;
    top: 25px;
    width: 100%;
    color: #fff;
    font-weight: 200;
    opacity: 0.9;
    font-size: 18px;
    overflow: hidden;
}
.login-left .title {
  text-align: center;
  color: #fff;
  font-weight: bold;
  font-size: 30px;
  letter-spacing: 2px;
    text-align: center;
    color: #fff;
    font-weight: bold;
    font-size: 30px;
    letter-spacing: 2px;
}
.login-border {
  border-left: none;
  border-top-right-radius: 5px;
  border-bottom-right-radius: 5px;
  color: #fff;
  background-color: #fff;
  width: 50%;
  float: left;
  box-sizing: border-box;
    border-left: none;
    border-top-right-radius: 5px;
    border-bottom-right-radius: 5px;
    color: #fff;
    background-color: #fff;
    width: 50%;
    float: left;
    box-sizing: border-box;
    position: relative;
    .img {
        position: absolute;
        top: 10px;
        right: 10px;
        width: 180px;
    }
}
.login-main {
  margin: 0 auto;
  width: 65%;
  box-sizing: border-box;
    margin: 0 auto;
    width: 65%;
    box-sizing: border-box;
}
.login-main > h3 {
  margin-bottom: 20px;
.login-main>h3 {
    margin-bottom: 20px;
}
.login-main > p {
  color: #76838f;
.login-main>p {
    color: #76838f;
}
.login-title {
  color: #333;
  margin-bottom: 40px;
  font-weight: 500;
  font-size: 22px;
  text-align: center;
  letter-spacing: 4px;
    color: #333;
    margin-bottom: 40px;
    font-weight: 500;
    font-size: 22px;
    text-align: center;
    letter-spacing: 4px;
}
.login-menu {
  margin-top: 40px;
  width: 100%;
  text-align: center;
    margin-top: 40px;
    width: 100%;
    text-align: center;
  a {
    color: #999;
    font-size: 12px;
    margin: 0px 8px;
  }
    a {
        color: #999;
        font-size: 12px;
        margin: 0px 8px;
    }
}
.login-submit {
  width: 100%;
  height: 45px;
  border: 1px solid #409EFF;
  background: none;
  font-size: 18px;
  letter-spacing: 2px;
  font-weight: 300;
  color: #409EFF;
  cursor: pointer;
  margin-top: 30px;
  font-family: "neo";
  transition: 0.25s;
    width: 100%;
    height: 45px;
    border: 1px solid #409EFF;
    background: none;
    font-size: 18px;
    letter-spacing: 2px;
    font-weight: 300;
    color: #409EFF;
    cursor: pointer;
    margin-top: 30px;
    font-family: "neo";
    transition: 0.25s;
}
.login-form {
  margin: 10px 0;
    margin: 10px 0;
  i {
    color: #333;
  }
  .el-form-item__content {
    width: 100%;
  }
  .el-form-item {
    margin-bottom: 12px;
  }
  .el-input {
    input {
      padding-bottom: 10px;
      text-indent: 5px;
      background: transparent;
      border: none;
      border-radius: 0;
      color: #333;
      border-bottom: 1px solid rgb(235, 237, 242);
    i {
        color: #333;
    }
    .el-input__prefix {
      i {
        padding: 0 5px;
        font-size: 16px !important;
      }
    .el-form-item__content {
        width: 100%;
    }
  }
    .el-form-item {
        margin-bottom: 12px;
    }
    .el-input {
        input {
            padding-bottom: 10px;
            text-indent: 5px;
            background: transparent;
            border: none;
            border-radius: 0;
            color: #333;
            border-bottom: 1px solid rgb(235, 237, 242);
        }
        .el-input__prefix {
            i {
                padding: 0 5px;
                font-size: 16px !important;
            }
        }
    }
}
.login-code {
  display: flex;
  align-items: center;
  justify-content: space-around;
  margin: 0 0 0 10px;
    display: flex;
    align-items: center;
    justify-content: space-around;
    margin: 0 0 0 10px;
}
.login-code-img {
  margin-top: 2px;
  width: 100px;
  height: 38px;
  background-color: #fdfdfd;
  border: 1px solid #f0f0f0;
  color: #333;
  font-size: 14px;
  font-weight: bold;
  letter-spacing: 5px;
  line-height: 38px;
  text-indent: 5px;
  text-align: center;
  cursor:pointer!important;
}
    margin-top: 2px;
    width: 100px;
    height: 38px;
    background-color: #fdfdfd;
    border: 1px solid #f0f0f0;
    color: #333;
    font-size: 14px;
    font-weight: bold;
    letter-spacing: 5px;
    line-height: 38px;
    text-indent: 5px;
    text-align: center;
    cursor: pointer !important;
}
src/styles/media.scss
@@ -2,181 +2,195 @@
.avue-header,
.avue-top,
.avue-logo,
.avue-layout
.login-logo,
.avue-layout .login-logo,
.avue-main {
  transition: all .3s;
    transition: all .3s;
}
.avue-contail {
  width: 100%;
  height: 100%;
  background: #f0f2f5;
  background-size: 100%;
  background-repeat: no-repeat;
    width: 100%;
    height: 100%;
    background: #f0f2f5;
    background-size: 100%;
    background-repeat: no-repeat;
}
.avue-left {
  position: fixed;
  left: 0;
  top: 0;
  width: 240px;
  height: 100%;
  z-index: 1025;
    position: fixed;
    left: 0;
    top: 0;
    width: 240px;
    height: 100%;
    z-index: 1025;
}
.avue--collapse {
  .avue-left,
  .avue-logo {
    width: 60px;
  }
  .avue-header {
    padding-left: 60px;
  }
  .avue-main {
    width: calc(100% - 60px);
    left: 60px;
  }
}
.avue-header {
  padding-left: 240px;
  width: 100%;
  background-color: #fff;
  box-sizing: border-box;
}
.avue-main {
  position: absolute;
  left: 240px;
  padding: 0;
  padding-bottom: 20px;
  width: calc(100% - 240px);
  height: calc(100% - 64px);
  box-sizing: border-box;
  overflow: hidden;
  transition: all 0.5s;
  background: #f0f2f5;
  z-index: 1026;
  &--fullscreen {
    width: 100%;
    left: 0;
  }
}
.avue-view {
  padding: 0 10px !important;
  width: 100%;
  box-sizing: border-box;
}
.avue-footer {
  margin: 0 auto;
  padding: 0 22px;
  width: 1300px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  .logo {
    margin-left: -50px;
  }
  .copyright {
    color: #666;
    line-height: 1.5;
    font-size: 12px;
  }
}
.avue-shade {
  position: fixed;
  display: none;
  width: 100%;
  height: 100%;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, .3);
  z-index: 1024;
  &--show {
    display: block;
  }
}
@media screen and (max-width: 992px) {
  $width: 240px;
  // ele的自适应
  .el-dialog,
  .el-message-box {
    width: 98% !important;
  }
  //登录页面
  .login-left {
    display: none !important;
  }
  .login-logo {
    padding-top: 30px !important;
    margin-left: -30px;
  }
  .login-weaper {
    margin: 0 auto;
    width: 96% !important;
  }
  .login-border {
    border-radius: 5px;
    padding: 40px;
    margin: 0 auto;
    float: none !important;
    width: 100% !important;
  }
  .login-main {
    width: 100% !important;
  }
  //主框架
  .avue-tags {
    display: none;
  }
  .avue-left,
  .avue-logo {
    left: -$width;
  }
  .avue-main {
    left: 0;
    width: 100%;
  }
  .avue-header {
    margin-bottom: 15px;
    padding-left: 15px;
  }
  .top-bar__item {
    display: none;
  }
  .avue--collapse {
    .avue-left,
    .avue-logo {
      width: $width;
      left: 0;
    }
    .avue-main {
      left: $width;
      width: 100%;
        width: 60px;
    }
    .avue-header {
      padding: 0;
      transform: translate3d(230px, 0, 0);
        padding-left: 60px;
    }
    .avue-shade {
      display: block;
    .avue-main {
        width: calc(100% - 60px);
        left: 60px;
    }
  }
}
.avue-header {
    padding-left: 240px;
    width: 100%;
    background-color: #fff;
    box-sizing: border-box;
}
.avue-main {
    position: absolute;
    left: 240px;
    padding: 0;
    padding-bottom: 20px;
    width: calc(100% - 240px);
    height: calc(100% - 64px);
    box-sizing: border-box;
    overflow: hidden;
    transition: all 0.5s;
    background: #f0f2f5;
    z-index: 1026;
    &--fullscreen {
        width: 100%;
        left: 0;
    }
}
.avue-view {
    padding: 0 10px !important;
    width: 100%;
    box-sizing: border-box;
}
.avue-footer {
    margin: 0 auto;
    padding: 0 22px;
    width: 1300px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    .logo {
        margin-left: -50px;
    }
    .copyright {
        color: #666;
        line-height: 1.5;
        font-size: 12px;
    }
}
.avue-shade {
    position: fixed;
    display: none;
    width: 100%;
    height: 100%;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, .3);
    z-index: 1024;
    &--show {
        display: block;
    }
}
@media screen and (max-width: 992px) {
    $width: 240px;
    // ele的自适应
    .el-dialog,
    .el-message-box {
        width: 98% !important;
    }
    //登录页面
    .login-left {
        display: none !important;
    }
    .login-logo {
        padding-top: 30px !important;
        margin-left: -30px;
    }
    .login-weaper {
        margin: 0 auto;
        width: 96% !important;
    }
    .login-border {
        border-radius: 5px;
        padding: 40px;
        margin: 0 auto;
        float: none !important;
        width: 100% !important;
        position: relative;
    }
    .login-main {
        width: 100% !important;
    }
    //主框架
    .avue-tags {
        display: none;
    }
    .avue-left,
    .avue-logo {
        left: -$width;
    }
    .avue-main {
        left: 0;
        width: 100%;
    }
    .avue-header {
        margin-bottom: 15px;
        padding-left: 15px;
    }
    .top-bar__item {
        display: none;
    }
    .avue--collapse {
        .avue-left,
        .avue-logo {
            width: $width;
            left: 0;
        }
        .avue-main {
            left: $width;
            width: 100%;
        }
        .avue-header {
            padding: 0;
            transform: translate3d(230px, 0, 0);
        }
        .avue-shade {
            display: block;
        }
    }
}
src/util/util.js
@@ -389,3 +389,17 @@
    window.open(URL.createObjectURL(file));
  }
}
export const processArray = (arr) => {
    arr.forEach(item => {
        if ('children' in item && item.children.length > 0) {
            item.children = processArray(item.children)
        } else {
            if ('children' in item) {
                delete item.children
            }
        }
    })
    return arr
}
src/views/district/index.vue
@@ -1,326 +1,326 @@
<template>
  <basic-container>
    <avue-crud :option="option" :table-loading="loading" :data="data" :page.sync="page" ref="crud" @row-del="rowDel"
      v-model="form" :permission="permissionList" @row-update="rowUpdate" @row-save="rowSave" :before-open="beforeOpen"
      @search-change="searchChange" @search-reset="searchReset" @selection-change="selectionChange"
      @current-change="currentChange" @size-change="sizeChange" @refresh-change="refreshChange" @on-load="onLoad">
      <template slot="menuLeft">
        <el-button size="small" icon="el-icon-delete" plain v-if="permission.district_delete" @click="handleDelete">删 除
        </el-button>
      </template>
    </avue-crud>
  </basic-container>
    <basic-container>
        <avue-crud :option="option" :table-loading="loading" :data="data" :page.sync="page" ref="crud" @row-del="rowDel"
            v-model="form" :permission="permissionList" @row-update="rowUpdate" @row-save="rowSave"
            :before-open="beforeOpen" @search-change="searchChange" @search-reset="searchReset"
            @selection-change="selectionChange" @current-change="currentChange" @size-change="sizeChange"
            @refresh-change="refreshChange" @on-load="onLoad">
            <template slot="menuLeft">
                <el-button size="small" icon="el-icon-delete" plain v-if="permission.district_delete"
                    @click="handleDelete">删 除
                </el-button>
            </template>
        </avue-crud>
    </basic-container>
</template>
<script>
import { getList, remove, update, add, getDistrict } from "@/api/district/index";
import { mapGetters } from "vuex";
import website from '@/config/website';
import { getList, remove, update, add, getDistrict } from "@/api/district/index"
import { mapGetters } from "vuex"
import website from '@/config/website'
export default {
  data() {
    return {
      form: {},
      query: {},
      loading: true,
      page: {
        pageSize: 10,
        currentPage: 1,
        total: 0,
      },
      datetime: "",
      selectionList: [],
      option: {
        height: "auto",
        calcHeight: 54,
        dialogWidth: 950,
        tip: false,
        searchShow: true,
        searchMenuSpan: 3,
        menuWidth: 350,
        border: true,
        //stripe:true,
        index: true,
        viewBtn: true,
        selection: true,
        dialogClickModal: false,
        column: [
          {
            label: "小区名称",
            prop: "name",
            searchSpan: 4,
            search: true,
            width:260,
            rules: [
              {
                required: true,
                message: "请输入小区名称",
                trigger: "blur",
              },
            ],
          },
          {
            label: "所属社区",
            prop: "communityCode",
            search: true,
            searchSpan: 4,
            width:110,
            type: "tree",
            dicUrl:"/api/blade-system/region/tree?parentCode=361102",
            // parent:false,
            defaultExpandedKeys:["361102003"],
            props: {
              label: "name",
              value: "id"
    data () {
        return {
            form: {},
            query: {},
            loading: true,
            page: {
                pageSize: 10,
                currentPage: 1,
                total: 0,
            },
            rules: [
              {
                required: true,
                message: "请选择所属社区",
                trigger: "blur",
              },
            ],
          },
          {
            label: "小区图片",
            prop: "picUrl",
            width: 80,
            type: "upload",
            listType: "picture-img",
            action: "/api/blade-resource/oss/endpoint/put-file",
            propsHttp: {
              res: "data",
              url: "link",
            datetime: "",
            selectionList: [],
            option: {
                height: "auto",
                calcHeight: 54,
                dialogWidth: 950,
                tip: false,
                searchShow: true,
                searchMenuSpan: 3,
                menuWidth: 280,
                border: true,
                //stripe:true,
                index: true,
                viewBtn: true,
                selection: true,
                dialogClickModal: false,
                column: [
                    {
                        label: "小区名称",
                        prop: "name",
                        searchSpan: 4,
                        search: true,
                        width: 260,
                        rules: [
                            {
                                required: true,
                                message: "请输入小区名称",
                                trigger: "blur",
                            },
                        ],
                    },
                    {
                        label: "所属社区",
                        prop: "communityCode",
                        search: true,
                        searchSpan: 4,
                        width: 150,
                        type: "tree",
                        dicUrl: "/api/blade-system/region/tree",
                        props: {
                            label: "name",
                            value: "id"
                        },
                        rules: [
                            {
                                required: true,
                                message: "请选择所属社区",
                                trigger: "blur",
                            },
                        ],
                    },
                    {
                        label: "小区图片",
                        prop: "picUrl",
                        width: 80,
                        type: "upload",
                        listType: "picture-img",
                        action: "/api/blade-resource/oss/endpoint/put-file",
                        propsHttp: {
                            res: "data",
                            url: "link",
                        },
                        span: 24,
                    },
                    {
                        label: "地址",
                        prop: "address",
                        span: 24,
                        rules: [
                            {
                                required: true,
                                message: "请输入地址",
                                trigger: "blur",
                            },
                        ],
                    },
                    {
                        label: "小区简介",
                        prop: "remark",
                        component: "AvueUeditor",
                        options: {
                            action: "/api/blade-resource/oss/endpoint/put-file",
                            props: {
                                res: "data",
                                url: "link",
                            },
                        },
                        hide: true,
                        minRows: 6,
                        span: 24,
                    },
                ],
            },
            span: 24,
          },
          {
            label: "地址",
            prop: "address",
            span: 24,
            rules: [
              {
                required: true,
                message: "请输入地址",
                trigger: "blur",
              },
            ],
          },
          {
            label: "小区简介",
            prop: "remark",
            component: "AvueUeditor",
            options: {
              action: "/api/blade-resource/oss/endpoint/put-file",
              props: {
                res: "data",
                url: "link",
              },
            },
            hide: true,
            minRows: 6,
            span: 24,
          },
        ],
      },
      data: [],
    };
  },
  watch: {
  },
  computed: {
    ...mapGetters(["permission", "userInfo"]),
    permissionList() {
      return {
        addBtn: this.vaildData(this.permission.district_add, true),
        viewBtn: this.vaildData(this.permission.district_view, true),
        delBtn: this.vaildData(this.permission.district_delete, true),
        editBtn: this.vaildData(this.permission.district_edit, true),
      };
    },
    ids() {
      let ids = [];
      this.selectionList.forEach((ele) => {
        ids.push(ele.id);
      });
      return ids.join(",");
    },
  },
  methods: {
    rowSave(row, done, loading) {
      if (row.picUrl.length > 0) {
        var urls = []
        var split = row.picUrl.split(",");
        split.forEach(url => {
          var names = url.split("jczz/");
          urls.push(names[1])
        })
        row.picUrl = urls.join(",")
      }
      row.userid = this.userInfo.user_id;
      add(row).then(
        () => {
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!",
          });
          done();
        },
        (error) => {
          window.console.log(error);
          loading();
            data: [],
        }
      );
    },
    rowUpdate(row, index, done, loading) {
      if (row.picUrl.length > 0) {
        var urls = []
        var split = row.picUrl.split(",");
        split.forEach(url => {
          var names = url.split("jczz/");
          urls.push(names[1])
        })
        row.picUrl = urls.join(",")
      }
      update(row).then(
        () => {
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!",
          });
          done();
        },
        (error) => {
          window.console.log(error);
          loading();
        }
      );
    watch: {
    },
    rowDel(row) {
      this.$confirm("确定将选择数据删除?", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          return remove(row.id);
        })
        .then(() => {
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!",
          });
        });
    },
    searchReset() {
      this.query = {};
      this.onLoad(this.page);
    },
    searchChange(params, done) {
      this.query = params;
      this.page.currentPage = 1;
      this.onLoad(this.page, params);
      done();
    },
    selectionChange(list) {
      this.selectionList = list;
    },
    selectionClear() {
      this.selectionList = [];
      this.$refs.crud.toggleSelection();
    },
    handleDelete() {
      if (this.selectionList.length === 0) {
        this.$message.warning("请选择至少一条数据");
        return;
      }
      this.$confirm("确定将选择数据删除?", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          return remove(this.ids);
        })
        .then(() => {
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!",
          });
          this.$refs.crud.toggleSelection();
        });
    },
    beforeOpen(done, type) {
      if (["edit", "view"].includes(type)) {
        getDistrict(this.form.id).then((res) => {
          this.form = res.data.data;
          if (this.form.picUrl.length > 0) {
            var urls = []
            var names = this.form.picUrl.split(",");
            names.forEach(name=>{
              urls.push(website.minioUrl + name)
            })
            this.form.picUrl = urls.join(",")
          }
        });
      }
      // con
      done();
    },
    currentChange(currentPage) {
      this.page.currentPage = currentPage;
    },
    sizeChange(pageSize) {
      this.page.pageSize = pageSize;
    },
    refreshChange() {
      this.onLoad(this.page, this.query);
    },
    onLoad(page, params = {}) {
      const { dateTime } = this.query;
      let values = {
        ...params,
      };
      if (dateTime) {
        values = {
          ...params,
          startTime: dateTime[0],
          endTime: dateTime[1],
          ...this.query,
        };
        values.dateTime = null;
      }
      this.loading = true;
      getList(page.currentPage, page.pageSize, values).then((res) => {
        const data = res.data.data;
        this.page.total = data.total;
        this.data = data.records;
        this.data.forEach(item=>{
          if(item.picUrl){
            if(item.picUrl.length>0){
              var urls = []
              var names = item.picUrl.split(",");
              names.forEach(name=>{
                urls.push(website.minioUrl + name)
              })
              item.picUrl = urls.join(",")
    computed: {
        ...mapGetters(["permission", "userInfo"]),
        permissionList () {
            return {
                addBtn: this.vaildData(this.permission.district_add, true),
                viewBtn: this.vaildData(this.permission.district_view, true),
                delBtn: this.vaildData(this.permission.district_delete, true),
                editBtn: this.vaildData(this.permission.district_edit, true),
            }
          }
        })
        this.loading = false;
        this.selectionClear();
      });
        },
        ids () {
            let ids = []
            this.selectionList.forEach((ele) => {
                ids.push(ele.id)
            })
            return ids.join(",")
        },
    },
    methods: {
        rowSave (row, done, loading) {
            if (row.picUrl.length > 0) {
                var urls = []
                var split = row.picUrl.split(",")
                split.forEach(url => {
                    var names = url.split("jczz/")
                    urls.push(names[1])
                })
                row.picUrl = urls.join(",")
            }
            row.userid = this.userInfo.user_id
            add(row).then(
                () => {
                    this.onLoad(this.page)
                    this.$message({
                        type: "success",
                        message: "操作成功!",
                    })
                    done()
                },
                (error) => {
                    window.console.log(error)
                    loading()
                }
            )
        },
        rowUpdate (row, index, done, loading) {
            if (row.picUrl.length > 0) {
                var urls = []
                var split = row.picUrl.split(",")
                split.forEach(url => {
                    var names = url.split("jczz/")
                    urls.push(names[1])
                })
                row.picUrl = urls.join(",")
            }
            update(row).then(
                () => {
                    this.onLoad(this.page)
                    this.$message({
                        type: "success",
                        message: "操作成功!",
                    })
                    done()
                },
                (error) => {
                    window.console.log(error)
                    loading()
                }
            )
        },
        rowDel (row) {
            this.$confirm("确定将选择数据删除?", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                type: "warning",
            })
                .then(() => {
                    return remove(row.id)
                })
                .then(() => {
                    this.onLoad(this.page)
                    this.$message({
                        type: "success",
                        message: "操作成功!",
                    })
                })
        },
        searchReset () {
            this.query = {}
            this.onLoad(this.page)
        },
        searchChange (params, done) {
            this.query = params
            this.page.currentPage = 1
            this.onLoad(this.page, params)
            done()
        },
        selectionChange (list) {
            this.selectionList = list
        },
        selectionClear () {
            this.selectionList = []
            this.$refs.crud.toggleSelection()
        },
        handleDelete () {
            if (this.selectionList.length === 0) {
                this.$message.warning("请选择至少一条数据")
                return
            }
            this.$confirm("确定将选择数据删除?", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                type: "warning",
            })
                .then(() => {
                    return remove(this.ids)
                })
                .then(() => {
                    this.onLoad(this.page)
                    this.$message({
                        type: "success",
                        message: "操作成功!",
                    })
                    this.$refs.crud.toggleSelection()
                })
        },
        beforeOpen (done, type) {
            if (["edit", "view"].includes(type)) {
                getDistrict(this.form.id).then((res) => {
                    this.form = res.data.data
                    if (this.form.picUrl.length > 0) {
                        var urls = []
                        var names = this.form.picUrl.split(",")
                        names.forEach(name => {
                            urls.push(website.minioUrl + name)
                        })
                        this.form.picUrl = urls.join(",")
                    }
                })
            }
            // con
            done()
        },
        currentChange (currentPage) {
            this.page.currentPage = currentPage
        },
        sizeChange (pageSize) {
            this.page.pageSize = pageSize
        },
        refreshChange () {
            this.onLoad(this.page, this.query)
        },
        onLoad (page, params = {}) {
            const { dateTime } = this.query
            let values = {
                ...params,
            }
            if (dateTime) {
                values = {
                    ...params,
                    startTime: dateTime[0],
                    endTime: dateTime[1],
                    ...this.query,
                }
                values.dateTime = null
            }
            this.loading = true
            getList(page.currentPage, page.pageSize, values).then((res) => {
                const data = res.data.data
                this.page.total = data.total
                this.data = data.records
                this.data.forEach(item => {
                    if (item.picUrl) {
                        if (item.picUrl.length > 0) {
                            var urls = []
                            var names = item.picUrl.split(",")
                            names.forEach(name => {
                                urls.push(website.minioUrl + name)
                            })
                            item.picUrl = urls.join(",")
                        }
                    }
                })
                this.loading = false
                this.selectionClear()
            })
        }
    }
  }
};
}
</script>
<style>
.avue-upload__icon {
  line-height: 6;
    line-height: 6;
}
</style>
src/views/grid/gridWorkLog/index.vue
@@ -1,333 +1,313 @@
<!-- 工作日志 -->
<!-- 走访日志 -->
<template>
  <basic-container>
    <avue-crud
      :option="option"
      :table-loading="loading"
      :data="data"
      :page.sync="page"
      ref="crud"
      @row-del="rowDel"
      v-model="form"
      :permission="permissionList"
      @row-update="rowUpdate"
      @row-save="rowSave"
      :before-open="beforeOpen"
      @search-change="searchChange"
      @search-reset="searchReset"
      @selection-change="selectionChange"
      @current-change="currentChange"
      @size-change="sizeChange"
      @refresh-change="refreshChange"
      @on-load="onLoad"
    >
      <template slot="menuLeft">
        <el-button
          size="small"
          icon="el-icon-delete"
          plain
          v-if="permission.gridWorkLog_delete"
          @click="handleDelete"
        >删 除
        </el-button>
      </template>
    </avue-crud>
  </basic-container>
    <basic-container>
        <avue-crud :option="option" :table-loading="loading" :data="data" :page.sync="page" ref="crud" @row-del="rowDel"
            v-model="form" :permission="permissionList" @row-update="rowUpdate" @row-save="rowSave"
            :before-open="beforeOpen" @search-change="searchChange" @search-reset="searchReset"
            @selection-change="selectionChange" @current-change="currentChange" @size-change="sizeChange"
            @refresh-change="refreshChange" @on-load="onLoad">
            <template slot="menuLeft">
                <el-button size="small" icon="el-icon-delete" plain v-if="permission.gridWorkLog_delete"
                    @click="handleDelete">删 除
                </el-button>
            </template>
        </avue-crud>
    </basic-container>
</template>
<script>
  import {getList, remove, update, add, getGridWorkLog} from "@/api/grid/gridWorkLog";
  import {mapGetters} from "vuex";
  import website from '@/config/website';
import { getList, remove, update, add, getGridWorkLog } from "@/api/grid/gridWorkLog"
import { mapGetters } from "vuex"
import website from '@/config/website'
  export default {
    data() {
      return {
        form: {},
        query: {},
        loading: true,
        page: {
          pageSize: 10,
          currentPage: 1,
          total: 0,
        },
        datetime: "",
        selectionList: [],
        option: {
          height: "auto",
          calcHeight: 54,
          dialogWidth: 950,
          tip: false,
          searchShow: true,
          searchMenuSpan: 3,
          menuWidth: 350,
          border: false,
          //stripe:true,
          index: true,
          viewBtn: true,
          selection: true,
          excelBtn: true,
          dialogClickModal: false,
          column: [
            {
              label: "走访人员姓名",
              prop: "name",
              span: 12,
              labelWidth:120,
              searchLabelWidth:120,
              searchSpan: 5,
              search:true,
              rules: [
                {
                  required: true,
                  message: "请输入走访人员姓名",
                  trigger: "blur",
                },
              ],
export default {
    data () {
        return {
            form: {},
            query: {},
            loading: true,
            page: {
                pageSize: 10,
                currentPage: 1,
                total: 0,
            },
            {
              label: "走访人员电话",
              prop: "phone",
              span: 12,
              labelWidth:120,
              searchLabelWidth:120,
              searchSpan: 5,
              search:true,
            datetime: "",
            selectionList: [],
            option: {
                height: "auto",
                calcHeight: 54,
                dialogWidth: 950,
                tip: false,
                searchShow: true,
                searchMenuSpan: 3,
                menuWidth: 350,
                border: false,
                //stripe:true,
                index: true,
                viewBtn: true,
                selection: true,
                excelBtn: true,
                dialogClickModal: false,
                column: [
                    {
                        label: "走访人员姓名",
                        prop: "name",
                        span: 12,
                        labelWidth: 120,
                        searchLabelWidth: 120,
                        searchSpan: 5,
                        search: true,
                        rules: [
                            {
                                required: true,
                                message: "请输入走访人员姓名",
                                trigger: "blur",
                            },
                        ],
                    },
                    {
                        label: "走访人员电话",
                        prop: "phone",
                        span: 12,
                        labelWidth: 120,
                        searchLabelWidth: 120,
                        searchSpan: 5,
                        search: true,
                    },
                    {
                        label: "内容",
                        labelWidth: 120,
                        prop: "context",
                        type: "textarea",
                        span: 24,
                    },
                    {
                        label: "图片",
                        prop: "url",
                        type: "upload",
                        labelWidth: 120,
                        width: 80,
                        listType: "picture-img",
                        action: "/api/blade-resource/oss/endpoint/put-file",
                        propsHttp: {
                            res: "data",
                            name: 'name',
                            url: "link",
                        },
                        span: 24,
                    },
                    {
                        label: "走访时间",
                        prop: "workTime",
                        width: 160,
                        type: "date",
                        format: "yyyy-MM-dd HH:mm:ss",
                        valueFormat: "yyyy-MM-dd HH:mm:ss",
                        rules: [
                            {
                                required: true,
                                message: "请输入走访时间",
                                trigger: "blur",
                            },
                        ],
                    }
                ],
            },
            {
              label: "内容",
              labelWidth:120,
              prop: "context",
              type: "textarea",
              span: 24,
            },
            {
              label: "图片",
              prop: "url",
              type: "upload",
              labelWidth:120,
              width:80,
              listType: "picture-img",
              action: "/api/blade-resource/oss/endpoint/put-file",
              propsHttp: {
                res: "data",
                name: 'name',
                url: "link",
              },
              span: 24,
            },
            {
              label: "走访时间",
              prop: "workTime",
              width:160,
              type: "date",
              format: "yyyy-MM-dd HH:mm:ss",
              valueFormat: "yyyy-MM-dd HH:mm:ss",
              rules: [
                {
                  required: true,
                  message: "请输入走访时间",
                  trigger: "blur",
                },
              ],
            }
          ],
        },
        data: [],
      };
            data: [],
        }
    },
    watch: {
    },
    computed: {
      ...mapGetters(["permission","userInfo"]),
      permissionList() {
        return {
          addBtn: this.vaildData(this.permission.gridWorkLog_add, true),
          viewBtn: this.vaildData(this.permission.gridWorkLog_view, true),
          delBtn: this.vaildData(this.permission.gridWorkLog_delete, true),
          editBtn: this.vaildData(this.permission.gridWorkLog_edit, true),
        };
      },
      ids() {
        let ids = [];
        this.selectionList.forEach((ele) => {
          ids.push(ele.id);
        });
        return ids.join(",");
      },
        ...mapGetters(["permission", "userInfo"]),
        permissionList () {
            return {
                addBtn: this.vaildData(this.permission.gridWorkLog_add, true),
                viewBtn: this.vaildData(this.permission.gridWorkLog_view, true),
                delBtn: this.vaildData(this.permission.gridWorkLog_delete, true),
                editBtn: this.vaildData(this.permission.gridWorkLog_edit, true),
            }
        },
        ids () {
            let ids = []
            this.selectionList.forEach((ele) => {
                ids.push(ele.id)
            })
            return ids.join(",")
        },
    },
    methods: {
      rowSave(row, done, loading) {
        if(row.url.length>0){
          var urls = []
          var split = row.url.split(",");
          split.forEach(url=>{
             var names = url.split("jczz/");
             urls.push(names[1])
          })
          row.url = urls.join(",")
        }
        add(row).then(
          () => {
            this.onLoad(this.page);
            this.$message({
              type: "success",
              message: "操作成功!",
            });
            done();
          },
          (error) => {
            window.console.log(error);
            loading();
          }
        );
      },
      rowUpdate(row, index, done, loading) {
        if(row.url.length>0){
          var urls = []
          var split = row.url.split(",");
          split.forEach(url=>{
             var names = url.split("jczz/");
             urls.push(names[1])
          })
          row.url = urls.join(",")
        }
        update(row).then(
          () => {
            this.onLoad(this.page);
            this.$message({
              type: "success",
              message: "操作成功!",
            });
            done();
          },
          (error) => {
            window.console.log(error);
            loading();
          }
        );
      },
      rowDel(row) {
        this.$confirm("确定将选择数据删除?", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning",
        })
          .then(() => {
            return remove(row.id);
          })
          .then(() => {
            this.onLoad(this.page);
            this.$message({
              type: "success",
              message: "操作成功!",
            });
          });
      },
      searchReset() {
        this.query = {};
        this.onLoad(this.page);
      },
      searchChange(params, done) {
        this.query = params;
        this.page.currentPage = 1;
        this.onLoad(this.page, params);
        done();
      },
      selectionChange(list) {
        this.selectionList = list;
      },
      selectionClear() {
        this.selectionList = [];
        this.$refs.crud.toggleSelection();
      },
      handleDelete() {
        if (this.selectionList.length === 0) {
          this.$message.warning("请选择至少一条数据");
          return;
        }
        this.$confirm("确定将选择数据删除?", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning",
        })
          .then(() => {
            return remove(this.ids);
          })
          .then(() => {
            this.onLoad(this.page);
            this.$message({
              type: "success",
              message: "操作成功!",
            });
            this.$refs.crud.toggleSelection();
          });
      },
      beforeOpen(done, type) {
        if (["edit", "view"].includes(type)) {
          getGridWorkLog(this.form.id).then((res) => {
            this.form = res.data.data;
            if(this.form.url.length>0){
              var urls = []
              var names = this.form.url.split(",");
              names.forEach(name=>{
                urls.push(website.minioUrl + name)
              })
              this.form.url = urls.join(",")
        rowSave (row, done, loading) {
            if (row.url.length > 0) {
                var urls = []
                var split = row.url.split(",")
                split.forEach(url => {
                    var names = url.split("jczz/")
                    urls.push(names[1])
                })
                row.url = urls.join(",")
            }
          });
        }
        // con
        done();
      },
      currentChange(currentPage) {
        this.page.currentPage = currentPage;
      },
      sizeChange(pageSize) {
        this.page.pageSize = pageSize;
      },
      refreshChange() {
        this.onLoad(this.page, this.query);
      },
      onLoad(page, params = {}) {
        const {dateTime} = this.query;
        let values = {
          ...params,
        };
        if (dateTime) {
          values = {
            ...params,
            startTime: dateTime[0],
            endTime: dateTime[1],
            ...this.query,
          };
          values.dateTime = null;
        }
        this.loading = true;
        getList(page.currentPage, page.pageSize, values).then((res) => {
          const data = res.data.data;
          this.page.total = data.total;
          this.data = data.records;
          this.data.forEach(item=>{
            if(item.url.length>0){
              var urls = []
              var names = item.url.split(",");
              names.forEach(name=>{
                urls.push(website.minioUrl + name)
              })
              item.url = urls.join(",")
            add(row).then(
                () => {
                    this.onLoad(this.page)
                    this.$message({
                        type: "success",
                        message: "操作成功!",
                    })
                    done()
                },
                (error) => {
                    window.console.log(error)
                    loading()
                }
            )
        },
        rowUpdate (row, index, done, loading) {
            if (row.url.length > 0) {
                var urls = []
                var split = row.url.split(",")
                split.forEach(url => {
                    var names = url.split("jczz/")
                    urls.push(names[1])
                })
                row.url = urls.join(",")
            }
          })
          this.loading = false;
          this.selectionClear();
        });
      }
            update(row).then(
                () => {
                    this.onLoad(this.page)
                    this.$message({
                        type: "success",
                        message: "操作成功!",
                    })
                    done()
                },
                (error) => {
                    window.console.log(error)
                    loading()
                }
            )
        },
        rowDel (row) {
            this.$confirm("确定将选择数据删除?", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                type: "warning",
            })
                .then(() => {
                    return remove(row.id)
                })
                .then(() => {
                    this.onLoad(this.page)
                    this.$message({
                        type: "success",
                        message: "操作成功!",
                    })
                })
        },
        searchReset () {
            this.query = {}
            this.onLoad(this.page)
        },
        searchChange (params, done) {
            this.query = params
            this.page.currentPage = 1
            this.onLoad(this.page, params)
            done()
        },
        selectionChange (list) {
            this.selectionList = list
        },
        selectionClear () {
            this.selectionList = []
            this.$refs.crud.toggleSelection()
        },
        handleDelete () {
            if (this.selectionList.length === 0) {
                this.$message.warning("请选择至少一条数据")
                return
            }
            this.$confirm("确定将选择数据删除?", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                type: "warning",
            })
                .then(() => {
                    return remove(this.ids)
                })
                .then(() => {
                    this.onLoad(this.page)
                    this.$message({
                        type: "success",
                        message: "操作成功!",
                    })
                    this.$refs.crud.toggleSelection()
                })
        },
        beforeOpen (done, type) {
            if (["edit", "view"].includes(type)) {
                getGridWorkLog(this.form.id).then((res) => {
                    this.form = res.data.data
                    if (this.form.url.length > 0) {
                        var urls = []
                        var names = this.form.url.split(",")
                        names.forEach(name => {
                            urls.push(website.minioUrl + name)
                        })
                        this.form.url = urls.join(",")
                    }
                })
            }
            // con
            done()
        },
        currentChange (currentPage) {
            this.page.currentPage = currentPage
        },
        sizeChange (pageSize) {
            this.page.pageSize = pageSize
        },
        refreshChange () {
            this.onLoad(this.page, this.query)
        },
        onLoad (page, params = {}) {
            const { dateTime } = this.query
            let values = {
                ...params,
            }
            if (dateTime) {
                values = {
                    ...params,
                    startTime: dateTime[0],
                    endTime: dateTime[1],
                    ...this.query,
                }
                values.dateTime = null
            }
            this.loading = true
            getList(page.currentPage, page.pageSize, values).then((res) => {
                const data = res.data.data
                this.page.total = data.total
                this.data = data.records
                this.data.forEach(item => {
                    if (item.url.length > 0) {
                        var urls = []
                        var names = item.url.split(",")
                        names.forEach(name => {
                            urls.push(website.minioUrl + name)
                        })
                        item.url = urls.join(",")
                    }
                })
                this.loading = false
                this.selectionClear()
            })
        }
    },
  };
}
</script>
<style>
  .avue-upload__icon {
.avue-upload__icon {
    line-height: 6;
  }
}
</style>
src/views/grid/gridman.vue
@@ -1,314 +1,317 @@
<template>
  <basic-container>
    <avue-crud :option="option" :table-loading="loading" :data="data" :page.sync="page" ref="crud" @row-del="rowDel"
      v-model="form" :permission="permissionList" @row-update="rowUpdate" @row-save="rowSave" :before-open="beforeOpen"
      @search-change="searchChange" @search-reset="searchReset" @selection-change="selectionChange"
      @current-change="currentChange" @size-change="sizeChange" @refresh-change="refreshChange" @on-load="onLoad">
      <template slot="menuLeft">
        <el-button size="small" icon="el-icon-delete" plain v-if="permission.gridman_delete" @click="handleDelete">删 除
        </el-button>
      </template>
    </avue-crud>
  </basic-container>
    <basic-container>
        <avue-crud :option="option" :table-loading="loading" :data="data" :page.sync="page" ref="crud" @row-del="rowDel"
            v-model="form" :permission="permissionList" @row-update="rowUpdate" @row-save="rowSave"
            :before-open="beforeOpen" @search-change="searchChange" @search-reset="searchReset"
            @selection-change="selectionChange" @current-change="currentChange" @size-change="sizeChange"
            @refresh-change="refreshChange" @on-load="onLoad">
            <template slot="menuLeft">
                <el-button size="small" icon="el-icon-delete" plain v-if="permission.gridman_delete" @click="handleDelete">删
                    除
                </el-button>
            </template>
        </avue-crud>
    </basic-container>
</template>
<script>
import { getList, remove, update, add, getGridman } from "@/api/grid/gridman";
import { mapGetters } from "vuex";
import website from '@/config/website';
import { getList, remove, update, add, getGridman } from "@/api/grid/gridman"
import { mapGetters } from "vuex"
import website from '@/config/website'
export default {
  data() {
    return {
      form: {},
      query: {},
      loading: true,
      page: {
        pageSize: 10,
        currentPage: 1,
        total: 0,
      },
      datetime: "",
      selectionList: [],
      option: {
        height: "auto",
        calcHeight: 54,
        dialogWidth: 950,
        tip: false,
        searchShow: true,
        searchMenuSpan: 3,
        menuWidth: 350,
        border: true,
        //stripe:true,
        index: true,
        viewBtn: true,
        selection: true,
        dialogClickModal: false,
        column: [
          {
            label: "网格名称",
            prop: "gridId",
            searchSpan: 4,
            search: true,
            span: 13,
            row: true,
            type: "tree",
            dicUrl: "/api/blade-grid/grid/getGridTree",
            defaultExpandedKeys: ["361102003"],
            props: {
              label: "name",
              value: "id"
    data () {
        return {
            form: {},
            query: {},
            loading: true,
            page: {
                pageSize: 10,
                currentPage: 1,
                total: 0,
            },
            rules: [
              {
                required: true,
                message: "请输入网格名称",
                trigger: "blur",
              },
            ],
          },
          {
            label: "所属社区",
            prop: "communityCode",
            type: "tree",
            dicUrl: "/api/blade-system/region/tree?parentCode=361102",
            defaultExpandedKeys: ["361102003"],
            props: {
              label: "name",
              value: "id"
            datetime: "",
            selectionList: [],
            option: {
                height: "auto",
                calcHeight: 54,
                dialogWidth: 950,
                tip: false,
                searchShow: true,
                searchMenuSpan: 3,
                menuWidth: 350,
                border: true,
                //stripe:true,
                index: true,
                viewBtn: true,
                selection: true,
                dialogClickModal: false,
                column: [
                    {
                        label: "网格名称",
                        prop: "gridId",
                        searchSpan: 4,
                        search: true,
                        span: 13,
                        row: true,
                        type: "tree",
                        dicUrl: "/api/blade-grid/grid/getGridTree",
                        defaultExpandedKeys: ["361102003"],
                        props: {
                            label: "name",
                            value: "id"
                        },
                        rules: [
                            {
                                required: true,
                                message: "请输入网格名称",
                                trigger: "blur",
                            },
                        ],
                    },
                    {
                        label: "所属社区",
                        prop: "communityCode",
                        search: true,
                        searchSpan: 4,
                        width: 150,
                        type: "tree",
                        dicUrl: "/api/blade-system/region/tree",
                        props: {
                            label: "name",
                            value: "id"
                        },
                        rules: [
                            {
                                required: true,
                                message: "请选择所属社区",
                                trigger: "blur",
                            },
                        ],
                    },
                    {
                        label: "网格员",
                        prop: "gridmanName",
                        searchSpan: 4,
                        search: true,
                        rules: [
                            {
                                required: true,
                                message: "请输入网格员",
                                trigger: "blur",
                            },
                        ],
                    },
                    {
                        label: "联系电话",
                        prop: "mobile",
                        searchSpan: 4,
                        search: true,
                        rules: [
                            {
                                required: true,
                                message: "请输入联系电话",
                                trigger: "blur",
                            },
                        ],
                    },
                    {
                        label: "形象照",
                        prop: "picUrl",
                        width: 80,
                        type: "upload",
                        listType: "picture-img",
                        action: "/api/blade-resource/oss/endpoint/put-file-attach",
                        propsHttp: {
                            res: "data",
                            url: "link",
                        },
                        span: 24,
                    },
                    {
                        label: "备注",
                        prop: "remark",
                        type: "textarea",
                        hide: true,
                        minRows: 6,
                        span: 24,
                    },
                ],
            },
            display: false,
            rules: [
              {
                required: true,
                message: "请选择所属社区",
                trigger: "blur",
              },
            ],
          },
          {
            label: "网格员",
            prop: "gridmanName",
            searchSpan: 4,
            search: true,
            rules: [
              {
                required: true,
                message: "请输入网格员",
                trigger: "blur",
              },
            ],
          },
          {
            label: "联系电话",
            prop: "mobile",
            searchSpan: 4,
            search: true,
            rules: [
              {
                required: true,
                message: "请输入联系电话",
                trigger: "blur",
              },
            ],
          },
          {
            label: "形象照",
            prop: "picUrl",
            width: 80,
            type: "upload",
            listType: "picture-img",
            action: "/api/blade-resource/oss/endpoint/put-file-attach",
            propsHttp: {
              res: "data",
              url: "link",
            },
            span: 24,
          },
          {
            label: "备注",
            prop: "remark",
            type: "textarea",
            hide: true,
            minRows: 6,
            span: 24,
          },
        ],
      },
      data: [],
    };
  },
  watch: {
  },
  computed: {
    ...mapGetters(["permission", "userInfo"]),
    permissionList() {
      return {
        addBtn: this.vaildData(this.permission.gridman_add, true),
        viewBtn: this.vaildData(this.permission.gridman_view, true),
        delBtn: this.vaildData(this.permission.gridman_delete, true),
        editBtn: this.vaildData(this.permission.gridman_edit, true),
      };
    },
    ids() {
      let ids = [];
      this.selectionList.forEach((ele) => {
        ids.push(ele.id);
      });
      return ids.join(",");
    },
  },
  methods: {
    rowSave(row, done, loading) {
      if (row.picUrl) {
        var names = row.picUrl.split("jczz/");
        row.picUrl = names[1]
      }
      add(row).then(
        () => {
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!",
          });
          done();
        },
        (error) => {
          window.console.log(error);
          loading();
            data: [],
        }
      );
    },
    rowUpdate(row, index, done, loading) {
      if (row.picUrl) {
        var names = row.picUrl.split("jczz/");
        row.picUrl = names[1]
      }
      update(row).then(
        () => {
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!",
          });
          done();
    watch: {
    },
    computed: {
        ...mapGetters(["permission", "userInfo"]),
        permissionList () {
            return {
                addBtn: this.vaildData(this.permission.gridman_add, true),
                viewBtn: this.vaildData(this.permission.gridman_view, true),
                delBtn: this.vaildData(this.permission.gridman_delete, true),
                editBtn: this.vaildData(this.permission.gridman_edit, true),
            }
        },
        (error) => {
          window.console.log(error);
          loading();
        ids () {
            let ids = []
            this.selectionList.forEach((ele) => {
                ids.push(ele.id)
            })
            return ids.join(",")
        },
    },
    methods: {
        rowSave (row, done, loading) {
            if (row.picUrl) {
                var names = row.picUrl.split("jczz/")
                row.picUrl = names[1]
            }
            add(row).then(
                () => {
                    this.onLoad(this.page)
                    this.$message({
                        type: "success",
                        message: "操作成功!",
                    })
                    done()
                },
                (error) => {
                    window.console.log(error)
                    loading()
                }
            )
        },
        rowUpdate (row, index, done, loading) {
            if (row.picUrl) {
                var names = row.picUrl.split("jczz/")
                row.picUrl = names[1]
            }
            update(row).then(
                () => {
                    this.onLoad(this.page)
                    this.$message({
                        type: "success",
                        message: "操作成功!",
                    })
                    done()
                },
                (error) => {
                    window.console.log(error)
                    loading()
                }
            )
        },
        rowDel (row) {
            this.$confirm("确定将选择数据删除?", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                type: "warning",
            })
                .then(() => {
                    return remove(row.id)
                })
                .then(() => {
                    this.onLoad(this.page)
                    this.$message({
                        type: "success",
                        message: "操作成功!",
                    })
                })
        },
        searchReset () {
            this.query = {}
            this.onLoad(this.page)
        },
        searchChange (params, done) {
            this.query = params
            this.page.currentPage = 1
            this.onLoad(this.page, params)
            done()
        },
        selectionChange (list) {
            this.selectionList = list
        },
        selectionClear () {
            this.selectionList = []
            this.$refs.crud.toggleSelection()
        },
        handleDelete () {
            if (this.selectionList.length === 0) {
                this.$message.warning("请选择至少一条数据")
                return
            }
            this.$confirm("确定将选择数据删除?", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                type: "warning",
            })
                .then(() => {
                    return remove(this.ids)
                })
                .then(() => {
                    this.onLoad(this.page)
                    this.$message({
                        type: "success",
                        message: "操作成功!",
                    })
                    this.$refs.crud.toggleSelection()
                })
        },
        beforeOpen (done, type) {
            if (["edit", "view"].includes(type)) {
                getGridman(this.form.id).then((res) => {
                    this.form = res.data.data
                    if (this.form.picUrl) {
                        this.form.picUrl = website.minioUrl + this.form.picUrl
                    }
                })
            }
            // con
            done()
        },
        currentChange (currentPage) {
            this.page.currentPage = currentPage
        },
        sizeChange (pageSize) {
            this.page.pageSize = pageSize
        },
        refreshChange () {
            this.onLoad(this.page, this.query)
        },
        onLoad (page, params = {}) {
            const { dateTime } = this.query
            let values = {
                ...params,
            }
            if (dateTime) {
                values = {
                    ...params,
                    startTime: dateTime[0],
                    endTime: dateTime[1],
                    ...this.query,
                }
                values.dateTime = null
            }
            this.loading = true
            getList(page.currentPage, page.pageSize, values).then((res) => {
                const data = res.data.data
                this.page.total = data.total
                this.data = data.records
                this.data.forEach(item => {
                    if (item.picUrl) {
                        item.picUrl = website.minioUrl + item.picUrl
                    }
                })
                this.loading = false
                this.selectionClear()
            })
        }
      );
    },
    rowDel(row) {
      this.$confirm("确定将选择数据删除?", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          return remove(row.id);
        })
        .then(() => {
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!",
          });
        });
    },
    searchReset() {
      this.query = {};
      this.onLoad(this.page);
    },
    searchChange(params, done) {
      this.query = params;
      this.page.currentPage = 1;
      this.onLoad(this.page, params);
      done();
    },
    selectionChange(list) {
      this.selectionList = list;
    },
    selectionClear() {
      this.selectionList = [];
      this.$refs.crud.toggleSelection();
    },
    handleDelete() {
      if (this.selectionList.length === 0) {
        this.$message.warning("请选择至少一条数据");
        return;
      }
      this.$confirm("确定将选择数据删除?", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          return remove(this.ids);
        })
        .then(() => {
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!",
          });
          this.$refs.crud.toggleSelection();
        });
    },
    beforeOpen(done, type) {
      if (["edit", "view"].includes(type)) {
        getGridman(this.form.id).then((res) => {
          this.form = res.data.data;
          if (this.form.picUrl) {
            this.form.picUrl = website.minioUrl + this.form.picUrl
          }
        });
      }
      // con
      done();
    },
    currentChange(currentPage) {
      this.page.currentPage = currentPage;
    },
    sizeChange(pageSize) {
      this.page.pageSize = pageSize;
    },
    refreshChange() {
      this.onLoad(this.page, this.query);
    },
    onLoad(page, params = {}) {
      const { dateTime } = this.query;
      let values = {
        ...params,
      };
      if (dateTime) {
        values = {
          ...params,
          startTime: dateTime[0],
          endTime: dateTime[1],
          ...this.query,
        };
        values.dateTime = null;
      }
      this.loading = true;
      getList(page.currentPage, page.pageSize, values).then((res) => {
        const data = res.data.data;
        this.page.total = data.total;
        this.data = data.records;
        this.data.forEach(item=>{
          if (item.picUrl) {
            item.picUrl = website.minioUrl + item.picUrl
          }
        })
        this.loading = false;
        this.selectionClear();
      });
    }
  }
};
}
</script>
<style>
.avue-upload__icon {
  line-height: 6;
    line-height: 6;
}
</style>
src/views/grid/index.vue
@@ -1,313 +1,314 @@
<template>
  <basic-container>
    <avue-crud :option="option" :table-loading="loading" :data="data" :page.sync="page" ref="crud" @row-del="rowDel"
      v-model="form" :permission="permissionList" @row-update="rowUpdate" @row-save="rowSave" :before-open="beforeOpen"
      @search-change="searchChange" @search-reset="searchReset" @selection-change="selectionChange"
      @current-change="currentChange" @size-change="sizeChange" @refresh-change="refreshChange" @on-load="onLoad">
      <template slot="menuLeft">
        <el-button size="small" icon="el-icon-delete" plain v-if="permission.grid_delete" @click="handleDelete">删 除
        </el-button>
      </template>
    </avue-crud>
  </basic-container>
    <basic-container>
        <avue-crud :option="option" :table-loading="loading" :data="data" :page.sync="page" ref="crud" @row-del="rowDel"
            v-model="form" :permission="permissionList" @row-update="rowUpdate" @row-save="rowSave"
            :before-open="beforeOpen" @search-change="searchChange" @search-reset="searchReset"
            @selection-change="selectionChange" @current-change="currentChange" @size-change="sizeChange"
            @refresh-change="refreshChange" @on-load="onLoad">
            <template slot="menuLeft">
                <el-button size="small" icon="el-icon-delete" plain v-if="permission.grid_delete" @click="handleDelete">删 除
                </el-button>
            </template>
        </avue-crud>
    </basic-container>
</template>
<script>
import { getList, remove, update, add, getGrid } from "@/api/grid/grid";
import { mapGetters } from "vuex";
import website from '@/config/website';
import { getList, remove, update, add, getGrid } from "@/api/grid/grid"
import { mapGetters } from "vuex"
// import website from '@/config/website'
export default {
  data() {
    return {
      form: {},
      query: {},
      loading: true,
      page: {
        pageSize: 10,
        currentPage: 1,
        total: 0,
      },
      datetime: "",
      selectionList: [],
      option: {
        height: "auto",
        calcHeight: 54,
        dialogWidth: 950,
        tip: false,
        searchShow: true,
        searchMenuSpan: 3,
        menuWidth: 350,
        border: true,
        //stripe:true,
        index: true,
        viewBtn: true,
        selection: true,
        dialogClickModal: false,
        column: [
          {
            label: "所属社区",
            prop: "communityCode",
            search: true,
            searchSpan: 4,
            type: "tree",
            dicUrl: "/api/blade-system/region/tree",
            defaultExpandedKeys: ["361102003"],
            props: {
              label: "name",
              value: "id"
    data () {
        return {
            form: {},
            query: {},
            loading: true,
            page: {
                pageSize: 10,
                currentPage: 1,
                total: 0,
            },
            rules: [
              {
                required: true,
                message: "请选择所属社区",
                trigger: "blur",
              },
            ],
          },
          {
            label: "网格名称",
            prop: "gridName",
            searchSpan: 4,
            search: true,
            rules: [
              {
                required: true,
                message: "请输入网格名称",
                trigger: "blur",
              },
            ],
          },
          {
            label: "负责人",
            prop: "principal",
            searchSpan: 4,
            search: true,
            rules: [
              {
                required: true,
                message: "请输入负责人",
                trigger: "blur",
              },
            ],
          },
          {
            label: "联系电话",
            prop: "principalPhone",
            searchSpan: 4,
            search: true,
            rules: [
              {
                required: true,
                message: "请输入联系电话",
                trigger: "blur",
              },
            ],
          },
          {
            label: "区域",
            prop: "geom",
            type:"textarea",
            hide:true,
            span: 24,
            display:false,
            rules: [
              {
                required: true,
                message: "请输入区域",
                trigger: "blur",
              },
            ],
          },
          {
            label: "排序",
            prop: "sort",
            type:"number",
            hide:true,
            value:1,
            rules: [
              {
                required: true,
                message: "请输入排序",
                trigger: "blur",
              },
            ],
          },
          {
            label: "网格简介",
            prop: "remark",
            component: "AvueUeditor",
            options: {
              action: "/api/blade-resource/oss/endpoint/put-file",
              props: {
                res: "data",
                url: "link",
              },
            datetime: "",
            selectionList: [],
            option: {
                height: "auto",
                calcHeight: 54,
                dialogWidth: 950,
                tip: false,
                searchShow: true,
                searchMenuSpan: 3,
                menuWidth: 280,
                border: true,
                //stripe:true,
                index: true,
                viewBtn: true,
                selection: true,
                dialogClickModal: false,
                column: [
                    {
                        label: "所属社区",
                        prop: "communityCode",
                        search: true,
                        searchSpan: 4,
                        width: 150,
                        type: "tree",
                        dicUrl: "/api/blade-system/region/tree",
                        props: {
                            label: "name",
                            value: "id"
                        },
                        rules: [
                            {
                                required: true,
                                message: "请选择所属社区",
                                trigger: "blur",
                            },
                        ],
                    },
                    {
                        label: "网格名称",
                        prop: "gridName",
                        searchSpan: 4,
                        search: true,
                        rules: [
                            {
                                required: true,
                                message: "请输入网格名称",
                                trigger: "blur",
                            },
                        ],
                    },
                    {
                        label: "负责人",
                        prop: "principal",
                        searchSpan: 4,
                        search: true,
                        rules: [
                            {
                                required: true,
                                message: "请输入负责人",
                                trigger: "blur",
                            },
                        ],
                    },
                    {
                        label: "联系电话",
                        prop: "principalPhone",
                        searchSpan: 4,
                        search: true,
                        rules: [
                            {
                                required: true,
                                message: "请输入联系电话",
                                trigger: "blur",
                            },
                        ],
                    },
                    {
                        label: "区域",
                        prop: "geom",
                        type: "textarea",
                        hide: true,
                        span: 24,
                        display: false,
                        rules: [
                            {
                                required: true,
                                message: "请输入区域",
                                trigger: "blur",
                            },
                        ],
                    },
                    {
                        label: "排序",
                        prop: "sort",
                        type: "number",
                        hide: true,
                        value: 1,
                        rules: [
                            {
                                required: true,
                                message: "请输入排序",
                                trigger: "blur",
                            },
                        ],
                    },
                    {
                        label: "网格简介",
                        prop: "remark",
                        component: "AvueUeditor",
                        options: {
                            action: "/api/blade-resource/oss/endpoint/put-file",
                            props: {
                                res: "data",
                                url: "link",
                            },
                        },
                        hide: true,
                        minRows: 6,
                        span: 24,
                    },
                ],
            },
            hide: true,
            minRows: 6,
            span: 24,
          },
        ],
      },
      data: [],
    };
  },
  watch: {
  },
  computed: {
    ...mapGetters(["permission", "userInfo"]),
    permissionList() {
      return {
        addBtn: this.vaildData(this.permission.grid_add, true),
        viewBtn: this.vaildData(this.permission.grid_view, true),
        delBtn: this.vaildData(this.permission.grid_delete, true),
        editBtn: this.vaildData(this.permission.grid_edit, true),
      };
    },
    ids() {
      let ids = [];
      this.selectionList.forEach((ele) => {
        ids.push(ele.id);
      });
      return ids.join(",");
    },
  },
  methods: {
    rowSave(row, done, loading) {
      add(row).then(
        () => {
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!",
          });
          done();
        },
        (error) => {
          window.console.log(error);
          loading();
            data: [],
        }
      );
    },
    rowUpdate(row, index, done, loading) {
      update(row).then(
        () => {
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!",
          });
          done();
    watch: {
    },
    computed: {
        ...mapGetters(["permission", "userInfo"]),
        permissionList () {
            return {
                addBtn: this.vaildData(this.permission.grid_add, true),
                viewBtn: this.vaildData(this.permission.grid_view, true),
                delBtn: this.vaildData(this.permission.grid_delete, true),
                editBtn: this.vaildData(this.permission.grid_edit, true),
            }
        },
        (error) => {
          window.console.log(error);
          loading();
        ids () {
            let ids = []
            this.selectionList.forEach((ele) => {
                ids.push(ele.id)
            })
            return ids.join(",")
        },
    },
    methods: {
        rowSave (row, done, loading) {
            add(row).then(
                () => {
                    this.onLoad(this.page)
                    this.$message({
                        type: "success",
                        message: "操作成功!",
                    })
                    done()
                },
                (error) => {
                    window.console.log(error)
                    loading()
                }
            )
        },
        rowUpdate (row, index, done, loading) {
            update(row).then(
                () => {
                    this.onLoad(this.page)
                    this.$message({
                        type: "success",
                        message: "操作成功!",
                    })
                    done()
                },
                (error) => {
                    window.console.log(error)
                    loading()
                }
            )
        },
        rowDel (row) {
            this.$confirm("确定将选择数据删除?", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                type: "warning",
            })
                .then(() => {
                    return remove(row.id)
                })
                .then(() => {
                    this.onLoad(this.page)
                    this.$message({
                        type: "success",
                        message: "操作成功!",
                    })
                })
        },
        searchReset () {
            this.query = {}
            this.onLoad(this.page)
        },
        searchChange (params, done) {
            this.query = params
            this.page.currentPage = 1
            this.onLoad(this.page, params)
            done()
        },
        selectionChange (list) {
            this.selectionList = list
        },
        selectionClear () {
            this.selectionList = []
            this.$refs.crud.toggleSelection()
        },
        handleDelete () {
            if (this.selectionList.length === 0) {
                this.$message.warning("请选择至少一条数据")
                return
            }
            this.$confirm("确定将选择数据删除?", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                type: "warning",
            })
                .then(() => {
                    return remove(this.ids)
                })
                .then(() => {
                    this.onLoad(this.page)
                    this.$message({
                        type: "success",
                        message: "操作成功!",
                    })
                    this.$refs.crud.toggleSelection()
                })
        },
        beforeOpen (done, type) {
            if (["edit", "view"].includes(type)) {
                getGrid(this.form.id).then((res) => {
                    this.form = res.data.data
                })
            }
            // con
            done()
        },
        currentChange (currentPage) {
            this.page.currentPage = currentPage
        },
        sizeChange (pageSize) {
            this.page.pageSize = pageSize
        },
        refreshChange () {
            this.onLoad(this.page, this.query)
        },
        onLoad (page, params = {}) {
            const { dateTime } = this.query
            let values = {
                ...params,
            }
            if (dateTime) {
                values = {
                    ...params,
                    startTime: dateTime[0],
                    endTime: dateTime[1],
                    ...this.query,
                }
                values.dateTime = null
            }
            this.loading = true
            getList(page.currentPage, page.pageSize, values).then((res) => {
                const data = res.data.data
                this.page.total = data.total
                this.data = data.records
                this.loading = false
                this.selectionClear()
            })
        }
      );
    },
    rowDel(row) {
      this.$confirm("确定将选择数据删除?", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          return remove(row.id);
        })
        .then(() => {
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!",
          });
        });
    },
    searchReset() {
      this.query = {};
      this.onLoad(this.page);
    },
    searchChange(params, done) {
      this.query = params;
      this.page.currentPage = 1;
      this.onLoad(this.page, params);
      done();
    },
    selectionChange(list) {
      this.selectionList = list;
    },
    selectionClear() {
      this.selectionList = [];
      this.$refs.crud.toggleSelection();
    },
    handleDelete() {
      if (this.selectionList.length === 0) {
        this.$message.warning("请选择至少一条数据");
        return;
      }
      this.$confirm("确定将选择数据删除?", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          return remove(this.ids);
        })
        .then(() => {
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!",
          });
          this.$refs.crud.toggleSelection();
        });
    },
    beforeOpen(done, type) {
      if (["edit", "view"].includes(type)) {
        getGrid(this.form.id).then((res) => {
          this.form = res.data.data;
        });
      }
      // con
      done();
    },
    currentChange(currentPage) {
      this.page.currentPage = currentPage;
    },
    sizeChange(pageSize) {
      this.page.pageSize = pageSize;
    },
    refreshChange() {
      this.onLoad(this.page, this.query);
    },
    onLoad(page, params = {}) {
      const { dateTime } = this.query;
      let values = {
        ...params,
      };
      if (dateTime) {
        values = {
          ...params,
          startTime: dateTime[0],
          endTime: dateTime[1],
          ...this.query,
        };
        values.dateTime = null;
      }
      this.loading = true;
      getList(page.currentPage, page.pageSize, values).then((res) => {
        const data = res.data.data;
        this.page.total = data.total;
        this.data = data.records;
        this.loading = false;
        this.selectionClear();
      });
    }
  }
};
}
</script>
<style>
.avue-upload__icon {
  line-height: 6;
    line-height: 6;
}
</style>
src/views/monitor/log/api.vue
@@ -1,161 +1,150 @@
<template>
  <basic-container>
    <avue-crud :option="option"
               :table-loading="loading"
               :data="data"
               ref="crud"
               v-model="form"
               :permission="permissionList"
               :before-open="beforeOpen"
               :page.sync="page"
               @search-change="searchChange"
               @search-reset="searchReset"
               @current-change="currentChange"
               @size-change="sizeChange"
               @refresh-change="refreshChange"
               @on-load="onLoad">
    </avue-crud>
  </basic-container>
    <basic-container>
        <avue-crud :option="option" :table-loading="loading" :data="data" ref="crud" v-model="form"
            :permission="permissionList" :before-open="beforeOpen" :page.sync="page" @search-change="searchChange"
            @search-reset="searchReset" @current-change="currentChange" @size-change="sizeChange"
            @refresh-change="refreshChange" @on-load="onLoad">
        </avue-crud>
    </basic-container>
</template>
<script>
  import {getApiList, getApiLogs} from "@/api/logs";
  import {mapGetters} from "vuex";
import { getApiList, getApiLogs } from "@/api/logs"
import { mapGetters } from "vuex"
  export default {
    data() {
      return {
        form: {},
        selectionList: [],
        query: {},
        loading: true,
        page: {
          pageSize: 10,
          currentPage: 1,
          total: 0
        },
        option: {
          height: 'auto',
          calcHeight: 30,
          tip: false,
          searchShow: true,
          searchMenuSpan: 6,
          border: true,
          index: true,
          viewBtn: true,
          editBtn: false,
          addBtn: false,
          delBtn: false,
          menuWidth: 120,
          dialogType: 'drawer',
          column: [
            {
              label: "服务id",
              prop: "serviceId",
              width:'120',
              search: true
export default {
    data () {
        return {
            form: {},
            selectionList: [],
            query: {},
            loading: true,
            page: {
                pageSize: 10,
                currentPage: 1,
                total: 0
            },
            {
              label: "服务host",
              prop: "serverHost",
              search: true
            option: {
                height: 'auto',
                calcHeight: 30,
                tip: false,
                searchShow: true,
                searchMenuSpan: 6,
                border: true,
                index: true,
                viewBtn: true,
                editBtn: false,
                addBtn: false,
                delBtn: false,
                menuWidth: 280,
                dialogType: 'drawer',
                column: [
                    {
                        label: "服务id",
                        prop: "serviceId",
                        width: '120',
                        search: true
                    },
                    {
                        label: "服务host",
                        prop: "serverHost",
                        search: true
                    },
                    {
                        label: "服务ip",
                        prop: "serverIp",
                        width: '160'
                    },
                    {
                        label: "软件环境",
                        prop: "env",
                        width: '80',
                    },
                    {
                        label: "日志名",
                        prop: "title"
                    },
                    {
                        label: "请求方法",
                        prop: "method",
                        width: '80'
                    },
                    {
                        label: "请求接口",
                        prop: "requestUri"
                    },
                    {
                        label: "日志时间",
                        prop: "createTime",
                        width: '180'
                    },
                    {
                        label: "用户代理",
                        prop: "userAgent",
                        span: 24,
                        hide: true
                    },
                    {
                        label: "请求数据",
                        prop: "params",
                        type: "textarea",
                        span: 24,
                        minRows: 2,
                        hide: true
                    }
                ]
            },
            {
              label: "服务ip",
              prop: "serverIp",
              width:'160'
            },
            {
              label: "软件环境",
              prop: "env",
              width:'80',
            },
            {
              label: "日志名",
              prop: "title"
            },
            {
              label: "请求方法",
              prop: "method",
              width:'80'
            },
            {
              label: "请求接口",
              prop: "requestUri"
            },
            {
              label: "日志时间",
              prop: "createTime",
              width:'180'
            },
            {
              label: "用户代理",
              prop: "userAgent",
              span: 24,
              hide: true
            },
            {
              label: "请求数据",
              prop: "params",
              type: "textarea",
              span: 24,
              minRows: 2,
              hide: true
            }
          ]
        },
        data: []
      };
            data: []
        }
    },
    computed: {
      ...mapGetters(["permission"]),
      permissionList() {
        return {
          viewBtn: this.vaildData(this.permission.log_api_view, false)
        };
      }
        ...mapGetters(["permission"]),
        permissionList () {
            return {
                viewBtn: this.vaildData(this.permission.log_api_view, false)
            }
        }
    },
    methods: {
      searchReset() {
        this.query = {};
        this.onLoad(this.page);
      },
      searchChange(params, done) {
        this.query = params;
        this.page.currentPage = 1;
        this.onLoad(this.page, params);
        done();
      },
      beforeOpen(done, type) {
        if (["edit", "view"].includes(type)) {
          getApiLogs(this.form.id).then(res => {
            this.form = res.data.data;
          });
        searchReset () {
            this.query = {}
            this.onLoad(this.page)
        },
        searchChange (params, done) {
            this.query = params
            this.page.currentPage = 1
            this.onLoad(this.page, params)
            done()
        },
        beforeOpen (done, type) {
            if (["edit", "view"].includes(type)) {
                getApiLogs(this.form.id).then(res => {
                    this.form = res.data.data
                })
            }
            done()
        },
        currentChange (currentPage) {
            this.page.currentPage = currentPage
        },
        sizeChange (pageSize) {
            this.page.pageSize = pageSize
        },
        refreshChange () {
            this.onLoad(this.page, this.query)
        },
        onLoad (page, params = {}) {
            this.loading = true
            getApiList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
                const data = res.data.data
                this.page.total = data.total
                this.data = data.records
                this.loading = false
            })
        }
        done();
      },
      currentChange(currentPage){
        this.page.currentPage = currentPage;
      },
      sizeChange(pageSize){
        this.page.pageSize = pageSize;
      },
      refreshChange() {
        this.onLoad(this.page, this.query);
      },
      onLoad(page, params = {}) {
        this.loading = true;
        getApiList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
          const data = res.data.data;
          this.page.total = data.total;
          this.data = data.records;
          this.loading = false;
        });
      }
    }
  };
}
</script>
<style>
</style>
<style></style>
src/views/monitor/log/error.vue
@@ -1,165 +1,154 @@
<template>
  <basic-container>
    <avue-crud :option="option"
               :table-loading="loading"
               :data="data"
               ref="crud"
               :before-open="beforeOpen"
               v-model="form"
               :permission="permissionList"
               :page.sync="page"
               @search-change="searchChange"
               @search-reset="searchReset"
               @current-change="currentChange"
               @size-change="sizeChange"
               @refresh-change="refreshChange"
               @on-load="onLoad">
    </avue-crud>
  </basic-container>
    <basic-container>
        <avue-crud :option="option" :table-loading="loading" :data="data" ref="crud" :before-open="beforeOpen"
            v-model="form" :permission="permissionList" :page.sync="page" @search-change="searchChange"
            @search-reset="searchReset" @current-change="currentChange" @size-change="sizeChange"
            @refresh-change="refreshChange" @on-load="onLoad">
        </avue-crud>
    </basic-container>
</template>
<script>
  import {getErrorList, getErrorLogs} from "@/api/logs";
  import {mapGetters} from "vuex";
import { getErrorList, getErrorLogs } from "@/api/logs"
import { mapGetters } from "vuex"
  export default {
    data() {
      return {
        form: {},
        selectionList: [],
        query: {},
        loading: true,
        page: {
          pageSize: 10,
          currentPage: 1,
          total: 0
        },
        option: {
          height: 'auto',
          calcHeight: 30,
          tip: false,
          searchShow: true,
          searchMenuSpan: 6,
          border: true,
          index: true,
          viewBtn: true,
          editBtn: false,
          addBtn: false,
          delBtn: false,
          menuWidth: 120,
          dialogType: 'drawer',
          column: [
            {
              label: "服务id",
              prop: "serviceId",
              search: true,
              width:'120'
export default {
    data () {
        return {
            form: {},
            selectionList: [],
            query: {},
            loading: true,
            page: {
                pageSize: 10,
                currentPage: 1,
                total: 0
            },
            {
              label: "服务host",
              prop: "serverHost",
              search: true,
              width:'150'
            option: {
                height: 'auto',
                calcHeight: 30,
                tip: false,
                searchShow: true,
                searchMenuSpan: 6,
                border: true,
                index: true,
                viewBtn: true,
                editBtn: false,
                addBtn: false,
                delBtn: false,
                menuWidth: 280,
                dialogType: 'drawer',
                column: [
                    {
                        label: "服务id",
                        prop: "serviceId",
                        search: true,
                        width: '120'
                    },
                    {
                        label: "服务host",
                        prop: "serverHost",
                        search: true,
                        width: '150'
                    },
                    {
                        label: "服务ip",
                        prop: "serverIp",
                        width: '160'
                    },
                    {
                        label: "软件环境",
                        prop: "env",
                        width: '80'
                    },
                    {
                        label: "请求方法",
                        prop: "method",
                        width: '80'
                    },
                    {
                        label: "请求接口",
                        prop: "requestUri"
                    },
                    {
                        label: "日志时间",
                        prop: "createTime",
                        width: '180'
                    },
                    {
                        label: "用户代理",
                        prop: "userAgent",
                        span: 24,
                        hide: true
                    },
                    {
                        label: "请求数据",
                        prop: "params",
                        type: "textarea",
                        span: 24,
                        minRows: 2,
                        hide: true
                    },
                    {
                        label: "日志数据",
                        prop: "stackTrace",
                        type: "textarea",
                        span: 24,
                        minRows: 16,
                        hide: true
                    }
                ]
            },
            {
              label: "服务ip",
              prop: "serverIp",
              width:'160'
            },
            {
              label: "软件环境",
              prop: "env",
              width:'80'
            },
            {
              label: "请求方法",
              prop: "method",
              width:'80'
            },
            {
              label: "请求接口",
              prop: "requestUri"
            },
            {
              label: "日志时间",
              prop: "createTime",
              width:'180'
            },
            {
              label: "用户代理",
              prop: "userAgent",
              span: 24,
              hide: true
            },
            {
              label: "请求数据",
              prop: "params",
              type: "textarea",
              span: 24,
              minRows: 2,
              hide: true
            },
            {
              label: "日志数据",
              prop: "stackTrace",
              type: "textarea",
              span: 24,
              minRows: 16,
              hide: true
            }
          ]
        },
        data: []
      };
            data: []
        }
    },
    computed: {
      ...mapGetters(["permission"]),
      permissionList() {
        return {
          viewBtn: this.vaildData(this.permission.log_error_view, false)
        };
      }
        ...mapGetters(["permission"]),
        permissionList () {
            return {
                viewBtn: this.vaildData(this.permission.log_error_view, false)
            }
        }
    },
    methods: {
      searchReset() {
        this.query = {};
        this.onLoad(this.page);
      },
      searchChange(params, done) {
        this.query = params;
        this.page.currentPage = 1;
        this.onLoad(this.page, params);
        done();
      },
      beforeOpen(done, type) {
        if (["edit", "view"].includes(type)) {
          getErrorLogs(this.form.id).then(res => {
            this.form = res.data.data;
          });
        searchReset () {
            this.query = {}
            this.onLoad(this.page)
        },
        searchChange (params, done) {
            this.query = params
            this.page.currentPage = 1
            this.onLoad(this.page, params)
            done()
        },
        beforeOpen (done, type) {
            if (["edit", "view"].includes(type)) {
                getErrorLogs(this.form.id).then(res => {
                    this.form = res.data.data
                })
            }
            done()
        },
        currentChange (currentPage) {
            this.page.currentPage = currentPage
        },
        sizeChange (pageSize) {
            this.page.pageSize = pageSize
        },
        refreshChange () {
            this.onLoad(this.page, this.query)
        },
        onLoad (page, params = {}) {
            this.loading = true
            getErrorList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
                const data = res.data.data
                this.page.total = data.total
                this.data = data.records
                this.loading = false
            })
        }
        done();
      },
      currentChange(currentPage){
        this.page.currentPage = currentPage;
      },
      sizeChange(pageSize){
        this.page.pageSize = pageSize;
      },
      refreshChange() {
        this.onLoad(this.page, this.query);
      },
      onLoad(page, params = {}) {
        this.loading = true;
        getErrorList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
          const data = res.data.data;
          this.page.total = data.total;
          this.data = data.records;
          this.loading = false;
        });
      }
    }
  };
}
</script>
<style>
</style>
<style></style>
src/views/monitor/log/usual.vue
@@ -1,165 +1,154 @@
<template>
  <basic-container>
    <avue-crud :option="option"
               :table-loading="loading"
               :data="data"
               ref="crud"
               v-model="form"
               :permission="permissionList"
               :page.sync="page"
               :before-open="beforeOpen"
               @search-change="searchChange"
               @search-reset="searchReset"
               @current-change="currentChange"
               @size-change="sizeChange"
               @refresh-change="refreshChange"
               @on-load="onLoad">
    </avue-crud>
  </basic-container>
    <basic-container>
        <avue-crud :option="option" :table-loading="loading" :data="data" ref="crud" v-model="form"
            :permission="permissionList" :page.sync="page" :before-open="beforeOpen" @search-change="searchChange"
            @search-reset="searchReset" @current-change="currentChange" @size-change="sizeChange"
            @refresh-change="refreshChange" @on-load="onLoad">
        </avue-crud>
    </basic-container>
</template>
<script>
  import {getUsualList, getUsualLogs} from "@/api/logs";
  import {mapGetters} from "vuex";
import { getUsualList, getUsualLogs } from "@/api/logs"
import { mapGetters } from "vuex"
  export default {
    data() {
      return {
        form: {},
        selectionList: [],
        query: {},
        loading: true,
        page: {
          pageSize: 10,
          currentPage: 1,
          total: 0
        },
        option: {
          height: 'auto',
          calcHeight: 30,
          tip: false,
          searchShow: true,
          searchMenuSpan: 6,
          border: true,
          index: true,
          viewBtn: true,
          editBtn: false,
          addBtn: false,
          delBtn: false,
          menuWidth: 120,
          dialogType: 'drawer',
          column: [
            {
              label: "服务id",
              prop: "serviceId",
              search: true
export default {
    data () {
        return {
            form: {},
            selectionList: [],
            query: {},
            loading: true,
            page: {
                pageSize: 10,
                currentPage: 1,
                total: 0
            },
            {
              label: "服务host",
              prop: "serverHost",
              search: true
            option: {
                height: 'auto',
                calcHeight: 30,
                tip: false,
                searchShow: true,
                searchMenuSpan: 6,
                border: true,
                index: true,
                viewBtn: true,
                editBtn: false,
                addBtn: false,
                delBtn: false,
                menuWidth: 280,
                dialogType: 'drawer',
                column: [
                    {
                        label: "服务id",
                        prop: "serviceId",
                        search: true
                    },
                    {
                        label: "服务host",
                        prop: "serverHost",
                        search: true
                    },
                    {
                        label: "服务ip",
                        prop: "serverIp"
                    },
                    {
                        label: "软件环境",
                        prop: "env",
                        width: '80'
                    },
                    {
                        label: "日志级别",
                        prop: "logLevel"
                    },
                    {
                        label: "日志id",
                        prop: "logId"
                    },
                    {
                        label: "请求接口",
                        prop: "requestUri"
                    },
                    {
                        label: "日志时间",
                        prop: "createTime",
                        width: '180'
                    },
                    {
                        label: "用户代理",
                        prop: "userAgent",
                        span: 24,
                        hide: true
                    },
                    {
                        label: "日志数据",
                        prop: "logData",
                        type: "textarea",
                        span: 24,
                        minRows: 2,
                        hide: true
                    },
                    {
                        label: "请求数据",
                        prop: "params",
                        type: "textarea",
                        span: 24,
                        minRows: 2,
                        hide: true
                    }
                ]
            },
            {
              label: "服务ip",
              prop: "serverIp"
            },
            {
              label: "软件环境",
              prop: "env",
              width:'80'
            },
            {
              label: "日志级别",
              prop: "logLevel"
            },
            {
              label: "日志id",
              prop: "logId"
            },
            {
              label: "请求接口",
              prop: "requestUri"
            },
            {
              label: "日志时间",
              prop: "createTime",
              width:'180'
            },
            {
              label: "用户代理",
              prop: "userAgent",
              span: 24,
              hide: true
            },
            {
              label: "日志数据",
              prop: "logData",
              type: "textarea",
              span: 24,
              minRows: 2,
              hide: true
            },
            {
              label: "请求数据",
              prop: "params",
              type: "textarea",
              span: 24,
              minRows: 2,
              hide: true
            }
          ]
        },
        data: []
      };
            data: []
        }
    },
    computed: {
      ...mapGetters(["permission"]),
      permissionList() {
        return {
          viewBtn: this.vaildData(this.permission.log_usual_view, false)
        };
      }
        ...mapGetters(["permission"]),
        permissionList () {
            return {
                viewBtn: this.vaildData(this.permission.log_usual_view, false)
            }
        }
    },
    methods: {
      searchReset() {
        this.query = {};
        this.onLoad(this.page);
      },
      searchChange(params, done) {
        this.query = params;
        this.page.currentPage = 1;
        this.onLoad(this.page, params);
        done();
      },
      beforeOpen(done, type) {
        if (["edit", "view"].includes(type)) {
          getUsualLogs(this.form.id).then(res => {
            this.form = res.data.data;
          });
        searchReset () {
            this.query = {}
            this.onLoad(this.page)
        },
        searchChange (params, done) {
            this.query = params
            this.page.currentPage = 1
            this.onLoad(this.page, params)
            done()
        },
        beforeOpen (done, type) {
            if (["edit", "view"].includes(type)) {
                getUsualLogs(this.form.id).then(res => {
                    this.form = res.data.data
                })
            }
            done()
        },
        currentChange (currentPage) {
            this.page.currentPage = currentPage
        },
        sizeChange (pageSize) {
            this.page.pageSize = pageSize
        },
        refreshChange () {
            this.onLoad(this.page, this.query)
        },
        onLoad (page, params = {}) {
            this.loading = true
            getUsualList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
                const data = res.data.data
                this.page.total = data.total
                this.data = data.records
                this.loading = false
            })
        }
        done();
      },
      currentChange(currentPage){
        this.page.currentPage = currentPage;
      },
      sizeChange(pageSize){
        this.page.pageSize = pageSize;
      },
      refreshChange() {
        this.onLoad(this.page, this.query);
      },
      onLoad(page, params = {}) {
        this.loading = true;
        getUsualList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
          const data = res.data.data;
          this.page.total = data.total;
          this.data = data.records;
          this.loading = false;
        });
      }
    }
  };
}
</script>
<style>
</style>
<style></style>
src/views/place/index.vue
@@ -1,40 +1,42 @@
<template>
  <basic-container>
    <avue-crud :option="option" :table-loading="loading" :data="data" :page.sync="page" ref="crud" @row-del="rowDel"
      v-model="form" :permission="permissionList" @row-update="rowUpdate" @row-save="rowSave" :before-open="beforeOpen"
      @search-change="searchChange" @search-reset="searchReset" @selection-change="selectionChange"
      @current-change="currentChange" @size-change="sizeChange" @refresh-change="refreshChange" @on-load="onLoad">
      <template slot="menuLeft">
        <el-button size="small" icon="el-icon-delete" plain v-if="permission.place_delete" @click="handleDelete">删 除
        </el-button>
      </template>
    <basic-container>
        <avue-crud :option="option" :table-loading="loading" :data="data" :page.sync="page" ref="crud" @row-del="rowDel"
            v-model="form" :permission="permissionList" @row-update="rowUpdate" @row-save="rowSave"
            :before-open="beforeOpen" @search-change="searchChange" @search-reset="searchReset"
            @selection-change="selectionChange" @current-change="currentChange" @size-change="sizeChange"
            @refresh-change="refreshChange" @on-load="onLoad">
            <template slot="menuLeft">
                <el-button size="small" icon="el-icon-delete" plain v-if="permission.place_delete" @click="handleDelete">删 除
                </el-button>
            </template>
      <template slot-scope="scope" slot="menu">
        <el-button type="text" icon="el-icon-circle-plus-outline" size="small" v-if="permission.househould_manager"
          @click="ManageTenants(scope.row)">场所维护
        </el-button>
      </template>
    </avue-crud>
            <template slot-scope="scope" slot="menu">
                <el-button type="text" icon="el-icon-circle-plus-outline" size="small" v-if="permission.househould_manager"
                    @click="ManageTenants(scope.row)">场所维护
                </el-button>
            </template>
        </avue-crud>
    <el-dialog title="场所维护" append-to-body :visible.sync="roleBox" center>
      <avue-crud :option="placeOption" :search.sync="search" :table-loading="loading" :data="placeExt" ref="crud"
        v-model="houseHoldForm" :permission="permissionList" @row-del="houseHoldRowDel" @row-update="houseHoldRowUpdate"
        @row-save="houseHoldRowSave" :page.sync="holdPage" @current-change="currentChange" @size-change="sizeChange">
      </avue-crud>
        <el-dialog title="场所维护" append-to-body :visible.sync="roleBox" center>
            <avue-crud :option="placeOption" :search.sync="search" :table-loading="loading" :data="placeExt" ref="crud"
                v-model="houseHoldForm" :permission="permissionList" @row-del="houseHoldRowDel"
                @row-update="houseHoldRowUpdate" @row-save="houseHoldRowSave" :page.sync="holdPage"
                @current-change="currentChange" @size-change="sizeChange">
            </avue-crud>
      <avue-form :option="optionDetail" v-model="placeForm"></avue-form>
            <avue-form :option="optionDetail" v-model="placeForm"></avue-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="roleBox = false">取 消</el-button>
        <el-button type="primary" @click="submitRole">确 定</el-button>
      </span>
    </el-dialog>
            <span slot="footer" class="dialog-footer">
                <el-button @click="roleBox = false">取 消</el-button>
                <el-button type="primary" @click="submitRole">确 定</el-button>
            </span>
        </el-dialog>
  </basic-container>
    </basic-container>
</template>
<script>
  import {
import {
    getList,
    remove,
    update,
@@ -42,457 +44,457 @@
    getPlace,
    getPlaceExt,
    updatePlaceExt
  } from "@/api/place/place";
  import {
} from "@/api/place/place"
import {
    mapGetters
  } from "vuex";
  import website from '@/config/website';
  export default {
    data() {
      return {
        form: {},
        query: {},
        loading: true,
        roleBox: false,
        placeForm: {},
        optionDetail: {
          submitBtn: false,
          emptyBtn: false,
          column: [{
              label: '场所名称',
              prop: 'placeName',
} from "vuex"
import website from '@/config/website'
export default {
    data () {
        return {
            form: {},
            query: {},
            loading: true,
            roleBox: false,
            placeForm: {},
            optionDetail: {
                submitBtn: false,
                emptyBtn: false,
                column: [{
                    label: '场所名称',
                    prop: 'placeName',
                },
                {
                    label: '法人信息',
                    prop: 'legalPerson'
                },
                {
                    label: '法人电话',
                    prop: 'legalTel'
                },
                {
                    label: '场所位置',
                    prop: 'localtion'
                }, {
                    label: '审核状态',
                    prop: 'confirmFlag',
                    type: 'radio',
                    dicData: [{
                        label: '待审核',
                        value: 0
                    }, {
                        label: '审核通过',
                        value: 1
                    }, {
                        label: '审核不通过',
                        value: 2
                    }]
                }
                ]
            },
            {
              label: '法人信息',
              prop: 'legalPerson'
            rowPlace: {},
            placeExt: [],
            placeOption: {
                menu: false,
                height: 300,
                calcHeight: 54,
                dialogWidth: 950,
                tip: false,
                searchShow: false,
                addBtn: false,
                delBtn: false,
                editBtn: false,
                border: true,
                index: true,
                dialogClickModal: false,
                column: [{
                    label: "名称",
                    prop: "name",
                    searchSpan: 4,
                    search: true,
                }, {
                    label: "电话",
                    prop: "telephone",
                    searchSpan: 4,
                    search: true,
                }, {
                    label: "暂住地",
                    prop: "tempAddress",
                    searchSpan: 4,
                    search: true,
                },]
            },
            {
              label: '法人电话',
              prop: 'legalTel'
            page: {
                pageSize: 10,
                currentPage: 1,
                total: 0,
            },
            {
              label: '场所位置',
              prop: 'localtion'
            }, {
              label: '审核状态',
              prop: 'confirmFlag',
              type: 'radio',
              dicData: [{
                label: '待审核',
                value: 0
              }, {
                label: '审核通过',
                value: 1
              }, {
                label: '审核不通过',
                value: 2
              }]
            }
          ]
        },
        rowPlace: {},
        placeExt: [],
        placeOption: {
          menu: false,
          height: 300,
          calcHeight: 54,
          dialogWidth: 950,
          tip: false,
          searchShow: false,
          addBtn: false,
          delBtn: false,
          editBtn: false,
          border: true,
          index: true,
          dialogClickModal: false,
          column: [{
            label: "名称",
            prop: "name",
            searchSpan: 4,
            search: true,
          }, {
            label: "电话",
            prop: "telephone",
            searchSpan: 4,
            search: true,
          }, {
            label: "暂住地",
            prop: "tempAddress",
            searchSpan: 4,
            search: true,
          }, ]
        },
        page: {
          pageSize: 10,
          currentPage: 1,
          total: 0,
        },
        datetime: "",
        selectionList: [],
        option: {
          height: "auto",
          calcHeight: 54,
          dialogWidth: 950,
          tip: false,
          searchShow: true,
          searchMenuSpan: 3,
          menuWidth: 350,
          border: true,
          //stripe:true,
          index: true,
          viewBtn: true,
          selection: true,
          dialogClickModal: false,
          column: [{
              label: "场所名称",
              prop: "placeName",
              searchSpan: 4,
              search: true,
              rules: [{
                required: true,
                message: "请输入场所名称",
                trigger: "blur",
              }, ],
            datetime: "",
            selectionList: [],
            option: {
                height: "auto",
                calcHeight: 54,
                dialogWidth: 950,
                tip: false,
                searchShow: true,
                searchMenuSpan: 3,
                menuWidth: 280,
                border: true,
                //stripe:true,
                index: true,
                viewBtn: true,
                selection: true,
                dialogClickModal: false,
                column: [{
                    label: "场所名称",
                    prop: "placeName",
                    searchSpan: 4,
                    search: true,
                    rules: [{
                        required: true,
                        message: "请输入场所名称",
                        trigger: "blur",
                    },],
                },
                {
                    label: "场所标签",
                    prop: "label",
                    type: "tree",
                    dicUrl: "/api/blade-categoryLabel/categoryLabel/getAllList",
                    props: {
                        label: "categoryName",
                        value: "categoryNo"
                    },
                    multiple: true,
                    dataType: "string",
                    hide: true,
                    rules: [{
                        required: true,
                        message: "请输入场所标签",
                        trigger: "blur",
                    },],
                },
                {
                    label: "负责人",
                    prop: "principal",
                    searchSpan: 4,
                    search: true,
                    rules: [{
                        required: false,
                        message: "请输入负责人",
                        trigger: "blur",
                    },],
                },
                {
                    label: "联系电话",
                    prop: "principalPhone",
                    searchSpan: 4,
                    search: true,
                    rules: [{
                        required: false,
                        message: "请输入联系电话",
                        trigger: "blur",
                    },],
                }, {
                    label: "审核状态",
                    prop: "confirmFlag",
                    searchSpan: 4,
                    search: true,
                    dicData: [{
                        label: '待审核',
                        value: 0,
                    }, {
                        label: '审核通过',
                        value: 1,
                    }, {
                        label: '审核不通过',
                        value: 2,
                    }],
                },
                {
                    label: "场所照片",
                    prop: "imageUrls",
                    width: 80,
                    type: "upload",
                    listType: "picture-card",
                    dataType: "string",
                    multiple: true,
                    action: "/api/blade-resource/oss/endpoint/put-file",
                    propsHttp: {
                        res: "data",
                        name: 'name',
                        url: "link",
                    },
                    span: 24,
                },
                {
                    label: "位置",
                    prop: "localtion",
                    span: 24,
                    minWidth: 220,
                    overHidden: true,
                    rules: [{
                        required: true,
                        message: "请输入区域",
                        trigger: "blur",
                    },],
                }
                ],
            },
            {
              label: "场所标签",
              prop: "label",
              type: "tree",
              dicUrl: "/api/blade-categoryLabel/categoryLabel/getAllList",
              props: {
                label: "categoryName",
                value: "categoryNo"
              },
              multiple: true,
              dataType: "string",
              hide: true,
              rules: [{
                required: true,
                message: "请输入场所标签",
                trigger: "blur",
              }, ],
            },
            {
              label: "负责人",
              prop: "principal",
              searchSpan: 4,
              search: true,
              rules: [{
                required: false,
                message: "请输入负责人",
                trigger: "blur",
              }, ],
            },
            {
              label: "联系电话",
              prop: "principalPhone",
              searchSpan: 4,
              search: true,
              rules: [{
                required: false,
                message: "请输入联系电话",
                trigger: "blur",
              }, ],
            }, {
              label: "审核状态",
              prop: "confirmFlag",
              searchSpan: 4,
              search: true,
              dicData: [{
                label: '待审核',
                value: 0,
              }, {
                label: '审核通过',
                value: 1,
              }, {
                label: '审核不通过',
                value: 2,
              }],
            },
            {
              label: "场所照片",
              prop: "imageUrls",
              width: 80,
              type: "upload",
              listType: "picture-card",
              dataType: "string",
              multiple: true,
              action: "/api/blade-resource/oss/endpoint/put-file",
              propsHttp: {
                res: "data",
                name: 'name',
                url: "link",
              },
              span: 24,
            },
            {
              label: "位置",
              prop: "localtion",
              span: 24,
              minWidth: 220,
              overHidden: true,
              rules: [{
                required: true,
                message: "请输入区域",
                trigger: "blur",
              }, ],
            }
          ],
        },
        data: [],
      };
            data: [],
        }
    },
    watch: {},
    computed: {
      ...mapGetters(["permission", "userInfo"]),
      permissionList() {
        return {
          addBtn: this.vaildData(this.permission.place_add, true),
          viewBtn: this.vaildData(this.permission.place_view, true),
          delBtn: this.vaildData(this.permission.place_delete, true),
          editBtn: this.vaildData(this.permission.place_edit, true),
        };
      },
      ids() {
        let ids = [];
        this.selectionList.forEach((ele) => {
          ids.push(ele.id);
        });
        return ids.join(",");
      },
        ...mapGetters(["permission", "userInfo"]),
        permissionList () {
            return {
                addBtn: this.vaildData(this.permission.place_add, true),
                viewBtn: this.vaildData(this.permission.place_view, true),
                delBtn: this.vaildData(this.permission.place_delete, true),
                editBtn: this.vaildData(this.permission.place_edit, true),
            }
        },
        ids () {
            let ids = []
            this.selectionList.forEach((ele) => {
                ids.push(ele.id)
            })
            return ids.join(",")
        },
    },
    methods: {
      ManageTenants(item) {
        this.roleBox = true
        this.rowPlace = item
        this.placeForm = {
          placeName: '',
          legalPerson: '',
          legalTel: '',
          localtion: '',
          confirmFlag: '',
        };
        this.placeExt = []
        this.onLoadPlaceExt()
      },
        ManageTenants (item) {
            this.roleBox = true
            this.rowPlace = item
            this.placeForm = {
                placeName: '',
                legalPerson: '',
                legalTel: '',
                localtion: '',
                confirmFlag: '',
            }
            this.placeExt = []
            this.onLoadPlaceExt()
        },
      submitRole() {
        updatePlaceExt(this.placeForm).then(
          () => {
            this.$message({
              type: "success",
              message: "操作成功!",
            });
            this.roleBox = false
          },
          (error) => {
            window.console.log(error);
            loading();
          }
        );
      },
        submitRole () {
            updatePlaceExt(this.placeForm).then(
                () => {
                    this.$message({
                        type: "success",
                        message: "操作成功!",
                    })
                    this.roleBox = false
                },
                (error) => {
                    window.console.log(error)
                    loading()
                }
            )
        },
      onLoadPlaceExt() {
        let params = {
          placeId: this.rowPlace.id,
        }
        getPlaceExt(Object.assign(params)).then(res => {
          const data = res.data.data;
          if (data) {
            this.placeForm = data;
            this.placeExt = data.placePractitioner;
            this.loading = false;
            this.selectionClear();
          }
        });
      },
        onLoadPlaceExt () {
            let params = {
                placeId: this.rowPlace.id,
            }
            getPlaceExt(Object.assign(params)).then(res => {
                const data = res.data.data
                if (data) {
                    this.placeForm = data
                    this.placeExt = data.placePractitioner
                    this.loading = false
                    this.selectionClear()
                }
            })
        },
      rowSave(row, done, loading) {
        if (row.imageUrls.length > 0) {
          var urls = []
          var split = row.imageUrls.split(",");
          split.forEach(url => {
            var names = url.split("jczz/");
            urls.push(names[1])
          })
          row.imageUrls = urls.join(",")
        }
        add(row).then(
          () => {
            this.onLoad(this.page);
            this.$message({
              type: "success",
              message: "操作成功!",
            });
            done();
          },
          (error) => {
            window.console.log(error);
            loading();
          }
        );
      },
      rowUpdate(row, index, done, loading) {
        if (row.imageUrls.length > 0) {
          var urls = []
          var split = row.imageUrls.split(",");
          split.forEach(url => {
            var names = url.split("jczz/");
            urls.push(names[1])
          })
          row.imageUrls = urls.join(",")
        }
        update(row).then(
          () => {
            this.onLoad(this.page);
            this.$message({
              type: "success",
              message: "操作成功!",
            });
            done();
          },
          (error) => {
            window.console.log(error);
            loading();
          }
        );
      },
      rowDel(row) {
        this.$confirm("确定将选择数据删除?", {
            confirmButtonText: "确定",
            cancelButtonText: "取消",
            type: "warning",
          })
          .then(() => {
            return remove(row.id);
          })
          .then(() => {
            this.onLoad(this.page);
            this.$message({
              type: "success",
              message: "操作成功!",
            });
          });
      },
      searchReset() {
        this.query = {};
        this.onLoad(this.page);
      },
      searchChange(params, done) {
        this.query = params;
        this.page.currentPage = 1;
        this.onLoad(this.page, params);
        done();
      },
      selectionChange(list) {
        this.selectionList = list;
      },
      selectionClear() {
        this.selectionList = [];
        this.$refs.crud.toggleSelection();
      },
      handleDelete() {
        if (this.selectionList.length === 0) {
          this.$message.warning("请选择至少一条数据");
          return;
        }
        this.$confirm("确定将选择数据删除?", {
            confirmButtonText: "确定",
            cancelButtonText: "取消",
            type: "warning",
          })
          .then(() => {
            return remove(this.ids);
          })
          .then(() => {
            this.onLoad(this.page);
            this.$message({
              type: "success",
              message: "操作成功!",
            });
            this.$refs.crud.toggleSelection();
          });
      },
      beforeOpen(done, type) {
        if (["edit", "view"].includes(type)) {
          getPlace(this.form.id).then((res) => {
            this.form = res.data.data;
            if (this.form.imageUrls) {
              if (this.form.imageUrls.length > 0) {
        rowSave (row, done, loading) {
            if (row.imageUrls.length > 0) {
                var urls = []
                var names = this.form.imageUrls.split(",");
                names.forEach(name => {
                  urls.push(website.minioUrl + name)
                var split = row.imageUrls.split(",")
                split.forEach(url => {
                    var names = url.split("jczz/")
                    urls.push(names[1])
                })
                this.form.imageUrls = urls.join(",")
              }
                row.imageUrls = urls.join(",")
            }
            if (this.form.placePoiLabelVOList) {
              var arr = []
              this.form.placePoiLabelVOList.forEach(item => {
                arr.push(item.poiCode);
              })
              this.form.label = arr.join(",")
            }
            console.log(this.form, 888888)
          });
        }
        // con
        done();
      },
      currentChange(currentPage) {
        this.page.currentPage = currentPage;
      },
      sizeChange(pageSize) {
        this.page.pageSize = pageSize;
      },
      refreshChange() {
        this.onLoad(this.page, this.query);
      },
      onLoad(page, params = {}) {
        const {
          dateTime
        } = this.query;
        let values = {
          ...params,
        };
        if (dateTime) {
          values = {
            ...params,
            startTime: dateTime[0],
            endTime: dateTime[1],
            ...this.query,
          };
          values.dateTime = null;
        }
        this.loading = true;
        getList(page.currentPage, page.pageSize, values).then((res) => {
          const data = res.data.data;
          this.page.total = data.total;
          this.data = data.records;
          this.data.forEach(item => {
            if (item.imageUrls) {
              if (item.imageUrls.length > 0) {
            add(row).then(
                () => {
                    this.onLoad(this.page)
                    this.$message({
                        type: "success",
                        message: "操作成功!",
                    })
                    done()
                },
                (error) => {
                    window.console.log(error)
                    loading()
                }
            )
        },
        rowUpdate (row, index, done, loading) {
            if (row.imageUrls.length > 0) {
                var urls = []
                var names = item.imageUrls.split(",");
                names.forEach(name => {
                  urls.push(website.minioUrl + name)
                var split = row.imageUrls.split(",")
                split.forEach(url => {
                    var names = url.split("jczz/")
                    urls.push(names[1])
                })
                item.imageUrls = urls.join(",")
              }
                row.imageUrls = urls.join(",")
            }
          })
          this.loading = false;
          this.selectionClear();
        });
      }
            update(row).then(
                () => {
                    this.onLoad(this.page)
                    this.$message({
                        type: "success",
                        message: "操作成功!",
                    })
                    done()
                },
                (error) => {
                    window.console.log(error)
                    loading()
                }
            )
        },
        rowDel (row) {
            this.$confirm("确定将选择数据删除?", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                type: "warning",
            })
                .then(() => {
                    return remove(row.id)
                })
                .then(() => {
                    this.onLoad(this.page)
                    this.$message({
                        type: "success",
                        message: "操作成功!",
                    })
                })
        },
        searchReset () {
            this.query = {}
            this.onLoad(this.page)
        },
        searchChange (params, done) {
            this.query = params
            this.page.currentPage = 1
            this.onLoad(this.page, params)
            done()
        },
        selectionChange (list) {
            this.selectionList = list
        },
        selectionClear () {
            this.selectionList = []
            this.$refs.crud.toggleSelection()
        },
        handleDelete () {
            if (this.selectionList.length === 0) {
                this.$message.warning("请选择至少一条数据")
                return
            }
            this.$confirm("确定将选择数据删除?", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                type: "warning",
            })
                .then(() => {
                    return remove(this.ids)
                })
                .then(() => {
                    this.onLoad(this.page)
                    this.$message({
                        type: "success",
                        message: "操作成功!",
                    })
                    this.$refs.crud.toggleSelection()
                })
        },
        beforeOpen (done, type) {
            if (["edit", "view"].includes(type)) {
                getPlace(this.form.id).then((res) => {
                    this.form = res.data.data
                    if (this.form.imageUrls) {
                        if (this.form.imageUrls.length > 0) {
                            var urls = []
                            var names = this.form.imageUrls.split(",")
                            names.forEach(name => {
                                urls.push(website.minioUrl + name)
                            })
                            this.form.imageUrls = urls.join(",")
                        }
                    }
                    if (this.form.placePoiLabelVOList) {
                        var arr = []
                        this.form.placePoiLabelVOList.forEach(item => {
                            arr.push(item.poiCode)
                        })
                        this.form.label = arr.join(",")
                    }
                    console.log(this.form, 888888)
                })
            }
            // con
            done()
        },
        currentChange (currentPage) {
            this.page.currentPage = currentPage
        },
        sizeChange (pageSize) {
            this.page.pageSize = pageSize
        },
        refreshChange () {
            this.onLoad(this.page, this.query)
        },
        onLoad (page, params = {}) {
            const {
                dateTime
            } = this.query
            let values = {
                ...params,
            }
            if (dateTime) {
                values = {
                    ...params,
                    startTime: dateTime[0],
                    endTime: dateTime[1],
                    ...this.query,
                }
                values.dateTime = null
            }
            this.loading = true
            getList(page.currentPage, page.pageSize, values).then((res) => {
                const data = res.data.data
                this.page.total = data.total
                this.data = data.records
                this.data.forEach(item => {
                    if (item.imageUrls) {
                        if (item.imageUrls.length > 0) {
                            var urls = []
                            var names = item.imageUrls.split(",")
                            names.forEach(name => {
                                urls.push(website.minioUrl + name)
                            })
                            item.imageUrls = urls.join(",")
                        }
                    }
                })
                this.loading = false
                this.selectionClear()
            })
        }
    }
  };
}
</script>
<style>
  .avue-upload__icon {
.avue-upload__icon {
    line-height: 6;
  }
}
</style>
src/views/rotation/index.vue
@@ -1,310 +1,289 @@
<!-- 工作日志 -->
<!-- 走访日志 -->
<template>
  <basic-container>
    <avue-crud
      :option="option"
      :table-loading="loading"
      :data="data"
      :page.sync="page"
      ref="crud"
      @row-del="rowDel"
      v-model="form"
      :permission="permissionList"
      @row-update="rowUpdate"
      @row-save="rowSave"
      :before-open="beforeOpen"
      @search-change="searchChange"
      @search-reset="searchReset"
      @selection-change="selectionChange"
      @current-change="currentChange"
      @size-change="sizeChange"
      @refresh-change="refreshChange"
      @on-load="onLoad"
    >
      <template slot="menuLeft">
        <el-button
          size="small"
          icon="el-icon-delete"
          plain
          v-if="permission.article_delete"
          @click="handleDelete"
        >删 除
        </el-button>
      </template>
    </avue-crud>
  </basic-container>
    <basic-container>
        <avue-crud :option="option" :table-loading="loading" :data="data" :page.sync="page" ref="crud" @row-del="rowDel"
            v-model="form" :permission="permissionList" @row-update="rowUpdate" @row-save="rowSave"
            :before-open="beforeOpen" @search-change="searchChange" @search-reset="searchReset"
            @selection-change="selectionChange" @current-change="currentChange" @size-change="sizeChange"
            @refresh-change="refreshChange" @on-load="onLoad">
            <template slot="menuLeft">
                <el-button size="small" icon="el-icon-delete" plain v-if="permission.article_delete" @click="handleDelete">删
                    除
                </el-button>
            </template>
        </avue-crud>
    </basic-container>
</template>
<script>
  import {getList, remove, update, add, getRotation} from "@/api/rotation/rotation";
  import {mapGetters} from "vuex";
  import website from '@/config/website';
import { getList, remove, update, add, getRotation } from "@/api/rotation/rotation"
import { mapGetters } from "vuex"
import website from '@/config/website'
  export default {
    data() {
      return {
        form: {},
        query: {},
        loading: true,
        page: {
          pageSize: 10,
          currentPage: 1,
          total: 0,
        },
        datetime: "",
        selectionList: [],
        option: {
          height: "auto",
          calcHeight: 54,
          dialogWidth: 950,
          tip: false,
          searchShow: true,
          searchMenuSpan: 3,
          menuWidth: 350,
          border: false,
          //stripe:true,
          index: true,
          viewBtn: true,
          selection: true,
          excelBtn: true,
          dialogClickModal: false,
          column: [
            {
              label: "名称",
              prop: "name",
              span: 12,
              searchSpan: 4,
              search:true,
export default {
    data () {
        return {
            form: {},
            query: {},
            loading: true,
            page: {
                pageSize: 10,
                currentPage: 1,
                total: 0,
            },
            {
              label: "跳转地址",
              prop: "junpUrl",
              span: 12,
              searchSpan: 4,
              search:true,
            datetime: "",
            selectionList: [],
            option: {
                height: "auto",
                calcHeight: 54,
                dialogWidth: 950,
                tip: false,
                searchShow: true,
                searchMenuSpan: 3,
                menuWidth: 350,
                border: false,
                //stripe:true,
                index: true,
                viewBtn: true,
                selection: true,
                excelBtn: true,
                dialogClickModal: false,
                column: [
                    {
                        label: "名称",
                        prop: "name",
                        span: 12,
                        searchSpan: 4,
                        search: true,
                    },
                    {
                        label: "跳转地址",
                        prop: "junpUrl",
                        span: 12,
                        searchSpan: 4,
                        search: true,
                    },
                    {
                        label: "图片",
                        prop: "url",
                        type: "upload",
                        width: 80,
                        listType: "picture-img",
                        action: "/api/blade-resource/oss/endpoint/put-file",
                        propsHttp: {
                            res: "data",
                            name: 'name',
                            url: "link",
                        },
                        span: 24,
                    },
                    {
                        label: "时间",
                        prop: "createTime",
                        width: 160,
                        addDisplay: false,
                        editDisplay: false,
                        type: "date",
                        format: "yyyy-MM-dd HH:mm:ss",
                        valueFormat: "yyyy-MM-dd HH:mm:ss",
                    }
                ],
            },
            {
              label: "图片",
              prop: "url",
              type: "upload",
              width:80,
              listType: "picture-img",
              action: "/api/blade-resource/oss/endpoint/put-file",
              propsHttp: {
                res: "data",
                name: 'name',
                url: "link",
              },
              span: 24,
            },
            {
              label: "时间",
              prop: "createTime",
              width:160,
              addDisplay: false,
              editDisplay: false,
              type: "date",
              format: "yyyy-MM-dd HH:mm:ss",
              valueFormat: "yyyy-MM-dd HH:mm:ss",
            }
          ],
        },
        data: [],
      };
            data: [],
        }
    },
    watch: {
    },
    computed: {
      ...mapGetters(["permission","userInfo"]),
      permissionList() {
        return {
          addBtn: this.vaildData(this.permission.rotation_add, true),
          viewBtn: this.vaildData(this.permission.rotation_view, true),
          delBtn: this.vaildData(this.permission.rotation_delete, true),
          editBtn: this.vaildData(this.permission.rotation_edit, true),
        };
      },
      ids() {
        let ids = [];
        this.selectionList.forEach((ele) => {
          ids.push(ele.id);
        });
        return ids.join(",");
      },
        ...mapGetters(["permission", "userInfo"]),
        permissionList () {
            return {
                addBtn: this.vaildData(this.permission.rotation_add, true),
                viewBtn: this.vaildData(this.permission.rotation_view, true),
                delBtn: this.vaildData(this.permission.rotation_delete, true),
                editBtn: this.vaildData(this.permission.rotation_edit, true),
            }
        },
        ids () {
            let ids = []
            this.selectionList.forEach((ele) => {
                ids.push(ele.id)
            })
            return ids.join(",")
        },
    },
    methods: {
      rowSave(row, done, loading) {
        if(row.url.length>0){
          var urls = []
          var split = row.url.split(",");
          split.forEach(url=>{
             var names = url.split("jczz/");
             urls.push(names[1])
          })
          row.url = urls.join(",")
        }
        add(row).then(
          () => {
            this.onLoad(this.page);
            this.$message({
              type: "success",
              message: "操作成功!",
            });
            done();
          },
          (error) => {
            window.console.log(error);
            loading();
          }
        );
      },
      rowUpdate(row, index, done, loading) {
        if(row.url.length>0){
          var urls = []
          var split = row.url.split(",");
          split.forEach(url=>{
             var names = url.split("jczz/");
             urls.push(names[1])
          })
          row.url = urls.join(",")
        }
        update(row).then(
          () => {
            this.onLoad(this.page);
            this.$message({
              type: "success",
              message: "操作成功!",
            });
            done();
          },
          (error) => {
            window.console.log(error);
            loading();
          }
        );
      },
      rowDel(row) {
        this.$confirm("确定将选择数据删除?", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning",
        })
          .then(() => {
            return remove(row.id);
          })
          .then(() => {
            this.onLoad(this.page);
            this.$message({
              type: "success",
              message: "操作成功!",
            });
          });
      },
      searchReset() {
        this.query = {};
        this.onLoad(this.page);
      },
      searchChange(params, done) {
        this.query = params;
        this.page.currentPage = 1;
        this.onLoad(this.page, params);
        done();
      },
      selectionChange(list) {
        this.selectionList = list;
      },
      selectionClear() {
        this.selectionList = [];
        this.$refs.crud.toggleSelection();
      },
      handleDelete() {
        if (this.selectionList.length === 0) {
          this.$message.warning("请选择至少一条数据");
          return;
        }
        this.$confirm("确定将选择数据删除?", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning",
        })
          .then(() => {
            return remove(this.ids);
          })
          .then(() => {
            this.onLoad(this.page);
            this.$message({
              type: "success",
              message: "操作成功!",
            });
            this.$refs.crud.toggleSelection();
          });
      },
      beforeOpen(done, type) {
        if (["edit", "view"].includes(type)) {
          getRotation(this.form.id).then((res) => {
            this.form = res.data.data;
            if(this.form.url.length>0){
              var urls = []
              var names = this.form.url.split(",");
              names.forEach(name=>{
                urls.push(website.minioUrl + name)
              })
              this.form.url = urls.join(",")
        rowSave (row, done, loading) {
            if (row.url.length > 0) {
                var urls = []
                var split = row.url.split(",")
                split.forEach(url => {
                    var names = url.split("jczz/")
                    urls.push(names[1])
                })
                row.url = urls.join(",")
            }
          });
        }
        // con
        done();
      },
      currentChange(currentPage) {
        this.page.currentPage = currentPage;
      },
      sizeChange(pageSize) {
        this.page.pageSize = pageSize;
      },
      refreshChange() {
        this.onLoad(this.page, this.query);
      },
      onLoad(page, params = {}) {
        const {dateTime} = this.query;
        let values = {
          ...params,
        };
        if (dateTime) {
          values = {
            ...params,
            startTime: dateTime[0],
            endTime: dateTime[1],
            ...this.query,
          };
          values.dateTime = null;
        }
        this.loading = true;
        getList(page.currentPage, page.pageSize, values).then((res) => {
          const data = res.data.data;
          this.page.total = data.total;
          this.data = data.records;
          this.data.forEach(item=>{
            if(item.url.length>0){
              var urls = []
              var names = item.url.split(",");
              names.forEach(name=>{
                urls.push(website.minioUrl + name)
              })
              item.url = urls.join(",")
            add(row).then(
                () => {
                    this.onLoad(this.page)
                    this.$message({
                        type: "success",
                        message: "操作成功!",
                    })
                    done()
                },
                (error) => {
                    window.console.log(error)
                    loading()
                }
            )
        },
        rowUpdate (row, index, done, loading) {
            if (row.url.length > 0) {
                var urls = []
                var split = row.url.split(",")
                split.forEach(url => {
                    var names = url.split("jczz/")
                    urls.push(names[1])
                })
                row.url = urls.join(",")
            }
          })
          this.loading = false;
          this.selectionClear();
        });
      }
            update(row).then(
                () => {
                    this.onLoad(this.page)
                    this.$message({
                        type: "success",
                        message: "操作成功!",
                    })
                    done()
                },
                (error) => {
                    window.console.log(error)
                    loading()
                }
            )
        },
        rowDel (row) {
            this.$confirm("确定将选择数据删除?", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                type: "warning",
            })
                .then(() => {
                    return remove(row.id)
                })
                .then(() => {
                    this.onLoad(this.page)
                    this.$message({
                        type: "success",
                        message: "操作成功!",
                    })
                })
        },
        searchReset () {
            this.query = {}
            this.onLoad(this.page)
        },
        searchChange (params, done) {
            this.query = params
            this.page.currentPage = 1
            this.onLoad(this.page, params)
            done()
        },
        selectionChange (list) {
            this.selectionList = list
        },
        selectionClear () {
            this.selectionList = []
            this.$refs.crud.toggleSelection()
        },
        handleDelete () {
            if (this.selectionList.length === 0) {
                this.$message.warning("请选择至少一条数据")
                return
            }
            this.$confirm("确定将选择数据删除?", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                type: "warning",
            })
                .then(() => {
                    return remove(this.ids)
                })
                .then(() => {
                    this.onLoad(this.page)
                    this.$message({
                        type: "success",
                        message: "操作成功!",
                    })
                    this.$refs.crud.toggleSelection()
                })
        },
        beforeOpen (done, type) {
            if (["edit", "view"].includes(type)) {
                getRotation(this.form.id).then((res) => {
                    this.form = res.data.data
                    if (this.form.url.length > 0) {
                        var urls = []
                        var names = this.form.url.split(",")
                        names.forEach(name => {
                            urls.push(website.minioUrl + name)
                        })
                        this.form.url = urls.join(",")
                    }
                })
            }
            // con
            done()
        },
        currentChange (currentPage) {
            this.page.currentPage = currentPage
        },
        sizeChange (pageSize) {
            this.page.pageSize = pageSize
        },
        refreshChange () {
            this.onLoad(this.page, this.query)
        },
        onLoad (page, params = {}) {
            const { dateTime } = this.query
            let values = {
                ...params,
            }
            if (dateTime) {
                values = {
                    ...params,
                    startTime: dateTime[0],
                    endTime: dateTime[1],
                    ...this.query,
                }
                values.dateTime = null
            }
            this.loading = true
            getList(page.currentPage, page.pageSize, values).then((res) => {
                const data = res.data.data
                this.page.total = data.total
                this.data = data.records
                this.data.forEach(item => {
                    if (item.url.length > 0) {
                        var urls = []
                        var names = item.url.split(",")
                        names.forEach(name => {
                            urls.push(website.minioUrl + name)
                        })
                        item.url = urls.join(",")
                    }
                })
                this.loading = false
                this.selectionClear()
            })
        }
    },
  };
}
</script>
<style>
  .avue-upload__icon {
.avue-upload__icon {
    line-height: 6;
  }
}
</style>
src/views/task/eCall/index.vue
@@ -1,540 +1,540 @@
<!-- e 呼即办 -->
<template>
  <basic-container>
    <avue-crud :option="option" :table-loading="loading" :data="data" :page.sync="page" ref="crud" @row-del="rowDel"
      v-model="form" :permission="permissionList" @row-update="rowUpdate" @row-save="rowSave" :before-open="beforeOpen"
      @search-change="searchChange" @search-reset="searchReset" @selection-change="selectionChange"
      @current-change="currentChange" @size-change="sizeChange" @refresh-change="refreshChange" @on-load="onLoad">
      <template slot="menuLeft">
        <el-button size="small" icon="el-icon-delete" plain v-if="permission.article_delete" @click="handleDelete">删 除
        </el-button>
      </template>
    </avue-crud>
  </basic-container>
    <basic-container>
        <avue-crud :option="option" :table-loading="loading" :data="data" :page.sync="page" ref="crud" @row-del="rowDel"
            v-model="form" :permission="permissionList" @row-update="rowUpdate" @row-save="rowSave"
            :before-open="beforeOpen" @search-change="searchChange" @search-reset="searchReset"
            @selection-change="selectionChange" @current-change="currentChange" @size-change="sizeChange"
            @refresh-change="refreshChange" @on-load="onLoad">
            <template slot="menuLeft">
                <el-button size="small" icon="el-icon-delete" plain v-if="permission.article_delete" @click="handleDelete">删
                    除
                </el-button>
            </template>
        </avue-crud>
    </basic-container>
</template>
<script>
import { getList, remove, update, add, getECallEvent } from "@/api/task/eCall";
import { getList, remove, update, add, getECallEvent } from "@/api/task/eCall"
import {
  getList as getHouseList,
  getDetatil as getHouseDetail
} from "@/api/doorplateAddress/doorplateAddress.js";
import { mapGetters } from "vuex";
import website from '@/config/website';
import AvueMap from "avue-plugin-map";
    getList as getHouseList,
    getDetatil as getHouseDetail
} from "@/api/doorplateAddress/doorplateAddress.js"
import { mapGetters } from "vuex"
import website from '@/config/website'
// import AvueMap from "avue-plugin-map"
export default {
  data() {
    return {
      form: {},
      query: {},
      loading: true,
      page: {
        pageSize: 10,
        currentPage: 1,
        total: 0,
      },
      datetime: "",
      selectionList: [],
      option: {
        height: "auto",
        calcHeight: 54,
        dialogWidth: 950,
        tip: false,
        searchShow: true,
        searchMenuSpan: 3,
        menuWidth: 220,
        border: true,
        //stripe:true,
        index: true,
        viewBtn: true,
        selection: true,
        // excelBtn: true,
        dialogClickModal: false,
        column: [
          {
            label: "事件名称",
            prop: "name",
            span: 12,
            searchSpan: 4,
            width: 100,
            search: true,
            rules: [
              {
                required: true,
                message: "请输入事件名称",
                trigger: "blur",
              },
            ],
          },
          {
            label: "事件类型",
            prop: "type",
            span: 12,
            searchSpan: 4,
            dataType: "number",
            type: "select",
            width: 100,
            dicUrl: "/api/blade-system/dict-biz/dictionary?code=eCallEventType",
            props: {
              label: "dictValue",
              value: "dictKey",
            },
            rules: [
              {
                required: true,
                message: "请选择事件类型",
                trigger: "blur",
              },
            ],
            // search: true,
          },
          {
            label: "所属社区",
            prop: "communityCode",
            // search: true,
            // searchSpan: 4,
            width: 150,
            type: "tree",
            dicUrl: "/api/blade-system/region/tree?parentCode=361102005",
            props: {
              label: "name",
              value: "id"
            },
            rules: [
              {
                required: true,
                message: "请选择所属社区",
                trigger: "blur",
              },
            ],
          },
          {
            label: "数据来源",
            prop: "source",
            span: 12,
            searchSpan: 4,
            width: 100,
            hide: true,
            // search: true,
          },
          {
            label: "姓名",
            prop: "realName",
            span: 12,
            searchSpan: 4,
            width: 100,
            search: true,
            rules: [
              {
                required: false,
                message: "请输入姓名",
                trigger: "blur",
              },
            ],
          },
          {
            label: "联系方式",
            prop: "phone",
            span: 12,
            width: 100,
            searchSpan: 4,
            search: true,
            rules: [
              {
                required: false,
                message: "请输入联系方式",
                trigger: "blur",
              },
            ],
          },
          {
            label: "事发地点",
            prop: "scene",
            overHidden: true,
            rules: [
              {
                required: true,
                message: "请输入事发地点",
                trigger: "blur",
              },
            ],
          },
          {
            label: "事发时间",
            prop: "occurrenceTime",
            width: 100,
            type: "date",
            format: "yyyy-MM-dd",
            valueFormat: "yyyy-MM-dd",
            rules: [
              {
                required: true,
                message: "请选择事发时间",
                trigger: "blur",
              },
            ],
          },
          {
            label: "事发位置",
            prop: "location",
            submitBtn:"提交",
            hide: true,
            type: 'map',
            dataType: "string",
            span: 24,
            value: [117.966460, 28.431002, ""]
          },
          {
            label: "标准地址",
            prop: "addressCode",
            hide: true,
            type: "table",
            span: 24,
            row: true,
            children: {
              border: true,
              height: 400,
              searchShow: true,
              searchMenuSpan: 6,
              submitText: "确定",
              column: [
                // {
                //   label: "小区",
                //   prop: "aoiName",
                //   search: true,
                //   searchSpan: 4,
                //   rules: [
                //     {
                //       required: true,
                //       message: "请选择小区",
                //       trigger: "blur",
                //     },
                //   ],
                // },
                {
                  label: "标准地址",
                  search: true,
                  searchSpan: 8,
                  prop: "addressName",
                  display: false
                },
              ],
            },
    data () {
        return {
            form: {},
            query: {},
            loading: true,
            page: {
              pageSize: 10,
              currentPage: 1,
              total: 0
                pageSize: 10,
                currentPage: 1,
                total: 0,
            },
            formatter: (row) => {
              return row.addressName
              // if (!row.districtName) return ''
              // return row.districtName + '-' + row.unit  + row.building  + row.room
            datetime: "",
            selectionList: [],
            option: {
                height: "auto",
                calcHeight: 54,
                dialogWidth: 950,
                tip: false,
                searchShow: true,
                searchMenuSpan: 3,
                menuWidth: 280,
                border: true,
                //stripe:true,
                index: true,
                viewBtn: true,
                selection: true,
                // excelBtn: true,
                dialogClickModal: false,
                column: [
                    {
                        label: "事件名称",
                        prop: "name",
                        span: 12,
                        searchSpan: 4,
                        width: 100,
                        search: true,
                        rules: [
                            {
                                required: true,
                                message: "请输入事件名称",
                                trigger: "blur",
                            },
                        ],
                    },
                    {
                        label: "事件类型",
                        prop: "type",
                        span: 12,
                        searchSpan: 4,
                        dataType: "number",
                        type: "select",
                        width: 100,
                        dicUrl: "/api/blade-system/dict-biz/dictionary?code=eCallEventType",
                        props: {
                            label: "dictValue",
                            value: "dictKey",
                        },
                        rules: [
                            {
                                required: true,
                                message: "请选择事件类型",
                                trigger: "blur",
                            },
                        ],
                        // search: true,
                    },
                    {
                        label: "所属社区",
                        prop: "communityCode",
                        search: true,
                        searchSpan: 4,
                        width: 150,
                        type: "tree",
                        dicUrl: "/api/blade-system/region/tree",
                        props: {
                            label: "name",
                            value: "id"
                        },
                        rules: [
                            {
                                required: true,
                                message: "请选择所属社区",
                                trigger: "blur",
                            },
                        ],
                    },
                    {
                        label: "数据来源",
                        prop: "source",
                        span: 12,
                        searchSpan: 4,
                        width: 100,
                        hide: true,
                        // search: true,
                    },
                    {
                        label: "姓名",
                        prop: "realName",
                        span: 12,
                        searchSpan: 4,
                        width: 100,
                        search: true,
                        rules: [
                            {
                                required: false,
                                message: "请输入姓名",
                                trigger: "blur",
                            },
                        ],
                    },
                    {
                        label: "联系方式",
                        prop: "phone",
                        span: 12,
                        width: 100,
                        searchSpan: 4,
                        search: true,
                        rules: [
                            {
                                required: false,
                                message: "请输入联系方式",
                                trigger: "blur",
                            },
                        ],
                    },
                    {
                        label: "事发地点",
                        prop: "scene",
                        overHidden: true,
                        rules: [
                            {
                                required: true,
                                message: "请输入事发地点",
                                trigger: "blur",
                            },
                        ],
                    },
                    {
                        label: "事发时间",
                        prop: "occurrenceTime",
                        width: 100,
                        type: "date",
                        format: "yyyy-MM-dd",
                        valueFormat: "yyyy-MM-dd",
                        rules: [
                            {
                                required: true,
                                message: "请选择事发时间",
                                trigger: "blur",
                            },
                        ],
                    },
                    {
                        label: "事发位置",
                        prop: "location",
                        submitBtn: "提交",
                        hide: true,
                        type: 'map',
                        dataType: "string",
                        span: 24,
                        value: [117.966460, 28.431002, ""]
                    },
                    {
                        label: "标准地址",
                        prop: "addressCode",
                        hide: true,
                        type: "table",
                        span: 24,
                        row: true,
                        children: {
                            border: true,
                            height: 400,
                            searchShow: true,
                            searchMenuSpan: 6,
                            submitText: "确定",
                            column: [
                                // {
                                //   label: "小区",
                                //   prop: "aoiName",
                                //   search: true,
                                //   searchSpan: 4,
                                //   rules: [
                                //     {
                                //       required: true,
                                //       message: "请选择小区",
                                //       trigger: "blur",
                                //     },
                                //   ],
                                // },
                                {
                                    label: "标准地址",
                                    search: true,
                                    searchSpan: 8,
                                    prop: "addressName",
                                    display: false
                                },
                            ],
                        },
                        page: {
                            pageSize: 10,
                            currentPage: 1,
                            total: 0
                        },
                        formatter: (row) => {
                            return row.addressName
                            // if (!row.districtName) return ''
                            // return row.districtName + '-' + row.unit  + row.building  + row.room
                        },
                        onLoad: ({ page, value, data }, callback) => {
                            //首次加载去查询对应的值
                            if (value) {
                                getHouseDetail({
                                    addressCode: value
                                }).then(res => {
                                    var resData = res.data.data
                                    // 查询对应行数据
                                    callback(resData)
                                    return
                                })
                            }
                            if (page) {
                                this.loading = true
                                var params = {
                                    ...data,
                                    townStreetCode: "361102005"
                                }
                                getHouseList(page.currentPage, page.pageSize, Object.assign(params)).then(res => {
                                    const resData = res.data.data
                                    var total = resData.total
                                    var data = resData.records
                                    this.loading = false
                                    this.selectionClear()
                                    //分页查询信息
                                    callback({
                                        total: total,
                                        data: data
                                    })
                                })
                            }
                        },
                        props: {
                            label: 'addressName',
                            value: 'addressCode'
                        }
                    },
                    {
                        label: "现场图片",
                        prop: "imageUrls",
                        width: 80,
                        type: "upload",
                        listType: "picture-card",
                        dataType: "string",
                        multiple: true,
                        row: true,
                        action: "/api/blade-resource/oss/endpoint/put-file-attach",
                        propsHttp: {
                            res: "data",
                            name: 'name',
                            url: "link",
                        },
                        span: 24,
                    },
                    {
                        label: "事件简述",
                        prop: "remark",
                        type: "textarea",
                        span: 24,
                    },
                    // {
                    //   label: "处置情况",
                    //   prop: "disSit",
                    //   type:"textarea",
                    //   hide:true,
                    //   span: 24,
                    // },
                    {
                        label: "处理结果",
                        prop: "disRes",
                        type: "textarea",
                        hide: true,
                        span: 24,
                    },
                    {
                        label: "回访情况",
                        prop: "retVis",
                        type: "textarea",
                        hide: true,
                        span: 24,
                    },
                    // {
                    //   label: "处置状态",
                    //   prop: "dis_status",
                    //   type:"select",
                    //   hide:true,
                    // }
                ],
            },
            onLoad: ({ page, value, data }, callback) => {
              //首次加载去查询对应的值
              if (value) {
                getHouseDetail({
                  addressCode: value
                }).then(res => {
                  var resData = res.data.data;
                  // 查询对应行数据
                  callback(resData)
                  return
                });
              }
              if (page) {
                this.loading = true;
                var params = {
                  ...data,
                  townStreetCode: "361102005"
            data: [],
        }
    },
    watch: {
        "form.location": {
            // form是表单或者表格绑定的数据集,v-model='form'
            handler (val) {
                if (typeof val == "string") {
                    console.log(val, 7777)
                    var arr = val.split(",")
                    console.log(val, 88888)
                    //经纬度替换
                    this.form.lat = arr[1]
                    this.form.lng = arr[0]
                    // this.form.location = arr[2];
                }
                getHouseList(page.currentPage, page.pageSize, Object.assign(params)).then(res => {
                  const resData = res.data.data;
                  var total = resData.total;
                  var data = resData.records;
                  this.loading = false;
                  this.selectionClear();
                  //分页查询信息
                  callback({
                    total: total,
                    data: data
                  })
                });
              }
            },
            props: {
              label: 'addressName',
              value: 'addressCode'
            immediate: true,
        },
    },
    computed: {
        ...mapGetters(["permission", "userInfo"]),
        permissionList () {
            return {
                addBtn: this.vaildData(this.permission.eCallEvent_add, true),
                viewBtn: this.vaildData(this.permission.eCallEvent_view, true),
                delBtn: this.vaildData(this.permission.eCallEvent_delete, true),
                editBtn: this.vaildData(this.permission.eCallEvent_edit, true),
            }
          },
          {
            label: "现场图片",
            prop: "imageUrls",
            width: 80,
            type: "upload",
            listType: "picture-card",
            dataType: "string",
            multiple: true,
            row: true,
            action: "/api/blade-resource/oss/endpoint/put-file-attach",
            propsHttp: {
              res: "data",
              name: 'name',
              url: "link",
            },
            span: 24,
          },
          {
            label: "事件简述",
            prop: "remark",
            type: "textarea",
            span: 24,
          },
          // {
          //   label: "处置情况",
          //   prop: "disSit",
          //   type:"textarea",
          //   hide:true,
          //   span: 24,
          // },
          {
            label: "处理结果",
            prop: "disRes",
            type: "textarea",
            hide: true,
            span: 24,
          },
          {
            label: "回访情况",
            prop: "retVis",
            type: "textarea",
            hide: true,
            span: 24,
          },
          // {
          //   label: "处置状态",
          //   prop: "dis_status",
          //   type:"select",
          //   hide:true,
          // }
        ],
      },
      data: [],
    };
  },
  watch: {
    "form.location": {
      // form是表单或者表格绑定的数据集,v-model='form'
      handler(val) {
        var that = this;
        if (typeof val == "string") {
          console.log(val,7777)
          var arr = val.split(",");
          console.log(val,88888)
          //经纬度替换
          this.form.lat = arr[1];
          this.form.lng = arr[0];
          // this.form.location = arr[2];
        }
      },
      immediate: true,
    },
  },
  computed: {
    ...mapGetters(["permission", "userInfo"]),
    permissionList() {
      return {
        addBtn: this.vaildData(this.permission.eCallEvent_add, true),
        viewBtn: this.vaildData(this.permission.eCallEvent_view, true),
        delBtn: this.vaildData(this.permission.eCallEvent_delete, true),
        editBtn: this.vaildData(this.permission.eCallEvent_edit, true),
      };
    },
    ids() {
      let ids = [];
      this.selectionList.forEach((ele) => {
        ids.push(ele.id);
      });
      return ids.join(",");
    },
  },
  methods: {
    rowSave(row, done, loading) {
      if (row.imageUrls.length > 0) {
        var urls = []
        var split = row.imageUrls.split(",");
        split.forEach(url => {
          var names = url.split("jczz/");
          urls.push(names[1])
        })
        row.imageUrls = urls.join(",")
      }
      add(row).then(
        () => {
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!",
          });
          done();
        },
        (error) => {
          window.console.log(error);
          loading();
        }
      );
    },
    rowUpdate(row, index, done, loading) {
      if (row.imageUrls.length > 0) {
        var urls = []
        var split = row.imageUrls.split(",");
        split.forEach(url => {
          var names = url.split("jczz/");
          urls.push(names[1])
        })
        row.imageUrls = urls.join(",")
      }
      update(row).then(
        () => {
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!",
          });
          done();
        },
        (error) => {
          window.console.log(error);
          loading();
        }
      );
    },
    rowDel(row) {
      this.$confirm("确定将选择数据删除?", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          return remove(row.id);
        })
        .then(() => {
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!",
          });
        });
    },
    searchReset() {
      this.query = {};
      this.onLoad(this.page);
    },
    searchChange(params, done) {
      this.query = params;
      this.page.currentPage = 1;
      this.onLoad(this.page, params);
      done();
    },
    selectionChange(list) {
      this.selectionList = list;
    },
    selectionClear() {
      this.selectionList = [];
      this.$refs.crud.toggleSelection();
    },
    handleDelete() {
      if (this.selectionList.length === 0) {
        this.$message.warning("请选择至少一条数据");
        return;
      }
      this.$confirm("确定将选择数据删除?", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          return remove(this.ids);
        })
        .then(() => {
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!",
          });
          this.$refs.crud.toggleSelection();
        });
    },
    beforeOpen(done, type) {
      if (["edit", "view"].includes(type)) {
        getECallEvent(this.form.id).then((res) => {
          this.form = res.data.data;
          if (this.form.imageUrls.length > 0) {
            var urls = []
            var names = this.form.imageUrls.split(",");
            names.forEach(name => {
              urls.push(website.minioUrl + name)
        ids () {
            let ids = []
            this.selectionList.forEach((ele) => {
                ids.push(ele.id)
            })
            this.form.imageUrls = urls.join(",")
          }
        });
      }
      // con
      done();
            return ids.join(",")
        },
    },
    currentChange(currentPage) {
      this.page.currentPage = currentPage;
    },
    sizeChange(pageSize) {
      this.page.pageSize = pageSize;
    },
    refreshChange() {
      this.onLoad(this.page, this.query);
    },
    onLoad(page, params = {}) {
      const { dateTime } = this.query;
      let values = {
        ...params,
      };
      if (dateTime) {
        values = {
          ...params,
          startTime: dateTime[0],
          endTime: dateTime[1],
          ...this.query,
        };
        values.dateTime = null;
      }
      this.loading = true;
      getList(page.currentPage, page.pageSize, values).then((res) => {
        const data = res.data.data;
        this.page.total = data.total;
        this.data = data.records;
        this.data.forEach(item => {
          if (item.imageUrls) {
            if (item.imageUrls.length > 0) {
              var urls = []
              var names = item.imageUrls.split(",");
              names.forEach(name => {
                urls.push(website.minioUrl + name)
              })
              item.imageUrls = urls.join(",")
    methods: {
        rowSave (row, done, loading) {
            if (row.imageUrls.length > 0) {
                var urls = []
                var split = row.imageUrls.split(",")
                split.forEach(url => {
                    var names = url.split("jczz/")
                    urls.push(names[1])
                })
                row.imageUrls = urls.join(",")
            }
          }
        })
        this.loading = false;
        this.selectionClear();
      });
    }
  },
};
            add(row).then(
                () => {
                    this.onLoad(this.page)
                    this.$message({
                        type: "success",
                        message: "操作成功!",
                    })
                    done()
                },
                (error) => {
                    window.console.log(error)
                    loading()
                }
            )
        },
        rowUpdate (row, index, done, loading) {
            if (row.imageUrls.length > 0) {
                var urls = []
                var split = row.imageUrls.split(",")
                split.forEach(url => {
                    var names = url.split("jczz/")
                    urls.push(names[1])
                })
                row.imageUrls = urls.join(",")
            }
            update(row).then(
                () => {
                    this.onLoad(this.page)
                    this.$message({
                        type: "success",
                        message: "操作成功!",
                    })
                    done()
                },
                (error) => {
                    window.console.log(error)
                    loading()
                }
            )
        },
        rowDel (row) {
            this.$confirm("确定将选择数据删除?", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                type: "warning",
            })
                .then(() => {
                    return remove(row.id)
                })
                .then(() => {
                    this.onLoad(this.page)
                    this.$message({
                        type: "success",
                        message: "操作成功!",
                    })
                })
        },
        searchReset () {
            this.query = {}
            this.onLoad(this.page)
        },
        searchChange (params, done) {
            this.query = params
            this.page.currentPage = 1
            this.onLoad(this.page, params)
            done()
        },
        selectionChange (list) {
            this.selectionList = list
        },
        selectionClear () {
            this.selectionList = []
            this.$refs.crud.toggleSelection()
        },
        handleDelete () {
            if (this.selectionList.length === 0) {
                this.$message.warning("请选择至少一条数据")
                return
            }
            this.$confirm("确定将选择数据删除?", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                type: "warning",
            })
                .then(() => {
                    return remove(this.ids)
                })
                .then(() => {
                    this.onLoad(this.page)
                    this.$message({
                        type: "success",
                        message: "操作成功!",
                    })
                    this.$refs.crud.toggleSelection()
                })
        },
        beforeOpen (done, type) {
            if (["edit", "view"].includes(type)) {
                getECallEvent(this.form.id).then((res) => {
                    this.form = res.data.data
                    if (this.form.imageUrls.length > 0) {
                        var urls = []
                        var names = this.form.imageUrls.split(",")
                        names.forEach(name => {
                            urls.push(website.minioUrl + name)
                        })
                        this.form.imageUrls = urls.join(",")
                    }
                })
            }
            // con
            done()
        },
        currentChange (currentPage) {
            this.page.currentPage = currentPage
        },
        sizeChange (pageSize) {
            this.page.pageSize = pageSize
        },
        refreshChange () {
            this.onLoad(this.page, this.query)
        },
        onLoad (page, params = {}) {
            const { dateTime } = this.query
            let values = {
                ...params,
            }
            if (dateTime) {
                values = {
                    ...params,
                    startTime: dateTime[0],
                    endTime: dateTime[1],
                    ...this.query,
                }
                values.dateTime = null
            }
            this.loading = true
            getList(page.currentPage, page.pageSize, values).then((res) => {
                const data = res.data.data
                this.page.total = data.total
                this.data = data.records
                this.data.forEach(item => {
                    if (item.imageUrls) {
                        if (item.imageUrls.length > 0) {
                            var urls = []
                            var names = item.imageUrls.split(",")
                            names.forEach(name => {
                                urls.push(website.minioUrl + name)
                            })
                            item.imageUrls = urls.join(",")
                        }
                    }
                })
                this.loading = false
                this.selectionClear()
            })
        }
    },
}
</script>
<style>
.avue-upload__icon {
  line-height: 6;
    line-height: 6;
}
</style>
src/views/task/index.vue
@@ -1,385 +1,387 @@
<!-- 工作日志 -->
<!-- 走访日志 -->
<template>
  <basic-container>
    <avue-crud :option="option" :table-loading="loading" :data="data" :page.sync="page" ref="crud" @row-del="rowDel"
      v-model="form" :permission="permissionList" @row-update="rowUpdate" @row-save="rowSave" :before-open="beforeOpen"
      @search-change="searchChange" @search-reset="searchReset" @selection-change="selectionChange"
      @current-change="currentChange" @size-change="sizeChange" @refresh-change="refreshChange" @on-load="onLoad">
      <template slot="menuLeft">
        <el-button size="small" icon="el-icon-delete" plain v-if="permission.article_delete" @click="handleDelete">删 除
        </el-button>
      </template>
      <!-- <template slot-scope="scope" slot="menu">
    <basic-container>
        <avue-crud :option="option" :table-loading="loading" :data="data" :page.sync="page" ref="crud" @row-del="rowDel"
            v-model="form" :permission="permissionList" @row-update="rowUpdate" @row-save="rowSave"
            :before-open="beforeOpen" @search-change="searchChange" @search-reset="searchReset"
            @selection-change="selectionChange" @current-change="currentChange" @size-change="sizeChange"
            @refresh-change="refreshChange" @on-load="onLoad">
            <template slot="menuLeft">
                <el-button size="small" icon="el-icon-delete" plain v-if="permission.article_delete" @click="handleDelete">删
                    除
                </el-button>
            </template>
            <!-- <template slot-scope="scope" slot="menu">
        <el-button type="text" icon="el-icon-circle-plus-outline" size="small"
          @click="taskApply(scope.row)">任务分发
        </el-button>
      </template> -->
    </avue-crud>
    <!-- <el-dialog title="任务分发" append-to-body :visible.sync="taskVisible" width="70%" height="60%">
        </avue-crud>
        <!-- <el-dialog title="任务分发" append-to-body :visible.sync="taskVisible" width="70%" height="60%">
      <avue-form :option="taskOption"
             v-model="taskForm"> </avue-form>
        </el-dialog> -->
  </basic-container>
    </basic-container>
</template>
<script>
import { getList, remove, update, add, getReportForRepairs } from "@/api/task/reportForRepairs";
import { mapGetters } from "vuex";
import website from '@/config/website';
import { getList, remove, update, add, getReportForRepairs } from "@/api/task/reportForRepairs"
import { mapGetters } from "vuex"
import website from '@/config/website'
export default {
  data() {
    return {
      taskForm:{},
      taskOption:{
        column: [
          {
            label: '姓名',
            prop: 'name',
            value: 'small'
          }
        ]
      },
      taskVisible:false,
      form: {},
      query: {},
      loading: true,
      page: {
        pageSize: 10,
        currentPage: 1,
        total: 0,
      },
      datetime: "",
      selectionList: [],
      option: {
        height: "auto",
        calcHeight: 54,
        dialogWidth: 950,
        tip: false,
        searchShow: true,
        searchMenuSpan: 3,
        menuWidth: 280,
        border: true,
        //stripe:true,
        index: true,
        editBtnText:"任务分发",
        editTitle:"任务分发",
        updateBtnText:"确定",
        viewBtn: true,
        selection: true,
        // excelBtn: true,
        dialogClickModal: false,
        column: [
          {
            label: "类型",
            prop: "type",
            span: 12,
            searchSpan: 4,
            dataType: "number",
            type: "select",
            width: 100,
            editDisabled:true,
            dicUrl: "/api/blade-system/dict-biz/dictionary?code=reportForRepairsType",
            props: {
              label: "dictValue",
              value: "dictKey",
    data () {
        return {
            taskForm: {},
            taskOption: {
                column: [
                    {
                        label: '姓名',
                        prop: 'name',
                        value: 'small'
                    }
                ]
            },
            search: true,
            span:15,
            row:true,
            labelWidth:110,
          },
          {
            label: "姓名",
            prop: "realName",
            span: 12,
            searchSpan: 4,
            width: 100,
            search: true,
            editDisabled:true,
            labelWidth:110,
          },
          {
            label: "手机号",
            prop: "phone",
            span: 12,
            width: 100,
            searchSpan: 4,
            search: true,
            editDisabled:true,
            labelWidth:110,
          },
          {
            label: "图片",
            prop: "imageUrls",
            width: 80,
            type: "upload",
            listType: "picture-card",
            dataType: "string",
            multiple: true,
            action: "/api/blade-resource/oss/endpoint/put-file",
            propsHttp: {
              res: "data",
              name: 'name',
              url: "link",
            taskVisible: false,
            form: {},
            query: {},
            loading: true,
            page: {
                pageSize: 10,
                currentPage: 1,
                total: 0,
            },
            span: 24,
            editDisabled:true,
            labelWidth:110,
          },
          {
            label: "上报事发地址",
            prop: "address",
            overHidden: true,
            editDisabled:true,
            labelWidth:110,
            span:24
          },
          // {
          //   label: "地点",
          //   prop: "addressName",
          //   overHidden:true
          // },
          {
            label: "上报时间",
            prop: "createTime",
            width: 160,
            addDisplay: false,
            editDisplay: false,
            type: "date",
            format: "yyyy-MM-dd HH:mm:ss",
            valueFormat: "yyyy-MM-dd HH:mm:ss",
            editDisabled:true,
            labelWidth:110,
          },
          {
            label: "描述",
            prop: "remark",
            type: "textarea",
            span: 24,
            editDisabled:true,
            labelWidth:110,
          },
          {
            label: "接收员",
            prop: "userIds",
            type: "tree",
            hide:true,
            labelWidth:110,
            dicUrl:"/api/blade-gridman/gridman/getGridmanList",
            props: {
              label: "gridmanName",
              value: "id",
            datetime: "",
            selectionList: [],
            option: {
                height: "auto",
                calcHeight: 54,
                dialogWidth: 950,
                tip: false,
                searchShow: true,
                searchMenuSpan: 3,
                menuWidth: 280,
                border: true,
                //stripe:true,
                index: true,
                editBtnText: "任务分发",
                editTitle: "任务分发",
                updateBtnText: "确定",
                viewBtn: true,
                selection: true,
                // excelBtn: true,
                dialogClickModal: false,
                column: [
                    {
                        label: "类型",
                        prop: "type",
                        span: 12,
                        searchSpan: 4,
                        dataType: "number",
                        type: "select",
                        width: 100,
                        editDisabled: true,
                        dicUrl: "/api/blade-system/dict-biz/dictionary?code=reportForRepairsType",
                        props: {
                            label: "dictValue",
                            value: "dictKey",
                        },
                        search: true,
                        span: 15,
                        row: true,
                        labelWidth: 110,
                    },
                    {
                        label: "姓名",
                        prop: "realName",
                        span: 12,
                        searchSpan: 4,
                        width: 100,
                        search: true,
                        editDisabled: true,
                        labelWidth: 110,
                    },
                    {
                        label: "手机号",
                        prop: "phone",
                        span: 12,
                        width: 100,
                        searchSpan: 4,
                        search: true,
                        editDisabled: true,
                        labelWidth: 110,
                    },
                    {
                        label: "图片",
                        prop: "imageUrls",
                        width: 80,
                        type: "upload",
                        listType: "picture-card",
                        dataType: "string",
                        multiple: true,
                        action: "/api/blade-resource/oss/endpoint/put-file",
                        propsHttp: {
                            res: "data",
                            name: 'name',
                            url: "link",
                        },
                        span: 24,
                        editDisabled: true,
                        labelWidth: 110,
                    },
                    {
                        label: "上报事发地址",
                        prop: "address",
                        overHidden: true,
                        editDisabled: true,
                        labelWidth: 110,
                        span: 24
                    },
                    // {
                    //   label: "地点",
                    //   prop: "addressName",
                    //   overHidden:true
                    // },
                    {
                        label: "上报时间",
                        prop: "createTime",
                        width: 160,
                        addDisplay: false,
                        editDisplay: false,
                        type: "date",
                        format: "yyyy-MM-dd HH:mm:ss",
                        valueFormat: "yyyy-MM-dd HH:mm:ss",
                        editDisabled: true,
                        labelWidth: 110,
                    },
                    {
                        label: "描述",
                        prop: "remark",
                        type: "textarea",
                        span: 24,
                        editDisabled: true,
                        labelWidth: 110,
                    },
                    {
                        label: "接收员",
                        prop: "userIds",
                        type: "tree",
                        hide: true,
                        labelWidth: 110,
                        dicUrl: "/api/blade-gridman/gridman/getGridmanList",
                        props: {
                            label: "gridmanName",
                            value: "id",
                        },
                    }
                ],
            },
          }
        ],
      },
      data: [],
    };
  },
  watch: {
  },
  computed: {
    ...mapGetters(["permission", "userInfo"]),
    permissionList() {
      return {
        addBtn: this.vaildData(this.permission.reportForRepairs_add, false),
        viewBtn: this.vaildData(this.permission.reportForRepairs_view, true),
        delBtn: this.vaildData(this.permission.reportForRepairs_delete, false),
        editBtn: this.vaildData(this.permission.reportForRepairs_edit, true),
      };
    },
    ids() {
      let ids = [];
      this.selectionList.forEach((ele) => {
        ids.push(ele.id);
      });
      return ids.join(",");
    },
  },
  methods: {
    // 任务派发
    taskApply(row){
      var that = this
      this.taskVisible = true
      this.$nextTick(() => {
        })
    },
    rowSave(row, done, loading) {
      if (row.imageUrls.length > 0) {
        var urls = []
        var split = row.imageUrls.split(",");
        split.forEach(url => {
          var names = url.split("jczz/");
          urls.push(names[1])
        })
        row.imageUrls = urls.join(",")
      }
      add(row).then(
        () => {
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!",
          });
          done();
        },
        (error) => {
          window.console.log(error);
          loading();
            data: [],
        }
      );
    },
    rowUpdate(row, index, done, loading) {
      if (row.imageUrls.length > 0) {
        var urls = []
        var split = row.imageUrls.split(",");
        split.forEach(url => {
          var names = url.split("jczz/");
          urls.push(names[1])
        })
        row.imageUrls = urls.join(",")
      }
      update(row).then(
        () => {
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!",
          });
          done();
    watch: {
    },
    computed: {
        ...mapGetters(["permission", "userInfo"]),
        permissionList () {
            return {
                addBtn: this.vaildData(this.permission.reportForRepairs_add, false),
                viewBtn: this.vaildData(this.permission.reportForRepairs_view, true),
                delBtn: this.vaildData(this.permission.reportForRepairs_delete, false),
                editBtn: this.vaildData(this.permission.reportForRepairs_edit, true),
            }
        },
        (error) => {
          window.console.log(error);
          loading();
        ids () {
            let ids = []
            this.selectionList.forEach((ele) => {
                ids.push(ele.id)
            })
            return ids.join(",")
        },
    },
    methods: {
        // 任务派发
        taskApply (row) {
            var that = this
            this.taskVisible = true
            this.$nextTick(() => {
            })
        },
        rowSave (row, done, loading) {
            if (row.imageUrls.length > 0) {
                var urls = []
                var split = row.imageUrls.split(",")
                split.forEach(url => {
                    var names = url.split("jczz/")
                    urls.push(names[1])
                })
                row.imageUrls = urls.join(",")
            }
            add(row).then(
                () => {
                    this.onLoad(this.page)
                    this.$message({
                        type: "success",
                        message: "操作成功!",
                    })
                    done()
                },
                (error) => {
                    window.console.log(error)
                    loading()
                }
            )
        },
        rowUpdate (row, index, done, loading) {
            if (row.imageUrls.length > 0) {
                var urls = []
                var split = row.imageUrls.split(",")
                split.forEach(url => {
                    var names = url.split("jczz/")
                    urls.push(names[1])
                })
                row.imageUrls = urls.join(",")
            }
            update(row).then(
                () => {
                    this.onLoad(this.page)
                    this.$message({
                        type: "success",
                        message: "操作成功!",
                    })
                    done()
                },
                (error) => {
                    window.console.log(error)
                    loading()
                }
            )
        },
        rowDel (row) {
            this.$confirm("确定将选择数据删除?", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                type: "warning",
            })
                .then(() => {
                    return remove(row.id)
                })
                .then(() => {
                    this.onLoad(this.page)
                    this.$message({
                        type: "success",
                        message: "操作成功!",
                    })
                })
        },
        searchReset () {
            this.query = {}
            this.onLoad(this.page)
        },
        searchChange (params, done) {
            this.query = params
            this.page.currentPage = 1
            this.onLoad(this.page, params)
            done()
        },
        selectionChange (list) {
            this.selectionList = list
        },
        selectionClear () {
            this.selectionList = []
            this.$refs.crud.toggleSelection()
        },
        handleDelete () {
            if (this.selectionList.length === 0) {
                this.$message.warning("请选择至少一条数据")
                return
            }
            this.$confirm("确定将选择数据删除?", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                type: "warning",
            })
                .then(() => {
                    return remove(this.ids)
                })
                .then(() => {
                    this.onLoad(this.page)
                    this.$message({
                        type: "success",
                        message: "操作成功!",
                    })
                    this.$refs.crud.toggleSelection()
                })
        },
        beforeOpen (done, type) {
            if (["edit", "view"].includes(type)) {
                getReportForRepairs(this.form.id).then((res) => {
                    this.form = res.data.data
                    if (this.form.imageUrls) {
                        if (this.form.imageUrls.length > 0) {
                            var urls = []
                            var names = this.form.imageUrls.split(",")
                            names.forEach(name => {
                                urls.push(website.minioUrl + name)
                            })
                            this.form.imageUrls = urls.join(",")
                        }
                    }
                })
            }
            // con
            done()
        },
        currentChange (currentPage) {
            this.page.currentPage = currentPage
        },
        sizeChange (pageSize) {
            this.page.pageSize = pageSize
        },
        refreshChange () {
            this.onLoad(this.page, this.query)
        },
        onLoad (page, params = {}) {
            const { dateTime } = this.query
            let values = {
                ...params,
            }
            if (dateTime) {
                values = {
                    ...params,
                    startTime: dateTime[0],
                    endTime: dateTime[1],
                    ...this.query,
                }
                values.dateTime = null
            }
            this.loading = true
            getList(page.currentPage, page.pageSize, values).then((res) => {
                const data = res.data.data
                this.page.total = data.total
                this.data = data.records
                this.data.forEach(item => {
                    if (item.imageUrls) {
                        if (item.imageUrls.length > 0) {
                            var urls = []
                            var names = item.imageUrls.split(",")
                            names.forEach(name => {
                                urls.push(website.minioUrl + name)
                            })
                            item.imageUrls = urls.join(",")
                        }
                    }
                })
                this.loading = false
                this.selectionClear()
            })
        }
      );
    },
    rowDel(row) {
      this.$confirm("确定将选择数据删除?", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          return remove(row.id);
        })
        .then(() => {
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!",
          });
        });
    },
    searchReset() {
      this.query = {};
      this.onLoad(this.page);
    },
    searchChange(params, done) {
      this.query = params;
      this.page.currentPage = 1;
      this.onLoad(this.page, params);
      done();
    },
    selectionChange(list) {
      this.selectionList = list;
    },
    selectionClear() {
      this.selectionList = [];
      this.$refs.crud.toggleSelection();
    },
    handleDelete() {
      if (this.selectionList.length === 0) {
        this.$message.warning("请选择至少一条数据");
        return;
      }
      this.$confirm("确定将选择数据删除?", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          return remove(this.ids);
        })
        .then(() => {
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!",
          });
          this.$refs.crud.toggleSelection();
        });
    },
    beforeOpen(done, type) {
      if (["edit", "view"].includes(type)) {
        getReportForRepairs(this.form.id).then((res) => {
          this.form = res.data.data;
          if (this.form.imageUrls) {
            if (this.form.imageUrls.length > 0) {
              var urls = []
              var names = this.form.imageUrls.split(",");
              names.forEach(name => {
                urls.push(website.minioUrl + name)
              })
              this.form.imageUrls = urls.join(",")
            }
          }
        });
      }
      // con
      done();
    },
    currentChange(currentPage) {
      this.page.currentPage = currentPage;
    },
    sizeChange(pageSize) {
      this.page.pageSize = pageSize;
    },
    refreshChange() {
      this.onLoad(this.page, this.query);
    },
    onLoad(page, params = {}) {
      const { dateTime } = this.query;
      let values = {
        ...params,
      };
      if (dateTime) {
        values = {
          ...params,
          startTime: dateTime[0],
          endTime: dateTime[1],
          ...this.query,
        };
        values.dateTime = null;
      }
      this.loading = true;
      getList(page.currentPage, page.pageSize, values).then((res) => {
        const data = res.data.data;
        this.page.total = data.total;
        this.data = data.records;
        this.data.forEach(item => {
          if (item.imageUrls) {
            if (item.imageUrls.length > 0) {
              var urls = []
              var names = item.imageUrls.split(",");
              names.forEach(name => {
                urls.push(website.minioUrl + name)
              })
              item.imageUrls = urls.join(",")
            }
          }
        })
        this.loading = false;
        this.selectionClear();
      });
    }
  },
};
}
</script>
<style>
.avue-upload__icon {
  line-height: 6;
    line-height: 6;
}
</style>
src/views/task/reportForRepairs.vue
@@ -1,322 +1,324 @@
<!-- 工作日志 -->
<!-- 走访日志 -->
<template>
  <basic-container>
    <avue-crud :option="option" :table-loading="loading" :data="data" :page.sync="page" ref="crud" @row-del="rowDel"
      v-model="form" :permission="permissionList" @row-update="rowUpdate" @row-save="rowSave" :before-open="beforeOpen"
      @search-change="searchChange" @search-reset="searchReset" @selection-change="selectionChange"
      @current-change="currentChange" @size-change="sizeChange" @refresh-change="refreshChange" @on-load="onLoad">
      <template slot="menuLeft">
        <el-button size="small" icon="el-icon-delete" plain v-if="permission.article_delete" @click="handleDelete">删 除
        </el-button>
      </template>
    </avue-crud>
  </basic-container>
    <basic-container>
        <avue-crud :option="option" :table-loading="loading" :data="data" :page.sync="page" ref="crud" @row-del="rowDel"
            v-model="form" :permission="permissionList" @row-update="rowUpdate" @row-save="rowSave"
            :before-open="beforeOpen" @search-change="searchChange" @search-reset="searchReset"
            @selection-change="selectionChange" @current-change="currentChange" @size-change="sizeChange"
            @refresh-change="refreshChange" @on-load="onLoad">
            <template slot="menuLeft">
                <el-button size="small" icon="el-icon-delete" plain v-if="permission.article_delete" @click="handleDelete">删
                    除
                </el-button>
            </template>
        </avue-crud>
    </basic-container>
</template>
<script>
import { getList, remove, update, add, getReportForRepairs } from "@/api/task/reportForRepairs";
import { mapGetters } from "vuex";
import website from '@/config/website';
import { getList, remove, update, add, getReportForRepairs } from "@/api/task/reportForRepairs"
import { mapGetters } from "vuex"
import website from '@/config/website'
export default {
  data() {
    return {
      form: {},
      query: {},
      loading: true,
      page: {
        pageSize: 10,
        currentPage: 1,
        total: 0,
      },
      datetime: "",
      selectionList: [],
      option: {
        height: "auto",
        calcHeight: 54,
        dialogWidth: 950,
        tip: false,
        searchShow: true,
        searchMenuSpan: 3,
        menuWidth: 350,
        border: true,
        //stripe:true,
        index: true,
        viewBtn: true,
        selection: true,
        // excelBtn: true,
        dialogClickModal: false,
        column: [
          {
            label: "类型",
            prop: "type",
            span: 12,
            searchSpan: 4,
            dataType: "number",
            type:"select",
            width:100,
            dicUrl: "/api/blade-system/dict-biz/dictionary?code=reportForRepairsType",
            props: {
              label: "dictValue",
              value: "dictKey",
    data () {
        return {
            form: {},
            query: {},
            loading: true,
            page: {
                pageSize: 10,
                currentPage: 1,
                total: 0,
            },
            search: true,
          },
          {
            label: "姓名",
            prop: "realName",
            span: 12,
            searchSpan: 4,
            width:100,
            search: true,
          },
          {
            label: "手机号",
            prop: "phone",
            span: 12,
            width:100,
            searchSpan: 4,
            search: true,
          },
          {
            label: "图片",
            prop: "imageUrls",
            width:80,
            type: "upload",
            listType: "picture-card",
            dataType:"string",
            multiple: true,
            action: "/api/blade-resource/oss/endpoint/put-file",
            propsHttp: {
              res: "data",
              name: 'name',
              url: "link",
            datetime: "",
            selectionList: [],
            option: {
                height: "auto",
                calcHeight: 54,
                dialogWidth: 950,
                tip: false,
                searchShow: true,
                searchMenuSpan: 3,
                menuWidth: 350,
                border: true,
                //stripe:true,
                index: true,
                viewBtn: true,
                selection: true,
                // excelBtn: true,
                dialogClickModal: false,
                column: [
                    {
                        label: "类型",
                        prop: "type",
                        span: 12,
                        searchSpan: 4,
                        dataType: "number",
                        type: "select",
                        width: 100,
                        dicUrl: "/api/blade-system/dict-biz/dictionary?code=reportForRepairsType",
                        props: {
                            label: "dictValue",
                            value: "dictKey",
                        },
                        search: true,
                    },
                    {
                        label: "姓名",
                        prop: "realName",
                        span: 12,
                        searchSpan: 4,
                        width: 100,
                        search: true,
                    },
                    {
                        label: "手机号",
                        prop: "phone",
                        span: 12,
                        width: 100,
                        searchSpan: 4,
                        search: true,
                    },
                    {
                        label: "图片",
                        prop: "imageUrls",
                        width: 80,
                        type: "upload",
                        listType: "picture-card",
                        dataType: "string",
                        multiple: true,
                        action: "/api/blade-resource/oss/endpoint/put-file",
                        propsHttp: {
                            res: "data",
                            name: 'name',
                            url: "link",
                        },
                        span: 24,
                    },
                    {
                        label: "地点",
                        prop: "addressName",
                        overHidden: true
                    },
                    {
                        label: "上报时间",
                        prop: "createTime",
                        width: 160,
                        addDisplay: false,
                        editDisplay: false,
                        type: "date",
                        format: "yyyy-MM-dd HH:mm:ss",
                        valueFormat: "yyyy-MM-dd HH:mm:ss",
                    },
                    {
                        label: "备注",
                        prop: "remark",
                        type: "textarea",
                        hide: true,
                        span: 24,
                    }
                ],
            },
            span: 24,
          },
          {
            label: "地点",
            prop: "addressName",
            overHidden:true
          },
          {
            label: "上报时间",
            prop: "createTime",
            width: 160,
            addDisplay: false,
            editDisplay: false,
            type: "date",
            format: "yyyy-MM-dd HH:mm:ss",
            valueFormat: "yyyy-MM-dd HH:mm:ss",
          },
          {
            label: "备注",
            prop: "remark",
            type:"textarea",
            hide:true,
            span: 24,
          }
        ],
      },
      data: [],
    };
  },
  watch: {
  },
  computed: {
    ...mapGetters(["permission", "userInfo"]),
    permissionList() {
      return {
        addBtn: this.vaildData(this.permission.reportForRepairs_add, true),
        viewBtn: this.vaildData(this.permission.reportForRepairs_view, true),
        delBtn: this.vaildData(this.permission.reportForRepairs_delete, true),
        editBtn: this.vaildData(this.permission.reportForRepairs_edit, true),
      };
    },
    ids() {
      let ids = [];
      this.selectionList.forEach((ele) => {
        ids.push(ele.id);
      });
      return ids.join(",");
    },
  },
  methods: {
    rowSave(row, done, loading) {
      if (row.imageUrls.length > 0) {
        var urls = []
        var split = row.imageUrls.split(",");
        split.forEach(url => {
          var names = url.split("jczz/");
          urls.push(names[1])
        })
        row.imageUrls = urls.join(",")
      }
      add(row).then(
        () => {
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!",
          });
          done();
        },
        (error) => {
          window.console.log(error);
          loading();
            data: [],
        }
      );
    },
    rowUpdate(row, index, done, loading) {
      if (row.imageUrls.length > 0) {
        var urls = []
        var split = row.imageUrls.split(",");
        split.forEach(url => {
          var names = url.split("jczz/");
          urls.push(names[1])
        })
        row.imageUrls = urls.join(",")
      }
      update(row).then(
        () => {
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!",
          });
          done();
    watch: {
    },
    computed: {
        ...mapGetters(["permission", "userInfo"]),
        permissionList () {
            return {
                addBtn: this.vaildData(this.permission.reportForRepairs_add, true),
                viewBtn: this.vaildData(this.permission.reportForRepairs_view, true),
                delBtn: this.vaildData(this.permission.reportForRepairs_delete, true),
                editBtn: this.vaildData(this.permission.reportForRepairs_edit, true),
            }
        },
        (error) => {
          window.console.log(error);
          loading();
        ids () {
            let ids = []
            this.selectionList.forEach((ele) => {
                ids.push(ele.id)
            })
            return ids.join(",")
        },
    },
    methods: {
        rowSave (row, done, loading) {
            if (row.imageUrls.length > 0) {
                var urls = []
                var split = row.imageUrls.split(",")
                split.forEach(url => {
                    var names = url.split("jczz/")
                    urls.push(names[1])
                })
                row.imageUrls = urls.join(",")
            }
            add(row).then(
                () => {
                    this.onLoad(this.page)
                    this.$message({
                        type: "success",
                        message: "操作成功!",
                    })
                    done()
                },
                (error) => {
                    window.console.log(error)
                    loading()
                }
            )
        },
        rowUpdate (row, index, done, loading) {
            if (row.imageUrls.length > 0) {
                var urls = []
                var split = row.imageUrls.split(",")
                split.forEach(url => {
                    var names = url.split("jczz/")
                    urls.push(names[1])
                })
                row.imageUrls = urls.join(",")
            }
            update(row).then(
                () => {
                    this.onLoad(this.page)
                    this.$message({
                        type: "success",
                        message: "操作成功!",
                    })
                    done()
                },
                (error) => {
                    window.console.log(error)
                    loading()
                }
            )
        },
        rowDel (row) {
            this.$confirm("确定将选择数据删除?", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                type: "warning",
            })
                .then(() => {
                    return remove(row.id)
                })
                .then(() => {
                    this.onLoad(this.page)
                    this.$message({
                        type: "success",
                        message: "操作成功!",
                    })
                })
        },
        searchReset () {
            this.query = {}
            this.onLoad(this.page)
        },
        searchChange (params, done) {
            this.query = params
            this.page.currentPage = 1
            this.onLoad(this.page, params)
            done()
        },
        selectionChange (list) {
            this.selectionList = list
        },
        selectionClear () {
            this.selectionList = []
            this.$refs.crud.toggleSelection()
        },
        handleDelete () {
            if (this.selectionList.length === 0) {
                this.$message.warning("请选择至少一条数据")
                return
            }
            this.$confirm("确定将选择数据删除?", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                type: "warning",
            })
                .then(() => {
                    return remove(this.ids)
                })
                .then(() => {
                    this.onLoad(this.page)
                    this.$message({
                        type: "success",
                        message: "操作成功!",
                    })
                    this.$refs.crud.toggleSelection()
                })
        },
        beforeOpen (done, type) {
            if (["edit", "view"].includes(type)) {
                getReportForRepairs(this.form.id).then((res) => {
                    this.form = res.data.data
                    if (this.form.imageUrls) {
                        if (this.form.imageUrls.length > 0) {
                            var urls = []
                            var names = this.form.imageUrls.split(",")
                            names.forEach(name => {
                                urls.push(website.minioUrl + name)
                            })
                            this.form.imageUrls = urls.join(",")
                        }
                    }
                })
            }
            // con
            done()
        },
        currentChange (currentPage) {
            this.page.currentPage = currentPage
        },
        sizeChange (pageSize) {
            this.page.pageSize = pageSize
        },
        refreshChange () {
            this.onLoad(this.page, this.query)
        },
        onLoad (page, params = {}) {
            const { dateTime } = this.query
            let values = {
                ...params,
            }
            if (dateTime) {
                values = {
                    ...params,
                    startTime: dateTime[0],
                    endTime: dateTime[1],
                    ...this.query,
                }
                values.dateTime = null
            }
            this.loading = true
            getList(page.currentPage, page.pageSize, values).then((res) => {
                const data = res.data.data
                this.page.total = data.total
                this.data = data.records
                this.data.forEach(item => {
                    if (item.imageUrls) {
                        if (item.imageUrls.length > 0) {
                            var urls = []
                            var names = item.imageUrls.split(",")
                            names.forEach(name => {
                                urls.push(website.minioUrl + name)
                            })
                            item.imageUrls = urls.join(",")
                        }
                    }
                })
                this.loading = false
                this.selectionClear()
            })
        }
      );
    },
    rowDel(row) {
      this.$confirm("确定将选择数据删除?", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          return remove(row.id);
        })
        .then(() => {
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!",
          });
        });
    },
    searchReset() {
      this.query = {};
      this.onLoad(this.page);
    },
    searchChange(params, done) {
      this.query = params;
      this.page.currentPage = 1;
      this.onLoad(this.page, params);
      done();
    },
    selectionChange(list) {
      this.selectionList = list;
    },
    selectionClear() {
      this.selectionList = [];
      this.$refs.crud.toggleSelection();
    },
    handleDelete() {
      if (this.selectionList.length === 0) {
        this.$message.warning("请选择至少一条数据");
        return;
      }
      this.$confirm("确定将选择数据删除?", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          return remove(this.ids);
        })
        .then(() => {
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!",
          });
          this.$refs.crud.toggleSelection();
        });
    },
    beforeOpen(done, type) {
      if (["edit", "view"].includes(type)) {
        getReportForRepairs(this.form.id).then((res) => {
          this.form = res.data.data;
          if (this.form.imageUrls) {
            if (this.form.imageUrls.length > 0) {
              var urls = []
              var names = this.form.imageUrls.split(",");
              names.forEach(name => {
                urls.push(website.minioUrl + name)
              })
              this.form.imageUrls = urls.join(",")
            }
          }
        });
      }
      // con
      done();
    },
    currentChange(currentPage) {
      this.page.currentPage = currentPage;
    },
    sizeChange(pageSize) {
      this.page.pageSize = pageSize;
    },
    refreshChange() {
      this.onLoad(this.page, this.query);
    },
    onLoad(page, params = {}) {
      const { dateTime } = this.query;
      let values = {
        ...params,
      };
      if (dateTime) {
        values = {
          ...params,
          startTime: dateTime[0],
          endTime: dateTime[1],
          ...this.query,
        };
        values.dateTime = null;
      }
      this.loading = true;
      getList(page.currentPage, page.pageSize, values).then((res) => {
        const data = res.data.data;
        this.page.total = data.total;
        this.data = data.records;
        this.data.forEach(item => {
          if (item.imageUrls) {
            if (item.imageUrls.length > 0) {
              var urls = []
              var names = item.imageUrls.split(",");
              names.forEach(name => {
                urls.push(website.minioUrl + name)
              })
              item.imageUrls = urls.join(",")
            }
          }
        })
        this.loading = false;
        this.selectionClear();
      });
    }
  },
};
}
</script>
<style>
.avue-upload__icon {
  line-height: 6;
    line-height: 6;
}
</style>
src/views/tool/code.vue
@@ -1,624 +1,599 @@
<template>
  <basic-container>
    <avue-crud :option="option"
               :table-loading="loading"
               :data="data"
               ref="crud"
               v-model="form"
               :permission="permissionList"
               :page.sync="page"
               @row-del="rowDel"
               @row-update="rowUpdate"
               @row-save="rowSave"
               :before-open="beforeOpen"
               @search-change="searchChange"
               @search-reset="searchReset"
               @selection-change="selectionChange"
               @current-change="currentChange"
               @size-change="sizeChange"
               @refresh-change="refreshChange"
               @on-load="onLoad">
      <template slot="menuLeft">
        <el-button type="danger"
                   size="small"
                   icon="el-icon-delete"
                   v-if="permission.code_delete"
                   plain
                   @click="handleDelete">删 除
        </el-button>
        <el-button type="primary"
                   size="small"
                   plain
                   icon="el-icon-refresh"
                   @click="handleBuild">代码生成
        </el-button>
      </template>
      <template slot-scope="scope" slot="menu">
        <el-button type="text"
                   size="small"
                   icon="el-icon-document-copy"
                   v-if="permission.code_edit"
                   class="none-border"
                   @click.stop="handleCopy(scope.row)">复制
        </el-button>
      </template>
    </avue-crud>
  </basic-container>
    <basic-container>
        <avue-crud :option="option" :table-loading="loading" :data="data" ref="crud" v-model="form"
            :permission="permissionList" :page.sync="page" @row-del="rowDel" @row-update="rowUpdate" @row-save="rowSave"
            :before-open="beforeOpen" @search-change="searchChange" @search-reset="searchReset"
            @selection-change="selectionChange" @current-change="currentChange" @size-change="sizeChange"
            @refresh-change="refreshChange" @on-load="onLoad">
            <template slot="menuLeft">
                <el-button type="danger" size="small" icon="el-icon-delete" v-if="permission.code_delete" plain
                    @click="handleDelete">删 除
                </el-button>
                <el-button type="primary" size="small" plain icon="el-icon-refresh" @click="handleBuild">代码生成
                </el-button>
            </template>
            <template slot-scope="scope" slot="menu">
                <el-button type="text" size="small" icon="el-icon-document-copy" v-if="permission.code_edit"
                    class="none-border" @click.stop="handleCopy(scope.row)">复制
                </el-button>
            </template>
        </avue-crud>
    </basic-container>
</template>
<script>
  import {getList, getCode, build, remove, add, update, copy} from "@/api/tool/code";
  import {getDetail as modelDetail, prototypeDetail} from "@/api/tool/model";
  import {templateDic} from "@/const/tool/model";
  import {validatenull} from "@/util/validate";
  import {mapGetters} from "vuex";
import { getList, getCode, build, remove, add, update, copy } from "@/api/tool/code"
import { getDetail as modelDetail, prototypeDetail } from "@/api/tool/model"
import { templateDic } from "@/const/tool/model"
import { validatenull } from "@/util/validate"
import { mapGetters } from "vuex"
  export default {
    data() {
      return {
        form: {},
        selectionList: [],
        loading: true,
        query: {},
        page: {
          pageSize: 10,
          currentPage: 1,
          total: 0
        },
        option: {
          height: 'auto',
          calcHeight: 30,
          dialogWidth: 900,
          tip: false,
          searchShow: true,
          searchMenuSpan: 6,
          border: true,
          index: true,
          selection: true,
          labelWidth: 120,
          menuWidth: 300,
          viewBtn: true,
          dialogClickModal: false,
          tabs: true,
          column: [
            {
              label: "模块名",
              prop: "codeName",
              search: true,
              display: false,
export default {
    data () {
        return {
            form: {},
            selectionList: [],
            loading: true,
            query: {},
            page: {
                pageSize: 10,
                currentPage: 1,
                total: 0
            },
            {
              label: '模版类型',
              prop: 'templateType',
              type: "select",
              dicData: templateDic,
              display: false,
            },
            {
              label: "表名",
              prop: "tableName",
              search: true,
              display: false,
            },
            {
              label: "服务名",
              prop: "serviceName",
              search: true,
              display: false,
            },
            {
              label: "包名",
              prop: "packageName",
              display: false,
            },
          ],
          group: [
            {
              label: '模型配置',
              prop: 'modelSetting',
              icon: 'el-icon-tickets',
              column: [
                {
                  label: "数据模型",
                  prop: "modelId",
                  search: true,
                  span: 24,
                  type: "select",
                  dicUrl: "/api/blade-develop/model/select",
                  props: {
                    label: "modelName",
                    value: "id"
                  },
                  rules: [{
                    required: true,
                    message: "请选择数据模型",
                    trigger: "blur"
                  }]
                },
                {
                  label: "模块名",
                  prop: "codeName",
                  search: true,
                  rules: [{
                    required: true,
                    message: "请输入模块名",
                    trigger: "blur"
                  }]
                },
                {
                  label: "服务名",
                  prop: "serviceName",
                  search: true,
                  rules: [{
                    required: true,
                    message: "请输入服务名",
                    trigger: "blur"
                  }]
                },
                {
                  label: "表名",
                  prop: "tableName",
                  rules: [{
                    required: true,
                    message: "请输入表名",
                    trigger: "blur"
                  }]
                },
                {
                  label: "表前缀",
                  prop: "tablePrefix",
                  hide: true,
                  rules: [{
                    required: true,
                    message: "请输入表前缀",
                    trigger: "blur"
                  }]
                },
                {
                  label: "主键名",
                  prop: "pkName",
                  hide: true,
                  rules: [{
                    required: true,
                    message: "请输入主键名",
                    trigger: "blur"
                  }]
                },
                {
                  label: "包名",
                  prop: "packageName",
                  overHidden: true,
                  rules: [{
                    required: true,
                    message: "请输入包名",
                    trigger: "blur"
                  }]
                },
              ]
            },
            {
              label: '模版配置',
              prop: 'templateSetting',
              icon: 'el-icon-copy-document',
              column: [
                {
                  label: '模版类型',
                  prop: 'templateType',
                  type: "select",
                  dicData: templateDic,
                  value: "crud",
                  rules: [{
                    required: true,
                    message: "请选择模版类型",
                    trigger: "blur"
                  }]
                },
                {
                  label: "作者信息",
                  prop: "author",
                  value: "BladeX",
                  rules: [{
                    required: true,
                    message: "请输入作者",
                    trigger: "blur"
                  }]
                },
                {
                  label: "子表模型",
                  prop: "subModelId",
                  type: "select",
                  dicUrl: "/api/blade-develop/model/select",
                  props: {
                    label: "modelName",
                    value: "id"
                  },
                  display: false,
                  hide: true,
                },
                {
                  label: "子表外键",
                  prop: "subFkId",
                  display: false,
                  hide: true,
                },
                {
                  label: "树主键字段",
                  prop: "treeId",
                  type: "select",
                  dicData: [],
                  props: {
                    label: "jdbcComment",
                    value: "jdbcName"
                  },
                  display: false,
                  hide: true,
                },
                {
                  label: "树父主键字段",
                  prop: "treePid",
                  type: "select",
                  dicData: [],
                  props: {
                    label: "jdbcComment",
                    value: "jdbcName"
                  },
                  display: false,
                  hide: true,
                },
                {
                  label: "树名称字段",
                  prop: "treeName",
                  type: "select",
                  dicData: [],
                  props: {
                    label: "jdbcComment",
                    value: "jdbcName"
                  },
                  display: false,
                  hide: true,
                },
              ]
            },
            {
              label: '生成配置',
              prop: 'codingSetting',
              icon: 'el-icon-printer',
              column: [
                {
                  label: "基础业务",
                  labelTip:'配置是否使用BladeX封装的BaseService解锁更多功能',
                  prop: "baseMode",
                  type: 'radio',
                  dicUrl: "/api/blade-system/dict/dictionary?code=yes_no",
                  props: {
                    label: "dictValue",
                    value: "dictKey"
                  },
                  value: 2,
                  dataType: "number",
                  hide: true,
                  rules: [{
                    required: true,
                    message: "请选择基础业务",
                    trigger: "blur"
                  }]
                },
                {
                  label: "包装器",
                  labelTip:'配置是否使用Wrapper包装器来拓展Controller返回列表的字段',
                  prop: "wrapMode",
                  type: 'radio',
                  dicUrl: "/api/blade-system/dict/dictionary?code=yes_no",
                  props: {
                    label: "dictValue",
                    value: "dictKey"
                  },
                  value: 2,
                  dataType: "number",
                  hide: true,
                  rules: [{
                    required: true,
                    message: "请选择包装器",
                    trigger: "blur"
                  }]
                },
                {
                  label: "远程调用",
                  labelTip:'配置是否使用Feign远程调用',
                  prop: "feignMode",
                  type: 'radio',
                  dicUrl: "/api/blade-system/dict/dictionary?code=yes_no",
                  props: {
                    label: "dictValue",
                    value: "dictKey"
                  },
                  value: 1,
                  dataType: "number",
                  hide: true,
                  rules: [{
                    required: true,
                    message: "请选择基础业务",
                    trigger: "blur"
                  }]
                },
                {
                  label: "代码风格",
                  labelTip:'选择不同底层实现的代码模版',
                  prop: "codeStyle",
                  type: 'radio',
                  dicData: [
            option: {
                height: 'auto',
                calcHeight: 30,
                dialogWidth: 900,
                tip: false,
                searchShow: true,
                searchMenuSpan: 6,
                border: true,
                index: true,
                selection: true,
                labelWidth: 120,
                menuWidth: 280,
                viewBtn: true,
                dialogClickModal: false,
                tabs: true,
                column: [
                    {
                      label: "saber",
                      value: "saber"
                        label: "模块名",
                        prop: "codeName",
                        search: true,
                        display: false,
                    },
                    {
                      label: "element",
                      value: "element"
                        label: '模版类型',
                        prop: 'templateType',
                        type: "select",
                        dicData: templateDic,
                        display: false,
                    },
                    {
                        label: "表名",
                        prop: "tableName",
                        search: true,
                        display: false,
                    },
                    {
                        label: "服务名",
                        prop: "serviceName",
                        search: true,
                        display: false,
                    },
                    {
                        label: "包名",
                        prop: "packageName",
                        display: false,
                    },
                ],
                group: [
                    {
                        label: '模型配置',
                        prop: 'modelSetting',
                        icon: 'el-icon-tickets',
                        column: [
                            {
                                label: "数据模型",
                                prop: "modelId",
                                search: true,
                                span: 24,
                                type: "select",
                                dicUrl: "/api/blade-develop/model/select",
                                props: {
                                    label: "modelName",
                                    value: "id"
                                },
                                rules: [{
                                    required: true,
                                    message: "请选择数据模型",
                                    trigger: "blur"
                                }]
                            },
                            {
                                label: "模块名",
                                prop: "codeName",
                                search: true,
                                rules: [{
                                    required: true,
                                    message: "请输入模块名",
                                    trigger: "blur"
                                }]
                            },
                            {
                                label: "服务名",
                                prop: "serviceName",
                                search: true,
                                rules: [{
                                    required: true,
                                    message: "请输入服务名",
                                    trigger: "blur"
                                }]
                            },
                            {
                                label: "表名",
                                prop: "tableName",
                                rules: [{
                                    required: true,
                                    message: "请输入表名",
                                    trigger: "blur"
                                }]
                            },
                            {
                                label: "表前缀",
                                prop: "tablePrefix",
                                hide: true,
                                rules: [{
                                    required: true,
                                    message: "请输入表前缀",
                                    trigger: "blur"
                                }]
                            },
                            {
                                label: "主键名",
                                prop: "pkName",
                                hide: true,
                                rules: [{
                                    required: true,
                                    message: "请输入主键名",
                                    trigger: "blur"
                                }]
                            },
                            {
                                label: "包名",
                                prop: "packageName",
                                overHidden: true,
                                rules: [{
                                    required: true,
                                    message: "请输入包名",
                                    trigger: "blur"
                                }]
                            },
                        ]
                    },
                    {
                        label: '模版配置',
                        prop: 'templateSetting',
                        icon: 'el-icon-copy-document',
                        column: [
                            {
                                label: '模版类型',
                                prop: 'templateType',
                                type: "select",
                                dicData: templateDic,
                                value: "crud",
                                rules: [{
                                    required: true,
                                    message: "请选择模版类型",
                                    trigger: "blur"
                                }]
                            },
                            {
                                label: "作者信息",
                                prop: "author",
                                value: "BladeX",
                                rules: [{
                                    required: true,
                                    message: "请输入作者",
                                    trigger: "blur"
                                }]
                            },
                            {
                                label: "子表模型",
                                prop: "subModelId",
                                type: "select",
                                dicUrl: "/api/blade-develop/model/select",
                                props: {
                                    label: "modelName",
                                    value: "id"
                                },
                                display: false,
                                hide: true,
                            },
                            {
                                label: "子表外键",
                                prop: "subFkId",
                                display: false,
                                hide: true,
                            },
                            {
                                label: "树主键字段",
                                prop: "treeId",
                                type: "select",
                                dicData: [],
                                props: {
                                    label: "jdbcComment",
                                    value: "jdbcName"
                                },
                                display: false,
                                hide: true,
                            },
                            {
                                label: "树父主键字段",
                                prop: "treePid",
                                type: "select",
                                dicData: [],
                                props: {
                                    label: "jdbcComment",
                                    value: "jdbcName"
                                },
                                display: false,
                                hide: true,
                            },
                            {
                                label: "树名称字段",
                                prop: "treeName",
                                type: "select",
                                dicData: [],
                                props: {
                                    label: "jdbcComment",
                                    value: "jdbcName"
                                },
                                display: false,
                                hide: true,
                            },
                        ]
                    },
                    {
                        label: '生成配置',
                        prop: 'codingSetting',
                        icon: 'el-icon-printer',
                        column: [
                            {
                                label: "基础业务",
                                labelTip: '配置是否使用BladeX封装的BaseService解锁更多功能',
                                prop: "baseMode",
                                type: 'radio',
                                dicUrl: "/api/blade-system/dict/dictionary?code=yes_no",
                                props: {
                                    label: "dictValue",
                                    value: "dictKey"
                                },
                                value: 2,
                                dataType: "number",
                                hide: true,
                                rules: [{
                                    required: true,
                                    message: "请选择基础业务",
                                    trigger: "blur"
                                }]
                            },
                            {
                                label: "包装器",
                                labelTip: '配置是否使用Wrapper包装器来拓展Controller返回列表的字段',
                                prop: "wrapMode",
                                type: 'radio',
                                dicUrl: "/api/blade-system/dict/dictionary?code=yes_no",
                                props: {
                                    label: "dictValue",
                                    value: "dictKey"
                                },
                                value: 2,
                                dataType: "number",
                                hide: true,
                                rules: [{
                                    required: true,
                                    message: "请选择包装器",
                                    trigger: "blur"
                                }]
                            },
                            {
                                label: "远程调用",
                                labelTip: '配置是否使用Feign远程调用',
                                prop: "feignMode",
                                type: 'radio',
                                dicUrl: "/api/blade-system/dict/dictionary?code=yes_no",
                                props: {
                                    label: "dictValue",
                                    value: "dictKey"
                                },
                                value: 1,
                                dataType: "number",
                                hide: true,
                                rules: [{
                                    required: true,
                                    message: "请选择基础业务",
                                    trigger: "blur"
                                }]
                            },
                            {
                                label: "代码风格",
                                labelTip: '选择不同底层实现的代码模版',
                                prop: "codeStyle",
                                type: 'radio',
                                dicData: [
                                    {
                                        label: "saber",
                                        value: "saber"
                                    },
                                    {
                                        label: "element",
                                        value: "element"
                                    }
                                ],
                                value: "saber",
                                hide: true,
                                rules: [{
                                    required: true,
                                    message: "请选择代码风格",
                                    trigger: "blur"
                                }]
                            },
                            {
                                label: "后端生成路径",
                                prop: "apiPath",
                                span: 24,
                                hide: true,
                                rules: [{
                                    required: true,
                                    message: "请输入后端生成路径",
                                    trigger: "blur"
                                }]
                            },
                            {
                                label: "前端生成路径",
                                prop: "webPath",
                                span: 24,
                                hide: true,
                                rules: [{
                                    required: true,
                                    message: "请输入前端生成路径",
                                    trigger: "blur"
                                }]
                            }
                        ]
                    }
                  ],
                  value: "saber",
                  hide: true,
                  rules: [{
                    required: true,
                    message: "请选择代码风格",
                    trigger: "blur"
                  }]
                },
                {
                  label: "后端生成路径",
                  prop: "apiPath",
                  span: 24,
                  hide: true,
                  rules: [{
                    required: true,
                    message: "请输入后端生成路径",
                    trigger: "blur"
                  }]
                },
                {
                  label: "前端生成路径",
                  prop: "webPath",
                  span: 24,
                  hide: true,
                  rules: [{
                    required: true,
                    message: "请输入前端生成路径",
                    trigger: "blur"
                  }]
                }
              ]
            }
          ]
        },
        data: []
      };
                ]
            },
            data: []
        }
    },
    watch: {
      'form.modelId'() {
        if (!validatenull(this.form.modelId)) {
          // 获取数据模型信息
          modelDetail(this.form.modelId).then(res => {
            const result = res.data;
            if (result.success) {
              const {modelName, modelTable, modelCode} = result.data;
              if (validatenull(this.form.tablePrefix)) {
                this.form.tablePrefix = modelTable.split("_")[0] + "_";
              }
              if (validatenull(this.form.tableName)) {
                this.form.tableName = modelTable;
              }
              if (validatenull(this.form.codeName)) {
                this.form.codeName = modelName;
              }
              if (validatenull(this.form.serviceName)) {
                this.form.serviceName = `blade-${modelCode}`;
              }
              if (validatenull(this.form.pkName)) {
                this.form.pkName = "id";
              }
              if (validatenull(this.form.packageName)) {
                this.form.packageName = `org.springblade.modules.${modelCode}`;
              }
              if (validatenull(this.form.subFkId) && !validatenull(this.form.tablePrefix)) {
                this.form.subFkId = modelTable.replace(this.form.tablePrefix, "") + "_id";
              }
        'form.modelId' () {
            if (!validatenull(this.form.modelId)) {
                // 获取数据模型信息
                modelDetail(this.form.modelId).then(res => {
                    const result = res.data
                    if (result.success) {
                        const { modelName, modelTable, modelCode } = result.data
                        if (validatenull(this.form.tablePrefix)) {
                            this.form.tablePrefix = modelTable.split("_")[0] + "_"
                        }
                        if (validatenull(this.form.tableName)) {
                            this.form.tableName = modelTable
                        }
                        if (validatenull(this.form.codeName)) {
                            this.form.codeName = modelName
                        }
                        if (validatenull(this.form.serviceName)) {
                            this.form.serviceName = `blade-${modelCode}`
                        }
                        if (validatenull(this.form.pkName)) {
                            this.form.pkName = "id"
                        }
                        if (validatenull(this.form.packageName)) {
                            this.form.packageName = `org.springblade.modules.${modelCode}`
                        }
                        if (validatenull(this.form.subFkId) && !validatenull(this.form.tablePrefix)) {
                            this.form.subFkId = modelTable.replace(this.form.tablePrefix, "") + "_id"
                        }
              // 获取数据原型信息
              prototypeDetail(this.form.modelId).then(res => {
                const result = res.data;
                if (result.success) {
                  const columnTreeId = this.findObject(this.option.group, "treeId");
                  const columnTreePid = this.findObject(this.option.group, "treePid");
                  const columnTreeName = this.findObject(this.option.group, "treeName");
                  columnTreeId.dicData = result.data;
                  columnTreePid.dicData = result.data;
                  columnTreeName.dicData = result.data;
                }
              });
                        // 获取数据原型信息
                        prototypeDetail(this.form.modelId).then(res => {
                            const result = res.data
                            if (result.success) {
                                const columnTreeId = this.findObject(this.option.group, "treeId")
                                const columnTreePid = this.findObject(this.option.group, "treePid")
                                const columnTreeName = this.findObject(this.option.group, "treeName")
                                columnTreeId.dicData = result.data
                                columnTreePid.dicData = result.data
                                columnTreeName.dicData = result.data
                            }
                        })
                    }
                })
            }
          });
        },
        'form.templateType' () {
            // 模版类型
            const type = this.form.templateType
            // 主子表字段显隐
            const columnSubModelId = this.findObject(this.option.group, "subModelId")
            const columnSubFkId = this.findObject(this.option.group, "subFkId")
            columnSubModelId.display = type === "sub"
            columnSubFkId.display = type === "sub"
            // 树表字段显隐
            const columnTreeId = this.findObject(this.option.group, "treeId")
            const columnTreePid = this.findObject(this.option.group, "treePid")
            const columnTreeName = this.findObject(this.option.group, "treeName")
            columnTreeId.display = type === "tree"
            columnTreePid.display = type === "tree"
            columnTreeName.display = type === "tree"
        }
      },
      'form.templateType'() {
        // 模版类型
        const type = this.form.templateType;
        // 主子表字段显隐
        const columnSubModelId = this.findObject(this.option.group, "subModelId");
        const columnSubFkId = this.findObject(this.option.group, "subFkId");
        columnSubModelId.display = type === "sub";
        columnSubFkId.display = type === "sub";
        // 树表字段显隐
        const columnTreeId = this.findObject(this.option.group, "treeId");
        const columnTreePid = this.findObject(this.option.group, "treePid");
        const columnTreeName = this.findObject(this.option.group, "treeName");
        columnTreeId.display = type === "tree";
        columnTreePid.display = type === "tree";
        columnTreeName.display = type === "tree";
      }
    },
    computed: {
      ...mapGetters(["permission"]),
      permissionList() {
        return {
          addBtn: this.vaildData(this.permission.code_add, false),
          viewBtn: this.vaildData(this.permission.code_view, false),
          delBtn: this.vaildData(this.permission.code_delete, false),
          editBtn: this.vaildData(this.permission.code_edit, false)
        };
      },
      ids() {
        let ids = [];
        this.selectionList.forEach(ele => {
          ids.push(ele.id);
        });
        return ids.join(",");
      }
        ...mapGetters(["permission"]),
        permissionList () {
            return {
                addBtn: this.vaildData(this.permission.code_add, false),
                viewBtn: this.vaildData(this.permission.code_view, false),
                delBtn: this.vaildData(this.permission.code_delete, false),
                editBtn: this.vaildData(this.permission.code_edit, false)
            }
        },
        ids () {
            let ids = []
            this.selectionList.forEach(ele => {
                ids.push(ele.id)
            })
            return ids.join(",")
        }
    },
    methods: {
      rowSave(row, done, loading) {
        add(row).then(() => {
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!"
          });
          done();
        }, error => {
          window.console.log(error);
          loading();
        });
      },
      rowUpdate(row, index, done, loading) {
        update(row).then(() => {
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!"
          });
          done();
        }, error => {
          window.console.log(error);
          loading();
        });
      },
      rowDel(row) {
        this.$confirm("确定将选择数据删除?", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        })
          .then(() => {
            return remove(row.id);
          })
          .then(() => {
            this.onLoad(this.page);
            this.$message({
              type: "success",
              message: "操作成功!"
            });
          });
      },
      searchReset() {
        this.query = {};
        this.onLoad(this.page);
      },
      searchChange(params, done) {
        this.query = params;
        this.page.currentPage = 1;
        this.onLoad(this.page, params);
        done();
      },
      selectionChange(list) {
        this.selectionList = list;
      },
      selectionClear() {
        this.selectionList = [];
        this.$refs.crud.toggleSelection();
      },
      handleDelete() {
        if (this.selectionList.length === 0) {
          this.$message.warning("请选择至少一条数据");
          return;
        rowSave (row, done, loading) {
            add(row).then(() => {
                this.onLoad(this.page)
                this.$message({
                    type: "success",
                    message: "操作成功!"
                })
                done()
            }, error => {
                window.console.log(error)
                loading()
            })
        },
        rowUpdate (row, index, done, loading) {
            update(row).then(() => {
                this.onLoad(this.page)
                this.$message({
                    type: "success",
                    message: "操作成功!"
                })
                done()
            }, error => {
                window.console.log(error)
                loading()
            })
        },
        rowDel (row) {
            this.$confirm("确定将选择数据删除?", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                type: "warning"
            })
                .then(() => {
                    return remove(row.id)
                })
                .then(() => {
                    this.onLoad(this.page)
                    this.$message({
                        type: "success",
                        message: "操作成功!"
                    })
                })
        },
        searchReset () {
            this.query = {}
            this.onLoad(this.page)
        },
        searchChange (params, done) {
            this.query = params
            this.page.currentPage = 1
            this.onLoad(this.page, params)
            done()
        },
        selectionChange (list) {
            this.selectionList = list
        },
        selectionClear () {
            this.selectionList = []
            this.$refs.crud.toggleSelection()
        },
        handleDelete () {
            if (this.selectionList.length === 0) {
                this.$message.warning("请选择至少一条数据")
                return
            }
            this.$confirm("确定将选择数据删除?", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                type: "warning"
            })
                .then(() => {
                    return remove(this.ids)
                })
                .then(() => {
                    this.onLoad(this.page)
                    this.$message({
                        type: "success",
                        message: "操作成功!"
                    })
                    this.$refs.crud.toggleSelection()
                })
        },
        handleBuild () {
            if (this.selectionList.length === 0) {
                this.$message.warning("请选择至少一条数据")
                return
            }
            this.$confirm("是否生成选中模块的代码?", {
                title: "代码生成确认",
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                type: "warning"
            })
                .then(() => {
                    return build(this.ids)
                })
                .then(() => {
                    this.onLoad(this.page)
                    this.$message({
                        type: "success",
                        message: "操作成功!"
                    })
                    this.$refs.crud.toggleSelection()
                })
        },
        handleCopy (row) {
            copy(row.id).then(() => {
                this.onLoad(this.page)
                this.$message({
                    type: "success",
                    message: "复制成功!"
                })
            })
        },
        beforeOpen (done, type) {
            if (["edit", "view"].includes(type)) {
                getCode(this.form.id).then(res => {
                    this.form = res.data.data
                })
            }
            done()
        },
        currentChange (currentPage) {
            this.page.currentPage = currentPage
        },
        sizeChange (pageSize) {
            this.page.pageSize = pageSize
        },
        refreshChange () {
            this.onLoad(this.page, this.query)
        },
        onLoad (page, params = {}) {
            this.loading = true
            getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
                const data = res.data.data
                this.page.total = data.total
                this.data = data.records
                this.loading = false
                this.selectionClear()
            })
        }
        this.$confirm("确定将选择数据删除?", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        })
          .then(() => {
            return remove(this.ids);
          })
          .then(() => {
            this.onLoad(this.page);
            this.$message({
              type: "success",
              message: "操作成功!"
            });
            this.$refs.crud.toggleSelection();
          });
      },
      handleBuild() {
        if (this.selectionList.length === 0) {
          this.$message.warning("请选择至少一条数据");
          return;
        }
        this.$confirm("是否生成选中模块的代码?", {
          title: "代码生成确认",
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        })
          .then(() => {
            return build(this.ids);
          })
          .then(() => {
            this.onLoad(this.page);
            this.$message({
              type: "success",
              message: "操作成功!"
            });
            this.$refs.crud.toggleSelection();
          });
      },
      handleCopy(row) {
        copy(row.id).then(() => {
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "复制成功!"
          });
        });
      },
      beforeOpen(done, type) {
        if (["edit", "view"].includes(type)) {
          getCode(this.form.id).then(res => {
            this.form = res.data.data;
          });
        }
        done();
      },
      currentChange(currentPage) {
        this.page.currentPage = currentPage;
      },
      sizeChange(pageSize) {
        this.page.pageSize = pageSize;
      },
      refreshChange() {
        this.onLoad(this.page, this.query);
      },
      onLoad(page, params = {}) {
        this.loading = true;
        getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
          const data = res.data.data;
          this.page.total = data.total;
          this.data = data.records;
          this.loading = false;
          this.selectionClear();
        });
      }
    }
  };
}
</script>
src/views/tool/datasource.vue
@@ -1,278 +1,260 @@
<template>
  <basic-container>
    <avue-crud :option="option"
               :table-loading="loading"
               :data="data"
               :page.sync="page"
               :permission="permissionList"
               :before-open="beforeOpen"
               v-model="form"
               ref="crud"
               @row-update="rowUpdate"
               @row-save="rowSave"
               @row-del="rowDel"
               @search-change="searchChange"
               @search-reset="searchReset"
               @selection-change="selectionChange"
               @current-change="currentChange"
               @size-change="sizeChange"
               @refresh-change="refreshChange"
               @on-load="onLoad">
      <template slot="menuLeft">
        <el-button type="danger"
                   size="small"
                   icon="el-icon-delete"
                   plain
                   v-if="permission.datasource_delete"
                   @click="handleDelete">删 除
        </el-button>
      </template>
    </avue-crud>
  </basic-container>
    <basic-container>
        <avue-crud :option="option" :table-loading="loading" :data="data" :page.sync="page" :permission="permissionList"
            :before-open="beforeOpen" v-model="form" ref="crud" @row-update="rowUpdate" @row-save="rowSave"
            @row-del="rowDel" @search-change="searchChange" @search-reset="searchReset" @selection-change="selectionChange"
            @current-change="currentChange" @size-change="sizeChange" @refresh-change="refreshChange" @on-load="onLoad">
            <template slot="menuLeft">
                <el-button type="danger" size="small" icon="el-icon-delete" plain v-if="permission.datasource_delete"
                    @click="handleDelete">删 除
                </el-button>
            </template>
        </avue-crud>
    </basic-container>
</template>
<script>
  import {getList, getDetail, add, update, remove} from "@/api/tool/datasource";
  import {mapGetters} from "vuex";
import { getList, getDetail, add, update, remove } from "@/api/tool/datasource"
import { mapGetters } from "vuex"
  export default {
    data() {
      return {
        form: {},
        query: {},
        loading: true,
        page: {
          pageSize: 10,
          currentPage: 1,
          total: 0
        },
        selectionList: [],
        option: {
          height: 'auto',
          calcHeight: 30,
          dialogWidth: 900,
          tip: false,
          searchShow: true,
          searchMenuSpan: 6,
          border: true,
          index: true,
          viewBtn: true,
          selection: true,
          dialogClickModal: false,
          column: [
            {
              label: "名称",
              prop: "name",
              width: 120,
              rules: [{
                required: true,
                message: "请输入数据源名称",
                trigger: "blur"
              }]
export default {
    data () {
        return {
            form: {},
            query: {},
            loading: true,
            page: {
                pageSize: 10,
                currentPage: 1,
                total: 0
            },
            {
              label: "驱动类",
              prop: "driverClass",
              type: 'select',
              dicData: [
                {
                  label: 'com.mysql.cj.jdbc.Driver',
                  value: 'com.mysql.cj.jdbc.Driver',
                }, {
                  label: 'org.postgresql.Driver',
                  value: 'org.postgresql.Driver',
                }, {
                  label: 'oracle.jdbc.OracleDriver',
                  value: 'oracle.jdbc.OracleDriver',
                }, {
                  label: 'com.microsoft.sqlserver.jdbc.SQLServerDriver',
                  value: 'com.microsoft.sqlserver.jdbc.SQLServerDriver',
                }, {
                  label: 'dm.jdbc.driver.DmDriver',
                  value: 'dm.jdbc.driver.DmDriver',
                }
              ],
              width: 200,
              rules: [{
                required: true,
                message: "请输入驱动类",
                trigger: "blur"
              }]
            selectionList: [],
            option: {
                height: 'auto',
                calcHeight: 30,
                dialogWidth: 900,
                tip: false,
                searchShow: true,
                searchMenuSpan: 6,
                border: true,
                index: true,
                viewBtn: true,
                selection: true,
                dialogClickModal: false,
                menuWidth: 280,
                column: [
                    {
                        label: "名称",
                        prop: "name",
                        width: 120,
                        rules: [{
                            required: true,
                            message: "请输入数据源名称",
                            trigger: "blur"
                        }]
                    },
                    {
                        label: "驱动类",
                        prop: "driverClass",
                        type: 'select',
                        dicData: [
                            {
                                label: 'com.mysql.cj.jdbc.Driver',
                                value: 'com.mysql.cj.jdbc.Driver',
                            }, {
                                label: 'org.postgresql.Driver',
                                value: 'org.postgresql.Driver',
                            }, {
                                label: 'oracle.jdbc.OracleDriver',
                                value: 'oracle.jdbc.OracleDriver',
                            }, {
                                label: 'com.microsoft.sqlserver.jdbc.SQLServerDriver',
                                value: 'com.microsoft.sqlserver.jdbc.SQLServerDriver',
                            }, {
                                label: 'dm.jdbc.driver.DmDriver',
                                value: 'dm.jdbc.driver.DmDriver',
                            }
                        ],
                        width: 200,
                        rules: [{
                            required: true,
                            message: "请输入驱动类",
                            trigger: "blur"
                        }]
                    },
                    {
                        label: "用户名",
                        prop: "username",
                        width: 120,
                        rules: [{
                            required: true,
                            message: "请输入用户名",
                            trigger: "blur"
                        }]
                    },
                    {
                        label: "密码",
                        prop: "password",
                        hide: true,
                        rules: [{
                            required: true,
                            message: "请输入密码",
                            trigger: "blur"
                        }]
                    },
                    {
                        label: "连接地址",
                        prop: "url",
                        span: 24,
                        rules: [{
                            required: true,
                            message: "请输入连接地址",
                            trigger: "blur"
                        }]
                    },
                    {
                        label: "备注",
                        prop: "remark",
                        span: 24,
                        minRows: 3,
                        hide: true,
                        type: "textarea"
                    },
                ]
            },
            {
              label: "用户名",
              prop: "username",
              width: 120,
              rules: [{
                required: true,
                message: "请输入用户名",
                trigger: "blur"
              }]
            },
            {
              label: "密码",
              prop: "password",
              hide: true,
              rules: [{
                required: true,
                message: "请输入密码",
                trigger: "blur"
              }]
            },
            {
              label: "连接地址",
              prop: "url",
              span: 24,
              rules: [{
                required: true,
                message: "请输入连接地址",
                trigger: "blur"
              }]
            },
            {
              label: "备注",
              prop: "remark",
              span: 24,
              minRows: 3,
              hide: true,
              type: "textarea"
            },
          ]
        },
        data: []
      };
            data: []
        }
    },
    computed: {
      ...mapGetters(["permission"]),
      permissionList() {
        return {
          addBtn: this.vaildData(this.permission.datasource_add, false),
          viewBtn: this.vaildData(this.permission.datasource_view, false),
          delBtn: this.vaildData(this.permission.datasource_delete, false),
          editBtn: this.vaildData(this.permission.datasource_edit, false)
        };
      },
      ids() {
        let ids = [];
        this.selectionList.forEach(ele => {
          ids.push(ele.id);
        });
        return ids.join(",");
      }
        ...mapGetters(["permission"]),
        permissionList () {
            return {
                addBtn: this.vaildData(this.permission.datasource_add, false),
                viewBtn: this.vaildData(this.permission.datasource_view, false),
                delBtn: this.vaildData(this.permission.datasource_delete, false),
                editBtn: this.vaildData(this.permission.datasource_edit, false)
            }
        },
        ids () {
            let ids = []
            this.selectionList.forEach(ele => {
                ids.push(ele.id)
            })
            return ids.join(",")
        }
    },
    methods: {
      rowSave(row, done, loading) {
        add(row).then(() => {
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!"
          });
          done();
        }, error => {
          window.console.log(error);
          loading();
        });
      },
      rowUpdate(row, index, done, loading) {
        update(row).then(() => {
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!"
          });
          done();
        }, error => {
          window.console.log(error);
          loading();
        });
      },
      rowDel(row) {
        this.$confirm("确定将选择数据删除?", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        })
          .then(() => {
            return remove(row.id);
          })
          .then(() => {
            this.onLoad(this.page);
            this.$message({
              type: "success",
              message: "操作成功!"
            });
          });
      },
      handleDelete() {
        if (this.selectionList.length === 0) {
          this.$message.warning("请选择至少一条数据");
          return;
        rowSave (row, done, loading) {
            add(row).then(() => {
                this.onLoad(this.page)
                this.$message({
                    type: "success",
                    message: "操作成功!"
                })
                done()
            }, error => {
                window.console.log(error)
                loading()
            })
        },
        rowUpdate (row, index, done, loading) {
            update(row).then(() => {
                this.onLoad(this.page)
                this.$message({
                    type: "success",
                    message: "操作成功!"
                })
                done()
            }, error => {
                window.console.log(error)
                loading()
            })
        },
        rowDel (row) {
            this.$confirm("确定将选择数据删除?", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                type: "warning"
            })
                .then(() => {
                    return remove(row.id)
                })
                .then(() => {
                    this.onLoad(this.page)
                    this.$message({
                        type: "success",
                        message: "操作成功!"
                    })
                })
        },
        handleDelete () {
            if (this.selectionList.length === 0) {
                this.$message.warning("请选择至少一条数据")
                return
            }
            this.$confirm("确定将选择数据删除?", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                type: "warning"
            })
                .then(() => {
                    return remove(this.ids)
                })
                .then(() => {
                    this.onLoad(this.page)
                    this.$message({
                        type: "success",
                        message: "操作成功!"
                    })
                    this.$refs.crud.toggleSelection()
                })
        },
        beforeOpen (done, type) {
            if (["edit", "view"].includes(type)) {
                getDetail(this.form.id).then(res => {
                    this.form = res.data.data
                })
            }
            done()
        },
        searchReset () {
            this.query = {}
            this.onLoad(this.page)
        },
        searchChange (params, done) {
            this.query = params
            this.page.currentPage = 1
            this.onLoad(this.page, params)
            done()
        },
        selectionChange (list) {
            this.selectionList = list
        },
        selectionClear () {
            this.selectionList = []
            this.$refs.crud.toggleSelection()
        },
        currentChange (currentPage) {
            this.page.currentPage = currentPage
        },
        sizeChange (pageSize) {
            this.page.pageSize = pageSize
        },
        refreshChange () {
            this.onLoad(this.page, this.query)
        },
        onLoad (page, params = {}) {
            this.loading = true
            getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
                const data = res.data.data
                this.page.total = data.total
                this.data = data.records
                this.loading = false
                this.selectionClear()
            })
        }
        this.$confirm("确定将选择数据删除?", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        })
          .then(() => {
            return remove(this.ids);
          })
          .then(() => {
            this.onLoad(this.page);
            this.$message({
              type: "success",
              message: "操作成功!"
            });
            this.$refs.crud.toggleSelection();
          });
      },
      beforeOpen(done, type) {
        if (["edit", "view"].includes(type)) {
          getDetail(this.form.id).then(res => {
            this.form = res.data.data;
          });
        }
        done();
      },
      searchReset() {
        this.query = {};
        this.onLoad(this.page);
      },
      searchChange(params, done) {
        this.query = params;
        this.page.currentPage = 1;
        this.onLoad(this.page, params);
        done();
      },
      selectionChange(list) {
        this.selectionList = list;
      },
      selectionClear() {
        this.selectionList = [];
        this.$refs.crud.toggleSelection();
      },
      currentChange(currentPage) {
        this.page.currentPage = currentPage;
      },
      sizeChange(pageSize) {
        this.page.pageSize = pageSize;
      },
      refreshChange() {
        this.onLoad(this.page, this.query);
      },
      onLoad(page, params = {}) {
        this.loading = true;
        getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
          const data = res.data.data;
          this.page.total = data.total;
          this.data = data.records;
          this.loading = false;
          this.selectionClear();
        });
      }
    }
  };
}
</script>
<style>
</style>
<style></style>
src/views/tool/model.vue
@@ -1,371 +1,350 @@
<template>
  <basic-container>
    <avue-crud :option="option"
               :table-loading="loading"
               :data="data"
               :page="page"
               :permission="permissionList"
               :before-open="beforeOpen"
               v-model="form"
               v-loading.fullscreen.lock="fullscreenLoading"
               ref="crud"
               @row-update="rowUpdate"
               @row-save="rowSave"
               @row-del="rowDel"
               @search-change="searchChange"
               @search-reset="searchReset"
               @selection-change="selectionChange"
               @current-change="currentChange"
               @size-change="sizeChange"
               @on-load="onLoad">
      <template slot="menuLeft">
        <el-button type="danger"
                   size="small"
                   icon="el-icon-delete"
                   plain
                   @click="handleDelete">删 除
        </el-button>
      </template>
      <template slot-scope="{row}" slot="menu">
        <el-button type="text"
                   icon="el-icon-setting"
                   size="small"
                   plain
                   class="none-border"
                   @click.stop="handleModel(row)">模型配置
        </el-button>
      </template>
      <template slot-scope="{row}" slot="modelTable">
        <el-tag>{{ row.modelTable }}</el-tag>
      </template>
    </avue-crud>
    <el-dialog title="数据库模型配置"
               :visible.sync="modelBox"
               :fullscreen="true"
               append-to-body>
      <avue-crud ref="crudModel" :option="optionModel" :table-loading="loading" :data="fields"></avue-crud>
      <span slot="footer" class="dialog-footer">
        <el-button type="danger" @click="modelBox = false">关 闭</el-button>
        <el-button type="primary" @click="handleSubmit">提 交</el-button>
      </span>
    </el-dialog>
  </basic-container>
    <basic-container>
        <avue-crud :option="option" :table-loading="loading" :data="data" :page="page" :permission="permissionList"
            :before-open="beforeOpen" v-model="form" v-loading.fullscreen.lock="fullscreenLoading" ref="crud"
            @row-update="rowUpdate" @row-save="rowSave" @row-del="rowDel" @search-change="searchChange"
            @search-reset="searchReset" @selection-change="selectionChange" @current-change="currentChange"
            @size-change="sizeChange" @on-load="onLoad">
            <template slot="menuLeft">
                <el-button type="danger" size="small" icon="el-icon-delete" plain @click="handleDelete">删 除
                </el-button>
            </template>
            <template slot-scope="{row}" slot="menu">
                <el-button type="text" icon="el-icon-setting" size="small" plain class="none-border"
                    @click.stop="handleModel(row)">模型配置
                </el-button>
            </template>
            <template slot-scope="{row}" slot="modelTable">
                <el-tag>{{ row.modelTable }}</el-tag>
            </template>
        </avue-crud>
        <el-dialog title="数据库模型配置" :visible.sync="modelBox" :fullscreen="true" append-to-body>
            <avue-crud ref="crudModel" :option="optionModel" :table-loading="loading" :data="fields"></avue-crud>
            <span slot="footer" class="dialog-footer">
                <el-button type="danger" @click="modelBox = false">关 闭</el-button>
                <el-button type="primary" @click="handleSubmit">提 交</el-button>
            </span>
        </el-dialog>
    </basic-container>
</template>
<script>
import {
  getList,
  getDetail,
  add,
  update,
  remove,
  getTableList,
  getTableInfoByName,
  getModelPrototype,
  submitModelPrototype
} from "@/api/tool/model";
import {entityDic, option, optionModel} from "@/const/tool/model";
import {validatenull} from "@/util/validate";
import {mapGetters} from "vuex";
    getList,
    getDetail,
    add,
    update,
    remove,
    getTableList,
    getTableInfoByName,
    getModelPrototype,
    submitModelPrototype
} from "@/api/tool/model"
import { entityDic, option, optionModel } from "@/const/tool/model"
import { validatenull } from "@/util/validate"
import { mapGetters } from "vuex"
export default {
  data() {
    return {
      form: {},
      query: {},
      loading: true,
      loadingOption: {
        lock: true,
        text: '物理表读取中',
        spinner: 'el-icon-loading',
        background: 'rgba(0, 0, 0, 0)'
      },
      fullscreenLoading: false,
      page: {
        pageSize: 10,
        currentPage: 1,
        total: 0
      },
      selectionList: [],
      modelBox: false,
      modelId: 0,
      datasourceId: 1,
      tableInfo: {},
      active: 0,
      stepStart: 0,
      stepEnd: 4,
      data: [],
      option: option,
      optionModel: optionModel,
      formStep: {},
      fields: [],
      selectionModelList: [],
      // 默认不需要显示的字段名
      hideFields: ["id", "tenant_id", "create_user", "create_dept", "create_time", "update_user", "update_time", "status", "is_deleted"]
    };
  },
  watch: {
    'form.datasourceId'() {
      if (!validatenull(this.form.datasourceId)) {
        const fullLoading = this.$loading(this.loadingOption);
        getTableList(this.form.datasourceId).then(res => {
          const column = this.findObject(this.option.column, "modelTable");
          column.dicData = res.data.data;
          fullLoading.close();
        }).catch(() => {
          fullLoading.close();
        })
      }
    },
    'form.modelTable'() {
      if (!validatenull(this.form.modelTable)) {
        const fullLoading = this.$loading(this.loadingOption);
        getTableInfoByName(this.form.modelTable, this.form.datasourceId).then(res => {
          const result = res.data;
          if (result.success) {
            const {comment, entityName} = result.data;
            if (validatenull(this.form.modelClass)) {
              this.form.modelClass = entityName;
            }
            if (validatenull(this.form.modelName)) {
              this.form.modelName = comment;
            }
            if (validatenull(this.form.modelCode)) {
              this.form.modelCode = entityName.replace(/^\S/, s => s.toLowerCase());
            }
            fullLoading.close();
          }
        }).catch(() => {
          fullLoading.close();
        });
      }
    }
  },
  computed: {
    ...mapGetters(["permission"]),
    permissionList() {
      return {
        addBtn: true,
        delBtn: true,
        editBtn: true,
        viewBtn: false
      };
    },
    ids() {
      let ids = [];
      this.selectionList.forEach(ele => {
        ids.push(ele.id);
      });
      return ids.join(",");
    },
  },
  methods: {
    rowSave(row, done, loading) {
      add(row).then((res) => {
        done();
        this.onLoad(this.page);
        this.$message({
          type: "success",
          message: "操作成功!"
        });
        this.$confirm("是否进行模型配置?", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        }).then(() => {
          let model = {
            id: res.data.data.id,
            datasourceId: res.data.data.datasourceId
          };
          this.handleModel(model);
        });
      }, error => {
        loading();
        window.console.log(error);
      });
    },
    rowUpdate(row, index, done, loading) {
      update(row).then(() => {
        done();
        this.onLoad(this.page);
        this.$message({
          type: "success",
          message: "操作成功!"
        });
      }, error => {
        loading();
        window.console.log(error);
      });
    },
    rowDel(row) {
      this.$confirm("确定将选择数据删除?", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      })
        .then(() => {
          return remove(row.id);
        })
        .then(() => {
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!"
          });
        });
    },
    handleDelete() {
      if (this.selectionList.length === 0) {
        this.$message.warning("请选择至少一条数据");
        return;
      }
      this.$confirm("确定将选择数据删除?", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      })
        .then(() => {
          return remove(this.ids);
        })
        .then(() => {
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!"
          });
          this.$refs.crud.toggleSelection();
        });
    },
    beforeOpen(done, type) {
      if (["edit", "view"].includes(type)) {
        getDetail(this.form.id).then(res => {
          this.form = res.data.data;
        });
      }
      done();
    },
    searchReset() {
      this.query = {};
      this.onLoad(this.page);
    },
    searchChange(params, done) {
      this.query = params;
      this.onLoad(this.page, params);
      done();
    },
    selectionChange(list) {
      this.selectionList = list;
    },
    selectionModelChange(list) {
      this.selectionModelList = list;
    },
    selectionClear() {
      this.selectionList = [];
      this.$refs.crud.toggleSelection();
    },
    currentChange(currentPage) {
      this.page.currentPage = currentPage;
    },
    sizeChange(pageSize) {
      this.page.pageSize = pageSize;
    },
    onLoad(page, params = {}) {
      this.loading = true;
      getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
        const data = res.data.data;
        this.page.total = data.total;
        this.data = data.records;
        this.loading = false;
        this.selectionClear();
      });
    },
    handleModel(row) {
      this.fields = [];
      this.modelBox = true;
      this.loading = true;
      this.modelId = row.id;
      this.datasourceId = row.datasourceId;
      getModelPrototype(this.modelId, this.datasourceId).then(res => {
        const result = res.data;
        if (result.success) {
          this.fields = result.data;
          this.fields.forEach(item => {
            item.$cellEdit = true;
            item.modelId = this.modelId;
            // 根据字段物理类型自动适配实体类型
            if (!validatenull(item.name)) {
              item.jdbcName = item.name;
              item.jdbcType = item.propertyType;
              item.jdbcComment = item.comment;
              if (item.propertyType === "LocalDateTime") {
                item.propertyType = "Date";
                item.propertyEntity = "java.util.Date";
              } else {
                entityDic.forEach(d => {
                  if (d.label === item.propertyType) {
                    item.propertyType = d.label;
                    item.propertyEntity = d.value;
                  }
                });
              }
            }
            // 首次加载配置默认值
            if (validatenull(item.id)) {
              item.isList = 1;
              item.isForm = 1;
              item.isRow = 0;
              item.isRequired = 0;
              item.isQuery = 0;
              item.componentType = "input";
              // 默认不需要显示的字段名配置
              if (this.hideFields.includes(item.jdbcName)) {
                item.isList = 0;
                item.isForm = 0;
                item.isRequired = 0;
              }
            }
          });
          this.loading = false;
    data () {
        return {
            form: {},
            query: {},
            loading: true,
            loadingOption: {
                lock: true,
                text: '物理表读取中',
                spinner: 'el-icon-loading',
                background: 'rgba(0, 0, 0, 0)'
            },
            fullscreenLoading: false,
            page: {
                pageSize: 10,
                currentPage: 1,
                total: 0
            },
            selectionList: [],
            modelBox: false,
            modelId: 0,
            datasourceId: 1,
            tableInfo: {},
            active: 0,
            stepStart: 0,
            stepEnd: 4,
            data: [],
            option: {
                menuWidth: 280,
                ...option,
            },
            optionModel: optionModel,
            formStep: {},
            fields: [],
            selectionModelList: [],
            // 默认不需要显示的字段名
            hideFields: ["id", "tenant_id", "create_user", "create_dept", "create_time", "update_user", "update_time", "status", "is_deleted"]
        }
      });
    },
    handleSubmit() {
      console.log(this.fields);
      this.$confirm("确定提交模型配置?", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      }).then(() => {
        this.fields.forEach(item => {
          entityDic.forEach(d => {
            if (d.value === item.propertyEntity) {
              item.propertyType = d.label;
    watch: {
        'form.datasourceId' () {
            if (!validatenull(this.form.datasourceId)) {
                const fullLoading = this.$loading(this.loadingOption)
                getTableList(this.form.datasourceId).then(res => {
                    const column = this.findObject(this.option.column, "modelTable")
                    column.dicData = res.data.data
                    fullLoading.close()
                }).catch(() => {
                    fullLoading.close()
                })
            }
          });
        });
        submitModelPrototype(this.fields).then(res => {
          const result = res.data;
          if (result.success) {
            this.$message.success(result.msg);
            this.modelBox = false;
          } else {
            this.$message.error(result.msg);
          }
        })
      });
        },
        'form.modelTable' () {
            if (!validatenull(this.form.modelTable)) {
                const fullLoading = this.$loading(this.loadingOption)
                getTableInfoByName(this.form.modelTable, this.form.datasourceId).then(res => {
                    const result = res.data
                    if (result.success) {
                        const { comment, entityName } = result.data
                        if (validatenull(this.form.modelClass)) {
                            this.form.modelClass = entityName
                        }
                        if (validatenull(this.form.modelName)) {
                            this.form.modelName = comment
                        }
                        if (validatenull(this.form.modelCode)) {
                            this.form.modelCode = entityName.replace(/^\S/, s => s.toLowerCase())
                        }
                        fullLoading.close()
                    }
                }).catch(() => {
                    fullLoading.close()
                })
            }
        }
    },
    computed: {
        ...mapGetters(["permission"]),
        permissionList () {
            return {
                addBtn: true,
                delBtn: true,
                editBtn: true,
                viewBtn: false
            }
        },
        ids () {
            let ids = []
            this.selectionList.forEach(ele => {
                ids.push(ele.id)
            })
            return ids.join(",")
        },
    },
    methods: {
        rowSave (row, done, loading) {
            add(row).then((res) => {
                done()
                this.onLoad(this.page)
                this.$message({
                    type: "success",
                    message: "操作成功!"
                })
                this.$confirm("是否进行模型配置?", {
                    confirmButtonText: "确定",
                    cancelButtonText: "取消",
                    type: "warning"
                }).then(() => {
                    let model = {
                        id: res.data.data.id,
                        datasourceId: res.data.data.datasourceId
                    }
                    this.handleModel(model)
                })
            }, error => {
                loading()
                window.console.log(error)
            })
        },
        rowUpdate (row, index, done, loading) {
            update(row).then(() => {
                done()
                this.onLoad(this.page)
                this.$message({
                    type: "success",
                    message: "操作成功!"
                })
            }, error => {
                loading()
                window.console.log(error)
            })
        },
        rowDel (row) {
            this.$confirm("确定将选择数据删除?", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                type: "warning"
            })
                .then(() => {
                    return remove(row.id)
                })
                .then(() => {
                    this.onLoad(this.page)
                    this.$message({
                        type: "success",
                        message: "操作成功!"
                    })
                })
        },
        handleDelete () {
            if (this.selectionList.length === 0) {
                this.$message.warning("请选择至少一条数据")
                return
            }
            this.$confirm("确定将选择数据删除?", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                type: "warning"
            })
                .then(() => {
                    return remove(this.ids)
                })
                .then(() => {
                    this.onLoad(this.page)
                    this.$message({
                        type: "success",
                        message: "操作成功!"
                    })
                    this.$refs.crud.toggleSelection()
                })
        },
        beforeOpen (done, type) {
            if (["edit", "view"].includes(type)) {
                getDetail(this.form.id).then(res => {
                    this.form = res.data.data
                })
            }
            done()
        },
        searchReset () {
            this.query = {}
            this.onLoad(this.page)
        },
        searchChange (params, done) {
            this.query = params
            this.onLoad(this.page, params)
            done()
        },
        selectionChange (list) {
            this.selectionList = list
        },
        selectionModelChange (list) {
            this.selectionModelList = list
        },
        selectionClear () {
            this.selectionList = []
            this.$refs.crud.toggleSelection()
        },
        currentChange (currentPage) {
            this.page.currentPage = currentPage
        },
        sizeChange (pageSize) {
            this.page.pageSize = pageSize
        },
        onLoad (page, params = {}) {
            this.loading = true
            getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
                const data = res.data.data
                this.page.total = data.total
                this.data = data.records
                this.loading = false
                this.selectionClear()
            })
        },
        handleModel (row) {
            this.fields = []
            this.modelBox = true
            this.loading = true
            this.modelId = row.id
            this.datasourceId = row.datasourceId
            getModelPrototype(this.modelId, this.datasourceId).then(res => {
                const result = res.data
                if (result.success) {
                    this.fields = result.data
                    this.fields.forEach(item => {
                        item.$cellEdit = true
                        item.modelId = this.modelId
                        // 根据字段物理类型自动适配实体类型
                        if (!validatenull(item.name)) {
                            item.jdbcName = item.name
                            item.jdbcType = item.propertyType
                            item.jdbcComment = item.comment
                            if (item.propertyType === "LocalDateTime") {
                                item.propertyType = "Date"
                                item.propertyEntity = "java.util.Date"
                            } else {
                                entityDic.forEach(d => {
                                    if (d.label === item.propertyType) {
                                        item.propertyType = d.label
                                        item.propertyEntity = d.value
                                    }
                                })
                            }
                        }
                        // 首次加载配置默认值
                        if (validatenull(item.id)) {
                            item.isList = 1
                            item.isForm = 1
                            item.isRow = 0
                            item.isRequired = 0
                            item.isQuery = 0
                            item.componentType = "input"
                            // 默认不需要显示的字段名配置
                            if (this.hideFields.includes(item.jdbcName)) {
                                item.isList = 0
                                item.isForm = 0
                                item.isRequired = 0
                            }
                        }
                    })
                    this.loading = false
                }
            })
        },
        handleSubmit () {
            console.log(this.fields)
            this.$confirm("确定提交模型配置?", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                type: "warning"
            }).then(() => {
                this.fields.forEach(item => {
                    entityDic.forEach(d => {
                        if (d.value === item.propertyEntity) {
                            item.propertyType = d.label
                        }
                    })
                })
                submitModelPrototype(this.fields).then(res => {
                    const result = res.data
                    if (result.success) {
                        this.$message.success(result.msg)
                        this.modelBox = false
                    } else {
                        this.$message.error(result.msg)
                    }
                })
            })
        }
    }
  }
};
}
</script>
<style>
.none-border {
  border: 0;
  background-color: transparent !important;
    border: 0;
    background-color: transparent !important;
}
.step-div {
  margin-top: 30px;
    margin-top: 30px;
}
</style>
src/views/userHouse/houseHoldList.vue
@@ -159,6 +159,7 @@
          addBtn: true,
          dialogType: 'drawer',
          dialogClickModal: false,
          menuWidth:280,
          column: [{
              label: "姓名",
              prop: "name",
src/views/wel/index.vue
@@ -1,34 +1,161 @@
<template>
  <div>
  </div>
    <div id="homeL">
        <div class="homeL-up">
            <span class="h1">基层智治综合协同平台</span>
            <span class="h2">Grassroots intelligent governance integrated cooperation platform</span>
        </div>
        <div class="homeL-bar">
            <div class="outS" @click="down1">
                <div class="down1"><span>住户管理</span></div>
            </div>
            <div class="outS" @click="down2">
                <div class="down2"><span>房屋管理</span></div>
            </div>
            <div class="outS" @click="down3">
                <div class="down3"><span>E呼即办</span></div>
            </div>
            <div class="outS" @click="down4">
                <div class="down4"><span>报事报修</span></div>
            </div>
            <div class="outS" @click="down5">
                <div class="down5"><span>走访日志</span></div>
            </div>
        </div>
    </div>
</template>
<script>
  import {mapGetters} from "vuex";
  export default {
    name: "wel",
    data() {
      return {
        activeNames: ['1', '2', '3', '5'],
        logActiveNames: ['31']
      };
    },
    computed: {
      ...mapGetters(["userInfo"]),
export default {
    data () {
        return {
            a: 1,
        }
    },
    methods: {
      handleChange(val) {
        window.console.log(val);
      }
        down1 () {
            this.$router.push({ path: "/userHouse/houseHoldList" })
        },
        down2 () {
            this.$router.push({ path: "/userHouse/houseList" })
        },
        down3 () {
            this.$router.push({ path: "/task/eCall/index" })
        },
        down4 () {
            this.$router.push({ path: "/task/reportForRepairs" })
        },
        down5 () {
            this.$router.push({ path: "/grid/gridWorkLog/index" })
        },
    },
  };
    mouted () { },
}
</script>
<style lang="scss">
#homeL {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 96.6%;
<style>
  .el-font-size {
    font-size: 14px;
  }
</style>
    //   border: 1px solid #000;
    .homeL-up {
        width: 100%;
        height: 70%;
        // border: 1px solid rgb(39, 164, 185);
        display: flex;
        align-items: center;
        justify-content: center;
        flex-direction: column;
        background-image: url("../../../public/img/bjkeji.png");
        background-color: #fff;
        background-repeat: no-repeat;
        background-size: 100% 100%;
        -moz-background-size: 100% 100%;
        color: #4BA3FE;
        .h1,
        .h2 {
            position: relative;
            left: 22%;
        }
        .h1 {
            font-size: 54px;
        }
        .h2 {
            font-size: 28px;
        }
    }
    .homeL-bar {
        height: 0;
        flex: 1;
        width: 100%;
        display: flex;
        align-items: center;
        .outS {
            width: 20%;
            height: 94.6%;
            display: flex;
            justify-content: center;
        }
        .down1,
        .down2,
        .down3,
        .down4,
        .down5 {
            width: 96%;
            height: 100%;
            background-repeat: no-repeat;
            background-size: 100% 100%;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 5px;
            &:hover {
                width: 99%;
                height: 99%;
                transition: all 0.3s ease;
            }
            span {
                position: relative;
                top: -30px;
                left: -50px;
                font-weight: 600;
                font-size: 30px;
                color: #fff;
                display: inline-block;
                // border: 1px solid rgb(180, 22, 75);
            }
        }
        .down1 {
            background-image: url("../../../public/img/yijianbaoj.png");
        }
        .down2 {
            background-image: url("../../../public/img/fangyi.png");
        }
        .down3 {
            background-image: url("../../../public/img/anjian.png");
        }
        .down4 {
            background-image: url("../../../public/img/tiwen.png");
        }
        .down5 {
            background-image: url("../../../public/img/tongji.png");
        }
    }
}
</style>
src/views/work/claim.vue
@@ -1,201 +1,182 @@
<template>
  <basic-container>
    <avue-crud :option="option"
               :table-loading="loading"
               :data="data"
               ref="crud"
               v-model="form"
               @search-change="searchChange"
               @search-reset="searchReset"
               @selection-change="selectionChange"
               @current-change="currentChange"
               @size-change="sizeChange"
               @refresh-change="refreshChange"
               @on-load="onLoad">
      <template slot-scope="scope" slot="menu">
        <el-button type="text"
                   size="small"
                   icon="el-icon-download"
                   v-if="permission.work_claim_sign"
                   @click.stop="handleClaim(scope.row)">签收
        </el-button>
        <el-button type="text"
                   size="small"
                   icon="el-icon-info"
                   v-if="permission.work_claim_detail"
                   @click.stop="handleDetail(scope.row)">详情
        </el-button>
        <el-button type="text"
                   size="small"
                   icon="el-icon-search"
                   v-if="permission.work_claim_follow"
                   @click.stop="handleImage(scope.row,scope.index)">流程图
        </el-button>
      </template>
      <template slot-scope="{row}"
                slot="processDefinitionVersion">
        <el-tag>v{{row.processDefinitionVersion}}</el-tag>
      </template>
    </avue-crud>
    <flow-design is-dialog :is-display.sync="flowBox" :process-instance-id="processInstanceId"></flow-design>
  </basic-container>
    <basic-container>
        <avue-crud :option="option" :table-loading="loading" :data="data" ref="crud" v-model="form"
            @search-change="searchChange" @search-reset="searchReset" @selection-change="selectionChange"
            @current-change="currentChange" @size-change="sizeChange" @refresh-change="refreshChange" @on-load="onLoad">
            <template slot-scope="scope" slot="menu">
                <el-button type="text" size="small" icon="el-icon-download" v-if="permission.work_claim_sign"
                    @click.stop="handleClaim(scope.row)">签收
                </el-button>
                <el-button type="text" size="small" icon="el-icon-info" v-if="permission.work_claim_detail"
                    @click.stop="handleDetail(scope.row)">详情
                </el-button>
                <el-button type="text" size="small" icon="el-icon-search" v-if="permission.work_claim_follow"
                    @click.stop="handleImage(scope.row, scope.index)">流程图
                </el-button>
            </template>
            <template slot-scope="{row}" slot="processDefinitionVersion">
                <el-tag>v{{ row.processDefinitionVersion }}</el-tag>
            </template>
        </avue-crud>
        <flow-design is-dialog :is-display.sync="flowBox" :process-instance-id="processInstanceId"></flow-design>
    </basic-container>
</template>
<script>
  import {mapGetters} from "vuex";
  import {claimList, claimTask} from "@/api/work/work";
  import {flowCategory, flowRoute} from "@/util/flow";
import { mapGetters } from "vuex"
import { claimList, claimTask } from "@/api/work/work"
import { flowCategory, flowRoute } from "@/util/flow"
  export default {
    data() {
      return {
        form: {},
        selectionId: '',
        selectionList: [],
        query: {},
        loading: true,
        page: {
          pageSize: 10,
          currentPage: 1,
          total: 0
        },
        processInstanceId: '',
        flowBox: false,
        workBox: false,
        option: {
          height: 'auto',
          calcHeight: 30,
          tip: false,
          simplePage: true,
          searchShow: true,
          searchMenuSpan: 6,
          border: true,
          index: true,
          selection: true,
          editBtn: false,
          addBtn: false,
          viewBtn: false,
          delBtn: false,
          dialogWidth: 900,
          menuWidth: 200,
          dialogClickModal: false,
          column: [
            {
              label: "流程分类",
              type: "select",
              row: true,
              dicUrl: "/api/blade-system/dict/dictionary?code=flow",
              props: {
                label: "dictValue",
                value: "dictKey"
              },
              dataType: "number",
              slot: true,
              prop: "category",
              search: true,
              hide: true,
              width: 100,
export default {
    data () {
        return {
            form: {},
            selectionId: '',
            selectionList: [],
            query: {},
            loading: true,
            page: {
                pageSize: 10,
                currentPage: 1,
                total: 0
            },
            {
              label: '流程名称',
              prop: 'processDefinitionName',
              search: true,
            processInstanceId: '',
            flowBox: false,
            workBox: false,
            option: {
                height: 'auto',
                calcHeight: 30,
                tip: false,
                simplePage: true,
                searchShow: true,
                searchMenuSpan: 6,
                border: true,
                index: true,
                selection: true,
                editBtn: false,
                addBtn: false,
                viewBtn: false,
                delBtn: false,
                dialogWidth: 900,
                menuWidth: 280,
                dialogClickModal: false,
                column: [
                    {
                        label: "流程分类",
                        type: "select",
                        row: true,
                        dicUrl: "/api/blade-system/dict/dictionary?code=flow",
                        props: {
                            label: "dictValue",
                            value: "dictKey"
                        },
                        dataType: "number",
                        slot: true,
                        prop: "category",
                        search: true,
                        hide: true,
                        width: 100,
                    },
                    {
                        label: '流程名称',
                        prop: 'processDefinitionName',
                        search: true,
                    },
                    {
                        label: '当前步骤',
                        prop: 'taskName',
                    },
                    {
                        label: '流程版本',
                        prop: 'processDefinitionVersion',
                        slot: true,
                        width: 80,
                    },
                    {
                        label: '申请时间',
                        prop: 'createTime',
                        width: 165,
                    },
                ]
            },
            {
              label: '当前步骤',
              prop: 'taskName',
            },
            {
              label: '流程版本',
              prop: 'processDefinitionVersion',
              slot: true,
              width: 80,
            },
            {
              label: '申请时间',
              prop: 'createTime',
              width: 165,
            },
          ]
        },
        data: []
      };
            data: []
        }
    },
    computed: {
      ...mapGetters(["permission", "flowRoutes"]),
      ids() {
        let ids = [];
        this.selectionList.forEach(ele => {
          ids.push(ele.id);
        });
        return ids.join(",");
      },
        ...mapGetters(["permission", "flowRoutes"]),
        ids () {
            let ids = []
            this.selectionList.forEach(ele => {
                ids.push(ele.id)
            })
            return ids.join(",")
        },
    },
    methods: {
      searchReset() {
        this.query = {};
        this.onLoad(this.page);
      },
      searchChange(params, done) {
        this.query = params;
        this.page.currentPage = 1;
        this.onLoad(this.page, params);
        done();
      },
      selectionChange(list) {
        this.selectionList = list;
      },
      selectionClear() {
        this.selectionList = [];
        this.$refs.crud.toggleSelection();
      },
      handleClaim(row) {
        this.$confirm("确定签收此任务?", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        })
          .then(() => {
            return claimTask(row.taskId);
          })
          .then(() => {
            this.onLoad(this.page);
            this.$message({
              type: "success",
              message: "操作成功!"
            });
          });
      },
      handleDetail(row) {
        this.$router.push({path: `/work/process/${flowRoute(this.flowRoutes, row.category)}/detail/${row.processInstanceId}/${row.businessId}`});
      },
      handleImage(row) {
        this.processInstanceId = row.processInstanceId;
        this.flowBox = true;
      },
      currentChange(currentPage){
        this.page.currentPage = currentPage;
      },
      sizeChange(pageSize){
        this.page.pageSize = pageSize;
      },
      refreshChange() {
        this.onLoad(this.page, this.query);
      },
      onLoad(page, params = {}) {
        const query = {
          ...this.query,
          category: (params.category) ? flowCategory(params.category) : null
        };
        this.loading = true;
        claimList(page.currentPage, page.pageSize, Object.assign(params, query)).then(res => {
          const data = res.data.data;
          this.page.total = data.total;
          this.data = data.records;
          this.loading = false;
          this.selectionClear();
        });
      }
        searchReset () {
            this.query = {}
            this.onLoad(this.page)
        },
        searchChange (params, done) {
            this.query = params
            this.page.currentPage = 1
            this.onLoad(this.page, params)
            done()
        },
        selectionChange (list) {
            this.selectionList = list
        },
        selectionClear () {
            this.selectionList = []
            this.$refs.crud.toggleSelection()
        },
        handleClaim (row) {
            this.$confirm("确定签收此任务?", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                type: "warning"
            })
                .then(() => {
                    return claimTask(row.taskId)
                })
                .then(() => {
                    this.onLoad(this.page)
                    this.$message({
                        type: "success",
                        message: "操作成功!"
                    })
                })
        },
        handleDetail (row) {
            this.$router.push({ path: `/work/process/${flowRoute(this.flowRoutes, row.category)}/detail/${row.processInstanceId}/${row.businessId}` })
        },
        handleImage (row) {
            this.processInstanceId = row.processInstanceId
            this.flowBox = true
        },
        currentChange (currentPage) {
            this.page.currentPage = currentPage
        },
        sizeChange (pageSize) {
            this.page.pageSize = pageSize
        },
        refreshChange () {
            this.onLoad(this.page, this.query)
        },
        onLoad (page, params = {}) {
            const query = {
                ...this.query,
                category: (params.category) ? flowCategory(params.category) : null
            }
            this.loading = true
            claimList(page.currentPage, page.pageSize, Object.assign(params, query)).then(res => {
                const data = res.data.data
                this.page.total = data.total
                this.data = data.records
                this.loading = false
                this.selectionClear()
            })
        }
    }
  };
}
</script>
src/views/work/done.vue
@@ -1,178 +1,161 @@
<template>
  <basic-container>
    <avue-crud :option="option"
               :table-loading="loading"
               :data="data"
               ref="crud"
               v-model="form"
               :page.sync="page"
               @search-change="searchChange"
               @search-reset="searchReset"
               @selection-change="selectionChange"
               @current-change="currentChange"
               @size-change="sizeChange"
               @refresh-change="refreshChange"
               @on-load="onLoad">
      <template slot-scope="scope" slot="menu">
        <el-button type="text"
                   size="small"
                   icon="el-icon-info"
                   v-if="permission.work_done_detail"
                   @click.stop="handleDetail(scope.row)">详情
        </el-button>
        <el-button type="text"
                   size="small"
                   icon="el-icon-search"
                   v-if="permission.work_done_follow"
                   @click.stop="handleImage(scope.row,scope.index)">流程图
        </el-button>
      </template>
      <template slot-scope="{row}"
                slot="processDefinitionVersion">
        <el-tag>v{{row.processDefinitionVersion}}</el-tag>
      </template>
    </avue-crud>
    <flow-design is-dialog :is-display.sync="flowBox" :process-instance-id="processInstanceId"></flow-design>
  </basic-container>
    <basic-container>
        <avue-crud :option="option" :table-loading="loading" :data="data" ref="crud" v-model="form" :page.sync="page"
            @search-change="searchChange" @search-reset="searchReset" @selection-change="selectionChange"
            @current-change="currentChange" @size-change="sizeChange" @refresh-change="refreshChange" @on-load="onLoad">
            <template slot-scope="scope" slot="menu">
                <el-button type="text" size="small" icon="el-icon-info" v-if="permission.work_done_detail"
                    @click.stop="handleDetail(scope.row)">详情
                </el-button>
                <el-button type="text" size="small" icon="el-icon-search" v-if="permission.work_done_follow"
                    @click.stop="handleImage(scope.row, scope.index)">流程图
                </el-button>
            </template>
            <template slot-scope="{row}" slot="processDefinitionVersion">
                <el-tag>v{{ row.processDefinitionVersion }}</el-tag>
            </template>
        </avue-crud>
        <flow-design is-dialog :is-display.sync="flowBox" :process-instance-id="processInstanceId"></flow-design>
    </basic-container>
</template>
<script>
  import {mapGetters} from "vuex";
  import {doneList} from "@/api/work/work";
  import {flowCategory, flowRoute} from "@/util/flow";
import { mapGetters } from "vuex"
import { doneList } from "@/api/work/work"
import { flowCategory, flowRoute } from "@/util/flow"
  export default {
    data() {
      return {
        form: {},
        selectionId: '',
        selectionList: [],
        query: {},
        loading: true,
        page: {
          pageSize: 10,
          currentPage: 1,
          total: 0
        },
        processInstanceId: '',
        flowBox: false,
        workBox: false,
        option: {
          height: 'auto',
          calcHeight: 30,
          tip: false,
          searchShow: true,
          searchMenuSpan: 6,
          border: true,
          index: true,
          selection: true,
          editBtn: false,
          addBtn: false,
          viewBtn: false,
          delBtn: false,
          dialogWidth: 900,
          menuWidth: 150,
          dialogClickModal: false,
          column: [
            {
              label: "流程分类",
              type: "select",
              row: true,
              dicUrl: "/api/blade-system/dict/dictionary?code=flow",
              props: {
                label: "dictValue",
                value: "dictKey"
              },
              dataType: "number",
              slot: true,
              prop: "category",
              search: true,
              hide: true,
              width: 100,
export default {
    data () {
        return {
            form: {},
            selectionId: '',
            selectionList: [],
            query: {},
            loading: true,
            page: {
                pageSize: 10,
                currentPage: 1,
                total: 0
            },
            {
              label: '流程名称',
              prop: 'processDefinitionName',
              search: true,
            processInstanceId: '',
            flowBox: false,
            workBox: false,
            option: {
                height: 'auto',
                calcHeight: 30,
                tip: false,
                searchShow: true,
                searchMenuSpan: 6,
                border: true,
                index: true,
                selection: true,
                editBtn: false,
                addBtn: false,
                viewBtn: false,
                delBtn: false,
                dialogWidth: 900,
                menuWidth: 280,
                dialogClickModal: false,
                column: [
                    {
                        label: "流程分类",
                        type: "select",
                        row: true,
                        dicUrl: "/api/blade-system/dict/dictionary?code=flow",
                        props: {
                            label: "dictValue",
                            value: "dictKey"
                        },
                        dataType: "number",
                        slot: true,
                        prop: "category",
                        search: true,
                        hide: true,
                        width: 100,
                    },
                    {
                        label: '流程名称',
                        prop: 'processDefinitionName',
                        search: true,
                    },
                    {
                        label: '当前步骤',
                        prop: 'taskName',
                    },
                    {
                        label: '流程版本',
                        prop: 'processDefinitionVersion',
                        slot: true,
                        width: 80,
                    },
                    {
                        label: '申请时间',
                        prop: 'createTime',
                        width: 165,
                    },
                ]
            },
            {
              label: '当前步骤',
              prop: 'taskName',
            },
            {
              label: '流程版本',
              prop: 'processDefinitionVersion',
              slot: true,
              width: 80,
            },
            {
              label: '申请时间',
              prop: 'createTime',
              width: 165,
            },
          ]
        },
        data: []
      };
            data: []
        }
    },
    computed: {
      ...mapGetters(["permission", "flowRoutes"]),
      ids() {
        let ids = [];
        this.selectionList.forEach(ele => {
          ids.push(ele.id);
        });
        return ids.join(",");
      },
        ...mapGetters(["permission", "flowRoutes"]),
        ids () {
            let ids = []
            this.selectionList.forEach(ele => {
                ids.push(ele.id)
            })
            return ids.join(",")
        },
    },
    methods: {
      searchReset() {
        this.query = {};
        this.onLoad(this.page);
      },
      searchChange(params, done) {
        this.query = params;
        this.page.currentPage = 1;
        this.onLoad(this.page, params);
        done();
      },
      selectionChange(list) {
        this.selectionList = list;
      },
      selectionClear() {
        this.selectionList = [];
        this.$refs.crud.toggleSelection();
      },
      handleDetail(row) {
        this.$router.push({path: `/work/process/${flowRoute(this.flowRoutes, row.category)}/detail/${row.processInstanceId}/${row.businessId}`});
      },
      handleImage(row) {
        this.processInstanceId = row.processInstanceId;
        this.flowBox = true;
      },
      currentChange(currentPage){
        this.page.currentPage = currentPage;
      },
      sizeChange(pageSize){
        this.page.pageSize = pageSize;
      },
      refreshChange() {
        this.onLoad(this.page, this.query);
      },
      onLoad(page, params = {}) {
        const query = {
          ...this.query,
          category: (params.category) ? flowCategory(params.category) : null
        };
        this.loading = true;
        doneList(page.currentPage, page.pageSize, Object.assign(params, query)).then(res => {
          const data = res.data.data;
          this.page.total = data.total;
          this.data = data.records;
          this.loading = false;
          this.selectionClear();
        });
      }
        searchReset () {
            this.query = {}
            this.onLoad(this.page)
        },
        searchChange (params, done) {
            this.query = params
            this.page.currentPage = 1
            this.onLoad(this.page, params)
            done()
        },
        selectionChange (list) {
            this.selectionList = list
        },
        selectionClear () {
            this.selectionList = []
            this.$refs.crud.toggleSelection()
        },
        handleDetail (row) {
            this.$router.push({ path: `/work/process/${flowRoute(this.flowRoutes, row.category)}/detail/${row.processInstanceId}/${row.businessId}` })
        },
        handleImage (row) {
            this.processInstanceId = row.processInstanceId
            this.flowBox = true
        },
        currentChange (currentPage) {
            this.page.currentPage = currentPage
        },
        sizeChange (pageSize) {
            this.page.pageSize = pageSize
        },
        refreshChange () {
            this.onLoad(this.page, this.query)
        },
        onLoad (page, params = {}) {
            const query = {
                ...this.query,
                category: (params.category) ? flowCategory(params.category) : null
            }
            this.loading = true
            doneList(page.currentPage, page.pageSize, Object.assign(params, query)).then(res => {
                const data = res.data.data
                this.page.total = data.total
                this.data = data.records
                this.loading = false
                this.selectionClear()
            })
        }
    }
  };
}
</script>
src/views/work/send.vue
@@ -1,188 +1,170 @@
<template>
  <basic-container>
    <avue-crud :option="option"
               :table-loading="loading"
               :data="data"
               ref="crud"
               v-model="form"
               :page.sync="page"
               @search-change="searchChange"
               @search-reset="searchReset"
               @selection-change="selectionChange"
               @current-change="currentChange"
               @size-change="sizeChange"
               @refresh-change="refreshChange"
               @on-load="onLoad">
      <template slot-scope="scope" slot="menu">
        <el-button type="text"
                   size="small"
                   icon="el-icon-info"
                   v-if="permission.work_send_detail"
                   @click.stop="handleDetail(scope.row)">详情
        </el-button>
        <el-button type="text"
                   size="small"
                   icon="el-icon-search"
                   v-if="permission.work_send_follow"
                   @click.stop="handleImage(scope.row,scope.index)">流程图
        </el-button>
      </template>
      <template slot-scope="{row}"
                slot="processDefinitionVersion">
        <el-tag>v{{row.processDefinitionVersion}}</el-tag>
      </template>
      <template slot-scope="{row}"
                slot="processIsFinished">
        <el-tag>{{row.processIsFinished==='finished' ? '已完成' : '未完成'}}</el-tag>
      </template>
    </avue-crud>
    <flow-design is-dialog :is-display.sync="flowBox" :process-instance-id="processInstanceId"></flow-design>
  </basic-container>
    <basic-container>
        <avue-crud :option="option" :table-loading="loading" :data="data" ref="crud" v-model="form" :page.sync="page"
            @search-change="searchChange" @search-reset="searchReset" @selection-change="selectionChange"
            @current-change="currentChange" @size-change="sizeChange" @refresh-change="refreshChange" @on-load="onLoad">
            <template slot-scope="scope" slot="menu">
                <el-button type="text" size="small" icon="el-icon-info" v-if="permission.work_send_detail"
                    @click.stop="handleDetail(scope.row)">详情
                </el-button>
                <el-button type="text" size="small" icon="el-icon-search" v-if="permission.work_send_follow"
                    @click.stop="handleImage(scope.row, scope.index)">流程图
                </el-button>
            </template>
            <template slot-scope="{row}" slot="processDefinitionVersion">
                <el-tag>v{{ row.processDefinitionVersion }}</el-tag>
            </template>
            <template slot-scope="{row}" slot="processIsFinished">
                <el-tag>{{ row.processIsFinished === 'finished' ? '已完成' : '未完成' }}</el-tag>
            </template>
        </avue-crud>
        <flow-design is-dialog :is-display.sync="flowBox" :process-instance-id="processInstanceId"></flow-design>
    </basic-container>
</template>
<script>
  import {mapGetters} from "vuex";
  import {sendList} from "@/api/work/work";
  import {flowCategory,flowRoute} from "@/util/flow";
import { mapGetters } from "vuex"
import { sendList } from "@/api/work/work"
import { flowCategory, flowRoute } from "@/util/flow"
  export default {
    data() {
      return {
        form: {},
        selectionId: '',
        selectionList: [],
        query: {},
        loading: true,
        page: {
          pageSize: 10,
          currentPage: 1,
          total: 0
        },
        processInstanceId: '',
        flowBox: false,
        workBox: false,
        option: {
          height: 'auto',
          calcHeight: 30,
          tip: false,
          searchShow: true,
          searchMenuSpan: 6,
          border: true,
          index: true,
          selection: true,
          editBtn: false,
          addBtn: false,
          viewBtn: false,
          delBtn: false,
          dialogWidth: 900,
          menuWidth: 150,
          dialogClickModal: false,
          column: [
            {
              label: "流程分类",
              type: "select",
              row: true,
              dicUrl: "/api/blade-system/dict/dictionary?code=flow",
              props: {
                label: "dictValue",
                value: "dictKey"
              },
              dataType: "number",
              slot: true,
              prop: "category",
              search: true,
              hide: true,
              width: 100,
export default {
    data () {
        return {
            form: {},
            selectionId: '',
            selectionList: [],
            query: {},
            loading: true,
            page: {
                pageSize: 10,
                currentPage: 1,
                total: 0
            },
            {
              label: '流程名称',
              prop: 'processDefinitionName',
              search: true,
            processInstanceId: '',
            flowBox: false,
            workBox: false,
            option: {
                height: 'auto',
                calcHeight: 30,
                tip: false,
                searchShow: true,
                searchMenuSpan: 6,
                border: true,
                index: true,
                selection: true,
                editBtn: false,
                addBtn: false,
                viewBtn: false,
                delBtn: false,
                dialogWidth: 900,
                menuWidth: 280,
                dialogClickModal: false,
                column: [
                    {
                        label: "流程分类",
                        type: "select",
                        row: true,
                        dicUrl: "/api/blade-system/dict/dictionary?code=flow",
                        props: {
                            label: "dictValue",
                            value: "dictKey"
                        },
                        dataType: "number",
                        slot: true,
                        prop: "category",
                        search: true,
                        hide: true,
                        width: 100,
                    },
                    {
                        label: '流程名称',
                        prop: 'processDefinitionName',
                        search: true,
                    },
                    {
                        label: '当前步骤',
                        prop: 'taskName',
                    },
                    {
                        label: '流程版本',
                        prop: 'processDefinitionVersion',
                        slot: true,
                        width: 80,
                    },
                    {
                        label: '流程进度',
                        prop: 'processIsFinished',
                        slot: true,
                        width: 80,
                    },
                    {
                        label: '申请时间',
                        prop: 'createTime',
                        width: 165,
                    },
                ]
            },
            {
              label: '当前步骤',
              prop: 'taskName',
            },
            {
              label: '流程版本',
              prop: 'processDefinitionVersion',
              slot: true,
              width: 80,
            },
            {
              label: '流程进度',
              prop: 'processIsFinished',
              slot: true,
              width: 80,
            },
            {
              label: '申请时间',
              prop: 'createTime',
              width: 165,
            },
          ]
        },
        data: []
      };
            data: []
        }
    },
    computed: {
      ...mapGetters(["permission", "flowRoutes"]),
      ids() {
        let ids = [];
        this.selectionList.forEach(ele => {
          ids.push(ele.id);
        });
        return ids.join(",");
      },
        ...mapGetters(["permission", "flowRoutes"]),
        ids () {
            let ids = []
            this.selectionList.forEach(ele => {
                ids.push(ele.id)
            })
            return ids.join(",")
        },
    },
    methods: {
      searchReset() {
        this.query = {};
        this.onLoad(this.page);
      },
      searchChange(params, done) {
        this.query = params;
        this.page.currentPage = 1;
        this.onLoad(this.page, params);
        done();
      },
      selectionChange(list) {
        this.selectionList = list;
      },
      selectionClear() {
        this.selectionList = [];
        this.$refs.crud.toggleSelection();
      },
      handleDetail(row) {
        this.$router.push({ path: `/work/process/${flowRoute(this.flowRoutes, row.category)}/detail/${row.processInstanceId}/${row.businessId}` });
      },
      handleImage(row) {
        this.processInstanceId = row.processInstanceId;
        this.flowBox = true;
      },
      currentChange(currentPage){
        this.page.currentPage = currentPage;
      },
      sizeChange(pageSize){
        this.page.pageSize = pageSize;
      },
      refreshChange() {
        this.onLoad(this.page, this.query);
      },
      onLoad(page, params = {}) {
        const query = {
          ...this.query,
          category: (params.category) ? flowCategory(params.category) : null
        };
        this.loading = true;
        sendList(page.currentPage, page.pageSize, Object.assign(params, query)).then(res => {
          const data = res.data.data;
          this.page.total = data.total;
          this.data = data.records;
          this.loading = false;
          this.selectionClear();
        });
      }
        searchReset () {
            this.query = {}
            this.onLoad(this.page)
        },
        searchChange (params, done) {
            this.query = params
            this.page.currentPage = 1
            this.onLoad(this.page, params)
            done()
        },
        selectionChange (list) {
            this.selectionList = list
        },
        selectionClear () {
            this.selectionList = []
            this.$refs.crud.toggleSelection()
        },
        handleDetail (row) {
            this.$router.push({ path: `/work/process/${flowRoute(this.flowRoutes, row.category)}/detail/${row.processInstanceId}/${row.businessId}` })
        },
        handleImage (row) {
            this.processInstanceId = row.processInstanceId
            this.flowBox = true
        },
        currentChange (currentPage) {
            this.page.currentPage = currentPage
        },
        sizeChange (pageSize) {
            this.page.pageSize = pageSize
        },
        refreshChange () {
            this.onLoad(this.page, this.query)
        },
        onLoad (page, params = {}) {
            const query = {
                ...this.query,
                category: (params.category) ? flowCategory(params.category) : null
            }
            this.loading = true
            sendList(page.currentPage, page.pageSize, Object.assign(params, query)).then(res => {
                const data = res.data.data
                this.page.total = data.total
                this.data = data.records
                this.loading = false
                this.selectionClear()
            })
        }
    }
  };
}
</script>
src/views/work/start.vue
@@ -1,214 +1,194 @@
<template>
  <basic-container>
    <avue-crud :option="option"
               :table-loading="loading"
               :data="data"
               :page.sync="page"
               v-model="form"
               ref="crud"
               @search-change="searchChange"
               @search-reset="searchReset"
               @selection-change="selectionChange"
               @current-change="currentChange"
               @size-change="sizeChange"
               @refresh-change="refreshChange"
               @on-load="onLoad">
      <template slot="menuLeft">
        <el-radio-group v-model="mode" size="small">
          <el-radio-button label="1">通用流程</el-radio-button>
          <el-radio-button label="2">定制流程</el-radio-button>
        </el-radio-group>
      </template>
      <template slot-scope="scope" slot="menu">
        <el-button type="text"
                   size="small"
                   icon="el-icon-video-play"
                   v-if="permission.work_start_flow"
                   @click.stop="handleStart(scope.row)">发起
        </el-button>
        <el-button type="text"
                   size="small"
                   icon="el-icon-search"
                   v-if="permission.work_start_image"
                   @click.stop="handleImage(scope.row,scope.index)">流程图
        </el-button>
      </template>
      <template slot-scope="{row}"
                slot="tenantId">
        <el-tag>{{row.tenantId===''?'通用':row.tenantId}}</el-tag>
      </template>
      <template slot-scope="{row}"
                slot="version">
        <el-tag>v{{row.version}}</el-tag>
      </template>
      <template slot-scope="{row}"
                slot="suspensionState">
        <el-tag>{{row.suspensionState===1?'激活':'挂起'}}</el-tag>
      </template>
      <template slot-scope="{row}"
                slot="category">
        <el-tag>{{row.categoryName}}</el-tag>
      </template>
    </avue-crud>
    <flow-design is-dialog :is-display.sync="flowBox" :process-definition-id="processDefinitionId"></flow-design>
  </basic-container>
    <basic-container>
        <avue-crud :option="option" :table-loading="loading" :data="data" :page.sync="page" v-model="form" ref="crud"
            @search-change="searchChange" @search-reset="searchReset" @selection-change="selectionChange"
            @current-change="currentChange" @size-change="sizeChange" @refresh-change="refreshChange" @on-load="onLoad">
            <template slot="menuLeft">
                <el-radio-group v-model="mode" size="small">
                    <el-radio-button label="1">通用流程</el-radio-button>
                    <el-radio-button label="2">定制流程</el-radio-button>
                </el-radio-group>
            </template>
            <template slot-scope="scope" slot="menu">
                <el-button type="text" size="small" icon="el-icon-video-play" v-if="permission.work_start_flow"
                    @click.stop="handleStart(scope.row)">发起
                </el-button>
                <el-button type="text" size="small" icon="el-icon-search" v-if="permission.work_start_image"
                    @click.stop="handleImage(scope.row, scope.index)">流程图
                </el-button>
            </template>
            <template slot-scope="{row}" slot="tenantId">
                <el-tag>{{ row.tenantId === '' ? '通用' : row.tenantId }}</el-tag>
            </template>
            <template slot-scope="{row}" slot="version">
                <el-tag>v{{ row.version }}</el-tag>
            </template>
            <template slot-scope="{row}" slot="suspensionState">
                <el-tag>{{ row.suspensionState === 1 ? '激活' : '挂起' }}</el-tag>
            </template>
            <template slot-scope="{row}" slot="category">
                <el-tag>{{ row.categoryName }}</el-tag>
            </template>
        </avue-crud>
        <flow-design is-dialog :is-display.sync="flowBox" :process-definition-id="processDefinitionId"></flow-design>
    </basic-container>
</template>
<script>
  import {mapGetters} from "vuex";
  import {startList} from "@/api/work/work";
  import {flowCategory, flowRoute} from "@/util/flow";
import { mapGetters } from "vuex"
import { startList } from "@/api/work/work"
import { flowCategory, flowRoute } from "@/util/flow"
  export default {
    data() {
      return {
        form: {},
        mode: '1',
        selectionId: '',
        selectionList: [],
        query: {},
        loading: true,
        page: {
          pageSize: 10,
          currentPage: 1,
          total: 0
        },
        processDefinitionId: '',
        flowBox: false,
        workBox: false,
        option: {
          height: 'auto',
          calcHeight: 30,
          tip: false,
          searchShow: true,
          searchMenuSpan: 6,
          border: true,
          index: true,
          selection: true,
          editBtn: false,
          addBtn: false,
          viewBtn: false,
          delBtn: false,
          menuWidth: 150,
          dialogWidth: 900,
          dialogClickModal: false,
          column: [
            {
              label: '租户编号',
              prop: 'tenantId',
              slot: true,
              width: 120,
export default {
    data () {
        return {
            form: {},
            mode: '1',
            selectionId: '',
            selectionList: [],
            query: {},
            loading: true,
            page: {
                pageSize: 10,
                currentPage: 1,
                total: 0
            },
            {
              label: "流程分类",
              type: "select",
              row: true,
              dicUrl: "/api/blade-system/dict/dictionary?code=flow",
              props: {
                label: "dictValue",
                value: "dictKey"
              },
              dataType: "number",
              slot: true,
              prop: "category",
              search: true,
              width: 100,
            processDefinitionId: '',
            flowBox: false,
            workBox: false,
            option: {
                height: 'auto',
                calcHeight: 30,
                tip: false,
                searchShow: true,
                searchMenuSpan: 6,
                border: true,
                index: true,
                selection: true,
                editBtn: false,
                addBtn: false,
                viewBtn: false,
                delBtn: false,
                menuWidth: 280,
                dialogWidth: 900,
                dialogClickModal: false,
                column: [
                    {
                        label: '租户编号',
                        prop: 'tenantId',
                        slot: true,
                        width: 120,
                    },
                    {
                        label: "流程分类",
                        type: "select",
                        row: true,
                        dicUrl: "/api/blade-system/dict/dictionary?code=flow",
                        props: {
                            label: "dictValue",
                            value: "dictKey"
                        },
                        dataType: "number",
                        slot: true,
                        prop: "category",
                        search: true,
                        width: 100,
                    },
                    {
                        label: '流程标识',
                        prop: 'key',
                    },
                    {
                        label: '流程名称',
                        prop: 'name',
                        search: true,
                    },
                    {
                        label: '流程版本',
                        prop: 'version',
                        slot: true,
                        width: 80,
                    },
                    {
                        label: '状态',
                        prop: 'suspensionState',
                        slot: true,
                        width: 80,
                    },
                    {
                        label: '部署时间',
                        prop: 'deploymentTime',
                        width: 165,
                    },
                ]
            },
            {
              label: '流程标识',
              prop: 'key',
            },
            {
              label: '流程名称',
              prop: 'name',
              search: true,
            },
            {
              label: '流程版本',
              prop: 'version',
              slot: true,
              width: 80,
            },
            {
              label: '状态',
              prop: 'suspensionState',
              slot: true,
              width: 80,
            },
            {
              label: '部署时间',
              prop: 'deploymentTime',
              width: 165,
            },
          ]
        },
        data: []
      };
            data: []
        }
    },
    watch: {
      'mode'() {
        this.onLoad(this.page);
      }
        'mode' () {
            this.onLoad(this.page)
        }
    },
    computed: {
      ...mapGetters(["permission", "flowRoutes"]),
      ids() {
        let ids = [];
        this.selectionList.forEach(ele => {
          ids.push(ele.id);
        });
        return ids.join(",");
      },
        ...mapGetters(["permission", "flowRoutes"]),
        ids () {
            let ids = []
            this.selectionList.forEach(ele => {
                ids.push(ele.id)
            })
            return ids.join(",")
        },
    },
    methods: {
      searchReset() {
        this.query = {};
        this.onLoad(this.page);
      },
      searchChange(params, done) {
        this.query = params;
        this.page.currentPage = 1;
        this.onLoad(this.page, params);
        done();
      },
      selectionChange(list) {
        this.selectionList = list;
      },
      selectionClear() {
        this.selectionList = [];
        this.$refs.crud.toggleSelection();
      },
      handleStart(row) {
        this.$router.push({path: `/work/process/${flowRoute(this.flowRoutes, row.category)}/form/${row.id}`});
      },
      handleImage(row) {
        this.processDefinitionId = row.id;
        this.flowBox = true;
      },
      currentChange(currentPage) {
        this.page.currentPage = currentPage;
      },
      sizeChange(pageSize) {
        this.page.pageSize = pageSize;
      },
      refreshChange() {
        this.onLoad(this.page, this.query);
      },
      onLoad(page, params = {}) {
        const query = {
          ...this.query,
          category: (params.category) ? flowCategory(params.category) : null,
          mode: this.mode
        };
        this.loading = true;
        startList(page.currentPage, page.pageSize, Object.assign(params, query)).then(res => {
          const data = res.data.data;
          this.page.total = data.total;
          this.data = data.records;
          this.loading = false;
          this.selectionClear();
        });
      }
        searchReset () {
            this.query = {}
            this.onLoad(this.page)
        },
        searchChange (params, done) {
            this.query = params
            this.page.currentPage = 1
            this.onLoad(this.page, params)
            done()
        },
        selectionChange (list) {
            this.selectionList = list
        },
        selectionClear () {
            this.selectionList = []
            this.$refs.crud.toggleSelection()
        },
        handleStart (row) {
            this.$router.push({ path: `/work/process/${flowRoute(this.flowRoutes, row.category)}/form/${row.id}` })
        },
        handleImage (row) {
            this.processDefinitionId = row.id
            this.flowBox = true
        },
        currentChange (currentPage) {
            this.page.currentPage = currentPage
        },
        sizeChange (pageSize) {
            this.page.pageSize = pageSize
        },
        refreshChange () {
            this.onLoad(this.page, this.query)
        },
        onLoad (page, params = {}) {
            const query = {
                ...this.query,
                category: (params.category) ? flowCategory(params.category) : null,
                mode: this.mode
            }
            this.loading = true
            startList(page.currentPage, page.pageSize, Object.assign(params, query)).then(res => {
                const data = res.data.data
                this.page.total = data.total
                this.data = data.records
                this.loading = false
                this.selectionClear()
            })
        }
    }
  };
}
</script>
src/views/work/todo.vue
@@ -1,187 +1,168 @@
<template>
  <basic-container>
    <avue-crud :option="option"
               :table-loading="loading"
               :data="data"
               ref="crud"
               v-model="form"
               @search-change="searchChange"
               @search-reset="searchReset"
               @selection-change="selectionChange"
               @current-change="currentChange"
               @size-change="sizeChange"
               @refresh-change="refreshChange"
               @on-load="onLoad">
      <template slot-scope="scope" slot="menu">
        <el-button type="text"
                   size="small"
                   icon="el-icon-s-check"
                   v-if="permission.work_todo_handle"
                   @click.stop="handleWork(scope.row)">处理
        </el-button>
        <el-button type="text"
                   size="small"
                   icon="el-icon-info"
                   v-if="permission.work_todo_detail"
                   @click.stop="handleDetail(scope.row)">详情
        </el-button>
        <el-button type="text"
                   size="small"
                   icon="el-icon-search"
                   v-if="permission.work_todo_follow"
                   @click.stop="handleImage(scope.row,scope.index)">流程图
        </el-button>
      </template>
      <template slot-scope="{row}"
                slot="processDefinitionVersion">
        <el-tag>v{{row.processDefinitionVersion}}</el-tag>
      </template>
    </avue-crud>
    <flow-design is-dialog :is-display.sync="flowBox" :process-instance-id="processInstanceId"></flow-design>
  </basic-container>
    <basic-container>
        <avue-crud :option="option" :table-loading="loading" :data="data" ref="crud" v-model="form"
            @search-change="searchChange" @search-reset="searchReset" @selection-change="selectionChange"
            @current-change="currentChange" @size-change="sizeChange" @refresh-change="refreshChange" @on-load="onLoad">
            <template slot-scope="scope" slot="menu">
                <el-button type="text" size="small" icon="el-icon-s-check" v-if="permission.work_todo_handle"
                    @click.stop="handleWork(scope.row)">处理
                </el-button>
                <el-button type="text" size="small" icon="el-icon-info" v-if="permission.work_todo_detail"
                    @click.stop="handleDetail(scope.row)">详情
                </el-button>
                <el-button type="text" size="small" icon="el-icon-search" v-if="permission.work_todo_follow"
                    @click.stop="handleImage(scope.row, scope.index)">流程图
                </el-button>
            </template>
            <template slot-scope="{row}" slot="processDefinitionVersion">
                <el-tag>v{{ row.processDefinitionVersion }}</el-tag>
            </template>
        </avue-crud>
        <flow-design is-dialog :is-display.sync="flowBox" :process-instance-id="processInstanceId"></flow-design>
    </basic-container>
</template>
<script>
  import {mapGetters} from "vuex";
  import {todoList} from "@/api/work/work";
  import {flowCategory,flowRoute} from "@/util/flow";
import { mapGetters } from "vuex"
import { todoList } from "@/api/work/work"
import { flowCategory, flowRoute } from "@/util/flow"
  export default {
    data() {
      return {
        form: {},
        selectionId: '',
        selectionList: [],
        query: {},
        loading: true,
        page: {
          pageSize: 10,
          currentPage: 1,
          total: 0
        },
        processInstanceId: '',
        flowBox: false,
        workBox: false,
        option: {
          height: 'auto',
          calcHeight: 30,
          tip: false,
          simplePage: true,
          searchShow: true,
          searchMenuSpan: 6,
          border: true,
          index: true,
          selection: true,
          editBtn: false,
          addBtn: false,
          viewBtn: false,
          delBtn: false,
          dialogWidth: 900,
          menuWidth: 200,
          dialogClickModal: false,
          column: [
            {
              label: "流程分类",
              type: "select",
              row: true,
              dicUrl: "/api/blade-system/dict/dictionary?code=flow",
              props: {
                label: "dictValue",
                value: "dictKey"
              },
              dataType: "number",
              slot: true,
              prop: "category",
              search: true,
              hide: true,
              width: 100,
export default {
    data () {
        return {
            form: {},
            selectionId: '',
            selectionList: [],
            query: {},
            loading: true,
            page: {
                pageSize: 10,
                currentPage: 1,
                total: 0
            },
            {
              label: '流程名称',
              prop: 'processDefinitionName',
              search: true,
            processInstanceId: '',
            flowBox: false,
            workBox: false,
            option: {
                height: 'auto',
                calcHeight: 30,
                tip: false,
                simplePage: true,
                searchShow: true,
                searchMenuSpan: 6,
                border: true,
                index: true,
                selection: true,
                editBtn: false,
                addBtn: false,
                viewBtn: false,
                delBtn: false,
                dialogWidth: 900,
                menuWidth: 280,
                dialogClickModal: false,
                column: [
                    {
                        label: "流程分类",
                        type: "select",
                        row: true,
                        dicUrl: "/api/blade-system/dict/dictionary?code=flow",
                        props: {
                            label: "dictValue",
                            value: "dictKey"
                        },
                        dataType: "number",
                        slot: true,
                        prop: "category",
                        search: true,
                        hide: true,
                        width: 100,
                    },
                    {
                        label: '流程名称',
                        prop: 'processDefinitionName',
                        search: true,
                    },
                    {
                        label: '当前步骤',
                        prop: 'taskName',
                    },
                    {
                        label: '流程版本',
                        prop: 'processDefinitionVersion',
                        slot: true,
                        width: 80,
                    },
                    {
                        label: '申请时间',
                        prop: 'createTime',
                        width: 165,
                    },
                ]
            },
            {
              label: '当前步骤',
              prop: 'taskName',
            },
            {
              label: '流程版本',
              prop: 'processDefinitionVersion',
              slot: true,
              width: 80,
            },
            {
              label: '申请时间',
              prop: 'createTime',
              width: 165,
            },
          ]
        },
        data: []
      };
            data: []
        }
    },
    computed: {
      ...mapGetters(["permission", "flowRoutes"]),
      ids() {
        let ids = [];
        this.selectionList.forEach(ele => {
          ids.push(ele.id);
        });
        return ids.join(",");
      },
        ...mapGetters(["permission", "flowRoutes"]),
        ids () {
            let ids = []
            this.selectionList.forEach(ele => {
                ids.push(ele.id)
            })
            return ids.join(",")
        },
    },
    methods: {
      searchReset() {
        this.query = {};
        this.onLoad(this.page);
      },
      searchChange(params, done) {
        this.query = params;
        this.page.currentPage = 1;
        this.onLoad(this.page, params);
        done();
      },
      selectionChange(list) {
        this.selectionList = list;
      },
      selectionClear() {
        this.selectionList = [];
        this.$refs.crud.toggleSelection();
      },
      handleWork(row) {
        this.$router.push({ path: `/work/process/${flowRoute(this.flowRoutes, row.category)}/handle/${row.taskId}/${row.processInstanceId}/${row.businessId}` });
      },
      handleDetail(row) {
        this.$router.push({ path: `/work/process/${flowRoute(this.flowRoutes, row.category)}/detail/${row.processInstanceId}/${row.businessId}` });
      },
      handleImage(row) {
        this.processInstanceId = row.processInstanceId;
        this.flowBox = true;
      },
      currentChange(currentPage){
        this.page.currentPage = currentPage;
      },
      sizeChange(pageSize){
        this.page.pageSize = pageSize;
      },
      refreshChange() {
        this.onLoad(this.page, this.query);
      },
      onLoad(page, params = {}) {
        const query = {
          ...this.query,
          category: (params.category) ? flowCategory(params.category) : null
        };
        this.loading = true;
        todoList(page.currentPage, page.pageSize, Object.assign(params, query)).then(res => {
          const data = res.data.data;
          this.page.total = data.total;
          this.data = data.records;
          this.loading = false;
          this.selectionClear();
        });
      }
        searchReset () {
            this.query = {}
            this.onLoad(this.page)
        },
        searchChange (params, done) {
            this.query = params
            this.page.currentPage = 1
            this.onLoad(this.page, params)
            done()
        },
        selectionChange (list) {
            this.selectionList = list
        },
        selectionClear () {
            this.selectionList = []
            this.$refs.crud.toggleSelection()
        },
        handleWork (row) {
            this.$router.push({ path: `/work/process/${flowRoute(this.flowRoutes, row.category)}/handle/${row.taskId}/${row.processInstanceId}/${row.businessId}` })
        },
        handleDetail (row) {
            this.$router.push({ path: `/work/process/${flowRoute(this.flowRoutes, row.category)}/detail/${row.processInstanceId}/${row.businessId}` })
        },
        handleImage (row) {
            this.processInstanceId = row.processInstanceId
            this.flowBox = true
        },
        currentChange (currentPage) {
            this.page.currentPage = currentPage
        },
        sizeChange (pageSize) {
            this.page.pageSize = pageSize
        },
        refreshChange () {
            this.onLoad(this.page, this.query)
        },
        onLoad (page, params = {}) {
            const query = {
                ...this.query,
                category: (params.category) ? flowCategory(params.category) : null
            }
            this.loading = true
            todoList(page.currentPage, page.pageSize, Object.assign(params, query)).then(res => {
                const data = res.data.data
                this.page.total = data.total
                this.data = data.records
                this.loading = false
                this.selectionClear()
            })
        }
    }
  };
}
</script>