|
|
@@ -50,6 +50,15 @@
|
|
50
|
50
|
</view>
|
|
51
|
51
|
</template>
|
|
52
|
52
|
|
|
|
53
|
+ <!-- kezhang角色显示查获人员选择 -->
|
|
|
54
|
+ <uni-forms-item v-if="isKezhang && !isDetailMode" label="查获人员" name="inspectUserId" required>
|
|
|
55
|
+ <uni-data-picker :readonly="isDetailMode" :localdata="departmentUserOptions" popup-title="请选择查获人员"
|
|
|
56
|
+ v-model="formData.inspectUserId" @change="onInspectUserChange" />
|
|
|
57
|
+ </uni-forms-item>
|
|
|
58
|
+ <uni-forms-item v-else-if="isKezhang && isDetailMode" label="查获人员">
|
|
|
59
|
+ <uni-easyinput :disabled="true" placeholder="查获人员" :value="formData.inspectUserName" />
|
|
|
60
|
+ </uni-forms-item>
|
|
|
61
|
+
|
|
53
|
62
|
<uni-forms-item label="查获时间" name="seizureTime" required>
|
|
54
|
63
|
<uni-datetime-picker :disabled="isDetailMode" type="datetime" :start="startDate" :end="endDate"
|
|
55
|
64
|
v-model="formData.seizureTime" />
|
|
|
@@ -243,6 +252,7 @@ import { approvePass, approveReject, getApprovelHistory } from '@/api/approve/ap
|
|
243
|
252
|
import { getDeptList } from "@/api/system/dept/dept.js"
|
|
244
|
253
|
import { formatTime } from '@/utils/formatUtils'
|
|
245
|
254
|
import { getUserInfoById, getPostListsByUserId } from '@/api/system/user.js'
|
|
|
255
|
+import { getUserList } from '@/api/attendance/attendance'
|
|
246
|
256
|
export default {
|
|
247
|
257
|
components: { HomeContainer, SearchView },
|
|
248
|
258
|
mixins: [useDictMixin],
|
|
|
@@ -254,6 +264,10 @@ export default {
|
|
254
|
264
|
|
|
255
|
265
|
return (this.$store.state.user && this.$store.state.user.userInfo) ? this.$store.state.user.userInfo : {}
|
|
256
|
266
|
},
|
|
|
267
|
+ // 判断是否为kezhang角色
|
|
|
268
|
+ isKezhang() {
|
|
|
269
|
+ return this.$store?.state?.user?.roles?.includes('kezhang')
|
|
|
270
|
+ },
|
|
257
|
271
|
// 将item_check_method_options转换为字符串数组供uni-combox使用
|
|
258
|
272
|
checkMethodCandidates() {
|
|
259
|
273
|
// console.log(this.item_check_method_options.map(item => item.postName || item.label || item.text || item.value),"this.item_check_method_options.map(item => item.postName || item.label || item.text || item.value)")
|
|
|
@@ -272,8 +286,8 @@ export default {
|
|
272
|
286
|
// 表单数据
|
|
273
|
287
|
formData: {
|
|
274
|
288
|
// 安检员信息
|
|
275
|
|
- inspectUserName: this.$store.state.user.name,
|
|
276
|
|
- inspectUserId: this.$store.state.user.id,
|
|
|
289
|
+ inspectUserName: this.isKezhang ? '' : this.$store.state.user.name,
|
|
|
290
|
+ inspectUserId: this.isKezhang ? '' : this.$store.state.user.id,
|
|
277
|
291
|
seizureTime: this.formatDateTime(new Date()),
|
|
278
|
292
|
securityLocation: '',
|
|
279
|
293
|
securityLocationText: '',
|
|
|
@@ -393,6 +407,7 @@ export default {
|
|
393
|
407
|
position_options: [], // 位置通道
|
|
394
|
408
|
teams: [],
|
|
395
|
409
|
item_category_options: [], // 物品分类
|
|
|
410
|
+ departmentUserOptions: [], // 部门人员选项(kezhang角色使用)
|
|
396
|
411
|
typeData: [],
|
|
397
|
412
|
item_unit_options: [],
|
|
398
|
413
|
check_point_options: [],
|
|
|
@@ -448,6 +463,12 @@ export default {
|
|
448
|
463
|
this.type = params?.type || 'add';
|
|
449
|
464
|
// }
|
|
450
|
465
|
await this.initPageData();
|
|
|
466
|
+
|
|
|
467
|
+ // 如果是kezhang角色,加载部门人员
|
|
|
468
|
+ if (this.isKezhang) {
|
|
|
469
|
+ await this.loadDepartmentUsers();
|
|
|
470
|
+ }
|
|
|
471
|
+
|
|
451
|
472
|
if (this.type == 'add') {
|
|
452
|
473
|
this.invokerGetLocationsbyTime()
|
|
453
|
474
|
}
|
|
|
@@ -810,6 +831,41 @@ export default {
|
|
810
|
831
|
return result;
|
|
811
|
832
|
},
|
|
812
|
833
|
|
|
|
834
|
+ // 加载部门人员(kezhang角色使用)
|
|
|
835
|
+ async loadDepartmentUsers() {
|
|
|
836
|
+ if (!this.isKezhang) return;
|
|
|
837
|
+
|
|
|
838
|
+ try {
|
|
|
839
|
+ const currentUserInfo = this.userInfo || {};
|
|
|
840
|
+ const currentUserDeptId = currentUserInfo.departmentId || currentUserInfo.deptId;
|
|
|
841
|
+
|
|
|
842
|
+ if (!currentUserDeptId) {
|
|
|
843
|
+ console.warn('无法获取当前用户的部门ID');
|
|
|
844
|
+ return;
|
|
|
845
|
+ }
|
|
|
846
|
+
|
|
|
847
|
+ const response = await getUserList({
|
|
|
848
|
+ deptId: currentUserDeptId,
|
|
|
849
|
+ status: '0',
|
|
|
850
|
+ pageSize: 1000
|
|
|
851
|
+ });
|
|
|
852
|
+
|
|
|
853
|
+ if (response && response.code === 200) {
|
|
|
854
|
+ this.departmentUserOptions = (response.rows || []).map(user => ({
|
|
|
855
|
+ value: user.userId,
|
|
|
856
|
+ text: user.nickName || user.userName
|
|
|
857
|
+ }));
|
|
|
858
|
+ }
|
|
|
859
|
+ } catch (error) {
|
|
|
860
|
+ console.error('获取部门人员失败:', error);
|
|
|
861
|
+ uni.showToast({
|
|
|
862
|
+ title: '获取部门人员失败',
|
|
|
863
|
+ icon: 'none',
|
|
|
864
|
+ duration: 2000
|
|
|
865
|
+ });
|
|
|
866
|
+ }
|
|
|
867
|
+ },
|
|
|
868
|
+
|
|
813
|
869
|
// 选择文件后手动上传
|
|
814
|
870
|
async onSelect(event) {
|
|
815
|
871
|
// 由于限制只能上传1个文件,直接取第一个文件进行上传
|
|
|
@@ -1004,6 +1060,14 @@ export default {
|
|
1004
|
1060
|
this.formData.partTypeText = e.detail.value[1].text;
|
|
1005
|
1061
|
},
|
|
1006
|
1062
|
|
|
|
1063
|
+ // 安检员选择变化(kezhang角色使用)
|
|
|
1064
|
+ onInspectUserChange(e) {
|
|
|
1065
|
+ console.log("安检员选择变化", e.detail.value)
|
|
|
1066
|
+ const arr = e.detail.value || [];
|
|
|
1067
|
+ this.formData.inspectUserId = arr[arr.length - 1]?.value || '';
|
|
|
1068
|
+ this.formData.inspectUserName = arr.map(item => item.text).join('/');
|
|
|
1069
|
+ },
|
|
|
1070
|
+
|
|
1007
|
1071
|
// 部位类型变化
|
|
1008
|
1072
|
onPartTypeChange(e) {
|
|
1009
|
1073
|
this.formData.partType = e.detail.value[0].value;
|