123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664 |
- <template>
- <div class="app-container">
- <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch">
- <el-form-item label="仓库名称" prop="fName">
- <el-input v-model="queryParams.fName" placeholder="请输入仓库名称" clearable size="small"
- @keyup.enter.native="handleQuery" />
- </el-form-item>
- <el-form-item label="状态" prop="status">
- <el-select v-model="queryParams.status" placeholder="仓库状态" clearable size="small">
- <el-option v-for="dict in statusOptions" :key="dict.dictValue" :label="dict.dictLabel"
- :value="dict.dictValue" />
- </el-select>
- </el-form-item>
- <el-form-item>
- <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
- <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
- </el-form-item>
- </el-form>
- <el-row :gutter="10" class="mb8">
- <el-col :span="1.5">
- <el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAdd"
- v-hasPermi="['basicdata:warehouse:add']">新增</el-button>
- </el-col>
- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
- </el-row>
- <el-table v-loading="loading" :data="deptList" row-key="fId" :default-expand-all="false" lazy
- :tree-props="{children: 'children', hasChildren: 'hasChildren'}" :load="getTreeLoad" ref="table">
- <el-table-column prop="fName" label="仓库名称" width="310"></el-table-column>
- <el-table-column prop="fTotalgross" label="库容(吨)" width="100"></el-table-column>
- <el-table-column prop="fLocation" label="库位" width="100">
- <template slot-scope="scope">
- <span v-if="scope.row.fLocation === 0">否</span>
- <span v-else>是</span>
- </template>
- </el-table-column>
- <el-table-column prop="fAddr" label="地址" width="200"></el-table-column>
- <el-table-column prop="fContacts" label="联系人" width="100"></el-table-column>
- <el-table-column prop="fTel" label="电话" width="150"></el-table-column>
- <el-table-column prop="fCharg" label="计费" width="50">
- <template slot-scope="scope">
- <span v-if="scope.row.fCharg === 0">否</span>
- <span v-else>是</span>
- </template>
- </el-table-column>
- <el-table-column prop="fIsBonded" label="保税" width="50">
- <template slot-scope="scope">
- <span v-if="scope.row.fIsBonded == 1">是</span>
- <span v-else>否</span>
- </template>
- </el-table-column>
- <el-table-column prop="supervise" label="监管" width="50">
- <template slot-scope="scope">
- <span v-if="scope.row.supervise === 0">否</span>
- <span v-else>是</span>
- </template>
- </el-table-column>
- <el-table-column prop="remark" label="备注" width="100"></el-table-column>
- <el-table-column prop="orderNum" label="排序" width="50"></el-table-column>
- <el-table-column prop="fStatus" label="状态" :formatter="statusFormat" width="50"></el-table-column>
- <el-table-column label="创建时间" align="center" prop="createTime" width="170">
- <template slot-scope="scope">
- <span>{{ parseTime(scope.row.createTime) }}</span>
- </template>
- </el-table-column>
- <el-table-column label="操作" align="center" width="200" fixed="right" class-name="small-padding fixed-width">
- <template slot-scope="scope">
- <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
- v-hasPermi="['basicdata:warehouse:edit']">修改</el-button>
- <el-button size="mini" type="text" icon="el-icon-plus" @click="handleAdd(scope.row)"
- v-hasPermi="['basicdata:warehouse:add']">新增</el-button>
- <el-button size="mini" type="text" icon="el-icon-plus" v-if="scope.row.fLocation === 1"
- @click="handleView(scope.row)">查看监控</el-button>
- <el-button v-if="scope.row.parentId != 0" size="mini" type="text" icon="el-icon-delete"
- @click="handleDelete(scope.row)" v-hasPermi="['basicdata:warehouse:remove']">删除</el-button>
- </template>
- </el-table-column>
- </el-table>
- <el-dialog title="监控列表" v-dialogDrag :visible.sync="dialogVideoList" :close-on-click-modal="false">
- <el-table v-loading="loading" :data="list" style="width: 100%;">
- <el-table-column label="序号" type="index" width="50" />
- <el-table-column label="仓库" :width="200" prop="fWarehouseName" header-align="center" align="center"
- :show-overflow-tooltip="true" />
- <el-table-column label="库位" :width="200" prop="libraryPosition" header-align="center" align="center"
- :show-overflow-tooltip="true" />
- <el-table-column label="监控项目" :width="200" prop="projectId" header-align="center" align="center"
- :show-overflow-tooltip="true">
- <template slot-scope="scope">
- <span>
- {{ scope.row.projectId | projectIdFormat(projectIdOptions) }}
- </span>
- </template>
- </el-table-column>
- <el-table-column label="设备序列号" :width="200" prop="deviceName" header-align="center" align="center"
- :show-overflow-tooltip="true" />
- <el-table-column label="仓库" :width="200" prop="deviceSerial" header-align="center" align="center"
- :show-overflow-tooltip="true" />
- <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="100" fixed="right">
- <template slot-scope="scope">
- <el-button size="mini" type="text" icon="el-icon-view" @click="rowView(scope.row)">
- 查看视频
- </el-button>
- </template>
- </el-table-column>
- </el-table>
- </el-dialog>
- <el-dialog title="查看监控" v-dialogDrag :visible.sync="dialogVideo" :close-on-click-modal="false" @closed="videoClose">
- <div style="width:100%; height:80vh;">
- <iframe v-if="dialogVideo" :src="iframeSrc" width="100%" height="100%" frameborder="0" scrolling="no">
- </iframe>
- </div>
- </el-dialog>
- <!-- 添加或修改仓库对话框 -->
- <el-dialog v-dialogDrag :fullscreen="dialogFull" :title="title" :visible.sync="open" :close-on-click-modal="false"
- width="70%" append-to-body>
- <template slot="title">
- <div class="avue-crud__dialog__header">
- <span class="el-dialog__title">
- <span
- style="display:inline-block;width:3px;height:20px;margin-right:5px; float: left;margin-top:2px"></span>
- 添加仓库
- </span>
- <div class="avue-crud__dialog__menu enlarge" @click="full">
- <i
- style="cursor: pointer;display: block;width:12px;height:12px;border:1px solid #909399;border-top:3px solid #909399;margin-top: -3px;"></i>
- </div>
- </div>
- </template>
- <el-form ref="form" :model="form" :rules="rules" label-width="80px">
- <el-row>
- <el-col :span="8" v-if="form.parentId !== 0">
- <el-form-item label="上级仓库" prop="parentId">
- <treeselect v-model="form.parentId" :options="deptOptions" :normalizer="normalizer"
- placeholder="选择上级仓库" />
- </el-form-item>
- </el-col>
- </el-row>
- <el-row>
- <el-col :span="8">
- <el-form-item label="仓库编号" prop="fNo">
- <el-input v-model="form.fNo" placeholder="请输入仓库编号" />
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="仓库名称" prop="fName">
- <el-input v-model="form.fName" placeholder="请输入仓库名称" @change="nameChange" />
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="是否为库位" prop="fLocation " label-width="82px">
- <el-select v-model="form.fLocation" style="width:100%">
- <el-option label="是" value="1" />
- <el-option label="否" value="0" />
- </el-select>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row>
- <el-col :span="8">
- <el-form-item label="显示排序" prop="orderNum">
- <el-input-number v-model="form.orderNum" style="width:100%" controls-position="right" :min="0" />
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="地址" prop="fAddr">
- <el-input v-model="form.fAddr" placeholder="请输入地址" />
- </el-form-item>
- </el-col>
- <!-- </el-row>-->
- <!-- <el-row>-->
- <el-col :span="8">
- <el-form-item label="联系人" prop="fContacts">
- <el-input v-model="form.fContacts" placeholder="请输入联系人" />
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="电话" prop="fTel">
- <el-input v-model="form.fTel" placeholder="请输入电话"
- oninput='this.value=this.value.replace(/[^\-?\d]/g,"")' />
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="是否计费" prop="fCharg">
- <el-select v-model="form.fCharg" style="width: 100%">
- <el-option label="是" value="1" />
- <el-option label="否" value="0" />
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item v-if="form.fLocation === '1'" label="库容(吨)" prop="fTotalgross">
- <el-input v-model="form.fTotalgross" placeholder="请输入库容(吨位)" />
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="状态">
- <el-radio-group v-model="form.fStatus">
- <el-radio v-for="dict in statusOptions" :key="dict.dictValue" :label="dict.dictValue">{{dict.dictLabel}}
- </el-radio>
- </el-radio-group>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row>
- <el-col :span="8">
- <el-form-item label="是否保税">
- <el-select v-model="form.fIsBonded" style="width: 100%">
- <el-option label="是" value="1" />
- <el-option label="否" value="0" />
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="简称" prop="fCname">
- <el-input v-model="form.fCname" placeholder="请输入简称"></el-input>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="是否监管库" prop="supervise" label-width="82px">
- <el-select v-model="form.supervise" style="width: 100%">
- <el-option label="是" :value="1" />
- <el-option label="否" :value="0" />
- </el-select>
- </el-form-item>
- </el-col>
- </el-row>
- <!--<el-form-item label="状态,默认 T ,正常T 停用F 下拉选择">
- <el-radio-group v-model="form.fStatus">
- <el-radio label="1">请选择字典生成</el-radio>
- </el-radio-group>
- </el-form-item>-->
- <!--<el-form-item label="删除状态" prop="delFlag">
- <el-input v-model="form.delFlag" placeholder="请输入删除状态" />
- </el-form-item>-->
- <el-form-item label="备注" prop="remark">
- <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
- </el-form-item>
- </el-form>
- <up-load :relevantAttachments="relevantAttachments" :createBy="username"></up-load>
- <div slot="footer" class="dialog-footer">
- <el-button type="primary" @click="submitForm">确 定</el-button>
- <el-button @click="cancel">取 消</el-button>
- </div>
- </el-dialog>
- </div>
- </template>
- <script>
- import { listDept, getDept, delDept, addDept, updateDept, listDeptExcludeChild, lazyListDept } from "@/api/basicdata/dept";
- import { list } from "@/api/monitor/monitorList";
- import Treeselect from "@riophae/vue-treeselect";
- import "@riophae/vue-treeselect/dist/vue-treeselect.css";
- import Vue from 'vue'
- import upLoad from "@/views/Warehousing/components/upLoad";
- import Cookies from "js-cookie";
- import Axios from "axios";
- Vue.directive('dialogDrag', {
- bind(el, binding, vnode, oldVnode) {
- const dialogHeaderEl = el.querySelector('.el-dialog__header')
- const dragDom = el.querySelector('.el-dialog')
- const enlarge = el.querySelector('.enlarge')
- dialogHeaderEl.style.cursor = 'move'
- // 获取原有属性 ie dom元素.currentStyle 火狐谷歌 window.getComputedStyle(dom元素, null);
- const sty = dragDom.currentStyle || window.getComputedStyle(dragDom, null)
- if (enlarge) {
- enlarge.onclick = (e) => {
- dragDom.style.top = '0px'
- dragDom.style.left = '0px'
- }
- }
- dialogHeaderEl.onmousedown = (e) => {
- // 鼠标按下,计算当前元素距离可视区的距离
- const disX = e.clientX - dialogHeaderEl.offsetLeft
- const disY = e.clientY - dialogHeaderEl.offsetTop
- // 获取到的值带px 正则匹配替换
- let styL, styT
- // 注意在ie中 第一次获取到的值为组件自带50% 移动之后赋值为px
- if (sty.left.includes('%')) {
- styL = +document.body.clientWidth * (+sty.left.replace(/\%/g, '') / 100)
- styT = +document.body.clientHeight * (+sty.top.replace(/\%/g, '') / 100)
- } else {
- styL = +sty.left.replace(/\px/g, '')
- styT = +sty.top.replace(/\px/g, '')
- }
- document.onmousemove = function (e) {
- // 通过事件委托,计算移动的距离
- const l = e.clientX - disX
- const t = e.clientY - disY
- // 移动当前元素
- if ((t + styT) >= 0) {
- dragDom.style.top = `${t + styT}px`
- }
- dragDom.style.left = `${l + styL}px`
- // 将此时的位置传出去
- // binding.value({x:e.pageX,y:e.pageY})
- }
- document.onmouseup = function (e) {
- document.onmousemove = null
- document.onmouseup = null
- }
- }
- }
- })
- export default {
- name: "Dept",
- components: {
- Treeselect,
- upLoad,
- },
- data() {
- return {
- total: 0,
- // 表格数据
- list: [],
- dialogVideoList: false,
- dialogVideo: false,
- //全屏放大
- dialogFull: false,
- // 遮罩层
- loading: true,
- // 显示搜索条件
- showSearch: true,
- // 表格树数据
- deptList: [],
- maps: [],
- // 仓库树选项
- deptOptions: [],
- // 弹出层标题
- title: "",
- // 是否显示弹出层
- open: false,
- // 状态数据字典
- statusOptions: [],
- // 查询参数
- queryParams: {
- fName: undefined,
- status: undefined
- },
- // 表单参数
- form: {
- fLocation: 0
- },
- // 表单校验
- rules: {
- fNo: [
- { required: true, message: "编号不能为空", trigger: "blur" }
- ],
- fAddr: [
- { required: true, message: "地址不能为空", trigger: "blur" }
- ],
- // fTotalgross: [
- // { required: true, message: "库容不能为空", trigger: "blur" }
- // ],
- parentId: [
- { required: true, message: "上级仓库不能为空", trigger: "blur" }
- ],
- fName: [
- { required: true, message: "仓库名称不能为空", trigger: "blur" }
- ],
- fCname: [
- { required: true, message: " ", trigger: "blur" }
- ],
- orderNum: [
- { required: true, message: "显示排序不能为空", trigger: "blur" }
- ],
- phone: [
- {
- pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
- message: "请输入正确的手机号码",
- trigger: "blur"
- }
- ]
- },
- relevantAttachments: [],
- username: null,
- projectIdOptions:[],
- };
- },
- created() {
- this.getList();
- this.getDicts("sys_normal_disable").then(response => {
- this.statusOptions = response.data;
- });
- this.getDicts("monitor_project").then((response) => {
- this.projectIdOptions = response.data;
- });
- this.username = Cookies.get("userName");
- },
- filters: {
- projectIdFormat(row, list) {
- let name = ""
- list.map((e) => {
- if (row == e.dictValue) {
- name = e.dictLabel;
- }
- });
- return name;
- }
- },
- methods: {
- handleView(row) {
- this.dialogVideoList = true;
- this.loading = true;
- let data = {
- fWarehouseId: row.parentId,
- libraryPositionId: row.fId
- }
- list(data).then(response => {
- this.list = response.rows;
- this.total = response.total;
- this.loading = false;
- });
- },
- rowView(row) {
- Axios.post("/prod-api/api/LiveBroadcast/getAccessToken").then(res => {
- Axios.post(`/prod-api/api/LiveBroadcast/getToken?productCode=1640070936703286&token=${res.data.data.access_token}`).then(res2 => {
- console.log(res2)
- Axios({
- method: 'POST',
- url: '/prod-api/api/LiveBroadcast/videoWeb',
- params: {
- deviceSerial: row.deviceSerial,
- projectId: row.projectId,
- channelNo: row.code,
- token: res.data.data.access_token,
- Authorization: res2.data.data.data.Authorization
- }
- })
- .then(response => {
- this.dialogVideo = true
- this.iframeSrc = response.data.data.data.previewUrl
- this.start()
- });
- })
- })
- },
- videoClose() {
- this.iframeSrc = this.$options.data().iframeSrc;
- this.end()
- },
- start() {
- // 将定时器名字赋值到变量中
- this.timer = setTimeout(() => {
- this.dialogVideo = false;
- }, 60000);
- },
- end() {
- clearInterval(this.timer);
- this.timer = null
- },
- //全屏放大
- full() {
- this.dialogFull = !this.dialogFull
- },
- /** 查询仓库列表 */
- getList() {
- this.loading = true;
- lazyListDept(this.queryParams).then(res => {
- this.deptList = res.data
- this.loading = false
- })
- // listDept(this.queryParams).then(response => {
- // this.deptList = this.handleTree(response.data, "fId");
- // this.loading = false;
- // });
- },
- getTreeLoad(tree, treeNode, resolve) {
- lazyListDept({ parentId: tree.fId }).then(res => {
- resolve(res.data)
- })
- },
- /** 转换仓库数据结构 */
- normalizer(node) {
- if (node.children && !node.children.length) {
- delete node.children;
- }
- return {
- id: node.fId,
- label: node.fName,
- children: node.children
- };
- },
- // 字典状态字典翻译
- statusFormat(row, column) {
- return this.selectDictLabel(this.statusOptions, row.fStatus);
- },
- // 取消按钮
- cancel() {
- this.open = false;
- this.reset();
- },
- // 表单重置
- reset() {
- this.form = {
- fId: undefined,
- parentId: undefined,
- fName: undefined,
- orderNum: undefined,
- leader: undefined,
- phone: undefined,
- email: undefined,
- status: "0",
- fLocation: '0'
- };
- this.relevantAttachments = []
- this.resetForm("form");
- },
- /** 搜索按钮操作 */
- handleQuery() {
- this.getList();
- },
- /** 重置按钮操作 */
- resetQuery() {
- this.resetForm("queryForm");
- this.handleQuery();
- },
- /** 新增按钮操作 */
- handleAdd(row) {
- this.reset();
- if (row != undefined) {
- this.form.parentId = row.fId;
- }
- this.$set(this.form, 'fStatus', '0')
- this.$set(this.form, 'supervise', 0)
- // this.form.fStatus = '0'
- this.open = true;
- this.title = "添加仓库";
- listDept().then(response => {
- this.deptOptions = this.handleTree(response.data, "fId");
- });
- },
- /** 修改按钮操作 */
- handleUpdate(row) {
- this.reset();
- getDept(row.fId).then(response => {
- this.form = response.data;
- this.form.fLocation = this.form.fLocation + ''
- this.form.fCharg = this.form.fCharg + ''
- this.relevantAttachments = this.form.annexList ? this.form.annexList : [];
- this.open = true;
- this.title = "修改仓库";
- });
- listDeptExcludeChild(row.fId).then(response => {
- this.deptOptions = this.handleTree(response.data, "fId");
- });
- },
- /** 提交按钮 */
- submitForm: function () {
- this.$refs["form"].validate(valid => {
- if (valid) {
- if (this.form.fId != undefined) {
- console.log(this.relevantAttachments)
- this.form.annexList = this.relevantAttachments
- updateDept(this.form).then(response => {
- this.msgSuccess("修改成功");
- this.open = false;
- this.getList();
- });
- } else {
- this.form.annexList = this.relevantAttachments
- addDept(this.form).then(response => {
- this.msgSuccess("新增成功");
- this.open = false;
- this.getList();
- });
- }
- }
- });
- },
- /** 删除按钮操作 */
- handleDelete(row) {
- this.$confirm('是否确认删除名称为"' + row.fName + '"的数据项?', "警告", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(function () {
- return delDept(row.fId);
- }).then(() => {
- // this.getList();
- location.reload();
- this.msgSuccess("删除成功");
- })
- },
- nameChange() {
- this.$set(this.form, 'fCname', this.form.fName)
- },
- }
- };
- </script>
- <style lang="scss">
- .avue-crud__dialog__header {
- display: -webkit-box;
- display: -ms-flexbox;
- display: flex;
- -webkit-box-align: center;
- -ms-flex-align: center;
- align-items: center;
- -webkit-box-pack: justify;
- -ms-flex-pack: justify;
- justify-content: space-between;
- }
- .el-dialog__title {
- color: rgba(0, 0, 0, .85);
- font-weight: 500;
- word-wrap: break-word;
- }
- .avue-crud__dialog__menu {
- padding-right: 20px;
- float: left;
- }
- .avue-crud__dialog__menu i {
- color: #909399;
- font-size: 15px;
- }
- .el-icon-full-screen {
- cursor: pointer;
- }
- .el-icon-full-screen:before {
- content: "\e719";
- }
- </style>
- <style lang="scss" scoped>
- .tabSetting {
- display: flex;
- justify-content: flex-end;
- }
- .listStyle {
- display: flex;
- border-top: 1px solid #dcdfe6;
- border-left: 1px solid #dcdfe6;
- border-right: 1px solid #dcdfe6;
- }
- .listStyle:last-child {
- border-bottom: 1px solid #dcdfe6;
- }
- .progress {
- display: flex;
- align-items: center;
- padding: 2px;
- background-color: rgba(0, 0, 0, 0.05);
- height: 100%;
- }
- </style>
|