完善费用流水
This commit is contained in:
parent
559e673cfa
commit
e10239f7c7
@ -3,6 +3,7 @@
|
||||
<el-header>
|
||||
<div class="left-panel">
|
||||
<el-button type="primary" v-auth="'addCost'" :size="size" icon="el-icon-plus" @click="add">新增</el-button>
|
||||
<el-button type="danger" plain v-auth="'deleteCost'" :disabled="selection.length>0?false:true" :size="size" icon="el-icon-delete" @click="all_del"></el-button>
|
||||
<scImport ref="scImport" :size="size" title="批量导入费用流水" @parentParams="importUpload" @importSuccess="importSuccess">
|
||||
<template #header>
|
||||
<el-button v-auth="'costFlowImport'" type="primary" :size="size" plain @click="importFile">批量导入</el-button>
|
||||
@ -183,23 +184,33 @@ export default {
|
||||
},
|
||||
//查看
|
||||
table_show(row){
|
||||
this.dialog.show = true
|
||||
this.dialog.save = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.showDialog.open('show').setData(row);
|
||||
this.$refs.saveDialog.open('show').setData(row);
|
||||
})
|
||||
},
|
||||
//删除
|
||||
async table_del(row){
|
||||
this.$confirm(`确定删除 ${row.name} 吗?`, '提示', {
|
||||
async all_del(){
|
||||
this.$confirm(`确定删除所选项吗?`, '提示', {
|
||||
type: 'warning'
|
||||
}).then(async () => {
|
||||
const reqData = {id: row.id};
|
||||
const res = await this.$API.system.company.delete.post(reqData);
|
||||
const reqData = {ids: this.selection.map(em=>em.id)};
|
||||
const res = await this.$API.finance.cost.delete.post(reqData);
|
||||
if(res.code == 200){
|
||||
this.$refs.table.refresh()
|
||||
this.$message.success("删除成功")
|
||||
}
|
||||
}).catch(()=>{})
|
||||
},
|
||||
async table_del(row){
|
||||
this.$confirm(`确定删除 ${row.identifier} 吗?`, '提示', {
|
||||
type: 'warning'
|
||||
}).then(async () => {
|
||||
const reqData = {ids: [row.id]};
|
||||
const res = await this.$API.finance.cost.delete.post(reqData);
|
||||
if(res.code == 200){
|
||||
this.$refs.table.refresh()
|
||||
this.$message.success("删除成功")
|
||||
}else{
|
||||
await this.$alert(res.message, "提示", {type: 'error'})
|
||||
}
|
||||
}).catch(()=>{})
|
||||
},
|
||||
@ -208,22 +219,7 @@ export default {
|
||||
selectionChange(selection){
|
||||
this.selection = selection;
|
||||
},
|
||||
// 状态
|
||||
changeSwitch(val, row) {
|
||||
row.$switch_yx = true;
|
||||
setTimeout(async () => {
|
||||
let params = {
|
||||
id: row.id,
|
||||
status: row.active_status,
|
||||
};
|
||||
const res = await this.$API.system.company.status.post(params);
|
||||
if(res.code !=200){
|
||||
row.active_status = !row.active_status;
|
||||
}
|
||||
delete row.$switch_status;
|
||||
delete row.$switch_yx;
|
||||
}, 500);
|
||||
},
|
||||
|
||||
// 下载导出
|
||||
exportChangeShow(params){
|
||||
if(params.type == 19){
|
||||
@ -239,14 +235,7 @@ export default {
|
||||
},
|
||||
|
||||
//本地更新数据
|
||||
handleSuccess(data, mode){
|
||||
if(mode=='add'){
|
||||
this.$refs.table.refresh();
|
||||
}else if(mode=='edit'){
|
||||
this.$refs.table.tableData.filter(item => item.id===data.id ).forEach(item => {
|
||||
Object.assign(item, data)
|
||||
})
|
||||
}
|
||||
handleSuccess(){
|
||||
this.$refs.table.refresh();
|
||||
},
|
||||
upSearch(){
|
||||
|
||||
@ -4,21 +4,21 @@
|
||||
<el-row :gutter="1" justify="start">
|
||||
<el-col :span="11">
|
||||
<el-form-item label="费用类型" prop="type_code">
|
||||
<el-select class="input" v-model="form.type_code" placeholder="请选择费用类型" :disabled="mode!='add'?true:false" clearable>
|
||||
<el-option></el-option>
|
||||
<el-select class="input" v-model="form.type_code" placeholder="请选择费用类型" clearable @visible-change="getSelectType">
|
||||
<el-option v-for="(item,index) in setMap.typeList" :key="index" :value="item.value" :label="item.label"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="11">
|
||||
<el-form-item label="费用类别" prop="category_code">
|
||||
<el-select class="input" v-model="form.category_code" placeholder="请选择费用类别" clearable @visible-change="getSelectCategory">
|
||||
<el-option></el-option>
|
||||
<el-option v-for="(item,index) in setMap.categoryList" :key="index" :value="item.value" :label="item.label"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="11">
|
||||
<el-form-item label="单号" prop="identifier">
|
||||
<el-input v-model="form.identifier" placeholder="请填写单号" clearable></el-input>
|
||||
<el-input v-model="form.identifier" :disabled="mode!='add'?true:false" placeholder="请填写单号" clearable></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="11">
|
||||
@ -43,12 +43,12 @@
|
||||
</el-col>
|
||||
<el-col :span="11">
|
||||
<el-form-item label="交付/快递日期" prop="time">
|
||||
<el-input v-model="form.time" placeholder="请选择日期" clearable></el-input>
|
||||
<el-date-picker class="input" type="date" value-format="YYYY-MM-DD" v-model="form.time" placeholder="请选择日期" clearable></el-date-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="22">
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input type="textarea" :row="2" v-model="form.mobile" placeholder="请填写备注" clearable></el-input>
|
||||
<el-input type="textarea" :row="2" v-model="form.remark" placeholder="请填写备注" clearable></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@ -69,7 +69,7 @@ export default {
|
||||
titleMap: {
|
||||
add: '新增费用',
|
||||
edit: '编辑费用',
|
||||
show: '查看详情'
|
||||
show: '费用详情'
|
||||
},
|
||||
visible: false,
|
||||
isSave: false,
|
||||
@ -92,30 +92,35 @@ export default {
|
||||
},
|
||||
//验证规则
|
||||
rules: {
|
||||
avatar:[
|
||||
{required: true, message: '请上传头像'}
|
||||
type_code:[
|
||||
{required: true, message: '费用类型不能为空'}
|
||||
],
|
||||
login_name: [
|
||||
{required: true, message: '请输入登录账号'}
|
||||
category_code: [
|
||||
{required: true, message: '费用类别不能为空'}
|
||||
],
|
||||
name: [
|
||||
{required: true, message: '请输入真实姓名'}
|
||||
amount:[
|
||||
{required: true, message: '金额不能为空'}
|
||||
],
|
||||
emp_id:[
|
||||
{required: true, message: '请输入工号'}
|
||||
time:[
|
||||
{required: true, message: '时间不能为空'}
|
||||
],
|
||||
mobile: [
|
||||
{required: true, message: '请输入联系方式'}
|
||||
location:[
|
||||
{required: true, message: '地点不能为空'}
|
||||
],
|
||||
email: [
|
||||
{required: true, message: '请输入邮箱地址'}
|
||||
unit:[
|
||||
{required: true, message: '单位不能为空'}
|
||||
],
|
||||
quantity:[
|
||||
{required: true, message: '数量不能为空'}
|
||||
],
|
||||
identifier:[
|
||||
{required: true, message: '单号不能为空'}
|
||||
]
|
||||
},
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getGroup()
|
||||
this.getDept()
|
||||
|
||||
},
|
||||
methods: {
|
||||
//显示
|
||||
@ -124,23 +129,12 @@ export default {
|
||||
this.visible = true;
|
||||
return this
|
||||
},
|
||||
//加载树数据
|
||||
async getGroup(){
|
||||
const res = await this.$API.system.role.list.get();
|
||||
if(res.code == 200){
|
||||
this.groups = res.data.rows;
|
||||
async getSelectType() {
|
||||
const res = await this.$API.finance.cost.typeList.post();
|
||||
if (res.code == 200) {
|
||||
this.setMap.typeList = res.data;
|
||||
}
|
||||
},
|
||||
async getDept(){
|
||||
const res = await this.$API.system.dept.active.post();
|
||||
if(res.code == 200){
|
||||
this.depts = res.data;
|
||||
}
|
||||
},
|
||||
parentParams(item){
|
||||
this.form.avatar = item;
|
||||
},
|
||||
|
||||
async getSelectCategory() {
|
||||
const res = await this.$API.finance.cost.categoryList.post();
|
||||
if (res.code == 200) {
|
||||
@ -152,7 +146,7 @@ export default {
|
||||
this.$refs.dialogForm.validate(async (valid) => {
|
||||
if (valid) {
|
||||
this.isSave = true;
|
||||
const res = await this.$API.system.user.add.post(this.form);
|
||||
const res = await this.$API.finance.cost.add.post(this.form);
|
||||
this.isSave = false;
|
||||
if(res.code == 200){
|
||||
this.$emit('success', this.form, this.mode)
|
||||
@ -165,18 +159,26 @@ export default {
|
||||
})
|
||||
},
|
||||
//表单注入数据
|
||||
setData(data){
|
||||
this.form.id = data.id
|
||||
this.form.login_name = data.login_name
|
||||
this.form.name = data.name
|
||||
this.form.emp_id = data.emp_id
|
||||
this.form.mobile = data.mobile
|
||||
this.form.email = data.email
|
||||
this.form.avatar = data.avatar
|
||||
this.form.dept_id = data.dept_id
|
||||
this.form.group = data.group
|
||||
this.form.role_ids = data.user_roles && data.user_roles.role_ids?data.user_roles.role_ids:[]
|
||||
async setData(data) {
|
||||
await this.getSelectType();
|
||||
await this.getSelectCategory();
|
||||
|
||||
let params = {
|
||||
id:data.id
|
||||
}
|
||||
const res = await this.$API.finance.cost.info.post(params);
|
||||
if(res.code == 200){
|
||||
this.form.id=res.data.id;
|
||||
this.form.type_code=res.data.type_code;
|
||||
this.form.category_code=res.data.category_code;
|
||||
this.form.amount=res.data.amount;
|
||||
this.form.time=res.data.time;
|
||||
this.form.location=res.data.location;
|
||||
this.form.identifier=res.data.identifier;
|
||||
this.form.unit=res.data.unit;
|
||||
this.form.quantity=res.data.quantity;
|
||||
this.form.remark=res.data.remark;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
<el-header>
|
||||
<div class="left-panel">
|
||||
<el-button type="primary" :size="size" icon="el-icon-plus" @click="add">新增</el-button>
|
||||
<el-button type="danger" :disabled="selection.length>0?false:true" :size="size" icon="el-icon-Delete" @click="all_delete"></el-button>
|
||||
<el-button plain type="danger" :disabled="selection.length>0?false:true" :size="size" icon="el-icon-Delete" @click="all_delete"></el-button>
|
||||
<scImport ref="scImport" :size="size" title="批量导入物料成本" @parentParams="importUpload" @importSuccess="importSuccess">
|
||||
<template #header>
|
||||
<el-button type="primary" :size="size" plain @click="importFile">批量导入</el-button>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user