资产管理90%

This commit is contained in:
xiao-fajia 2024-08-17 20:29:20 +08:00
parent 9affd194e7
commit 35f2301f7b
10 changed files with 863 additions and 120 deletions

View File

@ -94,3 +94,11 @@ export function getCompanyQualsPage(params) {
params
})
}
// 获得租户下的所有企业
export function getCompanyList(){
return request({
url: "/base/company/list",
method: 'get'
})
}

View File

@ -60,3 +60,11 @@ export function exportPropertyPosExcel(params) {
responseType: 'blob'
})
}
// 获得企业管理-资产存放位置列表 分企业
export function getPositionListByCorpId(id) {
return request({
url: '/company/property-pos/listByCorpId?id=' + id,
method: 'get'
})
}

View File

@ -1,53 +1,62 @@
import request from '@/utils/request'
// 创建企业管理-资产处置单/变动单
export function createPropertyDeal(data) {
return request({
url: '/company/property-deal/create',
method: 'post',
data: data
})
}
// 更新企业管理-资产处置单/变动单
export function updatePropertyDeal(data) {
return request({
url: '/company/property-deal/update',
method: 'put',
data: data
})
}
// 删除企业管理-资产处置单/变动单
export function deletePropertyDeal(id) {
return request({
url: '/company/property-deal/delete?id=' + id,
method: 'delete'
})
}
// 获得企业管理-资产处置单/变动单
export function getPropertyDeal(id) {
return request({
url: '/company/property-deal/get?id=' + id,
method: 'get'
})
}
// 获得企业管理-资产处置单/变动单分页
export function getPropertyDealPage(params) {
return request({
url: '/company/property-deal/page',
method: 'get',
params
})
}
// 导出企业管理-资产处置单/变动单 Excel
export function exportPropertyDealExcel(params) {
return request({
url: '/company/property-deal/export-excel',
method: 'get',
params,
responseType: 'blob'
})
}
import request from '@/utils/request'
// 创建企业管理-资产处置单
export function createPropertyDeal(data) {
return request({
url: '/company/property-deal/create',
method: 'post',
data: data
})
}
// 创建企业管理-资产变动单
export function createPropertyDealChange(data) {
return request({
url: '/company/property-deal/createChange',
method: 'post',
data: data
})
}
// 更新企业管理-资产处置单/变动单
export function updatePropertyDeal(data) {
return request({
url: '/company/property-deal/update',
method: 'put',
data: data
})
}
// 删除企业管理-资产处置单/变动单
export function deletePropertyDeal(id) {
return request({
url: '/company/property-deal/delete?id=' + id,
method: 'delete'
})
}
// 获得企业管理-资产处置单/变动单
export function getPropertyDeal(id) {
return request({
url: '/company/property-deal/get?id=' + id,
method: 'get'
})
}
// 获得企业管理-资产处置单/变动单分页
export function getPropertyDealPage(params) {
return request({
url: '/company/property-deal/page',
method: 'get',
params
})
}
// 导出企业管理-资产处置单/变动单 Excel
export function exportPropertyDealExcel(params) {
return request({
url: '/company/property-deal/export-excel',
method: 'get',
params,
responseType: 'blob'
})
}

View File

@ -34,6 +34,14 @@ export function getStaff(id) {
})
}
// 获得企业管理-员工信息
export function getStaffById(id) {
return request({
url: '/company/staff/getById?id=' + id,
method: 'get'
})
}
// 获得企业管理-员工信息分页
export function getStaffPage(params) {
return request({
@ -92,3 +100,11 @@ export function getRoleList(){
method: 'get'
})
}
// 获取当前登录用户部门下的员工信息
export function getStaffListByCorpId(id){
return request({
url: '/company/staff/listByCorpId?id=' + id,
method: 'get'
})
}

View File

@ -140,6 +140,8 @@ export const DICT_TYPE = {
CYCLE_DICT : 'cycle_dict',
//资产分类
COMPANY_PROPERTY_CATG: 'company_property_catg',
// 资产取得方式
PROPERTY_GET_WAY : 'property_get_way',
COMPANY_COST_TYPE: 'company_cost_type',
}

View File

@ -322,12 +322,11 @@ export default {
const res = await PropertyApi.getProperty(id)
this.formData = res.data
this.formData.userId = parseInt(this.formData.userId)
this.dialogTitle = '修改企业管理-资产'
} finally {
this.formLoading = false
}
}
this.dialogTitle = '新增企业管理-资产'
this.dialogTitle = id ? '修改企业管理-资产' : '新增企业管理-资产'
this.companyPropertyCatg = companyPropertyCatg
this.staffList = staffList
this.options = this.staffList

