riku
2024-07-26 1a4d35a08d05e014663c144771976abb0edaa933
监管场景信息管理

1. 新增场景设备信息管理;
2. 新增场景设备位置变更信息管理;
已修改12个文件
已添加7个文件
360 ■■■■ 文件已修改
behaviors/loading.js 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
model/sceneType.js 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/inspection/detail/chart-proxy.js 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/inspection/scene/index.js 19 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/inspection/scene/index.wxml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/inspection/scene/info/components/device-location/index.js 51 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/inspection/scene/info/components/device-location/index.json 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/inspection/scene/info/components/device-location/index.wxml 50 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/inspection/scene/info/components/device-location/index.wxss 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/inspection/scene/info/device-info-items.js 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/inspection/scene/info/device-location-proxy.js 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/inspection/scene/info/device-location.wxml 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/inspection/scene/info/deviceinfo-proxy.js 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/inspection/scene/info/deviceinfo.wxml 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/inspection/scene/info/index.js 44 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/inspection/scene/info/index.json 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/inspection/scene/info/index.wxml 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/inspection/scene/info/index.wxss 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
services/inspection/fetchScene.js 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
behaviors/loading.js
@@ -81,12 +81,12 @@
    _fetch() {
      if (typeof this._fetchData === 'function') {
        this._fetchData(this.data.cPage)
        const promise = this._fetchData(this.data.cPage);
        if (!promise) return;
        promise
          .then(head => {
            if (head) {
              let cPage = head.currentPage
                ? parseInt(head.currentPage)
                : parseInt(head.page);
              let cPage = head.currentPage ? parseInt(head.currentPage) : parseInt(head.page);
              let tPage = parseInt(head.totalPage);
              let totalCount = head.totalCount ? parseInt(head.totalCount) : 0;
              this._setPagination(cPage, tPage, totalCount);
model/sceneType.js
@@ -21,7 +21,8 @@
 */
function transSceneType(value) {
  const s = sceneMap[value]
  return s == undefined ? '-1' : s;
  return s
  // return s == undefined ? '-1' : s;
}
export { transSceneType };
pages/inspection/detail/chart-proxy.js
@@ -112,8 +112,8 @@
      const changes = [];
      const xAxisMonth = this.getXAxisMonth();
      xAxisMonth.forEach(m => {
        problems.push('0');
        changes.push('0');
        problems.push(0);
        changes.push(0);
      });
      this.data.subtaskSummary.forEach(s => {
        const month = dayjs(s.stPlanTime).month() + 1 + '月';
@@ -121,8 +121,8 @@
          return month == value;
        });
        if (index) {
          problems[index] = s.proNum;
          changes[index] = s.changeNum;
          problems[index] += s.proNum;
          changes[index] += s.changeNum;
        }
      });
      const datas = [problems, changes];
pages/inspection/scene/index.js
@@ -18,8 +18,9 @@
  _fetchData(page) {
    const { area, onlineValue, sceneValue } = this.data;
    if (!onlineValue || !sceneValue) return;
    area.scensetypeid = sceneValue[0];
    area.online = onlineValue;
    area.online = onlineValue[0];
    return searchScene(area, page).then(res => {
      if (res.success) {
        this.setData({
@@ -42,14 +43,14 @@
  onLocationChange(e) {
    const { area } = this.data;
    area.provinceName = e.detail.provinceText;
    area.cityName = e.detail.cityText;
    area.districtName = e.detail.districtText;
    area.townName = e.detail.townText;
    area.provinceCode = e.detail.provinceValue;
    area.cityCode = e.detail.cityValue;
    area.districtCode = e.detail.districtValue;
    area.townCode = e.detail.townValue;
    area.provincename = e.detail.provinceText;
    area.cityname = e.detail.cityText;
    area.districtname = e.detail.districtText;
    area.townname = e.detail.townText;
    area.provincecode = e.detail.provinceValue;
    area.citycode = e.detail.cityValue;
    area.districtcode = e.detail.districtValue;
    area.towncode = e.detail.townValue;
    area.locationValue = e.detail.locationValue;
    this.setData({ area });
    this._startLoad();
pages/inspection/scene/index.wxml
@@ -11,7 +11,8 @@
          color="var(--td-font-white-1)"
          style-mode="picker"
          picker-class="picker-location"
          bind:onChange="onOnlineChange"
          bind:onlinePickerChange="onOnlineChange"
          bind:onlineInitValue="onOnlineChange"
        ></online-picker>
        <location-picker
          color="var(--td-font-white-1)"
@@ -21,7 +22,7 @@
        ></location-picker>
      </view>
      <view class="filter-wrap-2">
        <scene-picker sceneMode="{{1}}" bind:scenePickerChange="onScenePickerConfirm" />
        <scene-picker sceneMode="{{1}}" bind:scenePickerChange="onScenePickerConfirm" bind:sceneInitValue="onScenePickerConfirm"/>
      </view>
    </view>
  </t-sticky>
pages/inspection/scene/info/components/device-location/index.js
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,51 @@
import dayjs from 'dayjs';
Component({
  options: {
    addGlobalClass: true,
    multipleSlots: true,
  },
  properties: {
    index: {
      type: Number,
      value: 0,
    },
    readOnly: {
      type: Boolean,
      value: false,
    },
    // è®¾å¤‡ä½ç½®ä¿¡æ¯
    location: {
      type: Object,
      value: {},
      observer(value) {
        this.setData({ ...value });
      },
    },
  },
  data: {},
  methods: {
    onStandardChange(e) {
      if (!e) {
        this.setData({ dlUnstandardReason: '' });
      }
    },
    changeEdit() {
      this.setData({ readOnly: false, isUpdate: true });
    },
    cancel() {
      this.setData({ readOnly: true });
      this.triggerEvent('cancel');
    },
    confirm() {
      const date = this.data.dlUpdateTime ? dayjs(this.data.dlUpdateTime) : dayjs();
      const time = date.format('YYYYå¹´MM月DD日');
      this.setData({ time, readOnly: true });
      const { readOnly, location, ...rest } = this.data;
      this.triggerEvent('confirm', rest);
    },
    update() {},
  },
});
pages/inspection/scene/info/components/device-location/index.json
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,4 @@
{
  "component": true,
  "usingComponents": {}
}
pages/inspection/scene/info/components/device-location/index.wxml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,50 @@
<view wx:if="{{time}}" class="flex-h">
  <!-- <t-divider content="变更时间: {{time}}" align="left" /> -->
  <view>{{index}}. å˜æ›´æ—¶é—´: {{time}}</view>
  <view wx:if="{{readOnly}}">
    <t-button theme="primary" size="extra-small" bind:tap="changeEdit">修改</t-button>
  </view>
</view>
<t-input
  label="安装位置"
  placeholder="请输入安装位置"
  model:value="{{dlLocation}}"
  disabled="{{readOnly}}"
/>
<t-input
  label="经度"
  placeholder="请输入经度"
  model:value="{{dlLongitude}}"
  disabled="{{readOnly}}"
/>
<t-input
  label="维度"
  placeholder="请输入维度"
  model:value="{{dlLatitude}}"
  disabled="{{readOnly}}"
/>
<t-cell title="是否规范">
  <t-switch
    model:value="{{dlStandard}}"
    defaultValue="{{true}}"
    label="{{['是', '否']}}"
    slot="note"
    disabled="{{readOnly}}"
    bind:change="onStandardChange"
  />
</t-cell>
<t-input
  wx:if="{{!dlStandard}}"
  label="不规范说明"
  placeholder="请输入说明"
  model:value="{{dlUnstandardReason}}"
  disabled="{{readOnly}}"
/>
<view wx:if="{{!readOnly}}" style="display: flex; gap: 4">
  <t-button theme="light" block size="small" bind:tap="cancel">取消</t-button>
  <t-button wx:if="{{!isUpdate}}" theme="primary" block block size="small" bind:tap="confirm"
    >保存</t-button
  >
  <t-button wx:else theme="primary" block block size="small" bind:tap="update">更新</t-button>
</view>
<!-- <t-divider /> -->
pages/inspection/scene/info/components/device-location/index.wxss
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,9 @@
/* pages/inspection/scene/info/components/device-location/index.wxss */
.flex-h {
  display: flex;
  justify-content: space-between;
  align-items: center;
  /* background-color: blanchedalmond; */
  padding: 0 16px;
  margin-top: 8px;
}
pages/inspection/scene/info/device-info-items.js
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,35 @@
export const menuData = [
  {
    label: '站点名称',
    placeholder: '请输入站点名称',
    name: 'diName',
    value: '',
    status: 'success',
    tips: '站点名称不能为空',
    onChange:(v)=>{
      this.value = v
    }
  },
  {
    label: 'MN编号',
    placeholder: '请输入MN编号',
    name: 'diMnCode',
    value: '',
    status: 'success',
    tips: 'MN编号不能为空',
    onChange:(v)=>{
      this.value = v
    }
  },
  {
    label: '设备类型',
    placeholder: '请输入设备类型',
    name: 'diType',
    value: '',
    status: 'success',
    tips: '设备类型不能为空',
    onChange:(v)=>{
      this.value = v
    }
  },
];
pages/inspection/scene/info/device-location-proxy.js
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,33 @@
/**
 * è®¾å¤‡å®‰è£…位置信息管理
 */
export const useDeviceLocation = Behavior({
  data: {
    showNewLocation: false,
    newLocation: {},
    deviceLocationList: [],
  },
  methods: {
    onAddLocation() {
      this.setData({
        showNewLocation: true,
        newLocation: {},
      });
    },
    saveNewLocation(e) {
      const { deviceLocationList } = this.data;
      deviceLocationList.push(e.detail);
      debugger
      this.setData({
        showNewLocation: false,
        deviceLocationList,
      });
    },
    cancelNewLocation() {
      this.setData({
        showNewLocation: false,
      });
    },
  },
});
pages/inspection/scene/info/device-location.wxml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,12 @@
<block wx:for="{{deviceLocationList}}">
  <device-location index="{{index + 1}}" read-only="{{true}}" location="{{item}}"></device-location>
</block>
<t-button wx:if="{{!showNewLocation}}" theme="light" size="small" bind:tap="onAddLocation"
  >新增位置变更信息</t-button
>
<device-location
  wx:if="{{showNewLocation}}"
  location="{{newLocation}}"
  bind:cancel="cancelNewLocation"
  bind:confirm="saveNewLocation"
></device-location>
pages/inspection/scene/info/deviceinfo-proxy.js
@@ -0,0 +1,11 @@
/**
 * è®¾å¤‡ä¿¡æ¯ç®¡ç†
 */
export const useDeviceInfo = Behavior({
  data: {
  },
  methods: {
  },
});
pages/inspection/scene/info/deviceinfo.wxml
@@ -0,0 +1,21 @@
<t-input label="站点名称" placeholder="请输入站点名称" model:value="{{diName}}" />
<t-input label="MN编号" placeholder="请输入MN编号" model:value="{{diMnCode}}" />
<t-input label="设备类型" placeholder="请输入设备类型" model:value="{{diType}}" />
<t-input label="供应商" placeholder="请输入供应商" model:value="{{diSupplier}}" />
<t-input label="运维商" placeholder="请输入运维商" model:value="{{diMaintainer}}" />
<t-cell title="是否上线">
  <t-switch
    model:value="{{diRunningStatus}}"
    defaultValue="{{true}}"
    label="{{['是', '否']}}"
    slot="note"
  />
</t-cell>
<t-cell title="是否拆除">
  <t-switch
    model:value="{{diRemoved}}"
    defaultValue="{{false}}"
    label="{{['是', '否']}}"
    slot="note"
  />
</t-cell>
pages/inspection/scene/info/index.js
@@ -1,13 +1,10 @@
// pages/inspection/scene/info/index.js
import { useDeviceInfo } from './deviceinfo-proxy.js';
import { useDeviceLocation } from './device-location-proxy.js';
Page({
  /**
   * é¡µé¢çš„初始数据
   */
  behaviors: [useDeviceInfo, useDeviceLocation],
  data: {},
  /**
   * ç”Ÿå‘½å‘¨æœŸå‡½æ•°--监听页面加载
   */
  onLoad(options) {
    this.getOpenerEventChannel().on('acceptSceneData', data => {
      if (data) {
@@ -18,38 +15,5 @@
    });
  },
  /**
   * ç”Ÿå‘½å‘¨æœŸå‡½æ•°--监听页面初次渲染完成
   */
  onReady() {},
  /**
   * ç”Ÿå‘½å‘¨æœŸå‡½æ•°--监听页面显示
   */
  onShow() {},
  /**
   * ç”Ÿå‘½å‘¨æœŸå‡½æ•°--监听页面隐藏
   */
  onHide() {},
  /**
   * ç”Ÿå‘½å‘¨æœŸå‡½æ•°--监听页面卸载
   */
  onUnload() {},
  /**
   * é¡µé¢ç›¸å…³äº‹ä»¶å¤„理函数--监听用户下拉动作
   */
  onPullDownRefresh() {},
  /**
   * é¡µé¢ä¸Šæ‹‰è§¦åº•事件的处理函数
   */
  onReachBottom() {},
  /**
   * ç”¨æˆ·ç‚¹å‡»å³ä¸Šè§’分享
   */
  onShareAppMessage() {},
});
pages/inspection/scene/info/index.json
@@ -4,5 +4,7 @@
  "backgroundTextStyle": "light",
  "navigationBarTextStyle": "white",
  "navigationBarBackgroundColor": "#389AFF",
  "usingComponents": {}
  "usingComponents": {
    "device-location": "./components/device-location/index"
  }
}
pages/inspection/scene/info/index.wxml
@@ -1,15 +1,23 @@
<t-tabs
  theme="card"
  defaultValue="{{0}}"
  space-evenly="{{true}}"
  t-class="custom-tabs"
  t-class-content="custom-panel"
>
  <t-tab-panel label="基本信息" value="{{0}}" class="custom-tab-panel">
    <view>基本信息</view>
  </t-tab-panel>
  <t-tab-panel label="设备信息" value="{{1}}" class="custom-tab-panel">
    <view>设备信息</view>
    <include src="./deviceinfo.wxml" />
  </t-tab-panel>
</t-tabs>
<view class="page">
  <view class="page-header"> </view>
  <view class="page-container">
    <t-tabs
      theme="card"
      defaultValue="{{0}}"
      space-evenly="{{true}}"
      t-class="custom-tabs"
      t-class-content="custom-panel"
    >
      <t-tab-panel label="基本信息" value="{{0}}" class="custom-tab-panel">
        <view>基本信息</view>
      </t-tab-panel>
      <t-tab-panel label="设备信息" value="{{1}}" class="custom-tab-panel">
        <include src="./deviceinfo.wxml" />
      </t-tab-panel>
      <t-tab-panel label="设备位置" value="{{3}}" class="custom-tab-panel">
        <include src="./device-location.wxml" />
      </t-tab-panel>
    </t-tabs>
  </view>
  <view class="page-footer"></view>
</view>
pages/inspection/scene/info/index.wxss
@@ -1,3 +1,7 @@
.page .page-container {
  padding: 0;
}
.chart-panel {
  width: 100%;
  height: 550rpx;
services/inspection/fetchScene.js
@@ -21,6 +21,7 @@
 * æŸ¥æ‰¾åœºæ™¯
 */
function searchScene(area, page = 1, perPage = 20) {
  area.scensetypeid = transSceneType(area.scensetypeid);
  return post(
    {
      url: `/scense/find`,