|
@@ -2,9 +2,13 @@
|
|
|
<view class="">
|
|
<view class="">
|
|
|
<u--form style="margin: 0 20px;" labelPosition="left" :model="form" :rules="rules" ref="uForm"
|
|
<u--form style="margin: 0 20px;" labelPosition="left" :model="form" :rules="rules" ref="uForm"
|
|
|
labelWidth='140rpx'>
|
|
labelWidth='140rpx'>
|
|
|
- <u-form-item label="负责人" prop="userName" required>
|
|
|
|
|
- <u--input clearable placeholder="请选择" border="surround" v-model="form.userName"
|
|
|
|
|
- @click.native="showTechnicianPicker"></u--input>
|
|
|
|
|
|
|
+ <u-form-item v-if="taskDefinitionKey === 'deptLeaderAssign'" label="采购部门" prop="useDeptId">
|
|
|
|
|
+ <u--input clearable placeholder="请选择" border="surround" v-model="form.useDeptName"
|
|
|
|
|
+ @click.native="openDepartmentPicker"></u--input>
|
|
|
|
|
+ </u-form-item>
|
|
|
|
|
+ <u-form-item v-if="taskDefinitionKey === 'deptLeaderAssign'" label="采购员" prop="assignList" required>
|
|
|
|
|
+ <u--input clearable placeholder="请选择" border="surround" v-model="form.assignListName"
|
|
|
|
|
+ @click.native="openPicker"></u--input>
|
|
|
</u-form-item>
|
|
</u-form-item>
|
|
|
<u-form-item label="审批建议" prop="reason" required>
|
|
<u-form-item label="审批建议" prop="reason" required>
|
|
|
<u--textarea style="width: 100%;" height='120' border='surround' placeholder="请输入审批建议"
|
|
<u--textarea style="width: 100%;" height='120' border='surround' placeholder="请输入审批建议"
|
|
@@ -12,18 +16,25 @@
|
|
|
</u-form-item>
|
|
</u-form-item>
|
|
|
</u--form>
|
|
</u--form>
|
|
|
<view>
|
|
<view>
|
|
|
- <u-button style="width: 100%;margin-bottom: 10rpx;" icon="edit-pen" :loading='loading' type="success"
|
|
|
|
|
|
|
+ <u-button v-if="!['storeManagerApprove'].includes(taskDefinitionKey)" style="width: 100%;margin-bottom: 10rpx;" icon="edit-pen" :loading='loading' type="success"
|
|
|
text="通过" @click="handleAudit(1)">
|
|
text="通过" @click="handleAudit(1)">
|
|
|
</u-button>
|
|
</u-button>
|
|
|
|
|
+ <u-button v-if="['storeManagerApprove'].includes(taskDefinitionKey)" style="width: 100%;margin-bottom: 10rpx;" icon="edit-pen" :loading='loading' type="success"
|
|
|
|
|
+ text="申请入库" @click="handleAudit(1)">
|
|
|
|
|
+ </u-button>
|
|
|
<u-button style="width: 100%;" :loading='loading' type="error" icon="close" text="驳回"
|
|
<u-button style="width: 100%;" :loading='loading' type="error" icon="close" text="驳回"
|
|
|
- @click="handleAudit(0)" v-if="!['starter'].includes(taskDefinitionKey)"></u-button>
|
|
|
|
|
|
|
+ @click="rejectTask" v-if="!['starter'].includes(taskDefinitionKey)"></u-button>
|
|
|
</view>
|
|
</view>
|
|
|
<view class="btnConcel">
|
|
<view class="btnConcel">
|
|
|
<u-button @click="showAction = true">更多</u-button>
|
|
<u-button @click="showAction = true">更多</u-button>
|
|
|
</view>
|
|
</view>
|
|
|
<u-action-sheet :actions="actionList" :closeOnClickOverlay="true" :closeOnClickAction="true" title="更多操作" :show="showAction" @close="showAction = false" @select="selectActionClick"></u-action-sheet>
|
|
<u-action-sheet :actions="actionList" :closeOnClickOverlay="true" :closeOnClickAction="true" title="更多操作" :show="showAction" @close="showAction = false" @select="selectActionClick"></u-action-sheet>
|
|
|
<u-picker itemHeight='60' :show="technicianShow" visibleItemCount='10' :columns="userOptions" keyName="name"
|
|
<u-picker itemHeight='60' :show="technicianShow" visibleItemCount='10' :columns="userOptions" keyName="name"
|
|
|
- @confirm='selectTechnicianInfo' @cancel='technicianShow = false' title='选择负责人'></u-picker>
|
|
|
|
|
|
|
+ @confirm='selectTechnicianInfo' @cancel='technicianShow = false' title='选择采购员'></u-picker>
|
|
|
|
|
+ <ba-tree-picker ref="departmentPicker" :multiple="false" @select-change="departmentConfirm" title="选择采购部门"
|
|
|
|
|
+ :localdata="departmentOption" valueKey="id" textKey="name" childrenKey="children" />
|
|
|
|
|
+ <ba-tree-picker ref="treePicker" :multiple="true" @select-change="confirm" title="选择采购员"
|
|
|
|
|
+ :localdata="userOptions" valueKey="id" textKey="name" childrenKey="child" />
|
|
|
</view>
|
|
</view>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
@@ -34,8 +45,13 @@
|
|
|
cancelTask
|
|
cancelTask
|
|
|
} from '@/api/wt/index.js'
|
|
} from '@/api/wt/index.js'
|
|
|
import {
|
|
import {
|
|
|
|
|
+ listOrganizations,
|
|
|
|
|
+ getUserPage,
|
|
|
listAllUserBind
|
|
listAllUserBind
|
|
|
- } from '@/api/common.js'
|
|
|
|
|
|
|
+ } from '@/api/common'
|
|
|
|
|
+ import {
|
|
|
|
|
+ toTreeData
|
|
|
|
|
+ } from '@/utils/utils.js'
|
|
|
export default {
|
|
export default {
|
|
|
name: 'taskSubmit',
|
|
name: 'taskSubmit',
|
|
|
props: {
|
|
props: {
|
|
@@ -55,6 +71,7 @@
|
|
|
|
|
|
|
|
data() {
|
|
data() {
|
|
|
return {
|
|
return {
|
|
|
|
|
+ departmentOption: [],
|
|
|
showAction: false,
|
|
showAction: false,
|
|
|
loading: false,
|
|
loading: false,
|
|
|
actionList: [{
|
|
actionList: [{
|
|
@@ -66,7 +83,11 @@
|
|
|
userOptions: [],
|
|
userOptions: [],
|
|
|
form: {
|
|
form: {
|
|
|
userId: '',
|
|
userId: '',
|
|
|
|
|
+ useDeptId: '',
|
|
|
|
|
+ useDeptName: '',
|
|
|
userName: '',
|
|
userName: '',
|
|
|
|
|
+ assignListName: '',
|
|
|
|
|
+ assignList: [],
|
|
|
reason: '',
|
|
reason: '',
|
|
|
},
|
|
},
|
|
|
rules: {
|
|
rules: {
|
|
@@ -76,20 +97,70 @@
|
|
|
message: '请输入审批建议',
|
|
message: '请输入审批建议',
|
|
|
trigger: 'blur'
|
|
trigger: 'blur'
|
|
|
},
|
|
},
|
|
|
- userName: {
|
|
|
|
|
|
|
+ useDeptId: {
|
|
|
type: 'string',
|
|
type: 'string',
|
|
|
|
|
+ required: false,
|
|
|
|
|
+ message: '请选择采购部门',
|
|
|
|
|
+ trigger: ['blur','change']
|
|
|
|
|
+ },
|
|
|
|
|
+ assignList: {
|
|
|
|
|
+ type: 'array',
|
|
|
required: true,
|
|
required: true,
|
|
|
- message: '请选择负责人',
|
|
|
|
|
|
|
+ message: '请选择采购员',
|
|
|
trigger: ['blur','change']
|
|
trigger: ['blur','change']
|
|
|
},
|
|
},
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
|
|
+ created() {
|
|
|
|
|
+ this.initDeptData()
|
|
|
|
|
+ this.getUserOptions()
|
|
|
|
|
+ },
|
|
|
mounted() {
|
|
mounted() {
|
|
|
this.$refs.uForm.setRules(this.rules)
|
|
this.$refs.uForm.setRules(this.rules)
|
|
|
- this.getUserOptions()
|
|
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
|
|
|
+ openPicker() {
|
|
|
|
|
+ this.$refs.treePicker._show()
|
|
|
|
|
+ },
|
|
|
|
|
+ confirm(data, name, allList) {
|
|
|
|
|
+ console.log('name-------', data,name, allList)
|
|
|
|
|
+ this.form.assignListName = name
|
|
|
|
|
+ this.form.assignList = allList
|
|
|
|
|
+ this.form.userId = allList.map(item => item.id)?.[0] || ''
|
|
|
|
|
+ this.form.userName = allList.map(item => item.name)?.[0] || ''
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ openDepartmentPicker() {
|
|
|
|
|
+ this.$refs.departmentPicker._show()
|
|
|
|
|
+ },
|
|
|
|
|
+ departmentConfirm(data, name, allList) {
|
|
|
|
|
+ console.log(data, name, allList)
|
|
|
|
|
+ this.form.useDeptId = data
|
|
|
|
|
+ this.form.useDeptName = name
|
|
|
|
|
+ this.form.userName = ''
|
|
|
|
|
+ this.form.userId = ''
|
|
|
|
|
+ this.form.assignListName = ''
|
|
|
|
|
+ this.form.assignList = []
|
|
|
|
|
+ if(!data) {
|
|
|
|
|
+ this.getUserOptions()
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ getUserPage({
|
|
|
|
|
+ groupId: data,
|
|
|
|
|
+ size: 999
|
|
|
|
|
+ }).then((data) => {
|
|
|
|
|
+ this.userOptions = data.list;
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
|
|
+ async initDeptData() {
|
|
|
|
|
+ let deptTreeList = await listOrganizations()
|
|
|
|
|
+ this.departmentOption = toTreeData({
|
|
|
|
|
+ data: deptTreeList,
|
|
|
|
|
+ idField: 'id',
|
|
|
|
|
+ parentIdField: 'parentId'
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
selectActionClick(item) {
|
|
selectActionClick(item) {
|
|
|
console.log('selectActionClick', item)
|
|
console.log('selectActionClick', item)
|
|
|
if (item.name == '作废') {
|
|
if (item.name == '作废') {
|
|
@@ -124,8 +195,8 @@
|
|
|
},
|
|
},
|
|
|
async getUserOptions() {
|
|
async getUserOptions() {
|
|
|
const data = await listAllUserBind()
|
|
const data = await listAllUserBind()
|
|
|
- this.userOptions.push(data)
|
|
|
|
|
- this.$comfi
|
|
|
|
|
|
|
+ this.userOptions = data
|
|
|
|
|
+ console.log('userOptions~~~', this.userOptions)
|
|
|
},
|
|
},
|
|
|
showTechnicianPicker(val) {
|
|
showTechnicianPicker(val) {
|
|
|
if (val.target.nodeName == 'I') {
|
|
if (val.target.nodeName == 'I') {
|
|
@@ -140,18 +211,60 @@
|
|
|
this.form.userName = e.value[0]?.name
|
|
this.form.userName = e.value[0]?.name
|
|
|
this.technicianShow = false
|
|
this.technicianShow = false
|
|
|
},
|
|
},
|
|
|
|
|
+ // async handleAudit(status) {
|
|
|
|
|
+ // if (!!status) await this.$refs.uForm.validate()
|
|
|
|
|
+
|
|
|
|
|
+ // await AssignPurchasePlanUserAPI({
|
|
|
|
|
+ // userId: this.form.userId,
|
|
|
|
|
+ // userName: this.form.userName,
|
|
|
|
|
+ // id: this.taskId,
|
|
|
|
|
+ // reason: this.form.reason,
|
|
|
|
|
+ // businessId: this.businessId
|
|
|
|
|
+ // })
|
|
|
|
|
+ // this.loading = true
|
|
|
|
|
+ // await this._approveTaskWithVariables(status);
|
|
|
|
|
+ // },
|
|
|
async handleAudit(status) {
|
|
async handleAudit(status) {
|
|
|
|
|
+ console.log(this.form)
|
|
|
if (!!status) await this.$refs.uForm.validate()
|
|
if (!!status) await this.$refs.uForm.validate()
|
|
|
-
|
|
|
|
|
- await AssignPurchasePlanUserAPI({
|
|
|
|
|
- userId: this.form.userId,
|
|
|
|
|
- userName: this.form.userName,
|
|
|
|
|
|
|
+ //主管指派采购员
|
|
|
|
|
+ if (this.taskDefinitionKey === 'deptLeaderAssign') {
|
|
|
|
|
+ await AssignPurchasePlanUserAPI({
|
|
|
|
|
+ userId: this.form.userId,
|
|
|
|
|
+ userName: this.form.userName,
|
|
|
|
|
+ assignList: this.form.assignList,
|
|
|
|
|
+ id: this.taskId,
|
|
|
|
|
+ reason: this.form.reason,
|
|
|
|
|
+ businessId: this.businessId
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ let API = !!status ? approveTaskWithVariables : rejectTask;
|
|
|
|
|
+ await API({
|
|
|
|
|
+ id: this.taskId,
|
|
|
|
|
+ reason: this.form.reason,
|
|
|
|
|
+ variables: {
|
|
|
|
|
+ // userId: this.form.userId,
|
|
|
|
|
+ userId: this.form.assignList.map(item => item.id).join(','),
|
|
|
|
|
+ pass: !!status
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ this.$emit('handleAudit', {
|
|
|
|
|
+ status,
|
|
|
|
|
+ title: status === 0 ? '驳回' : ''
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
|
|
+ async rejectTask(status) {
|
|
|
|
|
+ await rejectTask({
|
|
|
id: this.taskId,
|
|
id: this.taskId,
|
|
|
reason: this.form.reason,
|
|
reason: this.form.reason,
|
|
|
- businessId: this.businessId
|
|
|
|
|
- })
|
|
|
|
|
- this.loading = true
|
|
|
|
|
- await this._approveTaskWithVariables(status);
|
|
|
|
|
|
|
+ variables: {
|
|
|
|
|
+ pass: !!status
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ this.$emit('handleAudit', {
|
|
|
|
|
+ status,
|
|
|
|
|
+ title: status === 0 ? '驳回' : ''
|
|
|
|
|
+ });
|
|
|
},
|
|
},
|
|
|
async _approveTaskWithVariables(status) {
|
|
async _approveTaskWithVariables(status) {
|
|
|
let variables = {
|
|
let variables = {
|