Micro-build low-code development equipment inspection applet

Traditional factories still use paper records when inspecting equipment. Paper records are not easy to find and collect information. In order to facilitate work, we will take you to implement a small program for equipment inspection.

1 Demand Analysis

  • To be able to register in the applet
  • Registered users need to be reviewed by the administrator and assigned permissions
  • Authorized personnel can scan the code and submit inspection records
  • The administrator can maintain equipment information and inspection record information, and can download the QR code of the equipment

2 Design data source

In order to meet the needs of equipment inspection, we need a total of three data sources. The first is user information. The
insert image description here
data type of our role here is set to enumeration. There are two enumeration items, which are ordinary users and salespersons
insert image description here
. The data source is equipment information.
insert image description here
The third is to check the maintenance record information.
insert image description here
It should be noted here that equipment information and inspection maintenance records are in a one-to-many relationship, so we set a device identification data type as an association relationship, so that express a one-to-many relationship

3 Create model application

According to the requirements, we need to provide a background application for the administrator. The background application in the Weibo corresponds to the model application, log in to the console, click New Model Application, check the
insert image description here
data source we set, and the system will automatically generate a page for adding, deleting, modifying and checking.
insert image description here
The only thing to note here is that we need to develop a download in the device management For the function of the QR code, select the table, add a button in the operation column, change the name to download,
insert image description here
then add a pop-up window component, place a picture component in it,
insert image description here
define a variable to receive the device ID,
insert image description here
and bind the picture component with the following content

'https://api.qrserver.com/v1/create-qr-code/?size=150x150&data='+$page.dataset.state.sbid

When we click the button, let the pop-up window component display, and then assign the data identifier of the current record to the variable
insert image description here

4 Small program function development

Create a custom application, add a grid layout to the home page, modify the number of columns to 2,
insert image description here
add a normal container to the first column, and put a picture component and text component in it.
insert image description here
We bind a custom method to user registration, method content as follows

export default function ({
     
      event, data }) {
    
    
  console.log("id",app.dataset.state.user?._id)
  if (app.dataset.state.user?._id == "") {
    
    
    app.navigateTo({
    
    
      pageId: 'u_yong_hu_zhu_ce',    // 页面 Id 
      params: {
    
    },
    });
  }else{
    
    
     app.navigateTo({
    
    
      pageId: 'u_yong_hu_xin_xi_geng',    // 页面 Id 
      params: {
    
    id:app.dataset.state.user._id},
    });
  }
}

The logic is that if we have registered, we will jump to the update page, and if we have not registered, we will jump to the new page. Two new pages need to be added, one is to add and the other is to update. For
insert image description here
registration and update, we can use the form container.
insert image description here
Add the same component to the second column according to the structure of the first column.
insert image description here
The difference is that we need to display binding conditions. If there is no permission We will prompt a message, if you have permission, open the upload page
insert image description here

insert image description here

insert image description here
Record the upload page, we can build the corresponding structure according to the requirements
insert image description here

Summarize

In this article, we took everyone to build a small program for equipment inspection. The daily use of low-code building capabilities can quickly help us complete common tasks, which is still very convenient.

Guess you like

Origin blog.csdn.net/u012877217/article/details/129922465