Browse Source

营销-商机:信息收集权限控制表;

001295 1 year ago
parent
commit
7bfb070b08
2 changed files with 583 additions and 0 deletions
  1. 247 0
      src/views/business/spd/bo/power/111.vue
  2. 336 0
      src/views/business/spd/bo/power/detail.vue

+ 247 - 0
src/views/business/spd/bo/power/111.vue

@@ -0,0 +1,247 @@
+<template>
+  <div class="app-container">
+    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
+      <el-form-item label="编码" prop="code">
+        <el-input v-model="queryParams.code" placeholder="请输入编码" clearable @keyup.enter.native="handleQuery" />
+      </el-form-item>
+      <el-form-item label="人员" prop="staff">
+        <el-input v-model="queryParams.staff" placeholder="请输入人员" clearable @keyup.enter.native="handleQuery" />
+      </el-form-item>
+      <el-form-item label="人员姓名" prop="staffName">
+        <el-input v-model="queryParams.staffName" placeholder="请输入人员姓名" clearable @keyup.enter.native="handleQuery" />
+      </el-form-item>
+      <!-- <el-form-item label="联系方式" prop="contactInformation">
+        <el-input v-model="queryParams.contactInformation" placeholder="请输入联系方式" clearable
+          @keyup.enter.native="handleQuery" />
+      </el-form-item>
+      <el-form-item label="描述" prop="description">
+        <el-input v-model="queryParams.description" placeholder="请输入描述" clearable @keyup.enter.native="handleQuery" />
+      </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>
+
+    <el-row :gutter="10" class="mb8">
+      <el-col :span="1.5">
+        <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd">新增</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate">修改</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete">删除</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport">导出</el-button>
+      </el-col>
+      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+    </el-row>
+
+    <el-table v-loading="loading" :data="powerList" @selection-change="handleSelectionChange">
+      <el-table-column type="selection" width="55" align="center" />
+      <el-table-column label="编码" align="center" prop="code" />
+      <el-table-column label="人员" align="center" prop="staff" />
+      <el-table-column label="人员姓名" align="center" prop="staffName" />
+      <el-table-column label="联系方式" align="center" prop="contactInformation" />
+      <el-table-column label="描述" align="center" prop="description" />
+      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+        <template slot-scope="scope">
+          <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)">修改</el-button>
+          <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)">删除</el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
+      @pagination="getList" />
+
+    <!-- 添加或修改医院竞争对手用户查看权限对话框 -->
+    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
+      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
+        <el-form-item label="编码" prop="code">
+          <el-input v-model="form.code" placeholder="请输入编码" />
+        </el-form-item>
+        <el-form-item label="人员" prop="staff">
+          <el-input v-model="form.staff" placeholder="请输入人员" />
+        </el-form-item>
+        <el-form-item label="人员姓名" prop="staffName">
+          <el-input v-model="form.staffName" placeholder="请输入人员姓名" />
+        </el-form-item>
+        <el-form-item label="联系方式" prop="contactInformation">
+          <el-input v-model="form.contactInformation" placeholder="请输入联系方式" />
+        </el-form-item>
+        <el-form-item label="描述" prop="description">
+          <el-input type="textarea" autosize v-model="form.description" placeholder="请输入描述" />
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitForm">确 定</el-button>
+        <el-button @click="cancel">取 消</el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+  import {
+    listPower,
+    getPower,
+    delPower,
+    addPower,
+    updatePower
+  } from "@/api/business/spd/bo/power";
+
+  export default {
+    name: "Power",
+    data() {
+      return {
+        // 遮罩层
+        loading: true,
+        // 选中数组
+        ids: [],
+        // 非单个禁用
+        single: true,
+        // 非多个禁用
+        multiple: true,
+        // 显示搜索条件
+        showSearch: true,
+        // 总条数
+        total: 0,
+        // 医院竞争对手用户查看权限表格数据
+        powerList: [],
+        // 弹出层标题
+        title: "",
+        // 是否显示弹出层
+        open: false,
+        // 查询参数
+        queryParams: {
+          pageNum: 1,
+          pageSize: 10,
+          code: null,
+          staff: null,
+          staffName: null,
+          contactInformation: null,
+          description: null,
+          tenantId: null,
+          revision: null,
+        },
+        // 表单参数
+        form: {},
+        // 表单校验
+        rules: {}
+      };
+    },
+    created() {
+      this.getList();
+    },
+    methods: {
+      /** 查询医院竞争对手用户查看权限列表 */
+      getList() {
+        this.loading = true;
+        listPower(this.queryParams).then(response => {
+          this.powerList = response.rows;
+          this.total = response.total;
+          this.loading = false;
+        });
+      },
+      // 取消按钮
+      cancel() {
+        this.open = false;
+        this.reset();
+      },
+      // 表单重置
+      reset() {
+        this.form = {
+          id: null,
+          code: null,
+          staff: null,
+          staffName: null,
+          contactInformation: null,
+          description: null,
+          tenantId: null,
+          revision: null,
+          createBy: null,
+          createTime: null,
+          updateBy: null,
+          updateTime: null,
+          delFlag: null
+        };
+        this.resetForm("form");
+      },
+      /** 搜索按钮操作 */
+      handleQuery() {
+        this.queryParams.pageNum = 1;
+        this.getList();
+      },
+      /** 重置按钮操作 */
+      resetQuery() {
+        this.resetForm("queryForm");
+        this.handleQuery();
+      },
+      // 多选框选中数据
+      handleSelectionChange(selection) {
+        this.ids = selection.map(item => item.id)
+        this.single = selection.length !== 1
+        this.multiple = !selection.length
+      },
+      /** 新增按钮操作 */
+      handleAdd() {
+        this.reset();
+        this.open = true;
+        this.title = "添加医院竞争对手用户查看权限";
+      },
+      /** 修改按钮操作 */
+      handleUpdate(row) {
+        this.reset();
+        const id = row.id || this.ids
+        getPower(id).then(response => {
+          this.form = response.data;
+          this.open = true;
+          this.title = "修改医院竞争对手用户查看权限";
+        });
+      },
+      /** 提交按钮 */
+      submitForm() {
+        this.$refs["form"].validate(valid => {
+          if (valid) {
+            if (this.form.id != null) {
+              updatePower(this.form).then(response => {
+                this.$modal.msgSuccess("修改成功");
+                this.open = false;
+                this.getList();
+              });
+            } else {
+              addPower(this.form).then(response => {
+                this.$modal.msgSuccess("新增成功");
+                this.open = false;
+                this.getList();
+              });
+            }
+          }
+        });
+      },
+      /** 删除按钮操作 */
+      handleDelete(row) {
+        if (row.id != undefined) {
+          this.ids.push(row.id);
+        }
+        const ids = this.ids;
+        this.$modal.confirm('是否确认删除?').then(function () {
+          return delPower(ids);
+        }).then(() => {
+          this.getList();
+          this.$modal.msgSuccess("删除成功");
+        }).catch(() => {});
+      },
+      /** 导出按钮操作 */
+      handleExport() {
+        this.download('bo/power/export', {
+          ...this.queryParams
+        }, `power_${new Date().getTime()}.xlsx`)
+      }
+    }
+  };
+
+</script>

