¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <el-dialog title="ç©æ产åéæ©" |
| | | v-if="showFlag" |
| | | :visible.sync="showFlag" |
| | | :modal= false |
| | | width="80%" |
| | | center |
| | | > |
| | | <el-row :gutter="20"> |
| | | <!--åç±»æ°æ®--> |
| | | <el-col :span="4" :xs="24"> |
| | | <div class="head-container"> |
| | | <el-input |
| | | v-model="itemTypeName" |
| | | placeholder="请è¾å
¥åç±»å称" |
| | | clearable |
| | | size="small" |
| | | prefix-icon="el-icon-search" |
| | | style="margin-bottom: 20px" |
| | | /> |
| | | </div> |
| | | <div class="head-container"> |
| | | <el-tree |
| | | :data="itemTypeOptions" |
| | | :props="defaultProps" |
| | | :expand-on-click-node="false" |
| | | :filter-node-method="filterNode" |
| | | ref="tree" |
| | | default-expand-all |
| | | @node-click="handleNodeClick" |
| | | /> |
| | | </div> |
| | | </el-col> |
| | | <!--ç©ææ°æ®--> |
| | | <el-col :span="20" :xs="24"> |
| | | <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> |
| | | <el-form-item label="ç©æç¼ç " prop="itemCode"> |
| | | <el-input |
| | | v-model="queryParams.itemCode" |
| | | placeholder="请è¾å
¥ç©æç¼ç " |
| | | clearable |
| | | style="width: 240px" |
| | | @keyup.enter.native="handleQuery" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="ç©æå称" prop="itemName"> |
| | | <el-input |
| | | v-model="queryParams.itemName" |
| | | placeholder="请è¾å
¥ç©æå称" |
| | | clearable |
| | | style="width: 240px" |
| | | @keyup.enter.native="handleQuery" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">æç´¢</el-button> |
| | | <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">éç½®</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | <el-table v-loading="loading" :data="itemList" @selection-change="handleSelectionChange"> |
| | | <el-table-column type="selection" width="50" align="center" /> |
| | | <el-table-column label="ç©æç¼ç " width = "120" align="center" key="itemCode" prop="itemCode" v-if="columns[0].visible" > |
| | | </el-table-column> |
| | | <el-table-column label="ç©æå称" min-width="120" align="left" key="itemName" prop="itemName" v-if="columns[1].visible" :show-overflow-tooltip="true" /> |
| | | <el-table-column label="è§æ ¼åå·" align="left" key="specification" prop="specification" v-if="columns[2].visible" :show-overflow-tooltip="true" /> |
| | | <el-table-column label="åä½" align="center" key="unitOfMeasure" prop="unitOfMeasure" v-if="columns[3].visible" :show-overflow-tooltip="true" /> |
| | | <el-table-column label="ç©æ/产å" align="center" key="itemOrProduct" prop="itemOrProduct" v-if="columns[4].visible" :show-overflow-tooltip="true" > |
| | | <template slot-scope="scope"> |
| | | <dict-tag :options="dict.type.mes_item_product" :value="scope.row.itemOrProduct"/> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="æå±åç±»" align="center" key="itemTypeName" prop="itemTypeName" v-if="columns[5].visible" width="120" /> |
| | | <el-table-column label="å建æ¶é´" align="center" prop="createTime" v-if="columns[6].visible" width="160"> |
| | | <template slot-scope="scope"> |
| | | <span>{{ parseTime(scope.row.createTime) }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | |
| | | <pagination |
| | | v-show="total>0" |
| | | :total="total" |
| | | :page.sync="queryParams.pageNum" |
| | | :limit.sync="queryParams.pageSize" |
| | | @pagination="getList" |
| | | /> |
| | | </el-col> |
| | | </el-row> |
| | | <div slot="footer" class="dialog-footer"> |
| | | <el-button type="primary" @click="confirmSelect">ç¡® å®</el-button> |
| | | <el-button @click="showFlag=false">å æ¶</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | </template> |
| | | |
| | | <script> |
| | | import { listMdItem, getMdItem, delMdItem, addMdItem, updateMdItem} from "@/api/mes/md/mdItem"; |
| | | import { listAllUnitmeasure} from "@/api/mes/md/unitmeasure"; |
| | | import {genCode} from "@/api/system/autocode/rule" |
| | | import { getToken } from "@/utils/auth"; |
| | | import { treeselect } from "@/api/mes/md/itemtype"; |
| | | import Treeselect from "@riophae/vue-treeselect"; |
| | | import "@riophae/vue-treeselect/dist/vue-treeselect.css"; |
| | | |
| | | export default { |
| | | name: "MdItemSelect", |
| | | dicts: ['sys_yes_no','mes_item_product'], |
| | | components: { Treeselect }, |
| | | data() { |
| | | return { |
| | | showFlag:false, |
| | | |
| | | // éä¸æ°ç» |
| | | ids: [], |
| | | selectedRows: [], |
| | | // éå个ç¦ç¨ |
| | | single: true, |
| | | // éå¤ä¸ªç¦ç¨ |
| | | multiple: true, |
| | | // æ¾ç¤ºæç´¢æ¡ä»¶ |
| | | showSearch: true, |
| | | // æ»æ¡æ° |
| | | total: 0, |
| | | // ç©æ产åè¡¨æ ¼æ°æ® |
| | | itemList: null, |
| | | // é¨é¨æ é项 |
| | | itemTypeOptions: undefined, |
| | | // é¨é¨å称 |
| | | itemTypeName: undefined, |
| | | defaultProps: { |
| | | children: "children", |
| | | label: "label" |
| | | }, |
| | | // æ¥è¯¢åæ° |
| | | queryParams: { |
| | | pageNum: 1, |
| | | pageSize: 10, |
| | | itemCode: undefined, |
| | | itemName: undefined, |
| | | itemTypeId: 0 |
| | | }, |
| | | // åä¿¡æ¯ |
| | | columns: [ |
| | | { key: 0, label: `ç©æ/产åç¼ç `, visible: true }, |
| | | { key: 1, label: `ç©æ/产åå称`, visible: true }, |
| | | { key: 2, label: `è§æ ¼åå·`, visible: true }, |
| | | { key: 3, label: `åä½`, visible: true }, |
| | | { key: 4, label: `ç©æ/产å`, visible: true }, |
| | | { key: 5, label: `ç©æåç±»`, visible: true }, |
| | | { key: 6, label: `å建æ¶é´`, visible: true } |
| | | ] |
| | | }; |
| | | }, |
| | | watch: { |
| | | // æ ¹æ®å称çéåç±»æ |
| | | itemTypeName(val) { |
| | | this.$refs.tree.filter(val); |
| | | } |
| | | }, |
| | | created() { |
| | | this.getList(); |
| | | this.getTreeselect(); |
| | | }, |
| | | methods: { |
| | | /** æ¥è¯¢ç©æç¼ç å表 */ |
| | | getList() { |
| | | this.loading = true; |
| | | listMdItem(this.queryParams).then(response => { |
| | | this.itemList = response.rows; |
| | | this.total = response.total; |
| | | this.loading = false; |
| | | } |
| | | ); |
| | | }, |
| | | /** æ¥è¯¢åç±»ä¸ææ ç»æ */ |
| | | getTreeselect() { |
| | | treeselect().then(response => { |
| | | this.itemTypeOptions = response.data; |
| | | }); |
| | | }, |
| | | // çéèç¹ |
| | | filterNode(value, data) { |
| | | if (!value) return true; |
| | | return data.label.indexOf(value) !== -1; |
| | | }, |
| | | // èç¹åå»äºä»¶ |
| | | handleNodeClick(data) { |
| | | this.queryParams.itemTypeId = data.id; |
| | | this.handleQuery(); |
| | | }, |
| | | /** æç´¢æé®æä½ */ |
| | | handleQuery() { |
| | | this.queryParams.pageNum = 1; |
| | | this.getList(); |
| | | }, |
| | | /** éç½®æé®æä½ */ |
| | | resetQuery() { |
| | | this.resetForm("queryForm"); |
| | | this.handleQuery(); |
| | | }, |
| | | // å¤éæ¡éä¸æ°æ® |
| | | handleSelectionChange(selection) { |
| | | this.ids = selection.map(item => item.itemId); |
| | | this.single = selection.length != 1; |
| | | this.multiple = !selection.length; |
| | | this.selectedRows = selection; |
| | | }, |
| | | //ç¡®å®éä¸ |
| | | confirmSelect(){ |
| | | if(this.ids ==[] || this.ids.length==0){ |
| | | this.$notify({ |
| | | title:'æ示', |
| | | type:'warning', |
| | | message: '请è³å°éæ©ä¸æ¡æ°æ®!' |
| | | }); |
| | | return; |
| | | } |
| | | this.$emit('onSelected',this.selectedRows); |
| | | this.showFlag = false; |
| | | } |
| | | } |
| | | }; |
| | | </script> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <el-dialog title="ç©æ产åéæ©" |
| | | v-if="showFlag" |
| | | :visible.sync="showFlag" |
| | | :modal= false |
| | | width="80%" |
| | | center |
| | | > |
| | | <el-row :gutter="20"> |
| | | <!--ç©ææ°æ®--> |
| | | <el-col :span="24" :xs="24"> |
| | | <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> |
| | | <el-form-item label="ç©æç¼ç " prop="itemCode"> |
| | | <el-input |
| | | v-model="queryParams.itemCode" |
| | | placeholder="请è¾å
¥ç©æç¼ç " |
| | | clearable |
| | | style="width: 240px" |
| | | @keyup.enter.native="handleQuery" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="ç©æå称" prop="itemName"> |
| | | <el-input |
| | | v-model="queryParams.itemName" |
| | | placeholder="请è¾å
¥ç©æå称" |
| | | clearable |
| | | style="width: 240px" |
| | | @keyup.enter.native="handleQuery" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item style="float: right"> |
| | | <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">æç´¢</el-button> |
| | | <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">éç½®</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | <el-table border v-loading="loading" :data="itemList" @current-change="handleCurrent" @row-dblclick="handleRowDbClick"> |
| | | <el-table-column width="50" align="center" > |
| | | <template v-slot="scope"> |
| | | <el-radio v-model="selectedItemId" :label="scope.row.id" @change="handleRowChange(scope.row)">{{""}}</el-radio> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="ç©æç¼å·" align="center" prop="materialCode"> |
| | | </el-table-column> |
| | | <el-table-column label="ç©æå称" align="center" prop="materialName"> |
| | | </el-table-column> |
| | | <el-table-column label="ç§ç±»" align="center" prop="typeZ"> |
| | | </el-table-column> |
| | | <el-table-column label="ç±»å" align="center" prop="typeL"> |
| | | </el-table-column> |
| | | <el-table-column label="åä½" align="center" prop="unit"> |
| | | </el-table-column> |
| | | <el-table-column label="å建æ¶é´" align="center" prop="createTime" width="180"> |
| | | </el-table-column> |
| | | <el-table-column label="ERPè§æ ¼" align="center" prop="erpSpec"> |
| | | </el-table-column> |
| | | <el-table-column label="æ°æ®æ¥æº" align="center" prop="dataSource"> |
| | | </el-table-column> |
| | | <el-table-column label="ç¶æ" align="center" prop="status"> |
| | | </el-table-column> |
| | | <el-table-column label="åå" align="center" prop="supplier"> |
| | | </el-table-column> |
| | | <el-table-column label="å¤æ³¨" align="center" prop="remarks"> |
| | | </el-table-column> |
| | | </el-table> |
| | | |
| | | <pagination |
| | | v-show="total>0" |
| | | :total="total" |
| | | :page.sync="queryParams.pageNum" |
| | | :limit.sync="queryParams.pageSize" |
| | | @pagination="getList" |
| | | /> |
| | | </el-col> |
| | | </el-row> |
| | | <div slot="footer" class="dialog-footer"> |
| | | <el-button type="primary" @click="confirmSelect">ç¡® å®</el-button> |
| | | <el-button @click="showFlag=false">å æ¶</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | </template> |
| | | |
| | | <script> |
| | | import { listMaterial, getMaterial, delMaterial, addMaterial, updateMaterial } from "@/api/main/bs/material/material"; |
| | | |
| | | export default { |
| | | name: "MdItemSingle", |
| | | dicts: ['sys_yes_no','mes_item_product'], |
| | | data() { |
| | | return { |
| | | showFlag:false, |
| | | // éä¸æ°ç» |
| | | selectedItemId: undefined, |
| | | selectedRows: undefined, |
| | | // éå个ç¦ç¨ |
| | | single: true, |
| | | // éå¤ä¸ªç¦ç¨ |
| | | multiple: true, |
| | | // æ¾ç¤ºæç´¢æ¡ä»¶ |
| | | showSearch: true, |
| | | // æ»æ¡æ° |
| | | total: 0, |
| | | // ç©æ产åè¡¨æ ¼æ°æ® |
| | | itemList: null, |
| | | // é¨é¨æ é项 |
| | | itemTypeOptions: undefined, |
| | | // é¨é¨å称 |
| | | itemTypeName: undefined, |
| | | defaultProps: { |
| | | children: "children", |
| | | label: "label" |
| | | }, |
| | | // æ¥è¯¢åæ° |
| | | queryParams: { |
| | | pageNum: 1, |
| | | pageSize: 10, |
| | | itemCode: undefined, |
| | | itemName: undefined, |
| | | itemTypeId: 0 |
| | | }, |
| | | // åä¿¡æ¯ |
| | | columns: [ |
| | | { key: 0, label: `ç©æ/产åç¼ç `, visible: true }, |
| | | { key: 1, label: `ç©æ/产åå称`, visible: true }, |
| | | { key: 2, label: `è§æ ¼åå·`, visible: true }, |
| | | { key: 3, label: `åä½`, visible: true }, |
| | | { key: 4, label: `ç©æ/产å`, visible: true }, |
| | | { key: 5, label: `ç©æåç±»`, visible: true }, |
| | | { key: 6, label: `å建æ¶é´`, visible: true } |
| | | ] |
| | | }; |
| | | }, |
| | | watch: { |
| | | // æ ¹æ®å称çéåç±»æ |
| | | itemTypeName(val) { |
| | | this.$refs.tree.filter(val); |
| | | } |
| | | }, |
| | | created() { |
| | | this.getList(); |
| | | }, |
| | | methods: { |
| | | /** æ¥è¯¢ç©æç¼ç å表 */ |
| | | getList() { |
| | | this.loading = true; |
| | | listMaterial(this.queryParams).then(response => { |
| | | this.itemList = response.rows; |
| | | this.total = response.total; |
| | | this.loading = false; |
| | | } |
| | | ); |
| | | }, |
| | | // çéèç¹ |
| | | filterNode(value, data) { |
| | | if (!value) return true; |
| | | return data.label.indexOf(value) !== -1; |
| | | }, |
| | | // èç¹åå»äºä»¶ |
| | | handleNodeClick(data) { |
| | | this.queryParams.itemTypeId = data.id; |
| | | this.handleQuery(); |
| | | }, |
| | | /** æç´¢æé®æä½ */ |
| | | handleQuery() { |
| | | this.queryParams.pageNum = 1; |
| | | this.getList(); |
| | | }, |
| | | /** éç½®æé®æä½ */ |
| | | resetQuery() { |
| | | this.resetForm("queryForm"); |
| | | this.handleQuery(); |
| | | }, |
| | | handleCurrent(row){ |
| | | if(row){ |
| | | this.selectedRows = row; |
| | | } |
| | | }, |
| | | handleRowDbClick(row){ |
| | | if(row){ |
| | | this.selectedRows = row; |
| | | this.$emit('onSelected',this.selectedRows); |
| | | this.showFlag = false; |
| | | } |
| | | }, |
| | | // åééä¸æ°æ® |
| | | handleRowChange(row) { |
| | | debugger; |
| | | if(row){ |
| | | this.selectedRows = row; |
| | | } |
| | | }, |
| | | //ç¡®å®éä¸ |
| | | confirmSelect(){ |
| | | if(this.selectedItemId ==null || this.selectedItemId==0){ |
| | | this.$notify({ |
| | | title:'æ示', |
| | | type:'warning', |
| | | message: '请è³å°éæ©ä¸æ¡æ°æ®!' |
| | | }); |
| | | return; |
| | | } |
| | | console.log(this.selectedRows) |
| | | |
| | | this.$emit('onSelected',this.selectedRows); |
| | | this.showFlag = false; |
| | | } |
| | | } |
| | | }; |
| | | </script> |