Tcsm
2023-04-10 3ca2523e54e60eb4bd20f525f91f264c2e8d45f2
ruoyi-ui/src/views/contacts/index.vue
@@ -1,74 +1,79 @@
<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch">
      <el-col  :span="6" >
        <el-input size="medium" v-model="input" placeholder="搜索" clearable>
      <el-form-item label="" prop="id" style="padding-left:30px">
        <el-input
          v-model="queryParams.id"
          placeholder="在“通讯录”中搜索"
          clearable
          style="width: 240px"
          @keyup.enter.native="handleQuery">
          <i slot="prefix" class="el-input__icon el-icon-search"></i>
        </el-input>
      </el-col>
      <el-form-item label="时间" style="padding-left:80px">
          <el-date-picker
            v-model="dateRange"
            style="width: 240px"
            value-format="yyyy-MM-dd HH-MM"
            type="daterange"
            range-separator="-"
            start-placeholder="开始日期"
            end-placeholder="结束日期"
          ></el-date-picker>
      </el-form-item>
      <el-form-item label="类别" prop="type">
          <el-select
            v-model="queryParams.type"
            placeholder="所有类别"
      <el-form-item label="成员姓名" prop="myName" style="padding-left:180px">
        <el-input
          v-model="queryParams.myName"
          placeholder="请输入成员姓名"
          clearable
          style="width: 240px"
          @keyup.enter.native="handleQuery">
          <i slot="prefix" class="el-input__icon el-icon-search"></i>
        </el-input>
      </el-form-item>
      <el-form-item label="称呼" prop="nickName">
        <el-input
          v-model="queryParams.nickName"
          placeholder="请输入称呼"
          clearable
          style="width: 240px"
          @keyup.enter.native="handleQuery">
          <i slot="prefix" class="el-input__icon el-icon-search"></i>
        </el-input>
      </el-form-item>
      <el-cntainer>
        <el-col :span="9" >
         <el-form-item>
          <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
          <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
         </el-form-item>
        </el-col>
      </el-cntainer>
        <el-form-item label="姓名" prop="name">
          <el-input
            v-model="queryParams.name"
            placeholder="请输入姓名"
            clearable
            style="width: 240px"
            @keyup.enter.native="handleQuery">
            <i slot="prefix" class="el-input__icon el-icon-search"></i>
          </el-input>
        </el-form-item>
        <el-form-item label="工作单位" prop="work">
          <el-input
            v-model="queryParams.work"
            placeholder="请输入工作单位"
            clearable
            style="width: 240px"
            @keyup.enter.native="handleQuery"
          >
            <el-option
              v-for="dict in typeOptions"
              :key="dict.value"
              :label="dict.label"
              :value="dict.value"
            />
          </el-select>
      </el-form-item>
      <el-form-item label="标题" prop="title">
        <el-input
          v-model="queryParams.title"
          placeholder="请输入标题"
          clearable
          style="width: 240px"title
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="持有人" prop="holder">
        <el-input
          v-model="queryParams.holder"
          placeholder="请输入持有人"
          clearable
          style="width: 240px"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="存放地址" prop="address">
        <el-input
          v-model="queryParams.address"
          placeholder="请输入具体位置"
          clearable
          style="width: 240px"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
            <i slot="prefix" class="el-input__icon el-icon-search"></i>
          </el-input>
        </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>
    <div style="width: 72px;
height: 24px;
font-size: 18px;
font-family: Microsoft YaHei-Regular, Microsoft YaHei;
font-weight: 400;
color: #000000;
line-height: 21px;
">通讯录</div>
    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
@@ -105,20 +110,28 @@
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>
    <el-table v-loading="loading" :data="propertyList" @selection-change="handleSelectionChange">
    <el-table v-loading="loading" :data="contactList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55"  align="center" />
      <el-table-column label="资产编号" prop="id" sortable width="120" />
      <el-table-column label="类型" prop="type" sortable :show-overflow-tooltip="true" width="150" />
      <el-table-column label="标题" prop="title" sortable :show-overflow-tooltip="true" width="150" />
      <el-table-column label="存储地址" prop="location" sortable width="100" />
      <el-table-column label="持有人" prop="holder" sortable width="100" />
      <el-table-column label="具体位置" prop="address" sortable width="100" />
      <el-table-column label="备注信息" prop="remark" sortable width="100" />
      <el-table-column label="创建时间" align="center" sortable prop="createTime" width="180">
      <el-table-column label="成员姓名" prop="myName" sortable width="100" />
      <el-table-column label="称呼" prop="nickName" sortable :show-overflow-tooltip="true" width="100" />
      <el-table-column label="姓名" prop="name" sortable :show-overflow-tooltip="true" width="100" />
      <el-table-column label="工作单位" prop="work" sortable width="100" />
      <el-table-column label="手机" prop="phone" sortable width="120" />
      <el-table-column label="其它联系方式" prop="wx qq twitter" sortable width="150" >
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.createTime) }}</span>
          {{scope.row.wx}}/
          {{scope.row.qq}}/
          {{scope.row.twitter}}
        </template>
      </el-table-column>
      <el-table-column label="是否常联系" prop="isAlways" sortable width="120" />
      <el-table-column label="电子名片" prop="url" align="center" sortable  width="180">
