更新自贡
This commit is contained in:
159
src/views/cost/deep/costDeepOthercostRule/add-or-updata.vue
Normal file
159
src/views/cost/deep/costDeepOthercostRule/add-or-updata.vue
Normal file
@@ -0,0 +1,159 @@
|
||||
<!--
|
||||
* @Author: zwq
|
||||
* @Date: 2023-08-01 13:52:10
|
||||
* @LastEditors: zwq
|
||||
* @LastEditTime: 2024-04-22 14:56:17
|
||||
* @Description:
|
||||
-->
|
||||
<template>
|
||||
<el-form
|
||||
:model="dataForm"
|
||||
:rules="dataRule"
|
||||
ref="dataForm"
|
||||
v-if="visible"
|
||||
@keyup.enter.native="dataFormSubmit()"
|
||||
label-width="100px"
|
||||
label-position="top">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="成本名称" prop="label">
|
||||
<el-input v-model="dataForm.label" clearable readonly />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="自动计算策略" prop="type">
|
||||
<el-radio-group v-model="dataForm.type" @input="setType">
|
||||
<el-radio :label="1">每天等价</el-radio>
|
||||
<el-radio :label="2">折旧</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" v-if="dataForm.type === 1" key="one">
|
||||
<el-form-item label="价格" prop="price">
|
||||
<el-input-number
|
||||
:min="0"
|
||||
style="width: 80%"
|
||||
v-model="dataForm.price"
|
||||
clearable />
|
||||
(元)
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" v-if="dataForm.type === 2" key="two">
|
||||
<el-form-item label="总价" prop="price">
|
||||
<el-input-number
|
||||
:min="0"
|
||||
style="width: 80%"
|
||||
v-model="dataForm.price"
|
||||
clearable />
|
||||
(元)
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" v-if="dataForm.type === 2" key="three">
|
||||
<el-form-item label="折旧率" prop="ratio">
|
||||
<el-input-number
|
||||
:min="0"
|
||||
style="width: 80%"
|
||||
v-model="dataForm.ratio"
|
||||
clearable />
|
||||
(%)
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" v-if="dataForm.type === 2" key="four">
|
||||
<el-form-item label="折旧年限" prop="timeLimit">
|
||||
<el-input-number
|
||||
:min="0"
|
||||
style="width: 80%"
|
||||
v-model="dataForm.timeLimit"
|
||||
clearable />
|
||||
(年)
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input
|
||||
@input="$forceUpdate()"
|
||||
v-model="dataForm.remark"
|
||||
clearable
|
||||
placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
updateRawOthercostRule,
|
||||
getRawOthercostRule,
|
||||
} from '@/api/cost/deepOthercostRule';
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
urlOptions: {
|
||||
updateURL: updateRawOthercostRule,
|
||||
infoURL: getRawOthercostRule,
|
||||
},
|
||||
dataForm: {
|
||||
label: undefined,
|
||||
type: 1,
|
||||
price: 0,
|
||||
ratio: 0,
|
||||
timeLimit: 1,
|
||||
remark: '',
|
||||
},
|
||||
visible: false,
|
||||
dataRule: {
|
||||
price: [{ required: true, message: '价格不能为空', trigger: 'blur' }],
|
||||
ratio: [{ required: true, message: '折旧率不能为空', trigger: 'blur' }],
|
||||
timeLimit: [
|
||||
{ required: true, message: '折旧年限不能为空', trigger: 'blur' },
|
||||
],
|
||||
},
|
||||
};
|
||||
},
|
||||
created() {},
|
||||
methods: {
|
||||
init(val) {
|
||||
this.dataForm = {
|
||||
label: undefined,
|
||||
type: 1,
|
||||
price: 0,
|
||||
ratio: 0,
|
||||
timeLimit: 1,
|
||||
remark: '',
|
||||
};
|
||||
this.visible = true;
|
||||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].resetFields();
|
||||
this.dataForm = JSON.parse(JSON.stringify(val));
|
||||
});
|
||||
},
|
||||
setType(val) {
|
||||
if (val === 1) {
|
||||
} else {
|
||||
}
|
||||
},
|
||||
// 表单提交
|
||||
dataFormSubmit() {
|
||||
this.$refs['dataForm'].validate((valid) => {
|
||||
if (!valid) {
|
||||
return false;
|
||||
}
|
||||
// 修改的提交
|
||||
this.urlOptions.updateURL(this.dataForm).then((response) => {
|
||||
this.$modal.msgSuccess('修改成功');
|
||||
this.visible = false;
|
||||
this.$emit('refreshDataList');
|
||||
});
|
||||
});
|
||||
},
|
||||
/** 清空form */
|
||||
formClear() {
|
||||
if (this.$refs.dataForm !== undefined) {
|
||||
this.$refs.dataForm.resetFields();
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
109
src/views/cost/deep/costDeepOthercostRule/index.vue
Normal file
109
src/views/cost/deep/costDeepOthercostRule/index.vue
Normal file
@@ -0,0 +1,109 @@
|
||||
<!--
|
||||
* @Author: zwq
|
||||
* @Date: 2024-04-15 16:52:38
|
||||
* @LastEditors: zwq
|
||||
* @LastEditTime: 2024-04-22 16:46:26
|
||||
* @Description:
|
||||
-->
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<!-- 列表 -->
|
||||
<base-table
|
||||
v-loading="dataListLoading"
|
||||
:table-props="tableProps"
|
||||
:page="listQuery.pageNo"
|
||||
:limit="listQuery.pageSize"
|
||||
:max-height="tableH"
|
||||
:table-data="tableData">
|
||||
<method-btn
|
||||
v-if="tableBtn.length"
|
||||
slot="handleBtn"
|
||||
:width="80"
|
||||
label="操作"
|
||||
:method-list="tableBtn"
|
||||
@clickBtn="handleClick" />
|
||||
</base-table>
|
||||
<pagination
|
||||
:limit.sync="listQuery.pageSize"
|
||||
:page.sync="listQuery.pageNo"
|
||||
:total="listQuery.total"
|
||||
@pagination="getDataList" />
|
||||
|
||||
<!-- 对话框(添加 / 修改) -->
|
||||
<base-dialog
|
||||
:dialogTitle="addOrEditTitle"
|
||||
:dialogVisible="addOrUpdateVisible"
|
||||
@cancel="handleCancel"
|
||||
@confirm="handleConfirm"
|
||||
:before-close="handleCancel"
|
||||
width="40%">
|
||||
<add-or-update
|
||||
ref="addOrUpdate"
|
||||
@refreshDataList="successSubmit"></add-or-update>
|
||||
</base-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import AddOrUpdate from './add-or-updata';
|
||||
import basicPage from '@/mixins/basic-page';
|
||||
import typeRule from './typeRule';
|
||||
import {
|
||||
getRawOthercostRulePage,
|
||||
} from '@/api/cost/deepOthercostRule';
|
||||
import tableHeightMixin from '@/mixins/lb/tableHeightMixin';
|
||||
|
||||
const tableProps = [
|
||||
{
|
||||
prop: 'label',
|
||||
label: '成本名称',
|
||||
},
|
||||
{
|
||||
prop: 'type',
|
||||
label: '自动计算方式',
|
||||
subcomponent: typeRule,
|
||||
},
|
||||
{
|
||||
prop: 'remark',
|
||||
label: '备注',
|
||||
},
|
||||
];
|
||||
|
||||
export default {
|
||||
mixins: [basicPage,tableHeightMixin],
|
||||
data() {
|
||||
return {
|
||||
urlOptions: {
|
||||
getDataListURL: getRawOthercostRulePage,
|
||||
},
|
||||
tableProps,
|
||||
tableBtn: [
|
||||
this.$auth.hasPermi(`monitoring:cost-deep-othercost-rule:update`)
|
||||
? {
|
||||
type: 'edit',
|
||||
btnName: '编辑',
|
||||
}
|
||||
: undefined,
|
||||
].filter((v) => v),
|
||||
tableData: [],
|
||||
};
|
||||
},
|
||||
components: {
|
||||
AddOrUpdate,
|
||||
},
|
||||
created() {
|
||||
},
|
||||
methods: {
|
||||
//tableBtn点击
|
||||
handleClick(val) {
|
||||
if (val.type === "edit") {
|
||||
this.addOrUpdateVisible = true;
|
||||
this.addOrEditTitle = "编辑";
|
||||
this.$nextTick(() => {
|
||||
this.$refs.addOrUpdate.init(val.data);
|
||||
});
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
31
src/views/cost/deep/costDeepOthercostRule/typeRule.vue
Normal file
31
src/views/cost/deep/costDeepOthercostRule/typeRule.vue
Normal file
@@ -0,0 +1,31 @@
|
||||
<!--
|
||||
* @Author: zwq
|
||||
* @Date: 2023-12-05 13:45:59
|
||||
* @LastEditors: zwq
|
||||
* @LastEditTime: 2024-04-15 17:12:03
|
||||
* @Description
|
||||
-->
|
||||
<template>
|
||||
<div>
|
||||
<span>
|
||||
{{
|
||||
injectData.type == 1
|
||||
? `每天等价,${injectData.price}元`
|
||||
: injectData.type == 2
|
||||
? `总价${injectData.price}元,年折旧率${injectData.ratio}%,折旧年限${injectData.timeLimit}年`
|
||||
: '-'
|
||||
}}
|
||||
</span>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
name: '',
|
||||
props: {
|
||||
injectData: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
Reference in New Issue
Block a user