feature: 标准跟踪清单

This commit is contained in:
zyn
2024-01-30 13:38:54 +08:00
parent 0fff368258
commit ebe7df84d5
4 changed files with 145 additions and 16 deletions
@@ -123,6 +123,11 @@ export default {
FileList: [], // 用于回显 FileList: [], // 用于回显
} }
}, },
watch: {
ids (val) {
this.initFileList()
},
},
created () { created () {
this.initFileList() this.initFileList()
}, },
@@ -143,6 +148,9 @@ export default {
} }
this.fileList = fileList this.fileList = fileList
this.FileList = fileList this.FileList = fileList
} else {
this.fileList = []
this.FileList = []
} }
}, },
beforeUpload (file) { beforeUpload (file) {
@@ -19,7 +19,7 @@
<el-table <el-table
ref="selection" ref="selection"
class="table" class="table"
:data="data" :data="value"
tooltip-effect="dark" tooltip-effect="dark"
style="width:100%;height: calc(100% - 40px)" style="width:100%;height: calc(100% - 40px)"
height="string" height="string"
@@ -129,7 +129,7 @@ export default {
StandardListDrawer StandardListDrawer
}, },
props: { props: {
data: { value: {
type: Array, type: Array,
default: () => [] default: () => []
} }
@@ -151,7 +151,7 @@ export default {
this.selectedList = selection this.selectedList = selection
}, },
dragIn ({ list, type }) { dragIn ({ list, type }) {
if (list.some(item => this.data.some(i => i.id === item.id))) { if (list.some(item => this.value.some(i => i.lawId === item.id))) {
this.$message.warning('请勿重复添加数据') this.$message.warning('请勿重复添加数据')
return return
} }
@@ -171,7 +171,7 @@ export default {
break break
} }
return { return {
id: item.id, lawId: item.id,
dataSource: type, dataSource: type,
lawCode, lawCode,
lawName, lawName,
@@ -180,7 +180,7 @@ export default {
implRequire: '' implRequire: ''
} }
}) })
this.data.push(...newList) this.$emit('input', [ ...this.value, ...newList ])
}, },
handleDeleteStandard () { handleDeleteStandard () {
if (this.selectedList.length === 0) { if (this.selectedList.length === 0) {
@@ -194,7 +194,8 @@ export default {
confirmButtonClass: 'common-button-primary', confirmButtonClass: 'common-button-primary',
roundButton: true roundButton: true
}).then(() => { }).then(() => {
this.data = this.data.filter(item => !this.selectedList.some(i => i.id === item.id)) const list = this.value.filter(item => !this.selectedList.some(i => i.id === item.id))
this.$emit('input', list)
}) })
}, },
getDicTypeListCode () { getDicTypeListCode () {
@@ -30,8 +30,9 @@
<el-tab-pane label="核查清单" name="1" /> <el-tab-pane label="核查清单" name="1" />
<el-tab-pane label="人员信息" name="2" /> <el-tab-pane label="人员信息" name="2" />
</el-tabs> </el-tabs>
<Inventory v-show="activeName === '1'" :data="form.issueTrackList" /> <Inventory v-show="activeName === '1'" v-model="form.issueTrackList" />
<PersonInfo v-show="activeName === '2'" ref="roleForm" :roleForm="roleForm" :roleRules="roleRules" /> <PersonInfo v-show="activeName === '2'" ref="roleForm" :roleForm="roleForm" :roleRules="roleRules" />
<loading :loading="loading">数据获取中...</loading>
</el-form> </el-form>
</div> </div>
<div class="drawer-footer"> <div class="drawer-footer">
@@ -130,14 +131,18 @@ export default {
showDrawer: false, showDrawer: false,
isSubmit: false, isSubmit: false,
form, form,
initForm: JSON.parse(JSON.stringify(form)),
roleForm, roleForm,
initRoleForm: JSON.parse(JSON.stringify(roleForm)),
rules, rules,
roleRules, roleRules,
activeName: '1', activeName: '1',
url: { url: {
save: 'standardTrackingCheckList/save', save: 'standardTrackingCheckList/save',
update: 'standardTrackingCheckList/update', update: 'standardTrackingCheckList/update',
} getById: 'standardTrackingCheckList/getById',
},
loading: false,
} }
}, },
methods: { methods: {
@@ -146,11 +151,25 @@ export default {
}, },
add () { add () {
this.title = '新增' this.title = '新增'
// this.form = JSON.parse(JSON.stringify(this.initForm))
Object.keys(this.initForm).forEach(key => this.form[key] = this.initForm[key])
this.roleForm = JSON.parse(JSON.stringify(this.initRoleForm))
this.$nextTick(() => {
this.$refs.form.clearValidate()
this.$refs['roleForm'].$refs['userForm'].clearValidate()
})
this.showDrawer = true this.showDrawer = true
}, },
edit () { edit (id) {
this.title = '编辑' this.title = '编辑'
this.showDrawer = true this.showDrawer = true
const config = { _this: this, loading: 'loading' }
this.$http._getData(this.url.getById, { checklistId: id }, config).then(res => {
if (res.ok) {
this.form = res.data
this.roleForm = res.data.roleForm
}
})
}, },
onSubmit () { onSubmit () {
if (this.form.issueTrackList.length === 0) { if (this.form.issueTrackList.length === 0) {
@@ -164,14 +183,16 @@ export default {
return this.$message.warning('请完善人员信息'); return this.$message.warning('请完善人员信息');
const url = this.title === '新增' ? this.url.save : this.url.update const url = this.title === '新增' ? this.url.save : this.url.update
const method = this.title === '新增' ? '_postData' : '_putData'
const form = Object.assign(this.form, { roleForm: this.roleForm }) const form = Object.assign(this.form, { roleForm: this.roleForm })
const config = { const config = {
_this: this, _this: this,
loading: 'isSubmit', loading: 'isSubmit',
} }
this.$http._postData(url, form, config).then(res => { this.$http[method](url, form, config).then(res => {
if (res.ok) { if (res.ok) {
this.$message.success('操作成功') this.$message.success('操作成功')
this.$emit('ok')
this.showDrawer = false this.showDrawer = false
} else { } else {
this.$message.error(res.message) this.$message.error(res.message)
@@ -55,30 +55,42 @@
<el-button <el-button
v-btn-permission="''" v-btn-permission="''"
size="mini" size="mini"
@click="edit"
>
编辑
</el-button>
<el-button
v-btn-permission="''"
size="mini"
@click="downTemplate"
> >
模板下载 模板下载
</el-button> </el-button>
<el-button <el-button
v-btn-permission="''" v-btn-permission="''"
size="mini" size="mini"
@click="addImportModal"
> >
导入 导入
</el-button> </el-button>
<el-button <el-button
v-btn-permission="''" v-btn-permission="''"
size="mini" size="mini"
@click="exportData"
> >
导出 导出
</el-button> </el-button>
<el-button <el-button
v-btn-permission="'bdc3bb8549669702642f86aa4323c568'" v-btn-permission="'bdc3bb8549669702642f86aa4323c568'"
size="mini" size="mini"
@click="onDelete"
> >
批量删除 批量删除
</el-button> </el-button>
<el-button <el-button
v-btn-permission="''" v-btn-permission="''"
size="mini" size="mini"
@click="processDistribution"
> >
流程下发 流程下发
</el-button> </el-button>
@@ -161,21 +173,42 @@
label="流程状态" label="流程状态"
align="center" align="center"
sortable="custom" sortable="custom"
/> >
<template slot-scope="{row, column, $index}">
<span v-if="row.processStatus === 0">未下发</span>
<span v-if="row.processStatus === 1">进行中</span>
<span v-if="row.processStatus === 2">已完成</span>
</template>
</el-table-column>
</el-table> </el-table>
<pagination :page="searchForm.page" :total="searchForm.total" @pageChange="pageChange" @pageSizeChange="pageSizeChange" /> <pagination :page="searchForm.page" :total="searchForm.total" @pageChange="pageChange" @pageSizeChange="pageSizeChange" />
<loading :loading="loading">数据获取中...</loading> <loading :loading="loading">数据获取中...</loading>
</div> </div>
<addModel ref="addModel" /> <addModel ref="addModel" @ok="onClear" />
<!-- 导入 -->
<ImportZip :visible.sync="importModalShowFlag" :action="url.importExcelUrl" @onSuccess="getData" />
<!-- 导出 -->
<ExportDialog ref="exportDialogRef" @exportName="handleExport" />
<el-dialog title="流程下发" :visible="visible" width="600px">
<div slot="footer">
<el-button size="small" @click="">取消</el-button>
<el-button size="small" type="primary" @click="">确定</el-button>
</div>
</el-dialog>
</div> </div>
</template> </template>
<script> <script>
import addModel from './addModel' import addModel from './addModel'
import ImportZip from '@/components/hzwlComponents/importZip'
import ExportDialog from '@/components/hzwlComponents/exportDialog'
export default { export default {
name: 'StandardTrackingList', name: 'StandardTrackingList',
components: { components: {
addModel addModel,
ImportZip,
ExportDialog,
}, },
data () { data () {
const searchForm = { const searchForm = {
@@ -193,14 +226,18 @@ export default {
url: { url: {
page: 'standardTrackingCheckList/page', page: 'standardTrackingCheckList/page',
save: 'standardTrackingCheckList/save', save: 'standardTrackingCheckList/save',
remove: 'standardTrackingCheckList/remove', delete: 'standardTrackingCheckList/remove',
getById: 'standardTrackingCheckList/getById', getById: 'standardTrackingCheckList/getById',
update: 'standardTrackingCheckList/update', update: 'standardTrackingCheckList/update',
exportTrackingChecklist: 'standardTrackingCheckList/exportTrackingChecklist', exportTemplateFile: 'api/standardTrackingCheckList/exportTemplateFile',
exportTemplateFile: 'standardTrackingCheckList/exportTemplateFile', importExcelUrl: 'api/standardTrackingCheckList/importTrackingChecklist',
exportTrackingChecklist: 'api/standardTrackingCheckList/exportTrackingChecklist',
}, },
data: [], data: [],
selectedList: [], selectedList: [],
// 导入
importModalShowFlag: false,
visible: false,
} }
}, },
created () { created () {
@@ -253,6 +290,68 @@ export default {
}, },
add () { add () {
this.$refs.addModel.add() this.$refs.addModel.add()
},
edit () {
if(this.selectedList.length === 0) {
return this.$message.warning('请选择要编辑的数据')
}
if (this.selectedList.length > 1) {
return this.$message.warning('仅能选择一条数据进行编辑')
}
this.$refs.addModel.edit(this.selectedList[0])
},
downTemplate () {
window.open(`${this.url.exportTemplateFile}?fileName=标准跟踪清单导入模板`)
},
addImportModal () {
this.importModalShowFlag = true
},
// 导出
exportData () {
this.$refs.exportDialogRef.openModel()
},
handleExport (exportName) {
const params = {
...this.searchForm,
exportName: exportName,
exportIds: this.selectedList.join(',')
}
let query = '?'
for(const i in params) {
if (params[i] && params[i] !== '') {
query = query + i + '=' + params[i] + '&'
}
}
query = query.slice(0, -1)
window.open(this.url.exportTrackingChecklist + query)
this.$refs.exportDialogRef.cancel()
this.$message.success('导出信息成功')
},
onDelete () {
if (this.selectedList.length === 0) {
this.$message.warning('请选择要删除的数据')
return
}
const ids = this.selectedList.join(',')
this.$confirm('确认删除这些数据?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
confirmButtonClass: 'common-button-primary',
roundButton: true
}).then(() => {
this.$http._deleteData(this.url.delete, { ids }).then(res => {
if (res.ok) {
this.$message.success('删除成功')
this.getData()
}
})
})
},
processDistribution () {
if (this.selectedList.length === 0) {
return this.$message.warning('请选择要下发的数据')
}
} }
} }
} }