@@ -2,14 +2,26 @@
< div class = "app-container" >
<!-- 列表 -- >
<!-- 搜索 -- >
< page-search ref = "searchRef" :search-config = "searchConfig" @ query -click = " newHandleQueryClick "
@ reset -click = " handleResetClick2 " / >
< page-search
ref = "searchRef"
:search-config = "searchConfig"
@ query -click = " newHandleQueryClick "
@ reset -click = " handleResetClick2 "
/ >
<!-- 顶部数据 -- >
< Statistics :data = "gongjiData" > < / Statistics >
<!-- 列表 -- >
< page-content ref = "contentRef" :content-config = "contentConfig" @ add -click = " handleAddClick "
@ edit -click = " handleEditClick " @ export -click = " handleExportClick " @ search -click = " handleSearchClick "
@ toolbar -click = " handleToolbarClick " @ operat -click = " handleOperatClick " @ filter -change = " handleFilterChange " >
< page-content
ref = "contentRef "
:content-config = "contentConfig"
@ add -click = " handleAddClick "
@ edit -click = " handleEditClick "
@ export -click = " handleExportClick "
@ search -click = " handleSearchClick "
@ toolbar -click = " handleToolbarClick "
@ operat -click = " handleOperatClick "
@ filter -change = " handleFilterChange "
>
<!-- < template # status = "scope" >
< el-tag : type = "scope.row[scope.prop] == 1 ? 'success' : 'info'" >
{ { scope . row [ scope . prop ] == 1 ? "启用" : "禁用" } }
@@ -22,43 +34,67 @@
< DictLabel v-model = "scope.row[scope.prop]" code="gender" / >
< / template >
< template # shangjia = "scope" >
< el-switch v-model = "scope.row[scope.prop]" :active-value="1" :inactive-value="0"
@click ="handleSwitchChange(scope.row)" > < / el -switch >
< el-switch
v-model = "scope.row[scope.prop]"
:active-value = "1"
:inactive-value = "0"
@click ="handleSwitchChange(scope.row)"
> < / el-switch >
< / template >
< template # isStock = "scope" >
< el-switch
disabled
v-model = "scope.row[scope.prop]"
:active-value = "1"
:inactive-value = "0"
> < / el-switch >
< / template >
< template # kucunedit = "scope" >
< template v-if = "scope.row.type != null" >
{{ scope.row.stockNumber }} < el -icon @click ="kucunedit(scope.row)" style = "cursor: pointer;color: #4080ff;" >
{{ scope.row.stockNumber }}
< el -icon @click ="kucunedit(scope.row)" style = "cursor: pointer; color: #4080ff" >
< EditPen / >
< / el-icon >
< / template >
< / template >
< template # tuikuantuihui = "scope" >
< el-switch v-if = "!scope.row.productId" v-model="scope.row[scope.prop]" :active-value="1" :inactive-value="0"
@click ="handleSwitchhaocai(scope.row)" > < / el -switch >
< el-switch
v-if = "!scope.row.productId"
v-model = "scope.row[scope.prop]"
:active-value = "1"
:inactive-value = "0"
@click ="handleSwitchhaocai(scope.row)"
> < / el-switch >
< / template >
< template # sellOut = "scope" >
< el-switch v-model = "scope.row[scope.prop]" :active-value="1" :inactive-value="0"
@click ="handleSwitchChangeTwo( scope.row) "> < / el -switch >
< el-switch
v-model = "scope.row[ scope.p rop] "
:active-value = "1"
:inactive-value = "0"
@click ="handleSwitchChangeTwo(scope.row)"
> < / el-switch >
< / template >
< template # mobile = "scope" >
< el-text > { { scope . row [ scope . prop ] } } < / el-text >
< copy-button v-if = "scope.row[scope.prop]" :text="scope.row[scope.prop]" style="margin-left: 2px" / >
< copy-button
v-if = "scope.row[scope.prop]"
:text = "scope.row[scope.prop]"
style = "margin-left: 2px"
/ >
< / template >
< template # consumables = "scope" >
< template v-if = "scope.row.type != null" >
< span style = "color: #4080ff; " v-if = "scope.row.consName" >
< span style = "color: #4080ff" v-if = "scope.row.consName" >
{{ scope.row.consName }}
< / span >
< span v-else >
绑定
< / span >
< el -icon @click ="editOpen(scope.row)" style = "cursor: pointer;color: #4080ff;" >
< span v-else > 绑定 < / span >
< el -icon @click ="editOpen(scope.row)" style = "cursor: pointer; color: #4080ff" >
< EditPen / >
< / el-icon >
< / template >
< / template >
< / page-content >
<!-- 新增 -- >
@@ -69,7 +105,11 @@
< / page-modal >
<!-- 编辑 -- >
< page-modal ref = "editModalRef" :modal-config = "editModalConfig" @ submit -click = " handleSubmitClick " >
< page-modal
ref = "editModalRef"
:modal-config = "editModalConfig"
@ submit -click = " handleSubmitClick "
>
< template # gender = "scope" >
< Dict v-model = "scope.formData[scope.prop]" code="gender" v-bind="scope.attrs" / >
< / template >
@@ -100,9 +140,11 @@
<!-- 耗材绑定 -- >
< MyDialog ref = "myDialogRefhaocai" @confirm ="confirmhaocai" width = "50%" title = "耗材绑定" >
< el-row >
< el-col :span = "12" > < el-form-item label = "商品名" >
< el-col :span = "12" >
< el-form-item label = "商品名" >
{ { haocaiData . name } }
< / el-form-item > < / el-col >
< / el-form-item >
< / el-col >
< el-col :span = "12" >
<!-- < el-form-item label = "退款退回库存" >
< el-switch v-model = "haocaiData.isRefundStock" :active-value="1" :inactive-value="0"
@@ -114,15 +156,23 @@
< el-table-column label = "序号" type = "index" width = "60" > < / el-table-column >
< el-table-column label = "耗材名称" prop = "consInfoId" >
< template v-slot = "scope" >
< el -select v-model = "scope.row.consInfoId" reserve-keyword placeholder="请输入关键词"
@change ="selectionChange($event, scope.row)" >
< el -option v-for = "item in options" :key="item.id" :label="item.conName" :value="item.id" >
< / el -option >
< el -select
v-model = "scope.row.consInfoId"
reserve -keyword
placeholder = "请输入关键词"
@change ="selectionChange($event, scope.row)"
>
< el-option
v-for = "item in options"
:key = "item.id"
:label = "item.conName"
:value = "item.id"
> < / el-option >
< / el-select >
<!-- < div class = "tips" v-if = "scope.row.stockNumber" > 库存 : {{ scope.row.stockNumber }} < / div > - - >
< / template >
< / el-table-column >
< el-table-column label = "单位" prop = "conUnit" > < / el-table-column >
< el-table-column label = "单位" prop = "conUnit" > < / el-table-column >
< el-table-column label = "使用数量" prop = "surplusStock" min -width = " 150px " >
< template v-slot = "scope" >
< el -input -number v-model = "scope.row.surplusStock" :min="0" / >
@@ -131,13 +181,20 @@
< el-table-column label = "操作" width = "100" >
< template v-slot = "scope" >
< div class = "table_btn_wrap" >
< div class = "btn sub" v-if = "haocaiData.consList.length > 1"
@click ="haocaiData.consList.splice(scope.$index, 1)" >
< div
class = "btn sub"
v-if = "haocaiData.consList.length > 1"
@click ="haocaiData.consList.splice(scope.$index, 1)"
>
< el-icon >
< RemoveFilled / >
< / el-icon >
< / div >
< div class = "btn add" v-if = "scope.$index == haocaiData.consList.length - 1" @click="createItem(scope.row)" >
< div
class = "btn add"
v-if = "scope.$index == haocaiData.consList.length - 1"
@click ="createItem(scope.row)"
>
< el-icon >
< CirclePlusFilled / >
< / el-icon >
@@ -162,13 +219,13 @@ import usePage from "@/components/CURD/usePage";
import { isSyncStatus } from "@/utils/index" ;
import addModalConfig from "./indexconfig/add" ;
import contentConfig from "./indexconfig/content" ;
import MultiImageUpload from "@/components/Upload/MultiImageUpload.vue"
import MultiImageUpload from "@/components/Upload/MultiImageUpload.vue" ;
import contentConfig2 from "./indexconfig/content2" ;
import editModalConfig from "./indexconfig/edit" ;
import searchConfig from "./indexconfig/search" ;
import MyDialog from "@/components/mycomponents/myDialog.vue" ;
import Statistics from "./indexconfig/statistics.vue" ;
import { min } from ' lodash' ;
import { min } from " lodash" ;
const {
searchRef ,
@@ -192,24 +249,24 @@ const myDialogRefhaocai = ref(null);
const myDialogRefkucun = ref ( null ) ;
let haocaiData = ref ( { } ) ;
let options = ref ( [ ] ) ;
let kucundata = ref ( 0 )
let kucundata = ref ( 0 ) ;
const form = reactive ( {
warnLine : "" ,
} ) ;
let datas = reactive ( {
number : 0 ,
remark : "" ,
images : [ ]
images : [ ] ,
} ) ;
if ( isSyncStatus ( ) ) {
contentConfig . toolbar [ 0 ] . hidden = true
contentConfig . toolbar [ 1 ] . hidden = false
contentConfig . cols [ contentConfig . cols . length - 1 ] . operat [ 2 ] . hidden = true
contentConfig . toolbar [ 0 ] . hidden = true ;
contentConfig . toolbar [ 1 ] . hidden = false ;
contentConfig . cols [ contentConfig . cols . length - 1 ] . operat [ 2 ] . hidden = true ;
} else {
contentConfig . toolbar [ 0 ] . hidden = false
contentConfig . toolbar [ 1 ] . hidden = true
contentConfig . cols [ contentConfig . cols . length - 1 ] . operat [ 2 ] . hidden = false
contentConfig . toolbar [ 0 ] . hidden = false ;
contentConfig . toolbar [ 1 ] . hidden = true ;
contentConfig . cols [ contentConfig . cols . length - 1 ] . operat [ 2 ] . hidden = false ;
}
onMounted ( ( ) => {
@@ -218,8 +275,64 @@ onMounted(() => {
contentRef . value ? . fetchPageData ( { id : route . query . id } ) ;
}
// 获取耗材列表
gethaocaiList ( )
gethaocaiList ( ) ;
} ) ;
if ( isSyncStatus ( ) ) {
contentConfig . toolbar [ 0 ] . hidden = true ;
contentConfig . toolbar [ 1 ] . hidden = false ;
contentConfig . cols [ contentConfig . cols . length - 1 ] . operat [ 2 ] . hidden = true ;
} else {
contentConfig . toolbar [ 0 ] . hidden = false ;
contentConfig . toolbar [ 1 ] . hidden = true ;
contentConfig . cols [ contentConfig . cols . length - 1 ] . operat [ 2 ] . hidden = false ;
}
onMounted ( ( ) => {
console . log ( route . query ) ;
if ( route . query . id ) {
contentRef . value ? . fetchPageData ( { id : route . query . id } ) ;
}
// 获取耗材列表
gethaocaiList ( ) ;
} ) ;
if ( isSyncStatus ( ) ) {
contentConfig . toolbar [ 0 ] . hidden = true ;
contentConfig . toolbar [ 1 ] . hidden = false ;
contentConfig . cols [ contentConfig . cols . length - 1 ] . operat [ 2 ] . hidden = true ;
} else {
contentConfig . toolbar [ 0 ] . hidden = false ;
contentConfig . toolbar [ 1 ] . hidden = true ;
contentConfig . cols [ contentConfig . cols . length - 1 ] . operat [ 2 ] . hidden = false ;
}
onMounted ( ( ) => {
console . log ( route . query ) ;
if ( route . query . id ) {
contentRef . value ? . fetchPageData ( { id : route . query . id } ) ;
}
// 获取耗材列表
gethaocaiList ( ) ;
} ) ;
if ( isSyncStatus ( ) ) {
contentConfig . toolbar [ 0 ] . hidden = true ;
contentConfig . toolbar [ 1 ] . hidden = false ;
contentConfig . cols [ contentConfig . cols . length - 1 ] . operat [ 2 ] . hidden = true ;
} else {
contentConfig . toolbar [ 0 ] . hidden = false ;
contentConfig . toolbar [ 1 ] . hidden = true ;
contentConfig . cols [ contentConfig . cols . length - 1 ] . operat [ 2 ] . hidden = false ;
}
onMounted ( ( ) => {
console . log ( route . query ) ;
if ( route . query . id ) {
contentRef . value ? . fetchPageData ( { id : route . query . id } ) ;
}
// 获取耗材列表
gethaocaiList ( ) ;
} ) ;
function newHandleQueryClick ( e : IObject | undefined ) {
const filterParams = contentRef . value ? . getFilterParams ( ) ;
@@ -228,25 +341,28 @@ function newHandleQueryClick(e: IObject | undefined) {
}
// 库存修改
function kucunedit ( item ) {
kucundata . value = item
myDialogRefkucun . value . open ( )
kucundata . value = item ;
myDialogRefkucun . value . open ( ) ;
}
async function confirmkucun ( ) {
let res = await UserAPI . modifyStock ( { id : kucundata . value . id , stockNumber : kucundata . value . stockNumber } )
ElMessage . success ( '成功' )
myDialogRef kucun. value . close ( )
let res = await UserAPI . modifyStock ( {
id : kucundata . value . id ,
stockNumber : kucundata . value . stockNumber ,
} ) ;
ElMessage . success ( "成功" ) ;
myDialogRefkucun . value . close ( ) ;
}
function editOpen ( item : any ) {
haocaiData . value = item
haocaiData . value = item ;
if ( haocaiData . value . consList . length == 0 ) {
let items = {
" productId" : item . id ,
" consInfoId" : "" ,
" surplusStock" : '0'
}
haocaiData . value . consList . push ( items )
productId: item . id ,
consInfoId: "" ,
surplusStock: "0" ,
} ;
haocaiData . value . consList . push ( items ) ;
}
handleResetClick ( )
handleResetClick ( ) ;
myDialogRefhaocai . value . open ( ) ;
}
// 重置
@@ -254,12 +370,11 @@ function handleResetClick2(queryParams: IObject) {
const filterParams = contentRef . value ? . getFilterParams ( ) ;
contentRef . value ? . fetchPageData ( { ... queryParams , ... filterParams } , true ) ;
getTongji ( queryParams ) ;
}
function getTongji ( params : IObject | undefined ) {
UserAPI . statistics ( params ) . then ( ( res ) => {
gongjiData . value = res
gongjiData . value = res ;
} ) ;
}
@@ -274,11 +389,11 @@ async function handleAddClick() {
// 生成新商品绑定耗材关系项
function createItem ( val : IObject ) {
let item = {
" productId" : val . productId ,
" consInfoId" : "" ,
" surplusStock" : ''
}
haocaiData . value . consList . push ( item )
productId: val . productId ,
consInfoId: "" ,
surplusStock: "" ,
} ;
haocaiData . value . consList . push ( item ) ;
}
// 上架
function handleSwitchChange ( data : any ) {
@@ -309,18 +424,18 @@ function handleSwitchChangethree(data: any) {
// 退款退回
async function handleSwitchhaocai ( row : IObject ) {
let res = await UserAPI . refundToStock ( { isReturn : row . isRefundStock , id : row . id } )
ElMessage . success ( ' 成功' )
handleResetClick ( )
let res = await UserAPI . refundToStock ( { isReturn : row . isRefundStock , id : row . id } ) ;
ElMessage . success ( " 成功" ) ;
handleResetClick ( ) ;
// myDialogRefhaocai.value.close()
}
// 编辑
async function handleEditClick ( row : IObject ) {
try {
router . push ( { name : "addgoods" , query : { goods _id : row . id } } ) ;
router . push ( { name : "addgoods" , query : { goods _id : row . id } } ) ;
} catch ( error ) {
ElMessage . error ( ' 没有编辑权限' )
ElMessage . error ( " 没有编辑权限" ) ;
}
}
@@ -331,25 +446,25 @@ async function handleToolbarClick(name: string) {
// ElMessage.success("点击了自定义1按钮");
myDialogRef . value . open ( ) ;
}
if ( name === "sync" ) { //商品同步
let res = await UserAPI . sync ( )
ElMessage . success ( '操作成功,数据正在后台同步中...' )
if ( name === "sync" ) {
//商品同步
let res = await UserAPI . sync ( ) ;
ElMessage . success ( "操作成功,数据正在后台同步中..." ) ;
}
}
async function confirm ( ) {
let res = await UserAPI . stockWarning ( form . warnLine )
let res = await UserAPI . stockWarning ( form . warnLine ) ;
ElMessage . success ( "成功" ) ;
myDialogRef . value . close ( ) ;
}
// 商品选择耗材
function selectionChange ( e , row ) {
let item = options . value . find ( item => item . id == e )
row . name = item . conName
row . conUnit = item . conUnit
let item = options . value . find ( ( item ) => item . id == e ) ;
row . name = item . conName ;
row . conUnit = item . conUnit ;
}
async function confirmbaosun ( ) {
let res = await UserAPI . reportDamage ( datas )
let res = await UserAPI . reportDamage ( datas ) ;
ElMessage . success ( "成功" ) ;
myDialogRefbaosun . value . close ( ) ;
contentRef . value ? . fetchPageData ( ) ;
@@ -357,11 +472,11 @@ async function confirmbaosun() {
async function confirmhaocai ( ) {
let obj = {
consList : haocaiData . value . consList ,
id : haocaiData . value . id
}
let res = await UserAPI . bind ( obj )
id : haocaiData . value . id ,
} ;
let res = await UserAPI . bind ( obj ) ;
ElMessage . success ( "成功" ) ;
handleResetClick ( )
handleResetClick ( ) ;
myDialogRefhaocai . value . close ( ) ;
}
// 商品规格
@@ -380,16 +495,15 @@ function typeFilter(item: any) {
}
// 其他操作列
async function handleOperatClick ( data : IOperatData ) {
datas . productId = data . row . id
datas . productId = data . row . id ;
myDialogRefbaosun . value . open ( ) ;
datas . number = 1
datas . remark = ""
datas . number = 1 ;
datas . remark = "" ;
}
async function gethaocaiList ( ) {
let res = await UserAPI . productcons ( { id : route . query . id } )
options . value = res . records
let res = await UserAPI . productcons ( { id : route . query . id } ) ;
options . value = res . records ;
}
< / script >
< style scoped lang = "scss" >
@@ -402,11 +516,11 @@ async function gethaocaiList() {
font - size : 26 px ;
& . sub {
color : # FF4D4F ;
color : # ff4d4f ;
}
& . add {
color : # 52 C 41A ;
color : # 52 c 41a ;
}
}
}