This commit is contained in:
xiao-fajia 2024-09-13 18:31:24 +08:00
commit 81f23067b0
3 changed files with 75 additions and 17 deletions

View File

@ -196,6 +196,8 @@ export const DICT_TYPE = {
REPAIR_SO_STATUS: 'repair_so_status', REPAIR_SO_STATUS: 'repair_so_status',
// 维修旧件处理方式 // 维修旧件处理方式
REPAIR_PART_DISPOSAL: 'repair_part_disposal', REPAIR_PART_DISPOSAL: 'repair_part_disposal',
//单位
REPAIR_UNIT: 'repair_unit',
} }
/** /**

View File

@ -19,12 +19,12 @@
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="12"> <el-col :span="12">
<el-form-item label="成本" prop="cost"> <el-form-item label="成本" prop="cost">
<el-input v-model="formData.cost" placeholder="请输入成本"/> <el-input-number v-model="formData.cost" :precision="2" :step="0.1" :max="10"></el-input-number>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="售价" prop="price"> <el-form-item label="售价" prop="price">
<el-input v-model="formData.price" placeholder="请输入售价"/> <el-input-number v-model="formData.price" :precision="2" :step="0.1" :max="10"></el-input-number>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -37,7 +37,10 @@
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="单位" prop="unit"> <el-form-item label="单位" prop="unit">
<el-input v-model="formData.unit" placeholder="请输入单位"/> <el-select v-model="formData.unit" placeholder="请选择单位">
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.REPAIR_UNIT)"
:key="dict.value" :label="dict.label" :value="dict.value"/>
</el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -45,9 +48,12 @@
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="12"> <el-col :span="12">
<el-form-item label="分类" prop="type"> <el-form-item label="分类" prop="type">
<el-select v-model="formData.type" placeholder="请选择分类"> <TreeSelect
<el-option label="请选择字典生成" value=""/> v-model="formData.type"
</el-select> :options="baseTypeTree"
:normalizer="normalizer"
placeholder="请选择分类"
/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
@ -60,12 +66,24 @@
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="12"> <el-col :span="12">
<el-form-item label="是否自助" prop="isSelf"> <el-form-item label="是否自助" prop="isSelf">
<el-input v-model="formData.isSelf" placeholder="请输入是否自助"/> <el-switch
v-model="formData.isSelf"
active-color="#13ce66"
inactive-color="#ff4949"
active-value="1"
inactive-value="0">
</el-switch>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="分店公用" prop="isPublic"> <el-form-item label="分店公用" prop="isPublic">
<el-input v-model="formData.isPublic" placeholder="请输入是否允许分店公用此产品"/> <el-switch
v-model="formData.isPublic"
active-color="#13ce66"
inactive-color="#ff4949"
active-value="1"
inactive-value="0">
</el-switch>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
@ -85,10 +103,12 @@
<script> <script>
import * as RepairProjectApi from '@/api/repair/project'; import * as RepairProjectApi from '@/api/repair/project';
import * as BaseTypeApi from '@/api/base/type';
import TreeSelect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
export default { export default {
name: "RepairProjectForm", name: "RepairProjectForm",
components: {}, components: {TreeSelect},
data() { data() {
return { return {
// //
@ -109,13 +129,19 @@ export default {
type: undefined, type: undefined,
manHour: undefined, manHour: undefined,
isSelf: undefined, isSelf: undefined,
isPublic: undefined, isPublic: '0',
remark: undefined, remark: '0',
corpId:'', corpId:'',
corpIds:[], corpIds:[],
}, },
// //
formRules: {}, formRules: {
// name: [{required: true, message: '', trigger: 'blur'}],
// code: [{required: true, message: '', trigger: 'blur'}],
// type: [{required: true, message: '', trigger: 'blur'}],
// unit: [{required: true, message: '', trigger: 'blur'}],
},
baseTypeTree:[],
}; };
}, },
methods: { methods: {
@ -135,7 +161,33 @@ export default {
} }
} }
this.title = "新增维修项目"; this.title = "新增维修项目";
//
await this.getBaseTypeTree();
}, },
/** 获得配置类型树 */
async getBaseTypeTree() {
this.baseTypeTree = [];
let param = {
type:'02'
}
const res = await BaseTypeApi.getBaseTypeList(param);
const root = {id: 0, name: '顶级配置类型', children: []};
root.children = this.handleTree(res.data, 'id', 'parentId',"children","0")
this.baseTypeTree.push(root)
},
/** 转换配置类型数据结构 */
normalizer(node) {
if (node.children && !node.children.length) {
delete node.children;
}
return {
id: node.id,
label: node.name,
children: node.children
};
},
/** 提交按钮 */ /** 提交按钮 */
async submitForm() { async submitForm() {
// //
@ -173,8 +225,8 @@ export default {
type: undefined, type: undefined,
manHour: undefined, manHour: undefined,
isSelf: undefined, isSelf: undefined,
isPublic: undefined, isPublic: '0',
remark: undefined, remark: '0',
corpId:'', corpId:'',
corpIds:[], corpIds:[],
}; };

View File

@ -39,8 +39,12 @@
<el-table-column label="规格" align="center" prop="spec"/> <el-table-column label="规格" align="center" prop="spec"/>
<el-table-column label="售价" align="center" prop="price"/> <el-table-column label="售价" align="center" prop="price"/>
<el-table-column label="编码" align="center" prop="code"/> <el-table-column label="编码" align="center" prop="code"/>
<el-table-column label="单位" align="center" prop="unit"/> <el-table-column label="单位" align="center" prop="unit">
<el-table-column label="分类" align="center" prop="type"/> <template v-slot="scope">
<dict-tag :type="DICT_TYPE.REPAIR_UNIT" :value="scope.row.unit" />
</template>
</el-table-column>
<el-table-column label="分类" align="center" prop="typeName"/>
<el-table-column label="工时" align="center" prop="manHour"/> <el-table-column label="工时" align="center" prop="manHour"/>
<el-table-column label="备注" align="center" prop="remark"/> <el-table-column label="备注" align="center" prop="remark"/>
<el-table-column label="创建时间" align="center" prop="createTime" width="180"> <el-table-column label="创建时间" align="center" prop="createTime" width="180">