View File

@ -0,0 +1,435 @@
<template>
<div class="app-container">
<el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="80%" v-dialogDrag append-to-body>
<el-form ref="formRef" :model="formData" :rules="formRules" v-loading="formLoading" label-width="100px">
<el-card class="box-card">
<!-- 卡片头 -->
<div slot="header" class="clearfix">
<i class="el-icon-plus"/>
<span>基本信息</span>
</div>
<!-- 卡片内容 -->
<div>
<el-row :gutter="2">
<el-col :span="12">
<el-form-item label="变动单号" prop="dealNo">
<el-input disabled v-model="formData.dealNo"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="变动时间" prop="dealDate">
<el-date-picker :disabled="!!formData.id" clearable v-model="formData.dealDate" type="date"
value-format="yyyy-MM-dd"
placeholder="选择处置/变动日期"
/>
</el-form-item>
<el-form-item v-show="false" label="数据类型" prop="dataType">
<el-select v-model="queryParams.dataType" placeholder="请选择处置方式" clearable size="small">
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.PROPERTY_DATA_TYPE)" :key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
</el-col>
</el-row>
</div>
</el-card>
<el-card class="box-card">
<!-- 卡片头 -->
<div slot="header" class="clearfix">
<i class="el-icon-plus"/>
<span>资产信息</span>
<el-button v-if="!formData.id" type="primary" style="float: right" @click="getList">选择资产</el-button>
</div>
<!-- 卡片内容 -->
<div>
<el-table :data="formData.propList" :stripe="true" :show-overflow-tooltip="true">
<el-table-column label="序号" align="center" prop="num">
<template #default="{ $index }">
{{ $index + 1 }}
</template>
</el-table-column>
<el-table-column label="资产编号" prop="propNo" align="center" width="180"/>
<el-table-column label="资产名称" prop="propName" align="center" width="180"/>
<el-table-column label="调入企业" prop="corpId" align="center" width="180">
<template #default="{ row }">
<el-select v-model="row.corpId" placeholder="请选择调入企业" clearable size="small"
@change="getOtherList(row)"
>
<el-option v-for="item in companyList" :key="item.id"
:label="item.corpName"
:value="item.id"
/>
</el-select>
</template>
</el-table-column>
<!-- TODO 修改回显有问题 -->
<el-table-column label="调入使用人" prop="userId" align="center" width="180">
<template #default="{ row }">
<el-select v-model="row.userId" placeholder="请选择使用人" clearable size="small">
<el-option v-for="item in staffList" :key="item.userId"
:label="item.name"
:value="item.userId"
/>
</el-select>
</template>
</el-table-column>
<el-table-column label="调入存放地" prop="posId" align="center" width="180">
<template #default="{ row }">
<el-select v-model="row.posId" placeholder="请选择调入企业" clearable size="small">
<el-option v-for="item in positionList" :key="item.id"
:label="item.posName"
:value="item.id"
/>
</el-select>
</template>
</el-table-column>
<el-table-column label="数量" align="center" prop="propNum" width="180">
<template #default="{ row }">
{{ row.propNum + ' ' + row.unit }}
</template>
</el-table-column>
<el-table-column label="价格" align="center" prop="netValue" width="180"/>
<el-table-column label="取得方式" align="center" prop="dealWay" width="180">
<template #default="{ row }">
<el-select v-model="row.dealWay" placeholder="请选择取得方式" clearable size="small">
<el-option v-for="dict in getDictDatas(DICT_TYPE.PROPERTY_GET_WAY)" :key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</template>
</el-table-column>
<el-table-column label="备注" align="center" prop="remark" width="180">
<template #default="{ row }">
<el-input type="textarea" v-model="row.remark"/>
</template>
</el-table-column>
<el-table-column v-if="!formData.id" fixed="right" label="操作" align="center"
class-name="small-padding fixed-width" width="150"
>
<template v-slot="scope">
<el-button size="mini" type="text" icon="el-icon-delete" @click="deleteProp(scope.$index)"
>删除
</el-button>
</template>
</el-table-column>
</el-table>
</div>
</el-card>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" :disabled="formLoading" @click="submitForm"> </el-button>
<el-button @click="dialogVisible = false"> </el-button>
</div>
</el-dialog>
<el-dialog v-if="!formData.id" title="选择资产" :visible.sync="chooseDisable" width="60%" v-dialogDrag append-to-body>
<!-- 搜索工作栏 -->
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="88px">
<el-form-item label="资产名称" prop="propName">
<el-input v-model="queryParams.propName" placeholder="请输入资产名称" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="资产编号" prop="propNo">
<el-input v-model="queryParams.propNo" placeholder="请输入资产编号" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
<el-table-column label="序号" align="center" prop="num">
<template slot-scope="scope">
<span style="margin-left: 10px">{{
queryParams.pageSize * (queryParams.pageNo - 1) + scope.$index + 1
}}</span>
</template>
</el-table-column>
<el-table-column :show-overflow-tooltip="true" label="资产名称" align="center" prop="propName" width="150px"/>
<el-table-column label="存放位置" align="center" prop="posName" width="150px"/>
<el-table-column label="资产编号" align="center" prop="propNo" width="150px"/>
<el-table-column label="价值类型" align="center" prop="costType" width="150px">
<template v-slot="scope">
<dict-tag :type="DICT_TYPE.COMPANY_COST_TYPE" :value="scope.row.costType"/>
</template>
</el-table-column>
<el-table-column label="资产原值(元)" align="center" prop="costTotal" width="150px"/>
<el-table-column label="资产状态" align="center" prop="propStatus" width="150px">
<template v-slot="scope">
<dict-tag :type="DICT_TYPE.COMPANY_PROP_STATUS" :value="scope.row.propStatus"/>
</template>
</el-table-column>
<el-table-column label="净值(元)" align="center" prop="netValue" width="150px"/>
<el-table-column label="数量" align="center" prop="propNum" width="150"/>
<el-table-column label="使用人" align="center" prop="staffName" width="150px"/>
<el-table-column fixed="right" label="操作" align="center" class-name="small-padding fixed-width" width="150px">
<template v-slot="scope">
<el-button size="mini" type="text" icon="el-icon-check" @click="chooseProp(scope.row)"
>选择
</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页组件 -->
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</el-dialog>
</div>
</template>
<script>
import * as PropertyDealItemApi from '@/api/company/property/propertydealitem'
import { createUUID } from '@/utils/createUUID'
import * as PropertyDealApi from '@/api/company/property/propertydeal'
import * as PropertyApi from '@/api/company/property/property'
import { getCompanyList } from '@/api/base/company'
import { getStaffListByCorpId } from '@/api/company/staff'
import { getPositionListByCorpId } from '@/api/company/property/position'
export default {
name: 'PropertyDealChangeForm',
data() {
return {
//
loading: true,
//
dialogTitle: '',
//
dialogVisible: false,
// 12
formLoading: false,
//
formData: {
id: undefined,
dealNo: undefined,
dealDate: undefined,
dataType: '01',
propList: []
},
//
formRules: {
dealDate: [{ required: true, message: '变动日期不能为空', trigger: 'blur' }]
},
chooseDisable: false,
//
queryParams: {
pageNo: 1,
pageSize: 10,
corpId: null,
deptId: null,
posId: null,
userId: null,
propNo: null,
propName: null,
propCatg: null,
useYear: null,
costType: null,
propNum: null,
costTotal: null,
propStatus: null,
brand: null,
spec: null,
factory: null,
serialNo: null,
unit: null,
getDateArray: [],
prodDate: [],
supplier: null,
openDateArray: [],
netValue: null,
voucherNo: null,
keepCycleType: null,
keepCycle: null,
lastKeepDate: [],
nextKeepDate: []
},
//
showSearch: true,
list: [],
total: 0,
companyList: [],
staffList: [],
positionList: []
}
},
methods: {
/** 打开弹窗 */
async open(id) {
this.reset()
//
if (id) {
this.formLoading = true
this.formData.id = id
try {
const res = await PropertyDealItemApi.getPropertyDealItem(id)
const propertyDeal = res.data.propertyDeal
this.formData.dealNo = propertyDeal.dealNo
this.formData.dealDate = propertyDeal.dealDate
this.formData.dataType = propertyDeal.dataType
this.formData.dealId = propertyDeal.id
const property = res.data.property
property.dealWay = res.data.dealWay
await this.getOtherList(property.corpId)
this.formData.propList.push(property)
} finally {
this.formLoading = false
}
}
if (!id) this.formData.dealNo = createUUID()
this.dialogTitle = id ? '修改资产变动单' : '新增资产变动单'
await this.listCompany()
this.dialogVisible = true
},
/** 表单重置 */
reset() {
this.formData = {
id: undefined,
dealNo: undefined,
dealDate: undefined,
dataType: '01',
propList: []
}
this.resetForm('formRef')
},
/** 提交按钮 */
async submitForm() {
//
await this.$refs['formRef'].validate()
//
const flag = await this.validatePropList()
if (flag) {
this.formLoading = true
try {
const data = this.formData
//
if (data.id) {
// TODO
// const newData = {
// id: data.id,
// dealWay: data.propList[0].dealWay,
// dealId: data.dealId,
// propertyId: data.propList[0].id,
// remark: data.propList[0].remark
// }
// await PropertyDealItemApi.updatePropertyDealItem(newData)
// this.$modal.msgSuccess('')
// this.dialogVisible = false
// this.$emit('success')
return
}
//
await PropertyDealApi.createPropertyDealChange(data)
this.$modal.msgSuccess('新增成功')
this.dialogVisible = false
this.$emit('success')
} finally {
this.formLoading = false
}
}
},
/** 查询列表 */
async getList() {
try {
this.loading = true
this.chooseDisable = true
const res = await PropertyApi.getPropertyPage(this.queryParams)
this.list = res.data.records
this.list = this.list.filter(item => !this.formData.propList.map(i => i.id).includes(item.id))
this.total = res.data.total
} finally {
this.loading = false
}
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNo = 1
this.getList()
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm('queryForm')
this.handleQuery()
},
chooseProp(row) {
this.chooseDisable = false
const newRow = {
...row,
dealWay: null,
remark: null
}
newRow.corpId = null
newRow.userId = null
newRow.posId = null
this.formData.propList.push(newRow)
},
deleteProp(index) {
this.formData.propList.splice(index, 1)
},
async listCompany() {
const res = await getCompanyList()
this.companyList = res.data
},
async listStaff(id) {
const res = await getStaffListByCorpId(id)
this.staffList = res.data
},
async listPosition(id) {
const res = await getPositionListByCorpId(id)
this.positionList = res.data
},
async getOtherList(row) {
if (row instanceof Object){
row.posId = null
row.userId = null
await this.listStaff(row.corpId)
await this.listPosition(row.corpId)
return
}
await this.listStaff(row)
await this.listPosition(row)
},
async validatePropList() {
const tempList = this.formData.propList
if (!tempList || tempList.length === 0) {
this.$modal.msgError('资产列表不能为空')
return false
} else {
const hasEmptyCorpId = tempList.some(item => !item.corpId)
const hasEmptyUserId = tempList.some(item => !item.userId)
const hasEmptyPosId = tempList.some(item => !item.posId)
const hasEmptyDealWay = tempList.some(item => !item.dealWay)
if (hasEmptyCorpId) {
this.$modal.msgError('调入企业不能为空')
return false
}
if (hasEmptyUserId) {
this.$modal.msgError('调入使用人不能为空')
return false
}
if (hasEmptyPosId) {
this.$modal.msgError('调入存放地不能为空')
return false
}
if (hasEmptyDealWay) {
this.$modal.msgError('取得方式不能为空')
return false
}
return true
}
}
}
}
</script>
<style scoped>
.box-card {
margin-bottom: 10px;
}
</style>