+ 336 - 0
src/views/business/spd/bo/power/detail.vue

@@ -0,0 +1,336 @@
+<template>
+  <div>
+    <el-card>
+      <div slot="header" class="clearfix">
+        <span style="font-weight:bold">权限</span>
+        <div style="float: right; padding: 3px 0" type="text">
+          <el-button size="mini" plain @click="btnBack">返回</el-button>
+          <el-button size="mini" plain @click="btnPreviou">上一个</el-button>
+          <el-button size="mini" plain @click="btnNext">下一个</el-button>
+        </div>
+      </div>
+      <div v-loading="loading">
+        <el-descriptions :column="6">
+          <el-descriptions-item label="员工编号">{{form.staff}}</el-descriptions-item>
+          <el-descriptions-item label="员工姓名">{{form.staffName}}</el-descriptions-item>
+        </el-descriptions>
+        <el-row>
+          <el-col :span="4">
+            客户权限
+          </el-col>
+          <el-col :span="20">
+            <div style="float:right">
+              <el-button type="primary" size="mini" @click="btnAddPowerCustomers">新增</el-button>
+            </div>
+          </el-col>
+        </el-row>
+        <el-table size="mini" :data="form.powerCustomerss" v-if="pageState == 'see'" :key="refreshTable" @row-click="btnClickZiRow"  highlight-current-row>
+          <el-table-column width="50" label="序号" align="center" type="index" />
+          <!-- <el-table-column width="300" label="客户" align="center" prop="customers" /> -->
+          <el-table-column width="300" label="客户名称" align="center" prop="customersName" />
+          <el-table-column label="操作" fixed="right" align="center" class-name="small-padding fixed-width">
+            <template slot-scope="scope">
+              <el-button
+                size="mini"
+                type="text"
+                @click="btnDelPowerCustomers(scope.row)"
+              >删除</el-button>
+            </template>
+          </el-table-column>
+        </el-table>
+        <el-row>
+          <el-col :span="4">
+            产线权限
+          </el-col>
+          <el-col :span="20">
+            <div style="float:right">
+              <el-button type="primary" size="mini" @click="btnAddPowerProducts">新增</el-button>
+            </div>
+          </el-col>
+        </el-row>
+        <el-table size="mini" :data="powerProducts" v-if="pageState == 'see'" :key="refreshTable">
+          <el-table-column width="50" label="序号" align="center" type="index" />
+          <!-- <el-table-column width="300" label="产线" align="center" prop="product" /> -->
+          <el-table-column width="300" label="产线名称" align="center" prop="productName" />
+          <el-table-column label="操作" fixed="right" align="center" class-name="small-padding fixed-width">
+            <template slot-scope="scope">
+              <el-button
+                size="mini"
+                type="text"
+                @click="btnDelPowerProduct(scope.row)"
+              >删除</el-button>
+            </template>
+          </el-table-column>
+        </el-table>
+      </div>
+    </el-card>
+    <!-- 添加客户权限对话框 -->
+    <el-dialog title="新增" :visible.sync="openPc" width="500px" append-to-body :show-close="false">
+      <el-form ref="formPc" :model="formPc" :rules="rulesPc" label-width="80px">
+        <el-form-item label="客户" prop="customersName">
+          <el-popover-select-v2 
+            size="mini" 
+            v-model="formPc.customersName" 
+            title="客户" 
+            valueKey="name"
+            referName="CUSTOMER_PARAM_ZT" 
+            :dataMapping="{customers:'id',customersName: 'name'}"
+            :source.sync="formPc"
+          >
+          </el-popover-select-v2>
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button size="mini" type="primary" @click="btnSubmitFormPc">确 定</el-button>
+        <el-button size="mini" @click="btnCancelPc">取 消</el-button>
+      </div>
+    </el-dialog>
+    <!-- 添加产线权限对话框 -->
+    <el-dialog title="新增" :visible.sync="openPp" width="500px" append-to-body :show-close="false">
+      <el-form ref="formPp" :model="formPp" :rules="rulesPp" label-width="80px">
+        <el-form-item label="产线" prop="productName">
+          <el-popover-tree-select v-model="formPp.productName" valueKey='name' title="产线"
+              referName="PRODUCTLINE" :dataMapping="{ product: 'id', productName: 'name'}" :source.sync="formPp"/>
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button size="mini" type="primary" @click="btnSubmitFormPp">确 定</el-button>
+        <el-button size="mini" @click="btnCancelPp">取 消</el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import { getPower,addPowerCustomers,delPowerCustomers,addPowerProduct,delPowerProduct} from "@/api/business/spd/bo/power";
+import ElPopoverSelectV2 from "@/components/popover-select-v2";
+import ElPopoverTreeSelect from "@/components/popover-tree-select/index.vue"
+export default {
+  name: 'detail',
+  props: ['enterState','rowId',"ids"],
+  components: { ElPopoverSelectV2,ElPopoverTreeSelect},
+  model: {
+    prop: 'isList',
+    event: 'jugislist'
+  },
+  data() {
+    return {
+      //id
+      id:null,
+      //表单
+      form:{},
+      //删除的子表数据
+      delItems:[],
+      //表单校验规则
+      formRules:{
+      },
+      //遮罩
+      loading: false,
+      //页面状态
+      pageState: null,
+      //刷新表格标记
+      refreshTable:0,
+
+      //新增子表表单
+      formPc:{},
+      //是否打开子表表单弹窗
+      openPc:false,
+      //子表表单校验
+      rulesPc:{
+        customersName: [
+          { required: true, message: "客户必输", trigger: "blur" },
+        ],
+      },
+      
+      //当前点击的子表
+      ziRow:{},
+      //当前孙表
+      powerProducts:[],
+
+      //新增孙表表单
+      formPp:{},
+      //是否打开孙表表单弹窗
+      openPp:false,
+      //孙表表单校验
+      rulesPp:{
+        productName: [
+          { required: true, message: "产线必输", trigger: "blur" },
+        ],
+      },
+    }
+  },
+  async created() {
+    this.pageState = this.enterState;
+    this.id = this.rowId;
+    this.fetchPower(this.id);
+    if(this.enterState == 'add'){
+    }
+    if(this.enterState == 'edit' || this.enterState == 'see') {
+    }
+  },
+  watch: {
+  },
+  methods: {
+    //返回
+    btnBack(){
+      this.$emit('jugislist', true)
+      this.$emit('refresh')
+    },
+    //查询详情
+    async fetchPower(id){
+      this.loading = true;
+      await getPower(id).then(res => {
+        if (res.code === 200) {
+          this.form = res.data;
+          this.id = res.data.id;
+          this.refreshTable++;
+         }
+         this.loading = false;
+      })
+    },
+    //上一个
+    btnPreviou(){
+      this.pageState = "see";
+      let i = this.ids.indexOf(this.id) - 1;
+      if(i > -1){
+        let id = this.ids[i];
+        this.fetchPower(id);
+      }else{
+        this.$modal.msgSuccess("已经是当前页第一条了!");
+      }
+    },
+    //下一个
+    btnNext(){
+      this.pageState = "see";
+      let i = this.ids.indexOf(this.id) + 1;
+      if(i < this.ids.length){
+        let id = this.ids[i];
+        this.fetchPower(id);
+      }else{
+        this.$modal.msgSuccess("已经是当前页最后一条了!");
+      }
+    },
+    //新增客户维度权限
+    btnAddPowerCustomers(){
+      this.btnResetPc();
+      this.openPc = true;
+    },
+    // 子表表单重置
+    btnResetPc() {
+      this.formPc = {
+        id: null,
+        powerId: null,
+        customers: null,
+        customersName: null,
+        tenantId: null,
+        revision: null,
+        createBy: null,
+        createTime: null,
+        updateBy: null,
+        updateTime: null,
+        delFlag: null
+      };
+      this.resetForm("formPc");
+    },
+    // 取消按钮
+    btnCancelPc() {
+      this.openPc = false;
+      this.btnResetPc();
+    },
+    //确定按钮
+    btnSubmitFormPc() {
+      this.$refs["formPc"].validate(valid => {
+        if (valid) {
+          this.formPc.powerId = this.form.id;
+          addPowerCustomers(this.formPc).then(response => {
+            this.$modal.msgSuccess("新增成功");
+            this.openPc = false;
+            this.fetchPower(this.id);
+          });
+        }
+      });
+    },
+    //删除按钮
+    btnDelPowerCustomers(row){
+      this.$modal.confirm('是否确认删除?').then(function () {
+        return delPowerCustomers(row.id);
+      }).then(() => {
+        this.fetchPower(this.id);
+        this.$modal.msgSuccess("删除成功");
+      }).catch(() => {});
+    },
+    //点击子表行
+    btnClickZiRow(row){
+      this.ziRow = row;
+      this.powerProducts = row.powerProducts;
+    },
+    //新增客户维度权限
+    btnAddPowerProducts(){
+      console.log('this.ziRow.id',this.ziRow.id);
+      if(!(this.ziRow.id)){
+        this.$modal.msgWarning("请选择一个客户!");
+        return;
+      }
+      this.btnResetPp();
+      this.openPp = true;
+    },
+    // 孙表表单重置
+    btnResetPp() {
+      this.formPp = {
+        id: null,
+        powerCustomersId: null,
+        product: null,
+        productName: null,
+        tenantId: null,
+        revision: null,
+        createBy: null,
+        createTime: null,
+        updateBy: null,
+        updateTime: null,
+        delFlag: null
+      };
+      this.resetForm("formPp");
+    },
+    // 取消按钮
+    btnCancelPp() {
+      this.openPp = false;
+      this.btnResetPp();
+    },
+    //确定按钮
+    btnSubmitFormPp() {
+      this.$refs["formPp"].validate(valid => {
+        if (valid) {
+          this.formPp.powerCustomersId = this.ziRow.id;
+          console.log('this.formPp',this.formPp);
+          addPowerProduct(this.formPp).then(response => {
+            this.$modal.msgSuccess("新增成功");
+            this.openPp = false;
+            this.fetchPower(this.id);
+          });
+        }
+      });
+    },
+    //删除按钮
+    btnDelPowerProduct(row){
+      this.$modal.confirm('是否确认删除?').then(function () {
+        return delPowerProduct(row.id);
+      }).then(() => {
+        this.fetchPower(this.id);
+        this.$modal.msgSuccess("删除成功");
+      }).catch(() => {});
+    },
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+.footer {
+  z-index: 500;
+  position: fixed;
+  bottom: 10px;
+  right: 10px;
+  width: 100%;
+  line-height: var(--footer-height);
+  text-align: right;
+}
+</style>