<!--        <el-image-->
<!--          :src="'http://47.93.189.255:8080/'+ contactList.url"-->
<!--          :fit="fit"-->
<!--        ></el-image>-->
      </el-table-column>
      <el-table-column label="备注(是否存在金钱关系)" prop="remark" sortable width="120" />
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope" v-if="scope.row.roleId !== 1">
          <el-button
@@ -159,37 +172,44 @@
      @pagination="getList"
    />
    <!-- 添加或修改资产信息配置对话框 -->
    <!-- 添加通讯录配置对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
      <el-form ref="elForm" :model="formDat" :rules="rules" size="medium" label-width="100px">
      <el-form ref="elForm" :model="contactList" :rules="rules" size="medium" label-width="100px">
        <el-form-item label="类别" prop="type">
          <el-select v-model="formDat.type" placeholder="请选择类别" clearable :style="{width: '100%'}"  >
            <el-option v-for="(item, index) in typeOptions" :key="index" :label="item.label" :value="item.value"
            ></el-option>
          </el-select>
        <el-form-item label="成员姓名" prop="myName">
          <el-input v-model="contactList.myName" placeholder="请输入成员姓名" clearable :style="{width: '100%'}" >
        </el-input>
        </el-form-item>
        <el-form-item label="标题" prop="title">
          <el-input v-model="formDat.title" placeholder="请输入标题" clearable :style="{width: '100%'}" ></el-input>
        <el-form-item label="称呼" prop="nickName">
          <el-input v-model="contactList.nickName" placeholder="请输入称呼" clearable :style="{width: '100%'}" ></el-input>
        </el-form-item>
        <el-form-item label="存储地址" prop="location">
          <el-input v-model="formDat.location" placeholder="请输入存储地址" clearable :style="{width: '100%'}" >
        <el-form-item label="姓名" prop="name">
          <el-input v-model="contactList.name" placeholder="请输入姓名" clearable :style="{width: '100%'}" >
          </el-input>
        </el-form-item>
        <el-form-item label="持有人" prop="holder">
          <el-input v-model="formDat.holder" placeholder="请输入持有人" clearable :style="{width: '100%'}" >
        <el-form-item label="工作单位" prop="work">
          <el-input v-model="contactList.work" placeholder="请输入工作单位" clearable :style="{width: '100%'}" >
          </el-input>
        </el-form-item>
        <el-form-item label="具体位置" prop="address">
          <el-input v-model="formDat.address" placeholder="请输入具体位置" clearable :style="{width: '100%'}" >
        <el-form-item label="手机" prop="phone">
          <el-input v-model="contactList.phone" placeholder="请输入手机" clearable :style="{width: '100%'}" >
          </el-input>
        </el-form-item>
        <el-form-item label="备注" prop="remark">
          <el-input v-model="formDat.remark" placeholder="请输入备注" clearable :style="{width: '100%'}" ></el-input>
        <el-form-item label="其它联系方式" prop="wx">
          <el-input v-model="contactList.wx" placeholder="请输入其它联系方式" clearable :style="{width: '100%'}" >
          </el-input>
        </el-form-item>
        <el-form-item label="是否常联系" prop="isAlways">
          <el-input v-model="contactList.isAlways" placeholder="是否常联系" clearable :style="{width: '100%'}" >
          </el-input>
        </el-form-item>
        <h4 class="form-header">相关图片 </h4>
        <el-form-item label="备注(是否存在金钱关系)" prop="remark">
          <el-input v-model="contactList.remark" placeholder="请输入备注" clearable :style="{width: '100%'}" ></el-input>
        </el-form-item>
        <h4 class="form-header">电子名片 </h4>
        <el-upload
          action="#"
          list-type="picture-card"
@@ -238,7 +258,7 @@
          :http-request="requestUpload"
          :show-file-list="true"
        >
          <el-button type="primary">Click to upload</el-button>
          <el-button type="primary">点击上传</el-button>
          <template #tip>
            <div class="el-upload__tip">
            </div>
