liujiangyong 2 years ago
parent
commit
ecb7b1dea3
  1. 35
      api/app/lib/controllers/projectRegime/projectSituation.js
  2. 3
      api/app/lib/routes/projectRegime/index.js
  3. 6
      api/config.js
  4. 18
      api/jenkinsfile
  5. 16
      api/log/development.log
  6. 18
      jenkinsfile_api
  7. 18
      jenkinsfile_web
  8. BIN
      weapp/images/noData.png
  9. 87
      weapp/pages/index/index.js
  10. 2
      weapp/pages/index/index.json
  11. 7
      weapp/pages/index/index.wxml
  12. 15
      weapp/pages/index/index.wxss
  13. 2
      weapp/project.config.json
  14. 5
      weapp/utils/getApiUrl.js
  15. 29
      web/Dockerfile
  16. 2
      web/client/src/index.js
  17. 2
      web/client/src/layout/components/header/index.js
  18. 12
      web/client/src/sections/projectRegime/actions/projectSituation.js
  19. 91
      web/client/src/sections/projectRegime/components/pointModel.js
  20. 80
      web/client/src/sections/projectRegime/containers/point.js
  21. 102
      web/client/src/sections/projectRegime/containers/qrCode.js
  22. 1
      web/client/src/utils/webapi.js
  23. 18
      web/jenkinsfile

35
api/app/lib/controllers/projectRegime/projectSituation.js

