Browse Source

应急人员完成

wangqin
Joe 10 months ago
parent
commit
fd27c971b2
  1. 22
      ruoyi-ui/src/views/JiHeExpressway/components/FormConfig/index.vue
  2. 10
      ruoyi-ui/src/views/JiHeExpressway/components/FormConfig/utils/index.js
  3. 4
      ruoyi-ui/src/views/JiHeExpressway/pages/control/event/businessDataManagement/components/PeopleCard/index.vue
  4. 20
      ruoyi-ui/src/views/JiHeExpressway/pages/control/event/businessDataManagement/index.vue
  5. 2
      ruoyi-ui/src/views/JiHeExpressway/pages/control/event/businessDataManagement/views/emergencyAgencies/index.vue
  6. 189
      ruoyi-ui/src/views/JiHeExpressway/pages/control/event/businessDataManagement/views/firstResponders/components/AddNEditDialog.vue
  7. 32
      ruoyi-ui/src/views/JiHeExpressway/pages/control/event/businessDataManagement/views/firstResponders/index.vue
  8. 2
      ruoyi-ui/src/views/JiHeExpressway/pages/control/event/businessDataManagement/views/jurisdictionalManagement/index.vue

22
ruoyi-ui/src/views/JiHeExpressway/components/FormConfig/index.vue

@ -16,7 +16,7 @@
</template>
<script>
import { resolveName, defaultComponentOptions } from "./utils/index";
import { resolveName, defaultComponentOptions, RegexpMap } from "./utils/index";
import { reduceDefaultValue } from "./utils/defaultValue";
import { set as pathSet, get as pathGet, cloneDeep } from "lodash";
@ -188,11 +188,27 @@ export default {
{
validator: (_, __, callback) => {
const value = pathGet(this.modelFormData, item.key)
if (!value && typeof value === 'object') return callback(new Error(`${item.options?.placeholder || `${item.label}不能为空`}`))
if (!value && typeof value === 'object' || typeof value === 'string' && !value.trim()) return callback(new Error(`${item.options?.placeholder || `${item.label}不能为空`}`))
/**
* @type {{ callback?: (value: any) => boolean; type?: "phone"; message: string; }[]}
*/
const rules = item.rules || [];
for (let index = 0; index < rules.length; index++) {
const rule = rules[index];
if (typeof rule.callback === 'function') {
if (!rule.callback(value)) return new Error(rule.message || "内容错误");
}
else if (RegexpMap[rule.type]) {
if (!RegexpMap[rule.type].reg.test(value)) return callback(new Error(rule.message || RegexpMap[rule.type].message))
}
}
callback()
},
trigger: "blur",
trigger: ["blur", "change"],
},
]
},

10
ruoyi-ui/src/views/JiHeExpressway/components/FormConfig/utils/index.js

@ -7,3 +7,13 @@ export const defaultComponentOptions = {
placeholder: "请选择",
},
};
/**
* @type {Record<string, { reg: RegExp; message: string; }>}
*/
export const RegexpMap = {
phone: {
message: "手机号码格式不正确",
reg: /^[1][3,4,5,6,7,8,9][0-9]{9}$/,
},
};

4
ruoyi-ui/src/views/JiHeExpressway/pages/control/event/businessDataManagement/components/PeopleCard/index.vue

@ -9,8 +9,8 @@
</p>
</div>
<div class="btns">
<Button :style="{ background: '#00B3CC' }">修改</Button>
<Button :style="{ background: '#FF5F5F' }">删除</Button>
<Button @click.native="$emit('edit', cardData)" :style="{ background: '#00B3CC' }">修改</Button>
<Button @click.native="$emit('delete', cardData)" :style="{ background: '#FF5F5F' }">删除</Button>
</div>
</BorderRadiusImage>
</template>

20
ruoyi-ui/src/views/JiHeExpressway/pages/control/event/businessDataManagement/index.vue

