|
@@ -51,6 +51,7 @@
|
|
|
<h3 ref="headHe" style="padding-left: 220px">{{shuz[ins]}}</h3>
|
|
|
<p style="float: right;margin-right: 25px;"><el-button type="primary" @click="submits" size="mini">提交</el-button></p>
|
|
|
<p style="float: right;margin-right: 25px;"><el-button type="primary" @click="submitUpload" size="mini">批量上传</el-button></p>
|
|
|
+ <p style="float: right;margin-right: 25px;"><el-button type="primary" @click="customTypeOp" size="mini" v-if="permissions.costAll">费用类型管理</el-button></p>
|
|
|
</div>
|
|
|
<!-- 上面部分 -->
|
|
|
<div ref="staff" style="margin: 20px 20px 0 220px; width: 81.5%" >
|
|
@@ -135,7 +136,7 @@
|
|
|
</el-select>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="费用类型" width="155px">
|
|
|
+ <el-table-column label="费用类型" width="175px">
|
|
|
<template slot-scope="scope">
|
|
|
<el-select size="small" v-model="scope.row.expenseType" placeholder="费用类型" style="width: 150px" >
|
|
|
<el-option v-for="(item, index) in expenseTypeList" :key="index" :label="item.typeName" :value="item.typeName" ></el-option>
|
|
@@ -460,6 +461,48 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
+
|
|
|
+ <!-- 费用类型自定义 -->
|
|
|
+ <el-dialog title="费用类型管理" v-if="customTypeDialog" :visible.sync="customTypeDialog" customClass="customWidth" width="600px">
|
|
|
+ <el-table :data="customTypeList" style="height:400px" :loading="customTypeListLoading">
|
|
|
+ <el-table-column prop="typeName" label="费用名称" min-width="150"></el-table-column>
|
|
|
+ <el-table-column label="费用类型" min-width="150">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <span>{{scope.row.mainType == 0 ? '一般费用' : (scope.row.mainType == 1 ? '差旅费用' : '外包费用')}}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="操作" width="150">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-button @click="customTypeEditOp(scope.row)" size="small" type="primary">编辑</el-button>
|
|
|
+ <el-button @click="customTypeEditDelete(scope.row)" size="small" type="danger">删除</el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ <span slot="footer" class="dialog-footer">
|
|
|
+ <el-button @click="customTypeDialog = false" size="medium">取消</el-button>
|
|
|
+ <el-button type="primary" @click="customTypeEditOp()" size="medium">新增类型</el-button>
|
|
|
+ </span>
|
|
|
+
|
|
|
+ <!-- 新增/编辑费用类型 -->
|
|
|
+ <el-dialog title="新增/编辑费用类型" v-if="customTypeEditDialog" :visible.sync="customTypeEditDialog" customClass="customWidth" width="400px" append-to-body>
|
|
|
+ <el-form label-width="80px" :rules="editTypeDataRules" ref="editTypeDataForm" :model="editTypeData">
|
|
|
+ <el-form-item label="所属类型" style="margin:30px 0">
|
|
|
+ <el-select v-model="editTypeData.mainType" size="medium" style="width:90%">
|
|
|
+ <el-option label="一般费用" :value="0"></el-option>
|
|
|
+ <el-option label="差旅费用" :value="1"></el-option>
|
|
|
+ <el-option label="外包费用" :value="2"></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="类型名称" style="margin:30px 0" prop="typeName">
|
|
|
+ <el-input id="editTypeDataInput" size="medium" v-model="editTypeData.typeName" placeholder="自定义费用类型名称" style="width:90%" @keyup.native="editTypeDataInput('editTypeDataInput')"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <span slot="footer" class="dialog-footer">
|
|
|
+ <el-button @click="customTypeEditDialog = false" size="medium">取消</el-button>
|
|
|
+ <el-button type="primary" @click="customTypeEditSure" size="medium">确认</el-button>
|
|
|
+ </span>
|
|
|
+ </el-dialog>
|
|
|
+ </el-dialog>
|
|
|
</section>
|
|
|
</template>
|
|
|
|
|
@@ -521,7 +564,17 @@ export default {
|
|
|
apl: '',
|
|
|
diz: 'http://worktime.ttkuaiban.com',
|
|
|
importDialog: false,
|
|
|
- importingData: false
|
|
|
+ importingData: false,
|
|
|
+
|
|
|
+ // 费用类型自定义
|
|
|
+ customTypeDialog: false,
|
|
|
+ customTypeList: [],
|
|
|
+ customTypeListLoading: false,
|
|
|
+ customTypeEditDialog: false,
|
|
|
+ editTypeData: {},
|
|
|
+ editTypeDataRules:{
|
|
|
+ typeName: [{ required: true, message: "请输入自定义费用类型名称", trigger: "blur" }],
|
|
|
+ },
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
@@ -569,6 +622,85 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ // 费用类型自定义
|
|
|
+ customTypeOp(){
|
|
|
+ this.customTypeDialog = true
|
|
|
+ this.customTypeListLoading = true
|
|
|
+ this.getExpList()
|
|
|
+ },
|
|
|
+ customTypeEditOp(row){
|
|
|
+ this.customTypeEditDialog = true
|
|
|
+ if(row){
|
|
|
+ this.editTypeData = row
|
|
|
+ }else{
|
|
|
+ this.editTypeData = {
|
|
|
+ mainType: 0,
|
|
|
+ typeName: '',
|
|
|
+ companyId: this.user.companyId
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ customTypeEditSure(){
|
|
|
+ this.$refs.editTypeDataForm.validate(valid => {
|
|
|
+ if (valid) {
|
|
|
+ this.http.post('/expense-type/addOrMod',this.editTypeData,
|
|
|
+ res => {
|
|
|
+ if(res.code == 'ok'){
|
|
|
+ this.customTypeEditDialog = false
|
|
|
+ this.customTypeOp()
|
|
|
+ }else{
|
|
|
+ this.$message({
|
|
|
+ message: res.msg,
|
|
|
+ type: 'error'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },err => {
|
|
|
+ this.$message({
|
|
|
+ message: err,
|
|
|
+ type: 'error'
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }})
|
|
|
+ },
|
|
|
+ customTypeEditDelete(row){
|
|
|
+ this.$confirm('该操作可能造成已有数据丢失,确定要删除吗?','提示',{
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ }).then(()=>{
|
|
|
+ this.http.post('/expense-type/delete',{
|
|
|
+ id: row.id
|
|
|
+ },
|
|
|
+ res => {
|
|
|
+ if(res.code == 'ok'){
|
|
|
+ this.customTypeEditDialog = false
|
|
|
+ this.customTypeOp()
|
|
|
+ }else{
|
|
|
+ this.$message({
|
|
|
+ message: res.msg,
|
|
|
+ type: 'error'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },err => {
|
|
|
+ this.$message({
|
|
|
+ message: err,
|
|
|
+ type: 'error'
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }).catch(()=>{
|
|
|
+ this.$message({
|
|
|
+ type: 'info',
|
|
|
+ message: '已取消删除'
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ editTypeDataInput(typeName){
|
|
|
+ let inpu = document.getElementById(typeName);
|
|
|
+ inpu.value = inpu.value.replace(/^\s*|\s*$/g, '')
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
submitUpload(){
|
|
|
this.importDialog = true
|
|
|
},
|
|
@@ -688,8 +820,10 @@ export default {
|
|
|
this.http.post('/expense-type/getList', {
|
|
|
},
|
|
|
res => {
|
|
|
+ this.customTypeListLoading = false
|
|
|
if (res.code == "ok") {
|
|
|
this.allExpList = res.data;
|
|
|
+ this.customTypeList = res.data
|
|
|
this.expenseTypeList = this.allExpList.filter(a=>a.mainType == 0);
|
|
|
} else {
|
|
|
this.$message({
|
|
@@ -699,6 +833,7 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
error => {
|
|
|
+ this.customTypeListLoading = false
|
|
|
this.$message({
|
|
|
message: error,
|
|
|
type: "error"
|