feat:修复bug

dev
kongyeqing 2023-09-14 15:24:34 +08:00
parent f573d9a3ae
commit 453c33e629
7 changed files with 87 additions and 29 deletions

View File

@ -491,6 +491,12 @@ export default class HiddenDangerClapComponent extends BaseRecordComponent<any>
return return
} }
} }
if (item && item.key === 'violateNumber') {
this.updateParams.violateNumber = null
setTimeout(()=>{
this.updateParams.violateNumber = +data.toFixed(0)
},0)
}
// //
} }

View File

@ -183,7 +183,7 @@ export default class RulesManagerComponent extends BaseRecordComponent<any> {
require: true, require: true,
showError: false, showError: false,
datas: this.areaList, datas: this.areaList,
clearable:true, clearable: true,
}, { }, {
name: "适用单元", name: "适用单元",
key: "units", key: "units",
@ -193,7 +193,7 @@ export default class RulesManagerComponent extends BaseRecordComponent<any> {
require: true, require: true,
showError: false, showError: false,
datas: this.unitList, datas: this.unitList,
clearable:true, clearable: true,
}, { }, {
name: "适用对象", name: "适用对象",
key: "targets", key: "targets",
@ -203,7 +203,7 @@ export default class RulesManagerComponent extends BaseRecordComponent<any> {
require: true, require: true,
showError: false, showError: false,
datas: this.$store.state.analControlList, datas: this.$store.state.analControlList,
clearable:true, clearable: true,
}, { }, {
name: "适用部门", name: "适用部门",
key: "depts", key: "depts",
@ -213,7 +213,7 @@ export default class RulesManagerComponent extends BaseRecordComponent<any> {
require: true, require: true,
showError: false, showError: false,
datas: this.$store.state.deptList, datas: this.$store.state.deptList,
clearable:true, clearable: true,
}, { }, {
name: "适用类型", name: "适用类型",
key: "types", key: "types",
@ -223,7 +223,7 @@ export default class RulesManagerComponent extends BaseRecordComponent<any> {
multiple: true, multiple: true,
showError: false, showError: false,
datas: this.$store.state.prevention_dangrous_type, datas: this.$store.state.prevention_dangrous_type,
clearable:true, clearable: true,
}] }]
this.updateActions = [{ this.updateActions = [{
name: "取消", name: "取消",
@ -291,6 +291,12 @@ export default class RulesManagerComponent extends BaseRecordComponent<any> {
} }
// //
public loadUnitData(ids?) { public loadUnitData(ids?) {
if (!ids || ids.length === 0) {
this.unitList = []
const option = this.updateOptions.find(item => item.key === "units") as any;
option.datas = this.unitList
return
}
this.unitService.getListByIds({ areaIds: ids }, false).then((res: any) => { this.unitService.getListByIds({ areaIds: ids }, false).then((res: any) => {
this.unitList = res.data.map(item => { this.unitList = res.data.map(item => {
return { return {
@ -348,12 +354,15 @@ export default class RulesManagerComponent extends BaseRecordComponent<any> {
} }
public change(data, item) { public change(data, item) {
console.log('item', item);
console.log('data', data);
// //
if (item && item.key === "areas") { if (item && item.key === "areas") {
if (this.updateParams.units.length) { if (this.updateParams.units.length) {
this.updateParams.units = []; this.updateParams.units = [];
} }
this.loadUnitData(data) this.loadUnitData(data)
} }
} }

View File

@ -161,6 +161,10 @@ export default class IntegralCenter extends BaseRecordComponent<any> {
this.getTableData() this.getTableData()
} }
public change(data, item) {
//
}
public handleClose() { public handleClose() {
this.showUpdate = false; this.showUpdate = false;
} }

View File

@ -49,7 +49,7 @@
<el-dialog :close-on-click-modal="false" :title="isReadonly ?'详情':updateParams.id ?'编辑': '新增'" <el-dialog :close-on-click-modal="false" :title="isReadonly ?'详情':updateParams.id ?'编辑': '新增'"
:visible.sync="showUpdate" width="952px" :before-close="handleClose" destroy-on-close> :visible.sync="showUpdate" width="952px" :before-close="handleClose" destroy-on-close>
<FormComponent :options="updateOptions" labelWidth="110px" labelAlign="right" :data.sync="updateParams" <FormComponent :options="updateOptions" labelWidth="110px" labelAlign="right" :data.sync="updateParams"
:isReadonly="isReadonly" @actionCallback="subCallback" :actions="updateActions" :full-btn="true" :isReadonly="isReadonly" @actionCallback="subCallback" :actions="updateActions" :full-btn="true" @change="change"
btnPosition="center"> btnPosition="center">
</FormComponent> </FormComponent>
</el-dialog> </el-dialog>

View File

@ -171,6 +171,10 @@ export default class IntegralEvent extends BaseRecordComponent<any> {
pageNum: 1, pageNum: 1,
pageSize: 20, pageSize: 20,
} as any; } as any;
this.getTableData()
}
public change(data, item) {
//
} }
public handleClose() { public handleClose() {

View File

@ -105,6 +105,7 @@ export default class IntegralMall extends BaseRecordComponent<any> {
key: "number", key: "number",
require: true, require: true,
width: "calc(50% - 20px)", width: "calc(50% - 20px)",
showError:false,
}, },
{ {
name: " 商品名称", name: " 商品名称",
@ -112,6 +113,7 @@ export default class IntegralMall extends BaseRecordComponent<any> {
key: "name", key: "name",
require: true, require: true,
width: "calc(50% - 20px)", width: "calc(50% - 20px)",
showError:false,
}, },
{ {
name: "库存数量", name: "库存数量",
@ -119,10 +121,11 @@ export default class IntegralMall extends BaseRecordComponent<any> {
key: "stockNumber", key: "stockNumber",
require: true, require: true,
width: "calc(50% - 20px)", width: "calc(50% - 20px)",
// rules: [ showError:false,
// { pattern: /^1[3|5|7|8|9]\d{9}$/, message: '', } rules: [
// ], { pattern: /^\d{1,5}$/, message: '在1~99999范围内', }
max: 99999, ],
// max: 99999,
min: 1 min: 1
}, },
{ {
@ -162,10 +165,10 @@ export default class IntegralMall extends BaseRecordComponent<any> {
}, },
{ {
name: "商品照片", name: "商品照片",
key: "resourceId", key: "photo",
ref: "photo", ref: "photo",
type: "upload", type: "upload",
width: "calc(50% - 20px)", width: "100%",
require: true, require: true,
onSucess: this.onSuccess, onSucess: this.onSuccess,
onMove: this.onRemove, onMove: this.onRemove,
@ -252,6 +255,8 @@ export default class IntegralMall extends BaseRecordComponent<any> {
this.isReadonly = false; this.isReadonly = false;
this.photoList = [] as any; this.photoList = [] as any;
this.buildUpdateForm() this.buildUpdateForm()
//
this.clearFileListMethod()
this.showUpdate = true this.showUpdate = true
} }
} }
@ -269,10 +274,13 @@ export default class IntegralMall extends BaseRecordComponent<any> {
pageNum: 1, pageNum: 1,
pageSize: 20, pageSize: 20,
} as any; } as any;
this.getTableData()
} }
public handleClose() { public handleClose() {
this.showUpdate = false; this.showUpdate = false;
//
this.clearFileListMethod()
} }
@ -301,7 +309,9 @@ export default class IntegralMall extends BaseRecordComponent<any> {
public subCallback(data) { public subCallback(data) {
if (data.value === "cancel") { if (data.value === "cancel") {
this.showUpdate = false this.showUpdate = false;
//
this.clearFileListMethod()
} else if (data && data.value.indexOf("save") >= 0) { } else if (data && data.value.indexOf("save") >= 0) {
this.doSave(data.value !== "save") this.doSave(data.value !== "save")
} }
@ -309,20 +319,21 @@ export default class IntegralMall extends BaseRecordComponent<any> {
public onSuccess(res, file, fileList) { public onSuccess(res, file, fileList) {
if (res.code === 200) { if (res.code === 200) {
this.photoList = []
this.photoList = [{ this.photoList = [{
name: res.data.originalName, name: res.data.originalName,
url: res.data.url, url: res.data.url,
type: res.data.type, type: res.data.type,
id: res.data.id id: res.data.id
}] }]
this.updateParams.resourceId = this.photoList.length || null; this.updateParams.photo = this.photoList.length || null;
this.buildUpdateForm() this.buildUpdateForm()
} }
} }
public onRemove(file, fileList) { public onRemove(file, fileList) {
this.photoList.splice(this.photoList.findIndex(item => item.id === file.id), 1) this.photoList.splice(this.photoList.findIndex(item => item.id === file.id), 1)
this.updateParams.resourceId = this.photoList.length || null; this.updateParams.photo = this.photoList.length || null;
} }
public onPreview(file) { public onPreview(file) {
@ -343,6 +354,7 @@ export default class IntegralMall extends BaseRecordComponent<any> {
let resourceName = this.photoList.map((item) => { let resourceName = this.photoList.map((item) => {
return item.name return item.name
}) })
this.updateParams.resourceId = resourceId.join(",") this.updateParams.resourceId = resourceId.join(",")
this.updateParams.resourceName = resourceName.join(",") this.updateParams.resourceName = resourceName.join(",")
} else { } else {
@ -359,14 +371,11 @@ export default class IntegralMall extends BaseRecordComponent<any> {
}) })
} }
public change(data, item) {
public showModal(row, isReadonly) { //
if (isReadonly) {
this.isReadonly = true
} else {
this.isReadonly = false
} }
public showModal(row, isReadonly = false) {
this.isReadonly = isReadonly
this.tableService.getListDetail({ id: row.id }).then((res: any) => { this.tableService.getListDetail({ id: row.id }).then((res: any) => {
if (res.code === 200) { if (res.code === 200) {
this.updateParams = Object.assign({ this.updateParams = Object.assign({
@ -382,7 +391,7 @@ export default class IntegralMall extends BaseRecordComponent<any> {
id: item.id id: item.id
} }
}) })
this.updateParams.resourceId = '' this.updateParams.photo = isReadonly ? null : this.photoList.length
this.buildUpdateForm() this.buildUpdateForm()
}) })
} }
@ -399,6 +408,15 @@ export default class IntegralMall extends BaseRecordComponent<any> {
this.currentUrl = data this.currentUrl = data
this.showFile = true; this.showFile = true;
} }
/**
* 清除附件数据
*/
public clearFileListMethod() {
this.photoList = [];
const option = this.updateOptions.find(item => item.key === "photo") as any;
option.fileList = [];
}
} }
</script> </script>
<style lang="scss" scoped src="../common.component.scss"></style> <style lang="scss" scoped src="../common.component.scss"></style>

View File

@ -79,8 +79,8 @@ export default class IntegralRule extends BaseRecordComponent<any> {
}]; }];
public formOptions: FormOption<BtnOption>[] = [{ public formOptions: FormOption<BtnOption>[] = [{
name: "规则名称", name: "规则编号",
key: "controlName", key: "number",
type: "text", type: "text",
}]; }];
@ -104,12 +104,14 @@ export default class IntegralRule extends BaseRecordComponent<any> {
require: true, require: true,
width: "calc(50% - 20px)", width: "calc(50% - 20px)",
disable: true, disable: true,
showError: false,
}, },
{ {
name: "规则类型", name: "规则类型",
type: "select", type: "select",
key: "type", key: "type",
format: "typeName", format: "typeName",
showError: false,
require: true, require: true,
width: "calc(50% - 20px)", width: "calc(50% - 20px)",
datas: this.$store.state.prevention_integral_type datas: this.$store.state.prevention_integral_type
@ -120,6 +122,7 @@ export default class IntegralRule extends BaseRecordComponent<any> {
key: "description", key: "description",
require: true, require: true,
width: "100%", width: "100%",
showError: false,
}, },
{ {
name: "事件", name: "事件",
@ -135,9 +138,10 @@ export default class IntegralRule extends BaseRecordComponent<any> {
name: "分值", name: "分值",
type: "number", type: "number",
key: "point", key: "point",
require: true, require: !(this.updateParams.type === 3),
width: "calc(50% - 20px)", width: "calc(50% - 20px)",
showError: false, showError: false,
disable: (this.updateParams.type === 3)
}, },
{ {
name: "状态", name: "状态",
@ -265,6 +269,7 @@ export default class IntegralRule extends BaseRecordComponent<any> {
pageNum: 1, pageNum: 1,
pageSize: 20, pageSize: 20,
} as any; } as any;
this.getTableData()
} }
public handleClose() { public handleClose() {
@ -291,6 +296,18 @@ export default class IntegralRule extends BaseRecordComponent<any> {
} }
} }
public change(data, item) {
if (item && item.key === 'type') {
const option = this.updateOptions.find(item => item.key === "point") as any;
option.disable = data === 3 ? true : false;
option.require = data === 3 ? false : true;
if (data === 3) {
this.updateParams.point = null;
option.showError = false
}
}
}
public handleSelectionChange(data) { public handleSelectionChange(data) {
this.selectData = data; this.selectData = data;
} }