zhouhaibin
6 months ago
20 changed files with 2500 additions and 4 deletions
@ -0,0 +1,236 @@ |
|||
/** |
|||
* 参照页面混入 |
|||
*/ |
|||
import { Dialog } from '@/components/abc/Dialog' |
|||
import CollapseTab from '@/components/abc/CollapseTab/index.vue' |
|||
import QueryText from '@/components/abc/QueryText/index.vue' |
|||
import QueryButton from '@/components/abc/QueryButton/index.vue' |
|||
import { ContentWrap } from '@/components/abc/ContentWrap' |
|||
import ListPager from '@/components/abc/ListPager/index.vue' |
|||
import ColumnsController from '@/components/abc/ColumnsController/index.vue' |
|||
import DictionarySelect from '@/components/abc/DictionarySelect/DictionarySelect.vue' |
|||
import DictionaryRadioGroup from '@/components/abc/DictionarySelect/DictionaryRadioGroup.vue' |
|||
import OrganizationSingleSelect from '@/modules/system/view/organization/treeReference.vue' |
|||
import OrganizationMultipleSelect from '@/modules/system/view/organization/treeMultipleSelect.vue' |
|||
import UserSingleSelect from '@/modules/system/view/user/treeListReference.vue' |
|||
import IconPicker from '@/components/abc/IconPicker/index.vue' |
|||
|
|||
export const referenceMixin_copy = { |
|||
emits: ['update:modelValue', 'my-change'], |
|||
components: { |
|||
Dialog, |
|||
ContentWrap, |
|||
CollapseTab, |
|||
QueryText, |
|||
QueryButton, |
|||
ListPager, |
|||
ColumnsController, |
|||
DictionarySelect, |
|||
DictionaryRadioGroup, |
|||
OrganizationSingleSelect, |
|||
OrganizationMultipleSelect, |
|||
UserSingleSelect, |
|||
IconPicker |
|||
}, |
|||
props: { |
|||
modelValue: { |
|||
type: String, |
|||
default: '', |
|||
required: false |
|||
}, |
|||
disabled: { |
|||
type: Boolean, |
|||
required: false, |
|||
default: false |
|||
} |
|||
}, |
|||
data() { |
|||
return { |
|||
// 表格数据
|
|||
tableData: [], |
|||
// 加载中
|
|||
loading: false, |
|||
// 当前行
|
|||
currentId: this.$constant.NO_ITEM_SELECTED, |
|||
// 分页信息
|
|||
pageInfo: { |
|||
// 页码
|
|||
pageNum: this.$constant.DEFAULT_PAGE_NUM, |
|||
// 页码大小
|
|||
pageSize: this.$constant.DEFAULT_PAGE_SIZE |
|||
}, |
|||
// 排序信息
|
|||
sortInfo: { |
|||
sort_field: 'orderNo', |
|||
sort_sortType: 'ascending' |
|||
}, |
|||
// 总页数
|
|||
pageTotal: 0, |
|||
queryCondition: { |
|||
// 默认值处理
|
|||
}, |
|||
visible: false, |
|||
// 显示名称
|
|||
displayName: '' |
|||
} |
|||
}, |
|||
watch: { |
|||
modelValue: { |
|||
immediate: true, |
|||
handler: 'getSelectedName' |
|||
} |
|||
}, |
|||
computed: { |
|||
showCols() { |
|||
return this.columnList.filter((item) => item.show) |
|||
}, |
|||
tableKey() { |
|||
const { path } = this.$route |
|||
return `${path}/table` |
|||
} |
|||
}, |
|||
methods: { |
|||
// 初始化
|
|||
init(param) { |
|||
if (this.beforeInit != null) { |
|||
this.beforeInit(param) |
|||
} |
|||
this.loadData().then((res) => { |
|||
if (this.afterInit) { |
|||
this.afterInit(param) |
|||
} |
|||
this.visible = true |
|||
}) |
|||
}, |
|||
// 确认选择
|
|||
confirm() { |
|||
if (!this.checkSelectedRowExist()) { |
|||
return |
|||
} |
|||
const selectedRow = this.getRow(this.currentId) |
|||
|
|||
this.displayName = selectedRow.name |
|||
// 更新父组件绑定值
|
|||
this.$emit('update:modelValue', selectedRow.id) |
|||
this.$emit('my-change', selectedRow.id, selectedRow) |
|||
this.visible = false |
|||
if (this.afterConfirm!=null) { |
|||
this.afterConfirm(selectedRow) |
|||
} |
|||
}, |
|||
// 关闭
|
|||
close() { |
|||
this.visible = false |
|||
}, |
|||
// 清空选择
|
|||
clear() { |
|||
this.displayName = '' |
|||
this.$emit('update:modelValue', '') |
|||
this.$emit('my-change', '') |
|||
}, |
|||
// 获取选中的名称
|
|||
getSelectedName() { |
|||
if (this.modelValue) { |
|||
this.api.get(this.modelValue).then((res) => { |
|||
this.displayName = res.data[this.nameKey] |
|||
}) |
|||
} |
|||
}, |
|||
// 加载数据
|
|||
loadData() { |
|||
return new Promise((resolve) => { |
|||
this.loading = true |
|||
const params = Object.assign(this.queryCondition, this.pageInfo, this.sortInfo) |
|||
this.api |
|||
.page(params) |
|||
.then((res) => { |
|||
this.tableData = res.data.records |
|||
this.pageTotal = res.data.total |
|||
resolve() |
|||
}) |
|||
.finally(() => { |
|||
this.loading = false |
|||
this.currentId = this.$constant.NO_ITEM_SELECTED |
|||
}) |
|||
}) |
|||
}, |
|||
// 查看
|
|||
view(id) { |
|||
if (this.$refs.viewPage) { |
|||
this.$refs.viewPage.init(id) |
|||
} |
|||
}, |
|||
// 刷新
|
|||
refresh() { |
|||
this.loadData() |
|||
}, |
|||
// 处理排序
|
|||
// eslint-disable-next-line no-unused-vars
|
|||
sortChange({ column, prop, order }) { |
|||
this.sortInfo.sort_field = prop |
|||
this.sortInfo.sort_sortType = order |
|||
this.refresh() |
|||
}, |
|||
// 当前行变化
|
|||
rowChange(currentRow) { |
|||
this.currentId = currentRow ? currentRow.id : this.$constant.NO_ITEM_SELECTED |
|||
}, |
|||
// 获取行记录
|
|||
getRow(id) { |
|||
if (id && id !== this.$constant.NO_ITEM_SELECTED) { |
|||
if (this.tableData && this.tableData.length > 0) { |
|||
for (let i = 0; i < this.tableData.length; i++) { |
|||
if (this.tableData[i].id === id) { |
|||
return this.tableData[i] |
|||
} |
|||
} |
|||
} |
|||
} |
|||
return undefined |
|||
}, |
|||
// 获取名称
|
|||
getName(id) { |
|||
const row = this.getRow(id) |
|||
if (row) { |
|||
return row[this.nameKey] |
|||
} |
|||
return undefined |
|||
}, |
|||
// 验证是否有选中行
|
|||
checkSelectedRowExist() { |
|||
if (this.currentId === this.$constant.NO_ITEM_SELECTED) { |
|||
this.$message.info('当前无选中行') |
|||
return false |
|||
} |
|||
return true |
|||
}, |
|||
// 双击事件
|
|||
rowDoubleClick(row) { |
|||
this.view(row.id) |
|||
}, |
|||
// 处理查询
|
|||
query() { |
|||
// 查询之前,将当前页置为1
|
|||
this.pageInfo.pageNum = 1 |
|||
this.refresh() |
|||
}, |
|||
// 处理分页变化
|
|||
pageChange(value) { |
|||
this.pageInfo.pageNum = value |
|||
this.refresh() |
|||
}, |
|||
// 处理分页大小变化
|
|||
pageSizeChange(value) { |
|||
this.pageInfo.pageSize = value |
|||
this.refresh() |
|||
} |
|||
}, |
|||
provide() { |
|||
return { |
|||
query: this.query, |
|||
view: this.view, |
|||
pageChange: this.pageChange, |
|||
pageSizeChange: this.pageSizeChange |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,90 @@ |
|||
import { COMMON_METHOD } from '@/constant/common' |
|||
import request from '@/config/axios' |
|||
|
|||
const moduleName = 'costMode' |
|||
|
|||
// 系统参数
|
|||
// export const param = Object.assign({}, COMMON_METHOD, {
|
|||
// serveUrl: '/' + moduleName + '/' + 'param' + '/'
|
|||
// })
|
|||
|
|||
// 供应商管理
|
|||
// export const supplierInformation = {
|
|||
// serveUrl: '/' + moduleName + '/' + 'supplierInformation' + '/',
|
|||
|
|||
// page(params) {
|
|||
// return request.get({ url: this.serveUrl + 'page', params })
|
|||
// },
|
|||
// get(id) {
|
|||
// return request.get({ url: this.serveUrl + id })
|
|||
// }
|
|||
// }
|
|||
|
|||
|
|||
|
|||
// 个人产品
|
|||
export const personProducts = Object.assign({}, COMMON_METHOD, { |
|||
serveUrl: '/' + moduleName + '/' + 'personProducts' + '/', |
|||
|
|||
}) |
|||
|
|||
// 字典类型
|
|||
export const dictionaryType = Object.assign({}, COMMON_METHOD, { |
|||
serveUrl: '/' + moduleName + '/' + 'dictionaryType' + '/', |
|||
tree() { |
|||
return request.get({ url: this.serveUrl + 'tree' }) |
|||
}, |
|||
|
|||
// 通过编码获取数据
|
|||
getByCode(param) { |
|||
return request.get({ url: this.serveUrl + 'getByCode/' + param }) |
|||
}, |
|||
// 批量保存
|
|||
saveItem(id, itemList) { |
|||
return request.post({ url: this.serveUrl + id + '/item', data: itemList }) |
|||
}, |
|||
// 通过编码获取字典项,转换为列表项数据结构,用于公用选择控件
|
|||
getItem(code) { |
|||
return request.get({ url: this.serveUrl + 'getItem?code=' + code }) |
|||
} |
|||
}) |
|||
|
|||
// 字典项
|
|||
export const dictionaryItem = Object.assign({}, COMMON_METHOD, { |
|||
serveUrl: '/' + moduleName + '/' + 'dictionaryItem' + '/', |
|||
enable(id) { |
|||
return request.put({ url: this.serveUrl + id + '/enable' }) |
|||
}, |
|||
disable(id) { |
|||
return request.put({ url: this.serveUrl + id + '/disable' }) |
|||
} |
|||
}) |
|||
// 用户设置
|
|||
export const userProfile = Object.assign({}, COMMON_METHOD, { |
|||
serveUrl: '/' + moduleName + '/' + 'userProfile' + '/', |
|||
get() { |
|||
return request.get({ url: this.serveUrl }) |
|||
} |
|||
}) |
|||
|
|||
// 系统管理
|
|||
export const systemManage = Object.assign( |
|||
{}, |
|||
{ |
|||
serveUrl: '/' + moduleName + '/' + 'systemManage' + '/', |
|||
// 重建系统缓存
|
|||
rebuildSystemCache() { |
|||
return request.put({ url: this.serveUrl + 'rebuildSystemCache' }) |
|||
}, |
|||
// 获取唯一性标识
|
|||
getUniqueId() { |
|||
// 获取唯一性标识
|
|||
return request.get({ url: this.serveUrl + 'getUniqueId' }) |
|||
} |
|||
} |
|||
) |
|||
|
|||
// 模块
|
|||
export const module = Object.assign({}, COMMON_METHOD, { |
|||
serveUrl: '/' + moduleName + '/' + 'module' + '/' |
|||
}) |
@ -0,0 +1,132 @@ |
|||
<template> |
|||
<div class="w-full"> |
|||
<el-input v-model="displayName" disabled style="width: 152px" /> |
|||
<el-button-group> |
|||
<el-button icon="grid" @click="init" style="border-left-width: 0; padding: 10px" /> |
|||
<el-button icon="delete" @click="clear" style="border-left-width: 0; padding: 10px" /> |
|||
</el-button-group> |
|||
<Dialog title="模块选择" v-model="visible" class="w-150"> |
|||
<CollapseTab> |
|||
<el-form :inline="true" :model="queryCondition" label-width="80px" @keyup.enter="query"> |
|||
<!--查询条件区 --> |
|||
<el-form-item label="应用"> |
|||
<dictionary-select v-model="queryCondition.app" code="AppCode" /> |
|||
</el-form-item> |
|||
<el-form-item label="名称"> |
|||
<QueryText v-model="queryCondition.name" type="LK" /> |
|||
</el-form-item> |
|||
<el-form-item label="编码"> |
|||
<QueryText v-model="queryCondition.code" type="LK" /> |
|||
</el-form-item> |
|||
<el-form-item style="float: right"> |
|||
<QueryButton :page-code="pageCode" /> |
|||
</el-form-item> |
|||
<div class="clearfix"></div> |
|||
</el-form> |
|||
</CollapseTab> |
|||
<el-card style="width: 100%"> |
|||
<div style="float: right; margin-top: 0; margin-bottom: 10px"> |
|||
<ColumnsController :value="columnList" :tableKey="tableKey" /> |
|||
</div> |
|||
<el-table |
|||
v-loading="loading" |
|||
:data="tableData" |
|||
style="width: 100%" |
|||
highlight-current-row |
|||
border |
|||
@sort-change="sortChange" |
|||
@current-change="rowChange" |
|||
> |
|||
<el-table-column |
|||
v-for="(item, index) in showCols" |
|||
:key="index" |
|||
:label="item.label" |
|||
:prop="item.prop" |
|||
:show-overflow-tooltip="item.showOverflowTooltip" |
|||
:width="item.width" |
|||
:formatter="item.formatFunc" |
|||
:sortable="item.sortable" |
|||
/> |
|||
</el-table> |
|||
<ListPager |
|||
:page-num="pageInfo.pageNum" |
|||
:page-size="pageInfo.pageSize" |
|||
:page-total="pageTotal" |
|||
/> |
|||
</el-card> |
|||
<template #footer> |
|||
<el-button type="primary" @click="confirm">确定</el-button> |
|||
<el-button @click="close">关闭</el-button> |
|||
</template> |
|||
</Dialog> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import { referenceMixin } from '@/mixin/referenceMixin.js' |
|||
const MODULE_CODE = 'productManagement' |
|||
const ENTITY_TYPE = 'supplierInformation' |
|||
export default { |
|||
name: ENTITY_TYPE + '-reference', |
|||
components: {}, |
|||
mixins: [referenceMixin], |
|||
props: { |
|||
moduleParam: { |
|||
type: Object, |
|||
required: false |
|||
} |
|||
}, |
|||
data() { |
|||
return { |
|||
entityType: ENTITY_TYPE, |
|||
moduleCode: MODULE_CODE, |
|||
// eslint-disable-next-line no-eval |
|||
api: eval('this.$api.' + MODULE_CODE + '.' + ENTITY_TYPE), |
|||
pageCode: MODULE_CODE + ':' + ENTITY_TYPE + ':', |
|||
sortInfo: { |
|||
sort_field: 'id', |
|||
sort_sortType: 'descending' |
|||
}, |
|||
columnList: [ |
|||
{ |
|||
prop: 'supplierName', |
|||
label: '供应商名称', |
|||
show: true, |
|||
showOverflowTooltip: true, |
|||
sortable: true |
|||
}, |
|||
{ |
|||
prop: 'supplierContacts', |
|||
label: '供应商联系人', |
|||
show: true, |
|||
showOverflowTooltip: true, |
|||
sortable: true |
|||
}, |
|||
{ |
|||
prop: 'supplierContactsPhone', |
|||
label: '供应商联系电话', |
|||
show: true, |
|||
showOverflowTooltip: true, |
|||
sortable: true |
|||
}, |
|||
{ |
|||
prop: 'supplierType', |
|||
label: '供应商类型', |
|||
show: true, |
|||
showOverflowTooltip: true, |
|||
sortable: true |
|||
} |
|||
], |
|||
queryCondition: { |
|||
//默认值处理 |
|||
app: '' |
|||
}, |
|||
// 名称键值 |
|||
nameKey: 'supplierName' |
|||
} |
|||
}, |
|||
methods: {} |
|||
} |
|||
</script> |
|||
|
|||
<style></style> |
@ -0,0 +1,126 @@ |
|||
import { COMMON_METHOD } from '@/constant/common' |
|||
import request from '@/config/axios' |
|||
|
|||
const moduleName = 'productManagement' |
|||
|
|||
// 系统参数
|
|||
// export const param = Object.assign({}, COMMON_METHOD, {
|
|||
// serveUrl: '/' + moduleName + '/' + 'param' + '/'
|
|||
// })
|
|||
|
|||
// 供应商管理
|
|||
// export const supplierInformation = {
|
|||
// serveUrl: '/' + moduleName + '/' + 'supplierInformation' + '/',
|
|||
|
|||
// page(params) {
|
|||
// return request.get({ url: this.serveUrl + 'page', params })
|
|||
// },
|
|||
// get(id) {
|
|||
// return request.get({ url: this.serveUrl + id })
|
|||
// }
|
|||
// }
|
|||
|
|||
// 供应商管理
|
|||
export const supplierInformation = Object.assign({}, COMMON_METHOD, { |
|||
serveUrl: '/' + moduleName + '/' + 'supplierInformation' + '/' |
|||
}) |
|||
|
|||
// 厂商产品管理
|
|||
export const supplierProducts = Object.assign({}, COMMON_METHOD, { |
|||
serveUrl: '/' + moduleName + '/' + 'supplierProducts' + '/' |
|||
}) |
|||
|
|||
// 公司产品
|
|||
export const companyProducts = Object.assign({}, COMMON_METHOD, { |
|||
serveUrl: '/' + moduleName + '/' + 'companyProducts' + '/' |
|||
}) |
|||
// 个人产品
|
|||
export const personProducts = Object.assign({}, COMMON_METHOD, { |
|||
serveUrl: '/' + moduleName + '/' + 'personProducts' + '/' |
|||
}) |
|||
// 供应商产品型号
|
|||
export const supplierProductModel = Object.assign({}, COMMON_METHOD, { |
|||
serveUrl: '/' + moduleName + '/' + 'supplierProductModel' + '/', |
|||
addModel(params) { |
|||
return request.post({ url: this.serveUrl + 'addModel', data: params }) |
|||
}, |
|||
modifyModel(params) { |
|||
return request.put({ url: this.serveUrl + 'modifyModel', data: params }) |
|||
}, |
|||
getModelDetails(modelId) { |
|||
return request.get({ url: this.serveUrl + 'getModelDetails/' + modelId }) |
|||
} |
|||
}) |
|||
// 公司产品型号
|
|||
export const companyProductModel = Object.assign({}, COMMON_METHOD, { |
|||
serveUrl: '/' + moduleName + '/' + 'companyProductModel' + '/', |
|||
addModel(params) { |
|||
return request.post({ url: this.serveUrl + 'addModel', data: params }) |
|||
}, |
|||
modifyModel(params) { |
|||
return request.put({ url: this.serveUrl + 'modifyModel', data: params }) |
|||
}, |
|||
getModelDetails(modelId) { |
|||
return request.get({ url: this.serveUrl + 'getModelDetails/' + modelId }) |
|||
} |
|||
}) |
|||
// 个人产品型号
|
|||
export const personProductModel = Object.assign({}, COMMON_METHOD, { |
|||
serveUrl: '/' + moduleName + '/' + 'personProductModel' + '/', |
|||
addModel(params) { |
|||
return request.post({ url: this.serveUrl + 'addModel', data: params }) |
|||
}, |
|||
modifyModel(params) { |
|||
return request.put({ url: this.serveUrl + 'modifyModel', data: params }) |
|||
}, |
|||
getModelDetails(modelId) { |
|||
return request.get({ url: this.serveUrl + 'getModelDetails/' + modelId }) |
|||
} |
|||
}) |
|||
// 产品型号管理
|
|||
export const productModelTemplate = Object.assign({}, COMMON_METHOD, { |
|||
serveUrl: '/' + moduleName + '/' + 'productModelTemplate' + '/' |
|||
}) |
|||
// 产品型号规格管理
|
|||
export const productModelTemplateDetails = Object.assign({}, COMMON_METHOD, { |
|||
serveUrl: '/' + moduleName + '/' + 'productModelTemplateDetails' + '/', |
|||
|
|||
addList(params) { |
|||
return request.post({ url: this.serveUrl + 'addList', data: params }) |
|||
}, |
|||
modifyList(params) { |
|||
return request.put({ url: this.serveUrl + 'modifyList', data: params }) |
|||
} |
|||
|
|||
}) |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
// 用户设置
|
|||
export const userProfile = Object.assign({}, COMMON_METHOD, { |
|||
serveUrl: '/' + moduleName + '/' + 'userProfile' + '/' |
|||
}) |
|||
|
|||
// 系统管理
|
|||
export const systemManage = Object.assign( |
|||
{}, |
|||
{ |
|||
serveUrl: '/' + moduleName + '/' + 'systemManage' + '/', |
|||
// 重建系统缓存
|
|||
rebuildSystemCache() { |
|||
return request.put({ url: this.serveUrl + 'rebuildSystemCache' }) |
|||
}, |
|||
// 获取唯一性标识
|
|||
getUniqueId() { |
|||
// 获取唯一性标识
|
|||
return request.get({ url: this.serveUrl + 'getUniqueId' }) |
|||
} |
|||
} |
|||
) |
|||
|
|||
// 模块
|
|||
export const module = Object.assign({}, COMMON_METHOD, { |
|||
serveUrl: '/' + moduleName + '/' + 'module' + '/' |
|||
}) |
@ -0,0 +1,251 @@ |
|||
<template> |
|||
<div class="w-full"> |
|||
<el-input type="textarea" v-model="displayName" disabled style="width: 100%" /> |
|||
<el-button-group v-if="moduleParam.pageType != 'view'"> |
|||
<el-button icon="grid" @click="init" style="border-left-width: 0; padding: 10px" /> |
|||
<!-- <el-button icon="delete" @click="clear" style="border-left-width: 0; padding: 10px" /> --> |
|||
</el-button-group> |
|||
<Dialog title="模块选择" v-model="visible" class="w-150"> |
|||
<el-form label-width="auto" :model="formData"> |
|||
<el-form-item label="型号模板"> |
|||
<product-model-select-components |
|||
v-model="formData.productModelTemplateId" |
|||
@updateTableData="updateTableData" |
|||
:module-param="moduleParam" |
|||
/> |
|||
<!-- <el-input v-model="formData.productModelTemplateId" style="width: 100%" /> --> |
|||
</el-form-item> |
|||
<el-form-item label="产品描述"> |
|||
<el-input type="textarea" disabled v-model="formData.description" style="width: 100%" /> |
|||
</el-form-item> |
|||
<el-form-item label="产品规格" style="margin-top: 20px"> |
|||
<avue-crud |
|||
ref="crud" |
|||
:option="option" |
|||
:data="tableData" |
|||
@row-update="addUpdate" |
|||
@row-save="rowSave" |
|||
@row-del="rowDelete" |
|||
/> |
|||
</el-form-item> |
|||
</el-form> |
|||
<template #footer> |
|||
<el-button type="primary" @click="confirm">确定</el-button> |
|||
<el-button @click="close">关闭</el-button> |
|||
</template> |
|||
</Dialog> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
// import { referenceMixin } from '@/mixin/referenceMixin.js' |
|||
import { Dialog } from '@/components/abc/Dialog' |
|||
import { isEmpty } from '@/utils/is' |
|||
import productModelSelectComponents from '@/modules/productManagement/components/productModelSelectComponents.vue' |
|||
const MODULE_CODE = 'productManagement' |
|||
// const ENTITY_TYPE = 'supplierProductModel' |
|||
export default { |
|||
emits: ['update:modelValue', 'my-change'], |
|||
name: 'productModelComponents-reference', |
|||
components: { Dialog, productModelSelectComponents }, |
|||
// mixins: [referenceMixin], |
|||
props: { |
|||
moduleParam: { |
|||
type: Object, |
|||
required: false |
|||
}, |
|||
modelValue: { |
|||
type: String, |
|||
default: '', |
|||
required: false |
|||
} |
|||
}, |
|||
data() { |
|||
return { |
|||
entityType: this.moduleParam.entityType, |
|||
moduleCode: MODULE_CODE, |
|||
// eslint-disable-next-line no-eval |
|||
productModelApi: this.$api[MODULE_CODE][this.moduleParam.entityType], //eval('this.$api.' + MODULE_CODE + '.' + ENTITY_TYPE), |
|||
modelDetailsApi: eval('this.$api.' + MODULE_CODE + '.' + 'productModelTemplateDetails'), |
|||
pageCode: MODULE_CODE + ':' + this.moduleParam.entityType + ':', |
|||
sortInfo: { |
|||
sort_field: 'id', |
|||
sort_sortType: 'descending' |
|||
}, |
|||
displayName: '', |
|||
visible: false, |
|||
loading: false, |
|||
tableData: [], |
|||
option: { |
|||
addBtn: false, |
|||
addRowBtn: true, |
|||
cellBtn: true, |
|||
refreshBtn: false, |
|||
columnBtn: false, |
|||
gridBtn: false, |
|||
// saveBtn: false, |
|||
menuWidth: 100, |
|||
column: [ |
|||
{ |
|||
label: '指标名称', |
|||
prop: 'paramName', |
|||
labelWidth: '120px', |
|||
sortable: true, |
|||
cell: true, |
|||
rules: [ |
|||
{ |
|||
required: true, |
|||
message: '请输入参数名称', |
|||
trigger: 'blur' |
|||
} |
|||
] |
|||
}, |
|||
{ |
|||
label: '指标参数', |
|||
labelWidth: '120px', |
|||
prop: 'parameterValue', |
|||
cell: true, |
|||
rules: [ |
|||
{ |
|||
required: true, |
|||
message: '请输入参数指标', |
|||
trigger: 'blur' |
|||
} |
|||
] |
|||
}, |
|||
{ |
|||
label: '是否关键指标', |
|||
labelWidth: '120px', |
|||
prop: 'isKeyParameter', |
|||
type: 'radio', |
|||
button: true, |
|||
dicData: [ |
|||
{ |
|||
label: '是', |
|||
value: '1' |
|||
}, |
|||
{ |
|||
label: '否', |
|||
value: '0' |
|||
} |
|||
], |
|||
value: '1', |
|||
required: true, |
|||
cell: true |
|||
} |
|||
] |
|||
}, |
|||
queryCondition: { |
|||
//默认值处理 |
|||
app: '' |
|||
}, |
|||
// 名称键值 |
|||
nameKey: 'supplierName', |
|||
formData: { |
|||
description: '' |
|||
// tableData:[] |
|||
} |
|||
} |
|||
}, |
|||
watch: { |
|||
tableData: { |
|||
handler(newName, oldName) { |
|||
this.formData.description = '' |
|||
for (let i = 0; i < this.tableData.length; i++) { |
|||
let rowData = this.tableData[i] |
|||
if (!isEmpty(rowData.paramName)) { |
|||
this.formData.description = |
|||
// this.formData.description + rowData.paramName + ':' + rowData.parameterIndex + ';\n' |
|||
this.formData.description + rowData.paramName + ':' + rowData.parameterValue + ';' |
|||
} |
|||
} |
|||
}, |
|||
immediate: true, |
|||
deep: true |
|||
}, |
|||
modelValue: { |
|||
immediate: true, |
|||
handler: 'getSelectedName' |
|||
} |
|||
}, |
|||
methods: { |
|||
// 初始化 |
|||
init() { |
|||
if (!this.modelValue) { |
|||
this.productModelApi.init().then((res) => { |
|||
this.formData['id'] = res.data.id //厂商产品参数id |
|||
console.log('厂商产品型号初始化', this.formData, res.data) |
|||
}) |
|||
} |
|||
this.visible = true |
|||
}, |
|||
// 清空选择 |
|||
clear() { |
|||
this.displayName = '' |
|||
this.$emit('update:modelValue', '') |
|||
this.$emit('my-change', '') |
|||
}, |
|||
// 关闭 |
|||
close() { |
|||
this.visible = false |
|||
}, |
|||
// 确认选择 |
|||
async confirm() { |
|||
this.displayName = this.formData.description |
|||
// 更新父组件绑定值 |
|||
//上传 |
|||
this.formData.modelDeatils = this.tableData |
|||
this.loading = true |
|||
//modelValue存在说明已有数据,是修改操作,否则是新增操作 |
|||
if (!this.modelValue) { |
|||
await this.productModelApi.addModel(this.formData) |
|||
} else { |
|||
await this.productModelApi.modifyModel(this.formData) |
|||
} |
|||
this.$emit('update:modelValue', this.formData['id']) |
|||
this.$emit('my-change', '') |
|||
this.loading = false |
|||
this.visible = false |
|||
}, |
|||
getSelectedName() { |
|||
if (this.modelValue) { |
|||
this.productModelApi.get(this.modelValue).then((res) => { |
|||
this.displayName = res.data['description'] |
|||
this.formData['id'] = this.modelValue |
|||
this.formData['productModelTemplateId'] = res.data['productModelTemplateId'] |
|||
}) |
|||
//获取产品型号详情 |
|||
this.productModelApi.getModelDetails(this.modelValue).then((res) => { |
|||
this.tableData = res.data |
|||
}) |
|||
} |
|||
}, |
|||
addUpdate(form, index, done, loading) { |
|||
done() |
|||
}, |
|||
rowSave(form, done) { |
|||
done() |
|||
}, |
|||
rowDelete(form, index, done) { |
|||
done() |
|||
}, |
|||
updateTableData() { |
|||
console.log('updateTableData', this.tableData) |
|||
this.tableData = [] |
|||
this.modelDetailsApi |
|||
.list({ modelTemplateId: this.formData.productModelTemplateId }) |
|||
.then((res) => { |
|||
res.data.forEach((item) => { |
|||
this.tableData.push({ |
|||
paramName: item.paramName, |
|||
isKeyParameter: item.isKeyParameter, |
|||
$cellEdit: true |
|||
}) |
|||
}) |
|||
}) |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style></style> |
@ -0,0 +1,141 @@ |
|||
<template> |
|||
<div class="w-full"> |
|||
<el-input v-model="displayName" disabled style="width: 152px" /> |
|||
<el-button-group> |
|||
<el-button icon="grid" @click="init" style="border-left-width: 0; padding: 10px" /> |
|||
<!-- <el-button icon="delete" @click="clear" style="border-left-width: 0; padding: 10px" /> --> |
|||
</el-button-group> |
|||
<Dialog title="模块选择" v-model="visible" class="w-150"> |
|||
<CollapseTab> |
|||
<el-form :inline="true" :model="queryCondition" label-width="80px" @keyup.enter="query"> |
|||
<!--查询条件区 --> |
|||
<el-form-item label="型号名称"> |
|||
<dictionary-select v-model="queryCondition.templateName" code="AppCode" /> |
|||
</el-form-item> |
|||
<el-form-item label="型号规格"> |
|||
<QueryText v-model="queryCondition.templateDetailsDescription" type="LK" /> |
|||
</el-form-item> |
|||
<el-form-item label="类型"> |
|||
<QueryText v-model="queryCondition.templateType" type="LK" /> |
|||
</el-form-item> |
|||
<el-form-item style="float: right"> |
|||
<QueryButton :page-code="pageCode" /> |
|||
</el-form-item> |
|||
<div class="clearfix"></div> |
|||
</el-form> |
|||
</CollapseTab> |
|||
<el-card style="width: 100%"> |
|||
<div style="float: right; margin-top: 0; margin-bottom: 10px"> |
|||
<ColumnsController :value="columnList" :tableKey="tableKey" /> |
|||
</div> |
|||
<el-table |
|||
v-loading="loading" |
|||
:data="tableData" |
|||
style="width: 100%" |
|||
highlight-current-row |
|||
border |
|||
@sort-change="sortChange" |
|||
@current-change="rowChange" |
|||
> |
|||
<el-table-column |
|||
v-for="(item, index) in showCols" |
|||
:key="index" |
|||
:label="item.label" |
|||
:prop="item.prop" |
|||
:show-overflow-tooltip="item.showOverflowTooltip" |
|||
:width="item.width" |
|||
:formatter="item.formatFunc" |
|||
:sortable="item.sortable" |
|||
/> |
|||
</el-table> |
|||
<ListPager |
|||
:page-num="pageInfo.pageNum" |
|||
:page-size="pageInfo.pageSize" |
|||
:page-total="pageTotal" |
|||
/> |
|||
</el-card> |
|||
<template #footer> |
|||
<el-button type="primary" @click="confirm">确定</el-button> |
|||
<el-button @click="close">关闭</el-button> |
|||
</template> |
|||
</Dialog> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import { referenceMixin_copy } from '@/mixin/referenceMixin_copy.js' |
|||
|
|||
const MODULE_CODE = 'productManagement' |
|||
const ENTITY_TYPE = 'productModelTemplate' |
|||
export default { |
|||
name: ENTITY_TYPE + '-reference', |
|||
components: {}, |
|||
mixins: [referenceMixin_copy], |
|||
props: { |
|||
moduleParam: { |
|||
type: Object, |
|||
required: false |
|||
}, |
|||
modelSelectData: { |
|||
type: Object, |
|||
required: false |
|||
} |
|||
}, |
|||
data() { |
|||
return { |
|||
entityType: ENTITY_TYPE, |
|||
moduleCode: MODULE_CODE, |
|||
// eslint-disable-next-line no-eval |
|||
api: eval('this.$api.' + MODULE_CODE + '.' + ENTITY_TYPE), |
|||
pageCode: MODULE_CODE + ':' + ENTITY_TYPE + ':', |
|||
sortInfo: { |
|||
sort_field: 'id', |
|||
sort_sortType: 'descending' |
|||
}, |
|||
columnList: [ |
|||
{ |
|||
prop: 'templateName', |
|||
label: '型号名称', |
|||
show: true, |
|||
showOverflowTooltip: true, |
|||
sortable: true |
|||
}, |
|||
{ |
|||
label: '型号规格', |
|||
prop: 'templateDetailsDescription', |
|||
show: true, |
|||
showOverflowTooltip: true, |
|||
sortable: true |
|||
}, |
|||
{ |
|||
label: '类型', |
|||
prop: 'templateType', |
|||
show: true, |
|||
showOverflowTooltip: true, |
|||
sortable: true |
|||
}, |
|||
{ |
|||
label: '备注', |
|||
prop: 'remarks', |
|||
show: true, |
|||
showOverflowTooltip: true, |
|||
sortable: true |
|||
} |
|||
], |
|||
queryCondition: { |
|||
//默认值处理 |
|||
app: '' |
|||
}, |
|||
// 名称键值 |
|||
nameKey: 'templateName' |
|||
} |
|||
}, |
|||
methods: { |
|||
afterConfirm(param){ |
|||
this.$emit('updateTableData') |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style></style> |
@ -0,0 +1,220 @@ |
|||
<template> |
|||
<div class="w-full"> |
|||
<el-input type="textarea" v-model="displayName" disabled style="width: 100%" /> |
|||
<el-button-group v-if="moduleParam.pageType != 'view'"> |
|||
<el-button icon="grid" @click="init" style="border-left-width: 0; padding: 10px" /> |
|||
</el-button-group> |
|||
<Dialog title="模块选择" v-model="visible" class="w-150"> |
|||
<el-form label-width="auto" :model="formData"> |
|||
<el-form-item label="产品规格" style="margin-top: 20px"> |
|||
<avue-crud |
|||
ref="crud" |
|||
:option="option" |
|||
:data="tableData" |
|||
@row-update="addUpdate" |
|||
@row-save="rowSave" |
|||
@row-del="rowDelete" |
|||
/> |
|||
</el-form-item> |
|||
</el-form> |
|||
<template #footer> |
|||
<el-button type="primary" @click="confirm">确定</el-button> |
|||
<el-button @click="close">关闭</el-button> |
|||
</template> |
|||
</Dialog> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
// import { referenceMixin } from '@/mixin/referenceMixin.js' |
|||
import { Dialog } from '@/components/abc/Dialog' |
|||
import { isEmpty } from '@/utils/is' |
|||
|
|||
const MODULE_CODE = 'productManagement' |
|||
const ENTITY_TYPE = 'productModelTemplateDetails' |
|||
export default { |
|||
name: ENTITY_TYPE + '-reference', |
|||
components: { Dialog }, |
|||
emits: ['update:modelValue', 'my-change'], |
|||
// mixins: [referenceMixin], |
|||
props: { |
|||
// tableData: { |
|||
// handler(newName, oldName) { |
|||
// // this. = '' |
|||
// for (let i = 0; i < this.tableData.length; i++) { |
|||
// let rowData = this.tableData[i] |
|||
// if (!isEmpty(rowData.paramName)) { |
|||
// this.formData.description = |
|||
// // this.formData.description + rowData.paramName + ':' + rowData.parameterIndex + ';\n' |
|||
// this.formData.description + rowData.paramName +';' |
|||
// } |
|||
// } |
|||
// }, |
|||
// immediate: true, |
|||
// deep: true |
|||
// }, |
|||
moduleParam: { |
|||
type: Object, |
|||
required: false |
|||
}, |
|||
modelValue: { |
|||
type: String, |
|||
default: '', |
|||
required: false |
|||
} |
|||
}, |
|||
data() { |
|||
return { |
|||
entityType: ENTITY_TYPE, |
|||
moduleCode: MODULE_CODE, |
|||
// eslint-disable-next-line no-eval |
|||
ModelTemplateDetailsApi: eval('this.$api.' + MODULE_CODE + '.' + ENTITY_TYPE), |
|||
pageCode: MODULE_CODE + ':' + ENTITY_TYPE + ':', |
|||
sortInfo: { |
|||
sort_field: 'id', |
|||
sort_sortType: 'descending' |
|||
}, |
|||
displayName: '', |
|||
visible: false, |
|||
loading: false, |
|||
tableData: [], |
|||
option: { |
|||
addBtn: false, |
|||
addRowBtn: true, |
|||
cellBtn: true, |
|||
refreshBtn: false, |
|||
columnBtn: false, |
|||
gridBtn: false, |
|||
// saveBtn: false, |
|||
menuWidth: 100, |
|||
column: [ |
|||
{ |
|||
label: '指标名称', |
|||
prop: 'paramName', |
|||
labelWidth: '120px', |
|||
sortable: true, |
|||
cell: true, |
|||
rules: [ |
|||
{ |
|||
required: true, |
|||
message: '请输入参数名称', |
|||
trigger: 'blur' |
|||
} |
|||
] |
|||
}, |
|||
{ |
|||
label: '是否关键指标', |
|||
labelWidth: '120px', |
|||
prop: 'isKeyParameter', |
|||
type: 'radio', |
|||
button: true, |
|||
dicData: [ |
|||
{ |
|||
label: '是', |
|||
value: '1' |
|||
}, |
|||
{ |
|||
label: '否', |
|||
value: '0' |
|||
} |
|||
], |
|||
value: '1', |
|||
required: true, |
|||
cell: true |
|||
} |
|||
] |
|||
}, |
|||
queryCondition: { |
|||
//默认值处理 |
|||
app: '' |
|||
}, |
|||
// 名称键值 |
|||
nameKey: 'supplierName', |
|||
formData: {}, |
|||
modelTemplateId: '' |
|||
} |
|||
}, |
|||
watch: { |
|||
modelValue: { |
|||
immediate: true, |
|||
handler: 'getSelectedName' |
|||
} |
|||
}, |
|||
methods: { |
|||
// 初始化 |
|||
init() { |
|||
if (!this.modelValue) { |
|||
this.ModelTemplateDetailsApi.init().then((res) => { |
|||
this.modelTemplateId = res.data.id //产品型号id |
|||
console.log('厂商产品型号初始化', this.formData, res.data) |
|||
}) |
|||
} |
|||
this.visible = true |
|||
}, |
|||
// 清空选择 |
|||
clear() { |
|||
this.displayName = '' |
|||
this.$emit('update:modelValue', '') |
|||
this.$emit('my-change', '') |
|||
}, |
|||
// 关闭 |
|||
close() { |
|||
this.visible = false |
|||
}, |
|||
// 确认选择 |
|||
async confirm() { |
|||
// 更新父组件绑定值 |
|||
//上传 |
|||
this.loading = true |
|||
//遍历表格内容,添加modelTemplateId数据 |
|||
this.displayName = '' |
|||
for (let i = 0; i < this.tableData.length; i++) { |
|||
let rowData = this.tableData[i] |
|||
if (!isEmpty(rowData.paramName)) { |
|||
this.tableData[i].modelTemplateId = this.modelTemplateId |
|||
this.displayName = this.displayName + rowData.paramName + ';' |
|||
} |
|||
} |
|||
//modelValue存在说明已有数据,是修改操作,否则是新增操作 |
|||
if (!this.modelValue) { |
|||
await this.ModelTemplateDetailsApi.addList(this.tableData) |
|||
} else { |
|||
await this.ModelTemplateDetailsApi.modifyList(this.tableData) |
|||
} |
|||
this.$emit('update:modelValue', this.modelTemplateId) |
|||
this.$emit('my-change', '') |
|||
this.loading = false |
|||
this.visible = false |
|||
}, |
|||
getSelectedName() { |
|||
if (this.modelValue) { |
|||
this.modelTemplateId = this.modelValue |
|||
this.ModelTemplateDetailsApi.list({ modelTemplateId: this.modelValue }).then((res) => { |
|||
//显示型号规格 |
|||
if (isEmpty(this.displayName)) { |
|||
res.data.forEach((item) => { |
|||
this.displayName = this.displayName + item.paramName + ';' |
|||
}) |
|||
} |
|||
|
|||
//如果tabletData为空,则初始化表单数据 |
|||
if (isEmpty(this.tableData)) { |
|||
this.tableData = res.data |
|||
} |
|||
}) |
|||
} |
|||
}, |
|||
addUpdate(form, index, done, loading) { |
|||
done() |
|||
}, |
|||
rowSave(form, done) { |
|||
done() |
|||
}, |
|||
rowDelete(form, index, done) { |
|||
done() |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style></style> |
@ -0,0 +1,145 @@ |
|||
<template> |
|||
<div class="w-full"> |
|||
<el-input v-model="displayName" disabled style="width: 152px" /> |
|||
<el-button-group> |
|||
<el-button icon="grid" @click="init" style="border-left-width: 0; padding: 10px" /> |
|||
<el-button icon="delete" @click="clear" style="border-left-width: 0; padding: 10px" /> |
|||
</el-button-group> |
|||
<Dialog title="模块选择" v-model="visible" class="w-150"> |
|||
<CollapseTab> |
|||
<el-form :inline="true" :model="queryCondition" label-width="80px" @keyup.enter="query"> |
|||
<el-form-item label="供应商名称"> |
|||
<QueryText v-model="queryCondition.supplierName" type="LK" /> |
|||
</el-form-item> |
|||
<el-form-item label="供应商联系人"> |
|||
<QueryText v-model="queryCondition.supplierContacts" type="LK" /> |
|||
</el-form-item> |
|||
<el-form-item label="供应商联系电话"> |
|||
<QueryText v-model="queryCondition.supplierContactsPhone" type="LK" /> |
|||
</el-form-item> |
|||
<el-form-item label="供应商类型"> |
|||
<QueryText v-model="queryCondition.supplierType" type="LK" /> |
|||
</el-form-item> |
|||
<el-form-item style="float: right"> |
|||
<QueryButton :page-code="pageCode" /> |
|||
</el-form-item> |
|||
<div class="clearfix"></div> |
|||
</el-form> |
|||
</CollapseTab> |
|||
<el-card style="width: 100%"> |
|||
<div style="float: right; margin-top: 0; margin-bottom: 10px"> |
|||
<el-button v-permission="pageCode + 'add'" type="primary" icon="plus" @click="add" |
|||
>新增供应商</el-button |
|||
> |
|||
<ColumnsController :value="columnList" :tableKey="tableKey" /> |
|||
</div> |
|||
<el-table |
|||
v-loading="loading" |
|||
:data="tableData" |
|||
style="width: 100%" |
|||
highlight-current-row |
|||
border |
|||
@sort-change="sortChange" |
|||
@current-change="rowChange" |
|||
> |
|||
<el-table-column |
|||
v-for="(item, index) in showCols" |
|||
:key="index" |
|||
:label="item.label" |
|||
:prop="item.prop" |
|||
:show-overflow-tooltip="item.showOverflowTooltip" |
|||
:width="item.width" |
|||
:formatter="item.formatFunc" |
|||
:sortable="item.sortable" |
|||
/> |
|||
</el-table> |
|||
<ListPager |
|||
:page-num="pageInfo.pageNum" |
|||
:page-size="pageInfo.pageSize" |
|||
:page-total="pageTotal" |
|||
/> |
|||
</el-card> |
|||
<template #footer> |
|||
<el-button type="primary" @click="confirm">确定</el-button> |
|||
<el-button @click="close">关闭</el-button> |
|||
</template> |
|||
</Dialog> |
|||
<AddPage ref="addPage" @refresh="refresh" /> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import { referenceMixin } from '@/mixin/referenceMixin.js' |
|||
import AddPage from '@/modules/productManagement/view/supplierInformation/add.vue' |
|||
|
|||
const MODULE_CODE = 'productManagement' |
|||
const ENTITY_TYPE = 'supplierInformation' |
|||
export default { |
|||
name: ENTITY_TYPE + '-reference', |
|||
components: { AddPage }, |
|||
mixins: [referenceMixin], |
|||
props: { |
|||
moduleParam: { |
|||
type: Object, |
|||
required: false |
|||
} |
|||
}, |
|||
data() { |
|||
return { |
|||
entityType: ENTITY_TYPE, |
|||
moduleCode: MODULE_CODE, |
|||
// eslint-disable-next-line no-eval |
|||
api: eval('this.$api.' + MODULE_CODE + '.' + ENTITY_TYPE), |
|||
pageCode: MODULE_CODE + ':' + ENTITY_TYPE + ':', |
|||
sortInfo: { |
|||
sort_field: 'id', |
|||
sort_sortType: 'descending' |
|||
}, |
|||
columnList: [ |
|||
{ |
|||
prop: 'supplierName', |
|||
label: '供应商名称', |
|||
show: true, |
|||
showOverflowTooltip: true, |
|||
sortable: true |
|||
}, |
|||
{ |
|||
prop: 'supplierContacts', |
|||
label: '供应商联系人', |
|||
show: true, |
|||
showOverflowTooltip: true, |
|||
sortable: true |
|||
}, |
|||
{ |
|||
prop: 'supplierContactsPhone', |
|||
label: '供应商联系电话', |
|||
show: true, |
|||
showOverflowTooltip: true, |
|||
sortable: true |
|||
}, |
|||
{ |
|||
prop: 'supplierType', |
|||
label: '供应商类型', |
|||
show: true, |
|||
showOverflowTooltip: true, |
|||
sortable: true |
|||
} |
|||
], |
|||
queryCondition: { |
|||
//默认值处理 |
|||
app: '' |
|||
}, |
|||
// 名称键值 |
|||
nameKey: 'supplierName' |
|||
} |
|||
}, |
|||
methods: { |
|||
// 新增 |
|||
add() { |
|||
this.$refs.addPage.init() |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style></style> |
@ -0,0 +1,209 @@ |
|||
<template> |
|||
<avue-crud |
|||
ref="crudRef" |
|||
:option="option" |
|||
:data="data" |
|||
v-model="formData" |
|||
v-model:page="page" |
|||
v-model:search="queryCondition" |
|||
@row-save="rowSave" |
|||
@row-update="rowUpdate" |
|||
@row-del="rowDel" |
|||
@refresh-change="onLoad" |
|||
@on-load="onLoad" |
|||
@search-change="searchChange" |
|||
@row-dblclick="rowDblclick" |
|||
> |
|||
<template #menu-left="{}"> |
|||
<el-button |
|||
type="primary" |
|||
icon="el-icon-plus" |
|||
@click="proxy.$refs.crudRef.rowAdd()" |
|||
v-permission="pageCode + 'add'" |
|||
>新增</el-button |
|||
> |
|||
</template> |
|||
<template #menu="{ row, index }"> |
|||
<el-button |
|||
type="primary" |
|||
text |
|||
icon="el-icon-edit" |
|||
@click="proxy.$refs.crudRef.rowEdit(row)" |
|||
v-permission="pageCode + 'modify'" |
|||
>编辑</el-button |
|||
> |
|||
<el-popconfirm |
|||
title="此操作将删除数据, 是否继续?" |
|||
confirm-button-text="删除" |
|||
cancel-button-text="取消" |
|||
icon="el-icon-delete" |
|||
icon-color="red" |
|||
@confirm="rowDel(row, index)" |
|||
> |
|||
<template #reference> |
|||
<el-button type="primary" text icon="el-icon-delete" v-permission="pageCode + 'remove'" |
|||
>删除</el-button |
|||
> |
|||
</template> |
|||
</el-popconfirm> |
|||
</template> |
|||
<template #supplierName-form="{}"> |
|||
<supplier-information-components |
|||
v-model="formData.supplierInformationId" |
|||
:module-param="moduleParam" |
|||
/> |
|||
</template> |
|||
<template #modelId-form="{}"> |
|||
<product-model-components v-model="formData.modelId" :module-param="moduleParam" /> |
|||
</template> |
|||
</avue-crud> |
|||
</template> |
|||
<script setup> |
|||
import { ref, getCurrentInstance, reactive } from 'vue' |
|||
import supplierInformationComponents from '@/modules/productManagement/components/supplierInformationComponents.vue' |
|||
import productModelComponents from '@/modules/productManagement/components/productModelComponents.vue' |
|||
//获取this |
|||
let { proxy } = getCurrentInstance() |
|||
const option = ref(null) |
|||
const data = ref(null) |
|||
let moduleParam = reactive({ |
|||
entityType: 'companyProductModel', |
|||
pageType: 'addOrModify' |
|||
}) |
|||
let formData = ref({}) |
|||
let queryCondition = ref({}) |
|||
let pageInfo = reactive({ |
|||
// 页码 |
|||
pageNum: 1, |
|||
// 页码大小 |
|||
pageSize: 10 |
|||
}) |
|||
// 排序信息 |
|||
let sortInfo = reactive({ |
|||
sort_field: 'id', |
|||
sort_sortType: 'descending' |
|||
}) |
|||
let page = reactive({ |
|||
total: 0, |
|||
currentPage: 1, |
|||
pageSize: 10 |
|||
}) |
|||
|
|||
const MODULE_CODE = 'productManagement' |
|||
const ENTITY_TYPE = 'companyProducts' |
|||
const pageCode = `${MODULE_CODE}:${ENTITY_TYPE}:` |
|||
const api = eval('proxy.$api.' + MODULE_CODE + '.' + ENTITY_TYPE) |
|||
option.value = { |
|||
dialogWidth: '80%', //弹窗宽度 |
|||
searchMenuSpan: 6, //搜索按钮宽度 |
|||
addBtn: false, //隐藏新增按钮 |
|||
editBtn: false, //隐藏编辑按钮 |
|||
delBtn: false, //隐藏删除按钮 |
|||
column: [ |
|||
{ |
|||
label: '产品名称', |
|||
labelWidth: 120, |
|||
prop: 'productName', //sProductName |
|||
search: true, |
|||
searchLabelWidth: 120 |
|||
}, |
|||
{ |
|||
label: '产品标识(型号)', |
|||
labelWidth: 120, |
|||
prop: 'productIdentity', |
|||
search: true, |
|||
searchLabelWidth: 120 |
|||
}, |
|||
{ |
|||
label: '供应商名称', |
|||
labelWidth: 120, |
|||
prop: 'supplierName', |
|||
type: 'input', |
|||
hide: true, |
|||
searchLabelWidth: 120, |
|||
span: 12 |
|||
}, |
|||
{ |
|||
label: '产品价格', |
|||
prop: 'productPrice', |
|||
labelWidth: 120, |
|||
type: 'number', |
|||
precision: 2, |
|||
mim: 0 |
|||
}, |
|||
{ |
|||
label: '产品型号', |
|||
labelWidth: 120, |
|||
prop: 'modelId', |
|||
type: 'textarea', |
|||
hide: true, |
|||
minRows: 4 //文本最小行数 |
|||
}, |
|||
{ |
|||
label: '产品描述', |
|||
labelWidth: 120, |
|||
prop: 'modelDescription', |
|||
//editDisabled: true //编辑时禁用 |
|||
display: false //表单不展示该字段 |
|||
}, |
|||
{ |
|||
label: '信息来源', |
|||
labelWidth: 120, |
|||
prop: 'sourceInformation', |
|||
hide: true |
|||
}, |
|||
{ |
|||
label: '备注', |
|||
labelWidth: 120, |
|||
prop: 'remarks', |
|||
hide: true |
|||
} |
|||
] |
|||
} |
|||
data.value = [] |
|||
function rowSave(row, done, loading) { |
|||
api.add(row).then(() => { |
|||
done() |
|||
onLoad() |
|||
}).catch(() => { |
|||
loading() |
|||
|
|||
}) |
|||
} |
|||
function rowDel(row, index) { |
|||
api.remove(row.id) |
|||
onLoad() |
|||
} |
|||
function rowUpdate(row, index, done, loading) { |
|||
api.modify(row).then(() => { |
|||
done() |
|||
onLoad() |
|||
}).catch(() => { |
|||
loading() |
|||
|
|||
}) |
|||
// done() |
|||
} |
|||
function onLoad() { |
|||
pageInfo.pageNum = page.currentPage |
|||
const params = Object.assign(queryCondition.value, pageInfo, sortInfo) |
|||
api.page(params).then((res) => { |
|||
data.value = res.data.records |
|||
page.total = res.data.total |
|||
// res.data.total |
|||
}) |
|||
} |
|||
function rowDblclick(row, index) { |
|||
proxy.$refs.crudRef.rowView(row) |
|||
} |
|||
function searchChange(val, done) { |
|||
onLoad() |
|||
done() |
|||
} |
|||
</script> |
|||
<style> |
|||
.el-input, |
|||
.el-input-number { |
|||
width: 100% !important; |
|||
} |
|||
</style> |
@ -0,0 +1,208 @@ |
|||
<template> |
|||
<avue-crud |
|||
ref="crudRef" |
|||
:option="option" |
|||
:data="data" |
|||
v-model="formData" |
|||
v-model:page="page" |
|||
v-model:search="queryCondition" |
|||
@row-save="rowSave" |
|||
@row-update="rowUpdate" |
|||
@row-del="rowDel" |
|||
@refresh-change="onLoad" |
|||
@on-load="onLoad" |
|||
@search-change="searchChange" |
|||
@row-dblclick="rowDblclick" |
|||
> |
|||
<template #menu-left="{}"> |
|||
<el-button |
|||
type="primary" |
|||
icon="el-icon-plus" |
|||
@click="proxy.$refs.crudRef.rowAdd()" |
|||
v-permission="pageCode + 'add'" |
|||
>新增</el-button |
|||
> |
|||
</template> |
|||
<template #menu="{ row, index }"> |
|||
<el-button |
|||
type="primary" |
|||
text |
|||
icon="el-icon-edit" |
|||
@click="proxy.$refs.crudRef.rowEdit(row)" |
|||
v-permission="pageCode + 'modify'" |
|||
>编辑</el-button |
|||
> |
|||
<el-popconfirm |
|||
title="此操作将删除数据, 是否继续?" |
|||
confirm-button-text="删除" |
|||
cancel-button-text="取消" |
|||
icon="el-icon-delete" |
|||
icon-color="red" |
|||
@confirm="rowDel(row, index)" |
|||
> |
|||
<template #reference> |
|||
<el-button type="primary" text icon="el-icon-delete" v-permission="pageCode + 'remove'" |
|||
>删除</el-button |
|||
> |
|||
</template> |
|||
</el-popconfirm> |
|||
</template> |
|||
<template #supplierName-form="{}"> |
|||
<supplier-information-components |
|||
v-model="formData.supplierInformationId" |
|||
:module-param="moduleParam" |
|||
/> |
|||
</template> |
|||
<template #modelId-form="{}"> |
|||
<product-model-components v-model="formData.modelId" :module-param="moduleParam" /> |
|||
</template> |
|||
</avue-crud> |
|||
</template> |
|||
<script setup> |
|||
import { ref, getCurrentInstance, reactive } from 'vue' |
|||
import supplierInformationComponents from '@/modules/productManagement/components/supplierInformationComponents.vue' |
|||
import productModelComponents from '@/modules/productManagement/components/productModelComponents.vue' |
|||
//获取this |
|||
let { proxy } = getCurrentInstance() |
|||
const option = ref(null) |
|||
const data = ref(null) |
|||
let moduleParam = reactive({ |
|||
entityType: 'personProductModel', |
|||
pageType: 'addOrModify' |
|||
}) |
|||
let formData = ref({}) |
|||
let queryCondition = ref({}) |
|||
let pageInfo = reactive({ |
|||
// 页码 |
|||
pageNum: 1, |
|||
// 页码大小 |
|||
pageSize: 10 |
|||
}) |
|||
// 排序信息 |
|||
let sortInfo = reactive({ |
|||
sort_field: 'id', |
|||
sort_sortType: 'descending' |
|||
}) |
|||
let page = reactive({ |
|||
total: 0, |
|||
currentPage: 1, |
|||
pageSize: 10 |
|||
}) |
|||
|
|||
const MODULE_CODE = 'productManagement' |
|||
const ENTITY_TYPE = 'personProducts' |
|||
const pageCode = `${MODULE_CODE}:${ENTITY_TYPE}:` |
|||
const api = eval('proxy.$api.' + MODULE_CODE + '.' + ENTITY_TYPE) |
|||
option.value = { |
|||
dialogWidth: '80%', //弹窗宽度 |
|||
searchMenuSpan: 6, //搜索按钮宽度 |
|||
addBtn: false, //隐藏新增按钮 |
|||
editBtn: false, //隐藏编辑按钮 |
|||
delBtn: false, //隐藏删除按钮 |
|||
column: [ |
|||
{ |
|||
label: '产品名称', |
|||
labelWidth: 120, |
|||
prop: 'productName', //sProductName |
|||
search: true, |
|||
searchLabelWidth: 120 |
|||
}, |
|||
{ |
|||
label: '产品标识(型号)', |
|||
labelWidth: 120, |
|||
prop: 'productIdentity', |
|||
search: true, |
|||
searchLabelWidth: 120 |
|||
}, |
|||
{ |
|||
label: '供应商名称', |
|||
labelWidth: 120, |
|||
prop: 'supplierName', |
|||
type: 'input', |
|||
hide: true, |
|||
searchLabelWidth: 120, |
|||
span: 12 |
|||
}, |
|||
{ |
|||
label: '产品价格', |
|||
prop: 'productPrice', |
|||
labelWidth: 120, |
|||
type: 'number', |
|||
precision: 2, |
|||
mim: 0 |
|||
}, |
|||
{ |
|||
label: '产品型号', |
|||
labelWidth: 120, |
|||
prop: 'modelId', |
|||
type: 'textarea', |
|||
hide: true, |
|||
minRows: 4 //文本最小行数 |
|||
}, |
|||
{ |
|||
label: '产品描述', |
|||
labelWidth: 120, |
|||
prop: 'modelDescription', |
|||
//editDisabled: true //编辑时禁用 |
|||
display: false //表单不展示该字段 |
|||
}, |
|||
{ |
|||
label: '信息来源', |
|||
labelWidth: 120, |
|||
prop: 'sourceInformation', |
|||
hide: true |
|||
}, |
|||
{ |
|||
label: '备注', |
|||
labelWidth: 120, |
|||
prop: 'remarks', |
|||
hide: true |
|||
} |
|||
] |
|||
} |
|||
data.value = [] |
|||
function rowSave(row, done, loading) { |
|||
api.add(row).then(() => { |
|||
done() |
|||
onLoad() |
|||
}).catch(() => { |
|||
loading() |
|||
|
|||
}) |
|||
} |
|||
function rowDel(row, index) { |
|||
api.remove(row.id) |
|||
onLoad() |
|||
} |
|||
function rowUpdate(row, index, done, loading) { |
|||
api.modify(row).then(() => { |
|||
done() |
|||
onLoad() |
|||
}).catch(() => { |
|||
loading() |
|||
|
|||
}) |
|||
} |
|||
function onLoad() { |
|||
pageInfo.pageNum = page.currentPage |
|||
const params = Object.assign(queryCondition.value, pageInfo, sortInfo) |
|||
api.page(params).then((res) => { |
|||
data.value = res.data.records |
|||
page.total = res.data.total |
|||
// res.data.total |
|||
}) |
|||
} |
|||
function rowDblclick(row, index) { |
|||
proxy.$refs.crudRef.rowView(row) |
|||
} |
|||
function searchChange(val, done) { |
|||
onLoad() |
|||
done() |
|||
} |
|||
</script> |
|||
<style> |
|||
.el-input, |
|||
.el-input-number { |
|||
width: 100% !important; |
|||
} |
|||
</style> |
@ -0,0 +1,167 @@ |
|||
<template> |
|||
<avue-crud |
|||
ref="crudRef" |
|||
:option="option" |
|||
:data="data" |
|||
v-model="formData" |
|||
v-model:page="page" |
|||
v-model:search="queryCondition" |
|||
@row-save="rowSave" |
|||
@row-update="rowUpdate" |
|||
@row-del="rowDel" |
|||
@refresh-change="onLoad" |
|||
@on-load="onLoad" |
|||
@search-change="searchChange" |
|||
@row-dblclick="rowDblclick" |
|||
:before-close="beforeCloseForm" |
|||
> |
|||
<template #menu-left="{}"> |
|||
<el-button |
|||
type="primary" |
|||
icon="el-icon-plus" |
|||
@click="proxy.$refs.crudRef.rowAdd()" |
|||
v-permission="pageCode + 'add'" |
|||
>新增</el-button |
|||
> |
|||
</template> |
|||
<template #menu="{ row, index }"> |
|||
<el-button |
|||
type="primary" |
|||
text |
|||
icon="el-icon-edit" |
|||
@click="proxy.$refs.crudRef.rowEdit(row)" |
|||
v-permission="pageCode + 'modify'" |
|||
>编辑</el-button |
|||
> |
|||
<el-popconfirm |
|||
title="此操作将删除数据, 是否继续?" |
|||
confirm-button-text="删除" |
|||
cancel-button-text="取消" |
|||
icon="el-icon-delete" |
|||
icon-color="red" |
|||
@confirm="rowDel(row, index)" |
|||
> |
|||
<template #reference> |
|||
<el-button type="primary" text icon="el-icon-delete" v-permission="pageCode + 'remove'" |
|||
>删除</el-button |
|||
> |
|||
</template> |
|||
</el-popconfirm> |
|||
</template> |
|||
<template #templateDetailsDescription-form="{}"> |
|||
<productModelTemplateComponents v-model="formData.id" :module-param="moduleParam" /> |
|||
</template> |
|||
</avue-crud> |
|||
</template> |
|||
<script setup> |
|||
import { ref, getCurrentInstance, reactive } from 'vue' |
|||
import productModelTemplateComponents from '@/modules/productManagement/components/productModelTemplateComponents.vue' |
|||
//获取this |
|||
let { proxy } = getCurrentInstance() |
|||
const option = ref(null) |
|||
const data = ref(null) |
|||
let queryCondition = ref({}) |
|||
let formData = ref({}) |
|||
let moduleParam = reactive({ |
|||
pageType: 'addOrModify' |
|||
}) |
|||
let pageInfo = reactive({ |
|||
// 页码 |
|||
pageNum: 1, |
|||
// 页码大小 |
|||
pageSize: 10 |
|||
}) |
|||
// 排序信息 |
|||
let sortInfo = reactive({ |
|||
sort_field: 'id', |
|||
sort_sortType: 'descending' |
|||
}) |
|||
let page = reactive({ |
|||
total: 0, |
|||
currentPage: 1, |
|||
pageSize: 10 |
|||
}) |
|||
|
|||
const MODULE_CODE = 'productManagement' |
|||
const ENTITY_TYPE = 'productModelTemplate' |
|||
const pageCode = `${MODULE_CODE}:${ENTITY_TYPE}:` |
|||
const api = eval('proxy.$api.' + MODULE_CODE + '.' + ENTITY_TYPE) |
|||
|
|||
option.value = { |
|||
dialogWidth: '80%', //弹窗宽度 |
|||
searchMenuSpan: 6, //搜索按钮宽度 |
|||
addBtn: false, //隐藏新增按钮 |
|||
editBtn: false, //隐藏编辑按钮 |
|||
delBtn: false, //隐藏删除按钮 |
|||
column: [ |
|||
{ |
|||
label: '型号名称', |
|||
labelWidth: 120, |
|||
prop: 'templateName', //sProductName |
|||
search: true, |
|||
searchLabelWidth: 120 |
|||
}, |
|||
{ |
|||
label: '型号规格', |
|||
prop: 'templateDetailsDescription', |
|||
labelWidth: 120 |
|||
}, |
|||
{ |
|||
label: '类型', |
|||
labelWidth: 120, |
|||
prop: 'templateType' |
|||
}, |
|||
{ |
|||
label: '备注', |
|||
labelWidth: 120, |
|||
prop: 'remarks' |
|||
} |
|||
] |
|||
} |
|||
data.value = [] |
|||
function rowSave(row, done, loading) { |
|||
api.add(row).then((res) => { |
|||
onLoad() |
|||
done() |
|||
}) |
|||
} |
|||
function rowDel(row, index) { |
|||
api.remove(row.id).then(() => { |
|||
onLoad() |
|||
}) |
|||
} |
|||
function rowUpdate(row, index, done, loading) { |
|||
api.modify(row).then(() => { |
|||
onLoad() |
|||
done() |
|||
}) |
|||
} |
|||
function onLoad() { |
|||
pageInfo.pageNum = page.currentPage |
|||
const params = Object.assign(queryCondition.value, pageInfo, sortInfo) |
|||
api.page(params).then((res) => { |
|||
data.value = res.data.records |
|||
page.total = res.data.total |
|||
// res.data.total |
|||
}) |
|||
} |
|||
function rowDblclick(row, index) { |
|||
moduleParam.pageType = 'view' |
|||
proxy.$refs.crudRef.rowView(row) |
|||
} |
|||
//关闭表单页面 |
|||
function beforeCloseForm(done, type) { |
|||
done() |
|||
moduleParam.pageType = 'addOrModify' //还原默认值 |
|||
} |
|||
function searchChange(val, done) { |
|||
onLoad() |
|||
done() |
|||
} |
|||
</script> |
|||
<style> |
|||
.el-input, |
|||
.el-input-number { |
|||
width: 100% !important; |
|||
} |
|||
</style> |
@ -0,0 +1,69 @@ |
|||
<template> |
|||
<Dialog title="新增" v-model="visible" width="500px"> |
|||
<el-form |
|||
ref="form" |
|||
:model="entityData" |
|||
:rules="rules" |
|||
label-width="120px" |
|||
label-position="right" |
|||
style="width: 90%; margin: 0px auto" |
|||
> |
|||
<!--表单区域 --> |
|||
<el-form-item label="供应商名称" prop="supplierName"> |
|||
<el-input v-model="entityData.supplierName" /> |
|||
</el-form-item> |
|||
<el-form-item label="供应商联系人" prop="supplierContacts"> |
|||
<el-input v-model="entityData.supplierContacts" /> |
|||
</el-form-item> |
|||
<el-form-item label="供应商联系电话" prop="supplierContactsPhone"> |
|||
<el-input v-model="entityData.supplierContactsPhone" /> |
|||
</el-form-item> |
|||
<el-form-item label="供应商类型" prop="supplierType"> |
|||
<el-input v-model="entityData.supplierType" /> |
|||
</el-form-item> |
|||
<el-form-item label="职位" prop="position"> |
|||
<el-input v-model="entityData.position" /> |
|||
</el-form-item> |
|||
</el-form> |
|||
<template #footer> |
|||
<el-button type="primary" @click="save" v-permission="pageCode + 'add'">保存</el-button> |
|||
<el-button @click="close">关闭</el-button> |
|||
</template> |
|||
</Dialog> |
|||
</template> |
|||
|
|||
<script> |
|||
import { addMixin } from '@/mixin/addMixin.js' |
|||
const MODULE_CODE = 'productManagement' |
|||
const ENTITY_TYPE = 'supplierInformation' |
|||
export default { |
|||
name: ENTITY_TYPE + '-add', |
|||
mixins: [addMixin], |
|||
components: {}, |
|||
data() { |
|||
return { |
|||
entityType: ENTITY_TYPE, |
|||
moduleCode: MODULE_CODE, |
|||
// eslint-disable-next-line no-eval |
|||
api: eval('this.$api.' + MODULE_CODE + '.' + ENTITY_TYPE), |
|||
pageCode: MODULE_CODE + ':' + ENTITY_TYPE + ':', |
|||
entityData: {}, |
|||
rules: { |
|||
//前端验证规则 |
|||
supplierName: [{ required: true, message: '【供应商名称】不能为空', trigger: 'blur' }], |
|||
supplierContacts: [ |
|||
{ required: true, message: '【供应商联系人】不能为空', trigger: 'blur' } |
|||
], |
|||
supplierContactsPhone: [ |
|||
{ required: true, message: '【供应商联系电话】不能为空', trigger: 'blur' } |
|||
], |
|||
supplierType: [{ required: true, message: '【供应商类型】不能为空', trigger: 'blur' }], |
|||
position: [{ required: true, message: '【职位】不能为空', trigger: 'blur' }] |
|||
} |
|||
} |
|||
}, |
|||
methods: {} |
|||
} |
|||
</script> |
|||
|
|||
<style></style> |
@ -0,0 +1,148 @@ |
|||
<template> |
|||
<ContentWrap> |
|||
<CollapseTab> |
|||
<el-form :inline="true" :model="queryCondition" label-width="120px" @keyup.enter="query"> |
|||
<!--查询条件区 --> |
|||
<el-form-item label="供应商名称"> |
|||
<QueryText v-model="queryCondition.supplierName" type="LK" /> |
|||
</el-form-item> |
|||
<el-form-item label="供应商联系人"> |
|||
<QueryText v-model="queryCondition.supplierContacts" type="LK" /> |
|||
</el-form-item> |
|||
<el-form-item label="供应商联系电话"> |
|||
<QueryText v-model="queryCondition.supplierContactsPhone" type="LK" /> |
|||
</el-form-item> |
|||
<el-form-item label="供应商类型"> |
|||
<QueryText v-model="queryCondition.supplierType" type="LK" /> |
|||
</el-form-item> |
|||
<el-form-item style="float: right"> |
|||
<QueryButton :page-code="pageCode" /> |
|||
</el-form-item> |
|||
<div class="clearfix"></div> |
|||
</el-form> |
|||
</CollapseTab> |
|||
<div class="mb-10px mt-10px"> |
|||
<el-button type="primary" icon="Refresh" @click="refresh">刷新</el-button> |
|||
<el-button v-permission="pageCode + 'add'" type="primary" icon="plus" @click="add" |
|||
>新增</el-button |
|||
> |
|||
</div> |
|||
|
|||
<el-card style="width: 100%"> |
|||
<div style="margin-top: 0; margin-bottom: 10px; float: right"> |
|||
<ColumnsController :value="columnList" :tableKey="tableKey" /> |
|||
</div> |
|||
|
|||
<el-table |
|||
v-loading="loading" |
|||
:data="tableData" |
|||
style="width: 100%" |
|||
highlight-current-row |
|||
border |
|||
@sort-change="sortChange" |
|||
@current-change="rowChange" |
|||
@selection-change="selectionChange" |
|||
@row-dblclick="rowDoubleClick" |
|||
> |
|||
<el-table-column type="selection" width="55" /> |
|||
<el-table-column |
|||
v-for="(item, index) in showCols" |
|||
:key="index" |
|||
:label="item.label" |
|||
:prop="item.prop" |
|||
:show-overflow-tooltip="item.showOverflowTooltip" |
|||
:width="item.width" |
|||
:formatter="item.formatFunc" |
|||
:sortable="item.sortable" |
|||
/> |
|||
<el-table-column fixed="right" label="操作" width="250"> |
|||
<template #default="scope"> |
|||
<el-button v-permission="pageCode + 'modify'" type="primary" @click="modify(scope.row)" |
|||
>修改</el-button |
|||
> |
|||
<el-button v-permission="pageCode + 'remove'" type="primary" @click="remove(scope.row)" |
|||
>删除</el-button |
|||
> |
|||
</template> |
|||
</el-table-column> |
|||
</el-table> |
|||
<ListPager |
|||
:page-num="pageInfo.pageNum" |
|||
:page-size="pageInfo.pageSize" |
|||
:page-total="pageTotal" |
|||
/> |
|||
</el-card> |
|||
<AddPage ref="addPage" @refresh="refresh" /> |
|||
<ModifyPage ref="modifyPage" @refresh="refresh" /> |
|||
|
|||
<ViewPage ref="viewPage" /> |
|||
</ContentWrap> |
|||
</template> |
|||
|
|||
<script lang="ts"> |
|||
import { listMixin } from '@/mixin/listMixin.js' |
|||
import AddPage from './add.vue' |
|||
import ModifyPage from './modify.vue' |
|||
import ViewPage from './view.vue' |
|||
|
|||
const MODULE_CODE = 'productManagement' |
|||
const ENTITY_TYPE = 'supplierInformation' |
|||
export default { |
|||
name: ENTITY_TYPE, |
|||
mixins: [listMixin], |
|||
components: { |
|||
AddPage, |
|||
ModifyPage, |
|||
ViewPage |
|||
}, |
|||
data() { |
|||
return { |
|||
entityType: ENTITY_TYPE, |
|||
moduleCode: MODULE_CODE, |
|||
// eslint-disable-next-line no-eval |
|||
api: eval('this.$api.' + MODULE_CODE + '.' + ENTITY_TYPE), |
|||
pageCode: MODULE_CODE + ':' + ENTITY_TYPE + ':', |
|||
// 排序信息 |
|||
sortInfo: { |
|||
sort_field: 'id', |
|||
sort_sortType: 'descending' |
|||
}, |
|||
columnList: [ |
|||
{ |
|||
prop: 'supplierName', |
|||
label: '供应商名称', |
|||
show: true, |
|||
showOverflowTooltip: true, |
|||
sortable: true |
|||
}, |
|||
{ |
|||
prop: 'supplierContacts', |
|||
label: '供应商联系人', |
|||
show: true, |
|||
showOverflowTooltip: true, |
|||
sortable: true |
|||
}, |
|||
{ |
|||
prop: 'supplierContactsPhone', |
|||
label: '供应商联系电话', |
|||
show: true, |
|||
showOverflowTooltip: true, |
|||
sortable: true |
|||
}, |
|||
{ |
|||
prop: 'supplierType', |
|||
label: '供应商类型', |
|||
show: true, |
|||
showOverflowTooltip: true, |
|||
sortable: true |
|||
} |
|||
], |
|||
queryCondition: { |
|||
//默认值处理 |
|||
} |
|||
} |
|||
}, |
|||
|
|||
methods: {} |
|||
} |
|||
</script> |
@ -0,0 +1,69 @@ |
|||
<template> |
|||
<Dialog title="修改" v-model="visible" width="500px"> |
|||
<el-form |
|||
ref="form" |
|||
:model="entityData" |
|||
:rules="rules" |
|||
label-width="120px" |
|||
label-position="right" |
|||
style="width: 90%; margin: 0px auto" |
|||
> |
|||
<!--表单区域 --> |
|||
<el-form-item label="供应商名称" prop="supplierName"> |
|||
<el-input v-model="entityData.supplierName" /> |
|||
</el-form-item> |
|||
<el-form-item label="供应商联系人" prop="supplierContacts"> |
|||
<el-input v-model="entityData.supplierContacts" /> |
|||
</el-form-item> |
|||
<el-form-item label="供应商联系电话" prop="supplierContactsPhone"> |
|||
<el-input v-model="entityData.supplierContactsPhone" /> |
|||
</el-form-item> |
|||
<el-form-item label="供应商类型" prop="supplierType"> |
|||
<el-input v-model="entityData.supplierType" /> |
|||
</el-form-item> |
|||
<el-form-item label="职位" prop="position"> |
|||
<el-input v-model="entityData.position" /> |
|||
</el-form-item> |
|||
</el-form> |
|||
<template #footer> |
|||
<el-button type="primary" @click="save" v-permission="pageCode + 'modify'">保存</el-button> |
|||
<el-button @click="close">关闭</el-button> |
|||
</template> |
|||
</Dialog> |
|||
</template> |
|||
|
|||
<script> |
|||
import { modifyMixin } from '@/mixin/modifyMixin.js' |
|||
const MODULE_CODE = 'productManagement' |
|||
const ENTITY_TYPE = 'supplierInformation' |
|||
export default { |
|||
name: ENTITY_TYPE + '-modify', |
|||
mixins: [modifyMixin], |
|||
components: {}, |
|||
data() { |
|||
return { |
|||
entityType: ENTITY_TYPE, |
|||
moduleCode: MODULE_CODE, |
|||
// eslint-disable-next-line no-eval |
|||
api: eval('this.$api.' + MODULE_CODE + '.' + ENTITY_TYPE), |
|||
pageCode: MODULE_CODE + ':' + ENTITY_TYPE + ':', |
|||
entityData: {}, |
|||
rules: { |
|||
//前端验证规则 |
|||
supplierName: [{ required: true, message: '【供应商名称】不能为空', trigger: 'blur' }], |
|||
supplierContacts: [ |
|||
{ required: true, message: '【供应商联系人】不能为空', trigger: 'blur' } |
|||
], |
|||
supplierContactsPhone: [ |
|||
{ required: true, message: '【供应商联系电话】不能为空', trigger: 'blur' } |
|||
], |
|||
supplierType: [{ required: true, message: '【供应商类型】不能为空', trigger: 'blur' }], |
|||
position: [{ required: true, message: '【职位】不能为空', trigger: 'blur' }] |
|||
} |
|||
} |
|||
}, |
|||
methods: {} |
|||
} |
|||
</script> |
|||
|
|||
<style></style> |
@ -0,0 +1,55 @@ |
|||
<template> |
|||
<Dialog title="查看" v-model="visible" width="500px"> |
|||
<el-form |
|||
ref="form" |
|||
:model="entityData" |
|||
label-width="120px" |
|||
label-position="right" |
|||
style="width: 90%; margin: 0px auto" |
|||
> |
|||
<!--表单区域 --> |
|||
<el-form-item label="供应商名称" prop="supplierName"> |
|||
<el-input v-model="entityData.supplierName" /> |
|||
</el-form-item> |
|||
<el-form-item label="供应商联系人" prop="supplierContacts"> |
|||
<el-input v-model="entityData.supplierContacts" /> |
|||
</el-form-item> |
|||
<el-form-item label="供应商联系电话" prop="supplierContactsPhone"> |
|||
<el-input v-model="entityData.supplierContactsPhone" /> |
|||
</el-form-item> |
|||
<el-form-item label="供应商类型" prop="supplierType"> |
|||
<el-input v-model="entityData.supplierType" /> |
|||
</el-form-item> |
|||
<el-form-item label="职位" prop="position"> |
|||
<el-input v-model="entityData.position" /> |
|||
</el-form-item> |
|||
</el-form> |
|||
<template #footer> |
|||
<el-button @click="close">关闭</el-button> |
|||
</template> |
|||
</Dialog> |
|||
</template> |
|||
|
|||
<script> |
|||
import { viewMixin } from '@/mixin/viewMixin.js' |
|||
const MODULE_CODE = 'productManagement' |
|||
const ENTITY_TYPE = 'supplierInformation' |
|||
export default { |
|||
name: ENTITY_TYPE + '-view', |
|||
mixins: [viewMixin], |
|||
components: {}, |
|||
data() { |
|||
return { |
|||
entityType: ENTITY_TYPE, |
|||
moduleCode: MODULE_CODE, |
|||
// eslint-disable-next-line no-eval |
|||
api: eval('this.$api.' + MODULE_CODE + '.' + ENTITY_TYPE), |
|||
pageCode: MODULE_CODE + ':' + ENTITY_TYPE + ':', |
|||
entityData: {} |
|||
} |
|||
}, |
|||
methods: {} |
|||
} |
|||
</script> |
|||
|
|||
<style></style> |
@ -0,0 +1,220 @@ |
|||
<template> |
|||
<avue-crud |
|||
ref="crudRef" |
|||
:option="option" |
|||
:data="data" |
|||
v-model="formData" |
|||
v-model:page="page" |
|||
v-model:search="queryCondition" |
|||
@row-save="rowSave" |
|||
@row-update="rowUpdate" |
|||
@row-del="rowDel" |
|||
@refresh-change="onLoad" |
|||
@on-load="onLoad" |
|||
@search-change="searchChange" |
|||
@row-dblclick="rowDblclick" |
|||
:before-close="beforeCloseForm" |
|||
> |
|||
<template #menu-left="{}"> |
|||
<el-button |
|||
type="primary" |
|||
icon="el-icon-plus" |
|||
@click="proxy.$refs.crudRef.rowAdd()" |
|||
v-permission="pageCode + 'add'" |
|||
>新增</el-button |
|||
> |
|||
</template> |
|||
<template #menu="{ row, index }"> |
|||
<el-button |
|||
type="primary" |
|||
text |
|||
icon="el-icon-edit" |
|||
@click="proxy.$refs.crudRef.rowEdit(row)" |
|||
v-permission="pageCode + 'modify'" |
|||
>编辑</el-button |
|||
> |
|||
<el-popconfirm |
|||
title="此操作将删除数据, 是否继续?" |
|||
confirm-button-text="删除" |
|||
cancel-button-text="取消" |
|||
icon="el-icon-delete" |
|||
icon-color="red" |
|||
@confirm="rowDel(row, index)" |
|||
> |
|||
<template #reference> |
|||
<el-button type="primary" text icon="el-icon-delete" v-permission="pageCode + 'remove'" |
|||
>删除</el-button |
|||
> |
|||
</template> |
|||
</el-popconfirm> |
|||
</template> |
|||
<template #supplierName-form="{}"> |
|||
<supplier-information-components |
|||
v-model="formData.supplierInformationId" |
|||
:module-param="moduleParam" |
|||
/> |
|||
</template> |
|||
<template #modelId-form="{}"> |
|||
<product-model-components v-model="formData.modelId" :module-param="moduleParam" /> |
|||
</template> |
|||
</avue-crud> |
|||
</template> |
|||
<script setup> |
|||
import { ref, getCurrentInstance, reactive } from 'vue' |
|||
import supplierInformationComponents from '@/modules/productManagement/components/supplierInformationComponents.vue' |
|||
import productModelComponents from '@/modules/productManagement/components/productModelComponents.vue' |
|||
//获取this |
|||
let { proxy } = getCurrentInstance() |
|||
const option = ref(null) |
|||
const data = ref(null) |
|||
let queryCondition = ref({}) |
|||
let formData = ref({}) |
|||
let moduleParam = reactive({ |
|||
pageType: 'addOrModify', |
|||
entityType: 'supplierProductModel' |
|||
}) |
|||
let pageInfo = reactive({ |
|||
// 页码 |
|||
pageNum: 1, |
|||
// 页码大小 |
|||
pageSize: 10 |
|||
}) |
|||
// 排序信息 |
|||
let sortInfo = reactive({ |
|||
sort_field: 'id', |
|||
sort_sortType: 'descending' |
|||
}) |
|||
let page = reactive({ |
|||
total: 0, |
|||
currentPage: 1, |
|||
pageSize: 10 |
|||
}) |
|||
|
|||
const MODULE_CODE = 'productManagement' |
|||
const ENTITY_TYPE = 'supplierProducts' |
|||
const pageCode = `${MODULE_CODE}:${ENTITY_TYPE}:` |
|||
const api = eval('proxy.$api.' + MODULE_CODE + '.' + ENTITY_TYPE) |
|||
|
|||
option.value = { |
|||
dialogWidth: '80%', //弹窗宽度 |
|||
searchMenuSpan: 6, //搜索按钮宽度 |
|||
addBtn: false, //隐藏新增按钮 |
|||
editBtn: false, //隐藏编辑按钮 |
|||
delBtn: false, //隐藏删除按钮 |
|||
column: [ |
|||
{ |
|||
label: '产品名称', |
|||
labelWidth: 120, |
|||
prop: 'productName', //sProductName |
|||
search: true, |
|||
searchLabelWidth: 120 |
|||
}, |
|||
{ |
|||
label: '产品标识(型号)', |
|||
labelWidth: 120, |
|||
prop: 'productIdentity', |
|||
search: true, |
|||
searchLabelWidth: 120 |
|||
}, |
|||
{ |
|||
label: '供应商名称', |
|||
labelWidth: 120, |
|||
prop: 'supplierName', |
|||
type: 'input', |
|||
hide: true, |
|||
searchLabelWidth: 120, |
|||
span: 12 |
|||
}, |
|||
{ |
|||
label: '产品价格', |
|||
prop: 'productPrice', |
|||
labelWidth: 120, |
|||
type: 'number', |
|||
precision: 2, |
|||
mim: 0 |
|||
}, |
|||
{ |
|||
label: '产品型号', |
|||
labelWidth: 120, |
|||
prop: 'modelId', |
|||
type: 'textarea', |
|||
hide: true, |
|||
minRows: 4 //文本最小行数 |
|||
}, |
|||
{ |
|||
label: '产品描述', |
|||
labelWidth: 120, |
|||
prop: 'modelDescription', |
|||
//editDisabled: true //编辑时禁用 |
|||
display: false //表单不展示该字段 |
|||
}, |
|||
{ |
|||
label: '信息来源', |
|||
labelWidth: 120, |
|||
prop: 'sourceInformation', |
|||
hide: true |
|||
}, |
|||
{ |
|||
label: '备注', |
|||
labelWidth: 120, |
|||
prop: 'remarks', |
|||
hide: true |
|||
} |
|||
] |
|||
} |
|||
data.value = [] |
|||
function rowSave(row, done, loading) { |
|||
api |
|||
.add(row) |
|||
.then((res) => { |
|||
done() |
|||
onLoad() |
|||
}) |
|||
.catch((err) => { |
|||
loading() |
|||
}) |
|||
} |
|||
function rowDel(row, index) { |
|||
api.remove(row.id) |
|||
onLoad() |
|||
} |
|||
function rowUpdate(row, index, done, loading) { |
|||
api |
|||
.modify(row) |
|||
.then((res) => { |
|||
done() |
|||
onLoad() |
|||
}) |
|||
.catch((err) => { |
|||
loading() |
|||
}) |
|||
} |
|||
function onLoad() { |
|||
pageInfo.pageNum = page.currentPage |
|||
const params = Object.assign(queryCondition.value, pageInfo, sortInfo) |
|||
api.page(params).then((res) => { |
|||
data.value = res.data.records |
|||
page.total = res.data.total |
|||
// res.data.total |
|||
}) |
|||
} |
|||
function rowDblclick(row, index) { |
|||
moduleParam.pageType = 'view' |
|||
proxy.$refs.crudRef.rowView(row) |
|||
} |
|||
//关闭表单页面 |
|||
function beforeCloseForm(done, type) { |
|||
done() |
|||
moduleParam.pageType = 'addOrModify' //还原默认值 |
|||
} |
|||
function searchChange(val, done) { |
|||
onLoad() |
|||
done() |
|||
} |
|||
</script> |
|||
<style> |
|||
.el-input, |
|||
.el-input-number { |
|||
width: 100% !important; |
|||
} |
|||
</style> |
Loading…
Reference in new issue