diff --git a/src/layout/components/Sidebar/index.vue b/src/layout/components/Sidebar/index.vue index 50dccf0..65c9ef1 100644 --- a/src/layout/components/Sidebar/index.vue +++ b/src/layout/components/Sidebar/index.vue @@ -1,21 +1,21 @@ <template> <div :class="{'has-logo':showLogo}"> <!-- <logo v-if="showLogo" :collapse="isCollapse" />--> -<!-- <el-scrollbar wrap-class="scrollbar-wrapper"> +<el-scrollbar wrap-class="scrollbar-wrapper"> + <el-menu + :default-active="activeMenu" + :collapse="isCollapse" + :background-color="variables.menuBg" + :text-color="variables.menuText" + :unique-opened="false" + :active-text-color="variables.menuActiveText" + :collapse-transition="false" + mode="vertical" + > + <sidebar-item v-for="route in permission_routes" :key="route.path" :item="route" :base-path="route.path" /> + </el-menu> + </el-scrollbar> - </el-scrollbar>--> - <el-menu - :default-active="activeMenu" - :collapse="isCollapse" - :background-color="variables.menuBg" - :text-color="variables.menuText" - :unique-opened="false" - :active-text-color="variables.menuActiveText" - :collapse-transition="false" - mode="vertical" - > - <sidebar-item v-for="route in permission_routes" :key="route.path" :item="route" :base-path="route.path" /> - </el-menu> </div> </template> diff --git a/src/views/jhzx/sydgWH.vue b/src/views/jhzx/sydgWH.vue new file mode 100644 index 0000000..cc883d5 --- /dev/null +++ b/src/views/jhzx/sydgWH.vue @@ -0,0 +1,331 @@ +<template> + <el-container> + <el-header style="width: 100%"> + <el-row> + <el-col :span="20"> + <el-col :span="3"> + <el-input + v-model="request.matGrd" + placeholder="材质" + clearable + /> + </el-col> + </el-col> + <el-col :span="4" style="text-align: right"> + <el-button type="primary" @click="initList()">查询</el-button> + </el-col> + </el-row> + <el-row> + <el-col :span="20"> + <el-col :span="3"> + <el-select + v-model="request.matType" + placeholder="材质类型" + clearable + > + <el-option v-for="item in czlxList" :key="item.itemCode" :value="item.itemCode" :label="item.itemValue" /> + </el-select> + </el-col> + </el-col> + <el-col :span="4" style="text-align: right"> + + + + <el-button + type="success" + @click="toolbarButtonClickEvent('insert')" + >添加</el-button> + <el-button + type="danger" + @click="toolbarButtonClickEvent('delete')" + >删除</el-button> + <el-button + type="primary" + @click="toolbarButtonClickEvent('save')" + >保存</el-button> + + + </el-col> + </el-row> + </el-header> + <el-container style="padding-top: 10px"> + <el-container> + <el-main> + <div class="mytable"> + <vxe-grid + id="id" + ref="xGrid" + border + resizable + keep-source + :height="height" + :auto-resize="true" + :columns="tableColumn" + :data="list" + :custom-config="{ storage: true }" + :edit-config="{ trigger: 'click', mode: 'row', showStatus: true }" + highlight-hover-row + /> + </div> + + <!-- :toolbar-config="tableToolbar" @toolbar-button-click="toolbarButtonClickEvent"--> + <!-- <tb-filter ref="tbFilter" :list="" :filter="columnFilter" @execFilter="execFilter"></tb-filter>--> + </el-main> + </el-container> + </el-container> + </el-container> +</template> + +<script> + + + +import { mapGetters } from 'vuex' +import {null2str} from "@/utils/rpkj"; + +export default { + // components: { TbFilter }, + name:'SydgWH', + data() { + return { + request: { + matGrd: '', + matType: '', + departCode:'' + }, + list: [], + deptList: [], + czlx: { + dictCode: 'CZLX' + }, + czjb: { + dictCode: 'CZJB' + }, + czlxList: [], + czjbList: [], + columnFilter: {}, + height: '500px', + tableColumn: [ + { type: 'checkbox', width: 50 }, + { type: 'seq', width: 60, title: '序号' }, + { + field: 'zt', title: '状态',width:"100px", formatter: ['dictFormat','JLDW'], + }, + { field: 'lx', title: '类型', + editRender: { name: '$select', options: [], props: { clearable: true },events: { change: this.selectChange } + }, + filters: [{ data: { checks: [], sVal: '', sMenu: '', fType1: '', fVal1: '', fMode: 'and', fType2: '', fVal2: '' } }], + filterRender: { name: 'FilterCombination', }, + }, + /** + { + field: 'matGrd', + title: '材质', + editRender: { + name: 'input' + }, + filters: [{ data: { checks: [], sVal: '', sMenu: '', fType1: '', fVal1: '', fMode: 'and', fType2: '', fVal2: '' } }], + filterRender: { name: 'FilterCombination', }, + }, + { field: 'matType', title: '材质类型', + editRender: { name: '$select', options: [], props: { clearable: true },events: { change: this.selectChange } + }, + filters: [{ data: { checks: [], sVal: '', sMenu: '', fType1: '', fVal1: '', fMode: 'and', fType2: '', fVal2: '' } }], + filterRender: { name: 'FilterCombination', }, + }, + { field: 'matLevel', title: '级别', + editRender: { name: '$select', options: [], props: { clearable: true },events: { change: this.selectChange } + }, + filters: [{ data: { checks: [], sVal: '', sMenu: '', fType1: '', fVal1: '', fMode: 'and', fType2: '', fVal2: '' } }], + filterRender: { name: 'FilterCombination', }, + }, + { + field: 'weightFactor', + title: '重量系数', + editRender: { name: 'input' }, + filters: [{ data: { checks: [], sVal: '', sMenu: '', fType1: '', fVal1: '', fMode: 'and', fType2: '', fVal2: '' } }], + filterRender: { name: 'FilterCombination', }, + }, + { field: 'matCode', title: '材料编码', editRender: { name: 'input' }, + filters: [{ data: { checks: [], sVal: '', sMenu: '', fType1: '', fVal1: '', fMode: 'and', fType2: '', fVal2: '' } }], + filterRender: { name: 'FilterCombination', }, + }, + + { + field: 'matName', + title: '材料名称', + editRender: { name: 'input' }, + filters: [{ data: { checks: [], sVal: '', sMenu: '', fType1: '', fVal1: '', fMode: 'and', fType2: '', fVal2: '' } }], + filterRender: { name: 'FilterCombination', }, + }, + { field: 'weldName', title: '焊材名称', + editRender: { name: 'input' }, + filters: [{ data: { checks: [], sVal: '', sMenu: '', fType1: '', fVal1: '', fMode: 'and', fType2: '', fVal2: '' } }], + filterRender: { name: 'FilterCombination', }, + }, + **/ + { field: 'remark', title: '备注', editRender: { name: 'input' }} + ] + } + }, + computed: { + ...mapGetters(['name', 'bmbm']) + }, + created() { + window.addEventListener('resize', this.getHeight) + this.getHeight() + this.initList() + // this.initCzlxList() + // this.initCzjbList() + // this.request.departCode=this.bmbm + }, + mounted() { + this.initCzlxList() + }, + methods: { + initList() { + // getCzglList(this.request).then((res) => { + this.list = [{ + 'zt':'71', + 'lx':'M', + 'remark':'' + }] + + // }) + }, + initCzlxList() { + const dict=window.localStorage.getItem('GZLX'); + this.czlxList =JSON.parse(dict) + const xGrid = this.$refs.xGrid + const departCode = xGrid.getColumnByField('lx') + const testList = [] + for (let i = 0; i < this.czlxList.length; i++) { + const temp = { label: this.czlxList[i].bmsm, value:this.czlxList[i].bm } + testList.push(temp) + } + departCode.editRender.options = testList + + + }, + selectChange(row) { + this.$refs.xGrid.clearActived() // 清除单元格激活状态 + this.$refs.xGrid.setActiveCell(row.row, row.column.property) // 设置单元格为激活状态 + // if(row.row.treatmentType==='01'){ + // row.row.remark='11111111' + // // 希望改变这一行这个列得属性 disabled=false + // this.$refs.xGrid.getColumnByField('itdepartCode').editRender.props.disabled=false + // //console.log(this.$refs.xGrid.getColumnByField('itdepartCode')) + // } + null2str(row.row) + }, + getHeight() { + this.height = window.innerHeight - 160 + }, + toolbarButtonClickEvent(code) { + const { + insertRecords, + removeRecords, + updateRecords + } = this.$refs.xGrid.getRecordset() + switch (code) { + case 'insert': + this.$refs.xGrid.insertAt({ + 'bzry': this.name + }, -1).then(({ row }) => { + this.$refs.xGrid.setActiveRow(row) + }) + break + case 'delete': + this.$confirm('删除, 是否继续?', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then((type) => { + this.$refs.xGrid.removeCheckboxRow() + }) + break + case 'save': + if (insertRecords.length !== 0) { + addCzgl(insertRecords).then((response) => { + if (response.success) { + this.list = this.list.concat(insertRecords) + const xTable = this.$refs.xGrid + xTable.loadData(this.initList()) + this.$message({ message: '保存成功!', type: 'success' }) + } + }) + } + if (removeRecords.length !== 0) { + delCzgl(removeRecords).then((response) => { + if (response.success) { + for (let i = 0; i < this.list.length; i++) { + if (removeRecords.indexOf(this.list[i]) !== -1) { + this.list.splice(i, 1) + i-- + } + } + const xTable = this.$refs.xGrid + xTable.loadData(this.initList()) + this.$message({ message: '保存成功!', type: 'success' }) + } + }) + } + if (updateRecords.length !== 0) { + updateCzgl(updateRecords).then((response) => { + if (response.success) { + const xTable = this.$refs.xGrid + xTable.loadData(this.initList()) + this.$message({ message: '保存成功!', type: 'success' }) + } + }) + } + this.$message( + `新增 ${insertRecords.length} 条,删除 ${removeRecords.length} 条,更新 ${updateRecords.length} 条` + ) + break + } + } + } +} +</script> +<style lang="scss" scoped > +.el-header { + margin: 0; + padding: 5px; + height: auto; +} +.el-container { + padding: 0; + margin: 0; +} +.el-main { + padding: 0; +} +.el-col { + padding: 0; +} +.el-aside { + background: #fff; + padding: 0; +} +.el-container { + padding: 0; +} +.el-row { + margin-bottom: 5px; +} +.el-row:last-child { + margin-bottom: 0; +} +.tableStyles { + background: #0a76a4; +} +.my-dropdown { + width: 450px; + height: 250px; + background-color: #fff; + border: 1px solid #dcdfe6; + box-shadow: 0 0 6px 2px rgba(0, 0, 0, 0.1); + font-size: 12px; +} +</style>