diff --git a/src/api/wms/supplyLabel/index.ts b/src/api/wms/supplyLabel/index.ts
index 8cc8c4ed4..31cff4b34 100644
--- a/src/api/wms/supplyLabel/index.ts
+++ b/src/api/wms/supplyLabel/index.ts
@@ -46,4 +46,13 @@ export const exportSupplyLabel = async (params) => {
// 下载用户导入模板
export const importTemplate = () => {
return request.download({ url: '/wms/supply-label/get-import-template' })
+}
+
+// 启用
+export const enableOption = async (id: number) => {
+ return await request.enable({ url: `/wms/supply-label/enable?id=` + id })
+}
+// 禁用
+export const disableOption = async (id: number) => {
+ return await request.disable({ url: `/wms/supply-label/disable?id=` + id })
}
\ No newline at end of file
diff --git a/src/views/wms/basicDataManage/labelManage/supplyLabel/index.vue b/src/views/wms/basicDataManage/labelManage/supplyLabel/index.vue
index 59c5caa1f..4f0932950 100644
--- a/src/views/wms/basicDataManage/labelManage/supplyLabel/index.vue
+++ b/src/views/wms/basicDataManage/labelManage/supplyLabel/index.vue
@@ -17,6 +17,7 @@
-
-
- {{ row.code }}
+
+
+ {{ row.itemCode }}
-
+
@@ -65,6 +67,10 @@ import * as defaultButtons from '@/utils/disposition/defaultButtons'
import TableHead from '@/components/TableHead/src/TableHead.vue'
import ImportForm from '@/components/ImportForm/src/ImportForm.vue'
import Detail from '@/components/Detail/src/Detail.vue'
+import * as PackageApi from '@/api/wms/package'
+import * as LocationApi from '@/api/wms/location'
+import { getJmreportBaseUrl } from '@/utils/systemParam'
+import { getAccessToken } from '@/utils/auth'
defineOptions({ name: 'SupplyLabel' })
@@ -78,11 +84,29 @@ const tableColumns = ref(SupplyLabel.allSchemas.tableColumns)
// 查询页面返回
const searchTableSuccess = (formField, searchField, val, formRef) => {
+ // nextTick(() => {
+ // const setV = {}
+ // setV[formField] = val[0][searchField]
+ // formRef.setValues(setV)
+ // })
nextTick(() => {
- const setV = {}
- setV[formField] = val[0][searchField]
- formRef.setValues(setV)
- })
+
+console.log('searchTableSuccess',formField, searchField, val)
+
+const setV = {}
+if (formField == 'itemCode') {
+ setV['itemCode'] = val[0]['code']
+ setV['uom'] = val[0]['uom']
+ setV['itemGroup'] = val[0]['itemGroup']
+ setV['backNumber'] = val[0]['backNumber']
+} else if (formField == 'locationCode') {
+ //工位
+ setV['locationCode'] = val[0]['code']
+}else {
+ setV[formField] = val[0][searchField]
+}
+formRef.setValues(setV)
+})
}
// 字段设置 更新主列表字段
@@ -102,6 +126,7 @@ const HeadButttondata = [
defaultButtons.defaultAddBtn({hasPermi:'wms:supplyLabel:create'}), // 新增
defaultButtons.defaultImportBtn({hasPermi:'wms:supplyLabel:import'}), // 导入
defaultButtons.defaultExportBtn({hasPermi:'wms:supplyLabel:export'}), // 导出
+ defaultButtons.mainLisSelectiontPointBtn(null), // 批量标签打印
defaultButtons.defaultFreshBtn(null), // 刷新
defaultButtons.defaultFilterBtn(null), // 筛选
defaultButtons.defaultSetBtn(null), // 设置
@@ -126,29 +151,84 @@ const buttonBaseClick = (val, item) => {
} else if (val == 'refresh') { // 刷新
getList()
} else if (val == 'filtrate') { // 筛选
- } else { // 其他按钮
+ } else if (val=='selection_point'){//批量打印
+ handleSelectionPoint()
+ }else { // 其他按钮
console.log('其他按钮', item)
}
}
+const isShowMainButton = (row, val) => {
+ if (val.indexOf(row.available) > -1) {
+ return false
+ } else {
+ return true
+ }
+}
+
// 列表-操作按钮
-const butttondata = [
+const butttondata = (row) => {
+ return[
defaultButtons.mainListEditBtn({hasPermi:'wms:supplyLabel:update'}), // 编辑
+ defaultButtons.mainListEnableBtn({hide: isShowMainButton(row, ['FALSE']),hasPermi: 'wms:supplyLabel:enable'}), //启用
+ defaultButtons.mainListDisableBtn({hide: isShowMainButton(row, ['TRUE']),hasPermi: 'wms:supplyLabel:disable'}), //停用
defaultButtons.mainListDeleteBtn({hasPermi:'wms:supplyLabel:delete'}), // 删除
-]
-
+ defaultButtons.mainListPointBtn(null), // 标签打印
+ ]
+}
+const BASE_URL = getJmreportBaseUrl()
+const src = ref(BASE_URL + '/jmreport/view/924811818898698240?token=' + getAccessToken())
+const srcPoint = ref(BASE_URL + '/jmreport/view/940818992169918464?token=' + getAccessToken())
// 列表-操作按钮事件
const buttonTableClick = async (val, row) => {
if (val == 'edit') { // 编辑
openForm('update', row)
} else if (val == 'delete') { // 删除
handleDelete(row.id)
+ }else if (val == 'enable') {//启用
+ handleEnable(row.id)
+ } else if (val == 'disable') {//禁用
+ handleDisable(row.id)
+ } else if (val == 'point') { // 标签打印
+ handlePoint(row)
}
}
/** 添加/修改操作 */
const basicFormRef = ref()
-const openForm = (type: string, row?: any) => {
+const openForm = async(type: string, row?: any) => {
+ if (type == 'update') {
+ // 修改 tableform 属性
+ SupplyLabel.allSchemas.formSchema.map(itemColumns => {
+ if(itemColumns.field == 'itemCode') {
+ itemColumns.componentProps.isSearchList = false
+ itemColumns.componentProps.disabled = true
+ }
+ if(itemColumns.field == 'productionLineCode') {
+ itemColumns.componentProps.isSearchList = false
+ itemColumns.componentProps.disabled = true
+ }
+ })
+ } else {
+ // 修改 tableform 属性
+ SupplyLabel.allSchemas.formSchema.map(itemColumns => {
+ if(itemColumns.field == 'itemCode') {
+ itemColumns.componentProps.isSearchList = true
+ itemColumns.componentProps.disabled = false
+ }
+ })
+ }
+ let param = {
+ 'areaType':'BS',
+ 'available': 'TRUE',
+ 'pageSize': 20,
+ 'pageNo': 1,
+ 'by': 'ASC',
+ }
+ const data = await LocationApi.getLocationPage(param)
+ let locationCode = data[0]?.code;
+ console.log('row',row);
+ row.locationCode = locationCode;
basicFormRef.value.open(type, row)
}
@@ -235,6 +315,66 @@ const searchFormClick = (searchData) => {
getList() // 刷新当前列表
}
+const handleEnable = async (id: number) => {
+ try {
+ await SupplyLabelApi.enableOption(id)
+ message.success(t('common.updateSuccess'))
+ // 刷新列表
+ await getList()
+ } catch {}
+}
+
+
+const handleDisable = async (id: number) => {
+ try {
+ await SupplyLabelApi.disableOption(id)
+ message.success(t('common.updateSuccess'))
+ // 刷新列表
+ await getList()
+ } catch {}
+}
+const handlePoint = async (row) => {
+ let rows = [row.id]; // 将单个 row.id 转换成数组
+ await PackageApi.batchPrintingLable(rows.join(',')).then(res => {
+ window.open(srcPoint.value + '&relateNumber=' + res);
+ message.success('创建标签成功');
+ }).catch(err => {
+ message.error('创建标签失败');
+ });
+}
+
+// 批量打印
+const handleSelectionPoint = async ()=>{
+ let rows:any = []
+ selectionRows.value.forEach(item=>{
+ rows = [...rows,...item.selectionRows.map(item1=>item1.id)]
+ })
+ console.log('批量打印',rows.join(','))
+ await PackageApi.batchPrintingLable(rows.join(',')).then(res => {
+ console.log(res)
+ window.open(srcPoint.value+'&relateNumber='+res)
+ message.success('创建标签成功')
+ }).catch(err => {
+ console.log(err)
+ message.error('创建标签失败')
+ })
+}
+
+const selectionRows = ref([])
+const tableRef = ref()
+
+const getSelectionRows = (currentPage,currentPageSelectionRows) => {
+ console.log("getSelectionRows",currentPage,currentPageSelectionRows)
+ const currentRows = selectionRows.value.find(item=>item.currentPage==currentPage)
+ if(currentRows){
+ currentRows.selectionRows = currentPageSelectionRows
+ }else{
+ selectionRows.value.push({
+ currentPage,
+ selectionRows:currentPageSelectionRows
+ })
+ }
+}
/** 初始化 **/
onMounted(async () => {
getList()
diff --git a/src/views/wms/basicDataManage/labelManage/supplyLabel/supplyLabel.data.ts b/src/views/wms/basicDataManage/labelManage/supplyLabel/supplyLabel.data.ts
index a9e3e0ae3..739049059 100644
--- a/src/views/wms/basicDataManage/labelManage/supplyLabel/supplyLabel.data.ts
+++ b/src/views/wms/basicDataManage/labelManage/supplyLabel/supplyLabel.data.ts
@@ -82,26 +82,6 @@ export const SupplyLabel = useCrudSchemas(reactive([
}
}
},
- {
- label: '计量单位', // 发料申请 与当前物料计量单位做匹配 : 原PACK_UNIT 修改:UOM
- field: 'uom',
- dictType: DICT_TYPE.UOM,
- dictClass: 'string',
- isTable: true,
- sort: 'custom',
- table: {
- width: 150
- },
- tableForm: {
- disabled: true,
- type: 'Select'
- },
- form: {
- componentProps: {
- disabled: true
- }
- }
- },
{
label: '货架号',
field: 'itemGroup',
@@ -114,10 +94,11 @@ export const SupplyLabel = useCrudSchemas(reactive([
disabled: true
}
},
+ hiddenSearchHigh:true,
},
{
- label: '库位',
- field: 'location',
+ label: '所在库位',
+ field: 'locationCode',
sort: 'custom',
table: {
width: 150
@@ -146,6 +127,26 @@ export const SupplyLabel = useCrudSchemas(reactive([
},
isSearch: true
},
+ {
+ label: '计量单位', // 发料申请 与当前物料计量单位做匹配 : 原PACK_UNIT 修改:UOM
+ field: 'uom',
+ dictType: DICT_TYPE.UOM,
+ dictClass: 'string',
+ isTable: true,
+ sort: 'custom',
+ table: {
+ width: 150
+ },
+ tableForm: {
+ disabled: true,
+ type: 'Select'
+ },
+ form: {
+ componentProps: {
+ disabled: true
+ }
+ }
+ },
// {
// label: '是否可用',
// field: 'available',
@@ -169,6 +170,38 @@ export const SupplyLabel = useCrudSchemas(reactive([
// width: 110
// }
// },
+ {
+ label: '是否可用',
+ field: 'available',
+ sort: 'custom',
+ isSearch:true,
+ isForm: false,
+ dictType: DICT_TYPE.TRUE_FALSE,
+ dictClass: 'string', // 默认都是字符串类型其他暂不考虑
+ search: {
+ value: 'TRUE',
+ },
+ form: {
+ component: 'Switch',
+ value: 'TRUE',
+ componentProps: {
+ inactiveValue: 'FALSE',
+ activeValue: 'TRUE'
+ }
+ },
+ table: {
+ width: 110
+ }
+ },
+ {
+ label: '创建者',
+ field: 'creator',
+ table: {
+ width: 130
+ },
+ isForm: false,
+ isTable: true
+ },
{
label: '创建时间',
field: 'createTime',
@@ -191,13 +224,14 @@ export const SupplyLabel = useCrudSchemas(reactive([
}
},
{
- label: '创建者',
- field: 'creator',
- table: {
- width: 130
- },
+ label: '最后更新者',
+ field: 'updater',
+ isDetail: true,
isForm: false,
- isTable: true
+ isTable: true,
+ table: {
+ width: 150
+ }
},
{
label: '最后更新时间',
@@ -223,16 +257,6 @@ export const SupplyLabel = useCrudSchemas(reactive([
}
}
},
- {
- label: '最后更新者',
- field: 'updater',
- isDetail: true,
- isForm: false,
- isTable: true,
- table: {
- width: 150
- }
- },
{
label: '操作',
field: 'action',