View File

@ -1,15 +1,250 @@
<template>
<div class="container">
1
<div class="app-container">
<!-- 搜索工作栏 -->
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="变动单号" prop="dealNo">
<el-input v-model="queryParams.dealNo" placeholder="请输入处置单" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="变动日期" prop="dealDateArray">
<el-date-picker v-model="queryParams.dealDateArray" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss"
type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"
:default-time="['00:00:00', '23:59:59']"
/>
</el-form-item>
<el-form-item v-show="false" label="数据类型" prop="dataType">
<el-select v-model="queryParams.dataType" placeholder="请选择处置方式" clearable size="small">
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.PROPERTY_DATA_TYPE)" :key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<!-- 操作工具栏 -->
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="openForm(undefined)"
v-hasPermi="['company:property-deal:create']"
>新增
</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
<el-table-column label="序号" align="center" prop="num">
<template slot-scope="scope">
<span style="margin-left: 10px">{{
queryParams.pageSize * (queryParams.pageNo - 1) + scope.$index + 1
}}</span>
</template>
</el-table-column>
<el-table-column label="变动单号" align="center" prop="propertyDeal.dealNo" width="180"/>
<el-table-column label="资产编号" align="center" prop="property.propNo" width="180"/>
<el-table-column label="资产名称" align="center" prop="property.propName" width="180"/>
<el-table-column label="变动时间" align="center" prop="propertyDeal.dealDate" width="180"/>
<el-table-column label="原企业" align="center" prop="oldCorpId" width="180">
<template #default="{ row }">
{{ CompanyName(row.oldCorpId) }}
</template>
</el-table-column>
<el-table-column label="调入企业" align="center" prop="corpId" width="180">
<template #default="{ row }">
{{ CompanyName(row.corpId) }}
</template>
</el-table-column>
<el-table-column label="原存放地" align="center" prop="oldPosId" width="180">
<template #default="{ row }">
{{ PositionName(row.oldPosId) }}
</template>
</el-table-column>
<el-table-column label="调入存放地" align="center" prop="posId" width="180">
<template #default="{ row }">
{{ PositionName(row.posId) }}
</template>
</el-table-column>
<el-table-column label="原使用人" align="center" prop="oldUserId" width="180">
<template #default="{ row }">
{{ StaffName(row.oldUserId) }}
</template>
</el-table-column>
<el-table-column label="调入使用人" align="center" prop="userId" width="180">
<template #default="{ row }">
{{ StaffName(row.userId) }}
</template>
</el-table-column>
<el-table-column label="备注" align="center" prop="remark" width="180"/>
<el-table-column fixed="right" label="操作" align="center" class-name="small-padding fixed-width" width="200">
<template v-slot="scope">
<el-button size="mini" type="text" icon="el-icon-edit" @click="openForm(scope.row.id)"
v-hasPermi="['company:property-deal:update']"
>修改
</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
v-hasPermi="['company:property-deal:delete']"
>删除
</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页组件 -->
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 对话框(添加 / 修改) -->
<PropertyDealChangeForm ref="formRef" @success="getList"/>
</div>
</template>
<script>
import * as PropertyDealItemApi from '@/api/company/property/propertydealitem'
import PropertyDealChangeForm from '@/views/company/property/propertyDealChange/form/PropertyDealChangeForm'
import { getCompany } from '@/api/base/company'
import { getStaffById } from '@/api/company/staff'
import { getPropertyPos } from '@/api/company/property/position'
export default {
name: 'PropertyDealChange'
name: 'PropertyDealChange',
components: {
PropertyDealChangeForm
},
data() {
return {
//
loading: false,
//
exportLoading: false,
//
showSearch: true,
//
total: 0,
// -
list: [],
//
queryParams: {
pageNo: 1,
pageSize: 10,
dealNo: undefined,
dealDateArray: [],
dataType: '01',
dealWay: undefined
},
companyNamesCache: {}, //
staffNamesCache: {}, //
positionNamesCache: {} //
}
},
created() {
this.getList()
},
computed: {
CompanyName() {
return (id) => {
if (this.companyNamesCache[id]) {
return this.companyNamesCache[id]
}
//
return this.getCompanyById(id)
}
},
StaffName() {
return (id) => {
if (this.staffNamesCache[id]) {
return this.staffNamesCache[id]
}
//
return this.getStaffByUserId(id)
}
},
PositionName() {
return (id) => {
if (this.positionNamesCache[id]) {
return this.positionNamesCache[id]
}
//
return this.getPositionById(id)
}
}
},
methods: {
/** 查询列表 */
async getList() {
try {
this.loading = true
const res = await PropertyDealItemApi.getPropertyDealItemPage(this.queryParams)
this.list = res.data.records
this.total = res.data.total
} finally {
this.loading = false
}
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNo = 1
this.getList()
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm('queryForm')
this.handleQuery()
},
/** 添加/修改操作 */
openForm(id) {
this.$refs['formRef'].open(id)
},
/** 删除按钮操作 */
async handleDelete(row) {
const id = row.id;
await this.$modal.confirm('是否确认删除企业管理-资产处置子编号为"' + id + '"的数据项?')
try {
await PropertyDealItemApi.deletePropertyDealItem(id);
await this.getList();
this.$modal.msgSuccess("删除成功");
} catch { }
},
async getCompanyById(id) {
try {
if (!this.companyNamesCache[id]) {
const res = await getCompany(id)
const name = res.data.corpName
this.$set(this.companyNamesCache, id, name)
}
return this.companyNamesCache[id]
} catch {
}
},
async getStaffByUserId(id) {
try {
if (!this.staffNamesCache[id]) {
const res = await getStaffById(id)
const name = res.data.name
this.$set(this.staffNamesCache, id, name)
}
return this.staffNamesCache[id]
} catch {
}
},
async getPositionById(id) {
try {
if (!this.positionNamesCache[id]) {
const res = await getPropertyPos(id)
const name = res.data.posName
this.$set(this.positionNamesCache, id, name)
}
return this.positionNamesCache[id]
} catch {
}
}
}
}
</script>
<style scoped>
<style scoped lang="scss">
</style>

