Browse Source

造价管理前端

dev
zhouhaibin 4 months ago
parent
commit
835a016783
  1. 6
      src/api/index.ts
  2. 37
      src/modules/costManagement/api/index.ts
  3. 222
      src/modules/costManagement/components/costTypeComponents.vue
  4. 49
      src/modules/costManagement/view/costIndex/index.vue
  5. 368
      src/modules/costManagement/view/costTable/add.vue
  6. 194
      src/modules/costManagement/view/costTable/index.vue
  7. 376
      src/modules/costManagement/view/costTable/modify.vue
  8. 221
      src/modules/costManagement/view/costTable/view.vue
  9. 132
      src/modules/costMode/components/supplierInformationComponents.vue
  10. 2
      src/views/Login/components/LoginForm.vue

6
src/api/index.ts

@ -6,6 +6,8 @@ import * as scheduler from '@/modules/scheduler/api'
import * as notification from '@/modules/notification/api'
import * as workflow from '@/modules/workflow/api'
import * as businessflow from '@/modules/businessflow/api'
import * as productManagement from '@/modules/productManagement/api'
import * as costManagement from '@/modules/costManagement/api'
export default {
system,
@ -15,5 +17,7 @@ export default {
scheduler,
notification,
workflow,
businessflow
businessflow,
productManagement,
costManagement
}

37
src/modules/costMode/api/index.ts → src/modules/costManagement/api/index.ts

@ -1,7 +1,7 @@
import { COMMON_METHOD } from '@/constant/common'
import request from '@/config/axios'
const moduleName = 'costMode'
const moduleName = 'costManagement'
// 系统参数
// export const param = Object.assign({}, COMMON_METHOD, {
@ -22,12 +22,39 @@ const moduleName = 'costMode'
// 个人产品
export const personProducts = Object.assign({}, COMMON_METHOD, {
serveUrl: '/' + moduleName + '/' + 'personProducts' + '/',
// 造价表
export const costTable = Object.assign({}, COMMON_METHOD, {
serveUrl: '/' + moduleName + '/' + 'costTable' + '/',
// 新增
addCostTable(itemList) {
return request.post({ url: this.serveUrl + 'addCostTable', data: itemList })
},
// 查询数据
getCostTableDetail(id) {
return request.get({ url: this.serveUrl + 'getCostTableDetail/' + id })
},
modifyCostTable(params){
return request.put({ url: this.serveUrl + 'modifyCostTable', data: params })
}
})
// 造价明细
export const costItemDetail = Object.assign({}, COMMON_METHOD, {
serveUrl: '/' + moduleName + '/' + 'costItemDetail' + '/',
// 全产品造价
getProductsPageByType(params) {
return request.get({ url: this.serveUrl + 'getProductsPageByType', params })
},
// 查询数据
getCostTableDetail(id) {
return request.get({ url: this.serveUrl + 'getCostTableDetail/' + id })
},
modifyCostTable(params){
return request.put({ url: this.serveUrl + 'modifyCostTable', data: params })
}
})
// 字典类型
export const dictionaryType = Object.assign({}, COMMON_METHOD, {
serveUrl: '/' + moduleName + '/' + 'dictionaryType' + '/',

222
src/modules/costManagement/components/costTypeComponents.vue

@ -0,0 +1,222 @@
<template>
<div class="w-full">
<el-input v-model="displayName" disabled style="width: 152px" />
<el-button-group>
<el-button icon="grid" @click="init" style="border-left-width: 0; padding: 10px" />
<el-button icon="delete" @click="clear" style="border-left-width: 0; padding: 10px" />
</el-button-group>
<Dialog title="模块选择" v-model="visible" width="80%">
<el-container>
<el-aside width="200px">
<avue-tree ref="treeRef" :option="treeOption" :data="treeData" @node-click="nodeClick" />
</el-aside>
<el-main>
<avue-crud
v-model:page="page"
v-model:search="queryCondition"
@search-change="searchChange"
@current-row-change="handleCurrentRowChange"
@row-dblclick="confirm"
@on-load="onLoad"
:data="loadData"
:option="loadOption"
>
<template #menu-left="{}">
<el-button
type="danger"
icon="el-icon-plus"
@click="addrow()"
v-permission="'productManagement:personProducts:add'"
>新增个人产品</el-button
>
</template>
</avue-crud>
</el-main>
</el-container>
<template #footer>
<el-button type="primary" @click="confirm">确定</el-button>
<el-button @click="close">关闭</el-button>
</template>
</Dialog>
</div>
</template>
<script>
import { Dialog } from '@/components/abc/Dialog'
const MODULE_CODE = 'costManagement'
const ENTITY_TYPE = 'costItemDetail'
export default {
emits: ['update:modelValue', 'updateCostInfo', 'my-change'],
name: ENTITY_TYPE + '-reference',
components: { Dialog },
mixins: [],
props: {
moduleParam: {
type: Object,
required: false
},
modelValue: {
type: String,
required: false
},
costDescribe: {
type: String,
required: false
}
},
data() {
return {
entityType: ENTITY_TYPE,
moduleCode: MODULE_CODE,
// eslint-disable-next-line no-eval
api: eval('this.$api.' + MODULE_CODE + '.' + ENTITY_TYPE),
pageCode: MODULE_CODE + ':' + ENTITY_TYPE + ':',
visible: false,
queryCondition: {},
currentRow: {},
displayName: '',
page: {
total: 0,
currentPage: 1,
pageSize: 10
},
pageInfo: {
//
pageNum: 1,
//
pageSize: 10
},
sortInfo: {
sort_field: 'id',
sort_sortType: 'descending'
},
treeData: [
{
value: '全产品库',
label: '全产品库'
},
{
value: '供应商产品库',
label: '供应商产品库'
},
{
value: '公司产品库',
label: '公司产品库'
},
{
value: '个人产品库',
label: '个人产品库'
}
],
treeOption: {
defaultExpandAll: true,
filter: false
},
loadData: [],
loadOption: {
highlightCurrentRow: true,
menu: false,
addBtn: false,
labelWidth: 120,
column: {
productName: {
label: '产品名称',
labelWidth: 120,
search: true,
searchLabelWidth: 120
},
productIdentity: {
label: '产品标识(型号)',
labelWidth: 120,
search: true,
searchLabelWidth: 120
},
productPrice: {
label: '产品价格',
labelWidth: 120,
type: 'number',
precision: 2,
mim: 0
},
modelDescription: {
label: '产品描述',
labelWidth: 120,
//editDisabled: true //
display: false //
},
remarks: {
label: '备注',
labelWidth: 120
},
productType: {
label: '所在库'
}
}
},
//
nameKey: 'supplierName'
}
},
watch: {
modelValue: {
handler(newvalue, oldvalue) {
this.displayName = newvalue
},
immediate: true
}
},
methods: {
init(param) {
if (this.beforeInit != null) {
this.beforeInit(param)
}
this.visible = true
//
this.queryCondition.productType = '全产品库'
this.pageInfo.pageNum = this.page.currentPage
const params = Object.assign(this.queryCondition, this.pageInfo, this.sortInfo)
this.api.getProductsPageByType(params).then((res) => {
this.loadData = res.data.records
this.page.total = res.data.total
// res.data.total
})
this.$refs.treeRef.setCurrentKey(-1)
},
close() {
this.visible = false
},
confirm(row) {
if (row) {
this.currentRow = row
}
this.displayName = this.currentRow.productName
this.$emit('update:modelValue', this.displayName)
this.$emit('updateCostInfo', this.currentRow)
this.visible = false
},
nodeClick(data) {
this.queryCondition.productType = data.value
this.onLoad()
},
onLoad() {
this.pageInfo.pageNum = this.page.currentPage
const params = Object.assign(this.queryCondition, this.pageInfo, this.sortInfo)
this.api.getProductsPageByType(params).then((res) => {
this.loadData = res.data.records
this.page.total = res.data.total
// res.data.total
})
},
searchChange(val, done) {
this.onLoad()
done()
},
handleCurrentRowChange(val) {
this.currentRow = val
}
}
}
</script>
<style></style>

49
src/modules/costManagement/view/costIndex/index.vue

@ -0,0 +1,49 @@
<template>
<div class="container1">
<iframe
id="modle_iframe"
src="https://www.gldjc.com/"
width="100%"
height="100%"
frameborder="0"
scrolling="auto"
></iframe>
</div>
</template>
<script>
export default {
data() {
return {}
},
mounted() {
/**
* iframe-宽高自适应显示
*/
// function changeMobsfIframe() {
// const mobsf = document.getElementById('mobsf')
// const deviceWidth = document.body.clientWidth
// const deviceHeight = document.body.clientHeight
// mobsf.style.width = Number(deviceWidth) - 240 + 'px' //
// mobsf.style.height = Number(deviceHeight) - 64 + 'px' //
// }
// changeMobsfIframe()
// window.onresize = function () {
// changeMobsfIframe()
// }
}
}
</script>
<style scoped lang="less">
.container1 {
// position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100vh;
}
// #modle_iframe {
// width: 100%;
// height: 100%;
// }
</style>

368
src/modules/costManagement/view/costTable/add.vue

@ -0,0 +1,368 @@
<template>
<Dialog title="新增" v-model="visible" width="80%">
<el-form
ref="form"
:model="entityData"
:rules="rules"
label-width="120px"
label-position="right"
style="width: 90%; margin: 0px auto"
>
<!--表单区域 -->
<el-form-item label="项目名称" prop="projectName">
<el-input v-model="entityData.projectName" />
</el-form-item>
<el-form-item label="总投资" prop="totalInvestment">
<el-input type="number" v-model="entityData.totalInvestment" disabled />
</el-form-item>
</el-form>
<!--表格区域-->
<avue-crud
ref="crudRef"
v-model="curdForm"
v-model:defaults="defaults"
:option="option"
:data="tableData"
@row-update="addUpdate"
@row-save="rowSave"
@row-del="rowDelete"
>
<template #orderNo="{ row }">
<el-tag type="success">{{ row.orderNo }}</el-tag>
</template>
<template #menu-left="{}">
<el-button
type="danger"
icon="el-icon-plus"
@click="addrow()"
v-permission="pageCode + 'add'"
>新增</el-button
>
</template>
<template #menu="{ row, index }">
<el-button text type="primary" @click="addChild(row, index)" v-if="row.isDetail == '0'"
>增加子项</el-button
>
</template>
<template #costName-form="{}">
<costTypeComponents v-model="curdForm.costName" :module-param="moduleParam" @updateCostInfo="updateCostInfo"/>
</template>
</avue-crud>
<template #footer>
<el-button type="primary" @click="save" v-permission="pageCode + 'add'">保存</el-button>
<el-button @click="close">关闭</el-button>
</template>
</Dialog>
</template>
<script>
import { addMixin } from '@/mixin/addMixin.js'
import { cloneDeep } from 'lodash-es'
import costTypeComponents from '@/modules/costManagement/components/costTypeComponents.vue'
const MODULE_CODE = 'costManagement'
const ENTITY_TYPE = 'costTable'
export default {
name: ENTITY_TYPE + '-add',
mixins: [addMixin],
components: { costTypeComponents },
data() {
return {
entityType: ENTITY_TYPE,
moduleCode: MODULE_CODE,
// eslint-disable-next-line no-eval
api: eval('this.$api.' + MODULE_CODE + '.' + ENTITY_TYPE),
pageCode: MODULE_CODE + ':' + ENTITY_TYPE + ':',
entityData: {},
rules: {
//
projectName: [{ required: true, message: '【项目名称】不能为空', trigger: 'blur' }],
totalInvestment: [{ required: true, message: '【总投资】不能为空', trigger: 'blur' }]
},
tableData: [],
curdForm: {},
defaults: {},
parentId: undefined,
currentlevel: undefined,
currentRowData: {},
option: {
addBtn: false,
refreshBtn: false,
columnBtn: false,
gridBtn: false,
index: false,
rowKey: 'id',
rowParentKey: 'parentId',
menuWidth: 100,
column: {
orderNo: {
label: '序号',
display: false,
width: 200
},
isDetail: {
label: '是否明细',
type: 'radio',
button: true,
dicData: [
{
label: '是',
value: '1'
},
{
label: '否',
value: '0'
}
],
value: '0',
rules: [
{
required: true
}
],
hide: true
},
costType: {
label: '费用类型',
rules: [
{
required: true,
message: '请输入费用类型',
trigger: 'blur'
}
]
},
constructContent: {
label: '建设内容',
span: 24,
type: 'textarea',
rules: [
{
required: true,
message: '请输入建设内容',
trigger: 'blur'
}
]
},
costName: {
label: '费用名称',
rules: [
{
required: true,
message: '请输入费用名称',
trigger: 'blur'
}
]
},
costDescribe: {
label: '费用描述',
span: 24,
type: 'textarea',
rules: [
{
required: true,
message: '请输入费用描述',
trigger: 'blur'
}
]
},
//
unit: {
label: '单位',
rules: [
{
required: true,
message: '请输入单位',
trigger: 'blur'
}
]
},
quantity: {
label: '数量',
type: 'number',
min: 1,
precision: 0,
rules: [
{
required: true,
message: '请输入数量',
trigger: 'blur'
}
]
},
unitPrice: {
label: '单价',
type: 'number',
min: 0,
precision: 2,
rules: [
{
required: true,
message: '请输入单价',
trigger: 'blur'
}
]
},
totalPrice: {
label: '总价',
disabled: true,
rules: [
{
required: true,
message: '请输入总价',
trigger: 'blur'
}
]
},
remarks: {
label: '备注'
}
}
}
}
},
methods: {
beforeInit() {
this.tableData = []
},
//
addrow() {
this.currentlevel = this.tableData.length + 1
this.$refs.crudRef.rowAdd()
},
addUpdate(row, index, done, loading) {
console.log('addUpdate', row)
done(row)
this.updatePrice()
},
rowSave(row, done) {
row.costTableId = this.entityData.id
row.parentId = this.parentId
row.id = new Date().getTime()
row.orderNo = this.currentlevel
this.currentlevel = undefined
this.parentId = undefined
console.log('rowSave', row, this.data)
done(row)
this.updatePrice()
},
rowDelete(row, index, done) {
console.log('rowDelete', row)
done(row)
this.updatePrice()
},
//
addChild(row, index) {
//
if (row.children && row.children.length > 0) {
this.curdForm.isDetail = row.children[0].isDetail
} else {
this.curdForm.isDetail = '0'
}
this.parentId = row.id
this.currentlevel =
row.orderNo + '-' + (row.children == undefined ? 1 : row.children.length + 1)
this.$refs.crudRef.rowAdd()
},
calculateSubtotal(item) {
if (item.isDetail == '1') {
return item.totalPrice
}
let subtotal = 0
if (item.children && item.children.length > 0) {
subtotal += item.children.reduce((acc, child) => acc + this.calculateSubtotal(child), 0)
}
item.totalPrice = subtotal
if (item.children) {
for (let i = 0; i < item.children.length; i++) {
if (item.children[i].isDetail == '0') {
//
item.children[i].totalPrice = this.calculateSubtotal(item.children[i])
}
}
}
return subtotal
},
updatePrice() {
this.entityData.totalInvestment = 0
if (this.tableData.length > 0) {
this.tableData.forEach((item) => {
this.calculateSubtotal(item)
this.entityData.totalInvestment += item.totalPrice
console.log('calculateSubtotal', item, this.entityData)
})
}
},
save() {
this.$refs.form.validate((valid) => {
if (valid) {
this.entityData.costItemDetailList = this.tableData
this.api.addCostTable(this.entityData).then((response) => {
this.$emit('refresh')
this.close()
})
}
})
},
updateCostInfo(val){
this.curdForm.costDescribe = val.modelDescription
this.curdForm.unitPrice=val.productPrice
}
},
computed: {
updatedTotal() {
return this.curdForm.unitPrice * this.curdForm.quantity
}
},
watch: {
//
'curdForm.isDetail'(val) {
console.log('isDetail', val, this.curdForm, this.defaults)
if (val == '0') {
//
this.defaults.costName.display = false
this.defaults.costDescribe.display = false
this.defaults.unit.display = false
this.defaults.quantity.display = false
this.defaults.unitPrice.display = false
this.defaults.totalPrice.display = false
this.curdForm.costName = ''
this.curdForm.costDescribe = ''
this.curdForm.unit = ''
this.curdForm.quantity = ''
this.curdForm.unitPrice = ''
this.curdForm.totalPrice = ''
this.defaults.costType.display = true
this.defaults.constructContent.display = true
} else {
this.defaults.costType.display = false
this.defaults.constructContent.display = false
this.curdForm.costType = ''
this.curdForm.constructContent = ''
this.defaults.costName.display = true
this.defaults.costDescribe.display = true
this.defaults.unit.display = true
this.defaults.quantity.display = true
this.defaults.unitPrice.display = true
this.defaults.totalPrice.display = true
}
},
updatedTotal(val) {
if (val == 0) {
this.curdForm.totalPrice = '' //0
return
}
this.curdForm.totalPrice = val //updatedTotal
},
tableData: {
handler(val, oldVal) {
console.log('tableData', val, oldVal)
},
deep: true
}
}
}
</script>
<style></style>

194
src/modules/costManagement/view/costTable/index.vue

@ -0,0 +1,194 @@
<template>
<avue-crud
ref="crudRef"
:option="option"
:data="data"
v-model="formData"
v-model:page="page"
v-model:search="queryCondition"
@row-del="rowDel"
@refresh-change="onLoad"
@on-load="onLoad"
@search-change="searchChange"
@row-dblclick="rowDblclick"
>
<template #menu-left="{}">
<el-button
type="primary"
icon="el-icon-plus"
@click="rowSave()"
v-permission="pageCode + 'add'"
>新增</el-button
>
</template>
<template #menu="{ row, index }">
<el-button
type="primary"
text
icon="el-icon-edit"
@click="rowUpdate(row)"
v-permission="pageCode + 'modify'"
>编辑</el-button
>
<el-popconfirm
title="此操作将删除数据, 是否继续?"
confirm-button-text="删除"
cancel-button-text="取消"
icon="el-icon-delete"
icon-color="red"
@confirm="rowDel(row, index)"
>
<template #reference>
<el-button type="primary" text icon="el-icon-delete" v-permission="pageCode + 'remove'"
>删除</el-button
>
</template>
</el-popconfirm>
</template>
</avue-crud>
<AddPage ref="addPage" @refresh="onLoad" />
<ModifyPage ref="modifyPage" @refresh="onLoad" />
<ViewPage ref="viewPage" />
</template>
<script setup>
import { ref, getCurrentInstance, reactive } from 'vue'
import AddPage from './add.vue'
import ModifyPage from './modify.vue'
import ViewPage from './view.vue'
//this
let { proxy } = getCurrentInstance()
const option = ref(null)
const data = ref(null)
let moduleParam = reactive({
entityType: 'personProductModel',
pageType: 'addOrModify'
})
let formData = ref({})
let queryCondition = ref({})
let pageInfo = reactive({
//
pageNum: 1,
//
pageSize: 10
})
//
let sortInfo = reactive({
sort_field: 'id',
sort_sortType: 'descending'
})
let page = reactive({
total: 0,
currentPage: 1,
pageSize: 10
})
const MODULE_CODE = 'costManagement'
const ENTITY_TYPE = 'costTable'
const pageCode = `${MODULE_CODE}:${ENTITY_TYPE}:`
const api = eval('proxy.$api.' + MODULE_CODE + '.' + ENTITY_TYPE)
option.value = {
dialogWidth: '80%', //
searchMenuSpan: 6, //
addBtn: false, //
editBtn: false, //
delBtn: false, //
column: [
{
label: '项目名称',
labelWidth: 120,
prop: 'projectName',
search: true,
searchLabelWidth: 120
},
{
label: '造价日期',
labelWidth: 120,
prop: 'costDate',
type: 'date',
format: 'YYYY-MM-DD',
search: true,
searchLabelWidth: 120
},
{
label: '总投资',
labelWidth: 120,
prop: 'totalInvestment',
type: 'number',
precision: 2,
mim: 0,
searchLabelWidth: 120,
disabled: true
}
]
// group: [
// {
// label: '',
// prop: 'jbxx',
// icon: 'el-icon-edit-outline',
// column: [
// {
// label: '',
// labelWidth: 120,
// prop: 'projectName',
// search: true,
// searchLabelWidth: 120,
// },
// {
// label: '',
// labelWidth: 120,
// prop: 'totalInvestment',
// type: 'number',
// precision: 2,
// mim: 0,
// searchLabelWidth: 120,
// disabled: true,
// }
// ]
// },
// {
// label: '',
// prop: 'jbxx',
// icon: 'el-icon-edit-outline',
// column: [
// {
// label: '',
// prop: 'id'
// },
// ]
// }
// ]
}
data.value = []
function rowSave(row, done, loading) {
proxy.$refs.addPage.init()
}
function rowDel(row, index) {
api.remove(row.id)
onLoad()
}
function rowUpdate(row, index, done, loading) {
proxy.$refs.modifyPage.init(row.id)
}
function onLoad() {
pageInfo.pageNum = page.currentPage
const params = Object.assign(queryCondition.value, pageInfo, sortInfo)
api.page(params).then((res) => {
data.value = res.data.records
page.total = res.data.total
// res.data.total
})
}
function rowDblclick(row, index) {
proxy.$refs.viewPage.init(row.id)
}
function searchChange(val, done) {
onLoad()
done()
}
</script>
<style>
.el-input,
.el-input-number {
width: 100% !important;
}
</style>

376
src/modules/costManagement/view/costTable/modify.vue

@ -0,0 +1,376 @@
<template>
<Dialog title="修改" v-model="visible" width="80%">
<el-form
ref="form"
:model="entityData"
:rules="rules"
label-width="120px"
label-position="right"
style="width: 90%; margin: 0px auto"
>
<!--表单区域 -->
<el-form-item label="项目名称" prop="projectName">
<el-input v-model="entityData.projectName" />
</el-form-item>
<el-form-item label="总投资" prop="totalInvestment">
<el-input type="number" v-model="entityData.totalInvestment" disabled />
</el-form-item>
</el-form>
<!--表格区域-->
<avue-crud
ref="crudRef"
v-model="curdForm"
v-model:defaults="defaults"
:option="option"
:data="tableData"
@row-update="addUpdate"
@row-save="rowSave"
@row-del="rowDelete"
>
<template #orderNo="{ row }">
<el-tag type="success">{{ row.orderNo }}</el-tag>
</template>
<template #menu-left="{}">
<el-button
type="danger"
icon="el-icon-plus"
@click="addrow()"
v-permission="pageCode + 'add'"
>新增</el-button
>
</template>
<template #menu="{ row, index }">
<el-button text type="primary" @click="addChild(row, index)" v-if="row.isDetail == '0'"
>增加子项</el-button
>
</template>
<template #costName-form="{}">
<costTypeComponents v-model="curdForm.costName" :module-param="moduleParam" @updateCostInfo="updateCostInfo"/>
</template>
</avue-crud>
<template #footer>
<el-button type="primary" @click="save" v-permission="pageCode + 'add'">保存</el-button>
<el-button @click="close">关闭</el-button>
</template>
</Dialog>
</template>
<script>
import { Dialog } from '@/components/abc/Dialog'
import costTypeComponents from '@/modules/costManagement/components/costTypeComponents.vue'
const MODULE_CODE = 'costManagement'
const ENTITY_TYPE = 'costTable'
export default {
name: ENTITY_TYPE + '-modify',
components: { Dialog,costTypeComponents },
data() {
return {
entityType: ENTITY_TYPE,
moduleCode: MODULE_CODE,
// eslint-disable-next-line no-eval
api: eval('this.$api.' + MODULE_CODE + '.' + ENTITY_TYPE),
pageCode: MODULE_CODE + ':' + ENTITY_TYPE + ':',
entityData: {},
visible: false,
rules: {
//
projectName: [{ required: true, message: '【项目名称】不能为空', trigger: 'blur' }],
totalInvestment: [{ required: true, message: '【总投资】不能为空', trigger: 'blur' }]
},
tableData: [],
curdForm: {},
defaults: {},
parentId: undefined,
currentlevel: undefined,
currentRowData: {},
option: {
addBtn: false,
refreshBtn: false,
columnBtn: false,
gridBtn: false,
index: false,
rowKey: 'id',
rowParentKey: 'parentId',
menuWidth: 100,
column: {
orderNo: {
label: '序号',
display: false,
width:200
},
isDetail: {
label: '是否明细',
type: 'radio',
button: true,
dicData: [
{
label: '是',
value: '1'
},
{
label: '否',
value: '0'
}
],
value: '0',
rules: [
{
required: true
}
],
hide: true
},
costType: {
label: '费用类型',
rules: [
{
required: true,
message: '请输入费用类型',
trigger: 'blur'
}
]
},
constructContent: {
label: '建设内容',
span: 24,
type: 'textarea',
rules: [
{
required: true,
message: '请输入建设内容',
trigger: 'blur'
}
]
},
costName: {
label: '费用名称',
rules: [
{
required: true,
message: '请输入费用名称',
trigger: 'blur'
}
]
},
costDescribe: {
label: '费用描述',
span: 24,
type: 'textarea',
rules: [
{
required: true,
message: '请输入费用描述',
trigger: 'blur'
}
]
},
//
unit: {
label: '单位',
rules: [
{
required: true,
message: '请输入单位',
trigger: 'blur'
}
]
},
quantity: {
label: '数量',
type: 'number',
min: 1,
precision: 0,
rules: [
{
required: true,
message: '请输入数量',
trigger: 'blur'
}
]
},
unitPrice: {
label: '单价',
type: 'number',
min: 0,
precision: 2,
rules: [
{
required: true,
message: '请输入单价',
trigger: 'blur'
}
]
},
totalPrice: {
label: '总价',
disabled: true,
rules: [
{
required: true,
message: '请输入总价',
trigger: 'blur'
}
]
},
remarks: {
label: '备注'
}
}
}
}
},
methods: {
//
init(id) {
this.api.getCostTableDetail(id).then((res) => {
this.entityData = res.data
this.tableData = res.data.costItemDetailList
this.visible = true
})
},
//
addrow() {
this.currentlevel = this.tableData.length + 1
this.$refs.crudRef.rowAdd()
},
addUpdate(row, index, done, loading) {
console.log('addUpdate', row)
done(row)
this.updatePrice()
},
rowSave(row, done) {
row.costTableId = this.entityData.id
row.parentId = this.parentId
row.id = new Date().getTime()
row.orderNo = this.currentlevel
this.currentlevel = undefined
this.parentId = undefined
console.log('rowSave', row, this.data)
done(row)
this.updatePrice()
},
rowDelete(row, index, done) {
console.log('rowDelete', row)
done(row)
this.updatePrice()
},
//
addChild(row, index) {
//
if (row.children && row.children.length > 0) {
this.curdForm.isDetail = row.children[0].isDetail
} else {
this.curdForm.isDetail = '0'
}
this.parentId = row.id
this.currentlevel =
row.orderNo + '-' + (row.children == undefined ? 1 : row.children.length + 1)
this.$refs.crudRef.rowAdd()
},
calculateSubtotal(item) {
if (item.isDetail == '1') {
return item.totalPrice
}
let subtotal = 0
if (item.children && item.children.length > 0) {
subtotal += item.children.reduce((acc, child) => acc + this.calculateSubtotal(child), 0)
}
item.totalPrice = subtotal
if (item.children) {
for (let i = 0; i < item.children.length; i++) {
if (item.children[i].isDetail == '0') {
//
item.children[i].totalPrice = this.calculateSubtotal(item.children[i])
}
}
}
return subtotal
},
updatePrice() {
this.entityData.totalInvestment = 0
if (this.tableData.length > 0) {
this.tableData.forEach((item) => {
this.calculateSubtotal(item)
this.entityData.totalInvestment += item.totalPrice
console.log('calculateSubtotal', item, this.entityData)
})
}
},
save() {
this.$refs.form.validate((valid) => {
if (valid) {
this.entityData.costItemDetailList = this.tableData
this.api.modifyCostTable(this.entityData).then((response) => {
this.close()
})
}
})
},
updateCostInfo(val){
this.curdForm.costDescribe = val.modelDescription
this.curdForm.unitPrice=val.productPrice
},
close() {
this.visible = false
this.$emit('refresh')
}
},
computed: {
updatedTotal() {
return this.curdForm.unitPrice * this.curdForm.quantity
}
},
watch: {
//
'curdForm.isDetail'(val) {
console.log('isDetail', val, this.curdForm, this.defaults)
if (val == '0') {
//
this.defaults.costName.display = false
this.defaults.costDescribe.display = false
this.defaults.unit.display = false
this.defaults.quantity.display = false
this.defaults.unitPrice.display = false
this.defaults.totalPrice.display = false
this.curdForm.costName = ''
this.curdForm.costDescribe = ''
this.curdForm.unit = ''
this.curdForm.quantity = ''
this.curdForm.unitPrice = ''
this.curdForm.totalPrice = ''
this.defaults.costType.display = true
this.defaults.constructContent.display = true
} else {
this.defaults.costType.display = false
this.defaults.constructContent.display = false
this.curdForm.costType = ''
this.curdForm.constructContent = ''
this.defaults.costName.display = true
this.defaults.costDescribe.display = true
this.defaults.unit.display = true
this.defaults.quantity.display = true
this.defaults.unitPrice.display = true
this.defaults.totalPrice.display = true
}
},
updatedTotal(val) {
if (val == 0) {
this.curdForm.totalPrice = '' //0
return
}
this.curdForm.totalPrice = val //updatedTotal
},
tableData: {
handler(val, oldVal) {
console.log('tableData', val, oldVal)
},
deep: true
}
}
}
</script>
<style></style>

221
src/modules/costManagement/view/costTable/view.vue

@ -0,0 +1,221 @@
<template>
<Dialog title="查看" v-model="visible" width="80%">
<el-form
ref="form"
:model="entityData"
:rules="rules"
label-width="120px"
label-position="right"
style="width: 90%; margin: 0px auto"
>
<!--表单区域 -->
<el-form-item label="项目名称" prop="projectName">
<el-input v-model="entityData.projectName" disabled />
</el-form-item>
<el-form-item label="总投资" prop="totalInvestment">
<el-input type="number" v-model="entityData.totalInvestment" disabled />
</el-form-item>
</el-form>
<!--表格区域-->
<avue-crud ref="crudRef" :option="option" :data="tableData" >
<template #orderNo="{ row }">
<el-tag type="success">{{ row.orderNo }}</el-tag>
</template>
</avue-crud>
<template #footer>
<el-button @click="close">关闭</el-button>
</template>
</Dialog>
</template>
<script>
import { Dialog } from '@/components/abc/Dialog'
const MODULE_CODE = 'costManagement'
const ENTITY_TYPE = 'costTable'
export default {
name: ENTITY_TYPE + '-modify',
components: { Dialog },
data() {
return {
entityType: ENTITY_TYPE,
moduleCode: MODULE_CODE,
// eslint-disable-next-line no-eval
api: eval('this.$api.' + MODULE_CODE + '.' + ENTITY_TYPE),
pageCode: MODULE_CODE + ':' + ENTITY_TYPE + ':',
entityData: {},
visible: false,
tableData: [],
option: {
addBtn: false,
refreshBtn: false,
columnBtn: false,
gridBtn: false,
index: false,
menu: false,
rowKey: 'id',
rowParentKey: 'parentId',
menuWidth: 100,
column: {
orderNo: {
label: '序号',
display: false,
width: 200
},
isDetail: {
label: '是否明细',
type: 'radio',
button: true,
dicData: [
{
label: '是',
value: '1'
},
{
label: '否',
value: '0'
}
],
value: '0',
rules: [
{
required: true
}
],
hide: true
},
costType: {
label: '费用类型',
rules: [
{
required: true,
message: '请输入费用类型',
trigger: 'blur'
}
]
},
constructContent: {
label: '建设内容',
span: 24,
type: 'textarea',
rules: [
{
required: true,
message: '请输入建设内容',
trigger: 'blur'
}
]
},
costName: {
label: '费用名称',
rules: [
{
required: true,
message: '请输入费用名称',
trigger: 'blur'
}
]
},
costDescribe: {
label: '费用描述',
span: 24,
type: 'textarea',
rules: [
{
required: true,
message: '请输入费用描述',
trigger: 'blur'
}
]
},
//
unit: {
label: '单位',
rules: [
{
required: true,
message: '请输入单位',
trigger: 'blur'
}
]
},
quantity: {
label: '数量',
type: 'number',
min: 1,
precision: 0,
rules: [
{
required: true,
message: '请输入数量',
trigger: 'blur'
}
]
},
unitPrice: {
label: '单价',
type: 'number',
min: 0,
precision: 2,
rules: [
{
required: true,
message: '请输入单价',
trigger: 'blur'
}
]
},
totalPrice: {
label: '总价',
disabled: true,
rules: [
{
required: true,
message: '请输入总价',
trigger: 'blur'
}
]
},
remarks: {
label: '备注'
}
}
}
}
},
methods: {
//
init(id) {
this.api.getCostTableDetail(id).then((res) => {
this.entityData = res.data
this.tableData = res.data.costItemDetailList
this.visible = true
})
},
close() {
this.visible = false
this.$emit('refresh')
},
spanMethod({ row, column, rowIndex, columnIndex }) {
console.log("row, column, rowIndex, columnIndex",row, column, rowIndex, columnIndex)
if (columnIndex === 0) {
if (rowIndex % 2 === 0) {
return {
rowspan: 2,
colspan: 1
}
} else {
return {
rowspan: 0,
colspan: 0
}
}
}
}
}
}
</script>
<style></style>

132
src/modules/costMode/components/supplierInformationComponents.vue

@ -1,132 +0,0 @@
<template>
<div class="w-full">
<el-input v-model="displayName" disabled style="width: 152px" />
<el-button-group>
<el-button icon="grid" @click="init" style="border-left-width: 0; padding: 10px" />
<el-button icon="delete" @click="clear" style="border-left-width: 0; padding: 10px" />
</el-button-group>
<Dialog title="模块选择" v-model="visible" class="w-150">
<CollapseTab>
<el-form :inline="true" :model="queryCondition" label-width="80px" @keyup.enter="query">
<!--查询条件区 -->
<el-form-item label="应用">
<dictionary-select v-model="queryCondition.app" code="AppCode" />
</el-form-item>
<el-form-item label="名称">
<QueryText v-model="queryCondition.name" type="LK" />
</el-form-item>
<el-form-item label="编码">
<QueryText v-model="queryCondition.code" type="LK" />
</el-form-item>
<el-form-item style="float: right">
<QueryButton :page-code="pageCode" />
</el-form-item>
<div class="clearfix"></div>
</el-form>
</CollapseTab>
<el-card style="width: 100%">
<div style="float: right; margin-top: 0; margin-bottom: 10px">
<ColumnsController :value="columnList" :tableKey="tableKey" />
</div>
<el-table
v-loading="loading"
:data="tableData"
style="width: 100%"
highlight-current-row
border
@sort-change="sortChange"
@current-change="rowChange"
>
<el-table-column
v-for="(item, index) in showCols"
:key="index"
:label="item.label"
:prop="item.prop"
:show-overflow-tooltip="item.showOverflowTooltip"
:width="item.width"
:formatter="item.formatFunc"
:sortable="item.sortable"
/>
</el-table>
<ListPager
:page-num="pageInfo.pageNum"
:page-size="pageInfo.pageSize"
:page-total="pageTotal"
/>
</el-card>
<template #footer>
<el-button type="primary" @click="confirm">确定</el-button>
<el-button @click="close">关闭</el-button>
</template>
</Dialog>
</div>
</template>
<script>
import { referenceMixin } from '@/mixin/referenceMixin.js'
const MODULE_CODE = 'productManagement'
const ENTITY_TYPE = 'supplierInformation'
export default {
name: ENTITY_TYPE + '-reference',
components: {},
mixins: [referenceMixin],
props: {
moduleParam: {
type: Object,
required: false
}
},
data() {
return {
entityType: ENTITY_TYPE,
moduleCode: MODULE_CODE,
// eslint-disable-next-line no-eval
api: eval('this.$api.' + MODULE_CODE + '.' + ENTITY_TYPE),
pageCode: MODULE_CODE + ':' + ENTITY_TYPE + ':',
sortInfo: {
sort_field: 'id',
sort_sortType: 'descending'
},
columnList: [
{
prop: 'supplierName',
label: '供应商名称',
show: true,
showOverflowTooltip: true,
sortable: true
},
{
prop: 'supplierContacts',
label: '供应商联系人',
show: true,
showOverflowTooltip: true,
sortable: true
},
{
prop: 'supplierContactsPhone',
label: '供应商联系电话',
show: true,
showOverflowTooltip: true,
sortable: true
},
{
prop: 'supplierType',
label: '供应商类型',
show: true,
showOverflowTooltip: true,
sortable: true
}
],
queryCondition: {
//
app: ''
},
//
nameKey: 'supplierName'
}
},
methods: {}
}
</script>
<style></style>

2
src/views/Login/components/LoginForm.vue

@ -56,7 +56,7 @@ const schema = reactive<FormSchema[]>([
{
field: 'password',
label: t('login.password'),
value: '12345678',
value: 'Admin123',
component: 'InputPassword',
colProps: {
span: 24

Loading…
Cancel
Save