Files
sgxt_web/src/views/backOfficeSystem/DeploymentDisposal/mpvGroup/model/joblogging.vue
2025-09-07 23:50:16 +08:00

233 lines
4.9 KiB
Vue

<template>
<div>
<div class="headClass" style="">
<h3>工作记录</h3>
<el-button type="primary" v-if="showBut" @click="openHistory">新增</el-button>
</div>
<MyTable :tableData="pageData.tableData" :tableColumn="pageData.tableColumn" :tableHeight="pageData.tableHeight"
:key="pageData.keyCount" :tableConfiger="pageData.tableConfiger" :controlsWidth="pageData.controlsWidth">
<template #fj="{ row }">
<span v-for="(item, index) in row.fj" :key="index">{{ item.originalName }}<span
v-if="index < row.fj.length - 1">,</span></span>
</template>
<!-- 操作 -->
<template #controls="{ row }">
<el-link type="danger" @click="modification(row)">修改</el-link>
<el-link type="danger" @click="delDictItem(row.id)">删除</el-link>
</template>
</MyTable>
</div>
<Record v-model="recordShow" @comfirm="onComfirm" :data="dataAmend" />
</template>
<script setup>
import { ref, reactive, watch, toRaw, getCurrentInstance, onMounted, onUnmounted } from "vue";
import MyTable from "@/components/aboutTable/MyTable.vue";
import { ElMessageBox } from 'element-plus'
import { tbZdqtGzjlAdd, tbZdqtGzjlDelete, tbZdqtGzjlSelectPage, tbZdqtGzjlUpdate } from '@/api/qt.js'
import Record from "../component/record.vue";
const props = defineProps({
dataList: {
type: Object,
default: () => { },
}, disabled: {
type: Boolean,
default: false
},
showBut: {
type: Boolean,
default: false
},
})
const { proxy } = getCurrentInstance();
const pageData = reactive({
tableData: [],
tableColumn: [{
prop: 'xm',
label: '民警',
}, {
prop: 'sfzh',
label: '身份证号',
}, {
prop: 'gzjl',
label: '工作记录',
},{
prop: 'ssbm',
label: '所属部门',
},{
prop: 'gzjl',
label: '工作记录',
}, {
prop: 'fj',
label: '附件',
showSolt: true
}],
tableHeight: '200px',
keyCount: 0,
tableConfiger: {
border: true,
stripe: true,
showHeader: true,
showIndex: true,
indexLabel: '序号',
indexWidth: 60,
align: 'center',
showOverflowTooltip: true,
},
controlsWidth: 120,
})
const listData = ref({})
const butShow = ref(true)
watch(() => props.dataList, (val) => {
if (val) {
listData.value = val
gettbZdqtLsjhSelectPage()
}
}, { deep: true })
const recordShow = ref(false);
const dataAmend = ref({});
const onComfirm = (val) => {
let promes = {
gzjl: val.gzjl,
sfzh: val.sfzh,
ssbm: val.ssbm,
ssbmdm:val.ssbmdm,
xm: val.xm,
fj: val.fileList.length > 0 ? JSON.stringify(val.fileList) : '',
qtid: listData.value.id
}
if (butShow.value) {
tbZdqtGzjlAdd(promes).then((res) => {
gettbZdqtLsjhSelectPage()
proxy.$message({
message: '添加成功',
type: 'success'
})
})
} else {
promes.id=val.id
tbZdqtGzjlUpdate(promes).then((res) => {
gettbZdqtLsjhSelectPage()
proxy.$message({
message: '修改成功',
type: 'success'
})
})
}
}
const openHistory = () => {
butShow.value=true
recordShow.value = true;
}
// 列表
const gettbZdqtLsjhSelectPage = () => {
const promes = {
qtid: listData.value.id,
pageSize: 1000,
pageCurrent: 1
}
tbZdqtGzjlSelectPage(promes).then((res) => {
pageData.tableData = res.records.map(item => {
return {
...item,
fj: item.fj ? JSON.parse(item.fj) : [],
}
})
})
}
// 删除
const delDictItem = (val) => {
ElMessageBox.confirm(
'是否删除该记录?',
'提示',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}
)
.then(() => {
const promes = { ids: [val] }
tbZdqtGzjlDelete(promes).then((res) => {
gettbZdqtLsjhSelectPage()
proxy.$message({
message: '删除成功',
type: 'success'
})
})
})
.catch(() => {
ElMessage({
type: 'info',
message: '取消删除',
})
})
}
// 修改
const modification = (val) => {
butShow.value=false
recordShow.value = true;
dataAmend.value = val
}
</script>
<style lang="scss" scoped>
@import "~@/assets/css/layout.scss";
@import "~@/assets/css/element-plus.scss";
.backinfo-container {
padding: 10px;
}
.left_box {
width: 200px;
border: 1px solid #c8c8c89a;
border-radius: 5px;
padding: 5px;
}
.right_box {
width: calc(100% - 230px);
overflow-y: auto;
padding: 5px;
}
::v-deep .el-form-item__content {
display: block !important;
}
.headClass {
font-size: 18px;
font-weight: 600;
color: #303133;
margin: 0 0 10px 0;
padding-bottom: 10px;
border-bottom: 2px solid #409eff;
position: relative;
display: flex;
justify-content: space-between;
align-items: center;
}
.headClass::after {
content: '';
position: absolute;
left: 0;
bottom: -2px;
width: 60px;
height: 2px;
background-color: #409eff;
}
h3 {
margin: 0;
}
</style>