| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280 |
- <template>
- <view class="mx3" style="padding-bottom: 100rpx">
- <u-toast ref="uToast" />
- <view class="main-color-bg" style="height: 100rpx; margin: 0 -30rpx"></view>
- <view
- class="p3 bg-color-white"
- style="margin-top: -50rpx; border-radius: 20rpx"
- >
- <u-form :model="form" ref="uForm" >
- <!-- <u-form-item label="选择设备" required prop="running" :label-width="150">
- <u-input
- v-model="form.running"
- disabled
- @click="handleSelect"
- placeholder="请选择设备"
- type="select"
- />
- <u-select
- v-model="haltState"
- :list="runningList"
- @confirm="runningSubmit"
- ></u-select> -->
- </u-form-item>
- <common-popup :list="runningList" @select="runningSubmit" ref="popup" />
- <view class="main-color-text f-size-32 f-weight-6 mt-2">备件信息</view>
- <u-form-item label="备件名称" :label-width="150">
- <u-input v-model="form.spareName" disabled />
- </u-form-item>
- <u-form-item label="备件编号" :label-width="150">
- <u-input v-model="form.spareNo" disabled />
- </u-form-item>
- <view class="main-color-text f-size-32 f-weight-6 mt-2">出库仓库信息</view>
- <u-form-item label="仓库名称" :label-width="150">
- <u-input v-model="form.storeName" disabled />
- </u-form-item>
- <u-form-item label="库存价格" :label-width="150">
- <u-input v-model="form.price" disabled/>
- </u-form-item>
- <u-form-item label="库存数量" :label-width="150">
- <u-input v-model="form.storeNum" disabled/>
- </u-form-item>
- <u-form-item label="出库数量" prop="num" required :label-width="150">
- <u-input v-model="form.num" :cursor-spacing="cursorSpacing" />
- </u-form-item>
- <!--<u-form-item label="上传图片" :label-width="150">
- <u-upload
- width="180"
- height="180"
- max-count="6"
- :action="action"
- :file-list="fileList"
- @on-success="uploadSuccess"
- @on-remove="uploadRemove"></u-upload>
- </u-form-item>-->
- </u-form>
- <!-- <button class="main-color-bg text-color-white" @tap='handleSubmit'>提交</button> -->
- <view class="p-fixed d-flex j-around a-center footer">
- <view
- class="main-color-bg text-color-white common"
- @tap="handleSubmit"
- >提交</view
- >
- </view>
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- form: {
- price: '',
- spareName: '',
- spareId: '',
- spareNo: '',
- storeId: '',
- storeName: '',
- storeNum: ''
- },
- data: [],
- badState: false,
- badList: [],
- runningState: false, // 设备选择
- runningList: [],
- haltState: false, // 是否停机
- haltList: [],
- repairState: false, // 报修来源
- repairList: [],
- levelState: false,
- levelList: [],
- imagesList: [],
- action: this.$BaseTool.UserUtil.getUploadUrlIgnores(),
- // action: 'http://39.103.133.141:8000/mock/7/upms/files/upload',
- /*header: {
- Authorization: 'Bearer ' + uni.getStorageSync('accessToken')
- },*/
- fileList: [],
- sourceMap: {},
- levelMap: {},
- statusMap: {},
- needStopMap: {},
- haltDefaultValue: [0],
- rules: {
- num: [
- {
- required: true,
- message: '请填写出库数量',
- trigger: ['blur', 'change']
- }
- ]
- },
- // #ifdef MP-WEIXIN
- cursorSpacing: 50,
- // #endif
- // #ifndef MP-WEIXIN
- cursorSpacing: 0,
- // #endif
- sbBackId: '',
- aShow: false,
- address: '',
- sbId: null,
- aList: [
- ]
- };
- },
- onShow() {
- },
- onLoad(options) {
- this.form.spareId = options.spareId;
- this.form.spareName = options.spareName;
- this.form.spareNo = options.spareNo;
- this.form.storeId = options.storeId;
- this.form.storeNum = options.storeNum;
- this.form.price = options.price;
- this.form.storeName = options.storeName;
- this.sourceMap = this.$DictCache.getLabelByValueMapByType(
- this.$DictCache.TYPE.REPAIR_APPLICATION_FORM_SOURCE
- );
- for (const key in this.sourceMap) {
- this.repairList.push({
- label: this.sourceMap[key],
- value: key
- });
- }
- this.form.repair = this.repairList[0].label;
- this.form.source = this.repairList[0].value;
- this.levelMap = this.$DictCache.getLabelByValueMapByType(
- this.$DictCache.TYPE.REPAIR_APPLICATION_FORM_LEVEL
- );
- for (const key in this.levelMap) {
- this.levelList.push({
- label: this.levelMap[key],
- value: key
- });
- }
- this.form.level = this.levelList[0].label;
- this.form.levelValue = this.levelList[0].value;
- this.statusMap = this.$DictCache.getLabelByValueMapByType(
- this.$DictCache.TYPE.REPAIR_APPLICATION_FORM_STATUS
- );
- this.needStopMap = this.$DictCache.getLabelByValueMapByType(
- this.$DictCache.TYPE.YES_NO
- );
- for (const key in this.needStopMap) {
- this.haltList.push({
- label: this.needStopMap[key],
- value: key
- });
- }
- this.form.halt = this.haltList[this.haltDefaultValue].label;
- this.form.needStop = this.haltList[this.haltDefaultValue].value;
- this.getType()
- // 获取设备数据
- // this.initSb();
- },
- onReady() {
- this.$refs.uForm.setRules(this.rules);
- },
- methods: {
- //
- confirm(e) {
- console.log(e);
- this.address = ''
- for (let i = 0; i < e.length; i++) {
- this.address += e[i].label
- }
- },
- badSubmit(data) {
- this.form.badType = data[0].label;
- this.form.repairErrorTypeId = data[0].value;
- },
- getType() {
- /* this.$Http
- .fetchErrorTypeTree({
- id: this.detailId
- })
- .then((res) => {
- console.log(res.data);
- const temp = []
- res.data.forEach(item => {
- temp.push({
- label: item.title,
- value: item.id
- })
- })
- this.badList = temp
- console.log(this.badList);
- }) */
- },
- handleSelect() {
- uni.navigateTo({
- url: '/pages/search/search'
- })
- },
- handleSubmit() {
- if(this.form.storeNum<=0){
- uni.showToast({ icon: 'none', title: '库存数量为0,无法出库!', duration: 2000 });
- return
- }
- if(this.form.num<=0){
- uni.showToast({ icon: 'none', title: '出库数量必须大于0!', duration: 2000 });
- return
- }
- if(this.form.storeNum< this.form.num){
- uni.showToast({ icon: 'none', title: '出库数量不得大于库存数量!', duration: 2000 });
- return
- }
- const params = {
- storeId: this.form.storeId,
- detailList:[{
- price: this.form.price,
- spareId: this.form.spareId,
- storeId: this.form.storeId,
- num: this.form.num
- }]
- };
- // this.form.photo = a.join(',');
- var that = this;
- this.$refs.uForm.validate((valid) => {
- if (valid) {
- this.$Http.addOutStoreForm(params).then((res) => {
- uni.showToast({ icon: 'none', title: '出库单已提交!', duration: 2000 });
- setTimeout(function () {
- uni.navigateTo({
- url: '/pages/spare/spare-store?detailId=' + that.form.spareId
- });
- }, 2000)
- });
- }
- });
- }
- }
- };
- </script>
- <style lang="less">
- .footer {
- bottom: 0;
- left: 0;
- right: 0;
- background-color: #fff;
- z-index: 10000;
- border-top: 1rpx solid #f4f4f4;
- height: 100rpx;
- .common {
- padding: 15rpx 200rpx;
- border-radius: 30rpx;
- background-color: #0082ff;
- color: #fff;
- }
- }
- </style>
|