Authored by wangtao

业务

告警订阅
拓扑负责人
自动化巡检
文档管理权限
  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/alarmSubPer`, 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/alarmSubPer`,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/alarmSubPer`, 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: '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 }
@@ -24,7 +24,7 @@ @@ -24,7 +24,7 @@
24 <cm-table-page :columns="data.columns" 24 <cm-table-page :columns="data.columns"
25 :dataList="data.tableData" 25 :dataList="data.tableData"
26 :treeProps="{ children: 'children', hasChildren: 'hasChildren' }" 26 :treeProps="{ children: 'children', hasChildren: 'hasChildren' }"
27 - :total="count" 27 + :total="data.count"
28 :pageSize="pageSize" 28 :pageSize="pageSize"
29 @loaddata="loadTableDataList" 29 @loaddata="loadTableDataList"
30 @selectionChange="selectionChange" 30 @selectionChange="selectionChange"
@@ -41,4 +41,4 @@ @@ -41,4 +41,4 @@
41 </el-col> 41 </el-col>
42 </el-row> 42 </el-row>
43 43
44 -<ChangeUsersList :show="data.userDialogFlag" title="业务关系变更用户" @hideDialog="showUserDialog" @savebtn="saveRel"></ChangeUsersList> 44 +<ChangeUsersList :show="data.userDialogFlag" @hideDialog="showUserDialog" @savebtn="saveRel"></ChangeUsersList>
@@ -176,7 +176,7 @@ export default { @@ -176,7 +176,7 @@ export default {
176 proxy.$global.confirm("确定取消相关资源?", function () { 176 proxy.$global.confirm("确定取消相关资源?", function () {
177 proxy.$global.showMsg('取消成功!'); 177 proxy.$global.showMsg('取消成功!');
178 proxy.$http.post(`/api-web/personnelChange/remove/bizPer`, data.value.searchParams , function (res) { 178 proxy.$http.post(`/api-web/personnelChange/remove/bizPer`, data.value.searchParams , function (res) {
179 - if (res && res.data) { 179 + if (res && res.success) {
180 proxy.$global.showMsg('取消成功!'); 180 proxy.$global.showMsg('取消成功!');
181 getList() 181 getList()
182 } 182 }
  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 }