@ -11,8 +11,8 @@
<!-- 分页 -->
<div class="footer">
<Pagination :total="total" :page-size="30" :page-sizes="[30, 60, 90]" @size-change="handleSizeChange"
@current-change="handleCurrentChange" />
<Pagination :total="total" :current-page.sync="currentPage" :page-size="30" :page-sizes="[30, 60, 90]"
@size-change="handleSizeChange" @current-change="handleCurrentChange" />
</div>
</div>
</template>
@ -41,9 +41,10 @@ export default {
return {
getPagination: () => ({
pageSize: this.pageSize || 30,
pageNum: this.pageNum || 1
pageNum: this.currentPage || 1
}),
setTotal: (total) => this.total = total
setTotal: (total) => this.total = total,
setCurrentPage: page => this.currentPage = page
}
},
data() {
@ -67,19 +68,20 @@ export default {
key: "JurisdictionalManagement"
},
],
total: 0
total: 0,
currentPage: 1
}
},
methods: {
handleSelect(activeName) {
this.pageNum = 1;
this.currentPage = 1;
this.activeName = activeName;
},
handleSizeChange(size) {
this.pageNum = size;
this.pageSize = size;
},
handleCurrentChange(currentPage) {
this.pageNum = currentPage;
handleCurrentChange() {
this.$refs.viewRef.getData();
},
}
}

2
ruoyi-ui/src/views/JiHeExpressway/pages/control/event/businessDataManagement/views/emergencyAgencies/index.vue

@ -133,7 +133,7 @@ export default {
if (result.code != 200) return;
this.data = result.data;
this.total = result.total;
this.setTotal(result.total)
}).finally(() => {
closeLoading();
})

189
ruoyi-ui/src/views/JiHeExpressway/pages/control/event/businessDataManagement/views/firstResponders/components/AddNEditDialog.vue

@ -0,0 +1,189 @@
<template>
<Dialog v-model="modelVisible" :title="data ? '编辑' : '新增'">
<div class='DeviceControlDialog'>
<Form v-model="formData" class="form" ref="FormConfigRef" :formList="formList" column="1" labelWidth="90px" />
</div>
<template #footer>
<Button style="background-color: rgba(0, 179, 204, .3);" @click.native="modelVisible = false, submitting = false">
取消
</Button>
<Button @click.native="handleSubmit" :loading="submitting">
确定
</Button>
</template>
</Dialog>
</template>
<script>
import Dialog from "@screen/components/Dialog/index.vue";
import Button from "@screen/components/Buttons/Button.vue"
import Form from '@screen/components/FormConfig';
import request from "@/utils/request";
import { Message } from "element-ui";
export default {
name: 'DeviceControlDialog',
components: {
Dialog,
Button,
Form
},
model: {
prop: 'visible',
event: "update:value"
},
props: {
visible: Boolean,
data: Object
},
inject: ['setCurrentPage'],
data() {
return {
submitting: false,
formData: {},
formList: [
{
label: "人员名称:",
key: "name",
required: true
},
{
label: "手机号码:",
key: "contactNumber",
required: true,
rules: [
{
type: 'phone'
}
]
},
{
label: "岗位:",
key: "postId",
required: true,
type: "select",
options: {
options: []
}
},
{
label: "机构:",
key: "organizationId",
required: true,
type: "select",
options: {
options: []
}
},
]
}
},
computed: {
modelVisible: {
get() {
return this.visible
},
set(val) {
this.$emit('update:value', val)
}
}
},
watch: {
modelVisible: {
immediate: true,
handler(bool) {
if (!bool) return;
this.formData = {
...this.data
}
this.getOptions();
}
}
},
methods: {
getOptions() {
Promise.allSettled([
//
request({
url: `/business/employees/sysPost`,
method: "post",
data: {}
}),
//
request({
url: `/business/employees/organization`,
method: "post",
data: {}
})
])
.then(([post, organization]) => {
if (post.status === 'fulfilled' && post.value.code == 200) {
this.formList[2].options.options = post.value.data.map(item => ({
key: item.postId + "",
label: item.postName,
}))
}
if (organization.status === 'fulfilled' && organization.value.code == 200) {
this.formList[3].options.options = organization.value.data.map(item => ({
key: item.id,
label: item.organizationName,
}))
}
})
},
handleSubmit() {
this.$refs.FormConfigRef.validate()
.then((data) => {
this.submitting = true;
if (this.data) data.id = this.data.id;
request({
url: `/business/employees`,
method: this.data ? 'PUT' : 'POST',
data
})
.then(() => {
this.$parent.getData();
Message.success(`提交成功!`);
this.modelVisible = false;
this.setCurrentPage(1)
})
.catch((err) => {
console.log("%c [ err ]-110-「DeviceControlDialog.vue」", "font-size:15px; background:#547bf2; color:#98bfff;", err);
Message.error(`提交失败!`);
})
.finally(() => {
this.submitting = false;
})
})
}
},
}
</script>
<style lang='scss' scoped>
.DeviceControlDialog {
width: 450px;
height: 150px;
display: flex;
flex-direction: column;
gap: 15px;
.tips {
font-size: 12px;
}
}
</style>

