| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175 |
- <template>
- <view>
- <u-popup :show="show" closeOnClickOverlay mode="top" @close="closePopup">
- <view class="search_list">
- <u-form labelPosition="left" :model="form" labelWidth="180" labelAlign="left" class="baseForm">
- <!-- <u-form-item label="创建时间:" class="required-form" borderBottom prop="rangeDate">
- <uni-datetime-picker v-model="rangeDate" :border="true" :icon="false" type="daterange" />
- </u-form-item> -->
- <u-form-item label="使用单位:" class="required-form" borderBottom prop="postName">
- <!-- <u-input v-model="form.postId" placeholder="请选择" type="text" @click.stop="openDepartmentPicker" /> -->
- <view :style="{ color: form.postName ? 'black' : '#c0c4cc' }" class="assetType_box"
- @click="openDepartmentPicker">
- {{ form.postName ? form.postName : '请选择使用单位' }}
- </view>
- </u-form-item>
-
- </u-form>
- </view>
- <view class="operate_box rx-bc">
- <u-button size="small" class="u-reset-button" @click="reset">
- 重置
- </u-button>
- <u-button type="success" size="small" class="u-reset-button" @click="submit">
- 确定
- </u-button>
- </view>
- </u-popup>
- <ba-tree-picker ref="departmentPicker" :multiple="false" @select-change="departmentConfirm" title="选择领料部门"
- :localdata="departmentOption" valueKey="id" textKey="name" childrenKey="children" />
- </view>
- </template>
- <script>
- import {
- getWarehouseList,
- getProduceTreeByPid
- } from '@/api/warehouseManagement'
- import {
- post,
- get
- } from '@/utils/api.js'
- import DictSelection from "@/components/Dict/DictSelection.vue";
- import dictMxins from "@/mixins/dictMixins";
- import { orderTypeEnum, saleOrderProgressStatusEnum, reviewStatusEnum } from '@/enum/dict.js'
- import {
- listOrganizations
- } from '@/api/common'
- import {
- toTreeData
- } from '@/utils/utils.js'
- export default {
- mixins: [dictMxins],
- components: {
- DictSelection
- },
- props: ['type', 'postId', 'postName'],
- data() {
- return {
- show: false,
- rangeDate: [],
- form: {
- postId: '',
- postName: ''
- },
- orderTypeEnum,
- saleOrderProgressStatusEnum,
- reviewStatusEnum,
- departmentOption: []
- }
- },
- created() {
- this.initDeptData()
- },
- methods: {
- openDepartmentPicker() {
- this.$refs.departmentPicker._show()
- },
- // 部门列表
- async initDeptData() {
- let deptTreeList = await listOrganizations()
- this.departmentOption = toTreeData({
- data: deptTreeList,
- idField: 'id',
- parentIdField: 'parentId'
- })
- },
- departmentConfirm(data, name, allList) {
- console.log(data, name, allList)
- this.form.postId = data[0]
- this.form.postName = name
- },
- handleSaleTypeChange(val) {
- console.log(val)
- },
- open() {
- this.show = true
- for (let key of Object.keys(this.form)) {
- this.form[key] = this[key]
- }
- // if(this.createTimeStart && this.createTimeEnd) {
- // this.rangeDate = [this.createTimeStart, this.createTimeEnd]
- // } else {
- // this.setDefaultRangeDate()
- // }
- },
- setDefaultRangeDate() {
- const now = new Date()
- const year = now.getFullYear()
- const month = String(now.getMonth() + 1).padStart(2, '0')
- const day = String(now.getDate()).padStart(2, '0')
- const today = `${year}-${month}-${day}`
- if (this.type === 'year') {
- this.rangeDate = [`${year}-01-01`, today]
- } else if (this.type === 'month') {
- this.rangeDate = [`${year}-${month}-01`, today]
- }
- },
- closePopup() {
- this.show = false
- },
- reset() {
- this.form = {
- postId: '',
- postName: ''
- }
- this.rangeDate = [],
- this.$emit('succeed', this.form)
- this.closePopup()
- },
- submit() {
- // if(this.rangeDate.length) {
- // this.form.createTimeStart = this.rangeDate[0]
- // this.form.createTimeEnd = this.rangeDate[1]
- // }
- this.$emit('succeed', this.form)
- this.closePopup()
- },
- }
- }
- </script>
- <style lang="scss" scoped>
- .search_list {
- min-height: 100rpx;
- /deep/ .baseForm {
- padding: 0 20rpx;
- }
- }
- .operate_box {
- padding: 10rpx 32rpx;
- /deep/ .u-button {
- width: 40%;
- }
- }
- /deep/.baseForm {
- .u-form-item__body {
- padding: 4px !important;
- }
- .assetType_box {
- padding: 12rpx 18rpx;
- width: 100%;
- overflow: hidden;
- white-space: nowrap;
- text-overflow: ellipsis;
- font-size: 30rpx;
- }
- }
- </style>
|