|
|
@@ -59,7 +59,7 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="item-actions">
|
|
|
- <view v-if="getAuditStatus(item) == 0 && !item.isSelected!" class="delete-btn" @click.stop="handleDeleteMaterial(item)">
|
|
|
+ <view v-if="getAuditStatus(item) == 0 && !item.isSelected! && canDeleteMaterial(item)" class="delete-btn" @click.stop="handleDeleteMaterial(item)">
|
|
|
<text class="delete-icon">×</text>
|
|
|
</view>
|
|
|
<view v-if="item.isSelected" class="added-btn">
|
|
|
@@ -103,24 +103,35 @@
|
|
|
:key="selIndex"
|
|
|
class="selected-item"
|
|
|
>
|
|
|
- <text class="selected-item-name">{{ selItem.itemName }}</text>
|
|
|
- <text class="selected-item-measure">{{ selItem.measureName }}</text>
|
|
|
- <view class="quantity-control">
|
|
|
- <view class="qty-btn" @click="decreaseQty(selIndex)">
|
|
|
- <text class="qty-btn-text">-</text>
|
|
|
+ <view class="selected-item-row1">
|
|
|
+ <text class="selected-item-name">{{ selItem.itemName }}</text>
|
|
|
+ <text class="selected-item-measure">{{ selItem.measureName }}</text>
|
|
|
+ <view class="quantity-control">
|
|
|
+ <view class="qty-btn" @click="decreaseQty(selIndex)">
|
|
|
+ <text class="qty-btn-text">-</text>
|
|
|
+ </view>
|
|
|
+ <input
|
|
|
+ class="quantity-input"
|
|
|
+ type="digit"
|
|
|
+ v-model="selItem.qty"
|
|
|
+ placeholder="数量"
|
|
|
+ />
|
|
|
+ <view class="qty-btn" @click="increaseQty(selIndex)">
|
|
|
+ <text class="qty-btn-text">+</text>
|
|
|
+ </view>
|
|
|
</view>
|
|
|
- <input
|
|
|
- class="quantity-input"
|
|
|
- type="digit"
|
|
|
- v-model="selItem.qty"
|
|
|
- placeholder="数量"
|
|
|
- />
|
|
|
- <view class="qty-btn" @click="increaseQty(selIndex)">
|
|
|
- <text class="qty-btn-text">+</text>
|
|
|
+ <view class="delete-btn" @click="removeSelected(selIndex)">
|
|
|
+ <text class="delete-icon">×</text>
|
|
|
</view>
|
|
|
</view>
|
|
|
- <view class="delete-btn" @click="removeSelected(selIndex)">
|
|
|
- <text class="delete-icon">×</text>
|
|
|
+ <view class="selected-item-row2">
|
|
|
+ <input
|
|
|
+ class="selected-item-remark"
|
|
|
+ type="text"
|
|
|
+ v-model="selItem.remark"
|
|
|
+ placeholder="备注"
|
|
|
+ :maxlength="200"
|
|
|
+ />
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
@@ -270,6 +281,7 @@
|
|
|
<script setup lang="uts">
|
|
|
import { ref, computed, onBeforeUnmount, onMounted } from 'vue'
|
|
|
import { getItemTypeListByParentId, getItemList, savePurchaseApply, confirmPurchaseApply, addMaterial, getMeasureList, deleteMaterial } from '../../api/apply/index'
|
|
|
+import { getUserInfo } from '../../utils/storage'
|
|
|
import UploadImage from '../../components/upload-image/upload-image.uvue'
|
|
|
import type { UploadResponse } from '../../types/workbench'
|
|
|
|
|
|
@@ -287,9 +299,10 @@ let searchTimer: number | null = null
|
|
|
productUrl: string;
|
|
|
auditStatus: number;
|
|
|
stockNum: number;
|
|
|
+ createBy: string;
|
|
|
isSelected?: boolean;
|
|
|
}
|
|
|
- type SelectedItem = { itemId: string; itemName: string; itemTypeName: string; measureName: string; qty: string }
|
|
|
+ type SelectedItem = { itemId: string; itemName: string; itemTypeName: string; measureName: string; qty: string; remark: string }
|
|
|
|
|
|
const keyword = ref<string>("")
|
|
|
|
|
|
@@ -313,6 +326,9 @@ let searchTimer: number | null = null
|
|
|
let currentStatus = ref<string>('')
|
|
|
const isSearching = ref<boolean>(false)
|
|
|
|
|
|
+// 当前登录用户
|
|
|
+const currentUserName = ref<string>('')
|
|
|
+
|
|
|
// 新增物料相关
|
|
|
const showAddMaterialModal = ref<boolean>(false)
|
|
|
const showMeasurePicker = ref<boolean>(false)
|
|
|
@@ -411,7 +427,8 @@ const selectMeasure = (item: UTSJSONObject): void => {
|
|
|
productUrl: item['productUrl'] != null ? item['productUrl'].toString() : '',
|
|
|
isSelected: selectedIds.includes(itemId),
|
|
|
auditStatus: auditStatus,
|
|
|
- stockNum: stockNum
|
|
|
+ stockNum: stockNum,
|
|
|
+ createBy: item['createBy'] != null ? item['createBy'].toString() : ''
|
|
|
}
|
|
|
arr.push(it)
|
|
|
})
|
|
|
@@ -506,7 +523,8 @@ const selectMeasure = (item: UTSJSONObject): void => {
|
|
|
itemName: mdItem.itemName,
|
|
|
itemTypeName: mdItem.itemTypeName,
|
|
|
measureName: mdItem.measureName,
|
|
|
- qty: '1'
|
|
|
+ qty: '1',
|
|
|
+ remark: ''
|
|
|
}
|
|
|
selectedItems.value.push(selItem)
|
|
|
// 更新 dataList 中的选中状态
|
|
|
@@ -581,6 +599,14 @@ const selectMeasure = (item: UTSJSONObject): void => {
|
|
|
return status == 3
|
|
|
}
|
|
|
|
|
|
+ // 判断物料是否可删除(创建人是当前用户)
|
|
|
+ const canDeleteMaterial = (item: any | null): boolean => {
|
|
|
+ if (item == null) return false
|
|
|
+ const mdItem = item as Item
|
|
|
+ const createBy = mdItem.createBy != null ? mdItem.createBy : ''
|
|
|
+ return createBy === currentUserName.value
|
|
|
+ }
|
|
|
+
|
|
|
// 检查物料是否已被选择
|
|
|
const isItemSelected = (item: any | null): boolean => {
|
|
|
if (item == null) return false
|
|
|
@@ -632,6 +658,7 @@ const selectMeasure = (item: UTSJSONObject): void => {
|
|
|
lineObj['specification'] = ''
|
|
|
lineObj['unitOfMeasure'] = ''
|
|
|
lineObj['quantityApply'] = parseInt(item.qty)
|
|
|
+ lineObj['remark'] = item.remark || ''
|
|
|
applyLines.push(lineObj)
|
|
|
})
|
|
|
const result = new UTSJSONObject()
|
|
|
@@ -825,7 +852,12 @@ const handleDeleteMaterial = (item: Item): void => {
|
|
|
onMounted(() => {
|
|
|
loadCategories()
|
|
|
loadMeasureList()
|
|
|
-// 获取页面参数,判断是否从index.uvue跳转过来
|
|
|
+ // 获取当前登录用户信息
|
|
|
+ const userInfo = getUserInfo()
|
|
|
+ if (userInfo != null) {
|
|
|
+ currentUserName.value = userInfo['userName'] != null ? userInfo['userName'].toString() : ''
|
|
|
+ }
|
|
|
+ // 获取页面参数,判断是否从index.uvue跳转过来
|
|
|
const pages = getCurrentPages()
|
|
|
const currentPage = pages[pages.length - 1]
|
|
|
const options = currentPage.options
|
|
|
@@ -1131,14 +1163,23 @@ onMounted(() => {
|
|
|
|
|
|
.selected-item {
|
|
|
display: flex;
|
|
|
- flex-direction: row;
|
|
|
- align-items: center;
|
|
|
+ flex-direction: column;
|
|
|
background-color: #ffffff;
|
|
|
border-radius: 10rpx;
|
|
|
- padding: 20rpx;
|
|
|
+ padding: 16rpx 20rpx;
|
|
|
border: 1rpx solid #e5e5e5;
|
|
|
box-shadow: 0 2rpx 4rpx rgba(0, 0, 0, 0.05);
|
|
|
- white-space: nowrap;
|
|
|
+ margin-bottom: 12rpx;
|
|
|
+ }
|
|
|
+
|
|
|
+ .selected-item-row1 {
|
|
|
+ display: flex;
|
|
|
+ flex-direction: row;
|
|
|
+ align-items: center;
|
|
|
+ }
|
|
|
+
|
|
|
+ .selected-item-row2 {
|
|
|
+ margin-top: 10rpx;
|
|
|
}
|
|
|
|
|
|
.selected-item-name {
|
|
|
@@ -1146,13 +1187,25 @@ onMounted(() => {
|
|
|
color: #333333;
|
|
|
margin-right: 20rpx;
|
|
|
font-weight: 500;
|
|
|
- // white-space: nowrap;
|
|
|
max-width: 180rpx;
|
|
|
- // overflow: hidden;
|
|
|
- // text-overflow: ellipsis;
|
|
|
flex-shrink: 0;
|
|
|
}
|
|
|
|
|
|
+ .selected-item-remark-row {
|
|
|
+ margin-top: 10rpx;
|
|
|
+ }
|
|
|
+
|
|
|
+ .selected-item-remark {
|
|
|
+ width: 100%;
|
|
|
+ height: 56rpx;
|
|
|
+ padding: 0 16rpx;
|
|
|
+ background-color: #f5f5f5;
|
|
|
+ border-radius: 6rpx;
|
|
|
+ font-size: 24rpx;
|
|
|
+ color: #333333;
|
|
|
+ border: 1rpx solid #e5e5e5;
|
|
|
+ }
|
|
|
+
|
|
|
.selected-item-measure {
|
|
|
font-size: 24rpx;
|
|
|
color: #999999;
|