From 581b26f9ecf44b43723969c0e8cac7a335d64db0 Mon Sep 17 00:00:00 2001 From: liuguocan <527956374@qq.com> Date: 星期二, 28 十一月 2023 16:29:17 +0800 Subject: [PATCH] 物品报废列表/详情 --- admin-web/src/views/departmentitem/itemscr/scrappDetails/index.vue | 88 ---------------- admin-web/src/views/departmentitem/itemscr/scrapping/detail.vue | 198 ++++++++++++++++++++++++++++---------- 2 files changed, 148 insertions(+), 138 deletions(-) diff --git a/admin-web/src/views/departmentitem/itemscr/scrappDetails/index.vue b/admin-web/src/views/departmentitem/itemscr/scrappDetails/index.vue index 6377cb4..59395d0 100644 --- a/admin-web/src/views/departmentitem/itemscr/scrappDetails/index.vue +++ b/admin-web/src/views/departmentitem/itemscr/scrappDetails/index.vue @@ -14,7 +14,7 @@ </el-col> </el-row> <!--娣诲姞/缂栬緫寮圭獥--> - <edit v-if="editSetting.show" :setting="editSetting" @close="editSetting.show = false" @search="search"/> + <detail v-if="editSetting.show" :setting="editSetting" @close="editSetting.show = false"/> </el-card> </el-container> </el-container> @@ -30,14 +30,14 @@ import MyTableV2 from "@/components/myTable/myTableV2"; import MyButton from "@/components/myButton/myButton"; import SettingIplatform from '@/utils/settingIplatform'; -import edit from './edit' +import detail from '@/views/departmentitem/itemscr/scrapping/detail' import * as finsystenant from '@/api/baseSetting/finsystenant' import myImport from '@/views/components/myImport' import {getBaseUrl} from '@/utils/base'; export default { name: "index", - components: {MyButton, MyTableV2, edit, myImport}, + components: {MyButton, MyTableV2, detail, myImport}, data() { return { // 鎼滅储妗� @@ -181,90 +181,10 @@ this.initTreeData() }, methods: { - //瀵煎叆 - importOrg() { - this.importSetting.dialogShow = true - this.importSetting.onSuccess = (response, callBack) => { - if (response.code===1){ - this.$message.success(response.msg) - this.search(1) - }else{ - this.$message.warning(response.msg) - } - callBack() - } - }, - // 宸︿晶鏍戝垵濮嬪寲 - initTreeData() { - finsystenant.getTree().then(res => { - const content = res || [] - this.treeDataList.splice(0, this.treeDataList.length) - this.treeDataList = content - if (content.length > 0) { - this.importSetting.fileSettings.data = {pid: content[0].id} - } - }) - }, - updState(row) { - let vm = this - let text = row.status == 0 ? "鍚敤" : "绂佺敤"; - vm.$modal.confirm('纭瑕�' + text + '"' + row.name + '"鍚楋紵').then(function () { - let params = Object.assign({}, row) - params.status = row.status == 1 ? 0 : 1 - finsystenant.edit(params).then(res => { - if (res) { - row.status = row.status === 1 ? 0 : 1 - vm.$modal.msgSuccess(text + "鎴愬姛"); - vm.search() - } - }) - }) - }, - del(row) { - this.$modal - .confirm('鏄惁纭鍒犻櫎鍚嶇О涓�"' + row.name + '"鐨勬満鏋勫悧锛�') - .then(function () { - finsystenant.del({id: row.id}).then((res) => { - }); - }) - .then((res) => { - this.$message.success('鍒犻櫎鎴愬姛锛�'); - this.search() - }) - .catch(() => { - }); - }, - showAdd() { - // if (!this.editSetting.orgId) { - // this.$message.warning('璇峰厛閫夋嫨宸︿晶鏈烘瀯') - // } else { - this.editSetting.id = null; - this.editSetting.info = null; - this.editSetting.title = '鏂板'; - this.editSetting.show = true; - // } - }, showAudit(row) { this.editSetting.id = row.id; - this.editSetting.info = JSON.stringify(row); - this.editSetting.title = '缂栬緫'; + this.editSetting.title = '璇︽儏'; this.editSetting.show = true; - }, - nodeClick(param) { - param = param || {} - this.p = Object.assign({}, { - id: param.id, - name: param.name - }) - if (this.p.id != undefined && this.p.id != null) { - this.filterFrom.tenantId = this.p.id - this.editSetting.orgId = this.p.id - } else { - this.filterFrom.tenantId = null - this.editSetting.orgId = null - } - this.importSetting.fileSettings.data = {pid: param.id} - this.search(1) }, // 鏌ヨtable鍒楄〃 search(pageNum) { diff --git a/admin-web/src/views/departmentitem/itemscr/scrapping/detail.vue b/admin-web/src/views/departmentitem/itemscr/scrapping/detail.vue index b513998..2ad40fd 100644 --- a/admin-web/src/views/departmentitem/itemscr/scrapping/detail.vue +++ b/admin-web/src/views/departmentitem/itemscr/scrapping/detail.vue @@ -1,79 +1,116 @@ <template> - <win-md class="stock-detail" :title="setting.title" @close="close" :width="'800px'"> + <win-lg class="stock-detail" :title="setting.title" @close="close" :width="'800px'" :loading="loading"> <el-row :gutter="20"> <el-col :span="8"> - <span>鍑哄簱鍗曞彿锛�</span> - <span>{{ detail.businessFormCode }}</span> - </el-col> - <el-col :span="8"> - <span>鍑哄簱浠撳簱锛�</span> - <span>{{ detail.warehouseName }}</span> + <span>鎶ュ簾鍗曞彿锛�</span> + <span>SL2023001</span> </el-col> <el-col :span="8"> <span>鎵�灞炴満鏋勶細</span> - <span>{{ detail.agencyName }}</span> + <span>娌冲崡鐪侀偖鏀垮垎鍏徃</span> + </el-col> + <el-col :span="8"> + <span>閮ㄩ棬锛�</span> + <span>閲戣瀺涓氬姟閮�</span> </el-col> </el-row> <el-row :gutter="20" style="margin-top: 20px"> <el-col :span="8"> - <span>鍒涘缓浜猴細</span> - <span>{{ detail.operatorName }}</span> + <span>鎶ュ簾浜猴細</span> + <span>寮犵埍鐢�</span> </el-col> <el-col :span="8"> - <span>鍑哄簱鏃堕棿锛�</span> - <span>{{ detail.dealTime | formatTime }}</span> + <span>鎶ュ簾鏃堕棿锛�</span> + <span>2023-08-08 10:23:12</span> </el-col> </el-row> - <el-row v-if="detail.procureDoc" :gutter="20" style="margin-top: 20px"> + <el-row :gutter="20" style="margin-top: 20px"> <el-col class="img-row" :span="24"> - <span>鍑哄簱鎵嬬画锛�</span> - <div class="img-box"></div> + <span>鎶ュ簾鎵嬬画锛�</span> + <div class="img-box" v-for="(item, index) in fileList" :key="index" @click="handlePreview(item)"> + <img class="img" :src="getUrl(item.path)" alt="" /> + </div> </el-col> </el-row> - <div class="goods-card" v-for="(goodsItem, goodsIndex) in detail.fromOutputGoods" :key="goodsIndex"> + <div class="goods-card" v-for="(goodsItem, goodsIndex) in detail.procureGoods" :key="goodsIndex"> <el-row :gutter="20"> - <el-col :span="8"> + <el-col :span="6"> <span>鐗╁搧鍒嗙被锛�</span> - <span>{{ goodsItem.categoryName }}</span> + <span>{{ goodsItem.baseCategoryName }}</span> </el-col> - <el-col :span="8"> + <el-col :span="6"> <span>鐗╁搧鍚嶇О锛�</span> - <span>{{ goodsItem.goodsName }}</span> + <span>{{ goodsItem.goodsTemplateName }}</span> + </el-col> + <el-col :span="6"> + <span>鐗╁搧绫诲埆锛�</span> + <span>{{ goodsItem.supplier }}</span> + </el-col> + <el-col :span="6"> + <span>鍒嗗彂鍗曞彿锛�</span> + <span>{{ goodsItem.supplier }}</span> </el-col> </el-row> - <el-table :data="goodsItem.models" :stripe="true" style="margin-top: 20px"> - <el-table-column prop="baseGoodsModelsName" label="瑙勬牸鍨嬪彿" align="center"> - <template slot-scope="scope"> - {{ scope.row.baseGoodsModelsName }} - </template> - </el-table-column> - <el-table-column label="鍗曚綅" align="center"> - <template slot-scope="scope"> - {{ scope.row.unit }} - </template> - </el-table-column> - <el-table-column prop="counts" label="鍑哄簱鏁伴噺" align="center"> - <template slot-scope="scope"> - {{ scope.row.counts }} - </template> - </el-table-column> - <el-table-column prop="counts" label="閲戦" align="center"> - <template slot-scope="scope"> - {{ scope.row.price * scope.row.counts | formatPrice}} - </template> - </el-table-column> - </el-table> + <div> + <el-table :data="goodsItem.models" :stripe="true" style="margin-top: 20px"> + <el-table-column prop="baseGoodsModelsName" label="瑙勬牸鍨嬪彿" align="center"> + <template slot-scope="scope"> + {{ scope.row.baseGoodsModelsName }} + </template> + </el-table-column> + <el-table-column label="鍗曚綅" align="center"> + <template slot-scope="scope"> + {{ scope.row.unit }} + </template> + </el-table-column> + <el-table-column label="浣跨敤浜�" align="center" v-if="goodsItem.type===1"> + <template slot-scope="scope"> + {{ scope.row.unit }} + </template> + </el-table-column> + <el-table-column prop="price" label="鍐嶇敤鏁伴噺" align="center"> + <template slot-scope="scope"> + {{ scope.row.counts }} + </template> + </el-table-column> + <el-table-column prop="counts" label="鎶ュ簾鏁伴噺" align="center"> + <template slot-scope="scope"> + {{ scope.row.counts }} + </template> + </el-table-column> + <el-table-column prop="counts" label="鎶ュ簾鍘熷洜" align="center"> + <template slot-scope="scope"> + {{ scope.row.price }} + </template> + </el-table-column> + </el-table> + </div> </div> - </win-md> + <div id="uploadPreviewImages" style="display: none"> + <span v-for="(src, index) in fileList" :key="index"> + <img + v-if="checkImg(src.name)" + class="v-img" + :src="src.url" + :alt="src.name" + style="width: 100px; height: 100px" + /> + </span> + </div> + </win-lg> </template> <script> -import { outputDetail } from '@/api/stock/accessStock'; -import winMd from '@/components/win/win-md'; +import { procureDetail } from '@/api/stock/procure/purchaseOrder'; +import winLg from '@/components/win/win-lg'; import * as DateFormatter from '@/utils/DateFormatter'; +import { getDownUrl } from '@/utils/base'; +import Viewer from 'viewerjs'; +import 'viewerjs/dist/viewer.css'; + +let viewer = null; export default { - components: { winMd }, - + components: { winLg }, props: { setting: { type: Object, @@ -82,21 +119,26 @@ }, data() { return { + loading:false, + fileList: [], detail: { - categoryName: '', + baseCategoryName: '', businessFormCode: '', - goodsName: '', + goodsTemplateName: '', + procureDoc: '', agencyId: '', agencyName: '', states: '', createName: '', - fromOutputGoods: [], + time: '', + procureGoods: [{}, {}], + fileKey: Math.random(), }, }; }, filters: { formatTime(time) { - if (!time) return; + if (!time) return '-'; return DateFormatter.LongToDateTime(time); }, formatPrice(price) { @@ -104,17 +146,65 @@ } }, created() { - outputDetail({ id: this.setting.id }).then((res) => { + procureDetail({ id: this.setting.id }).then((res) => { this.detail = res; + this.fileList = this.detail.procureDoc ? JSON.parse(this.detail.procureDoc) : []; + this.$nextTick(() => { + this.initPreviewImg(); + }); }); }, methods: { + initPreviewImg() { + if (viewer != null) { + viewer.destroy(); + } + const ViewerDom = document.querySelector('#uploadPreviewImages'); + viewer = new Viewer(ViewerDom, {}); + }, + handlePreview(file) { + if (!this.checkImg(file.name)) { + return false; + } + let index = 0; + for (let i = 0; i < this.fileList.length; i++) { + const f = this.fileList[i]; + if (this.checkImg(f.name)) { + if (file.id == f.id) { + break; + } + index++; + } + } + // this.fileList.forEach((f, i) => { + // if (file.uid == f.uid) { + // index = i + // } + // }) + // document.querySelector('#uploadPreviewImages').children[0].click() + viewer.view(index); + }, + checkImg(name) { + const suffix = name.substring(name.lastIndexOf('.'), name.length); + const imgArray = ['.jpg', '.jpeg', '.png', '.bmp']; + if (imgArray.indexOf(suffix) < 0) { + return false; + } + return true; + }, + getUrl(path) { + if (path.substr(0, 7).toLowerCase() == 'http://' || path.substr(0, 8).toLowerCase() == 'https://') { + return path; + } else { + return getDownUrl() + path; + } + }, close() { - this.$emit('close') + this.$emit('close'); }, }, }; </script> <style lang="scss" scoped> -@import url(../../../../styles/store.scss); +//@import url(../../../../styles/store.scss); </style> -- Gitblit v1.9.1