完善费用流水和对应权限
This commit is contained in:
parent
29658a94ec
commit
559e673cfa
@ -17,6 +17,13 @@ export default {
|
||||
return await http.post(this.url, params);
|
||||
},
|
||||
},
|
||||
field:{
|
||||
url: `${config.API_URL}/cost.field.list`,
|
||||
name: "费用流水检索",
|
||||
post: async function (params) {
|
||||
return await http.post(this.url, params);
|
||||
},
|
||||
},
|
||||
typeList: {
|
||||
url: `${config.API_URL}/cost.type.const.list`,
|
||||
name: "费用类型常量列表",
|
||||
@ -40,10 +47,31 @@ export default {
|
||||
},
|
||||
info:{
|
||||
url: `${config.API_URL}/cost.detail.list`,
|
||||
name: "费用详情",
|
||||
name: "费用流水详情",
|
||||
post: async function (params) {
|
||||
return await http.post(this.url, params);
|
||||
},
|
||||
},
|
||||
export:{
|
||||
url: `${config.API_URL}/cost.flow.export`,
|
||||
name: "费用流水导出",
|
||||
post: async function (params) {
|
||||
return await http.post(this.url, params);
|
||||
}
|
||||
},
|
||||
template:{
|
||||
url: `${config.API_URL}/cost.flow.import.template`,
|
||||
name: "费用流水导入模版",
|
||||
post: async function (params) {
|
||||
return await http.get(this.url,params,{responseType: 'arraybuffer'});
|
||||
}
|
||||
},
|
||||
import:{
|
||||
url: `${config.API_URL}/cost.flow.import`,
|
||||
name: "费用流水导入",
|
||||
post: async function (params) {
|
||||
return await http.post(this.url,params,{'Content-Type': 'multipart/form-data'});
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
@ -10,7 +10,6 @@
|
||||
>
|
||||
<template #reference>
|
||||
<slot></slot>
|
||||
<!--<el-button :size="size" v-auths="['organizationExport','userExport']" icon="sc-icon-Download" @click="exportClick">下载</el-button>-->
|
||||
</template>
|
||||
<template #default>
|
||||
<div v-for="item in list" :key="item">
|
||||
@ -42,7 +41,7 @@ export default {
|
||||
},
|
||||
data(){
|
||||
return{
|
||||
list:[{},{},{},{}],
|
||||
list:[{},{},{},{},{}],
|
||||
}
|
||||
},
|
||||
setup(){
|
||||
@ -57,7 +56,7 @@ export default {
|
||||
},
|
||||
methods:{
|
||||
getWsResult(res){
|
||||
if(res.data && (res.data.type == 6 || res.data.type == 7 || res.data.type == 8 || res.data.type == 11)){
|
||||
if(res.data && (res.data.type == 6 || res.data.type == 7 || res.data.type == 8 || res.data.type == 11 || res.data.type == 19)){
|
||||
let item = {
|
||||
type:res.data.type,
|
||||
type_desc:res.data.type_desc,
|
||||
@ -77,6 +76,9 @@ export default {
|
||||
if(res.data.type == 11){
|
||||
this.list[3] = item;
|
||||
}
|
||||
if(res.data.type == 19){
|
||||
this.list[4] = item;
|
||||
}
|
||||
this.$emit('updateShow', item);
|
||||
|
||||
if(res.data.status==1){
|
||||
|
||||
@ -108,7 +108,7 @@ export default {
|
||||
},
|
||||
methods:{
|
||||
getWsResult(res){
|
||||
if(res.data && (res.data.type == 4 || res.data.type == 5 || res.data.type == 10 || res.data.type == 17)){
|
||||
if(res.data && (res.data.type == 4 || res.data.type == 5 || res.data.type == 10 || res.data.type == 17 || res.data.type == 18)){
|
||||
this.importInfo = res.data;
|
||||
this.progressShow = true;
|
||||
if(res.data.status == 0){
|
||||
|
||||
@ -1,7 +1,25 @@
|
||||
<template>
|
||||
<el-container class="mainBox mainBoxHeaderNoBorder">
|
||||
<el-container class="mainBox mainHeaderNoBorderPadding">
|
||||
<el-header>
|
||||
<div class="left-panel">
|
||||
<el-button type="primary" v-auth="'addCost'" :size="size" icon="el-icon-plus" @click="add">新增</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>
|
||||
</template>
|
||||
<template #download>
|
||||
<div v-auth="'costFlowImportTemplate'" @click="importTemplate">下载导入模版</div>
|
||||
</template>
|
||||
</scImport>
|
||||
</div>
|
||||
<div class="right-panel">
|
||||
<scExport :size="size" @exportData="exportData" @updateShow="exportChangeShow" :show="exportShow" type="19">
|
||||
<el-button v-auth="'costFlowExport'" :size="size" icon="sc-icon-Download" @click="exportData">下载</el-button>
|
||||
</scExport>
|
||||
</div>
|
||||
</el-header>
|
||||
<el-main class="nopadding">
|
||||
<div class="searchMain">
|
||||
<div class="searchMain searchMainNoTop">
|
||||
<scSearch ref="scSearch" :searchList="searchList" @fetchSelectData="getSelectData"></scSearch>
|
||||
|
||||
<div class="searchItem searchBtn">
|
||||
@ -31,12 +49,13 @@
|
||||
<el-button class="noBorderBtn" icon="el-icon-more" :size="size"></el-button>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item @click="table_show(scope.row, 'see')" icon="sc-icon-See">查看详情</el-dropdown-item>
|
||||
<el-dropdown-item @click="table_edit(scope.row, 'edit')" icon="sc-icon-Edit">编辑公司</el-dropdown-item>
|
||||
<el-dropdown-item icon="sc-icon-AbilityAuthorization" @click="table_empower(scope.row)" divided>功能授权</el-dropdown-item>
|
||||
<el-dropdown-item icon="sc-icon-DataAuthorization">数据授权</el-dropdown-item>
|
||||
<el-dropdown-item icon="sc-icon-UserList" @click="table_user_ist(scope.row)" divided>用户列表</el-dropdown-item>
|
||||
<el-dropdown-item @click="table_del(scope.row, 'delete')" icon="sc-icon-Delete">删除公司</el-dropdown-item>
|
||||
<div v-auth="'addCost'">
|
||||
<el-dropdown-item @click="table_edit(scope.row, 'edit')" icon="sc-icon-Edit">编辑费用</el-dropdown-item>
|
||||
</div>
|
||||
<div v-auth="'deleteCost'">
|
||||
<el-dropdown-item @click="table_del(scope.row, 'delete')" icon="sc-icon-Delete">删除费用</el-dropdown-item>
|
||||
</div>
|
||||
<el-dropdown-item @click="table_show(scope.row, 'see')" icon="sc-icon-See" divided>查看详情</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
@ -46,13 +65,14 @@
|
||||
</el-main>
|
||||
</el-container>
|
||||
|
||||
<save-dialog v-if="dialog.save" ref="saveDialog" @success="handleSuccess" @closed="dialog.save=false"></save-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import saveDialog from './save'
|
||||
export default {
|
||||
components: {
|
||||
|
||||
saveDialog
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@ -62,23 +82,21 @@ export default {
|
||||
show: false,
|
||||
},
|
||||
list: {
|
||||
apiObj: {},
|
||||
apiObj: this.$API.finance.cost.list,
|
||||
column: [],
|
||||
},
|
||||
selection: [],
|
||||
exportShow:false,
|
||||
searchShow:false,
|
||||
searchList:[
|
||||
{name:'生产日期',type:'date',code:'activation_date'},
|
||||
{name:'反厂日期',type:'date',code:'activation_date'},
|
||||
{name:'处理时间',type:'date',code:'activation_date'},
|
||||
{name:'客户名称',type:'multiple',code:'id', data:[], placeholder:"请选择公司名称",show:false},
|
||||
{name:'状态',type:'select',code:'active_status', data:[], placeholder:"请选择状态",show:false},
|
||||
{name:'工单号',type:'text',code:['mobile'],placeholder:"请输入手机号",isOpen:true,show:false},
|
||||
{name:'邮件地址',type:'text',code:['email'],placeholder:"请输入邮箱地址",isOpen:true,show:false},
|
||||
{name:'公司地址',type:'text',code:['address'],placeholder:"请输入公司地址",isOpen:true,show:false},
|
||||
{name:'负责人',type:'text',code:['owner'],placeholder:"请输入负责人",isOpen:true,show:false},
|
||||
{name:'关键字',type:'text',code:['domain','name'],keyword:true,show:true},
|
||||
{name:'费用类型',type:'select',code:'type_name', data:[], placeholder:"请选择费用类型",show:true},
|
||||
{name:'费用类别',type:'select',code:'category_name', data:[], placeholder:"请选择费用类别",isOpen:true,show:false},
|
||||
{name:'地址',type:'text',code:['location'],placeholder:"请输入地址",isOpen:true,show:false},
|
||||
{name:'单号',type:'text',code:['identifier'],placeholder:"请输入单号",isOpen:true,show:false},
|
||||
{name:'单位',type:'text',code:['unit'],placeholder:"请输入单位",isOpen:true,show:false},
|
||||
{name:'交付/快递日期',type:'date',code:'time',show:true},
|
||||
{name:'新增日期',type:'date',code:'created_at',show:true},
|
||||
{name:'关键字',type:'text',code:['quantity','amount','remark'],keyword:true,show:true},
|
||||
],
|
||||
params: {},
|
||||
}
|
||||
@ -92,39 +110,30 @@ export default {
|
||||
}
|
||||
})
|
||||
},
|
||||
getSelectData(item){
|
||||
let {data,params} = item;
|
||||
async getSelectData(item) {
|
||||
let {data, params} = item;
|
||||
this.params = params;
|
||||
if(data.code == "id"){
|
||||
this.getCompanyList(data,params)
|
||||
}else if(data.code == "active_status"){
|
||||
this.getStatusList(data,params);
|
||||
let searchParams = this.$TOOL.objCopy(params);
|
||||
searchParams.field = ""
|
||||
if (typeof data.code === 'string') {
|
||||
searchParams.field = data.code;
|
||||
} else {
|
||||
searchParams.field = data.code[0];
|
||||
}
|
||||
},
|
||||
|
||||
async getCompanyList(data,params) {
|
||||
const res = await this.$API.system.company.select.post(params);
|
||||
if(res.data && res.data.length>0){
|
||||
res.data.forEach(item=>{
|
||||
item.label = item.full_name;
|
||||
if (data.type == 'select') {
|
||||
const res = await this.$API.finance.cost.field.post(searchParams);
|
||||
if (res.code == 200) {
|
||||
if (res.data && res.data.length > 0) {
|
||||
res.data.forEach(item => {
|
||||
item.label = item[data.code];
|
||||
})
|
||||
}
|
||||
if(res.code == 200){
|
||||
this.searchList.forEach(item=>{
|
||||
if(item.code == data.code){
|
||||
this.searchList.forEach(item => {
|
||||
if (item.code == data.code) {
|
||||
item.data = res.data;
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
async getStatusList(data,params) {
|
||||
const res = await this.$API.oss.status.post(params);
|
||||
if(res.code == 200){
|
||||
this.searchList.forEach(item=>{
|
||||
if(item.code == data.code){
|
||||
item.data = res.data;
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
@ -143,11 +152,11 @@ export default {
|
||||
})
|
||||
},
|
||||
async importTemplate() {
|
||||
const res = await this.$API.orders.order.maintenance.template.post();
|
||||
const res = await this.$API.finance.cost.template.post();
|
||||
const blob = new Blob([res]);
|
||||
const text = new Date().getTime();
|
||||
const eLink = document.createElement('a');
|
||||
eLink.download = "维保导入模版_"+text+'.xlsx';
|
||||
eLink.download = "费用流水导入模版_"+text+'.xlsx';
|
||||
eLink.style.display = 'none';
|
||||
eLink.href = URL.createObjectURL(blob);
|
||||
document.body.appendChild(eLink);
|
||||
@ -156,7 +165,7 @@ export default {
|
||||
document.body.removeChild(eLink);
|
||||
},
|
||||
async importUpload(params) {
|
||||
const res = await this.$API.orders.order.maintenance.import.post(params);
|
||||
const res = await this.$API.finance.cost.import.post(params);
|
||||
if(res.code == 200){
|
||||
this.$message.success('上传成功,开始导入数据');
|
||||
}
|
||||
@ -194,26 +203,7 @@ export default {
|
||||
}
|
||||
}).catch(()=>{})
|
||||
},
|
||||
// 功能授权
|
||||
table_empower(row){
|
||||
this.$router.push({
|
||||
path: '/setting/company/add-permission',
|
||||
query: {
|
||||
id: row.id,
|
||||
name:row.name
|
||||
}
|
||||
})
|
||||
},
|
||||
// 公司用户列表
|
||||
table_user_ist(row){
|
||||
this.$router.push({
|
||||
path: '/setting/user/company-user-list',
|
||||
query: {
|
||||
id: row.id,
|
||||
name:row.name
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
//表格选择后回调事件
|
||||
selectionChange(selection){
|
||||
this.selection = selection;
|
||||
@ -236,17 +226,29 @@ export default {
|
||||
},
|
||||
// 下载导出
|
||||
exportChangeShow(params){
|
||||
if(params.type == 11){
|
||||
if(params.type == 19){
|
||||
this.exportShow = params.status==0?true:false
|
||||
}
|
||||
},
|
||||
async exportData() {
|
||||
if(this.exportShow) return
|
||||
const res = await this.$API.orders.order.maintenance.export.post(this.params);
|
||||
const res = await this.$API.finance.cost.export.post(this.params);
|
||||
if(res.code == 200){
|
||||
this.$message.success('开始导出');
|
||||
}
|
||||
},
|
||||
|
||||
//本地更新数据
|
||||
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)
|
||||
})
|
||||
}
|
||||
this.$refs.table.refresh();
|
||||
},
|
||||
upSearch(){
|
||||
this.$refs.table.upData(this.params);
|
||||
},
|
||||
|
||||
189
src/views/cost/feeRecords/save.vue
Normal file
189
src/views/cost/feeRecords/save.vue
Normal file
@ -0,0 +1,189 @@
|
||||
<template>
|
||||
<el-dialog :title="titleMap[mode]" v-model="visible" :width="800" draggable destroy-on-close @closed="$emit('closed')">
|
||||
<el-form class="form" :model="form" :rules="rules" :disabled="mode=='show'" ref="dialogForm" label-width="130px" label-position="right">
|
||||
<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>
|
||||
</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-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-form-item>
|
||||
</el-col>
|
||||
<el-col :span="11">
|
||||
<el-form-item label="地址" prop="location">
|
||||
<el-input v-model="form.location" placeholder="请填写地址" clearable></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="11">
|
||||
<el-form-item label="单位" prop="unit">
|
||||
<el-input v-model="form.unit" placeholder="请填写单位" clearable></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="11">
|
||||
<el-form-item label="数量" prop="quantity">
|
||||
<el-input v-model="form.quantity" placeholder="请填写数量" clearable></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="11">
|
||||
<el-form-item label="流水金额" prop="amount">
|
||||
<el-input v-model="form.amount" placeholder="请填写流水金额" clearable></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="11">
|
||||
<el-form-item label="交付/快递日期" prop="time">
|
||||
<el-input v-model="form.time" placeholder="请选择日期" clearable></el-input>
|
||||
</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-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="visible=false" >取 消</el-button>
|
||||
<el-button v-if="mode!='show'" type="primary" :loading="isSave" @click="submit()">保 存</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
emits: ['success', 'closed'],
|
||||
data() {
|
||||
return {
|
||||
mode: "add",
|
||||
titleMap: {
|
||||
add: '新增费用',
|
||||
edit: '编辑费用',
|
||||
show: '查看详情'
|
||||
},
|
||||
visible: false,
|
||||
isSave: false,
|
||||
setMap:{
|
||||
categoryList:[],
|
||||
typeList:[]
|
||||
},
|
||||
//表单数据
|
||||
form: {
|
||||
id:"",
|
||||
type_code: "",
|
||||
category_code:"",
|
||||
amount:"",
|
||||
time:"",
|
||||
location:"",
|
||||
identifier: "",
|
||||
unit:"",
|
||||
quantity: "",
|
||||
remark: ""
|
||||
},
|
||||
//验证规则
|
||||
rules: {
|
||||
avatar:[
|
||||
{required: true, message: '请上传头像'}
|
||||
],
|
||||
login_name: [
|
||||
{required: true, message: '请输入登录账号'}
|
||||
],
|
||||
name: [
|
||||
{required: true, message: '请输入真实姓名'}
|
||||
],
|
||||
emp_id:[
|
||||
{required: true, message: '请输入工号'}
|
||||
],
|
||||
mobile: [
|
||||
{required: true, message: '请输入联系方式'}
|
||||
],
|
||||
email: [
|
||||
{required: true, message: '请输入邮箱地址'}
|
||||
],
|
||||
},
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getGroup()
|
||||
this.getDept()
|
||||
},
|
||||
methods: {
|
||||
//显示
|
||||
open(mode='add'){
|
||||
this.mode = mode;
|
||||
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 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) {
|
||||
this.setMap.categoryList = res.data;
|
||||
}
|
||||
},
|
||||
//表单提交方法
|
||||
submit(){
|
||||
this.$refs.dialogForm.validate(async (valid) => {
|
||||
if (valid) {
|
||||
this.isSave = true;
|
||||
const res = await this.$API.system.user.add.post(this.form);
|
||||
this.isSave = false;
|
||||
if(res.code == 200){
|
||||
this.$emit('success', this.form, this.mode)
|
||||
this.visible = false;
|
||||
this.$message.success("操作成功")
|
||||
}
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
})
|
||||
},
|
||||
//表单注入数据
|
||||
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:[]
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.input{
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
Loading…
Reference in New Issue
Block a user