diff --git a/src/components/BaseSearchForm copy.vue b/src/components/BaseSearchForm copy.vue new file mode 100644 index 0000000..81e7835 --- /dev/null +++ b/src/components/BaseSearchForm copy.vue @@ -0,0 +1,181 @@ + + + + + diff --git a/src/components/BaseSearchForm.vue b/src/components/BaseSearchForm.vue index 4d83eff..e5eb507 100644 --- a/src/components/BaseSearchForm.vue +++ b/src/components/BaseSearchForm.vue @@ -1,188 +1,154 @@ diff --git a/src/components/noTemplateComponents/statusComponent.js b/src/components/noTemplateComponents/statusComponent.js index 4f4d656..bf40851 100644 --- a/src/components/noTemplateComponents/statusComponent.js +++ b/src/components/noTemplateComponents/statusComponent.js @@ -1,47 +1,69 @@ // import i18n from '@/i18n' export default { - name: 'StatusComponent', + name: "StatusComponent", props: { injectData: { type: Object, - default: () => ({}) - } + default: () => ({}), + }, }, data() { return { statusText: [ - '正常', - '异常', - '损坏', + "正常", + "异常", + "损坏", // more... ], statusType: [ - 'success', - 'warning', - 'danger', + "success", + "warning", + "danger", // more... - ] - } + ], + }; }, computed: { - isEnabled() { - return this.injectData && (this.injectData.enabled === 1 || this.injectData.enabled.toString() === '1') + // isEnabled() { + // return ( + // this.injectData && + // (this.injectData[this.injectData.head.prop ?? "enabled"] === 1 || + // this.injectData[this.injectData.head.prop ?? "enabled"].toString() === "1") + // ); + // }, + propValue() { + return this.injectData[this.injectData.head.prop ?? "enabled"] ?? 9527 + }, + type() { + if (this.propValue === 9527) { + return 'danger' + } + return this.statusType[this.propValue] + }, + text() { + if (this.propValue === 9527) { + return '未知状态' + } + return this.statusText[this.propValue] } }, mounted() { - console.log('[component] StatusComponent: ', this.injectData) + // console.log("[component] StatusComponent: ", this.injectData); }, methods: { // 发射事件 - emit(opt) { } + emit(opt) { }, }, render: function (h) { - return h('el-tag', + return h( + "el-tag", { - props: - { size: 'small', type: this.isEnabled ? this.statusType[0] : this.statusType[1] } + // props: { size: "small", type: this.isEnabled ? this.statusType[0] : this.statusType[1] }, + props: { size: "small", type: this.type }, }, - this.isEnabled ? this.statusText[0] : this.statusText[1]) - } -} \ No newline at end of file + // this.isEnabled ? this.statusText[0] : this.statusText[1] + this.text + ); + }, +}; diff --git a/src/utils/request.js b/src/utils/request.js index 324cdcc..d2880d9 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -17,7 +17,7 @@ const http = axios.create({ http.interceptors.request.use(config => { config.headers['Accept-Language'] = Cookies.get('language') || 'zh-CN' config.headers['token'] = Cookies.get('token') || '' - console.log('[request interceptor] token is:', config.headers['token']) + // console.log('[request interceptor] token is:', config.headers['token']) // 默认参数 var defaults = {} // 防止缓存,GET请求默认带_t参数 diff --git a/src/views/atomViews/ListViewWithHead.vue b/src/views/atomViews/ListViewWithHead.vue index 9b3cbf3..2e80e40 100644 --- a/src/views/atomViews/ListViewWithHead.vue +++ b/src/views/atomViews/ListViewWithHead.vue @@ -103,23 +103,22 @@ export default { }, /** 获取 列表数据 */ - getList(listQuery = null) { + getList(queryParams) { this.tableLoading = true; - if (!listQuery) { - listQuery = {}; - listQuery.page = this.page; - listQuery.size = this.size; - } - const params = { - page: listQuery.page, - limit: listQuery.size, - }; - if (this.listQueryExtra.length) { + const params = queryParams + ? { ...queryParams, page: this.page, limit: this.size } + : { + page: this.page, + limit: this.size, + }; + + if (!queryParams && this.listQueryExtra.length) { this.listQueryExtra.map((name) => { params[name] = ""; }); } + this.$http .get(this.urls.page, { params, @@ -207,8 +206,10 @@ export default { case "新增": this.openDialog(); break; - case "查询": + case "查询": { + this.getList(payload); break; + } } }, diff --git a/src/views/modules/pms/productionLine/config.js b/src/views/modules/pms/productionLine/config.js index aa6e8d2..9455f5e 100644 --- a/src/views/modules/pms/productionLine/config.js +++ b/src/views/modules/pms/productionLine/config.js @@ -24,6 +24,7 @@ export default function () { const headFormFields = [ { + prop: 'key', label: "产线名称/编码", input: true, default: { value: "" }, diff --git a/src/views/modules/pms/productionLine/index.vue b/src/views/modules/pms/productionLine/index.vue index 532ae7b..7ccdd8e 100644 --- a/src/views/modules/pms/productionLine/index.vue +++ b/src/views/modules/pms/productionLine/index.vue @@ -7,28 +7,13 @@ import initConfig from './config'; import ListViewWithHead from '@/views/atomViews/ListViewWithHead.vue'; export default { - name: 'BlenderView', + name: 'ProductionLineView', components: { ListViewWithHead }, provide() { return { urls: this.allUrls } - } - // urls: { - // type: Object, - // required: true, - // default: () => ({ - // /** 列表 url **/ list: null, - // /** 分页 url **/ page: null, - // /** 编辑保存 url **/ edit: null, - // /** 删除条目 url **/ delete: null, - // /** 详情 url **/ detail: null, - // /** 导出 url **/ export: null, - // /** 导入 url **/ import: null, - // /** 其他 url **/ other: null, - // }), - // }, - , + }, data() { const { tableConfig, headFormConfigs, urls, dialogConfigs } = initConfig.call(this); return {