Administrator
2022-04-11 79d9fc857559982b00b68b2d709807bdc4cd286f
src/views/talk/talk.vue
@@ -1,6 +1,12 @@
<template>
  <basic-container>
  <basic-container
    :class="[
      $store.state.control.screenSize == 1366 ? 'smallSize' : 'normalSize',
      $store.state.control.windowWidth >= 1024 ? 'tooRowSearch1' : ''
    ]"
  >
    <avue-crud
      class="tablesss"
      :option="option"
      :table-loading="loading"
      :data="data"
@@ -26,7 +32,7 @@
      @refresh-change="refreshChange"
      @on-load="onLoad"
    >
      <template slot-scope="{ disabled, size }" slot="realNameSearch">
      <!-- <template slot-scope="{ disabled, size }" slot="realNameSearch">
        <el-input
          placeholder="姓名"
          :disabled="disabled"
@@ -35,7 +41,7 @@
          v-on:input="inputs(findName)"
          v-model="findName"
        ></el-input>
      </template>
      </template> -->
      <template slot="menuLeft">
        <el-button
          type="danger"
@@ -44,7 +50,7 @@
          plain
          v-if="permission.talk_delete"
          @click="handleDelete"
        >删 除
          >删 除
        </el-button>
      </template>
    </avue-crud>
@@ -52,8 +58,8 @@
</template>
<script>
import {getList, getDetail, add, update, remove} from "@/api/talk/talk";
import {mapGetters} from "vuex";
import { getList, getDetail, add, update, remove } from "@/api/talk/talk";
import { mapGetters } from "vuex";
export default {
  data() {
@@ -67,6 +73,7 @@
        pageSize: 10,
        currentPage: 1,
        total: 0,
        ...this.$store.state.control.changePageSize
      },
      selectionList: [],
      option: {
@@ -80,7 +87,9 @@
        index: true,
        viewBtn: true,
        selection: true,
        // menu: false,
        dialogClickModal: false,
        ...this.$store.state.control.clearOtherBut,
        column: [
          {
            label: "标题",
@@ -91,28 +100,28 @@
              {
                required: true,
                message: "请输入标题",
                trigger: "blur",
              },
            ],
                trigger: "blur"
              }
            ]
          },
          {
            label: "谈话对象",
            prop: "realName",
            search: true,
            // type: "tree",
            searchslot: true,
            // searchslot: true,
            // dicUrl: `/api/blade-user/selectInr?deptid=` + id,
            // props: {
            //   label: "realName",
            //   value: "id",
            // },
            // rules: [
            //   {
            //     required: true,
            //     message: "请输入谈话对象",
            //     trigger: "blur",
            //   },
            // ],
            rules: [
              {
                required: true,
                message: "请输入谈话对象",
                trigger: "blur"
              }
            ]
          },
          {
            label: "谈话内容",
@@ -121,9 +130,9 @@
              {
                required: true,
                message: "请输入谈话内容",
                trigger: "blur",
              },
            ],
                trigger: "blur"
              }
            ]
          },
          {
            label: "谈话时间",
@@ -135,9 +144,9 @@
              {
                required: true,
                message: "请输入谈话时间",
                trigger: "blur",
              },
            ],
                trigger: "blur"
              }
            ]
          },
          {
            label: "结论",
@@ -146,9 +155,9 @@
              {
                required: true,
                message: "请输入结论",
                trigger: "blur",
              },
            ],
                trigger: "blur"
              }
            ]
          },
          {
            label: "评价",
@@ -157,26 +166,26 @@
              {
                required: true,
                message: "请输入评价",
                trigger: "blur",
              },
            ],
                trigger: "blur"
              }
            ]
          },
          {
            label: '图片',
            prop: 'imgurl',
            label: "图片",
            prop: "imgurl",
            // dataType: 'string',
            type: 'upload',
            type: "upload",
            propsHttp: {
              res: 'data'
              res: "data"
            },
            span: 24,
            listType: 'picture-card',
            tip: '只能上传jpg/png文件,且不超过500kb',
            action: '/api/blade-resource/oss/endpoint/put-files-talk?file='
          },
        ],
            listType: "picture-card",
            tip: "只能上传jpg/png文件,且不超过500kb",
            action: "/api/blade-resource/oss/endpoint/put-files-talk?file="
          }
        ]
      },
      data: [],
      data: []
    };
  },
  computed: {
@@ -186,41 +195,44 @@
        addBtn: this.vaildData(this.permission.talk_add, false),
        viewBtn: this.vaildData(this.permission.talk_view, false),
        delBtn: this.vaildData(this.permission.talk_delete, false),
        editBtn: this.vaildData(this.permission.talk_edit, false),
        editBtn: this.vaildData(this.permission.talk_edit, false)
      };
    },
    ids() {
      let ids = [];
      this.selectionList.forEach((ele) => {
      this.selectionList.forEach(ele => {
        ids.push(ele.id);
      });
      return ids.join(",");
    },
    }
  },
  mounted() {
    this.$store.commit("setWindowSizeHeightAdd");
  },
  methods: {
    // searchChange(params, done) {
    //   console.log(params);
    //   done();
    // this.$message.success(JSON.stringify(params));
    // },
    searchChange(params, done) {
      // console.log(params);
      this.onLoad(this.page, params);
      done();
    },
    rowSave(row, done, loading) {
      var d = [];
      for (var k in row.imgurl) {
        d.push(row.imgurl[k].value);
      }
      row.imgurl = d.join(',');
      row.imgurl = d.join(",");
      row.deptid = this.$store.getters.userInfo.dept_id;
      add(row).then(
        () => {
          row.deptid = this.$store.getters.userInfo.dept_id;
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!",
            message: "操作成功!"
          });
          done();
        },
        (error) => {
        error => {
          loading();
          window.console.log(error);
        }
@@ -232,11 +244,11 @@
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!",
            message: "操作成功!"
          });
          done();
        },
        (error) => {
        error => {
          loading();
          console.log(error);
        }
@@ -246,7 +258,7 @@
      this.$confirm("确定将选择数据删除?", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
        type: "warning"
      })
        .then(() => {
          return remove(row.id);
@@ -255,7 +267,7 @@
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!",
            message: "操作成功!"
          });
        });
    },
