|
@@ -67,8 +67,8 @@
|
|
|
</el-upload>
|
|
|
</el-form-item>
|
|
|
<div class="TranslatorBase-form-btn">
|
|
|
- <el-button type="primary" @click="submitForm('ruleForm')">立即创建</el-button>
|
|
|
- <el-button @click="resetForm('ruleForm')">重置</el-button>
|
|
|
+ <el-button type="primary" @click="submitForm('ruleForm')">保存</el-button>
|
|
|
+ <!-- <el-button @click="resetForm('ruleForm')">重置</el-button> -->
|
|
|
</div>
|
|
|
</el-form>
|
|
|
</el-dialog>
|
|
@@ -82,7 +82,7 @@
|
|
|
<el-input size="small" placeholder="请输入内容" v-model="input" clearable></el-input>
|
|
|
</div>
|
|
|
<div class="TranslatorBase-search-li">
|
|
|
- <el-button size="small" type="primary">查询</el-button>
|
|
|
+ <el-button size="small" @click="TranslatorLibraryItem()" type="primary">查询</el-button>
|
|
|
</div>
|
|
|
<!-- <div class="TranslatorBase-search-li">
|
|
|
<label>请输入内容</label>
|
|
@@ -98,16 +98,41 @@
|
|
|
</div> -->
|
|
|
</div>
|
|
|
<div>
|
|
|
- <el-button size="small" type="primary">新增</el-button>
|
|
|
+ <el-button size="small" @click="abbtlbBtn" type="primary">新增</el-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="TranslatorBase-table">
|
|
|
<el-table :data="tableData" border style="width: 100%">
|
|
|
- <el-table-column prop="date" label="日期" width="180">
|
|
|
+ <el-table-column prop="area" label="地区" width="180">
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="name" label="姓名" width="180">
|
|
|
+ <el-table-column prop="name" label="姓名" width="100">
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="address" label="地址">
|
|
|
+ <el-table-column prop="sex" label="性别" width="60">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="tel" label="电话" width="120">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="email" label="邮箱" width="120">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="wechatNo" label="微信" width="120">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="price" label="费用" width="120">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ {{townum(scope.row.price)}}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="currency" label="币种" width="100">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="createUserName" label="录入人" width="100">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="createTime" label="录入时间" width="180">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="remark" label="备注">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="操作" width="180">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-button @click="edittib(scope.$index, scope.row)" size="mini" >编辑</el-button>
|
|
|
+ <el-button size="mini" type="danger" >删除</el-button>
|
|
|
+ </template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
</div>
|
|
@@ -117,25 +142,10 @@
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
+ token:'',
|
|
|
input: '',
|
|
|
- tableData: [{
|
|
|
- date: '2016-05-02',
|
|
|
- name: '王小虎',
|
|
|
- address: '上海市普陀区金沙江路 1518 弄'
|
|
|
- }, {
|
|
|
- date: '2016-05-04',
|
|
|
- name: '王小虎',
|
|
|
- address: '上海市普陀区金沙江路 1517 弄'
|
|
|
- }, {
|
|
|
- date: '2016-05-01',
|
|
|
- name: '王小虎',
|
|
|
- address: '上海市普陀区金沙江路 1519 弄'
|
|
|
- }, {
|
|
|
- date: '2016-05-03',
|
|
|
- name: '王小虎',
|
|
|
- address: '上海市普陀区金沙江路 1516 弄'
|
|
|
- }],
|
|
|
- TranslatorBaseform: true,
|
|
|
+ tableData: [],
|
|
|
+ TranslatorBaseform: false,
|
|
|
Id:0,
|
|
|
ruleForm: {
|
|
|
area:'',
|
|
@@ -194,6 +204,11 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ //保留两位小数
|
|
|
+ townum(val){
|
|
|
+ val=Number(val);
|
|
|
+ return val.toFixed(2);
|
|
|
+ },
|
|
|
//获取基础数据
|
|
|
TranslatorLibraryInit(){
|
|
|
var that = this;
|
|
@@ -209,10 +224,108 @@ export default {
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
+ //表单初始化
|
|
|
+ formInitialization(){
|
|
|
+ this.Id=0;
|
|
|
+ this.ruleForm= {
|
|
|
+ area:'',
|
|
|
+ name: '',
|
|
|
+ sex:'',
|
|
|
+ photo:'',
|
|
|
+ tel:'',
|
|
|
+ email:'',
|
|
|
+ wechatNo:'',
|
|
|
+ otherSocialAccounts:'',
|
|
|
+ language:'',
|
|
|
+ price:0,
|
|
|
+ currency:'',
|
|
|
+ files:[],
|
|
|
+ remark:'',
|
|
|
+ region: '',
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //新增
|
|
|
+ abbtlbBtn(){
|
|
|
+ this.formInitialization();
|
|
|
+ this.$nextTick(() => { this.$refs['ruleForm'].clearValidate();});
|
|
|
+ this.TranslatorBaseform=true;
|
|
|
+ },
|
|
|
+ //编辑
|
|
|
+ edittib(index,val){
|
|
|
+ this.imageUrl=''
|
|
|
+ // this.$nextTick(() => { this.$refs['ruleForm'].clearValidate();});
|
|
|
+ this.TranslatorBaseform=true;
|
|
|
+ console.log(val);
|
|
|
+ var that = this;
|
|
|
+ var url = "/api/Resource/TranslatorLibraryInfo/id?id="+val.id
|
|
|
+ this.$axios({
|
|
|
+ method: 'get',
|
|
|
+ url: url,
|
|
|
+ }).then(function (res) {
|
|
|
+ if (res.data.code == 200) {
|
|
|
+ that.Id=res.data.data.id;
|
|
|
+ that.ruleForm.area=res.data.data.area;
|
|
|
+ that.ruleForm.name=res.data.data.name;
|
|
|
+ that.ruleForm.sex=res.data.data.sex==2?'女':'男';
|
|
|
+ that.ruleForm.tel=res.data.data.tel;
|
|
|
+ that.ruleForm.email=res.data.data.email;
|
|
|
+ that.ruleForm.wechatNo=res.data.data.wechatNo;
|
|
|
+ that.ruleForm.otherSocialAccounts=res.data.data.otherSocialAccounts;
|
|
|
+ that.ruleForm.language=res.data.data.language;
|
|
|
+ that.ruleForm.price=res.data.data.price;
|
|
|
+ that.ruleForm.currency=res.data.data.currency;
|
|
|
+ that.ruleForm.photo=that.base64ImgtoFile(res.data.data.photo);
|
|
|
+ console.log(that.ruleForm.photo);
|
|
|
+ that.imageUrl=res.data.data.photo;
|
|
|
+ // console.log();
|
|
|
+ } else {
|
|
|
+ that.$message.error(res.data.msg);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ //base转图片
|
|
|
+ base64ImgtoFile(dataurl, filename = 'file') {
|
|
|
+ if(dataurl==""){
|
|
|
+ return
|
|
|
+ }
|
|
|
+ let arr = dataurl.split(',')
|
|
|
+ let mime = arr[0].match(/:(.*?);/)[1]
|
|
|
+ let suffix = mime.split('/')[1]
|
|
|
+ let bstr = atob(arr[1])
|
|
|
+ let n = bstr.length
|
|
|
+ let u8arr = new Uint8Array(n)
|
|
|
+ while (n--) {
|
|
|
+ u8arr[n] = bstr.charCodeAt(n)
|
|
|
+ }
|
|
|
+ return new File([u8arr], `${filename}.${suffix}`, {
|
|
|
+ type: mime
|
|
|
+ })
|
|
|
+ },
|
|
|
+ //获取列表
|
|
|
+ TranslatorLibraryItem(){
|
|
|
+ var that = this;
|
|
|
+ var url = "/api/Resource/TranslatorLibraryItem"
|
|
|
+ this.$axios({
|
|
|
+ method: 'post',
|
|
|
+ url: url,
|
|
|
+ data:{
|
|
|
+ portType:1,
|
|
|
+ pageIndex: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ name: that.input
|
|
|
+ }
|
|
|
+ }).then(function (res) {
|
|
|
+ if (res.data.code == 200) {
|
|
|
+ that.tableData=res.data.data;
|
|
|
+ } else {
|
|
|
+ that.$message.error(res.data.msg);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
submitForm(formName) {
|
|
|
this.$refs[formName].validate((valid) => {
|
|
|
if (valid) {
|
|
|
- this.TranslatorLibraryOp(0)
|
|
|
+ this.TranslatorLibraryOp(1)
|
|
|
} else {
|
|
|
console.log('error submit!!');
|
|
|
return false;
|
|
@@ -274,11 +387,12 @@ export default {
|
|
|
method: 'post',
|
|
|
url: url,
|
|
|
headers: {
|
|
|
- Authorization: 'Bearer '
|
|
|
+ Authorization: 'Bearer '+that.token,
|
|
|
+ 'Content-Type':'multipart/form-data'
|
|
|
},
|
|
|
data:{
|
|
|
portType:1,
|
|
|
- opStatus:opStatus,
|
|
|
+ status:opStatus,
|
|
|
id:that.Id,
|
|
|
area:that.ruleForm.area,
|
|
|
name:that.ruleForm.name,
|
|
@@ -313,7 +427,9 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
mounted(){
|
|
|
+ this.token = JSON.parse(localStorage.getItem('userinif')).token;
|
|
|
this.TranslatorLibraryInit();
|
|
|
+ this.TranslatorLibraryItem();
|
|
|
}
|
|
|
}
|
|
|
</script>
|