Ver Fonte

input 增加 autocomplete="off"

yangzhijie há 4 anos atrás
pai
commit
90e9eeac0c

+ 1 - 1
.eslintrc.js

@@ -19,7 +19,7 @@ module.exports = {
     browser: true,
     node: true,
     es6: true,
-    jquery: true,
+    jquery: true
   },
   rules: {
     // override/add rules settings here, such as:

+ 2 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "pc-component-v3",
-  "version": "1.0.24",
+  "version": "1.0.25",
   "description": "",
   "main": "dist/pc-component-v3.js",
   "scripts": {
@@ -39,6 +39,7 @@
     
   },
   "peerDependencies": {
+    "amis": "^1.9.0",
     "v-tooltip": "^4.0.0-beta.17",
     "vue": "^3.2.31",
     "vue-i18n": "^9.1.9",

+ 7 - 0
packages/amis/index.js

@@ -0,0 +1,7 @@
+import AmisWidget from './src/AmisWidget.vue';
+
+AmisWidget.install = function(Vue) {
+  Vue.component(AmisWidget.name, AmisWidget);
+};
+
+export default AmisWidget;

+ 27 - 0
packages/amis/src/AmisConfig.js

@@ -0,0 +1,27 @@
+let amisConfig = {
+  requestAdaptor(api) {
+    api.headers['token'] = $.cookie('token');
+    api.headers['account'] = $.cookie('account');
+    return api;
+  },
+
+  responseAdaptor(api, payload, query, request, response) {
+    let newPayload = {};
+    newPayload.status = payload.errorCode;
+    newPayload.msg = payload.errorMessage == null ? '' : payload.errorMessage;
+    newPayload.data = {};
+    var attributeNames = Object.keys(payload);
+    attributeNames.forEach(attributeName => {
+      if (attributeName !== 'errorCode' && attributeName !== 'errorMessage') {
+        newPayload.data[attributeName] = payload[attributeName];
+      }
+    });
+    return newPayload;
+  },
+
+  theme: 'antd',
+};
+
+export {
+  amisConfig,
+};

+ 85 - 0
packages/amis/src/AmisWidget.vue

@@ -0,0 +1,85 @@
+<template>
+  <div id="amis-box" />
+</template>
+
+
+<script>
+
+import 'amis/sdk/sdk.js';
+import 'amis/lib/themes/antd.css';
+import 'amis/lib/helper.css';
+import 'amis/sdk/iconfont.css';
+import { amisConfig } from './AmisConfig.js';
+
+var AmisWindowResource = require('./AmisWindowResource.js');
+var Common = require('../../common/Common.js').default;
+var Notify = require('../../common/Notify.js').default;
+
+export default {
+
+  name: 'AmisWidget',
+
+  props: {
+    amisWindowNo: {
+      type: String,
+      default: null,
+    },
+  },
+
+  watch: {
+    'amisWindowNo': function (to, from) {
+      this.init();
+    },
+  },
+
+
+  mounted() {
+    let _self = this;
+    this.$nextTick(function () {
+      _self.init();
+    });
+  },
+
+  methods: {
+    
+    /**
+     * 初始化amis实例
+     */
+    init() {
+      if (this.amisWindowNo == null) {
+        return;
+      }
+
+      // 初始化amis实例之前,先判断是否已经有amis实例,如果有的话就销毁。
+      this.destory();
+
+      let amis = window.amisRequire('amis/embed');
+      let _self = this;
+
+      AmisWindowResource.readJson(this.amisWindowNo).then(baseObjectResponse => {
+        if (baseObjectResponse.errorCode === 0) {
+          let amisJSON = JSON.parse(baseObjectResponse.data);
+          _self.amisScoped = amis.embed('#amis-box', amisJSON, {}, amisConfig);
+        } else {
+          Notify.error('提示', baseObjectResponse.errorMessage, false);
+        }
+      }, errorData => {
+        Common.processException(errorData);
+      });
+    },
+
+    
+    /**
+     * 销毁amis实例
+     */
+    destory(){
+      let _self = this;
+      if(_self.amisScoped != null){
+        _self.amisScoped.unmount();
+        _self.amisScoped = null;
+      }
+    },
+
+  },
+};
+</script>

+ 35 - 0
packages/amis/src/AmisWindowResource.js

@@ -0,0 +1,35 @@
+var Common = require('../../common/Common.js').default;
+/**
+ * 工具类自动生成的API,请勿做任何修改,请勿做任何修改,请勿做任何修改(重要的事情说3遍)
+ * 工具作者: 杨志杰
+ *  
+ */
+module.exports = {
+
+  /**
+	 * 工具类自动生成的方法
+	 * 工具作者: 杨志杰
+	 * 读取文件服务器下面{}/AmisWindow/{moduleNo}/{amisWindowNo}.{amisWindowName}.json文件内容 
+	 */
+  readJson: function(amisWindowNo){
+    var requestUrl = '/api/AmisWindowResource/readJson?amisWindowNo='+amisWindowNo;
+
+    return new Promise((resolve, reject) => {
+      $.ajax({
+        url: requestUrl,
+        type: 'post',
+        contentType: 'application/json',
+				
+        beforeSend: function(request) {
+          Common.addTokenToRequest(request);
+        },
+        success: function(data) {
+          resolve(data);
+        },
+        error: function(XMLHttpRequest, textStatus, errorThrown) {
+          reject(XMLHttpRequest);
+        },
+      });
+    });
+  },
+};

+ 2 - 1
packages/checkbox/src/Checkbox.vue

@@ -1,7 +1,8 @@
 <template>
   <div class="checkbox-component">
-    <input autocomplete="off"
+    <input
       :id="id"
+      autocomplete="off"
       type="checkbox"
       :name="name"
       :checked="myValue"

+ 4 - 2
packages/datetime-v2/src/DateTimeV2.vue

@@ -3,8 +3,9 @@
     class="datetime-container input-group"
     :class="{'has-error' : isValid === false}"
   >
-    <input autocomplete="off"
+    <input
       id="datetime"
+      autocomplete="off"
       type="datetime-local"
       :readonly="readonly"
       :value="dateTime"
@@ -12,7 +13,8 @@
       @change="datetimeLocalValueChanged($event)"
     />
 
-    <input autocomplete="off"
+    <input
+      autocomplete="off"
       type="text"
       :readonly="readonly"
       :value="dateValue"

+ 3 - 0
packages/index.js

@@ -4,6 +4,7 @@ import DateTime from './dateTime/index.js';
 import DateTimeV2 from './dateTime-v2/index.js';
 import Date from './date/index.js';
 import Checkbox from '../packages/checkbox/index.js';
+import AmisWidget from '../packages/amis/index.js';
 import PageSizeSelect from './page-size-select/index.js';
 import Time from './time/index.js';
 import Switches from './switches/index.js';
@@ -61,6 +62,7 @@ const components = [
   DateTimeV2,
   Date,
   Checkbox,
+  AmisWidget,
   PageSizeSelect,
   Time,
   Switches,
@@ -135,6 +137,7 @@ export default {
   DateTimeV2,
   Date,
   Checkbox,
+  AmisWidget,
   PageSizeSelect,
   Time,
   Switches,

+ 8 - 4
packages/info/src/DocGeneratorGrid.vue

@@ -12,7 +12,8 @@
               width="50px"
               class="fixed-cell"
             >
-              <input autocomplete="off"
+              <input
+                autocomplete="off"
                 :checked="allSelected"
                 type="checkbox"
                 @click="selectAll($event)"
@@ -49,8 +50,9 @@
             height="40px"
           >
             <td class="fixed-cell">
-              <input autocomplete="off"
+              <input
                 v-model="rowData.checked"
+                autocomplete="off"
                 type="checkbox"
                 :value="rowData.id"
               />
@@ -59,15 +61,17 @@
               v-for="infoGridField in infoGridFields"
               :key="infoGridField.fieldName + '_' + rowData.id"
             >
-              <input autocomplete="off"
+              <input
                 v-if="infoGridField.simpleDisplayType == 'TextEditor'"
+                autocomplete="off"
                 type="text"
                 class="form-control"
                 :value="getDisplayValue(rowData, infoGridField)"
                 @keyup="valueChange($event, rowData, infoGridField)"
               />
-              <input autocomplete="off"
+              <input
                 v-if="infoGridField.simpleDisplayType == 'NumberEditor'"
+                autocomplete="off"
                 type="number"
                 class="form-control"
                 :value="getDisplayValue(rowData,infoGridField)"

+ 4 - 2
packages/info/src/DocGeneratorSelected.vue

@@ -64,15 +64,17 @@
               v-for="infoGridField in infoGridFields"
               :key="infoGridField.fieldName + '_' + rowData.id"
             >
-              <input autocomplete="off"
+              <input
                 v-if="infoGridField.simpleDisplayType == 'TextEditor'"
+                autocomplete="off"
                 type="text"
                 class="form-control"
                 :value="getDisplayValue(rowData, infoGridField)"
                 @keyup="valueChange($event, rowData, infoGridField)"
               />
-              <input autocomplete="off"
+              <input
                 v-if="infoGridField.simpleDisplayType == 'NumberEditor'"
+                autocomplete="off"
                 type="number"
                 class="form-control"
                 :value="getDisplayValue(rowData,infoGridField)"

+ 4 - 2
packages/info/src/InfoHeader.vue

@@ -35,9 +35,10 @@
               <template #item="{element}">
                 <div style="margin-left: 15px;margin-right: 15px;">
                   <div class="column">
-                    <input autocomplete="off"
+                    <input
                       :id="'InfoForm' + '_' + infoWindowNo + '_' + element.fieldName"
                       v-model="element.isShow"
+                      autocomplete="off"
                       class="isShow-checkbox"
                       type="checkbox"
                       :disabled="element.mandatory && element.isShow"
@@ -78,9 +79,10 @@
               <template #item="{element}">
                 <div style="margin-left: 15px;margin-right: 15px;">
                   <div class="column">
-                    <input autocomplete="off"
+                    <input
                       :id="'InfoGrid' + '_' + infoWindowNo + '_' + element.fieldName"
                       v-model="element.isShow"
+                      autocomplete="off"
                       class="isShow-checkbox"
                       type="checkbox"
                       :disabled="element.mandatory && element.isShow"

+ 8 - 4
packages/info/src/QueryConditionComplex.vue

@@ -21,18 +21,20 @@
             class="form-inline-div"
             @keyup.enter="complexSearch()"
           >
-            <input autocomplete="off"
+            <input
               v-if="item.displayType =='TextEditor'"
               :id="item.id"
               v-model="item.value.value1"
+              autocomplete="off"
               type="text"
               :placeholder="$t('lang.QueryConditionComplex.pleaseInputTheContent')"
               class="form-control form-control-complex form-input"
             />
-            <input autocomplete="off"
+            <input
               v-if="item.displayType =='NumberEditor'"
               :id="item.id"
               v-model="item.value.value1"
+              autocomplete="off"
               type="number"
               class="form-control form-control-complex form-input"
               :placeholder="$t('lang.QueryConditionComplex.pleaseEnterANumber')"
@@ -117,19 +119,21 @@
             v-if="item.index == 2"
             class="form-inline-div"
           >
-            <input autocomplete="off"
+            <input
               v-if="item.displayType =='TextEditor'"
               :id="item.id"
               v-model="item.value.value2"
+              autocomplete="off"
               type="text"
               :placeholder="$t('lang.QueryConditionComplex.pleaseInputTheContent')"
               class="form-control form-control-complex form-input"
               @keyup.enter="complexSearch()"
             />
-            <input autocomplete="off"
+            <input
               v-if="item.displayType =='NumberEditor'"
               :id="item.id"
               v-model="item.value.value2"
+              autocomplete="off"
               type="number"
               class="form-control form-control-complex form-input"
               :placeholder="$t('lang.QueryConditionComplex.pleaseEnterANumber')"

+ 2 - 1
packages/info/src/QueryConditionSimple.vue

@@ -2,8 +2,9 @@
 <template>
   <div>
     <div>
-      <input autocomplete="off"
+      <input
         v-model="simpleConditionValue"
+        autocomplete="off"
         type="text"
         class="form-control input-simple"
         :placeholder="$t('lang.QueryConditionSimple.enterSearchCriteria')"

+ 4 - 2
packages/info/src/QueryPage.vue

@@ -61,8 +61,9 @@
                 :class="{'mulitiple-select': multipleSelect}"
                 @click.self="changeSelectMode"
               >
-                <input autocomplete="off"
+                <input
                   v-model="isSelectAll"
+                  autocomplete="off"
                   type="checkbox"
                 />
               </th>
@@ -103,7 +104,8 @@
               <td style="text-align: center;">{{ index+1+(pagination.current_page-1)*pagination.per_page }}</td>
 
               <td class="text-center">
-                <input autocomplete="off"
+                <input
+                  autocomplete="off"
                   type="checkbox"
                   :checked="item1.select"
                   @click.self="selectNodeForSearch(item1)"

+ 2 - 1
packages/info/src/SearchWidget.vue

@@ -1,6 +1,7 @@
 <template>
   <div class="input-group">
-    <input autocomplete="off"
+    <input
+      autocomplete="off"
       aria-describedby="addon"
       type="text"
       class="form-control"

+ 2 - 1
packages/loading/src/Loading.vue

@@ -1,8 +1,9 @@
 <template>
   <teleport to="body">
     <div :key="id" class="loading">
-      <input autocomplete="off"
+      <input
         ref="focusInput"
+        autocomplete="off"
         class="focus-input"
       />
       <div

+ 10 - 5
packages/process/src/ProcessReportArchive.vue

@@ -36,8 +36,9 @@
       <div v-show="startArchive == true">
         <div class="form-group">
           <label>标题</label>
-          <input autocomplete="off"
+          <input
             v-model="title"
+            autocomplete="off"
             type="text"
             class="form-control"
           />
@@ -52,16 +53,18 @@
         </div>
         <div class="form-group">
           <label>备注</label>
-          <input autocomplete="off"
+          <input
             v-model="description"
+            autocomplete="off"
             type="description"
             class="form-control"
           />
         </div>
         <div class="form-group">
           <label>归档日期</label>
-          <input autocomplete="off"
+          <input
             v-model="archiveDate"
+            autocomplete="off"
             type="text"
             class="form-control"
             :readonly="true"
@@ -69,8 +72,9 @@
         </div>
         <div class="form-group">
           <label>归档人</label>
-          <input autocomplete="off"
+          <input
             v-model="userName"
+            autocomplete="off"
             type="text"
             class="form-control"
             :readonly="true"
@@ -82,8 +86,9 @@
           class="form-group"
         >
           <label>报表路径{{ index + 1 }}</label>
-          <input autocomplete="off"
+          <input
             v-model="item.htmlPreviewUrl"
+            autocomplete="off"
             type="text"
             class="form-control"
             :readonly="true"

+ 6 - 4
packages/process/src/ProcessReportDynamic.vue

@@ -20,10 +20,11 @@
               :for="'editor_' + item.id"
             >{{ item.displayName }}</label>
 
-            <input autocomplete="off"
+            <input
               v-if="item.displayType =='TextEditor'"
               :id="'editor_' + item.id"
               v-model="item.fieldValue.displayValue[0]"
+              autocomplete="off"
               type="text"
               class="form-control m-input-group"
               placeholder="请输入内容"
@@ -41,17 +42,17 @@
               @change="valueChanged(item)"
             />
 
-            <input autocomplete="off"
+            <input
               v-if="item.displayType =='NumberEditor'"
               :id="'editor_' + item.id"
               v-model="item.fieldValue.displayValue[0]"
+              autocomplete="off"
               type="number"
               class="form-control m-input-group"
               placeholder="请输入数字"
               @change="valueChanged(item)"
             />
 
-            <!-- <input autocomplete="off" v-if="item.displayType =='CheckBoxEditor'" type="checkbox" v-model="item.fieldValue.displayValue[0]" class="form-control" :id="'editor_' + item.id"/> -->
 
             <Switches
               v-if="item.displayType =='CheckBoxEditor'"
@@ -119,7 +120,8 @@
         >
           <span class="glyphicon glyphicon-question-sign" />
         </button>
-        <input autocomplete="off"
+        <input
+          autocomplete="off"
           type="button"
           class="btn btn-primary"
           style="margin-top: 15px;"

+ 6 - 3
packages/process/src/ProcessReportStatic.vue

@@ -26,10 +26,11 @@
           >该项为必填项字段</span>
 
           <div class="input-group">
-            <input autocomplete="off"
+            <input
               v-if="item.displayType =='TextEditor'"
               :id="'editor_' + item.id"
               v-model="item.fieldValue.displayValue[0]"
+              autocomplete="off"
               type="text"
               class="form-control"
               placeholder="请输入内容"
@@ -47,10 +48,11 @@
               @change="valueChanged(item)"
             />
 
-            <input autocomplete="off"
+            <input
               v-if="item.displayType =='NumberEditor'"
               :id="'editor_' + item.id"
               v-model="item.fieldValue.displayValue[0]"
+              autocomplete="off"
               type="number"
               class="form-control"
               placeholder="请输入数字"
@@ -127,7 +129,8 @@
         >
           <span class="glyphicon glyphicon-question-sign" />
         </button>
-        <input autocomplete="off"
+        <input
+          autocomplete="off"
           type="button"
           class="btn btn-primary"
           style="margin-top: 15px;"

+ 2 - 1
packages/switches/src/Switches.vue

@@ -1,7 +1,8 @@
 <template>
   <label :class="classObject">
-    <input autocomplete="off"
+    <input
       v-model="value"
+      autocomplete="off"
       type="checkbox"
       :disabled="disabled"
       @click="clickEvent($event)"

+ 1 - 1
packages/time/src/Time.vue

@@ -1,5 +1,5 @@
 <template>
-  <input autocomplete="off" v-model="innerValue" type="time" :readonly="readonly" />
+  <input v-model="innerValue" autocomplete="off" type="time" :readonly="readonly" />
 </template>
 
 <script>

+ 2 - 1
packages/upload-widget/src/UploadWidget.vue

@@ -1,7 +1,8 @@
 <template>
   <div>
-    <input autocomplete="off"
+    <input
       ref="fileInput"
+      autocomplete="off"
       type="file"
       class="form-control file-input"
       :accept="fileType"

+ 2 - 1
packages/vue-datepicker/src/vue-datepicker.vue

@@ -1,8 +1,9 @@
 <template>
   <div class="cov-vue-date">
     <div class="datepickbox">
-      <input autocomplete="off"
+      <input
         v-model="date.time"
+        autocomplete="off"
         type="text"
         title="input date"
         class="cov-datepicker"

+ 1 - 1
packages/vue-monthly-picker/src/VueMonthlyPicker.vue

@@ -4,7 +4,7 @@
       class="month-picker-wrapper"
       :class="{ 'active visible':showMenu }"
     >
-      <div class="month-year-label picker" type="text"  tabindex="0" @click="openMenu">
+      <div class="month-year-label picker" type="text" tabindex="0" @click="openMenu">
         <div
           class="month-year-display"
           :disabled="disabled"

+ 2 - 1
webpack.lib.js

@@ -44,6 +44,7 @@ module.exports = WebpackMerge.merge(baseConfig,{
     'vue-i18n': 'vue-i18n',
     'vue-router': 'vue-router',
     'v-tooltip': 'v-tooltip',
-    'vuedraggable': 'vuedraggable'
+    'vuedraggable': 'vuedraggable',
+    "amis": "amis"
   }
 });