123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514 |
- import ImageUpload from '@/components/file-upload'
- export default {
- data() {
- return {
- // 事件组合
- optionsEvensGroup: [
- [
- [
- {
- name: '新建',
- isRole: true,
- click: this.addData
- }
- ],
- ],
- ],
- // 表格属性
- tableAttributes: {
- // 启用勾选列
- selectColumn: false
- },
- // 表格事件
- tableEvents: {
- 'selection-change': this.selectionChange
- },
- recordSelected: [],
- formDialog: false,
- formDialogType: 0, // 0:新增, 1:编辑, 2:查看, 3:审核
- formDialogTitles: ['新增', '编辑', '查看', '审核'],
- pageType: this?.$route?.name,
- }
- },
- computed: {
- moreParameters() {
- return [
- {
- name: '状态',
- key: 'flag',
- value: '',
- conditions: [
- {
- label: `全部`,
- value: ''
- },
- {
- label: `已保存`,
- value: "SAVE"
- },
- {
- label: `已审核`,
- value: "OK"
- }, {
- label: `失败`,
- value: "FAIL"
- },
- ]
- },
- ]
- },
- columns() {
- return [
- ...(() => {
- if (!!~['auxiliaryMaterialsStorage', 'returnAuxiliaryMaterials'].indexOf(this.pageType)) {
- return [{
- columnAttributes: {
- label: '大类名称',
- prop: 'parentCategoryId',
- },
- render: (h, { row, column, index }) => {
- return (
- row.isEditRow ?
- <el-select value={row[column.prop]} onInput={(val) => { row[column.prop] = val }} placeholder="请选择">
- {[].map((item, index_) => <el-option key={index_} label={item.label} value={item.value}></el-option>)}
- </el-select> :
- <div>{row[column.prop]}</div>
- )
- }
- }]
- }
- return []
- })(),
- ...(() => {
- if (!!~['auxiliaryMaterialsStorage', 'returnAuxiliaryMaterials'].indexOf(this.pageType)) {
- return [{
- columnAttributes: {
- label: '小类名称',
- prop: 'goodsCategoryId',
- },
- render: (h, { row, column, index }) => {
- return (
- row.isEditRow ?
- <el-select value={row[column.prop]} onInput={(val) => { row[column.prop] = val }} placeholder="请选择">
- {[].map((item, index_) => <el-option key={index_} label={item.label} value={item.value}></el-option>)}
- </el-select> :
- <div>{row[column.prop]}</div>
- )
- }
- }]
- }
- return []
- })(),
- ...(() => {
- if (!!~['auxiliaryMaterialsStorage', 'returnAuxiliaryMaterials'].indexOf(this.pageType)) {
- return [{
- columnAttributes: {
- label: '辅材名称',
- prop: 'avatar',
- },
- render: (h, { row, column, index }) => {
- return (
- row.isEditRow ?
- <el-select value={row[column.prop]} onInput={(val) => { row[column.prop] = val }} placeholder="请选择">
- {[].map((item, index_) => <el-option key={index_} label={item.label} value={item.value}></el-option>)}
- </el-select> :
- <div>{row[column.prop]}</div>
- )
- }
- }]
- }
- return []
- })(),
- ...(() => {
- if (!!~['partsStorage', 'partsReturn'].indexOf(this.pageType)) {
- return [{
- columnAttributes: {
- label: '配件名称',
- prop: 'avatar',
- },
- render: (h, { row, column, index }) => {
- return (
- row.isEditRow ?
- <el-select value={row[column.prop]} onInput={(val) => { row[column.prop] = val }} placeholder="请选择">
- {[].map((item, index_) => <el-option key={index_} label={item.label} value={item.value}></el-option>)}
- </el-select> :
- <div>{row[column.prop]}</div>
- )
- }
- }]
- }
- return []
- })(),
- ...(() => {
- if (!!~['auxiliaryMaterialsStorage', 'returnAuxiliaryMaterials', 'partsStorage', 'partsReturn'].indexOf(this.pageType)) {
- return [{
- columnAttributes: {
- label: '单位',
- prop: 'purchaseId',
- }
- }]
- }
- return []
- })(),
- ...(() => {
- if (!!~['auxiliaryMaterialsStorage', 'partsStorage'].indexOf(this.pageType)) {
- return [{
- columnAttributes: {
- label: '数量',
- prop: 'recQty',
- },
- render: (h, { row, column, index }) => {
- return (
- row.isEditRow ?
- <el-input type="number" value={row[column.prop]} onInput={(val) => { row[column.prop] = val }} placeholder="请选择">
- </el-input> :
- <div>{row[column.prop]}</div>
- )
- }
- }]
- }
- return []
- })(),
- ...(() => {
- if (!!~['returnAuxiliaryMaterials', 'partsReturn'].indexOf(this.pageType)) {
- return [{
- columnAttributes: {
- label: '退货数量',
- prop: 'retQty',
- },
- render: (h, { row, column, index }) => {
- return (
- row.isEditRow ?
- <el-input type="number" value={row[column.prop]} onInput={(val) => { row[column.prop] = val }} placeholder="请选择">
- </el-input> :
- <div>{row[column.prop]}</div>
- )
- }
- }]
- }
- return []
- })(),
- ...(() => {
- if (!!~['returnAuxiliaryMaterials', 'partsReturn'].indexOf(this.pageType)) {
- return [{
- columnAttributes: {
- label: '退款金额',
- prop: 'retValue',
- },
- render: (h, { row, column, index }) => {
- return (
- row.isEditRow ?
- <el-input type="number" value={row[column.prop]} onInput={(val) => { row[column.prop] = val }} placeholder="请选择">
- </el-input> :
- <div>{row[column.prop]}</div>
- )
- }
- }]
- }
- return []
- })(),
- ...(() => {
- if (!!~['auxiliaryMaterialsStorage', 'returnAuxiliaryMaterials'].indexOf(this.pageType)) {
- return [{
- columnAttributes: {
- label: '商品代码',
- prop: '',
- }
- }]
- }
- return []
- })(),
- ...(() => {
- if (!!~['auxiliaryMaterialsStorage', 'returnAuxiliaryMaterials'].indexOf(this.pageType)) {
- return [{
- columnAttributes: {
- label: '规格型号',
- prop: 'goodsSpecification',
- }
- }]
- }
- return []
- })(),
- ...(() => {
- if (!!~['partsStorage', 'partsReturn'].indexOf(this.pageType)) {
- return [{
- columnAttributes: {
- label: '配件编码',
- prop: '',
- }
- }]
- }
- return []
- })(),
- ...(() => {
- if (!!~['partsStorage', 'partsReturn'].indexOf(this.pageType)) {
- return [{
- columnAttributes: {
- label: '适用品牌',
- prop: '',
- }
- }]
- }
- return []
- })(),
- ...(() => {
- if (!!~['partsStorage', 'partsReturn'].indexOf(this.pageType)) {
- return [{
- columnAttributes: {
- label: '适用产品大类',
- prop: '',
- }
- }]
- }
- return []
- })(),
- ...(() => {
- if (!!~['returnAuxiliaryMaterials', 'partsReturn'].indexOf(this.pageType)) {
- return [{
- columnAttributes: {
- label: '采购数量',
- prop: '',
- }
- }]
- }
- return []
- })(),
- ...(() => {
- if (!!~['auxiliaryMaterialsStorage', 'returnAuxiliaryMaterials', 'partsStorage', 'partsReturn'].indexOf(this.pageType)) {
- return [{
- columnAttributes: {
- label: '采购价格',
- prop: '',
- }
- }]
- }
- return []
- })(),
- ...(() => {
- if (!!~['auxiliaryMaterialsStorage', 'returnAuxiliaryMaterials', 'partsStorage', 'partsReturn'].indexOf(this.pageType)) {
- return [{
- columnAttributes: {
- label: '采购金额',
- prop: '',
- }
- }]
- }
- return []
- })(),
- ...(() => {
- if (!!~['auxiliaryMaterialsStorage', 'returnAuxiliaryMaterials', 'partsReturn'].indexOf(this.pageType)) {
- return [{
- columnAttributes: {
- label: '库存数量',
- prop: '',
- }
- }]
- }
- return []
- })(),
- ...(() => {
- if (!!~[0, 1].indexOf(this.formDialogType)) {
- return [{
- columnAttributes: {
- label: '操作',
- prop: '',
- },
- render: (h, { row, column, index }) => {
- return (
- <div class='operation-btns'>
- <el-button type="text" onClick={() => {
- this.formData.items.map((item, index_) => {
- if (index_ == index) {
- item.isEditRow = true
- } else {
- item.isEditRow = false
- }
- })
- }}>编辑</el-button>
- <el-button type="text" onClick={() => {
- this.formData.items.splice(index, 1)
- }}>删除</el-button>
- </div>
- )
- }
- }]
- }
- return []
- })(),
- ]
- },
- formItems1() {
- return [
- {
- md: 24,
- isShow: true,
- name: 'slot-component',
- formItemAttributes: {
- label: '',
- prop: '',
- 'label-width': '0px'
- },
- render: (h, { props, onInput }) => {
- var { value } = props
- return (
- <div>
- <el-descriptions border title="" column={4} colon={false} labelStyle={{ width: '8%' }} contentStyle={{ width: '17%' }}>
- <el-descriptions-item label="单据状态">
- {({ SAVE: "保存", OK: "通过", FAIL: "失败" })[this.formData.flag]}
- </el-descriptions-item>
- <el-descriptions-item label="单据编号">
- {(!!~['auxiliaryMaterialsStorage', 'partsStorage'].indexOf(this.pageType) ? this.formData.purchaseId : this.formData.purchaseRetId) || ''}
- </el-descriptions-item>
- <el-descriptions-item label="所属商户" contentStyle={{ width: '42%' }}>
- {this.formData.companyWechatName}
- </el-descriptions-item>
- </el-descriptions>
- <el-descriptions border title="" column={2} colon={false} labelStyle={{ width: '8%' }} contentStyle={{ width: '42%' }} style="margin-top:-1px">
- <el-descriptions-item label="网点名称">
- {this.formData.websitName}
- </el-descriptions-item>
- <el-descriptions-item label="供应商名称">
- {this.formData.venderName}
- </el-descriptions-item>
- </el-descriptions>
- {
- !!~['returnAuxiliaryMaterials', 'partsReturn'].indexOf(this.pageType) ?
- <el-descriptions border title="" column={4} colon={false} labelStyle={{ width: '8%' }} contentStyle={{ width: '17%' }} style="margin-top:-1px">
- <el-descriptions-item label="采购入库单号" contentStyle={{ width: '42%' }}>
- {this.formData.purchaseId}
- </el-descriptions-item>
- <el-descriptions-item label="退货数量">
- {this.formData.purchaseId}
- </el-descriptions-item>
- <el-descriptions-item label="退款金额">
- {this.formData.purchaseId}
- </el-descriptions-item>
- </el-descriptions> : null
- }
- <el-descriptions border title="" column={4} colon={false} labelStyle={{ width: '8%' }} contentStyle={{ width: '17%' }} style="margin-top:-1px">
- <el-descriptions-item label="制单人">
- {this.formData.createBy}
- </el-descriptions-item>
- <el-descriptions-item label="制单时间">
- {this.formData.createTime}
- </el-descriptions-item>
- <el-descriptions-item label="审核人">
- {this.formData.confirmBy}
- </el-descriptions-item>
- <el-descriptions-item label="审核时间">
- {this.formData.confirmTime}
- </el-descriptions-item>
- </el-descriptions>
- <el-descriptions border title="" column={4} colon={false} labelStyle={{ width: '8%' }} contentStyle={{ width: '17%' }} style="margin-top:-1px">
- <el-descriptions-item label="附件">
- <ImageUpload fileList={this.formData.imageUrl} uid="imgSrc666_materials_drawing_images" limit={1} isEdit={this.formDialogType < 2} />
- </el-descriptions-item>
- <el-descriptions-item label="备注" contentStyle={{ width: '67%' }}>
- <el-input
- type="textarea"
- placeholder="请输入内容"
- value={this.formData.remark}
- onInput={(val) => { this.formData.remark = val }}
- maxlength="200"
- show-word-limit
- autosize={{ minRows: 6, maxRows: 8 }}
- >
- </el-input>
- </el-descriptions-item>
- </el-descriptions>
- </div>
- )
- }
- },]
- },
- formItems2() {
- return [
- {
- md: 24,
- isShow: true,
- name: 'slot-component',
- formItemAttributes: {
- label: '',
- prop: '',
- 'label-width': '0px'
- },
- render: (h, { props, onInput }) => {
- var { value } = props
- return (
- <div>
- {!!~[0, 1].indexOf(this.formDialogType) ? <div style="margin-bottom:8px">
- <el-button onClick={() => {
- this.formData.items.push({
- "brand": "",
- "companyWechatId": "",
- "cost": "",
- "costValue": "",
- "goodsCategoryId": "",
- "goodsCategoryName": "",
- "goodsId": "",
- "goodsName": "",
- "goodsSpecification": "",
- "goodsStockUnit": "",
- "goodsType": "",
- "note": "",
- "parentCategoryId": "",
- "parentCategoryName": "",
- "productCategory": "",
- "purchaseId": "",
- "recQty": "",
- "retQty": "",
- "stockQty": "",
- "websitId": "",
- "websitName": ""
- })
- // if (this.pageType == "auxiliaryMaterialsStorage") {
- // } else if (this.pageType == "returnAuxiliaryMaterials") {
- // } else if (this.pageType == "partsStorage") {
- // } else if (this.pageType == "partsReturn") {
- // }
- }}>添加</el-button>
- </div> : null}
- <zj-table
- columns={this.columns}
- tableData={this.formData.items}
- tableAttributes={{
- size: 'mini',
- border: true,
- }} />
- </div>
- )
- }
- },]
- }
- },
- methods: {
- // 表格列解析渲染数据更改
- columnParsing(item, defaultData) {
- return defaultData
- },
- // 监听勾选变化
- selectionChange(data) {
- this.recordSelected = data
- },
- // 打开
- openForm() {
- {/* Promise.all([
-
- ]).then(([res1]) => {
-
- }) */}
- this.formDialog = true
- },
- // 添加
- addData() {
- this.formDialogType = 0
- this.openForm()
- },
- // 关闭弹窗
- formCancel() {
- this.$refs.formRef.$refs.inlineForm.clearValidate()
- this.$data.formData = this.$options.data().formData
- this.formDialog = false
- },
- },
- }
|