forked from xxhjsb/hbt-prevention-ui
fit:修复bug
parent
9c140b1bd3
commit
aaa9fc1633
|
|
@ -13,7 +13,7 @@ import AreaService from '@/service/area.service';
|
||||||
import moment from "moment"
|
import moment from "moment"
|
||||||
@Component({
|
@Component({
|
||||||
template,
|
template,
|
||||||
components:{
|
components: {
|
||||||
FormComponent,
|
FormComponent,
|
||||||
TableComponent,
|
TableComponent,
|
||||||
DrawComponent,
|
DrawComponent,
|
||||||
|
|
@ -28,17 +28,17 @@ export default class UnitManagerComponent extends BaseRecordComponent<any> {
|
||||||
|
|
||||||
public isArea = false;
|
public isArea = false;
|
||||||
|
|
||||||
public repairTableData = {datas:[]};
|
public repairTableData = { datas: [] };
|
||||||
|
|
||||||
public repairTableColumn = [] as any;
|
public repairTableColumn = [] as any;
|
||||||
|
|
||||||
|
|
||||||
public filters = [{
|
public filters = [{
|
||||||
text:"未绘制",
|
text: "未绘制",
|
||||||
value:0
|
value: 0
|
||||||
},{
|
}, {
|
||||||
text:"已绘制",
|
text: "已绘制",
|
||||||
value:1
|
value: 1
|
||||||
}]
|
}]
|
||||||
public showQrCode = false;
|
public showQrCode = false;
|
||||||
|
|
||||||
|
|
@ -47,47 +47,47 @@ export default class UnitManagerComponent extends BaseRecordComponent<any> {
|
||||||
public isReadonly = false;
|
public isReadonly = false;
|
||||||
|
|
||||||
public formActions = [{
|
public formActions = [{
|
||||||
name:"查询",
|
name: "查询",
|
||||||
value:"search",
|
value: "search",
|
||||||
icon:"el-icon-search",
|
icon: "el-icon-search",
|
||||||
type:"primary"
|
type: "primary"
|
||||||
},{
|
}, {
|
||||||
name:"清空",
|
name: "清空",
|
||||||
icon:"el-icon-tickets",
|
icon: "el-icon-tickets",
|
||||||
value:"reset"
|
value: "reset"
|
||||||
}];
|
}];
|
||||||
public tableActions = [{
|
public tableActions = [{
|
||||||
name:"添加",
|
name: "添加",
|
||||||
value:"add",
|
value: "add",
|
||||||
icon:"el-icon-plus",
|
icon: "el-icon-plus",
|
||||||
type:"primary"
|
type: "primary"
|
||||||
},{
|
}, {
|
||||||
name:"批量绘制",
|
name: "批量绘制",
|
||||||
value:"drawList",
|
value: "drawList",
|
||||||
plain:true,
|
plain: true,
|
||||||
icon:"el-icon-plus",
|
icon: "el-icon-plus",
|
||||||
type:"primary"
|
type: "primary"
|
||||||
},{
|
}, {
|
||||||
name:"批量删除",
|
name: "批量删除",
|
||||||
value:"delete",
|
value: "delete",
|
||||||
plain:true,
|
plain: true,
|
||||||
icon:"el-icon-delete",
|
icon: "el-icon-delete",
|
||||||
type:"danger"
|
type: "danger"
|
||||||
}];
|
}];
|
||||||
public footerActions = [{
|
public footerActions = [{
|
||||||
name:"选择全部",
|
name: "选择全部",
|
||||||
value:"selectAll",
|
value: "selectAll",
|
||||||
type:"primary"
|
type: "primary"
|
||||||
},{
|
}, {
|
||||||
name:"反向选择",
|
name: "反向选择",
|
||||||
value:"reverse"
|
value: "reverse"
|
||||||
}];
|
}];
|
||||||
public formOptions:FormOption<BtnOption>[] = [];
|
public formOptions: FormOption<BtnOption>[] = [];
|
||||||
|
|
||||||
public showUpdate = false;
|
public showUpdate = false;
|
||||||
public currentId = -1;
|
public currentId = -1;
|
||||||
public updateParams = {} as any;
|
public updateParams = {} as any;
|
||||||
public updateOptions:FormOption<BtnOption>[] = [];
|
public updateOptions: FormOption<BtnOption>[] = [];
|
||||||
|
|
||||||
|
|
||||||
public showDraw = false;
|
public showDraw = false;
|
||||||
|
|
@ -97,7 +97,7 @@ export default class UnitManagerComponent extends BaseRecordComponent<any> {
|
||||||
public areaNoMap = {} as any;
|
public areaNoMap = {} as any;
|
||||||
|
|
||||||
|
|
||||||
public updateActions:BtnOption[] = [];
|
public updateActions: BtnOption[] = [];
|
||||||
|
|
||||||
public selectData = [];
|
public selectData = [];
|
||||||
|
|
||||||
|
|
@ -111,273 +111,281 @@ export default class UnitManagerComponent extends BaseRecordComponent<any> {
|
||||||
public turnOffForm = [] as any;
|
public turnOffForm = [] as any;
|
||||||
|
|
||||||
public turnOffAction = [{
|
public turnOffAction = [{
|
||||||
name:"取消",
|
name: "取消",
|
||||||
value:"cancelStatus"
|
value: "cancelStatus"
|
||||||
},{
|
}, {
|
||||||
name:"保存",
|
name: "保存",
|
||||||
value:"saveStatus",
|
value: "saveStatus",
|
||||||
type:"primary"
|
type: "primary"
|
||||||
}]
|
}]
|
||||||
|
|
||||||
created(){
|
created() {
|
||||||
this.getAreaList();
|
this.getAreaList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public buildTurnOffForm(){
|
public buildTurnOffForm() {
|
||||||
this.turnOffForm = [{
|
this.turnOffForm = [{
|
||||||
name:"停用/恢复",
|
name: "停用/恢复",
|
||||||
type:"radio",
|
type: "radio",
|
||||||
key:"status",
|
key: "status",
|
||||||
require:true,
|
require: true,
|
||||||
disable:true,
|
disable: true,
|
||||||
width:"100%",
|
width: "100%",
|
||||||
showError:false,
|
showError: false,
|
||||||
datas:[{
|
datas: [{
|
||||||
name:"停用",
|
name: "停用",
|
||||||
value:0
|
value: 0
|
||||||
},{
|
}, {
|
||||||
name:"恢复",
|
name: "恢复",
|
||||||
value:1
|
value: 1
|
||||||
}]
|
}]
|
||||||
},{
|
}, {
|
||||||
name:"停用开始时间",
|
name: "停用开始时间",
|
||||||
type:"date",
|
type: "date",
|
||||||
subType:"datetime",
|
subType: "datetime",
|
||||||
hide:this.turnOffParams.status===1,
|
hide: this.turnOffParams.status === 1,
|
||||||
format:"yyyy-MM-dd HH:mm",
|
format: "yyyy-MM-dd HH:mm",
|
||||||
key:"startTime",
|
key: "startTime",
|
||||||
width:"100%",
|
width: "100%",
|
||||||
require:true,
|
require: true,
|
||||||
showError:false,
|
showError: false,
|
||||||
},{
|
}, {
|
||||||
name:"停用结束时间",
|
name: "停用结束时间",
|
||||||
type:"date",
|
type: "date",
|
||||||
subType:"datetime",
|
subType: "datetime",
|
||||||
format:"yyyy-MM-dd HH:mm",
|
format: "yyyy-MM-dd HH:mm",
|
||||||
hide:this.turnOffParams.status===1,
|
hide: this.turnOffParams.status === 1,
|
||||||
key:"endTime",
|
key: "endTime",
|
||||||
width:"100%",
|
width: "100%",
|
||||||
require:true,
|
require: true,
|
||||||
showError:false,
|
showError: false,
|
||||||
},{
|
}, {
|
||||||
name:"原因",
|
name: "原因",
|
||||||
type:"textarea",
|
type: "textarea",
|
||||||
key:"reason",
|
key: "reason",
|
||||||
width:"100%",
|
width: "100%",
|
||||||
require:true,
|
require: true,
|
||||||
showError:false,
|
showError: false,
|
||||||
},{
|
}, {
|
||||||
name:"登记人",
|
name: "登记人",
|
||||||
type:"text",
|
type: "text",
|
||||||
key:"registerUserName",
|
key: "registerUserName",
|
||||||
disable:true,
|
disable: true,
|
||||||
require:true,
|
require: true,
|
||||||
width:"100%",
|
width: "100%",
|
||||||
showError:false,
|
showError: false,
|
||||||
},{
|
}, {
|
||||||
name:"登记时间",
|
name: "登记时间",
|
||||||
type:"text",
|
type: "text",
|
||||||
key:"registerTime",
|
key: "registerTime",
|
||||||
disable:true,
|
disable: true,
|
||||||
width:"100%",
|
width: "100%",
|
||||||
require:true,
|
require: true,
|
||||||
showError:false,
|
showError: false,
|
||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
|
|
||||||
public doTurnOff(data,status){
|
public doTurnOff(data, status) {
|
||||||
this.turnOffParams = {
|
this.turnOffParams = {
|
||||||
status:status,
|
status: status,
|
||||||
unitId:data.id,
|
unitId: data.id,
|
||||||
startTime:"",
|
startTime: "",
|
||||||
endTime:"",
|
endTime: "",
|
||||||
riskUnitStatus:status,
|
riskUnitStatus: status,
|
||||||
registerUserId:this.account.userId,
|
registerUserId: this.account.userId,
|
||||||
registerUserName:this.account.nickName,
|
registerUserName: this.account.nickName,
|
||||||
registerTime:moment().format("YYYY-MM-DD HH:mm"),
|
registerTime: moment().format("YYYY-MM-DD HH:mm"),
|
||||||
|
|
||||||
}
|
}
|
||||||
this.showTurnOff = true;
|
this.showTurnOff = true;
|
||||||
this.buildTurnOffForm();
|
this.buildTurnOffForm();
|
||||||
}
|
}
|
||||||
|
|
||||||
public doTurnOffAction(data){
|
public doTurnOffAction(data) {
|
||||||
if(data && data.value==="saveStatus"){
|
if (data && data.value === "saveStatus") {
|
||||||
this.tableService.updateStatus(this.turnOffParams,true).then((res)=>{
|
this.tableService.updateStatus(this.turnOffParams, true).then((res) => {
|
||||||
this.$message.success(this.turnOffParams.status?"启用成功":"停用成功");
|
this.$message.success(this.turnOffParams.status ? "启用成功" : "停用成功");
|
||||||
this.getTableData();
|
this.getTableData();
|
||||||
this.showTurnOff = false;
|
this.showTurnOff = false;
|
||||||
})
|
})
|
||||||
}else{
|
} else {
|
||||||
this.showTurnOff = false;
|
this.showTurnOff = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public buildFormOptions(){
|
public buildFormOptions() {
|
||||||
this.updateOptions = [{
|
this.updateOptions = [{
|
||||||
name:"选择区域",
|
name: "选择区域",
|
||||||
key:"areaId",
|
key: "areaId",
|
||||||
placeholder:"请选择区域名称",
|
placeholder: "请选择区域名称",
|
||||||
width:"calc(50% - 20px)",
|
width: "calc(50% - 20px)",
|
||||||
format:"areaName",
|
format: "areaName",
|
||||||
type:"select",
|
type: "select",
|
||||||
require:true,
|
require: true,
|
||||||
datas:this.areaList
|
datas: this.areaList,
|
||||||
},{
|
|
||||||
name:"区域编号",
|
|
||||||
key:"areaNo",
|
|
||||||
type:"text",
|
|
||||||
disable:true,
|
|
||||||
width:"calc(50% - 20px)",
|
|
||||||
},{
|
|
||||||
name:"单元编号",
|
|
||||||
key:"number",
|
|
||||||
type:"text",
|
|
||||||
disable:true,
|
|
||||||
width:"calc(50% - 20px)",
|
|
||||||
require:true
|
|
||||||
},{
|
|
||||||
name:"单元名称",
|
|
||||||
key:"name",
|
|
||||||
type:"text",
|
|
||||||
width:"calc(50% - 20px)",
|
|
||||||
require:true
|
|
||||||
},{
|
|
||||||
name:"责任部门",
|
|
||||||
key:"chargeDeptId",
|
|
||||||
format:"chargeDeptName",
|
|
||||||
type:"treeSelect",
|
|
||||||
width:"calc(50% - 20px)",
|
|
||||||
require:true,
|
|
||||||
expandLevel:Infinity,
|
|
||||||
showError:false,
|
showError:false,
|
||||||
datas:this.$store.state.deptTreeList
|
}, {
|
||||||
},{
|
name: "区域编号",
|
||||||
name:"责任人",
|
key: "areaNo",
|
||||||
key:"chargeUserId",
|
type: "text",
|
||||||
format:"chargeUserName",
|
disable: true,
|
||||||
type:"select",
|
width: "calc(50% - 20px)",
|
||||||
width:"calc(50% - 20px)",
|
showError:false,
|
||||||
require:true,
|
}, {
|
||||||
datas:this.$store.state.userList
|
name: "单元编号",
|
||||||
},{
|
key: "number",
|
||||||
type:"btn",
|
type: "text",
|
||||||
name:"单元绘制",
|
disable: true,
|
||||||
width:"calc(50% - 20px)",
|
width: "calc(50% - 20px)",
|
||||||
btn:[{
|
require: true,
|
||||||
name:"开始绘制",
|
showError:false,
|
||||||
value:"draw",
|
}, {
|
||||||
height:"36px",
|
name: "单元名称",
|
||||||
hide:this.isReadonly,
|
key: "name",
|
||||||
size:"small",
|
type: "text",
|
||||||
icon:"el-icon-edit-outline",
|
width: "calc(50% - 20px)",
|
||||||
type:"primary"
|
require: true,
|
||||||
},{
|
showError:false,
|
||||||
name:"查看绘制",
|
}, {
|
||||||
value:"readDraw",
|
name: "责任部门",
|
||||||
hide:!this.isReadonly,
|
key: "chargeDeptId",
|
||||||
height:"36px",
|
format: "chargeDeptName",
|
||||||
size:"small",
|
type: "treeSelect",
|
||||||
icon:"el-icon-edit-outline",
|
width: "calc(50% - 20px)",
|
||||||
type:"primary"
|
require: true,
|
||||||
|
expandLevel: Infinity,
|
||||||
|
showError: false,
|
||||||
|
datas: this.$store.state.deptTreeList
|
||||||
|
}, {
|
||||||
|
name: "责任人",
|
||||||
|
key: "chargeUserId",
|
||||||
|
format: "chargeUserName",
|
||||||
|
type: "select",
|
||||||
|
width: "calc(50% - 20px)",
|
||||||
|
require: true,
|
||||||
|
datas: this.$store.state.userList,
|
||||||
|
showError:false,
|
||||||
|
}, {
|
||||||
|
type: "btn",
|
||||||
|
name: "单元绘制",
|
||||||
|
width: "calc(50% - 20px)",
|
||||||
|
btn: [{
|
||||||
|
name: "开始绘制",
|
||||||
|
value: "draw",
|
||||||
|
height: "36px",
|
||||||
|
hide: this.isReadonly,
|
||||||
|
size: "small",
|
||||||
|
icon: "el-icon-edit-outline",
|
||||||
|
type: "primary"
|
||||||
|
}, {
|
||||||
|
name: "查看绘制",
|
||||||
|
value: "readDraw",
|
||||||
|
hide: !this.isReadonly,
|
||||||
|
height: "36px",
|
||||||
|
size: "small",
|
||||||
|
icon: "el-icon-edit-outline",
|
||||||
|
type: "primary"
|
||||||
}]
|
}]
|
||||||
},{
|
}, {
|
||||||
name:"停用/检修状态",
|
name: "停用/检修状态",
|
||||||
key:"status",
|
key: "status",
|
||||||
width:"calc(50% - 20px)",
|
width: "calc(50% - 20px)",
|
||||||
labelWidth:"130px",
|
labelWidth: "130px",
|
||||||
format:"statusName",
|
format: "statusName",
|
||||||
type:"select",
|
type: "select",
|
||||||
disable:this.currentId!=-1,
|
disable: this.currentId != -1,
|
||||||
require:true,
|
require: true,
|
||||||
datas:[{
|
showError:false,
|
||||||
name:"启用",
|
datas: [{
|
||||||
value:1,
|
name: "启用",
|
||||||
},{
|
value: 1,
|
||||||
name:"停用",
|
}, {
|
||||||
value:0,
|
name: "停用",
|
||||||
|
value: 0,
|
||||||
}]
|
}]
|
||||||
}];
|
}];
|
||||||
|
|
||||||
this.updateActions = [{
|
this.updateActions = [{
|
||||||
name:"取消",
|
name: "取消",
|
||||||
value:"cancel"
|
value: "cancel"
|
||||||
},{
|
}, {
|
||||||
name:"保存并继续添加",
|
name: "保存并继续添加",
|
||||||
value:"saveAndContinue",
|
value: "saveAndContinue",
|
||||||
hide:this.currentId!=-1,
|
hide: this.currentId != -1,
|
||||||
type:"primary"
|
type: "primary"
|
||||||
},{
|
}, {
|
||||||
name:"保存",
|
name: "保存",
|
||||||
value:"submit",
|
value: "submit",
|
||||||
type:"primary"
|
type: "primary"
|
||||||
}];
|
}];
|
||||||
this.formOptions=[{
|
this.formOptions = [{
|
||||||
name:"单元名称",
|
name: "单元名称",
|
||||||
key:"name",
|
key: "name",
|
||||||
type:"text"
|
type: "text"
|
||||||
},{
|
}, {
|
||||||
name:"责任部门",
|
name: "责任部门",
|
||||||
key:"chargeDeptId",
|
key: "chargeDeptId",
|
||||||
type:"select",
|
type: "select",
|
||||||
datas:this.$store.state.deptList
|
datas: this.$store.state.deptList
|
||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
|
|
||||||
public getQrCode(row){
|
public getQrCode(row) {
|
||||||
this.areaService.getQrCode({
|
this.areaService.getQrCode({
|
||||||
url:"/",
|
url: "/",
|
||||||
id:row.id,
|
id: row.id,
|
||||||
system:"prevention",
|
system: "prevention",
|
||||||
type:0,
|
type: 0,
|
||||||
data:"",
|
data: "",
|
||||||
params:{
|
params: {
|
||||||
"区域编号" : row.areaNo,
|
"区域编号": row.areaNo,
|
||||||
"单元名称" : row.name,
|
"单元名称": row.name,
|
||||||
"单元编号" : row.number,
|
"单元编号": row.number,
|
||||||
"责任人" : row.chargeUserName,
|
"责任人": row.chargeUserName,
|
||||||
"责任部门" : row.chargeDeptName,
|
"责任部门": row.chargeDeptName,
|
||||||
}
|
}
|
||||||
}).then((res:any)=>{
|
}).then((res: any) => {
|
||||||
this.showQrCode = true;
|
this.showQrCode = true;
|
||||||
this.qrUrl = res.data.url;
|
this.qrUrl = res.data.url;
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public buildTable(){
|
public buildTable() {
|
||||||
this.tableColumn.push({name:'风险分析单元',key:"name"});
|
this.tableColumn.push({ name: '风险分析单元', key: "name" });
|
||||||
this.tableColumn.push({name:'责任部门',key:"chargeDeptName"});
|
this.tableColumn.push({ name: '责任部门', key: "chargeDeptName" });
|
||||||
this.tableColumn.push({name:'责任人',key:"chargeUserName"});
|
this.tableColumn.push({ name: '责任人', key: "chargeUserName" });
|
||||||
this.tableColumn.push({name:'绘制情况',filters:this.filters,filterMethod:(data,row)=>{
|
this.tableColumn.push({
|
||||||
if(data){
|
name: '绘制情况', filters: this.filters, filterMethod: (data, row) => {
|
||||||
return row.geoJson && row.geoJson!=="[]"
|
if (data) {
|
||||||
}else{
|
return row.geoJson && row.geoJson !== "[]"
|
||||||
|
} else {
|
||||||
return !row.geoJson || row.geoJson === "[]"
|
return !row.geoJson || row.geoJson === "[]"
|
||||||
}
|
}
|
||||||
},render:(data)=>{
|
}, render: (data) => {
|
||||||
if(data.geoJson==='[]' || !data.geoJson){
|
if (data.geoJson === '[]' || !data.geoJson) {
|
||||||
return "<span class='noDraw'>未绘制</span>"
|
return "<span class='noDraw'>未绘制</span>"
|
||||||
}else{
|
} else {
|
||||||
return "<span>已绘制</span>"
|
return "<span class='color_1'>已绘制</span>"
|
||||||
}
|
}
|
||||||
}});
|
}
|
||||||
|
});
|
||||||
|
|
||||||
this.repairTableColumn.push({name:"序号",key:"index"});
|
this.repairTableColumn.push({ name: "序号", key: "index" });
|
||||||
this.repairTableColumn.push({name:"停用开始时间",key:"startTime"});
|
this.repairTableColumn.push({ name: "停用开始时间", key: "startTime" });
|
||||||
this.repairTableColumn.push({name:"停用开始时间",key:"endTime"});
|
this.repairTableColumn.push({ name: "停用开始时间", key: "endTime" });
|
||||||
this.repairTableColumn.push({name:"原因",key:"reason"});
|
this.repairTableColumn.push({ name: "原因", key: "reason" });
|
||||||
this.repairTableColumn.push({name:"登记人",key:"registerUserName"});
|
this.repairTableColumn.push({ name: "登记人", key: "registerUserName" });
|
||||||
this.repairTableColumn.push({name:"登记时间",key:"registerTime"});
|
this.repairTableColumn.push({ name: "登记时间", key: "registerTime" });
|
||||||
}
|
}
|
||||||
|
|
||||||
public getAreaList(){
|
public getAreaList() {
|
||||||
this.areaService.selectByPage({pageSize:10}).then((res:any)=>{
|
this.areaService.selectByPage({ pageSize: 10 }).then((res: any) => {
|
||||||
this.areaList = res.data.datas.map(item=>{
|
this.areaList = res.data.datas.map(item => {
|
||||||
this.areaNoMap[item.id] = item.number;
|
this.areaNoMap[item.id] = item.number;
|
||||||
return {
|
return {
|
||||||
name:item.name,
|
name: item.name,
|
||||||
value:item.id
|
value: item.id
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.buildFormOptions()
|
this.buildFormOptions()
|
||||||
|
|
@ -385,117 +393,120 @@ export default class UnitManagerComponent extends BaseRecordComponent<any> {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public doDraw(){
|
public doDraw() {
|
||||||
console.log("openDraw")
|
if (!this.updateParams.name) {
|
||||||
if(!this.updateParams.name){
|
|
||||||
this.$message.error("请先输入单元名称");
|
this.$message.error("请先输入单元名称");
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.drawModel = "unit";
|
this.drawModel = "unit";
|
||||||
this.showDraw = true;
|
this.showDraw = true;
|
||||||
}
|
}
|
||||||
public getCreateNumber(params){
|
public getCreateNumber(params) {
|
||||||
this.tableService.getUnitNumber(params).then((res)=>{
|
this.tableService.getUnitNumber(params).then((res) => {
|
||||||
this.updateParams.number = res.data;
|
this.updateParams.number = res.data;
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
public doSave(goOn?){
|
public doSave(goOn?) {
|
||||||
this.tableService.addOrUpdate(this.updateParams,this.currentId===-1).then((res)=>{
|
this.tableService.addOrUpdate(this.updateParams, this.currentId === -1).then((res) => {
|
||||||
this.$message.success(this.currentId===-1?"新增成功!":"修改成功!");
|
this.$message.success(this.currentId === -1 ? "新增成功!" : "修改成功!");
|
||||||
if(goOn){
|
if (goOn) {
|
||||||
this.updateParams = {bottomHeight:0,topHeight:0,geoJson:"[]",status:1,number:null} as any;
|
this.updateParams = { bottomHeight: 0, topHeight: 0, geoJson: "[]", status: 1, number: null } as any;
|
||||||
}else{
|
} else {
|
||||||
this.handleClose();
|
this.handleClose();
|
||||||
}
|
}
|
||||||
this.getTableData();
|
this.getTableData();
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
public change(data,item){
|
public change(data, item) {
|
||||||
// 新增编辑选择部门
|
// 新增编辑选择部门
|
||||||
if(item && item.key === "chargeDeptId"){
|
if (item && item.key === "chargeDeptId") {
|
||||||
this.updateParams.chargeDeptName = this.$store.getters.dept_map[data];
|
this.updateParams.chargeDeptName = this.$store.getters.dept_map[data];
|
||||||
}
|
}
|
||||||
// 新增编辑选择人员
|
// 新增编辑选择人员
|
||||||
if(item && item.key === "chargeUserId"){
|
if (item && item.key === "chargeUserId") {
|
||||||
this.updateParams.chargeUserName = this.$store.getters.user_map[data];
|
this.updateParams.chargeUserName = this.$store.getters.user_map[data];
|
||||||
}
|
}
|
||||||
// 新增编辑选择区域
|
// 新增编辑选择区域
|
||||||
if(item && item.key === "areaId"){
|
if (item && item.key === "areaId") {
|
||||||
this.updateParams.areaNo = this.areaNoMap[data];
|
this.updateParams.areaNo = this.areaNoMap[data];
|
||||||
this.getCreateNumber({areaNo:this.updateParams.areaNo})
|
this.getCreateNumber({ areaNo: this.updateParams.areaNo })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public callback(data,type){
|
public callback(data, type) {
|
||||||
if(type){
|
if (type) {
|
||||||
this.params[type] = data;
|
this.params[type] = data;
|
||||||
this.getTableData();
|
this.getTableData();
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// 查询
|
// 查询
|
||||||
if(data && data.value==="search"){
|
if (data && data.value === "search") {
|
||||||
this.getTableData()
|
this.getTableData()
|
||||||
// 重置
|
// 重置
|
||||||
}else if(data && data.value === "reset"){
|
} else if (data && data.value === "reset") {
|
||||||
this.reset()
|
this.reset()
|
||||||
// 反选
|
// 反选
|
||||||
}else if(data && data.value === "reverse"){
|
} else if (data && data.value === "reverse") {
|
||||||
this.toggleAll()
|
this.toggleAll()
|
||||||
// 全选
|
// 全选
|
||||||
}else if(data && data.value === "selectAll"){
|
} else if (data && data.value === "selectAll") {
|
||||||
this.selectAll()
|
this.selectAll()
|
||||||
}else if(data && data.value === "add"){
|
} else if (data && data.value === "add") {
|
||||||
this.showUpdateModel()
|
this.showUpdateModel()
|
||||||
}else if(data && data.value === "delete"){
|
} else if (data && data.value === "delete") {
|
||||||
this.deleteData(this.selectData.map((item:any)=>item.id))
|
this.deleteData(this.selectData.map((item: any) => item.id))
|
||||||
}else if(data && (data.value === "draw" || data.value==="readDraw")){
|
} else if (data && (data.value === "draw" || data.value === "readDraw")) {
|
||||||
this.doDraw()
|
this.doDraw()
|
||||||
}else if(data && data.value === "drawList"){
|
} else if (data && data.value === "drawList") {
|
||||||
this.drawModel = "list";
|
this.drawModel = "list";
|
||||||
this.showDraw = true;
|
this.showDraw = true;
|
||||||
}else if(data && data.value === "submit"){
|
} else if (data && data.value === "submit") {
|
||||||
this.doSave()
|
this.doSave()
|
||||||
}else if(data && data.value === "saveAndContinue"){
|
} else if (data && data.value === "saveAndContinue") {
|
||||||
this.doSave(true)
|
this.doSave(true)
|
||||||
}else if(data && data.value === "cancel"){
|
} else if (data && data.value === "cancel") {
|
||||||
this.updateParams = {} as any;
|
this.updateParams = {} as any;
|
||||||
this.handleClose();
|
this.handleClose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 重置数据
|
// 重置数据
|
||||||
public reset(){
|
public reset() {
|
||||||
this.params = {
|
this.params = {
|
||||||
name:null,
|
name: null,
|
||||||
chargeDeptId:null,
|
chargeDeptId: null,
|
||||||
pageNum:1,
|
pageNum: 1,
|
||||||
pageSize:20,
|
pageSize: 20,
|
||||||
} as any;
|
} as any;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public showUpdateModel(data?,isRead?){
|
public showUpdateModel(data?, isRead?) {
|
||||||
if(!data){
|
if (!data) {
|
||||||
this.currentId = -1;
|
this.currentId = -1;
|
||||||
this.updateParams = {bottomHeight:0,topHeight:0,geoJson:"[]",status:1,number:null} as any;
|
this.updateParams = { bottomHeight: 0, topHeight: 0, geoJson: "[]", status: 1, number: null } as any;
|
||||||
this.showUpdate = true
|
this.showUpdate = true
|
||||||
}else{
|
} else {
|
||||||
this.currentId = data.id;
|
this.currentId = data.id;
|
||||||
this.updateParams = Object.assign({areaName:this.areaList.find(item=>item.value===data.areaId)?.name,bottomHeight:0,topHeight:0,status:1,geoJson:"[]",number:null,statusName:["停用","启用"][data.status]},data);
|
|
||||||
if(isRead){
|
this.updateParams = Object.assign({ areaName: this.areaList.find(item => item.value === data.areaId)?.name, bottomHeight: 0, topHeight: 0, status: 1, geoJson: "[]", number: null, statusName: ["停用", "启用"][data.status] }, data);
|
||||||
this.repairTableData.datas = this.updateParams.repairs.map((item,i)=>{
|
this.tableService.getUnitDetail({ unitId: data.id }).then((res: any) => {
|
||||||
item.index = i+1;
|
this.updateParams.repairs = res.data;
|
||||||
|
if (isRead) {
|
||||||
|
this.repairTableData.datas = this.updateParams.repairs.map((item, i) => {
|
||||||
|
item.index = i + 1;
|
||||||
return item
|
return item
|
||||||
}) || []
|
}) || []
|
||||||
}
|
}
|
||||||
|
})
|
||||||
this.isReadonly = !!isRead;
|
this.isReadonly = !!isRead;
|
||||||
|
}
|
||||||
|
this.showUpdate = true;
|
||||||
this.buildFormOptions();
|
this.buildFormOptions();
|
||||||
}
|
}
|
||||||
this.showUpdate = true
|
|
||||||
}
|
|
||||||
|
|
||||||
public handleClose(){
|
public handleClose() {
|
||||||
this.updateParams = {} as any;
|
this.updateParams = {} as any;
|
||||||
this.showUpdate = false;
|
this.showUpdate = false;
|
||||||
this.currentId = -1;
|
this.currentId = -1;
|
||||||
|
|
@ -505,24 +516,24 @@ export default class UnitManagerComponent extends BaseRecordComponent<any> {
|
||||||
|
|
||||||
public toggleAll() {
|
public toggleAll() {
|
||||||
|
|
||||||
this.tableData.datas.forEach((item,index)=>{
|
this.tableData.datas.forEach((item, index) => {
|
||||||
(this.$refs.multipleTable as any).toggleRowSelection(item);
|
(this.$refs.multipleTable as any).toggleRowSelection(item);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
public selectAll(){
|
public selectAll() {
|
||||||
if(!this.selectData.length){
|
if (!this.selectData.length) {
|
||||||
this.toggleAll()
|
this.toggleAll()
|
||||||
}else{
|
} else {
|
||||||
this.tableData.datas.forEach((item,index)=>{
|
this.tableData.datas.forEach((item, index) => {
|
||||||
const find = this.selectData.find((data:any)=>data.id === item.id);
|
const find = this.selectData.find((data: any) => data.id === item.id);
|
||||||
if(!find){
|
if (!find) {
|
||||||
(this.$refs.multipleTable as any).toggleRowSelection(item);
|
(this.$refs.multipleTable as any).toggleRowSelection(item);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public handleSelectionChange(data){
|
public handleSelectionChange(data) {
|
||||||
this.selectData = data;
|
this.selectData = data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue