Authored by 鲁尚清

Merge branch 'master' of http://192.168.1.136:82/monitor_v3/hg-monitor-web into …

…master-v32-lushangqing
@@ -880,21 +880,30 @@ layui.define(['table', 'form', 'admin', 'layer', 'laytpl', 'common', 'view', 'se @@ -880,21 +880,30 @@ layui.define(['table', 'form', 'admin', 'layer', 'laytpl', 'common', 'view', 'se
880 } 880 }
881 //获取选中的数据 881 //获取选中的数据
882 function getCheckData() { 882 function getCheckData() {
  883 + debugger
883 if(mode){ 884 if(mode){
884 - //获取改变的值  
885 - var str='';  
886 - var $tr=$('#bustype-table').next().find('tbody tr');  
887 - $.each($tr,function (i,v) {  
888 - var $btn=$(this).find('.btn-bustype-unbind');  
889 - var showType=$(this).find('.resourceType_showType') && $(this).find('.resourceType_showType').eq(0) && $(this).find('.resourceType_showType').eq(0).val() ? $(this).find('.resourceType_showType').eq(0).val():'<';  
890 - if(!$btn.hasClass('hide')){  
891 - str += $btn.attr("data-id")+'_'+showType+','; 885 + let arr = [];
  886 + $.each($('[data-type="checkbox"] input'),function (i,v) {
  887 + var that = $(this);
  888 + if(that.is(':checked')){
  889 + arr.push(that.val());
892 } 890 }
893 - });  
894 - if(str!=''){  
895 - str=str.substring(0,str.length-1);  
896 - }  
897 - return str; 891 + })
  892 + return arr.join(',');
  893 + // //获取改变的值
  894 + // var str='';
  895 + // var $tr=$('#bustype-table').next().find('tbody tr');
  896 + // $.each($tr,function (i,v) {
  897 + // var $btn=$(this).find('.btn-bustype-unbind');
  898 + // var showType=$(this).find('.resourceType_showType') && $(this).find('.resourceType_showType').eq(0) && $(this).find('.resourceType_showType').eq(0).val() ? $(this).find('.resourceType_showType').eq(0).val():'<';
  899 + // if(!$btn.hasClass('hide')){
  900 + // str += $btn.attr("data-id")+'_'+showType+',';
  901 + // }
  902 + // });
  903 + // if(str!=''){
  904 + // str=str.substring(0,str.length-1);
  905 + // }
  906 + // return str;
898 }else{ 907 }else{
899 return busTypeTable.checkStatus(false); 908 return busTypeTable.checkStatus(false);
900 } 909 }
@@ -1056,6 +1056,7 @@ layui.define(['table', 'form', 'admin', 'layer', 'upload', 'common', 'sessions', @@ -1056,6 +1056,7 @@ layui.define(['table', 'form', 'admin', 'layer', 'upload', 'common', 'sessions',
1056 btn: ['完成'], 1056 btn: ['完成'],
1057 content: laytpl(res.body).render(JSON.stringify({username:usernames})), 1057 content: laytpl(res.body).render(JSON.stringify({username:usernames})),
1058 yes: function (index, layero) {//保存业务授权 1058 yes: function (index, layero) {//保存业务授权
  1059 + debugger
1059 var busType = layui.bustype({username:usernames[0], mode: 'bind'}); 1060 var busType = layui.bustype({username:usernames[0], mode: 'bind'});
1060 var busTypeData = busType.getData(); 1061 var busTypeData = busType.getData();
1061 var loding = layer.load(2); 1062 var loding = layer.load(2);
@@ -16,8 +16,9 @@ @@ -16,8 +16,9 @@
16 <div id="LAY_app"></div> 16 <div id="LAY_app"></div>
17 <script src="/start/layui/layui.js"></script> 17 <script src="/start/layui/layui.js"></script>
18 <script> 18 <script>
19 - layui.use(['jquery'], function () { 19 + layui.use(['jquery','pageTips'], function () {
20 var $ = layui.jquery; 20 var $ = layui.jquery;
  21 + let pageTips = layui.pageTips;
21 // 读取配置文件 22 // 读取配置文件
22 $.when( 23 $.when(
23 $.ajax({ 24 $.ajax({
  1 +<el-row>
  2 + <el-col :span="24" class="search">
  3 + <div class="condition" style="display: flex;">
  4 + <el-form-item style="margin-right: 6px;margin-bottom: 10px;width: 300px">
  5 + <el-input v-model="data.searchParams.keywords" placeholder="关键字支持:名称、负责人、业务描述"></el-input>
  6 + </el-form-item>
  7 + <el-form-item style="margin-right: 6px;margin-bottom: 10px;">
  8 + <el-button @click="getList">查询</el-button>
  9 + </el-form-item>
  10 +
  11 + <el-form-item style="margin-right: 6px;margin-bottom: 10px;">
  12 + <el-button type="primary" @click="removeRel">取消</el-button>
  13 + </el-form-item>
  14 +
  15 + <el-form-item style="margin-right: 6px;margin-bottom: 10px;">
  16 + <el-button type="primary" @click="changeUser">变更</el-button>
  17 + </el-form-item>
  18 +
  19 + </div>
  20 + </el-col>
  21 +</el-row>
  22 +<el-row class="margin-bottom-50" style="margin-top: 3px">
  23 + <el-col :span="24" class="table-height">
  24 + <cm-table-page :columns="data.columns"
  25 + :dataList="data.tableData"
  26 + :treeProps="{ children: 'children', hasChildren: 'hasChildren' }"
  27 + :total="data.count"
  28 + :pageSize="pageSize"
  29 + @loaddata="loadTableDataList"
  30 + @selectionChange="selectionChange"
  31 + :showIndex="true"
  32 + :showSelection="true"
  33 + :showBorder="true"
  34 + :loading="loading"
  35 + :showPage="true"
  36 + :showTools="false"
  37 + :height="(height - 200)">
  38 + <template #default="{row,prop,column}">
  39 + </template>
  40 + </cm-table-page>
  41 + </el-col>
  42 +</el-row>
  43 +
  44 +<ChangeUsersList :show="data.userDialogFlag" @hideDialog="showUserDialog" @savebtn="saveRel"></ChangeUsersList>
@@ -2,20 +2,254 @@ export default { @@ -2,20 +2,254 @@ export default {
2 name: 'resourceTypePer', 2 name: 'resourceTypePer',
3 template: '', 3 template: '',
4 components: { 4 components: {
5 - 5 + 'ChangeUsersList': Vue.defineAsyncComponent(
  6 + () => myImport('views/batchChangeLeaders/changeUsersList/index')
  7 + ),
6 }, 8 },
7 data() { 9 data() {
8 }, 10 },
9 - props: {  
10 - }, 11 + props: {},
11 setup: function (props, {attrs, slots, emit}) { 12 setup: function (props, {attrs, slots, emit}) {
12 const {proxy} = Vue.getCurrentInstance(); 13 const {proxy} = Vue.getCurrentInstance();
  14 + //列表高度
  15 + let height = Vue.ref(window.innerHeight);
  16 + let data = Vue.ref({
  17 + searchParams: {
  18 + "page": 1,
  19 + "limit": 50,
  20 + "keywords": "",
  21 + "userName": proxy.$route.query.username,
  22 + "subId": ""
  23 + },
  24 + userDialogFlag : false,
  25 + count: 0,
  26 + columns: [{
  27 + prop: "subName",
  28 + label: "订阅名称",
  29 + width: "250",
  30 + sortable: true,
  31 + align: 'center'
  32 + }, {
  33 + prop: "subType",
  34 + label: "订阅类型",
  35 + width: "120",
  36 + sortable: true,
  37 + align: 'center',
  38 + render: function (row) {
  39 + switch (row.subType) {
  40 + case '1':
  41 + return '告警订阅'
  42 + break;
  43 + case '2':
  44 + return '报表订阅'
  45 + break;
  46 + case '3':
  47 + return '系统通知订阅'
  48 + break;
  49 + case '4':
  50 + return '采集器异常订阅'
  51 + break;
  52 + }
  53 + }
  54 + }, {
  55 + prop: "subWay",
  56 + label: "通知类型",
  57 + width: "200",
  58 + sortable: true,
  59 + align: 'center',
  60 + render: function (row) {
  61 + switch (row.subWay){
  62 + case 'wechat':
  63 + return '<div class="small-icon small-icon-wechat"></div>'
  64 + break;
  65 + case 'email':
  66 + return '<div class="small-icon small-icon-email"></div>'
  67 + break;
  68 + case 'message':
  69 + return '<div class="small-icon small-icon-msg"></div>'
  70 + break;
  71 + }
  72 + }
  73 + }, {
  74 + prop: "alarmTempTotal",
  75 + label: "订阅对象",
  76 + sortable: true,
  77 + align: 'center',
  78 + // render: (row) => {
  79 + // switch (row.alarmTempTotal) {
  80 + // case 0:
  81 + // return '否';
  82 + // case 1:
  83 + // return '是';
  84 + // default:
  85 + // return '';
  86 + // }
  87 + // }
  88 + }, {
  89 + prop: "tempType",
  90 + label: "通知说明",
  91 + sortable: true,
  92 + align: 'center',
  93 + render: (row) => {
  94 + switch (row.tempType) {
  95 + case 'wechat':
  96 + return '微信'
  97 + case 'email':
  98 + return '邮箱';
  99 + case 'msg':
  100 + return '短信';
  101 + }
  102 + }
  103 + }, {
  104 + prop: "userTotal",
  105 + label: "订阅人数",
  106 + sortable: true,
  107 + align: 'center'
  108 + }, {
  109 + prop: "times",
  110 + label: "允许通知时间段",
  111 + sortable: true,
  112 + align: 'center'
  113 + }, {
  114 + prop: "syncFlag",
  115 + label: "同步状态",
  116 + sortable: true,
  117 + align: 'center',
  118 + render: (row) => {
  119 + switch (row.syncFlag) {
  120 + case '0':
  121 + return '未同步'
  122 + case '1':
  123 + return '已同步';
  124 + }
  125 + }
  126 + }],
  127 + tableData: [],
  128 + // 表格选中
  129 + checkArr:[]
  130 + })
  131 +
  132 +
  133 + const getList = () => {
  134 + proxy.$http.post(`/api-web/personnelChange/getList/alarmSubPer`, data.value.searchParams, function (res) {
  135 + if (res && res.success) {
  136 + let dataVal = data.value;
  137 + let list = res.data;
  138 + let count = res.count;
  139 +
  140 + dataVal.tableData = list;
  141 + dataVal.count = count;
  142 + }
  143 + })
  144 + }
  145 +
  146 + // 展示用户选择
  147 + let showUserDialog = (flg) =>{
  148 + data.value.userDialogFlag = flg;
  149 + }
  150 +
  151 + let saveRel = (obj) =>{
  152 + // 获取选中
  153 + let arr = data.value.checkArr;
  154 + if(arr.length == 0){
  155 + proxy.$global.showMsg('请至少选择一项','warning');
  156 + return;
  157 + }
  158 +
  159 + let params = {
  160 + targetUserName: obj.selectModel.join(''),
  161 + "userName": proxy.$route.query.username,
  162 + "busId": arr.join(',')
  163 + }
  164 + if(params.targetUserName == params.userName){
  165 + proxy.$global.showMsg('变更用户不能与变更前用户一致,请修改!','warning');
  166 + return;
  167 + }
  168 + proxy.$http.post(`/api-web/personnelChange/update/alarmSubPer`,params, function (res) {
  169 + if (res && res.success) {
  170 + proxy.$global.showMsg('变更成功!');
  171 + showUserDialog(false);
  172 + // 刷新表格
  173 + getList();
  174 + }
  175 + })
  176 + }
  177 +
  178 + // 变更
  179 + let changeUser = () =>{
  180 + // 获取选中
  181 + let arr = data.value.checkArr;
  182 + if(arr.length == 0){
  183 + proxy.$global.showMsg('请至少选择一项','warning');
  184 + return;
  185 + }
  186 +
  187 + showUserDialog(true);
  188 + }
  189 +
  190 + /**
  191 + * 取消
  192 + */
  193 + let removeRel = () =>{
  194 + let arr = data.value.checkArr;
  195 + if(arr.length == 0){
  196 + proxy.$global.showMsg('请至少选择一项','warning');
  197 + return;
  198 + }
  199 +
  200 + data.value.searchParams.subId = arr.join(',')
  201 + proxy.$global.confirm("确定取消相关资源?", function () {
  202 + proxy.$global.showMsg('取消成功!');
  203 + proxy.$http.post(`/api-web/personnelChange/remove/alarmSubPer`, data.value.searchParams , function (res) {
  204 + if (res && res.success) {
  205 + proxy.$global.showMsg('取消成功!');
  206 + getList()
  207 + }
  208 + })
  209 + });
  210 + }
  211 +
  212 + //重新加载表格数据
  213 + let loadTableDataList = ({page, limit}) => {
  214 + let dataVal = data.value;
  215 + dataVal.page = page;
  216 + dataVal.limit = limit;
  217 + getList();
  218 + }
  219 +
  220 + // 表格全选事件
  221 + let selectionChange = (val) => {
  222 + let checkArr = [];
  223 + val.map(item => {
  224 + checkArr.push(item.subId)
  225 + })
  226 + data.value.checkArr = checkArr;
  227 + let isCheck = (list, checkArr) => {
  228 + list.forEach((v, i) => {
  229 + v.checked = checkArr.includes(v.subId);
  230 + if (v.children) {
  231 + isCheck(v.children, checkArr);
  232 + }
  233 + });
  234 + }
  235 + isCheck(data.value.tableData, checkArr);
  236 + }
13 237
14 // 挂载完 238 // 挂载完
15 Vue.onMounted(() => { 239 Vue.onMounted(() => {
  240 + getList();
16 }) 241 })
17 - return {  
18 242
  243 + return {
  244 + height,
  245 + data,
  246 + getList,
  247 + changeUser,
  248 + showUserDialog,
  249 + removeRel,
  250 + loadTableDataList,
  251 + selectionChange,
  252 + saveRel
19 } 253 }
20 } 254 }
21 } 255 }
  1 +<el-row>
  2 + <el-col :span="24" class="search">
  3 + <div class="condition" style="display: flex;">
  4 + <el-form-item style="margin-right: 6px;margin-bottom: 10px;width: 300px">
  5 + <el-input v-model="data.searchParams.keywords" placeholder="关键字支持:名称、负责人、业务描述"></el-input>
  6 + </el-form-item>
  7 + <el-form-item style="margin-right: 6px;margin-bottom: 10px;">
  8 + <el-button @click="getList">查询</el-button>
  9 + </el-form-item>
  10 +
  11 + <el-form-item style="margin-right: 6px;margin-bottom: 10px;">
  12 + <el-button type="primary" @click="removeRel">取消</el-button>
  13 + </el-form-item>
  14 +
  15 + <el-form-item style="margin-right: 6px;margin-bottom: 10px;">
  16 + <el-button type="primary" @click="changeUser">变更</el-button>
  17 + </el-form-item>
  18 +
  19 + </div>
  20 + </el-col>
  21 +</el-row>
  22 +<el-row class="margin-bottom-50" style="margin-top: 3px">
  23 + <el-col :span="24" class="table-height">
  24 + <cm-table-page :columns="data.columns"
  25 + :dataList="data.tableData"
  26 + :treeProps="{ children: 'children', hasChildren: 'hasChildren' }"
  27 + :total="data.count"
  28 + :pageSize="pageSize"
  29 + @loaddata="loadTableDataList"
  30 + @selectionChange="selectionChange"
  31 + :showIndex="true"
  32 + :showSelection="true"
  33 + :showBorder="true"
  34 + :loading="loading"
  35 + :showPage="true"
  36 + :showTools="false"
  37 + :height="(height - 200)">
  38 + <template #default="{row,prop,column}">
  39 + </template>
  40 + </cm-table-page>
  41 + </el-col>
  42 +</el-row>
  43 +
  44 +<ChangeUsersList :show="data.userDialogFlag" @hideDialog="showUserDialog" @savebtn="saveRel"></ChangeUsersList>
1 export default { 1 export default {
2 - name: 'resourceTypePer', 2 + name: 'autoPatrolPortPer',
3 template: '', 3 template: '',
4 components: { 4 components: {
5 - 5 + 'ChangeUsersList': Vue.defineAsyncComponent(
  6 + () => myImport('views/batchChangeLeaders/changeUsersList/index')
  7 + ),
6 }, 8 },
7 data() { 9 data() {
8 }, 10 },
9 - props: {  
10 - }, 11 + props: {},
11 setup: function (props, {attrs, slots, emit}) { 12 setup: function (props, {attrs, slots, emit}) {
12 const {proxy} = Vue.getCurrentInstance(); 13 const {proxy} = Vue.getCurrentInstance();
  14 + //列表高度
  15 + let height = Vue.ref(window.innerHeight);
  16 + let data = Vue.ref({
  17 + searchParams: {
  18 + "page": 1,
  19 + "limit": 50,
  20 + "keywords": "",
  21 + "userName": proxy.$route.query.username,
  22 + "reportId": ""
  23 + },
  24 + userDialogFlag: false,
  25 + count: 0,
  26 + columns: [{
  27 + prop: "docName",
  28 + label: "文档名称",
  29 + width: "350",
  30 + sortable: true,
  31 + align: 'center'
  32 + }, {
  33 + prop: "frequency",
  34 + label: "CRON表达式",
  35 + width: "170",
  36 + sortable: true,
  37 + align: 'center'
  38 + },{
  39 +
  40 + prop: "handleHour",
  41 + label: "处理时常(时)",
  42 + width: "150",
  43 + sortable: true,
  44 + align: 'center'
  45 + }, {
  46 + prop: "inspectionType",
  47 + label: "巡检类型",
  48 + width: "100",
  49 + sortable: true,
  50 + align: 'center',
  51 + render: (row) => {
  52 + switch (row.important) {
  53 + case '0':
  54 + return '自动巡检';
  55 + case '1':
  56 + return '人工巡检';
  57 + default:
  58 + return '';
  59 + }
  60 + }
  61 + }, {
  62 + prop: "templatePath",
  63 + label: "文档地址",
  64 + sortable: true,
  65 + align: 'left'
  66 + }],
  67 + tableData: [],
  68 + // 表格选中
  69 + checkArr: []
  70 + })
  71 +
  72 +
  73 + const getList = () => {
  74 + proxy.$http.post(`/api-web/personnelChange/getList/autoPatrolPortPer`, data.value.searchParams, function (res) {
  75 + if (res && res.data) {
  76 + let dataVal = data.value;
  77 + let list = res.data;
  78 + let count = res.count;
  79 +
  80 + dataVal.tableData = list;
  81 + dataVal.count = count;
  82 + }
  83 + })
  84 + }
  85 +
  86 + // 展示用户选择
  87 + let showUserDialog = (flg) => {
  88 + data.value.userDialogFlag = flg;
  89 + }
  90 +
  91 + let saveRel = (obj) => {
  92 + // 获取选中
  93 + let arr = data.value.checkArr;
  94 + if (arr.length == 0) {
  95 + proxy.$global.showMsg('请至少选择一项', 'warning');
  96 + return;
  97 + }
  98 +
  99 + let params = {
  100 + targetUserName: obj.selectModel.join(''),
  101 + "userName": proxy.$route.query.username,
  102 + "reportId": arr.join(',')
  103 + }
  104 + if (params.targetUserName == params.userName) {
  105 + proxy.$global.showMsg('变更用户不能与变更前用户一致,请修改!', 'warning');
  106 + return;
  107 + }
  108 + proxy.$http.post(`/api-web/personnelChange/update/autoPatrolPortPer`, params, function (res) {
  109 + if (res && res.success) {
  110 + proxy.$global.showMsg('变更成功!');
  111 + showUserDialog(false);
  112 + // 刷新表格
  113 + getList();
  114 + }
  115 + })
  116 + }
  117 +
  118 + // 变更
  119 + let changeUser = () => {
  120 + // 获取选中
  121 + let arr = data.value.checkArr;
  122 + if (arr.length == 0) {
  123 + proxy.$global.showMsg('请至少选择一项', 'warning');
  124 + return;
  125 + }
  126 +
  127 + showUserDialog(true);
  128 + }
  129 +
  130 + /**
  131 + * 取消
  132 + */
  133 + let removeRel = () => {
  134 + let arr = data.value.checkArr;
  135 + if (arr.length == 0) {
  136 + proxy.$global.showMsg('请至少选择一项', 'warning');
  137 + return;
  138 + }
  139 +
  140 + data.value.searchParams.reportId = arr.join(',')
  141 + proxy.$global.confirm("确定取消相关资源?", function () {
  142 + proxy.$global.showMsg('取消成功!');
  143 + proxy.$http.post(`/api-web/personnelChange/remove/autoPatrolPortPer`, data.value.searchParams, function (res) {
  144 + if (res && res.success) {
  145 + proxy.$global.showMsg('取消成功!');
  146 + getList()
  147 + }
  148 + })
  149 + });
  150 + }
  151 +
  152 + //重新加载表格数据
  153 + let loadTableDataList = ({page, limit}) => {
  154 + let dataVal = data.value;
  155 + dataVal.page = page;
  156 + dataVal.limit = limit;
  157 + getList();
  158 + }
  159 +
  160 + // 表格全选事件
  161 + let selectionChange = (val) => {
  162 + let checkArr = [];
  163 + val.map(item => {
  164 + checkArr.push(item.id)
  165 + })
  166 + data.value.checkArr = checkArr;
  167 + let isCheck = (list, checkArr) => {
  168 + list.forEach((v, i) => {
  169 + v.checked = checkArr.includes(v.id);
  170 + if (v.children) {
  171 + isCheck(v.children, checkArr);
  172 + }
  173 + });
  174 + }
  175 + isCheck(data.value.tableData, checkArr);
  176 + }
13 177
14 // 挂载完 178 // 挂载完
15 Vue.onMounted(() => { 179 Vue.onMounted(() => {
  180 + getList();
16 }) 181 })
17 - return {  
18 182
  183 + return {
  184 + height,
  185 + data,
  186 + getList,
  187 + changeUser,
  188 + showUserDialog,
  189 + removeRel,
  190 + loadTableDataList,
  191 + selectionChange,
  192 + saveRel
19 } 193 }
20 } 194 }
21 } 195 }
  1 +<el-row>
  2 + <el-col :span="24" class="search">
  3 + <div class="condition" style="display: flex;">
  4 + <el-form-item style="margin-right: 6px;margin-bottom: 10px;width: 300px">
  5 + <el-input v-model="data.searchParams.keywords" placeholder="关键字支持:名称、负责人、业务描述"></el-input>
  6 + </el-form-item>
  7 + <el-form-item style="margin-right: 6px;margin-bottom: 10px;">
  8 + <el-button @click="getList">查询</el-button>
  9 + </el-form-item>
  10 +
  11 + <el-form-item style="margin-right: 6px;margin-bottom: 10px;">
  12 + <el-button type="primary" @click="removeRel">取消</el-button>
  13 + </el-form-item>
  14 +
  15 + <el-form-item style="margin-right: 6px;margin-bottom: 10px;">
  16 + <el-button type="primary" @click="changeUser">变更</el-button>
  17 + </el-form-item>
  18 +
  19 + </div>
  20 + </el-col>
  21 +</el-row>
  22 +<el-row class="margin-bottom-50" style="margin-top: 3px">
  23 + <el-col :span="24" class="table-height">
  24 + <cm-table-page :columns="data.columns"
  25 + :dataList="data.tableData"
  26 + :treeProps="{ children: 'children', hasChildren: 'hasChildren' }"
  27 + :total="data.count"
  28 + :pageSize="pageSize"
  29 + @loaddata="loadTableDataList"
  30 + @selectionChange="selectionChange"
  31 + :showIndex="true"
  32 + :showSelection="true"
  33 + :showBorder="true"
  34 + :loading="loading"
  35 + :showPage="true"
  36 + :showTools="false"
  37 + :height="(height - 200)">
  38 + <template #default="{row,prop,column}">
  39 + </template>
  40 + </cm-table-page>
  41 + </el-col>
  42 +</el-row>
  43 +
  44 +<ChangeUsersList :show="data.userDialogFlag" @hideDialog="showUserDialog" @savebtn="saveRel"></ChangeUsersList>
@@ -2,20 +2,229 @@ export default { @@ -2,20 +2,229 @@ export default {
2 name: 'resourceTypePer', 2 name: 'resourceTypePer',
3 template: '', 3 template: '',
4 components: { 4 components: {
5 - 5 + 'ChangeUsersList': Vue.defineAsyncComponent(
  6 + () => myImport('views/batchChangeLeaders/changeUsersList/index')
  7 + ),
6 }, 8 },
7 data() { 9 data() {
8 }, 10 },
9 - props: {  
10 - }, 11 + props: {},
11 setup: function (props, {attrs, slots, emit}) { 12 setup: function (props, {attrs, slots, emit}) {
12 const {proxy} = Vue.getCurrentInstance(); 13 const {proxy} = Vue.getCurrentInstance();
  14 + //列表高度
  15 + let height = Vue.ref(window.innerHeight);
  16 + let data = Vue.ref({
  17 + searchParams: {
  18 + "page": 1,
  19 + "limit": 50,
  20 + "keywords": "",
  21 + "userName": proxy.$route.query.username,
  22 + "busId": ""
  23 + },
  24 + userDialogFlag : false,
  25 + count: 0,
  26 + columns: [{
  27 + prop: "busTypeName",
  28 + label: "名称",
  29 + width: "250",
  30 + sortable: true,
  31 + align: 'center'
  32 + }, {
  33 + prop: "nickname",
  34 + label: "负责人",
  35 + width: "120",
  36 + sortable: true,
  37 + align: 'center'
  38 + }, {
  39 + prop: "busTypeDesc",
  40 + label: "业务描述",
  41 + width: "200",
  42 + sortable: true,
  43 + align: 'center'
  44 + }, {
  45 + prop: "isUse",
  46 + label: "是否使用",
  47 + sortable: true,
  48 + align: 'center',
  49 + render: (row) => {
  50 + switch (row.isUse) {
  51 + case 0:
  52 + return '否';
  53 + case 1:
  54 + return '是';
  55 + default:
  56 + return '';
  57 + }
  58 + }
  59 + }, {
  60 + prop: "important",
  61 + label: "重要程度",
  62 + sortable: true,
  63 + align: 'center',
  64 + render: (row) => {
  65 + switch (row.important) {
  66 + case 1:
  67 + return '核心';
  68 + case 2:
  69 + return '重要';
  70 + case 3:
  71 + return '一般';
  72 + case 9:
  73 + return '虚拟业务';
  74 + default:
  75 + return '';
  76 + }
  77 + }
  78 + }, {
  79 + prop: "sort",
  80 + label: "排序",
  81 + sortable: true,
  82 + align: 'center'
  83 + }],
  84 + tableData: [],
  85 + // 表格选中
  86 + checkArr:[]
  87 + })
  88 +
  89 +
  90 + const getList = () => {
  91 + proxy.$http.post(`/api-web/personnelChange/getList/bizPer`, data.value.searchParams, function (res) {
  92 + if (res && res.data) {
  93 + let dataVal = data.value;
  94 + let list = res.data;
  95 + let count = res.count;
  96 +
  97 + let tableData = list.filter(function (v) {
  98 + if (v.parentId == '0') {
  99 + // 获取子节点
  100 + let childs = list.filter(function (v1) {
  101 + if (v1.parentId != '0' && v1.parentId == v.busId) {
  102 + // 获取子节点
  103 + return v1;
  104 + }
  105 + }).sort(function (a, b) {
  106 + return a.sort - b.sort
  107 + })
  108 + v.children = childs;
  109 + return v;
  110 + }
  111 + }).sort(function (a, b) {
  112 + return a.sort - b.sort
  113 + })
  114 +
  115 + dataVal.tableData = tableData;
  116 + dataVal.count = count;
  117 + }
  118 + })
  119 + }
  120 +
  121 + // 展示用户选择
  122 + let showUserDialog = (flg) =>{
  123 + data.value.userDialogFlag = flg;
  124 + }
  125 +
  126 + let saveRel = (obj) =>{
  127 + // 获取选中
  128 + let arr = data.value.checkArr;
  129 + if(arr.length == 0){
  130 + proxy.$global.showMsg('请至少选择一项','warning');
  131 + return;
  132 + }
  133 +
  134 + let params = {
  135 + targetUserName: obj.selectModel.join(''),
  136 + "userName": proxy.$route.query.username,
  137 + "busId": arr.join(',')
  138 + }
  139 + if(params.targetUserName == params.userName){
  140 + proxy.$global.showMsg('变更用户不能与变更前用户一致,请修改!','warning');
  141 + return;
  142 + }
  143 + proxy.$http.post(`/api-web/personnelChange/update/bizPer`,params, function (res) {
  144 + if (res && res.success) {
  145 + proxy.$global.showMsg('变更成功!');
  146 + showUserDialog(false);
  147 + // 刷新表格
  148 + getList();
  149 + }
  150 + })
  151 + }
  152 +
  153 + // 变更
  154 + let changeUser = () =>{
  155 + // 获取选中
  156 + let arr = data.value.checkArr;
  157 + if(arr.length == 0){
  158 + proxy.$global.showMsg('请至少选择一项','warning');
  159 + return;
  160 + }
  161 +
  162 + showUserDialog(true);
  163 + }
  164 +
  165 + /**
  166 + * 取消
  167 + */
  168 + let removeRel = () =>{
  169 + let arr = data.value.checkArr;
  170 + if(arr.length == 0){
  171 + proxy.$global.showMsg('请至少选择一项','warning');
  172 + return;
  173 + }
  174 +
  175 + data.value.searchParams.busId = arr.join(',')
  176 + proxy.$global.confirm("确定取消相关资源?", function () {
  177 + proxy.$global.showMsg('取消成功!');
  178 + proxy.$http.post(`/api-web/personnelChange/remove/bizPer`, data.value.searchParams , function (res) {
  179 + if (res && res.success) {
  180 + proxy.$global.showMsg('取消成功!');
  181 + getList()
  182 + }
  183 + })
  184 + });
  185 + }
  186 +
  187 + //重新加载表格数据
  188 + let loadTableDataList = ({page, limit}) => {
  189 + let dataVal = data.value;
  190 + dataVal.page = page;
  191 + dataVal.limit = limit;
  192 + getList();
  193 + }
  194 +
  195 + // 表格全选事件
  196 + let selectionChange = (val) => {
  197 + let checkArr = [];
  198 + val.map(item => {
  199 + checkArr.push(item.busId)
  200 + })
  201 + data.value.checkArr = checkArr;
  202 + let isCheck = (list, checkArr) => {
  203 + list.forEach((v, i) => {
  204 + v.checked = checkArr.includes(v.busId);
  205 + if (v.children) {
  206 + isCheck(v.children, checkArr);
  207 + }
  208 + });
  209 + }
  210 + isCheck(data.value.tableData, checkArr);
  211 + }
13 212
14 // 挂载完 213 // 挂载完
15 Vue.onMounted(() => { 214 Vue.onMounted(() => {
  215 + getList();
16 }) 216 })
17 - return {  
18 217
  218 + return {
  219 + height,
  220 + data,
  221 + getList,
  222 + changeUser,
  223 + showUserDialog,
  224 + removeRel,
  225 + loadTableDataList,
  226 + selectionChange,
  227 + saveRel
19 } 228 }
20 } 229 }
21 } 230 }
  1 +<el-row>
  2 + <el-col :span="24" class="search">
  3 + <div class="condition" style="display: flex;">
  4 + <el-form-item style="margin-right: 6px;margin-bottom: 10px;width: 300px">
  5 + <el-input v-model="data.searchParams.keywords" placeholder="关键字支持:名称、负责人、业务描述"></el-input>
  6 + </el-form-item>
  7 + <el-form-item style="margin-right: 6px;margin-bottom: 10px;">
  8 + <el-button @click="getList">查询</el-button>
  9 + </el-form-item>
  10 +
  11 + <el-form-item style="margin-right: 6px;margin-bottom: 10px;">
  12 + <el-button type="primary" @click="removeRel">取消</el-button>
  13 + </el-form-item>
  14 +
  15 + <el-form-item style="margin-right: 6px;margin-bottom: 10px;">
  16 + <el-button type="primary" @click="changeUser">变更</el-button>
  17 + </el-form-item>
  18 +
  19 + </div>
  20 + </el-col>
  21 +</el-row>
  22 +<el-row class="margin-bottom-50" style="margin-top: 3px">
  23 + <el-col :span="24" class="table-height">
  24 + <cm-table-page :columns="data.columns"
  25 + :dataList="data.tableData"
  26 + :treeProps="{ children: 'children', hasChildren: 'hasChildren' }"
  27 + :total="data.count"
  28 + :pageSize="pageSize"
  29 + @loaddata="loadTableDataList"
  30 + @selectionChange="selectionChange"
  31 + :showIndex="true"
  32 + :showSelection="true"
  33 + :showBorder="true"
  34 + :loading="loading"
  35 + :showPage="true"
  36 + :showTools="false"
  37 + :height="(height - 200)">
  38 + <template #default="{row,prop,column}">
  39 + </template>
  40 + </cm-table-page>
  41 + </el-col>
  42 +</el-row>
  43 +
  44 +<ChangeUsersList :show="data.userDialogFlag" @hideDialog="showUserDialog" @savebtn="saveRel"></ChangeUsersList>
1 export default { 1 export default {
2 - name: 'resourceTypePer', 2 + name: 'fileManagePer',
3 template: '', 3 template: '',
4 components: { 4 components: {
5 - 5 + 'ChangeUsersList': Vue.defineAsyncComponent(
  6 + () => myImport('views/batchChangeLeaders/changeUsersList/index')
  7 + ),
6 }, 8 },
7 data() { 9 data() {
8 }, 10 },
9 - props: {  
10 - }, 11 + props: {},
11 setup: function (props, {attrs, slots, emit}) { 12 setup: function (props, {attrs, slots, emit}) {
12 const {proxy} = Vue.getCurrentInstance(); 13 const {proxy} = Vue.getCurrentInstance();
  14 + //列表高度
  15 + let height = Vue.ref(window.innerHeight);
  16 + let data = Vue.ref({
  17 + searchParams: {
  18 + "page": 1,
  19 + "limit": 50,
  20 + "keywords": "",
  21 + "userName": proxy.$route.query.username,
  22 + "docId": ""
  23 + },
  24 + userDialogFlag: false,
  25 + count: 0,
  26 + columns: [{
  27 + prop: "name",
  28 + label: "名称",
  29 + width: "350",
  30 + sortable: true,
  31 + align: 'center'
  32 + }, {
  33 + prop: "docNo",
  34 + label: "文档编号",
  35 + width: "100",
  36 + sortable: true,
  37 + align: 'center'
  38 + }, {
  39 + prop: "createUserName",
  40 + label: "创建用户",
  41 + width: "100",
  42 + sortable: true,
  43 + align: 'center'
  44 + }, {
  45 + prop: "localPath",
  46 + label: "文档地址",
  47 + sortable: true,
  48 + align: 'left'
  49 + }],
  50 + tableData: [],
  51 + // 表格选中
  52 + checkArr: []
  53 + })
  54 +
  55 +
  56 + const getList = () => {
  57 + proxy.$http.post(`/api-web/personnelChange/getList/fileManagePer`, data.value.searchParams, function (res) {
  58 + if (res && res.data) {
  59 + let dataVal = data.value;
  60 + let list = res.data;
  61 + let count = res.count;
  62 +
  63 + dataVal.tableData = list;
  64 + dataVal.count = count;
  65 + }
  66 + })
  67 + }
  68 +
  69 + // 展示用户选择
  70 + let showUserDialog = (flg) => {
  71 + data.value.userDialogFlag = flg;
  72 + }
  73 +
  74 + let saveRel = (obj) => {
  75 + // 获取选中
  76 + let arr = data.value.checkArr;
  77 + if (arr.length == 0) {
  78 + proxy.$global.showMsg('请至少选择一项', 'warning');
  79 + return;
  80 + }
  81 +
  82 + let params = {
  83 + targetUserName: obj.selectModel.join(''),
  84 + "userName": proxy.$route.query.username,
  85 + "docId": arr.join(',')
  86 + }
  87 + if (params.targetUserName == params.userName) {
  88 + proxy.$global.showMsg('变更用户不能与变更前用户一致,请修改!', 'warning');
  89 + return;
  90 + }
  91 + proxy.$http.post(`/api-web/personnelChange/update/fileManagePer`, params, function (res) {
  92 + if (res && res.success) {
  93 + proxy.$global.showMsg('变更成功!');
  94 + showUserDialog(false);
  95 + // 刷新表格
  96 + getList();
  97 + }
  98 + })
  99 + }
  100 +
  101 + // 变更
  102 + let changeUser = () => {
  103 + // 获取选中
  104 + let arr = data.value.checkArr;
  105 + if (arr.length == 0) {
  106 + proxy.$global.showMsg('请至少选择一项', 'warning');
  107 + return;
  108 + }
  109 +
  110 + showUserDialog(true);
  111 + }
  112 +
  113 + /**
  114 + * 取消
  115 + */
  116 + let removeRel = () => {
  117 + let arr = data.value.checkArr;
  118 + if (arr.length == 0) {
  119 + proxy.$global.showMsg('请至少选择一项', 'warning');
  120 + return;
  121 + }
  122 +
  123 + data.value.searchParams.docId = arr.join(',')
  124 + proxy.$global.confirm("确定取消相关资源?", function () {
  125 + proxy.$global.showMsg('取消成功!');
  126 + proxy.$http.post(`/api-web/personnelChange/remove/fileManagePer`, data.value.searchParams, function (res) {
  127 + if (res && res.success) {
  128 + proxy.$global.showMsg('取消成功!');
  129 + getList()
  130 + }
  131 + })
  132 + });
  133 + }
  134 +
  135 + //重新加载表格数据
  136 + let loadTableDataList = ({page, limit}) => {
  137 + let dataVal = data.value;
  138 + dataVal.page = page;
  139 + dataVal.limit = limit;
  140 + getList();
  141 + }
  142 +
  143 + // 表格全选事件
  144 + let selectionChange = (val) => {
  145 + let checkArr = [];
  146 + val.map(item => {
  147 + checkArr.push(item.id)
  148 + })
  149 + data.value.checkArr = checkArr;
  150 + let isCheck = (list, checkArr) => {
  151 + list.forEach((v, i) => {
  152 + v.checked = checkArr.includes(v.id);
  153 + if (v.children) {
  154 + isCheck(v.children, checkArr);
  155 + }
  156 + });
  157 + }
  158 + isCheck(data.value.tableData, checkArr);
  159 + }
13 160
14 // 挂载完 161 // 挂载完
15 Vue.onMounted(() => { 162 Vue.onMounted(() => {
  163 + getList();
16 }) 164 })
17 - return {  
18 165
  166 + return {
  167 + height,
  168 + data,
  169 + getList,
  170 + changeUser,
  171 + showUserDialog,
  172 + removeRel,
  173 + loadTableDataList,
  174 + selectionChange,
  175 + saveRel
19 } 176 }
20 } 177 }
21 } 178 }
  1 +<el-row>
  2 + <el-col :span="24" class="search">
  3 + <div class="condition" style="display: flex;">
  4 + <el-form-item style="margin-right: 6px;margin-bottom: 10px;width: 300px">
  5 + <el-input v-model="data.searchParams.keywords" placeholder="关键字支持:名称、负责人、业务描述"></el-input>
  6 + </el-form-item>
  7 + <el-form-item style="margin-right: 6px;margin-bottom: 10px;">
  8 + <el-button @click="getList">查询</el-button>
  9 + </el-form-item>
  10 +
  11 + <el-form-item style="margin-right: 6px;margin-bottom: 10px;">
  12 + <el-button type="primary" @click="removeRel">取消</el-button>
  13 + </el-form-item>
  14 +
  15 + <el-form-item style="margin-right: 6px;margin-bottom: 10px;">
  16 + <el-button type="primary" @click="changeUser">变更</el-button>
  17 + </el-form-item>
  18 +
  19 + </div>
  20 + </el-col>
  21 +</el-row>
  22 +<el-row class="margin-bottom-50" style="margin-top: 3px">
  23 + <el-col :span="24" class="table-height">
  24 + <cm-table-page :columns="data.columns"
  25 + :dataList="data.tableData"
  26 + :treeProps="{ children: 'children', hasChildren: 'hasChildren' }"
  27 + :total="data.count"
  28 + :pageSize="pageSize"
  29 + @loaddata="loadTableDataList"
  30 + @selectionChange="selectionChange"
  31 + :showIndex="true"
  32 + :showSelection="true"
  33 + :showBorder="true"
  34 + :loading="loading"
  35 + :showPage="true"
  36 + :showTools="false"
  37 + :height="(height - 200)">
  38 + <template #default="{row,prop,column}">
  39 + </template>
  40 + </cm-table-page>
  41 + </el-col>
  42 +</el-row>
  43 +
  44 +<ChangeUsersList :show="data.userDialogFlag" @hideDialog="showUserDialog" @savebtn="saveRel"></ChangeUsersList>
@@ -2,20 +2,229 @@ export default { @@ -2,20 +2,229 @@ export default {
2 name: 'resourceTypePer', 2 name: 'resourceTypePer',
3 template: '', 3 template: '',
4 components: { 4 components: {
5 - 5 + 'ChangeUsersList': Vue.defineAsyncComponent(
  6 + () => myImport('views/batchChangeLeaders/changeUsersList/index')
  7 + ),
6 }, 8 },
7 data() { 9 data() {
8 }, 10 },
9 - props: {  
10 - }, 11 + props: {},
11 setup: function (props, {attrs, slots, emit}) { 12 setup: function (props, {attrs, slots, emit}) {
12 const {proxy} = Vue.getCurrentInstance(); 13 const {proxy} = Vue.getCurrentInstance();
  14 + //列表高度
  15 + let height = Vue.ref(window.innerHeight);
  16 + let data = Vue.ref({
  17 + searchParams: {
  18 + "page": 1,
  19 + "limit": 50,
  20 + "keywords": "",
  21 + "userName": proxy.$route.query.username,
  22 + "busId": ""
  23 + },
  24 + userDialogFlag : false,
  25 + count: 0,
  26 + columns: [{
  27 + prop: "busTypeName",
  28 + label: "名称",
  29 + width: "250",
  30 + sortable: true,
  31 + align: 'center'
  32 + }, {
  33 + prop: "nickname",
  34 + label: "负责人",
  35 + width: "120",
  36 + sortable: true,
  37 + align: 'center'
  38 + }, {
  39 + prop: "busTypeDesc",
  40 + label: "业务描述",
  41 + width: "200",
  42 + sortable: true,
  43 + align: 'center'
  44 + }, {
  45 + prop: "isUse",
  46 + label: "是否使用",
  47 + sortable: true,
  48 + align: 'center',
  49 + render: (row) => {
  50 + switch (row.isUse) {
  51 + case 0:
  52 + return '否';
  53 + case 1:
  54 + return '是';
  55 + default:
  56 + return '';
  57 + }
  58 + }
  59 + }, {
  60 + prop: "important",
  61 + label: "重要程度",
  62 + sortable: true,
  63 + align: 'center',
  64 + render: (row) => {
  65 + switch (row.important) {
  66 + case 1:
  67 + return '核心';
  68 + case 2:
  69 + return '重要';
  70 + case 3:
  71 + return '一般';
  72 + case 9:
  73 + return '虚拟业务';
  74 + default:
  75 + return '';
  76 + }
  77 + }
  78 + }, {
  79 + prop: "sort",
  80 + label: "排序",
  81 + sortable: true,
  82 + align: 'center'
  83 + }],
  84 + tableData: [],
  85 + // 表格选中
  86 + checkArr:[]
  87 + })
  88 +
  89 +
  90 + const getList = () => {
  91 + proxy.$http.post(`/api-web/personnelChange/getList/topoPer`, data.value.searchParams, function (res) {
  92 + if (res && res.data) {
  93 + let dataVal = data.value;
  94 + let list = res.data;
  95 + let count = res.count;
  96 +
  97 + let tableData = list.filter(function (v) {
  98 + if (v.parentId == '0') {
  99 + // 获取子节点
  100 + let childs = list.filter(function (v1) {
  101 + if (v1.parentId != '0' && v1.parentId == v.busId) {
  102 + // 获取子节点
  103 + return v1;
  104 + }
  105 + }).sort(function (a, b) {
  106 + return a.sort - b.sort
  107 + })
  108 + v.children = childs;
  109 + return v;
  110 + }
  111 + }).sort(function (a, b) {
  112 + return a.sort - b.sort
  113 + })
  114 +
  115 + dataVal.tableData = tableData;
  116 + dataVal.count = count;
  117 + }
  118 + })
  119 + }
  120 +
  121 + // 展示用户选择
  122 + let showUserDialog = (flg) =>{
  123 + data.value.userDialogFlag = flg;
  124 + }
  125 +
  126 + let saveRel = (obj) =>{
  127 + // 获取选中
  128 + let arr = data.value.checkArr;
  129 + if(arr.length == 0){
  130 + proxy.$global.showMsg('请至少选择一项','warning');
  131 + return;
  132 + }
  133 +
  134 + let params = {
  135 + targetUserName: obj.selectModel.join(''),
  136 + "userName": proxy.$route.query.username,
  137 + "busId": arr.join(',')
  138 + }
  139 + if(params.targetUserName == params.userName){
  140 + proxy.$global.showMsg('变更用户不能与变更前用户一致,请修改!','warning');
  141 + return;
  142 + }
  143 + proxy.$http.post(`/api-web/personnelChange/update/topoPer`,params, function (res) {
  144 + if (res && res.success) {
  145 + proxy.$global.showMsg('变更成功!');
  146 + showUserDialog(false);
  147 + // 刷新表格
  148 + getList();
  149 + }
  150 + })
  151 + }
  152 +
  153 + // 变更
  154 + let changeUser = () =>{
  155 + // 获取选中
  156 + let arr = data.value.checkArr;
  157 + if(arr.length == 0){
  158 + proxy.$global.showMsg('请至少选择一项','warning');
  159 + return;
  160 + }
  161 +
  162 + showUserDialog(true);
  163 + }
  164 +
  165 + /**
  166 + * 取消
  167 + */
  168 + let removeRel = () =>{
  169 + let arr = data.value.checkArr;
  170 + if(arr.length == 0){
  171 + proxy.$global.showMsg('请至少选择一项','warning');
  172 + return;
  173 + }
  174 +
  175 + data.value.searchParams.busId = arr.join(',')
  176 + proxy.$global.confirm("确定取消相关资源?", function () {
  177 + proxy.$global.showMsg('取消成功!');
  178 + proxy.$http.post(`/api-web/personnelChange/remove/topoPer`, data.value.searchParams , function (res) {
  179 + if (res && res.success) {
  180 + proxy.$global.showMsg('取消成功!');
  181 + getList()
  182 + }
  183 + })
  184 + });
  185 + }
  186 +
  187 + //重新加载表格数据
  188 + let loadTableDataList = ({page, limit}) => {
  189 + let dataVal = data.value;
  190 + dataVal.page = page;
  191 + dataVal.limit = limit;
  192 + getList();
  193 + }
  194 +
  195 + // 表格全选事件
  196 + let selectionChange = (val) => {
  197 + let checkArr = [];
  198 + val.map(item => {
  199 + checkArr.push(item.busId)
  200 + })
  201 + data.value.checkArr = checkArr;
  202 + let isCheck = (list, checkArr) => {
  203 + list.forEach((v, i) => {
  204 + v.checked = checkArr.includes(v.busId);
  205 + if (v.children) {
  206 + isCheck(v.children, checkArr);
  207 + }
  208 + });
  209 + }
  210 + isCheck(data.value.tableData, checkArr);
  211 + }
13 212
14 // 挂载完 213 // 挂载完
15 Vue.onMounted(() => { 214 Vue.onMounted(() => {
  215 + getList();
16 }) 216 })
17 - return {  
18 217
  218 + return {
  219 + height,
  220 + data,
  221 + getList,
  222 + changeUser,
  223 + showUserDialog,
  224 + removeRel,
  225 + loadTableDataList,
  226 + selectionChange,
  227 + saveRel
19 } 228 }
20 } 229 }
21 } 230 }