32
ruoyi-ui/src/views/JiHeExpressway/pages/control/event/businessDataManagement/views/firstResponders/index.vue

@ -2,7 +2,7 @@
<div class='FirstResponders'>
<div class="filter">
<div>
<ButtonGradient>
<ButtonGradient @click.native="handleOpenDialogAddEdit()">
<template #prefix>
<img src="@screen/images/insert.svg" />
</template>
@ -29,9 +29,12 @@
<div class='body'>
<ElEmpty v-if="!data.length" description="暂无数据" style="width: 100%;height: 100%;position: absolute;" />
<template v-else>
<PeopleCard v-for="(item, index) in data" :buttonIcon="null" :cardData="item" :key="index" buttonText="详情" />
<PeopleCard v-for="(item, index) in data" :cardData="item" :key="index"
@edit="data => handleOpenDialogAddEdit(data)" @delete="handleDelete" />
</template>
</div>
<AddNEditDialog v-model="addNEditDialogVisible" :data="dialogData" />
</div>
</template>
@ -39,6 +42,7 @@
import PeopleCard from "./../../components/PeopleCard/index.vue";
import InputSearch from '@screen/components/InputSearch/index.vue';
import ButtonGradient from '@screen/components/Buttons/ButtonGradient.vue';
import AddNEditDialog from "./components/AddNEditDialog.vue"
import { searchFormList } from "./data";
import request from "@/utils/request";
@ -51,13 +55,16 @@ export default {
components: {
PeopleCard,
ButtonGradient,
InputSearch
InputSearch,
AddNEditDialog
},
inject: ['getPagination', 'setTotal'],
data() {
return {
searchFormList,
data: []
data: [],
addNEditDialogVisible: false,
dialogData: null
}
},
created() {
@ -65,6 +72,17 @@ export default {
this.getSearchOptions();
},
methods: {
handleDelete() {
// request({
// url: `/business/employees/sysPost`,
// method: "post",
// data: {}
// })
},
handleOpenDialogAddEdit(data) {
this.addNEditDialogVisible = true;
this.dialogData = data;
},
getSearchOptions() {
Promise.allSettled([
//
@ -94,9 +112,6 @@ export default {
label: item.organizationName,
}))
}
console.log(this.searchFormList)
})
},
handleExport() {
@ -128,7 +143,8 @@ export default {
}).then(result => {
if (result.code != 200) return;
this.data = result.rows;
this.total = result.total;
this.setTotal(result.total)
// this.setTotal(90)
}).finally(() => {
closeLoading();
})

2
ruoyi-ui/src/views/JiHeExpressway/pages/control/event/businessDataManagement/views/jurisdictionalManagement/index.vue

@ -142,7 +142,7 @@ export default {
}).then(result => {
if (result.code != 200) return;
this.data = result.rows;
this.total = result.total;
this.setTotal(result.total)
}).finally(() => {
closeLoading();
})

Loading…
Cancel
Save