@@ -269,9 +289,9 @@
//在system/note/index.js中导入接口函数
import {listProperty, getPropertyInfo, delProperty, getCategory, addProperty, uploadPic} from "@/api/note/index";
import {getContactList, getContactIdList, addContact,updateContact, delContact,uploadPic} from "@/api/contacts/index";
export default {
  name: "Role",
  name: "index",
  dicts: ['sys_normal_disable'],
  data() {
    return {
@@ -290,8 +310,8 @@
      showSearch: true,
      // 总条数
      total: 0,
      // 资产表格数据
      propertyList: [],
      // 通讯录表格数据
      contactList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
@@ -313,14 +333,31 @@
      ],
      dsb:true,
      btn:false,
      fit:['fill'],
      formDat: {
        type: undefined,
        title: undefined,
        location: undefined,
        holder: undefined,
        address: undefined,
        remark: undefined,
        //通讯录
        id:undefined,
        myName:undefined,
        nickName:undefined,
        name:undefined,
        work:undefined,
        phone:undefined,
        wx:undefined,
        qq:undefined,
        twitter:undefined,
        isAlways:undefined,
        remark:undefined,
        url: undefined,
        // type: undefined,
        // title: undefined,
        // location: undefined,
        // holder: undefined,
        // address: undefined,
      },
      // 菜单列表
      menuOptions: [],
@@ -330,12 +367,11 @@
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        type:undefined,
        title:undefined,
        location:undefined,
        holder:undefined,
        address:undefined,
        createTime:undefined
        id:undefined,
        myName:undefined,
        nickName:undefined,
        name:undefined,
        work:undefined,
      },
      // 表单参数
      form: {},
@@ -345,48 +381,39 @@
      },
      // 表单校验
      rules: {
        type: [{
        id: [{
          required: true,
          message: '请选择类别',
          trigger: 'change'
        }],
        title: [{
          required: true,
          message: '请输入标题',
          message: '请输入id',
          trigger: 'blur'
        }],
        location: [{
        myName: [{
          required: true,
          message: '请输入存储地址',
          message: '请输入成员姓名',
          trigger: 'blur'
        }],
        holder: [{
        nickName: [{
          required: true,
          message: '请输入持有人',
          message: '请输入称呼',
          trigger: 'blur'
        }],
        address: [{
        name: [{
          required: true,
          message: '请输入具体位置',
          message: '请输入姓名',
          trigger: 'blur'
        }],
        remark: [{
        work: [{
          required: true,
          message: '请输入备注',
          message: '请输入工作单位',
          trigger: 'blur'
        }],
        createTime: [{
          required: true,
          message: '请选择日期选择',
          trigger: 'change'
        }],
      },
      typeOptions: [],
    };
  },
  created() {
    this.getList();
    this.getCateInfor()
    // this.getCateInfor()
  },
  methods: {
@@ -395,15 +422,16 @@
      this.open = false;
      this.reset();
    },
    /** 查询角色列表 */
    /** 查询通讯录列表 */
    getList() {
      this.loading = true;
      // console.log(this.queryParams)
      //  listProperty(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
      listProperty(this.queryParams).then(response => {
      getContactList(this.queryParams).then(response => {
          //  alert(123)
          //   console.log(response.data)
          this.propertyList = response.data.data;
          this.contactList = response.data.data;
          this.total = response.data.total;
          this.loading = false;
@@ -411,16 +439,16 @@
      );
    },
    /** 查询类别信息 */
    getCateInfor()
    {
      let _this = this
      getCategory().then(response=>{
        response.data.itemValues.replace("{","").replace("}","").split(",").map(elem=>{
          _this.typeOptions.push({"label":elem.split(":")[0], "value":elem.split(":")[0]})
        })
      })
    },
    // getCateInfor()
    // {
    //   let _this = this
    //   getCategory().then(response=>{
    //
    //     response.data.itemValues.replace("{","").replace("}","").split(",").map(elem=>{
    //       _this.typeOptions.push({"label":elem.split(":")[0], "value":elem.split(":")[0]})
    //     })
    //   })
    // },
    handleRemove(file) {
      alert(323)
@@ -481,12 +509,12 @@
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加资产详细信息";
      this.title = "添加通讯录详细信息";
    },
    /** 查看详细信息 */
    handleCheck(row){
      const id = row.id;
      this.$router.push("/family/note1/propertyInfo/" + id);
      this.$router.push("/tongxunlu/contacts/propertyInfo/" + id);
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
@@ -494,7 +522,7 @@
      let jd = true
      this.$router.push({
        path:"/family/note1/propertyInfo/" + id,
        path:"/tongxunlu/contacts/propertyInfo/" + id,
        query:{
          detail:jd
        }
@@ -519,7 +547,7 @@
      this.$refs["elForm"].validate(valid => {
        if (valid) {
          addProperty(this.formDat).then(response => {
          addContact(this.formDat).then(response => {
            this.$modal.msgSuccess("新增成功");
            this.open = false;
            this.getList();
@@ -554,7 +582,7 @@
    handleDelete(row) {
      const Ids = row.id || this.ids;
      this.$modal.confirm('是否确认删除资产编号为"' + Ids + '"的数据项?').then(function() {
        return delProperty(Ids);
        return delContact(Ids);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");