|
@@ -15,24 +15,19 @@
|
|
</view>
|
|
</view>
|
|
<view class="user-info uni-column" style="margin: 0 20rpx 20rpx 20rpx;width: 94%;">
|
|
<view class="user-info uni-column" style="margin: 0 20rpx 20rpx 20rpx;width: 94%;">
|
|
<uni-section title="当前厂别" type="square">
|
|
<uni-section title="当前厂别" type="square">
|
|
- <uni-data-select v-model="curSelectedTenant" :localdata="tenantList" :clear="false" @change="handleTenantChange"></uni-data-select>
|
|
|
|
|
|
+ <uni-data-select v-model="curSelectedTenantId" :localdata="tenantList" :clear="false" @change="handleTenantChange"></uni-data-select>
|
|
</uni-section>
|
|
</uni-section>
|
|
<uni-section title="当前工段" type="square">
|
|
<uni-section title="当前工段" type="square">
|
|
- <uni-data-select v-model="curSelectedDept" :localdata="userDeptsByTenantId" :clear="false" @change="handleDeptChange"></uni-data-select>
|
|
|
|
|
|
+ <uni-data-select v-model="curSelectedDeptId" :localdata="userDeptsByTenantId" :clear="false" @change="handleDeptChange"></uni-data-select>
|
|
</uni-section>
|
|
</uni-section>
|
|
</view>
|
|
</view>
|
|
<!-- <view class="business-btn uni-row" v-if="showOther" @click="handleRecerptSfprod"><text class="label">半成品接收</text></view> -->
|
|
<!-- <view class="business-btn uni-row" v-if="showOther" @click="handleRecerptSfprod"><text class="label">半成品接收</text></view> -->
|
|
- <view class="business-btn uni-row" v-if="showOther" @click="handeleToReportHistory"><text
|
|
|
|
- class="label">我的报工</text></view>
|
|
|
|
- <view v-if="showQuick" class="business-btn uni-row" @click="handleFastToProductionPlan"><text
|
|
|
|
- class="label">快速报工</text></view>
|
|
|
|
- <view class="business-btn uni-row" v-if="showOther" @click="handleToProductionPlan"><text
|
|
|
|
- class="label">报工</text></view>
|
|
|
|
<view class="business-btn uni-row" v-if="showOther" @click="handeleToReportHistory">
|
|
<view class="business-btn uni-row" v-if="showOther" @click="handeleToReportHistory">
|
|
<text class="label">我的报工</text>
|
|
<text class="label">我的报工</text>
|
|
</view>
|
|
</view>
|
|
- <!-- <view v-if="showQuick" class="business-btn uni-row" @click="handleFastToProductionPlan"><text
|
|
|
|
- class="label">快速报工</text></view> -->
|
|
|
|
|
|
+ <view v-if="showQuick" class="business-btn uni-row" @click="handleFastToProductionPlan">
|
|
|
|
+ <text class="label">快速报工</text>
|
|
|
|
+ </view>
|
|
<view class="business-btn uni-row" v-if="showOther" @click="handleToProductionPlan">
|
|
<view class="business-btn uni-row" v-if="showOther" @click="handleToProductionPlan">
|
|
<text class="label">报工</text>
|
|
<text class="label">报工</text>
|
|
</view>
|
|
</view>
|
|
@@ -73,8 +68,8 @@
|
|
|
|
|
|
|
|
|
|
const userName = ref('') // 用户名
|
|
const userName = ref('') // 用户名
|
|
- const curSelectedDept = ref(null) // 用户当前选择的工段
|
|
|
|
- const curSelectedTenant = ref(null) // 用户当前选择的厂别
|
|
|
|
|
|
+ const curSelectedDeptId = ref(null) // 用户当前选择的工段
|
|
|
|
+ const curSelectedTenantId = ref(null) // 用户当前选择的厂别
|
|
const userInfo = ref({}) // 用户信息
|
|
const userInfo = ref({}) // 用户信息
|
|
const tenantList = ref([]) // 厂别列表
|
|
const tenantList = ref([]) // 厂别列表
|
|
const userDeptList = ref([]) // 用户所在所有工段列表
|
|
const userDeptList = ref([]) // 用户所在所有工段列表
|
|
@@ -102,15 +97,63 @@
|
|
init();
|
|
init();
|
|
})
|
|
})
|
|
|
|
|
|
|
|
+ /******************************** 定义一些方法 ********************************/
|
|
function init() {
|
|
function init() {
|
|
getTenant();
|
|
getTenant();
|
|
getUserDepts(store.userInfo.userId, store.tenantId);
|
|
getUserDepts(store.userInfo.userId, store.tenantId);
|
|
- getDeptsByTenantId(store.tenantId);
|
|
|
|
|
|
+ //getUserDeptsByTenantId(store.tenantId);
|
|
|
|
+ }
|
|
|
|
+ // 获取租户列表
|
|
|
|
+ function getTenant() {
|
|
|
|
+ getTenantList().then((res) => {
|
|
|
|
+ if (res.code == 200) {
|
|
|
|
+ for (var i = 0; i < res.rows.length; i++) {
|
|
|
|
+ tenantList.value[i] = {
|
|
|
|
+ text: res.rows[i].orgName,
|
|
|
|
+ value: res.rows[i].id
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ curSelectedTenantId.value = store.userInfo.tenantId;
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ // 获取人员工段
|
|
|
|
+ function getUserDepts(userId, tenantId) {
|
|
|
|
+ userDeptsByTenantId.value = []
|
|
|
|
+ getUserDeptList(userId).then((res) => {
|
|
|
|
+ if (res.code == 200) {
|
|
|
|
+ userDeptList.value = res.data;
|
|
|
|
+ for (let i = 0; i < res.data.length; i++) {
|
|
|
|
+ if (res.data[i].tenantId == tenantId) {
|
|
|
|
+ userDeptsByTenantId.value[i] = {
|
|
|
|
+ text: res.data[i].deptName,
|
|
|
|
+ value: res.data[i].deptId
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (res.data.some(v => v.hasQuick === 1)) {
|
|
|
|
+ showQuick.value = true
|
|
|
|
+ } else {
|
|
|
|
+ showQuick.value = false
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ // 根据租户id获取到工段
|
|
|
|
+ function getUserDeptsByTenantId(tenantId) {
|
|
|
|
+ userDeptsByTenantId.value = [];
|
|
|
|
+ let newArr = userDeptList.value.filter((item, index, arrs) => item.tenantId == tenantId);
|
|
|
|
+ for (var i = 0; i < newArr.length; i++) {
|
|
|
|
+ userDeptsByTenantId.value[i] = {
|
|
|
|
+ text: newArr[i].deptName,
|
|
|
|
+ value: newArr[i].deptId
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
/*
|
|
/*
|
|
// 半成品接收
|
|
// 半成品接收
|
|
function handleRecerptSfprod() {
|
|
function handleRecerptSfprod() {
|
|
- if (curSelectedDept.value) {
|
|
|
|
|
|
+ if (curSelectedDeptId.value) {
|
|
uni.navigateTo({
|
|
uni.navigateTo({
|
|
url: '/pages/recerptSfprod/index'
|
|
url: '/pages/recerptSfprod/index'
|
|
})
|
|
})
|
|
@@ -130,7 +173,7 @@
|
|
}
|
|
}
|
|
|
|
|
|
function handleFastToProductionPlan() {
|
|
function handleFastToProductionPlan() {
|
|
- if (curSelectedDept.value) {
|
|
|
|
|
|
+ if (curSelectedDeptId.value) {
|
|
uni.navigateTo({
|
|
uni.navigateTo({
|
|
url: '/pages/fastProductionPlan/index'
|
|
url: '/pages/fastProductionPlan/index'
|
|
})
|
|
})
|
|
@@ -143,7 +186,7 @@
|
|
}
|
|
}
|
|
|
|
|
|
function handleToProductionPlan() {
|
|
function handleToProductionPlan() {
|
|
- if (curSelectedDept.value) {
|
|
|
|
|
|
+ if (curSelectedDeptId.value) {
|
|
uni.navigateTo({
|
|
uni.navigateTo({
|
|
url: '/pages/productionPlan/index'
|
|
url: '/pages/productionPlan/index'
|
|
})
|
|
})
|
|
@@ -181,79 +224,17 @@
|
|
}
|
|
}
|
|
*/
|
|
*/
|
|
|
|
|
|
- function getUserDepts(userId, tenantId) {
|
|
|
|
- getUserDeptList(userId).then((res) => {
|
|
|
|
- // console.log(res)
|
|
|
|
- if (res.code == 200) {
|
|
|
|
- userDeptList.value = res.data;
|
|
|
|
- for (let i = 0; i < res.data.length; i++) {
|
|
|
|
- if (res.data[i].tenantId == tenantId) {
|
|
|
|
- userDeptsByTenantId.value[i] = {
|
|
|
|
- text: res.data[i].deptName,
|
|
|
|
- value: res.data[i]
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- console.log(res.data)
|
|
|
|
- if (res.data.some(v => v.hasQuick === 1)) {
|
|
|
|
- showQuick.value = true
|
|
|
|
- } else {
|
|
|
|
- showQuick.value = false
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- // 选择工段来个默认值
|
|
|
|
- // if(res.data.length > 0){
|
|
|
|
- // curSelectedDept.value = res.data[0];
|
|
|
|
- // }
|
|
|
|
- // store.curDeptDetails = curSelectedDept.value;
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- function getDeptsByTenantId(tenantId) {
|
|
|
|
- userDeptsByTenantId.value = [];
|
|
|
|
- let newArr = userDeptList.value.filter((item, index, arrs) => item.tenantId == tenantId);
|
|
|
|
- // curSelectedDept.value = newArr.length > 0 ? newArr[0].deptId : null;
|
|
|
|
- for (var i = 0; i < newArr.length; i++) {
|
|
|
|
- userDeptsByTenantId.value[i] = {
|
|
|
|
- text: newArr[i].deptName,
|
|
|
|
- value: newArr[i]
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- // if(userDeptsByTenantId.value.length == 0){
|
|
|
|
- // store.curDeptDetails = 0;
|
|
|
|
- // }else{
|
|
|
|
- // store.curDeptDetails = userDeptsByTenantId.value[0].value;
|
|
|
|
- // }
|
|
|
|
- console.log(userDeptsByTenantId.value);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- function getTenant() {
|
|
|
|
- getTenantList().then((res) => {
|
|
|
|
- if (res.code == 200) {
|
|
|
|
- for (var i = 0; i < res.rows.length; i++) {
|
|
|
|
- tenantList.value[i] = {
|
|
|
|
- text: res.rows[i].orgName,
|
|
|
|
- value: res.rows[i].id
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- curSelectedTenant.value = store.userInfo.tenantId;
|
|
|
|
- console.log(curSelectedTenant.value)
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
|
|
|
|
function handleTenantChange() {
|
|
function handleTenantChange() {
|
|
- store.tenantId = curSelectedTenant.value;
|
|
|
|
- curSelectedDept.value = null;
|
|
|
|
- getDeptsByTenantId(store.tenantId);
|
|
|
|
|
|
+ console.log(curSelectedTenantId)
|
|
|
|
+ store.tenantId = curSelectedTenantId.value
|
|
|
|
+ curSelectedDeptId.value = null
|
|
|
|
+ getUserDeptsByTenantId(store.tenantId)
|
|
}
|
|
}
|
|
|
|
|
|
function handleDeptChange() {
|
|
function handleDeptChange() {
|
|
- console.log('handleDeptChange')
|
|
|
|
- return
|
|
|
|
- store.curDeptDetails = curSelectedDept.value;
|
|
|
|
- // console.log(store.curDeptDetails)
|
|
|
|
|
|
+ let curDept = userDeptList.value.find(item => item.deptId === curSelectedDeptId.value)
|
|
|
|
+ store.curDeptDetails = curDept
|
|
}
|
|
}
|
|
</script>
|
|
</script>
|
|
|
|
|