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: [], // 用于回显
}
},
watch: {
ids (val) {
this.initFileList()
},
},
created () {
this.initFileList()
},
@@ -143,6 +148,9 @@ export default {
}
this.fileList = fileList
this.FileList = fileList
} else {
this.fileList = []
this.FileList = []
}
},
beforeUpload (file) {
@@ -19,7 +19,7 @@
<el-table
ref="selection"
class="table"
:data="data"
:data="value"
tooltip-effect="dark"
style="width:100%;height: calc(100% - 40px)"
height="string"
@@ -129,7 +129,7 @@ export default {
StandardListDrawer
},
props: {
data: {
value: {
type: Array,
default: () => []
}
@@ -151,7 +151,7 @@ export default {
this.selectedList = selection
},
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('请勿重复添加数据')
return
}
@@ -171,7 +171,7 @@ export default {
break
}
return {
id: item.id,
lawId: item.id,
dataSource: type,
lawCode,
lawName,
@@ -180,7 +180,7 @@ export default {
implRequire: ''
}
})
this.data.push(...newList)
this.$emit('input', [ ...this.value, ...newList ])
},
handleDeleteStandard () {
if (this.selectedList.length === 0) {
@@ -194,7 +194,8 @@ export default {
confirmButtonClass: 'common-button-primary',
roundButton: true
}).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 () {
@@ -30,8 +30,9 @@
<el-tab-pane label="核查清单" name="1" />
<el-tab-pane label="人员信息" name="2" />
</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" />
<loading :loading="loading">数据获取中...</loading>
</el-form>
</div>
<div class="drawer-footer">
@@ -130,14 +131,18 @@ export default {
showDrawer: false,
isSubmit: false,
form,
initForm: JSON.parse(JSON.stringify(form)),
roleForm,
initRoleForm: JSON.parse(JSON.stringify(roleForm)),
rules,
roleRules,
activeName: '1',
url: {
save: 'standardTrackingCheckList/save',
update: 'standardTrackingCheckList/update',
}
getById: 'standardTrackingCheckList/getById',
},
loading: false,
}
},
methods: {
@@ -146,11 +151,25 @@ export default {
},
add () {
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
},
edit () {
edit (id) {
this.title = '编辑'
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 () {
if (this.form.issueTrackList.length === 0) {
@@ -164,14 +183,16 @@ export default {
return this.$message.warning('请完善人员信息');
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 config = {
_this: this,
loading: 'isSubmit',
}
this.$http._postData(url, form, config).then(res => {
this.$http[method](url, form, config).then(res => {
if (res.ok) {
this.$message.success('操作成功')
this.$emit('ok')
this.showDrawer = false
} else {
this.$message.error(res.message)
@@ -55,30 +55,42 @@
<el-button
v-btn-permission="''"
size="mini"
@click="edit"
>
编辑
</el-button>
<el-button
v-btn-permission="''"
size="mini"
@click="downTemplate"
>
模板下载
</el-button>
<el-button
v-btn-permission="''"
size="mini"
@click="addImportModal"
>
导入
</el-button>
<el-button
v-btn-permission="''"
size="mini"
@click="exportData"
>
导出
</el-button>
<el-button
v-btn-permission="'bdc3bb8549669702642f86aa4323c568'"
size="mini"
@click="onDelete"
>
批量删除
</el-button>
<el-button
v-btn-permission="''"
size="mini"
@click="processDistribution"
>
流程下发
</el-button>
@@ -161,21 +173,42 @@
label="流程状态"
align="center"
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>
<pagination :page="searchForm.page" :total="searchForm.total" @pageChange="pageChange" @pageSizeChange="pageSizeChange" />
<loading :loading="loading">数据获取中...</loading>
</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>
</template>
<script>
import addModel from './addModel'
import ImportZip from '@/components/hzwlComponents/importZip'
import ExportDialog from '@/components/hzwlComponents/exportDialog'
export default {
name: 'StandardTrackingList',
components: {
addModel
addModel,
ImportZip,
ExportDialog,
},
data () {
const searchForm = {
@@ -193,14 +226,18 @@ export default {
url: {
page: 'standardTrackingCheckList/page',
save: 'standardTrackingCheckList/save',
remove: 'standardTrackingCheckList/remove',
delete: 'standardTrackingCheckList/remove',
getById: 'standardTrackingCheckList/getById',
update: 'standardTrackingCheckList/update',
exportTrackingChecklist: 'standardTrackingCheckList/exportTrackingChecklist',
exportTemplateFile: 'standardTrackingCheckList/exportTemplateFile',
exportTemplateFile: 'api/standardTrackingCheckList/exportTemplateFile',
importExcelUrl: 'api/standardTrackingCheckList/importTrackingChecklist',
exportTrackingChecklist: 'api/standardTrackingCheckList/exportTrackingChecklist',
},
data: [],
selectedList: [],
// 导入
importModalShowFlag: false,
visible: false,
}
},
created () {
@@ -253,6 +290,68 @@ export default {
},
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('请选择要下发的数据')
}
}
}
}