@@ -267,7 +279,7 @@
      this.$confirm("确定将选择数据删除?", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
        type: "warning"
      })
        .then(() => {
          return remove(this.ids);
@@ -276,14 +288,14 @@
          this.onLoad(this.page);
          this.$message({
            type: "success",
            message: "操作成功!",
            message: "操作成功!"
          });
          this.$refs.crud.toggleSelection();
        });
    },
    beforeOpen(done, type) {
      if (["edit", "view"].includes(type)) {
        getDetail(this.form.id).then((res) => {
        getDetail(this.form.id).then(res => {
          this.form = res.data.data;
        });
      }
@@ -292,16 +304,6 @@
    searchReset() {
      this.query = {};
      this.onLoad(this.page);
    },
    searchChange(params, done) {
      console.log(params);
      // this.query = params;
      // this.page.currentPage = 1;
      // this.onLoad(this.page, params);
      done();
    },
    inputs(val) {
      console.log(val);
    },
    selectionChange(list) {
      this.selectionList = list;
@@ -320,22 +322,27 @@
      this.onLoad(this.page, this.query);
    },
    onLoad(page, params = {}) {
      if(this.userInfo.role_name == "公安管理员" || this.userInfo.role_name == "民警" || this.userInfo.role_name == "administrator"){
        params["jurisdiction"] = this.userInfo.jurisdiction;
      }else{
        params["deptid"] = this.userInfo.dept_id;
      }
      this.loading = true;
      // console.log(1);
      getList(
        page.currentPage,
        page.pageSize,
        Object.assign(params, this.query)
      ).then((res) => {
      ).then(res => {
        const data = res.data.data;
        this.page.total = data.total;
        this.data = data.records;
        console.log(this.data);
        this.loading = false;
        this.$store.commit("setWindowSizeHeightAdd");
        this.selectionClear();
      });
    },
  },
    }
  }
};
</script>