diff --git a/src/components/BaseListTable.vue b/src/components/BaseListTable.vue index 01971cc..d48802a 100644 --- a/src/components/BaseListTable.vue +++ b/src/components/BaseListTable.vue @@ -9,10 +9,7 @@ :header-cell-style="/** 重写表格样式 **/ { padding: '8px 0', }" - :header-row-style="/** 重写表格样式 **/ { - color: 'red', - background: 'black', - }" + row-key="id" > diff --git a/src/components/DialogJustForm.vue b/src/components/DialogJustForm.vue index 055286a..5629193 100644 --- a/src/components/DialogJustForm.vue +++ b/src/components/DialogJustForm.vue @@ -1,290 +1,268 @@ diff --git a/src/components/noTemplateComponents/richInput.js b/src/components/noTemplateComponents/richInput.js index d1da305..4b90362 100644 --- a/src/components/noTemplateComponents/richInput.js +++ b/src/components/noTemplateComponents/richInput.js @@ -1,2 +1,65 @@ +import Quill from "quill" +import 'quill/dist/quill.snow.css' + // 富文本组件 -export default {} \ No newline at end of file +export default { + name: 'QuillRichInput', + props: ['readonly', 'placeholder', 'scroll'] + , + data() { + return { + ReadOnlyMode: false, + Placeholder: '', + ScrollingContainer: null + } + }, + watch: { + readonly(val) { + this.ReadOnlyMode = val + }, + placeholder(val) { + this.Placeholder = val + }, + scroll(val) { + this.ScrollingContainer = val + } + }, + mounted() { + console.log('[Quill Editor] ref:', this.$refs['quill-editor']) + /** https://blog.csdn.net/qq_36947168/article/details/119486710 */ + /** https://quilljs.com/docs/modules/toolbar/ */ + const toolbarOptions = [ + [{ 'font': [] }], + [{ 'size': ['small', false, 'large', 'huge'] }], // custom dropdown + ['bold', 'italic', 'underline', 'strike'], // toggled buttons + ['blockquote', 'code-block'], + + [{ 'header': 1 }, { 'header': 2 }], // custom button values + [{ 'list': 'ordered'}, { 'list': 'bullet' }], + [{ 'script': 'sub'}, { 'script': 'super' }], // superscript/subscript + [{ 'indent': '-1'}, { 'indent': '+1' }], // outdent/indent + [{ 'direction': 'rtl' }], // text direction + + [{ 'header': [1, 2, 3, 4, 5, 6, false] }], + + [{ 'color': [] }, { 'background': [] }], // dropdown with defaults from theme + [{ 'align': [] }], + + ['clean'] // remove formatting button + ]; + // const editor = new Quill(this.$refs['quill-editor'], this.defaultConfig) + const editor = new Quill(this.$refs['quill-editor'], { + modules: { + toolbar: toolbarOptions + }, + theme: 'snow', + readOnly: this.ReadOnlyMode, + placeholder: this.Placeholder, + scrollingContainer: this.ScrollingContainer + }) + }, + methods: {}, + render: function (h) { + return h('div', { ref: 'quill-editor', domProps: { id: 'quill-editor' } }) + } +} \ No newline at end of file diff --git a/src/views/atomViews/ListViewWithHead.vue b/src/views/atomViews/ListViewWithHead.vue index a9bb19b..b9e9198 100644 --- a/src/views/atomViews/ListViewWithHead.vue +++ b/src/views/atomViews/ListViewWithHead.vue @@ -129,10 +129,17 @@ export default { // page 场景: if ("list" in res.data) { // real env: - this.dataList = res.data.list.map((item) => ({ - ...item, - id: item._id ?? item.id, - })); + this.dataList = res.data.list.map((item) => { + // if (item.parentId || item.parendName) { /** && 也行 */ + // // 如果需要树形结构的列表 + // return this.reConstructDataList(res.data.list) + // } else { + return { + ...item, + id: item._id ?? item.id, + }; + // } + }); // this.dataList = res.data.records; this.totalPage = res.data.total; } else if ("records" in res.data) { @@ -151,6 +158,11 @@ export default { }); }, + /** 针对树形结构的列表,进行服务器端返回的数据重排 */ + reConstructDataList(list) { + // const parentIndex = list.forEach() + }, + /** 处理 HeadForm 的操作 */ handleHeadformOperate(payload) { // 查询,导出,导入,等等 diff --git a/src/views/modules/pms/car/config.js b/src/views/modules/pms/car/config.js new file mode 100644 index 0000000..b3cfb9d --- /dev/null +++ b/src/views/modules/pms/car/config.js @@ -0,0 +1,112 @@ +import TableOperaionComponent from "@/components/noTemplateComponents/operationComponent"; +import switchBtn from "@/components/noTemplateComponents/switchBtn"; +import QuillRichInput from "@/components/noTemplateComponents/richInput"; +import request from "@/utils/request"; +import { dictFilter } from '@/utils/filters' + +export default function () { + const tableProps = [ + { prop: "name", label: "窑车号" }, + { prop: "code", label: "编码" }, + { prop: "typeDictValue", label: "过渡车", filter: val => ['否', '是'](val) }, + { prop: "status", label: "状态", subcomponent: switchBtn }, // subcomponent + { prop: "currentQty", label: "载量" }, + { prop: "currentPos", label: "当前位置" }, + { prop: "description", label: "描述" }, + { prop: "remark", label: "备注" }, + { + prop: "operations", + name: "操作", + fixed: "right", + width: 120, + subcomponent: TableOperaionComponent, + options: ["edit", { name: "delete", permission: "pms:car:delete" }], + }, + ]; + + const headFormFields = [ + { + prop: 'name', + label: "窑车号", + input: true, + default: { value: "" }, + bind: { + // placeholder: '请输入产线名称或编码' + placeholder: '请输入料仓名称' + } + }, + { + button: { + type: "primary", + name: "查询", + }, + }, + { + button: { + type: "primary", + name: "新增", + permission: "pms:materialStorage:save" + }, + bind: { + plain: true, + } + }, + ]; + + /** + * dialog config 有两个版本,一个适用于 DialogWithMenu 组件,另一个适用于 DialogJustForm 组件 + * 适用于 DialogWithMenu 组件的配置示例详见 blenderStep/config.js + * 此为后者的配置: + */ + const dialogJustFormConfigs = { + clickModalToClose: false, + form: { + rows: [ + [ + { + input: true, + label: "窑车号", + prop: "name", + rules: { required: true, message: "not empty", trigger: "blur" }, + elparams: { placeholder: "请输入窑车号" }, + }, + { + input: true, + label: "编码", + prop: "code", + rules: { required: true, message: "not empty", trigger: "blur" }, + elparams: { placeholder: "请输入料仓编码" }, + }, + ], + [{ component: QuillRichInput, label: "描述信息", prop: "description" }], + [{ input: true, label: "备注", prop: "remark", elparams: { placeholder: "备注" } }], + ], + operations: [ + { name: "add", label: "保存", type: "primary", permission: "pms:car:save", showOnEdit: false }, + { name: "update", label: "更新", type: "primary", permission: "pms:car:update", showOnEdit: true }, + { name: "reset", label: "重置", type: "warning", showAlways: true }, + // { name: 'cancel', label: '取消', showAlways: true }, + ], + }, + }; + // 备注:弹窗弹出的时间和网速有关...... + + return { + dialogConfigs: dialogJustFormConfigs, + tableConfig: { + table: null, // 此处可省略,el-table 上的配置项 + column: tableProps, // el-column-item 上的配置项 + }, + headFormConfigs: { + rules: null, // 名称是由 BaseSearchForm.vue 组件固定的 + fields: headFormFields, // 名称是由 BaseSearchForm.vue 组件固定的 + }, + urls: { + base: "/pms/car", + page: "/pms/car/page", + // subase: '/pms/blenderStepParam', + // subpage: '/pms/blenderStepParam/page', + // more... + }, + }; +} diff --git a/src/views/modules/pms/car/index.vue b/src/views/modules/pms/car/index.vue new file mode 100644 index 0000000..da21189 --- /dev/null +++ b/src/views/modules/pms/car/index.vue @@ -0,0 +1,32 @@ + + + + + diff --git a/src/views/modules/pms/equipmentType/config.js b/src/views/modules/pms/equipmentType/config.js index 6d3fb79..27defa1 100644 --- a/src/views/modules/pms/equipmentType/config.js +++ b/src/views/modules/pms/equipmentType/config.js @@ -8,7 +8,7 @@ export default function () { { prop: "createTime", label: "添加时间", filter: timeFilter }, { prop: "name", label: "类型名称" }, { prop: "code", label: "类型编码" }, - { prop: "description", label: "描述" }, + // { prop: "description", label: "描述" }, { prop: "remark", label: "备注" }, { prop: "operations", @@ -72,9 +72,28 @@ export default function () { rules: { required: true, message: "not empty", trigger: "blur" }, elparams: { placeholder: "请输入类型编码" }, }, + { + prop: "parentId", + select: true, + options: [ + // {label: '父类1', value: '1'}, + // {label: '父类2', value: '2'}, + ], + // fetchData() 获取普通列表数据 + // fetchTreeData() 获取需要展示层级结构的数据 + fetchTreeData: () => { + return this.$http.get('/pms/equipmentType/page', { + limit: 999, page: 1, key: "" + }) + }, + label: "父类", + rules: { required: true, message: "not empty", trigger: "change" }, + elparams: { placeholder: "请输选择父类" }, + }, ], - [{ textarea: true, label: "描述信息", prop: "description", elparams: { placeholder: "描述信息" } }], + // [{ textarea: true, label: "描述信息", prop: "description", elparams: { placeholder: "描述信息" } }], [{ input: true, label: "备注", prop: "remark", elparams: { placeholder: "备注" } }], + [{ upload: true, label: "上传资料", prop: "upload", elparams: null }], ], operations: [ { name: "add", label: "保存", type: "primary", permission: "pms:equipmentType:save", showOnEdit: false }, diff --git a/src/views/modules/pms/materialType/index.vue b/src/views/modules/pms/materialType/index.vue index b6bb4c3..d337d43 100644 --- a/src/views/modules/pms/materialType/index.vue +++ b/src/views/modules/pms/materialType/index.vue @@ -7,7 +7,7 @@ import initConfig from './config'; import ListViewWithHead from '@/views/atomViews/ListViewWithHead.vue'; export default { - name: 'WorkSequenceView', + name: 'MaterialTypeView', components: { ListViewWithHead }, provide() { return {