| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213 |
- <template>
- <view>
- <uni-nav-bar
- fixed="true"
- statusBar="true"
- left-icon="back"
- title="申请备品备件"
- @clickLeft="back"
- ></uni-nav-bar>
- <view class="sparepart-container">
- <view class="infos">
- <!-- <view class="col">
- <text class="label">申领单号</text>
- <text class="content">{{ formData.applyOrder }}</text>
- </view>
- <view class="col">
- <text class="label">期望完成时间</text>
- <text class="content" @click="timeShow = true">{{
- formData.expectedPerformanceTime | timeFilter
- }}</text>
- </view> -->
- <u-form
- labelPosition="left"
- :model="formData"
- ref="formRef"
- labelWidth="250"
- labelAlign="left"
- class="baseForm"
- >
- <!-- <u-form-item label="审核人部门" prop="verifyDeptName" borderBottom>
- <u-input
- :value="formData.verifyDeptName"
- disableColor="#ffffff"
- placeholder="请选择"
- disabled
- type="select"
- clearable
- @click.native="$refs.verifyTreePicker._show()"
- />
- <view slot="right" style="display: flex; align-item: center">
- <u-icon
- v-show="formData.verifyDeptName"
- name="close-circle-fill"
- @click="verifyDeptConfirm([], '')"
- ></u-icon>
- <u-icon name="arrow-right"></u-icon>
- </view>
- </u-form-item>
- <u-form-item label="审核人" prop="approvalUserId" borderBottom>
- <picker
- @change="
- e =>
- handlePicker(
- e,
- userList,
- 'approvalUserId',
- 'approvalUserName'
- )
- "
- :value="pickerIndex"
- :range="userList"
- range-key="name"
- >
- <u-input
- :value="formData.approvalUserName"
- disableColor="#ffffff"
- placeholder="请选择"
- disabled
- type="select"
- />
- </picker>
- <view slot="right" style="display: flex; align-item: center">
- <u-icon
- v-show="formData.approvalUserName"
- name="close-circle-fill"
- @click="
- handlePicker(null, [], 'approvalUserId', 'approvalUserName')
- "
- ></u-icon>
- <u-icon name="arrow-right"></u-icon>
- </view>
- </u-form-item> -->
- <u-form-item
- label="仓库:"
- prop="warehouseId"
- style="height: 120rpx"
- required
- >
- <!-- <uni-datetime-picker type="datetime" v-model="formData.datetime" @change="changeLog" /> -->
- <picker
- @change="bindPickerChange"
- :value="warehosueVal"
- :range="warehouseList"
- range-key="name"
- >
- <input
- disabled
- class="uni-input"
- v-model="warehosueName"
- placeholder="请选择"
- />
- </picker>
- </u-form-item>
- <!-- <u-form-item
- label="期望完成时间:"
- prop="approvalUserId"
- style="height: 120rpx"
- >
- <text class="content" @click="timeShow = true">{{
- formData.expectedPerformanceTime | timeFilter
- }}</text>
- </u-form-item> -->
- </u-form>
- </view>
- <view class="detail-title">
- 申请明细
- <u-button @click="addGoods" type="success" size="small">
- 添加物品
- </u-button></view
- >
- <view class="detail-content">
- <uni-collapse
- :key="forceUpdate"
- ref="collapseRef"
- v-model="collapseVal"
- accordion
- >
- <uni-collapse-item
- :typeOpen="1"
- :name="item.informationCode"
- :show-animation="true"
- v-for="(item, index) in registerlist"
- :key="item.informationCode"
- >
- <template slot="title">
- <view class="row">
- <view class="col">
- <view class="col-item">
- {{ item.informationName }}({{ item.informationCode }})
- </view>
- </view>
- <view class="col">
- <view class="col-item">
- 规格/型号:{{ item.specification }}/{{ item.modelType }}
- </view>
- <view class="col-item">
- {{ item.isUnpack ? "包装单位" : "计量单位" }}:{{
- item.isUnpack
- ? `${item.measuringUnit}/${item.minPackUnit}`
- : item.measuringUnit
- }}
- </view>
- </view>
- <view class="col">
- <view class="col-item">
- 所需数量:{{ item.selectNum || 0 }}{{ item.measuringUnit }}
- </view>
- <view
- class="col-item text-primary"
- @click.stop="openPlus(item)"
- >
- 添加备品备件
- </view>
- </view>
- </view>
- </template>
- <view class="instance-list">
- <view class="" v-for="(itm, index) in item.tableData">
- <view class="row">
- <uni-icons
- type="trash"
- size="27"
- color="red"
- @click="handleDelete(item, itm, index)"
- ></uni-icons>
- <view class="col">
- <view class="col-item">
- {{ itm.onlyCode }}
- </view>
- </view>
- <view class="col">
- <view class="col-item"> 批次号:{{ itm.batchNum }} </view>
- <view class="col-item"> 包装编码:{{ itm.num }} </view>
- </view>
- <view class="col">
- <view class="col-item">
- {{ itm.manufactureTime ? "生产日期" : "采购日期" }}:{{
- itm.manufactureTime || itm.procurementTime
- }}
- </view>
- </view>
- <view class="col" v-if="!itm.isUnpack">
- <view class="col-item">
- 最小包装单元:{{ itm.measurementUnit }}{{ itm.unit }}/{{
- itm.minPackUnit
- }}
- </view>
- </view>
- <view class="col">
- <view class="col-item">
- 货位:{{ itm.warehouseName }}-{{ itm.areaName }}-{{
- itm.shelfCode
- }}-{{ itm.cargoSpaceCode }}
- </view>
- </view>
- </view>
- </view>
- </view>
- </uni-collapse-item>
- </uni-collapse>
- <!-- <view class="col" v-for="(item, index) in registerlist" :key="item.id">
- <view>
- <view>{{ item.informationName }}</view>
- <view style="color: #aaaaaa"
- >({{ item.informationCode }}/{{ item.modelType }})</view
- >
- </view>
- <u-number-box
- v-model="item.num"
- :step="1"
- :min="0"
- :name="index"
- :disabledInput="true"
- @change="numChange"
- ></u-number-box>
- </view>
- <view class="plus" @click="openPlus">+</view> -->
- </view>
- </view>
- <view class="sparepart-footer">
- <button class="primary" @click="toSubmit">提交</button>
- <button class="defualt" @click="back">返回</button>
- </view>
- <u-datetime-picker
- @confirm="timeConfirm"
- @cancel="timeCancel"
- :show="timeShow"
- v-model="formData.expectedPerformanceTime"
- mode="datetime"
- ></u-datetime-picker>
- <u-popup :show="popShow" @close="close" @open="open">
- <view class="select-container" v-if="popShow">
- <view class="title"
- >添加备件
- <view class="btn-box">
- <text class="btn cancel" @click="close">取消</text>
- <text class="btn confirm" @click="popConfirm">确定</text>
- </view>
- </view>
- <!-- <input
- type="text"
- :value="curClassification.name"
- placeholder="选择分类"
- @click="openPicker"
- /> -->
- <input
- type="text"
- @input="nameFilter"
- v-model="searchKey"
- placeholder="搜索编号"
- />
- <view class="self-table-header">
- <view class="table-code">备品备件编码</view>
- <view class="table-batch">批次号</view>
- </view>
- <view class="table-wrapper">
- <view class="listContent">
- <checkbox-group @change="selectionChange">
- <view
- class="listBox"
- v-for="(item, index) in tableData"
- :key="index"
- >
- <label>
- <view class="self-table-tr">
- <view class="table-code">{{ item.onlyCode }}</view>
- <view class="table-batch">{{ item.batchNum }}</view>
- <view class="table-date"></view>
- <view class="other-info">
- <view>包装编码:{{ item.num }}</view>
- <view v-if="!currentRow.isUnpack"
- >最小包装单元:{{ item.measurementUnit
- }}{{ item.unit }}/{{ item.minPackUnit }}</view
- >
- <view v-if="item.manufactureTime || item.procurementTime"
- >{{
- item.procurementTime ? "采购日期" : "生产日期"
- }}:{{
- item.manufactureTime || item.procurementTime
- }}</view
- >
- <view style="width: 100%"
- >货位:{{ item.warehouseName }}-{{ item.areaName }}-{{
- item.shelfCode
- }}-{{ item.cargoSpaceCode }}</view
- >
- </view>
- <view class="checked">
- <checkbox
- :value="item.onlyCode"
- :checked="selectList.includes(item.onlyCode)"
- ></checkbox>
- </view>
- </view>
- </label>
- </view>
- </checkbox-group>
- <u-empty style="margin-top: 20vh" v-if="!tableData.length" />
- </view>
- </view>
- </view>
- </u-popup>
- <!-- <ba-tree-picker
- ref="treePicker"
- :multiple="false"
- @select-change="confirm"
- title="选择分类"
- :localdata="listData"
- valueKey="id"
- textKey="name"
- childrenKey="children"
- /> -->
- <ba-tree-picker
- ref="verifyTreePicker"
- key="verify"
- :multiple="false"
- @select-change="verifyDeptConfirm"
- title="选择部门"
- :localdata="deptList"
- valueKey="code"
- textKey="name"
- childrenKey="children"
- />
- <u-modal
- :show="showConfirm"
- title="提示"
- @confirm="warehosueConfirm"
- @cancel="warehosueCancel"
- :showCancelButton="true"
- content="仓库修改后,已添加的备品备件信息将会被清空,是否要继续修改仓库?"
- ></u-modal>
- </view>
- </template>
- <script>
- import { get, postJ, post } from "@/utils/api.js";
- import dayjs from "dayjs";
- import { debounce } from "lodash";
- let [page, size, isEnd] = [1, 10, true];
- export default {
- components: {},
- filters: {
- timeFilter(inp) {
- return inp && dayjs(inp).format("YYYY-MM-DD HH:mm");
- },
- },
- data() {
- return {
- workOrderId: "",
- planFinishTime: "",
- workOrderCode: "",
- showConfirm: false,
- popShow: false,
- timeShow: false,
- time: "",
- pageId: "",
- pickerDeptShow: false,
- list: [],
- treeList: [],
- classificationId: "",
- // formData: {
- // applyOrder: getRuleNo('BJ'),
- // expectedPerformanceTime: new Date().getTime()
- // },
- registerlist: [],
- listData: [],
- curClassification: {
- id: "",
- name: "",
- },
- planCode: "",
- formData: {
- approvalUserId: "",
- approvalUserName: "",
- verifyDeptCode: "",
- verifyDeptName: "",
- // expectedPerformanceTime: new Date().getTime()
- },
- pickerIndex: 0,
- userList: [],
- deptList: [], //部门
- searchKey: "",
- tableData: [],
- selectIndex: [],
- chooseItem: {},
- sourceCode: null,
- sourceId: null,
- // 关键词搜索
- nameFilter: debounce(this.getTableData, 500),
- chooseIndex: null,
- warehouseId: "",
- warehosueName: "",
- warehouseList: [],
- warehosueVal: 0,
- memo: [],
- selectList: [],
- currentRow: {},
- forceUpdate: false,
- collapseVal: "",
- };
- },
- onLoad(options) {
- this.planCode = options.planCode;
- this.sourceCode = options.sourceCode;
- this.sourceId = options.sourceId;
- // this.getDept()
- // this._getPlanInfo()
- this.getwarehouseList();
- // this.workOrderId = workOrderId
- // this.workOrderCode = workOrderCode
- // this.planFinishTime = planFinishTime
- // this._getClassification()
- },
- computed: {
- selectAll: {
- set(val) {
- if (val) {
- this.selectList = this.tableData.map((i) => i.onlyCode);
- } else {
- this.selectList = [];
- }
- },
- get() {
- return (
- this.selectList.length &&
- this.selectList.length == this.tableData.length
- );
- },
- },
- },
- onShow() {
- uni.$off("setSelectList");
- uni.$on("setSelectList", (selectList) => {
- if (selectList?.length) {
- this.registerlist = this.registerlist.filter((item) => {
- const index = selectList.findIndex((i) => i.curId === item.curId);
- if (index > -1) {
- selectList.splice(index, 1);
- }
- return index > -1;
- });
- this.registerlist.push(
- ...selectList.map((item) => {
- return {
- curId: item.curId,
- isUnpack: item.isUnpack,
- informationCode: item.assetCode || item.informationCode,
- informationName: item.assetName || item.informationName,
- specification: item.specification,
- minPackUnit: item.minPackUnit,
- modelType: item.modelType,
- measuringUnit: item.unit || item.measuringUnit,
- tableData: item.tableData || [],
- num: 0,
- selectNum: 0,
- };
- })
- );
- }
- });
- },
- onReachBottom: function () {
- if (isEnd) {
- return;
- }
- // 显示加载图标
- uni.showLoading({
- title: "数据加载中",
- });
- this.getMoreLists();
- },
- methods: {
- showPopu() {
- this.popShow = true;
- },
- changeLog(e) {
- console.log("change事件:", e);
- },
- // 选择审核人确定
- handlePicker(e, list, idKey, nameKey) {
- if (idKey) {
- this.formData[idKey] = list[e?.detail.value]?.id;
- }
- if (nameKey) {
- this.formData[nameKey] = list[e?.detail.value]?.name;
- }
- this.$nextTick(() => {
- if (idKey === "assetType" || idKey === "bizScene") {
- this.$refs.formRef.validateField(idKey);
- }
- });
- },
- // 部门确认
- verifyDeptConfirm(data, name) {
- this.formData.verifyDeptCode = data[0];
- this.formData.verifyDeptName = name;
- this.formData.approvalUserId = "";
- this.formData.approvalUserName = "";
- this.getUser(data[0]);
- },
- // 获取部门
- getDept() {
- get(this.apiUrl + "/main/org/dept/effectiveTree").then((res) => {
- if (res?.success) {
- this.deptList = res.data;
- }
- });
- },
- // 获取人员
- getUser(deptCode) {
- post(this.apiUrl + "/main/user/list", {
- deptCode,
- page: 1,
- size: 9999,
- }).then((res) => {
- if (res?.success) {
- this.userList = res.data.items.map((item) => {
- item.name = item.trueName;
- item.id = item.userId;
- return item;
- });
- }
- });
- },
- numChange(val) {
- if (val?.value === 0) {
- this.registerlist.splice(val.name, 1);
- }
- },
- back() {
- uni.navigateBack({
- delta: 1,
- });
- },
- selectionChange({ detail }) {
- this.selectList = detail.value;
- },
- // 点击提交
- toSubmit() {
- // if (!this.formData.expectedPerformanceTime) {
- // uni.showToast({
- // icon: 'error',
- // title: '请选择期望完成时间'
- // })
- // return
- // }
- // if (!this.formData.approvalUserName) {
- // uni.showToast({
- // icon: 'error',
- // title: '请选择审核人'
- // })
- // return
- // }
- const stockOutApplyDetailList = this.registerlist.filter(
- (i) => i.tableData.length
- );
- if (!stockOutApplyDetailList.length) {
- uni.showToast({
- icon: "error",
- title: "请添加申请备件",
- });
- return;
- }
- const params = {
- ...this.formData,
- sparePartsApplyDetailList: this.registerlist
- .filter((i) => i.tableData.length)
- .map((i) => i.tableData)
- .flat()
- .map((i) => {
- delete i.id;
- return {
- informationCode: i.assetCode,
- informationName: i.assetName,
- assetCode: i.onlyCode,
- };
- }),
- sourceCode: this.sourceCode,
- sourceId: this.sourceId,
- sourceType: 2,
- };
- params.expectedPerformanceTime = dayjs(
- params.expectedPerformanceTime
- ).format("YYYY-MM-DD HH:mm:ss");
- postJ(this.apiUrl + "/sparePartsApply/save", params).then((res) => {
- if (res?.success) {
- this.back();
- }
- });
- },
- addGoods() {
- if (!this.warehouseId) {
- uni.showToast({
- title: "请选择仓库!",
- icon: "none",
- });
- return;
- }
- const storageKey = Date.now() + "";
- uni.setStorageSync(storageKey, this.registerlist);
- uni.navigateTo({
- url:
- "/pages/warehouse/outHouse/selectOutType?warehousingType=7&warehousingName=备品备件" +
- "&storageKey=" +
- storageKey +
- "&warehouseId=" +
- this.warehouseId,
- });
- },
- handleDelete(item, row, index) {
- uni.showModal({
- title: `确定删除${row.onlyCode}?`,
- content: "",
- confirmText: "确认",
- success: function (res) {
- if (res.confirm) {
- item.tableData.splice(index, 1);
- item.selectNum = item.tableData.reduce((next, pre) => {
- next += pre.isUnpack ? 1 : pre.measurementUnit || 0;
- return next;
- }, 0);
- }
- },
- });
- },
- // 选择备品备件
- openPicker() {
- this.$refs.treePicker._show();
- },
- handleSelectionChange(val) {
- console.log("handleSelectionChangeval", val);
- this.selectIndex = val.detail.index;
- },
- //获取备品备件分类
- _getClassification() {
- postJ(this.apiUrl + "/classificationTree/list", [4]).then((res) => {
- if (res?.success) {
- this.listData = res.data;
- }
- });
- },
- // 查询计划备件明细
- _getPlanInfo() {
- postJ(this.apiUrl + "/sparePartsApply/getSparePartsApplyDetail", {
- planCode: this.planCode,
- }).then((res) => {
- if (res?.success) {
- this.registerlist = res.data.map((item) => {
- item.tableData = [];
- item.curId = item.informationCode;
- delete item.equipmentCode;
- return item;
- });
- }
- });
- },
- close() {
- this.selectIndex = [];
- // this.$refs.tableRef.clearSelection()
- this.popShow = false;
- this.chooseItem = {};
- this.currentRow = {};
- },
- // 确定选择的备品备件
- popConfirm() {
- const selectList = [
- ...this.memo,
- ...this.tableData.filter((item) =>
- this.selectList.includes(item.onlyCode)
- ),
- ];
- if (!selectList.length) {
- uni.showToast({
- icon: "none",
- title: "请选择需添加的备品备件",
- });
- return;
- }
- // this.registerlist.push(this.chooseItem)
- this.currentRow.tableData = selectList;
- let selectNum = 0;
- this.currentRow.tableData.forEach((item) => {
- selectNum += item.isUnpack ? 1 : item.measurementUnit || 0;
- });
- this.currentRow.selectNum = selectNum;
- this.collapseVal = this.currentRow.informationCode;
- console.log(this.collapseVal);
- this.close();
- },
- open(...args) {
- // this.getTableData()
- },
- //获取仓库
- getwarehouseList() {
- post(this.apiUrl + "/warehouseGoodsshelves/select/warehouseList").then(
- (res) => {
- if (res.success) {
- this.warehouseList = res.data
- .filter((i) => !i.isDelete && !!i.status)
- .map((n) => {
- return {
- name: n.name,
- id: n.id,
- };
- });
- }
- }
- );
- },
- warehosueConfirm() {
- const obj = this.warehouseList[this.warehouseInfo?.detail?.value] || {};
- this.warehosueName = obj.name;
- this.warehouseId = obj.id;
- this.registerlist = [];
- this.showConfirm = false;
- },
- warehosueCancel() {
- this.warehosueVal = this.warehouseList.findIndex(
- (i) => i.id === this.warehouseId
- );
- this.showConfirm = false;
- },
- bindPickerChange(val) {
- this.warehosueVal = val?.detail?.value;
- if (
- this.warehouseId &&
- (this.registerlist.length > 0 ||
- this.registerlist.some((i) => i.tableData.length))
- ) {
- this.warehouseInfo = val;
- this.showConfirm = true;
- } else {
- const obj = this.warehouseList[val?.detail?.value] || {};
- this.warehosueName = obj.name;
- this.warehouseId = obj.id;
- this.registerlist = [];
- }
- },
- getTableData() {
- const params = {
- assetCode: this.currentRow.informationCode,
- searchKey: this.searchKey,
- warehouseId: this.warehouseId,
- };
- this.memo.push(
- ...this.tableData.filter((item) =>
- this.selectList.includes(item.onlyCode)
- )
- );
- this.selectList = [];
- get(
- this.apiUrl + "/outInWarehouse/getWarehouseActualDetail",
- params
- ).then((res) => {
- if (res?.success) {
- this.tableData = res.data;
- this.$nextTick(() => {
- this.tableData.map((i, idx) => {
- const index = this.memo.findIndex(
- (itm) => i.onlyCode === itm.onlyCode
- );
- if (index > -1) {
- this.selectList.push(i.onlyCode);
- this.memo.splice(index, 1);
- }
- });
- });
- }
- });
- },
- // 备品备件行选中事件
- rowclick(item, index) {
- this.chooseIndex = index;
- this.selectIndex = [index];
- this.chooseItem = item;
- },
- openPlus(item) {
- if (!this.warehouseId) {
- uni.showToast({
- title: "请选择仓库!",
- icon: "none",
- });
- return;
- }
- this.selectList = [];
- this.memo = uni.$u.deepClone(item.tableData);
- this.currentRow = item;
- this.popShow = true;
- this.getTableData();
- },
- timeConfirm() {
- this.timeShow = false;
- },
- timeCancel() {
- this.timeShow = false;
- },
- resetEqui() {
- this.pickerDeptShow = true;
- this.$refs.pickerDeptName.show();
- },
- handleChange(e) {
- let data = e.detail.value[e.detail.value.length - 1];
- this.classificationId = data.value;
- page = 1;
- isEnd = true;
- uni.showLoading({
- title: "数据加载中",
- });
- this.getList();
- },
- getTreeList() {
- postJ(this.apiUrl + "/classificationTree/list", [4]).then((res) => {
- // console.log(res)
- if (res.success) {
- this.treeList = res.data;
- this.pickerDeptShow = true;
- this.$refs.pickerDeptName.show();
- }
- });
- },
- getFirstList: function () {
- page = 1;
- isEnd = true;
- uni.showLoading({
- title: "数据加载中",
- });
- this.getList();
- },
- getMoreLists: function () {
- //获取更多数据
- page++;
- this.getList();
- },
- //获取列表数据
- getList() {
- post(this.apiUrl + "/classificationSpareParts/classificationSpare/list", {
- page,
- size,
- code: "",
- classificationId: this.classificationId,
- })
- .then((res) => {
- // console.log(res)
- let data = res.data.records;
- let pageTotal = res.data.pages;
- if (page === 1) {
- data.forEach((el) => {
- el.num = 0;
- });
- this.list = data;
- } else {
- data.forEach((element) => {
- element.num = 0;
- this.list.push(element);
- });
- }
- page < pageTotal ? (isEnd = false) : (isEnd = true);
- })
- .then(() => {
- uni.hideLoading();
- });
- },
- submit(data) {
- let list = data;
- let pickData = list.filter((item) => {
- return item.checked && !item.disabled && item.num > 0;
- });
- if (pickData.length == 0) {
- uni.showToast({
- title: "请选择备品备件数量",
- icon: "none",
- duration: 2000,
- });
- return;
- }
- this.$store.dispatch("maintenance/setSparepartIndex", this.index);
- this.$store.dispatch("maintenance/setSparepart", pickData);
- this.$store.dispatch("maintenance/setEquiIndex", this.equiIndex);
- this.back();
- },
- },
- };
- </script>
- <style lang="scss" scoped>
- .instance-list {
- background-color: #fff;
- font-size: 28rpx;
- .row {
- position: relative;
- padding: 10rpx 20rpx;
- & + .row {
- margin-top: 10rpx;
- }
- .uni-icons {
- position: absolute;
- top: 10rpx;
- right: 20rpx;
- }
- }
- }
- /deep/.uni-data-tree-input {
- display: none;
- }
- .no_data {
- position: fixed;
- top: 50%;
- left: 50%;
- transform: translate(-50%, -50%);
- .center {
- text-align: center;
- color: #555;
- font-size: $uni-font-size-base;
- }
- }
- .footer {
- position: fixed;
- display: flex;
- justify-content: space-between;
- align-items: center;
- bottom: 0;
- width: 100%;
- height: 90rpx;
- text-align: center;
- border-top: 1rpx solid #eeecec;
- background-color: #ffffff;
- .bottom {
- font-size: $uni-font-size-lg;
- margin-left: 20rpx;
- .select-all {
- color: $j-primary-green;
- }
- }
- .footer-span-btn {
- height: 30rpx;
- line-height: 30rpx;
- font-size: $uni-font-size-lg;
- color: #ffffff;
- margin-right: 20rpx;
- padding: 10rpx 20rpx;
- text-align: center;
- background-color: $j-primary-green;
- border-radius: 40rpx;
- }
- }
- .footer-right {
- justify-content: flex-end;
- }
- .sparepart-container {
- padding: 40rpx 20rpx;
- margin-bottom: 120rpx;
- .infos {
- border: 1rpx solid rgba(242, 242, 242, 1);
- padding: 0 20rpx;
- .col {
- height: 60rpx;
- line-height: 60rpx;
- display: flex;
- align-items: stretch;
- font-size: 28rpx;
- & + .col {
- margin-top: 4rpx;
- }
- .label {
- display: inline-block;
- width: 200rpx;
- padding-right: 20rpx;
- text-align: right;
- background-color: rgba(215, 215, 215, 1);
- }
- .content {
- flex: 1;
- background-color: rgba(242, 242, 242, 1);
- padding-left: 8rpx;
- border: 1rpx solid rgba(215, 215, 215, 1);
- }
- }
- }
- .detail-title {
- font-size: 34rpx;
- padding: 20rpx 0;
- margin-top: 10rpx;
- display: flex;
- justify-content: space-between;
- .u-button {
- width: 180rpx;
- margin: 0;
- }
- }
- .detail-content {
- border: 1rpx solid rgba(242, 242, 242, 1);
- min-height: 50vh;
- padding-bottom: 100rpx;
- .col {
- font-size: 30rpx;
- border-bottom: 1rpx solid rgba(242, 242, 242, 1);
- display: flex;
- padding: 10rpx;
- align-items: center;
- justify-content: space-between;
- background-color: rgba(242, 242, 242, 0.372549019607843);
- }
- .plus {
- width: 40rpx;
- height: 40rpx;
- line-height: 38rpx;
- text-align: center;
- background-color: $j-primary-border-green;
- color: #fff;
- margin: 16rpx 0 0 16rpx;
- }
- }
- /deep/.u-number-box {
- .u-number-box__minus,
- .u-number-box__plus,
- .u-number-box__input {
- font-size: 30rpx;
- height: 1.6em !important;
- }
- .u-number-box__input {
- width: 2em !important;
- }
- .u-number-box__minus,
- .u-number-box__plus {
- background-color: $j-primary-border-green !important;
- .u-icon__icon {
- color: #fff !important;
- }
- }
- }
- }
- .select-container {
- // height:60vh;
- .title {
- height: 70rpx;
- line-height: 70rpx;
- text-align: center;
- background-color: $j-primary-border-green;
- font-weight: bold;
- position: relative;
- font-size: 28rpx;
- color: #fff;
- .btn-box {
- position: absolute;
- top: 50%;
- right: 10rpx;
- transform: translateY(-50%);
- }
- .btn {
- width: 60rpx;
- height: 32rpx;
- display: inline-block;
- font-size: 28rpx;
- border: 1px solid #fff;
- text-align: center;
- line-height: 30rpx;
- }
- }
- input {
- display: block;
- margin: 8rpx auto;
- width: 720rpx;
- height: 72rpx;
- border: 1rpx solid rgb(153, 153, 153);
- padding-left: 8rpx;
- }
- /deep/.uni-table {
- margin-top: 10rpx;
- // min-width: 100% !important;
- // max-width: 100%;
- }
- .uni-table-th-row {
- padding: 24rpx 0 !important;
- }
- .uni-table-td,
- .uni-table-th {
- font-size: 28rpx;
- }
- .uni-table-th {
- background-color: rgba(242, 242, 242, 1);
- padding: 24rpx 0 !important;
- }
- .table-wrapper {
- height: 75vh;
- overflow: auto;
- padding: 20rpx;
- }
- }
- .sparepart-footer {
- width: 100%;
- height: 80px;
- display: flex;
- align-items: center;
- justify-content: space-around;
- position: fixed;
- bottom: 0;
- background: #fff;
- button {
- width: 300rpx;
- height: 80rpx;
- line-height: 80rpx;
- &.primary {
- background-color: $j-primary-border-green;
- color: #fff;
- }
- }
- }
- .listContent {
- flex: 1;
- overflow: auto;
- padding-bottom: 125rpx;
- .self-table-tr {
- padding: 5rpx 0;
- border-bottom: 1rpx solid #ccc;
- }
- }
- .self-table-header {
- padding: 20rpx;
- border-bottom: 1rpx solid #ccc;
- }
- .self-table-tr,
- .self-table-header {
- font-size: 28rpx;
- display: flex;
- justify-content: space-between;
- flex-wrap: wrap;
- .table-date,
- .table-batch,
- .table-code {
- box-sizing: border-box;
- width: 27%;
- padding: 0 5rpx;
- word-break: break-all;
- }
- .table-code {
- width: 50%;
- }
- .table-date {
- width: 37%;
- }
- .other-info {
- color: #aaa;
- width: 100%;
- display: flex;
- justify-content: space-between;
- font-size: 28rpx;
- flex-wrap: wrap;
- > view {
- margin-bottom: 10rpx;
- }
- }
- .checked {
- width: 100%;
- display: flex;
- justify-content: flex-end;
- }
- }
- </style>
|