资产管理CRUD
This commit is contained in:
parent
dcf8442ce7
commit
21a0949135
@ -42,7 +42,7 @@
|
||||
|
||||
<script>
|
||||
|
||||
import * as PropertyPosApi from '@/api/base/property/position';
|
||||
import * as PropertyPosApi from '@/api/company/property/position';
|
||||
export default {
|
||||
name: "PropertyPosForm",
|
||||
components: {
|
||||
|
@ -63,7 +63,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import * as PropertyPosApi from '@/api/base/property/position';
|
||||
import * as PropertyPosApi from '@/api/company/property/position';
|
||||
import PropertyPosForm from './PropertyPosForm.vue';
|
||||
export default {
|
||||
name: "PropertyPos",
|
||||
|
@ -186,8 +186,8 @@
|
||||
<el-row :gutter="2">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="使用人" prop="userId">
|
||||
<el-select filterable v-model="formData.userId" placeholder="请选择使用人" clearable class="customerSelectWidth">
|
||||
<el-option v-for="item in staffList" :key="item.id" :label="item.name" :value="item.userId">
|
||||
<el-select filterable v-model="formData.userId" placeholder="请选择使用人" clearable class="customerSelectWidth" :filter-method="searchOption">
|
||||
<el-option v-for="item in options" :key="item.userId" :label="item.name" :value="item.userId">
|
||||
<div class="options">
|
||||
<span>姓名:{{ item.name }}</span>
|
||||
<span>工号:{{ item.workNo }}</span>
|
||||
@ -199,7 +199,9 @@
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="存放位置" prop="posId">
|
||||
<el-input v-model="formData.posId" placeholder="请输入存放位置"/>
|
||||
<el-select v-model="formData.posId" clearable filterable placeholder="请选择存放位置" class="customerSelectWidth">
|
||||
<el-option v-for="item in positionList" :key="item.id" :label="item.posName" :value="item.id" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@ -220,8 +222,8 @@
|
||||
</div>
|
||||
<!-- 卡片内容 -->
|
||||
<div>
|
||||
<el-form-item label="附件上传">
|
||||
<FileUpload v-model="formData.fileUrls"/>
|
||||
<el-form-item label="附件上传" prop="fileUrls">
|
||||
<file-upload v-model="formData.fileUrls"/>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</el-card>
|
||||
@ -235,9 +237,8 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import * as PropertyApi from '@/api/base/property/property'
|
||||
import * as PropertyApi from '@/api/company/property/property'
|
||||
import FileUpload from '@/components/FileUpload'
|
||||
import {getStaffList} from '@/api/company/staff'
|
||||
|
||||
export default {
|
||||
name: 'PropertyForm',
|
||||
@ -305,11 +306,13 @@ export default {
|
||||
},
|
||||
companyPropertyCatg: [],
|
||||
staffList: [],
|
||||
positionList: [],
|
||||
options: [],
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
/** 打开弹窗 */
|
||||
async open(id, companyPropertyCatg, staffList) {
|
||||
async open(id, companyPropertyCatg, staffList, positionList) {
|
||||
this.dialogVisible = true
|
||||
this.reset()
|
||||
// 修改时,设置数据
|
||||
@ -318,6 +321,12 @@ export default {
|
||||
try {
|
||||
const res = await PropertyApi.getProperty(id)
|
||||
this.formData = res.data
|
||||
this.formData.userId = parseInt(this.formData.userId)
|
||||
this.formData.prodDate = new Date(this.formData.prodDate)
|
||||
this.formData.lastKeepDate = new Date(this.formData.lastKeepDate)
|
||||
this.formData.openDate = new Date(this.formData.openDate)
|
||||
this.formData.nextKeepDate = new Date(this.formData.nextKeepDate)
|
||||
this.formData.getDate = new Date(this.formData.getDate)
|
||||
this.dialogTitle = '修改企业管理-资产'
|
||||
} finally {
|
||||
this.formLoading = false
|
||||
@ -326,6 +335,8 @@ export default {
|
||||
this.dialogTitle = '新增企业管理-资产'
|
||||
this.companyPropertyCatg = companyPropertyCatg
|
||||
this.staffList = staffList
|
||||
this.options = this.staffList
|
||||
this.positionList = positionList
|
||||
},
|
||||
/** 提交按钮 */
|
||||
async submitForm() {
|
||||
@ -411,8 +422,15 @@ export default {
|
||||
default:
|
||||
throw new Error('超出预期了,只能是年、月、天');
|
||||
}
|
||||
this.formData.nextKeepDate = tempDate
|
||||
this.formData.nextKeepDate = new Date(tempDate)
|
||||
},
|
||||
searchOption(val) {
|
||||
this.options = this.staffList.filter(item => (
|
||||
item.name.toLowerCase().includes(val.toLowerCase()) ||
|
||||
item.workNo.includes(val) ||
|
||||
item.tel.includes(val)
|
||||
))
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
@ -42,10 +42,12 @@
|
||||
<el-input v-model="queryParams.factory" placeholder="请输入生产厂家" clearable @keyup.enter.native="handleQuery"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="存放位置" prop="posId">
|
||||
<el-input v-model="queryParams.posId" placeholder="请输入存放位置" clearable @keyup.enter.native="handleQuery"/>
|
||||
<el-select v-model="queryParams.posId" clearable filterable placeholder="请选择存放位置">
|
||||
<el-option v-for="item in positionList" :key="item.id" :label="item.posName" :value="item.id"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="使用人" prop="userId">
|
||||
<el-select filterable v-model="queryParams.userId" placeholder="请选择使用人" clearable class="customerSelectWidth">
|
||||
<el-select filterable v-model="queryParams.userId" placeholder="请选择使用人" clearable>
|
||||
<el-option v-for="item in staffList" :key="item.id" :label="item.name" :value="item.userId">
|
||||
<div class="options">
|
||||
<span>姓名:{{ item.name }}</span>
|
||||
@ -55,14 +57,14 @@
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="取得日期" prop="getDate">
|
||||
<el-date-picker v-model="queryParams.getDate" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss"
|
||||
<el-form-item label="取得日期" prop="getDateArray">
|
||||
<el-date-picker v-model="queryParams.getDateArray" 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 label="启用日期" prop="openDate">
|
||||
<el-date-picker v-model="queryParams.openDate" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss"
|
||||
<el-form-item label="启用日期" prop="openDateArray">
|
||||
<el-date-picker v-model="queryParams.openDateArray" 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']"
|
||||
/>
|
||||
@ -98,50 +100,55 @@
|
||||
}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="资产名称" align="center" prop="propName"/>
|
||||
<el-table-column label="存放位置" align="center" prop="posId"/>
|
||||
<el-table-column label="资产编号" align="center" prop="propNo"/>
|
||||
<el-table-column label="资产分类" align="center" prop="propCatg"/>
|
||||
<el-table-column label="价值类型" align="center" prop="costType">
|
||||
<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="propCatg" width="150px">
|
||||
<template v-slot="scope">
|
||||
{{scope.row.propCatg !== null ? companyPropertyCatg.find(item => item.code === scope.row.propCatg).name : ''}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<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="useYear" width="110px"/>
|
||||
<el-table-column label="资产数量" align="center" prop="propNum">
|
||||
<el-table-column label="预计使用年限" align="center" prop="useYear" width="150px"/>
|
||||
<el-table-column label="资产数量" align="center" prop="propNum" width="150px">
|
||||
<template v-slot="scope">
|
||||
{{ scope.row.propNum + ' ' + scope.row.unit }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="资产原值(元)" align="center" prop="costTotal" width="120px"/>
|
||||
<el-table-column label="资产状态" align="center" prop="propStatus">
|
||||
<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="brand"/>
|
||||
<el-table-column label="规格型号" align="center" prop="spec"/>
|
||||
<el-table-column label="生产厂家" align="center" prop="factory"/>
|
||||
<el-table-column label="出厂序列号/编号" align="center" prop="serialNo" width="130px"/>
|
||||
<el-table-column label="出厂日期" align="center" prop="prodDate">
|
||||
<el-table-column label="品牌" align="center" prop="brand" width="150px"/>
|
||||
<el-table-column label="规格型号" align="center" prop="spec" width="150px"/>
|
||||
<el-table-column :show-overflow-tooltip="true" label="生产厂家" align="center" prop="factory" width="150px"/>
|
||||
<el-table-column label="出厂序列号/编号" align="center" prop="serialNo" width="150px"/>
|
||||
<el-table-column label="出厂日期" align="center" prop="prodDate" width="150px">
|
||||
<template v-slot="scope">
|
||||
{{ scope.row.prodDate }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="取得日期" align="center" prop="getDate"/>
|
||||
<el-table-column label="供应商" align="center" prop="supplier"/>
|
||||
<el-table-column label="启用日期" align="center" prop="openDate"/>
|
||||
<el-table-column label="净值(元)" align="center" prop="netValue" width="90px"/>
|
||||
<el-table-column label="凭证号" align="center" prop="voucherNo"/>
|
||||
<el-table-column label="上次维修/保养日期" align="center" prop="lastKeepDate" width="130px"/>
|
||||
<el-table-column label="维修/保养周期" align="center" prop="keepCycle" width="120px">
|
||||
<el-table-column label="取得日期" align="center" prop="getDate" width="150px"/>
|
||||
<el-table-column :show-overflow-tooltip="true" label="供应商" align="center" prop="supplier" width="150px"/>
|
||||
<el-table-column label="启用日期" align="center" prop="openDate" width="150px"/>
|
||||
<el-table-column label="净值(元)" align="center" prop="netValue" width="150px"/>
|
||||
<el-table-column label="凭证号" align="center" prop="voucherNo" width="150px"/>
|
||||
<el-table-column label="上次维修/保养日期" align="center" prop="lastKeepDate" width="150px"/>
|
||||
<el-table-column label="维修/保养周期" align="center" prop="keepCycle" width="150px">
|
||||
<template v-slot="scope">
|
||||
{{ scope.row.keepCycle + ' ' + scope.row.keepCycleType }}
|
||||
{{ scope.row.keepCycle + ' '}}
|
||||
<dict-tag :type="DICT_TYPE.CYCLE_DICT" :value="scope.row.keepCycleType"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="下次维修/保养日期" align="center" prop="nextKeepDate" width="130px"/>
|
||||
<el-table-column label="使用人" align="center" prop="userId"/>
|
||||
<el-table-column fixed="right" label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<el-table-column label="下次维修/保养日期" align="center" prop="nextKeepDate" 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-edit" @click="openForm(scope.row.id)"
|
||||
v-hasPermi="['company:property:update']"
|
||||
@ -164,11 +171,12 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import * as PropertyApi from '@/api/base/property/property'
|
||||
import * as PropertyApi from '@/api/company/property/property'
|
||||
import PropertyForm from './form/PropertyForm.vue'
|
||||
import { listCategory } from '@/api/system/category'
|
||||
import { DICT_TYPE } from '@/utils/dict'
|
||||
import { getStaffList } from '@/api/company/staff'
|
||||
import { getPropertyPosList } from '@/api/company/property/position'
|
||||
|
||||
export default {
|
||||
name: 'Property',
|
||||
@ -214,26 +222,28 @@ export default {
|
||||
factory: null,
|
||||
serialNo: null,
|
||||
unit: null,
|
||||
getDate: [],
|
||||
getDateArray: [],
|
||||
prodDate: [],
|
||||
supplier: null,
|
||||
openDate: [],
|
||||
openDateArray: [],
|
||||
netValue: null,
|
||||
voucherNo: null,
|
||||
keepCycleType: null,
|
||||
keepCycle: null,
|
||||
lastKeepDate: [],
|
||||
nextKeepDate: [],
|
||||
createTime: [],
|
||||
createTime: []
|
||||
},
|
||||
companyPropertyCatg: [],
|
||||
staffList: [],
|
||||
positionList: []
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getList()
|
||||
this.getCompanyPropertyCatg()
|
||||
this.listStaff()
|
||||
this.listPropertyPos()
|
||||
},
|
||||
methods: {
|
||||
/** 查询列表 */
|
||||
@ -241,6 +251,7 @@ export default {
|
||||
try {
|
||||
this.loading = true
|
||||
const res = await PropertyApi.getPropertyPage(this.queryParams)
|
||||
|
||||
this.list = res.data.records
|
||||
this.total = res.data.total
|
||||
} finally {
|
||||
@ -259,12 +270,13 @@ export default {
|
||||
},
|
||||
/** 添加/修改操作 */
|
||||
openForm(id) {
|
||||
this.$refs['formRef'].open(id, this.companyPropertyCatg, this.staffList)
|
||||
this.$refs['formRef'].open(id, this.companyPropertyCatg, this.staffList, this.positionList)
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
async handleDelete(row) {
|
||||
const id = row.id
|
||||
await this.$modal.confirm('是否确认删除企业管理-资产编号为"' + id + '"的数据项?')
|
||||
const propNo = row.propNo
|
||||
await this.$modal.confirm('是否确认删除企业管理-资产编号为"' + propNo + '"的数据项?')
|
||||
try {
|
||||
await PropertyApi.deleteProperty(id)
|
||||
await this.getList()
|
||||
@ -285,17 +297,23 @@ export default {
|
||||
}
|
||||
},
|
||||
// 获取分类字典
|
||||
async getCompanyPropertyCatg(){
|
||||
async getCompanyPropertyCatg() {
|
||||
listCategory().then(res => {
|
||||
this.companyPropertyCatg = this.handleTree(res.data, 'id', 'pid', 'children', '0').find(item => item.code === DICT_TYPE.COMPANY_PROPERTY_CATG).children
|
||||
})
|
||||
},
|
||||
// 拿当前登录用户的部门下的员工们
|
||||
async listStaff(){
|
||||
async listStaff() {
|
||||
getStaffList().then(res => {
|
||||
this.staffList = res.data
|
||||
})
|
||||
},
|
||||
// 拿到位置列表
|
||||
async listPropertyPos() {
|
||||
getPropertyPosList().then(res => {
|
||||
this.positionList = res.data
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
@ -32,7 +32,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import * as PropertyDealApi from '@/api/base/property/propertydeal';
|
||||
import * as PropertyDealApi from '@/api/company/property/propertydeal';
|
||||
|
||||
export default {
|
||||
name: "PropertyDealForm",
|
||||
|
@ -88,7 +88,7 @@
|
||||
|
||||
<script>
|
||||
|
||||
import * as PropertyDealApi from '@/api/base/property/propertydeal';
|
||||
import * as PropertyDealApi from '@/api/company/property/propertydeal';
|
||||
import PropertyDealForm from './PropertyDealForm.vue';
|
||||
export default {
|
||||
name: "PropertyDeal",
|
||||
|
@ -52,7 +52,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import * as PropertyDealItemApi from '@/api/base/property/propertydealitem';
|
||||
import * as PropertyDealItemApi from '@/api/company/property/propertydealitem';
|
||||
|
||||
export default {
|
||||
name: "PropertyDealItemForm",
|
||||
|
@ -111,7 +111,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import * as PropertyDealItemApi from '@/api/base/property/propertydealitem';
|
||||
import * as PropertyDealItemApi from '@/api/company/property/propertydealitem';
|
||||
|
||||
import PropertyDealItemForm from './PropertyDealItemForm.vue';
|
||||
export default {
|
||||
|
@ -26,7 +26,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import * as PropertyKeepApi from '@/api/base/property/propertykeep';
|
||||
import * as PropertyKeepApi from '@/api/company/property/propertykeep';
|
||||
import FileUpload from '@/components/FileUpload';
|
||||
export default {
|
||||
name: "PropertyKeepForm",
|
||||
|
@ -71,7 +71,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import * as PropertyKeepApi from '@/api/base/property/propertykeep';
|
||||
import * as PropertyKeepApi from '@/api/company/property/propertykeep';
|
||||
import PropertyKeepForm from './PropertyKeepForm.vue';
|
||||
export default {
|
||||
name: "PropertyKeep",
|
||||
|
Loading…
Reference in New Issue
Block a user