修改物料信息功能
This commit is contained in:
parent
b1d6bf3b7b
commit
45a0a86b2f
|
@ -59,56 +59,59 @@
|
|||
</div>
|
||||
<div>
|
||||
<div style="width:300px;float: left;">
|
||||
<div style="with: 100%;display: flex;">
|
||||
<div class="all-card">
|
||||
<div v-for="(item, index) in treeData" :key="index" style="position: relative;">
|
||||
<div :class="clickCount === index ? 'card-target' : 'card'" :style="getCardStyle(index,treeData.length)" @click="handleClick(index,item)">
|
||||
<img src="/src/assets/images/logo.png" width="30" height="30" />
|
||||
<span style="margin-top: 8px;">{{ item.title }}</span>
|
||||
<div style="background: white; border-radius: 8px;padding: 8px;margin-right: 8px;min-height: 400px;">
|
||||
<div style="width:100%;text-align: right;" v-if="treeData.length == 0">
|
||||
<a-button type="primary" v-auth="'ConfigMaterial:config_material_category:add'" @click="handleAddbj({levle:'1'})" preIcon="ant-design:plus-outlined"> 一级分类</a-button>
|
||||
</div>
|
||||
<a-tree class="draggable-tree" draggable block-node :tree-data="treeData" >
|
||||
<template #title="{ data,title }">
|
||||
<div @mouseenter="data.showContent = true" @mouseleave="data.showContent = false">
|
||||
<span @click="handleSearch(data)">{{title}}</span>
|
||||
<span v-if="data?.izEnabled == '1'" style="color:red;">(已停用)</span>
|
||||
<span v-show="data.showContent" style="margin-left: 5px;">
|
||||
<!-- 下拉菜单 -->
|
||||
<a-dropdown>
|
||||
<a class="ant-dropdown-link" @click.prevent>
|
||||
<Icon icon="ant-design:setting-outlined" />
|
||||
</a>
|
||||
<template #overlay>
|
||||
<a-menu>
|
||||
<a-menu-item v-if="data.levle == '1'">
|
||||
<a href="javascript:;" @click="handleAddbj(data)">添加本级</a>
|
||||
</a-menu-item>
|
||||
<a-menu-item v-if="data.levle == '1' || data.levle == '2'">
|
||||
<a href="javascript:;" @click="handleAddxj(data)">添加下级</a>
|
||||
</a-menu-item>
|
||||
<a-menu-item>
|
||||
<a href="javascript:;" @click="handleAdd(data)">添加物料</a>
|
||||
</a-menu-item>
|
||||
<a-menu-item>
|
||||
<a href="javascript:;" @click="handleFenleiEdit(data)">编辑</a>
|
||||
</a-menu-item>
|
||||
<a-menu-item v-if="data.izEnabled == '1'">
|
||||
<a href="javascript:;" @click="handleQyty(data,'0')">启用</a>
|
||||
</a-menu-item>
|
||||
<a-menu-item v-if="data.izEnabled == '0'">
|
||||
<a href="javascript:;" @click="handleQyty(data,'1')">停用</a>
|
||||
</a-menu-item>
|
||||
</a-menu>
|
||||
</template>
|
||||
</a-dropdown>
|
||||
</span>
|
||||
</div>
|
||||
<div v-show="clickCount === index && index !== 4" class="sanjiao-down"></div>
|
||||
<div v-show="clickCount === index && index" class="sanjiao-up"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div style="background: #fff;border-radius: 0px 5px 5px 5px ;width: calc(100% - 80px);">
|
||||
<a-menu
|
||||
v-model:openKeys="openKeys"
|
||||
v-model:selectedKeys="selectedKeys"
|
||||
style="height:700px;overflow-y:auto;overflow-x: hidden;"
|
||||
mode="inline"
|
||||
>
|
||||
<template v-for="(item2,key2) in treeChildData" >
|
||||
<a-sub-menu v-if="item2.children.length>0" :key="`sub`+key2" style="margin:20px;background-image: url('../resource/img/bj.png');text-align:center;border-radius:5px;">
|
||||
<template #title>
|
||||
<div style="height:50px;line-height:50px;">
|
||||
<span><img src="/src/assets/images/logo.png" width="30" height="30" /></span><span style="margin-left: 10px;">{{item2.title}}</span>
|
||||
</div>
|
||||
</template>
|
||||
<a-menu-item v-for="(item3,key3) in item2.children" :key="key3" style="height:50px;text-align:left;" >
|
||||
<div @click="onSelect(item3)">
|
||||
<span style="font-size: 18px;">·</span> <span style="margin-left: 10px;">{{item3.title}}</span>
|
||||
</div>
|
||||
</a-menu-item>
|
||||
</a-sub-menu>
|
||||
<a-menu-item v-if="item2.children.length==0" :key="`sub`+key2" style="margin:20px;background-image: url('../resource/img/bj.png');text-align:center;border-radius:5px;width:85%;height:50px;line-height:50px;">
|
||||
<div @click="onSelect(item2)">
|
||||
<span><img src="/src/assets/images/logo.png" width="30" height="30"/></span><span style="margin-left: 10px;">{{item2.title}}</span>
|
||||
</div>
|
||||
</a-menu-item>
|
||||
</template>
|
||||
</a-menu>
|
||||
</div>
|
||||
</template>
|
||||
</a-tree>
|
||||
</div>
|
||||
</div>
|
||||
<div style="width:calc(100% - 320px);float: left;margin-left: 20px;">
|
||||
<div style="width:calc(100% - 300px);float: left;padding-left:10px;">
|
||||
<!--引用表格-->
|
||||
<BasicTable @register="registerTable" >
|
||||
<!--插槽:table标题-->
|
||||
<template #tableTitle>
|
||||
<!-- <template #tableTitle>
|
||||
<a-button type="primary" v-auth="'configMaterialInfo:config_material_info:add'" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button>
|
||||
<a-button type="primary" v-auth="'configMaterialInfo:config_material_info:exportXls'" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button>
|
||||
<j-upload-button type="primary" v-auth="'configMaterialInfo:config_material_info:importExcel'" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button>
|
||||
</template>
|
||||
</template> -->
|
||||
<!--操作栏-->
|
||||
<template #action="{ record }">
|
||||
<TableAction :actions="getTableAction(record)" />
|
||||
|
@ -125,6 +128,11 @@
|
|||
|
||||
<!-- 表单区域 -->
|
||||
<ConfigMaterialInfoModal ref="registerModal" @success="handleSuccess"></ConfigMaterialInfoModal>
|
||||
|
||||
|
||||
<ConfigMaterialCategoryModal ref="registerDrawer" @success="handleSuccess"></ConfigMaterialCategoryModal>
|
||||
<ConfigMaterialTypeModal ref="registerTypeDrawer" @success="handleSuccess"></ConfigMaterialTypeModal>
|
||||
<ConfigMaterialMedicationModal ref="registerMedicationDrawer" @success="handleSuccess"></ConfigMaterialMedicationModal>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
@ -143,8 +151,12 @@
|
|||
import { JInput } from '/@/components/Form';
|
||||
import type { TreeProps } from 'ant-design-vue';
|
||||
import { DownOutlined } from '@ant-design/icons-vue';
|
||||
import { defHttp } from '/@/utils/http/axios';
|
||||
import type { CollapseProps } from 'ant-design-vue';
|
||||
import { defHttp } from '/@/utils/http/axios';
|
||||
import type { CollapseProps } from 'ant-design-vue';
|
||||
|
||||
import ConfigMaterialCategoryModal from '/@/views/invoicing/ConfigMaterial/components/ConfigMaterialCategoryModal.vue';
|
||||
import ConfigMaterialTypeModal from '/@/views/invoicing/ConfigMaterial/components/ConfigMaterialTypeModal.vue';
|
||||
import ConfigMaterialMedicationModal from '/@/views/invoicing/ConfigMaterial/components/ConfigMaterialMedicationModal.vue';
|
||||
|
||||
const formRef = ref();
|
||||
const queryParam = reactive<any>({});
|
||||
|
@ -159,6 +171,12 @@ import type { CollapseProps } from 'ant-design-vue';
|
|||
const openKeys= []
|
||||
const selectedKeys= []
|
||||
const clickCount = ref(0);
|
||||
|
||||
|
||||
const registerDrawer = ref();
|
||||
const registerTypeDrawer = ref();
|
||||
const registerMedicationDrawer = ref();
|
||||
|
||||
/**
|
||||
* 点击菜单
|
||||
* @param index 菜单索引
|
||||
|
@ -189,12 +207,12 @@ const getCardStyle = (index,allSize) => {
|
|||
//注册table数据
|
||||
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
|
||||
tableProps: {
|
||||
title: '物料信息',
|
||||
api: list,
|
||||
columns,
|
||||
canResize:false,
|
||||
useSearchForm: false,
|
||||
showIndexColumn: true,
|
||||
showIndexColumn: true,
|
||||
showTableSetting: false,
|
||||
actionColumn: {
|
||||
width: 160,
|
||||
fixed: 'right',
|
||||
|
@ -254,9 +272,24 @@ const getCardStyle = (index,allSize) => {
|
|||
/**
|
||||
* 新增事件
|
||||
*/
|
||||
function handleAdd() {
|
||||
function handleAdd(data) {
|
||||
const record = {categoryId:'',typeId:'',medicationId:''}
|
||||
var levle = parseInt(data.levle)
|
||||
if(levle == 1){
|
||||
record.categoryId = data.key
|
||||
record.typeId = ''
|
||||
record.medicationId = ''
|
||||
}else if(levle == 2){
|
||||
record.categoryId = data.categoryId
|
||||
record.typeId = data.key
|
||||
record.medicationId = ''
|
||||
}else if(levle == 3){
|
||||
record.categoryId = data.categoryId
|
||||
record.typeId = data.typeId
|
||||
record.medicationId = data.key
|
||||
}
|
||||
registerModal.value.disableSubmit = false;
|
||||
registerModal.value.add();
|
||||
registerModal.value.add(record);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -293,7 +326,8 @@ const getCardStyle = (index,allSize) => {
|
|||
* 成功回调
|
||||
*/
|
||||
function handleSuccess() {
|
||||
(selectedRowKeys.value = []) && reload();
|
||||
getTreeData();
|
||||
searchQuery();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -321,6 +355,89 @@ const getCardStyle = (index,allSize) => {
|
|||
];
|
||||
}
|
||||
|
||||
//点击树节点查询右侧列表数据
|
||||
function handleSearch(data){
|
||||
var levle = parseInt(data.levle)
|
||||
if(levle == 1){
|
||||
queryParam.categoryId = data.key
|
||||
queryParam.typeId = ''
|
||||
queryParam.medicationId = ''
|
||||
}else if(levle == 2){
|
||||
queryParam.categoryId = data.categoryId
|
||||
queryParam.typeId = data.key
|
||||
queryParam.medicationId = ''
|
||||
}else if(levle == 3){
|
||||
queryParam.categoryId = data.categoryId
|
||||
queryParam.typeId = data.typeId
|
||||
queryParam.medicationId = data.key
|
||||
}
|
||||
reload();
|
||||
}
|
||||
//添加本级(只添加一级分类)
|
||||
function handleAddbj(data){
|
||||
// var params = {id:data.key,level:1,title:data.title}
|
||||
var params = {}
|
||||
registerDrawer.value.disableSubmit = false;
|
||||
registerDrawer.value.edit(params);
|
||||
}
|
||||
//添加下级
|
||||
function handleAddxj(data){
|
||||
var levle = parseInt(data.levle)+1;
|
||||
var params = {levle,categoryId:data.categoryId,typeId:data.typeId}
|
||||
if(data.levle == 1){
|
||||
registerTypeDrawer.value.disableSubmit = false;
|
||||
registerTypeDrawer.value.edit(params);
|
||||
}else if(data.levle == 2){
|
||||
registerMedicationDrawer.value.disableSubmit = false;
|
||||
registerMedicationDrawer.value.edit(params);
|
||||
}
|
||||
}
|
||||
//编辑
|
||||
function handleFenleiEdit(data){
|
||||
console.log("🚀 ~ handleEdit ~ data:", data)
|
||||
const params = {id:data.key,categoryId:data.categoryId,typeId:data.typeId,}
|
||||
if(data.levle == 1){
|
||||
params.categoryName = data.title
|
||||
registerDrawer.value.disableSubmit = false;
|
||||
registerDrawer.value.edit(params);
|
||||
}else if(data.levle == 2){
|
||||
params.typeName = data.title
|
||||
console.log("🚀 ~ handleEdit ~ params:", params)
|
||||
registerTypeDrawer.value.disableSubmit = false;
|
||||
registerTypeDrawer.value.edit(params);
|
||||
}else if(data.levle == 3){
|
||||
params.medicationName = data.title
|
||||
console.log("🚀 ~ handleEdit ~ params:", params)
|
||||
registerMedicationDrawer.value.disableSubmit = false;
|
||||
registerMedicationDrawer.value.edit(params);
|
||||
}
|
||||
}
|
||||
//启用停用
|
||||
function handleQyty(data,type){
|
||||
console.log("🚀 ~ handleQyty ~ data:", data)
|
||||
var levle = data.levle;
|
||||
var params = {id:data.key,izEnabled:type}
|
||||
var url = "";
|
||||
//一级分类
|
||||
if(levle == 1){
|
||||
url = "/invoicing/configMaterialCategory/edit";
|
||||
//二级分类
|
||||
}else if(levle == 2){
|
||||
url = "/invoicing/configMaterialType/edit";
|
||||
//三级分类
|
||||
}else if(levle == 3){
|
||||
url = "/invoicing/configMaterialMedication/edit";
|
||||
}else{
|
||||
return;
|
||||
}
|
||||
defHttp.post({url:url,params}).then(res =>{
|
||||
console.log("🚀 ~ defHttp.post ~ res:", res)
|
||||
reload();
|
||||
getTreeData();
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询
|
||||
|
@ -340,18 +457,20 @@ const getCardStyle = (index,allSize) => {
|
|||
reload();
|
||||
}
|
||||
|
||||
function getTreeData(){
|
||||
defHttp.get({url:'/invoicing/configMaterialCategory/getMaterialTreeData'}).then(res =>{
|
||||
treeData.value = res;
|
||||
// console.log("🚀 ~ defHttp.get ~ treeData:", treeData)
|
||||
// console.log("🚀 ~ defHttp.get ~ res:", res)
|
||||
// if(treeData.value.length > 0){
|
||||
// treeChildData.value = treeData.value[0].children;
|
||||
// }
|
||||
})
|
||||
}
|
||||
|
||||
// 自动请求并暴露内部方法
|
||||
onMounted(() => {
|
||||
defHttp.get({url:'/invoicing/configMaterialCategory/getMaterialTreeData'}).then(res =>{
|
||||
treeData.value = res;
|
||||
console.log("🚀 ~ defHttp.get ~ treeData:", treeData)
|
||||
console.log("🚀 ~ defHttp.get ~ res:", res)
|
||||
if(treeData.value.length > 0){
|
||||
treeChildData.value = treeData.value[0].children;
|
||||
}
|
||||
|
||||
})
|
||||
getTreeData()
|
||||
});
|
||||
|
||||
|
||||
|
|
|
@ -140,8 +140,4 @@
|
|||
.antd-modal-form {
|
||||
padding: 14px;
|
||||
}
|
||||
.ant-modal .ant-modal-body {
|
||||
padding: 0;
|
||||
height: 300px !important;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -74,4 +74,5 @@
|
|||
display: none !important;
|
||||
}
|
||||
</style>
|
||||
<style lang="less" scoped></style>
|
||||
<style lang="less" scoped>
|
||||
</style>
|
||||
|
|
|
@ -4,17 +4,17 @@
|
|||
<template #detail>
|
||||
<a-form ref="formRef" class="antd-modal-form" :labelCol="labelCol" :wrapperCol="wrapperCol" name="ConfigMaterialInfoForm">
|
||||
<a-row>
|
||||
<a-col :span="8">
|
||||
<a-col :span="8" hidden>
|
||||
<a-form-item label="一级级分类" v-bind="validateInfos.categoryId" id="ConfigMaterialInfoForm-categoryId" name="categoryId">
|
||||
<j-dict-select-tag type='list' v-model:value="formData.categoryId" dictCode="nu_config_material_category,category_name,id,iz_enabled = 0 and del_flag = 0" placeholder="请选择一级级分类" allow-clear @change="formData.typeId = null , formData.medicationId = null" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-col :span="8" hidden>
|
||||
<a-form-item label="二级级分类" v-bind="validateInfos.typeId" id="ConfigMaterialInfoForm-typeId" name="typeId">
|
||||
<j-dict-select-tag type='list' v-model:value="formData.typeId" :dictCode="`nu_config_material_type,type_name,id,category_id = ${formData.categoryId || -1} and iz_enabled = 0 and del_flag = 0 `" placeholder="请选择二级级分类" @change="formData.medicationId = null" allow-clear />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
<a-col :span="8" hidden>
|
||||
<a-form-item label="三级级分类" v-bind="validateInfos.medicationId" id="ConfigMaterialInfoForm-medicationId" name="medicationId">
|
||||
<j-dict-select-tag type='list' v-model:value="formData.medicationId" :dictCode="`nu_config_material_medication,medication_name,id,type_id = ${formData.typeId || -1} and iz_enabled = 0 and del_flag = 0`" placeholder="请选择三级级分类" allow-clear />
|
||||
</a-form-item>
|
||||
|
@ -65,33 +65,33 @@
|
|||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8" v-if="formData.multiUnitSwitch == '1'">
|
||||
<a-form-item label="父级单位" v-bind="validateInfos.oneUnit" id="ConfigMaterialInfoForm-oneUnit" name="oneUnit">
|
||||
<a-input v-model:value="formData.oneUnit" placeholder="请输入父级单位" allow-clear ></a-input>
|
||||
<a-form-item label="二级单位" v-bind="validateInfos.oneUnit" id="ConfigMaterialInfoForm-oneUnit" name="oneUnit">
|
||||
<a-input v-model:value="formData.oneUnit" placeholder="请输入二级单位" allow-clear ></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8" v-if="formData.multiUnitSwitch == '1'">
|
||||
<a-form-item label="父级单位兑换比例" v-bind="validateInfos.oneUnitProportion" id="ConfigMaterialInfoForm-oneUnitProportion" name="oneUnitProportion">
|
||||
<a-input-number v-model:value="formData.oneUnitProportion" placeholder="请输入父级单位兑换比例" style="width: 100%" />
|
||||
<a-form-item label="二级单位兑换比例" v-bind="validateInfos.oneUnitProportion" id="ConfigMaterialInfoForm-oneUnitProportion" name="oneUnitProportion">
|
||||
<a-input-number v-model:value="formData.oneUnitProportion" placeholder="请输入二级单位兑换比例" style="width: 100%" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8" v-if="formData.multiUnitSwitch == '1'">
|
||||
<a-form-item label="父级单位价格" v-bind="validateInfos.oneUnitPrice" id="ConfigMaterialInfoForm-oneUnitPrice" name="oneUnitPrice">
|
||||
<a-input-number v-model:value="formData.oneUnitPrice" placeholder="请输入父级单位价格" style="width: 100%" />
|
||||
<a-form-item label="二级单位价格" v-bind="validateInfos.oneUnitPrice" id="ConfigMaterialInfoForm-oneUnitPrice" name="oneUnitPrice">
|
||||
<a-input-number v-model:value="formData.oneUnitPrice" placeholder="请输入二级单位价格" style="width: 100%" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8" v-if="formData.multiUnitSwitch == '1'">
|
||||
<a-form-item label="爷级单位" v-bind="validateInfos.twoUnit" id="ConfigMaterialInfoForm-twoUnit" name="twoUnit">
|
||||
<a-input v-model:value="formData.twoUnit" placeholder="请输入爷级单位" allow-clear ></a-input>
|
||||
<a-form-item label="一级单位" v-bind="validateInfos.twoUnit" id="ConfigMaterialInfoForm-twoUnit" name="twoUnit">
|
||||
<a-input v-model:value="formData.twoUnit" placeholder="请输入一级单位" allow-clear ></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8" v-if="formData.multiUnitSwitch == '1'">
|
||||
<a-form-item label="爷级单位兑换比例" v-bind="validateInfos.twoUnitProportion" id="ConfigMaterialInfoForm-twoUnitProportion" name="twoUnitProportion">
|
||||
<a-input-number v-model:value="formData.twoUnitProportion" placeholder="请输入爷级单位兑换比例" style="width: 100%" />
|
||||
<a-form-item label="一级单位兑换比例" v-bind="validateInfos.twoUnitProportion" id="ConfigMaterialInfoForm-twoUnitProportion" name="twoUnitProportion">
|
||||
<a-input-number v-model:value="formData.twoUnitProportion" placeholder="请输入一级单位兑换比例" style="width: 100%" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8" v-if="formData.multiUnitSwitch == '1'">
|
||||
<a-form-item label="爷级单位价格" v-bind="validateInfos.twoUnitPrice" id="ConfigMaterialInfoForm-twoUnitPrice" name="twoUnitPrice">
|
||||
<a-input-number v-model:value="formData.twoUnitPrice" placeholder="请输入爷级单位价格" style="width: 100%" />
|
||||
<a-form-item label="一级单位价格" v-bind="validateInfos.twoUnitPrice" id="ConfigMaterialInfoForm-twoUnitPrice" name="twoUnitPrice">
|
||||
<a-input-number v-model:value="formData.twoUnitPrice" placeholder="请输入一级单位价格" style="width: 100%" />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="8">
|
||||
|
@ -182,8 +182,6 @@
|
|||
const confirmLoading = ref<boolean>(false);
|
||||
//表单验证
|
||||
const validatorRules = reactive({
|
||||
categoryId: [{ required: true, message: '请选择一级级分类!'},],
|
||||
typeId: [{ required: true, message: '请选择二级级分类!'},],
|
||||
materialName: [{ required: true, message: '请输入货品名称!'},],
|
||||
salesUnitPrice: [{ required: true, message: '请输入销售单价!'},],
|
||||
referenceUnitPrice: [{ required: true, message: '请输入参考单价!'},],
|
||||
|
@ -207,8 +205,8 @@
|
|||
/**
|
||||
* 新增
|
||||
*/
|
||||
function add() {
|
||||
edit({});
|
||||
function add(record) {
|
||||
edit(record);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -19,11 +19,11 @@
|
|||
/**
|
||||
* 新增
|
||||
*/
|
||||
function add() {
|
||||
function add(record) {
|
||||
title.value = '新增';
|
||||
visible.value = true;
|
||||
nextTick(() => {
|
||||
registerForm.value.add();
|
||||
registerForm.value.add(record);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue