123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586 |
- <template>
- <view>
- <view style="padding:5rpx 20rpx 45rpx 20rpx;">
- <view class="desc">
- <uni-row>
- <uni-col :span="5">
- <view class="desc" style="font-size: 25rpx;">
- 申请人
- </view>
- </uni-col>
- <uni-col :span="19">
- <view>
- <uni-easyinput primaryColor="#37babd" v-model="form.applyUserName" disabled>
- </uni-easyinput>
- </view>
- </uni-col>
- </uni-row>
- </view>
- <view class="desc">
- <uni-row>
- <uni-col :span="5">
- <view class="desc" style="font-size: 25rpx;">
- 申请部门
- </view>
- </uni-col>
- <uni-col :span="19">
- <view class="pickerView">
- <picker @change="deptBindPickerChange" :value="deptConfig.deptIndex"
- :range="deptConfig.deptDatas" range-key="deptName">
- <view class="pickerText"
- v-if="deptConfig.deptDatas && deptConfig.deptDatas.length>0 && deptConfig.deptIndex !== undefined">
- {{ deptConfig.deptDatas[deptConfig.deptIndex].deptName }}
- </view>
- <view class="pickerText" v-else>
- {{defaultDept}}
- </view>
- </picker>
- </view>
- </uni-col>
- </uni-row>
- </view>
- <view class="desc" v-if="pageType === 'dj'">
- <uni-row>
- <uni-col :span="5">
- <view class="desc" style="font-size: 25rpx;">
- 登记类型
- </view>
- </uni-col>
- <uni-col :span="19">
- <view class="pickerView">
- <picker @change="accessBindPickerChange" :value="accessStorageType.index"
- :range="accessStorageType.data" range-key="dictLabel">
- <view class="pickerText"
- v-if="accessStorageType.data && accessStorageType.data.length>0 && accessStorageType.index !== undefined">
- {{ accessStorageType.data[accessStorageType.index].dictLabel }}
- </view>
- <view class="pickerText" v-else>
- 待 选 择
- </view>
- </picker>
- </view>
- </uni-col>
- </uni-row>
- </view>
- <view class="desc" v-if="pageType === 'ly'">
- <uni-row>
- <uni-col :span="5">
- <view class="desc" style="font-size: 25rpx;">
- 领用类型
- </view>
- </uni-col>
- <uni-col :span="19">
- <view class="pickerView">
- <picker @change="dictBindPickerChange" :value="outStorageType.index"
- :range="outStorageType.data" range-key="dictLabel">
- <view class="pickerText"
- v-if="outStorageType.data && outStorageType.data.length>0 && outStorageType.index !== undefined">
- {{ outStorageType.data[outStorageType.index].dictLabel }}
- </view>
- <view class="pickerText" v-else>
- 待 选 择
- </view>
- </picker>
- </view>
- </uni-col>
- </uni-row>
- </view>
- <view class="desc" v-if="pageType === 'gh'">
- <uni-row>
- <uni-col :span="5">
- <view class="desc" style="font-size: 25rpx;">
- 物品状态
- </view>
- </uni-col>
- <uni-col :span="19">
- <view class="pickerView">
- <radio-group @change="radioChange">
- <uni-col :span="12" v-for="(item, index) in radiolist1">
- <label :key="item.value">
- <radio color="rgb(55,186,189)" :value="item.value" :checked="index === current">
- {{item.value}}
- </radio>
- </label>
- </uni-col>
- </radio-group>
- </view>
- </uni-col>
- </uni-row>
- </view>
- <view class="desc">
- <uni-row>
- <uni-col :span="5">
- <view class="desc" style="font-size: 25rpx;">
- 物资类型
- </view>
- </uni-col>
- <uni-col :span="19">
- <view class="pickerView">
- <picker @change="oneBindPickerChange" :value="typeData.oneTypeIndex"
- :range="typeData.oneType" range-key="goodsTypeName">
- <view class="pickerText"
- v-if="typeData.oneType && typeData.oneType.length>0 && typeData.oneTypeIndex !== undefined">
- {{ typeData.oneType[typeData.oneTypeIndex].goodsTypeName }}
- </view>
- <view class="pickerText" v-else>
- 待 选 择
- </view>
- </picker>
- </view>
- </uni-col>
- </uni-row>
- </view>
- <view class="desc">
- <uni-row>
- <uni-col :span="5">
- <view class="desc" style="font-size: 25rpx;">
- 具体分类
- </view>
- </uni-col>
- <uni-col :span="19">
- <view class="pickerView">
- <picker @change="twoBindPickerChange" :value="typeData.twoTypeIndex"
- :range="typeData.twoType" range-key="goodsTypeName"
- :disabled="typeData.twoTypeDisabled">
- <view class="pickerText"
- v-if="typeData.twoType && typeData.twoType.length>0 && typeData.oneTypeIndex !== undefined">
- {{ typeData.twoType[typeData.twoTypeIndex].goodsTypeName }}
- </view>
- <view class="pickerText" v-else @click="isTwoTypeShowModal()">
- 待 选 择
- </view>
- </picker>
- </view>
- </uni-col>
- </uni-row>
- </view>
- <view class="desc">
- <uni-row>
- <uni-col :span="5">
- <view class="desc" style="font-size: 25rpx;">
- 物资名称
- </view>
- </uni-col>
- <uni-col :span="19">
- <view class="pickerView pickerText">
- <view @click="openGoodsPopup" class="pickerText" v-if="form.goodsName">
- {{form.goodsName}}
- </view>
- <view @click="openGoodsPopup" class="pickerText" v-else>
- 待 选 择
- </view>
- </view>
- </uni-col>
- </uni-row>
- </view>
- <view class="desc">
- <uni-row>
- <uni-col :span="5">
- <view class="desc" style="font-size: 25rpx;">
- 单位
- </view>
- </uni-col>
- <uni-col :span="19">
- <view class="pickerView">
- <view class="pickerText" v-if="form.unit">
- {{form.unit}}
- </view>
- <view class="pickerText" v-else>
- 暂无
- </view>
- </view>
- </uni-col>
- </uni-row>
- </view>
- <view class="desc">
- <uni-row>
- <uni-col :span="5">
- <view class="desc" style="font-size: 25rpx;" v-if="pageType === 'dj'">
- 登记数量
- </view>
- <view class="desc" style="font-size: 25rpx;" v-if="pageType === 'ly'">
- 申请数量
- </view>
- <view class="desc" style="font-size: 25rpx;" v-if="pageType === 'gh'">
- 归还数量
- </view>
- </uni-col>
- <uni-col :span="19">
- <view>
- <u-number-box v-model="form.amount"></u-number-box>
- </view>
- </uni-col>
- </uni-row>
- </view>
- <view class="desc" v-if="pageType === 'ly'">
- <view class="desc" style="font-size: 25rpx;">
- 备注:
- </view>
- <view>
- <uni-easyinput type="textarea" primaryColor="#37babd" v-model="form.remark">
- </uni-easyinput>
- </view>
- </view>
- </view>
- <u-gap height="70" bgColor="#ffffff"></u-gap>
- <view class="bottim_view">
- <view>
- <u-row>
- <u-col span="11">
- <u-button :disabled="isDisabled" class="btnDoPay" shape="circle" @click="submit"
- color="rgb(55,186,189)" text="提交"></u-button>
- </u-col>
- </u-row>
- </view>
- </view>
- <!-- 物资选择弹窗 -->
- <uni-popup ref="goodsPopup" background-color="#fff">
- <view style="height: 800rpx;">
- <view style="padding: 30rpx;">
- <u-search v-model="searchGoodsName" :show-action="false" placeholder="快捷搜索"
- @change="getAppGoodsData(typeData.twoType[typeData.twoTypeIndex].id)"></u-search>
- </view>
- <view style="padding: 5rpx;">
- <uni-list v-for="item in goodsData">
- <uni-list-item :clickable="true" @click="goodsToSubmiut(item)" :title="item.name" />
- </uni-list>
- </view>
- </view>
- </uni-popup>
- <!-- 下一步选择人员弹窗 -->
- <uni-popup ref="popup" background-color="#fff">
- <view style="height: 800rpx;">
- <view class="desc">
- <uni-row>
- <uni-col :span="10">
- <view style="font-size: 40rpx;color: rgb(145, 145, 145);">
- </view>
- </uni-col>
- <uni-col :span="11">
- <view style="font-size: 40rpx;color: rgb(98, 98, 98);">
- 下一步
- </view>
- </uni-col>
- <uni-col :span="3">
- <view @click="submitPass" style="font-size: 40rpx;color: rgb(55,186,189);">
- 确认
- </view>
- </uni-col>
- </uni-row>
- </view>
- <view>
- <!-- -->
- <uni-row>
- <uni-col>
- <view style="padding: 15rpx 20rpx;">
- <uni-data-picker ref="picker" placeholder="请选择" :popup-title="selectTitle"
- :localdata="dataTree" v-model="hxForm.candidate" @change="nextApprovalChange">
- </uni-data-picker>
- </view>
- </uni-col>
- </uni-row>
- </view>
- </view>
- </uni-popup>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- isDisabled: false,
- selectTitle: '',
- form: {
- goodsId: '',
- goodsName: '',
- amount: 1,
- unit: '',
- remark: ''
- },
- org_dept_parent_id: '',
- searchGoodsName: '',
- hxForm: {},
- dataTree: [],
- index: 0,
- defaultDept: '',
- reserve_type: [],
- goodsData: [],
- deptConfig: {
- deptDatas: [],
- deptIndex: undefined
- },
- current: 0,
- radiolist1: [{
- value: '正常'
- }, {
- value: '异常'
- }, {
- value: '损坏'
- }],
- typeData: {
- oneTypeIndex: undefined,
- oneType: [],
- twoTypeIndex: undefined,
- twoType: [],
- twoTypeDisabled: true
- },
- outStorageType: {
- index: undefined,
- data: []
- },
- accessStorageType: {
- index: undefined,
- data: []
- },
- pageType: ''
- }
- },
- onLoad() {
- this.pageType = this.$root.$mp.query.pageType
- let title = ''
- switch (this.pageType) {
- case "dj":
- title = '物资登记'
- this.accessStorageType.data = uni.getStorageSync('access_stroage_type')
- this.form.recordType = 1
- break
- case "ly":
- title = '物资领用'
- this.outStorageType.data = uni.getStorageSync('out_storage_type')
- this.form.recordType = 2
- break
- case "gh":
- title = '物资归还'
- this.form.recordType = 3
- this.form.applyReason = 5
- this.form.remark = '正常'
- break
- }
- uni.setNavigationBarTitle({
- title: title
- })
- //物资一级分类初始化
- this.getAppGoodsTypeData('')
- //机构信息初始化
- this.deptConfig.deptDatas = uni.getStorageSync('deptData')
- //申请人初始化
- this.form.applyUserName = uni.getStorageSync("userInfo").nickName
- //翻译默认部门
- let department = uni.getStorageSync('files').department
- this.defaultDept = this.$dictTranslation(department, 'deptData', 'dept')
- this.form.applyDepartment = department
- },
- methods: {
- openGoodsPopup() {
- if (!this.typeData.twoTypeDisabled) {
- this.$refs.goodsPopup.open('bottom')
- } else {
- this.$showModal('请先选择具体分类')
- }
- },
- isTwoTypeShowModal() {
- if (this.typeData.twoTypeDisabled) {
- this.$showModal('请先选择物资类型')
- }
- },
- change(e) {
- console.log(e);
- },
- radioChange: function(evt) {
- this.form.remark = evt.detail.value
- },
- async submit() {
- this.isDisabled = true
- setTimeout(() => {
- this.isDisabled = false
- }, 1000)
- if (!this.form.applyDepartment) {
- this.isDisabled = false
- uni.showModal({
- content: '请选择所属部门',
- title: '提交失败',
- showCancel: false
- })
- return
- }
- if (!this.form.goodsName) {
- this.isDisabled = false
- uni.showModal({
- content: '请选择物资',
- title: '提交失败',
- showCancel: false
- })
- return
- }
- if (!this.form.amount) {
- this.isDisabled = false
- uni.showModal({
- content: '请填写数量',
- title: '提交失败',
- showCancel: false
- })
- return
- }
- if (!this.form.applyReason) {
- this.isDisabled = false
- uni.showModal({
- content: '请选择领用类型',
- title: '提交失败',
- showCancel: false
- })
- return
- }
- const {
- data: res
- } = await this.$httpRequest({
- url: '/app/submitApply/rcr',
- method: 'post',
- data: this.form
- });
- if (res.code === 200) {
- this.dataTree = res.data.tree
- this.hxForm.taskId = res.data.taskId
- this.$refs.popup.open('bottom')
- this.selectTitle = "请选择" + this.dataTree[0].text
- this.isDisabled = false
- } else {
- this.$showModal(res.msg)
- }
- this.isDisabled = false
- },
- async submitPass() {
- if (!this.hxForm.candidate) {
- uni.showModal({
- content: '请选择' + this.dataTree[0].text,
- title: '提交失败',
- showCancel: false,
- })
- }
- const {
- data: res
- } = await this.$httpRequest({
- url: '/app/task/submit/candidate?taskId=' + this.hxForm.taskId +
- '&candidate=' + this.hxForm.candidate + '&applyUserName=' + this.hxForm.applyUserName,
- method: 'get',
- });
- if (res.code === 200) {
- uni.showModal({
- content: '已提交给审批人员',
- title: '提交成功',
- showCancel: false,
- success() {
- uni.navigateBack()
- }
- })
- } else {
- uni.showModal({
- content: res.msg,
- title: '提交失败',
- showCancel: false,
- success() {
- uni.navigateBack()
- }
- })
- }
- },
- nextApprovalChange(e) {
- // console.log('onchange:', e.detail.value[1].text);
- this.hxForm.applyUserName = e.detail.value[1].text
- this.hxForm.candidate = e.detail.value[1].value
- },
- //获取物资一级/二级类型
- async getAppGoodsTypeData(type) {
- const {
- data: res
- } = await this.$httpRequest({
- url: '/app/goodsType?type=' + type,
- urlType: this.$getUrlType()
- });
- if (res.code === 200) {
- if (type) {
- this.typeData.twoType = res.data
- this.getAppGoodsData(this.typeData.twoType[0].id)
- } else {
- this.typeData.oneType = res.data
- this.getAppGoodsTypeData(this.typeData.oneType[0].id)
- }
- }
- },
- //获取物资信息/查询物资信息
- async getAppGoodsData(type) {
- const {
- data: res
- } = await this.$httpRequest({
- url: '/app/goodses?type=' + type + '&name=' + this.searchGoodsName,
- urlType: this.$getUrlType()
- });
- if (res.code === 200) {
- this.goodsData = res.data
- }
- },
- //选择物资form赋值
- goodsToSubmiut(item) {
- this.form.goodsName = item.name
- this.form.goodsId = item.id
- this.form.unit = item.unit
- this.$refs.goodsPopup.close()
- },
- maskClick(e) {},
- //选择框赋值区
- oneBindPickerChange: function(e) {
- this.typeData.oneTypeIndex = e.detail.value
- this.getAppGoodsTypeData(this.typeData.oneType[this.typeData.oneTypeIndex].id)
- this.typeData.twoTypeIndex = 0
- this.typeData.twoTypeDisabled = false
- this.form.goodsName = ''
- },
- twoBindPickerChange: function(e) {
- this.typeData.twoTypeIndex = e.detail.value
- this.form.goodsName = ''
- },
- deptBindPickerChange: function(e) {
- this.deptConfig.deptIndex = e.detail.value
- this.form.applyDepartment = this.deptConfig.deptDatas[this.deptConfig.deptIndex].deptId
- },
- dictBindPickerChange: function(e) {
- this.outStorageType.index = e.detail.value
- this.form.applyReason = this.outStorageType.data[this.outStorageType.index].dictValue
- },
- accessBindPickerChange: function(e) {
- this.accessStorageType.index = e.detail.value
- this.form.applyReason = this.accessStorageType.data[this.accessStorageType.index].dictValue
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .desc {
- padding: 10rpx 5rpx;
- color: #818181;
- font-size: 20rpx;
- }
- .pickerView {
- // align-items: flex-end;
- padding: 10rpx 20rpx;
- border: 1rpx #eeeeee solid;
- }
- .pickerText {
- font-size: 26rpx;
- color: #b1b1b1;
- }
- .bottim_view {
- padding: 5px 20px 30px;
- position: fixed;
- left: 0px;
- bottom: 0px;
- width: 100%;
- height: 40px;
- background-color: #ffffff;
- }
- </style>
|