View File

@ -18,14 +18,17 @@
</el-col>
<el-col :span="12">
<el-form-item label="处置时间" prop="dealDate">
<el-date-picker clearable v-model="formData.dealDate" type="date" value-format="timestamp"
<el-date-picker :disabled="!!formData.id" clearable v-model="formData.dealDate" type="date"
value-format="yyyy-MM-dd"
placeholder="选择处置/变动日期"
/>
</el-form-item>
<el-form-item v-show="false" label="数据类型" prop="dataType">
<el-select v-model="queryParams.dataType" placeholder="请选择处置方式" clearable size="small">
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.PROPERTY_DATA_TYPE)" :key="dict.value" :label="dict.label"
:value="dict.value" />
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.PROPERTY_DATA_TYPE)" :key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
</el-col>
@ -38,7 +41,7 @@
<div slot="header" class="clearfix">
<i class="el-icon-plus"/>
<span>资产信息</span>
<el-button type="primary" style="float: right" @click="getList">选择资产</el-button>
<el-button v-if="!formData.id" type="primary" style="float: right" @click="getList">选择资产</el-button>
</div>
<!-- 卡片内容 -->
<div>
@ -48,24 +51,34 @@
{{ $index + 1 }}
</template>
</el-table-column>
<el-table-column label="资产编号" prop="propNo" align="center" />
<el-table-column label="资产名称" prop="propName" align="center" />
<el-table-column label="价值类型" align="center" prop="costType" />
<el-table-column label="资产原值(元)" align="center" prop="costTotal" />
<el-table-column label="净值(元)" align="center" prop="netValue" />
<el-table-column label="存放位置" align="center" prop="posName" width="150px"/>
<el-table-column label="处置方式" align="center" prop="dealWay">
<el-table-column label="资产编号" prop="propNo" align="center" width="180"/>
<el-table-column label="资产名称" prop="propName" align="center" width="180"/>
<el-table-column label="价值类型" align="center" prop="costType" width="180"/>
<el-table-column label="资产原值(元)" align="center" prop="costTotal" width="180"/>
<el-table-column label="净值(元)" align="center" prop="netValue" width="180"/>
<el-table-column label="存放位置" align="center" prop="posName" width="180"/>
<el-table-column label="备注" align="center" prop="remark" width="180">
<template #default="{ row }">
<el-input type="textarea" v-model="row.remark" />
</template>
</el-table-column>
<el-table-column label="处置方式" align="center" prop="dealWay" width="180">
<template #default="{ row }">
<el-select v-model="row.dealWay" placeholder="请选择处置方式" clearable size="small">
<el-option v-for="dict in getDictDatas(DICT_TYPE.COMPANY_DEAL_WAY)" :key="dict.value" :label="dict.label"
:value="dict.value" />
<el-option v-for="dict in getDictDatas(DICT_TYPE.COMPANY_DEAL_WAY)" :key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</template>
</el-table-column>
<el-table-column fixed="right" label="操作" align="center" class-name="small-padding fixed-width" width="200">
<el-table-column v-if="!formData.id" fixed="right" label="操作" align="center"
class-name="small-padding fixed-width" width="150"
>
<template v-slot="scope">
<el-button size="mini" type="text" icon="el-icon-delete" @click="deleteProp(scope.$index)"
>删除</el-button>
>删除
</el-button>
</template>
</el-table-column>
</el-table>
@ -78,7 +91,7 @@
</div>
</el-dialog>
<el-dialog title="选择资产" :visible.sync="chooseDisable" width="60%" v-dialogDrag append-to-body>
<el-dialog v-if="!formData.id" title="选择资产" :visible.sync="chooseDisable" width="60%" v-dialogDrag append-to-body>
<!-- 搜索工作栏 -->
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="88px">
<el-form-item label="资产名称" prop="propName">
@ -109,14 +122,14 @@
<dict-tag :type="DICT_TYPE.COMPANY_COST_TYPE" :value="scope.row.costType"/>
</template>
</el-table-column>
<el-table-column label="资产原值(元)" align="center" prop="costTotal"width="150px"/>
<el-table-column label="资产原值(元)" align="center" prop="costTotal" width="150px"/>
<el-table-column label="资产状态" align="center" prop="propStatus" width="150px">
<template v-slot="scope">
<dict-tag :type="DICT_TYPE.COMPANY_PROP_STATUS" :value="scope.row.propStatus"/>
</template>
</el-table-column>
<el-table-column label="净值(元)" align="center" prop="netValue" width="150px"/>
<el-table-column label="使用人" align="center" prop="staffName" width="150px" />
<el-table-column label="使用人" align="center" prop="staffName" width="150px"/>
<el-table-column fixed="right" label="操作" align="center" class-name="small-padding fixed-width" width="150px">
<template v-slot="scope">
<el-button size="mini" type="text" icon="el-icon-check" @click="chooseProp(scope.row)"
@ -139,6 +152,7 @@
import { createUUID } from '@/utils/createUUID'
import * as PropertyApi from '@/api/company/property/property'
import * as PropertyDealApi from '@/api/company/property/propertydeal'
import * as PropertyDealItemApi from '@/api/company/property/propertydealitem'
export default {
name: 'PropertyDealDisposalForm',
@ -157,12 +171,12 @@ export default {
id: undefined,
dealNo: undefined,
dealDate: undefined,
dataType: "02",
dataType: '02',
propList: []
},
//
formRules: {
dealDate: [{required: true, message: "处置日期不能为空", trigger: 'blur'}],
dealDate: [{ required: true, message: '处置日期不能为空', trigger: 'blur' }]
},
chooseDisable: false,
//
@ -195,12 +209,12 @@ export default {
keepCycleType: null,
keepCycle: null,
lastKeepDate: [],
nextKeepDate: [],
nextKeepDate: []
},
//
showSearch: true,
list: [],
total: 0,
total: 0
}
},
methods: {
@ -211,16 +225,23 @@ export default {
//
if (id) {
this.formLoading = true
this.formData.id = id
try {
// const res = await PropertyDealApi.getPropertyDeal(id);
// this.formData = res.data;
this.dialogTitle = '修改资产处置单'
const res = await PropertyDealItemApi.getPropertyDealItem(id)
const propertyDeal = res.data.propertyDeal
this.formData.dealNo = propertyDeal.dealNo
this.formData.dealDate = propertyDeal.dealDate
this.formData.dataType = propertyDeal.dataType
this.formData.dealId = propertyDeal.id
const property = res.data.property
property.dealWay = res.data.dealWay
this.formData.propList.push(property)
} finally {
this.formLoading = false
}
}
this.formData.dealNo = createUUID()
this.dialogTitle = '新增资产处置单'
if (!id) this.formData.dealNo = createUUID()
this.dialogTitle = id ? '修改资产处置单' : '新增资产处置单'
},
/** 表单重置 */
reset() {
@ -228,7 +249,7 @@ export default {
id: undefined,
dealNo: undefined,
dealDate: undefined,
dataType: "02",
dataType: '02',
propList: []
}
this.resetForm('formRef')
@ -256,41 +277,51 @@ export default {
this.loading = false
}
},
chooseProp(row){
this.chooseDisable = false;
chooseProp(row) {
this.chooseDisable = false
const newRow = {
...row,
dealWay: null,
remark: null,
}
this.formData.propList.push(newRow)
},
deleteProp(index){
deleteProp(index) {
this.formData.propList.splice(index, 1)
},
/** 提交按钮 */
async submitForm() {
//
await this.$refs["formRef"].validate();
await this.$refs['formRef'].validate()
//
const flag = await this.validatePropList();
this.formLoading = true;
try {
const data = this.formData;
//
if (data.id) {
await PropertyDealApi.updatePropertyDeal(data);
this.$modal.msgSuccess("修改成功");
this.dialogVisible = false;
this.$emit('success');
return;
const flag = await this.validatePropList()
if (flag) {
this.formLoading = true
try {
const data = this.formData
//
if (data.id) {
const newData = {
id: data.id,
dealWay: data.propList[0].dealWay,
dealId: data.dealId,
propertyId: data.propList[0].id,
remark: data.propList[0].remark
}
await PropertyDealItemApi.updatePropertyDealItem(newData);
this.$modal.msgSuccess("修改成功");
this.dialogVisible = false
this.$emit('success')
return
}
//
await PropertyDealApi.createPropertyDeal(data);
this.$modal.msgSuccess("新增成功");
this.dialogVisible = false
this.$emit('success')
} finally {
this.formLoading = false
}
//
await PropertyDealApi.createPropertyDeal(data);
this.$modal.msgSuccess("新增成功");
this.dialogVisible = false;
this.$emit('success');
} finally {
this.formLoading = false;
}
},
async validatePropList() {
@ -299,15 +330,15 @@ export default {
this.$modal.msgError('资产列表不能为空')
return false
} else {
const hasEmptyDealWay = tempList.some(item => !item.dealWay);
const hasEmptyDealWay = tempList.some(item => !item.dealWay)
if (hasEmptyDealWay) {
this.$modal.msgError('处置方式不能为空')
return false;
return false
} else {
return true
}
}
},
}
}
}
</script>

View File

@ -51,16 +51,17 @@
<dict-tag :type="DICT_TYPE.COMPANY_DEAL_WAY" :value="scope.row.dealWay" />
</template>
</el-table-column>
<el-table-column label="资产编号" align="center" prop="property.propNo" />
<el-table-column label="资产名称" align="center" prop="property.propName" />
<el-table-column label="价值类型" align="center" prop="property.costType">
<el-table-column label="资产编号" align="center" prop="property.propNo" width="180"/>
<el-table-column label="资产名称" align="center" prop="property.propName" width="180"/>
<el-table-column label="价值类型" align="center" prop="property.costType" width="180">
<template v-slot="scope">
<dict-tag :type="DICT_TYPE.COMPANY_COST_TYPE" :value="scope.row.property.costType"/>
</template>
</el-table-column>
<el-table-column label="资产原值(元)" align="center" prop="property.costTotal" />
<el-table-column label="净值(元)" align="center" prop="property.netValue" />
<el-table-column label="处置时间" align="center" prop="propertyDeal.dealDate" />
<el-table-column label="资产原值(元)" align="center" prop="property.costTotal" width="180"/>
<el-table-column label="净值(元)" align="center" prop="property.netValue" width="180"/>
<el-table-column label="处置时间" align="center" prop="propertyDeal.dealDate" width="180"/>
<el-table-column label="备注" align="center" prop="remark" width="180"/>
<el-table-column fixed="right" label="操作" align="center" class-name="small-padding fixed-width" width="200">
<template v-slot="scope">
<el-button size="mini" type="text" icon="el-icon-edit" @click="openForm(scope.row.id)"
@ -121,7 +122,6 @@ export default {
try {
this.loading = true;
const res = await PropertyDealItemApi.getPropertyDealItemPage(this.queryParams);
console.log(res)
this.list = res.data.records;
this.total = res.data.total;
} finally {