|
@@ -20,9 +20,9 @@
|
|
|
{{ formData.institution || '请选择任务归属' }}
|
|
{{ formData.institution || '请选择任务归属' }}
|
|
|
<image class="icon" src="/static/image/icon_more.png"></image>
|
|
<image class="icon" src="/static/image/icon_more.png"></image>
|
|
|
</view> -->
|
|
</view> -->
|
|
|
- <view class="form-input picker-input" :class="{ placeholder: !formData.institution }"
|
|
|
|
|
|
|
+ <view class="form-input picker-input" :class="{ placeholder: !formData.deptId }"
|
|
|
@click="showPicker('任务归属',companyData)">
|
|
@click="showPicker('任务归属',companyData)">
|
|
|
- {{ formData.institution || '请选择任务归属' }}
|
|
|
|
|
|
|
+ {{ institutionDisplayText || '请选择任务归属' }}
|
|
|
<image class="icon" src="/static/image/icon_more.png"></image>
|
|
<image class="icon" src="/static/image/icon_more.png"></image>
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
@@ -32,30 +32,20 @@
|
|
|
<text class="required">*</text>
|
|
<text class="required">*</text>
|
|
|
<text>归属项目</text>
|
|
<text>归属项目</text>
|
|
|
</view>
|
|
</view>
|
|
|
- <view class="form-input picker-input" :class="{ placeholder: !formData.belongingProject }"
|
|
|
|
|
|
|
+ <view class="form-input picker-input" :class="{ placeholder: !formData.projectId }"
|
|
|
@click="showPicker('归属项目',companyList)">
|
|
@click="showPicker('归属项目',companyList)">
|
|
|
- {{ formData.belongingProject || '请选择归属项目' }}
|
|
|
|
|
|
|
+ {{ belongingProjectDisplayText || '请选择归属项目' }}
|
|
|
<image class="icon" src="/static/image/icon_more.png"></image>
|
|
<image class="icon" src="/static/image/icon_more.png"></image>
|
|
|
</view>
|
|
</view>
|
|
|
- <!-- <view class="form-input picker-input" :class="{ placeholder: !formData.belongingProject }"
|
|
|
|
|
- @click="showBelongingPopup = true">
|
|
|
|
|
- {{ formData.belongingProject || '请选择归属项目' }}
|
|
|
|
|
- <image class="icon" src="/static/image/icon_more.png"></image>
|
|
|
|
|
- </view> -->
|
|
|
|
|
</view>
|
|
</view>
|
|
|
-<view class="form-item">
|
|
|
|
|
|
|
+ <view class="form-item">
|
|
|
<view class="form-label">
|
|
<view class="form-label">
|
|
|
<text class="required">*</text>
|
|
<text class="required">*</text>
|
|
|
<text>产品代码</text>
|
|
<text>产品代码</text>
|
|
|
</view>
|
|
</view>
|
|
|
- <!-- <view class="form-input picker-input" :class="{ placeholder: !formData.institution }"
|
|
|
|
|
- @click="showTaskPopup=true">
|
|
|
|
|
- {{ formData.institution || '请选择任务归属' }}
|
|
|
|
|
- <image class="icon" src="/static/image/icon_more.png"></image>
|
|
|
|
|
- </view> -->
|
|
|
|
|
- <view class="form-input picker-input" :class="{ placeholder: !formData.productCode }"
|
|
|
|
|
|
|
+ <view class="form-input picker-input" :class="{ placeholder: !formData.productId }"
|
|
|
@click="showPicker('产品代码',productList)">
|
|
@click="showPicker('产品代码',productList)">
|
|
|
- {{ formData.productCode || '请选择产品代码' }}
|
|
|
|
|
|
|
+ {{ productNameDisplayText || '请选择产品代码' }}
|
|
|
<image class="icon" src="/static/image/icon_more.png"></image>
|
|
<image class="icon" src="/static/image/icon_more.png"></image>
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
@@ -64,9 +54,9 @@
|
|
|
<text class="required">*</text>
|
|
<text class="required">*</text>
|
|
|
<text>费用分摊</text>
|
|
<text>费用分摊</text>
|
|
|
</view>
|
|
</view>
|
|
|
- <view class="form-input picker-input" :class="{ placeholder: !formData.costAllocation }"
|
|
|
|
|
|
|
+ <view class="form-input picker-input" :class="{ placeholder: !formData.costShareId }"
|
|
|
@click="showPicker('费用分摊',companyData)">
|
|
@click="showPicker('费用分摊',companyData)">
|
|
|
- {{ formData.costAllocation || '请选择费用分摊主体' }}
|
|
|
|
|
|
|
+ {{ costAllocationDisplayText || '请选择费用分摊主体' }}
|
|
|
<image class="icon" src="/static/image/icon_more.png"></image>
|
|
<image class="icon" src="/static/image/icon_more.png"></image>
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
@@ -83,7 +73,11 @@
|
|
|
<text class="required">*</text>
|
|
<text class="required">*</text>
|
|
|
<text>归属类型</text>
|
|
<text>归属类型</text>
|
|
|
</view>
|
|
</view>
|
|
|
- <text class="txt">院内</text>
|
|
|
|
|
|
|
+ <view class="form-input picker-input" :class="{ placeholder: !formData.belongType }"
|
|
|
|
|
+ @click="showPicker('归属类型',dictTypeColumns)">
|
|
|
|
|
+ {{ belongTypeDisplayText || '请选择归属类型' }}
|
|
|
|
|
+ <image class="icon" src="/static/image/icon_more.png"></image>
|
|
|
|
|
+ </view>
|
|
|
</view>
|
|
</view>
|
|
|
|
|
|
|
|
<view class="form-item">
|
|
<view class="form-item">
|
|
@@ -93,7 +87,7 @@
|
|
|
</view>
|
|
</view>
|
|
|
<view class="form-input picker-input" :class="{ placeholder: !formData.taskType }"
|
|
<view class="form-input picker-input" :class="{ placeholder: !formData.taskType }"
|
|
|
@click="showPicker('任务类型',taskTypeColumns)">
|
|
@click="showPicker('任务类型',taskTypeColumns)">
|
|
|
- {{ formData.taskType || '请选择任务类型' }}
|
|
|
|
|
|
|
+ {{ taskTypeDisplayText || '请选择任务类型' }}
|
|
|
<image class="icon" src="/static/image/icon_more.png"></image>
|
|
<image class="icon" src="/static/image/icon_more.png"></image>
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
@@ -103,12 +97,11 @@
|
|
|
<text class="required">*</text>
|
|
<text class="required">*</text>
|
|
|
<text>计划开始时间</text>
|
|
<text>计划开始时间</text>
|
|
|
</view>
|
|
</view>
|
|
|
- <picker mode="date" :value="formData.planStartTime" fields="day" @change="onPlanStartTimeChange">
|
|
|
|
|
- <view class="form-input picker-input" :class="{ placeholder: !formData.planStartTime }">
|
|
|
|
|
- {{ formData.planStartTime || '请选择计划开始时间' }}
|
|
|
|
|
- <image class="icon" src="/static/image/icon_more.png"></image>
|
|
|
|
|
- </view>
|
|
|
|
|
- </picker>
|
|
|
|
|
|
|
+ <view class="form-input picker-input" :class="{ placeholder: !formData.planStartTime }"
|
|
|
|
|
+ @click="showStartTimePicker = true">
|
|
|
|
|
+ {{ formData.planStartTime || '请选择计划开始时间' }}
|
|
|
|
|
+ <image class="icon" src="/static/image/icon_more.png"></image>
|
|
|
|
|
+ </view>
|
|
|
</view>
|
|
</view>
|
|
|
|
|
|
|
|
<view class="form-item">
|
|
<view class="form-item">
|
|
@@ -116,12 +109,11 @@
|
|
|
<text class="required">*</text>
|
|
<text class="required">*</text>
|
|
|
<text>计划结束时间</text>
|
|
<text>计划结束时间</text>
|
|
|
</view>
|
|
</view>
|
|
|
- <picker mode="date" :value="formData.planEndTime" fields="day" @change="onPlanEndTimeChange">
|
|
|
|
|
- <view class="form-input picker-input" :class="{ placeholder: !formData.planEndTime }">
|
|
|
|
|
- {{ formData.planEndTime || '请选择计划结束时间' }}
|
|
|
|
|
- <image class="icon" src="/static/image/icon_more.png"></image>
|
|
|
|
|
- </view>
|
|
|
|
|
- </picker>
|
|
|
|
|
|
|
+ <view class="form-input picker-input" :class="{ placeholder: !formData.planEndTime }"
|
|
|
|
|
+ @click="showEndTimePicker = true">
|
|
|
|
|
+ {{ formData.planEndTime || '请选择计划结束时间' }}
|
|
|
|
|
+ <image class="icon" src="/static/image/icon_more.png"></image>
|
|
|
|
|
+ </view>
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
|
</scroll-view>
|
|
</scroll-view>
|
|
@@ -130,6 +122,14 @@
|
|
|
:columns="pickerData" @confirm="confirm" @cancel="cancel">
|
|
:columns="pickerData" @confirm="confirm" @cancel="cancel">
|
|
|
</u-picker>
|
|
</u-picker>
|
|
|
|
|
|
|
|
|
|
+ <u-datetime-picker :show="showStartTimePicker" v-model="startTimeValue" mode="date"
|
|
|
|
|
+ confirmColor='#576B95' @confirm="onStartTimeConfirm" @cancel="showStartTimePicker = false">
|
|
|
|
|
+ </u-datetime-picker>
|
|
|
|
|
+
|
|
|
|
|
+ <u-datetime-picker :show="showEndTimePicker" v-model="endTimeValue" mode="date"
|
|
|
|
|
+ confirmColor='#576B95' @confirm="onEndTimeConfirm" @cancel="showEndTimePicker = false">
|
|
|
|
|
+ </u-datetime-picker>
|
|
|
|
|
+
|
|
|
<u-popup :show="showBelongingPopup" mode="bottom" round="20" @close="closePopup" closeable>
|
|
<u-popup :show="showBelongingPopup" mode="bottom" round="20" @close="closePopup" closeable>
|
|
|
<view class="popup-content p32">
|
|
<view class="popup-content p32">
|
|
|
<view class="popup-header">
|
|
<view class="popup-header">
|
|
@@ -204,7 +204,9 @@ import utils from '@/utils/common.js'
|
|
|
return {
|
|
return {
|
|
|
taskTypeDict:[],//任务类型字典
|
|
taskTypeDict:[],//任务类型字典
|
|
|
taskType:[],//任务类型
|
|
taskType:[],//任务类型
|
|
|
|
|
+ taskTypeOriginalData:[],//任务类型原始数据(包含dictLabel和dictValue)
|
|
|
companyList:[],//归属项目
|
|
companyList:[],//归属项目
|
|
|
|
|
+ projectData:[],//项目数据(持久化存储)
|
|
|
productList:[],//产品列表
|
|
productList:[],//产品列表
|
|
|
companyData:[],
|
|
companyData:[],
|
|
|
userInfo:{},
|
|
userInfo:{},
|
|
@@ -250,7 +252,7 @@ import utils from '@/utils/common.js'
|
|
|
['主体1', '主体2', '主体3'],
|
|
['主体1', '主体2', '主体3'],
|
|
|
],
|
|
],
|
|
|
taskTypeColumns: [
|
|
taskTypeColumns: [
|
|
|
- ['类型1', '类型2', '类型3'],
|
|
|
|
|
|
|
+ // ['类型1', '类型2', '类型3'],
|
|
|
],
|
|
],
|
|
|
currentStep: 1,
|
|
currentStep: 1,
|
|
|
currentText: [{
|
|
currentText: [{
|
|
@@ -271,28 +273,32 @@ import utils from '@/utils/common.js'
|
|
|
],
|
|
],
|
|
|
rejectionInfo: '',
|
|
rejectionInfo: '',
|
|
|
formData: {
|
|
formData: {
|
|
|
- costAllocation: '',
|
|
|
|
|
|
|
+ costShareId: '',
|
|
|
planStartTime: '',
|
|
planStartTime: '',
|
|
|
planEndTime: '',
|
|
planEndTime: '',
|
|
|
- institution: '',
|
|
|
|
|
|
|
+ belongType: '',
|
|
|
deptId: '',
|
|
deptId: '',
|
|
|
- belongingProject: '',
|
|
|
|
|
|
|
+ projectId: '',
|
|
|
productId: '',
|
|
productId: '',
|
|
|
- productCode: '',
|
|
|
|
|
- productCodeValue: '',
|
|
|
|
|
taskType: '',
|
|
taskType: '',
|
|
|
addRemark: false
|
|
addRemark: false
|
|
|
},
|
|
},
|
|
|
originalCompanyData: null,
|
|
originalCompanyData: null,
|
|
|
pickerTitle: '默认标题',
|
|
pickerTitle: '默认标题',
|
|
|
pickerData: [],
|
|
pickerData: [],
|
|
|
- companyId:''
|
|
|
|
|
|
|
+ companyId:'',
|
|
|
|
|
+ showStartTimePicker: false,
|
|
|
|
|
+ showEndTimePicker: false,
|
|
|
|
|
+ startTimeValue: new Date(),
|
|
|
|
|
+ endTimeValue: new Date(),
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
onLoad: async function(options) {
|
|
onLoad: async function(options) {
|
|
|
try {
|
|
try {
|
|
|
this.taskTypeDict = await utils.getDicts("task_type");//任务类型
|
|
this.taskTypeDict = await utils.getDicts("task_type");//任务类型
|
|
|
|
|
+ this.belongTypeList = await utils.getDicts("task_belong_type");//任务类型
|
|
|
|
|
|
|
|
} catch (e) {
|
|
} catch (e) {
|
|
|
console.log('获取字典数据失败:', e)
|
|
console.log('获取字典数据失败:', e)
|
|
@@ -303,63 +309,93 @@ import utils from '@/utils/common.js'
|
|
|
if (options.rejectionInfo) {
|
|
if (options.rejectionInfo) {
|
|
|
this.rejectionInfo = decodeURIComponent(options.rejectionInfo)
|
|
this.rejectionInfo = decodeURIComponent(options.rejectionInfo)
|
|
|
}
|
|
}
|
|
|
- // 初始化二级选项
|
|
|
|
|
- this.currentSecondaryOptions = this.primaryOptions[0]?.children || []
|
|
|
|
|
// 获取用户信息
|
|
// 获取用户信息
|
|
|
const userInfoStr = uni.getStorageSync('userInfo')
|
|
const userInfoStr = uni.getStorageSync('userInfo')
|
|
|
this.userInfo = userInfoStr ? JSON.parse(userInfoStr) : {}
|
|
this.userInfo = userInfoStr ? JSON.parse(userInfoStr) : {}
|
|
|
console.log(this.userInfo);
|
|
console.log(this.userInfo);
|
|
|
// 加载信息
|
|
// 加载信息
|
|
|
this.companyId = this.userInfo.companyId || 1
|
|
this.companyId = this.userInfo.companyId || 1
|
|
|
|
|
+ // 设置默认日期为当天
|
|
|
|
|
+ this.formData.planStartTime = this.formatDateTime(new Date());
|
|
|
|
|
+ this.formData.planEndTime = this.formatDateTime(new Date());
|
|
|
|
|
+
|
|
|
},
|
|
},
|
|
|
- // onLoad(options) {
|
|
|
|
|
- // this.userInfo=JSON.parse(uni.getStorageSync("userInfo"))||''
|
|
|
|
|
- // if (options.rejectionInfo) {
|
|
|
|
|
- // this.rejectionInfo = decodeURIComponent(options.rejectionInfo)
|
|
|
|
|
- // }
|
|
|
|
|
- // // 初始化二级选项
|
|
|
|
|
- // this.currentSecondaryOptions = this.primaryOptions[0]?.children || []
|
|
|
|
|
- // // 获取用户信息
|
|
|
|
|
- // const userInfoStr = uni.getStorageSync('userInfo')
|
|
|
|
|
- // this.userInfo = userInfoStr ? JSON.parse(userInfoStr) : {}
|
|
|
|
|
- // console.log(this.userInfo);
|
|
|
|
|
- // // 加载信息
|
|
|
|
|
- // this.companyId = this.userInfo.companyId || 1
|
|
|
|
|
-
|
|
|
|
|
- // },
|
|
|
|
|
|
|
+
|
|
|
computed: {
|
|
computed: {
|
|
|
- filteredProjects() {
|
|
|
|
|
- if (!this.searchKeyword.trim()) {
|
|
|
|
|
- return this.belongingprojects;
|
|
|
|
|
|
|
+ taskTypeDisplayText() {
|
|
|
|
|
+ console.log('计算taskTypeDisplayText, formData.taskType:', this.formData.taskType);
|
|
|
|
|
+ console.log('计算taskTypeDisplayText, taskTypeOriginalData:', this.taskTypeOriginalData);
|
|
|
|
|
+ if (!this.formData.taskType || !this.taskTypeOriginalData) {
|
|
|
|
|
+ return '';
|
|
|
|
|
+ }
|
|
|
|
|
+ const selectedType = this.taskTypeOriginalData.find(item => item.dictValue === this.formData.taskType);
|
|
|
|
|
+ console.log('找到的selectedType:', selectedType);
|
|
|
|
|
+ return selectedType ? selectedType.dictLabel : '';
|
|
|
|
|
+ },
|
|
|
|
|
+ institutionDisplayText() {
|
|
|
|
|
+ if (!this.formData.deptId || !this.originalCompanyData) {
|
|
|
|
|
+ return '';
|
|
|
|
|
+ }
|
|
|
|
|
+ const selectedItem = this.originalCompanyData.find(item => item.deptId === this.formData.deptId);
|
|
|
|
|
+ return selectedItem ? selectedItem.deptName : '';
|
|
|
|
|
+ },
|
|
|
|
|
+ costAllocationDisplayText() {
|
|
|
|
|
+ if (!this.formData.costShareId || !this.originalCompanyData) {
|
|
|
|
|
+ return '';
|
|
|
|
|
+ }
|
|
|
|
|
+ const selectedItem = this.originalCompanyData.find(item => item.deptId === this.formData.costShareId);
|
|
|
|
|
+ return selectedItem ? selectedItem.deptName : '';
|
|
|
|
|
+ },
|
|
|
|
|
+ belongingProjectDisplayText() {
|
|
|
|
|
+ console.log('计算belongingProjectDisplayText:', this.formData.projectId, this.projectData);
|
|
|
|
|
+ if (!this.formData.projectId || !this.projectData) {
|
|
|
|
|
+ console.log('formData.projectId或projectData为空');
|
|
|
|
|
+ return '';
|
|
|
|
|
+ }
|
|
|
|
|
+ const selectedItem = this.projectData.find(item => item.id === this.formData.projectId);
|
|
|
|
|
+ console.log('找到的项目:', selectedItem);
|
|
|
|
|
+ return selectedItem ? selectedItem.projectName : '';
|
|
|
|
|
+ },
|
|
|
|
|
+ productNameDisplayText() {
|
|
|
|
|
+ if (!this.formData.productId || !this.productList) {
|
|
|
|
|
+ return '';
|
|
|
|
|
+ }
|
|
|
|
|
+ const selectedItem = this.productList.find(item => item.id === this.formData.productId);
|
|
|
|
|
+ return selectedItem ? selectedItem.productName : '';
|
|
|
|
|
+ },
|
|
|
|
|
+ belongTypeDisplayText() {
|
|
|
|
|
+ if (!this.formData.belongType || !this.belongTypeList) {
|
|
|
|
|
+ return '';
|
|
|
|
|
+ }
|
|
|
|
|
+ const selectedItem = this.belongTypeList.find(item => item.dictValue === this.formData.belongType);
|
|
|
|
|
+ return selectedItem ? selectedItem.dictLabel : '';
|
|
|
}
|
|
}
|
|
|
- return this.belongingprojects.filter(project =>
|
|
|
|
|
- project.name.includes(this.searchKeyword)
|
|
|
|
|
- );
|
|
|
|
|
- }
|
|
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
|
//任务类型
|
|
//任务类型
|
|
|
queryAllData(){
|
|
queryAllData(){
|
|
|
- if(!this.id){
|
|
|
|
|
- uni.showToast({
|
|
|
|
|
- title: '请先选择产品',
|
|
|
|
|
- icon: 'none'
|
|
|
|
|
- })
|
|
|
|
|
- return
|
|
|
|
|
- }
|
|
|
|
|
- let data={
|
|
|
|
|
- companyId:this.userInfo.companyId||'',
|
|
|
|
|
- deptId:this.formData.deptId||'',
|
|
|
|
|
- productId:this.id||'',
|
|
|
|
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
|
|
+ if(!this.formData.productId){
|
|
|
|
|
+ uni.showToast({
|
|
|
|
|
+ title: '请先选择产品',
|
|
|
|
|
+ icon: 'none'
|
|
|
|
|
+ })
|
|
|
|
|
+ resolve();
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ let data={
|
|
|
|
|
+ companyId:this.userInfo.companyId||'',
|
|
|
|
|
+ deptId:this.formData.deptId||'',
|
|
|
|
|
+ productId:this.formData.productId||'',
|
|
|
|
|
|
|
|
- }
|
|
|
|
|
- queryAllData(data).then(res => {
|
|
|
|
|
- if (res.code === 200) {
|
|
|
|
|
- // 处理任务类型
|
|
|
|
|
- this.taskType = res.data || []
|
|
|
|
|
- console.log('company接口返回数据:', res)
|
|
|
|
|
-
|
|
|
|
|
- // 处理taskTypeIds,获取对应的字典数据
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+ queryAllData(data).then(res => {
|
|
|
|
|
+ if (res.code === 200) {
|
|
|
|
|
+ // 处理任务类型
|
|
|
|
|
+ this.taskType = res.data || []
|
|
|
|
|
+ console.log('company接口返回数据:', res)
|
|
|
|
|
+
|
|
|
|
|
+ // 处理taskTypeIds,获取对应的字典数据
|
|
|
if (res.data && res.data.length > 0) {
|
|
if (res.data && res.data.length > 0) {
|
|
|
const firstData = res.data[0];
|
|
const firstData = res.data[0];
|
|
|
if (firstData.taskTypeIds) {
|
|
if (firstData.taskTypeIds) {
|
|
@@ -369,15 +405,21 @@ import utils from '@/utils/common.js'
|
|
|
const filteredTaskTypes = this.taskTypeDict.filter(item =>
|
|
const filteredTaskTypes = this.taskTypeDict.filter(item =>
|
|
|
taskTypeIdsArray.includes(item.dictValue)
|
|
taskTypeIdsArray.includes(item.dictValue)
|
|
|
);
|
|
);
|
|
|
|
|
+ // 保存原始数据(包含dictLabel和dictValue)
|
|
|
|
|
+ this.taskTypeOriginalData = filteredTaskTypes;
|
|
|
// 提取dictLabel并放到taskTypeColumns中
|
|
// 提取dictLabel并放到taskTypeColumns中
|
|
|
const taskTypeLabels = filteredTaskTypes.map(item => item.dictLabel);
|
|
const taskTypeLabels = filteredTaskTypes.map(item => item.dictLabel);
|
|
|
this.taskTypeColumns = [taskTypeLabels];
|
|
this.taskTypeColumns = [taskTypeLabels];
|
|
|
console.log('处理后的taskTypeColumns:', this.taskTypeColumns);
|
|
console.log('处理后的taskTypeColumns:', this.taskTypeColumns);
|
|
|
|
|
+ console.log('任务类型原始数据:', this.taskTypeOriginalData);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
- }).catch(err => {
|
|
|
|
|
- console.error('获取任务类型失败:', err);
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+ resolve(res);
|
|
|
|
|
+ }).catch(err => {
|
|
|
|
|
+ console.error('获取任务类型失败:', err);
|
|
|
|
|
+ reject(err);
|
|
|
|
|
+ });
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
|
|
|
|
|
@@ -412,8 +454,11 @@ import utils from '@/utils/common.js'
|
|
|
if (res.code === 200) {
|
|
if (res.code === 200) {
|
|
|
// 处理公司项目设置列表数据
|
|
// 处理公司项目设置列表数据
|
|
|
this.companyList = res.data || []
|
|
this.companyList = res.data || []
|
|
|
|
|
+ // 保存项目数据用于显示
|
|
|
|
|
+ this.projectData = res.data || []
|
|
|
|
|
|
|
|
console.log('company接口返回数据:', res)
|
|
console.log('company接口返回数据:', res)
|
|
|
|
|
+ console.log('companyList数据结构:', this.companyList)
|
|
|
}
|
|
}
|
|
|
resolve(res);
|
|
resolve(res);
|
|
|
}).catch(err => {
|
|
}).catch(err => {
|
|
@@ -482,7 +527,7 @@ import utils from '@/utils/common.js'
|
|
|
handleConfirm() {
|
|
handleConfirm() {
|
|
|
if (this.selectedSecondaryItem) {
|
|
if (this.selectedSecondaryItem) {
|
|
|
const displayText = `${this.selectedPrimaryItem.name} > ${this.selectedSecondaryItem}`;
|
|
const displayText = `${this.selectedPrimaryItem.name} > ${this.selectedSecondaryItem}`;
|
|
|
- this.formData.institution = displayText;
|
|
|
|
|
|
|
+ this.formData.belongType = displayText;
|
|
|
this.showTaskPopup = false;
|
|
this.showTaskPopup = false;
|
|
|
} else {
|
|
} else {
|
|
|
uni.showToast({
|
|
uni.showToast({
|
|
@@ -516,16 +561,21 @@ import utils from '@/utils/common.js'
|
|
|
// 调用getAllData()获取归属项目数据
|
|
// 调用getAllData()获取归属项目数据
|
|
|
await this.getAllData();
|
|
await this.getAllData();
|
|
|
data = this.companyList;
|
|
data = this.companyList;
|
|
|
|
|
+ console.log('归属项目数据:', data);
|
|
|
} else if (title === '产品代码') {
|
|
} else if (title === '产品代码') {
|
|
|
// 调用queryAllProduct()获取产品代码数据
|
|
// 调用queryAllProduct()获取产品代码数据
|
|
|
await this.queryAllProduct();
|
|
await this.queryAllProduct();
|
|
|
data = this.productList;
|
|
data = this.productList;
|
|
|
- }else if (title === '任务类型') {
|
|
|
|
|
|
|
+ } else if (title === '任务类型') {
|
|
|
// queryAllData()获取任务类型数据
|
|
// queryAllData()获取任务类型数据
|
|
|
await this.queryAllData();
|
|
await this.queryAllData();
|
|
|
// 使用处理后的taskTypeColumns作为数据
|
|
// 使用处理后的taskTypeColumns作为数据
|
|
|
data = this.taskTypeColumns;
|
|
data = this.taskTypeColumns;
|
|
|
console.log('任务类型数据:', data);
|
|
console.log('任务类型数据:', data);
|
|
|
|
|
+ } else if (title === '归属类型') {
|
|
|
|
|
+ // 归属类型数据已经在onLoad中获取
|
|
|
|
|
+ data = this.belongTypeList;
|
|
|
|
|
+ console.log('归属类型数据:', data);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 处理任务归属和费用分摊数据,将deptStr作为显示文本
|
|
// 处理任务归属和费用分摊数据,将deptStr作为显示文本
|
|
@@ -544,52 +594,108 @@ import utils from '@/utils/common.js'
|
|
|
this.pickerData = [data.map(item => item.productName)]
|
|
this.pickerData = [data.map(item => item.productName)]
|
|
|
// 保存原始数据,用于后续获取productCode
|
|
// 保存原始数据,用于后续获取productCode
|
|
|
this.originalCompanyData = data
|
|
this.originalCompanyData = data
|
|
|
|
|
+ } else if (title === '归属类型' && data && data.length > 0) {
|
|
|
|
|
+ // 处理归属类型数据,将dictLabel作为显示文本
|
|
|
|
|
+ this.pickerData = [data.map(item => item.dictLabel)]
|
|
|
|
|
+ // 保存原始数据,用于后续获取dictType
|
|
|
|
|
+ this.originalCompanyData = data
|
|
|
} else {
|
|
} else {
|
|
|
this.pickerData = data
|
|
this.pickerData = data
|
|
|
this.originalCompanyData = null
|
|
this.originalCompanyData = null
|
|
|
}
|
|
}
|
|
|
this.pickerTitle = title
|
|
this.pickerTitle = title
|
|
|
|
|
+ console.log('打开picker, pickerTitle:', this.pickerTitle);
|
|
|
|
|
+ console.log('pickerData:', this.pickerData);
|
|
|
this.showPickerVisible = true
|
|
this.showPickerVisible = true
|
|
|
},
|
|
},
|
|
|
confirm(e) {
|
|
confirm(e) {
|
|
|
|
|
+ console.log('confirm事件返回值:', e);
|
|
|
|
|
+ console.log('pickerTitle:', this.pickerTitle);
|
|
|
|
|
+ console.log('e.value:', e.value);
|
|
|
if (e.value && e.value.length > 0) {
|
|
if (e.value && e.value.length > 0) {
|
|
|
if (this.pickerTitle === '费用分摊') {
|
|
if (this.pickerTitle === '费用分摊') {
|
|
|
- this.formData.costAllocation = e.value[0]
|
|
|
|
|
|
|
+ // e.value[0]是选中的文本值(deptStr)
|
|
|
|
|
+ const selectedDeptStr = e.value[0];
|
|
|
|
|
+ console.log('选中的费用分摊文本:', selectedDeptStr);
|
|
|
|
|
+ console.log('originalCompanyData:', this.originalCompanyData);
|
|
|
|
|
+ // 从originalCompanyData中找到对应的项
|
|
|
|
|
+ const selectedItem = this.originalCompanyData.find(item => item.deptStr === selectedDeptStr);
|
|
|
|
|
+ if (selectedItem) {
|
|
|
|
|
+ // 保存deptId到表单(存储id值)
|
|
|
|
|
+ this.formData.costShareId = selectedItem.deptId;
|
|
|
|
|
+ console.log('设置formData.costShareId为:', selectedItem.deptId);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.formData.costShareId = '';
|
|
|
|
|
+ console.log('未找到对应的费用分摊');
|
|
|
|
|
+ }
|
|
|
} else if (this.pickerTitle === '任务类型') {
|
|
} else if (this.pickerTitle === '任务类型') {
|
|
|
- this.formData.taskType = e.value[0]
|
|
|
|
|
|
|
+ // e.value[0]是选中的文本值(dictLabel)
|
|
|
|
|
+ const selectedLabel = e.value[0];
|
|
|
|
|
+ console.log('选中的任务类型文本:', selectedLabel);
|
|
|
|
|
+ console.log('taskTypeOriginalData:', this.taskTypeOriginalData);
|
|
|
|
|
+ // 从taskTypeOriginalData中找到对应的项
|
|
|
|
|
+ const selectedType = this.taskTypeOriginalData.find(item => item.dictLabel === selectedLabel);
|
|
|
|
|
+ if (selectedType) {
|
|
|
|
|
+ this.formData.taskType = selectedType.dictValue;
|
|
|
|
|
+ console.log('设置formData.taskType为:', selectedType.dictValue);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ }
|
|
|
} else if (this.pickerTitle === '任务归属' && this.originalCompanyData) {
|
|
} else if (this.pickerTitle === '任务归属' && this.originalCompanyData) {
|
|
|
- // 获取选中的索引
|
|
|
|
|
- const selectedIndex = e.value[0]
|
|
|
|
|
- // 找到对应的原始数据项
|
|
|
|
|
- const selectedItem = this.originalCompanyData.find(item => item.deptStr === selectedIndex)
|
|
|
|
|
|
|
+ // e.value[0]是选中的文本值(deptStr)
|
|
|
|
|
+ const selectedDeptStr = e.value[0];
|
|
|
|
|
+ console.log('选中的任务归属文本:', selectedDeptStr);
|
|
|
|
|
+ console.log('originalCompanyData:', this.originalCompanyData);
|
|
|
|
|
+ // 从originalCompanyData中找到对应的项
|
|
|
|
|
+ const selectedItem = this.originalCompanyData.find(item => item.deptStr === selectedDeptStr);
|
|
|
if (selectedItem) {
|
|
if (selectedItem) {
|
|
|
- // 显示deptStr
|
|
|
|
|
- this.formData.institution = selectedItem.deptStr
|
|
|
|
|
- // 保存deptId到表单
|
|
|
|
|
- this.formData.deptId = selectedItem.deptId
|
|
|
|
|
|
|
+ // 保存deptId到表单(存储id值)
|
|
|
|
|
+ this.formData.deptId = selectedItem.deptId;
|
|
|
|
|
+ console.log('设置formData.deptId为:', selectedItem.deptId);
|
|
|
|
|
+ } else {
|
|
|
}
|
|
}
|
|
|
} else if (this.pickerTitle === '归属项目' && this.originalCompanyData) {
|
|
} else if (this.pickerTitle === '归属项目' && this.originalCompanyData) {
|
|
|
- // 获取选中的索引
|
|
|
|
|
- const selectedIndex = e.value[0]
|
|
|
|
|
- // 找到对应的原始数据项
|
|
|
|
|
- const selectedItem = this.originalCompanyData.find(item => item.projectName === selectedIndex)
|
|
|
|
|
|
|
+ // e.value[0]是选中的文本值(projectName)
|
|
|
|
|
+ const selectedProjectName = e.value[0];
|
|
|
|
|
+ console.log('选中的归属项目文本:', selectedProjectName);
|
|
|
|
|
+ console.log('originalCompanyData:', this.originalCompanyData);
|
|
|
|
|
+ // 从originalCompanyData中找到对应的项
|
|
|
|
|
+ const selectedItem = this.originalCompanyData.find(item => item.projectName === selectedProjectName);
|
|
|
if (selectedItem) {
|
|
if (selectedItem) {
|
|
|
- // 显示projectName
|
|
|
|
|
- this.formData.belongingProject = selectedItem.projectName
|
|
|
|
|
|
|
+ // 保存id到表单(存储id值)
|
|
|
|
|
+ this.formData.projectId = selectedItem.id;
|
|
|
// 保存productId到表单
|
|
// 保存productId到表单
|
|
|
- this.formData.productId = selectedItem.productId
|
|
|
|
|
|
|
+ this.formData.productId = selectedItem.productId;
|
|
|
|
|
+ console.log('设置formData.projectId为:', selectedItem.id);
|
|
|
|
|
+ } else {
|
|
|
}
|
|
}
|
|
|
} else if (this.pickerTitle === '产品代码' && this.originalCompanyData) {
|
|
} else if (this.pickerTitle === '产品代码' && this.originalCompanyData) {
|
|
|
- // 获取选中的索引
|
|
|
|
|
- const selectedIndex = e.value[0]
|
|
|
|
|
- // 找到对应的原始数据项
|
|
|
|
|
- const selectedItem = this.originalCompanyData.find(item => item.productName === selectedIndex)
|
|
|
|
|
|
|
+ // e.value[0]是选中的文本值(productName)
|
|
|
|
|
+ const selectedProductName = e.value[0];
|
|
|
|
|
+ console.log('选中的产品代码文本:', selectedProductName);
|
|
|
|
|
+ console.log('originalCompanyData:', this.originalCompanyData);
|
|
|
|
|
+ // 从originalCompanyData中找到对应的项
|
|
|
|
|
+ const selectedItem = this.originalCompanyData.find(item => item.productName === selectedProductName);
|
|
|
if (selectedItem) {
|
|
if (selectedItem) {
|
|
|
- // 显示productName
|
|
|
|
|
- this.formData.productCode = selectedItem.productName
|
|
|
|
|
- // 保存productCode到表单
|
|
|
|
|
- this.formData.productCodeValue = selectedItem.productCode
|
|
|
|
|
- this.id=selectedItem.id
|
|
|
|
|
|
|
+ // 保存id到表单
|
|
|
|
|
+ this.formData.productId = selectedItem.id;
|
|
|
|
|
+ // 保存id用于获取任务类型
|
|
|
|
|
+ console.log('设置formData.productId为:', selectedItem.id);
|
|
|
|
|
+ } else {
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ } else if (this.pickerTitle === '归属类型' && this.originalCompanyData) {
|
|
|
|
|
+ // e.value[0]是选中的文本值(dictLabel)
|
|
|
|
|
+ const selectedLabel = e.value[0];
|
|
|
|
|
+ console.log('选中的归属类型文本:', selectedLabel);
|
|
|
|
|
+ console.log('originalCompanyData:', this.originalCompanyData);
|
|
|
|
|
+ // 从originalCompanyData中找到对应的项
|
|
|
|
|
+ const selectedItem = this.originalCompanyData.find(item => item.dictLabel === selectedLabel);
|
|
|
|
|
+ if (selectedItem) {
|
|
|
|
|
+ // 保存dictValue到表单的belongType字段
|
|
|
|
|
+ this.formData.belongType = selectedItem.dictValue;
|
|
|
|
|
+ console.log('设置formData.belongType为:', selectedItem.dictValue);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ console.log('未找到对应的归属类型');
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -605,11 +711,24 @@ import utils from '@/utils/common.js'
|
|
|
url: '/pages_task/selectCustomer'
|
|
url: '/pages_task/selectCustomer'
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
|
- onPlanStartTimeChange(e) {
|
|
|
|
|
- this.formData.planStartTime = e.detail.value
|
|
|
|
|
|
|
+ onStartTimeConfirm(e) {
|
|
|
|
|
+ this.formData.planStartTime = this.formatDateTime(e.value);
|
|
|
|
|
+ this.showStartTimePicker = false;
|
|
|
|
|
+ },
|
|
|
|
|
+ onEndTimeConfirm(e) {
|
|
|
|
|
+ this.formData.planEndTime = this.formatDateTime(e.value);
|
|
|
|
|
+ this.showEndTimePicker = false;
|
|
|
},
|
|
},
|
|
|
- onPlanEndTimeChange(e) {
|
|
|
|
|
- this.formData.planEndTime = e.detail.value
|
|
|
|
|
|
|
+ formatDateTime(timestamp) {
|
|
|
|
|
+ const date = new Date(timestamp);
|
|
|
|
|
+ const year = date.getFullYear();
|
|
|
|
|
+ const month = String(date.getMonth() + 1).padStart(2, '0');
|
|
|
|
|
+ const day = String(date.getDate()).padStart(2, '0');
|
|
|
|
|
+ // const hours = String(date.getHours()).padStart(2, '0');
|
|
|
|
|
+ // const minutes = String(date.getMinutes()).padStart(2, '0');
|
|
|
|
|
+ // const seconds = String(date.getSeconds()).padStart(2, '0');
|
|
|
|
|
+ // ${hours}:${minutes}:${seconds}
|
|
|
|
|
+ return `${year}-${month}-${day}`;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|