¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div> |
| | | <a-card |
| | | :bordered="true" |
| | | style="height: 50%" |
| | | > |
| | | <a-row type="flex"> |
| | | <a-col><a-button |
| | | type="primary" |
| | | @click="handleAdd(da)" |
| | | >æ°å»º</a-button></a-col> |
| | | <a-col><a-button |
| | | type="primary" |
| | | @click="handleEdit(da)" |
| | | >ç¼è¾</a-button></a-col> |
| | | <a-col><a-button |
| | | type="primary" |
| | | @click="batchDel(da)" |
| | | >å é¤</a-button></a-col> |
| | | <a-col style="left: 5%"><a-button type="primary">模æ¿</a-button></a-col> |
| | | <a-col style="left: 5%"><a-button type="primary">导å
¥</a-button></a-col> |
| | | <a-col style="left: 5%"><a-button type="primary">导åº</a-button></a-col> |
| | | </a-row> |
| | | </a-card> |
| | | <a-row |
| | | type="flex" |
| | | :gutter="16" |
| | | > |
| | | <a-col |
| | | :md="5" |
| | | :sm="24" |
| | | > |
| | | Â Â Â |
| | | <MomBaseUnitCategoryListLeft |
| | | ref="MomBaseUnitCategoryListLeft" |
| | | class="MomBaseUnitCategoryListLeft" |
| | | @treeSelect="treeSelect" |
| | | /> |
| | | Â Â |
| | | </a-col> |
| | | <a-col |
| | | :md="24 - 5" |
| | | :sm="24" |
| | | > |
| | | <MomBaseUnitCategoryListRight |
| | | ref="MomBaseUnitCategoryListRight" |
| | | class="MomBaseUnitCategoryListRight" |
| | | @searchkeys="selectedKeys" |
| | | /> |
| | | </a-col> |
| | | </a-row> |
| | | <mom-base-unit-category-modal |
| | | ref="modalForm" |
| | | @ok="modalFormOk" |
| | | ></mom-base-unit-category-modal> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import MomBaseUnitCategoryListLeft from './modules/unitCategory/MomBaseUnitCategoryListLeft' |
| | | import MomBaseUnitCategoryListRight from './modules/unitCategory/MomBaseUnitCategoryListRight' |
| | | import MomBaseUnitCategoryModal from './modules/unitCategory/MomBaseUnitCategoryModal' |
| | | import { JeecgListMixin } from '@/mixins/JeecgListMixin' |
| | | import { deleteAction } from '@/api/manage' |
| | | |
| | | export default { |
| | | name: 'MomBaseUnitCategoryList', |
| | | mixins: [JeecgListMixin], |
| | | components: { MomBaseUnitCategoryListLeft, MomBaseUnitCategoryListRight, MomBaseUnitCategoryModal }, |
| | | data() { |
| | | return { |
| | | description: '计éåä½å类页é¢', |
| | | currentOrgCode: '', |
| | | selectedRowKeys: [], |
| | | selectionRows: [], |
| | | url: { |
| | | list: '/base/getTree', |
| | | deleteBatch: '/base/delete', |
| | | }, |
| | | da: [], |
| | | } |
| | | }, |
| | | |
| | | methods: { |
| | | //æ°å¢æ°æ®ï¼æ°å»ºæé®è§¦åï¼ |
| | | handleAdd(da) { |
| | | if (this.da.length <= 0) { |
| | | this.$message.warning('è¯·éæ©ä¸ä¸ªæ èç¹ï¼') |
| | | return |
| | | } else { |
| | | this.$refs.modalForm.add(da, { cb: this.callback }) |
| | | } |
| | | }, |
| | | //ä¿®æ¹æ°æ®ï¼ä¿®æ¹æé®è§¦åï¼ |
| | | handleEdit(da) { |
| | | if (this.da.length <= 0) { |
| | | this.$message.warning('è¯·éæ©ä¸ä¸ªæ èç¹ï¼') |
| | | return |
| | | } else { |
| | | this.$refs.modalForm.edit(da, { cb: this.loadTree }) |
| | | } |
| | | }, |
| | | //æ¹éå é¤å³ä¾§æ°æ®ï¼å 餿é®è§¦åï¼ |
| | | batchDel(da) { |
| | | if (!this.url.deleteBatch) { |
| | | this.$message.error('请设置url.deleteBatch屿§!') |
| | | return |
| | | } |
| | | if (this.selectedRowKeys.length <= 0) { |
| | | this.$message.warning('è¯·éæ©ä¸æ¡è®°å½ï¼') |
| | | return |
| | | } else { |
| | | var ids = '' |
| | | for (var a = 0; a < this.selectedRowKeys.length; a++) { |
| | | ids += this.selectedRowKeys[a] + ',' |
| | | } |
| | | var that = this |
| | | this.$confirm({ |
| | | title: '确认å é¤', |
| | | content: 'æ¯å¦å é¤é䏿°æ®?', |
| | | onOk: function () { |
| | | that.loading = true |
| | | deleteAction(that.url.deleteBatch, { ids: ids }) |
| | | .then((res) => { |
| | | if (res.success) { |
| | | that.$message.success(res.message) |
| | | } else { |
| | | that.$message.warning(res.message) |
| | | } |
| | | }) |
| | | .finally(() => { |
| | | that.loading = false |
| | | //éæ°è®¡ç®å页é®é¢ |
| | | that.reCalculatePage(that.selectedRowKeys.length) |
| | | that.onClearSelected() |
| | | that.$refs.MomBaseUnitCategoryListRight.loadData({ id: da.id }) |
| | | that.loadTree() |
| | | }) |
| | | }, |
| | | }) |
| | | } |
| | | }, |
| | | //éæ°è®¡ç®å页 |
| | | reCalculatePage(count) { |
| | | //æ»æ°é-count |
| | | let total = this.ipagination.total - count |
| | | //è·åå é¤åçåé¡µæ° |
| | | let currentIndex = Math.ceil(total / this.ipagination.pageSize) |
| | | //å é¤åçå页æ°<æå¨å½å页 |
| | | if (currentIndex < this.ipagination.current) { |
| | | this.ipagination.current = currentIndex |
| | | } |
| | | console.log('currentIndex', currentIndex) |
| | | }, |
| | | //æ¸
é¤å³ä¾§éä¸é¡¹ |
| | | onClearSelected() { |
| | | this.selectedRowKeys = [] |
| | | this.selectionRows = [] |
| | | }, |
| | | //å·¦å³èå¨ï¼da为左侧é䏿 çæ°æ®ï¼åæ§ä»¶ä¸è¿åï¼ |
| | | treeSelect(da) { |
| | | let id = da.id |
| | | this.da = da |
| | | this.onClearSelected() |
| | | this.$refs.MomBaseUnitCategoryListRight.loadData({ id }) |
| | | }, |
| | | //å³ä¾§å表éä¸äºä»¶ |
| | | selectedKeys(selectedRowKeys) { |
| | | this.selectedRowKeys = selectedRowKeys |
| | | }, |
| | | //å 载左侧æ |
| | | loadTree() { |
| | | this.$refs.MomBaseUnitCategoryListLeft.queryTreeData() |
| | | }, |
| | | //æ°å¢ç¼è¾ä¿åååè°å½æ°åæ¾é¡µé¢æ°æ® |
| | | callback(id) { |
| | | this.$refs.MomBaseUnitCategoryListLeft.queryTreeData() |
| | | this.$refs.MomBaseUnitCategoryListRight.loadData({ id: id }) |
| | | }, |
| | | }, |
| | | } |
| | | </script> |
| | | <style scoped> |
| | | @import '~@assets/less/common.less'; |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div> |
| | | <a-card |
| | | :bordered="true" |
| | | style="height: 50%" |
| | | > |
| | | <a-row type="flex"> |
| | | <a-col><a-button |
| | | type="primary" |
| | | @click="handleAdd(da)" |
| | | >æ°å»º</a-button></a-col> |
| | | <a-col><a-button |
| | | type="primary" |
| | | @click="handleEdit(selectedRows)" |
| | | >ç¼è¾</a-button></a-col> |
| | | <a-col><a-button |
| | | type="primary" |
| | | @click="batchDel(da)" |
| | | >å é¤</a-button></a-col> |
| | | <a-col style="left: 5%"><a-button type="primary">模æ¿</a-button></a-col> |
| | | <a-col style="left: 5%"><a-button type="primary">导å
¥</a-button></a-col> |
| | | <a-col style="left: 5%"><a-button type="primary">导åº</a-button></a-col> |
| | | </a-row> |
| | | </a-card> |
| | | <a-row |
| | | type="flex" |
| | | :gutter="16" |
| | | > |
| | | <a-col |
| | | :md="5" |
| | | :sm="24" |
| | | > |
| | | Â Â Â |
| | | <MomUnitListLeft |
| | | ref="MomUnitListLeft" |
| | | class="MomUnitListLeft" |
| | | @treeSelect="treeSelect" |
| | | /> |
| | | Â Â |
| | | </a-col> |
| | | <a-col |
| | | :md="24 - 5" |
| | | :sm="24" |
| | | > |
| | | <MomUnitListRight |
| | | ref="MomUnitListRight" |
| | | class="MomUnitListRight" |
| | | @searchkeys="selectedKeys" |
| | | /> |
| | | </a-col> |
| | | </a-row> |
| | | <mom-unit-modal |
| | | ref="modalForm" |
| | | @ok="modalFormOk" |
| | | ></mom-unit-modal> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import MomUnitListLeft from './modules/unit/MomUnitListLeft' |
| | | import MomUnitListRight from './modules/unit/MomUnitListRight' |
| | | import MomUnitModal from './modules/unit/MomUnitModal' |
| | | import { JeecgListMixin } from '@/mixins/JeecgListMixin' |
| | | import { deleteAction } from '@/api/manage' |
| | | |
| | | export default { |
| | | name: 'MomUnitList', |
| | | mixins: [JeecgListMixin], |
| | | components: { MomUnitListLeft, MomUnitListRight, MomUnitModal }, |
| | | data() { |
| | | return { |
| | | description: '计éåä½é¡µé¢', |
| | | currentOrgCode: '', |
| | | selectedRowKeys: [], |
| | | selectedRows: [], |
| | | url: { |
| | | list: '/base/getTree', |
| | | deleteBatch: '/base/unit/deleteMomUnit', |
| | | }, |
| | | da: [], |
| | | } |
| | | }, |
| | | |
| | | methods: { |
| | | //æ°å¢æ°æ®ï¼æ°å»ºæé®è§¦åï¼ |
| | | handleAdd(da) { |
| | | if (this.da.length <= 0) { |
| | | this.$message.warning('è¯·éæ©ä¸ä¸ªæ èç¹ï¼') |
| | | return |
| | | } else { |
| | | this.$refs.modalForm.add(da, { cb: this.callback }) |
| | | } |
| | | }, |
| | | //ä¿®æ¹æ°æ®ï¼ä¿®æ¹æé®è§¦åï¼ |
| | | handleEdit(selectedRows) { |
| | | if (this.selectedRows.length <= 0) { |
| | | this.$message.warning('è¯·éæ©ä¸æ¡éè¦ä¿®æ¹ç计éåä½ï¼') |
| | | return |
| | | } else if (this.selectedRows.length > 1) { |
| | | this.$message.warning('注æï¼åªè½éæ©ä¸æ¡è®¡éåä½è¿è¡ä¿®æ¹ï¼') |
| | | return |
| | | } else { |
| | | this.$refs.modalForm.edit(selectedRows, { cb: this.callback }) |
| | | } |
| | | }, |
| | | //æ¹éå é¤å³ä¾§æ°æ®ï¼å 餿é®è§¦åï¼ |
| | | batchDel(da) { |
| | | if (!this.url.deleteBatch) { |
| | | this.$message.error('请设置url.deleteBatch屿§!') |
| | | return |
| | | } |
| | | if (this.selectedRowKeys.length <= 0) { |
| | | this.$message.warning('è¯·éæ©ä¸æ¡è®°å½ï¼') |
| | | return |
| | | } else { |
| | | var ids = '' |
| | | for (var a = 0; a < this.selectedRowKeys.length; a++) { |
| | | ids += this.selectedRowKeys[a] + ',' |
| | | } |
| | | var that = this |
| | | this.$confirm({ |
| | | title: '确认å é¤', |
| | | content: 'æ¯å¦å é¤é䏿°æ®?', |
| | | onOk: function () { |
| | | that.loading = true |
| | | deleteAction(that.url.deleteBatch, { ids: ids }) |
| | | .then((res) => { |
| | | if (res.success) { |
| | | that.$message.success(res.message) |
| | | } else { |
| | | that.$message.warning(res.message) |
| | | } |
| | | }) |
| | | .finally(() => { |
| | | that.loading = false |
| | | //éæ°è®¡ç®å页é®é¢ |
| | | that.reCalculatePage(that.selectedRowKeys.length) |
| | | that.onClearSelected() |
| | | that.$refs.MomUnitListRight.loadData({ id: da.id }) |
| | | that.loadTree() |
| | | }) |
| | | }, |
| | | }) |
| | | } |
| | | }, |
| | | //éæ°è®¡ç®å页 |
| | | reCalculatePage(count) { |
| | | //æ»æ°é-count |
| | | let total = this.ipagination.total - count |
| | | //è·åå é¤åçåé¡µæ° |
| | | let currentIndex = Math.ceil(total / this.ipagination.pageSize) |
| | | //å é¤åçå页æ°<æå¨å½å页 |
| | | if (currentIndex < this.ipagination.current) { |
| | | this.ipagination.current = currentIndex |
| | | } |
| | | console.log('currentIndex', currentIndex) |
| | | }, |
| | | //æ¸
é¤å³ä¾§éä¸é¡¹ |
| | | onClearSelected() { |
| | | this.selectedRowKeys = [] |
| | | this.selectedRows = [] |
| | | }, |
| | | //å·¦å³èå¨ï¼da为左侧é䏿 çæ°æ®ï¼åæ§ä»¶ä¸è¿åï¼ |
| | | treeSelect(da) { |
| | | let id = da.id |
| | | this.da = da |
| | | this.onClearSelected() |
| | | this.$refs.MomUnitListRight.loadData({ unitCategoryId: id }) |
| | | }, |
| | | //å³ä¾§å表éä¸äºä»¶ |
| | | selectedKeys(selectedRowKeys, selectedRows) { |
| | | this.selectedRowKeys = selectedRowKeys |
| | | this.selectedRows = selectedRows |
| | | }, |
| | | //å 载左侧æ |
| | | loadTree() { |
| | | this.$refs.MomUnitListLeft.queryTreeData() |
| | | }, |
| | | //æ°å¢ç¼è¾ä¿åååè°å½æ°åæ¾é¡µé¢æ°æ® |
| | | callback(id) { |
| | | this.$refs.MomUnitListRight.loadData({ id: id }) |
| | | this.$refs.MomUnitListRight.getList() |
| | | }, |
| | | }, |
| | | } |
| | | </script> |
| | | <style scoped> |
| | | @import '~@assets/less/common.less'; |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <a-spin :spinning="confirmLoading"> |
| | | <j-form-container :disabled="formDisabled"> |
| | | <a-form-model ref="form" :model="model" slot="detail" :rules="validatorRules"> |
| | | <a-row type="flex" :gutter="16"> |
| | | <a-col :span="24"> |
| | | <a-form-model-item label="ç®æ 计éåä½ä»£ç " :labelCol="labelCol" :wrapperCol="wrapperCol" prop="targetUnitId"> |
| | | <a-tree-select |
| | | style="width:100%" |
| | | :dropdownStyle="{ maxHeight: '200px', overflow: 'auto' }" |
| | | :treeData="treeData" |
| | | v-model="model.targetUnitId" |
| | | placeholder="è¯·éæ©ç¶çº§èå" |
| | | :replace-fields="replaceFields" |
| | | :disabled="false" |
| | | @change="handleParentIdChange"> |
| | | </a-tree-select> |
| | | </a-form-model-item> |
| | | </a-col> |
| | | |
| | | <a-col :span="24"> |
| | | <a-form-model-item label="æ¢ç®æ¯ä¾" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="conversionRatio"> |
| | | <a-input style="width: 48%" :min="1" defaultValue="1" :disabled="true" ></a-input> |
| | | <span>ï¼</span> |
| | | <a-input style="width: 49%" :min="1" v-model="model.conversionRatio" placeholder="请è¾å
¥æ¢ç®æ¯ä¾"></a-input> |
| | | </a-form-model-item> |
| | | </a-col> |
| | | |
| | | <a-col :span="24"> |
| | | <a-form-model-item label="夿³¨" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="remark"> |
| | | <a-input style="width: 100%" :min="1" v-model="model.remark" placeholder="请è¾å
¥å¤æ³¨"></a-input> |
| | | </a-form-model-item> |
| | | </a-col> |
| | | </a-row> |
| | | <a-row type="flex" :gutter="16" justify="center"> |
| | | <a-col> |
| | | <a-button type="primary" @click="submitForm">ä¿å</a-button> |
| | | </a-col> |
| | | |
| | | <a-col> |
| | | <a-button type="primary" @click="submitFormAndAdd">ä¿åå¹¶æ°å¢</a-button> |
| | | </a-col> |
| | | |
| | | <a-col> |
| | | <a-button type="primary" @click="close">åæ¶</a-button> |
| | | </a-col> |
| | | </a-row> |
| | | </a-form-model> |
| | | </j-form-container> |
| | | </a-spin> |
| | | </template> |
| | | |
| | | <script> |
| | | import { httpAction, getAction } from '@/api/manage' |
| | | import { validateDuplicateValue } from '@/utils/util' |
| | | import JFormContainer from '@/components/jeecg/JFormContainer' |
| | | import JDate from '@/components/jeecg/JDate' |
| | | import JDictSelectTag from '@/components/dict/JDictSelectTag' |
| | | |
| | | export default { |
| | | name: 'MomUnitConversionForm', |
| | | components: { |
| | | JFormContainer, |
| | | JDate, |
| | | JDictSelectTag, |
| | | }, |
| | | props: { |
| | | formData: { |
| | | type: Object, |
| | | default: () => {}, |
| | | required: false, |
| | | }, |
| | | normal: { |
| | | type: Boolean, |
| | | default: false, |
| | | required: false, |
| | | }, |
| | | disabled: { |
| | | type: Boolean, |
| | | default: false, |
| | | required: false, |
| | | }, |
| | | }, |
| | | data() { |
| | | return { |
| | | model: { status: 1 }, |
| | | id: '', |
| | | treeData: null, |
| | | replaceFields: { |
| | | children:"children", |
| | | title: 'codeName', |
| | | key:"code", |
| | | value:"id" |
| | | }, |
| | | labelCol: { |
| | | xs: { span: 24 }, |
| | | sm: { span: 5 }, |
| | | }, |
| | | wrapperCol: { |
| | | xs: { span: 24 }, |
| | | sm: { span: 16 }, |
| | | }, |
| | | confirmLoading: false, |
| | | url: { |
| | | addMomUnit: '/base/unit/addMomUnit', |
| | | deleteMomUnit: '/base/unit/deleteMomUnit', |
| | | addMomUnitOnversion: '/base/unit/onversion/addMomUnitOnversion', |
| | | deleteMomUnitOnversion:'/base/unit/onversion/deleteMomUnitOnversion', |
| | | treeList:'/base/getUnitTree' |
| | | }, |
| | | validatorRules: { |
| | | targetUnitId: [{ required: true, message: 'è¯·éæ©ç®æ 计éåä½ä»£ç !' }, { trigger: 'blur' }], |
| | | conversionRatio: [{ required: true, message: '请è¾å
¥æ¢ç®æ¯ä¾!' }, { trigger: 'blur' }], |
| | | }, |
| | | cb: null, |
| | | } |
| | | }, |
| | | computed: { |
| | | formDisabled() { |
| | | if (this.normal === false) { |
| | | if (this.formData.disabled === false) { |
| | | return false |
| | | } else { |
| | | return true |
| | | } |
| | | } |
| | | return this.disabled |
| | | }, |
| | | disabledId() { |
| | | return this.id ? true : false |
| | | }, |
| | | showFlowSubmitButton() { |
| | | if (this.normal === false) { |
| | | if (this.formData.disabled === false) { |
| | | return true |
| | | } else { |
| | | return false |
| | | } |
| | | } else { |
| | | return false |
| | | } |
| | | }, |
| | | }, |
| | | created() { |
| | | this.showFlowData() |
| | | this.loadTree() |
| | | }, |
| | | methods: { |
| | | showAdd(record, { cb }) { |
| | | this.cb = cb |
| | | this.model = record ? Object.assign({}, record) : this.model |
| | | this.id = record ? record.id : '' |
| | | this.model.id='' |
| | | this.model.name='' |
| | | this.model.remark='' |
| | | this.model.unitId=record[0].id |
| | | this.visible = true |
| | | }, |
| | | show(record, { cb }) { |
| | | this.cb = cb |
| | | this.model = record[0] ? Object.assign({}, record[0]) : this.model |
| | | this.id = record[0] ? record[0].id : '' |
| | | this.visible = true |
| | | this.loadTree(); |
| | | }, |
| | | showFlowData() { |
| | | if (this.normal === false) { |
| | | let params = { id: this.formData.dataId } |
| | | getAction(this.url.queryById, params).then((res) => { |
| | | if (res.success) { |
| | | this.edit(res.result) |
| | | } |
| | | }) |
| | | } |
| | | }, |
| | | //ä¿åæé®è§¦å |
| | | submitForm() { |
| | | const that = this |
| | | // 触å表åéªè¯ |
| | | that.$refs.form.validate((valid) => { |
| | | if (valid) { |
| | | that.confirmLoading = true |
| | | let httpurl = this.url.addMomUnitOnversion |
| | | let method = 'post' |
| | | httpAction(httpurl, this.model, method) |
| | | .then((res) => { |
| | | if (res.success) { |
| | | that.$message.success(res.message) |
| | | that.$emit('ok') |
| | | } else { |
| | | that.$message.warning(res.message) |
| | | } |
| | | }) |
| | | .finally(() => { |
| | | that.confirmLoading = false |
| | | this.cb(this.id) |
| | | this.cb = null |
| | | }) |
| | | } else { |
| | | return false |
| | | } |
| | | }) |
| | | }, |
| | | //ä¿åå¹¶æ°å¢æé®è§¦å |
| | | submitFormAndAdd() { |
| | | const that = this |
| | | // 触å表åéªè¯ |
| | | that.$refs.form.validate((valid) => { |
| | | if (valid) { |
| | | that.confirmLoading = true |
| | | let httpurl = this.url.addMomUnit |
| | | let method = 'post' |
| | | httpAction(httpurl, this.model, method) |
| | | .then((res) => { |
| | | if (res.success) { |
| | | that.$message.success(res.message) |
| | | } else { |
| | | that.$message.warning(res.message) |
| | | } |
| | | }) |
| | | .finally(() => { |
| | | this.confirmLoading = false |
| | | this.model.id = '' |
| | | this.model.num = '' |
| | | this.model.name = '' |
| | | this.cb(this.id) |
| | | }) |
| | | } else { |
| | | return false |
| | | } |
| | | }) |
| | | }, |
| | | loadTree(){ |
| | | var that = this; |
| | | getAction(that.url.treeList).then((res) => { |
| | | if (res.success) { |
| | | that.treeData = res.result |
| | | } |
| | | }) |
| | | }, |
| | | handleParentIdChange(value){ |
| | | if(!value){ |
| | | this.validateStatus="error" |
| | | }else{ |
| | | this.validateStatus="success" |
| | | } |
| | | }, |
| | | //åæ¶æé®è§¦å |
| | | close() { |
| | | this.$emit('ok') |
| | | this.visible = false |
| | | }, |
| | | }, |
| | | } |
| | | </script> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <j-modal |
| | | :title="title" |
| | | :width="width" |
| | | :visible="visible" |
| | | switchFullscreen |
| | | @ok="handleOk" |
| | | :okButtonProps="{ class:{'jee-hidden': disableSubmit} }" |
| | | @cancel="handleCancel" |
| | | :footer="null" |
| | | > |
| | | <mom-unit-conversion-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit" normal></mom-unit-conversion-form> |
| | | </j-modal> |
| | | </template> |
| | | |
| | | <script> |
| | | import MomUnitConversionForm from './MomUnitConversionForm' |
| | | export default { |
| | | name: "MomUnitConversionModal", |
| | | components: { |
| | | MomUnitConversionForm |
| | | }, |
| | | data () { |
| | | return { |
| | | title:'', |
| | | width:800, |
| | | visible: false, |
| | | disableSubmit: false |
| | | } |
| | | }, |
| | | methods: { |
| | | add (record,{cb}) { |
| | | this.title="æ°å»º" |
| | | this.visible=true |
| | | this.$nextTick(()=>{ |
| | | this.$refs.realForm.showAdd(record,{cb}); |
| | | }) |
| | | }, |
| | | edit (record,{cb}) { |
| | | this.title="ç¼è¾" |
| | | this.visible=true |
| | | this.$nextTick(()=>{ |
| | | this.$refs.realForm.show(record,{cb}); |
| | | }) |
| | | }, |
| | | close () { |
| | | this.$emit('close'); |
| | | this.visible = false; |
| | | }, |
| | | handleOk () { |
| | | this.$refs.realForm.submitForm(); |
| | | }, |
| | | submitCallback(){ |
| | | this.$emit('ok'); |
| | | this.visible = false; |
| | | }, |
| | | handleCancel () { |
| | | this.close() |
| | | }, |
| | | |
| | | } |
| | | } |
| | | </script> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <a-spin :spinning="confirmLoading"> |
| | | <j-form-container :disabled="formDisabled"> |
| | | <a-form-model ref="form" :model="model" slot="detail" :rules="validatorRules"> |
| | | <a-row type="flex" :gutter="16"> |
| | | <a-col :span="24"> |
| | | <a-form-model-item label="计éåä½ç¼ç " :labelCol="labelCol" :wrapperCol="wrapperCol" prop="num"> |
| | | <a-input v-model="model.num" placeholder="请è¾å
¥è®¡éåä½ç¼ç "></a-input> |
| | | </a-form-model-item> |
| | | </a-col> |
| | | |
| | | <a-col :span="24"> |
| | | <a-form-model-item label="计éåä½åç§°" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="name"> |
| | | <a-input style="width: 100%" :min="1" v-model="model.name" placeholder="请è¾å
¥è®¡éåä½åç§°"></a-input> |
| | | </a-form-model-item> |
| | | </a-col> |
| | | |
| | | <a-col :span="24"> |
| | | <a-form-model-item label="åç±»åç§°" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="categoryName"> |
| | | <a-input style="width: 100%" :min="1" v-model="model.categoryName" :disabled="true"></a-input> |
| | | </a-form-model-item> |
| | | </a-col> |
| | | |
| | | <a-col :span="24"> |
| | | <a-form-model-item label="夿³¨" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="remark"> |
| | | <a-input style="width: 100%" :min="1" v-model="model.remark" placeholder="请è¾å
¥å¤æ³¨"></a-input> |
| | | </a-form-model-item> |
| | | </a-col> |
| | | </a-row> |
| | | <a-row type="flex" :gutter="16" justify="center"> |
| | | <a-col> |
| | | <a-button type="primary" @click="submitForm">ä¿å</a-button> |
| | | </a-col> |
| | | |
| | | <a-col> |
| | | <a-button type="primary" @click="submitFormAndAdd">ä¿åå¹¶æ°å¢</a-button> |
| | | </a-col> |
| | | |
| | | <a-col> |
| | | <a-button type="primary" @click="close">åæ¶</a-button> |
| | | </a-col> |
| | | </a-row> |
| | | </a-form-model> |
| | | </j-form-container> |
| | | </a-spin> |
| | | </template> |
| | | |
| | | <script> |
| | | import { httpAction, getAction } from '@/api/manage' |
| | | import { validateDuplicateValue } from '@/utils/util' |
| | | import JFormContainer from '@/components/jeecg/JFormContainer' |
| | | import JDate from '@/components/jeecg/JDate' |
| | | import JDictSelectTag from '@/components/dict/JDictSelectTag' |
| | | |
| | | export default { |
| | | name: 'MomUnitForm', |
| | | components: { |
| | | JFormContainer, |
| | | JDate, |
| | | JDictSelectTag, |
| | | }, |
| | | props: { |
| | | formData: { |
| | | type: Object, |
| | | default: () => {}, |
| | | required: false, |
| | | }, |
| | | normal: { |
| | | type: Boolean, |
| | | default: false, |
| | | required: false, |
| | | }, |
| | | disabled: { |
| | | type: Boolean, |
| | | default: false, |
| | | required: false, |
| | | }, |
| | | }, |
| | | data() { |
| | | return { |
| | | model: { status: 1 }, |
| | | id: '', |
| | | labelCol: { |
| | | xs: { span: 24 }, |
| | | sm: { span: 5 }, |
| | | }, |
| | | wrapperCol: { |
| | | xs: { span: 24 }, |
| | | sm: { span: 16 }, |
| | | }, |
| | | confirmLoading: false, |
| | | url: { |
| | | addMomUnit: '/base/unit/addMomUnit', |
| | | deleteMomUnit: '/base/unit/deleteMomUnit', |
| | | addMomUnitOnversion: '/base/unit/onversion/addMomUnitOnversion', |
| | | deleteMomUnitOnversion:'/base/unit/onversion/deleteMomUnitOnversion' |
| | | }, |
| | | validatorRules: { |
| | | num: [{ required: true, message: '请è¾å
¥è®¡éåä½ç¼ç !' }, { trigger: 'blur' }], |
| | | name: [{ required: true, message: '请è¾å
¥è®¡éåä½åç§°!' }, { trigger: 'blur' }], |
| | | }, |
| | | cb: null, |
| | | } |
| | | }, |
| | | computed: { |
| | | formDisabled() { |
| | | if (this.normal === false) { |
| | | if (this.formData.disabled === false) { |
| | | return false |
| | | } else { |
| | | return true |
| | | } |
| | | } |
| | | return this.disabled |
| | | }, |
| | | disabledId() { |
| | | return this.id ? true : false |
| | | }, |
| | | showFlowSubmitButton() { |
| | | if (this.normal === false) { |
| | | if (this.formData.disabled === false) { |
| | | return true |
| | | } else { |
| | | return false |
| | | } |
| | | } else { |
| | | return false |
| | | } |
| | | }, |
| | | }, |
| | | created() { |
| | | this.showFlowData() |
| | | }, |
| | | methods: { |
| | | showAdd(record, { cb }) { |
| | | this.cb = cb |
| | | this.model = record ? Object.assign({}, record) : this.model |
| | | this.id = record ? record.id : '' |
| | | this.model.id='' |
| | | this.model.name='' |
| | | this.model.remark='' |
| | | this.model.unitCategoryId=record.id |
| | | this.model.categoryName = record.codeName |
| | | this.visible = true |
| | | }, |
| | | show(record, { cb }) { |
| | | this.cb = cb |
| | | this.model = record[0] ? Object.assign({}, record[0]) : this.model |
| | | this.id = record[0] ? record[0].id : '' |
| | | this.visible = true |
| | | }, |
| | | showFlowData() { |
| | | if (this.normal === false) { |
| | | let params = { id: this.formData.dataId } |
| | | getAction(this.url.queryById, params).then((res) => { |
| | | if (res.success) { |
| | | this.edit(res.result) |
| | | } |
| | | }) |
| | | } |
| | | }, |
| | | //ä¿åæé®è§¦å |
| | | submitForm() { |
| | | const that = this |
| | | // 触å表åéªè¯ |
| | | that.$refs.form.validate((valid) => { |
| | | if (valid) { |
| | | that.confirmLoading = true |
| | | let httpurl = this.url.addMomUnit |
| | | let method = 'post' |
| | | httpAction(httpurl, this.model, method) |
| | | .then((res) => { |
| | | if (res.success) { |
| | | that.$message.success(res.message) |
| | | that.$emit('ok') |
| | | } else { |
| | | that.$message.warning(res.message) |
| | | } |
| | | }) |
| | | .finally(() => { |
| | | that.confirmLoading = false |
| | | this.cb(this.id) |
| | | this.cb = null |
| | | }) |
| | | } else { |
| | | return false |
| | | } |
| | | }) |
| | | }, |
| | | //ä¿åå¹¶æ°å¢æé®è§¦å |
| | | submitFormAndAdd() { |
| | | const that = this |
| | | // 触å表åéªè¯ |
| | | that.$refs.form.validate((valid) => { |
| | | if (valid) { |
| | | that.confirmLoading = true |
| | | let httpurl = this.url.addMomUnit |
| | | let method = 'post' |
| | | httpAction(httpurl, this.model, method) |
| | | .then((res) => { |
| | | if (res.success) { |
| | | that.$message.success(res.message) |
| | | } else { |
| | | that.$message.warning(res.message) |
| | | } |
| | | }) |
| | | .finally(() => { |
| | | this.confirmLoading = false |
| | | this.model.id = '' |
| | | this.model.num = '' |
| | | this.model.name = '' |
| | | this.cb(this.id) |
| | | }) |
| | | } else { |
| | | return false |
| | | } |
| | | }) |
| | | }, |
| | | //åæ¶æé®è§¦å |
| | | close() { |
| | | this.$emit('ok') |
| | | this.visible = false |
| | | }, |
| | | }, |
| | | } |
| | | </script> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <a-card :bordered="false" style="height: 100%;"> |
| | | <a-tree |
| | | showLine |
| | | checkStrictly |
| | | :replace-fields="replaceFields" |
| | | :dropdownStyle="{maxHeight:'200px',overflow:'auto'}" |
| | | :treeData="treeDataSource" |
| | | @select="handleTreeSelect" |
| | | > |
| | | <a-icon slot="switcherIcon" type="folder" /></a-tree> |
| | | </a-card> |
| | | </template> |
| | | |
| | | <script> |
| | | import { getAction } from '@/api/manage' |
| | | |
| | | export default { |
| | | name: 'MomUnitListLeft', |
| | | data() { |
| | | return { |
| | | treeDataSource:[], |
| | | replaceFields: { |
| | | title: 'codeName', |
| | | }, |
| | | url:{ |
| | | getTree:'/base/getTree' |
| | | } |
| | | } |
| | | }, |
| | | created() { |
| | | this.queryTreeData() |
| | | }, |
| | | methods: { |
| | | |
| | | queryTreeData() { |
| | | getAction(this.url.getTree).then((res)=>{ |
| | | this.treeDataSource = res.result; |
| | | }) |
| | | }, |
| | | //左侧æ ç¹å»è§¦å |
| | | handleTreeSelect(selectedKeys, event) { |
| | | let da = event.node.dataRef; |
| | | this.$emit("treeSelect", da); |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <a-card class="j-address-list-right-card-box" :bordered="false"> |
| | | <a-table |
| | | ref="table" |
| | | size="middle" |
| | | :row-selection="rowSelection" |
| | | bordered |
| | | rowKey="id" |
| | | :columns="columns" |
| | | :dataSource="dataSource" |
| | | > |
| | | </a-table> |
| | | <a-tabs type="card"> |
| | | <a-tab-pane key="1" tab="å使¢ç®"> |
| | | <a-row type="flex" :gutter="5" justify="end"> |
| | | <a-col><a-button type="text" style="float:right" @click="batchDel(selectedDownRows)"><a-icon type="minus" style="color:rgba(28, 106, 235, 1)"></a-icon></a-button></a-col> |
| | | <a-col><a-button type="text" style="float:right" @click="handleAdd(selectedRows)"><a-icon type="plus" style="color:rgba(28, 106, 235, 1)"></a-icon></a-button></a-col> |
| | | <a-col><a-button type="text" style="float:right" @click="handleEdit(selectedDownRows)"><a-icon type="form" style="color:rgba(28, 106, 235, 1)"></a-icon></a-button></a-col> |
| | | </a-row> |
| | | </a-tab-pane> |
| | | </a-tabs> |
| | | <a-table |
| | | ref="table" |
| | | size="middle" |
| | | :row-selection="rowDownSelection" |
| | | bordered |
| | | rowKey="id" |
| | | :columns="downColumns" |
| | | :dataSource="downDataSource" |
| | | > |
| | | </a-table> |
| | | <mom-unit-conversion-modal ref="modalForm" ></mom-unit-conversion-modal> |
| | | </a-card> |
| | | </template> |
| | | |
| | | <script> |
| | | import { getAction } from '@/api/manage' |
| | | import MomUnitConversionModal from './MomUnitConversionModal' |
| | | import { deleteAction } from '@/api/manage' |
| | | import { JeecgListMixin } from '@/mixins/JeecgListMixin' |
| | | |
| | | export default { |
| | | name: 'MomUnitListRight', |
| | | mixins: [JeecgListMixin], |
| | | components: { MomUnitConversionModal }, |
| | | props: ['value'], |
| | | data() { |
| | | return { |
| | | description: '计éåä½ä¿¡æ¯', |
| | | positionInfo: {}, |
| | | dataSource: null, |
| | | unitCategoryId:"", |
| | | downDataSource: null, |
| | | selectedRowKeys:[], |
| | | selectedRows:[], |
| | | ids:"", |
| | | selectedDownRowKeys:[], |
| | | selectedDownRows:[], |
| | | url: { |
| | | deleteBatch: '/base/unit/onversion/deleteMomUnitOnversion', |
| | | getListByUnitCategoryId:'/base/unit/getListByUnitCategoryId' |
| | | }, |
| | | columns: [ |
| | | { |
| | | title: 'åä½ä»£ç ', |
| | | width: '10%', |
| | | align: 'center', |
| | | dataIndex: 'num', |
| | | }, |
| | | { |
| | | title: 'åä½åç§°', |
| | | width: '15%', |
| | | align: 'center', |
| | | dataIndex: 'name', |
| | | }, |
| | | { |
| | | title: 'åç±»åç§°', |
| | | width: '15%', |
| | | align: 'center', |
| | | dataIndex: 'categoryName', |
| | | }, |
| | | { |
| | | title: 'å建人', |
| | | width: '10%', |
| | | align: 'center', |
| | | dataIndex: 'createBy', |
| | | }, |
| | | { |
| | | title: 'å建æ¶é´', |
| | | width: '15%', |
| | | align: 'center', |
| | | dataIndex: 'createTime', |
| | | }, |
| | | { |
| | | title: 'æ´æ°äºº', |
| | | width: '10%', |
| | | align: 'center', |
| | | dataIndex: 'updateBy', |
| | | }, |
| | | { |
| | | title: 'æ´æ°æ¶é´', |
| | | width: '15%', |
| | | align: 'center', |
| | | dataIndex: 'updateTime', |
| | | }, |
| | | { |
| | | title: '夿³¨', |
| | | width: '10%', |
| | | align: 'center', |
| | | dataIndex: 'remark', |
| | | }, |
| | | ], |
| | | downColumns: [ |
| | | { |
| | | title: '#', |
| | | key: 'rowIndex', |
| | | dataIndex: '', |
| | | width: 40, |
| | | align: 'center', |
| | | customRender: (t, r, i) => parseInt(i) + 1 |
| | | }, |
| | | { |
| | | title: 'ç®æ åä½ä»£ç ', |
| | | width: '12%', |
| | | align: 'center', |
| | | dataIndex: 'targetUnitNum', |
| | | }, |
| | | { |
| | | title: 'ç®æ åä½åç§°', |
| | | width: '12%', |
| | | align: 'center', |
| | | dataIndex: 'targetUnitName', |
| | | }, |
| | | { |
| | | title: 'æ¢ç®æ¯ä¾', |
| | | width: '15%', |
| | | align: 'center', |
| | | dataIndex: 'conversionRatio', |
| | | }, |
| | | { |
| | | title: 'å建人', |
| | | width: '10%', |
| | | align: 'center', |
| | | dataIndex: 'createBy', |
| | | }, |
| | | { |
| | | title: 'å建æ¶é´', |
| | | width: '15%', |
| | | align: 'center', |
| | | dataIndex: 'createTime', |
| | | }, |
| | | { |
| | | title: 'æ´æ°äºº', |
| | | width: '10%', |
| | | align: 'center', |
| | | dataIndex: 'updateBy', |
| | | }, |
| | | { |
| | | title: 'æ´æ°æ¶é´', |
| | | width: '15%', |
| | | align: 'center', |
| | | dataIndex: 'updateTime', |
| | | }, |
| | | { |
| | | title: '夿³¨', |
| | | width: '10%', |
| | | align: 'center', |
| | | dataIndex: 'remark', |
| | | }, |
| | | ], |
| | | } |
| | | }, |
| | | computed: { |
| | | rowSelection() { |
| | | return { |
| | | onChange: (selectedRowKeys, selectedRows) => { |
| | | this.selectedRowKeys = selectedRowKeys |
| | | this.selectedRows = selectedRows |
| | | this.$emit('searchkeys', selectedRowKeys,selectedRows) |
| | | this.ids=selectedRowKeys.join(",") |
| | | this.getList() |
| | | }, |
| | | getCheckboxProps: (record) => ({ |
| | | props: { |
| | | disabled: record.name === 'Disabled User', // Column configuration not to be checked |
| | | name: record.name, |
| | | }, |
| | | }), |
| | | } |
| | | }, |
| | | rowDownSelection() { |
| | | return { |
| | | onChange: (selectedDownRowKeys, selectedDownRows) => { |
| | | this.selectedDownRowKeys = selectedDownRowKeys |
| | | this.selectedDownRows = selectedDownRows |
| | | }, |
| | | getCheckboxProps: (record) => ({ |
| | | props: { |
| | | disabled: record.name === 'Disabled User', // Column configuration not to be checked |
| | | name: record.name, |
| | | }, |
| | | }), |
| | | } |
| | | }, |
| | | }, |
| | | created() { |
| | | this.loadData({ unitCategoryId: ''}) |
| | | }, |
| | | methods: { |
| | | loadData({ unitCategoryId }) { |
| | | let momUnit = { |
| | | unitCategoryId, |
| | | } |
| | | |
| | | getAction(this.url.getListByUnitCategoryId, momUnit) |
| | | .then((res) => { |
| | | if (res.success) { |
| | | this.dataSource = res.result |
| | | |
| | | } |
| | | }) |
| | | .finally(() => { |
| | | this.loading = false |
| | | this.cardLoading = false |
| | | }) |
| | | |
| | | }, |
| | | //æ ¹æ®éä¸ç计éåä½idè°ç¨æ¥è¯¢å使¢ç®å表æ¥å£ |
| | | getList(){ |
| | | getAction('/base/unit/onversion/getListByUnitId', {ids:this.ids}) |
| | | .then((res) => { |
| | | if (res.success) { |
| | | this.downDataSource = res.result |
| | | } |
| | | }) |
| | | .finally(() => { |
| | | this.loading = false |
| | | this.cardLoading = false |
| | | }) |
| | | }, |
| | | //å¢å å使¢ç®æ¹æ³ |
| | | handleAdd(selectedRows){ |
| | | if (this.selectedRows.length <= 0) { |
| | | this.$message.warning('è¯·éæ©ä¸æ¡éè¦å¢å å使¢ç®ç计éåä½ï¼') |
| | | return |
| | | } else if (this.selectedRows.length > 1) { |
| | | this.$message.warning('注æï¼åªè½éæ©ä¸æ¡éè¦å¢å å使¢ç®ç计éåä½ï¼') |
| | | return |
| | | } else { |
| | | this.$refs.modalForm.add(selectedRows,{cb: this.getList}) |
| | | } |
| | | }, |
| | | //ä¿®æ¹æ°æ®ï¼ä¿®æ¹æé®è§¦åï¼ |
| | | handleEdit(selectedDownRows) { |
| | | if (this.selectedDownRows.length <= 0) { |
| | | this.$message.warning('è¯·éæ©ä¸æ¡éè¦ä¿®æ¹çå使¢ç®ä¿¡æ¯ï¼') |
| | | return |
| | | } else if (this.selectedDownRows.length > 1) { |
| | | this.$message.warning('注æï¼åªè½éæ©ä¸æ¡åä½åç®ä¿¡æ¯è¿è¡ä¿®æ¹ï¼') |
| | | return |
| | | } else { |
| | | this.$refs.modalForm.edit(selectedDownRows, { cb: this.getList }) |
| | | } |
| | | }, |
| | | //æ¹éå é¤å³ä¾§æ°æ®ï¼å 餿é®è§¦åï¼ |
| | | batchDel() { |
| | | if (!this.url.deleteBatch) { |
| | | this.$message.error('请设置url.deleteBatch屿§!') |
| | | return |
| | | } |
| | | if (this.selectedDownRowKeys.length <= 0) { |
| | | this.$message.warning('è¯·éæ©ä¸æ¡è®°å½ï¼') |
| | | return |
| | | } else { |
| | | var ids = '' |
| | | for (var a = 0; a < this.selectedDownRowKeys.length; a++) { |
| | | ids += this.selectedDownRowKeys[a] + ',' |
| | | } |
| | | var that = this |
| | | this.$confirm({ |
| | | title: '确认å é¤', |
| | | content: 'æ¯å¦å é¤é䏿°æ®?', |
| | | onOk: function () { |
| | | that.loading = true |
| | | deleteAction(that.url.deleteBatch, { ids: ids }) |
| | | .then((res) => { |
| | | if (res.success) { |
| | | that.$message.success(res.message) |
| | | } else { |
| | | that.$message.warning(res.message) |
| | | } |
| | | }) |
| | | .finally(() => { |
| | | that.loading = false |
| | | //éæ°è®¡ç®å页é®é¢ |
| | | that.reCalculatePage(that.selectedDownRowKeys.length) |
| | | that.onClearSelected() |
| | | this.getList() |
| | | that.loadTree() |
| | | }) |
| | | }, |
| | | }) |
| | | } |
| | | }, |
| | | //éæ°è®¡ç®å页 |
| | | reCalculatePage(count) { |
| | | //æ»æ°é-count |
| | | let total = this.ipagination.total - count |
| | | //è·åå é¤åçåé¡µæ° |
| | | let currentIndex = Math.ceil(total / this.ipagination.pageSize) |
| | | //å é¤åçå页æ°<æå¨å½å页 |
| | | if (currentIndex < this.ipagination.current) { |
| | | this.ipagination.current = currentIndex |
| | | } |
| | | console.log('currentIndex', currentIndex) |
| | | }, |
| | | //æ¸
é¤å使¢ç®éä¸é¡¹ |
| | | onClearSelected() { |
| | | this.selectedDownRowKeys = [] |
| | | this.selectedDownRows = [] |
| | | }, |
| | | |
| | | }, |
| | | } |
| | | </script> |
| | | <style> |
| | | .j-address-list-right-card-box .ant-table-placeholder { |
| | | min-height: 46px; |
| | | } |
| | | </style> |
| | | <style scoped> |
| | | .j-address-list-right-card-box { |
| | | height: 100%; |
| | | min-height: 300px; |
| | | } |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <j-modal |
| | | :title="title" |
| | | :width="width" |
| | | :visible="visible" |
| | | switchFullscreen |
| | | @ok="handleOk" |
| | | :okButtonProps="{ class:{'jee-hidden': disableSubmit} }" |
| | | @cancel="handleCancel" |
| | | :footer="null" |
| | | > |
| | | <mom-unit-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit" normal></mom-unit-form> |
| | | </j-modal> |
| | | </template> |
| | | |
| | | <script> |
| | | import MomUnitForm from './MomUnitForm' |
| | | export default { |
| | | name: "MomUnitModal", |
| | | components: { |
| | | MomUnitForm |
| | | }, |
| | | data () { |
| | | return { |
| | | title:'', |
| | | width:800, |
| | | visible: false, |
| | | disableSubmit: false |
| | | } |
| | | }, |
| | | methods: { |
| | | add (record,{cb}) { |
| | | this.title="æ°å»º" |
| | | this.visible=true |
| | | this.$nextTick(()=>{ |
| | | this.$refs.realForm.showAdd(record,{cb}); |
| | | }) |
| | | }, |
| | | edit (record,{cb}) { |
| | | this.title="ç¼è¾" |
| | | this.visible=true |
| | | this.$nextTick(()=>{ |
| | | this.$refs.realForm.show(record,{cb}); |
| | | }) |
| | | }, |
| | | close () { |
| | | this.$emit('close'); |
| | | this.visible = false; |
| | | }, |
| | | handleOk () { |
| | | this.$refs.realForm.submitForm(); |
| | | }, |
| | | submitCallback(){ |
| | | this.$emit('ok'); |
| | | this.visible = false; |
| | | }, |
| | | handleCancel () { |
| | | this.close() |
| | | }, |
| | | |
| | | } |
| | | } |
| | | </script> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <a-spin :spinning="confirmLoading"> |
| | | <j-form-container :disabled="formDisabled"> |
| | | <a-form-model ref="form" :model="model" slot="detail" :rules="validatorRules"> |
| | | <a-row type="flex" :gutter="16"> |
| | | <a-col :span="24"> |
| | | <a-form-model-item label="计éåä½åç±»ç¼ç " :labelCol="labelCol" :wrapperCol="wrapperCol" prop="code"> |
| | | <a-input v-model="model.code" placeholder="请è¾å
¥è®¡éåä½åç±»ç¼ç "></a-input> |
| | | </a-form-model-item> |
| | | </a-col> |
| | | |
| | | <a-col :span="24"> |
| | | <a-form-model-item label="计éåä½åç±»åç§°" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="name"> |
| | | <a-input style="width: 100%" :min="1" v-model="model.name" placeholder="请è¾å
¥è®¡éåä½åç±»åç§°"></a-input> |
| | | </a-form-model-item> |
| | | </a-col> |
| | | |
| | | <a-col :span="24"> |
| | | <a-form-model-item label="ä¸çº§åç±»" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="pName"> |
| | | <a-input style="width: 100%" :min="1" v-model="model.pname" :disabled="true"></a-input> |
| | | </a-form-model-item> |
| | | </a-col> |
| | | |
| | | <a-col :span="24"> |
| | | <a-form-model-item label="夿³¨" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="remark"> |
| | | <a-input style="width: 100%" :min="1" v-model="model.remark" placeholder="请è¾å
¥å¤æ³¨"></a-input> |
| | | </a-form-model-item> |
| | | </a-col> |
| | | </a-row> |
| | | <a-row type="flex" :gutter="16" justify="center"> |
| | | <a-col> |
| | | <a-button type="primary" @click="submitForm">ä¿å</a-button> |
| | | </a-col> |
| | | |
| | | <a-col> |
| | | <a-button type="primary" @click="submitFormAndAdd">ä¿åå¹¶æ°å¢</a-button> |
| | | </a-col> |
| | | |
| | | <a-col> |
| | | <a-button type="primary" @click="close">åæ¶</a-button> |
| | | </a-col> |
| | | </a-row> |
| | | </a-form-model> |
| | | </j-form-container> |
| | | </a-spin> |
| | | </template> |
| | | |
| | | <script> |
| | | import { httpAction, getAction } from '@/api/manage' |
| | | import { validateDuplicateValue } from '@/utils/util' |
| | | import JFormContainer from '@/components/jeecg/JFormContainer' |
| | | import JDate from '@/components/jeecg/JDate' |
| | | import JDictSelectTag from '@/components/dict/JDictSelectTag' |
| | | |
| | | export default { |
| | | name: 'MomBaseUnitCategoryForm', |
| | | components: { |
| | | JFormContainer, |
| | | JDate, |
| | | JDictSelectTag, |
| | | }, |
| | | props: { |
| | | formData: { |
| | | type: Object, |
| | | default: () => {}, |
| | | required: false, |
| | | }, |
| | | normal: { |
| | | type: Boolean, |
| | | default: false, |
| | | required: false, |
| | | }, |
| | | disabled: { |
| | | type: Boolean, |
| | | default: false, |
| | | required: false, |
| | | }, |
| | | }, |
| | | data() { |
| | | return { |
| | | model: { status: 1 }, |
| | | id: '', |
| | | labelCol: { |
| | | xs: { span: 24 }, |
| | | sm: { span: 5 }, |
| | | }, |
| | | wrapperCol: { |
| | | xs: { span: 24 }, |
| | | sm: { span: 16 }, |
| | | }, |
| | | confirmLoading: false, |
| | | url: { |
| | | add: '/base/add', |
| | | delete: '/base/delete', |
| | | }, |
| | | validatorRules: { |
| | | code: [{ required: true, message: '请è¾å
¥è®¡éåä½åç±»ç¼ç !' }, { trigger: 'blur' }], |
| | | name: [{ required: true, message: '请è¾å
¥è®¡éåä½åç±»åç§°!' }, { trigger: 'blur' }], |
| | | }, |
| | | cb: null, |
| | | } |
| | | }, |
| | | computed: { |
| | | formDisabled() { |
| | | if (this.normal === false) { |
| | | if (this.formData.disabled === false) { |
| | | return false |
| | | } else { |
| | | return true |
| | | } |
| | | } |
| | | return this.disabled |
| | | }, |
| | | disabledId() { |
| | | return this.id ? true : false |
| | | }, |
| | | showFlowSubmitButton() { |
| | | if (this.normal === false) { |
| | | if (this.formData.disabled === false) { |
| | | return true |
| | | } else { |
| | | return false |
| | | } |
| | | } else { |
| | | return false |
| | | } |
| | | }, |
| | | }, |
| | | created() { |
| | | this.showFlowData() |
| | | }, |
| | | methods: { |
| | | showAdd(record, { cb }) { |
| | | this.cb = cb |
| | | this.model = record ? Object.assign({}, record) : this.model |
| | | this.id = record ? record.id : '' |
| | | this.model.id = '' |
| | | this.model.code = '' |
| | | this.model.name = '' |
| | | this.model.remark = '' |
| | | this.model.createBy = '' |
| | | this.model.createTime = '' |
| | | this.model.updateBy = '' |
| | | this.model.updateTime = '' |
| | | this.model.pid = record.id |
| | | this.model.pname = record.codeName |
| | | this.visible = true |
| | | }, |
| | | show(record, { cb }) { |
| | | this.cb = cb |
| | | this.model = record ? Object.assign({}, record) : this.model |
| | | this.id = record ? record.id : '' |
| | | this.visible = true |
| | | }, |
| | | showFlowData() { |
| | | if (this.normal === false) { |
| | | let params = { id: this.formData.dataId } |
| | | getAction(this.url.queryById, params).then((res) => { |
| | | if (res.success) { |
| | | this.edit(res.result) |
| | | } |
| | | }) |
| | | } |
| | | }, |
| | | //ä¿åæé®è§¦å |
| | | submitForm() { |
| | | const that = this |
| | | // 触å表åéªè¯ |
| | | that.$refs.form.validate((valid) => { |
| | | if (valid) { |
| | | that.confirmLoading = true |
| | | let httpurl = this.url.add |
| | | let method = 'post' |
| | | httpAction(httpurl, this.model, method) |
| | | .then((res) => { |
| | | if (res.success) { |
| | | that.$message.success(res.message) |
| | | that.$emit('ok') |
| | | } else { |
| | | that.$message.warning(res.message) |
| | | } |
| | | }) |
| | | .finally(() => { |
| | | that.confirmLoading = false |
| | | this.cb(this.id) |
| | | this.cb = null |
| | | }) |
| | | } else { |
| | | return false |
| | | } |
| | | }) |
| | | }, |
| | | //ä¿åå¹¶æ°å¢æé®è§¦å |
| | | submitFormAndAdd() { |
| | | const that = this |
| | | // 触å表åéªè¯ |
| | | that.$refs.form.validate((valid) => { |
| | | if (valid) { |
| | | that.confirmLoading = true |
| | | let httpurl = this.url.add |
| | | let method = 'post' |
| | | httpAction(httpurl, this.model, method) |
| | | .then((res) => { |
| | | if (res.success) { |
| | | that.$message.success(res.message) |
| | | } else { |
| | | that.$message.warning(res.message) |
| | | } |
| | | }) |
| | | .finally(() => { |
| | | this.confirmLoading = false |
| | | this.model.id = '' |
| | | this.model.code = '' |
| | | this.model.name = '' |
| | | this.cb(this.id) |
| | | }) |
| | | } else { |
| | | return false |
| | | } |
| | | }) |
| | | }, |
| | | //åæ¶æé®è§¦å |
| | | close() { |
| | | this.$emit('ok') |
| | | this.visible = false |
| | | }, |
| | | }, |
| | | } |
| | | </script> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <a-card |
| | | :bordered="false" |
| | | style="height: 100%;" |
| | | > |
| | | <a-tree |
| | | showLine |
| | | checkStrictly |
| | | :replace-fields="replaceFields" |
| | | :dropdownStyle="{maxHeight:'200px',overflow:'auto'}" |
| | | :treeData="treeDataSource" |
| | | @select="handleTreeSelect" |
| | | > |
| | | <a-icon |
| | | slot="switcherIcon" |
| | | type="folder" |
| | | /></a-tree> |
| | | </a-card> |
| | | </template> |
| | | |
| | | <script> |
| | | import { getAction } from '@/api/manage' |
| | | |
| | | export default { |
| | | name: 'MomBaseUnitCategoryListLeft', |
| | | data() { |
| | | return { |
| | | treeDataSource: [], |
| | | replaceFields: { |
| | | title: 'codeName', |
| | | }, |
| | | url: { |
| | | getTree: '/base/getTree' |
| | | } |
| | | } |
| | | }, |
| | | created() { |
| | | this.queryTreeData() |
| | | }, |
| | | methods: { |
| | | |
| | | queryTreeData() { |
| | | getAction(this.url.getTree).then((res) => { |
| | | this.treeDataSource = res.result; |
| | | }) |
| | | }, |
| | | //左侧æ ç¹å»è§¦å |
| | | handleTreeSelect(selectedKeys, event) { |
| | | let da = event.node.dataRef; |
| | | this.$emit("treeSelect", da); |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <a-card class="j-address-list-right-card-box" :bordered="false"> |
| | | <a-table |
| | | ref="table" |
| | | size="middle" |
| | | :row-selection="rowSelection" |
| | | bordered |
| | | rowKey="id" |
| | | :columns="columns" |
| | | :dataSource="dataSource" |
| | | > |
| | | </a-table> |
| | | </a-card> |
| | | </template> |
| | | |
| | | <script> |
| | | import { getAction } from '@/api/manage' |
| | | |
| | | export default { |
| | | name: 'MomBaseUnitCategoryListRight', |
| | | components: {}, |
| | | props: ['value'], |
| | | data() { |
| | | return { |
| | | description: '计éåä½å类信æ¯', |
| | | positionInfo: {}, |
| | | dataSource: null, |
| | | url:{ |
| | | getList:'/base/getList' |
| | | }, |
| | | columns: [ |
| | | { |
| | | title: 'åç±»ç¼ç ', |
| | | width: '10%', |
| | | align: 'center', |
| | | dataIndex: 'code', |
| | | }, |
| | | { |
| | | title: 'åç±»åç§°', |
| | | width: '15%', |
| | | align: 'center', |
| | | dataIndex: 'name', |
| | | key: 'name', |
| | | }, |
| | | { |
| | | title: 'ä¸çº§åç±»', |
| | | width: '10%', |
| | | align: 'center', |
| | | dataIndex: 'codeName', |
| | | }, |
| | | { |
| | | title: 'å建人', |
| | | width: '10%', |
| | | align: 'center', |
| | | dataIndex: 'createBy', |
| | | }, |
| | | { |
| | | title: 'å建æ¶é´', |
| | | width: '15%', |
| | | align: 'center', |
| | | dataIndex: 'createTime', |
| | | }, |
| | | { |
| | | title: 'æ´æ°äºº', |
| | | width: '10%', |
| | | align: 'center', |
| | | dataIndex: 'updateBy', |
| | | }, |
| | | { |
| | | title: 'æ´æ°æ¶é´', |
| | | width: '15%', |
| | | align: 'center', |
| | | dataIndex: 'updateTime', |
| | | }, |
| | | { |
| | | title: '夿³¨', |
| | | width: '15%', |
| | | align: 'center', |
| | | dataIndex: 'remark', |
| | | }, |
| | | ], |
| | | } |
| | | }, |
| | | computed: { |
| | | rowSelection() { |
| | | return { |
| | | onChange: (selectedRowKeys, selectedRows) => { |
| | | this.selectedRowKeys = selectedRowKeys |
| | | this.selectedRows = selectedRows |
| | | this.$emit('searchkeys', selectedRowKeys,selectedRows) |
| | | this.ids=selectedRowKeys.join(",") |
| | | //this.getList() |
| | | }, |
| | | getCheckboxProps: (record) => ({ |
| | | props: { |
| | | disabled: record.name === 'Disabled User', // Column configuration not to be checked |
| | | name: record.name, |
| | | }, |
| | | }), |
| | | } |
| | | }, |
| | | }, |
| | | created() { |
| | | this.loadData({ id: '' }) |
| | | }, |
| | | methods: { |
| | | loadData({ id }) { |
| | | let momBaseUnitCategory = { |
| | | id, |
| | | } |
| | | getAction(this.url.getList, momBaseUnitCategory) |
| | | .then((res) => { |
| | | if (res.success) { |
| | | this.dataSource = res.result |
| | | } |
| | | }) |
| | | .finally(() => { |
| | | this.loading = false |
| | | this.cardLoading = false |
| | | }) |
| | | // update-end- --- author:wangshuai ------ date:20200102 ---- for:ä¼ è¿æ¥çé¨é¨ç¼ç 为空å
¨æ¥ |
| | | }, |
| | | |
| | | }, |
| | | } |
| | | </script> |
| | | <style> |
| | | .j-address-list-right-card-box .ant-table-placeholder { |
| | | min-height: 46px; |
| | | } |
| | | </style> |
| | | <style scoped> |
| | | .j-address-list-right-card-box { |
| | | height: 100%; |
| | | min-height: 300px; |
| | | } |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <j-modal |
| | | :title="title" |
| | | :width="width" |
| | | :visible="visible" |
| | | switchFullscreen |
| | | @ok="handleOk" |
| | | :okButtonProps="{ class:{'jee-hidden': disableSubmit} }" |
| | | @cancel="handleCancel" |
| | | :footer="null" |
| | | > |
| | | <mom-base-unit-category-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit" normal></mom-base-unit-category-form> |
| | | </j-modal> |
| | | </template> |
| | | |
| | | <script> |
| | | import MomBaseUnitCategoryForm from './MomBaseUnitCategoryForm' |
| | | export default { |
| | | name: "MomBaseUnitCategoryModal", |
| | | components: { |
| | | MomBaseUnitCategoryForm |
| | | }, |
| | | data () { |
| | | return { |
| | | title:'', |
| | | width:800, |
| | | visible: false, |
| | | disableSubmit: false |
| | | } |
| | | }, |
| | | methods: { |
| | | add (record,{cb}) { |
| | | this.title="æ°å»º" |
| | | this.visible=true |
| | | this.$nextTick(()=>{ |
| | | this.$refs.realForm.showAdd(record,{cb}); |
| | | }) |
| | | }, |
| | | edit (record,{cb}) { |
| | | this.title="ç¼è¾" |
| | | this.visible=true |
| | | this.$nextTick(()=>{ |
| | | this.$refs.realForm.show(record,{cb}); |
| | | }) |
| | | }, |
| | | close () { |
| | | this.$emit('close'); |
| | | this.visible = false; |
| | | }, |
| | | handleOk () { |
| | | this.$refs.realForm.submitForm(); |
| | | }, |
| | | submitCallback(){ |
| | | this.$emit('ok'); |
| | | this.visible = false; |
| | | }, |
| | | handleCancel () { |
| | | this.close() |
| | | }, |
| | | |
| | | } |
| | | } |
| | | </script> |