|
|
@@ -1,42 +1,76 @@
|
|
|
<template>
|
|
|
- <u-popup :show="show" @close="cancel" :closeable="true">
|
|
|
+ <u-popup :show="show" @close="cancel" :closeable="false">
|
|
|
<view style="width: 750rpx;">
|
|
|
- <u-cell-group>
|
|
|
- <u-cell title="编码分类">
|
|
|
- <u--input slot="value" placeholder="请选择" border="surround" v-model="form.codeTypeName"
|
|
|
- @click.native="codeTypeOpen"></u--input>
|
|
|
- </u-cell>
|
|
|
- <u-cell title="编码方案">
|
|
|
+
|
|
|
+ <u--form ref="uForm" labelPosition="left" :model="form" labelWidth="180" labelAlign="left" :rules="rules">
|
|
|
+
|
|
|
+ <u-form-item label="文档位置" prop="directoryName">
|
|
|
+ <u--input placeholder="请选择" border="surround" v-model="form.directoryName"
|
|
|
+ @click.native="directoryIdOpen">
|
|
|
+ </u--input>
|
|
|
+ </u-form-item>
|
|
|
+
|
|
|
+ <u-form-item label="编码分类" prop="codeTypeName">
|
|
|
+ <u--input placeholder="请选择" border="surround" v-model="form.codeTypeName"
|
|
|
+ @click.native="codeTypeOpen">
|
|
|
+ </u--input>
|
|
|
+ </u-form-item>
|
|
|
+
|
|
|
+
|
|
|
+ <u-form-item label="编码方案" prop="businessCodeId">
|
|
|
+ <zxz-uni-data-select :localdata="options" v-model="form.businessCodeId" dataValue='id'
|
|
|
+ dataKey="name"></zxz-uni-data-select>
|
|
|
+ </u-form-item>
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ <!-- <u-cell title="编码方案">
|
|
|
<uni-data-picker :map="{text:'name',value:'id'}" v-model="form.businessCodeId" slot="value"
|
|
|
placeholder="请选择" :localdata="options">
|
|
|
</uni-data-picker>
|
|
|
- </u-cell>
|
|
|
- <u-cell title="文档类型">
|
|
|
- <uni-data-picker v-model="form.type" slot="value" placeholder="请选择" :localdata="doc_type">
|
|
|
+ </u-cell> -->
|
|
|
+
|
|
|
+
|
|
|
+ <!-- <u-cell title="文档类型">
|
|
|
+ <uni-data-picker v-model="form.type" slot="value" placeholder="请选择" :localdata="doc_type">
|
|
|
</uni-data-picker>
|
|
|
- </u-cell>
|
|
|
- <u-cell title="文档">
|
|
|
- <fileSelector class="fileList" slot="value"
|
|
|
- @filesChanged="onFilesChanged" />
|
|
|
+
|
|
|
|
|
|
+ </u-cell> -->
|
|
|
+
|
|
|
+
|
|
|
+ <u-form-item label="文档类型" prop="type">
|
|
|
+ <zxz-uni-data-select :localdata="doc_type" v-model="form.type" dataValue='value'
|
|
|
+ dataKey="text"></zxz-uni-data-select>
|
|
|
+ </u-form-item>
|
|
|
+
|
|
|
+
|
|
|
+ <!-- <u-form-item :label="文档类型" prop="form.type">
|
|
|
+ <zxz-uni-data-select :localdata="doc_type" v-model="form.type" dataValue='value'
|
|
|
+ dataKey="text"></zxz-uni-data-select>
|
|
|
+ </u-form-item> -->
|
|
|
+
|
|
|
+ <u-cell title="文档">
|
|
|
+ <fileSelector class="fileList" slot="value" @filesChanged="onFilesChanged" />
|
|
|
</u-cell>
|
|
|
- <u-cell title="文档位置">
|
|
|
- <u--input slot="value" placeholder="请选择" border="surround" v-model="form.directoryName"
|
|
|
- @click.native="directoryIdOpen">
|
|
|
- </u--input>
|
|
|
- </u-cell>
|
|
|
- </u-cell-group>
|
|
|
- <view class="btn">
|
|
|
- <u-button type="primary" @click="cancel" text="返回"></u-button>
|
|
|
- <u-button @click="save" text="保存"></u-button>
|
|
|
- </view>
|
|
|
+
|
|
|
+
|
|
|
+ <view class="btn">
|
|
|
+ <u-button type="primary" @click="cancel" text="返回"></u-button>
|
|
|
+ <u-button @click="save" text="保存"></u-button>
|
|
|
+ </view>
|
|
|
+
|
|
|
+ </u--form>
|
|
|
|
|
|
|
|
|
</view>
|
|
|
- <ba-tree-picker ref="codeTypeRef" key="verify" :multiple="false" @select-change="codeTypeBack" title="选择编码分类"
|
|
|
+ <ba-tree-picker ref="directoryIdRef" :multiple="false" title="选择文档位置" :localdata="folderList" valueKey="id"
|
|
|
+ textKey="name" childrenKey='sonDirectoryList' @select-row="directoryIdBack" />
|
|
|
+
|
|
|
+ <ba-tree-picker ref="codeTypeRef" key="verify" :multiple="false" @select-row="codeTypeBack" title="选择编码分类"
|
|
|
:localdata="list" valueKey="id" textKey="name" childrenKey='sonDirectoryList' />
|
|
|
- <ba-tree-picker ref="directoryIdRef" :multiple="false" @select-change="directoryIdBack" title="选择文档位置"
|
|
|
- :localdata="folderList" valueKey="id" textKey="name" childrenKey='sonDirectoryList' />
|
|
|
+
|
|
|
</u-popup>
|
|
|
</template>
|
|
|
|
|
|
@@ -88,7 +122,23 @@
|
|
|
list: [],
|
|
|
options: [],
|
|
|
show: false,
|
|
|
- doc_type: []
|
|
|
+ doc_type: [],
|
|
|
+ rules: {
|
|
|
+ 'directoryName': {
|
|
|
+ type: 'string',
|
|
|
+ required: true,
|
|
|
+ message: '请选择文档位置',
|
|
|
+ trigger: ['blur', 'change']
|
|
|
+ },
|
|
|
+ 'businessCodeId': {
|
|
|
+ type: 'string',
|
|
|
+ required: true,
|
|
|
+ message: '请选择编码方案',
|
|
|
+ trigger: ['blur', 'change']
|
|
|
+ },
|
|
|
+ },
|
|
|
+ nodeData: {}
|
|
|
+
|
|
|
};
|
|
|
},
|
|
|
|
|
|
@@ -133,15 +183,42 @@
|
|
|
codeTypeOpen() {
|
|
|
this.$refs.codeTypeRef._show()
|
|
|
},
|
|
|
+ async directoryIdBack(data) {
|
|
|
+ console.log(data);
|
|
|
+ this.nodeData.id = data?.id
|
|
|
+ this.nodeData.parentId = data.parentId == -1 ? '' : data.parentId
|
|
|
+
|
|
|
+ this.form.directoryName = data.name
|
|
|
+ this.form.directoryId = data.id
|
|
|
+
|
|
|
+ this.options = this.nodeData.id ? await listCode(this.nodeData) : [];
|
|
|
+
|
|
|
+ if (this.options.length > 0) {
|
|
|
+ this.form.businessCodeId = this.options[0].id;
|
|
|
+ this.form.codeType = this.options[0].parentId;
|
|
|
+ } else {
|
|
|
+ this.form.businessCodeId = '';
|
|
|
+ }
|
|
|
+
|
|
|
+ // this.form.directoryName = name
|
|
|
+ // this.form.directoryId = data[0]
|
|
|
+
|
|
|
+ },
|
|
|
async codeTypeBack(data, name) {
|
|
|
+ console.log(data);
|
|
|
+
|
|
|
let list = await listParentId({
|
|
|
pageNum: 1,
|
|
|
size: 100,
|
|
|
- parentId: data[0]
|
|
|
+ parentId: data.id,
|
|
|
+ objId: this.nodeData?.id,
|
|
|
+ objParentId: this.nodeData?.parentId
|
|
|
});
|
|
|
- this.form.codeTypeName = name
|
|
|
- this.form.codeType = data[0]
|
|
|
+ // this.form.codeTypeName = data.name
|
|
|
+ // this.form.codeType = data
|
|
|
this.options = list.list.filter((item) => item.type == 2);
|
|
|
+ this.form.codeType = data.id;
|
|
|
+ this.form.codeTypeName = data.name;
|
|
|
this.form.businessCodeId = '';
|
|
|
},
|
|
|
uploadFile(list) {
|
|
|
@@ -171,38 +248,55 @@
|
|
|
directoryIdOpen() {
|
|
|
this.$refs.directoryIdRef._show()
|
|
|
},
|
|
|
- directoryIdBack(data, name) {
|
|
|
-
|
|
|
- this.form.directoryName = name
|
|
|
- this.form.directoryId = data[0]
|
|
|
-
|
|
|
- },
|
|
|
|
|
|
// 当文件发生变化时触发
|
|
|
onFilesChanged(fileList) {
|
|
|
+ console.log(fileList);
|
|
|
this.files = fileList
|
|
|
+ this.form.name = fileList[0].name.replace(/\.[^/.]+$/, '');
|
|
|
+
|
|
|
// console.log('文件列表:', fileList)
|
|
|
},
|
|
|
/* 保存编辑 */
|
|
|
async save() {
|
|
|
- uni.showLoading({
|
|
|
- title: '加载中'
|
|
|
- })
|
|
|
+ console.log(this.form);
|
|
|
+ let _this = this
|
|
|
+
|
|
|
+ this.$refs.uForm.validate().then(async res => {
|
|
|
|
|
|
- this.form.storagePath = await this.uploadFile(this.files)
|
|
|
- fileSaveAPI(this.form)
|
|
|
- .then((msg) => {
|
|
|
- uni.hideLoading()
|
|
|
- console.log(msg,'msg')
|
|
|
-
|
|
|
- this.$emit('success', msg);
|
|
|
- this.cancel()
|
|
|
+ uni.showLoading({
|
|
|
+ title: '加载中'
|
|
|
})
|
|
|
- .catch((e) => {
|
|
|
- uni.hideLoading()
|
|
|
- this.cancel()
|
|
|
-
|
|
|
- });
|
|
|
+
|
|
|
+ _this.form.storagePath = await _this.uploadFile(_this.files)
|
|
|
+ let params = {
|
|
|
+ ..._this.form
|
|
|
+ }
|
|
|
+ delete params.codeTypeName
|
|
|
+ delete params.directoryName
|
|
|
+
|
|
|
+ fileSaveAPI(_this.form)
|
|
|
+ .then((msg) => {
|
|
|
+ uni.hideLoading()
|
|
|
+ console.log(msg, 'msg')
|
|
|
+
|
|
|
+ _this.$emit('success', msg);
|
|
|
+ _this.cancel()
|
|
|
+ })
|
|
|
+ .catch((e) => {
|
|
|
+ uni.hideLoading()
|
|
|
+ _this.cancel()
|
|
|
+
|
|
|
+ });
|
|
|
+
|
|
|
+ }).catch(errors => {
|
|
|
+ uni.$u.toast('校验失败')
|
|
|
+ })
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
},
|
|
|
|
|
|
cancel() {
|
|
|
@@ -253,13 +347,23 @@
|
|
|
margin-bottom: 8rpx;
|
|
|
}
|
|
|
}
|
|
|
- .btn{
|
|
|
+
|
|
|
+ .btn {
|
|
|
margin-top: 16rpx;
|
|
|
margin-bottom: 10rpx;
|
|
|
display: flex;
|
|
|
- uni-bottom{
|
|
|
+
|
|
|
+ uni-bottom {
|
|
|
width: 160rpx;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ // /deep/.u-form-item__body {
|
|
|
+ // padding: 16rpx 0
|
|
|
+ // }
|
|
|
+
|
|
|
+ /deep/ .u-form {
|
|
|
+ padding: 30rpx;
|
|
|
}
|
|
|
</style>
|