@ -8,9 +8,9 @@ async function projectList (ctx, next) {
const { limit, page, name, justStructure } = ctx.query; const { limit, page, name, justStructure } = ctx.query;
let options = { let options = {
// where: { where: {
// }, },
// include: [{ // include: [{
// as: 'company', // as: 'company',
// model: models.Company, // model: models.Company,
@ -211,6 +211,36 @@ async function delPosition (ctx, next) {
} }
async function qrCodeShow (ctx, next) {
try {
const models = ctx.fs.dc.models;
let userInfo = ctx.fs.api.userInfo;
const { projectId, name } = ctx.query;
let options = {
where: {
qrCode: { $ne: null }
},
}
if (projectId) {
options.where.projectId = projectId
}
if (name) {
options.where.name = { $like: `%${name}%` }
}
let res = await models.Point.findAndCountAll(options)
ctx.status = 200;
ctx.body = res
} catch (error) {
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`);
ctx.status = 400;
ctx.body = {
"message": "获取二维码列表失败"
}
}
}
module.exports = { module.exports = {
projectList, projectList,
@ -219,4 +249,5 @@ module.exports = {
addPosition, addPosition,
position, position,
delPosition, delPosition,
qrCodeShow
} }

3
api/app/lib/routes/projectRegime/index.js

@ -22,4 +22,7 @@ module.exports = function (app, router, opts) {
app.fs.api.logAttr['DEL/delPosition/:id'] = { content: '删除点位', visible: false }; app.fs.api.logAttr['DEL/delPosition/:id'] = { content: '删除点位', visible: false };
router.del('/delPosition/:id', projectSituation.delPosition); router.del('/delPosition/:id', projectSituation.delPosition);
app.fs.api.logAttr['GET/qrCodeShow'] = { content: '获取二维码列表', visible: false };
router.get('/qrCodeShow', projectSituation.qrCodeShow);
} }

6
api/config.js

@ -23,7 +23,7 @@ args.option('aliOssRegion', '阿里OSS Region');
const flags = args.parse(process.argv); const flags = args.parse(process.argv);
const ZHONGDING_DB = process.env.ZHONGDING_DB || flags.pg; const XUNJIAN_DB = process.env.XUNJIAN_DB || flags.pg;
// 七牛云存储参数 // 七牛云存储参数
const QINIU_DOMAIN_QNDMN_RESOURCE = process.env.ANXINCLOUD_QINIU_DOMAIN_QNDMN_RESOURCE || flags.qndmn; const QINIU_DOMAIN_QNDMN_RESOURCE = process.env.ANXINCLOUD_QINIU_DOMAIN_QNDMN_RESOURCE || flags.qndmn;
@ -37,7 +37,7 @@ const ALI_OSS_SECRETKET = process.env.ALI_OSS_SECRETKET || flags.aliOssSecretKey
const ALI_OSS_BUCKET = process.env.ALI_OSS_BUCKET || flags.aliOssBucket; const ALI_OSS_BUCKET = process.env.ALI_OSS_BUCKET || flags.aliOssBucket;
const ALI_OSS_REGION = process.env.ALI_OSS_REGION || flags.aliOssRegion; const ALI_OSS_REGION = process.env.ALI_OSS_REGION || flags.aliOssRegion;
if (!ZHONGDING_DB || !QINIU_DOMAIN_QNDMN_RESOURCE || !QINIU_BUCKET_RESOURCE || !QINIU_AK || !QINIU_SK) { if (!XUNJIAN_DB || !QINIU_DOMAIN_QNDMN_RESOURCE || !QINIU_BUCKET_RESOURCE || !QINIU_AK || !QINIU_SK) {
console.log('缺少启动参数,异常退出'); console.log('缺少启动参数,异常退出');
args.showHelp(); args.showHelp();
process.exit(-1); process.exit(-1);
@ -96,7 +96,7 @@ const product = {
} }
], ],
dc: { dc: {
url: ZHONGDING_DB, url: XUNJIAN_DB,
opts: { opts: {
pool: { pool: {
max: 80, max: 80,

18
api/jenkinsfile

@ -1,18 +0,0 @@
pipeline {
agent {
node{
label 'jnlp-slave'
}
}
stages {
stage('中鼎 api ......') {
steps {
buildName "#${BUILD_NUMBER} ~/smart-site/${JOB_NAME}:${IMAGE_VERSION}"
buildDescription "harbor.anxinyun.cn/smart-site/${JOB_NAME}:${IMAGE_VERSION}"
sh 'nerdctl build -t harbor.anxinyun.cn/smart-site/${JOB_NAME}:${IMAGE_VERSION} ./'
sh 'nerdctl push harbor.anxinyun.cn/smart-site/${JOB_NAME}:${IMAGE_VERSION}'
}
}
}
}

16
api/log/development.log

@ -3849,3 +3849,19 @@ notNull Violation: project.describe cannot be null
2023-01-16 20:45:57.174 - debug: [FS-LOGGER] Init. 2023-01-16 20:45:57.174 - debug: [FS-LOGGER] Init.
2023-01-16 20:45:57.417 - info: [FS-ATTACHMENT] Inject attachment mw into router. 2023-01-16 20:45:57.417 - info: [FS-ATTACHMENT] Inject attachment mw into router.
2023-01-16 20:45:57.418 - info: [FS-AUTH] Inject auth and api mv into router. 2023-01-16 20:45:57.418 - info: [FS-AUTH] Inject auth and api mv into router.
2023-01-17 09:24:14.329 - debug: [FS-LOGGER] Init.
2023-01-17 09:24:15.116 - info: [FS-ATTACHMENT] Inject attachment mw into router.
2023-01-17 09:24:15.117 - info: [FS-AUTH] Inject auth and api mv into router.
2023-01-17 09:26:37.752 - debug: [FS-LOGGER] Init.
2023-01-17 09:26:38.022 - info: [FS-ATTACHMENT] Inject attachment mw into router.
2023-01-17 09:26:38.023 - info: [FS-AUTH] Inject auth and api mv into router.
2023-01-17 10:57:37.126 - error: path: /projectList, error: TypeError: Cannot set property 'name' of undefined
2023-01-17 10:58:25.341 - error: path: /projectList, error: TypeError: Cannot set property 'name' of undefined
2023-01-17 10:58:51.005 - error: path: /projectList, error: TypeError: Cannot set property 'name' of undefined
2023-01-17 10:59:00.752 - error: path: /projectList, error: TypeError: Cannot set property 'name' of undefined
2023-01-17 10:59:06.553 - error: path: /projectList, error: TypeError: Cannot set property 'name' of undefined
2023-01-17 10:59:10.971 - error: path: /projectList, error: TypeError: Cannot set property 'name' of undefined
2023-01-17 10:59:45.469 - error: path: /projectList, error: TypeError: Cannot set property 'name' of undefined
2023-01-17 11:00:49.835 - debug: [FS-LOGGER] Init.
2023-01-17 11:00:50.799 - info: [FS-ATTACHMENT] Inject attachment mw into router.
2023-01-17 11:00:50.799 - info: [FS-AUTH] Inject auth and api mv into router.

18
jenkinsfile_api

@ -0,0 +1,18 @@
pipeline {
agent {
node{
label 'jnlp-slave'
}
}
stages {
stage('巡检 api ......') {
steps {
buildName "#${BUILD_NUMBER} ~/smartcity/${JOB_NAME}:${IMAGE_VERSION}"
buildDescription "harbor.anxinyun.cn/smartcity/${JOB_NAME}:${IMAGE_VERSION}"
sh 'nerdctl build -t harbor.anxinyun.cn/smartcity/${JOB_NAME}:${IMAGE_VERSION} ./api'
sh 'nerdctl push harbor.anxinyun.cn/smartcity/${JOB_NAME}:${IMAGE_VERSION}'
}
}
}
}

18
jenkinsfile_web

@ -0,0 +1,18 @@
pipeline {
agent {
node{
label 'jnlp-slave'
}
}
stages {
stage('巡检 web ......') {
steps {
buildName "#${BUILD_NUMBER} ~/smartcity/${JOB_NAME}:${IMAGE_VERSION}"
buildDescription "harbor.anxinyun.cn/smartcity/${JOB_NAME}:${IMAGE_VERSION}"
sh 'nerdctl build -t harbor.anxinyun.cn/smartcity/${JOB_NAME}:${IMAGE_VERSION} ./web'
sh 'nerdctl push harbor.anxinyun.cn/smartcity/${JOB_NAME}:${IMAGE_VERSION}'
}
}
}
}

BIN
weapp/images/noData.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

87
weapp/pages/index/index.js

@ -1,11 +1,71 @@
// pages/index/index.js // pages/index/index.js
import { getProjectList } from "../../utils/getApiUrl";
import { Request } from "../../common";
Page({ Page({
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
dataList: [1, 2, 3, 4] dataList: [],
limit: 10, //条数
page: 0, //当前页
count: '', //总条数
keyName: '', //结构物名称
hidden: true,
},
// 输入框
formInp(e) {
let that = this;
that.setData({
keyName: e.detail.value
})
},
// 手机键盘点击完成按钮(回车事件)
bindconfirm() {
let that = this;
that.setData({
page: 0, //当前页
count: '', //总条数
})
that.getProjectList();
},
// 搜索表单
goSearch() {
let that = this;
that.setData({
page: 0, //当前页
count: '', //总条数
})
that.getProjectList();
},
// 获取结构物列表
getProjectList: function () {
let that = this;
let { page, limit, keyName } = that.data;
Request.get(getProjectList(), { limit, page, name: keyName }).then(res => {
console.log(res);
if (res.rows.length == 0) {
that.setData({
dataList: res.rows,
hidden: false
})
return;
}
var arr1 = that.data.dataList; //从data获取当前dataList数组
var arr2 = res.rows; //从此次请求返回的数据中获取新数组
arr1 = arr1.concat(arr2); //合并数组
that.setData({
dataList: arr1,
count: res.count, //总条数
hidden: true
})
})
}, },
/** /**
@ -36,6 +96,8 @@ Page({
wx.reLaunch({ wx.reLaunch({
url: '/pages/login/login' url: '/pages/login/login'
}); });
} else {
this.getProjectList();
} }
}, },
@ -57,14 +119,33 @@ Page({
* 页面相关事件处理函数--监听用户下拉动作 * 页面相关事件处理函数--监听用户下拉动作
*/ */
onPullDownRefresh() { onPullDownRefresh() {
let that = this;
that.setData({
dataList: [],
keyName: '',
page: 0, //当前页
count: '', //总条数
})
that.getProjectList()
// 手动控制回弹
wx.stopPullDownRefresh();
}, },
/** /**
* 页面上拉触底事件的处理函数 * 页面上拉触底事件的处理函数
*/ */
onReachBottom() { onReachBottom() {
let _that = this;
let page = _that.data.page + 1; //获取当前页数并+1
let { dataList, count } = _that.data;
if (dataList.length == count) {
showToast('没有更多数据了...');
return;
}
_that.setData({
page: page, //更新当前页数
})
_that.getProjectList()
}, },
/** /**

2
weapp/pages/index/index.json

@ -2,5 +2,5 @@
"navigationBarBackgroundColor": "#1979ff", "navigationBarBackgroundColor": "#1979ff",
"navigationBarTextStyle": "white", "navigationBarTextStyle": "white",
"navigationBarTitleText": "巡检总览", "navigationBarTitleText": "巡检总览",
"enablePullDownRefresh": false "enablePullDownRefresh": true
} }

7
weapp/pages/index/index.wxml

@ -7,7 +7,7 @@
</view> </view>
</view> </view>
<view style="margin-top: 117rpx;"> <view style="margin-top: 140rpx;">
<block wx:for="{{dataList}}" wx:key='*this'> <block wx:for="{{dataList}}" wx:key='*this'>
<view style="padding-bottom: 60rpx;"> <view style="padding-bottom: 60rpx;">
<image style="width: 100%;height: 372rpx;display: block;" src="https://dingyue.ws.126.net/2021/0428/099be11ej00qs9xld006bc000xc00m7m.jpg"></image> <image style="width: 100%;height: 372rpx;display: block;" src="https://dingyue.ws.126.net/2021/0428/099be11ej00qs9xld006bc000xc00m7m.jpg"></image>
@ -23,4 +23,9 @@
</block> </block>
</view> </view>
<!-- 暂无数据 -->
<view hidden="{{hidden}}">
<image class="noData" src="../../images/noData.png"></image>
<view class="noTxt">暂无数据~</view>
</view>
</view> </view>

15
weapp/pages/index/index.wxss

@ -53,3 +53,18 @@ page {
line-height: 50rpx; line-height: 50rpx;
background: #fff; background: #fff;
} }
/* 暂无数据 */
.noData {
width: 254rpx;
height: 298rpx;
display: block;
margin: 450rpx auto 16rpx;
}
.noTxt {
font-size: 30rpx;
color: #999;
font-weight: bold;
text-align: center;
}

2
weapp/project.config.json

@ -41,7 +41,7 @@
}, },
"compileType": "miniprogram", "compileType": "miniprogram",
"libVersion": "2.19.4", "libVersion": "2.19.4",
"appid": "wxe9595234589a0147", "appid": "wxdd82ae635b22ccdb",
"projectname": "miniprogram-92", "projectname": "miniprogram-92",
"condition": {}, "condition": {},
"editorSetting": { "editorSetting": {

5
weapp/utils/getApiUrl.js

@ -7,3 +7,8 @@ exports.loginUrl = () => {
exports.logoutUrl = () => { exports.logoutUrl = () => {
return `/logout` return `/logout`
} }
// 登出
exports.getProjectList = () => {
return `/projectList`
}

29
web/Dockerfile

@ -7,7 +7,8 @@ WORKDIR /var/app
EXPOSE 8080 EXPOSE 8080
RUN npm cache clean -f RUN npm cache clean -f
RUN npm install -g node-gyp
RUN rm -rf package-lock.json
RUN npm install --registry http://10.8.30.22:7000 --legacy-peer-deps RUN npm install --registry http://10.8.30.22:7000 --legacy-peer-deps
RUN export NODE_OPTIONS=--max_old_space_size=4096&&npm run build RUN export NODE_OPTIONS=--max_old_space_size=4096&&npm run build
RUN rm -rf client/src RUN rm -rf client/src
@ -19,3 +20,29 @@ RUN npm install --production --registry http://10.8.30.22:7000
CMD ["-u", "http://localhost:8088"] CMD ["-u", "http://localhost:8088"]
ENTRYPOINT [ "node", "server.js" ] ENTRYPOINT [ "node", "server.js" ]
# FROM registry.cn-hangzhou.aliyuncs.com/fs-devops/node:12-dev as builder
# COPY . /var/app
# WORKDIR /var/app
# EXPOSE 8080
# RUN npm config set registry=http://10.8.30.22:7000
# RUN echo "{\"time\":\"$BUILD_TIMESTAMP\",\"build\": \"$BUILD_NUMBER\",\"revision\": \"$SVN_REVISION_1\",\"URL\":\"$SVN_URL_1\"}" > version.json
# RUN npm cache clean -f
# RUN rm -rf package-lock.json
# RUN npm install --registry http://10.8.30.22:7000
# RUN npm run build
# RUN rm -rf client/src
# RUN rm -rf node_modules
# RUN npm install --production --force --registry http://10.8.30.22:7000
# FROM registry.cn-hangzhou.aliyuncs.com/fs-devops/node:12
# COPY --from=builder --chown=node /var/app /home/node/app
# WORKDIR /home/node/app
# CMD ["node", "server.js"]

2
web/client/src/index.js

@ -4,4 +4,4 @@ import React from 'react';
import { render } from 'react-dom'; import { render } from 'react-dom';
import App from './app'; import App from './app';
render((<App projectName="巡检WEB" />), document.getElementById('App')); render((<App projectName="运维巡检平台" />), document.getElementById('App'));

2
web/client/src/layout/components/header/index.js

@ -38,7 +38,7 @@ const Header = props => {
</span> </span>
<div className={styles['header-title']} style={{}}> <div className={styles['header-title']} style={{}}>
{/* <img src='/assets/images/logo.png' style={{ margin: '0 12px 4px 12px', height: 42, borderRadius: 4 }} /> */} {/* <img src='/assets/images/logo.png' style={{ margin: '0 12px 4px 12px', height: 42, borderRadius: 4 }} /> */}
巡检WEB 运维巡检平台
</div> </div>
</div> </div>
<div id="nav" className={styles['header-nav']}> <div id="nav" className={styles['header-nav']}>

12
web/client/src/sections/projectRegime/actions/projectSituation.js

@ -76,3 +76,15 @@ export function delPosition (id) {
}); });
} }
export function qrCodeShow (query) {
return (dispatch) => basicAction({
type: 'get',
query,
dispatch,
actionType: 'GET_QR_CODE',
url: ApiTable.qrCodeShow,
msg: { error: '获取二维码列表失败', },
});
}

91
web/client/src/sections/projectRegime/components/pointModel.js

@ -0,0 +1,91 @@
import React, { useState } from 'react';
import { Button, Form, Input, Modal, Select, DatePicker } from 'antd';
const { TextArea } = Input;
import { connect } from 'react-redux';
import Uploads from '$components/Uploads';
import { useEffect } from 'react';
import moment from 'moment';
const ProjectAddModel = ({ dispatch, actions, user, modelData, close, success, qrCodeId }) => {
const { projectRegime } = actions
const [form] = Form.useForm();
useEffect(() => {
// console.log(modelData);
}, [])
return (
<Modal
title={modelData.id ? '编辑点位' : '新增点位'}
width={570}
open={true}
onOk={() => {
form.validateFields().then(r => {
dispatch(projectRegime.addPosition({
...r,
id: modelData?.id,
projectId: qrCodeId
})).then(res => {
if (res.success) {
success()
}
})
})
}}
onCancel={() => {
close()
}}
>
<Form
style={{}}
form={form}
labelAlign='right'
labelCol={{ span: 6 }} wrapperCol={{ span: 18 }}
onFinish={r => {
}}
>
<Form.Item label='点位名称' name="name" style={{}}
initialValue={modelData?.name}
rules={[{ required: true, message: '请输入点位名称' },]}
>
<Input placeholder="请输入点位名称" allowClear />
</Form.Item>
<div style={{}}>
{/* /^\d+$|^\d*\.\d+$/g */}
<Form.Item label="所在地区:" labelCol={{ span: 11 }} labelAlign='right' name="longitude" initialValue={modelData?.longitude} style={{ display: 'inline-block', width: 'calc(60% - 30px)', }}
rules={[{ required: true, message: '请输入横坐标', },]}
>
<Input placeholder="经度支持数字" />
</Form.Item>
~
<Form.Item name="latitude" initialValue={modelData?.latitude} style={{ display: 'inline-block', width: 'calc(40% + 15px)', }}
rules={[{ required: true, message: '请输入纵坐标', },]}
>
<Input placeholder="维度支持数字" />
</Form.Item>
</div>
<Form.Item name='describe' label="描述"
initialValue={modelData?.describe}
rules={[{ required: true, message: '请输入描述内容', },]}>
<TextArea />
</Form.Item>
</Form>
</Modal>
);
};
function mapStateToProps (state) {
const { auth, global } = state;
return {
user: auth.user,
actions: global.actions,
};
}
export default connect(mapStateToProps)(ProjectAddModel);

80
web/client/src/sections/projectRegime/containers/point.js

@ -5,7 +5,7 @@ const { TextArea } = Input;
import moment from "moment"; import moment from "moment";
import '../style.less'; import '../style.less';
import { push } from 'react-router-redux'; import { push } from 'react-router-redux';
import ProjectAddModel from '../components/projectAddModel' import PointModel from '../components/pointModel'
import { Model } from 'echarts'; import { Model } from 'echarts';
@ -28,7 +28,7 @@ const Information = (props) => {
var QRCode = require('qrcode') var QRCode = require('qrcode')
const qrCodeId = props?.match?.params?.id
useEffect(() => { useEffect(() => {
console.log(props?.match?.params?.id); console.log(props?.match?.params?.id);
@ -37,7 +37,7 @@ const Information = (props) => {
const projectList = (obj) => { const projectList = (obj) => {
const { limit, page } = obj const { limit, page } = obj
dispatch(projectRegime.positionList({ limit, page, projectId: props?.match?.params?.id })).then(res => { dispatch(projectRegime.positionList({ limit, page, projectId: qrCodeId })).then(res => {
// console.log(res) // console.log(res)
if (res.success) { if (res.success) {
let data = [] let data = []
@ -194,82 +194,22 @@ const Information = (props) => {
}} }}
/> />
{ {
<Modal
title={modelData.id ? '编辑点位' : '新增点位'}
width={570}
open={addModel}
onOk={() => {
form.validateFields().then(r => {
dispatch(projectRegime.addPosition({
...r,
id: modelData?.id,
projectId: props?.match?.params?.id
})).then(res => {
if (res.success) {
setAddModel(false)
setModelData({})
setQuery({ limit: 10, page: 0 });
projectList({ limit: 10, page: 0 })
}
})
})
}}
onCancel={() => {
setAddModel(false)
setModelData({})
}}
>
<Form
style={{}}
form={form}
labelAlign='right'
labelCol={{ span: 6 }} wrapperCol={{ span: 18 }}
onFinish={r => {
}}
>
<Form.Item label='点位名称' name="name" style={{}}
initialValue={modelData?.name}
rules={[{ required: true, message: '请输入点位名称' },]}
>
<Input placeholder="请输入点位名称" allowClear />
</Form.Item>
<div style={{}}>
{/* /^\d+$|^\d*\.\d+$/g */}
<Form.Item label="所在地区:" labelCol={{ span: 11 }} labelAlign='right' name="longitude" initialValue={modelData?.longitude} style={{ display: 'inline-block', width: 'calc(60% - 30px)', }}
rules={[{ required: true, message: '请输入横坐标', },]}
>
<Input placeholder="经度支持数字" />
</Form.Item>
~
<Form.Item name="latitude" initialValue={modelData?.latitude} style={{ display: 'inline-block', width: 'calc(40% + 15px)', }}
rules={[{ required: true, message: '请输入纵坐标', },]}
>
<Input placeholder="维度支持数字" />
</Form.Item>
</div>
<Form.Item name='describe' label="描述"
initialValue={modelData?.describe}
rules={[{ required: true, message: '请输入描述内容', },]}>
<TextArea />
</Form.Item>
</Form>
</Modal>
}
{/* {
addModel ? addModel ?
<ProjectAddModel <PointModel
firmList={firmList}
modelData={modelData} modelData={modelData}
qrCodeId={qrCodeId}
close={() => { close={() => {
setAddModel(false) setAddModel(false)
setModelData({}) setModelData({})
}} }}
success={() => { success={() => {
setAddModel(false)
setModelData({})
setQuery({ limit: 10, page: 0 });
projectList({ limit: 10, page: 0 })
}} }}
/> : "" /> : ""
} */} }
</> </>
) )
} }

102
web/client/src/sections/projectRegime/containers/qrCode.js

@ -5,6 +5,10 @@ import moment from "moment";
import '../style.less'; import '../style.less';
import ProjectAddModel from '../components/projectAddModel' import ProjectAddModel from '../components/projectAddModel'
import { Model } from 'echarts'; import { Model } from 'echarts';
import { login } from '../../auth/actions/auth';
import { createCanvas, loadImage, registerFont } from 'canvas'
import { dataURItoBlob } from 'react-jsonschema-form/lib/utils';
const QrCode = (props) => { const QrCode = (props) => {
const { dispatch, actions, user, loading } = props const { dispatch, actions, user, loading } = props
@ -22,61 +26,83 @@ const QrCode = (props) => {
useEffect(() => { useEffect(() => {
dispatch(projectRegime.getProjectList({ justStructure: true })).then(res => { dispatch(projectRegime.getProjectList({ justStructure: true })).then(res => {
if (res.success) { if (res.success) {
setFirmList(res.payload.data?.rows?.map(v => ({ value: v.id, label: v.name }))) setFirmList(res.payload.data?.rows?.map(v => ({ value: v.id, label: v.name })))
} }
}) })
projectList({})
}, []) }, [])
const projectList = (obj) => { const projectList = (obj) => {
const { limit, page, companyId, name, type } = obj const { projectId, name } = obj
dispatch(projectRegime.getProjectList({ limit, page, companyId, name, type })).then(res => { dispatch(projectRegime.qrCodeShow({ projectId, name })).then(res => {
// console.log(res)
if (res.success) { if (res.success) {
settableList(res.payload.data?.rows?.map(v => ({ ...v, key: v.id }))) settableList(res.payload.data?.rows)
setLimits(res.payload.data?.count)
} }
}) })
} }
console.log(firmList);
return ( return (
<> <>
<div style={{ display: 'flex', justifyContent: 'space-between', padding: '0 10px' }}> <Form
<Form style={{ display: 'flex', }}
style={{ display: 'flex', }} onFinish={r => {
onFinish={r => { projectList(r)
projectList(r) }}
setSearch(r) >
}} <Form.Item
label='结构物名称'
name="projectId"
style={{ marginRight: 16, width: 240 }}
// initialValue={firmList[0]?.name}
> >
<Form.Item <Select allowClear placeholder="请选择结构物名称" options={firmList} />
label='所属公司' </Form.Item>
name="companyId" <Form.Item
style={{ marginRight: 16, minWidth: 180 }} label='点位名称'
initialValue={firmList[0]?.name} name="name"
> style={{ marginRight: 16, width: 260 }}
<Select allowClear placeholder="全部" options={firmList} /> >
</Form.Item> <Input placeholder="请输入点位名称" allowClear />
<Form.Item </Form.Item>
label='项目名称' <Form.Item wrapperCol={{}}>
name="name" <Button type="primary" htmlType="submit">
style={{ marginRight: 16, minWidth: 180 }} 搜索
> </Button>
<Input placeholder="请输入项目名称" allowClear /> </Form.Item>
</Form.Item> </Form>
<Form.Item wrapperCol={{}}> <div >
<Button type="primary" htmlType="submit"> {
搜索 tableList?.map(v => {
</Button> return <div key={v.name + v.id}
</Form.Item> style={{ display: 'inline-block', margin: '0 10px 10px 0', border: '1px solid #3c383824' }} >
</Form> <div style={{
<Button onClick={() => { display: 'flex', flexDirection: 'column', padding: '6px 0',
console.log(45513); marginLeft: 20, width: 220, borderBottom: '1px solid #3c383824'
setAddModel(true) }}>
}}>新建项目</Button> <span>结构物名称{firmList?.filter(u => u.value == v.projectId)[0]?.label}</span>
<span>结构物名称{v.name}</span>
</div>
<img src={v.qrCode} style={{ display: 'inline-block', width: 260 }} />
<div style={{
width: 260, height: 60, background: '#e1d4d42e', display: 'flex',
justifyContent: 'center', alignItems: 'center', borderTop: '1px solid #3c383824'
}}>
<a href={`${v.qrCode}.png`}>
<Button type="primary" onClick={() => {
}}>下载二维码</Button>
</a>
</div>
</div>
}
)
}
</div> </div>
</> </>

1
web/client/src/utils/webapi.js

@ -101,6 +101,7 @@ export const ApiTable = {
//点位 //点位
position: 'position', position: 'position',
delPosition: 'delPosition/{id}', delPosition: 'delPosition/{id}',
qrCodeShow: 'qrCodeShow',
//视频接入配置 //视频接入配置
siteList: 'siteList', siteList: 'siteList',

18
web/jenkinsfile

@ -1,18 +0,0 @@
pipeline {
agent {
node{
label 'jnlp-slave'
}
}
stages {
stage('中鼎 web ......') {
steps {
buildName "#${BUILD_NUMBER} ~/smart-site/${JOB_NAME}:${IMAGE_VERSION}"
buildDescription "harbor.anxinyun.cn/smart-site/${JOB_NAME}:${IMAGE_VERSION}"
sh 'nerdctl build -t harbor.anxinyun.cn/smart-site/${JOB_NAME}:${IMAGE_VERSION} ./'
sh 'nerdctl push harbor.anxinyun.cn/smart-site/${JOB_NAME}:${IMAGE_VERSION}'
}
}
}
}
Loading…
Cancel
Save